akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
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;
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
ll MOD = 1000000007;

int main() {
  int D, G;
  cin >> D >> G;
  vi p(D), c(D), all(D);
  rep(i, D) {
    cin >> p[i] >> c[i];
    all[i] = 100 * (i + 1) * p[i] + c[i];
  }

  ll ans = INT_MAX;
  for (int x = 0; x < (1 << 10); x++) {
    int total = 0;
    ll cnt = 0;
    for (int i = 0; i < D; i++) {
      if ((x >> i) & 1) {
        total += all[i];
        cnt += p[i];
      }
    }
    int i = D - 1;
    while (total < G && i >= 0) {
      if (((x >> i) & 1) == 0) {
        ll use = min(p[i] - 1, (int)ceil((float)(G - total) / (100 * (i + 1))));
        // cout << i << "," << use << endl;
        total += 100 * (i + 1) * use;
        cnt += use;
      }
      i--;
    }
    if (total >= G) {
      ans = min(ans, cnt);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ll t; t=1;
    while(t--)
    {
        string s; cin>>s;
        int cnt=0; 
        if(s=="SSS") cnt=0;
        if(s=="RSS" || s=="SRS" || s=="SSR" || s=="RSR") cnt=1;
        if(s=="RRS" || s=="SRR" ) cnt=2;
        if(s=="RRR") cnt=3;
        cout<<cnt<<"\n";
   }
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()%
#define int long long

signed main(){
    vector<int> num = {0,1,2};
    string s; cin >> s;
    if(all_of(ALL(num),[&](int i){return s[i]!=s[i+1];})){
        cout << "Good" << endl;
    }else{
        cout << "Bad" << endl;
    }
}

Measured memory_bytes: 256
while True:
    N,X = map(int,input().split())
    if N == 0 and X == 0:
        break
    ans = 0
    for i in range(1,N-1):
        for j in range(i+1,N):
            for k in range(j+1,N+1):
                if X == i + j + k:
                    ans += 1
    print(ans)


Measured memory_bytes: 5596
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define INF 1e9;
using namespace std;
typedef long long ll;
int main() {
  int N;
  cin >> N;
  int A[N];
  int cnt = 0;
  ll sum = 0;
  ll min = INF;
  REP(i, N) {
    cin >> A[i];
    int tmp = abs(A[i]);
    sum += tmp;
    if (tmp < min) {
      min = tmp;
    }
    if (A[i] < 0) {
      cnt++;
    }
  }
  if (cnt % 2 == 0) {
    cout << sum;
  } else {
    cout << sum - 2 * min;
  }
  return 0;
}

Measured memory_bytes: 640
from itertools import permutations
N,M=map(int,input().split())
l=[[] for _ in range(N)]
for _ in range(M):
  x,y=map(int,input().split())
  l[x-1].append(y-1)
  l[y-1].append(x-1)

res=0
for i in permutations(range(2,N+1)):
  s='1'
  for j in i:
    s+=str(j)
  ans=True
  for k in range(N-1):
    ss=int(s[k])-1
    st=int(s[k+1])-1
    if st not in l[ss]:
      ans=False
  if ans:
    res+=1
print(res)

Measured memory_bytes: 3064
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define Stdio
#ifdef Stdio
#define Open_file(F)
#ifdef ONLINE_JUDGE
char _B[1<<15],*_S=_B,*_T=_B,_U[1<<15|1],*_O=_U,*_W=_U+(1<<15);
bool END=0;
#define getc() (_S==_T&&(_T=(_S=_B)+fread(_B,1,1<<15,stdin),_S==_T)?END=1:*_S++)
#define putc(c) (_O==_W?fwrite(_U,1,1<<15,stdout),_O=_U,1:1,*_O++=c)
#define EXIT fwrite(_U,1,_O-_U,stdout);\
	return 0
#else
#define getc() getchar()
#define putc(x) putchar(x)
#define EXIT return 0
#endif
#else
#define Open_file(F) freopen(F".in","r",stdin);\
	freopen(F".out","w",stdout)
char _B[1<<15],*_S=_B,*_T=_B,_U[1<<15|1],*_O=_U,*_W=_U+(1<<15);
bool END=0;
#define getc() (_S==_T&&(_T=(_S=_B)+fread(_B,1,1<<15,stdin),_S==_T)?END=1:*_S++)
#define putc(c) (_O==_W?fwrite(_U,1,1<<15,stdout),_O=_U,1:1,*_O++=c)
#define EXIT fwrite(_U,1,_O-_U,stdout);\
	return 0
#endif
#define I_inF 2*(233333333LL+666666666LL)
#define UI_inF 4*(233333333LL+666666666LL)
#define LL_inF (2333333333333333333LL+6666666666666666666LL)
#define ULL_inF 2*(2333333333333333333ULL+6666666666666666666ULL)
#define R register
#define D long long
#define RD R D
#define For(a,b,c) for(RD a=b;a<=c;++a)
#define foR(a,b,c) for(RD a=b;a>=c;--a)
#define Mset(a,b) memset(a,b,sizeof(a))
inline D read() {
#define isd(c) (c>='0'&&c<='9')
	RD aa,bb;
	R char ch;
	while(ch=getc(),!isd(ch)&&ch!='-');
	ch=='-'?aa=bb=0:(aa=ch-'0',bb=1);
	while(ch=getc(),isd(ch)) aa=(aa*10+ch-'0');
	return bb?aa:-aa;
}
inline void out(RD x,RD k=0) {
	if(x<0) putc('-'),x=-x;
	if(!x) putc('0');
	else {
		R char stk[20];
		RD ts;
		for(ts=0; x; x/=10) stk[++ts]=x%10+'0';
		for(; ts; putc(stk[ts--]));
	}
	if(k==1) putc(' ');
	if(k==2) putc('\n');
}
int main() {
	RD n=read(),T=read(),ans=I_inF;
	For(i,1,n) {
		RD c=read(),t=read();
		if(t<=T) ans=std::min(ans,c);
	}
	if(ans==I_inF) puts("TLE");
	else out(ans);
	EXIT;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin>>n;
    int arr[n];
    for(int i=0; i<n;i++){
        cin>>arr[i];
    }
    
    vector<int> ans(n,0);
    for(int i=1;i<n;i++){
        int tans=INT_MAX;
        if(i-1>=0){
            tans=min(tans,abs(arr[i]-arr[i-1])+ans[i-1]);
        }
        if(i-2>=0){
            tans=min(tans,abs(arr[i]-arr[i-2])+ans[i-2]);
        }
        ans[i]=tans;
    }
    cout<<ans[n-1];
}


Measured memory_bytes: 4024
#include<bits/stdc++.h>
#define ll long long 
#define ld long double
#define pb push_back
#define vl vector
#define ff first
#define ss second
using namespace std;
int main()
{
    ll a,b,i,j,n,t;
    cin>>a;
    if(a==1) cout<<"0";
    else cout<<"1";
}

Measured memory_bytes: 3592
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

int main(){
    std::string s;
    std::cin >> s;

    bool flg;
    int length, j;
    std::vector<int> vec;    
    for(int i = 0; i < s.size(); ++i){
//        std::cout << "i: " << i << std::endl;
        flg = true;
        j = 0;
        length = 0;
        while(flg){
//            std::cout << "j: " << j << std::endl;
            if(s.size() - i == j){
                flg = false;
                break;
            }

            switch(s.at(i + j)){
                case 'A':
                case 'T':
                case 'G':
                case 'C':
                    ++length;
                    break;
                default :
                    flg = false;
                    break;
            }

            ++j;
        }
        vec.push_back(length);
    }

    std::cout << *max_element(vec.begin(), vec.end()) << std::endl;

    return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
  int a[4];
  int k;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
  }
  cin >> k;

  bool enable = true;
  for (int i = 0; i < 5; i++ ) {
    for (int j = 0; j < 5; j++) {
      if ((a[i] - a[j]) > k) {
        enable = false;
      }
    }
  }

  if (enable == true) {
    printf("%s", "Yay!");
  } else {
    printf("%s", ":\(");
  } 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,vis[1000000],cost[1000000],d,e,di,ei;
int main(){
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> vis[i];
	}
	cost[0]=0;
	cost[1]=abs(vis[0]-vis[1]);
	for(int i=2;i<n;i++){
		d=abs(vis[i]-vis[i-1]);
		e=abs(vis[i]-vis[i-2]);
		di=d+cost[i-1];
		ei=e+cost[i-2];
		if (di>ei){
			cost[i]=ei;
		}
		else{
			cost[i]=di;
		}
	}
	cout << cost[n-1];
	return 0;
}


Measured memory_bytes: 4736
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int I, ans, T, J, L, S, Z;
	cin >> I >> ans >> T >> J >> L >> S >> Z;

	int j = J, l = L;
	int anss = ans;
	//cout << anss << endl;
	anss += (I - I % 2) + (L - L % 2) + (J - J % 2);
	/*J = J % 2;
	L = L % 2;
	if (J + L > 1)anss += 2;*/
	L = l;
	J = j;

	if (min(J, L)&&I) {
		ans += 3;
		I--;
		J--;
		L--;
		ans += (I - I % 2) + (L - L % 2) + (J - J % 2);
	
	}

	//cout << ans << " " << anss << endl;
	cout << max(ans,anss) << endl;
	


	return 0;
}



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

#define pb push_back
#define S second
#define F first
#define sz size()
#define eps 0.000001
#define oo 2000000007
#define endl '\n'
#define bg begin()
#define nd end()
#define up upper_bound
#define lw lower_bound
#define debug(x) #x << " = " << x << "; "
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;

const int MAX = 1e5 + 1;

ll dp[MAX][2];
vector<int> g[MAX];
int N, MOD = 1e9+7;

ll f(int u, int color, int parent){
	ll &ans = dp[u][color];
	if(ans != -1) return ans;
	ans = 0;
	ll aux = 1;
	for(auto &v: g[u]){
		if(v != parent){
			aux = (aux*(f(v, 0, u)%MOD))%MOD;
		}
	}
	ans += aux; aux = 1;
	if(!color){
		for(auto &v: g[u]){
			if(v != parent){
				aux = (aux*(f(v, 1, u)%MOD))%MOD;
			}
		}
		ans = (ans + aux)%MOD;
	}
	return ans;
}



int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int u, v;
	cin >> N;
	for(int i = 0; i < N - 1; i++){
		cin >> u >> v;
		u--; v--;
		g[u].pb(v);
		g[v].pb(u);
	}
	memset(dp, -1, sizeof(dp));
	ll ans = f(0, 0, -1);
	cout << ans << endl;
}

Measured memory_bytes: 15616
#include<bits/stdc++.h>
#define il inline
#define vd void
#define mod 1000000007
typedef long long ll;
il ll gi(){
	ll x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch))f^=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
struct jizei{int x,v,id;}s[200010];
int sum[800100],tag[800100];
struct intv{int l,r;}I[200010];
#define mid ((l+r)>>1)
il vd build(int x,int l,int r){
	sum[x]=l==0;tag[x]=1;if(l==r)return;
	build(x<<1,l,mid),build(x<<1|1,mid+1,r);
}
il vd Upd_mul(int x,int t){sum[x]=1ll*t*sum[x]%mod,tag[x]=1ll*t*tag[x]%mod;}
il vd down(int x){if(tag[x]!=1)Upd_mul(x<<1,tag[x]),Upd_mul(x<<1|1,tag[x]),tag[x]=1;}
il vd update_mul(int x,int l,int r,const int&L,const int&R){
	if(L<=l&&r<=R)return Upd_mul(x,2);
	down(x);
	if(L<=mid)update_mul(x<<1,l,mid,L,R);
	if(mid<R)update_mul(x<<1|1,mid+1,r,L,R);
	sum[x]=(sum[x<<1]+sum[x<<1|1])%mod;
}
il vd update_add(int x,int l,int r,const int&p,const int&d){
	if(l==r){sum[x]=(sum[x]+d)%mod;return;}
	down(x);
	if(p<=mid)update_add(x<<1,l,mid,p,d);
	else update_add(x<<1|1,mid+1,r,p,d);
	sum[x]=(sum[x<<1]+sum[x<<1|1])%mod;
}
il int query(int x,int l,int r,const int&L,const int&R){
	if(L<=l&&r<=R)return sum[x];
	down(x);
	if(L<=mid)
		if(mid<R)return (query(x<<1,l,mid,L,R)+query(x<<1|1,mid+1,r,L,R))%mod;
		else return query(x<<1,l,mid,L,R);
	else return query(x<<1|1,mid+1,r,L,R);
}
#undef mid
int main(){
#ifdef XZZSB
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	int n=gi();
	for(int i=1;i<=n;++i)s[i].x=gi(),s[i].v=gi();
	std::sort(s+1,s+n+1,[](jizei a,jizei b){return a.v<b.v;});
	for(int i=1;i<=n;++i)s[i].id=i;
	std::sort(s+1,s+n+1,[](jizei a,jizei b){return a.x<b.x;});
	for(int i=n,mn=n;i;--i)mn=std::min(mn,s[i].id),I[s[i].id].l=mn;
	for(int i=1,mx=1;i<=n;++i)mx=std::max(mx,s[i].id),I[s[i].id].r=mx;
	std::sort(I+1,I+n+1,[](intv a,intv b){return a.l<b.l;});
	build(1,0,n);
	for(int i=1;i<=n;++i){
		update_mul(1,0,n,I[i].r,n);
		update_add(1,0,n,I[i].r,query(1,0,n,I[i].l-1,I[i].r-1));
	}
	printf("%d\n",query(1,0,n,n,n));
	return 0;
}


Measured memory_bytes: 10496
''' Hey stalker :) '''
INF = 10**10
def main():
    print = out.append
    ''' Cook your dish here! '''
    adj = [[] for _ in range(4)]
    visited = [False]*4
    for _ in range(3):
        x, y = get_list()
        adj[x-1].append(y-1)
        adj[y-1].append(x-1)
    def dfs(root):
        #print(root)
        visited[root] = True
        for v in adj[root]:
            if not visited[v]:
                dfs(v)
                return
    dfs(0)
    print("YES") if False not in visited else print("NO")


''' Pythonista fLite 1.1 '''
import sys
from collections import defaultdict, Counter
from bisect import bisect_left, bisect_right
#from functools import reduce
import math
#input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
out = []
get_int = lambda: int(input())
get_list = lambda: list(map(int, input().split()))
main()
#[main() for _ in range(int(input()))]
print(*out, sep='\n')


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

int main(){
    int a,b;
    cin>>a>>b;
    for(int i=0; i<200; i++){
        for(int j=0; j<200; j++){
            if(2*i+4*j==b && i+j==a){
                cout<<"Yes"<<endl;
                return 0;
        }
        }
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3624
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N,M = MI()
    A = LI()
    cumsum = [0]
    for a in A:
        cumsum.append((cumsum[-1] + a)%M)

    D = defaultdict(int)
    ans = 0
    for c in cumsum:
        ans += D[c]
        D[c] += 1
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 17540
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int t = sc.nextInt();
    t = t / a;
    int ans = b * t;
    System.out.println(ans);
  }
}


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

using namespace std;

int main()
{
    int n;
    long long res = 0;
    cin >> n;
    for (int i = 1; i <= n; i++) if (i % 3 != 0 && i % 5 != 0) res += i;
    cout << res;
    return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/algorithm_ext.hpp>
#include <boost/math/common_factor_rt.hpp>
using namespace std;
using namespace boost::range;
using boost::irange;
using boost::math::gcd;
using boost::math::lcm;

using ll = int64_t;
constexpr char LN = '\n';
template<class T> bool chmax(T& a, const T& b) {if(a<b){a=b;return true;}else{return false;}}
template<class T> bool chmin(T& a, const T& b) {if(b<a){a=b;return true;}else{return false;}}

#ifdef LOCAL
template<class H> void dump_(const char* s, H h) {cout<<s<<"="<<h<<LN; }
template<class H, class... T> void dump_(const char* s, H h, T... t) {for(;*s!=',';++s){cout<<*s;}cout<<"="<<h<<",";dump_(++s,t...);}
#define dump(...) dump_(#__VA_ARGS__, __VA_ARGS__)
#else
#define dump(...)
#endif

struct init_ {init_(){cin.tie(nullptr);ios::sync_with_stdio(false);}} init_;

template<class C> C scan(size_t n) {C c(n);for(auto& v:c){cin>>v;}return c;}
template<class C> C scan(size_t n, size_t m) {C vss(n);for(auto& vs:vss){vs.resize(m);for(auto& v:vs){cin>>v;}}return vss;}

template<class R> struct Joined { const R& r; const char* s; };
template<class R> Joined<R> joined(const R& r, const char* s = " ") {return{r,s};}
template<class R> ostream& operator<<(ostream& out, Joined<R> j) {bool f=true;for(const auto& v:j.r){if(f){f=false;}else{out<<j.s;}out<<v;}return out;}

template<class T> using matrix = vector<vector<T>>;
template<class T> matrix<T> make_matrix(size_t n, size_t m, const T& init = T()) {matrix<T> vss(n);for(auto& vs:vss){vs.resize(m,init);}return vss;}
template<class T> ostream& operator<<(ostream& out, Joined<matrix<T>> j) {bool a=true;for(const auto& vs:j.r){if(a){a=false;}else{out<<LN;}bool f=true;for(const auto& v:vs){if(f){f=false;}else{out<<j.s;}out << v;}}return out;}

template<class T> void show_(const T& t) {cout<<t;}
template<class T> void show_(const vector<T>& v) {cout<<joined(v);}
void show_(bool b) {cout<<(b?"Yes":"No");}
void show_(double d) {cout<<fixed<<setprecision(12)<<d;}
template<class T, class... TS> void show_(const T& t, TS... ts) {show_(t);cout<<' ';show_(ts...);}
template<class T> void show(const T& t) {show_(t);cout<<LN;}
template<class T, class... TS> void show(const T& t, TS... ts) {show_(t, ts...);cout<<LN;}

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << (a + b + c >= 22 ? "bust" : "win") << LN;
}


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

#define REP(i, N) for (int i = 0; i < N; ++i)

using namespace std;

int main()
{
    string s;
    cin >> s;
    int n = s.length();

    uint64_t start0 = 0;
    uint64_t start1 = 0;
    REP(i, n)
    {
        char c = s[i];
        switch (c)
        {
        case '0':
            if (i % 2 == 0)
                ++start1;
            else
                ++start0;
            break;

        case '1':
            if (i % 2 == 0)
                ++start0;
            else
                ++start1;
            break;
        }
    }

    cout << min(start0, start1) << endl;
    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>

int main(void) {
	long long num, year, x;
	scanf("%lld", &x);
	num = 100;
	year = 0;
	while (num < x)
	{
		num = num *1.01;
		year++;
	}
	printf("%d", year);

	return 0;
}

Measured memory_bytes: 1732
/*input
7
0 blue 4
0 red 1
0 white 5
1 red
1 blue
0 black 8
1 black
*/
macro_rules! input_vec {
    () => {
        input!().split_whitespace().map(|x| x.to_string()).collect()
    };
    ($delimiter:expr) => {
        input!().split($delimiter).map(|x| x.to_string()).collect()
    };
}

macro_rules! input {
    () => {{
        let mut return_ = String::new();
        std::io::stdin().read_line(&mut return_).ok();
        return_.pop();
        return_
    }};
}

fn main() {
    let n: i32 = input!().parse().unwrap();
    let mut map: std::collections::HashMap<String, String> = std::collections::HashMap::new();
    let mut v: Vec<String>;
    for _ in 0..n {
        v = input_vec!();
        if v[0] == String::from("0") {
            map.insert(v[1].clone(), v[2].clone());
        } else {
            println!("{}", map[&v[1]]);
        }
    }
}



Measured memory_bytes: 29748
n,k = [int(e) for e in input().split()]
d = [0]*k
a = [0]*k
for i in range(k):
    d[i]=int(input())
    a[i]=[int(e) for e in input().split()]
s = set()
for i in range(k):
    for j in range(d[i]):
        s.add(a[i][j])
print(n-len(s))

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

typedef int Val;
typedef pair<Val,int> Res;
#define val first
#define idx second

Res readExpr(string &s, int idx);
Res readTerm(string &s, int idx);
Res readFctr(string &s, int idx);

Res readQuery(string &s, int idx){
  //cout << "Q[";
  Res r = readExpr(s, idx);
  // skip '=';
  //cout << "]";
  return r;
}
Res readExpr(string &s, int idx){
  //cout << "E[";
  Res r = readTerm(s, idx);
  while (s[r.idx]=='+' || s[r.idx]=='-'){
    Res r2 = readTerm(s, r.idx+1);
    if (s[r.idx]=='+') r.val += r2.val;
    else r.val -= r2.val;
    r.idx = r2.idx;
  }
  //cout << "]";
  return r;
}
Res readTerm(string &s, int idx){
  //cout << "T[";
  Res r = readFctr(s, idx);
  while (s[r.idx]=='*' || s[r.idx]=='/'){
    Res r2 = readFctr(s, r.idx+1);
    if (s[r.idx]=='*') r.val *= r2.val;
    else r.val /= r2.val;
    r.idx = r2.idx;
  }
  //cout << "]";
  return r;
}
Res readFctr(string &s, int idx){
  Res r;
  //cout << "F[";
  if (s[idx]=='('){
    r = readExpr(s, idx+1);
    r.idx++; // skip ')'
  } else {
    int sgn=1,num=0;
    if (s[idx]=='-'){
      sgn=-1;
      idx++;
    }
    while (s[idx]>='0'&&s[idx]<='9'){
      num = num*10 + (s[idx]-'0');
      idx++;
    }
    r.val = num*sgn; r.idx = idx;
  }
  //cout<<"]";
  return r;
}

int main(void){
  int n;
  cin >> n;
  for (int i=0; i<n; i++){
    string str; cin >> str;
    cout << readQuery(str,0).val << endl;
  }
  return 0;
}



Measured memory_bytes: 3060
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

using ll=long long;
using vi=std::vector<int>;
using vvi=std::vector<vi>;
using vll=std::vector<ll>;
using vvll=std::vector<vll>;
template<typename T> using vvec=std::vector<std::vector<T>>;
template<typename T>
auto make_v(size_t sz){return std::vector<T>(sz);}
template<typename T,typename... Ts>
auto make_v(size_t sz,Ts...ts){return std::vector<decltype(make_v<T>(ts...))>(sz,make_v<T>(ts...));}
template<typename T>
void fill_v(T&var,const T&x){var=x;}
template<typename V,typename T>
void fill_v(V&v,const T&x){for(auto&& w:v){fill_v(w,x);}}

template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<std::vector<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<std::deque<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s, const std::set<T>&v){
  s<<"\n";for(auto&& elm:v){s<<elm<<"\t";}s<<"\n";return s;}

inline void scan(int&a){scanf("%d",&a);}
inline void scan(ll&a){scanf("%lld",&a);}
inline void scan(char&a){scanf(" %c",&a);}
inline void scan(double&a){scanf("%lf",&a);}
template<typename T>
inline void scan(std::vector<T>&v){for(auto&& sv:v){scan(sv);}}
template<typename First,typename...Args>
inline void scan(First&f,Args&...args){scan(f);scan(args...);}
inline void scan(std::string&s){char BUF[3000000];scanf(" %s",BUF);s=std::string(BUF);}
inline void print(int a){printf("%d\n",a);}
inline void print(ll a){printf("%lld\n",a);}
inline void print(double a){printf("%.12f\n",a);}
inline void print(std::string s){std::cout<<s<<"\n";}

using namespace std;

void solve() {
  ll x;
  scan(x);
  ll balance = 100;
  rep (i, 10000) {
    if (balance >= x) {
      print(i);
      return;
    }
    /* This is WRONG because the precision of floating numbers is insufficient for 64bit int.
     * For example, 984502824448193656 is a successfully-hacking case.
    balance = balance * 1.01;
    */
    balance += (balance / 100);
  }
  assert(false);
}

int main() {
  solve();
  return 0;
}


Measured memory_bytes: 3172
#include <bits/stdc++.h>
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

#define rep(i, ss, ee) for (int i = ss; i < ee; ++i)
using namespace std;
using ll = long long;

// DP 実装の順序
// DP 配列全体を「DP の種類に応じた初期値」で初期化
// 初期条件を入力
// ループを回す
// テーブルから解を得て出力

// 初期化
const ll INF = 1LL << 60;
const ll DP_MAX = 1e5 + 10;
ll dp[DP_MAX];
ll s[DP_MAX];

int N;
void input() {
  rep(i, 0, DP_MAX) dp[i] = INF;
  dp[0] = 0;
  cin >> N;
  rep(i, 0, N) cin >> s[i];
}

// ループ
// chmin(dp[なにか], dp[なにか] + なにか);
void solve() {
  rep(i, 0, N) {
    // 1つ前からの遷移
    chmin(dp[i], dp[i - 1] + abs(s[i] - s[i - 1]));
    // 2つ前からの遷移
    if (i > 1) chmin(dp[i], dp[i - 2] + abs(s[i] - s[i - 2]));
  }
  // 解を得て出力
  cout << dp[N - 1] << endl;
}

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

Measured memory_bytes: 5164
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int A, B, C, K; cin >> A >> B >> C >> K;
    int max = A;
    if(max < B)
    {
        max = B;
    }
    if(max < C)
    {
        max = C;
    }
    int exp = max;
    for(int i = 0; i < K; i++)
    {
        exp*= 2;
    }
    cout << A + B + C + exp - max << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int a,b,c,d,e,f,g,h,S,T;
    cin >> a >> b >> c >> d; 
    cin >> e >> f >> g >> h;
     
    S = a+b+c+d;
    T = e+f+g+h;
    if(S < T){
        cout << T;
    }
    else if(S > T){
        cout << S;
    }
    else if(S == T){
        cout << S;
    }
    cout << endl;
}


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

int main() {
  int n; std::cin >> n;
  std::vector<std::string> a(n);
  for (int i = 0; i < n; ++i) std::cin >> a[i];
  // int n = 5;
  // std::vector<std::string> a{"7.5", "2.4", "17.000000001", "17", "16.000000000"};

  /* ピリオドをすべての文字列に加える */
  for (int i = 0; i < n; i++)
    if (a[i].find('.') == std::string::npos) // ピリオドの有無
      a[i].push_back('.');                   // ピリオドを末尾に加える
  
  /* key:val = (c2, c5):cnt */
  std::map<std::pair<int, int>, int> p;

  /* aの素因数2と5の数を数える */
  for (int i = 0; i < n; i++) {
    // a[i].length() => 文字列の長さ
    // a[i].find('.') => .(ピリオド)が存在すればその位置, なければstd::string::npos

    // std::cout << a[i] << " " <<  a[i].length() - a[i].find('.') - 1 << std::endl;
    /* 小数点以下の数 */
    int d_cnt = a[i].length() - a[i].find('.') - 1;
    int c2 = -d_cnt; // 2の数を-d_cntで初期化
    int c5 = -d_cnt; // 5の数を-d_cntで初期化
    
    /* 文字を数字に変換 */
    a[i].replace(a[i].find('.'), 1, ""); // .(ピリオド)を削除 str.replace(開始位置, 長さ, 置き換え後の新たな文字列)
    long long a_ll = std::stoll(a[i].c_str()); // long longに変換
    
    /* 2の数を取得 */
    while (a_ll%2 == 0) {
      ++c2;
      a_ll /= 2;
    }
    /* 5の数を取得 */
    while (a_ll%5 == 0) {
      ++c5;
      a_ll /= 5;
    }

    /* mapに key:val = (c2, c5):数 保持 */
    p[std::pair<int, int>(c2, c5)]++; // keyが存在しない場合は0が追加される
  }

  /* チェック */
  // for (auto itr = p.begin(); itr != p.end(); ++itr)
  //   // std::cout << "(" << (*itr).first.first << ", " << (*itr).first.second << ")" 
  //   //           <<  " " << (*itr).second << std::endl;
  //   std::cout << "(" << itr->first.first << ", " << itr->first.second << ")" 
  //             <<  " " << (*itr).second << std::endl;
  
  long long cnt = 0;
  for (auto itr_1 = p.begin(); itr_1 != p.end(); ++itr_1) {
    int c2_1 = itr_1->first.first;
    int c5_1 = itr_1->first.second;
    int cnt_1 = itr_1->second;

    if (c2_1 >= 0 && c5_1 >= 0)
      cnt += (long long)cnt_1 * (cnt_1-1)/2;

    // if (itr_1->first.first >= 0 && itr_1->first.second >= 0)
    //   cnt += itr_1->second*(itr_1->second-1)/2;

    for (auto itr_2 = std::next(itr_1, 1); itr_2 != p.end(); ++itr_2) {
    int c2_2 = itr_2->first.first;
    int c5_2 = itr_2->first.second;
    int cnt_2 = itr_2->second;
      if (c2_1 + c2_2 >= 0 && c5_1 + c5_2 >= 0)
        cnt += (long long)cnt_1 * cnt_2;
      // if (itr_1->first.first + itr_2->first.first >= 0 && itr_1->first.second + itr_2->first.second >= 0)
      //   cnt += itr_1->second * itr_2->second;
    }

  }
  std::cout << cnt << std::endl;


  return 0;
}

Measured memory_bytes: 9584
import math


def ALDS1_1_D():
    """
    ＜問題＞
    FX取引では、異なる国の通貨を交換することで為替差の利益を得ることができます。
    例えば、１ドル100円の時に 1000ドル買い、価格変動により 1ドル 108円になった時に売ると、
    (108円 − 100円) × 1000ドル = 8000円の利益を得ることができます。

    ある通貨について、時刻 t における価格 Rt (t=0,1,2,,,n−1)が入力として与えられるので、
    価格の差 Rj−Ri (ただし、j>i とする) の最大値を求めてください。

    ＜入力＞
    最初の行に整数 n が与えられます。続く n 行に整数 Rt (t=0,1,2,,,n−1) が順番に与えられます。


    ＜出力＞
    最大値を１行に出力してください。

    ＜制約＞
    2 ≤ n ≤ 200,000
    1 ≤ Rt ≤ 10^9
    """
    n = int(input())
    r_list = [int(input()) for _ in range(n)]
    max_v, min_v = -math.inf, r_list[0]
    for j in range(1,n):
        max_v = max_v if max_v > (r_list[j]-min_v) else (r_list[j]-min_v)
        min_v = r_list[j] if min_v > r_list[j] else min_v
    print(max_v)

def main():
    ALDS1_1_D()


if __name__ == '__main__':
    main()


Measured memory_bytes: 13436
s = list(input().split())
a = []
for x in s:
    if  x in  ['+', '-', '*']:
        c, b = str(a.pop()), str(a.pop())
        b+= x+c
        a+=[int(eval(b))]
    else:
        a+= [int(x)]
print(a.pop())

        
        


Measured memory_bytes: 5608
#include<iostream>
#include<algorithm>

using namespace std;

long long n, res;

long long prime(long long x){
    for(long long i = 2;i * i <= x;i++){
	if(x%i==0)return 0;
    }
    return 1;
}
int main(){
    long long p;
    cin >> n;
    for(long long i = 0;i < n;i++){
	cin >> p;
	res += prime(2*p+1);
    }
    cout << res << endl;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
 
using namespace std;
 
int main(void){
  int n,sum=0;
  vector<int> a,b,c;
  cin>>n;
  a.resize(n);
  b.resize(n);
  c.resize(n-1);
  for(auto& x:a){
    cin>>x;
  }
  for(auto& x:b){
    cin>>x;
  }
  for(auto& x:c){
    cin>>x;
  }
  for(int i=0;i<n;i++){
    if(i>0){
      if(a[i-1]==a[i]-1)sum+=c[a[i-1]-1];
    }
    sum+=b[a[i]-1];
  }
  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.stream.IntStream;

/**
 * 解説どおりに作成したソースコード
 */
public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			@SuppressWarnings("unchecked")
			List<Path>[] pathLists = new List[n];
			IntStream.range(0, n).forEach(i -> pathLists[i] = new ArrayList<>());
			IntStream.range(0, n - 1).forEach(i -> {
				int a = scanner.nextInt() - 1;
				int b = scanner.nextInt() - 1;
				long c = scanner.nextLong();
				pathLists[a].add(new Path(a, b, c));
				pathLists[b].add(new Path(b, a, c));
			});
			int q = scanner.nextInt(), k = scanner.nextInt() - 1;
			long[] distances = dijkstra(pathLists, k, n);
			IntStream.range(0, q).forEach(
					i -> System.out.println(distances[scanner.nextInt() - 1] + distances[scanner.nextInt() - 1]));
		}
	}

	/**
	 * @param pathLists ノード間の連結パス一覧の配列
	 * @param src       開始ノード
	 * @param n         ノードの数
	 * @return 開始ノードからの距離の配列
	 */
	private static long[] dijkstra(List<Path>[] pathLists, int src, int n) {
		long[] distances = new long[n];
		Arrays.fill(distances, Long.MAX_VALUE);
		// 最短距離が確定したかどうか
		boolean[] fixed = new boolean[n];
		Arrays.fill(fixed, false);
		// 出発地点までの距離を0とする
		distances[src] = 0L;
		Queue<Path> queue = new PriorityQueue<>();
		queue.add(new Path(src, src, 0));
		while (!queue.isEmpty()) {
			int now = queue.poll().to;
			if (!fixed[now]) {
				fixed[now] = true;
				for (Path path : pathLists[now]) {
					if (!fixed[path.to] && distances[path.to] > distances[now] + path.cost) {
						distances[path.to] = distances[now] + path.cost;
						queue.add(new Path(path.to, path.to, distances[path.to]));
					}
				}
			}
		}
		return distances;
	}

	/**
	 * ノード間の一つのパスを表すクラス
	 */
	private static class Path implements Comparable<Path> {
		/** 開始ノード */
		@SuppressWarnings("unused")
		int from;
		/** 終了ノード */
		int to;
		/** 移動コスト */
		long cost;

		Path(int from, int to, long cost) {
			super();
			this.from = from;
			this.to = to;
			this.cost = cost;
		}

		@Override
		public int compareTo(Path path) {
			if (this.cost > path.cost) {
				return 1;
			} else if (this.cost == path.cost) {
				return 0;
			} else {
				return -1;
			}
		}
	}
}


Measured memory_bytes: 178972
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        if (Math.abs(x-a) < Math.abs(x-b)) {
            System.out.println("A");
        } else {
            System.out.println("B");
        }
    }
}


Measured memory_bytes: 20948
n = int(input())
ans = n
for i in range(n + 1):
    cc = 0
    t = i
    while t > 0:
        cc += t % 6
        t //= 6
    t = n - i
    while t > 0:
        cc += t % 9
        t //= 9
    ans = min(ans, cc)
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define sz(c) ((int)(c).size())

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const ll MOD=1e9+7;

ll tim(ll a,ll b){
	return (a*b)%MOD;
}
ll adm(ll a,ll b){
	return (a+b)%MOD;
}

ll extgcd(ll a,ll b,ll& x, ll& y){
	ll d=a;
	if(b!=0){
		d = extgcd(b, a%b, y, x);
		y -= (a/b) * x;
	}
	else{
		x = 1; y = 0;
	}
	return d;
}
ll mod_inv(ll a,ll m){
	ll x,y;
	extgcd(a,m,x,y);
	return (m+x%m)%m;
}


int main(){
	ll N,M,K;
	cin>>N>>M>>K;
	
	ll ans1=0;
	ll ans2=0;
	rep1(i,M-1){
		ans1=adm(ans1,tim(i,M-i));
	}
	ans1=tim(ans1,N);
	ans1=tim(ans1,N);
	
	rep1(i,N-1){
		ans2=adm(ans2,tim(i,N-i));
	}
	ans2=tim(ans2,M);
	ans2=tim(ans2,M);
	ll ans=adm(ans1,ans2);
	
	ll ans3=1;
	ll a=N*M-2;
	ll b=K-2;
//  	cout<<a<<" "<<b<<endl;
	rep(i,b){
		ans3=tim(ans3,a-i);
		ans3=tim(ans3,mod_inv(i+1,MOD));
//      	cout<<ans3<<endl;
	}
	ans=tim(ans,ans3);
//	cout<<ans1<<endl;
//	cout<<ans2<<endl;
//  cout<<ans3<<endl;
	cout<<ans<<endl;
}

Measured memory_bytes: 256
s = list(input())
s_ = list('abcdefghijklmnopqrstuvwxyz')

s = list(set(s))
s.sort()

for i in range(len(s)):
    if s[i] != s_[i]:
        print(s_[i])
        exit()
if len(s) < 26: print(s_[len(s)])
else: print('None')


Measured memory_bytes: 3956
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  int sx,sy,tx,ty;
  cin>>sx>>sy>>tx>>ty;
  for(int i=sy;i<ty;i++) cout<<"U";
  for(int i=sx;i<tx;i++) cout<<"R";
  for(int i=sy;i<ty;i++) cout<<"D";
  for(int i=sx;i<=tx;i++) cout<<"L";
  for(int i=sy;i<=ty;i++) cout<<"U";
  for(int i=sx;i<=tx;i++) cout<<"R";
  cout<<"DR";
  for(int i=sy;i<=ty;i++) cout<<"D";
  for(int i=sx;i<=tx;i++) cout<<"L";
  cout<<"U"<<endl;
  return 0;
}


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

int main() {
	int N;
	int count = 0;
	cin >> N;
	if (N >= 1 && N <= 200) {
		for (int i = 1; i <= N; i += 2) {
			int x = 0;
			for (int j = 1; j <= i; j++) {
				if (i%j == 0) {
					x++;
				}
			}
			if (x == 8)
				count++;
		}
	}
	cout << count << endl;
	getchar();
	getchar();
}

Measured memory_bytes: 256
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=100005;
int n,m;
vector<int>adj[M];
int vis[M];
int flag=0;
int b=0,w=0;
void dfs(int u,int par)
{
    if(flag)return ;
    if(!par)
    {
        vis[u]=1;
        w++;
    }
    else
    {
        if(vis[par]==1)vis[u]=2,b++;
        else vis[u]=1,w++;
    }
    for(auto v:adj[u])
    {
        if(v==par)continue;
        if(vis[v]==0)
        {
            dfs(v,u);
        }
        else if(vis[v]==vis[u])
        {
            flag=1;
        }
    }
}
 main()

{
    fast
    cin>>n>>m;
    f(i,1,m)
    {
        int u,v;
        cin>>u>>v;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    dfs(1,0);
    if(flag)
    {
        int x=n*(n-1);
        x=x/2;
        x-=m;
        cout<<x<<endl;
        return 0;
    }
   cout<<(b*w)-m<<endl;
    return 0;

}





































Measured memory_bytes: 10728
// include
// ----------------------------------------------------------------------------
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>

// repetition
// ----------------------------------------------------------------------------
#define FOR(i, a, b) for (i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

// memory clear
// ----------------------------------------------------------------------------
#define CLRNUM(a) memset((a), 0, sizeof(a))
#define CLRBOOL(a, flag) memset((a), flag, sizeof(a))
#define CLRCHAR(a) memset((a), '\0', sizeof(a))

// debug
// ----------------------------------------------------------------------------
#define DEBUGINT(x) printf("%d\n", x);
#define DEBUGFLOAT(x) printf("%f\n", x);
#define DEBUGCHAR(x) printf("%c\n", x);
#define DEBUGSTR(x) printf("%s\n", x);
#define DEBUGFORINT(i, a, b, x) FOR(i, a, b){ printf("%d ", x[i]); }
#define DEBUGFORFLOAT(i, a, b,x ) FOR(i, a, b){ printf("%f ", x[i]); }
#define DEBUGFORCHAR(i, a, b, x) FOR(i, a, b){ printf("%c ", x[i]); }
#define DEBUGREPINT(i, n, x) REP(i, n){ printf("%d ", x[i]); }
#define DEBUGREPFLOAT(i, n, x) REP(i, n){ printf("%f ", x[i]); }
#define DEBUGREPCHAR(i, n, x) REP(i, n){ printf("%c ", x[i]); }

// other
// ----------------------------------------------------------------------------
#define PUTNL printf("\n")

// constant
// ----------------------------------------------------------------------------
#define INF 1000000000

int main(void)
{
    // M_PI
    int step, dig;
    double x, y, angle;

    x = 0;
    y = 0;
    angle = 0;

    while (1){
        scanf("%d,%d", &step, &dig);

        if (step == 0 && dig == 0){
            break;
        }

        x += (double)step * sin(angle * (M_PI / 180));
        y += (double)step * cos(angle * (M_PI / 180));
        angle += (double)dig;
    }

    printf("%d\n%d\n", (int)x, (int)y);

    return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define INF 1e9 + 5

int main(){
	int n;
	cin >> n;
	vector<int> v(n);
	for(int i = 0; i < n; i++){
		cin >> v[i];
	}
	vector<int> dp(n, INF);
	dp[0] = 0;
	for(int i = 0; i < n; i++){
		for(int j = 1; j < 3; j++){
			if(i + j < n)
				dp[i + j] = min(dp[i + j], dp[i] + abs(v[i]-v[i+j]));
		} 			
	}
	cout << dp[n-1] << endl;
	return 0;
}

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

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



}


Measured memory_bytes: 256
H,W=map(int,input().split())
A=[input() for _ in range(H)]
from collections import defaultdict
d=defaultdict(int)
for a in A:
  for j in a:
    #print("j: ",j)
    d[j]+=1

four=0
two=0
one=0

for i in  range(26):
  c=chr(ord("a")+i)
  if d[c]>=4:
    four+=d[c]//4 
    d[c]%=4
  if d[c]>=2:
    two+=d[c]//2
    d[c]%=2
  if d[c]>=1:
    one+=d[c]
    d[c]-=1

if four<(H//2)*(W//2):    
  print("No")
  exit(0)
four-=(H//2)*(W//2)
two+=four*2

if H%2==1:
  if two < W//2:
    print("No")
    exit()
  two-=W//2
if W%2==1:
  if two <H//2:
    print("No")
    exit()
  two-=H//2

print("Yes")
  

Measured memory_bytes: 39024
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>

using namespace std;

int main() {
    int K, N;
    cin >> K >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    A.push_back(A[0]);
    int maxDist = 0;
    for (int i = 0; i < N; i++) {
        maxDist = max((A[i+1] - A[i] + K) % K, maxDist);
    }
    cout << K - maxDist;
    return 0;
}


Measured memory_bytes: 1792
#define _USE_MATH_DEFINES
#include <cmath>
#include <string>
#include <vector>
#include <utility>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <numeric>
#include <array>
#include <float.h>
#include <memory>
#include <functional>
#include <iomanip>
#include <queue>
#include <random>
#include <map>
#include <set>

#pragma warning(disable:4996)

using namespace std;

int main() {
  int n;
  cin >> n;
  unsigned long long ans = 1;
  for (int i = 2; i <= n; ++i) {
    ans *= i;
    ans %= (unsigned long long)1E9 + 7;
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define rep(i,n)  for (int i = 0; i < n; i++)
#define loop(i,a,n)  for (int i = a; i <= n; i++)
#define deb(x) cout << #x << " = " << x <<'\n'
typedef long long ll;

int main(){
    int a,b;
  	cin >> a >> b;
  	cout << a*b << endl;
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#define int long long
#define INF 1e+18
using namespace std;

typedef pair<int,int> P;

signed main(){
	int m,n,k;
	bool start = false;
	static int d[200002][2];//0:tate 1:yoko
	static vector<P> G[200002][2];
	static vector<P> tate[100000],yoko[100000];
	cin >> m >> n >> k;
	for(int i = 0;i < k + 2;i++) {
		d[i][0] = INF;
		d[i][1] = INF;
	}
	for(int i = 0;i < k;i++){
		int a,b;
		cin >> a >> b;
		if(a == 1 && b == 1) start = true;
		tate[b - 1].push_back(P(a - 1,i + 1));
		yoko[a - 1].push_back(P(b - 1,i + 1));
	}
	tate[0].push_back(P(0,0));
	yoko[0].push_back(P(0,0));
	tate[n - 1].push_back(P(m - 1,k + 1));
	yoko[m - 1].push_back(P(n - 1,k + 1));
	for(int i = 0;i < n;i++){
		if(tate[i].size() <= 1) continue;
		sort(tate[i].begin(),tate[i].end());
		for(int j = 0;j < tate[i].size() - 1;j++){
			G[tate[i][j + 1].second][1].push_back(P(tate[i][j + 1].first - tate[i][j].first,tate[i][j].second));
			G[tate[i][j].second][1].push_back(P(tate[i][j + 1].first - tate[i][j].first,tate[i][j + 1].second));
		}
	}
	for(int i = 0;i < m;i++){
		if(yoko[i].size() <= 1) continue;
		sort(yoko[i].begin(),yoko[i].end());
		for(int j = 0;j < yoko[i].size() - 1;j++){
			G[yoko[i][j + 1].second][0].push_back(P(yoko[i][j + 1].first - yoko[i][j].first,yoko[i][j].second));
			G[yoko[i][j].second][0].push_back(P(yoko[i][j + 1].first - yoko[i][j].first,yoko[i][j + 1].second));
		}
	}
	priority_queue<P,vector<P>,greater<P> > que;
	que.push(P(0,0));
	d[0][0] = 0;
	if(start){
		que.push(P(1,k + 2));
		d[0][1] = 1;
	}
	while(!que.empty()){
		P p = que.top();que.pop();
		int v = p.second % (k + 2),flag = p.second / (k + 2),_flag = (flag + 1) % 2;
		if(d[v][flag] < p.first) continue;
		for(int i = 0;i < G[v][flag].size();i++){
			P u = G[v][flag][i];
			if(d[u.second][flag] > d[v][flag] + u.first){
				d[u.second][flag] = d[v][flag] + u.first;
				que.push(P(d[u.second][flag],u.second + flag * (k + 2)));
			}
			if(d[u.second][_flag] > d[v][flag] + u.first + 1){
				d[u.second][_flag] = d[v][flag] + u.first + 1;
				que.push(P(d[u.second][_flag],u.second + _flag * (k + 2)));
			}
		}
		for(int i = 0;i < G[v][_flag].size();i++){
			P u = G[v][_flag][i];
			if(d[u.second][_flag] > d[v][_flag] + u.first){
				d[u.second][_flag] = d[v][_flag] + u.first;
				que.push(P(d[u.second][_flag],u.second + _flag * (k + 2)));
			}
			if(d[u.second][flag] > d[v][_flag] + u.first + 1){
				d[u.second][flag] = d[v][_flag] + u.first + 1;
				que.push(P(d[u.second][flag],u.second + flag * (k + 2)));
			}
		}
	}
	if(min(d[k + 1][0],d[k + 1][1]) == INF) cout << -1 << endl;
	else cout << min(d[k + 1][0],d[k + 1][1]) << endl;
	/*for(int i = 0;i <= k + 1;i++){
		cout << i << ")" << endl;
		for(int j = 0;j < G[i][0].size();j++){
			cout << G[i][0][j].second << " ";
		}
		cout << endl;
		for(int j = 0;j < G[i][1].size();j++){
			cout << G[i][1][j].second << " ";
		}
		cout << endl;
	}*/
	return 0;
}

Measured memory_bytes: 48312
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
#define F first
#define S second
#define pb push_back
#define mp make_pair

const int MOD = 1000000007;
const int N = 1e5 + 18;


int32_t main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#endif
    int t = 1;
    //cin >> t;
    while (t--) {
        //for (int tt = 1; tt <= t; tt++) {
        int n;
        cin >> n;
        int a[n];
        int res = 0;
        cin >> a[0];
        for (int i = 1; i < n; i++) {
            cin >> a[i];
            if (a[i] < a[i - 1]) {
                res += a[i - 1] - a[i];
                a[i] = a[i - 1];
            }
        }
        cout << res << endl;
    }
    return 0;

}




Measured memory_bytes: 5200
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}


int d[3] = {-1,0,1};
int main(){
   string a,b,c;cin>>a>>b>>c;
   a[0]-=32;b[0]-=32;c[0]-=32;
   cout<<a[0]<<b[0]<<c[0];
}



Measured memory_bytes: 256