akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

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

#define MP make_pair
#define MT make_tuple
#define EACH(i,c) for(auto i: c)
#define SORT(c) sort((c).begin(),(c).end())

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()

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

	LL N, A, B, C, D;
	cin >> N >> A >> B >> C >> D;
	N -= 1;

	if(B < A) swap(A, B);
	REP(i, N + 1){
		LL tmp1 = A - D * i;
		LL tmp2 = A - C * i;
		tmp1 += (N - i) * C;
		tmp2 += (N - i) * D;
		if(tmp1 <= B && B <= tmp2){
			cerr << i << " " << tmp1 << " " << tmp2 << endl;
			cout << "YES" << endl;
			return 0;
		}
	}

	cout << "NO" << endl;


	return 0;
}


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

int main() {
  
  char X,Y;
  cin>>X>>Y;
  if (X>Y){
    printf(">\n" );
  }else if(X==Y){
    printf("=\n" );
  }else{
    printf("<\n" );
  }
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int card[4][13];
	char m;
	int n,i,j,k,l;
	
	scanf("%d",&i);
	for(j=0;j<i;j++){
		scanf(" %c %d",&m,&n);
		if(m=='S'){
			card[0][n-1]=2;
		}
		else if(m=='H'){
			card[1][n-1]=2;
		}
		else if(m=='C'){
			card[2][n-1]=2;
		}
		else if(m=='D'){
			card[3][n-1]=2;
		}
	}
	for(k=0;k<4;k++){
		for(l=0;l<13;l++){
			if(card[k][l]!=2){
				if(k==0){
					printf("S %d\n",l+1);
				}
				if(k==1){
					printf("H %d\n",l+1);
				}
				if(k==2){
					printf("C %d\n",l+1);
				}
				if(k==3){
					printf("D %d\n",l+1);
				}
			}
		}
	}
	return 0;
}


Measured memory_bytes: 2108
#include <iostream>
#include <algorithm>
#include <vector>

#define INPUT_ARRAY(N, A) \
    int N; \
    std::cin >> N; \
    std::vector<int> A(N); \
    for(int i = 0; i < N; ++i) std::cin >> A[i];

template<class T>
void print(const T &C)
{
    for(auto i : C)
    {
        std::cout << i << " ";
    }
    std::cout << std::endl;
}

bool starts_with(const std::string &S, int index, std::string q)
{
    for(int i = 0; i < q.size(); ++i)
    {
        if(index+i >= S.size() || S[index+i] != q[i])
            return false;
    }
    return true;
}

bool valid(const std::string &S, int index)
{
    if(S.size() == index) return true;
    
    if(starts_with(S, index, "eraser"))
    {
        if(valid(S, index + 6)) return true;
    }
    if(starts_with(S, index, "dreamer"))
    {
        if(valid(S, index + 7)) return true;
    }
    if(starts_with(S, index, "erase"))
    {
        if(valid(S, index + 5)) return true;
    }
    if(starts_with(S, index, "dream"))
    {
        if(valid(S, index + 5)) return true;
    }
    return false;
}

int main()
{
    std::string S;
    std::cin >> S;
    
    std::string ans_str = valid(S, 0) ? "YES" : "NO";
    std::cout << ans_str;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
signed main(){
  int count=0;
  int Q;
  int c[1005];
  int a[1005];
  int n[1005];
  cin>>Q;
  for(int i=0;i<Q;i++){
    cin>>c[i]>>a[i]>>n[i];
  }
  for(int i=0;i<Q;i++){
    count=0;
    for(int j=0;j<3000;j++){
      if(c[i]>=1 && a[i]>=1 && n[i]){
	count++;
	c[i]--;
	a[i]--;
	n[i]--;
      }else if(c[i]>=2 && a[i]>=1){
	count++;
	c[i]=c[i]-2;
	a[i]--;
      }else if(c[i]>=3){
	count++;
	c[i]=c[i]-3;
      }else{
	break;
      }
    }
    cout<<count<<'\n';
  }
  return(0);
}



Measured memory_bytes: 3124
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int N,M;
long long X;
const int maxN=15,maxM=15;
int A[maxN][maxM];
int C[maxN];

#define INF 1e9

int res=INF;

void input(){
    cin >> N >> M >> X;
    for(int i=0;i<N;i++){
        cin >> C[i];
        for(int j=0;j<M;j++){
            cin >> A[i][j];
        }
    }
}

bool check(vector<long long> sum){
    bool c=true;
    for(int i=0;i<M;i++){
        if(sum[i]<X) c=false;
    }
    /*
    cout << "in check" << endl;
    for(int i=0;i<M;i++){
        if(i!=0)  cout<< ' ';
        cout << sum[i];
    }
    cout << endl;
    cout << "c: " << c << endl;
    */

    return c;
}   


void solve(){
    for(long long i=0;i< 1<<N;i++){
        vector<long long> sum(M);
        long long sumC=0;
        for(int j=0;j<N;j++){
            if(i>>j&1){
                for(int k=0;k<M;k++){
                    sum[k] += A[j][k];
                }
                sumC+=C[j];
            }
        }
        if(check(sum)){
            if(res>sumC) res=sumC;
        }

    }
    if(res==INF) res=-1;
}

int main(){
    input();
    solve();
    cout << res << endl;
}

Measured memory_bytes: 3192
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long int s,ans,mod,i,j,r;
  ans=0;
  mod=pow(10,9)+7;
  cin >> s;
  long long int modc[s+1][s+1];
  
  for(i=0;i<=s;++i)
  {
  modc[i][0]=1;
  modc[i][i]=1;
  }
  
  for(i=2;i<s;++i)
  {
   for(j=1;j<=i;++j)
   {
    modc[i][j]=(modc[i-1][j-1]+modc[i-1][j])%mod;
   }
  }
  
  r=s/3;
  
  for(i=1;i<=r;++i)
  {
  ans=(ans+modc[s-2*i-1][i-1])%mod;
  }
  
  cout << ans;
return 0;}

Measured memory_bytes: 26008
//QWsin
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,x,y) for(int i=x;i<=y;++i)
#define out(i,u) for(int i=first[u];i!=-1;i=next[i])
#define repvc(i,vc) for(int i=0,Sz=vc.size();i<Sz;++i)
inline int read()
{
	char ch=getchar();int ret=0,f=1;
	while(ch<'0' || ch>'9') {if(ch=='-')f=-1;ch=getchar();}
	for(;ch>='0' && ch<='9';ch=getchar()) ret=ret*10+ch-'0';
	return ret*f;
}
using namespace std;

const int INF=1<<30;

int main()
{
	int n,t;cin>>n>>t;
	
	int a,b,m=INF;
	rep(i,1,n)
	{
		cin>>a>>b;
		if(b<=t) m=min(m,a);
	}
	if(m==INF) puts("TLE");
	else cout<<m<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iomanip>
#include <functional>
#include <bitset>
#include <limits>
#include <cstdio>
#include <cmath>
#include <cassert>
#include <random>

#ifdef DEBUG
#include "library/Utility/debug.cpp"
#else
#define debug(...)
#endif

#define rep(i,n) for(int i=0;i<(n);++i)
#define EL '\n'
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using lnt = long long;
struct FIO{FIO(){std::cin.tie(0);std::cout.tie(0);std::ios_base::sync_with_stdio(0);std::cout<<std::fixed<<std::setprecision(15);}}fIO;
/*-*/
#include <chrono>
struct timer
{
	std::chrono::time_point<std::chrono::steady_clock> start;
	timer() : start(std::chrono::steady_clock::now()) {}
	void ms() {
		std::chrono::duration<double> diff=std::chrono::steady_clock::now()-start;
		std::cerr << diff.count()*1000 << "ms\n";
	}
};
struct time_scope
{
	std::chrono::time_point<std::chrono::steady_clock> start;
	time_scope() : start(std::chrono::steady_clock::now()) {}
	~time_scope() {
		std::chrono::duration<double> diff=std::chrono::steady_clock::now()-start;
		std::cerr << diff.count()*1000 << "ms\n";
	}
};

template <typename T>
std::vector<int> sort_indexes(const std::vector<T> &v) {
	std::vector<int> idx(v.size());
	std::iota(idx.begin(), idx.end(), 0);
	std::sort(idx.begin(), idx.end(), [&v](int i1, int i2) {return v[i1] < v[i2];});
	return idx;
}


int main() {
	time_scope timer;
	int d;
	std::cin >> d;
	int N=26;
	std::vector<lnt> c(N);
	std::vector<std::vector<lnt> > v(d,std::vector<lnt>(N));
	rep(i,N) std::cin >> c[i];
	rep(i,d) {
		rep(j,N) {
			std::cin >> v[i][j];
		}
	}
	lnt best=-10000000;
	std::vector<int> besta;
	for(int x=0;x<4;x++) {
		for(int y=1;y<150;y++) {
			for(int z=8;z<12;z++) {
				std::vector<int> ans; ans.reserve(d);
				std::vector<int> last(N,-1);
				rep(i,d) {
					std::vector<int> idx(N);
					std::iota(idx.begin(), idx.end(), 0);
					lnt X=x; lnt Y=y; lnt Z=z;
					auto f = [&](int ix) -> lnt {
						return c[ix]*(i-last[ix]+X)*Y+v[i][ix]*Z;
					};
					std::sort(idx.begin(), idx.end(), [&](int i1, int i2) {return f(i1) > f(i2) ;});
					last[idx[0]]=i;
					ans.emplace_back(idx[0]);
					//print(idx[0]+1);
				}
				{
					lnt sum=0;
					std::vector<int> last(N,-1);
					rep(i,d) {
						int t=ans[i];
						sum+=v[i][t];
						last[t]=i;
						rep(j,N) sum-=(i-last[j])*c[j];
					}
					if(sum>best) {
						besta=ans;
						best=sum;
					}
				}
			}
		}
	}
	rep(i,d) {
		print(besta[i]+1);
	}
}


Measured memory_bytes: 3964
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int n,S[100000],q,T[50000],c=0,i,i2,toread,cnt;
	cin>>n;
	for(i=0;i<n;i++)cin>>S[i];
	cin>>q;
	for(i=0;i<q;i++)cin>>T[i];
	/*for(i=0;i<n;i++){
		for(i2=0;i2<n;i2++){
			if(S[i]<S[i2]){
				toread=S[i];
				S[i]=S[i2];
				S[i2]=toread;
			}
		}
	}*/
	sort(S,S+n);
	for(i=0;i<q;i++){
		cnt=0;
		toread=n;
		while(toread>1){
			if(toread%2==0)toread/=2;
			else toread=(toread+1)/2;
			if(S[(toread-1)+cnt]<T[i])cnt+=toread;
			else if(S[(toread-1)+cnt]==T[i]){
				c++;
				break;
			}
		}
	}
	cout<<c<<endl;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
 
using namespace std;
 
#define M 1 //masculino
#define F (-1) //femenino
#define U 0 //no marcado
#define PB push_back
vector<long long int> dp(100001,-1);
 long long int solve(long long int arr[],long long int n,long long int i)
 {  if(dp[i]!=-1)
    return dp[i];


    if(i==n-1)
     return 0;
     if(i==n-2)
     return abs(arr[i]-arr[i+1]);
    long long  int an=0;
     an =min( (abs(arr[i]-arr[i+1])+solve(arr,n,i+1)),(abs(arr[i]-arr[i+2])+solve(arr,n,i+2)));
     dp[i]=an;
     return an;
 }

int main()
{
    long long int n;
    cin>>n;
    long long int arr[n];
    for(long long int i=0;i<n;i++)
    cin>>arr[i];
     
     long long int ans = solve(arr,n,0);
     cout<<ans;

}


Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
#define sc(a) scanf("%d", &a)
#define sc2(a,b) scanf("%d%d", &a, &b)
#define sc3(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define pri(x) printf("%d\n", x)
#define mp make_pair
#define pb push_back
#define BUFF ios::sync_with_stdio(false);
#define imprime(v) for(int X=0;X<v.size();X++) printf("%d ", v[X]); printf("\n");
#define endl "\n"
const int INF= 0x3f3f3f3f;
const long double pi= acos(-1);
typedef long long int ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector< vector< int > > vvi;
const int MOD=1e9+7;
const ll LINF=0x3f3f3f3f3f3f3f3f;

ll k;

void solve(ll n, ll k) {
  vector<ll> resp(n, 0);
  for(int i = 0; i < n; i++) {
    resp[i] = k / n + n - 1ll;
  }
  for(int i = 0; i < (k % n); i++) {
    resp[i] += n;
    for(int j = 0; j < n; j++) {
      if(j == i) continue;
      resp[j]--;
    }
  }
  cout<<n<<endl;
  for(int i = 0; i < n; i++) {
    if(i != 0) cout<<" ";
    cout<<resp[i];
  }
  cout<<endl;
}

int main() {
  BUFF;
  cin>>k;
  if(k <= 50) {
    cout<<50<<endl;
    for(int i = 0; i < k; i++) {
      if(i != 0) cout<<" ";
      cout<<50;
    }
    for(int i = k; i < 50; i++) {
      if(i != 0) cout<<" ";
      cout<<0;
    }
    cout<<endl;
    return 0;
  }
  for(ll n = 2; n <= 50; n++) {
    if(k > n and (k % n) == 0 and k / n <= 10000000000000000ll) {
      solve(n, k);
      return 0;
    }
  }

  for(ll n = 2; n <= 50; n++) {
    if(k > n and ((k + n - 1ll)) / n <= 10000000000000000ll) {
      solve(n, k);
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 256
A, B = map(int,input().split())
import math
a = list()
i = A/0.08
j = (A+1)/0.08
while i < j:
    if int(i) == i:
        k = int(i)
        a.append(k)
        i = i+1
    elif int(i) != i:
        k = int(i+1)
        a.append(k)
        i = i+1
ko = max(a)
if ko == j:
    a.remove(ko)

b = list()
p = B/0.10
q = (B+1)/0.10
while p < q:
    if int(p) == p:
        l = int(p)
        b.append(l)
        p = p+1
    elif int(p) != p:
        l = int(p+1)
        b.append(l)
        p = p+1
mo = max(b)
if mo == q:
    b.remove(mo)

a.append(1000000)
b.append(1000000)
c= set(a) & set(b)
m = min(c)
if m == 1000000:
    print("-1")
else:
    print(m)


Measured memory_bytes: 3188
s = input()
length = len(s)

before = s[0]
chain = -1
cnt = 0
ans = 0

for a in range(length):
    if s[a] == 'R':
        if chain:
            cnt += 1
        else:
            chain = 1
            cnt += 1
    else:
        chain = -1
        cnt = 0

    ans = max(ans, cnt)

print(ans)


Measured memory_bytes: 8944
n,q=map(int, input().split())
que=[]
t=0
for i in range(n):
    que.append(input().split())
 
while len(que)!=0:
    proc=que.pop(0)
    if int(proc[1]) <= q:
        t += int(proc[1])
        print(proc[0],t)
    else:
        t += q
        proc[1]=int(proc[1]) - q
        que.append(proc)



Measured memory_bytes: 17116
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int N = Integer.parseInt(br.readLine());
		int K = Integer.parseInt(br.readLine());
		int X = Integer.parseInt(br.readLine());
		int Y = Integer.parseInt(br.readLine());
		int sum = 0;
		
		if(N>K){
			sum = K*X;
			sum += (N-K)*Y;
		}else{
			sum = N*X;
		}
		
		System.out.println(sum);
	}
}


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

#define ll long long int
#define maximum 0x7f

int dx[]= {0,0,1,-1,-1,-1,1,1};
int dy[]= {1,-1,0,0,-1,1,-1,1};

int main()
{
    char s[3001],t[3001];
    scanf("%s%s",s,t);
    int l=strlen(s);
    int len=strlen(t);
    int dp[l+1][len+1];
    for(int i=0;i<=l;i++)
    {
        for(int j=0;j<=len;j++)
        {
            if(i==0||j==0)
                dp[i][j]=0;
            else if(s[i-1]==t[j-1])
                dp[i][j]=dp[i-1][j-1]+1;
            else
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
    }
    int le=dp[l][len];
    char ans[le+1];
    ans[le--]='\0';
    while(l>0&&len>0)
    {
        if(s[l-1]==t[len-1])
        {
            l--;
            len--;
            ans[le--]=s[l];
        }
        else if(dp[l][len-1]==dp[l][len])
            len--;
        else
            l--;
    }
    puts(ans);
    return 0;
}


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

int main(){
    int M1, D1, M2, D2;
    cin >> M1 >> D1 >> M2 >> D2;

    int ans;
    if(D2 == 1)
        ans = 1;
    else
        ans = 0;
    

    cout << ans << endl;
}

Measured memory_bytes: 256
using System;

class Program
{

    static int gcd(int x, int y)
    {
        if(x>y){ int b=x; x=y; y=b; }
        while(x>0) { int b=x; x=y%x; y=b; }
        return y;
    }
    
    static void Main()
    {
        int K = int.Parse(Console.ReadLine())+1;

        int ans = 0;
        for(int i=1; i<K; ++i)
            for(int j=1; j<K; ++j) {
                int x = gcd(i, j);
                for(int k=1; k<K; ++k) ans+=gcd(k, x);
            }

        
        Console.WriteLine(ans);    

    }

    

}


Measured memory_bytes: 17644
import java.util.Scanner;

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

        if (K%2 == 0) System.out.println((K / 2) * (K / 2));
        else System.out.println((K/2 + 1) * (K / 2));
    }
}

Measured memory_bytes: 27092
package main
  
import (
    "fmt"
)

func main() {
    var n int
    fmt.Scan(&n)
    var fb, la, fbla, ab int
    for i := 0; i < n; i++ {
        var bs []byte
        fmt.Scan(&bs)
        if bs[0] == 'B' {
            fb++
        }
        if bs[len(bs)-1] == 'A' {
            la++
        }
        if bs[0] == 'B' && bs[len(bs)-1] == 'A' {
            fbla++
        }
        for j := 0; j < len(bs)-1; j++ {
            if bs[j] == 'A' && bs[j+1] == 'B' {
                ab++
            }
        }
    }
    cab := min(fb, la)
    if cab > 0 && fb == fbla && la == fbla {
        cab--
    }
    fmt.Println(ab + cab)
}

func min(a, b int) int {
    if a < b {
        return a
    }
    return b
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;cin>>s;
  bool f = true;
  for(int i=0;i<s.length();++i){
    if(i%2==0){
      if(s[i]=='L'){
        f = false;
      }
    }else{
      if(s[i]=='R'){
        f = false;
      }      
    }
  }
  if(f){cout<<"Yes"<<endl;}
  else{cout<<"No"<<endl;}
  return 0;
  
}

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

int	main(int	argc,
		 char*	argv[])
{
  int	a	= 0;
  int	b	= 0;
  int	c	= 0;

  std::cin >> a >> b >> c;

  std::vector<int> v;
  v.push_back(a);
  v.push_back(b);
  v.push_back(c);

  int	count	= 0;
  std::sort(v.begin(), v.end());

  int	size	= v.size();
  for(int x : v){
	  ++count;
	  std::cout << x;
	  if(count < size){
		  std::cout << ' ';
	  }
  }
  std::cout << "\n";
}



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

 using namespace std;

 int main() {
   string A, B, ans;
   int i;

   cin >> A >> B;

   if (A.length() > B.length()) cout << "GREATER" << endl;
   else if (A.length() < B.length()) cout << "LESS" << endl;

   else {
     ans = "EQUAL";
     for (i = 0; i < A.length(); i++) {
       if (A.at(i) > B.at(i)) {
         ans = "GREATER";
         break;
       }
       else if (A.at(i) < B.at(i)) {
         ans = "LESS";
         break;
       }
     }
     cout << ans << endl;
   }
 }


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
// #define ll int
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};

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

struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};



void solve(){
    ll a,b,c;
    cin>>a>>b>>c;
    if(a==b) cout<<c<<endl;
    else if(b==c) cout<<a<<endl;
    else cout<<b<<endl;

}


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // Timer TM;
    
    solve();

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <time.h>
#include <algorithm>
#include <math.h>
using namespace std;
#define INF 2147483647

int main() {
	ios_base::sync_with_stdio(false);

	int a, b; cin >> a >> b;

	int ans = a - 2 * b;
	if (b > a || ans < 0) {
		ans = 0;
	}
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n;i>=0;i--)
#define Pool(i, m, n) for(ll i=n;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(a) cout<<a<<endl
#define putout2(a,b) putout(a);putout(b)
#define putout3(a,b,c) putout(a);putout(b);putout(c)
#define putout4(a,b,c,d) putout(a);putout(b);putout(c);putout(d)
#define putout5(a,b,c,d,e) putout(a);putout(b);putout(c);putout(d);putout(e)
#define Gput(a,b) G[a].push_back(b)
#define cin1(a) cin>>a
#define cin2(a,b) cin>>a>>b
#define cin3(a,b,c) cin>>a>>b>>c
#define cin4(a,b,c,d) cin>>a>>b>>c>>d
#define cin5(a,b,c,d,e) cin>>a>>b>>c>>d>>e
#define sum(v) accumulate(all(v), 0ll)
#define gcd(x,y) __gcd(x,y)
ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
ll lcm(ll x,ll y){
  ll z=gcd(x,y);
  return x*y/z;
}
ll primejudge(ll n){
  if(n<2)return 0;
  else if(n==2)return 1;
  else if(n%2==0)return 0;
  double sqrtn=sqrt(n);
  Loop(i,3,sqrtn+1){
     if(n%i==0){
        return 0;
     }
     i++;
  }
  return 1;
}
int main() {
  cout << fixed << setprecision(30);
  ll n,k,s;
  cin3(n,k,s);
  ll count=k;
  if(s!=1000000000){
  loop(i,n){
   if(i<count)cout<<s;
   else cout<<1000000000;
   if(i!=n-1)cout<<" ";
  }
  }
  else{
   loop(i,n){
   if(i<count)cout<<s;
   else cout<<1;
   if(i!=n-1)cout<<" ";
  }
  }
}


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

#if MYDEBUG
#include "lib/cp_debug.hpp"
#else
#define DBG(...) ;
#endif
#if __cplusplus <= 201402L
template <typename T>
T gcd(T a, T b) { return ((a % b == 0) ? b : gcd(b, a % b)); }
template <typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }
#endif
using LL = long long;
constexpr LL LINF = 334ll << 53;
constexpr int INF = 15 << 26;
constexpr LL MOD = 1E9 + 7;

namespace Problem {
using namespace std;

class Solver {
 public:
  int n;
  vector<LL> a;
  Solver(LL n) : n(n), a(n){};

  void solve() {
    LL sum = 0;
    for (int i = 0; i < n; ++i) {
      cin >> a[i];
      sum += a[i];
    }
    LL ans = LINF;
    LL cumsum = 0;
    for (int i = 0; i < n - 1; ++i) {
      cumsum += a[i];
      ans = min(ans, abs(sum - cumsum * 2));
    }
    cout << ans << endl;
  }
};

}  // namespace Problem

int main() {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(12);
  long long n = 0;
  std::cin >> n;

  Problem::Solver sol(n);
  sol.solve();
  return 0;
}


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

int main()
{
  int a1, a2, b1, b2;
  cin >> a1 >> a2 >> b1 >> b2;

  cout << a1 + (a2 - a1) - (b2 - b1) << " " << a2 + (b1 - a1) + (b2 - a2) << " " << a1 - (b2 - a2) << " " << b1 + (a2 - a1) << endl;
}


Measured memory_bytes: 256
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors


N = int(input())
d = make_divisors(N)
ans = 0
for i in d:
    a = i-1
    m = N//i
    if a > m:
        ans += a

print(ans)


Measured memory_bytes: 3268
import java.util.*; 

class Main{
public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
   	double a=sc.nextDouble();
  	double b=sc.nextDouble();
  	double x=sc.nextDouble();
  	double c=0;
    if(x<=(a*a*b/2)){
    c=Math.toDegrees(Math.atan(a*b*b/2/x));
    }else{
    c=Math.toDegrees(Math.atan((2*b/a)-(2*x/a/a/a)));
    }
    
    System.out.println(c);
    }
}


Measured memory_bytes: 24144
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)

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

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() {
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  int result;
  if (a < k) {
    result = a;
    k -= a;
  } else {
    cout << k << endl;
    return 0;
  }

  if (b < k) {
    k -= b;
  } else {
    cout << result << endl;
    return 0;
  }

  cout << result - k << endl;

  return 0;
}

Measured memory_bytes: 3636
def main():
    S = input()
    T = input()
    n = len(T)
    ans = list(S)
    for i in range(len(S) - n, -1, -1):
        s = S[i:i + n]
        for j, t in zip(s, T):
            if j != '?' and j != t:
                break
        else:
            ans[i:i + n] = list(T)
            ans = [a if a != '?' else 'a' for a in ans]
            print(''.join(ans))
            exit()
    print('UNRESTORABLE')



if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
using System;
using System.Linq;
class aoj
{
    static void Main()
    {
        int[] c = new int[8];
        c[0] = 1;c[1] = 2;c[2] = 1;c[3] = 2;c[4] = 1;c[5] = 4;c[6] = 1;c[7] = 4;
        while (true)
        {
            string a = Console.ReadLine();
            if (String.IsNullOrEmpty(a)) break;
            int[] b = a.Split(' ').Select(int.Parse).ToArray();
            int[] f = new int[3];
            f[0] = 1000000000;
            for (int i = 0; i < 8; i++)
            {
                int e = 0;
                char[] h = new char[8];
                for (int j = 0; j < 8; j++)
                {
                    int d = j + i;
                    if (d >= 8)
                        d -= 8;
                    int g = b[j] - c[d];
                    if (g < 0)
                        g = 0;
                    e += g;
                    h[j] = (char)(c[d] + '0');
                }
                if (f[0] > e)
                {
                    f[0] = e;
                    f[1] = i;
                    string k = new string(h);
                    f[2] = int.Parse(k);
                }
                if (f[0] == e)
                {
                    string k = new string(h);
                    int l = int.Parse(k);
                    if (f[2] > l)
                    {
                        f[1] = i;
                        f[2] = l;
                    }
                }
            }
            int m = f[1];
            for (int i = 0; i < 8; i++)
            {
                int n = m + i;
                if (n >= 8)
                    n -= 8;
                if (i == 0)
                    Console.Write(c[n]);
                else
                    Console.Write(" " + c[n]);
            }
            Console.WriteLine();
        }
    }
}

Measured memory_bytes: 9472
#include<stdio.h>
void push(long int x[],long int i,long int k){//最大が根になる x: 配列，i:push後のデータ数，k: pushするデータ
  x[i]=k;
  for(int j=i;j>1;j/=2)if(x[j]>x[j/2])x[j]^=x[j/2]^=x[j]^=x[j/2];
}
long int pop(long int x[],long int i){//最大値を取り出す x: 配列，i:pop前のデータ数
  int j=1,k;
  x[0]=x[1];x[1]=x[i];
  while(j*2<i&&(x[j*2]>x[j]||x[j*2+1]>x[j])){
    k=x[j*2]>x[j*2+1]?j*2:j*2+1;
    x[j]^=x[k]^=x[j]^=x[k];
    j=k;
  }
  return x[0];
}
void quicksort(long int a[],int s,int t){
  if(s<t){
    long int i=s,j=t,p=a[(s+t)/2];
    while(1){
      while(a[i]>p)i++;
      while(p>a[j])j--;
      if(i>=j)break;
      a[i]^=a[j]^=a[i]^=a[j];
      i++;j--;
    }
    quicksort(a,s,i-1);quicksort(a,j+1,t);
  }
}
int main(){
  long int a[200000],n,h[200001],i,r=0;
  scanf("%ld",&n);
  for(i=0;i<n;i++)scanf("%ld",&a[i]);
  quicksort(a,0,n-1);
  h[1]=a[0];
  for(i=1;i<n;i++){r+=pop(h,i);push(h,i,a[i]);push(h,i+1,a[i]);}
  printf("%ld",r);
}


Measured memory_bytes: 4852
#include <bits/stdc++.h>
using namespace std;using ll=int_fast64_t;using ld=long double;using pll=pair<ll,ll>;using pld=pair<ld,ld>;
const ll INF=1LL<<60;void solve();int main(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(10);solve();}
#define foreach(i,a) for(auto &i:a)
#define SELECTOR(_1,_2,_3,_4,SELECT,...) SELECT
#define rep(...) SELECTOR(__VA_ARGS__,_rep2,_rep1,_rep0)(__VA_ARGS__)
#define _rep0(i,n) for(ll i=0;i<n;++i)
#define _rep1(i,k,n) for(ll i=k;i<n;++i)
#define _rep2(i,k,n,d) for(ll i=k;d!=0&&d>0?i<n:i>n;i+=d)
template<class T> vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<class... Ts> auto make_v(size_t a,Ts... ts){return vector<decltype(make_v(ts...))>(a,make_v(ts...));}
template<class T> inline bool chmax(T &a,const T &b){if(a<b){a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a,const T &b){if(a>b){a=b; return 1;} return 0;}

void solve(){
  ll h,w; cin>>h>>w;
  auto A=make_v(h,w,0);
  auto B=make_v(h,w,0);
  rep(i,h)rep(j,w) cin>>A[i][j];
  rep(i,h)rep(j,w) cin>>B[i][j];
  const ll ofs=12800;
  auto dp=make_v(h,w,bitset<25600>(0));
  ll x=abs(A[0][0]-B[0][0]);
  dp[0][0].set(x+ofs);
  dp[0][0].set(-x+ofs);
  
  rep(i,h)rep(j,w){
    if(i==0 && j==0) continue;
    ll x=abs(A[i][j]-B[i][j]);
    bitset<25600> S;
    if(i>0) S|=dp[i-1][j];
    if(j>0) S|=dp[i][j-1];
    dp[i][j]=(S<<x)|(S>>x);
  }
  rep(i,12800){
    if(dp[h-1][w-1].test(i+ofs)){
      cout<<i<<"\n";
      return;
    }
  }
}

Measured memory_bytes: 20736
#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
    int a, b; cin >> a >> b;

    cout << (((a*10+b*10)/2)/10 + (((a*10+b*10)/2) % 10 > 0 ? 1 : 0)) << endl; 
    return 0;
}


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

int main () {
  int n,k;
  int count = 0;
  cin>>n>>k;
  vector<int> p(n);
  for (int i=0;i<p.size();i++) {
    cin>>p.at(i);
  }
  sort(p.begin(),p.end());
  for (int i=0;i<k;i++) {
    count += p.at(i);
  }
  cout<<count<<endl;
}


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

using namespace std;

int main () {

	int a, b;
	cin >> a >> b;
	
	if ((a * b) % 2 == 0) 
		cout << "No" << '\n';
	else if (a & 1 and !(b & 1))
		cout << "No" << '\n';
	else if (!(a & 1) and b & 1)
		cout << "No" << '\n';
	else
		cout << "Yes" << '\n';
	
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

  
int main(){
  int n,S[100000],q,T[50000],i,j,count=0;
  int left,right,mid;
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&T[i]);
  }
  for(i=0;i<q;i++){
    left=0;
    right=n;
    while(left<right){
      mid=(left+right)/2;
      if(S[mid]==T[i]){
	count++;
	break;
      }
      else if(T[i]<S[mid]){
	right=mid;
      }
      else{
	left=mid+1;
      }
    }
  }
  
  

  
  printf("%d\n",count);
  return 0;
}



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

constexpr char types[]{'0', '1'};

int drawTiles(const string& S, char top) {
  int num{};
  for (size_t i{}; i < S.length(); ++i) {
    if (i % 2 == 0) {
      if (S[i] != types[top]) ++num;
    } else {
      if (S[i] != types[!top]) ++num;
    }
  }
  return num;
}

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

  int num0 = drawTiles(S, 0);
  int num1 = drawTiles(S, 1);
  cout << (num0 < num1 ? num0 : num1) << endl;
  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define mod 1000000007
#define endl "\n"
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define MAXX 1000000000000000000

int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll a,b,c,d;
	cin >> a >> b >> c >> d;
	while(1)
	{
		c -= b;
		if(c <= 0)
		{
			cout<<"Yes";
			return 0;
		}
		a -= d;
		if(a <= 0)
		{
			cout<<"No";
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 3628
require 'prime'

$primes_u10000 = Prime.each(10000).to_a

def prime?(n)
	return n == $primes_u10000.bsearch{|x| n <= x} if n <= 10000

	# trial division
	limit = Math.sqrt(n).floor
	$primes_u10000.each do |d|
		break if limit < d
		return false if n % d == 0
	end

	return true
end

p gets.to_i.times.count { prime? gets.to_i }

Measured memory_bytes: 6260
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template <typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template <typename T> istream &operator>>(istream &is, vector<T> &vec) { for (auto &v : vec) is >> v; return is; }

int main()
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> A(N), B(N);
    cin >> A >> B;
    vector<int> V(N);
    REP(i, N)
    {
        V[i] = upper_bound(B.begin(), B.end(), A[i]) - B.begin();
        if (i) chmax(V[i], V[i - 1] + 1);
    }
    IREP(i, N - 1) chmax(V[i], V[i + 1] - 1);
    REP(i, N) if (A[i] == B[V[i] % N])
    {
        puts("No");
        return 0;
    }

    cout << "Yes\n";
    REP(i, N) cout << B[V[i] % N] << ' ';
}


Measured memory_bytes: 5568
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pb push_back
#define pint pair<int,int>
using namespace std;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int i,j,n;	cin>>n;
	map<int,int> mymap;
	for(i=0;i<n;i++){
		int temp;	cin>>temp;	mymap[temp]++;
	}
	int ans=0;
	map<int,int>::iterator it=mymap.end();
	--it;
	while(1){
		if(it->second==0 && it==mymap.begin()){
			break;
		}
		else if(it->second==0){
			--it;	continue;
		}
		int num=it->first;
		int power=1073741824;
		while(power/2 > num){
			power/=2;
		}
		if(power!=2*num && mymap[power-num]>=1){
			ans++;
			mymap[power-num]--;	mymap[num]--;
		}
		else if(power==2*num && mymap[num]>=2){
			ans++;
			mymap[num]-=2;
		}
		else if(it==mymap.begin()){
			break;
		}
		else{
			--it;
		}
	}
	
	cout<<ans<<endl;
	
	return 0;
}


Measured memory_bytes: 19072
N = int(input())
S = str(input())

inputlist = list(S)
c_list = [0]*len(S)
# print(inputlist)
# print(c_list)

ans = 1

#文字が切り替わった回数カウント
for i in range(N):
#    print(inputlist[i-1])
    if i == N-1:
        break
    if inputlist[i] != inputlist[i+1]:
        ans += 1

print(ans)


Measured memory_bytes: 4852
#include<iostream>
#include<vector>
#include<string>

typedef long long ll;

int N;

using namespace std;



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

  vector<vector<int>> to(N+10);
  for(int i = 0; i < M; i++){
    int a,b; cin >> a >> b;
    to[a].push_back(b); }
  

  
  for(int j = 0; j < to[1].size(); j++){
    int v = to[1].at(j);
    for(int k = 0; k < to[v].size();k++){
      if(to[v].at(k) == N){ cout << "POSSIBLE" ; return 0;}}}
  
    cout << "IMPOSSIBLE"; return 0;
}

Measured memory_bytes: 8576
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
#include<cstring>

using namespace std;

#ifdef LDEBUG
#define debug(x) cout << #x << ":" << x << endl
#else
#define debug(...)
#endif

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

typedef unsigned long long u64;
typedef long long i64;

int r, d, x[20];


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

        cin >> r >> d >> x[0];

        REP(i,10) {
                x[i+1] = r*x[i] - d;
                cout << x[i+1] << endl;
        }


        return 0;
}


Measured memory_bytes: 256
S = input().strip()
s1,s2 = S[:2],S[2:]
def is_month(s): 
    return int(s) >=1 and int(s)<=12

if is_month(s1) and is_month(s2):
    print("AMBIGUOUS")
elif is_month(s1):
    print("MMYY")
elif is_month(s2):
    print("YYMM")
else:
    print("NA")

Measured memory_bytes: 3060
n,*L=$<.read.split.map &:to_i
L.sort!
s=0
n.times{|k|
k.times{|j|
j.times{|i|
s+=1 if L[i]!=L[j]&&L[j]!=L[k]&&L[i]+L[j]>L[k]
}
}
}
p s

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

int main()
{
    int n,y,i=0,k=0,z;
    long long sum=0;
    cin>>n>>y;
    int a[n], b[n];
    while(i<n)
    {
        cin>>a[i]>>b[i];
        i++;
    }
    sort(a,a+n);
    sort(b,b+n);
    i=n-1;
    for(int j=i; j>=0; j--)
    {
        if(a[i]<=b[j])
        {
            sum+=b[j];
            k++;
            if(sum>=y)
            {
                cout<<k;
                return 0;
            }
        }
        else
        {
            break;
        }
    }
    z=(y-sum)/a[i];
    sum+=z*a[i];
    if(sum>=y) cout<<k+z;
    else cout<<k+z+1;

    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main(){
  int num1, num2, num3 = 0;
  scanf("%d %d %d", &num1, &num2, &num3);
  if(num1 < num2 && num2 < num3){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 580
while True:
    n, x = (int(x) for x in input().split())
    if (n, x) == (0, 0): break

    cnt = 0
    for i in range(1, n + 1):
        for j in range(i + 1, n + 1):
            for k in range(j + 1, n + 1):
                if i + j + k == x:
                    cnt += 1

    print(cnt)

Measured memory_bytes: 7716
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
		String[] st = r.readLine().split(" ");
		int a = Integer.parseInt(st[0]);
		int b = Integer.parseInt(st[1]);
		int c = Integer.parseInt(st[2]);
		int d = Integer.parseInt(st[3]);

		while (true) {
			// t
			c = c - b;
			if (c <= 0) {
				System.out.println("Yes");
				break;
			}

			// a
			a = a - d;
			if (a <= 0) {
				System.out.println("No");
				break;
			}
		}

		r.close();
	}
}

Measured memory_bytes: 32620
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<set>
#include<vector>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int N=50005;
int main()
{
    double l;
    scanf("%lf",&l);
    double x=l/3;
    if(x+x+x==l)
    printf("%.6lf\n",x*x*x);
    else
    printf("%.6lf\n",x*x*(l-x-x));
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int N,A,B; cin>>N>>A>>B;
  int P=0,Q=0,R=0;
  rep(i,0,N){
    int X; cin>>X;
    if(X<=A)
      P++;
    else if(B<X)
      R++;
    else
      Q++;
  }
  cout<<min(P,min(Q,R))<<endl;
  
  }


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

typedef long long ll;
typedef pair<ll, ll> P;

const int MAX = 1e5 + 10;
const int INF = 1e9;
const int MOD = 1e9 + 7;

string s;

int main(){
    cin >> s;

    unordered_map<char, int> m;
    rep(i, s.size()) m[s[i]]++;

    int ans = INF;
    for(auto i : m){
        char c = i.first;
        
        int res = 0;
        string t = s;
        while(1){
            bool flg = true;
            rep(j, t.size() - res){
                if(t[j] != c) flg = false;
            }
            if(flg) break;

            rep(j, t.size() - 1 - res){
                if(t[j] == c || t[j+1] == c) t[j] = c;
            }
            res++;
        }
        ans = min(ans, res);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
S = input()
T = input()
res = []
for i in range(len(S) - len(T) + 1):
  s = S[i:i+len(T)]
  cnt = 0
  for i in range(len(s)):
    if s[i] != T[i]:
      cnt += 1
  res.append(cnt)

print(min(res))

Measured memory_bytes: 9056
#include<bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define reset(X) memset(X, 0, sizeof(X))
using namespace std;

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);

	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

	ll n;
	cin >> n;
	string s;
	while (n)
	{
		ll kl = n % 26;

		if (!kl)
		{
			kl = 26;
		}
		n -= kl;


		kl--;

		s = char('a' + kl) + s;
		n /= 26;
	}
	cout << s;
}



Measured memory_bytes: 3596
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        Integer[] ns = new Integer[n];
        Stream.of(sc.nextLine().split(" "))
              .map(Integer::parseInt)
              .collect(Collectors.toList())
              .toArray(ns);
        System.out.println(Arrays.stream(ns)
                                 .map(Object::toString)
                                 .collect(Collectors.joining(" ")));
        for (int i = 1; i < ns.length; i++) {
            int v = ns[i];
            int j = i - 1;
            while (j >=0 && ns[j] > v) {
                ns[j+1] = ns[j];
                j--;
            }
            ns[j+1] = v;
            System.out.println(Arrays.stream(ns)
                                     .map(Object::toString)
                                     .collect(Collectors.joining(" ")));
        }
    }
}



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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl




typedef long long ll;
const ll mod = 1e9+7;
const int maxn = 3003;





ll dp[maxn][maxn];
//dp[i][j]: # of ways to build perm with elems [1,i], with j in last slot.

// if p[i-1]<p[i], merge with sum(dp[i-1][1]...dp[i-1][p[i]-1])
// if p[i-1]>p[i], merge with dp[i-1][p[i]] + sum(dp[i-1][p[i]+1]...dp[i-1][i-1])





// In the case that we picked a p[i] that already exists in i-1 prefix, then
// we have to "boost" previous elements to accommodate. Let's define a process
// for this. We will fix the current p[i] collision by boosting the other occurrence
// of p[i] by +1. If this causes another collision, we repeat this process (of
// boosting the other occurrence).


// It can be proven that by following this process, the set of "boosts" will
// uniquely determine the final permutation. In fact, this is necessary for
// the algorithm to be correct, otherwise we would overcount permutations.


// Suppose up to i-1, all permutations created by the above process are unique.
// Let's show that at ith element, we still will create permutations uniquely.

// In the case of no collision, the claim is obviously true.
// In the case of a collision, there's only one other p[i] in i-1th prefix,
// (otherwise i-1 prefix wouldn't be a permutation), so the resulting final
// permutation will be unique.




//<><>
//15342

int n;
string s;


void add(ll &x, ll y) {
    x %= mod;
    y %= mod;
    x += y;
    x %= mod;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
    cin>>n>>s;

    s="*"+s;
    dp[1][1]=1;

    for (int i=2; i<=n; i++) {
	
	for (int j=1; j<=i; j++) {
	    dp[i-1][j] += dp[i-1][j-1];
	    dp[i-1][j] %= mod;
	}

	
	for (int j=1; j<=i; j++) {
	    if (s[i-1]=='<') {
		ll acc=dp[i-1][j-1];
		dp[i][j] += acc;
	    }
	    if (s[i-1]=='>') {
		ll acc=dp[i-1][i]-dp[i-1][j-1];
		dp[i][j] += acc;
	    }
	    dp[i][j] %= mod;
	}
	// for (int b=1; b<=i; b++) {
	//     for (int a=1; a<=i-1; a++) {
	// 	//...a,b
	// 	int real_a = a;
	// 	if (a>=b) real_a++;
	// 	assert(real_a!=b);
	// 	if ((real_a<b) != (s[i-1]=='<')) {
	// 	    continue;
	// 	}
	// 	add(dp[i][b], dp[i-1][a]);
	//     }
	// }
    }


    ll res = 0;
    for (int j=1; j<=n; j++) {
	add(res, dp[n][j]);
    }
    res %= mod;
    res += mod;
    res %= mod;
    cout<<res<<endl;

    return 0;
}


Measured memory_bytes: 68992
n = int(input())

s = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13"]
h = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13"]
c = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13"]
d = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13"]


for i in range(n):
    mark, num = input().split()
    if mark == "S":
        s.remove(num)
    elif mark == "H":
        h.remove(num)
    elif mark == "C":
        c.remove(num)
    elif mark == "D":
        d.remove(num)


for m in range(len(s)):
    print ("S %s" % s[m])
for m in range(len(h)):
    print ("H %s" % h[m])
for m in range(len(c)):
    print ("C %s" % c[m])
for m in range(len(d)):
    print ("D %s" % d[m])



Measured memory_bytes: 5612
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
#define REP(i,a,n) for(int (i)=(a); (i)<(int)(n); (i)++)
#define rep(i,n) REP(i,0,n)
#define vec vector 


int char_to_int(char c){
  switch(c){
    case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default: return 0;
  }
}

ll digit(ll N){
  ll res;
  res = floor(log10(N)) + 1;
  return res;
}



int main(){
  ll N, M;
  cin >> N >> M;
  
  vector <ll> a(N); vector <ll> b(N);
  rep (i, N) cin >> a.at(i) >> b.at(i);
  
  vector <ll> c(M); vector <ll> d(M);
  rep (i, M) cin >> c.at(i) >> d.at(i);
  
  
  rep(i, N){
    int res = 1;
    int distance = abs(a.at(i) -c.at(0)) + abs(b.at(i) - d.at(0));
    rep(j, M){
      if(abs(a.at(i) -c.at(j)) + abs(b.at(i) - d.at(j)) < distance){
        distance = abs(a.at(i) -c.at(j)) + abs(b.at(i) - d.at(j));
        res = j+1;
      }
    }
    cout << res << endl;
  }
  
  
         
}

Measured memory_bytes: 256
n, m = map(int, input().split())
al = []
bl = []

for _ in range(n):
    row = list(input())
    al.append(row)

for _ in range(m):
    row = list(input())
    bl.append(row)

for i in range(0,n-m+1):
    for j in range(0,n-m+1):
        ok_flag = True
        for y in range(0,m):
            for x in range(0,m):
                if al[i+y][j+x] != bl[y][x]:
                    ok_flag = False
        if ok_flag:
            print('Yes')
            exit()
else:
    print('No')

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

const ll INF = 0x3f3f3f3f3f3f3f3f;
const int MAX_N = 1e5+20;
int n;
int a[MAX_N],b[MAX_N],c[MAX_N];
int Q, K;
int x[MAX_N], y[MAX_N];

struct edge { int to,  cost; };
vector<edge> G[MAX_N];
ll dist[MAX_N];

void add_edge(int from, int to, int cost)
{
	G[from].push_back(edge{to, cost});
	G[to].push_back(edge{from, cost});
}

void dfs(int x, ll d)
{
	dist[x] = d;
	for(auto e : G[x]){
		int t = e.to, c = e.cost;
		if(dist[t] == INF){
			dfs(t, d+c);
		}
	}
}
 
void solve()
{
	for(int i=0;i<n-1;++i) add_edge(a[i],b[i],c[i]);
	memset(dist,0x3f,sizeof(dist));
	dfs(K, 0);
	for(int i=0;i<Q;++i){
		cout<<dist[x[i]]+dist[y[i]]<<'\n';
	}
}

int main()
{
	cin >> n;
	for(int i=0;i<n-1;++i){
		cin >> a[i] >> b[i] >> c[i];
	}
	cin >> Q >> K;
	for(int i=0;i<Q;++i){
		cin >> x[i] >> y[i];
	}
	solve();
	return 0;
}

Measured memory_bytes: 16460