akhauriyash/Code-Regression huggingface dataset:
// #pragma GCC optimize(2)
// #pragma G++ optimize(2)
// #pragma comment(linker,"/STACK:102400000,102400000")

#include <bits/stdc++.h>
using namespace std;

typedef long long int64;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef float fl;
typedef double dl;
typedef pair<int,int> pii;
#if (WIN32) || (WIN64) || (__WIN32) || (__WIN64) || (_WIN32) || (_WIN64) || (WINDOWS)
#define lld "%I64d"
#define llu "%I64u"
#else
#define lld "%lld"
#define llu "%llu"
#endif
#define uint(n) ((unsigned int)(n))
#define int64(n) ((long long)(n))
#define ull(n) ((unsigned long long)(n))
#define fl(n) ((float)(n))
#define dl(n) ((double)(n))
#define char(n) ((char)(n))
#define Bool(n) ((bool)(n))
#define fixpoint(n) fixed<<setprecision(n)

const int INF=1061109567;
const int NINF=-1044266559;
const int64 LINF=4557430888798830399;
const dl eps=1e-15;
#define MOD (1000000007)
#define PI (3.1415926535897932384626433832795028841971)

#define MP make_pair
#define MT make_tuple
#define All(a) (a).begin(),(a).end()
#define pall(a) (a).rbegin(),(a).rend()
#define Log(x,y) log(x)/log(y)
#define SZ(a) ((int)(a).size())
#define rep(i,n) for(int i=0;i<((int)(n));i++)
#define rep1(i,n) for(int i=1;i<=((int)(n));i++)
#define repd(i,n) for(int i=((int)(n))-1;i>=0;i--)
#define repd1(i,n) for(int i=((int)(n));i>=1;i--)
#define repv(itr,v) for(__typeof((v).begin()) itr=(v).begin();itr!=(v).end();itr++)
#define repV(i,v) for(auto i:v)
#define repE(i,v) for(auto &i:v)
#define MS(x,y) memset(x,y,sizeof(x))
#define MC(x) MS(x,0)
#define MINF(x) MS(x,63)
#define MCP(x,y) memcpy(x,y,sizeof(y))
#define UN(v) sort(All(v)),v.erase(unique(All(v)),v.end())
#define filein(x) freopen(x,"r",stdin)
#define fileout(x) freopen(x,"w",stdout)
#define fileio(x)\
	freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout)
#define filein2(filename,name) ifstream name(filename,ios::in)
#define fileout2(filename,name) ofstream name(filename,ios::out)
#define fileio2(filename,name) fstream name(filename,ios::in|ios::out)
#define sqr(x) ((x)*(x))
#define Pause system("pause")
#define Cls system("cls")
#define fs first
#define sc second
#define SF scanf
#define PF printf

const int maxn=1000010;

int n,cnt[maxn];

int main()
{
	cin>>n;

	int ans=0;
	for(int i=1;i<n;i++) for(int j=1;i*j<n;j++) ans++;
	cout<<ans;

	return 0;
}

Measured memory_bytes: 3632
n, m = gets.split(" ").map(&:to_i)
gates = []
m.times do
  gates.push(gets.split(" ").map(&:to_i))
end

mins = []
maxs = []

gates.each do |gate|
  mins.push(gate[0])
  maxs.push(gate[1])
end

minmax = mins.max
maxmin = maxs.min

answer = n - minmax + 1
if n > maxmin
  answer -= n - maxmin
end

if answer < 0
  answer = 0
end

puts answer

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

using namespace std;

int main(){
  int n;
  while(1){
    cin >> n;
    if(n == 0){
      break;
    }else{
      int count = 0;
      for(int i = 1; i <= n ; i++){
	int sum = i;
	for(int j = 1+i ; j <= n ; j++){
	  sum += j;
	  if(n == sum){
	    count++;
	  }
	}
      }
      cout << count << endl;
    }
  }
  
  return 0;
}



Measured memory_bytes: 3084
#include<iostream>
using namespace std;
int main() {
	int a, b;
	bool f = false;
	cin >> a;
	if (a % 10 == 7) f = true;
	if (a / 10 % 10 == 7) f = true;
	if (a / 100 % 10 == 7)f = true;
	if (f) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
}

Measured memory_bytes: 3632
#include<iostream>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
const int inf=0x3f3f3f3f;
ll a[105],b[105],dp[100005];
int main()
{
    int n;
    ll w,i,j;
    cin>>n>>w;
    for(i=1;i<=n;i++)
    cin>>a[i]>>b[i];
    for(i=1;i<=n;i++)
    {
    	for(j=w;j>=a[i];j--)
    	{
    		dp[j]=max(dp[j],dp[j-a[i]]+b[i]);
		}
	}
	cout<<dp[w];
	return 0;
}

Measured memory_bytes: 4360
#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
    int i, j, k;
    cin >> i >> j >> k;
    if(i < j)
    {
        if(j < k)
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
    }
    else
        cout << "No" << endl;
}

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

using namespace std;

main () {
  int N, K, X, Y;
  cin >> N >> K >> X >> Y;
  
  if (N <= K) {
    cout << X * N << endl;
  }
  else {
    cout << X * K + (N - K) * Y;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
using namespace std;

#define rep(i,a) for(int i=0; i<a; i++)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define loop3(i,j,k,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)
#define loop4(i,j,k,l,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)for(int l=0; l<a; l++)if(i!=l&&j!=l&&k!=l)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define scnd1(a) scanf("%d", &a)
#define scnd2(a,b) scanf("%d%d", &a,&b)
#define scnd3(a,b,c) scanf("%d%d%d", &a,&b,&c)
#define scnd4(a,b,c,d) scanf("%d%d%d%d", &a,&b,&c,&d)
#define cin1(a) cin >> a;
#define cin2(a,b) cin >> a >> b;
#define cin3(a,b,c) cin >> a >> b >> c;
#define cin4(a,b,c,d) cin >> a >> b >> c >> d;
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define prtd1(a) printf("%d\n", a)
#define prtd2(a,b) printf("%d %d\n", a,b)
#define prtd3(a,b,c) printf("%d %d %d\n", a,b,c)
#define prtd4(a,b,c,d) printf("%d %d %d %d\n", a,b,c,d)
#define mem(a,n) memset( a, n, sizeof(a))

typedef long long ll;
const int INF = 1e9;
const ll LLINF = 1e18;

int main() {
    ll s;
    cin>>s;
    
    vector<ll> nums;
    while(s>0){
        nums.push_back(s%10);
        s/=10;
    }
    
    reverse(nums.begin(),nums.end());
    
    int len=nums.size();
    ll total=0;
    rep(i,1<<(len-1)){
        ll n = nums[0];
        rep(j,len-1){
            if((1<<j)&i){
                total += n;
                n = nums[j+1];
            }else{
                n = n*10 + nums[j+1];
            }
        }
        total += n;
    }
    cout1(total);
}

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

using ll=long long;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back
#define ALL(x) x.begin(),x.end()
#define REACH cerr<<"reached line "<<__LINE__<<endl
#define DBG(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl

using pi=pair<int,int>;
using vi=vector<int>;
using ld=long double;

template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
	os<<"[";
	REP(i,(int)v.size()){
		if(i)os<<",";
		os<<v[i];
	}
	os<<"]";
	return os;
}

int read(){
	int i;
	scanf("%lld",&i);
	return i;
}

void printSpace(){
	printf(" ");
}

void printEoln(){
	printf("\n");
}

void print(int x,int suc=1){
	printf("%lld",x);
	if(suc==1)
		printEoln();
	if(suc==2)
		printSpace();
}

string readString(){
	static char buf[3341919];
	scanf("%s",buf);
	return string(buf);
}

char* readCharArray(){
	static char buf[3341919];
	static int bufUsed=0;
	char* ret=buf+bufUsed;
	scanf("%s",ret);
	bufUsed+=strlen(ret)+1;
	return ret;
}

template<class T,class U>
void chmax(T& a,U b){
	if(a<b)
		a=b;
}

template<class T,class U>
void chmin(T& a,U b){
	if(a>b)
		a=b;
}

template<class T>
T Sq(const T& t){
	return t*t;
}

const int inf=LLONG_MAX/3;

const int mod=1000000007;
template<class T,class U>
void add(T& a,U b){
	a=((ll)a+b)%mod;
}

template<class T,class U>
void sub(T& a,U b){
	a=((ll)a-b%mod+mod)%mod;
}

template<class T,class U>
void mult(T& a,U b){
	a=((ll)a*b)%mod;
}

ll modPow(ll a,ll p){
	ll s=1;
	REP(i,30){
		if((p>>i)&1)
			mult(s,a);
		mult(a,a);
	}
	return s;
}

ll modInv(ll a){
	return modPow(a,mod-2);
}

const int Nmax=214514;
vi g[Nmax];
void AddEdge(int a,int b){
	g[a].PB(b);
	g[b].PB(a);
}
bool vis[Nmax];
void dfs(int v,vi& z,const vi& c){
	if(vis[v])return;
	vis[v]=1;
	z.PB(c[v]);
	for(auto to:g[v])dfs(to,z,c);
}
pi s[Nmax],t[Nmax];

signed main(){
	int n=read(),x=read(),y=read();
	vi c,w;
	REP(i,n)c.PB(read()-1),w.PB(read());
	REP(i,n)s[i]=pi(inf,inf);
	REP(i,n)chmin(s[c[i]],pi(w[i],i));
	REP(i,n)if(s[c[i]].first+w[i]<=x)AddEdge(i,s[c[i]].second);
	REP(i,n)t[i]=s[i];
	FOR(i,1,n)chmin(s[i],s[i-1]);
	for(int i=n-2;i>=0;i--)chmin(t[i],t[i+1]);
	REP(i,n){
		pi p=pi(inf,inf);
		if(c[i]-1>=0)chmin(p,s[c[i]-1]);
		if(c[i]+1<n)chmin(p,t[c[i]+1]);
		if(p.first+w[i]<=y)AddEdge(i,p.second);
	}
	int ans=1;
	REP(v,n)if(!vis[v]){
		vi z;
		dfs(v,z,c);
		sort(ALL(z));
		FOR(i,1,z.size()+1)mult(ans,i);
		int len=0;
		REP(i,z.size()){
			if(i&&z[i-1]==z[i])len++;
			else len=1;
			mult(ans,modInv(len));
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 28900
import itertools

A1,A2,A3 = map(int,input().split())
    
vec = [A1,A2,A3]
com = list(itertools.permutations(vec))
    
all_cos = [0,0,0,0,0,0]
for i in range(6):
    tmp_com = com[i]
        
    tmp_A1 = tmp_com[0]
    tmp_A2 = tmp_com[1]
    tmp_A3 = tmp_com[2]
        
    cos1 = 0
    cos2 = abs(tmp_A1 - tmp_A2)
    cos3 = abs(tmp_A2 - tmp_A3)
        
    all_cos[i] = cos1 + cos2 + cos3
    
res = min(all_cos)
print(res)



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

int get_color(int rate){
    if (0 < rate && rate < 400){
        // 灰色
        return 0;
    }else if(400 <= rate && rate < 800){
        // 茶色
        return 1;
    }else if(800 <= rate && rate < 1200){
        // 緑色
        return 2;
    }else if(1200 <= rate && rate < 1600){
        // 水色
        return 3;
    }else if(1600 <= rate && rate < 2000){
        // 青色
        return 4;
    }else if(2000 <= rate && rate < 2400){
        // 黄色
        return 5;
    }else if(2400 <= rate && rate < 2800){
        // 橙色
        return 6;
    }else if(2800 <= rate && rate < 3200){
        // 赤色
        return 7;
    }else if(3200 <= rate){
        // 任意の色
        return 8;
    }
}

int main() {
    int N, a;
    int color_num = 0;
    int min_color, max_color;
    cin >> N;
    vector<int> rate_color(9, 0);
    for (int i = 0; i < N; i++){
        cin >> a;
        rate_color[get_color(a)]++;
    }
    for (int i = 0; i < 8; i++){
        if (rate_color[i] > 0) color_num++;
    }

    if (color_num > 0){
        min_color = color_num;
        max_color = color_num + rate_color[8];
    }else{
        if (rate_color[8] > 0){
            min_color = 1;
        }else{
            min_color = 0;
        }
        max_color = rate_color[8];
    }

    cout << min_color << " " << max_color << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fst first
#define snd second
#define rep(n) for(lint I = 0; (I) < (lint)(n); ++(I))
#define repeat(i, n) for(lint i = 0; (i) < (lint)(n); ++(i))
#define repeat_to(i, n) for(lint i = 0; (i) <= (lint)(n); ++(i))
#define repeat_from(i, m, n) for(lint i = (m); (i) < (lint)(n); ++(i))
#define repeat_from_to(i, m, n) for(lint i = (m); (i) <= (lint)(n); ++(i))
#define repeat_reverse_from_to(i, m, n) for(lint i = (m); (i) >= (lint)(n); --(i))
#define el cout<<endl
#define dump(x) cout<<" "<<#x<<"="<<x
#define vdump(v) for(size_t I=0; I<v.size(); ++I){cout<<" "<<#v<<"["<<I<<"]="<<v[I];} cout<<endl
using namespace std;
using lint = long long;
using ld = long double;

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll gcd(ll  a, ll b){
    if(b == 0)return a;
    else return gcd(b,a%b);
}

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

int main()
{
    ll n;
    cin>>n;
    cout<<lcm(n,2LL)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{

 int a,b,c,d,e;

 e=0;

 scanf("%d %d %d",&a,&b,&c);

 for(d=a;d<=b;d++)
{
 if(c%d==0)
  {e++;}
}

printf("%d\n",e);
return 0;
}



Measured memory_bytes: 2732
N, M = map(int, input().split())
A = []
for _ in range(N):
    k_a = map(int, input().split())
    A.append(list(k_a)[:])

LIKE = [0 for _ in range(M + 1)]

for Ai in A:
    for a in Ai[1:]:
        LIKE[a] += 1

ans = 0
for x in LIKE:
    if x == N:
        ans += 1
print(ans)

Measured memory_bytes: 3064
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP2_5_C&lang=jp
#  Enumeration : python3
#  2018.12.01 yonezawa

import sys
input = sys.stdin.readline
from collections import deque

class enumeration:
    def __init__(self,n):
        self.n = n
        self.depth = 0
        self.wnum = 0
        self.nq = []
        self.bits = [ pow(2,i) for i in range(n+1) ]
        self.mk_permutation(0,0,0)

    def mk_permutation(self,depth,bflag,wnum):
        if self.n == depth:
            self.nq.append(wnum)
            return
        for i in range(1,self.n+1):
            if bflag & self.bits[i-1] != 0:
                continue
            self.mk_permutation(depth + 1,bflag + self.bits[i-1],wnum*10+i)  
            
    def printList(self):
        l = self.nq
        self.nq.sort()
        for i in l:
            self.printInttoStr(i)
            
    def printInttoStr(self,i):
        c = ""
        for j in str(i):
            c += j + " "
        print(c.strip())

    def solve(self,tc):
        pos = self.nq.index(tc)
        if (pos != 0 ):
            self.printInttoStr(self.nq[pos-1])
        self.printInttoStr(tc)
        if (pos + 1 != len(self.nq) ):
            self.printInttoStr(self.nq[pos+1])
            
def main():
    n = int(input())
    tc = 0
    for i in list(map(int,input().split())):
        tc = tc * 10 + i
    e = enumeration(n)
    e.solve(tc)

if __name__ == '__main__':
    main()


Measured memory_bytes: 20468
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
template<unsigned int mod_>
struct ModInt{
	using uint = unsigned int;
	using ll = long long;
	using ull = unsigned long long;

	constexpr static uint mod = mod_;

	uint v;
	ModInt():v(0){}
	ModInt(ll v):v(normS(v%mod+mod)){}
	explicit operator bool() const {return v!=0;}
	static uint normS(const uint &x){return (x<mod)?x:x-mod;}		// [0 , 2*mod-1] -> [0 , mod-1]
	static ModInt make(const uint &x){ModInt m; m.v=x; return m;}
	ModInt operator+(const ModInt& b) const { return make(normS(v+b.v));}
	ModInt operator-(const ModInt& b) const { return make(normS(v+mod-b.v));}
	ModInt operator-() const { return make(normS(mod-v)); }
	ModInt operator*(const ModInt& b) const { return make((ull)v*b.v%mod);}
	ModInt operator/(const ModInt& b) const { return *this*b.inv();}
	ModInt& operator+=(const ModInt& b){ return *this=*this+b;}
	ModInt& operator-=(const ModInt& b){ return *this=*this-b;}
	ModInt& operator*=(const ModInt& b){ return *this=*this*b;}
	ModInt& operator/=(const ModInt& b){ return *this=*this/b;}
	ll extgcd(ll a,ll b,ll &x,ll &y) const{
		ll u[]={a,1,0},v[]={b,0,1};
		while(*v){
			ll t=*u/ *v;
			rep(i,3) swap(u[i]-=t*v[i],v[i]);
		}
		if(u[0]<0) rep(i,3) u[i]=-u[i];
		x=u[1],y=u[2];
		return u[0];
	}
	ModInt inv() const{
		ll x,y;
		extgcd(v,mod,x,y);
		return make(normS(x+mod));
	}
	bool operator==(const ModInt& b) const { return v==b.v;}
	bool operator!=(const ModInt& b) const { return v!=b.v;}
	friend istream& operator>>(istream &o,ModInt& x){
		ll tmp;
		o>>tmp;
		x=ModInt(tmp);
		return o;
	}
	friend ostream& operator<<(ostream &o,const ModInt& x){ return o<<x.v;}
};
using mint = ModInt<1000000007>;
mint dp[10010][100][2];
int main(){
	string str;
	int D;
	cin>>str;
	cin>>D;
	int N = str.size();
	dp[0][0][1] = 1;
	rep(i,N) rep(s,D) rep(just,2) if(dp[i][s][just]){
		rep(d,10){
			int ns = (s+d)%D;
			if(just && d>str[i]-'0') continue;
			int njust = just && (d==str[i]-'0');
			dp[i+1][ns][njust] += dp[i][s][just];
		}
	}
	cout<<dp[N][0][0]+dp[N][0][1]-1<<endl;
}

Measured memory_bytes: 8064
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <complex>
#include <iomanip>
#include <queue>
//定数
#define MOD 1000000007
//マクロ
#define rep(i,n)    for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))

#define vsort(v) sort((v).begin(), (v).end());

typedef unsigned long long int ull;
typedef long long lint;

using namespace std;




int main(){
    int A1, A2, A3;

    //入力
    cin >> A1 >> A2 >> A3;

    
    
    if(A1 + A2 + A3 >= 22)      cout << "bust"  << endl;
    else                        cout << "win"   << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static int getLength(String x, String y) {
		int ans = 0;
		int[][] answer = new int[x.length() + 1][y.length() + 1];
		for(int i = 1; i <= x.length(); i++) {
			for(int j =1 ; j <=y.length(); j++) {
				if(x.charAt(i-1) != y.charAt(j-1)) {
					answer[i][j] = max(answer[i-1][j],answer[i][j-1]);
				}
				if(x.charAt(i-1) == y.charAt(j-1)) {
					answer[i][j] = 1 + answer[i-1][j-1];
				}
			}//ends inner for 
		}//ends outer for
		ans = answer[x.length()][y.length()];
		return ans;
	}
	
	public static int max(int a , int b) {
		if(a >= b) {
			return a;
		}
		else {
			return b;
		}
		
	}
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int pairs = in.nextInt();
		for(int i = 0; i < pairs; i++) {
			String first = in.next();
			String second = in.next();
			System.out.println(getLength(first, second));
		}
		in.close();
	}
}


Measured memory_bytes: 65024
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<cmath>


#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))
#define FOR(i,n) for (int i = 1; (i) <= (n); ++ (i))
#define dump(x)  cout << #x << " = " << (x) << endl;
#define pb push_back
#define int long long
//#define lint long long

const int INF = 1e18;
const int MOD = 1e9+7;
//const lint LINF = 1e18;
const double eps = 0.000000001;//もとの値の10^(-16)まで

using namespace std;

//typedef pair<int, int> P;
//priority_queue< P, vector<P>, greater<P> > q;//ダイクストラの時、greaterで小さい順

int a[200000];
int b[200000];
signed main(){
  int a,b,k;
  cin >> a >> b >> k;
  if(a>k){
    cout << a-k << " " << b << endl;
  }
  else{
    cout << 0 << " " << max((int)0,b-(k-a)) << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import bisect
import collections
import itertools

def getint(): return int(input())
def getints(): return list(map(int, input().split()))
def getint2d(rows): return [getints() for _ in range(rows)]
def getgrid(rows): return [input() for _ in range(rows)]
def array1d(n, value): return [value for _ in range(n)]
def array2d(n, m, value): return [array1d(m, value) for _ in range(n)]

h,w=getints()

def solve2(h,w):
    if h % 2 == 0:
        e = h // 2 * w
        return (e,e)
    if w % 2 == 0:
        e = h * w // 2
        return (e,e)
    h1 = h // 2
    h2 = h - h1
    e1 = (h1 * w, h2 * w)
    w1 = w // 2
    w2 = w - w1
    e2 = (h * w1, h * w2)
    return e2 if abs(e2[0] - e2[1]) < abs(e1[0] - e1[1]) else e1

def solve3():
    res = h * w
    for i in range(1, h):
        m = i * w
        r = solve2(h-i,w)
        values = list(sorted([m, r[0], r[1]]))
        res = min(res, values[2] - values[0])
    for j in range(1, w):
        m = h * j
        r = solve2(h, w - j)
        values = list(sorted([m, r[0], r[1]]))
        res = min(res, values[2] - values[0])
    return res

print(solve3())


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

int main() {
  int N;
  string A, B, C;
  cin >> N >> A >> B >> C;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (A[i] == B[i] && B[i] == C[i]) continue;
    if (A[i] != B[i] && B[i] != C[i] && A[i] != C[i]) ans += 2;
    else ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
//encoding:utf-8
//#include <iostream> //c++
//#include<stack> //スタックに関して　最新のデータから捨てる
//#include<queue> //キューに関して　最古のデータから捨てる
//#include<math.h>
//#include<vector>
//#include<algorithm> //sort とかにいる
#include<bits/stdc++.h>//vector,algorithm,que
#include<time.h> //時間にかんして

#define ll long long
#define MOD 1000000007
using namespace std;
int main(){
  int N,K;
  cin>>N>>K;
  string S;
  cin>>S;

  vector<int> Nums;
  int now = 1;//今みている数
  //もし最初の数字が0ならその分がカウントされる
  int cnt = 0;
  for(int i=0;i<N;i++){
    if(S[i]==(char)('0'+now))cnt++;
    else{
      Nums.push_back(cnt);
      now = 1 - now;
      cnt = 1;
    }
  }

  if(cnt!=0) Nums.push_back(cnt);

  if(Nums.size()%2==0)Nums.push_back(0);

  int Add = 2 * K + 1;
  int ans = 0;
  //1-0-...の1から始めるの
  for(int i=0;i<Nums.size();i+=2){
    int tmp = 0;
    int left = i;
    int right = min(i+Add,(int)Nums.size());
    for(int j=left;j<right;j++){
      tmp += Nums[j];
    }
    ans = max(ans,tmp);
  }

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


Measured memory_bytes: 1020
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
 
public class Main {
 
    void solve() throws IOException {
        int N = ni();
        ArrayList<ArrayList<Integer>> robo = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            int x = ni();
            int l = ni();
            ArrayList<Integer> r = new ArrayList<>();
            r.add(x-l);
            r.add(x+l);
            robo.add(r);
        }
        Collections.sort(robo, (r1,r2) -> r1.get(1).compareTo(r2.get(1)));
        // System.out.println(robo);
        int time = -Integer.MAX_VALUE;
        int ans = 0;
        for (int i = 0; i < N; i++) {
            if(time <= robo.get(i).get(0)){
                time = robo.get(i).get(1);
                ans ++;
            }
        }
        out.println(ans);
    }

 
    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }
 
    int ni() throws IOException {
        return Integer.parseInt(ns());
    }
 
    long nl() throws IOException {
        return Long.parseLong(ns());
    }
 
    double nd() throws IOException {
        return Double.parseDouble(ns());
    }
 
    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }
 
    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }
 
    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }
 
    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;
 
    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

Measured memory_bytes: 68964
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define stpr setprecision
#define rep(i,n) for(ll i=0;i<(n);++i)
#define REP(i,a,b) for(ll i=(a);i<(b);++i)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define endl '\n'
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ld EPS=10e-8;
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
    for(auto i=begin(v); i != end(v); ++i){
        if(i !=begin(v)) os << ' ';
        os << *i;
    }
    return os;
}

ll dp[57][57][2507];
 
int main() {
    ll N,A[107],bunsan=0,minbun=MOD;
    cin >> N;
    rep(i,N){
        cin >> A[i];
    }
    for(int i=-100;i<=100;i++){
        bunsan=0;
        rep(j,N){
            bunsan+=(A[j]-i)*(A[j]-i);
        }
        minbun=min(minbun,bunsan);
    }
    cout << minbun << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env ruby
require 'set'

class Number
  def initialize num
    @num = num
  end

  def == num
    @num == num
  end

  attr_reader :num
end

def main
  loop do
    w,h = gets.chomp.split(' ').map(&:to_i)
    break if (w|h) == 0
    puts solve(w, h)
  end
end

def solve w, h
  grid = Array.new(h+1).map{Array.new(w+1, 0)}
  sets = []
  start_h = 0
  start_w = 0
  h.times do |i|
    line = gets.chomp
    line.each_char.with_index do |c, j|
      grid[i+1][j+1] = case c
      when '.' then Number.new(1)
      when '@'
        start_h = i + 1
        start_w = j + 1
        Number.new(1)
      when '#' then Number.new(0)
      end

      next if grid[i+1][j+1] == 0

      if grid[i+1][j] == 0 and grid[i][j+1] == 0
        sets << Set.new([grid[i+1][j+1]])
        next
      end

      left_set = nil
      top_set = nil
      sets.each do |set|
        if set.include?(grid[i+1][j])
          set << grid[i+1][j+1]
          left_set = set
        end

        if set.include?(grid[i][j+1])
          set << grid[i+1][j+1]
          top_set = set
        end
      end

      if left_set.nil? or top_set.nil?
        next
      end

      union_set = nil
      unless left_set.equal?(top_set)
        union_set = left_set + top_set
        sets.delete(left_set)
        sets.delete(top_set)
        sets << union_set
      end
    end
  end

  result = 0
  sets.each do |set|
    if set.include?(grid[start_h][start_w])
      result = set.size
      break
    end
  end
  result
end

main

Measured memory_bytes: 6644
#include<iostream>
using namespace std;
int n,data[101];
long long dp[101][21];
long long rec(int,int);
int main(){
  cin >> n;
  for(int i=0;i<n;i++) cin >> data[i];
  cout << rec(1,data[0]) << endl;
}
long long rec(int x,int s){
  if(s < 0 || s > 20) return 0;
  if(dp[x][s] != 0) return dp[x][s];
  if(x == n - 1) return (s == data[n - 1] ? 1 : 0);

  return (dp[x][s] = rec(x+1,s+data[x])+rec(x+1,s-data[x]));
}

Measured memory_bytes: 1172
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int k,a,b;
    cin>>k>>a>>b;
    for(int i=a; i<=b; i++)
    {
        if(i%k==0)
        {
            cout<<"OK";
            return 0;

        }
    }

        cout<<"NG";
        return 0;

    }


Measured memory_bytes: 3584
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> p(n);
    for (int i = 0; i < n; i++)cin >> p[i];

    int ret = 0;
    for (int i = 1; i < n - 1; i++) {
        bool found = false;
        if (p[i - 1] < p[i] && p[i] < p[i + 1])found = true;
        if (p[i - 1] > p[i] && p[i] > p[i + 1])found = true;
        if (found) ret++;
    }

    cout << ret << endl;
    return 0;
}

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

using namespace std;

const int N = 1e5+10;

int a[N];
int f[N]; 

int main()
{
	int n,k;
	cin>>n>>k;
	memset(f,0x3f,sizeof(f));
	f[1]=0;
	f[0]=0;
	for(int i=1;i<=n;i++)	cin>>a[i];
	for(int i=1;i<=n;i++)
	{
		for(int j=i+1;j<=min(i+k,n);j++)
		{
			f[j]=min(f[i]+abs(a[j]-a[i]),f[j]);
		}
	}
	cout<<f[n];
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<ll, ll>
#define debug(var) cerr << "[" << #var << "] " << var << endl
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define pr(s) cout << (s) << '\n'
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
const int INF = 1001001001;
const ll INFll = 1E+18;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n, x, m;
    cin >> n >> x >> m;
    ll ans = 0;
    vector<P> memo(m, P(-1, -1));
    for (ll i=0; i<n; i++) {
        if (memo[x].second>=0) {
            ll loop = i - memo[x].first;
            //debug(loop);
            ll sum_loop = ans - memo[x].second + x;
            ll num = (n-i-1)/loop;
            ans += sum_loop * num;
            i += loop*num;
        }
        else {
            memo[x] = {i, ans+x};
        }
        ans += x;
        x = (x*x)%m;
        //if (x==0) break;
    }
    
    pr(ans);
    return 0;
}


Measured memory_bytes: 4716
import sys

stdin = sys.stdin

ni = lambda: int(ns()) #int
na = lambda: list(map(int, stdin.readline().split())) #int,list
ns = lambda: stdin.readline().rstrip()  # str

n=ni()
w=na()
s=sum(w)
ss=0
ans =10000
for i in range(n):
	a=w.pop()
	s-=a
	ss+=a
	
	ans=min(ans,abs(s-ss))
print(ans)

Measured memory_bytes: 3064
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (size_t i = 0; i < size_t(n); i++)
#define forn1(i,n) for (size_t i = 1; i <= size_t(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

const int MAX_N = 100000;
int n;
ll a, b;
ll x[MAX_N];

int main() {
    fastio();

    cin >> n >> a >> b;
    forn(i, n) cin >> x[i];

    ll ans = 0;
    forn(i, n - 1) {
        ans += min(b, a * (x[i + 1] - x[i]));
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
l=require("fs").readFileSync("/dev/stdin","utf8").split(/[\s]+/);a={};p=0;r=1;for(i=0,n=+l.shift();i<n;i++){if(p!==0&&([...p].pop()!=l[i][0]||a[l[i]])){r=0;break}a[p=l[i]]=1;}console.log(r?"Yes":"No")

Measured memory_bytes: 11696
#include <bits/stdc++.h>
using namespace std;
int main(){
  int K;
  string S;
  cin >> K >> S;
  int a=S.size();
  string t="";
  char c;
  if(a<=K)cout<<S<<endl;
  else{
    for(int i=0;i<K;i++){
      c=S.at(i);
      t=t+c;
    }
    cout << t+"..." << endl;
  }
}

Measured memory_bytes: 3608
#include<iostream>
#include<string>
#include<array>
#include<algorithm>
using namespace std;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (b-a==c-b) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#include <new>
#include <typeinfo>
#include <iterator>


typedef long long ll;
typedef unsigned long long ull;
constexpr ll mop = 1000000007;
constexpr ll mop2 = 998244353;

using namespace std;

template <typename T>
map<T, T> prime_factor(T n) {
	map<T, T> res;
	for (T i = 2; i*i <= n; i++) {
		while (n%i == 0) {
			++res[i];
			n /= i;
		}
	}
	if (n != 1) {
		res[n] += 1;
	}
	return res;
}


int main() {
	ll n;
	cin >> n;
	map<ll, ll> ans;
	ans = prime_factor(n);
	cout << n << ":";
	for (auto i : ans) {
		ll numRep = i.second;
		for (ll j = 0; j < numRep; j++) {
			cout << " " << i.first;
		}
	}
	cout << endl;
}



Measured memory_bytes: 3116
# -*- coding: utf-8 -*-
from sys import stdin
# import numpy as np

s_in = lambda: stdin.readline()[:-1]  # s = s_in()
d_in = lambda: int(stdin.readline())  # N = d_in()
ds_in = lambda: list(map(int, stdin.readline().split()))  # List = ds_in()


def gcd(a, b):
    """ Greatest Common Divisor(最大公約数) """
    while b:
        a, b = b, a % b
    return a


N = d_in()
A_list = ds_in()

ans = A_list[0]
for a in A_list[1:]:
    ans = gcd(ans, a)
print(ans)


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

int main()
{
    int a,b;
    char str[105];
    scanf("%d %d %s",&a,&b,str);
    if(strlen(str)<(a+b+1))
    {
        puts("No");
        exit(0);
    }
    for(int i=0; i<a; i++)
    {
        if(str[i]>='0' && str[i]<='9')  continue;
        else
        {
            puts("No");
            exit(0);
        }
    }
    if(str[a]!='-')
    {
        puts("No");
        exit(0);
    }
    for(int i=(a+1); i<(a+b+1); i++)
    {
        if(str[i]>='0' && str[i]<='9')  continue;
        else
        {
            puts("No");
            exit(0);
        }
    }
    puts("Yes");
    return  0;
}


Measured memory_bytes: 384
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Numerics;


class Program
{
    static void Main(string[] args)
    {
        // 入力
        //var s = Console.ReadLine();
        //var n = int.Parse(Console.ReadLine());
        int[] nk = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var n = nk[0];
        var k = nk[1];
        long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray();

        var ans = new List<string>();
        for (int i = k; i < n; i++)
        {
            if (a[i] > a[i - k]) ans.Add("Yes");
            else ans.Add("No");
        }

        // 出力
        foreach (var item in ans)
        {
            Console.WriteLine(item);
        }

    }
}


Measured memory_bytes: 50580
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 998244353


def main():
    N, K, *LR = map(int, read().split())
    interval = [(l, r) for l, r in zip(*[iter(LR)] * 2)]

    dp = [0] * (N + 1)
    sdp = [0] * (N + 1)

    dp[0] = 1
    sdp[1] = 1

    for i in range(1, N):
        for l, r in interval:
            left = max(i - r, 0)
            right = max(i - l + 1, 0)
            dp[i] = (dp[i] + sdp[right] - sdp[left]) % MOD
        sdp[i + 1] = (sdp[i] + dp[i]) % MOD

    print(dp[N - 1])
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 76436
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main()
{
    int n,p;
    cin>>n>>p;
    int ans=1;
    for(int i=2;i<=1000000;++i){
        if(p%i==0){
            int cp=0;
            while(p%i==0){
                p/=i;
                cp++;
            }
            cp/=n;
            for(int j=0;j<cp;++j)
            ans*=i;
        }
    }
    if(n==1)
    ans*=p;
    cout<<ans;
    return 0;
}


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

int main() {
  int n, S, r[20001];
  while(cin >> n >> S && (n|S)) {
    for(int i = 0; i < n; ++i) cin >> r[i];
    sort(r,r+n);
    int res = 0;
    for(int i = 0; i < n; ++i) {
      int begin = distance(r,upper_bound(r,r+n,S-r[i]));
      res += n - begin - (begin <= i);
    }
    cout << res/2 << endl;
  }
  return 0;
}

Measured memory_bytes: 912
extern crate core;

use std::io::{self, Read};

#[macro_use]
mod parser {
    macro_rules! input {
    ($s:expr=>$($t:tt)*) => {
        let mut lines=$s.split("\n");
        $(
            line_parse!(lines,$t);
        )*
    };
    }

    macro_rules! line_parse {
    ($lines:expr,($($name:ident:$t:tt)*)) => {
        let mut line=$lines.next().unwrap().split_whitespace();
        $(value_def!(line,$name,$t);)*
    };

    //複数行
    ($lines:expr,{$n:expr;$name:ident:$t:tt}) => {
        values_def!($lines,$n,$name,$t);
    };
    }

    macro_rules! value_def {
        ($line:expr, $name:ident, $t:tt) => {
            let $name = value!($line, $t);
        };
    }

    macro_rules! values_def {
        ($lines:expr, $n:expr, $name:ident, $t:tt) => {
            let $name = {
                let mut vec = Vec::new();
                for i in 0..$n {
                    let mut next = $lines.next().unwrap().split_whitespace();
                    vec.push(value!(next, $t));
                }
                vec
            };
        };
    }

    macro_rules! value {
    //配列
    ($line:expr,[$t:tt]) => {
        $line.map(|x|{
        let mut iter=::std::iter::once(x);
        value!(iter,$t)
        }).collect::<Vec<_>>()
    };
    //タプル
    ($line:expr,($($t:tt),*)) => {
        ($(value!($line,$t),)*)
    };
    //文字列
    ($line:expr,#) => {
        $line.next().unwrap()
    };
    //単一値
    ($line:expr,$t:ty) => {
        $line.next().unwrap().parse::<$t>().unwrap()
    };
    }
}

fn main() {
    let mut input = String::new();
    io::stdin().read_to_string(&mut input).unwrap();
    let output = solve(input.trim().to_string());
    println!("{}", output);
}

fn solve(input: String) -> String {
    input!(input=>(s:#));
    let s = s.chars().collect::<Vec<_>>();
    let b1 = s[0] == 'A';
    let b2 = {
        let mut count = 0;
        for i in 2..s.len() - 1 {
            if s[i] == 'C' {
                count += 1;
            }
        }
        count == 1
    };
    let b3 = {
        let mut count = 0;
        for c in s {
            if 'A' <= c && c <= 'Z' {
                count += 1;
            }
        }
        count == 2
    };
    if b1 && b2 && b3 { "AC" } else { "WA" }.to_string()
}

macro_rules! tests {
    ($($name:ident: $input:expr=>$output:expr,)*) => {
        mod tests {
            $(
                #[test]
                fn $name() {
                    assert_eq!($output.trim().to_string(),super::solve($input.trim().to_string()));
                }
            )*
        }
    }
}

tests! {
    test1: "AtCoder" => "AC",
    test2: "ACoder" => "WA",
    test3: "AcycliC" => "WA",
    test4: "AtCoCo" => "WA",
    test5: "Atcoder" => "WA",
}


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

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

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

    // input
    ll N;
    cin >> N;

    vector<ll> V(N);
    vector<ll> C(N);

    FOR(i, 0, N){
        cin >> V[i];
    }
    FOR(i, 0, N){
        cin >> C[i];
    }

    ll sum = 0;
    FOR(i, 0, N){
        if(V[i]>C[i]){
            sum += V[i]-C[i];
        }
    }
    p(sum);
    
    return 0;
}

Measured memory_bytes: 256
def c_march(N, S):
    from collections import defaultdict
    from itertools import combinations
    import math
    count = defaultdict(int)
    for s in S:
        if s[0] in 'MARCH':
            count[s[0]] += 1
    kind = len(count)
    ans = 0
    if len(count) <= 2:
        return 0
    else:
        ans = 0
        s = ''
        for k, v in count.items():
            s += k
        string = combinations(s, 3)
        for s in string:
            tmp = 1
            for c in s:
                tmp *= count[c]
            ans += tmp
    return ans

N = int(input())
S = [input().strip() for _ in range(N)]
print(c_march(N, S))

Measured memory_bytes: 10008
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
using namespace std;
int main(){
	int N, D;
	cin >> N >> D;
	int L = 2 * D + 1;
	int ans = N / L;
	if(N % L > 0)ans++;
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
    public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n;
		int m;
		int[] cost;
		String[] max=new String[1000];
		int tmp;
		int cnt=0;
		while(sc.hasNextLine()){
	   		n=sc.nextInt();    //品物の個数
	    	m=sc.nextInt();    //最大の金額
	    	if(n!=0 && m!=0){
				cost=new int[n];
				max[cnt]="0";
				tmp=0;
				for(int i=0;i<n;i++){
		    		cost[i]=sc.nextInt();
				}
				for(int i=0;i<n-1;i++){
		    		for(int j=i+1;j<n;j++){
						tmp=cost[i]+cost[j];
						if(tmp>Integer.parseInt(max[cnt]) && tmp<=m){
			    			max[cnt]=String.valueOf(tmp);
						}
		    		}
				}
				if(max[cnt].equals("0")){
		    		max[cnt]="NONE";
				}
	    	}else{
				break;
	    	}
	    	cnt+=1;
		}
		for(int i=0;i<cnt;i++){
			if(max[i].equals("NONE")){
				System.out.println(max[i]);
			}else{
	    		System.out.println(Integer.parseInt(max[i]));
			}
		}
    }
}


Measured memory_bytes: 58136
#include <bits/stdc++.h>
	using namespace std;
	int main() { 
	    
	    int a,b;
	    cin >> a >> b;

	    while(a && b){
	    	for(int i=0; i<a ;i++){
	    	for(int j=0 ;j <b;j++){
	    		cout << "#";
	    	}
	    	cout << endl;
	    	}
	    	cout << endl;
	    	cin >> a >> b;	
	    }
	    


	    return 0;
	}


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

int main(){
int N,M;
  int ans =0;
  cin >> N >> M;
vector<int> A(M);
for(int i =0;i < M;++i){
    cin >> A[i];
ans +=A[i]; 
}
  if(ans > N)
    cout << -1 << endl;
  else 
    cout << N - ans << endl;
  
}

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

int main(){
  int n, a, b; cin >> n >> a >> b;
  int ans = 0;
  for(int i = 1; i <= n; i++){
    int num = i;
    int ans_num = 0;
    while(1){
      if(num == 0) break;
      ans_num += num % 10;
      num /= 10;
    }
    if(ans_num >= a && b >= ans_num) ans += i;
  }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rei register int
using namespace std;
const int maxn = 200010;
char s[maxn];
int main(){
	scanf("%s",s + 1);
	int lens = strlen(s + 1); int cnt(0);
	for(rei i = 1;i <= lens;++i) cnt = cnt + s[i] - '0';
//	cerr <<
	if(cnt % 9 == 0) puts("Yes");
	else puts("No"); return 0;
}

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

#define ll long long 
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()

void initforfac() {
/* 
	set const int N = ...; ll fac[N], inv[N];

	fac[0] = fac[1] = inv[0] = inv[1] = 1;
	for(int i = 2; i < N; ++i) inv[i] = 1ll * inv[MOD % i] * (MOD - MOD / i) % MOD;
	for(int i = 1; i < N; ++i) inv[i] = 1ll * inv[i - 1] * inv[i] % MOD;
	for(int i = 2; i < N; ++i) fac[i] = 1ll * fac[i - 1] * i % MOD;
*/
}

ll gcd(ll a, ll b) {
	return (a % b) ? gcd(b, a % b) : b;
}
ll lcm(ll a, ll b) {
	return (a * b) / gcd(a, b);
}
ll add(ll a, ll b) {
	ll x = (a + b) % MOD;
	if(x < 0) return x + MOD;
	return x;
}
ll sub(ll a, ll b) {
	ll x = (a - b) % MOD;
	if(x < 0) return x + MOD;
	return x;
}
ll mul(ll a, ll b) {
	ll x = (a * b) % MOD;
	if(x < 0) return x + MOD;
	return x;
}
ll power(ll a, ll b) {
	if(b == 0) return 1;
	if(b & 1) return mul(a, power(a, b - 1));
	return power(mul(a, a), b / 2);
}
ll inv(ll x) {
	return power(x, MOD - 2);
}
/*
ll C(ll n, ll r) {
	return 1ll * fac[n] * inv[r] % MOD * inv[n - r] % MOD;
}
*/

void init() {
	
}

void solve() {
	int n; cin >> n;
	int a[n], ans = 0;
	for(int i = 0; i < n; ++i) {
		cin >> a[i];
		if(i % 2 == 0 && a[i] & 1) ans++;

	}
	cout << ans;
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	init();
	int t = 1; //cin >> t;
	while(t--) {
		solve();
	}
	return 0;
}

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

using namespace std;

int main()
{
    int r,d,x2k;
    cin>>r>>d>>x2k;
    vector<unsigned int>v(11,0);
    v[0]=x2k;
    for(int i=1;i<11;i++)
    {
        v[i]=r*v[i-1]-d;
	cout<<v[i]<<endl;
    }
    return 0;
}


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

#define forn(i, a, b) for (int i = a; i <= b; ++i)

using namespace std;

const int N = (int)2e5 + 1;
const long long INF = 1e9 + 7;

typedef long long ll;
typedef long double ld;

typedef pair < int, int > pii;
typedef pair < ll, ll > pll;

int n;

bool f (int x){
  int sum = 0;
  for (int i = 1; i <= x; ++i){
    if (x % i == 0){
      sum++;
    }
  }
  if (sum == 8) return 1;
  return 0;
}

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


Measured memory_bytes: 256
#include<iostream>
#include<vector>

using namespace std;

int main(){
	int n;
    long long ans = 0;
	cin >> n;
    vector<long long> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    bool f = true;
    while(f){
        f = false;
        for(int i = 0; i < n; i++){
            if(a[i] < n) continue;
            long long t = a[i] / n;
            a[i] %= n;
            ans += t;
            f = true;
            for(int j = 0; j < n; j++){
                if(i == j) continue;
                a[j] += t;
            }
        }
    }
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <time.h>
using namespace std;
#define LL long long
#define MOD 1000000007
int N,M;
int S[2000], T[2000];
LL solve(int i, int j){
  if(i == N || j == M) return 1;
  LL ret = solve(i+1, j);
  for(int k=j; k<M; k++){
   if(S[i] == T[k]) ret += solve(i+1, k+1); 
  }
  return ret;
}
LL dp[2001][2001];
LL sum[2001][2001] = {};
int main(){
  cin >> N >> M;
  for(int i=0; i<N; i++) cin >> S[i];
  for(int i=0; i<M; i++) cin >> T[i];
  for(int i=N; i>=0; i--){
   for(int j=M; j>=0; j--){
     if(i==N || j == M) dp[i][j] = 1;
     else dp[i][j] = (dp[i+1][j] + sum[i+1][j+1]) % MOD;
     sum[i][j] = (j == M ? 0 : sum[i][j+1]);
     if(i > 0 && j > 0 && S[i-1] == T[j-1]) sum[i][j] += dp[i][j];
     sum[i][j] %= MOD;
   }
  }
  cout << dp[0][0] << endl;
}

Measured memory_bytes: 62848