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

#define int long long
#define double long double

using namespace std;

template<class T> string tostr(T x) { stringstream o; o << x; return o.str(); }
template<class T> T sqr(T x) { return x*x; }
template<class T> T mypow(T x, int n) { T r = 1; while (n > 0) { if (n & 1)r = r*x; x = x*x; n >>= 1; }return r; }

int toint(string s) { int v; stringstream i(s); i >> v; return v; }
bool check(int x, int y, int w, int h) { return x >= 0 && y >= 0 && w > x && h > y; }
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

#define REP(i,a,b)	for(int (i) = (a);i < (b);(i)++)
#define rep(i,n)	REP(i,0,n)
#define PER(i,a,b)	for(int (i) = (a-1);i >= (b);(i)--)
#define per(i,n)	PER(i,n,0)
#define each(i,n)	for(auto &i : n)
#define clr(a)		memset((a), 0 ,sizeof(a))
#define mclr(a)		memset((a), -1 ,sizeof(a))
#define all(a)		(a).begin(),(a).end()
#define dump(val) 	cerr << #val " = " << val << endl;
#define dum(val)	cerr << #val " = " << val;
#define FILL(a,v)	fill(a,a+sizeof(a)/sizeof(*a),v)

const int dx[8] = { +1,+0,-1,+0,+1,+1,-1,-1 };
const int dy[8] = { +0,-1,+0,+1,-1,+1,-1,+1 };
const int mod = 1e9 + 7;
const int INF = 1e9;

typedef tuple<int,int,int> T;

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) { }
	bool set(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
		if (data[y] < data[x]) swap(x, y);
		data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool find(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

signed main() {

	int n;
	cin >> n;

	vector<T> xp(n), yp(n);

	rep(i,n){
		int x, y;
		cin >> x >> y;
		xp[i] = tie(x, y, i);
		yp[i] = tie(y, x, i);
	}

	sort(all(xp));
	sort(all(yp));
	
	vector<T> e;
	rep(i,n-1){
		int x0 = get<0>(xp[i]);
		int x1 = get<0>(xp[i+1]);

		int i0 = get<2>(xp[i]);
		int i1 = get<2>(xp[i+1]);

		e.push_back(T(x1-x0,i0,i1));
	}
	rep(i,n-1){
		int y0 = get<0>(yp[i]);
		int y1 = get<0>(yp[i+1]);

		int i0 = get<2>(yp[i]);
		int i1 = get<2>(yp[i+1]);

		e.push_back(T(y1-y0,i0,i1));
	}

	UnionFind uf(n);

	int ans = 0;
	sort(all(e));
	rep(i, e.size()){

		int t0 = get<1>(e[i]);
		int t1 = get<2>(e[i]);

		if(uf.find(t0, t1) == false){
			uf.set(t0, t1);
			ans += get<0>(e[i]);
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 13168
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,s1=0,s2=0,i=0,j=n-1,min=1000000;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++)
    cin>>a[i];
  for(int i=0;i<n;i++)
  {
      s1=0,s2=0;
    for(int j=0;j<=i;j++)
      s1+=a[j];
    for(int j=i+1;j<n;j++)
      s2+=a[j];
    if(abs(s2-s1)<min)
      min=abs(s2-s1);
  }
  cout<<min;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <vector>
#include <cstdio>
#include <algorithm>

using namespace std;

int main(){
	string f[] = {"apple", "peach"};
	string s;

	getline(cin, s);

	for(int i = 0; i < s.size()-4; i++){
		if(s.substr(i, 5) == f[0]){
			for(int j = 0; j < 5; j++){
				s[i+j] = f[1][j];
			}
			i+=4;
		}
		if(s.substr(i, 5) == f[1]){
			for(int j = 0; j < 5; j++){
				s[i+j] = f[0][j];
			}
			i+=4;
		}
	}
	
	cout << s << endl;

	return 0;
} 

Measured memory_bytes: 1188
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<vector>
#include<map>
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	string s;
	while(cin>>s)
	{
		int i,j,cnt=0;
		if(s[0]=='A')
		{
			if(s[1]>='a'&&s[1]<='z')
			{
				for(i=2;i<s.size()-1;i++)
				{
					if(s[i]=='C')
						cnt++;
					if(s[i]>='A'&&s[i]<='Z'&&s[i]!='C')
					{
						cout<<"WA"<<endl;
						break;
					}
				}
				if(cnt==1&&s[s.size()-1]>='a'&&s[s.size()-1]<='z')
					cout<<"AC"<<endl;
				else
					cout<<"WA"<<endl;
			}
			else
				cout<<"WA"<<endl;
		}
		else
			cout<<"WA"<<endl;
		
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
int t,n,i,a[4];
for(i=0;i<=3;i++){
scanf("%d",&t);
scanf("%d",&n);

if(t==1){
a[i]=n*6000;}
else if(t==2){
a[i]=n*4000;}
else if(t==3){
a[i]=n*3000;}
else if(t==4){
a[i]=n*2000;}}
for(i = 0;i<=3;i++) {
printf("%d\n", a[i]);
}

return 0;}

Measured memory_bytes: 1816
from math import floor, ceil
k = int(input())
a = [int(i) for i in input().split()]
l,r = 2,2
for ai in a[::-1]:
    xi = ceil(l/ai)
    yi = floor(r/ai)
    if xi > yi:
        print(-1)
        exit()
    l = xi * ai
    r = yi * ai + ai - 1
print(l, r)

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

int main(void){
  
  int N,M,l,r,a,b;
  cin >> N >> M;
  for(int i=0;i<M;i++){
      if(i == 0) cin >> l >> r;
      else{
          cin >> a >> b;
          l = max(l,a);
          r = min(r,b);
      }
  }
  if (r-l+1 < 0) cout << 0 << endl;
  else cout << r-l+1 << endl;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<int(n);i++)
using namespace std;
int main() {

	int a,b,c,d;
	cin >>a>>b>>c>>d;
	string ans;
	while(a>0&&c>0){
		c-=b;
		if(c<=0){
			ans="Yes";
			break;
		}
		a-=d;
		if(a<=0){
			ans="No";
			break;
		}

	}
	cout << ans <<endl;
	return 0;
}


Measured memory_bytes: 3628
NM = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]
X.sort()
if(NM[1] <= NM[0]):
    print(0)
else:
    list1 = []
    for i in range(NM[1] - 1):
      list1.append(X[i + 1] - X[i])
    list1.sort()
    while(NM[0] > 1):
        del list1[-1]
        NM[0] -= 1
    print(sum(list1))

Measured memory_bytes: 13832
#include <bits/stdc++.h>
using namespace std;
#define FOR(I,X,Y) for(long long (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(long long (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define pb push_back
#define COUNT(V,X) upper_bound((V).begin(),(V).end(),X)-lower_bound((V).begin(),(V).end(),X)
#define debug(x) cerr<<#x<<':'<<x<<endl;
#define DEBUG(v) cerr<<#v<<':';for(auto x:v)cerr<<x<<' ';cerr<<endl;
#define INF 1000000007
#define LINF 1000000000000000007
#define EPS 1e-9
typedef long long ll;

long long POW(long long x,long long n,long long mod){
  long long ans = 1;
  while(n){
    if(n%2)ans *= x;
    x *= x;
    x %= mod;
    ans %= mod;
    n >>= 1;
  }
  return ans;
}
vector<long long> factorial(2,1);
long long nckmodp(long long n,long long k,long long p){
  if(n < k || n <= 0 || k < 0)return 0;
  while(factorial.size() <= n){
    long long i = factorial.size();
    factorial.push_back(i*factorial[i-1]%p);
  }
  return ((factorial[n]*POW(factorial[k],p-2,p))%p)*POW(factorial[n-k],p-2,p)%p;
}
long long TwelvefoldWay9(long long n,long long k,long long MOD){
  long long ans = 0;
  for(long long i = 1;i <= k;i++){
    ans += ((k-i)%2 ? -1 : 1)*nckmodp(k,i,MOD)*POW(i,n,MOD);
    ans = (ans%MOD+MOD)%MOD;
  }
  return (ans*POW(factorial[k],MOD-2,MOD))%MOD;
}
long long TwelvefoldWay7(long long n,long long k,long long MOD){
  long long ans = 0;
  for(long long i = 1;i <= k;i++){
    ans += TwelvefoldWay9(n,i,MOD);
    ans %= MOD;
  }
  return ans;
}

signed main(){
  ll n,k;
  cin >> n >> k;
  cout << TwelvefoldWay7(n,k,INF) << endl;
}


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

#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection"
#pragma ide diagnostic ignored "OCUnusedMacroInspection"
using namespace std;

#define sqr(a) ((a)*(a))
#define forn(i, n) for(int i = 0; i < (int)n; ++i)
#define rep(i, k, n) for(int i = (int)k; i <= (int)n; ++i)
#define nrof(i, n) for(int i = (int)n - 1; i >= 0; --i)
#define x first
#define y second
#define mp make_pair
#define sz(a) (int)(a.size())
#define pb push_back
#define eb emplace_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double dd;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int N = 1e6 + 9;
const int M = 2e3 + 9;
const int INFINT = 1e9 + 9;
const ll INFLL = 1e18 + 9;
const ll MOD = (ll) (1000000007);


void solve() {
    int n, k;
    cin >> n >> k;
    vector<int> p(n);
    forn(i, n) {
        cin >> p[i];
        --p[i];
    }
    vector<ll> c(n);
    forn(i, n) cin >> c[i];
    vector<vector<ll>> cycles;
    vector<bool> used(n);
    ll ans = -INFLL;
    forn(i, n) {
        if (!used[i]) {
            vector<ll> cycle;
            int ind = i;
            ll sum = 0;
            int cntqw = 0;
            do {
                used[ind] = true;
                cycle.pb(c[ind]);
                sum += c[ind];
               // ++cntqw;
              //  if (cntqw <= k) ans = max(ans, sum);
                ind = p[ind];
            } while (!used[ind]);
            //    cycles.pb(cycle);

            int w = sz(cycle);

        //    forn(j, w) cout << cycle[j] << ' ';
       //     cout << endl;

            forn(j, w) cycle.pb(cycle[j]);
            for (int j = 0; j < w; ++j) {
                int l = j, r = j + w;
                ll sum2 = 0;
                for (int q = l, cntww = 1; q < r; ++q, ++cntww) {
                    sum2 += cycle[q];
                    if (cntww > k) break;
                    ans = max(ans, sum2);
                    ans = max(ans, sum2 + sum * ((k - cntww) / w));
             //       cout << sum << ' ' << sum2 << ' ' << cntww << endl;
                }
            }
        }
    }
    cout << ans << endl;
//    for (const auto& v: cycles) {
//        for (auto x: v) {
//            cout << x << ' ';
//        }
//        cout << endl;
//    }
}

int main() {
    //  freopen("input.txt", "r", stdin);
    //  freopen("output.txt", "w", stdout);

    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int t;
    t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }

    return 0;
}


Measured memory_bytes: 3816
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;cin >> s;
	string a="CODEFESTIVAL2016";
	int ans=0;
	rep(i,s.size()){
		if(s.at(i)!=a.at(i)) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		BigDecimal a = sc.nextBigDecimal();
		BigDecimal b = sc.nextBigDecimal();
				
		
		if (b.compareTo(a) < 0) {
			System.out.println("GREATER");
		} else if (b.compareTo(a) == 0) {
			System.out.println("EQUAL");
		} else {
			System.out.println("LESS");
		}
	}
}

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

#define int long long

using namespace std;

const int oo = 2e18;



int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int N, M;

    cin >> N >> M;

    int sum = 0;

    for(int i = 0 ; i < M ; i++)
    {
    	int n;
    	cin >> n;
    	sum += n;
    }

    sum = N - sum;

    if(sum >= 0)cout << sum << '\n';
    else cout << -1 << '\n';

    return 0;
}

Measured memory_bytes: 3616
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;

using namespace std;

int main(){
	
	int n,a[4444],ans=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
		ans+=a[i]-1;
		
	}
	cout<<ans<<endl;
	
	
	return 0;
}

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

int main(){
    string str;
    int count[26] = {};
    while (getline(cin, str)){
        for (int i=0; i<str.size(); i++){
            if (isalpha(str[i])){
                if (isupper(str[i])) count[str[i]-'A']++;
                if (islower(str[i])) count[str[i]-'a']++;
            }
        }            
    }
    for (int i=0; i<26; i++)
        printf("%c : %d\n", i+'a', count[i]);
    return 0;
}


Measured memory_bytes: 3348
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		String N = reader.next();
		int ans = 0;
		for (int i = 0; i < N.length(); i++) {
			char ch = N.charAt(i);
			if (ch == '+' ) {
				ans++;
			} else {
				ans--;
			}
		}


		System.out.println(ans);
		reader.close();
	}
}





Measured memory_bytes: 21844
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll n;
    cin >> n;

    ll ans = 0;
    rep(i, n) {
        ll a;
        cin >> a;
        ll x = 0;
        while(a%2 == 0) {
            a /= 2;
            x++;
        }
        ans += x;
    }

    out(ans);
    re0;
}

Measured memory_bytes: 256
import Data.Array
import Data.Array.ST
import Data.Array.MArray
import Control.Monad
import Control.Monad.ST

solve :: Int -> [(Int,Int)] -> Int -> Int
solve n goods w = runST $ do
  dp <- newArray ((0,0), (n,w)) (-1)
  f dp 0 w
  where
    f :: STUArray s (Int,Int) Int -> Int -> Int -> ST s Int
    f dp i j = do
      mem <- readArray dp (i, j)
      if mem /= -1 then
        return mem
      else do
        res <- if i == n then
          return 0
        else if j < wi then
          f dp (i+1) j
        else
          liftM2 max (f dp (i+1) j) ((+vi) <$> f dp (i+1) (j-wi))
        writeArray dp (i, j) res
        return res
      where (wi, vi) = gary ! i
    gary = listArray (0, n-1) goods

main = do
  [n,w] <- map read.words <$> getLine
  goods <- replicateM n $ (\[a,b]->(a,b)).map read.words <$> getLine
  print $ solve n goods w

Measured memory_bytes: 80892
import java.util.Arrays;
import java.util.Collections;
//Atcoder 067 B - Snake Toy
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		Integer[] l = new Integer[n];
		for(int i=0;i<n;i++) l[i]= sc.nextInt();
		Arrays.sort(l,Collections.reverseOrder());

		int sum=0;
		for(int i=0;i<k;i++) {
			sum+=l[i];
		}
		System.out.println(sum);
	}
}


Measured memory_bytes: 35872
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

	public static void main(String[] args) throws IOException{
		
		InputStreamReader isr= new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		String[] strInputList;
		List<Integer>intListDivisorsC= new ArrayList<Integer>();
		List<Integer>intListAtoC = new ArrayList<Integer>();
		List<Integer>intListResultDivisors = new ArrayList<Integer>();
		int intResult = 0;
		
		String strINputNum = br.readLine();
		strInputList = strINputNum.split(" ");
		
		int intNumA = Integer.parseInt(strInputList[0]);
		int intNumB = Integer.parseInt(strInputList[1]);
		int intNumC = Integer.parseInt(strInputList[2]);
		
		for(int i = 1; i <= intNumC; i++){
			int j= intNumC % i;
			if(j == 0) {
				intListDivisorsC.add(i);
			}else {				
			}
		}
		
		for(int i = intNumA; i <= intNumB; i++) {
			if(i <= intNumB) {
				intListAtoC.add(i);
			}
		}
		
		for(int i = 0; i < intListDivisorsC.size(); i++) {
			for(int j = 0; j < intListAtoC.size(); j++) {
				int intDivisorsC = intListDivisorsC.get(i);
				int intAtoC = intListAtoC.get(j);
				if(intDivisorsC == intAtoC) {
					intListResultDivisors.add(intAtoC);
				}
			}
		}
		intResult = intListResultDivisors.size();
		System.out.println(intResult);
	}
}


Measured memory_bytes: 26148
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dp[410][410],v[410],rs[410];
int n;
//inclusive
ll sm(int a, int b) {
	return rs[b+1]-rs[a];
}
ll ds(int a, int b) {
	if(a == b) {return 0;}
	if(dp[a][b] != -1) {return dp[a][b];}
	ll val = 1LL<<45;
	for(int i=a;i<b;i++) {
		val = min(val,ds(a,i)+ds(i+1,b)+sm(a,i)+sm(i+1,b));
	}
	return dp[a][b] = val;
}
int main() {
	scanf("%d ",&n);
	ll s = 0;
	rs[0] = 0;
	memset(dp,-1,sizeof(dp));
	for(int i=0;i<n;i++) {
		int t;
		scanf("%d ",&t);
		s += t;
		rs[i+1] = s;
	}
	printf("%lld\n",ds(0,n-1));
}


Measured memory_bytes: 1536
#include<stdio.h>
#include<stdlib.h>
int l[200010],r[200010],idx[200010];
int ql[200010],qr[200010],qidx[200010];
int ans[200010];
int sum[510];
int cmp(const void*p,const void*q){
	if(r[*(int*)p]>r[*(int*)q])return 1;
	return -1;
}
int cmpq(const void*p,const void*q){
	if(qr[*(int*)p]>qr[*(int*)q])return 1;
	return -1;
}
int main(){
	int n,m,q;
	scanf("%d%d%d",&n,&m,&q);
	for(int i=0;i<m;i++){
		scanf("%d%d",l+i,r+i);
		idx[i]=i;
	}
	qsort(idx,m,sizeof(int),cmp);
	for(int i=0;i<q;i++){
		scanf("%d%d",ql+i,qr+i);
		qidx[i]=i;
	}
	qsort(qidx,q,sizeof(int),cmpq);
	
	int crr=0;
	for(int ii=0;ii<q;ii++){
		int i=qidx[ii];
		while(crr<m&&r[idx[crr]]<=qr[i])sum[l[idx[crr++]]]++;
		ans[i]=crr;
		for(int j=0;j<ql[i];j++)ans[i]-=sum[j];
	}
	for(int i=0;i<q;i++)printf("%d\n",ans[i]);
}

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


int main(void){
	int h,w;
	cin >> h >> w;
	vector<vector <int>> a(h);
	vector<vector <int>> b(h);
	for(int i = 0; i < h; ++i){
		a[i].resize(w);
		b[i].resize(w);
		for(int j = 0; j < w; ++j){
			cin >> a[i][j];
			b[i][j] = a[i][j];
		}
	}
	int count = 0;
	for(int i = 0; i < h; ++i){
		for(int j = 0; j < w; ++j){
			if(a[i][j] % 2 == 1){
				if(j != w-1){
					a[i][j+1]++;
					count++;
				}else{
					if(i != h-1){
						a[i+1][j]++;
						count++;
					}
				}
			}
		}
	}
	cout << count << endl;
	for(int i = 0; i < h; ++i){
		for(int j = 0; j < w; ++j){
			if(b[i][j] % 2 == 1){
				if(j != w-1){
					b[i][j+1]++;
					cout << i+1 << " " << j+1 << " " << i+1 << " " << j+2 << endl;
				}else{
					if(i != h-1){
						b[i+1][j]++;
						cout << i+1 << " " << j+1 << " " << i+2 << " " << j+1 << endl;
					}
				}
			}
		}
	}
/*
	for(int i = 0; i < h; ++i){
		for(int j = 0; j < w; ++j){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
*/

	return 0;
}

Measured memory_bytes: 4096
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N = 0, A = 0, B = 0, ans = 0;
    cin >> N;
    vector<int> vec(N);

    for (auto &x : vec)
    {
        cin >> x;
    }
    sort(vec.begin(), vec.end());

    for (int i = 1; i < N; i++)
    {
        if (vec[i - 1] == vec[i])
        {
            vec[i] = 0;
            vec[i - 1] = 0;
        }
    }
    for (int i = 0; i < N; i++)
    {
        if (vec[i] > 0)
            ans++;
    }

    cout << ans << endl;
}

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

#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define endl '\n'

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, int> pdi;

const ll INF = 1e18;
const int MAXN = 1e6 + 5;
const int MOD = 20200429;

ll K;
ll dp[11][21];

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> K;
	for(int i=0; i<=9; i++) dp[i][1] = 1;
	for(int i=2; i<=11; i++) {
		for(int j=0; j<=9; j++) {
			if(j > 0) dp[j][i] = dp[j-1][i-1] + dp[j][i-1] + dp[j+1][i-1];
			else dp[j][i] = dp[j][i-1] + dp[j+1][i-1];
		}
	}
	vector<int> ans;
	int dig;
	for(int i=1; i<=11; i++) {
		for(int j=1; j<=9; j++) {
			if(dp[j][i] >= K) {
				ans.push_back(j);
				dig = i;
				break;
			}
			K -= dp[j][i];
		}
		if(ans.size()) break;
	}
	for(int i=dig-1; i>=1; i--) {
		for(int j=max(0, (int)ans.back()-1); j<=min((int)ans.back()+1, 9); j++) {
			if(dp[j][i] >= K) {
				ans.push_back(j);
				break;
			}
			K -= dp[j][i];
		}
	}
	for(auto i : ans) cout << i;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp;
use std::io::Write;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

  ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($iter, $t);
    input_inner!{$iter $($r)*}
  };
}

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, [ $t:tt ]) => {{
    let len = read_value!($iter, usize);
    (0..len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  }};

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn fill(n: usize, k: usize, c: usize, s: &Vec<char>) -> usize {
  let mut last = None;
  let mut count = 0;
  for (i, &d) in s.iter().enumerate() {
    if d == 'x' {
      continue;
    }
    if let Some(last) = last {
      if i <= last + c {
        continue;
      }
    }
    last = Some(i);
    count += 1;
  }
  count
}

fn solve(n: usize, k: usize, c: usize, s: &Vec<char>) -> Vec<bool> {
  let mut work = vec![false; n];
  let mut last = None;
  let mut count = 0;
  for (i, &d) in s.iter().enumerate() {
    if count >= k {
      break;
    }
    if d == 'x' {
      continue;
    }
    if let Some(last) = last {
      if i <= last + c {
        continue;
      }
    }
    last = Some(i);
    work[i] = true;
    count += 1;
  }
  work
}

fn main() {
  let out = std::io::stdout();
  let mut out = std::io::BufWriter::new(out.lock());
  macro_rules! puts {
    ($($format:tt)*) => (write!(out,$($format)*).unwrap());
  }
  input! {
    n: usize,
    k: usize,
    c: usize,
    s: chars,
  }
  if fill(n, k, c, &s) > k {
    return;
  }
  let forward = solve(n, k, c, &s);
  let mut s = s;
  s.reverse();
  let mut backward = solve(n, k, c, &s);
  backward.reverse();
  for i in 0 .. n {
    if forward[i] && backward[i] {
      puts!("{}\n", i+1);
    }
  }
}


Measured memory_bytes: 7548
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
int main() {
	int N;
	cin>>N;
	if(N==1){
		string ans="Hello World";
		cout<<ans<<endl;
	}
	else {
		int A,B;
		cin>>A>>B;
		int ans=A+B;
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<cmath>
#include<queue>
#include<limits>
#include<cassert>
#include<set>
#include<tuple>
#include<map>
using namespace std;

int main() {
	int N, A;
	string b = "No";
	cin >> N;
	cin >> A;
	if (N % 500 <= A) b = "Yes";
	cout << b << endl;
}

Measured memory_bytes: 256
//#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

#define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++)
#define all(x) (x).begin(),(x).end()

#define MOD 1000000007LL
#define INF (1LL<<60LL)
#define int long long
#define MAX_N (100001)
typedef long long ll;

using namespace std;

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, x, y;
	cin >> n >> x >> y;
	if (x > y)swap(x, y);
	vector<int> ans(n);
	for (int i = 1; i <= n; i++)for (int j = i + 1; j <= n; j++) {
		int k = min(j - i, abs(j - y) + 1 + abs(i - x));
		ans[k]++;
	}
	for (int i = 1; i < n; i++) {
		cout << ans[i] << endl;
	}
}

Measured memory_bytes: 256
A, B, C = map(int, input().split())

count_5 = 0
count_7 = 0

if A == 5:
  count_5 += 1
elif A == 7:
  count_7 += 1
  
if B == 5:
  count_5 += 1
elif B == 7:
  count_7 += 1
  
if C == 5:
  count_5 += 1
elif C == 7:
  count_7 += 1
  
if count_5 == 2 and count_7 == 1:
  print("YES")
else:
  print("NO")

Measured memory_bytes: 61848
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

S = input()
tmp = 0
for s in S:
	if tmp == 0 and s == 'C':
		tmp += 1
	elif tmp == 1 and s == 'F':
		print('Yes')
		sys.exit()

print('No')


Measured memory_bytes: 4452
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cfloat>
#include <cassert>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
using llong = long long;

double r;

int main() {
    cin >> r;

    printf("%.*lf\n", DBL_DIG, 2 * r * M_PI);

    return 0;
}


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

using namespace std;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;

    if(a < b && b < c)
    {
        cout << "Yes" <<endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<ll,ll>;
using PP=pair<ll,P>;
using vp=vector<P>;
using vpp=vector<PP>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
template<typename A,typename B>istream&operator>>(istream&is,pair<A,B> &p){is>>p.fi>>p.se;return is;}
template<typename A,typename B>ostream&operator<<(ostream&os,const pair<A,B> &p){os<<"("<<p.fi<<","<<p.se<<")";return os;}
template<typename T>istream&operator>>(istream&is,vector<T> &t){REP(i,t.size())is>>t[i];return is;}
template<typename T>ostream&operator<<(ostream&os,const vector<T>&t){os<<"{";REP(i,t.size()){if(i)os<<",";os<<t[i];}cout<<"}";return os;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
int main(){
    int a,b;
    cin>>a>>b;
    if(a>=13){
        cout<<b<<endl;
    }else if(a>=6){
        cout<<b/2<<endl;
    }else{
        cout<<0<<endl;
    }
    return 0;
}

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

void chmax(int64_t& a, int64_t b){
    a = max(a, b);
}

int main(){
    int N;
    cin >> N;
    vector<int> V(N+1), W(N+1);
    for(int i=1; i<=N; i++) scanf("%d %d", &V[i], &W[i]);
    vector<vector<pair<int, int>>> ql(N+1);
    int Q;
    cin >> Q;
    for(int i=0; i<Q; i++){
        int v, l;
        scanf("%d %d", &v, &l);
        ql[v].emplace_back(i, l);
    }

    vector<int64_t> ans(Q);

    int T = min(N, 511);
    const int MX = 100000;
    static int64_t dp[512][MX+1];
    for(int i=1; i<=T; i++){
        for(int j=0; j<=MX; j++){
            int v = dp[i>>1][j];
            chmax(dp[i][j], v);
            if(j+W[i] <= MX) chmax(dp[i][j+W[i]], v+V[i]);
        }
        for(auto& [q, l] : ql[i]) ans[q] = dp[i][l];
    }

    vector<int> vm(1<<18), wm(1<<18);

    for(int i=T+1; i<=N; i++){
        int t = i;
        vector<int> ps;
        while(t > T){
            ps.push_back(t);
            t >>= 1;
        }
        int sz = ps.size();
        int msb = 1, idx = 0;
        for(int b=0; b<(1<<sz); b++){
            if(b == 2*msb) msb = b, idx++;
            int v = 0, w = 0;
            if(b){
                v = vm[b-msb] + V[ps[idx]];
                w = wm[b-msb] + W[ps[idx]];
            }
            vm[b] = v;
            wm[b] = w;
            for(auto& [q, l] : ql[i]) if(w <= l) chmax(ans[q], dp[t][l-w] + v);
        }
    }

    for(int i=0; i<Q; i++) printf("%lld\n", ans[i]);
    return 0;
}


Measured memory_bytes: 416672
"use strict";
main(require("fs").readFileSync("/dev/stdin", "UTF-8"));

function main(input) {
  input = input.split("\n");
  let baseInfo = input
    .shift()
    .split(" ")
    .map(e => parseInt(e));
  input = input.map(e => parseInt(e));
  const people = baseInfo[0]; // 参加人数
  const maxPoint = baseInfo[1]; // 初期に所持しているポイント
  let pData = new Array(people).fill(maxPoint); //　参加者の所持ポイントを表すデータ。
  const ansNum = baseInfo[2];

  for (let i = 0; i < ansNum; i++) {
    pData[input[i] - 1] += 1;
  }

  for (let f = 0; f < pData.length; f++) {
    if (pData[f] - ansNum > 0) console.log("Yes");
    else console.log("No");
  }
}


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

#define ll long long
#define endl "\n"
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define f first
#define s second
#define vecll vector<ll>
#define pairll pair<ll,ll>
#define vecpairll vector<pair<ll,ll>>
#define mapllll map<ll,ll>
#define mapstrll map<string,ll>
#define mapllvecll map<ll,vecll>
#define setll set<ll>
#define fio ios_base::sync_with_stdio (false); cin.tie (NULL); cout.tie(NULL);

using namespace std;

ll const N=1e5+5;
ll const inf=1e18+5;
ll const MOD=1e9+7;

ll t,n,m,x,y,z,w,k;

int main()
{
    fio

    string str;
    set<string>st;

    cin>>n;
    for(ll i=0;i<n;i++)
    {
        cin>>str;
        st.insert(str);
    }

    cout<<st.size();

    return 0;
}



Measured memory_bytes: 19240
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<functional>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<queue>
#include<random>
#include<set>
#include<stack>
#include<string>
#include<utility>
#include<vector>

#define FOR(i,a,b) for(long long i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define FORR(i,a,b) for(long long i=(a);i>=(b);--i)
#define REPR(i,n)   FORR(i,n,0)

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll>pll;


int main() {
	int N;
	vector<int>a;
	map<int,int>num;

	cin>>N;
	REP(i,N){
		int x;
		cin>>x;
		a.push_back(x);
		num[x]=0;
	}
	REP(i,N){
		num[a[i]]++;
	}

	sort(a.begin(),a.end(),greater<int>());
	int cnt=0;
	REP(i,N){
		if(num[a[i]]>0){
			for(int j=1;j<31;++j){
				int x=1<<j;
				if(num.count(x-a[i])){
					if(a[i]==x-a[i]){
						if(num[x-a[i]]>1){
							cnt++;
							num[a[i]]--;
							num[x-a[i]]--;
							break;
						}
					}
					else{
						if(num[x-a[i]]>0){
							cnt++;
							num[a[i]]--;
							num[x-a[i]]--;
							break;
						}
					}
				}
			}
		}
	}
	
	cout<<cnt<<endl;
	
	return 0;
}


Measured memory_bytes: 10356
import sys
input = sys.stdin.readline
import math

A, B, H, M = map(int, input().split())

theta_min = 2*math.pi/60*M
theta_hour = 2*math.pi/(60*12)*(H*60+M)

x1, y1 = A*math.cos(theta_hour), A*math.sin(theta_hour)
x2, y2 = B*math.cos(theta_min), B*math.sin(theta_min)
print(math.sqrt((x1-x2)**2+(y1-y2)**2))

Measured memory_bytes: 9516
#include <iostream>
#include <vector>
#include <cstdio>
#include <fstream>
#include <limits.h>
#include <algorithm>
using namespace std;
#define MAX_VAL 1000000007
typedef long long ll;

int main()
{
    //freopen("input.in", "r", stdin);
    string s, t;
    int n;
    cin>>s>>t;
    cin>>n;
    int len1=s.length();
    int len2=t.length();
    vector<int> a(len1+1, 0);
    vector<int> b(len2+1, 0);
    for(int i=0;i<len1;i++){
        a[i+1]=a[i]+(s[i]-'A'+1);
    }
    for(int i=0;i<len2;i++){
        b[i+1]=b[i]+(t[i]-'A'+1);
    }
    vector<int> q(4, 0);
    while(n--){
        cin>>q[0]>>q[1]>>q[2]>>q[3];
        if( (a[q[1]]-a[q[0]-1])%3 == (b[q[3]] - b[q[2]-1])%3 ){
            cout<<"YES"<<endl;
        }
        else cout<<"NO"<<endl;
    }
    return 0;

}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

	@SuppressWarnings("null")
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int k, p;
		int n , m;
		int a[][];
		int b[];
		int c[];
		int g[];

		a = new int[100][100];
		b = new int[100];
		c = new int[100];
		g = new int[100];
		n = scan.nextInt();
		m = scan.nextInt();
	
	
		for (k = 0; k < n; k++) {
			for(p = 0; p < m; p++){
				int d = scan.nextInt();
				a[k][p] = d;
				
			}
			
		
		}
			for(p = 0; p < m; p++){
				int e = scan.nextInt();
				b[p] = e;
				
			}
			for (k = 0; k < n; k++) {
				for(p = 0; p < m; p++){
					c[k] = a[k][p] * b[p];
					g[k] += c[k];
				}
				
			
			}
			for (k = 0; k < n; k++) {
				System.out.println(g[k]);
				
			}
			
		
		
		
	}
			
	
}

Measured memory_bytes: 40656
#include <iostream>
#include <math.h>
#include <vector>
#include <iomanip>


int main() {

    int N;
    std::cin >> N;

    std::vector<int> vx(N), vy(N);
    std::vector<long> vh(N);

    int p;

    for (int i = 0; i < N; i++) {
        int x, y;
        long h;
        std::cin >> x >> y >> h;
        vx[i] = x;
        vy[i] = y;
        vh[i] = h;

        if (h > 0) {
            p = i;
        }

    }

    int maxCx = 100;
    int maxCy = 100;

    long Height;
    int Cx, Cy;

    for (int cx = 0; cx <= maxCx; cx++) {
        for (int cy = 0; cy <= maxCy; cy++) {

            long H = vh[p] + abs(vx[p] - cx) + abs(vy[p] - cy);

            bool ok = true;

            for (int k = 0; k < N; k++) {

                if (vh[k] > 0 && H - vh[k] != abs(vx[k] - cx) + abs(vy[k] - cy)) {
                    ok = false;
                }

                if (vh[k] == 0 && H > abs(vx[k] - cx) + abs(vy[k] - cy)) {
                    ok = false;
                }
            }

            if (ok) {
                Height = H;
                Cx = cx;
                Cy = cy;
            }

        }
    }

    std::cout << Cx << " " << Cy << " " << Height << "\n";

    return 0;
}


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

public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    
    int N = scanner.nextInt();
    int A[] = new int[N];
    for(int i = 0;i < N;i++){
      A[i] = scanner.nextInt();
    }
    Arrays.sort(A);
    String answer = "YES";
    for(int i = 0;i < N - 1;i++){
      if(A[i] == A[i + 1]) answer = "NO";
    }
    System.out.println(answer);
  }
}

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

int main() {
    int A, B, C, K;
    cin >> A >> B >> C >> K;
    
    if (K < A) {
        cout << K << endl;
    }
    else if (K <= A + B) {
        cout << A << endl;
    }
    else {
        cout << A - (K - A - B) << endl;
    }

    return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1e9+7;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX Euclidean */           ll gcd(ll a,ll b){if(b==0)return a; return gcd(b,a%b);}
/*"lcm"   MIN*/                      ll lcm(ll a,ll b){ll g = gcd(a,b);return a/g*b;}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
ll modpow(ll a,ll n, ll mod){ll res = 1;while(n>0){if (n%2==1){res = res * a % mod;}a = a * a % mod;n/=2;}return res;}
int main() {
    int n;
    cin >> n;
    int ans = 0,senB=0,atoA=0,all =0;
    for(int i=0;i<n;i++){
        string s;
        cin >> s;
        for(int j=1;j<s.size();j++){
            if(s.at(j-1)=='A'&&s.at(j)=='B')ans++;
        }
        if(s.at(0)=='B'&&s.at(s.size()-1)=='A')all++;
        else if(s.at(0)=='B')senB++;
        else if(s.at(s.size()-1)=='A')atoA++;
    }
    if(all>0){
        ans+=all-1;
        if(atoA>0){
            ans++;
            atoA--;
        }
        if(senB>0){
            ans++;
            senB--;
        }
    }
    ans+=min(atoA,senB);
    cout << ans << endl;
}
    



Measured memory_bytes: 256
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		String[] s = saori.nextHayami().split("");
		int ans = 0;
		for(int i = 0;i < s.length/2;i++){
			if(s[i].equals(s[s.length-1-i])){

			} else {
				ans++;
			}
		}
		
		System.out.println(ans);
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

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

using namespace std;

typedef long long ll;
typedef long long unsigned int llui;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< vector<int> > vvi;
typedef set<int> si;
typedef map<string, int> msi;
typedef map<int, int> mii;

#define INF 1000000000
#define MOD 1000000007
#define EPS 1e-9
#define DEBUG(x) cout<< '>' << #x << ':' << x << "\n";
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define UNIQUE(x) SORT(x),(x).erase(unique((x).begin(),(x).end()),(x).end())
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define SZ(a) int((a).size())
#define CLR(a) memset(a,0,sizeof(a))
#define SET(a,b) memset(a,b,sizeof(a))

#define FOR(i,a,b) for (int i = int(a); i < int(b); i++)
#define FORD(i,a,b) for(int i=int(b)-1; i>=int(a); i--)
#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REP1(i,n) for (int i = 1; i <= int(n); i++)
#define REV(i, n) for (int i = int(n)-1; i >=0 ; i--)

#define sd(n) scanf("%d",&n)
#define dsd(n) int n; scanf("%d",&n)
#define sd2(a,b) scanf("%d%d",&a,&b)
#define dsd2(a,b) int a,b; scanf("%d%d",&a,&b)
#define sd3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define dsd3(a,b,c) int a,b,c; scanf("%d%d%d",&a,&b,&c)
#define pd(n) printf("%d\n",n)
#define pds(n) printf("%d ",n)
#define sll(n) scanf("%lld",&n)
#define dsll(n) ll n; scanf("%lld",&n)
#define sll2(a,b) scanf("%lld%lld",&a,&b)
#define dsll2(a,b) ll a,b; scanf("%lld%lld",&a,&b)
#define sll3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define dsll3(a,b,c) ll a,b,c; scanf("%lld%lld%lld",&a,&b,&c)
#define pll(n) printf("%lld\n",n)	
#define plls(n) printf("%lld ",n)	
#define print(x) cout<< x << "\n"

#define trace(x) cout << '>' << #x << ':' << x << "\n"
#define trace2(x,y) cout<< '>' << #x << ':' << x << " | " << #y << ':' << y << "\n"
#define trace3(a,b,c) cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define trace4(a,b,c,d) cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"

inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }

#define LSOne(S) (S&(-S))

const double pi = acos(-1);
const int oo = 0x3f3f3f3f;

int cmp(double x, double y = 0, double tol = EPS) {
    return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}

/////////////////////////////////////////////////////////////////////

const int MAX_N = 110;
//int arr[MAX_N];

int main(){
    dsd(n);
    vi V(n);
    REP(i,n) sd(V[i]);
    vi A(n);
    A[0]=0;A[1]=abs(V[1]-V[0]);
    FOR(i,2,n){
        A[i]=min(abs(V[i]-V[i-1])+A[i-1],abs(V[i]-V[i-2])+A[i-2]);
    }
    pd(A[n-1]);
	return 0;
}


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

int main() {
  int s, s1, s2, s3;
  cin >> s;
  s1 = s / 100;
  s2 = s % 100 / 10;
  s3 = s % 100 % 10 / 1;
  cout << s1 + s2 + s3 <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
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; }

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int l,r,s,x;

int dp[400];

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int n,m;
    cin >> n;
    vector<int> v,w;
    rep(_,n){
        cin >> l >> r >> s;
        for(int i=l;i<=r;i++){
            w.push_back(i);
            v.push_back(s);
        }
    }
    rep(i,400){
        rep(j,w.size()){
            if(i>=w[j])chmax(dp[i],dp[i-w[j]]+v[j]);
        }
    }
    cin >> m;
    vector<int> ans;
    rep(i,m){
        cin >> x;
        ans.push_back(dp[x]==0?-1:dp[x]);
        if(dp[x]==0){
            cout << -1 << endl;
            return 0;
        }
    }
    for(auto x:ans)cout << x << endl;
}


Measured memory_bytes: 4516
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c;
    cin >> a >> b>> c;
    int k;
    cin >> k;
    bool chk = false;
    while(k > 0 &&a >= b){
        k--;
        b *= 2;
    }

    while(k > 0 && b >= c){
        k--;
        c *= 2;
    }
    if(a<b && b<c)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
}

Measured memory_bytes: 3628
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int ans = 1001001001;
        for(int i =0;i<s.length()-2;i++){
            int tmp = Integer.parseInt(s.substring(i, i+3));
            ans = Math.min(ans,Math.abs(753-tmp));
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21716
#include<bits/stdc++.h>
#include<cstring>
#include<cmath>
#include<iterator>
#include<cstdlib>
#define IOS   ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ses   "\n"
#define whp   " "
#define mxi 99999
#define mp make_pair
#define PII pair<int, int>
#define pf printf
#define sf scanf
#define ALL(x) x.begin(),x.end()
#define pb push_back
#define PI acos(-1)
#define sz(a) long long(a.size())
#define ff first
#define ss second
#define forch(it,s) for(auto it:s)
#define each(it,s) for(auto it = s.begin(); it != s.end(); ++it)
#define rep0(i,a,b) for(int i=a; i<b; i++)
#define rep1(i,a,b) for(int i=a; i<=b; i++)
#define rep0in(i,a,b) for(int i=a-1; i>=b; i--)
#define rep1in(i,a,b) for(int i=a; i>b; i--)
#define repv(i,a) for(auto i=a.begin(); i!=a.end();++i)
//ostringstream str1;
 //       str1 << z;
  //      string c=str1.str();
///priority_queue <int, vector<int>, greater<int>> g
#define MS(a,b) memset(a,b,sizeof(a));

typedef long long ll;
typedef unsigned long long ull;
using namespace std;
ll fx[4]= {1,-1,0,0};
ll fy[4]= {0,0,1,-1};

typedef vector<ll> vll;
typedef vector<string> vss;
typedef vector<pair<ll,ll > > vpr;
typedef vector<pair<string,ll > > vspr;
typedef list<ll> li;
typedef list<string> ls;
typedef list<pair<ll,ll> > lpr;
typedef list<pair<string,ll> > lspr;
bool rs(ll a, ll b){return(a>b);}
ll spd(ll n){ if(n%2==0)return 2; for(ll i=3; i*i<=n; i++){if(n%i==0)return i;}return n;}

int main(){
ll n,x,t;
cin>>n>>x>>t;
ll r=n%x;
ll k;
if(r!=0){k=n/x+1;}
else{k=n/x;}
cout<<k*t<<endl;

return 0;
}


Measured memory_bytes: 3616