akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;

int main(){
    int N;
    int a,b,c,d;

    cin >> N;

    a = N % 10;
    b = (N / 10) % 10;
    c = (N / 100) % 10;
    d = N / 1000;

    if(d != c){
        if(c != b){
            cout << "No" << endl;
        }else if(b != a){
            cout << "No" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }else if(c != b){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
}

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

#include <fstream>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(20) << fixed;
  /*
  ifstream in("input.txt");
  cin.rdbuf(in.rdbuf());
  //*/
  int N;
  cin >> N;
  vector<int> vec(N);
  for(int i = 0; i < N; i++) cin >> vec[i];
  sort(vec.begin(), vec.end());
  cout << vec[N-1] - vec[0] <<endl;
}

Measured memory_bytes: 3660
N=int(input())
C=list(map(int,input().split()))
D=sorted(C,reverse=True)
A=[]
B=[]
for (i,d) in enumerate(D):
    if i%2==0:
        A.append(d)
    else:
        B.append(d)
print(abs(sum(A)-sum(B)))
        
    

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>
#include <climits>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<PII> VPI;
typedef vector<PLL> VPL;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pf push_front
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ub upper_bound
#define lb lower_bound

int main(){
  int D;
  cin>>D;
  VL C(26);
  rep(i,26) cin>>C[i];
  VVL S(D,VL(26));
  rep(i,D) rep(j,26) cin>>S[i][j];
  VL T(D);
  rep(i,D){
    ll X=0;
    rep(j,26) if(S[i][X]<S[i][j]) X=j;
    T[i]=X+1;
  }
  ll ans=0;
  VL L(26);
  rep(i,D){
    ll tmp=0;
    L[T[i]-1]=i+1;
    rep(j,26) tmp+=C[j]*(i+1-L[j]);
    ans+=S[i][T[i]-1]-tmp;
  }
  
  vector< set<ll> > X(26);
  rep(i,D) X[T[i]-1].insert(i+1);
  rep(i,26) X[i].insert(0);
  rep(i,26) X[i].insert(D+1);
  int M=1000000;
  VI d(M),q(M);
  rep(i,M) d[i]=rand()%D+1;
  rep(i,M) q[i]=rand()%26+1;
  int cnt=0;
  VI A(0),B(0),E(0);
  ll ans2=ans;
  int num=10;
  rep(i,M){
    int prv=T[d[i]-1];
    int nxt=q[i];
    auto itr=ub(all(X[prv-1]),d[i]);
    ll tmp=*itr;
    itr--;
    itr--;
    T[d[i]-1]=q[i];
    auto itr2=ub(all(X[nxt-1]),d[i]);
    ll tmp2=*itr2;
    itr2--;
    ans=ans-S[d[i]-1][prv-1]-C[prv-1]*(d[i]-*itr)*(tmp-d[i]);
    X[prv-1].erase(d[i]);
    ans=ans+S[d[i]-1][nxt-1]+C[nxt-1]*(d[i]-*itr2)*(tmp2-d[i]);
    X[nxt-1].insert(d[i]);
    if(ans>ans2){
      ans2=ans;
      cnt=0;
      A.clear();
      B.clear();
      E.clear();
    }else if(cnt<num){
      cnt++;
      A.pb(prv);
      B.pb(nxt);
      E.pb(d[i]);
    }else{
      ans=ans2;
      rep(j,num){
        T[E[num-1-j]-1]=A[num-1-j];
        X[B[num-1-j]-1].erase(E[num-1-j]);
        X[A[num-1-j]-1].insert(E[num-1-j]);
      }
      cnt=0;
      A.clear();
      B.clear();
      E.clear();
    }
  }
  rep(i,D) cout<<T[i]<<endl;
}


Measured memory_bytes: 11176
#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do{cout << "\033[32;1m" << #x << "->" ; err(x);} while(0)
void err(){cout << "\033[39;0m" << endl;}
template<template<typename...> class T,typename t,typename... A>
void err(T<t> a,A... x){for (auto v:a) cout << v << ' '; err(x...);}
template<typename T,typename... A>
void err(T a,A... x){cout << a << ' '; err(x...);}
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
        print(v[i],i==(int)(v.size())-1?suc:2);
}
const int INF=0x3f3f3f3f;
const int mod=1e9+7;
const int maxn=1e5+7;
ll fac[maxn];
ll quick(ll a,ll b)
{
    ll ret=1;
    while(b)
    {
        if(b&1) ret=ret*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return ret;
}

ll inv(ll a){return quick(a,mod-2);}
void db()
{
    fac[0]=1;
    for(int i=1;i<maxn;i++) fac[i]=fac[i-1]*i%mod;
}
int main()
{
    db();
    int n;
    cin>>n;
    vi x(n);
    for(int i=0;i<n;i++) cin>>x[i];
    vi d(n);
    for(int i=1;i<n;i++) d[i]=x[i]-x[i-1];
    ll ans=0;
    ll pre=0;
    for(int i=1;i<n;i++)
    {
        pre=(pre+fac[n-1]*inv(i))%mod;
        ans=(ans+pre*d[i]%mod)%mod;
        /*for(int k=1;k<=i;k++)
        {
            ans=(ans+fac[n-1]*inv(k)%mod*d[i]%mod)%mod;
        }*/
    }
    cout<<ans<<'\n';
}

Measured memory_bytes: 1792
import math
a,b,h,m=input().split()
a=float(a)
b=float(b)
h=float(h)
m=float(m)
pi=math.pi
rad=2*pi*(h/12+m/60/12-m/60)
s1=2*pi*(h/12+m/60/12)
s2=2*pi*m/60
x1=math.cos(s1)*a
y1=math.sin(s1)*a
x2=math.cos(s2)*b
y2=math.sin(s2)*b
ans=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)
print(math.sqrt(ans))


Measured memory_bytes: 9440
N = int(input())
A = list(map(int,input().split()))
A.sort()

cnt = 1
kisu = 0
gusu = 0
cntsub = 1
for i in range(1,N):
    if A[i] == A[i-1]:
        cntsub += 1
        if i == N-1:
            if cntsub % 2 == 0:
                gusu += 1
            else:
                kisu += 1
    else:
        cnt += 1
        if cntsub%2 == 0:
            gusu +=1
        else:
            kisu +=1
        if i == N-1:
            kisu +=1
        cntsub = 1

if gusu%2 == 1:
    cnt = cnt - 1

print(cnt)

Measured memory_bytes: 14396
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;

int main(){
    while(true){
	int l,m;
	m=0;
	string ans = "NA";
	cin >> l;
	if(l==0) break;
	vector<int> d(12);
	REP(i,12) {
	    int a,b;
	    cin >> a >> b;
	    d[i] = a-b;
	}
	REP(i,12){
	    m += d[i];
	    if(m >= l){
		ans = to_string(i+1);
		break;
	    }
	}
	cout << ans << endl;
    }
    return 0;
}

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

int main() {
  int N, K;
  cin >> N >> K;
  int sum = 0;
  
  for(int i = 0; i < N; i++) {
    int x;
    cin >> x;
    
    if(x < (K - x)) {
      sum += 2 * x;
    }
    else {
      sum += 2 * (K - x);
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mae(v) max_element(v.begin(),v.end())
#define mie(v) min_element(v.begin(),v.end())
#define INF 0x7FFFFFFF
#define mod 1000000007
#define fir first
#define sec second
typedef long long ll;
////////////////////////////////////////////////////////////

int main(){
	int n,m,X,Y;
	cin >> n >> m >> X >> Y;
	int x[100] , y[100];
	
	rep(i,0,n) cin >> x[i];
	rep(i,0,m) cin >> y[i];

	bool f = 0 , f2 = 0;
	for( int z = X + 1 ; z <= Y ; z++ ){
		f = 0;
		rep(i,0,n)
			if( z <= x[i] ){ f = 1 ; break; }
		rep(i,0,m)
			if( z > y[i] ){ f = 1 ; break; }
		
		if( !f ){ f2 = 1 ; break; }
	}

	if( !f2 ) cout << "War" << endl;
	else cout << "No War" << endl;
	ret 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define BOOST        std::ios::sync_with_stdio(false);  cin.tie(NULL); cout.tie(NULL);
#define sp           <<" "<<
#define ll           long long
#define ld           long double
#define P(x,y)       pair < x,y >
#define V(x)         vector < x >
#define fi           first
#define se           second
#define pb           push_back
#define mp           make_pair
#define PI           3.14159265358979323846264338327950288419716939937510
 
const ll mod=1e9+7,N=1e6+5;

int n,a[N][3],ans[N][3]; 

// int solve(int i,int j)
// {
//     if(i>=n)    return 0;
    
//     if(ans[i][j]!=-1)   return ans[i][j];
    
//     return ans[i][j] = a[i][j] + max( solve(i+1,(j+1)%3), solve(i+1,(j+2)%3));
// }

int main() 
{ 
    BOOST
    
    cin>>n;
    
    memset(ans,-1,sizeof(ans));
    
    for(int i=0;i<n;i++)    cin>>a[i][0]>>a[i][1]>>a[i][2];
    
    for (int k = 0; k < 3; k++)
        ans[n][k] = 0;

    for (int i = n - 1; i >= 0; i--)
    {
        for (int j = 0; j < 3; j++)
        {
            ans[i][j] = a[i][j] + max(ans[i + 1][(j + 1) % 3], ans[i + 1][(j + 2) % 3]);
        }
    }

    // cout<<max( max(solve(0,0),solve(0,1)), solve(0,2) );
    cout<<max( max(ans[0][0],ans[0][1]), ans[0][2] );
    return 0; 
} 

Measured memory_bytes: 14592
#119-D
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()
import bisect
a,b,q=IL()
s=[]
t=[]
for i in range(a):
    tmp=I()
    s.append(tmp)
for i in range(b):
    tmp=I()
    t.append(tmp)
inf=10**15
for i in range(q):
    rs,ls,rt,lt=inf,inf,inf,inf
    x=I()
    ts=bisect.bisect(s,x)
    tt=bisect.bisect(t,x)
    if ts!=0:
        ls=abs(x-s[ts-1])
    if tt!=0:
        lt=abs(x-t[tt-1])
    if ts!=a:
        rs=abs(s[ts]-x)
    if tt!=b:
        rt=abs(t[tt]-x)
    print(min(min(rs,lt)*2+max(rs,lt),min(rt,ls)*2+max(rt,ls),max(lt,ls),max(rt,rs)))

Measured memory_bytes: 12092
animal_cnt, animal_leg_cnt = gets.split.map(&:to_i)
turtle_leg = 2
crane_leg = 4
result = "No"
(0..animal_cnt).each do |turtle_cnt|
  leg_cnt = (turtle_cnt * turtle_leg) + ((animal_cnt - turtle_cnt) * crane_leg)
  if leg_cnt == animal_leg_cnt
    result = "Yes"
    break
  end
end
puts result

Measured memory_bytes: 14308
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N,M;
    int D,P;
    while(1){
        cin>>N>>M;
        if(N==0 && M==0) break;
        
        int p[11]={};
        
        for(int i=0;i<N;i++){
            cin>>D>>P;
            p[P]+=D;
        }
        
        for(int i=10;i>0;i--){
            if(M>=p[i]){
                M-=p[i];
                p[i]=0;
            }
            else{
                p[i]-=M;
                M=0;
            }
            if(M==0) break;
        }
        
        int ans=0;
        for(int i=0;i<11;i++){
            ans+=i*p[i];
        }
        
        cout<<ans<<endl;
    }
    
    return 0;
    
    
    
    
}



Measured memory_bytes: 3044
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        String result = "Odd";

        if((a * b) % 2 == 0){
            result = "Even";
        }

        System.out.println(result);
    }
}

Measured memory_bytes: 21716
n, m, l = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
b = [list(map(int, input().split())) for i in range(m)]

c = [[0] * l for i in range(n)]
for i in range(n):
    for j in range(l):
        for k in range(m):
            c[i][j] += a[i][k] * b[k][j]
    print(*c[i])


Measured memory_bytes: 7028
# B - 105

N = int(input())

def makeDivisors(n):
    divisors = []
    for i in range(1, int(pow(n,0.5)+1)):
        if n%i==0:
            divisors.append(i)
            if i!=n//1: 
                divisors.append(n//i)
    divisors.sort()
    return divisors

ans = 0
for i in range(1,N+1,2):
    if len(makeDivisors(i))==8:
        ans += 1
        
print(ans)

Measured memory_bytes: 3188
N = int(input())
B = list(map(int, input().split()))

seq = []
while B:
	for n in range(len(B) - 1, -1, -1):
		if (n + 1) == B[n]:
			seq += [B.pop(n)]
			break
	else:
		print(-1)
		break
else:
	for t in seq[::-1]:
		print(t)


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

int main() {
    int n;
    cin >> n;
    int l[1000], r[1000];
    rep(i, n) cin >> l[i] >> r[i];
    ll ans = 0;
    
    rep(i, n) {
        ans += (r[i] - l[i] + 1);
    }
    
    cout << ans << endl;
    return 0;
}

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

int main(){
    int A,B,C,K;
    cin >> A >> B >> C >> K;
    while(A >= B){
        B *= 2;
        K--;
    }
    while(B >= C){
        C*= 2;
        K--;
    }
    if(K < 0) cout << "No" << endl;
    else cout << "Yes" << endl;
}

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

int main()
{
	vector<int> v(3);
	
	for(int i=0; i<3; i++)
	{
		cin>>v[i];
	}
	sort(v.begin(), v.end());
	
	int ans = v[0]*v[1]/2;
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

int main(int argc, const char *argv[])
{
  int n;
  cin >> n;
  vector<int> a;
  set<int> distinct;
  for (int i = 0; i < n; i++) {
    int n;
    cin >> n;
    a.push_back(n);
    distinct.insert(n);
  }

  cout << (a.size() != distinct.size() ? "NO" : "YES") << "\n";
  return 0;
}

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

struct UnionFind{
  vector<int> data;
  int __size;
  UnionFind(int sz) {
  data.assign(sz, -1);
  __size = sz;
  }
 
  bool unite(int x, int y) {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y);//親は負でサイズを保存
    __size--;
    data[x] += data[y];
    data[y] = x;
    return (true);
  }
 
  int find(int k) {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }

  bool same(int x, int y){
    return find(x) == find(y);
  }
 
  int size(int k) {
    return (-data[find(k)]);
  }

  int union_count() {
    return (__size);
  }
};

int main(){
  int n, m;
  cin >> n >> m;
  UnionFind uf(n);
  vector<vector<int>> lang(m);
  rep(i,n) {
    int k;
    cin >> k;
    rep(j,k) {
      int id;
      cin >> id;
      id--;
      lang[id].emplace_back(i);
    }
  }
  
  for (int i = 0; i < m; i++) {
    int p = -1;
    for (auto e : lang[i]) {
      if (p != -1) uf.unite(p, e);
      p = e;
    }
  }
  if (uf.union_count() == 1) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
} 

Measured memory_bytes: 4608
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) (((x) < 0)?-(x):(x))
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

using cat = long long;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

vector<int> mult(vector<int> a, vector<int> b) {
	// permutation a * b
	int N = a.size();
	vector<int> ret(N);
	for(int i = 0; i < N; i++) ret[i] = a[b[i]];
	return ret;
}

vector<int> inv(vector<int> a) {
	// permutation a^-1
	int N = a.size();
	vector<int> ret(N);
	for(int i = 0; i < N; i++) ret[a[i]] = i;
	return ret;
}

vector<int> pw(vector<int> & a, int e) {
	int N = a.size();
	if(e <= 0) {
		vector<int> id(N);
		for(int i = 0; i < N; i++) id[i] = i;
		return id;
	}
	vector<int> x = pw(a, e/2);
	x = mult(x, x);
	if(e&1) x = mult(x, a);
	return x;
}

vector<int> lift(vector<int> p, vector<int> q, int K) {
	if(K == 0) return mult(inv(q), p);
	vector<int> b = mult(q, mult(inv(p), mult(inv(q), p)));
	vector<int> b_pw = pw(b, K);
	return mult(b_pw, mult(lift(p, q, 0), inv(b_pw)));
}

void print(vector<int> p) {
	int N = p.size();
	for(int i = 0; i < N; i++) cout << p[i]+1 << ((i+1 == N) ? "\n" : " ");
}

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int N, K;
	cin >> N >> K;
	vector< vector<int> > P(6, vector<int>(N));
	for(int i = 0; i < N; i++) {
		cin >> P[1][i];
		P[1][i]--;
	}
	for(int i = 0; i < N; i++) {
		cin >> P[2][i];
		P[2][i]--;
	}
	P[0] = mult(inv(P[2]), P[1]);
	for(int i = 3; i < 6; i++) P[i] = mult(P[i-1], inv(P[i-2]));
	vector<int> b = mult(P[2], mult(inv(P[1]), mult(inv(P[2]), P[1])));
	vector<int> b_pw = pw(b, K/6);
	print(mult(b_pw, mult(P[K%6], inv(b_pw))));
	return 0;
}

// look at my code
// my code is amazing


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

int main(){
    ll N;
    cin >> N;
    string ans = "";
    char letter;

    while(N != 0){
        if (N % 26 != 0){
            letter = 'a' + N % 26 - 1;
        }else{
            letter = 'z';
            N -= 1;
        }
        ans = letter + ans;
        N /= 26;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <algorithm>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include <iomanip>
using namespace std;

;;

int main(){
  ;;
    char n[2];
    for(int i = 0; i < 2; ++i) {cin >> n[i];};
    ;
    if(n[0]=='9'||n[1]=='9') {;cout << "Yes" << endl;;}
    else {;cout << "No" << endl;;};
}

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

int main() {
    int s, w;
    cin >> s >> w;
    cout << (w >= s? "unsafe": "safe") << endl;

}

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

using namespace std;

#define vit vector<int>::iterator
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define fr first
#define sc second
#define skip continue
#define PI 3.14159265

typedef unsigned long long ull;
typedef long long ll;
typedef unsigned int ui;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<bool> vb;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const ll MAXN = 3e5 + 3;
const int  M   =   1e9+7;

void faster(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

bool cmp(const string& a, const string& b) {
    return (a + b) < (b + a);
}

void solve(){

    ll n, m, i, j, k, x;

    cin >> n;
    map<ll, ll> a;
    for(k = 2; k <= n; ++k)
    {
        ll cnt = 0;
        ll num = k;
        while(num % 2 == 0) {
            ++cnt;
            num /= 2;
        }
        if(cnt) a[2] += cnt;
        for(i = 3; sqrt(i) <= num; i += 2) {
            if(num % i == 0) {
                cnt = 0;
                while(num % i == 0) {
                    ++cnt;
                    num /= i;
                }
                a[i] += cnt;
            }
        }
        if(num > 1) a[num]++;
    }

    ll tot = 1;
    for(auto t : a)
    {
        tot *= (t.second + 1);
        tot %= M;
    }
    cout << tot << endl;
}


int main(){
    //freopen("slalom.in","r",stdin);
    //freopen("slalom.out","w",stdout);
    //faster();
    int n = 1;
    //cin >> n;
    while(n--){
        solve();
        cout << endl;
    }
    //fclose(stdout);
}


Measured memory_bytes: 3632
while True:
    line = raw_input()
    if line == '0': break
    a = 0
    b = 0
    for re in line[1:]:
        if re == 'A':
            a += 1
        else:
            b += 1
    else:
        if b < a:
            a += 1
        else:
            b += 1
        print a, b

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

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

class UnionFind {
public:
    vector<int> parent;

    // 親の番号 親だったら-(集団サイズ)
    // 親じゃなければ親の番号(正の数)
    UnionFind(int N) {
        parent = vector<int>(N, -1);
    }

    // return parent[A] = root(parent[A])とすることで
    // Aを親のすぐ下につなぐ事になり親を取るときに高速になる
    // しないと親まで辿るときに集団サイズ分コストがかかる
    int root(int A) {
        if (parent[A] < 0) {
            return A;
        }
        return parent[A] = root(parent[A]);
    }

    int size(int A) {
        return -parent[root(A)];
    }

    // AとBをつなげる
    bool connect(int A, int B) {
        A = root(A);
        B = root(B);

        if (A == B) {
            return false;
        }

        if (size(A) > size(B)) {
            swap(A, B);
        }
        parent[B] += parent[A];
        parent[A] = B;

        return true;
    }
};


int main() {
    int n, m;
    cin >> n >> m;
    vector<int> a(m), b(m);
    UnionFind uni(n);
    queue<int> q;
    rep(i, m) {
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
        uni.connect(a[i], b[i]);
    }

    rep(i, n) {
        if (uni.parent[i] < 0) q.push(i);
    }

    uint64_t ans = 0;
    while (q.size() != 1) {
        ans++;
        int p1 = q.front();
        q.pop();
        int p2 = q.front();
        q.pop();
        uni.connect(p1, p2);

        if (uni.parent[p1] < 0) q.push(p1);
        else q.push(p2);
    }

    cout << ans << endl;


    return 0;
}


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

using namespace std;

long long fun (long long a,long long b)
{
    if(a%b==0) return 2*a-b;
    long long c=(long long)a/(long)b;
    return 2*c*b+fun(b,a%b);
};
int main()
{
    long long a,b;
    cin>>a>>b;
    cout<<a+fun(max(a-b,b),min(a-b,b))<<endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))
answer = 0#これなに
m = 0#カウントするやつやね
for i in range(n-1):
    if h[i] >= h[i+1]:
        m += 1
    else:
        answer = max(answer,m)
        m = 0
answer = max(answer,m)
print(answer)


Measured memory_bytes: 14252
#include<bits/stdc++.h>
using namespace std;
int main() {
  int k,i;
  string s;
  cin>>k>>s;
  if((int)s.length()<=k) cout<<s<<endl;
  else{
    for(i=0;i<k;i++) cout<<s.at(i);
    cout<<"..."<<endl;
  }
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(auto i = (a); i < (b); i++)
#define iter(it,c) for(auto it = (c).begin(); it != (c).end(); ++it)
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
const ll INF = ~(1<<31);
#define fs first
#define sc second
#define pb push_back

const double EPS = 1e-9;
const double pi = acos(-1);
typedef unsigned long long ull;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
template <class T> T smod(T a, T b) {
    return (a % b + b) % b;
}

vi E[100'050];
ll n;

ll memo[100'050][4];
ll md = 1000000000+7;

ll dp(ll at, ll color, ll parent) {
    if(memo[at][color] != -1) return memo[at][color];
    ll children = 0;
    iter(it,E[at]) {
        if(*it == parent) continue;
        children++;
    }
    if(children == 0) {
        if(color == 1) return 1;
        else return 2;
    } else {
        ll tots = 1;
        ll tots_2 = 1;
        iter(it,E[at]) {
            if(*it == parent) continue;
            tots *= dp(*it, 1, at);
            tots_2 *= dp(*it, 0, at);
            tots %= md;
            tots_2 %= md;
        }
        if(color == 1) return memo[at][color] = tots_2;
        else {
            return memo[at][color] = (tots + tots_2) % md;
        }
    }
}

int main() {
    cin.sync_with_stdio(false);
    cin >> n;
    rep(i,0,n-1) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        E[a].pb(b);
        E[b].pb(a);
    }
    memset(memo,-1,sizeof(memo));
    cout << dp(0,2,-1) << endl;
    return 0;
}


Measured memory_bytes: 15872
n,k = map(int,input().split())
l = [0]*(10**5+1)
for i in range(n):
    ai,bi = map(int,input().split())
    l[ai]+=bi
for index,i in enumerate(l):
    if i:
        k-=i
        if k<=0:
            break
print(index)

Measured memory_bytes: 11688
#include "bits/stdc++.h"
using namespace std;

int main(int argc, char const *argv[]) {
  int N,A;
  std::cin >> N>>A;
  if (N%500<=A) {
    std::cout << "Yes" << '\n';/* code */
  }
  else {
    std::cout << "No" << '\n';
  }
  return 0;
}


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


int main(int argc, const char * argv[]) {

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <fstream>
using namespace std;
typedef long long lint;
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(lint (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
const lint MOD =1000000007;
const lint MAX = 1000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
typedef map<lint,lint> M;
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    } 

  int main(){
      string s,t;
      cin>>s>>t;
      set<lint> st[26];
      rep(i,s.size()){
          lint a=s[i]-'a';
          st[a].insert(i);
      }
      rep(i,26){
          st[i].insert(-1);
          st[i].insert(INF);
      }
      lint now=-1;
      lint count=0;
      rep(i,t.size()){
          lint a=t[i]-'a';
          if(st[a].size()==2){
              cout<<-1<<endl;
              return 0;
          }
          auto it =st[a].upper_bound(now);
          lint g=*it;
          if(g==INF){
              count++;
              it=st[a].upper_bound(-1);
              g=*it;
              now=g;
          }else{
              now=g;
          }
      }
      cout<<count*s.size()+now+1<<endl;
  }

Measured memory_bytes: 8528
#include<iostream>
#include<algorithm>
 
using namespace std;
 
int main(){
  int h,w;
  cin>>h>>w;
  char g[51][51];
  for(int y=0;y<h;y++){
    cin>>g[y];
  }
  int cc[51][51];
  fill(cc[0],cc[51],1<<30);
  cc[0][0]=0;
  for(int y=0;y<h;y++){
    for(int x=0;x<w;x++){
      cc[y+1][x]=min(cc[y+1][x],cc[y][x]+g[y+1][x]-'0');
      cc[y][x+1]=min(cc[y][x+1],cc[y][x]+g[y][x+1]-'0');
    }
  }
  cout<<cc[h-1][w-1]<<endl;
  return 0;
}

Measured memory_bytes: 1176
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int f(int n) {
	int r =0;
	while (n) {
		r += n % 10;
		n /= 10;
	}return r;
}
int main() {
	int a; cin >> a;
	int ans = 114514;
	for (int i = 1; i < a; i++) {
		ans = min(ans, f(i) + f(a - i));
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <cstdlib>
#include <unordered_map>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define seg_size 524288
long long calc(long long a, long long b) {
	if (a % b == 0) return a / b;
	long long hoge = a / b;
	long long geko = max(1LL, (a - hoge * b) / (hoge+1));
	return calc(a - (a / b + 1) * geko, b);
} 
int main() {
	int n;
	cin >> n;
	long long hoge = 0;
	REP(i, n) {
		int a, b;
		cin >> a >> b;
		hoge ^= calc(a, b);
	}
	if (hoge != 0) {
		cout << "Takahashi" << endl;
	}
	else {
		cout << "Aoki" << endl;
	}
	return 0;
}

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

char inverse(char alpha, char beta, char c) {
	char gamma;
	int flag = 1;
	int i;

	c -= 'a';
	/* (alpha * gamma + beta) % 26 == c */
	for(gamma = 0; gamma < 26 ; gamma++){
		if((alpha * gamma + beta ) % 26  == c){
			return gamma+'a';
		}
	}
	return 'A';
}

int search(char str[], char str2[]) {
	int i, j;

//	printf("call\n");
	/* str */
	for(i = 0; str[i]; i++) {
//		printf("%c ", str[i]);
		/* str2 */
		for(j = 0; str2[j]; j++) {
			if(str[i + j] != str2[j])
				break;
		}

		if(!str2[j]) {
			return 1;
		}
	}

	return 0;
}

int main() {
/*	
	char test[26]="abcdefghijklmnopqrstuvwxyz";
	int i,j,k;
	for(j=1;j<60;j+=2){
		if(j%2!=0&&j%13!=0){
			for(i=0;i<26;i++){
				printf("%c",inverse(j,0,test[i]));
			}printf("\n");
		}
	}
*/
	int alpha, beta;
	char input[512];
	char temp[512];
	int i, j;
	int n;

	scanf("%d", &n);
	while(getchar() != '\n');

	for(j = 0; j < n; j++) {
		fgets(input, 512, stdin);
//		printf("%s", input);

		i = 0;
		while(input[i] != '\n') i++; input[i] = '\0';

		for(alpha = 1; alpha < 26; alpha++) {
			if(alpha % 2 != 0 && alpha % 13 != 0){
				for(beta = 0; beta < 26; beta++) {
					for(i = 0; input[i]; i++) {
						if(input[i] != ' ')
							temp[i] = inverse(alpha, beta, input[i]);
						else
							temp[i] = ' ';
					}

					temp[i] = '\0';
					if(search(temp, "this") || search(temp, "that") ) {
						printf("%s\n", temp);
						goto RABEL;
					}
				}
			}
		}
RABEL:;
	}
	
	/*
	if(search("is this","that")){
		printf("correct\n");
	}
	*/
	return 0;
}

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

int main() {
  int N; cin >> N;
  int A;
  bool ans{true};
  for (int i{}; i < N; ++i) {
    cin >> A;
    if (A % 2 == 0) {
      if (!(A % 3 == 0 || A % 5 == 0)) {
        ans = false;
        break;
      }
    }
  }

  cout << (ans ? "APPROVED" : "DENIED") << endl;
  return 0;
}


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

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        long m1 = sc.NextLong();
        long d1 = sc.NextLong();
        long m2 = sc.NextLong();
        long d2 = sc.NextLong();

        bool ok = m1 != m2;

        string answer = ok ? "1" : "0";

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 27492
from collections import Counter
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')
n = I()
d = {'AC': 0, 'WA': 0, 'TLE': 0, 'RE': 0}
for _ in range(n):
    s = S()
    d[s] += 1
for k, v in d.items():
    print(f'{k} x {v}')


Measured memory_bytes: 9488
n,m = map(int,input().split())
a = {int(input()) for _ in range(m)}
mod = 10**9 + 7

dp = [0]*(n+1)
dp[0] = 1
    
for i in range(1,n+1):
    if i in a:
        continue
    x = dp[i-1] 
    if i > 1:
        x += dp[i-2]
    dp[i] = x
ans = dp[n] % mod
print(ans)

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

int main (){
    string s;
    int a=0;
    cin >> s;
    for (int i=0;i<s.size();i++){
        if(s.at(i)=='+'){
            a++;
        }
        if(s.at(i)=='-'){
            a--;
        }
    }
    cout << a << endl;
}

Measured memory_bytes: 256
def binsearch(l, r, fn):
    while r - l > 1:
        m = (l + r) // 2
        if fn(m):
            l = m
        else:
            r = m
    return l

def main():
    N, Q = map(int, input().split())
    s = input()
    TD = [input().split() for _ in range(Q)]
    def die(n):
        if n < 0:
            return -1
        if n >= N:
            return 1
        for t, d in TD:
            if s[n] != t:
                continue
            if d == 'L':
                n -= 1
                if n < 0:
                    return -1
            else:
                n += 1
                if n >= N:
                    return 1
        return 0
    L = binsearch(-1, N, lambda x: die(x) == -1)
    R = binsearch(-1, N, lambda x: die(x) != 1)
    return R - L

print(main())


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

int main(){
  int h,a;
  cin >> h >> a;
  if(h%a==0)cout << h/a << endl;
  else cout << h/a+1 << endl;
}


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

using namespace std;
#define MAXN 5000
#define MOD 1000000007
#define Trav(p) for(rint u = first[p], v; ~u; u = e[u].nex)
#define rint register int
#define gc() getchar()
inline int read(rint ans = 0, rint sgn = ' ', rint ch = gc())
{
	for(; ch < '0' || ch > '9'; sgn = ch, ch = gc());
	for(; ch >='0' && ch <='9';(ans*=10)+=ch-'0', ch = gc());
	return sgn-'-'?ans:-ans;
}
#define BUF_SIZE 1000000
#define _END fwrite(_Ob,1,_O-_Ob,stdout), _O = _Ob
#define Outc(a) (*_O++ = a)
char _Ob[BUF_SIZE+5], *_O = _Ob, _Os[25], *_Ot;
template <typename T> inline void Out(T x)
{
	if(!x){Outc('0'); return;} if(x < 0) Outc('-'), x = -x;
	for(_Ot = _Os; x; *_Ot++ = x%10+'0', x /= 10);
	for(; _Ot != _Os; Outc(*--_Ot)); if(_O-_Ob >= BUF_SIZE-50) _END;
}
int first[MAXN+5], sz[MAXN+5], mx[MAXN+5], A[MAXN+5], f[MAXN+5], fac[MAXN+5], efac[MAXN+5], sum, rt, num, tot, n, d, ans;
struct Edge{int to,nex; Edge(){} Edge(int _to, int _nex){to=_to,nex=_nex;}}e[(MAXN<<1)+5];
inline void Add(int a, int b){e[tot] = Edge(b,first[a]), first[a] = tot++, e[tot] = Edge(a,first[b]), first[b] = tot++;}
inline int fastpow(int s, int n){int a = 1; for(; n; n&1 ? a = 1ll*a*s%MOD : 0, s = 1ll*s*s%MOD, n >>= 1); return a;}
void DFS_sz(int p, int fa){sz[p] = 1, mx[p] = 0; Trav(p) if((v=e[u].to)-fa) DFS_sz(v,p), sz[p] += sz[v], mx[p] = max(mx[p],sz[v]);}
void DFS_rt(int p, int fa){(mx[p]=max(mx[p],sum-sz[p]))<mx[rt]?rt=p,num=1:num+=mx[p]==mx[rt]; Trav(p) if((v=e[u].to)-fa) DFS_rt(v,p);}
inline int C(int n, int k){return 1ll*fac[n]*efac[k]%MOD*efac[n-k]%MOD;} inline int sqr(int x){return 1ll*x*x%MOD;}
int main()
{
	n = read(), memset(first+1,-1,n<<2); for(rint i = 2; i <= n; Add(read(),read()), i++); DFS_sz(1,0), sum = sz[rt=1], DFS_rt(1,0);
	fac[0] = 1; for(rint i = 1; i <= n; fac[i] = 1ll*i*fac[i-1]%MOD, i++);
	if(num>1){printf("%lld\n",1ll*fac[n>>1]*fac[n>>1]%MOD); return 0;}
	efac[n] = fastpow(fac[n],MOD-2); for(rint i = n; i; efac[i-1] = 1ll*i*efac[i]%MOD, i--); sum = 0, f[0] = 1;
	Trav(rt) DFS_sz(v=e[u].to,rt), A[++d] = sz[v]; sort(A+1,A+d+1);
	for(rint i = 1, j, k; i <= d; i++)
		for(sum += A[i], j = sum; j; j--)
			for(k = 1; k <= j && k <= A[i]; k++)
				f[j] = (f[j]+1ll*f[j-k]*sqr(C(A[i],k))%MOD*fac[k])%MOD;
	for(rint k = 0; k <= sum; ans = (ans+(k&1?MOD-1ll:1ll)*fac[n-k]%MOD*f[k])%MOD, k++); printf("%d\n",ans); return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define INIT    \
    cin.tie(0); \
    ios::sync_with_stdio(false);

template <class T>
inline bool chmax(T& a, T b) {
    return a = (a < b) ? b : a;
}
template <class T>
inline bool chmin(T& a, T b) {
    return a = (a > b) ? b : a;
}

ll const INF = 1LL << 60;
ll const MOD = 1000000007;

int main() {
    INIT;

    ll N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];

    sort(ALL(A));
    // repv(A) cout << *it << " ";
    // cout << endl;

    vector<ll> sum(N, 0);
    sum[0] = A[0];
    reps(i, 1, N) { sum[i] = sum[i - 1] + A[i]; }
    // repv(sum) cout << *it << " ";
    // cout << endl;

    ll ans = 1;
    repr(i, N - 2) {
        // cout << sum[i] * 2 << ", " << A[i + 1] << endl;
        if (sum[i] * 2 >= A[i + 1]) {
            ans++;
        } else {
            break;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4736
#include <stdio.h>

int main()
{
    int n;
    int team[128] = {0};
    int lank[128];
    int i, j;

    scanf("%d", &n);
    for (i = 0; i < n * (n - 1) / 2; i++){
        int a, b, c, d;

        scanf("%d %d %d %d", &a, &b, &c, &d);
        a--, b--;
        if (c > d) team[a] += 3;
        else if (c < d) team[b] += 3;
        else team[a]++, team[b]++;
    }

    i = 0;
    while (i < n){
        int maxi = 0;
        int cnt = 0;

        for (j = 0; j < n; j++){
            if (maxi < team[j]) maxi = team[j];
        }
        for (j = 0; j < n; j++){
            if (team[j] == maxi){
                team[j] = 0;
                lank[j] = i + 1;
                cnt++;
            }
        }
        i += cnt;
    }

    for (i = 0; i < n; i++) printf("%d\n", lank[i]);

    return 0;
}

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

int main() {
    string a;
    cin >> a;
int counter = 700;
    if (a[0] == 'o') counter += 100;
    if (a[1] == 'o') counter += 100;
    if (a[2] == 'o') counter += 100;
    cout << counter << endl;
}

Measured memory_bytes: 256
a,b,n=map(int,input().split())

from math import floor
ans=0

if b>n:
    x=n
    print(floor(a*x/b)-a*floor(x/b))
    exit()
cnt=0    
for x in range(b-1,n+1,b):
    tmp=floor(a*x/b)-a*floor(x/b)
    ans=max(ans,tmp)
    cnt+=1
    if cnt>10**7:
        break
print(ans)



Measured memory_bytes: 63896
#include <iostream>
using namespace std;
int main (){
  int  d[10][7] ={{0,1,1,1,1,1,1},
		  {0,0,0,0,1,1,0},
		  {1,0,1,1,0,1,1},
		  {1,0,0,1,1,1,1},
		  {1,1,0,0,1,1,0},
		  {1,1,0,1,1,0,1},
		  {1,1,1,1,1,0,1},
		  {0,1,0,0,1,1,1},
		  {1,1,1,1,1,1,1},
		  {1,1,0,1,1,1,1}};

  int n;
  while(cin>>n && n!=-1){
    int  s[7] = {0,0,0,0,0,0,0};
    for(int i=0;i<n;i++){
      int a;
      cin >>a;
      for(int j=0;j<7;j++){
	if(s[j]!=d[a][j]){
	  cout<<1;
	  s[j]=d[a][j];
	}
	else cout <<0;
      }
      cout <<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1160
// #define STOPIT
#include <bits/stdc++.h>
#define loop(n) for (lint ngtkana_is_a_genius = 0; ngtkana_is_a_genius < lint(n); ngtkana_is_a_genius++)
#define rep(i, begin, end) for (lint i = lint(begin); (i) < lint(end); i++)
#define all(v) v.begin(), v.end()
#define rand(l, r) std::uniform_int_distribution<>(l, r)(mt)
using lint = long long;
auto mt = std::mt19937_64(std::random_device{}());
auto cmn = [](auto&& a, auto b){ if (a > b) {a = b; return true;} return false; };
auto cmx = [](auto&& a, auto b){ if (a < b) {a = b; return true;} return false; };
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { std::cerr << " " << head; debug_impl(tail...); }
#ifndef STOPIT
#define debug(...)\
  do {\
    std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
    debug_impl(__VA_ARGS__);\
    std::cerr << std::noboolalpha;\
  } while (false)
#else
#define debug(...) {}
#endif

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr>
std::istream& operator>> (std::istream& is, Container& v)
  { for (auto & x : v) { is >> x; } return is; }

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr >
std::ostream& operator<< (std::ostream& os, Container const& v) {
 os << "{";
  for (auto it = v.begin(); it != v.end(); it++)
    {os << (it != v.begin() ? "," : "") << *it;}
  return os << "}";
}

int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  int n, T; std::cin >> n >> T;
  std::vector<int> mul(T+2);
  loop(n) {
    int l, r; std::cin >> l >> r;
    mul.at(l)++;
    mul.at(r)--;
  }
  std::partial_sum(all(mul),mul.begin());
  // debug(mul);
  int ans = *std::max_element(all(mul));
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 3480
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn main(){
    input!{
        n:i64,
        q:i64,
        s:chars,
        lrn:[(usize,usize);q]
    }
    let mut count = 0;
    let mut sum:Vec<i64> = vec![0];
    for j in 0..(n as usize-1) {
        if s[j] == 'A' && s[j+1] == 'C' {
            count += 1;
        }
        sum.push(count)
    }
    for &(start,end) in &lrn {
        println!("{}",sum[end-1]-sum[start-1]);
    }
}

Measured memory_bytes: 6908
// 0, 1, 2, 3, 5, 7, 8, 9を用いた8進表現に変換するだけ
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int ref[8] = {0, 1, 2, 3, 5, 7, 8, 9};
int n;

int main(){
    while(cin >> n, n){
        vector<int> decode;
        while(n != 0){
            decode.push_back(ref[n%8]);
            n /= 8;
        }

        reverse(decode.begin(), decode.end());
        for(int x : decode)     cout << x;
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3032
from sys import stdin
import sys
import math

A, B, C, D, E = [int(x) for x in stdin.readline().rstrip().split()]
# A, B = [int(x) for x in stdin.readline().rstrip().split()]
# U = input().split()
x=A*60+B
y=C*60+D
print(y-x-E)


Measured memory_bytes: 9160
import java.util.HashSet;
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        HashSet<String>hs = new HashSet<String>();
        for(int i=0;i<n;i++){
            String order = sc.next();
            if(order.equals("insert")){
                String str = sc.next();
                hs.add(str);
            }else{
                String str = sc.next();
                if(hs.contains(str)){
                    System.out.println("yes");
                }else{
                    System.out.println("no");
                }
            }
        }
        sc.close();
    }
}


Measured memory_bytes: 253144
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

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

    int cnt[3] = {0};
    rep(i,n){
        int a;
        cin >> a;

        int d = 0;
        while(a % 2 == 0){
            a /= 2;
            d++;
        }
        if(d >= 2) d = 2;
        cnt[d]++;
    }
    //rep(i,3){ show(cnt[i]) }


    bool f = true;
    if(cnt[1] == 1 && cnt[2] == 0) f = false;
    else if(cnt[1] >= 1 && cnt[0] >= 1 && cnt[2] == 0) f = false;
    else if(cnt[1] == 0 && cnt[0] > cnt[2] + 1) f = false;
    else if(cnt[1] >= 1 && cnt[0] > cnt[2]) f = false;

    auto YesOrNo = [](bool f) { cout << (f ? "Yes" : "No") << endl; };
    YesOrNo(f);
}


Measured memory_bytes: 256
a,b,loop_max=map(int,input().split())

if a > loop_max:
	a = a - loop_max
	loop_max = 0
else:
	loop_max = loop_max - a
	a = 0

if b > loop_max:
	b = b - loop_max
	loop_max = 0
else:
	loop_max = loop_max - b
	b = 0

print(a,b)

Measured memory_bytes: 3064
import sys
input = sys.stdin.readline

N, L = map(int, input().split())
m = [None] * N

for i in range(N):
    m[i] = L + i
    
a = 10 ** 18
index = 0
for i in range(N):
    t = abs(sum(m) - (sum(m) - m[i]))
    
    if a > t:
        a = t
        index = i
        
ans = 0
for i in range(N):
    if i != index:
        ans += m[i]
        
print(ans)

Measured memory_bytes: 3064