akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const ll INF = 1LL<<60;
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; }
using Graph = vector<vector<int>>;

typedef pair<int, int> P;

struct edge{
    int to, id;
};
vector<vector<edge>> G;
vector<int> ans;

void dfs(int v, int color=-1, int parent=-1){

    int k = 1;
    for (edge e : G[v]){
        int to = e.to, id = e.id;
        if (to == parent) continue;
        if (k == color) k++;
        ans[id] = k++;
        dfs(to, ans[id], v);
    }
}

int main(){
    int N; cin >> N;
    ans.assign(N-1,-1);
    G.resize(N);
    rep(i,N-1){
        int a, b; cin >> a >> b;
        a--;
        b--;
        G[a].push_back(edge{b,i});
        G[b].push_back(edge{a,i});
    }

    dfs(0);

    int num=0;
    rep(i,N-1) num = max(num, (int)G[i].size());

    cout << num << endl;

    rep(i,N-1){
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 8320
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int         long long
#define mod         1000000007
#define FAST        ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f(i,n)      for(int i=0;i<n;i++)
#define fp(i,k,n)   for(int i=k;i<=n;i++)
#define fr(i,k,n)   for(int i=k;i>=n;i--)
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define dbg(x)      cout << (#x) << " is " << (x) << '\n' 
#define F           first
#define S           second
#define sz(x)       (int)(x).size()
#define lb          lower_bound
#define ub          upper_bound
#define mems(x,y)     memset(x,y,sizeof(x))
#define all(a)      a.begin(),a.end()
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

/*---------------------------------------------------------------------------------------------------*/
int len,s;
int dp[(int)4005];
int go(int sum)
{
  if(sum==s)
    return dp[sum]=1;
  if(sum>s)
    return 0;
  int& res=dp[sum];
  if(res!=-1)
    return res;
  res=0;
  fp(i,3,s)
  {
    res=(res%mod + go(sum+i)%mod)%mod;
  }
  return res;
}
void solve()
{
  cin >> s;
  if(s<3)
  {
    cout << 0 << '\n';return;
  }
  int val=0;
  while(val<s)
  {
    val+=3;
    if(val>s)
      break;
    len++;
  }
  mems(dp,-1);
  cout << go(0) << '\n';
  return;
} 

signed main()
{
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  FAST
  int T=1;
  // cin >> T;
  while(T--)
  {
    solve();
  }
  return 0;
}


Measured memory_bytes: 3668
from collections import deque
N = int(input())
T = [[] for _ in range(N)]
for i in range(N-1):
    u, v, w = map(int, input().split())
    u, v, w = u-1, v-1, w % 2
    T[u].append([v, w])
    T[v].append([u, w])

Ans = [-1]*N
P = deque([0])
Ans[0] = 0
while(len(P) > 0):
    a = P.popleft()
    for i in T[a]:
        if Ans[i[0]] == -1:
            if i[1] == 0:
                Ans[i[0]] = Ans[a]
            else:
                Ans[i[0]] = (Ans[a] + 1) % 2
            P.append(i[0])
for i in Ans:
    print(i)

Measured memory_bytes: 106320
package main

import (
	"fmt"
	"os"
)

func run() int {
	var h, n int
	fmt.Scanf("%d %d\n", &h, &n)
	var a int
	sum := 0
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a)
		sum += a
	}

	if sum >= h {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}

	return 0
}

func main() {
	os.Exit(run())
}


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

#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;
int n;
void solve(){
    cin>>n;
    mi f;
    set<int> s;
    rep(i,0,n){
        int x;
        cin>>x;
        f[x]++;
        s.insert(x);
    }
    vi v(all(s));
    if(sz(f)==3 and f[v[0]]==f[v[1]]  and f[v[1]]==f[v[2]] and (v[0]^v[1])==v[2]) cout<<"Yes"<<endl;
    else if(sz(f)==2 and v[0]==0 and 2*f[v[0]]==f[v[1]]) cout<<"Yes"<<endl;
    else if(sz(f)==1 and v[0]==0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

Measured memory_bytes: 7808
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int n, k;


int main() {
    cin >> n >> k;
    vector<bool> snk(n, false);
    for(int i = 0; i < k; ++i) {
        int d; cin >> d;
        for(int j = 0; j < d; ++j) {
            int aa; cin >> aa;
            aa--;
            snk.at(aa) = true;
        }
    }

    int cnt = 0;
    for(int i = 0; i < n; ++i) {
        if(!snk.at(i)) cnt++;
    }
    cout << cnt << endl;
}

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

int main(){
  string c1,c2;
  cin >> c1 >> c2;
  if(c1[0] == c2[2] && c1[1] == c2[1] && c1[2] == c2[0]) cout << "YES" << endl;
  else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <complex>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;

int main() {
  string s;
  int k;

  while (cin >> s >> k) {
    int cnt[128];
    fill(cnt, cnt + 128, 0);
    for (int i = 0; i < s.size(); i++) {
      cnt[s[i]]++;
    }
    if (cnt[s[0]] == s.size()) {
      ll ans = ((ll)s.size() * k) / 2;
      cout << ans << endl;
      continue;
    }

    int leftCnt = 1;
    while (s[leftCnt] == s[leftCnt - 1]) {
      leftCnt++;
    }

    int rightCnt = 0;
    for (int i = s.size() - 1; i >= 0; i--) {
      if (s[i] != s[s.size() - 1]) {
        rightCnt = s.size() - i - 1;
        break;
      }
    }

    if (leftCnt + rightCnt == s.size()) {
      ll ans = (ll)((leftCnt / 2) + (rightCnt / 2)) * k;
      cout << ans << endl;
      continue;
    }

    int med = 0;
    for (int i = leftCnt; i < s.size() - rightCnt; i++) {
      int j = i + 1;
      while (s[j] == s[i]) {
        j++;
      }
      if (j - i > 1) {
        med += (j - i) / 2;
      }
      i = j - 1;
    }

    ll ans = (ll)med * k + leftCnt / 2 + rightCnt / 2;
    if (s[0] == s[s.size() - 1]) {
      ll sum = leftCnt + rightCnt;
      ans += (ll)(sum / 2) * (k - 1);
    } else {
      ans += (ll)(leftCnt / 2 + rightCnt / 2) * (k - 1);
    }

    cout << ans << endl;
  }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <float.h>
#include <math.h>

int main() {
  int n, t, a, ans=0;
  scanf("%d", &n);
  scanf("%d %d", &t, &a);
  double tmp, h[n], dif=DBL_MAX;
  for (int i=0; i<n; i++) {
    scanf("%lf", &tmp);
    h[i] = t-tmp*0.006;
    if (dif > fabs(h[i]-a)) {
      ans = i+1;
      dif = fabs(h[i]-a);
    }
  }
  printf("%d\n", ans);
  return 0;
}


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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX / 100;
//const ll INF = (1ll << 31) - 1;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;

bool contain(set<P> &s, P a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
typedef priority_queue<long long, vector<long long>, greater<long long>> PQ_ASK;


void print_line(vector<string> &line) {
    if (line.size() == 0ll) {
        cout << endl;
        return;
    }
    for (ll i = 0; i < line.size(); i++) {
        cout << line[i];
        if (i == line.size() - 1) cout << endl;
        else cout << ' ';
    }
}

typedef int Weight;

struct Edge {
    int src, dst;
    Weight weight;

    Edge(int src, int dst, Weight weight) :
            src(src), dst(dst), weight(weight) {}
};

bool operator<(const Edge &e, const Edge &f) {
    return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
           e.src != f.src ? e.src < f.src : e.dst < f.dst;
}

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

typedef vector<Weight> Array;
typedef vector<Array> Matrix;

Weight visit(const Graph &g, Graph &T, int i, int j) {
    if (T[i][j].weight >= 0) return T[i][j].weight;
    T[i][j].weight = g[i][j].weight;
    int u = T[i][j].dst;
    rep(k, T[u].size()) {
        if (T[u][k].dst == i) continue;
        T[i][j].weight = max(T[i][j].weight, visit(g, T, u, k) + g[i][j].weight);
    }
    return T[i][j].weight;
}

vector<Weight> height(const Graph &g) {
    const int n = g.size();
    Graph T(g); // memoise on tree
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < T[i].size(); ++j)
            T[i][j].weight = -1;
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < T[i].size(); ++j)
            if (T[i][j].weight < 0)
                T[i][j].weight = visit(g, T, i, j);

    vector<Weight> ht(n); // gather results
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < T[i].size(); ++j)
            ht[i] = max(ht[i], T[i][j].weight);
    return ht;
}

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

    Graph g(n);

    rep(i, n - 1) {
        int s, t, w;
        cin >> s >> t >> w;
        Edge edge1(s, t, w);
        Edge edge2(t, s, w);
        g[s].push_back(edge1);
        g[t].push_back(edge2);
    }

    vector<Weight> ans = height(g);

    for(Weight w : ans) cout << w << endl;

}



Measured memory_bytes: 4956
from collections import deque
h , w = map(int,input().split())
ch , cw = map(lambda x:int(x)-1,input().split())
dh , dw = map(lambda x:int(x)-1,input().split())
ma = [list(input()) for i in range(h)]
visit = [[-1 for i in range(w)] for j in range(h)]
cou = -1
p = [(0,1),(0,-1),(1,0),(-1,0)]
for i in range(h):
    for j in range(w):
        if visit[i][j] != -1 or ma[i][j] == "#":
            continue
        cou += 1
        visit[i][j] = cou
        d = deque()
        d.append((i,j))
        while d:
            now = d.popleft()
            for x , y in p:
                if 0 <= now[0]+x < h and 0 <= now[1]+y < w:
                    if ma[now[0]+x][now[1]+y] == "." and visit[now[0]+x][now[1]+y] == -1:
                        visit[now[0]+x][now[1]+y] = cou
                        d.append(((now[0]+x,now[1]+y)))

st = visit[ch][cw]
go = visit[dh][dw]
route = [set() for i in range(cou+1)]

for i in range(h):
    for j in range(w):
        if visit[i][j] == -1:
            continue
        for s in range(-2,3,1):
            for t in range(-2,3,1):
                if 0<=i+s<h and 0<=j+t<w:
                    if visit[i+s][j+t] != -1 and visit[i+s][j+t] != visit[i][j]:
                        route[visit[i][j]].add(visit[i+s][j+t])

kyori = [-1 for i in range(cou+1)]
kyori[st] = 0
d = deque()
d.append(st)

while d:
    now = d.popleft()
    for i in route[now]:
        if kyori[i] == -1:
            kyori[i] = kyori[now] + 1
            d.append(i)

print(kyori[go])

Measured memory_bytes: 182476
MOD=10**9+7

def repeat_squaring n,p,m
    if p==0
        return 1
    elsif p%2==0
        t=repeat_squaring(n,p/2,m)
        return t**2%m
    end
    return n*repeat_squaring(n,p-1,m)
end

def frac n,k
  a=1
  b=1
  k.times do |i|
    b*=i+1
    b%=MOD
  end
  k.times do |i|
    j=i+1
    a*=n-i
    a%=MOD
  end
  a*inv(b)%MOD
end

def inv(n)
  repeat_squaring(n,MOD-2,MOD)
end


n,a,b=gets.split.map(&:to_i)
ans=repeat_squaring(2,n,MOD)
ans-=1

ca=MOD-frac(n,a)
cb=MOD-frac(n,b)

p (ans+ca+cb)%MOD

Measured memory_bytes: 3836
def f(n):
    return len([x for x in range(1, n+1) if (n % x == 0)])

def solve(n):
    return len([x for x in range(105, n+1) if (x % 2 == 1) and (f(x) == 8)])

assert solve(105) == 1
assert solve(7) == 0
print solve(input())

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

int main(){
  
  set<string> st;
  int n;
  string s;
  
  cin >> n;
  
  for(int i=0; i<n; i++){
    cin >> s;
    
    st.insert(s);
  }
  
  cout << st.size() << endl;
  
  
  return 0;
}

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



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

    long long int a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;


    cin>>a>>b;
    cout<<a*b<<"\n";

    return 0;


}


Measured memory_bytes: 3600
N, Q = map(int, input().split())
S = input()
t=[0]*(N+1)
ans = [0] * Q
for i in range(N):
	t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
	l, r = map(int, input().split())
	ans[i] = t[r-1] - t[l-1]
for i in range(Q):
    print(ans[i])

Measured memory_bytes: 11876
/*
tarun360
IIT Indore
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ll_s long
#define mod 1000000007
#define forn(i,start,lim) for(ll i=start;i<lim;i++)
#define forn_d(i,start,lim) for(ll i=start;i>=lim;i--)
#define forn_s(i,start,lim) for(ll_s i=start;i<lim;i++)
#define forn_d_s(i,start,lim) for(ll_s i=start;i>=lim;i--)
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define debug1(a) cout<<a<<endl
#define debug2(a,b) cout<<a<<" "<<b<<endl
#define debug3(a,b,c) cout<<a<<" "<<b<<" "<<c<<endl
#define debug4(a) cout<<"chu "<<a<<endl

ll w[105],v[105],dp[105][100005];

int main()
{
  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  ll n,W,V=0;
  cin>>n>>W;
  forn(i,1,n+1) cin>>w[i]>>v[i];
  forn(i,1,1e5+1) dp[0][i]=1e9+5;
  forn(i,1,n+1){
    forn(j,1,1e5+1){
      if(j-v[i]<0) dp[i][j]=dp[i-1][j];
      else
        dp[i][j]=min(dp[i-1][j],dp[i-1][j-v[i]] + w[i]);
    }
  }
  ll ans=0;
  forn_d(i,1e5,0){
    if(dp[n][i]<=W){
        ans=i;
        break;
    }
  }
  cout<<ans<<endl;
  /*forn(i,0,n+1){
    cout<<endl;
    forn(j,0,16){
      cout<<dp[i][j]<<" ";
    }
  }*/
  return 0;
}


Measured memory_bytes: 80128
import bisect
H,N = [int(x) for x in input().split()]
AB = [[int(x) for x in input().split()] for _ in range(N)]
dp = [[10**18]*(10**4+1) for _ in range(N+1)]
for i in range(N+1):
  dp[i][0]=0
mi=10**9
for i in range(N):
  for w in range(10**4+1):
    dp[i+1][w]=min(dp[i+1][w],dp[i][w])
    if w-AB[i][0]>=0:
      dp[i+1][w]=min(dp[i+1][w],dp[i + 1][w - AB[i][0]] + AB[i][1])
for i in range(H,10**4+1):
  mi = min(mi,dp[N][i])
print(mi)

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

int main(){
   string s4[] = {"dreamer","eraser","erase","dream"}; 
   string S,T="";

   for(int i = 0 ; i < 4; i++){
       reverse(s4[i].begin(),s4[i].end());
   }

   cin >> S;
   int tmp;
   bool flag = true;
   reverse(S.begin(),S.end());//反転
   for(int i = 0 ; i < S.length();){
       for(int j = 0; j < 4; j++){
           string str = S.substr(i,s4[j].size());
           if(str == s4[j]){
               i += s4[j].size();
               flag = true;
               break;
           }else{
               flag = false;
           }
       }
       if(!flag){
           cout << "NO";
           break;
       }
   }
   if(flag) cout << "YES";
}

Measured memory_bytes: 512
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
typedef pair<int,int> P;
inline int tosc(int h, int m,int s){
  return h*3600 + m * 60 + s;
}

int main(){
  int n;
  while(cin>>n,n){
    P v[10001];
    REP(i,n){
      int h,m,s;
      scanf("%d:%d:%d",&h,&m,&s);
      int m1 = tosc(h,m,s);
      scanf("%d:%d:%d",&h,&m,&s);
      int m2 = tosc(h,m,s);
      v[i] = P(m1,m2);
    }
    sort(v , v + n);
    int ans = 0;
    priority_queue<int, vector<int>, greater<int> > que;
    REP(i,n){
      if(que.empty() || que.top() > v[i].first){
        ans++;
      }else{
        que.pop();
      }
      que.push(v[i].second);
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod 			1000000007
#define tc(t) 			int t;cin >> t;while(t--)
#define for0(i , n)		for(int i=0;i<n;i++)
#define loop(i , a, b)	for(int i=a;i<=b;i++)
#define endl 			'\n'
#define inf 			1e18
#define fi 				first
#define se 				second

int XX[8] = { +1, +1, +1, 0, 0, -1, -1, -1};
int YY[8] = { +1, 0, -1, +1, -1, +1, 0, -1};
int dx[4] = { -1, 1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int wt[101], val[101];
int dp[101][100001];
int n, w;

int knapsack(int ind, int v) {
	if (ind == n and v == 0) return 0;
	if (ind == n or v < 0) return inf;
	if (dp[ind][v] != -1) return dp[ind][v];
	return dp[ind][v] = min(wt[ind] + knapsack(ind + 1, v - val[ind]), knapsack(ind + 1, v));
}

signed main() {

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

#ifndef ONLINE_JUDGE
	freopen("input.txt" , "r" , stdin);
	freopen("output.txt" , "w" , stdout);
#endif

	cin >> n >> w;

	int sum = 0;

	for0(i, n) {
		cin >> wt[i] >> val[i];
		sum += val[i];
	}

	memset(dp, -1, sizeof(dp));

	for (int i = sum; i >= 0; i--) {
		if (knapsack(0, i) <= w) {
			cout << i << endl;
			return 0;
		}
	}

	return 0;
}

Measured memory_bytes: 82552
#include "iostream"
#include "string"
#include "algorithm"
using namespace std;

int main()
{
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	const int lower=max(A, C);
	const int upper = min(B, D);
	cout << max(0,upper - lower) << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<map>
using namespace std;
int main() {
	map<char, char>low;
	char C = 'A';
	for (char c = 'a'; c <= 'z'; c++) {
		low[c] = c;
		low[C] = c;
		C++;
	}
	string str; cin >> str;
	string s, st;
	int ans = 0;
	while (cin >> st) {
		if (st == "END_OF_TEXT") {
			cout << ans << endl;
			break;
		}
		else {
			for (int i = 0; i < st.size(); i++)s += low[st[i]];
			if (str == s)ans++;
			s = "";
		}
	}
	cin >> st;
}

Measured memory_bytes: 3184
class City:
    def __init__(self, prefecture, year):
        self.prefecture = prefecture
        self.year = year
        self.order = None

    def __eq__(self, other):
        if self.year == other.year:
            return True
        return False

    def __le__(self, other):
        if self.year <= other.year:
            return True
        return False

    def __lt__(self, other):
        if self.year < other.year:
            return True
        return False

    def __ge__(self, other):
        if self.year >= other.year:
            return True
        return False

    def __gt__(self, other):
        if self.year > other.year:
            return True
        return False


cities = []
n,m=[int(i) for i in input().split()]
prefecture=[[] for i in range(n+1)]



for i in range(m):
    p,y=[int(j) for j in input().split()]
    new_city=City(p, y)
    cities.append(new_city)
    prefecture[p].append(new_city)

for pref_list in prefecture:
    pref_list.sort()
    for i ,pref in enumerate(pref_list):
        pref.order=i+1

for city in cities:
    print(str(city.prefecture).zfill(6)+str(city.order).zfill(6))




Measured memory_bytes: 42968
E = input()
N = len(E)
ans = ""

for i in range(2**(N-1)):
    bi = bin(i)[2:].zfill(N-1)
    op = ["-"] * (N-1)
    for j, b in enumerate(bi):
        if b == "1":
            op[j] = "+"
    su = E[0]
    for o, e in zip(op, E[1:]):
        su += o + e
    if eval(su) == 7:
        ans = su + "=7"
        break

print(ans)





























# for n in range(2**(N-1)):
    # s = 0
    # ans = []
    # B = bin(n)[2:]
    # while len(B) < N - 1:
        # B = "0" + B
    # ans += "{:s}".format(E[0])
    # s += int(E[0])
    # for i, e in enumerate(E[1:]):
        # if B[i] == "0":
            # ans += "{:s}".format("-")
            # s -= int(e)
        # else:
            # ans += "{:s}".format("+")
            # s += int(e)
        # ans += "{:s}".format(e)
    # if s == 7:
        # ans += "=7"
        # print(*ans, sep="")
        # break
            

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
int main()
{
    int n, l;
    cin >> n >> l;
    vector<string> s(n);
    rep(i, n) cin >> s[i];
    sort(all(s));
    rep(i, n) cout << s[i];
    cout << endl;
    return 0;
}

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

int main() {
  int N;
  string type = "Three";
  cin >> N;
  
  for (int i = 0; i < N; i++) {
    string s;
    cin >> s;
    if (s == "Y") {
      type = "Four";
      break;
    }
  }
    
  cout << type << endl;
}

Measured memory_bytes: 256
/*******************************
 * written by Koki Riho
 * Rih0z https://github.com/Rih0z
 *******************************/

#include<iostream>
#include<map>
#include<vector>
#include<string>
#include<numeric>
#include<algorithm>

#define DEBUG false

#define FOR(i , a, b) for(size_t i = a ; i < b ; i++ )
#define REP(i,b) FOR(i , 0 , b)
#define RFOR(i,a,b) for(size_t i = a-1 ; i >= b ; i--)
#define RREP(i,a) RFOR(i,a,0)



typedef long long ll;
using namespace std;

int scanInt(void);
string scanString(void);

void scanLlArr(ll *a , int n);
void scanCharArr(char *string);

void printInt(int p);
void printLlArr(ll *a);
void printCharArr(char *string);


void perSum(ll *a , ll *sum ,int n);

/*************Global variable  **************/
int N ;
char str[26];
std::map<char,int> M ;
int T ;
int ans = 1000;
int c,t;
bool set= false;
/*******************************/

int main(){
  if (DEBUG){
    std::printf("******debug mode********\n");
  }
  cin >> N >> T ;
  REP(i,N){
    cin >> c >> t ;
    if( t <= T )
    {
      if(ans >= c){
        ans = c ;
        set = true ;
      }
    }
  }
  if(set){
    cout << ans <<endl;
  }else{
    cout << "TLE" << endl;
  }


  if (DEBUG){
    std::printf("******debug********\n");

    std::printf("******debug********\n");
  }
  return 0 ;
}

//各地点までの部分和を計算する
void perSum(ll *a , ll *sum ,int n){
  int i ;
  sum[0] = a[0];
  for(i = 1 ; i < n ; i++){
    sum[i] = a[i] + sum[i-1];
  }

}


Measured memory_bytes: 256
import java.util.*;
 
public class Main {
	
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	int X = -1;
    	for (int i = 1; i <= 50000; i++) {
    		if ((i*108)/100 == N) {
    			X = i;
    		}
    	}
    	System.out.println(X != -1 ? X : ":(");
    }
}

Measured memory_bytes: 23124
import java.util.*;

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

    int Tsum = 0 ;
    int[] T = new int[ N ];
    for(int i = 0 ; i < N ; i ++){
      T[i] = sc.nextInt();
      Tsum = Tsum + T[i] ;
    }

    int M = sc.nextInt();
    int[] result = new int[ M ];
    for(int i = 0 ; i < M ; i ++){
      int P = sc.nextInt();
      int X = sc.nextInt();

      result[ i ] = Tsum - T[ P - 1 ] + X ;
    }
    
    for(int i = 0 ; i < M ; i ++){
      System.out.println(result[i]);
    }
  }
}


Measured memory_bytes: 21844
package main

import (
	"fmt"
	"math"
	"strings"
)

func main() {
	n := SInt()
	if n%2 == 1 {
		fmt.Println((float64(n/2) + 1) / float64(n))
	} else {
		fmt.Println(float64(n/2) / float64(n))
	}

	// var re int
	// fmt.Println()
}

func SInt() int {
	var n int
	fmt.Scan(&n)
	return n
}

func DInt() (int, int) {
	var n int
	fmt.Scan(&n)

	var m int
	fmt.Scan(&m)
	return n, m
}

func SStr() string {
	var s string
	fmt.Scan(&s)
	return s
}

func SIntSlice(n int) []int {
	re := make([]int, 0, n)
	for i := 0; i < n; i++ {
		re = append(re, SInt())
	}
	return re
}

func StrSlice() []string {
	var s string
	fmt.Scan(&s)
	return strings.Split(s, "")
}

func Min(nums ...int) int {
	if len(nums) == 0 {
		panic("function min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func Max(nums ...int) int {
	if len(nums) == 0 {
		panic("function max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

type Int64Slice []int64

func (p Int64Slice) Len() int           { return len(p) }
func (p Int64Slice) Less(i, j int) bool { return p[i] < p[j] }
func (p Int64Slice) Swap(i, j int)      { p[i], p[j] = p[j], p[i] }

type IntSlice []int

func (p IntSlice) Len() int           { return len(p) }
func (p IntSlice) Less(i, j int) bool { return p[i] < p[j] }
func (p IntSlice) Swap(i, j int)      { p[i], p[j] = p[j], p[i] }

// An IntHeap is a min-heap of ints.
type IntHeap []int

func (h IntHeap) Len() int           { return len(h) }
func (h IntHeap) Less(i, j int) bool { return h[i] > h[j] }
func (h IntHeap) Swap(i, j int)      { h[i], h[j] = h[j], h[i] }

func (h *IntHeap) Push(x interface{}) {
	// Push and Pop use pointer receivers because they modify the slice's length,
	// not just its contents.
	*h = append(*h, x.(int))
}

func (h *IntHeap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}


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

int main(){
  int a,b;
  cin>>a>>b;
  if(a>=13){
    b=b;
  }
  else if(a>=6 && a<=12){
    b=b/2;
  }

  else{
    b=0;
  }

  cout<<b<<endl;
  
}

Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as B
import           Data.Char

main :: IO ()
main = do
  n <- B.getLine
  putStrLn $ if solve n then "Yes" else "No"

solve :: B.ByteString -> Bool
solve = (== 0) . B.foldl' f 0
 where
   f r c = (r + digitToInt c) `rem` 9

Measured memory_bytes: 4184
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
# define ll int64_t
# define f first
# define s second
# define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
# define mod 1000000007
# define pb push_back
# define N (ll)100000
#define forab(i,a,b,c) for(ll (i) = a ; (i) <= (b) ; (i)+=(c))
# define inputs ll n;cin>>n;ll q;cin>>q;ll a[n];forab(i,0,n-1,1)cin>>a[i];
#define forabr(i,a,b,c) for(ll (i) = a ; (i) >= (b) ; (i)-=(c))
# define print forab(i,0,n-1,1)cout<<a[i]<<" ";
ll dp[1000+5][1000+5],n,m;char a[1000+5][1000+5];
ll f(ll i,ll j){
if(i==n-1&&j==m-1){
    return 1;
}
if(dp[i][j]!=-1)return dp[i][j];
ll x=0,y=0;
if(j+1<m&&a[i][j+1]=='.')
    x=f(i,j+1)%mod;
if(i+1<n&&a[i+1][j]=='.')
y=f(i+1,j)%mod;
y=y%mod;x=x%mod;
return dp[i][j]=(x+y)%mod;
}
int main(){
cin>>n>>m;
forab(i,0,n-1,1){
forab(j,0,m-1,1){
cin>>a[i][j];
}
}
forab(i,0,n-1,1)
forab(j,0,m-1,1)dp[i][j]=-1;
cout<<f(0,0);
}

Measured memory_bytes: 9088
#include<stdio.h>
#include<stdlib.h>
int main(void){
  char S[4];
  scanf("%s %s %s %s",&S[0],&S[1],&S[2],&S[3]);
if((S[0]==S[1] && S[2]==S[3]) ||(S[0]==S[2] &&S[1]==S[3]) ||(S[0]==S[3] && S[1]==S[2])){
  if(S[0]==S[1] && S[1]==S[2]&&S[2]==S[3]){
    printf("No");
  }
  else{
    printf("Yes");
  }
}
  else{
    printf("No");
  }
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

int main(void)
{
    IOS
    int n; cin >> n;
    string s; cin >> s;

    int ans = 1;
    REP(i,n-1) {
        if (s[i] != s[i+1]) ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<ext/numeric>

using namespace std;
using namespace __gnu_cxx;

const int MAX = 1e5 + 5, MOD = 1e9 + 7;

#define CLR(a,v) memset(a,v,sizeof(a))

int n, memo[55][3][3];
string s1, s2;

void fixMod(int &x) {
	if (x >= MOD)
		x -= MOD;
}

int solve(int i, int c1, int c2) {
	if (i == n)
		return 1;
	int &ret = memo[i][c1][c2];
	if (~ret)
		return ret;
	ret = 0;
	if (s1[i] == s2[i]) {
		for (int j = 0; j < 3; ++j)
			if (i == 0 || (j != c1 && j != c2)) {
				ret += solve(i + 1, j, j);
				fixMod(ret);
			}
//	if (i == 0) {
//		ret = solve(i + 1, 0, 0) + solve(i + 1, 1, 1);
//		fixMod(ret);
//		ret += solve(i + 1, 2, 2);
//		fixMod(ret);
//	} else

	} else {
		for (int j = 0; j < 3; ++j)
			for (int k = 0; k < 3; ++k)
				if (j != k && (i == 0 || (j != c1 && k != c2))) {
					ret += solve(i + 2, j, k);
					fixMod(ret);
				}
	}
	return ret;
}

int main() {
	cin >> n >> s1 >> s2;
	CLR(memo, -1);
	cout << solve(0, 0, 0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x)  x.begin(),x.end()
#define vi vector<int>
#define vll vector<ll>
#define print(x) for(auto it=x.begin();it!=x.end();it++) cout<<*it<<' '; cout<<'\n';
#define debug(a,b,c) cout << a << " " << b << " " << c << endl;
#define in(x,n) for(int e=0;e<n;e++){int y;cin>>y;x.pb(y);}
#define inl(x,n) for(int e=0;e<n;e++){ll y;cin>>y;x.pb(y);}
#define lower(sl)  transform(sl.begin(), sl.end(), sl.begin(), ::tolower); 

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
      int n,k;
      cin >> n >> k;
      vi a;
      in(a,n);
      sort(all(a));
      int s = 0;
      for(int i=0;i<k;i++){
            s+=a[i];
      }
      cout << s;
}


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

#define read(num) scanf("%d", &num)
#define readll(num) scanf("%lld", &num)
#define read2(num1, num2) scanf("%d%d", &num1, &num2)
#define read3(num1, num2, num3) scanf("%d%d%d", &num1, &num2, &num3)
#define reads(str) scanf("%s", str)
#define readc(ch) scanf("%c", &ch)

#define pb push_back
#define mp make_pair

#define pii pair<int, int>
#define vi vector<int>
#define ll long long


int main()
{
    double r;
    cin>>r;
    double pi=3.141592653589793238462643383279;
    double k=2.00000000000000;
    cout<<setprecision(9)<<(2*pi*r);
}


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

typedef long long ll;
typedef pair<int,int> P;
typedef map<int,int> M;
typedef vector<int> V;
typedef queue<int> Q;
typedef pair<long,long> PLL;
typedef map<long,long> MLL;
typedef vector<long long> VLL;
typedef vector<pair<int,int>> VP;
typedef vector<vector<int>> VV;
#define INF (int)(1e9+1)
#define MAXX (int)1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define MOD (ll)(1e9+7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define PRALL(a) a.begin(),a.end(),greater<pair<int,int>>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
//ceil(a/(double)b)=(a+b-1)/b
//printf("myco\n");//for debug
/*--------------------------------------------*/
int main(){
    int n;cin>>n;
    V h(n);rep(i,n)cin>>h[i];
    bool ok=true;
    for(int i=0;i<n-1;i++){
        if(i==0){
            if(h[i+1]-h[i]<-1)ok=false;
            else if(h[i+1]-h[i]==-1||h[i+1]-h[i]==0)h[i]--;
        }
        else{
            if(h[i+1]-h[i]<-1)ok=false;
            else if(((h[i+1]-h[i]==-1)&&(h[i]-1>=h[i-1]))||((h[i+1]-h[i]==0)&&(h[i]-1>=h[i-1])))h[i]--;
            if(h[i+1]<h[i-1])ok=false;
        }
        if(!ok){
            //cout<<i<<" "<<h[i-2]<<" "<<h[i]<<" "<<h[i+1]<<endl;
            break;
        }
    }
    cout<<(ok?"Yes":"No")<<endl;
}




Measured memory_bytes: 640
n,w=map(int,input().split())
w1,v1=map(int,input().split())
l1=[v1]
l2=[]
l3=[]
l4=[]
for _ in range(n-1):
    p=[int(i) for i in input().split()]
    if p[0]==w1:
        l1.append(p[1])
    if p[0]==w1+1:
        l2.append(p[1])
    if p[0]==w1+2:
        l3.append(p[1])
    if p[0]==w1+3:
        l4.append(p[1])
l1.sort()
l2.sort()
l3.sort()
l4.sort()
l1.reverse()
l2.reverse()
l3.reverse()
l4.reverse()
ans=0
for a in range(len(l1)+1):
    for b in range(len(l2)+1):
        for c in range(len(l3)+1):
            for d in range(len(l4)+1):
                if a*w1+b*(w1+1)+c*(w1+2)+d*(w1+3)<=w:
                    ans=max(ans,sum(l1[:a])+sum(l2[:b])+sum(l3[:c])+sum(l4[:d]))
print(ans)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,k,x,y;

int main(){
  ll ans=0;
  cin >> n>>k ;
  string s;
  cin>>s;
  ll m=0,h=0;
  
  REP(i,n-1){
	  if (s[i]=='R'){
		  if (s[i+1]=='L'){
			  //mukaiai
			  m++;
		  }else{
			  ans++;
		  }
	  }
	  
	  if (s[i]=='L'){
		  if (s[i+1]=='R'){
			  //hanten
			  h++;
		  }else{
			  ans++;
		  }
	  }

  }


  REP(i,k){
	  if ((m>0)&(h>0)){
		ans+=2;
		m--;
		h--;
	  }else{
		  if ((m!=0)|(h!=0)){
			  ans+=1;
			  m=0;
			  h=0;
		  }
	  }

	  
  }

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

Measured memory_bytes: 512
#include<cstdio>
#include<iostream>
#include<cstring>
#define RG register
#define LL long long
using namespace std;
const LL mod=1e9+7;
int n,m;
LL dp[305][305][305];
inline int read(){
    char ch=getchar(); int x=0, f=1;
    while(ch<'0' || ch>'9'){if(ch=='-') f=-1; ch=getchar(); }
    while(ch>='0' && ch<='9'){x=x*10+ch-'0'; ch=getchar();  }
    return x*f;}
int main()
{
//  freopen("Road of the King.in","r",stdin);
    //freopen(".out","w",stdout);
    n=read(); m=read();
    dp[0][1][1]=1;
    for(RG int i=0;i<m;i++)
     for(RG int j=1;j<=n;j++)
      for(RG int k=1;k<=j;k++)
      {
            (dp[i+1][j+1][k]+=dp[i][j][k]*(n-j))%=mod;
            (dp[i+1][j][k]+=dp[i][j][k]*(j-k))%=mod;
            (dp[i+1][j][j]+=dp[i][j][k]*k)%=mod;
      }
    printf("%lld\n",dp[m][n][n]);
    //fclose(stdin); fclose(stdout);
    return 0;
}

Measured memory_bytes: 218624
s = input()
if not s[0]=="A":
  print("WA")
elif not s[1].islower():
  print("WA")
else:
  cnC = 0
  for i in range(2,len(s)-1):
    if s[i]=="C":
      cnC += 1
    elif s[i].isupper():
      print("WA")
      quit()
  if cnC==1 and s[len(s)-1].islower():
    print("AC")
  else:
    print("WA")

Measured memory_bytes: 3064
import sys
input = sys.stdin.readline
'''
allinputs = iter(input().splitlines())
input = lambda : next(allinputs)
#'''
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if e - a > k:
	print(':(')
else:
	print('Yay!')
	

Measured memory_bytes: 38256
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define endl '\n'
#define MOD 1000000007
int main()
{
    ll h,w;
    cin>>h>>w;
    char a[h][w];
    for(ll j=0;j<h;j++)
    {
        for(ll k=0;k<w;k++)
        {
            cin>>a[j][k];
        }
    }
    vector <vector <ll> >dp (h+1,vector<ll> (w+1)) ;
    dp[1][1]=1;
    for(ll j=0;j<=h;j++)
    {
        for(ll k=0;k<=w;k++)
        {
            if(j==0 || k==0)dp[j][k]=0;
            else if(j==1 && k==1)continue;
            else if(a[j-1][k-1]=='#')dp[j][k]=0;

            else dp[j][k]=((dp[j-1][k]%MOD)+(dp[j][k-1]%MOD))%MOD;
        }
    }
    cout<<dp[h][w]%MOD<<endl;

    return 0;
}


Measured memory_bytes: 9088
#include <stdio.h>

int main()
{
  int n, a;
  int sum = 0;
  int min_odd = 100;
  int count_odd = 0;

  scanf("%d", &n);

  while (n--) {
    scanf("%d", &a);
    sum += a;
    if (a % 2) {
      if (a < min_odd) min_odd = a;
      count_odd++;
    }
  }
  
  count_odd % 2 ? printf("%d\n", (sum - min_odd) / 2) : printf("%d\n", sum / 2);

  return 0;
}



Measured memory_bytes: 2088
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
constexpr ll mod = 1000000007;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int a, b, t;
	cin >> a >> b >> t;
	cout << t / a * b;
	
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

def count(val1, val2):
    num = 1
    while True:
        if val1 < (val2 ** num):
            break
        num += 1

    cnt = 0
    digit = num
    while True:
        if val1 >= val2 ** digit:
            val1 -= val2 ** digit
            cnt += 1
        else:
            digit -= 1
        
        if digit== 0:
            break

    return cnt,val1


N = int(input())
ans = N

for i in range(0,N+1):
    n = i
    m = N - i
    res = 0

    cnt, nn = count(n, 9)
    n = nn
    res += cnt

    cnt, mm = count(m, 6)
    m = mm
    res += cnt

    res += n + m
    ans = min(ans, res)

print(ans)


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

int main() {
  int N;
  vector<int> value(N);
  vector<int> cost(N);
  vector<int> margin(N);
  
  cin >> N;
  
  for(int i=0; i<N; i++){
    cin >> value.at(i);
  }
  
  for(int j=0; j<N; j++){
    cin >> cost.at(j);
  }
  
  for(int k=0; k<N; k++){
    margin.at(k) = value.at(k) - cost.at(k);
  }
  
  int ans = 0;
  
  for(int l=0; l<N; l++){
    if(margin.at(l) > 0){
      ans += margin.at(l);
    }
  }
  
  cout << ans << endl;
  
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define mod 1000000007
#define int long long int
#define phi 1.6180339
#define rep(i,n) for(auto i=0;i<(n);i++)
#define endl "\n"
#define For(i,a,b) for(auto i=(a);i<(b);i++)
#define op1 cin.tie(NULL)
#define op2 cout.tie(NULL)
#define op3 std::ios_base::sync_with_stdio(false)
#define MAXX 1000001
using namespace std;
vector<int> arr(MAXX);
void trozen()
{
    vector<int> v1(3);
    for(auto &i:v1) cin>>i;
    sort(v1.begin(),v1.end());
    int ans=v1[0]+v1[1];
    cout<<ans<<endl;
}
int32_t main()
{
    op1;op2;op3;
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/
    trozen();
    return 0;
}


Measured memory_bytes: 10904
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
 
#pragma GCC optimize("Ofast")
//#pragma GCC optimization("unroll-loops, no-stack-protector")
//#pragma GCC target("avx,avx2,fma")
 
using namespace std;

using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
template<typename T>
using pair2 = pair<T, T>;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define endl '\n';
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
template <class T> inline T gcd(T a, T b) { while (b) { a %= b; swap(a, b); } return a; }
template <class T> inline T lcm(T a, T b) { return a * b / gcd(a, b); }

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__);fflush(stderr);
#else
    #define eprintf(...) 42
#endif

clock_t startTime;
double getCurrentTime() {
    return (double)(clock() - startTime) / CLOCKS_PER_SEC;
}

const ll MOD = 998244353, INF = (ll)1e18;;
ll add(ll x, ll y) {
    x += y;
    if (x >= MOD) return x - MOD;
    return x;
}
ll sub(ll x, ll y) {
    x -= y;
    if (x < 0) return x + MOD;
    return x;
}
ll mul(ll x, ll y) {
    return (x * y) % MOD;
}
ll bin_pow(ll x, ll p) {
    if (p == 0) return 1;
    if (p & 1) return mul(x, bin_pow(x, p - 1));
    return bin_pow(mul(x, x), p / 2);
}

const int N = 200100;
ll n, k;
vector <pll> q;
ll p[N], dp[N];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    startTime = clock();
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    
    cin >> n >> k;
    for (int i = 0; i < k; ++i) {
        int l, r;
        cin >> l >> r;
        q.push_back({l, r});
    }
    
    dp[1] = 1;
    p[1] = 1;
    for (int i = 2; i <= n; ++i) {
        for (auto [l, r] : q) {
            dp[i] = add(dp[i], sub(p[max(i - l, 0ll)], p[max(i - r - 1, 0ll)]));
        }
        p[i] = add(p[i - 1], dp[i]);
    }
    cout << dp[n] << endl;
    
    return 0;
}


Measured memory_bytes: 6784
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;

int main() {
    string S;
    cin>>S;
    if(S=="ABC") cout<<"ARC"<<endl;
    else cout<<"ABC"<<endl;
}



Measured memory_bytes: 3596
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <utility>
using namespace std;
int main() {
  unsigned long n, p;
  cin >> n >> p;
  vector<pair<unsigned long, unsigned long>> factors;
  // prime factorize p
  for(unsigned long i=2;i<=p;i++) {
    unsigned long j = 0;
    if (i > sqrt(p)) {
      if (i < p) {
        factors.push_back({p, 1});
      }
      break;
    }
    for(j=0;p%i == 0;j++) {
      p = p/i;
    }
    if (j > 0) {
      factors.push_back({i, j});
    }
  }
  unsigned long max_factor = 1;
  for(pair<unsigned long, unsigned long> factor_pair : factors) {
    unsigned long factor = get<0>(factor_pair);
    unsigned long exp = get<1>(factor_pair);
    unsigned long mult = static_cast<unsigned long>(exp/n);
    unsigned long mult_factor = powl(factor, mult);
    if (exp >= n) {
      max_factor *= mult_factor;
    }
    //    printf("%lu %lu => %lu ^ %lu = %lu\n", factor, exp,
    //           factor, mult, mult_factor);
  }
  printf("%lu\n", max_factor);
  return 0;
}


Measured memory_bytes: 256
/* ＵＴＦ－８ */
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}
	
	int A, B;
	std::cin >> A >> B;
	if (A == 1) A = 14;
	if (B == 1) B = 14;
	if (A > B)
		std::cout << "Alice\n";
	else if (A < B)
		std::cout << "Bob\n";
	else
		std::cout << "Draw\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define ff first
#define ss second
///////////////////////////////////////////////////////////
const ll mod = 1e9 + 7 ;
ll multiply(ll a, ll b){ return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b) {     return ((a % mod) + (b % mod)) % mod; }
ll sub(ll a, ll b) { return ((a%mod) - (b % mod)+ mod) % mod ; }
//////////////////////////////////////////////////////////

void solve( ){
    ll n ;
    cin >> n ;
    if(n%2!=0){
        cout << 0 ;
        return ;
    }
//    ll cnt = 0 ;
//    for( int i = n ; i >= 1 ; i-=2){
//        int j = i ;
//        while(j%5==0){
//            cnt++;
//            j/=5;
//        }
//    }
    // 10 20 30 40 50 60 70 80 90 100
    ll ans = 0 ;
    ll step = 1 ;
    for(ll i = 5 ; i <= n ; i*=5){
            //cout << i << " " ;
            ll x= n ;
            ll d = 2*i ;
            ans += n/d ;
    }
    cout <<  ans   ;

}
int main(){
  // #ifndef ONLINE_JUDGE
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  // #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int test_case=1 ;
    //cin >> test_case ;
    for( int i = 1 ; i <= test_case ; i++){
        solve( );
    }
}


Measured memory_bytes: 256
require 'prime'
A, B, C = gets.chomp.split(" ").map(&:to_i)

def divisors(n)
  n.prime_division.inject([1]) do |ary, (p, e)|
    (0..e).map{ |e1| p ** e1 }.product(ary).map{ |a, b| a * b }
  end.sort
end

puts divisors(A.gcd(B))[-C]


Measured memory_bytes: 2300