akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//Write From this Line

int main()
{
	string s;
	cin >> s;
	int ans = 0;
	rep(i,s.size()){
		ans += s[i] - '0';
	}
	cout << ans << endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  vector<pair<ll, ll>> ps(n);
  for (int i = 0; i < n; i++) cin >> ps[i].first >> ps[i].second;
  sort(ps.begin(), ps.end(), [](const pair<ll, ll> &l, const pair<ll, ll> &r) {
    return l.second < r.second;
  });
  ll now = 0;
  bool ok = true;
  for (int i = 0; i < n; i++) {
    now += ps[i].first;
    if (now > ps[i].second) {
      ok = false;
    }
  }
  if (ok) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 3456
#include<bits/stdc++.h>

using namespace std;

#define MP make_pair
#define F first
#define S second

constexpr pair<int, int> all = MP(-1e9, 1e9);
int N, K;
pair<int, int> val[100001];
vector<int> adj[100001];
int ans[100001];

bool both(int a, int b) {
    bool b1 = (a%2==0);
    bool b2 = (b%2==0);
    return !(b1^b2);
}

pair<int, int> dfs(int u, int p) {
    for(auto v:adj[u]) if( v != p ) {
        pair<int, int> tmp = dfs(v, u);
        if( tmp == all ) continue;
        if( val[u] == all ) {
            val[u].F = tmp.F-1;
            val[u].S = tmp.S+1;
            continue;
        }
        if( val[u].F-tmp.S>1 || tmp.F-val[u].S>1 || both(tmp.F, val[u].F) ) {
            puts("No");
            exit(0);
        } else {
            val[u].F = max(val[u].F, tmp.F-1);
            val[u].S = min(val[u].S, tmp.S+1);
        }
    }
    return val[u];
}
void dfs2(int u, int p, int vl) {
    ans[u] = vl;
    for(auto v:adj[u]) if( v != p ) {
        if( vl+1 <= val[v].S && vl+1 >= val[v].F )
            dfs2(v, u, vl+1);
        else
            dfs2(v, u, vl-1);
    }
}
int main() {
    scanf("%d", &N);
    fill_n(val, N, all);
    for(int i = 0; i<N-1; ++i) {
        int u, v; scanf("%d %d", &u, &v); --u; --v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    scanf("%d", &K);
    for(int i = 0; i<K; ++i) {
        int v, p; scanf("%d %d", &v, &p); --v;
        val[v].F = val[v].S = p;
    }
    dfs(0, -1);
    //for(int i = 0; i<N; ++i) cerr << i << " " << val[i].F << " " << val[i].S << endl;
    puts("Yes");
    dfs2(0, -1, val[0].F);
    for(int i = 0; i<N; ++i) printf("%d\n", ans[i]);
}


Measured memory_bytes: 15360
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <iostream>
#include <cmath>
#define maxn 1009
using namespace std;
double xs,ys,xt,yt;
double X[maxn],Y[maxn],R[maxn];
int n;
double G[maxn][maxn];
double DIS(double x1,double y1,double x2,double y2){
    return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}
double d[maxn];
priority_queue<pair<double,int> >Q;
bool done[maxn];
void Dijkstra(int s){
    for(int i=1;i<=n;i++)
        d[i]=1e18;
    d[s]=0;
    Q.push(make_pair(0,s));
    while(!Q.empty()){
        int u=Q.top().second;
        Q.pop();
        if(done[u])
            continue;
        done[u]=1;
        for(int i=1;i<=n;i++){
            if(d[i]>d[u]+G[i][u]){
                d[i]=d[u]+G[i][u];
                Q.push(make_pair(-d[i],i));
            }
        }
    }
}
int main(){
    cin>>xs>>ys>>xt>>yt;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>X[i]>>Y[i]>>R[i];
    }
    for(int i=1;i<=n;i++){
        for(int j=i+1;j<=n;j++){
            double dis_o=DIS(X[i],Y[i],X[j],Y[j]);
            G[i][j]=G[j][i]=max(0.0,dis_o-R[i]-R[j]);
        }
    }
    for(int i=1;i<=n;i++){
        double dis_o=DIS(xs,ys,X[i],Y[i]);
        G[n+1][i]=G[i][n+1]=max(0.0,dis_o-R[i]);
    }
    for(int i=1;i<=n;i++){
        double dis_o=DIS(xt,yt,X[i],Y[i]);
        G[n+2][i]=G[i][n+2]=max(0.0,dis_o-R[i]);
    }
    G[n+1][n+2]=G[n+2][n+1]=DIS(xs,ys,xt,yt);
    n+=2;
    Dijkstra(n-1);
    printf("%.15f\n",d[n]);
    //system("pause");
    return 0;
}

Measured memory_bytes: 12400
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <stdbool.h>
int main(){
    int a,b;
    scanf("%d %d",&a,&b);
    if (a%2==1 && b%2==1){
        printf("%s","Yes");
    }
    else{
        printf("%s","No");
    }
    return 0;
}

Measured memory_bytes: 1728
#include <bits/stdc++.h>

int main(){
    int n, a;
    scanf("%d", &n);
    int v[n];
    
    for(int i=1; i<=n; i++){
        scanf("%d", &a);
        v[a-1] = i;}
    
    for(int i=0; i<n; i++){
        if(i) printf(" ");
        printf("%d", v[i]);}
    printf("\n");

    return 0;}

Measured memory_bytes: 1152
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
X = Counter([4 if a % 4 == 0 else (2 if a % 2 == 0 else 1) for a in A])
for x in (1, 2, 4):
    if x not in X:
        X[x] = 0
if X[4] + 1 < X[1]:
    print("No")
    exit()
if X[4] + 1 == X[1] and X[2] != 0:
    print("No")
    exit()
print("Yes")


Measured memory_bytes: 14636
import sys

n = int(input())

a = list(map(int, input().split()))

cnt = 0
ave = sum(a)/2

for i in range(n):
    cnt += a[i]
    if cnt == ave:
        print(0)
        sys.exit()
    
    elif cnt > ave:
        x = ave -cnt +a[i]
        if x >= cnt -ave:
            x = cnt -ave
        break

print(int(x*2))

Measured memory_bytes: 26060
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
 
public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		String b = sc.next();
		char ans = 0;
		switch (b) {
		case "A":
			ans = 'T';
			break;
		case "C":
			ans = 'G';
			break;
		case "G":
			ans = 'C';
			break;
		case "T":
			ans = 'A';
			break;
		}
		System.out.println(ans);
	}
}
 
class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
 
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
 
    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }
 
    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }
 
    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }
 
    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
 
    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
 
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }
 
    public double nextDouble() {
        return Double.parseDouble(next());
    }
}

Measured memory_bytes: 21332
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	vl a(5);
	FOR(i,0,5) cin >> a[i];
	FOR(i,0,5) if (a[i] == 0) cout << i+1 << endl;


}



Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
    string s, t;
    cin >> s >> t;
    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    reverse(t.begin(), t.end());
    if (s < t) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T, class T2> void smin(T& a, T2 val) {if (a > val) a = val;}template<class T, class T2> void smax(T& a, T2 val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n;

int M(char c){
   return c - 'A';
}

char RM(int x){
   return 'A' + x;
}

int32_t main(){_
   
   cin>>n;
   vector<int> a(3);
   for(auto &i: a){
      cin >> i;
   }

   vector<int> tmp = a;
   vector<string> ops;
   vector<char> v;
   for (int i = 0; i < n; ++i)
   {
      string s;
      cin >> s;
      ops.push_back(s);
   }

   for (int i = 0; i < n; ++i)
   {
      string s = ops[i];
      int t1 = M(s[0]);
      int t2 = M(s[1]);
      int mi = min(a[t1], a[t2]);

      if (i + 1 < n and a[t1] == 1 and a[t2] == 1 and a[3 - (t1 + t2)] == 0){
         string t = ops[i+1];
         int t1_ = M(t[0]);
         int t2_ = M(t[1]);
         if (t1 == t1_ and t2 == t2_){
            a[t1]++, a[t2]--;
            a[t1]--, a[t2]++;
            v.push_back(RM(t1));
            v.push_back(RM(t2));
            ++i;
         }
         else if (t1 == t1_ or t1 == t2_){
            a[t1]++, a[t2]--;            
            v.push_back(RM(t1));
         }
         else if (t2 == t1_ or t2 == t2_){
            a[t2]++, a[t1]--;         
            v.push_back(RM(t2));            
         }
         else{
            assert(0);
         }
      }
      else{
         if (a[t1] == mi){
            a[t1]++;
            a[t2]--;
            v.push_back(RM(t1));
         }
         else{
            a[t1]--;
            a[t2]++;
            v.push_back(RM(t2));
         }
      }
      if (*min_element(a.begin(), a.end()) < 0){
         cout<<"No";
         exit(0);
      }
   }

   if (*min_element(a.begin(), a.end()) >= 0){
      cout<<"Yes"<<endl;

      for(auto it: v){
         cout<<it<<endl;
      }

      exit(0);
   }
   cout<<"No";   

   return 0;
}


Measured memory_bytes: 7432
#include <iostream>
#include <stdlib.h>
#define max_baggageNum 100000
#define max_weight 10000

using namespace std;

bool search(int* a, int* last, int* target, int sum)
{
    if (sum == *target) {
	return true;
    }
    if (a == last) {
	return false;
    }

    bool res = search(a + 1, last, target, sum) || search(a + 1, last, target, sum + *a);
    return res;
}
int main()
{
    int n = 0;
    int q = 0;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++) {
	cin >> a[i];
    }
    cin >> q;
    for (int i = 0; i < q; i++) {
	int tmp = 0;
	cin >> tmp;
	if (search(a, &a[n], &tmp, 0)) {
		cout<<"yes"<<endl;
	}
	else {
		cout<<"no"<<endl;
	}
    }

    return 0;
}

Measured memory_bytes: 1156
//D_Teleporter.cpp
#include<bits/stdc++.h>
using namespace std;

#define ll long long int
#define mp make_pair
#define pb push_back
#define ppi pair<ll,ll>
#define fi first
#define si second
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define F(a,n) for(int i=0;i<n;i++){cin>>a[i];}
#define F1(a,n) for(int i=1;i<=n;i++){cin>>a[i];}
#define P(a,n) for(int i=0;i<n;i++){cout<<a[i]<<' ';}cout<<endl;
#define P1(a,n) for(int i=1;i<=n;i++){cout<<a[i]<<' ';}cout<<endl;
#define NF(a,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cin>>a[i][j];}}
#define NF1(a,n,m) for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cin>>a[i][j];}}
#define PNF(a,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
#define PNF1(a,n,m) for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
#define AS 200005
#define mod 1000000007

int main(){
	
	fastIO

	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif

	ll n,k;
	
	cin>>n>>k;

	int a[n];

	for(int i=0; i<n; i++){
		cin>>a[i];
		a[i]--;
	}


	vector<ll> Next(AS);
	unordered_map<ll,ll> m;

	m[0] = 0;

	int ith = 1;
	int current = 0;
	int start, end; 


	for(int i=0; i<=n; i++){

		Next[ith] = a[current];

		if(m.count(Next[ith])){

			start =  m[Next[ith]];
			end = ith;
			break;	
		}

		else {
			m[Next[ith]] = ith; 
		}
		ith++;
		current = a[current];
	}


	if(k < end){
		cout<<Next[k]+1<<endl;
	}

	else
	{
		ll len = end-start;
		k -= start;
		k = k%len;
		cout<<Next[start + k]+1<<endl;
	}
	return 0;
}


Measured memory_bytes: 13728
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define p(x) cout << (x) << endl
#define FOR(i,r,n) for(ll i=(ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n); i>=r; i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) REP(i,0,n)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define pb push_back

const int inf = (int)1e9;
const ll INF = (ll)1e18;

// vectorの中身をcout << vs;で表示
template <class T>
ostream &operator<<(ostream &o, const vector<T> &v)
{
    o << "{";
    for (int i = 0; i < (int)v.size(); i++) o << (i > 0 ? ", " : "") << v[i];
    o << "}";
    return o;
}

ll gcd (ll a, ll b) {
	while (b > 0) {
		ll t = a % b;
		a = b, b = t;
	}
	return a;
}

ll lcm (ll a, ll b) {
	return (a / gcd (a, b)) * b;
}

bool is_prime (ll n) {
		if (n < 2) return false;
		else if (n == 2) return true;
		else if (n % 2) return false;
		
		double sqrtn = sqrt(n);
		for (ll i = 0; i < sqrtn; i += 2) {
			if (n % i == 0) return false; 
		}
		return true;
}

ll n, k, cnt=0, ans=0;
string s,t;

// ==================== template ============================

int main(void) {
	cin.tie(0);
   	ios::sync_with_stdio(false);

	int d, n; cin >> d >> n;
	if (n == 100) n+=1;
	while(d--) {
		n*=100;
	}
	cout << n << endl;
//	if (d == 0) {
//		if (n == 100) p(n+1);
//		else p(n);
//	}
//	else {
//		if (n == 100) p((n+1) * pow(100, d));
//		else printf("%llu\n", n * pow(100, d));
//	}
}



Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CDivideTheProblems solver = new CDivideTheProblems();
        solver.solve(1, in, out);
        out.close();
    }

    static class CDivideTheProblems {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            if (n % 2 != 0)
                out.println(0);
            else {
                int[] a = new int[n];
                for (int i = 0; i < n; i++) {
                    a[i] = in.nextInt();
                }
                Arrays.sort(a);
                int mid = n / 2;
                if (a[mid] != a[mid - 1]) {
                    out.println(a[mid] - a[mid - 1]);
                } else {
                    out.println(0);
                }
            }
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 35752
#include <iostream>
using namespace std;
int f(int n, int *a){
    if(n == 0)return 0;
    if(*(a+n) != -1)return *(a+n);
    int r = n;
    for(int i=1;i<=n;i*=6){
        r = min(f(n-i, a) + 1, r);
    }
    for(int i=1;i<=n;i*=9){
        r = min(f(n-i, a) + 1, r);
    }
    return *(a+n) = r;
}
int main() {
    int n, a[100001];
    cin >> n;
    fill(a, a+n+1, -1);
    cout << f(n, a) << endl;
	return 0;
}

Measured memory_bytes: 5376
import itertools as it


N = int(input())
s = list(map(int, input().split()))
s.sort()
count = 0


c = it.combinations(s, 3)

for i in c:
    listed = list(i)
    if listed[0] == listed[1] or listed[1] == listed[2] or listed[2] == listed[0]:
        continue
    if (listed[0] + listed[1]) > listed[2]:
        count += 1

print(count)

Measured memory_bytes: 9084
#include<cmath>
#include<iostream>
#include<cstdio>
#include<iomanip>
#include<cctype>
using namespace std;



int main() {
	char s;
	while (1) {
		scanf("%c", &s);
		if (s == '\n')break;



		if (islower(s))s = toupper(s);
		else if (isupper(s))s = tolower(s);
		printf("%c",s);
		

		
	}
	cout << endl;

	return 0;
}




/*


#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cctype>
#include<climits>
#include<cmath>
#include<cstdio>
#include<deque>
#include<list>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

int main() {
	for (char c; (c = getchar()) != '\n';) {
		if (islower(c))
			cout << (char)toupper(c);
		else if (isupper(c))
			cout << (char)tolower(c);
		else
			cout << c;
	}
	cout << endl;
	return 0;
}





#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cctype>
#include<climits>
#include<cmath>
#include<cstdio>
#include<deque>
#include<list>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

int main() {
	string s; getline(cin, s);
	for (int i = 0; i < s.size(); i++) {
		if (islower(s[i]))
			cout << (char)toupper(s[i]);
		else if (isupper(s[i]))
			cout << (char)tolower(s[i]);
		else
			cout << s[i];
	}
	cout << endl;
	return 0;
}
*/

Measured memory_bytes: 1144
#include <iostream>
#include <string>
using namespace std;

typedef long long lint;
typedef unsigned long long ulint;

int main(){
    string I;
    cin >> I;
    int A[4];
    int op;

    for(int i=0;i<4;i++) A[i]=(int)(I[i]-'0');
    for(op=0;op<8;op++){
        int res=A[0];
        for(int i=1;i<=3;i++){
            if(op&(1<<(i-1))) res+=A[i];
            else res-=A[i];
        }
        if(res==7){
            cout << A[0];
            for(int i=1;i<=3;i++){
                if(op&(1<<(i-1))) cout << '+';
                else cout << '-';
                cout << A[i];
            }
            cout << "=7" << endl;
            return 0;
        }
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>

#include <algorithm>
#include <random>
#include <bitset>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <iostream>
#include <limits>
#include <numeric>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int N = 100010;

int n, k;
int dp[N];
int h[N];

int main() {
#ifdef LBT
  freopen("test.in", "r", stdin);
  int nol_cl = clock();
#endif

  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; ++i)
    scanf("%d", &h[i]);
  for (int i = 2; i <= n; ++i) {
    dp[i] = numeric_limits<int>::max();
    for (int j = 1; j <= min(i - 1, k); ++j)
      dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
  }
  printf("%d\n", dp[n]);

#ifdef LBT
  LOG("Time: %dms\n", int ((clock()
          -nol_cl) / (double)CLOCKS_PER_SEC * 1000));
#endif
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(int argc, const char * argv[]) {
    int K,T;
    cin >> K >> T;
    vector<int> a(T);
    for(int i=0;i<T;i++){
        cin >> a[i];
    }
    int tempIndex = 0;
    int count =0;
    sort(a.rbegin(),a.rend());
    a[0]--;
    
    for(int i=1;i<K;i++){
        
        int max = 0;
        int yesterIndex = tempIndex;
        for(int j=0;j<T;j++){
            if(max < a[j] && j!=tempIndex){
                max = a[j];
                tempIndex = j;
            }
        }
        a[tempIndex]--;
        if(tempIndex == yesterIndex) count++;
    }
    cout << count;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>

typedef long long ll;
using namespace std;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	ll a,b; cin >> a >> b;
	ll k; cin >> k;

	for (int i = 0;i < k;i++){
		if(i%2 == 0){
			if(a%2 == 1)a--;
			b += a/2;
			a /= 2;
		}else{
			if(b%2 == 1)b--;
			a += b/2;
			b /= 2;
		}
	}

	cout << a << " " << b << endl;

	return 0;

}


Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	if(a*b==15)
	cout<<"*";
	if(a+b==15)
	cout<<"+";
	if(a+b!=15&&a*b!=15)
	cout<<"x";
	return 0;
}
  

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
	
	long long int n,l[100000],t=0,y=0,b=0,b2=0,bf;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>l[i];
	}
	sort(l,l+n);
	for(long long int i=n-1;i>0;i--){
		if(l[i]==l[i-1] && b==0){
			t=l[i];
			bf=i-1;
			b=1;
		}
		if(l[i]==l[i-1] && bf>i && b2==0){
			y=l[i];
			b2=1;
            break;
		}
	}
	cout<<t*y<<endl;
	return 0;
}


Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <iterator>
 
using namespace std;
 
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
 
#define FOR(i,n) for(int i = 0; i < (n); i++)
#define sz(c) ((int)c.size())

typedef unsigned long long ull;
const int INF = (int)1e8;

int n,a[100],b[100];
int dp[101][101];

int main(){
	cin>>n; FOR(i,n) cin>>a[i]>>b[i];
	memset(dp,0x3f,sizeof(dp));
	FOR(i,n) dp[i][i+1] = 0;
	for(int i = 2; i <= n; i++){
		for(int l = 0; l + i <= n; l++){
			int r = l + i;
			for(int k = l+1; k < r; k++){
				dp[l][r] = min(dp[l][r],dp[l][k] + dp[k][r] + a[l] * b[k-1] * a[k] * b[r-1]);
			}
		}
	}

	cout << dp[0][n] << endl;

	return 0;
}

Measured memory_bytes: 1208
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
using namespace std;
int main() {
	int N, k = 0, ans=1;
	cin >> N;
	vector<int> A(N,0);
	for (int i = 0; i < N; i++)cin >> A[i];
	while (A[k] != 2) {
		ans++;
		k = A[k]-1;
		if (ans > N)break;
	}
	cout << (ans > N ? -1 : ans);
}


Measured memory_bytes: 640
package main

import (
	"fmt"
	"math"
)

func main() {
	var n float64
	fmt.Scan(&n)
	x := n / 1.08
	if math.Floor(math.Ceil(x)*1.08) == n {
		fmt.Println(math.Ceil(x))
	} else {
		fmt.Println(":(")
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);in(name)
#define vv(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define VV(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__));in(name)
#define vvv(type,name,h,w,...) vector<vector<vector<type>>>name(h,vector<vector<type>>(w,vector<type>(__VA_ARGS__)))
#define SYOU(x) fixed<<setprecision(x) //小数点桁数を指定する
inline int scan(){ return getchar(); }
inline void scan(int &a){ scanf("%d", &a); }
inline void scan(unsigned &a){ scanf("%u", &a); }
inline void scan(long &a){ scanf("%ld", &a); }
inline void scan(long long &a){ scanf("%lld", &a); }
inline void scan(unsigned long long &a){ scanf("%llu", &a); }
inline void scan(char &a){ cin >> a; }
inline void scan(float &a){ scanf("%f", &a); }
inline void scan(double &a){ scanf("%lf", &a); }
inline void scan(long double &a){ scanf("%Lf", &a); }
inline void scan(vector<bool> &vec){ for(unsigned i = 0; i < vec.size(); i++) { int a; scan(a); vec[i] = a; } }
inline void scan(string &a){ cin >> a; }
template<class T> inline void scan(vector<T> &vec);
template<class T, size_t size> inline void scan(array<T, size> &vec);
template<class T, class L> inline void scan(pair<T, L> &p);
template<class T, size_t size> inline void scan(T (&vec)[size]);
template<class T> inline void scan(vector<T> &vec){ for(auto &i : vec) scan(i); }
template<class T, size_t size> inline void scan(array<T, size> &vec){ for(auto &i : vec) scan(i); }
template<class T, class L> inline void scan(pair<T, L> &p){ scan(p.first); scan(p.second); }
template<class T, size_t size> inline void scan(T (&vec)[size]){ for(auto &i : vec) scan(i); }
template<class T> inline void scan(T &a){ cin>>a; }
inline void in(){}
template <class Head, class... Tail> inline void in(Head &head, Tail&... tail){ scan(head); in(tail...); }
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
/* 4方向への隣接頂点への移動を表すベクトル */
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

const long long INF = 1LL << 60;
int main(){
    INT(X);
    INT(Y);
    INT(Z);

    swap(X,Y);
    swap(X,Z);

    cout << X << " " << Y << " " << Z << endl;
   
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;

int main(void) {
    string O,E;
    cin>>O>>E;
    // 0 -> O[0], 1 -> E[0], 2 -> O[1], 3 -> E[1], 4 -> O[2]
    for (int i = 0; i < O.size() + E.size(); i++) {
        if (i % 2 == 0) cout << O[i / 2];
        else cout << E[i / 2];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 30)
#define MOD 1000000007
//int dy[4] = {-1,0,0,1};
//int dx[4] = {0,1,-1,0};


int main(){

  int n;
  cin >> n;
  vector<string> s(n);
  REP(i,n)cin >> s[i];
  bool flag = true;
  map<string,int> mp;
  mp[s[0]]++;
  REP(i,n-1){
    if(s[i][(int)s[i].size()-1] != s[i+1][0])flag = false;
    if(mp[s[i+1]])flag = false;
    else mp[s[i+1]]++;
  }
  if(flag)cout << "Yes" << endl;
  else cout << "No" << endl;




  

  return 0;
}


Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInteger = readLn :: IO Integer
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readIntegers = map ( fst . fromJust . B.readInteger ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

modifyArray a i f = writeArray a i =<< f <$> readArray a i

main = do
	n <- readInt
	let
		res1000 = n `div` 500
		n' = n `mod` 500
		res5 = n' `div` 5
	print $ res1000 * 1000 + res5 * 5

Measured memory_bytes: 508
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <cstdio>
#include <algorithm>
#include <map>
#include <queue>
using namespace std;

#define next '\n'
#define rep(i, n) for(int (i) = (0); (i) < (n); (++i))
#define FOR(i, start, end) for(int (i) = (start); (i) < (end); (++i))
using ll = long long;
using ull = unsigned long long;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll n;
    cin >> n;

    ll a = 0, b = 0, ans = 1e12 + 10;
    ll len = sqrt(n);
    for(ll i = 1; i <= len; ++i){

        if(n % i == 0){
            a = i;
            b = n / i;
            ans = min(ans, (a + b) - 2);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define MOD 1000000007
using namespace std;

typedef pair<int, int> P;
typedef pair<long long, long long> LLP;

int main() {
    int N;
    cin >> N;

    for (int i = 1; i <= 9; i++) {
        for (int j = 1; j <= 9; j++) {
            if (N == i * j) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define lint long long int
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define mod 1000000007
#define MAXN 100001
#define len length()
#define testcase(t) for(int i=0;i<t;i++)
#define endl "\n"
#define space " "
void solve()
{
    
    lint n,a,b;
        cin>>n>>a>>b;
        bool f=false;
        for(int i=a;i<=b;i++)
        {
            if(i%n==0)
            {
                f=true;
                break;
            }
        }
        if(f==true)
            cout<<"OK"<<endl;
        else
            cout<<"NG"<<endl;

   
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    
    solve();
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 5LL << 60;
const ll mod = 1e9 + 7;

int main() {
	ll M;
	cin >> M;
	ll D = 0, C = 0;
	for(int i = 0; i < M; i++) {
		ll d, c;
		cin >> d >> c;
		D += d * c;
		C += c;
	}
	cout << C + (D - 1) / 9 - 1;
	return 0;
}

Measured memory_bytes: 3592
using System;

public class Program
  {
      static void Main(string[] args)
      {
        int n;
          n = int.Parse(Console.ReadLine());
          string[] sary = Console.ReadLine().Split(' ');
          float[] vary = Array.ConvertAll(sary, float.Parse);
          float mnew = 0;
          while (vary.Length > 1)
          {
            Array.Sort(vary);
            mnew = (vary[0] + vary[1]) / 2.0f;
            Array.Resize(ref vary, vary.Length + 1);
            vary[vary.Length - 1] = mnew;
            Array.Reverse(vary);
            Array.Resize(ref vary, vary.Length - 2);
          }
          //Console.WriteLine(n);
          Console.WriteLine(vary[0]);


      }
  }


Measured memory_bytes: 13396
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		
		Arrays.sort(a);
		System.out.println(a[n - 1] - a[0]);
	}

}


Measured memory_bytes: 21844
// https://atcoder.jp/contests/abc138/tasks/abc138
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <stack>
#include <queue>
#include <iomanip>
#include <set>
#include <bitset>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

int main()
{
    int N, Q;
    cin >> N >> Q;
    vector<int> a(N), b(N);
    for (int i = 0; i < N - 1; ++i) cin >> a[i] >> b[i], --a[i], --b[i];
    vector<int> p(Q), x(Q);
    for (int i = 0; i < Q; ++i) cin >> p[i] >> x[i], --p[i];

    vector<vector<int>> G(N);
    for (int i = 0; i < N - 1; ++i)
    {
        G[a[i]].push_back(b[i]);
        G[b[i]].push_back(a[i]);
    }
    vector<int> res(N, 0);
    for (int j = 0; j < Q; ++j)
    {
        res[p[j]] += x[j];
    }

    vector<int> parent(N, -1); // 頂点 i の親
    queue<int> que;
    que.push(0);
    while(!que.empty())
    {
        int v = que.front();
        que.pop();
        for (const auto& nv : G[v])
        {
            if (parent[v] == nv) continue;
            res[nv] += res[v];
            parent[nv] = v;
            que.push(nv);
        }
    }
    for (int i = 0; i < N; ++i)
    {
        cout << res[i];
        if (i != N - 1) cout << " ";
        else cout << endl;
    }
    return 0;
}

Measured memory_bytes: 20504
#include<stdio.h>

int main()
{
  int n,k;
  
  scanf("%d%d",&n,&k);
  
  int ans=1;
  int i;
  
  for(i=0;i<n;i++)
  {
    if(ans<k)
    {
      ans*=2;
    }
    else
    {
      ans+=k;
    }
  }
  
  printf("%d\n",ans);
  
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
const int N=5e5+10;
char s[N];
char s1[N];
int nxt[N],nxt1[N];//next数组
void kmp(char *t,int *nxt){//t为去匹配,s为被匹配
	int i,j;
	int len1=strlen(t+1);
	nxt[0]=nxt[1]=0;
	for(i=2,j=0;i<=len1;i++){
		while(j&&t[j+1]!=t[i])j=nxt[j];
		if(t[j+1]==t[i])++j;
		nxt[i]=j;
	}
}
bool check(int x,int len){
	int f1,f2;
	int l1=x-nxt[x],l2=len-x-(nxt1[len-x]);
	//if(x==2)cout<<l1<<" "<<l2<<endl;
	if(x==1||l1==x||x%l1!=0)f1=1;
	else f1=0;
	if(len-x==1||l2==len-x||(len-x)%l2!=0)f2=1;
	else f2=0;
	return (f1&&f2);
}
int main()
{
	//freopen("H:\\c++1\\in.txt","r",stdin);
	//freopen("H:\\c++1\\out.txt","w",stdout);
	scanf("%s",s+1);
	int len=strlen(s+1);
	for(int i=1;i<=len;i++){
		s1[i]=s[len-i+1];
	}
	kmp(s,nxt);kmp(s1,nxt1);
	int temp=len-nxt[len];
	if(temp==1){
		printf("%d\n%d\n",len,1);return 0;
	}
	if(temp!=len&&len%temp==0){
		int ans=0;
		for(int i=1;i<len;i++){
			if(check(i,len))ans++;
		}
		printf("2\n%d\n",ans);
	}
	else{
		printf("1\n1\n");
	}
	return 0;
}

Measured memory_bytes: 5120
#include<iostream>
#include<math.h>
#include<algorithm>
using namespace std;

int main()
{
	int a,b,c,k;
	cin>>a>>b>>c>>k;
	
	int maxv=max({a,b,c});
	
	cout<<a+b+c-maxv+maxv*pow(2,k)<<endl;
	
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <set>
using namespace std;
int main(){
    int n;
    cin >> n;
    int l[2*n];
    for(int i = 0;i<2*n;i++){
        cin >> l[i];
    }
    sort(l,l+2*n);
    int ans = 0;
    for(int i = 0;i<n;i++){
        ans = ans + l[2*i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int candys[] = new int [3];
        for(int i = 0;i <= 2;i++){
            candys[i] = sc.nextInt();
        }
        Arrays.sort(candys);
        int max = candys[2];
        int a = 0;
        for(int i = 0;i <= 1;i++){
            a = a + candys[i];
            
        }
        if(max == a){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 21844
# print('input >>')
N = int(input())
alphabets = 'abcdefghijklmnopqrstuvwxyz'

name = ''

while N > 0:
    mod = N % 26
    if mod == 0:
        mod = int(26)
    name = alphabets[int(mod-1)] + name
    N -= 0.1
    N //= 26

# print('-----output-----')
print(name)

Measured memory_bytes: 9240
using System;
using System.Linq;
using System.Collections.Generic;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            MainStream();
        }
        static void MainStream()
        {
            Scan sc = new Scan();
            write wr = new write();

            char[] s = sc.chararr;

            for (int i = 0; i < s.Length-1; i++)
            {
                if (s[i] == s[i+1])
                {
                    wr.wri("Bad");
                    return;
                }
            }
            wr.wri("Good");

        }


    }

    class Scan
    {
        public string str => Console.ReadLine();

        public string[] strarr => str.Split(' ');

        public long[] longarr => strarr.Select(long.Parse).ToArray();
        public int[] intarr => strarr.Select(int.Parse).ToArray();
        public char[] chararr => str.ToArray();


    }



    class write
    {
        public void wri<Type>(Type x)
        {
            Console.WriteLine(x);
        }
    }

    class Method
    {
        static public int max(params int[] nums)
        {

            int maxx = nums[0];
            for (int i = 1; i < nums.Length; i++)
            {
                maxx = Math.Max(maxx, nums[i]);
            }
            return maxx;
        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
 
#define rep(i, n)      for (int i = 0; i < (n); i++)
#define repr(i, n)     for (int i = (n) - 1; i >= 0; i--)
#define repe(i, l, r)  for (int i = (l); i < (r); i++)
#define reper(i, l, r) for (int i = (r) - 1; i >= (l); i--)
#define repi(i, l, r)  for (int i = (l); i <= (r); i++)
#define repir(i, l, r) for (int i = (r); i >= (l); i--)
#define range(a) a.begin(), a.end()
void initio() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }

int main() { initio();
  int N; cin >> N;
  vector<vector<int>> G(N);
  vector<int> A(N - 1), B(N - 1);
  int D = 0;
  rep(i, N - 1) {
    cin >> A[i] >> B[i]; A[i]--; B[i]--;
    G[A[i]].push_back(i);
    G[B[i]].push_back(i);
  }
  rep(i, N) D = max(D, (int)G[i].size());
  vector<int> ans(N - 1);
  auto dfs = [&](auto dfs, int u, int p, int c) -> void {
    for (int i : G[u]) {
      int v = u ^ A[i] ^ B[i];
      if (v == p) continue;
      ans[i] = c;
      c = (c + 1) % D;
      dfs(dfs, v, u, c);
    }
  };
  dfs(dfs, 0, -1, 0);
  cout << D << endl;
  rep(i, N-1) {
    cout << ans[i]+1 << '\n';
  }
}


Measured memory_bytes: 7296
#https://atcoder.jp/contests/abc116/tasks/abc116_b

s=int(input())

list=[s]
i=1
answer=0

while answer==0:
	if list[i-1]%2==0:
		list.append(list[i-1]//2)
	else:
		list.append(3*list[i-1]+1)

	for j in range(i):
		if list[i]==list[j]:
			answer=i+1

	i+=1 


print(answer)



Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
//#define int ll
#define pb push_back
#define __bp __builtin_popcount
using vint = vector<int>;
using pii = pair<int,int>;
using pdd = pair<ld,ld>;
using vpii = vector<pii>;
#define F first
#define S second
const int N = 3e5+5;//(1 << 18) + 5;
//const ll inf = 1e18+7;
const int Inf = 1e9+7;
const int Mod = 1e9+7;
const ld eps = 1e-9;
#ifndef M_PI
#define M_PI 3.1415926535
#endif

void io()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	cerr.tie(NULL);
//	freopen("sweets.in", "r", stdin);
//	freopen("sweets.out", "w", stdout);
//	cout << setprecision(2) << fixed;
}

int n;

signed main()
{
	io();
	cin >> n;
	if (400 <= n && n <= 599)
	{
		cout << 8;
	}
	if (600 <= n && n <= 799)
	{
		cout << 7;
	}
	if (800 <= n && n <= 999)
	{
		cout << 6;
	}
	if (1000 <= n && n <= 1199)
	{
		cout << 5;
	}
	if (1200 <= n && n <= 1399)
	{
		cout << 4;
	}
	if (1400 <= n && n <= 1599)
	{
		cout << 3;
	}
	if (1600 <= n && n <= 1799)
	{
		cout << 2;
	}
	if (1800 <= n && n <= 1999)
	{
		cout << 1;
	}

}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;

int main() {
	string s;
	cin >> s;
	int flag = 1;
	if(s.length() & 1) flag = 0; 
	for(int i = 0;i < s.length();i += 2) if(s[i] != 'h') flag = 0;
	for(int i = 1;i < s.length();i += 2) if(s[i] != 'i') flag = 0;
	cout << (flag ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include <queue>
using namespace std;
int main() {
	int N, T; 
	cin >> N >> T; 
	int A[114514] = {};
	for(int i = 0; i < N; i++){
		cin >> A[i]; 
	}
	int B[114514] = {}; 
	int C[114514] = {}; 
	int saidai = 0; 
	B[0] = A[0]; 
	for(int i = 1; i < N; i++){
		B[i] = min(B[i-1], A[i]); 
		C[i] = A[i] - B[i]; 
		saidai = max(saidai, C[i]); 
	}
	int ans = 0; 
	for(int i = 1; i < N; i++){
		if(C[i] == saidai){ans ++;} 
	}
	cout << ans << endl; 
}

Measured memory_bytes: 1536
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1000000007
#define INF 1e9
#define PIE 3.14159265358979323

template <class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
T GCD(T a, T b) {
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}
template <class T>
inline T LCM(T a, T b) {
    return (a * b) / GCD(a, b);
}

using namespace std;
//#inculude <bits/stdc++.h>
#define int long long

signed main() {
    int q, h, s, d, n;
    cin >> q >> h >> s >> d >> n;
    int one = min(4 * q, min(2 * h, min(s, 2 * q + h)));
    int two = min(2 * one, d);
	if (n%2)
            cout << two * (n / 2) + one << endl;
	else
            cout << two * (n / 2) << endl;
}

Measured memory_bytes: 256
<?php


$num = explode(" ",fgets(STDIN));
$Dnum = $num[0];
$Nnum = $num[1];

if($Nnum ==100){
    $x = pow(100,$Dnum);
    $y = $x *101;
}else{
    $x = pow(100,$Dnum);
    $y = $Nnum * $x;
}


echo $y;

Measured memory_bytes: 4604
#include <bits/stdc++.h>

using namespace std;

#define INF 210000000
#define int long long

int gcd(int a, int b) {
  int amari = a % b;
  int c = b;
  if (amari == 0) {
    return b;
  } else {
    return gcd(b, amari);
  }
}

int lcm(int a, int b) { return a * b / gcd(a, b); }

signed main() {
		int a,b;
		cin >> a >> b;
		for(int i=b-a+1;i<b+a;i++){
				cout << i;
				cout << " ";
		}
}



Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

#define D_MAX 1000000000
#define N_MAX 100000
#define M_MAX 10000
#define min(x,y) (((x)<(y))?(x):(y))

int d;
int n;
int m;

int ad[N_MAX+1];
int ak[M_MAX+1];
int awork[N_MAX+1];

void MergeSort(int array[],int left,int right){
  int mid;
  int i;
  int j;
  int x;
  int y;
  
  if( left >= right ){
    return;
  }
  
  mid = (left + right) / 2;
  MergeSort( array, left, mid);
  MergeSort( array, mid+1, right);
  
  for( i=left; i<=mid; i++){
    awork[i] = array[i];
  }
  
  j = right;
  for( i=mid+1; i<=right; i++){
    awork[i] = array[j];
    j--;
  }
  
  x = left;
  y = right;
  
  for( i=left; i<=right; i++){
    if(awork[x] <= awork[y]){
      array[i] = awork[x];
      x++;
    }else{
      array[i] = awork[y];
      y--;
    }
  }
}


int calcDist(void){
  int i;
  int j = 1;
  int sum = 0;
  int diff;
  int preDiff = 0;
  int minDist = d;
  int tmpDist;
  int halfDist = d >> 1;
  
  for( i=1; i<=m; i++){
    
    while(ad[j] < ak[i]){
      j++;
    }
    minDist = min( abs(ad[j-1]-ak[i]),abs(ad[j]-ak[i]) );
    sum += minDist;
    
  }
  
  return sum;
}


void input(void){
  int i;
  scanf("%d",&d);
  if( d != 0){
    scanf("%d",&n);
    scanf("%d",&m);
    ad[0] = 0;
    for( i=1; i<=n-1; i++){
      scanf("%d",&ad[i]);
    }
    ad[n] = d;
    for( i=1; i<=m; i++){
      scanf("%d",&ak[i]);
    }
  }
}

int main(void){
  int i;
  int sumDist = 0;
  while( 1 ){
    input();
    if( d == 0 ){
      break;
    }
    MergeSort( ad, 0, n);
    MergeSort( ak, 1, m);
    sumDist = calcDist();
    printf("%d\n",sumDist);
    sumDist = 0;
  }
}




Measured memory_bytes: 2512
#include <stdio.h>
#include <math.h>
int main(int argc, const char * argv[])
{
    int w, h, x, y, r;
    scanf("%d %d %d %d %d", &w, &h, &x, &y, &r);
    if(x+r<=w&&x-r>=0&&y+r<=h&&y-r>=0){
      printf("Yes\n");
    }else{
      printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 584
import java.util.Arrays;
import java.util.Scanner;

class Main {
	Scanner sc = new Scanner(System.in);

	public void run() {
		int[] num = new int[] { sc.nextInt(), sc.nextInt(), sc.nextInt() };
		Arrays.sort(num);

		ln(StringUtils.join(num, " "));
	}

	public static void main(String[] args) {
		new Main().run();
	}

	public static void pr(Object o) {
		System.out.print(o);
	}

	public static void ln(Object o) {
		System.out.println(o);
	}

	public static void ln() {
		System.out.println();
	}
}

class StringUtils {
	public static String join(int[] array, String separator) {
		StringBuilder str = new StringBuilder(array[0] + "");
		for (int i = 1; i < array.length; i++) {
			str.append(separator).append(array[i] + "");
		}
		return str.toString();
	}

	public static String join(Object[] array, String separator) {
		StringBuilder str = new StringBuilder(array[0] + "");
		for (int i = 1; i < array.length; i++) {
			str.append(separator).append(array[i] + "");
		}
		return str.toString();
	}
}

Measured memory_bytes: 12000