akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <algorithm>
#include <functional>
#include <cstring>
#include <limits.h>
#include <bitset>
#include <complex>
#include <cassert>
#define FOR(i,k,n)  for (int i=(k); i<(int)(n); ++i)
#define REP(i,n)    FOR(i,0,n)
#define FORIT(i,c)	for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define SZ(i) ((int)i.size())
#define GI(i) (scanf("%d",&i))
#define GLL(i) (scanf("%lld",&i))
#define GD(i)  (scanf("%lf",&i))
#define PB          push_back
#define MP          make_pair
#define MT          make_tuple
#define GET0(x)     (get<0>(x))
#define GET1(x)     (get<1>(x))
#define GET2(x)     (get<2>(x))
#define ALL(X)      (X).begin(),(X).end()
#define LLMAX       (1LL<<60)
#define LLMIN       -(1LL<<60)
#define IMAX        (1<<30)
#define IMIN        -(1<<30)
typedef long long LL;
using namespace std;

#define MAX_N 100000+1
int prime[MAX_N];

void eras(){
    for(int i=0;i<MAX_N;i++)
        prime[i]=1;
    prime[0]=prime[1]=0;
    for(int i=0;i<MAX_N;i++)
        if(prime[i])
            for(int j=i+i;j<MAX_N;j+=i)
                prime[j]=0;
}

int sum[MAX_N];

int main(void){
    eras();
    REP(i,MAX_N){
        if(i==0)
            sum[i]=0;
        else{
            if(i%2==1 && prime[i] && prime[(i+1)/2])
                sum[i] = sum[i-1]+1;
            else
                sum[i] = sum[i-1];
        }
    }
    int Q;
    GI(Q);
    REP(i,Q){
        int l,r;
        GI(l);GI(r);
        printf("%d\n",sum[r]-sum[l-1]);
    }
    return 0;
}



Measured memory_bytes: 1408
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#define MAXN 5005
#define p 1000000007
#define LL long long
using namespace std;

int n, cnt, head[MAXN], size[MAXN];
LL f[MAXN][MAXN][2];

struct Edge {int next, to;} edge[MAXN*2];

void addedge(int from, int to)
{
	edge[++cnt].next=head[from];
	edge[cnt].to=to;
	head[from]=cnt;
}

void dfs(int x, int fa)
{
	size[x]=1; f[x][1][0]=1;
	for(int i=head[x]; i; i=edge[i].next)
	{
		int to=edge[i].to;
		if(to==fa) continue;
		dfs(to, x);
		for(int j=size[x]+size[to]; j>=0; j--)
		{
			LL tx=f[x][j][0], ty=f[x][j][1];
			f[x][j][0]=(f[to][0][0]*tx+f[to][0][1]*ty)%p;
			f[x][j][1]=(f[to][0][0]*ty+f[to][0][1]*tx)%p;
			for(int k=max(1, j-size[x]); k<=min(j, size[to]); k++)
			{
				f[x][j][0]=(f[x][j][0]+f[to][k][0]*f[x][j-k][0]%p+f[to][k][1]*f[x][j-k][1]%p)%p;
				f[x][j][1]=(f[x][j][1]+f[to][k][0]*f[x][j-k][1]%p+f[to][k][1]*f[x][j-k][0]%p)%p;
			}
		}
		size[x]+=size[to];
	}
	LL temp=1;
	for(int i=2; i<=size[x]; i+=2)
	{
		temp=temp*(i-1)%p;
		f[x][0][0]=(f[x][0][0]+f[x][i][1]*temp)%p;
		f[x][0][1]=(f[x][0][1]+f[x][i][0]*temp)%p;
	}
}

int main()
{
	scanf("%d", &n);
	for(int i=1; i<n; i++)
	{
		int x, y;
		scanf("%d%d", &x, &y);
		addedge(x, y);
		addedge(y, x);	
	}
	dfs(1, 0);
	printf("%lld\n", (f[1][0][1]-f[1][0][0]+p)%p);
}

Measured memory_bytes: 383616
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<iomanip>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;
ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}


int main(){
  ll N, M; cin >> N >> M;
  vector<ll> a(N); rep(i,N) cin >> a[i];
  vector<ll> b(N); rep(i,N) b[i] = a[i]; rep(i,N) b[i] /= 2;


  // それぞれが何回2でわれるかを保存していく
  vector<ll> cnt(N);
  rep(i,N){
    while(a[i] % 2 == 0){
      a[i] /= 2;
      cnt[i]++;
    }
  }
  rep(i,N - 1){
    if(cnt[i] != cnt[i + 1]){
      cout << 0 << endl;
      return 0;
    }
  }

  // 何個あるか　最初の値から　2倍ずつ離れる
  ll lcm = b[0];
  rep(i,N){
    lcm = lcm * b[i] / gcd(lcm , b[i]);
    if(lcm > M){
      cout << 0 << endl;
      return 0;
    }
  }
  if(lcm > M) cout << 0 << endl;
  else {
    ll ans = (M - lcm) / (2 * lcm) + 1;
    cout << ans << endl;
  }
}


Measured memory_bytes: 2560
#include <iostream>
#include <cstdlib>

using namespace std;

int n;
int niz[100010];
int memo[100010];

int rek(int i){

    if (memo[i] != -1)return memo[i];
    if (i == n - 1)return 0;
    if (i == n - 2)return abs(niz[i] - niz[i + 1]) + rek(i + 1);

    int s1 = abs(niz[i] - niz[i + 1]);
    int s2 = abs(niz[i] - niz[i + 2]);
    int ret = min(rek(i + 1) + s1, rek(i + 2) + s2);
    memo[i] = ret;
    return ret;
}

int main (){

    cin >> n;
    for (int i = 0; i < n; i++){
        cin >> niz[i];
        memo[i] = -1;
    }
    cout << rek(0);

    return 0;
}


Measured memory_bytes: 3328
import sys
h,w=map(int,input().split())
graph=[[]*w for i in range(h)]
for i in range(h):
  graph[i]=list(input())
A=0
B=0
C=0
D=0
E=0
F=0
G=0
H=0
I=0
J=0
K=0
L=0
M=0
N=0
O=0
P=0
Q=0
R=0
S=0
T=0
U=0
V=0
W=0
X=0
Y=0
Z=0
for i in range(h):
  A=A+graph[i].count("a")
for i in range(h):
  B=B+graph[i].count("b")
for i in range(h):
  C=C+graph[i].count("c")
for i in range(h):
  D=D+graph[i].count("d")
for i in range(h):
  E=E+graph[i].count("e")
for i in range(h):
  F=F+graph[i].count("f")
for i in range(h):
  G=G+graph[i].count("g")
for i in range(h):
  H=H+graph[i].count("h")
for i in range(h):
  I=I+graph[i].count("i")
for i in range(h):
  J=J+graph[i].count("j")
for i in range(h):
  K=K+graph[i].count("k")
for i in range(h):
  L=L+graph[i].count("l")
for i in range(h):
  M=M+graph[i].count("m")
for i in range(h):
  N=N+graph[i].count("n")
for i in range(h):
  O=O+graph[i].count("o")
for i in range(h):
  P=P+graph[i].count("p")
for i in range(h):
  Q=Q+graph[i].count("q")
for i in range(h):
  R=R+graph[i].count("r")
for i in range(h):
  S=S+graph[i].count("s")
for i in range(h):
  T=T+graph[i].count("t")
for i in range(h):
  U=U+graph[i].count("u")
for i in range(h):
  V=V+graph[i].count("v")
for i in range(h):
  W=W+graph[i].count("w")
for i in range(h):
  X=X+graph[i].count("x")
for i in range(h):
  Y=Y+graph[i].count("y")
for i in range(h):
  Z=Z+graph[i].count("z")
List=[A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z]
if w%2==0 and h%2==0:
  for i in range(26):
    if List[i]%4==0:
      if i==25:
        print("Yes")
    else:
      print("No")
      sys.exit()
elif w%2==0 :
  a_2=0
  a_4=0
  for i in range(26):
    if List[i]%4==1 or List[i]%4==3:
      print("No")
      sys.exit()
    elif List[i]%4==0:
      a_4=a_4+1
    else:
      a_2=a_2+1
  if a_2%2==(w//2)%2 and a_2<=(w//2):
    print("Yes")
  else:
    print("No")
elif h%2==0 :
  a_2=0
  a_4=0
  for i in range(26):
    if List[i]%4==1 or List[i]%4==3:
      print("No")
      sys.exit()
    elif List[i]%4==0:
      a_4=a_4+1
    else:
      a_2=a_2+1
  if a_2%2==(h//2)%2 and a_2<=(h//2):
    print("Yes")
  else:
    print("No")
else:
  a_1=0
  a_2=0
  a_3=0
  a_4=0
  for i in range(26):
    if List[i]%4==1:
      a1=List[i]
      a_1=a_1+1
      if a_1==2:
        print("No")
        sys.exit()
    elif List[i]%4==2:
      a_2=a_2+1
    elif List[i]%4==3:
      a3=List[i]
      a_3=a_3+1
      if a_3==2:
        print("No")
        sys.exit()
    else:
      a_4=a_4+1
  if a_1==1 and a_3==0:
    if a_2%2==(((h-1)//2)+((w-1)//2))%2 and a_2<=((h-1)//2)+((w-1)//2)-max(0,2*(((a1-1)//4)-(((h-1)//2)*((w-1)//2)))):
      print("Yes")
    else:
      print("No")
  elif a_1==0 and a_3==1:
    if a_2%2==(((h-1)//2)+((w-1)//2)+1)%2 and a_2<=((h-1)//2)+((w-1)//2)-1-max(0,2*(((a3-3)//4)-(((h-1)//2)*((w-1)//2)))):
      print("Yes")
    else:
      print("No")
  else:
    print("No")

Measured memory_bytes: 3956
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define mod 1000000007
using namespace std;

vector<vector<int> >g;

ll dp[100005][2];

ll dfs(int v,int p,int col){
	ll& ans = dp[v][col];
	if(ans!=-1)
		return ans;

	ans = 1;
	vector<ll> tmp;
	for(auto to: g[v]){
		if(to == p)
			continue;
		
		tmp.pb(dfs(to,v,0));
		if(!col)
			tmp.back() = (tmp.back()+dfs(to,v,1))%mod;
	}
	for(auto x: tmp)
		ans = (ans*x)%mod;
	return ans;	
}

int main(){
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);cout.tie(NULL);	
	int n;
	cin>>n;
	g.resize(n+1);
	for(int i=1;i<n;++i)
	{
		int x,y;
		cin>>x>>y;
		g[x].pb(y);
		g[y].pb(x);
	}
	memset(dp,-1,sizeof dp);
	cout<<(dfs(1,-1,0)+dfs(1,-1,1))%mod;
	// cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n" ;
	return 0;
}

Measured memory_bytes: 19840
console.log((args=>{
  const [R,G,B,N] = args.trim().split(' ').map(v=>v|0);
  let count = 0;
  for ( let r = 0; r <= N; r+=R ) {
    for ( let g = 0; r+g <= N; g+=G ) {
      if ( (N-r-g)%B === 0 ) count++;
    }
  }
  return `${count}`;
})(require('fs').readFileSync('/dev/stdin', 'utf8')));


Measured memory_bytes: 32152
#include <cstdio>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <cmath>
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
ll intpow(int n,int m){
    if(m==0)return 1;
    return n*intpow(n,m-1);
}
ll gcd(ll n,ll m){
    n = max(n,m);
    m = min(n,m);
    if(n%m == 0)return m;
    return gcd(m,n%m);
}
ll lcm(ll n,ll m){
    return n*m/gcd(n,m);
}
const int inf=2147483647;
int n;
bool node[2000000][26];
void init(int n_){
    while(n<n_)n*=2;
    rep(i,2*n-1){
        rep(j,26)node[i][j]=0;
    }
}
void update(int i,char a,char b){
    i += n-1;
    int m1 = a-97;
    int m2 = b-97;
    node[i][m1]=0;
    node[i][m2]=1;
    while(i>0){
        i=(i-1)/2;
        node[i][m1]=node[i*2+1][m1]||node[i*2+2][m1];
        node[i][m2]=node[i*2+1][m2]||node[i*2+2][m2];
    }
}
int query(int a,int b,int k,int l,int r,int c){
    if(r<=a || b<=l)return 0;
    if(a<=l && r<=b)return node[k][c];
    else{
        bool vl = query(a,b,k*2+1,l,(l+r)/2,c);
        bool vr = query(a,b,k*2+2,(l+r)/2,r,c);
        return vl||vr;
    }
}

int main(){
    int N,q;cin >> N;
    string s;cin >> s;
    cin >> q;
    n=1;
    init(s.size());
    rep(i,s.size())update(i,'a',s[i]);
    rep(i,q){
        int type;
        cin >> type;
        if(type == 1){
            int j;char c;cin>>j>>c;
            j--;
            update(j,s[j],c);
            s.replace(j,1,1,c);
        }
        if(type == 2){
            int l,r;cin>>l>>r;
            int sum=0;
            rep(j,26)sum += query(l-1,r,0,0,n,j);
            cout << sum <<endl;
        }
    }
}

Measured memory_bytes: 29572
/// Bismillahir Rahmanir Rahim
/* Author: Mohammad Morsalin
    Dept of ICE, NSTU
*/
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define endl "\n"
#define f0(n) for(int i=0;i<n;i++)
#define ms(x) memset(x,0,sizeof(x))
#define ins insert
#define ALL(v) v.begin(),v.end()
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define PI acos(-1)
#define IOS ios::sync_with_stdio(false);
using namespace std;
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const long long MOD = 1000000007;
template<typename T>inline T Bigmod(T base, T power, T MOD){
    T ret=1;
    while(power)
    {
        if(power & 1)ret=(ret*base)%MOD;
        base=(base*base)%MOD;
        power>>=1;
    }
    return ret;
}

bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}
int main()
{
    IOS
    ll n;
    while(cin>>n){
        ll ans=0;
        ll sq=sqrt(n)+1;
        for(ll i=2;i<=sq;i++){
            ll cnt=0;
            while(n%i==0){
                cnt++;
                n/=i;
            }
            ll po=1;
            while(cnt>0){
                if(cnt-po>=0)ans++;
                cnt-=po;
                po++;
            }
        }
        if(n>1)ans++;
        cout << ans <<endl;
    }
    return 0;
}


Measured memory_bytes: 3692
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int k;
    string s;

    cin >> k >> s;

    if(s.size() <= k){
        cout << s;
    }

    else {
        s = s.erase(k);
        cout << s << "...";
    }
    

}

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

const int MAXN = (int)1e5 + 1;
int N, A, B, dist[MAXN], depth[MAXN];
bool vis[MAXN] = {0};
vector<int> edges[MAXN];

void dfs(int u, int (&arr)[MAXN]) {
    for (int v : edges[u]) {
        if (arr[v] == (int)1e9) {
            arr[v] = arr[u] + 1;
            dfs(v, arr);
        }
    }
}

int main() {
    cin >> N >> A >> B;
    for (int i = 1; i <= N - 1; i++) {
        int a, b;
        cin >> a >> b;
        edges[a].push_back(b);
        edges[b].push_back(a);
    }

    fill(dist + 1, dist + 1 + N, (int)1e9);
    dist[A] = 0;
    dfs(A, dist);
    fill(depth + 1, depth + 1 + N, (int)1e9);
    depth[B] = 0;
    dfs(B, depth);

    int ans = 0;
    for (int i = 1; i <= N; i++) {
        if (dist[i] < depth[i]) {
            ans = max(ans, depth[i] - 1);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 10368
#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(), (v).end()
#define lp(i, n) for (int i = 0; i < (n) ; ++i)
#define sz(v) (ll)(v).size()
#define int long long

int32_t main(){
ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
        int n; cin >> n;
        vector<int> v;
        lp(i, n) { int a; cin >> a; v.push_back(a); }
        sort(all(v));
        int an = 0;
        for (int i = 0; i < n; i++) {
                for (int j = i + 1; j < n; j++) {
                        int nm = v[i] + v[j];
                        int pos = lower_bound(all(v), nm) - v.begin();
                        int wh = pos - j - 1;
                        an += wh;
                }
        }
        cout << an;
return 0;
}


Measured memory_bytes: 256
n, k = list(map(int,input().split()))
dp = [0]*n
a = list(map(int, input().split()))

for i in range(1, n):
  dp[i] =  min([dp[i-j-1]+abs(a[i]-a[i-j-1]) for j in range(min(k, i))])
print(dp[n-1])

Measured memory_bytes: 53216
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		sc.close();
		
		if(N/10 == 9 || N%10 == 9)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
}


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

int main()
{
    int n, ans = 0;
    string s;

    cin >> n >> s;

    for(int i = 0; i < n; i++){
        string ch = s.substr(i, 3);

        if(ch == "ABC") ans++;
    }

    cout << ans << endl;

    return 0;
}


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

#define MIN(X,Y) ((X)<(Y)?(X):(Y))

int dp[20][50001];

int main(void){
  int n,m;
  vector<int> c;
  int ans;
  
  cin >> n >> m;
  for (int i=0; i<m; i++){
    int t;
    cin >> t;
    c.push_back(t);
  }
  sort(c.begin(), c.end());
  if (c[0]!=1){
    cout << -1 << endl; // 1円玉がない
    return 0;
  }
  for (int i=0; i<m; i++) dp[i][0] = 0; // 何円玉でも0円は0枚
  for (int j=0; j<=n; j++) dp[0][j] = j; // 1円玉でi円はi枚
  for (int i=1; i<m; i++){
    for (int j=1; j<=n; j++){
      if (c[i]>j) dp[i][j] = dp[i-1][j]; // 払う金額より高いコインは使わない
      else dp[i][j] = MIN(dp[i-1][j], dp[i][j-c[i]]+1);
    }
  }
  
/*  for (int j=0; j<=n; j++){
    for (int i=0; i<m; i++){
      cout << dp[i][j] << " ";
    }
    cout << endl;
  }*/
  cout << dp[m-1][n] << endl;
  return 0;
}



Measured memory_bytes: 7084
import sys
n=int(sys.stdin.readline())
a=list(map(int,sys.stdin.readline().split()))

x=[sum(a)-2*sum(a[1::2])]
for i in range(n-1):
    s=2*a[i]-x[i]
    x.append(s)
s=map(str,x)
print(" ".join(s))


Measured memory_bytes: 19052
#include<iostream>
#include<math.h>
#include<string.h>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<deque>
using namespace std;

bool func(string s){
	int x=s.size()/2;
	for(int i=0;i<x;i++){
		if(s[i]!=s[i+x]){
			return false;
		}
	}
	return true;
}

int main(){
	string s;
	cin >> s;
	
	while(1){
		s.pop_back();
		s.pop_back();
		if(s.size()==0)break;
		if(func(s)==true)break;
	}
	cout << s.size() << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <iomanip>
#include <numeric>

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
template<class T>using vv = vector<vector<T>>;

#define in(v) v; cin >> v;
// #define rep(i,n) for(int i=0;i<(n);++i)
#define all(f,c,...) (([&](decltype((c)) cccc) { return (f)(begin(cccc), end(cccc), ## __VA_ARGS__); })(c))
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

#define rrep(i,n) for(int i=(n);i>=0;--i)
const int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}

// debug
template<class T>ostream& operator<<(ostream& os,const vector<T>& vec){os<<"{";for(size_t i=0;i<vec.size();++i)os<<(i?", ":"")<<vec[i];os<<"}";return os;}
ostream& operator<<(ostream& os,const vector<char>&v){for(size_t i=0;i<v.size();++i)os<<v[i];return os;}
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>& rhs){os<<"("<<rhs.first<<", "<<rhs.second<<")";return os;}


#ifdef LOCAL
void debug() {cerr << "\n";}
template<class First> void debug(const First& first) {cerr<<first<<"\n";}
template<class First, class... Rest> void debug(const First& first, const Rest&... rest) {cerr<<first<<",";debug(rest...);}
#else
#define debug(...) 42
#endif

int main() {
  int in(N);
  ++N;

  ll ans = 0;
  rep(a, 1, N) {
    rep(b, 1, N) {
      rep(c, 1, N) {
        ans += gcd(a, gcd(b, c));
      }
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3620
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    static ArrayList<trip> ll;
    public static void main(String[] args){
        try{
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            String[] ss=br.readLine().split(" ");
            int a=Integer.parseInt(ss[0]);
            int b=Integer.parseInt(ss[1]);
            if(a<b){
                System.out.println(0);
            }else{
                System.out.println(10);
            }

        }catch(Exception e){
            System.out.println("KKKK "+e.getMessage());
        }
    }

    static class trip{
        int lev,node,child;
        public trip(int lev,int node,int child){
            this.lev=lev;
            this.node=node;
            this.child=child;
        }
    }
    static void bfs(ArrayList<ArrayList<Integer>> list){
        Queue<trip> q=new ArrayDeque<>();
        q.add(new trip(0,0,list.get(0).size()));
        boolean[] brr=new boolean[list.size()];
        brr[0]=true;
        while(q.size()>0){
            trip t=q.poll();
            if(t.child==0) {
                ll.add(t);
            }

            int node=t.node;
            for(int i=0;i<list.get(node).size();i++){
                int u=list.get(node).get(i);
                if(!brr[u]){
                    q.add(new trip(t.lev+1,u,list.get(u).size()));
                    brr[u]=true;
                }
            }
        }
    }
    static void shuffle(int[] a) {
        Random get = new Random();
        for (int i = 0; i < a.length; i++) {
            int r = get.nextInt(a.length);
            int temp = a[i];
            a[i] = a[r];
            a[r] = temp;
        }
    }
}


Measured memory_bytes: 21204
n=gets.to_i
arr=gets.split.map(&:to_i)
arr=arr.sort
arr<<0
j=1
ans=0
ss=1

n.times{
    if  arr[j-1]==arr[j]
        ss+=1
        j+=1
    elsif ss>arr[j-1]
      ans+=ss-arr[j-1]
      ss=1
      j+=1
  elsif ss<arr[j-1]
    ans+=ss
    ss=1
    j+=1
    elsif ss==arr[j-1]
    ss=1
    j+=1
end

}



p ans


Measured memory_bytes: 10112
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

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

  int pt=0, px=0, py=0;
  for (int i = 0; i < N; i++) {
    int t, x, y;
    cin >> t >> x >> y;

    int dt = t-pt;
    int dx = abs(x - px);
    int dy = abs(y - py);
    if (dt < dx + dy || dt % 2 != (dx + dy) % 2) { 
      cout << "No" << endl; return 0; 
    }
    pt = t;
    px = x;
    py = y;
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 384
// SeeAlso: 

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define MAX 100000
#define NIL -1
#define MOD 1000000007

typedef int _loop_int;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define debug(x) cout<<#x<<": "<<x<<endl
#define debig_vec(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

// 最大公約数
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);}

#define print2D(h, w, arr) rep(i, h) { rep(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << setprecision(12) << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }

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

    ll ans = min(a,k);
    k -= a;
    if(k>0) {
        k -= b;
    }
    if(k>0) {
        ans -= min(k, c);
    }
    print(ans);
    return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define si(x) scanf("%d",&x)
#define sii(x,y) scanf("%d %d",&x,&y)
#define siii(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define su(x) scanf("%u",&x)
#define sl(x) scanf("%ld",&x)
#define sli(x) scanf("%lld",&x)
#define slii(x,y) scanf("%lld %lld",&x,&y)
#define sliii(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define slu(x) scanf("%llu",&x)
#define sf(x) scanf("%f",&x)
#define slf(x) scanf("%lf",&x)
#define slff(x,y) scanf("%lf %lf",&x,&y)
#define slfff(x,y,z) scanf("%lf %lf %lf",&x,&y,&z)
#define sc(x) scanf("%c",&x)
#define ss(x) scanf("%s",x)
#define pf printf
#define fpf fprintf
#define pb push_back
#define f(i,x,y,z) for(int i=x;i<y;i=i+z)
#define f1(i,x,y,z) for(int i=x;i>y;i=i-z)
#define MAX (int)(1e9)
#define pi 2*acos(0)
#define mp make_pair
#define M 1000000007
#define xx first
#define yy second
#define N (int)(2e5 + 5)
#define vc vector
#define pq priority_queue
#define Q queue
#define E 100005
#define logn 16

using namespace std;

typedef long long int ll;

int pos[N];

int main()
{
    int n, l, r, range, i;
    scanf("%d",&n);
    for(i = 1; i<=n; i++){
        scanf("%d",&l);
        pos[l] = i;
    }
    l = 1;
    r = 2;
    range = n+N;
    while(l<=n){
        while(r<=n && pos[r]>pos[r-1]) r++;

            range = min(range,l-1-(pos[l-1]==1)+n-r+1-(pos[r]==n));
            l = r;
            r++;

        ///cout<<range<<" "<<l<<" "<<r<<endl;
    }
    printf("%d\n",range);
    return 0;
}


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

int main(){
	int n,k,max,buf,*a;
	
	while(1){
		cin >> n >> k;
		
		if(n || k){
			max = buf = 0;
			
			a = new int[n];
			
			for(int i = 0; i < n; i++){
				cin >> a[i];
			}
			
			for(int i = 0; i < k-1; i++){
				buf += a[i];
			}
			
			for(int i = k-1; i < n; i++){
				buf += a[i];
				max = (max < buf)?buf:max;
				buf -= a[i-k+1];
			}
			
			cout << max << endl;
		}else{
			break;
		}
	}
	
	return 0;
}

Measured memory_bytes: 1276
#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do { (t*=10)+=ch-'0'; ch=getchar(); } while ('0'<=ch&&ch<='9'); t*=f;
}
typedef long long ll;
int gcd(int x,int y) {
	if (!x||!y) return x+y;
	return gcd(y,x%y);
}
int n;
ll ans;
int main() {
	//freopen("1.txt","r",stdin);
	read(n);
	for (int i=1;i<=n;i++)
	for (int j=1;j<=n;j++)
	for (int k=1;k<=n;k++)
		ans+=gcd(gcd(i,j),k);
	printf("%d\n",ans);
	return 0;
}
/*
  0. Enough array size? Enough array size? Enough array size? Interger overflow?
  
  1. Think TWICE, Code ONCE!
  Are there any counterexamples to your algo?
    
  2. Be careful about the BOUNDARIES!
  N=1? P=1? Something about 0?
    
  3. Do not make STUPID MISTAKES!
  Time complexity? Memory usage? Precision error?
*/

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

using namespace std;
typedef long long ll;
#define FOR(i,n) for(int i=0; i<int(n); i++)
#define FOR1(i,m,n) for(int i=int(m); i<int(n); i++)

const int MAXN=1e5;
const int MAXA=1e9;
int n;
ll count[2], sum[2];

int main(int argc, char *argv[])
{
    int a, sign=1;
    scanf("%d", &n);
    FOR(i,n) {
        scanf("%d", &a);
        sum[0] += a;
        sum[1] -= a;
        FOR(j,2) {
            if (sign * sum[j] <= 0) {
                ::count[j] += 1 - sign * sum[j];
                sum[j] = sign;
            }
        }
        sign *= -1;
    }

    printf("%lld\n", min(::count[0], ::count[1]));
    return 0;
}


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

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;

const int dx[4] = {+1, 0, -1, 0};
const int dy[4] = {0, -1, 0, +1};

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    ll k, a, b; cin >> k >> a >> b;
    ll ans = 1;
    if(a + 2 < b && k > a - 1){
        ans = a;
        ll rep = k - a + 1;
        ans += ((rep / 2) * (b - a));
        if(rep %2) ans += 1;
    }else{
        ans += k;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <set>
#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 true;
    return false;
}

void solve(long long N, std::string S){
    int ans = -1;
    REP(i, N) {
        string s1 = S.substr(0, i);
        set<char> s1S;
        REP(j, s1.size()) s1S.insert(s1[j]);

        string s2 = S.substr(i);
        set<char> s2S;
        REP(j, s2.size()) s2S.insert(s2[j]);

        set<char> result;
        set_intersection(s1S.begin(), s1S.end(),
                s2S.begin(), s2S.end(),
                inserter(result, result.end()));
        chmax(ans, (int)result.size());
    }
    cout << ans << '\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long N;
    cin >> N;
    std::string S;
    std::cin >> S;
    solve(N, S);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define pic pair<int,char>
#define pci pair<char,int>
#define pll pair<ll,ll>
#define plc pair<ll,char>
#define pcl pair<char,ll>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define vic vector<pic>
#define vci vector<pci>
#define vlc vector<plc>
#define vcl vector<pcl>
#define pb push_back
const ll MOD=1e9+7;
const ll MAXN=1e5+3;
const ll MAXM=1e5+3;
vector<int>idxs[32];
int brt[32];
int brs[32];
string s;
string t;
int bs(vector<int>v,int val)
{
    int l=0,r=v.size()-1,m,ans=-1;
    while(l<=r)
    {
        m=(l+r)/2;
        if(v[m]>val)
        {
            ans=m;
            r=m-1;
        }
        else l=m+1;
    }
    //cout<<ans<<endl;
    return ans;
}
bool b2[32];
void solve()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>s;
    cin>>t;
    int tsize=t.size();
    int ssize=s.size();
    for(int i=0;i<ssize;++i)
    {
        idxs[s[i]-'a'].push_back(i);
        b2[s[i]-'a']=1;
    }
    for(int i=0;i<tsize;++i)
    {
        if(b2[t[i]-'a']==0)
        {
            cout<<"-1\n";
            return;
        }
    }
    int last=-1,l1=0,r2=-1;
    for(int i=0;i<tsize;++i)
    {
        if(i!=0&&t[i]==t[i-1])
        {
            if(r2==idxs[t[i]-'a'].size()-1)
            {
                last=idxs[t[i]-'a'][0];
                l1++;
                r2=0;
            }
            else
            {
                last=idxs[t[i]-'a'][r2+1];
                r2++;
            }
        }
        else if(idxs[t[i]-'a'][idxs[t[i]-'a'].size()-1]<=last)
        {
            last=idxs[t[i]-'a'][0];++l1;
            r2=0;
        }
        else
        {
            int r1=bs(idxs[t[i]-'a'],last);
            last=idxs[t[i]-'a'][r1];
            r2=r1;
        }
    }
    cout<<(ll)((ll)last+(ll)l1*ssize+1ll)<<"\n";
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    solve();
return 0;
}


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

int main(void) {
    int n;
    cin >> n;
    unsigned long long res=0;
    vector<unsigned long long> v={0,0,0,0,0};
    string tmp;
    rep(i,n){
        cin >> tmp;
        char f = tmp[0];
        if(f=='M'){v[0]++;}
        else if(f=='A'){v[1]++;}
        else if(f=='R'){v[2]++;}
        else if(f=='C'){v[3]++;}
        else if(f=='H'){v[4]++;}
    }
    rep(i,5){
        rep(j,5){
            // if(i>=j)continue;
            rep(k,5){
                
                // if(j>=k)continue;
                if(i<j&&j<k){
                    // cout << i << j << k << endl;
                    res += v[i]*v[j]*v[k];
                    
                    }
            }
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define gc getchar_unlocked()
#define pc(x) putchar_unlocked(x)
template<typename T> void scan(T &x){x = 0;bool _=0;T c=gc;_=c==45;c=_?gc:c;while(c<48||c>57)c=gc;for(;c<48||c>57;c=gc);for(;c>47&&c<58;c=gc)x=(x<<3)+(x<<1)+(c&15);x=_?-x:x;}
template<typename T> void printn(T n){bool _=0;_=n<0;n=_?-n:n;char snum[65];int i=0;do{snum[i++]=n%10+48;n/= 10;}while(n);--i;if (_)pc(45);while(i>=0)pc(snum[i--]);}
template<typename First, typename ... Ints> void scan(First &arg, Ints&... rest){scan(arg);scan(rest...);}
template<typename T> void print(T n){printn(n);pc(10);}
template<typename First, typename ... Ints> void print(First arg, Ints... rest){printn(arg);pc(32);print(rest...);}

using namespace std;


int main(){
    
    int x;
    long long sum = 0;
    cin>>x;
    long long d = x/500;
    x -= d*500;
    sum += d*1000;
    d = x/5;
    sum += d*5;
    print(sum);
    
    return 0;
}

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

int N,arr[50]; //N is a const

int main() {
  double avg = 0.0;
  cin >> N;
  //1st
  for (int i=0;i<N;i++){
    cin >> arr[i];
  }
  sort(arr, arr+N);
  avg  = (arr[0]+arr[1])/2.0; 
  for (int i=2;i<N;i++){
     avg = (avg+arr[i])/2;
  }

  cout << avg;
  return 0;
}

Measured memory_bytes: 256
n=int(input())
l=input().split()
s=0

max=int(l[0])
min=int(l[0])

for i in range(n):
    a=int(l[i])
    
    if min > a:
        min=a
        s+=a
        
    elif max<a:
        max=a
        s+=a
    else:
        s+=a

print(min,max,s)


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

using namespace std;
using llong = long long;
using P = pair<llong, llong>;

#define BE(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	int a,b;
	cin >>a >>b;
	if(a+b >= 10)
		cout << "error" << endl;
	else
		cout << a+b << endl;

	return 0;
}

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

int main(){
string s[3];
  cin>>s[0]>>s[1]>>s[2];
  
  int turn=0, ans;
  while(true){
   if(s[turn].size()==0){ans=turn; break;}
    
   int n=s[turn][0]-'a'; // 'a'は数字として扱われており、a-a=0,c-a=2になっている
    s[turn]=s[turn].substr(1, s[turn].size()-1); // s[turn]をs[turn][1]から
    turn=n;                    // s[turn].size()-1まで取り出した文字列にする
  }             // turn=nとして上のs[turn].size()==0で検証できるように回す
 if(ans==0){cout<<"A";}
 else if(ans==1){cout<<"B";}
 else{cout<<"C";}

}

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

typedef long long ll;
const int INF = 1e9;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	double n;
	cin>>n;
	cout<<n*2*3.14159<<'\n';
	return 0;
}

Measured memory_bytes: 3796
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<map>
#include <algorithm>
#include<cstdlib>
#include<cmath>
#include<deque>
#include <numeric>
#include<valarray>
typedef unsigned long long ull;
typedef  long long ll;

int main() {
	ll N;
	//std::vector<ll> AX;

	std::cin >> N ;
	ll max1 = -1;
	ll max2 = -1;
	ll maxindex = -1;

	for (ll i = 0; i < N; i++) 
	{
		ll B;
		std::cin >> B;
		if ((max1 < 0) || (max1 < B))
		{
			ll tmpmax2 = max1;

			max1 = B;
	   		maxindex = i;
			if ((max2 < 0) || (max2 < tmpmax2))
			{
				max2 = tmpmax2;
			}
		}
		else if ((max2 < 0) || (max2 < B))
		{
			max2 = B;
		}
	}

	for (ll i = 0; i < N; i++)
	{
		if (i != maxindex)
		{
			std::cout << max1 << std::endl;
		}
		else
		{
			std::cout << max2 << std::endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pp pop_back
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define f0(i,a,n) for(i=a;i<n;i++)
#define f1(I,a,b) for(i=a;i<=b;i++)
#define stp setprecision
#define nl endl
#define ipt(a) for(i=0;i<n;i++)cin>>a[i];
#define pll pair<ll,ll>
#define vl vector<ll>
#define mp map<ll,ll>
int main()
{
    fast;
    ll t;
    string s;
    cin>>s;
    ll l=s.length();
    if(s[l-1]=='s')
    cout<<s<<"es";
    else
    cout<<s<<"s";
}

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

#define FI(i,a,b) for(int i=(a);i<=(b);i++)
#define FD(i,a,b) for(int i=(a);i>=(b);i--)

#define LL long long
#define Ldouble long double
#define PI 3.14159265358979323846264338327950288419

#define PII pair<int,int>
#define PLL pair<LL,LL>
#define mp make_pair
#define fi first
#define se second

using namespace std;

int n, dist, s[100005], ans;
vector<int> v[100005];

int dfs(int id){
	int ret = 1;
	for(auto to: v[id]) ret = max(ret, dfs(to) + 1);
	if(ret >= dist && s[id] != 1){
		ans++;
		ret = 0;
	}
	return ret;
}

int main(){
	scanf("%d %d", &n, &dist);
	FI(i, 1, n) scanf("%d", &s[i]);
	if(s[1] != 1) s[1] = 1, ans++;
	FI(i, 2, n) v[s[i]].push_back(i);
	dfs(1);
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 10752
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

int main() {
  ll N;
  cin >> N;
  vector<ll> A(5);
  for (int i = 0; i < 5; i++) cin >> A[i];
  ll ans = 4;
  ll minNum = *min_element(A.begin(), A.end());
  ll plus = N / minNum;
  if (N % minNum) plus++;
  cout << ans + plus << endl;
  return 0;
}

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

using namespace std;

int main() {
    int n; cin >> n;
    string s[3]; cin >> s[0] >> s[1] >> s[2];

    int ans = 0;
    for (int i = 0; i < n; i++) {
        map<char, int> count;
        int ma = 0;
        for (int j = 0; j < 3; j++) {
            char c = s[j][i];
            count[c]++;
            ma = max(ma, count[c]);
        }
        ans += 3 - ma;
    }

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

Measured memory_bytes: 256
#![allow(unused)]

//入力マクロここから
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
//入力マクロここまで

//input
//use std::io::Read;

//collections
//use std::collections::BTreeMap;
//use std::collections::BTreeSet;
//use std::collections::HashMap;
//use std::collections::HashSet;
//use std::collections::VecDeque;

use std::cmp::*;

fn main() {
    input! {
        h : u64,
        w : u64,
    }

    if h == 1 || w == 1 {
        println!("1");
        return;
    }

    println!("{}", (h * w + 1) / 2);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
  ll n, a, b;
  cin >> n >> a >> b;
  if((b - a) % 2 == 1){
    ll ans = min(a - 1, n - b) + 1 + (b - a - 1) / 2;
    cout << ans << endl;
  }else{
    ll ans = (b - a) / 2;
    cout << ans << endl;
  }
  return 0;
}


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


int main() {
int N;
cin>>N;
vector<int> a(N*2);
for(int i=0;i<N*2;i++) cin>>a[i];
sort(a.begin(),a.end());
long ans=0;
for(int i=0;i<N;i++){
  ans+= min(a[2*i],a[2*i+1]);
}
cout<<ans<<endl;
}


Measured memory_bytes: 3608
import java.util.Scanner;


public class Main 
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		
		for(;;)
		{
			int n = scanner.nextInt();
			if(n == 0)
			{
				break;
			}
			
			int[] a = new int[n];
			int sum = 0;
			int max = -10000000;
			for(int i=0; i<n; i++)
			{
				a[i] = scanner.nextInt();
				sum += a[i];
				
				if(sum < a[i])
				{
					sum = a[i];
				}
				
				if(max < sum)
				{
					max = sum;
				}
			}
			System.out.println(max);
		}
	}
}

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

int main(){
    int n;

    cin >>n;
    vector<int> p(n);

    for (int i = 0; i < n;i++){
        cin >> p[i];
    }
    sort(p.rbegin(), p.rend());
    bool ok = false;
    int ans = 0;
    for(int i = 1; i < n; i++){
        ans +=p[i];
    }
    if(p[0]<ans){
    cout << "Yes" <<endl;
    }else{
        cout << "No" <<endl;
    }

}


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

using i64 = int64_t;

int main(){
    int n;
    while(cin >> n, n > 0){
        map<char, int> votes;
        int num = -1;
        char ans = 0;
        for(int i=0;i<n;++i){
            char c;
            cin >> c;
            votes[c]++;
            if(num == -1){
                char cmax = 'A';
                int maxi = 0;
                for(auto e: votes){
                    if(maxi < e.second){
                        maxi = e.second;
                        cmax = e.first;
                    }
                }
                bool flag = true;
                for(char cc='A';cc<='Z';++cc){
                    if(cc == cmax)continue;
                    if(votes[cc] + (n-i-1) >= maxi){
                        flag = false;
                        break;
                    }
                }
                if(flag){
                    num = i + 1;
                    ans = cmax;
                }
            }
        }
        if(num == -1)cout << "TIE";
        else cout << ans << " " << num;
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 3100
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
import bisect
import numpy as np
import math
from collections import deque
from collections import defaultdict
from math import gcd




N, K = map(int, input().split())
P = list(map(int, input().split()))

P.sort()
print(int(sum(P[:K])))

Measured memory_bytes: 27040
#include<bits/stdc++.h>
using namespace std;
#define all(a)  (a).begin(),(a).end()
typedef long long ll;
ll mod=1000000007;
int i,n,m;

int main() {
  cin >> n >> m;
  vector<int> p(m),y(m);
  vector<vector<ll>> v(n);
  for (i=0;i<m;++i){
    cin >> p[i] >> y[i];
    v[--p[i]].push_back(y[i]);
  }
  for (i=0;i<n;++i){
    sort(all(v[i]));
  }
  for (i=0;i<m;++i){
    ostringstream sout,sout2;
    sout << std::setfill('0') << std::setw(6) << p[i] + 1;
    auto id = lower_bound(all(v[p[i]]),y[i]) - v[p[i]].begin();
    sout2 << std::setfill('0') << std::setw(6) << id + 1;
    string s = sout.str() + sout2.str();
    cout << s << endl;
  }
  return 0;
}


Measured memory_bytes: 7808
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mst(a,b) memset((a),(b),sizeof(a))
#define pi acos(-1)
#define pii pair<int,int>
const int INF = 0x3f3f3f3f;
const double eps = 1e-6;
const int MAXN = 1e5 + 10;
const int MAXM = 2e6 + 10;
const ll mod = 1e9 + 7;

int a[110];

int main() {
#ifdef local
    freopen("data.txt","r",stdin);
//    freopen("data.txt","w",stdout);
#endif
    int n;
    scanf("%d",&n);
    for(int i=0; i<n; i++)
        scanf("%d",&a[i]);
    sort(a,a+n);
    int ans=0,now=-1;
    for(int i=0; i<n; i++) {
        if(a[i]>now) {
            ans++;
            now=a[i];
        }
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
S = input()

a = 10*int(S[0])+int(S[1])
b = 10*int(S[2])+int(S[3])

if 1<=a<=12 and 1<=b<=12:
    print('AMBIGUOUS')
elif 1<=b and b<=12:
    print('YYMM')
elif 1<=a and a<=12:
    print('MMYY')
else:
    print('NA')


Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
  string a,b,c;
  cin >> a >> b >> c;
  if(a[(int)a.size()-1]==b[0] && b[(int)b.size()-1]==c[0]){
    cout << "YES" << endl;
  }
  else cout << "NO" << endl;
  return 0;
}


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

int main() {
	ll n, m;
	cin >> n >> m;
	ll x = n % m;
	if (abs(x - m) > x) {
		cout << x;
	}else {
		cout << abs(x - m);
	}
}	






Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<sstream>
using namespace std;
int main() {
  int n;
  cin >> n;
  double ret = 0;
  for(int i=0;i<n;i++){
    double x;
    string s;
    cin >> x;
    cin >> s;
    if(s=="BTC"){
      ret += x * 380000.0;
    } else if (s=="JPY"){
      ret += x;
    }
  }
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main()
{
    int N, X;
    scanf("%d %d", &N, &X);
    int L[N];
    for(int i=0; i<N; i++)
        scanf(" %d", &L[i]);

    int count = 0, sum = 0;
    while(sum <= X && count < N){
        sum += L[count];
        count++;
    }
    if(count == N && sum <= X) printf("%d\n", count+1);
    else printf("%d\n", count);
}

Measured memory_bytes: 256
import itertools

l = int(input())
a = [int(input()) for _ in range(l)]

e_cs = [int(not (v % 2)) for v in a]
o_cs = [2 if v == 0 else v % 2 for v in a]

cs = [0] + list(itertools.accumulate(a))
cost = [a, o_cs, e_cs, o_cs, a]

# dp = [[None] * 5 for _ in range(l + 1)]
# def dfs(i=0, t=0):
#     if dp[i][t] is not None:
#         return dp[i][t]
#
#     if i == l:
#         dp[i][t] = 0
#         return 0
#     if t == 4:
#         dp[i][t] = cs[l] - cs[i]
#         return dp[i][t]
#     dp[i][t] = min(dfs(i + 1, t) + cost[t][i], dfs(i, t + 1))
#     return dp[i][t]

dp = [[None] * 5 for _ in range(l + 1)]
dp[l] = [0] * 5

for i in reversed(range(l)):
    for t in reversed(range(5)):
        if t == 4:
            dp[i][t] = cs[l] - cs[i]
            continue
        dp[i][t] = min(dp[i + 1][t] + cost[t][i], dp[i][t + 1])

print(dp[0][0])


Measured memory_bytes: 72900
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

int main() {
  int a,b;
  cin>>a>>b;
  if (a%3==0||b%3==0||(a+b)%3==0) cout<<"Possible"<<endl;  
  else cout<<"Impossible"<<endl;
  return 0;
}

Measured memory_bytes: 256
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws FileNotFoundException {

		//    	File file = new File("src/in.txt");
		//    	Scanner sc = new Scanner(file);

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int D = sc.nextInt();

		int[][] X = new int[N][D];

		for(int i=0;i<N;i++) {
			for(int j=0;j<D;j++) {
				X[i][j]= sc.nextInt();
			}
		}
		int ans = 0;
		for(int i=0;i<N-1;i++) {
			for(int j=i+1;j<N;j++) {
				int[] a = X[i];
				int[] b = X[j];
				int d2  = d2(a,b,D);
				if(isSquareNumber(d2)) {
					ans ++;
				}
			}
		}
		System.out.println(ans);
	}
	public static int d2(int[] y, int[] z,int D) {
		int d2 = 0;

		int sum = 0;
		for(int i=0;i<D;i++) {
			sum += (y[i]-z[i])*(y[i]-z[i]);
		}
		d2 = sum;

		return d2;
	}
    // 平方数かどうかを調べる。
    public static boolean isSquareNumber (int number) {
        if (number < 0) {
            throw new IllegalArgumentException("Argument must be 0 and over.");
        }
        double sqrtOfNumber = Math.sqrt(number);
        return (isInteger(sqrtOfNumber));
    }

    // 整数かどうかを調べる。
    public static boolean isInteger (double number) {
        return (number == Math.floor(number));
    }
}


Measured memory_bytes: 23124
#include <stdio.h>
using namespace std;
int main(void){
  int n,i,E;
//  printf(" ");
    scanf("%d",&n);
   i=3;
    while(n>=i){
        E=i;
        if(i%3==0){
            printf(" %d",i);
        }else{
            while(i>0){
                if(i%10==3){
                    printf(" %d",E);
                    i=0;
                }else{
                    i=i/10;
                }
                         }
            }   
                i=E+1;
            }
       printf("\n");
        }


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

using namespace std;

typedef long long LL;

const int N = 1100, MOD = 1e9 + 7;
int cnt[N];

int main() {
    int n;
    cin >> n;
    for (int i = 2; i <= n; i++) {
        int t = i;
        for (int j = 2; j <= t; j++) if (t % j == 0) {
            while (t % j == 0) {
                cnt[j]++;
                t /= j;
            }
        }
    }
    LL ans = 1;
    for (int i = 2; i <= n; i++) ans = ans * (cnt[i]+1) % MOD;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a, b, t;
	cin >> a >> b >> t;
	int ans = 0;
	for(int i = 1; i <= t; ++i){
		if(i%a == 0) ans += b;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3616