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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

const ll mod=1e9+7;

ll pw[401][401];
ll sumpw[401][401]={0};
int n,c;
ll a[400],b[400];

ll dp[401][401];
ll dfs(int now, int r)
{
    if(dp[now][r]>=0) return dp[now][r];
    if(now==n) return (r==0);

    ll ret=0;
    rep(i,r+1)
    {
        ll sum=(sumpw[b[now]][i]-sumpw[a[now]-1][i]+mod)%mod;
        // printf("sum=%lld\n", sum);
        ret+=(sum*dfs(now+1,r-i))%mod;
        ret%=mod;
    }

    return dp[now][r]=ret;
}

int main()
{
    rep(i,401)
    {
        pw[i][0]=1;
        for(int j=1; j<=400; ++j) pw[i][j]=(pw[i][j-1]*i)%mod;
    }

    rep(i,401)
    {
        for(int j=1; j<=400; ++j) (sumpw[j][i]+=sumpw[j-1][i]+pw[j][i])%=mod;
    }

    cin >>n >>c;
    rep(i,n) cin >>a[i];
    rep(i,n) cin >>b[i];

    memset(dp,-1,sizeof(dp));
    cout << dfs(0,c) << endl;
    return 0;
}


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

int main() {
	int N; cin >> N;
	int a[100010];
	for(int i=0; i<N; ++i) cin >> a[i];
	int num[100000]={0};
	for(int i=0; i<N; ++i){
	    ++num[a[i]];
	    if(a[i]!=0) ++num[a[i]-1];
	    if(a[i]!=100000) ++num[a[i]+1];
	}
	int m=0;
	for(int i=0; i!=100000; ++i) m=max(m, num[i]);
	cout << m << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
using vi=vector<int>;
#define PB push_back
#define ALL(x) x.begin(),x.end()
//#define LN cerr<<__LINE__<<endl
#define LN 0
using pi=pair<int,int>;
int read(){
	int i;
	scanf("%d",&i);
	return i;
}
void chmin(int&a,int b){
	a=a<b?a:b;
}
void chmax(int&a,int b){
	a=a>b?a:b;
}
struct SegTree{
	vi buf;
	int s;
	SegTree(int n){
		s=1;
		while(s<n)s*=2;
		buf.resize(s*2,-1);
	}
	void Update(int i,int v){
		i+=s;
		buf[i]=v;
		while((i/=2)>=1)buf[i]=max(buf[i*2],buf[i*2+1]);
	}
	int GetIdx(int b,int e,int t,vi&dst,int l,int r,int i){
		if(buf[i]<=t||e<=l||r<=b)return t;
		if(b<=l&&r<=e){
			if(l+1==r){
				if(t<buf[i])dst.PB(l);
				return max(t,buf[i]);
			}else{
				if(t<buf[i*2])
					t=GetIdx(b,e,t,dst,l,(l+r)/2,i*2);
				if(t<buf[i*2+1])
					t=GetIdx(b,e,t,dst,(l+r)/2,r,i*2+1);
				return t;
			}
		}
		t=GetIdx(b,e,t,dst,l,(l+r)/2,i*2);
		t=GetIdx(b,e,t,dst,(l+r)/2,r,i*2+1);
		return t;
	}
	void GetIdx(int b,int e,vi& dst){
		GetIdx(b,e,-1,dst,0,s,1);
	}
	int get(int x){
		return buf[x+s];
	}
};
inline int xorshift(){
	static int w=1145141919;
	w=w^(w<<17);
	w=w^(w>>13);
	w=w^(w<<5);
	return w;
}
struct Node{
	Node *l,*r;
	int v,s;
} buf[200010];
Node* Merge(Node*a,Node*b){
	if(!a)return b;
	if(!b)return a;
	int s=a->s+b->s,x=xorshift()%s;
	if(x<a->s){
		a->r=Merge(a->r,b);
		a->s=s;
		return a;
	}else{
		b->l=Merge(a,b->l);
		b->s=s;
		return b;
	}
}
using pn=pair<Node*,Node*>;
pn Split(Node*x,int t){
	if(!x)return pn(0,0);
	if(t<=x->v){
		pn c=Split(x->l,t);
		if(c.first)x->s-=c.first->s;
		x->l=c.second;
		return pn(c.first,x);
	}else{
		pn c=Split(x->r,t);
		if(c.second)x->s-=c.second->s;
		x->r=c.first;
		return pn(x,c.second);
	}
}
int MaxValue(Node* x){
	while(x->r)x=x->r;
	return x->v;
}
void Show(Node* x){
	if(!x)return;
	Show(x->l);
	cerr<<x->v<<" ";
	Show(x->r);
}
int main(){
	int n=read();
	SegTree seg(n*2);
	vector<Node*> trs(n*2);
	vi mx(n*2,-1);
	REP(i,n){
		int x=read()-1;
		seg.Update(i,x);
		trs[i]=buf+i;
		trs[i]->v=x;
		trs[i]->s=1;
		mx[i]=x;
	}
	vi idx;
	int sum=0;
	FOR(i,n,n*2){
		idx.clear();
		seg.GetIdx(0,i,idx);
		int last=-1;
		Node*x=0;
		sum+=idx.size();
		for(auto j:idx){
			LN;
			pn c=Split(trs[j],last);
			LN;
			last=mx[j];
			LN;
			if(c.first)
				mx[j]=MaxValue(c.first);
			else
				mx[j]=-1;
			LN;
			seg.Update(j,mx[j]);
			LN;
			trs[j]=c.first;
			LN;
			x=Merge(x,c.second);
			LN;
		}
		if(x->s==n){
			cout<<i-n<<endl;
			return 0;
		}
		if(sum>=1e7)return 0;
		mx[i]=last;
		seg.Update(i,mx[i]);
		trs[i]=x;
		//Show(x);
	}
}

Measured memory_bytes: 14840
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
constexpr int MOD = 1000000007;
constexpr int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
using Graph = vector<vector<int>>;
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; }
 
 
signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int H, W, N, h, w;
	string S, T;
	cin >> H >> W >> N >> h >> w >> S >> T;
	int SR{}, SD{}, SL{}, SU{}, TR{}, TD{}, TL{}, TU{};
	int L = w, R = w, U = h, D = h;
	bool ok = true;
	rep(i,N){
		if(S[i] == 'L'){
			L--;
			if(L <= 0) ok = false;
		}
		if(S[i] == 'R'){
			R++;
			if(R > W) ok = false;
		}
		if(S[i] == 'U'){
			U--;
			if(U <= 0) ok = false;
		}
		if(S[i] == 'D'){
			D++;
			if(D > H) ok = false;
		}
		
		if(T[i] == 'L'){
			R--;
			if(R <= 0) R = 1;
		}
		if(T[i] == 'R'){
			L++;
			if(L > W) L = W;
		}
		if(T[i] == 'U'){
			D--;
			if(D <= 0) D = 1;
		}
		if(T[i] == 'D'){
			U++;
			if(U > H) U = H;
		}
	}

	cout << (ok ? "YES" : "NO") << endl;
}

Measured memory_bytes: 920
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
pair<int,int>p[110000];
int main(){
	int a,b;scanf("%d%d",&a,&b);
	for(int i=0;i<a;i++){
		int s,t;scanf("%d%d",&s,&t);
		p[i]=make_pair(s,t);
	}
	std::sort(p,p+a);
	long long ret=0;
	for(int i=0;i<a;i++){
		int bu=min(b,p[i].second);
		b-=bu;
		ret+=(long long)bu*p[i].first;
	}
	printf("%lld\n",ret);
}

Measured memory_bytes: 896
N = int(input())
st = []
for i in range(N):
  st.append(input().split())
X = input()

a = 0
for i,s in enumerate(st):
  if s[0] == X:
    a = i + 1
    break

st = st[a:]
b = 0
for s in st:
  b = b + int(s[1])
print(b)

Measured memory_bytes: 3060
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
#define For(i,a,b) for(i=a;i<b;i++)
#define bFor(i,a,b) for(i=a;i>=b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define output(v) do{bool f=0;for(auto i:v){cout<<(f?" ":"")<<i;f=1;}cout<<endl;}while(0)
const ll mod=1000000007;
const ll inf=1LL<<60;

long mmid(long a,long b,long c){return a<b?(b<c?b:max(a,c)):(b>c?b:min(a,c));}

double dist(ddatas& x,ddatas& y){
  double a=x.first-y.first,b=x.second-y.second;
  return sqrt(a*a+b*b);
}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

ll modncr(ll n,ll r){
  ll i,plus=1;
  rep(i,r){
    plus=(plus*(n-i))%mod;
    plus=moddevide(plus,i+1);
  }
  return plus;
}

ll modncrlistp[200000],modncrlistm[200000];

ll modncrs(ll n,ll r){
  ll i,j;
  if(modncrlistp[n]==0){
    for(i=n;i>=0;i--){
      if(modncrlistp[i])break;
    }
    if(i<0){
      modncrlistp[0]=1;
      rep1(i,n+1){
        modncrlistp[i]=(modncrlistp[i-1]*i)%mod;
      }
    }else{
      For(j,i+1,n+1){
        modncrlistp[j]=(modncrlistp[j-1]*j)%mod;
      }
    }
  }
  if(modncrlistm[n]==0){
    for(i=n;i>=0;i--){
      if(modncrlistm[i])break;
    }
    if(i<0){
      modncrlistm[0]=1;
      rep1(i,n+1){
        modncrlistm[i]=(modncrlistm[i-1]*modinv(i))%mod;
      }
    }else{
      For(j,i+1,n+1)modncrlistm[j]=(modncrlistm[j-1]*modinv(j))%mod;
    }
  }
  return (((modncrlistp[n]*modncrlistm[r])%mod)*modncrlistm[n-r])%mod;
}

ll gcd(ll a,ll b){if(!b)return a;return (a%b==0)?b:gcd(b,a%b);}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

vec eratosthenes(ll N){
  ll i;
  vec ch(N+1,1),p;
  ch[0]=ch[1]=0;
  rep(i,N+1){
    if(ch[i]){
      p.push_back(i);
      for(ll j=2;i*j<=N;j++){
        ch[i*j]=0;
      }
    }
  }
  return ch;
}
int main(){
  ll i,j,N;
  cin>>N;
  mat dp(N,vec(3,0)),h(N,vec(3));
  rep(i,N){
    rep(j,3){
      cin>>h[i][j];
    }
    if(i){
      rep(j,3)dp[i][j]=max(dp[i-1][(j+1)%3],dp[i-1][(j+2)%3])+h[i][j];
    }else{
      rep(j,3)dp[i][j]=h[i][j];
    }
  }
  cout<<*max_element(all(dp[N-1]))<<endl;
  return 0;
}

Measured memory_bytes: 11136
import java.util.*;
import java.lang.*;

public class Main{
    
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        String s = sc.nextLine();
        
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (Character.isUpperCase(c)) {
                System.out.print(Character.toLowerCase(c));
            } else {
                System.out.print(Character.toUpperCase(c));
            }
        }
        System.out.println();
        
    }
}



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

public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int N = scan.nextInt();

	int[] a_ = new int[3*N];
	for(int i = 0; i < 3*N; i++){
	    a_[i] = scan.nextInt();
	}

	Arrays.sort(a_);

	long ans = 0;
	if(N % 2 == 0){
	    for(int i = N; i < 3*N; i++){
		if(i % 2 == 0){
		    ans += a_[i];
		}else{
		}
	    }
	}else{
	    for(int i = N; i < 3*N; i++){
		if(i % 2 != 0){
		    ans += a_[i];
		}else{
		}
	    }
	}
	
	System.out.println(ans);
    }
}


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

int main(){
  int a,b,c,d;
  //string a, b, c, d;
  cin >> a >> b >> c >> d;
  //cin >> s;
  if(abs(a-c)<=d)cout << "Yes" << endl;
  else if(abs(a-b)<=d&&abs(b-c)<=d)cout << "Yes" << endl;
  else cout << "No" << endl;
  //int x, y;
  //x = min(a,b);
  //y = min(c,d);
  //cout << x+y << endl;
  return 0;
}

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

using namespace std;

#define ll long long int
#define loop(i, n) for (int i = 0; i < n; i++)
#define loops(i, s, n) for (int i = s; i < n; i++)
#define pb push_back
#define mp make_pair
#define MOD 1000000007
const int mxn = 1e5;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int a,b;
    cin>>a>>b;
    bool f = true;
    for(int i=1; i<=1e5; ++i) {
		int x=i*8/100; 
        int y=i*10/100;
		if(x==a&&y==b) {
			cout << i;
            f=false;
			break;
		}
	}
    if(f){
	cout << -1;
    }
}
        
    


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

using namespace std;

#define reps(i,f,n) for(int i=f;i<n;i++)
#define rep(i,n) reps(i,0,n)
#define int long long

typedef long long ll;
const int N = 111111, Q  = 11111, T = 44, MOD = 1e9+7;

int n,q;
int p[N];

int l[Q];
int r[Q];


int hlen[N];
int hsum[N];

int ruiseki[N][T];

void input(){
	cin>>n>>q;
	rep(i,n)cin>>p[i];
	rep(i,q)cin>>l[i]>>r[i];
}

void add(int& a, int b){
	a = (a+b)%MOD;
}

void solve_heiro(){
	rep(i,N)hlen[i] = -1;

	vector<int> tmp,tmp2;
	rep(i,n)tmp.push_back(i+1);
	tmp2 = tmp;

	rep(i,T){
		rep(j,n){
			tmp2[p[j]-1] = tmp[j];
		}

		tmp = tmp2;

		rep(j,n){
			if(hlen[j]==-1){
				hsum[j] += tmp[j];
				if(tmp[j] == j+1) hlen[j] = i+1;
			}
		}

	}
}

void solve_ruiseki(){
	reps(i,1,n+1){
		rep(j,T){
			if(i!=0)ruiseki[i][j] = ruiseki[i-1][j];
		}
		ruiseki[i][hlen[i-1]] += hsum[i-1];
	}
}

ll gcd(ll a, ll b){
	if(a<b)swap(a,b);
	while(a%b!=0){
		ll c = a%b;
		a = b;
		b = c;
	}
	return b;
}

ll lcm(ll a, ll b){
	ll t = gcd(a,b);

	return a/t * (b/t) * t;
}

int solve(){
	solve_heiro();
	solve_ruiseki();

	ll m = 1;
	reps(i,1,41){
		m = lcm(m,i);
	}

/*
	rep(j,n+1)printf("%3d ",j);puts("");
	rep(i,10){
		rep(j,n+1){
			printf("%3d ",ruiseki[j][i]);
		}puts("");
	}
*/

	rep(query,q){

		//rep(i,3)puts("");

		ll t  = 1;
		int sum = 0;

		int num[T] = {0};
		//printf("*** %d %d  \n" ,r[query]+1, l[query]);
		rep(j,T){
			num[j] = ruiseki[r[query]][j] - ruiseki[l[query]-1][j];
			//printf("**** j=%d  %d %d\n",j,ruiseki[r[query]+1][j], ruiseki[l[query]][j]);
		}

		rep(j,10){
			//printf("num %d  :  %d\n", j, num[j]);
		}

		rep(j,T){
			if(num[j] > 0) t = lcm(t, j);
		}

		//cout<<"lcm "<<t<<endl;
		rep(j,T){
			if(num[j] > 0) add(sum,  (int)((ll)num[j] * (t/j%MOD) % MOD) );
		}
		cout<<sum<<endl;
	}

	return 0;
}


signed main(){
	input();
	solve();
}

Measured memory_bytes: 40256
#include <stdio.h>
#include <string.h>

bool vis[35] ;

int main ( )
{
	int t ;
	while ( scanf ( "%d" , &t ) == 1 ) {
		memset ( vis , false , 35 * sizeof ( bool ) ) ;
		vis[t] = true ;
		for ( int i = 0 ; i < 27 ; i++ ) {
			scanf ( "%d" , &t ) ;
			vis[t] = true ;
		}
		for ( int i = 1 ; i < 31 ; i++ ) {
			if ( vis[i] == false ) {
				printf ( "%d\n" , i ) ;
			}
		}
	}
	return 0 ;
}

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

// @@ !! LIM()

int main(/* int argc, char *argv[] */) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  string S; cin >> S;
  vector<bool> vec(128);
  for (ll i = 0; i < (ll)S.size(); i++) vec[S[i]] = true;
  for (char c = 'a'; c <= 'z'; c++) {
    if (!vec[c]) {
      cout << c << endl;
      return 0;
    }
  }
  cout << "None\n";

  return 0;
}



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

namespace ConsoleApp2
{
    public class Program
    {

        public static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int[] As = new int[N];
            string[] strBs = Console.ReadLine().Split(' ');
            As[0] = int.Parse(strBs[0]);
            int preB = As[0];
            for (int i = 1; i < N-1; i++)
            {
                int b = int.Parse(strBs[i]);
                As[i] = Math.Min(preB, b);
                preB = b;
            }
            As[N-1] = preB;

            Console.WriteLine(As.Sum());
            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int a, b, c;
    cin >> a >> b >> c;
    if (a+b == c || b+c == a || c+a == b) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll Mod = (ll) (1e9) + 7;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
ll modinv(ll a, ll m) {
  long long b = m, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0)
    u += m;
  return u;
}
struct combination {
  vector<ll> fact, ifact;
  combination(int n) :
      fact(n + 1), ifact(n + 1) {
    assert(n < Mod);
    fact[0] = 1;
    for (int i = 1; i <= n; i++)
      fact[i] = (fact[i - 1] * i) % Mod;
    ifact[n] = modinv(fact[n], Mod);
    for (int i = n; i >= 1; i--)
      ifact[i - 1] = (ifact[i] * i) % Mod;
  }
  ll operator()(int n, int k) {
    if (k < 0 || k > n)
      return 0;
    return ((fact[n] * ifact[k] % Mod) * ifact[n - k]) % Mod;
  }
};
int main() {
  ll n, k, ans = 0;
  cin >> n >> k;
  k = min(k, n - 1);
  combination c(n);
  rep(i,k+1)
  {
    ans += c(n, i) * c(n - 1, i);
    ans %= Mod;
  }
  cout << ans;
}

Measured memory_bytes: 3328
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int [] a = new int [n];
		int alice = 0;
		int bob = 0;
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		Arrays.sort(a);
		for(int i = n-1; i >= 0; i-=2) {
			alice += a[i];
			
		}
		for(int i = n-2; i >= 0; i-=2) {
			bob += a[i]; 
		}
		System.out.println(alice - bob);
		sc.close();
	}
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k,c=0;
  cin>>n>>k;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
    c+=a[i];
  }
  sort(a.begin(),a.end());
  for(int i=0;i<n-k;i++){
    c-=a[i];
  }
  cout<<c;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
const int INF = 1e9;
const int EPS = 1e-9; 
const int SEARCH_MAX = 6e3;

int main() {
  int N;
  cin >> N;
  vector<string> S(N);
  for(int i = 0; i < N; ++i) cin >> S.at(i);
  map<string, int> m;
  for (int i = 0; i < N; ++i) {
    m[S.at(i)] = m[S.at(i)] + 1; 
  }
  cout << m.size() << endl;
}

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

int main()
{
  int n ;
  cin>>n ;
  
  int d[3] ;
  for(int i=0;i<3;i++){
    int k=pow(10,2-i) ;
    d[i]=n/k ;
    n -= d[i]*pow(10,2-i) ;
    if(d[i]==1) d[i]=9 ;
    else d[i]=1 ;
  }
  
  cout<<100*d[0]+10*d[1]+d[2]<<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 ll;

const int INF = 1001001001;

int main(){
    int n, m; cin >> n >> m;
    int seikai = 0;
    int penalty = 0;
    vector<bool> ac(n);
    vector<int> wa(n);
    rep(i,n) {
        ac[i] = false;
        wa[i] = 0;
    }
    while(m--){
        int p; string s;
        cin >> p >> s;
        if(ac[p]) continue;
        if(s=="AC"){
            ac[p] = true;
            seikai++;
            penalty+=wa[p];
        }
        if(s=="WA"){
            wa[p]++;
        }
    }
    
    cout << seikai << " " << penalty << endl;
}

Measured memory_bytes: 640
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i,a,n) for(ll i=a;i<(ll)(n);i++)

int main(){
    int D; cin>>D;
    if(D == 25){
        cout << "Christmas" << endl;
    }
    if(D == 24){
        cout << "Christmas Eve" << endl;
    }
    if(D == 23){
        cout << "Christmas Eve Eve" << endl;
    }
    if(D == 22){
        cout << "Christmas Eve Eve Eve" << endl;
    }
}


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

int main(void){
    string S;
    int a;
    cin>>S;
    a=0;
    for(int i=0;i<4;i++){
        if(S[i]=='+'){
            a=a+1;
        }else{
            a=a-1;
        }
    }
    cout<<a<<endl;

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ITP1_10_D
{
    class Program
    {
        static void Main(string[] args)
        {
            // 2つのn次元ベクトルx={x(1)～x(n)}とy={y(1)～y(n)}
            // ミンコフスキー距離：上記を計算する指標の一つ
            // D(xy)=(Σ(i=1～n)((|x(i)-y(i)|)^p)^(1/2)
            // p=1の時(マンハッタン距離)：D(xy)=Σ|x(i)-y(i)|
            // p=2の時(ユークリッド距離)：     =√(D(xy))
            // p=∞の時（チェビシェフ距離）：  =max(i=1～n)(|x(i)-y(i)|)

            // 2つの与えられたn次元ベクトルより、p=1,2,3,∞の順に出力するプログラム

            int n = int.Parse(Console.ReadLine());
            int[] x = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int[] y = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            double p1 = 0;
            double p2 = 0;
            double p3 = 0;
            double lim = 0;

            
            int[] array = new int[n];

            for (int i = 0; i < n; i++)
            {
                array[i] = Math.Abs(x[i] - y[i]);               // |x(i)-y(i)|の要素をすべて含む配列を作成

                p1 += array[i];                                 //  p=1 の時(マンハッタン距離)

                p2 += Math.Pow(array[i], 2);                    

                p3 += Math.Pow(array[i], 3);                    
            }

            p2 = Math.Pow(p2, 1.0 / 2.0);                       // p=2 の時(ユークリッド距離)

            p3 = Math.Pow(p3, 1.0 / 3.0);                       // p=3 の時

            lim = array.Max();                                  // チェビシェフ距離

            Console.WriteLine(p1);
            Console.WriteLine(p2);
            Console.WriteLine(p3);
            Console.WriteLine(lim);
        }

    }
}



Measured memory_bytes: 18360
#include <bits/stdc++.h>
#define bp __builtin_popcountll
#define pb push_back
#define in(s) freopen(s, "r", stdin);
#define out(s) freopen(s, "w", stdout);
#define inout(s, end1, end2) freopen((string(s) + "." + end1).c_str(), "r", stdin),\
		freopen((string(s) + "." + end2).c_str(), "w", stdout);
#define fi first
#define se second
#define bw(i, r, l) for (int i = r - 1; i >= l; i--)
#define fw(i, l, r) for (int i = l; i < r; i++)
#define fa(i, x) for (auto i: x)
using namespace std;
const int mod = 998244353, inf = 1061109567;
const long long infll = 4557430888798830399;
const int N = 4005;
int n, k, fac[N], ifac[N];
void add(int &x, int y) {
	x += y; if (x >= mod) x -= mod;
}
void rem(int &x, int y) {
	x -= y;
	if (x < 0) x += mod;
}
int mul(int x, int y) {
	return 1ll * x * y % mod;
}
int fpow(int a, int p) {
	if (!p) return 1;
	int tmp = fpow(a, p >> 1);
	tmp = mul(tmp, tmp);
	if (p & 1) tmp = mul(tmp, a);
	return tmp;
}
int inv(int a) {
	return fpow(a, mod - 2);
}
int C(int n, int k) {
	if (n < k || k < 0) return 0;
	return mul(fac[n], mul(ifac[k], ifac[n - k]));
}
int solve(int i, int tot) {
	int special = 0, vari = 0;
	fw (j, 1, k + 1) {
		int other = i - j;
		if (other > 0 && other <= k) {
			if (j < other) special++, vari++;
		} else vari++;
	}
	int ans = 0, curPow = 1;
	fw (j, 0, special + 1) {
		int cntWays = C(special, j);
		int cntLeft = vari - special;
		add(ans, mul(mul(cntWays, curPow), C(tot + cntLeft - 1, j + cntLeft - 1)));
		
		curPow = mul(curPow, 2);
	}
	return ans;
}
signed main() {
	#ifdef BLU
	in("blu.inp");
	#endif
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	fac[0] = ifac[0] = 1;
	fw (i, 1, N) {
		fac[i] = 1ll * fac[i - 1] * i % mod;
		ifac[i] = inv(fac[i]);
	}
	cin >> k >> n;
	fw (i, 2, 2 * k + 1) {
		int ans = 0;
		if (i & 1) {
			add(ans, solve(i, n));
		} else {
			fw (haveHalf, 0, 2) add(ans, solve(i, n - haveHalf));
		}
		cout << ans << "\n";
	}
	return 0;
}

Measured memory_bytes: 384
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cstring>
#include<cmath>
#include<utility>
#include<queue>
using namespace std;
typedef long long ll;

int main(){
    priority_queue<pair<ll,int> ,vector<pair<ll,int> >,greater<pair<ll,int> > > q;
    int n,m,l,r;
    vector<pair<pair<int,int> ,ll> > e;
    ll c,dis[100001];
    scanf("%d%d",&n,&m);
    for(int i=0;i<m;i++){
        scanf("%d%d%lld",&l,&r,&c);
        e.push_back({{l,r},c});
    }
    sort(e.begin(),e.end());
    for(int i=0;i<=n;i++){
        dis[i]=1000000000000000;
    }
    dis[1]=0;
    int p=0;
    l=0;
    q.push({0LL,-1});
    while(!q.empty()&&l<n&&p<m){
        while(!q.empty()&&-q.top().second<=l){
            q.pop();
        }
        if(q.empty()){
            break;
        }
        l=-q.top().second;
        q.pop();
        while(e[p].first.first<=l&&p<m){
            if(dis[e[p].first.second]>dis[l]+e[p].second){
                dis[e[p].first.second]=dis[l]+e[p].second;
                //printf("%lld %lld %lld\n",dis[e[p].first.second],dis[l],e[p].second);
                q.push({dis[e[p].first.second],-e[p].first.second});
            }
            p++;
        }
    }
    if(dis[n]==1000000000000000){
        printf("-1\n");
    }
    else{
        printf("%lld\n",dis[n]);
    }
}

Measured memory_bytes: 5616
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <queue>

#define int long long

using namespace std;

class Solver {
};

signed main() {
	while (true) {
		int h, w, c;
		cin >> h >> w >> c;
		if (h == 0)break;

		int all = pow(5, 5);

		vector<vector<int>> grid(h, vector<int>(w, 0));
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++)cin >> grid[i][j];
		}

		int res = 0;
		for (int z = 0; z < all; z++) {
			vector<vector<int>> now(h, vector<int>(w, 0));
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					now[i][j] = grid[i][j];
				}
			}

			int val = z;
			for (int i = 0; i < 5; i++) {
				int color = now[0][0];
				int to = val % 5 + 1;
				if (to >= color)to++;
				val /= 5;

				queue<tuple<int, int>> que;
				que.push(make_tuple(0, 0));
				while (que.size() > 0) {
					int y = get<0>(que.front());
					int x = get<1>(que.front());
					que.pop();
					if (now[y][x] != color)continue;

					now[y][x] = to;
					if (y > 0 && now[y - 1][x] == color) {
						que.push(make_tuple(y - 1, x));
					}
					if (y + 1 < h && now[y + 1][x] == color) {
						que.push(make_tuple(y + 1, x));
					}
					if (x > 0 && now[y][x - 1] == color) {
						que.push(make_tuple(y, x - 1));
					}
					if (x + 1 < w && now[y][x + 1] == color) {
						que.push(make_tuple(y, x + 1));
					}
				}
			}

			int cnt = 0;
			vector<vector<bool>> visited(h, vector<bool>(w, false));
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					if (visited[i][j] || now[i][j] != c)continue;

					queue<tuple<int, int>> que;
					que.push(make_tuple(i, j));
					int tmp = 0;
					while (que.size() > 0) {
						int y = get<0>(que.front());
						int x = get<1>(que.front());
						que.pop();
						if (visited[y][x])continue;

						visited[y][x] = true;
						tmp++;
						if (y > 0 && now[y - 1][x] == c) {
							que.push(make_tuple(y - 1, x));
						}
						if (y + 1 < h && now[y + 1][x] == c) {
							que.push(make_tuple(y + 1, x));
						}
						if (x > 0 && now[y][x - 1] == c) {
							que.push(make_tuple(y, x - 1));
						}
						if (x + 1 < w && now[y][x + 1] == c) {
							que.push(make_tuple(y, x + 1));
						}
					}
					cnt = max(cnt, tmp);
				}
			}
			res = max(res, cnt);
		}

		cout << res << endl;
	}
}


Measured memory_bytes: 3140
import java.util.Scanner;

public class Main{
	
	void main() {
		 Scanner sc = new Scanner(System.in);
	     int[] a = new int[6];
	     for(int i=0;i<6;i++) {
	    	 a[i] = sc.nextInt();
	     }
	     if(a[0] + 5*a[1] + 10*a[2] + 50*a[3] + 100*a[4] + 500*a[5] >= 1000) {
	    	 System.out.println(1);
	     }else {
	    	 System.out.println(0);
	     }
    }

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



}


Measured memory_bytes: 26292
import java.util.Scanner;

public class Main {
  	public static void main(String[] args){
      //入力値の取得
      Scanner sc = new Scanner(System.in);
      String str = sc.next();
      sc.close();

      if (str.indexOf("A") == -1 || str.indexOf("B") == -1) {
    	  System.out.println("No");
      } else {
    	  System.out.println("Yes");
      }
  	}
}

Measured memory_bytes: 23508
s1 = input()
s2 = input()
n = 0

while n <= len(s1):
    s1 = s1[-1]+s1[:-1]
    #print(s1[-1],s1[:-1],s1)
    if s1 == s2:
        print("Yes")
        exit()
    n += 1
print("No")

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

int decline(int c, int d) { return -c * ((d - 1) * d / 2); }

int main() {
  srand(0);

  constexpr int n = 26;
  int d;
  cin >> d;
  vector<int> c(n);
  for (auto &e : c) cin >> e;
  vector<vector<int>> s(d, vector<int>(n));
  for (auto &se : s) {
    for (auto &e : se) cin >> e;
  }

  int satisfaction = 0;
  vector<set<int>> v(n);
  for (auto &e : v) e.insert(-1);
  vector<int> t(d);
  for (int i = 0; i < d; i++) {
    t[i] = max_element(s[i].begin(), s[i].end()) - s[i].begin();
    satisfaction += s[i][t[i]];
    v[t[i]].insert(i);

    for (int j = 0; j < n; j++) {
      int last_i = *v[j].rbegin();
      satisfaction -= c[j] * (i - last_i);
    }
  }

  for (int iteration = 0; iteration < (int)1e7; iteration++) {
    int i = rand() % d, j = rand() % n;
    if (t[i] == j) continue;

    int difference = 0;
    difference -= s[i][t[i]];
    difference += s[i][j];

    auto it1_to = v[t[i]].upper_bound(i);
    auto it1_from = it1_to;
    it1_from--;
    it1_from--;
    int i1_to = it1_to == v[t[i]].end() ? d : *it1_to, i1_from = *it1_from;

    auto it2_to = v[j].upper_bound(i);
    auto it2_from = it2_to;
    it2_from--;
    int i2_to = it2_to == v[j].end() ? d : *it2_to, i2_from = *it2_from;

    difference -= decline(c[t[i]], i - i1_from) + decline(c[t[i]], i1_to - i);
    difference += decline(c[t[i]], i1_to - i1_from);

    difference -= decline(c[j], i2_to - i2_from);
    difference += decline(c[j], i - i2_from) + decline(c[j], i2_to - i);

    if (difference > 0) {
      satisfaction += difference;
      v[t[i]].erase(i);
      v[j].insert(i);
      t[i] = j;
    }

    // cerr << i << ' ' << j << endl;
    // cerr << i1_from << ' ' << i1_to << ' ' << i2_from << ' ' << i2_to << endl;
    // cerr << difference << endl;
  }

  cerr << "satisfaction: " << satisfaction << endl;
  cerr << "score: " << max((int)1e6 + satisfaction, 0) << endl;

  for (auto e : t) cout << e + 1 << endl;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
#define y1 __y1__
using namespace std;

double x1, y1, x2, y2, A, B, H, M;
const double PI = 3.1415926535897932384626;

int main() {
	scanf("%lf %lf %lf %lf", &A, &B, &H, &M);
	double ang1 = M * PI / 30;
	double ang2 = H * PI / 6 + M * PI / 360;
	x1 = A * cos(ang1), y1 = A * sin(ang1);
	x2 = B * cos(ang2), y2 = B * sin(ang2);

	printf("%.20f\n", sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));
}

Measured memory_bytes: 4136
#include <stdio.h>
#include <algorithm>
using namespace std;

int main() {
  int a, b;
  bool first = true;
  while (scanf("%d %d", &a, &b), a|b) {
    if (!first) { puts(""); }
    first = false;
    if (a > b) { swap(a, b); }
    bool output = false;
    for (int i = a; i <= b; i++) {
      if (i % 400 == 0 || (i % 100 != 0 && i % 4 == 0)) {
        output = true;
        printf("%d\n", i);
      }
    }
    if (!output) { puts("NA"); }
  }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REP(a, b, m) for (ll a = (ll)(b); a < (ll)(m); a++)

int main()
{
    string s, t;
    cin >> s >> t;
    cout << t << s << endl;
}

Measured memory_bytes: 256
//============================================================================
// Author       : Sun YaoFeng
//============================================================================

//#pragma 	comment(linker, "/STACK:100240000,100240000")
//#include	<cstdio>
//#include	<cstdlib>
//#include	<cstring>
//#include	<algorithm>

#include	<bits/stdc++.h>

using	namespace	std;

#define DB		double
#define	lf		else if
#define I64		long long
#define	Rd()	(rand()<<15|rand())
#define For(i,a,b)	for(int i=a,lim=b;i<=lim;i++)
#define Rep(i,a,b)	for(int i=a,lim=b;i>=lim;i--)

#define	fi	first
#define se	second
#define MK	make_pair
#define PA	pair<int, int>

//#define	min(a,b)	((a)<(b)?(a):(b))
//#define	max(a,b)	((a)<(b)?(b):(a))

#define	CH	(ch=getchar())
int		IN()	{
		int x= 0, f= 0, ch;
		for	(; CH < '0' || ch > '9';)	f= (ch == '-');
		for	(; ch >= '0' && ch <= '9'; CH)	x= x*10 + ch -'0';
		return	f? -x : x;
}

#define n	4005
#define P	1000000007

int		N, M, K, D, F[n][n];

inline	void	Plu(int&a,int b){
		a+=b;
		if  (a>=P)	a-=P;
}

int		main(int argc, char* argv[]){
		N= IN();
		M= IN();
		K= IN();
		D= (N+M) / (K-1) + 1;
		
		For(i, 1, K-1)	F[1][i]= 1;
		For(i, 2, D)	For(j, 0, K-1)	For(k, 0, N-j)	Plu(F[i][j+k], F[i-1][k]);
		
		int	Ans= 0;
		For(i, 1, D)	For(j, 0, N)	{
			int k= i*(K-1) + 1 - j;
			if	(k <= M && j % (K-1) == N % (K-1) && k % (K-1) == M % (K-1))	Plu(Ans, F[i][j]);
		}
		
		printf("%d\n", Ans);
		
		return	0;
}

Measured memory_bytes: 47488
#include<stdio.h>
#include<math.h>

int main(){
  int n,i,j,sq;
  while(scanf("%d",&n)!=EOF){
    if(n==3){
      printf("2 5\n");
      continue;
    } 
    for(i=n-(n%2?2:1);;i-=2){
      sq=sqrt(i);
      for(j=3;j<=sq;j+=2)
	if(i%j==0) break;
      if(j>sq){
	printf("%d",i);
	break;
      }
    }
    for(i=n+(n%2?2:1);;i+=2){
      sq=sqrt(i);
      for(j=3;j<=sq;j+=2)
	if(i%j==0) break;
      if(j>sq){
	printf(" %d\n",i);
	break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 0
#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<ll, ll>;

int main()
{
    ll n, m, ans = 0;
    cin >> n >> m;
    vector<P> p;
    rep(i, n)
    {
        double a, b;
        cin >> a >> b;
        p.push_back(P(a, b));
    }
    sort(p.begin(), p.end());
    priority_queue<ll> q;
    q.push(0);
    for (int i = 1, j = 0; i <= m; i++)
    {
        while (j < n && p[j].first <= i)
        {
            q.push(p[j].second);
            j++;
        }
        ans += q.top();
        q.pop();
        q.push(0);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6708
#include<stdio.h>

int main(void){
    int X;
    int A;
    int B;
    
    scanf("%d",&X);
    scanf("%d",&A);
    scanf("%d",&B);
    
    X = X-A;
    while(X>=0){
        X = X-B;
    };
    
    printf("%d",X+B);
    
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N;
  cin >> N;
  vector<long> data(N);
  for(int i = 0; i < N; i++)cin >> data.at(i);
  long ans = 0;
  for(int i = 0; i < N; i++){
    for(int j = i + 1; j < N; j++){
      ans += data.at(i) * data.at(j); 
    }
  }
  cout << ans << endl;
  return 0;
}

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

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

using ll = long long;

using namespace std;

template <typename T>
bool Setmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main() {
  in(int, D);
  vector<int> c(26);
  rep(i, 26) cin >> c[i];
  vector<vector<int>> s(D, vector<int>(26));
  rep(i, D) rep(j, 26) cin >> s[i][j];

  int sat = 0;
  vector<int> last(26);
  rep(i, D) {
    int d = i + 1;
    int maxi = numeric_limits<int>::min();
    int chosen;
    rep(j, 26) {
      int change = s[i][j];
      rep(k, 26) {
        int last_day = k == j ? d : last[k];
        change -= c[k] * (d - last_day);
      }
      // HACK
      if (d - last[j] > 20) {
        change += 1000;
      }
      if (Setmax(maxi, change)) {
        chosen = j;
      }
    }
    last[chosen] = d;
    sat += maxi;
    dbg(sat, maxi, chosen);
#if DEBUG
    rep(i, 26) {
      if (i) cerr << " ";
      cerr << last[i];
    }
    cerr << endl;
#endif
    out(chosen + 1);
  }
  dbg(max(1000000 + sat, 0));
}


Measured memory_bytes: 3644
{-# OPTIONS_GHC -O3 #-}
{-# LANGUAGE ViewPatterns, ScopedTypeVariables #-}

import qualified Data.ByteString as B (getLine, getContents)
import qualified Data.ByteString.Char8 as C (readInt, lines, words, unpack, reverse, dropWhile)
import qualified Data.Maybe as M (fromJust)
import Data.Char as C (isSpace)

readInt = fst . M.fromJust . C.readInt
rstrip = C.reverse . C.dropWhile C.isSpace . C.reverse

run ans [] = ans
run ans ([a, b]:xs) = run (ans + b - a + 1) xs

main = do
    (map readInt . C.words -> [n]) <- B.getLine
    (map (map readInt . C.words) . C.lines -> xs) <- B.getContents
    putStrLn $ show $ run 0 xs


Measured memory_bytes: 892
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <ctime>
#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007
 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=(n);i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define rsort(x) sort(all(x));reverse(all(x))
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

bool debug=false;
/*---------------------------------------------------*/

int main(){
  int x,t;
  cin>>x>>t;
  cout<<max(0,x-t)<<endl;
  
  return 0;
}


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

void print() { cout << endl; }
template <typename Head, typename... Tail>
void print(Head head, Tail... tail) {
    int size = sizeof...(Tail);
    cout << head;
    if (size > 0) {
        cout << " ";
    }
    print(tail...);
}

void print0() {}
template <typename Head, typename... Tail>
void print0(Head head, Tail... tail) {
    cout << head;
    print0(tail...);
}
int main() {
    int64_t N, M;
    cin >> N;
    cin >> M;

    vector<pair<int64_t, int64_t>> alledg;
    map<int64_t, vector<int64_t>> edg;
    for (int64_t i = 0; i < M; i++) {
        int64_t a, b;
        cin >> a;
        cin >> b;
        a--;
        b--;
        edg[a].push_back(b);
        edg[b].push_back(a);
        alledg.push_back(make_pair(a, b));
    }
    vector<int64_t> colors(N);
    for (int64_t i = 0; i < N; i++) {
        colors[i] = -1;
    }
    colors[0] = 1;

    bool twocolor = true;
    stack<int64_t> nodeids;
    nodeids.push(0);
    while (!nodeids.empty()) {
        int64_t nod = nodeids.top();
        nodeids.pop();
        for (auto dstnod : edg[nod]) {
            if (colors[dstnod] == -1) {
                colors[dstnod] = 1 - colors[nod];
                nodeids.push(dstnod);
            } else if (colors[dstnod] == colors[nod]) {
                twocolor = false;
            }
        }
    }

    if (twocolor) {
        int64_t p = 0;
        int64_t q = 0;
        for (auto c : colors) {
            if (c == 0) {
                p++;
            } else {
                q++;
            }
        }
        cout << (p * q - M) << endl;

    } else {
        cout << ((N * (N - 1) / 2) - M) << endl;
    }
}


Measured memory_bytes: 17228
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
using namespace std;
const int MOD=1000000007;
const int nmax=501234;

int n,a[17][17],bt[17],flg[1<<17];
ll dp[1<<17],dp2[1<<17],dp3[1<<17],tmp3;
queue<int> q2;

int main()
{
    scanf("%d",&n);
    for(int i=1; i<=n; ++i)
    {
        bt[i]=1<<i-1;
        for(int j=1; j<=n; ++j)
            scanf("%d",&a[i][j]);
    }
    for(int i=2,l=0,r=0; i<=n; ++i)
    {
        for(int j=1,tmp=0; j<i; ++j)
        {
            tmp=bt[i]|bt[j];
            dp[tmp]=a[j][i];
            flg[tmp]=1;
            q2.push(tmp);
        }
        while(!q2.empty())
        {
            int tmp=q2.front();
            q2.pop();
            for(int j=1,tmp2=0; j<i; ++j)
            {
                tmp2=tmp|bt[j];
                if(tmp2!=tmp && flg[tmp2]==0)
                {
                    dp[tmp2]=dp[tmp]+a[j][i];
                    flg[tmp2]=1;
                    q2.push(tmp2);
                }
            }
        }
    }
    for(int i=2,tmp2=1; i<=n; ++i)
    {
        tmp2=tmp2<<1|1;
        for(int j=bt[i]+1; j<=tmp2; ++j)
            dp2[j]=dp[j]+dp2[j^bt[i]];
    }
    for(int i=2,tmp2=1; i<=n; ++i)
    {
        tmp2=tmp2<<1|1;
        for(int i2=bt[i]+1,j2=0; i2<=tmp2; ++i2)
        {
            dp3[i2]=dp2[i2];
            j2=i2&-i2;
            for(int j=bt[i]; j<i2; j+=j2)
            {
                while((j|i2)!=i2)
                    j+=j&-j;
                tmp3=dp2[j]+dp3[j^i2];
                if(dp3[i2]<tmp3)
                    dp3[i2]=tmp3;
            }
        }
    }
    printf("%lld",dp3[(1<<n)-1]);
    return 0;
}


Measured memory_bytes: 2048
import java.util.*;

public class Main{
      public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            int N = sc.nextInt();
            int M = N / 2;
            if(N % 2 == 0){
              System.out.println((double) M / N);
            } else {
              System.out.println((double) (M + 1) / N);
            }
        }
}

Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;
int main(void){
  int n,i;
  string s;
  cin >> n;
  if (n%2==1){
    cout << "No" << endl;
    return 0;
  }
  cin >> s;
  for (i=0;i<n/2;i++) if (s[i]!=s[i+n/2]) break;
  if (i==n/2) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
l=["q","w","e","r","t","a","s","d","f","g","z","x","c","v","b"]
while 1:
    s=input()
    if s=="#":break
    ans=0
    pos=0 if s[0] in l else 1
    for i in s[1:]:
        pos_n=0 if i in l else 1
        if pos!=pos_n:
            ans+=1
            pos=pos_n
    print(ans)


Measured memory_bytes: 5568
int n;
long dat[1<<19],lazy[1<<19];
init(n_)
{
	n=1;
	while(n<n_)n<<=1;
}
eval(i,l,r)
{
	if(lazy[i])
	{
		dat[i]+=lazy[i];
		if(r-l>1)
		{
			lazy[2*i+1]+=lazy[i];
			lazy[2*i+2]+=lazy[i];
		}
		lazy[i]=0;
	}
}
update(a,b,x,k,l,r)long x;
{
	eval(k,l,r);
	if(b<=l||r<=a)return 0;
	else if(a<=l&&r<=b)
	{
		lazy[k]+=x;
		eval(k,l,r);
	}
	else
	{
		update(a,b,x,2*k+1,l,(l+r)/2);
		update(a,b,x,2*k+2,(l+r)/2,r);
		dat[k]=fmax(dat[2*k+1],dat[2*k+2]);
	}
}
long query(a,b,k,l,r)
{
	eval(k,l,r);
	if(b<=l||r<=a)return 0;
	else if(a<=l&&r<=b)return dat[k];
	else return fmax(
		query(a,b,2*k+1,l,(l+r)/2),
		query(a,b,2*k+2,(l+r)/2,r)
	);
}
int N,m;
L[1<<18],R[1<<18],A[1<<18];
first[1<<18],next[1<<18];
main()
{
	scanf("%d%d",&N,&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%d%d%d",L+i,R+i,A+i);
	}
	for(int i=1;i<=m;i++)
	{
		next[i]=first[R[i]];
		first[R[i]]=i;
	}
	init(N+1);
	//lazysegtree dp(n+1);
	for(int i=1;i<=N;i++)
	{
		update(i,i+1,query(0,i,0,0,n),0,0,n);
		int p=first[i];
		for(;p!=0;)
		{
			update(L[p],i+1,1L*A[p],0,0,n);
			//printf("%d %d %d\n",L[p],R[p],A[p]);
			p=next[p];
		}
		//puts("");
	}
	printf("%ld",query(0,N+1,0,0,n));
}

Measured memory_bytes: 12800
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    //https://atcoder.jp/contests/abc141/tasks/abc141_a
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 文字列の入力
            //string s = Console.ReadLine();

            // 整数の入力
            //int n = int.Parse(Console.ReadLine());

            // 文字列配列の入力
            //string[] inputStrArray = Console.ReadLine().Split(' ');

            // 整数配列の入力
            var inputintArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();

            var A = inputintArray[0];
            var B = inputintArray[1];






            var result = A*B;

            Console.WriteLine(result);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 28072
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String str = scan.next();
		scan.close();
		int min=Integer.MAX_VALUE;
		for(int i=0;i<str.length()-2;i++) {
			int num = Character.getNumericValue(str.charAt(i))*100 + Character.getNumericValue(str.charAt(i+1))*10 + Character.getNumericValue(str.charAt(i+2));
			min = Math.min(min, Math.abs(num-753));
		}
		System.out.println(min);
	}
}


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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    ll h, w;
    cin >> h >> w;
    if (min(h, w) == 1) {
        cout << 1 << endl;
        return 0;
    }
    ll ans = (h * w + 1) / 2;
    cout << ans << endl;
    return 0;
}



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

#define ALL(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0, __##i##_length = (n); i < __##i##_length; i++)
#define rep_reverse(i, n) for (ll i = (n)-1; 0 <= i; i--)
#define FOR(i, from, to)                                                       \
  for (ll i = (from), __##i##_end = (to); i < __##i##_end; i++)
#define FOR_REVERSE(i, from, to)                                               \
  for (ll i = (to)-1, __##i##_end = (from); __##i##_end <= i; i--)
#define foreach(e, v) for (const auto e : (v))
#define vfree(v) std::vector<int>().swap(v)
#define DEBUG(x) cout << #x << " = " << (x) << endl

using namespace std;
typedef int64_t ll;
typedef vector<ll> llv;
typedef vector<llv> llvv;

#define MOD (ll)1000000007

int main() {
  ll a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  ll k; 
  cin >> k;
  cout << a[k - 1] << endl;
}

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

int main()
{
    int a = 0, b = 0, c = 0;
    string s;
    cin >> s;
    for (int i = 0; i < 3; i++)
    {
        if (s.at(i) == 'a')
            a++;
        if (s.at(i) == 'b')
            b++;
        if (s.at(i) == 'c')
            c++;
    }
    if(a == 1 && b == 1 && c == 1)
        cout << "Yes" << endl;
        else
            cout << "No" << endl;
}

Measured memory_bytes: 256