akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
#define REP(i, n) for(int (i)=0; (i)< (n); ++i)
#define REPR(i, n) for(int (i)=(n); (i)>=0; --i)
#define FOR(i, n, m) for(int (i)=(n); (i)<(m); ++i)
//#define INF 1e9
constexpr ll INF = 1LL << 62;
constexpr int mod = 1e9+7;

int main(){
  int K, N;
  cin >> N >> K;
  vector<ll> x(N), y(N), px(N), py(N);
  REP(i, N){
    cin >> x[i] >> y[i];
    px[i] = x[i], py[i] = y[i];
  }
  sort(px.begin(), px.end());
  sort(py.begin(), py.end());
  
  REP(i, N){
    auto itr = lower_bound(px.begin(), px.end(), x[i]);
    x[i] = itr-px.begin()+1;
    itr = lower_bound(py.begin(), py.end(), y[i]);
    y[i] = itr-py.begin()+1;
  }
  vector<vector<ll>> sum(N+1, vector<ll>(N+1, 0));
  REP(i, N){
    sum[y[i]][x[i]]++;
  }
  REP(i, N+1){
    REP(j, N){
      sum[i][j+1] += sum[i][j];
    }
  }
  REP(j, N+1){
    REP(i, N){
      sum[i+1][j] += sum[i][j];
    }
  }
  ll ans = INF;
  REP(i, N+1){
    FOR(j, i+1, N+1){
      REP(k, N+1){
        FOR(l, k+1, N+1){
          ll v = sum[j][l] - sum[j][k] - sum[i][l] + sum[i][k];
          if(v >= K){
            ll u = j-1, b = i, left = l-1, right = k;
            u = py[u], b = py[b], left = px[left], right = px[right];
            ll S = (u-b) * (left-right);
            ans = min(ans, S);
          }
        }
      }
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
const ll INF = 1LL<<60;
const int INT_INF = 1e9;
const ll MOD = 1e9+7;
template<class T> void puts(T x) { std::cout << x << std::endl; }
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 namespace std;

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

    int ans = 0;
    for (int i = 1; i < s.length(); i++) {
        if (s[i-1] != s[i]) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main()
    {
    int H;
    int A;
    int x;
    int z;
    cin >> H;
    cin >> A;
        if (H%A!=0){
                x=H%A;
                z=A-x;
                H+=z;



    }
    cout<<H/A;
return 0;
    }

Measured memory_bytes: 256
# B - Checkpoints
def main():
    n, m = map(int, input().split())
    a_b = [input().split() for i in range(n)]
    c_d = [input().split() for i in range(m)]

    for i in range(n):
        temp = []
        for j in range(m):
            temp.append(abs(int(a_b[i][0])-int(c_d[j][0]))+abs(int(a_b[i][1])-int(c_d[j][1])))
        else:
            print(temp.index(min(temp))+1)


        
if __name__ == '__main__':
    main()

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

#define check cnt=0;for(j=0;j<6;j++)if(d1[j]==d2[j])cnt++;
#define r tmp=d2[1];d2[1]=d2[3];d2[3]=d2[4];d2[4]=d2[2];d2[2]=tmp;
#define y tmp=d2[0];d2[0]=d2[3];d2[3]=d2[5];d2[5]=d2[2];d2[2]=tmp;

int main(){
 int d1[6],d2[6],tmp,cnt,j,a=1,i,k;

 for(int i=0;i<6;i++){
  cin >> d1[i] ;
 }
 for(int i=0;i<6;i++){
  cin >> d2[i] ;
 }

 check
   if(cnt==6)a=0;

 while(a){
  for(i=0;i<5;i++){
   for(k=0;k<4;k++){
    check
    if(cnt==6)break;
    r
   }
   check
   if(cnt==6)break;
   tmp=d2[0];
   d2[0]=d2[1];
   d2[1]=d2[5];
   d2[5]=d2[4];
   d2[4]=tmp;
  }
  if(cnt==6)break;
  y
  for(k=0;k<4;k++){
   check
   if(cnt==6)break;
   r
  }
  if(cnt==6)break;
  y
  y
  for(k=0;k<4;k++){
   check
   if(cnt==6)break;
   r
  }
  if(cnt==6)break;
  a=0;
 }

 if(cnt==6)cout << "Yes" << endl ;
 else cout << "No" << endl ;

 return 0;
}

Measured memory_bytes: 3092
import collections as c
import numpy as np

N,K = map(int,input().split()) 
A = list(map(int,input().split()))
A_c = c.Counter(A)
A_c = sorted(list(A_c.values()))
KindNum = len(A_c)
if KindNum < K:
    print(0)
else:
    ans = sum(A_c[:KindNum - K])
    print(ans)
    



Measured memory_bytes: 40472
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------
int main(void){
    int h, w;
    cin >> h >> w;
    int c[10][10];
    rep(i, 10){
        rep(j, 10){
            cin >> c[i][j];
        }
    }

    rep(via, 10){
        rep(i, 10){
            rep(j, 10){
                c[i][j] = min(c[i][j], c[i][via] + c[via][j]);
            }
        }
    }

    vector<vector<int>> a(h, vector<int>(w));

    rep(i, h){
        rep(j, w){
            cin >> a[i][j];
        }
    }
    int ans = 0;
    rep(i, h){
        rep(j, w){
            if(a[i][j] != -1){
                ans += c[a[i][j]][1];
            }
        }
    }

    cout << ans << endl;
} 

Measured memory_bytes: 384
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List
import qualified Data.Vector.Unboxed as VU

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    n <- getInt
    ls <- VU.fromList . sort <$> getIntList
    print $ sum [(binom (j+1) (n-1)  (ls VU.! i) (ls VU.! j) ls) - j | i <- [0..(n-3)], j <- [(i+1)..(n-2)]]

binom m1 m2 a b ls | m1 == m2 && tri a b (ls VU.! m1) = m1
                   | m1 == m2 = m1 - 1
                   | tri a b c = binom m' m2 a b ls
                   | otherwise = binom m1 (m' - 1) a b ls
    where m' = (m1 + m2) `div` 2 + 1
          c = ls VU.! m'

tri a b c | a + b > c && b + c > a && c + a > b = True
          | otherwise = False


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

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n;
    cin >> n;
    cout << "AB";
    if(n > 999){
        cout << "D";
    }
    else{
        cout << "C";
    }
}


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

using namespace std;

const int N = 5e5 + 5;

int n;
string a[N];
map <string, int> mm;
vector <pair <int, string> > vec;
set <string> st;
int pos = -1;

bool cmp (pair <int, string> p1, pair <int, string> p2) {
    if (p1.first != p2.first) return p1.first > p2.first;
    return p1.second < p2.second;
}

int main(){
    ios::sync_with_stdio(false);
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i], mm[a[i]]++;
    for (int i = 0; i < n; i++) {
        if (st.find(a[i]) != st.end()) continue;
        st.insert(a[i]);
        pos = max(pos, mm[a[i]]);
        vec.push_back({mm[a[i]], a[i]});
    }
    
    sort(vec.begin(), vec.end(), cmp);
    for (auto i: vec) if (i.first == pos) cout << i.second << "\n";
    return 0;
}

Measured memory_bytes: 40812
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
    class Program
    {
        static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        static long[] ReadLongs()
        {
            return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }

        static double ReadDouble()
        {
            return double.Parse(Console.ReadLine());
        }

        static double[] ReadDoubles()
        {
            return Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
        }

        static string ReadString()
        {
            return Console.ReadLine();
        }

        static string[] ReadStringSplit()
        {
            return Console.ReadLine().Split(' ');
        }

        static void A()
        {
            var AB = ReadLongs();
            var A = AB[0];
            var B = AB[1];
            Console.WriteLine(Math.Max(A - (2 * B), 0));
        }

        static void B()
        {
            var N = ReadLong();
            var ds = ReadLongs();
            long ans = 0;
            foreach (var x in Enumerable.Range(0, (int)N))
            {
                foreach (var y in Enumerable.Range(x, (int)N - x))
                {
                    if (x == y)
                    {
                        continue;
                    }
                    ans += ds[x] * ds[y];
                }
            }
            Console.WriteLine(ans);
        }

        static void C()
        {

        }

        static void D()
        {

        }

        static void Main(string[] args)
        {
            //A();
            B();
            //C();
            //D();
        }
    }
}


Measured memory_bytes: 28372
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int array [] = new int[3];
        int count = 0, num;
        while(count<3)
        {
            num = scanner.nextInt();
            if(0<num && num <10){
                array[count] = num;
                count++;
            }

        }

        for (int i = 0; i<3; i++) {
            for(int j = i+1; j<3; j++){
                if(array[i] == array[j]){
                    count = count-1;
                }
            }
        }
        if(count == 2){
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
    }
}



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

typedef long long int ll;

int main()
{
    vector<vector<ll>> a(3,vector<ll>(3));
    ll n;
    for(ll i = 0;i < 3;i++){
        for(ll j = 0;j < 3;j++){
            cin >> a[i][j];
        }
    }
    cin >> n;
    vector<ll> b(n);
    for(ll i = 0;i < n;i++){
        cin >> b[i];
    }

    for(ll i = 0;i < n;i++){
        for(ll j = 0;j < 3;j++){
            for(ll k = 0;k < 3;k++){
                if(b[i] == a[j][k]){
                    a[j][k] = -1;
                }
            }
        }
    }

    for(ll i = 0;i < 3;i++){
        bool f = true;
        for(ll j = 0;j < 3;j++){
            if(a[i][j] != -1){
                f = false;
            }
        }
        if(f){
            cout << "Yes";

            return 0;
        }
    }

    for(ll i = 0;i < 3;i++){
        bool f = true;
        for(ll j = 0;j < 3;j++){
            if(a[j][i] != -1){
                f = false;
            }
        }
        if(f){
            cout << "Yes";

            return 0;
        }
    }

    if(a[0][0] == -1 && a[1][1] == -1 && a[2][2] == -1 || a[0][2] == -1 && a[1][1] == -1 && a[2][0] == -1){
        cout << "Yes";

        return 0;
    }

    cout << "No";

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define LIMIT(d_in, d_min, d_max) max(d_min, min(d_max, d_in))
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	int a, b, c, d, e, k;
	cin >> a >> b >> c >> d >> e >> k;

	int min_num = INF32;
	int max_num = 0;
	max_num = max({a, b, c, d, e});
	min_num = min({a, b, c, d, e});

	if (max_num - min_num <= k)
	{
		cout << "Yay!" << endl;
	}
	else
	{
		cout << ":(" << endl;
	}
	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 int main(){
   int l=0,lm=0;
string s;
   cin>>s;
   for(int i=0;i<s.size();i++){
   if(s[i]=='A'||s[i]=='T'||s[i]=='G'||s[i]=='C'){
     l++;
   }else{
     lm=max(l,lm);
     l=0;
   }
   }
     cout<<max(lm,l);
 }

Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        Map<String, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            map.merge(sc.next(), 1, Integer::sum);
        }
        System.out.println(map.size());
    }
}

Measured memory_bytes: 76864
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<math.h>
#include<iomanip>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define PI acos(-1);
typedef long long ll;
using namespace std;
//scanf("%d", &a) '\n'

int main() {
	int r;
	cin >> r;
	cout << r * r << endl;
}
	

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

#define vi vector<int>
#define vl vector<long>
#define vvi vector<vector<int>>
#define vvl vector<vector<long>>
#define pint pair<int, int>
#define plong pair<long, long>

int main() {
    int N, M;
    cin>>N>>M;
    int w = 0;
    REP(i, 0, M){
        int a;
        cin >> a;
        w += a;
    } 
    int rest = N - w;
    cout <<( (rest >= 0 )? rest : -1 ) << endl;
}

Measured memory_bytes: 3636
#include <stdio.h>

#define MA 20
int M[MA][MA];
int best[1<<MA][MA];
int shortestHamiltonPath(int s,int n) {
	int N = 1 << n;
	int S,i,j;
	for(S=0;S<N;S++)for(i=0;i<n;i++)best[S][i]=1<<29;
	best[1<<s][s]=0;
	for(S=0;S<N;S++)for(j=0;j<n;j++)if(!(S&(1<<j)))for(i=0;i<n;i++){
		if(best[S|(1<<j)][j] > best[S][i]+M[i][j]){
			best[S|(1<<j)][j] = best[S][i]+M[i][j];
		}
	}
	for(j=1<<29,i=0;i<n;i++)if(j>best[N-1][i])j=best[N-1][i];
	return j;
}

int m[200][200],r[8];
int main(){
	int N,_M,R,a,b,c;
	scanf("%d%d%d",&N,&_M,&R);
	for(int i=0;i<N;i++)for(int j=0;j<N;j++)m[i][j]=(1<<29)*(i!=j);
	for(int i=0;i<R;i++)scanf("%d",r+i),r[i]--;
	for(int i=0;i<_M;i++){
		scanf("%d%d%d",&a,&b,&c);
		m[a-1][b-1]=m[b-1][a-1]=c;
	}
	for(int k=0;k<N;k++)for(int i=0;i<N;i++)for(int j=0;j<N;j++){
		if(m[i][j]>m[i][k]+m[k][j])m[i][j]=m[i][k]+m[k][j];
	}
	for(int i=0;i<R;i++)for(int j=0;j<R;j++)M[i][j]=m[r[i]][r[j]];
	N=1<<29;
	for(int i=0;i<R;i++)if(N>(a=shortestHamiltonPath(i,R)))N=a;
	printf("%d\n",N);
}

Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int mod=998244353;
#define N 300030
inline int read(){
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*f;
}
int cnt[6],n,ans;
char s[N];
inline int Get(char c){
	return c=='R'?0:(c=='G'?1:2);
}
int main(){
	n=read();
	scanf("%s",s+1);
	ans=1;
	for(int i=1;i<=3*n;++i){
		int x=Get(s[i]);
		bool flag=true;
		if(cnt[5-x]){
			ans=1LL*ans*(cnt[5-x]--)%mod;
			flag=false;
		}
		else{
			switch(x){
				case 0:
					if(!cnt[1]&&!cnt[2])break;
					ans=1LL*ans*(cnt[1]+cnt[2])%mod;
					if(cnt[1])--cnt[1],++cnt[3];
					if(cnt[2])--cnt[2],++cnt[4];
					flag=false;
					break;
				case 1:
					if(!cnt[0]&&!cnt[2])break;
					ans=1LL*ans*(cnt[0]+cnt[2])%mod;
					if(cnt[0])--cnt[0],++cnt[3];
					if(cnt[2])--cnt[2],++cnt[5];
					flag=false;
					break;
				case 2:
					if(!cnt[0]&&!cnt[1])break;
					ans=1LL*ans*(cnt[0]+cnt[1])%mod;
					if(cnt[0])--cnt[0],++cnt[4];
					if(cnt[1])--cnt[1],++cnt[5];
					flag=false;
					break;
			}
		}
		if(flag){
			++cnt[x];
		}
	}
	for(int i=1;i<=n;++i){
		ans=1LL*ans*i%mod;
	}
	printf("%d\n",ans);
	return 0;
}



Measured memory_bytes: 4052
def q2():
    N = int(input())
    H = [int(i) for i in input().split()]

    ans = 0
    max_H = 0
    for i in range(N):
        if H[i] >= max_H:
            ans += 1
            max_H = H[i]

    return ans

if __name__ == '__main__':
    print(q2())


Measured memory_bytes: 2940
/*
  キュー(ALDS1-3_B)
  2018/08/31
*/

#include<stdio.h>
#include<stdlib.h>

#define LEN 100005

typedef struct {
  char name[100];
  int time;
} Process;

Process queue[LEN];
int head,tail,n;
char line[100];

/*キューに入れる*/
void enqueue(Process x) {
  queue[tail] = x;
  tail = (tail + 1) % LEN;
}

Process dequeue(){
  Process x = queue[head];
  head = (head + 1) % LEN;
  return x;
}

int min(int a, int b){
  return a < b ? a : b;
}
int main(void){
  int elaps = 0,c;
  int i,q;
  Process use;

  fgets(line,sizeof(line),stdin);
  sscanf(line,"%d %d",&n, &q);

  for(i=0;i<n;i++){
    fgets(line,sizeof(line),stdin);
    sscanf(line,"%s %d",queue[i].name,&queue[i].time);
  }
  head = 0; tail = n;

  while(head != tail){
    use = dequeue();
    c = min(q,use.time);
    use.time -= c;
    elaps += c;
    if(use.time > 0) enqueue(use);
    else printf("%s %d\n",use.name , elaps);
  }
  
  
  return 0;
}



Measured memory_bytes: 11896
//#include <bits/stdc++.h>
 
#include <iostream>
#include <algorithm>
 
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>
#include <cstring>
#include <string>
#include <utility>
#include <array>
#include <complex>
#include <valarray>
 
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <chrono>
#include <random>
#include <numeric>
 
 
using namespace std;
//#define int long long
 
typedef long long ll;
typedef unsigned long long ull;
//typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef pair<ll,pll> plpll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<vector<int>> mat;
 
#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
 
const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const int INF = 1<<30;
const ll INFLL = 1LL<<62;
const double EPS = 1e-12;
const ll mod = 1000000000 + 7;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;
 
#define addm(X, Y) (X) = ((X) + ((Y) % mod) + mod) % mod
#define inside(y, x, h, w) (0 <= (y) && (y) < (h) && 0 <= (x) && (x) < (w)) ? true : false

deque<int> dq;

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    rep(i, n) {
        int a;
        cin >> a;
        if (i % 2 == 0) {
            dq.push_front(a);
        }
        else {
            dq.push_back(a);
        }
    }
    if (n % 2 == 0) reverse(all(dq));
    rep(i, n) cout << dq[i] << " ";
    cout << endl;
}


Measured memory_bytes: 3072
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC115A
{
	class Program
	{
		static void Main(string[] args)
		{
			string n;
			n = Console.ReadLine();

			if (n[0] == '2' && n[1] == '5')
				Console.WriteLine("Christmas");
			else if (n[0] == '2' && n[1] == '4')
				Console.WriteLine("Christmas Eve");
			else if (n[0] == '2' && n[1] == '3')
				Console.WriteLine("Christmas Eve Eve");
			else if (n[0] == '2' && n[1] == '2')
				Console.WriteLine("Christmas Eve Eve Eve");
			else
				Console.WriteLine("バジリスクタイム");
			Console.ReadKey();
		}
	}
}


Measured memory_bytes: 13140
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

    ll  a,b,c,d,e,n,maxi=0,f=0,mini=INF,sum=0,q;
	string str,g;
    cin>>a>>b>>c;
    if(a%3==0||b%3==0||(a+b)%3==0) cout<<"Possible"<<endl;
    else cout<<"Impossible"<<endl;
    return 0;
}


Measured memory_bytes: 3608
use proconio::{fastout, input};

pub struct UnionFind {
    par: Vec<usize>,
    cnt: Vec<i32>,
}

impl UnionFind {
    pub fn new(n: usize) -> UnionFind {
        let mut par: Vec<usize> = Vec::with_capacity(n);
        for i in 0..n {
            par.push(i);
        }
        let cnt: Vec<i32> = vec![1; n];
        UnionFind { par, cnt }
    }
    pub fn find(&mut self, x: usize) -> usize {
        if self.par[x] == x {
            x
        } else {
            let res = self.find(self.par[x]);
            self.par[x] = res;
            res
        }
    }
    pub fn unite(&mut self, x: usize, y: usize) {
        let x_par = self.find(x);
        let y_par = self.find(y);
        if x_par != y_par {
            self.par[x_par] = y_par;
            self.cnt[y_par] += self.cnt[x_par];
            self.cnt[x_par] = 0;
        }
    }
    pub fn same(&mut self, x: usize, y: usize) -> bool {
        self.find(x) == self.find(y)
    }
    pub fn size(&self, x: usize) -> i32 {
        self.cnt[x]
    }
}

#[fastout]
fn main() {
    input! {
        n: usize,
        m: usize,
    }
    let mut uf: UnionFind = UnionFind::new(n);
    for _ in 0..m {
        input! {
            a: usize,
            b: usize,
        }
        uf.unite(a - 1, b - 1);
    }

    let mut ans: i32 = 0;
    for i in 0..n {
        let sz = uf.size(i as usize);
        if ans < sz {
            ans = sz;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 6812
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define inf 1000000000
#define md 1000000007
#define pb push_back
#define li 100005
#define int long long
using namespace std;
int n,A[li],son,topla,topla2,son2,X[li];
main(){
	scanf("%lld",&n);
	for(int i=1;i<=n;i++) scanf("%lld",&A[i]);
	for(int i=1;i<=n-1;i++){
		topla+=2*A[i]-son;
		son=2*A[i]-son;
	}
	son2=A[n]*2;
	topla2=son2;
	for(int i=n-1;i>=1;i--){
		topla2+=A[i]*2-son2;
		son2=A[i]*2-son2;
	}
	X[1]=(topla2-topla)/2;
	int say=1;
	for(int i=1;i<=n-1;i++){
		say++;
		X[say]=A[i]*2-X[say-1];
	}
	for(int i=1;i<=say;i++) printf("%lld ",X[i]);
	return 0;
}




Measured memory_bytes: 2816
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
bool ok(int l, vector<int> &a, const int &k) {
    long long sum = 0;
    for (auto x: a) sum += (x-1) / l;
    if (sum > k) return false;
    else return true;
}
int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    int top = 1e9, bottom = 0;
    while (top - bottom > 1) {
        int mid = (top + bottom) / 2;
        if (ok(mid, a, k)) top = mid;
        else bottom = mid;
    }
    cout << top << endl;
    return 0;
}

Measured memory_bytes: 3996
a, b, c, x, y = map(int, input().split())

ans = 0
if a + b >= 2*c:
  if x >= y:
    ans = ans + 2*c*y
    z = x-y
    ans += min(a*z, 2*c*z)
  else:
    ans = ans + 2*c*x
    z = y-x
    ans += min(b*z, 2*c*z)
else:
  ans += a*x + b*y
  
print(ans)

Measured memory_bytes: 9160
n=int(input())
arr=[]
for i in range(n):
  s,p=map(str,input().split())
  arr.append([s,int(p),i+1])
for i in range(n):
  arr[i][1]=int(arr[i][1])
arr=sorted(arr,reverse=True,key=lambda x:x[1])
arr=sorted(arr,key=lambda x:x[0])
for i in range(n):
  print(arr[i][2])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

int main() {
  ll x, y; cin >> x >> y;
  ll ans = 0;
  if(y - x >= 0) {
    if(x < 0 && y >= 0) {
      if(abs(x) <= y) {
        ans++;
        ans += (y - abs(x));
      } else {
        if(y == 0) {
          ans += ((-y) - x);
        } else {
          ans++;
          ans += ((-y) - x);
        }
      }
    } else {
      ans += (y - x);
    }
  } else {
    if(x < 0) {
      ans += 2;
      ans += (abs(y) - abs(x));
    } else if(x >= 0 && y < 0) {
      if(y < -x) {
        ans++;
        ans += (abs(y) - abs(x));
      } else {
        ans++;
        ans += (y - (-x));
      }
    } else {
      if(y == 0) {
        ans++;
      } else {
        ans += 2;
      }
      ans += (x - y);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3644
# -*- coding: utf-8 -*-
x, y = [int(n) for n in input().split()]
group = [0, 1, 3, 1, 2, 1 , 2, 1, 1, 2, 1, 2, 1]
if group[x] == group[y]:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  char b;
  cin >> b;
  if(b=='A') cout << 'T' << endl;
  if(b=='T') cout << 'A' << endl;
  if(b=='G') cout << 'C' << endl;
  if(b=='C') cout << 'G' << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MODNum 1000000007
#define REP(type, i, a, b) for( type i = a; i < b; i++ )
typedef long long ll;

using namespace std;

int main (void) {
    ll N, K, S;
    scanf("%lld %lld %lld", &N, &K, &S);
    vector<ll> A(N);
    REP(int,i,0,N){
        if ( K > 0 ){
            A.at(i) = S; K--;
        }
        else{
            A.at(i) = S - 1;
            if ( A.at(i) < 1 ) A.at(i) = S + 2;
        }
        cout << A.at(i) << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
//型名省略
typedef long long ll;
typedef vector<long long> vl;
typedef vector<vector<long long>> vvl;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<string> vs;
//マクロ
#define rep(i,n) for(ll i = 0; i < (ll) n; i++)
#define rep2(i,x,n) for(ll i = (ll) x; i < (ll) n; i++)
#define all(A) A.begin(), A.end()
//正誤判定
void Yes(bool ans){cout << (ans? "Yes" : "No") << endl;}
void YES(bool ans){cout << (ans? "YES" : "NO") << endl;}


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

Measured memory_bytes: 3652
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <memory>
#include <string>

#include <algorithm>
#include <complex>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
#endif

#define ITER(c)         __typeof__((c).begin())
#define FOREACH(it, c)  for (ITER(c) it=(c).begin(); it != (c).end(); ++it)
#define RITER(c)        __typeof__((c).rbegin())
#define RFOREACH(it, c) for (RITER(c) it=(c).rbegin(); it != (c).rend(); ++it)
#define REP(i, n)       REPEAT(i, 0, n)
#define REPEAT(i, k, n) for (int i = (k); i < (n); ++i)
#define REVREP(i, n)    for (int i = ((n)-1); i >= 0; --i)
#define FIND(c, n)      std::find((c).begin(), (c).end(), (n));
#define BSEARCH(c, n)   std::binary_search((c).begin(), (c).end(), (n))
#define LLPOW(p1,p2)    ((ll)pow((double)(p1), (int)p2))
#define ESIZEOF(A)      (sizeof(A)/sizeof((A)[0]))
#define MIN(p1,p2)      (((p1)<(p2))?(p1):(p2))
#define MAX(p1,p2)      (((p1)>(p2))?(p1):(p2))
#define CIN_NO_SYNC     do { cin.tie(0); ios_base::sync_with_stdio(false); } while(0)
#define GETSTR(p)       fgets((p), sizeof(p), stdin)
#define CHOMP(p)        do{ char *_q = (p) + strlen(p)-1; if(*_q == '\n') *_q = 0; } while(0)

typedef long long ll;
typedef unsigned long long ull;

#ifdef _DEBUG
#define pf printf
#define pr(n) do { cout << #n " = " << (n) << endl; } while(0)
#else
#define pf(...) /* */
#define pr(...) /* */
#endif


int main(){
    string s;
    int total = 0;
    double numtotal = 0;
    int numcount = 0;
    while(getline(cin, s)){
        int a, b;
        sscanf(s.c_str(), "%d,%d", &a, &b);
        total += (a * b);
        numtotal += b;
        numcount++;
    }
    pr(total);
    pr(numtotal);
    pr(numcount);
    printf("%d\n%d\n", total, (int)(numtotal/numcount + 0.5));
}

Measured memory_bytes: 1236
c = []
for i in range(3):
    c.append(list(map(int, input().split())))
if abs(c[0][0] - c[0][1]) == abs(c[1][0] - c[1][1]) == abs(c[2][0] - c[2][1]) and \
    abs(c[0][1] - c[0][2]) == abs(c[1][1] - c[1][2]) == abs(c[2][1] - c[2][2]) and \
    abs(c[0][0] - c[0][2]) == abs(c[1][0] - c[1][2]) == abs(c[2][0] - c[2][2]):
        print('Yes')
else:
    print('No')

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

int main() {
  ll N,X,Y;
  cin >> N >> X >> Y;
  vector<vector<ll>> D(N,vector<ll>(N,0));
  vector<ll> Number(N-1,0);
  for(ll i=0;i<N;i++){
    for(ll j=i+1;j<N;j++){
      if((i+1<=X && j+1<=X) || (i+1>=Y && j+1>=Y)){
        D.at(i).at(j)=(j+1)-(i+1);
      }
      else if(X<i+1 && i+1<Y && X<j+1 && j+1<Y){
        D.at(i).at(j)=min((j+1)-(i+1),(i+1)-X+Y-(j+1)+1);
      }
      else if(i+1<=X && j+1>=Y){
        D.at(i).at(j)=X-(i+1)+(j+1)-Y+1;
      }
      else if(i+1<=X && X<j+1 && j+1<Y){
        D.at(i).at(j)=min((j+1)-(i+1) , X-(i+1)+1+Y-(j+1));
      }
      else if(X<i+1 && i+1<Y && Y<=j+1){
        D.at(i).at(j)=min((j+1)-(i+1) , (j+1)-Y+1+(i+1)-X);
      }
      Number.at(D.at(i).at(j)-1)++;
    }
  }
  for(ll k=0;k<=N-2;k++){
    cout << Number.at(k) << endl;
  }
}


Measured memory_bytes: 34792
import sys
n, q = list(map(int, input().split()))

robin = list(map(lambda y: [y[0], int(y[1])], list(map(lambda x: x.split(), sys.stdin))))

t = []
time = 0
while 0 < len(robin):
    r = robin.pop(0)
    remain = r[1]
    if q < remain:
        r[1] = remain - q
        robin.append(r)
        time += q
    else:
        time += remain
        t.append([r[0], time])

for i in t:
    print(' '.join(map(str, i)))

Measured memory_bytes: 24424
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N: int, s: str):

    for SW in [[1, 1], [0, 1], [0, 0], [1, 0]]:
        for c in s[1:]:
            if SW[-1] == 1:
                if c == 'o':
                    SW.append(SW[-2])
                else:
                    SW.append(1-SW[-2])
            else:
                if c == 'o':
                    SW.append(1-SW[-2])
                else:
                    SW.append(SW[-2])
        if SW[0] == SW[-1]:
            if ((SW[0] == 1) and (s[0] == 'o') and (SW[-2] == SW[1]))\
               or ((SW[0] == 1) and (s[0] == 'x') and (SW[-2] != SW[1]))\
               or ((SW[0] == 0) and (s[0] == 'o') and (SW[-2] != SW[1]))\
               or ((SW[0] == 0) and (s[0] == 'x') and (SW[-2] == SW[1])):
                print("".join("WS"[sw] for sw in SW[:-1]))
                return

    print(-1)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    s = next(tokens)  # type: str
    solve(N, s)


if __name__ == '__main__':
    main()


Measured memory_bytes: 7464
#include<iostream>
using namespace std;
const int MAXN=1e5+5;
int A[MAXN];
int main(){
	int H,N,sum=0;
	cin>>H>>N;
	for(int i=1;i<=N;++i){
		cin>>A[i];
		sum+=A[i];
	}
	if(sum>=H) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <deque>
#include <tuple>
using namespace std;

typedef pair<int,int> P;
bool isblocked[800][800];
int dist[800][800];
int H,W,K;


int main(){
    int sx,sy;
    cin>>H>>W>>K;
    for(int i=0;i<H;i++){
        string str;
        cin>>str;
        for(int j=0;j<W;j++){
            if(str[j]=='S'){
                sx=j; sy=i;
                str[j]='.';
            }
            isblocked[i][j]=(str[j]=='#');
        }
    }
    fill(dist[0],dist[800],10000000);
    dist[sy][sx]=0;
    deque<P> que;
    que.emplace_back(sx,sy);
    while(!que.empty()){
        int x,y;
        tie(x,y)=que.front(); que.pop_front();
        int k = dist[y][x];
        if(k>=K) continue;
        if(x>0&&!isblocked[y][x-1]&&dist[y][x-1]>k+1){
            dist[y][x-1]=k+1;
            que.emplace_back(x-1,y);
        }
        if(x+1<W&&!isblocked[y][x+1]&&dist[y][x+1]>k+1){
            dist[y][x+1]=k+1;
            que.emplace_back(x+1,y);
        }
        if(y>0&&!isblocked[y-1][x]&&dist[y-1][x]>k+1){
            dist[y-1][x]=k+1;
            que.emplace_back(x,y-1);
        }
        if(y+1<H&&!isblocked[y+1][x]&&dist[y+1][x]>k+1){
            dist[y+1][x]=k+1;
            que.emplace_back(x,y+1);
        }
    }
    int ans = 10000000;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(dist[i][j]<=K){
                int len = min({i,j,H-1-i,W-1-j});
                int t = 1 + (len+(K-1))/K;
                ans = min(ans,t);
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3960
package main

import(
	"fmt"
)

func main(){
	var k int
	fmt.Scan(&k)
	ans := 0
	if k%2 == 1{
		a := (k-1)/2
		ans = a*(a+1)
	} else {
		a := k/2
		ans = a*a 
	}
	fmt.Println(ans)
}

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

#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define setbits(x) __builtin_popcount(x)
#define zerobits(x) __builtin_ctz(x)
#define setbitsll(x) __builtin_popcountll(x)
#define zerobitsll(x) __builtin_ctzll(x)
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x

typedef vector<int> vi;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef unsigned long long ull;
typedef map<int,int> mii;

const int MOD = 1e9+7;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin >> n;
	ll arr[n];
	ll x = 0;
	for (int i = 0;i < n;++i) {
		cin >> arr[i];
		x = x^arr[i];
	}
	for (int i = 0;i < n;++i) {
		ll res = arr[i]^x ;
		cout << res << " ";
	}
	return 0;
}



Measured memory_bytes: 5204
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<algorithm>

using namespace std;

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

    vector<int> d(n, 0);
    for (int i = 0; i < n; i++) {
        cin >> d[i];
    }

    sort(d.begin(), d.end());

    int count = 0;
    int last = 0;
    for (int i = 0; i < n; i++) {
        if (d[i] != last) {
            count++;
            last = d[i];
        }
    }

    cout << count << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	char s[200001], t[200001], s1, t1;
	int n = 0, a[200], b[200];
	scanf("%s%s", s, t);
	while(s[n] != '\0') n++;

	for (int i = 0; i < 200; ++i) {
		a[i] = 0;
		b[i] = 0;
	}
	for (int i = 0; i < n; ++i) {
		a[(int)s[i]] += 1;
		b[(int)t[i]] += 1;
	}

	for (int i = 0; i < 200; ++i) {
		if (a[i] > 1) {
			for (int j = 0; j < n-1; ++j) {
				if ((int)s[j] == i) {
					t1 = t[j];
					for (int k = j+1; k < n; ++k) {
						if ((int)s[k] == i) {
							if (t[k] != t1) {
								printf("No\n");
								return 0;
							}
						}
					}
					break;
				}
			}
		}
	}
	for (int i = 0; i < 200; ++i) {
		if (b[i] > 1) {
			for (int j = 0; j < n-1; ++j) {
				if ((int)t[j] == i) {
					s1 = s[j];
					for (int k = j+1; k < n; ++k) {
						if ((int)t[k] == i) {
							if (s[k] != s1) {
								printf("No\n");
								return 0;
							}
						}
					}
					break;
				}
			}
		}
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 512
A = []
A.extend(list(map(int, input().split())))
A.extend(list(map(int, input().split())))
A.extend(list(map(int, input().split())))
hits = [[0] * 3 for _ in range(3)]
N = int(input())
for _ in range(N):
    n = int(input())
    if n not in A:
        continue
    i = A.index(n)
    row = i // 3
    col = i % 3
    hits[row][col] = 1

for i in range(3):
    if sum(hits[j][i] for j in range(3)) == 3:
        print('Yes')
        break
    if sum(hits[i][j] for j in range(3)) == 3:
        print('Yes')
        break
else:
    if sum(hits[i][i] for i in range(3)) == 3 or sum(hits[i][2 - i] for i in range(3)) == 3:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 38384
#include<bits/stdc++.h>
// use gp_hash_table<int,int,custom_hash> m;
// in place of map
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,n) for(int i=0;i<n;++i)
#define repa(i,a,n) for(int i=a;i<n;++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define repba(i,b,a) for(int i=b;i>=a;--i)
#define repab(i,a,b) for(int i=a;i<b;++i)
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define msi map<string,int>
#define mii map<int,int>
#define viip vector<pair<int,pair<int,int> > > 
#define mp make_pair
#define vip vector<pair<int,int> >
#define pb push_back 
#define po pop_back
#define fi first
#define sec second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define s(v) v.size()
ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());//use rng()%n for numbers in range [0,n-1]
// This custom_hash is for unordered_map 
// use map<int, int, custom_hash> mp;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	// #ifndef ONLINE_JUDGE
 //    	freopen("input.txt", "r", stdin);
 //    	freopen("output.txt", "w", stdout);
	// #endif
	int a,b;
	cin>>a>>b;
	int a1 = min(a,b);
	int b1 = max(a,b);	
	if(a1 != 1){
		cout<<1;
	}
	else if(b1 != 2){
		cout<<2;
	}
	else {
		cout<<3;
	}
	return 0;
}

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

using namespace std;
typedef long long ll;

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

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

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

// 約数の列挙 O(√n)
vector<ll> divisor(ll n) {
    vector<ll> res;

    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            res.push_back(i);
            if (i != n / i) res.push_back(n / i);
        }
    }

    return res;
}

int main() {
    INIT;

    ll N;
    cin >> N;
    vector<ll> a(N + 1, 0);
    reps(i, 1, N + 1) cin >> a[i];

    vector<ll> b;
    vector<ll> sum(N + 1, 0);
    ll ans = 0;

    for (ll i = N; i > 0; i--) {
        if (sum[i] % 2 != a[i]) {
            b.pb(i);
            vector<ll> divs = divisor(i);
            rep(j, SZ(divs)) { sum[divs[j]]++; }
        }

        // cout << i << ": ";
        // repv(sum) cout << *it << " ";
        // cout << endl;
    }

    sort(ALL(b));
    cout << SZ(b) << endl;
    if (SZ(b) > 0) {
        repv(b) { cout << *it << " "; }
        cout << endl;
    }

    return 0;
}

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

long long solve(long long N){
    if(N%2 == 1)return 0;
    
    long long res = 0;
    N /= 2;
    while(N){
        res += N / 5;
        N /= 5;
    }
    return res;
}



int main(){
    long long N; cin >> N;
    cout << solve(N) << endl;
}



Measured memory_bytes: 256
// 2011/08/05 Tazoe

#include <iostream>
using namespace std;

struct man{
	int x;
	int y;
	int d;
};

int main()
{
	while(true){
		int W, H;
		cin >> W >> H;
		if(W==0&&H==0)
			break;

		char S[30][30];
		struct man M[900];
		int N = 0;
		for(int y=0; y<H; y++){
			for(int x=0; x<W; x++){
				cin >> S[y][x];

				if(S[y][x]=='E'||S[y][x]=='N'||S[y][x]=='W'||S[y][x]=='S'){
					M[N].x = x;
					M[N].y = y;
					if(S[y][x]=='E')
						M[N].d = 2;
					else if(S[y][x]=='N')
						M[N].d = 3;
					else if(S[y][x]=='W')
						M[N].d = 0;
					else if(S[y][x]=='S')
						M[N].d = 1;
					N++;
					S[y][x] = '@';
				}
			}
		}

		bool flg = false;
		for(int t=1; t<=180; t++){
			for(int i=0; i<N; i++){
				int D = (M[i].d+4-1)%4;
				for(int j=0; j<4; j++){
					if(D==2&&(S[M[i].y][M[i].x+1]=='.'||S[M[i].y][M[i].x+1]=='X'))
						break;
					else if(D==3&&(S[M[i].y-1][M[i].x]=='.'||S[M[i].y-1][M[i].x]=='X'))
						break;
					else if(D==0&&(S[M[i].y][M[i].x-1]=='.'||S[M[i].y][M[i].x-1]=='X'))
						break;
					else if(D==1&&(S[M[i].y+1][M[i].x]=='.'||S[M[i].y+1][M[i].x]=='X'))
						break;
					if(j<3)
						D = (D+1)%4;
					else
						D = M[i].d;
				}
				M[i].d = D;
			}

			for(int i=0; i<N-1; i++)
				for(int j=i+1; j<N; j++)
					if(M[i].d>M[j].d){
						struct man tmp = M[i];
						M[i] = M[j];
						M[j] = tmp;
					}

			for(int i=0; i<N; i++)
				if(M[i].d==2&&(S[M[i].y][M[i].x+1]=='.'||S[M[i].y][M[i].x+1]=='X')){
					if(S[M[i].y][M[i].x+1]=='X')
						M[i].d = 9;
					S[M[i].y][M[i].x] = '.';
					M[i].x += 1;
					S[M[i].y][M[i].x] = '@';
				}
				else if(M[i].d==3&&(S[M[i].y-1][M[i].x]=='.'||S[M[i].y-1][M[i].x]=='X')){
					if(S[M[i].y-1][M[i].x]=='X')
						M[i].d = 9;
					S[M[i].y][M[i].x] = '.';
					M[i].y -= 1;
					S[M[i].y][M[i].x] = '@';
				}
				else if(M[i].d==0&&(S[M[i].y][M[i].x-1]=='.'||S[M[i].y][M[i].x-1]=='X')){
					if(S[M[i].y][M[i].x-1]=='X')
						M[i].d = 9;
					S[M[i].y][M[i].x] = '.';
					M[i].x -= 1;
					S[M[i].y][M[i].x] = '@';
				}
				else if(M[i].d==1&&(S[M[i].y+1][M[i].x]=='.'||S[M[i].y+1][M[i].x]=='X')){
					if(S[M[i].y+1][M[i].x]=='X')
						M[i].d = 9;
					S[M[i].y][M[i].x] = '.';
					M[i].y += 1;
					S[M[i].y][M[i].x] = '@';
				}

			for(int i=0; i<N; i++)
				if(M[i].d==9)
					S[M[i].y][M[i].x] = 'X';

			for(int i=0; i<N-1; i++)
				for(int j=i+1; j<N; j++)
					if(M[i].d>M[j].d){
						struct man tmp = M[i];
						M[i] = M[j];
						M[j] = tmp;
					}

			for(int i=0; i<N; i++)
				if(M[i].d==9){
					N = i;
					break;
				}
/*
			char S2[30][30];
			for(int y=0; y<H; y++)
				for(int x=0; x<W; x++)
					S2[y][x] = S[y][x];

			for(int i=0; i<N; i++)
				if(M[i].d==2)
					S2[M[i].y][M[i].x] = 'E';
				else if(M[i].d==3)
					S2[M[i].y][M[i].x] = 'N';
				else if(M[i].d==0)
					S2[M[i].y][M[i].x] = 'W';
				else if(M[i].d==1)
					S2[M[i].y][M[i].x] = 'S';

			for(int y=0; y<H; y++){
				for(int x=0; x<W; x++)
					cout << S2[y][x];
				cout << endl;
			}
			break;
*/
			if(N==0){
				cout << t << endl;
				flg = true;
				break;
			}
		}

		if(!flg)
			cout << "NA" << endl;
	}

	return 0;
}

Measured memory_bytes: 0
x, k, d = map(int, input().split())
flip = x < 0
if flip:
    x = -x
if x >= k * d:
    ans = x - k * d
else:
    if k % 2:
        x -= d
        k -= 1
    ans = min(x % (2 * d), 2*d - x % (2*d))
    
print(ans)

Measured memory_bytes: 61640
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[9]={1,0,-1,0,1,1,-1,-1,0};
const ll dx[9]={0,-1,0,1,1,-1,1,-1,0};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
    ll n;cin >> n;
    vl a(n);rep(i,n)cin >> a[i];
    vl cl(n+1,0),cr(n+1,0);
    rep(i,n)cl[i+1]=cl[i]+a[i];
    per(i,n)cr[i]=cr[i+1]+a[i];
    rev(all(cr));
    ll res=inf;
    repl(i,1,n-2){
        ll lsum=cl[i+1];
        ll t=lsum/2;
        ll pls=lower_bound(all(cl),t)-cl.begin();
        pl lcan1={cl[pls-1],lsum-cl[pls-1]};
        pl lcan2={cl[pls],lsum-cl[pls]};
        /*cout << lcan1.fi << " " << lcan1.se <<endl;
        cout << lcan2.fi << " " << lcan2.se <<endl;*/
        ll rsum=cl[n]-lsum;
        t=rsum/2;
        pls=lower_bound(all(cr),t)-cr.begin();
        pl rcan1={cr[pls-1],rsum-cr[pls-1]};
        pl rcan2={cr[pls],rsum-cr[pls]};
        /*cout << rcan1.fi << " " << rcan1.se <<endl;
        cout << rcan2.fi << " " << rcan2.se <<endl;*/
        chmin(res,max(max(lcan1.fi,lcan1.se),max(rcan1.fi,rcan1.se))-min(min(lcan1.fi,lcan1.se),min(rcan1.fi,rcan1.se)));
        chmin(res,max(max(lcan2.fi,lcan2.se),max(rcan1.fi,rcan1.se))-min(min(lcan2.fi,lcan2.se),min(rcan1.fi,rcan1.se)));
        chmin(res,max(max(lcan1.fi,lcan1.se),max(rcan2.fi,rcan2.se))-min(min(lcan1.fi,lcan1.se),min(rcan2.fi,rcan2.se)));
        chmin(res,max(max(lcan2.fi,lcan2.se),max(rcan2.fi,rcan2.se))-min(min(lcan2.fi,lcan2.se),min(rcan2.fi,rcan2.se)));
        //cout << res <<endl;
    }
    cout << res <<endl;
}   

Measured memory_bytes: 8024
N=int(input())
X=list(map(int,input().split()))
Y=list(map(int,input().split()))
a=1
b=1
def josu(x):
  if x==1 or x==0:
    return 1
  else:
    return x*josu(x-1)
A=list(range(1,N+1))
B=list(range(1,N+1))
for i in range(N-1):
  if X[i]!=min(A):
    z=A.index(X[i])
    a+=z*josu(N-(i+1))
  A.remove(X[i])
for j in range(N-1):
  if Y[j]!=min(B):
    z=B.index(Y[j])
    b+=z*josu(N-(j+1))
  B.remove(Y[j])
if a-b>=0:
  print(a-b)
else:
  print(b-a)

Measured memory_bytes: 38436