akhauriyash/Code-Regression huggingface dataset:
#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()
using ll = long long;
using ull = unsigned long long;


int main(void)
{
    IOS
    int n,m; cin >> n >> m;
    vector<set<int>> vs(n+1);
    REP(i,m) {
        int u,v; cin >> u >>v;
        vs[u].emplace(v);
    }
    int s,t; cin >> s >> t;

    bool dp[3][100010];
    memset(dp,0,sizeof dp);
    dp[0][s] = 1;

    set<int> next(vs[s]);

    int ans = 1;
    while(true) {
        FOR(i,0,3) {
            set<int> tmp;
            //cerr << next.size() << endl;
            int j = i == 2 ? 0:i+1;
            for(auto x:next) {
                if (dp[j][x]!=1) {
                    dp[j][x] = 1;
                    tmp.insert(ALL(vs[x]));
                }
            }
            next = tmp;
        }
        if (dp[0][t]== 1) break;
        //cerr << next.size()<<endl;
        if (next.size() == 0) {
            ans = -1;
            break;
        }
        ans++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 12288
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <chrono>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef double db;

#define fr first
#define sc second
#define pb push_back
#define rep(i,x) for(ll i=0;i<x;i++)
#define rep1(i,x) for(ll i=1;i<=x;i++)
#define rrep(i,x) for(ll i=x-1;i>=0;i--)
#define rrep1(i,x) for(ll i=x;i>0;i--)

ll N,M;
ll l,r;
P p[300001];
ll bit[100002];

void add(ll i,ll a){
	i++;
	while(i<=M+1){
		bit[i]+=a;
		i+=(i&-i);	
	}
}

ll sum(ll i){
	ll res=0;
	i++;
	while(i>0){
		res+=bit[i];
		i-=(i&-i);
	}
	return res;
}

int main()
{
	cin>>N>>M;
	rep(i,N){
		cin>>l>>r;
		p[i]=P(l,r-l+1);
	}
	sort(p,p+N,
		[](P a,P b){
			return a.sc<b.sc;
		}
	);
	ll now=0;
	for(ll d=1;d<=M;d++){
		ll ans=0;
		while(now<N&& p[now].sc<=d){
			add(p[now].fr,1);
			add(p[now].fr+p[now].sc,-1);
			now++;
		}
		for(ll i=0;i<=M;i+=d) ans+=sum(i); 
		cout<<ans+N-now<<endl;
	}
}

Measured memory_bytes: 6400
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int X, A;
    cin >> X >> A;
    if (X < A) {
        cout << 0 << endl;
    } else {
        cout << 10 << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
// vector<int> vec(3); = vector<int> vec={0,0,0}
// vec.at()
// sort(num.begin(),num.end(), greater<int>());
// reverse(num.begin(),num.end());
// transform(a.begin(), a.end(), a.begin(), ::toupper);
 
// 切り上げ　a/b+1
//  1からNの総和　N*(N+1)/2
 
int main() {
  int x,y;
  cin >> x >> y;

  if(x+y >= 10){
  	cout << "error" << endl;
  }else{
  	cout << x+y << endl;
  }
  
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <list>
#include <vector>
#include <iterator>
#include <ctime>
#include <iomanip>
#include <cstdlib>
#include <random>
#include <cstdio>
#include <sstream>
#include <map>
#include <set>
#include <unordered_map> 
#include <unordered_set>
#include <chrono> 
#include <numeric> 

using llong = long long;
using ullong = unsigned long long;
#define FOR(i, s, n) for (int i = (s); i < (n); i++)
#define FORD(i, s, n) for (int i = (s); i > (n); i--)
#define FORW(i, s, n, p) for (int i = (s); i < (n); i += p)
#define FORDW(i, s, n, p) for (int i = (s); i > (n); i -= p)

using namespace std;

int main()
{

	int n;
	cin >> n;

	FOR(i, 0, n) {

		int temp; cin >> temp;
		if (temp % 2 == 0 && (temp % 3 && temp % 5))
			cout << "DENIED", exit(0);

	}

	cout << "APPROVED";

}

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

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()

using namespace std;

int main(){
    std::ios::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    rep(n) cin >> a[i];
    rep(n) cin >> b[i];

    int ans = 0;
    repp(k, 29){
        vector<int> aa(n), bb(n);
        int t = 1 << k;
        rep(n) aa[i] = a[i] % (t << 1);
        rep(n) bb[i] = b[i] % (t << 1);
        sort(all(aa));
        sort(all(bb));

        int cnt = 0;
        rep(n){
            decltype(aa)::iterator start = lower_bound(all(aa),  t    -bb[i]);
            decltype(aa)::iterator end   = lower_bound(all(aa), (t<<1)-bb[i]);
            cnt += (int)(end-start);
            start = lower_bound(all(aa), (t<<1)+t-bb[i]);
            end   = lower_bound(all(aa), (t<<2)-bb[i]);
            cnt += (int)(end-start);
        }

        if(cnt & 1) ans |= 1 << k;
    }
    cout << ans << endl;
}

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

typedef struct Eq{
     int location ,eq;
     }S;

 int pop1();
 S pop2();
 void push1(int);
 void push2(int,int);

 int S1[20000];
 S S2[20000];

 int top1=0;
 int top2=0;

 int main(){
     int i,j,n,add,sum=0;
     char C[20000];
     scanf("%s",C);
     n=strlen(C);
     for(i=0;i<n;i++){
           if(C[i]=='\\'){
                 push1(i);
                 }
           else if(top1>0&&C[i]=='/'){
                 j=pop1();
                 add=i-j;
                 sum+=add;
                 while(top2>0&&S2[top2-1].location>j){
                       add+=pop2().eq;
                       }
                 push2(j,add);
                 }
           }
     printf("%d\n",sum);
     printf("%d",top2);
     for(i=0;i<top2;i++){
            printf(" %d",S2[i].eq);
            }
     printf("\n");
     return 0;
     }

 void push1(int i){
     S1[top1]=i;
     top1++;
     }

 int pop1(){
     top1--;
     return S1[top1];
     }

 void push2(int j,int add){
     S2[top2].location=j;
     S2[top2].eq=add;
     top2++;
     }
 
 S pop2(){
     top2--;
     return S2[top2];
     }



Measured memory_bytes: 2148
import java.util.*;
public class Main{
    void run(){
        Scanner sc = new Scanner(System.in);
        int[] coins = { 500, 100, 50, 10, 5, 1};
        while(true){
            int price = sc.nextInt();
            if(price == 0){
                break;
            }
            int change = 1000 - price;
            int ans = 0;
            for(int c: coins){
                while(change >= c){
                    change -= c;
                    ans++;
                }
            }
            System.out.println(ans);
        }
    }
    public static void main(String[] args){
        new Main().run();
    }
}

Measured memory_bytes: 17164
#define _USE_MATH_DEFINES
#include <math.h>
#include <time.h>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <iomanip>
#include <iterator>
#include <algorithm>
#include <typeinfo>

using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)

#define PI M_PI
#define INF 1000000000
#define MOD 1000000007;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<bool>> vvb;
typedef vector<vector<string>> vvs;

constexpr int dir[4][2] = { { -1, 0 }, { 0, -1 }, { 1, 0 }, { 0, 1 } };



int main()
{
	int A, B, C, X;
	cin >> A >> B >> C >> X;
	int ans = 0;

	rep(a, A + 1)
	{
		rep(b, B + 1)
		{
			rep(c, C + 1)
			{
				if (a * 500 + b * 100 + c * 50 == X) ans++;
			}
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

ll n, ans = 0;

void check(ll m) {

    int flag3 = 0, flag5 = 0, flag7 = 0;

    while(m > 0) {

        if(m%10 == 3) {
            flag3 = 1;
        }
        else if(m%10 == 5) {
            flag5 = 1;
        }
        else if(m%10 == 7) {
            flag7 = 1;
        }

        m /= 10;
    }

    if(flag3 && flag5 && flag7) {
        ans++;
    }
}

void dfs(ll x) {

    if(n < x) {
        return;
    }

    check(x);

    dfs(10*x + 3);
    dfs(10*x + 5);
    dfs(10*x + 7);
}

int main() {

    cin >> n;

    dfs(0);

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

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int K, X;

  std::cin >> K >> X;

  for (int i = X - K + 1; i <= X + K - 1; i ++)
    std::cout << i << ' ';
  std::cout << std::endl;
  
  return 0;
}


Measured memory_bytes: 256
a,b = map(int,input().split())
s = input()
for i in range(a):
    if s[i] == '-':
        print('No')
        exit(0)

if s[a] != '-':
    print('No')
    exit(0)

for i in range(a+1,a+b):
    if s[i] == '-':
        print('No')
        exit(0)

print('Yes')

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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		double ans = 0;
		for (int i = 1; i <= n; i++) {
			int tmp = i;
			int cnt = 0;
			while (tmp < k) {
				tmp *= 2;
				cnt++;
			}
			ans += 1.0 / n * Math.pow(0.5, cnt);
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 21204
#include<bits/stdc++.h>
#define INF 2000000000
#define MOD 1000000007
#define EPS (1e-10)

using namespace std;

int main(int argc, char *argv[]) {
	int A,B; cin >> A >> B;
	int K; cin >> K;


	int cnt = 0;


	vector<int> ans(100);
	for (int i = 1; i <= 100; i++) {
		if (A % i == 0 and B % i == 0) {
			ans.push_back(i);
		}
	}
	cout << ans[ans.size() - K] << endl;
	return 0;
}


Measured memory_bytes: 256
N=int(input())

L=list(map(int,input().split()))
L.insert(0,0)

H=list()
for _ in range(N+1):
    H.append(0)
for i in range(1,N+1):
    H[L[i]]+=1
#print(H)

def culc(x):
    return x*(x-1)//2

A=0
for j in range(1,N+1):
    A+=culc(H[j])
#print(A)


for k in range(1,N+1):
    number=L[k]
    print(A-(H[number]-1))







Measured memory_bytes: 26140
N, M = map(int, input().split())
A = set(list(int(input()) for _ in range(M)))



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

for i in range(1, N+1):
    dp[i] = (dp[i-1] + dp[i-2])%(10**9+7)
    if i in A:
        dp[i] = 0
print(dp[-1])


Measured memory_bytes: 19044
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <map>
#include <unordered_map>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
using namespace std;

int main()
{
    ll n;
    cin >> n;
    ll ans = 1e18;
    for (int i = 1; i <= sqrt(n); ++i)
    {
        if (n % i == 0)
        {
            ans = min(i + (n / i) - 2, ans);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    lint n;
    cin >> n;
    lint ret = 1;
    for (lint i = 1; i <= n; ++i) {
        ret = (ret * i) % mod;
    }
    cout << ret << "\n";
    return 0;
}

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

//
#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0, sizeof(x))
#define mm(x) memset((x), -1, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;

// bit_macro
#define bit(n) (1LL << (n))
#define bitset(a, b) (a) |= (1 << (b))
#define bitunset(a, b) (a) &= ~(1 << (b))
#define bitcheck(a, b) ((((a) >> (b)) & 1) == 1)
#define bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
const int INF = (int)1e18;
const int MOD = (int)1e9 + 7;
const double PI = (double)acos(-1);
const double EPS = (double)1e-10;
const int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};

signed main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a == b && b == c) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <cmath>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  int c=0;
  if(a>=b){
    for(int i=0;i<=a-1;i++){
      c+=b*pow(10,i);
    }
    cout<<c<<endl;
  }
  else{
    for(int i=0;i<=b-1;i++){
      c+=a*pow(10,i);
    }
    cout<<c<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
//
// Created on 2020/05/22.
//


#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;


int main() {
    int a,b;
    cin>>a>>b;

    int ans = 0;

    if (a > b){
        ans += a;
        a --;
    }else{
        ans += b;
        b --;
    }
    if (a > b){
        ans += a;
        a --;
    }else{
        ans += b;
        b --;
    }
    cout<<ans<<endl;
    
    return 0;
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

struct UnionFindTree{
    vector<int>par,sz;
    UnionFindTree(int n){
        par.resize(n);
        sz.resize(n);
        for(int i=0;i<n;i++){
            par[i]=i;
            sz[i]=1;
        }
    }
    int find(int x){
        return x==par[x]?x:par[x]=find(par[x]);
    }
    void unite(int x,int y){
        x=find(x);y=find(y);
        if(x==y)return;
        if(sz[x]<sz[y])swap(x,y);
        sz[x]+=sz[y];
        par[y]=x;
    }
    bool areSame(int x,int y){
        return find(x)==find(y);
    }
    int size(int x){
        return sz[find(x)];
    }
};

signed main(){
    int N,M;
    cin>>N>>M;
    UnionFindTree uf(2*N);
    rep(i,M){
        int a,b;
        cin>>a>>b;
        a--;b--;
        uf.unite(a,b+N);
        uf.unite(a+N,b);
    }

    bool flag=true;
    rep(i,N)if(uf.areSame(i,i+N))flag=false;

    if(flag){
        int x=0;
        rep(i,N)if(uf.areSame(0,i))x++;

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


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
int main(){
  cout << fixed << setprecision(20);
  double x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  cout << sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
}


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

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; }

using ll = long long;
using lb = long double;
using P = pair<string,string>;
using graph = vector<vector<ll>>;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll INF = 1LL<<60;
const ll mod = 1000000007LL;

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

int main() {
  int N;
  string S;
  cin>>N>>S;
  string L,R;
  rep(i,N) L += S[i];
  rep(i,N) R += S[N*2-i-1];
  map<P,ll> m,n;
  rep(i,(1LL<<N)){
    string a,b,c,d;
    rep(j,N){
      if(i&(1LL<<j)) {
        a += L[j];
        c += R[j];
      }
      else {
        b += L[j];
        d += R[j];
      }
    }
    m[make_pair(a,b)]++;
    n[make_pair(c,d)]++;
  }
  ll ans = 0;
  for(auto x:m){
    ans += x.second*n[x.first];
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 89660
n=int(input())
w = list(map(int, input().split()))
total=0

for i in range(n):
    total+=w[i]
    
left=0
right=total
min_=total
    
for i in range(n):
    left+=w[i]
    right-=w[i]
    dif=abs(right-left)
    if min_>dif:
        min_=dif

print(min_)

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

typedef long long ll;
//const int INF = 2e9;
//const ll INF = 9e18;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int A, B, C;
    int K;
    cin >> A >> B >> C >> K;
    int ans = 0;
    if (A >= K) {
        ans = K;
    } else {
        K -= A;
        if (B >= K) {
            ans = A;
        } else {
            K -= B;
            ans = A - K;
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 3688
void main()
{
    long k, n;
    rdVals(k, n);
    long[] a = rdRow;

    long[] diff = new long[n];
    foreach (i; 0 .. n-1)
    {
        diff[i] = a[i+1] - a[i];
    }
    diff[n-1] = a[0] + k - a[n-1];

    diff.sort!"a < b";

    diff[0..n-1].sum.writeln;
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.mathspecial;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;
import core.bitop;

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

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

  vector<int> A(N);
  for (int &a : A) {
    cin >> a;
  }
  
  sort(A.begin(), A.end());
  A.erase(unique(A.begin(), A.end()), A.end());
  

  if (N != A.size()) {
    cout << "NO" << endl;
  } else {
    cout << "YES" << endl;
  }
  
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int a,b,c,d,e;
  cin>>a>>b>>c>>d>>e;
  int time=0;
  time+=c*60;
  time+=d;
  time-=a*60;
  time-=b;
  time-=e;
  cout<<time<<endl;

  return 0;
}


Measured memory_bytes: 3608
#include<iostream>
#include<vector>
#include<string>
#include<map>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M, X;
    cin >> N >> M >> X;
    vector<int> A(M);
    --X;
    for (auto& a : A) {
        cin >> a;
        --a;
    }
    map<int, bool> exists;
    for (auto& a : A) {
        exists[a] = true;
    }
    int ans = 1 << 30;
    int now_ans = 0;
    rep(i, X, N) {
        if (exists[i]) {
            ++now_ans;
        }
    }
    chmin(ans, now_ans);
    now_ans = 0;
    rrep(i, X + 1, 0) {
        if (exists[i]) {
            ++now_ans;
        }
    }
    chmin(ans, now_ans);
    cout << ans << endl;
    return 0;
}

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

const ll INF = 1e18;
ll dp[200005][4];

int main(){
	int n;
  	cin >> n;
  	vector<int> a(n);
  	rep(i, n) cin >> a[i];
  
  	int k = 1 + n % 2;
  	rep(i, n+1)rep(j, k+1) dp[i][j] = -INF;
  	dp[0][0] = 0;
  	
  	rep(i, n){
    	rep(j, k+1){
        	dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j]);
          	ll now = dp[i][j];
          	if((i+j)%2 == 0) now += a[i];
          	dp[i+1][j] = max(dp[i+1][j], now);
        }
    }
  
  	ll ans = dp[n][k];
  	cout << ans << endl;
}

Measured memory_bytes: 10336
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
const int INF = 2e9;
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

int main(){
    string a, b, c; cin >> a >> b >> c;

    int ac = 0;
    int bc = 0;
    int cc = 0;

    char player = 'a';
    string winner = "";

    while(1){
        if(ac > a.size()) winner = "A";
        if(bc > b.size()) winner = "B";
        if(cc > c.size()) winner = "C";

        if(winner != "") break;

        if(player == 'a'){
            player = a[ac];
            ac++;
            continue;
        }
        if(player == 'b'){
            player = b[bc];
            bc++;
            continue;
        }
        if(player == 'c'){
            player = c[cc];
            cc++;
            continue;
        }

    }

    cout << winner << endl;
}
    

Measured memory_bytes: 256
import java.util.Scanner;
class Main{
  public static void main(String... args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int x[] = new int[N];
    int y[] = new int[N];

    for(int i = 0; i < N; i++){
      x[i] = sc.nextInt();
      y[i] = sc.nextInt();
    }

    double sum = 0;
    //組み合わせ
    for(int i = 0; i < N-1; i++){
      for(int j = i+1; j < N; j++){
        sum += Math.sqrt(Math.pow(x[i]-x[j], 2) + Math.pow(y[i]-y[j], 2));
      }
    }
    System.out.println(2*sum/N);
  }
}


Measured memory_bytes: 23124
<?php
$n = intval(fgets(STDIN));
$A = 1;
$B = 1;
for($i = 0; $i < $n; $i++){
  fscanf(STDIN, "%d%d", $a, $b);
  $m = max(divceil($A,$a), divceil($B,$b));
  $A = $a*$m;
  $B = $b*$m;
}
printf("%ld", $A + $B);

function divceil($dividend, $divisor) {
	return intdiv($dividend, $divisor) + ($dividend % $divisor !== 0);
}

Measured memory_bytes: 4604
#include <iostream>
#include <utility>
#include <stdint.h>
#include <string>

using namespace std;

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

  int count = 0;
  for (int n=1; n<=N; ++n) {
    string s = to_string(n);
    if (s.size()%2)
      ++count;
  }
  
  cout << count << endl;

  return 0;
}


Measured memory_bytes: 256
fn solve() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let c: char = sc.chars()[0];
    let a = c as u32 + 1;
    println!("{}", std::char::from_u32(a).unwrap());
}

fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| solve())
        .unwrap()
        .join()
        .unwrap();
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


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

int n;
vector<vector<int>> g;
vector<bool> chk;
int ans;

void dfs(int pre, int crt)
{
  if (chk[crt])
    return;
  if (pre == -1)
    ans++;
  chk[crt] = true;
  for (int nxt : g[crt])
    if (nxt != pre)
      dfs(crt, nxt);
}

int main()
{
  int m;
  cin >> n >> m;
  g.resize(n);
  rep(i, m)
  {
    int x, y, z;
    cin >> x >> y >> z;
    x--;
    y--;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  chk.resize(n);
  fill(chk.begin(), chk.end(), false);
  ans = 0;
  rep(i, n)
    dfs(-1, i);
  cout << ans << endl;
}

Measured memory_bytes: 10368
#include<stdio.h>

int main(){
  int a[3][3],n,b,bingo[3][3]={{0,0,0},{0,0,0},{0,0,0}},flag=0;
  int i,j,k;
  for(i=0;i<3;i++){
    for(j=0;j<3;j++)
      scanf("%d",&a[i][j]);
  }
  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&b);
    for(j=0;j<3;j++){
      for(k=0;k<3;k++){
	if(b==a[j][k])
	  bingo[j][k]++;
      }
    }
  }
  for(i=0;i<3;i++){
    if(bingo[i][0]>0 && bingo[i][1]>0 && bingo[i][2]>0)
      flag++;
    else if(bingo[0][i]>0 && bingo[1][i]>0 && bingo[2][i]>0)
      flag++;
    else if(bingo[0][0]>0 && bingo[1][1]>0 && bingo[2][2]>0)
      flag++;
    else if(bingo[0][2]>0 && bingo[1][1]>0 && bingo[2][0]>0)
      flag++;
  }
  if(flag==0)
    printf("No");
  else
    printf("Yes");
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdint>

using namespace std;

int main()
{
	int64_t n;
	int64_t course_max[5];	/* 輸送人数 */
	int64_t timer = 0;
	int64_t nec = 10E15;

	cin >> n;
	for (int i = 0; i < 5; i++) {
		cin >> course_max[i];
		if (nec > course_max[i])
			nec = course_max[i];
	}

	timer = (int64_t)(n / (double)nec);
	if (n % nec != 0)
		timer++;
	if (timer < 1)
		timer = 1;
	timer += 4;
	
	cout << timer << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long ll;

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

template<typename T>T gcd(T a, T b){return b?gcd(b,a%b):a;}


int main() {
  int N, M; cin >> N >> M;

  ll a[N];
  rep(i, N)
    cin >> a[i];

  int count = -1;
  ll lcm = 1;
  rep(i, N) {
    int c = 1;
    while (a[i] % 2 == 0) {
      a[i] /= 2;
      c *= 2;
    }
    if (count == -1)
      count = c;
    else if (count != c) {
      cout << 0 << endl;
      return 0;
    }
    lcm = lcm / gcd(lcm, a[i]) * a[i];
    if (lcm > M) {
      cout << 0 << endl;
      return 0;
    }
  }
  cout << (M / (count/2 * lcm) + 1) / 2 << endl;

  return 0;
}

Measured memory_bytes: 1024
W,H,m,c[10][10];
DP[11][10][10][10][51];//cà[yÀW][xÀW][¶[][E[][_fcÊ]
#define Update(tgt,val) ((val)>(tgt)?tgt=(val):0)
CalcO(o,x,y){//_fcÊÌvZ
	if(c[x][y]>0){
		o+=c[x][y];
		if(o>m)
			o=m;
	}
	return o;
}
CalcF(f,x,y){//càÌvZ
	if(c[x][y]<0)
		f+=c[x][y];
	return f;
}
main(){
	int x,y,range,d,dx,f,o,xl,xr,fn,on,f0;
	for(;scanf("%d%d",&W,&H),W;){
		scanf("%d%d%d",&f0,&m,&o);
		for(y=0;y<H;y++)
			for(x=0;x<W;x++)
				scanf("%d",&c[x][y]);
		f0++;//cà0ÅàDPÍ1ÆµÄANAÉÈéÌðh®
		for(y=0,x=0;x<W;x++)
			DP[y][x][x][x][o]=f0;
		for(y=0;y<H;y++){
			for(range=0;range<W;range++){//¶EÉ@éL³
				for(o=m;o>1;o--){
					for(d=0;d<2;d++){//»ÝÊuxð³¹é
						for(xl=0;xl<W-range;xl++){//¶[
							for(dx=0;dx<=range;dx++){//xÏÊ
								xr=xl+range;
								x=d?xl+dx:xr-dx;
								//printf("range=%d, d=%d, xl=%d, dx=%d, xr=%d, x=%d\n",range,d,xl,dx,xr,x);
								if(f=DP[y][x][xl][xr][o]){
									//ºÖ@é
									fn=CalcF(f,x,y);
									on=CalcO(o-1,x,y);
									Update(DP[y+1][x][x][x][on],fn);
									if(y>0){
										if(x>0){
											if(x==xl){//¶Ö@é
												fn=CalcF(f,x-1,y-1);
												on=CalcO(o-1,x-1,y-1);
												Update(DP[y][x-1][x-1][xr][on],fn);
											}else{//¶ÖiÞ
												Update(DP[y][x-1][xl][xr][o-1],f);
											}
										}
										if(x<W-1){
											if(x==xr){//EÖ@é
												fn=CalcF(f,x+1,y-1);
												on=CalcO(o-1,x+1,y-1);
												Update(DP[y][x+1][xl][x+1][on],fn);
											}else{//EÖiÞ
												Update(DP[y][x+1][xl][xr][o-1],f);
											}
										}
									}
									//break;
								}
							}//dx
						}//xl
					}//d
				}//o
			}//range
		}//y
#if 0
		for(y=0;y<H;y++){
			for(x=0;x<W;x++){
				int fn=0,xln=9,xrn=9,on=0;
				for(xl=0;xl<W;xl++){
					for(xr=0;xr<W;xr++){
						for(o=m;o>0;o--){
							f=DP[y][x][xl][xr][o];
							//if(f)printf("DP[%d][%d<=%d<=%d][%2d]=%3d\n",y,xl,x,xr,o,f0-f);
							if(f>fn)
								fn=f,xln=xl,xrn=xr,on=o;
						}
					}
				}
				#if 1
				if(fn)
					printf("%4d[%d,%d,%3d] ",f0-fn,xln,xrn,on);
				else
					printf("              ");
				#endif
			}
			puts("");
		}
#endif
		fn=0;
		for(x=0;x<W;x++){
			for(xl=0;xl<W;xl++){
				for(xr=0;xr<W;xr++){
					for(o=m;o>0;o--){
						f=DP[H][x][xl][xr][o];
						if(f>fn)
							fn=f;
					}
				}
			}
		}
		printf(fn?"%d\n":"NA\n",f0-fn);
		memset(DP,0,sizeof(DP));
	}
	//puts("");
	exit(0);
}

Measured memory_bytes: 0
#include <iostream>
using namespace std;
void ABC60(void);
void ABC61(void);
void ABC62(void);
void ABC63(void);
void ABC64(void);
void ABC65(void);
void ABC66(void);
void ABC67(void);
void ABC68(void);
void ABC69(void);

int main(void){
    ABC62();
}

void ABC62(void){
    int a[6]={1,3,5,7,8,12};
    int b[4]={4,6,9,11};
    int x,y,k=0,d=0,i;
    cin>>x>>y;
    if(x==2)++d;
    if(y==2)++d;
    for(i=0;i<=3;++i){
        if(x==b[i])++k;
        if(y==b[i])++k;
    }
    if((d==0&&k==0)||d==2||k==2)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

int main() {
  int a;
  int b;
  cin >> a >> b;
  
  if (((a*b)%2)==0) {
    cout << "Even" << endl;
  }
  
  if (((a*b)%2)==1) {
    cout << "Odd" << endl;
  }
}

Measured memory_bytes: 256
/**
 * Title: B - Comparing Strings
 * Url: https://atcoder.jp/contests/abc152/tasks/abc152_b
 */
#include<bits/stdc++.h>

using namespace std;

#define ll long long

int main() {
    int a, b; cin >> a >> b;
    if(a>b) {
        for(int i=0; i<a; i++) {
            cout << b;
        }
    } else {
        for(int i=0; i<b; i++) {
            cout << a;
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
import java.math.*;
import java.io.*;
import java.util.*;

public class Main{
    public static void main(String[] args ) throws IOException{
    	FastReader fr = new FastReader();
    	int n = fr.nextInt();
    	if(n < 3){
    		System.out.println(0);
    	}
    	else{
    		int result = n/3;
    		System.out.println(result);
    	}
    }
}


class FastReader {
	  BufferedReader br;
	  StringTokenizer st;

	  FastReader() {
	    br = new BufferedReader(new InputStreamReader(System.in));
	  }

	  String next() {
	    while (st == null || !st.hasMoreTokens()) {
	      try {
	        st = new StringTokenizer(br.readLine());
	      } catch (IOException e) {
	        e.printStackTrace();
	      }
	    }
	    return st.nextToken();
	  }

	  int nextInt() {
	    return Integer.parseInt(next());
	  }

	  long nextLong() {
	    return Long.parseLong(next());
	  }

	  double nextDouble() {
	    return Double.parseDouble(next());
	  }

	  String nextLine() {
	    String str = "";
	    try {
	      str = br.readLine();
	    } catch (IOException e) {
	      e.printStackTrace();
	    }
	    return str;
	  }
	}

	//source: http://www.geeksforgeeks.org/fast-io-in-java-in-competitive-programming/


Measured memory_bytes: 22612
#include<stdio.h>

int main(void){

  int a,b,c,tmp;

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

  if(a>b){
	tmp = a;
	a=b;
	b=tmp;
}

  if(b>c){
	tmp=b;
	b=c;
	c=tmp;
}

  if(a>b){
	tmp = a;
	a=b;
	b=tmp;
}
  
  printf("%d %d %d\n",a,b,c);

  return 0;
}

Measured memory_bytes: 1752
MAX_N = 10 ** 5
dp = list(range(MAX_N+1))
for t in (6,9):
    v = t
    while v < MAX_N:
        for i in range(MAX_N + 1):
            if i + v < len(dp):
                dp[i+v] = min(dp[i+v], dp[i] + 1)
        v *= t
print(dp[int(input())])

Measured memory_bytes: 8948
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
	int q1,b,c1,c2,q2;
	while(cin >> q1 , q1){
		cin >> b >> c1 >> c2 >> q2;
		int now = q2 * c1;
		while(now>b){
			now -= c1;
			q2--;
		}
		while(q2+(b-now)/c2 < q1 && q2 > 0){
			now -= c1;
			q2--;
		}
		if(q2>0){
			cout << q2 << " " << (b-now)/c2 << endl;
		}else{
			cout << "NA" << endl;
		}
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <math.h> 
#include <string>
#include <iomanip>
using namespace std;
int main(){
    int x;
    cin >> x;
    int ans = -1;
    int a, b;
    
    for(int i = 1; i < 50; i++){
        for(int j = 2; j < 10; j++){
            if(pow(i, j) > ans and pow(i, j) <= x){
                ans = pow(i,j);
                //cout << i << " " << j << " " << pow(i,j) << " " << ans << endl;
                a = i;
                b = j;
            }
        }
    }
    if(x == 1 or x == 2) {
        a = 1;
        b = 1;
    }

    cout << pow(a,b) << endl;
}

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

using ll = long long;
constexpr ll inf = static_cast<ll>(1e17);
constexpr ll mod = static_cast<ll>(1e9 + 7);

int x, y, z, k;
ll a[1005], b[1005], c[1005];
ll sum[10000005];
int num;
int main()
{
	std::cin >> x >> y >> z >> k;
	for (int i = 0; i < x; ++i)
		std::cin >> a[i];
	for (int i = 0; i < y; ++i)
		std::cin >> b[i];
	for (int i = 0; i < z; ++i)
		std::cin >> c[i];

	std::sort(a, a + x, std::greater<ll>());
	std::sort(b, b + y, std::greater<ll>());
	std::sort(c, c + z, std::greater<ll>());

	for (int i = 0; i < x; ++i)
		for (int j = 0; j < y; ++j)
			for (int l = 0; l < z; ++l)
				if ((i + 1)*(j + 1)*(l + 1) <= k)
					sum[num++] = a[i] + b[j] + c[l];

	std::sort(sum, sum + num, std::greater<ll>());
	for (int i = 0; i < k; ++i)
		std::cout << sum[i] << std::endl;
	return 0;
}


Measured memory_bytes: 1152
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <bitset>
#include <vector>
using namespace std;
int main()	
{
	int n, t,a,h;
	cin >>n>>t>>a;
	int ans = 0; int distans = 10000000;
	for (int i = 0; i < n; i++) {
		cin >> h;
		int m = t*1000 - h *6;
		if (distans >= abs(a*1000 - m)) {
			distans = abs(a*1000 - m);
			ans = i + 1;
		}

	}
	cout << ans << endl;
}


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

int main() {
   int a, b;
   cin >> a >> b;

   if (a+b < 24) {
       cout << a + b << endl;
   } else {
       cout << a + b - 24 << endl;
   }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ll long long
#define ull unsigned long long
#define nl '\n'
#define INF 1e9 + 5
#define f(i, n) for (int i = 0; i < n; ++i)

using namespace std;
void solve() {
    int n;
    cin >> n;
    cout << (n == 0 ? 1 : 0) << nl;
}

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

Measured memory_bytes: 3644
import java.util.*

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val n = scanner.nextInt()
    val x = scanner.nextLong()
    val burgerSize = arrayListOf(1L)
    val numOfPatty = arrayListOf(1L)
    for (i in 1..n) {
        burgerSize.add(burgerSize[i-1] * 2 + 3)
        numOfPatty.add(numOfPatty[i-1] * 2 + 1)
    }
    
    fun calc(n: Int, x: Long): Long {
        if (n == 0) return 1
        if (x <= n) return 0
        if (x == burgerSize[n]) return numOfPatty[n]

        val center = (burgerSize[n] + 1).div(2L)
        return when {
            x < center -> calc(n - 1, x - 1)
            x > center -> numOfPatty[n - 1] + 1 + calc(n - 1, x - burgerSize[n - 1] - 2)
            else -> numOfPatty[n - 1] + 1
        }
    }
    print(calc(n, x))
}

Measured memory_bytes: 31524
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pb emplace_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define F first
#define S second
#define vll vector<ll>
#define fast ios:: sync_with_stdio(false),cin.tie(0);
#define COUT cout<<fixed<<setprecision(12)
#define SET set<ll,greater<ll>>gquiz
#define ITERATOR set<ll,greater<ll>> :: iterator itr
#define V vector<ll>vector
#define sz size()
#define A vector<pair<ll,ll>>vect
ll N=100000,M=100000;
#define B vect.push_back(make_pair(N,M));
ll MOD=1000000007;
 
void solve()
{
	ll a,b;
	cin>>a>>b;
	ll c[4]={0};
	c[a-1]++;
	c[b-1]++;
	if(c[0]==0)
	cout<<1;
	else if(c[1]==0)
	cout<<2;
	else if(c[2]==0)
	cout<<3;
}
int main()
{
	solve();
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#define F first
#define S second
#define vec vector
#define pb push_back
#define pll pair<ll,ll>
#define pdd pair<ld, ld>
#define umap unordered_map
#define uset unordered_set
#define pii pair<int, int>
#define pnn pair<Node*, Node*>
#define all(m) m.begin(), m.end()
#define uid uniform_int_distribution
#define init(m, x) memset(m, x, sizeof(m));
#define FILE ifstream in("input.txt");ofstream out("output.txt");
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

int main() {
    fast;
    ll a, b, c; cin>>a>>b>>c;
    cout<<(b*c>=a ? "Yes" : "No");
}

Measured memory_bytes: 3648
import java.util.*;
import java.math.RoundingMode;
import java.math.BigDecimal;
 
 
 
public class Main{
	 public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] p = new int[n];
		for(int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
		}
		Arrays.sort(p);
		int ans = 0;
		for(int i = 0; i < k; i++) {
			ans+=p[i];
		}
		System.out.println(ans);
	 }
}

Measured memory_bytes: 39008
#include <iostream>
#include <iomanip>

using namespace std;

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

    double sum = 0.0;
    for(int i=0; i<n; i++){
        double num;
        cin >> num;
        sum += 1.0/num;
    }

    cout << setprecision(16) << 1.0/sum << endl;
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
 
        int n = sc.nextInt();
        int k = sc.nextInt();
 
        int array[] = new int[n];
 
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        
        int ans = Integer.MAX_VALUE;
        k--;
     
        for (int i = 0; i < n - k; i++) {
            int r = Math.abs(array[i + k]) + Math.abs(array[i] - array[i + k]);
            int l = Math.abs(array[i]) + Math.abs(array[i + k] - array[i]);
            
            int min = Math.min(r,l);
            
            if (ans > min) ans = min;
        }
        
        System.out.println(ans);
 
        sc.close();
 
    }
 
}

Measured memory_bytes: 58872
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using Graph=vector<vector<int>>;
using P=pair<int,int>;

int i,j,k;
vector<int> Rank;
vector<int> road;
vector<int> train;


//Union find(begin)
void makeTree(int x,vector<int>& parents){
    parents[x]=x;
    Rank[x]=0;
} 
int findRoot(int x,vector<int>& parents){
    if(x!=parents[x]){
        parents[x]=findRoot(parents[x],parents);
    }
    return parents[x];
}
bool unite(int x, int y,vector<int>& parents){
    x=findRoot(x,parents);
    y=findRoot(y,parents);
    if(x==y) return false;

    if(Rank[x]>Rank[y]){parents[y]=x;}
    else{
        parents[x]=y;
        if(Rank[x]==Rank[y]){Rank[y]++;}
    }
    return true;
}
//Union find(end)

int main(){
    int n,k,l;cin>>n>>k>>l;//n:都市数　k:道路数　l:鉄道数
    Rank.assign(n,0);
    road.assign(n,0);
    train.assign(n,0);

    for(i=0;i<n;i++){
        makeTree(i,road);makeTree(i,train);
    }

    for(i=0;i<k;i++){//roadについて
        int p,q;cin>>p>>q;
        p--;q--;
        unite(p,q,road);
    }

    for(i=0;i<l;i++){//trainについて
        int r,s;cin>>r>>s;
        r--;s--;
        unite(r,s,train);
    }

    map<P,int> relate;
    P p;
    for(i=0;i<n;i++){
        relate[make_pair(findRoot(i,road),findRoot(i,train))]++;
        //i番のroadとtrainそれぞれの根のペアに加算する
        //->roadとtrainのrootが同じ(つながっている状態)であれば、このペアは一致するので答えになる
    }

    for(i=0;i<n;i++){
        cout<<relate[make_pair(findRoot(i,road),findRoot(i,train))]<<" ";
    }
    cout<<endl;
    return 0;
}

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

signed main(){
  int A,B,C,X,Y;
  cin>>A>>B>>C>>X>>Y;
  int N=max(X,Y);
  int ans=1e12+7;
  rep(i,N+1){
    int Amo=i*2*C;
    if(X-i>0)Amo+=(X-i)*A;
    if(Y-i>0)Amo+=(Y-i)*B;
    ans=min(ans,Amo);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
A = sorted(A)
Alice = []
Bob = []
for i in range(N) :
    if i % 2 == 0 :
        Alice.append(A[-1])
    else :
        Bob.append(A[-1])
    A.pop(-1)
print(sum(Alice)-sum(Bob))



Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
const int MAX = 1005;

int main()
{
    long long n, m;
    cin >> n >> m;
    long long ans;
    if(n*2 > m)
    {
        ans = m/2;
    }
    else ans = n + (m-n*2)/4;
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
from itertools import combinations

N = int(input())
a, b = [], []

for i in range(N):
    c = int(input())
    if c % 10 == 0:
        a.append(c)
    else:
        b.append(c)
if len(b) == 0:
    print(0)
else:
    ans = sum(a)
    val = 0
    for i in reversed(range(1, 1+len(b))):
        for j in combinations(b, i):
            val0 = sum(j)
            if val0 % 10 != 0:
                val = max(val0, val)
        if val != 0:
            break
    if val == 0:
        print(0)
    else:
        print(val+ans)
    


Measured memory_bytes: 9084
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#define INF 1000000007
using namespace std;

int main(void){
	int m;
	cin >> m;
	cout << 48-m << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
	ll mx = 1;
	int n;
	cin >> n;
	vector<ll> v(n);
	unordered_map<ll,ll> mp;
	int all = 0;
	for(int i = 0;i < n;i++)
	{
		cin >> v[i];
		mp[v[i]]++;
		all = gcd(all,v[i]);
		mx = max(mx,v[i]);
	}
	mx++;
	bool pairwise = true;
	for(int i = 2;i < mx;i++)
	{
		int score = 0;
		for(int j = i;j < mx;j+= i)
			score += mp[j];
		if(score >= 2)
		{
			pairwise = false;
			break;
		}
	}
	if(pairwise)
		cout << "pairwise coprime";
	else if(all == 1)
		cout << "setwise coprime";
	else
		cout << "not coprime";
}


Measured memory_bytes: 50264
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int m,f,r;
    char k;
    for(;;){
        cin>>m>>f>>r;
        if(m==-1&&f==-1&&r==-1){
            break;
        }
        if(m==-1||f==-1){
            k='F';
        }else if(m+f>=80){
            k='A';
        }else if(m+f>=65){
            k='B';
        }else if(m+f>=50){
            k='C';
        }else if(m+f>=30){
            if(r>=50){
                k='C';
            }else{
                k='D';
            }
        }else{
            k='F';
        }
        cout<<k<<endl;
    }
    
}



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

using Int = long long int;
using UInt = unsigned long long int;

int main(void) {
    string a, b, c;
    cin >> a >> b >> c;
    if (a[a.length() - 1] == b[0] && b[b.length() - 1] == c[0]) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 3624
N = str(input())
A, B, C, D = N[0], N[1], N[2], N[3]
 
ops = ['+','-']
for op1 in ops:
  for op2 in ops:
    for op3 in ops:
        if eval(A + op1 + B + op2 + C + op3 + D) == 7:
            print(A + op1 + B + op2 + C + op3 + D + "=7")
            exit()

Measured memory_bytes: 3060