akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>

#define FOR(i,N) for(int i=0;i<N;i++)
#define REP(i,a,N) for(int i=0+a;i<N;i++)
#define lint long long int

using namespace std;

int main(){
	long long int N,x,ans;
	cin>>N>>x;
	if(x==1||x==2*N-1)
		cout<<"No";
	else if(x==2){
		cout<<"Yes"<<endl;
		ans=2*N-1;
		REP(i,0,N-2){
			cout<<ans<<endl;
			ans--;
		}
		cout<<1<<endl<<2<<endl<<3<<endl;
		REP(i,0,N-2){
			cout<<ans<<endl;
			ans--;
		}
	}
	else if(x==2*N-2){
		cout<<"Yes"<<endl;
		ans=1;
		REP(i,0,N-2){
			cout<<ans<<endl;
			ans++;
		}
		cout<<2*N-1<<endl<<2*N-2<<endl<<2*N-3<<endl;
		REP(i,0,N-2){
			cout<<ans<<endl;
			ans++;
		}
	}
	else{
		cout<<"Yes"<<endl;
		ans=1;
		REP(i,0,N-3){
			if(ans==x-2)
				ans=ans+5;
			cout<<ans<<endl;
			ans++;
		}
		cout<<x+2<<endl<<x-1<<endl<<x<<endl<<x+1<<endl<<x-2<<endl;
		REP(i,0,N-3){
			if(ans==x-2)
				ans=ans+5;
			cout<<ans<<endl;
			ans++;
	}
	}




return 0;
}


Measured memory_bytes: 1536
#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>;
const int INF = 1 << 30;
 
int main() {
	int g[5];
	rep(i, 3) cin>>g[i];
	sort(g, g+3);
	int ma=g[2], md=g[1], mi=g[0];
	int cnt = 0;
	cnt += (ma-md) / 2;
	cnt += (ma-mi) / 2;
	bool isMd = (ma-md) % 2 == 0;
	bool isMi = (ma-mi) % 2 == 0;
	if (isMd && !isMi) cnt += 2;
	if (!isMd && isMi) cnt += 2;
	if (!isMd && !isMi) cnt++;
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
//abc144_c.cpp
//Sun Oct 27 20:49:51 2019

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	ll cand = 1;
	ll ans = LLINF;
	while (cand*cand<=n){
		if (n%cand==0){
			ans = min(ans,cand+n/cand);
		}
		cand++;
	}

	cout << ans-2<< endl;
//	printf("%.4f\n",ans);
}

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

int n, h[100], ans = 1;
bool b = false;

int main(){
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> h[i];
  }

  for(int i = 1; i < n; i++){
    for(int j = 0; j < i; j++){
      if(h[j] > h[i]){
        b = false;
        break;
      }
      b = true;
    }
    if(b)
    ans++;
  }

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


Measured memory_bytes: 256
n=int(input())
h=list(map(int,input().split()))
ans=0
tmp_h=h[0]
for i in range(1, n):
    if h[i]<=tmp_h:
        ans+=(tmp_h-h[i])
    tmp_h=h[i]
ans+=h[n-1]
print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<math.h>
#include<string.h>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<deque>
using namespace std;
 
int main(){
	int n,k;
	cin >> n >> k;
	vector<int> s(n,0);
	for(int i=0;i<k;i++){
		int d;
		cin >> d;
		for(int j=0;j<d;j++){
			int x;
			cin >> x;
			s[x-1]++;
		}
	}
	int cnt=0;
	for(int i=0;i<n;i++){
		if(s[i]==0)cnt++;
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 3596
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	int r,d,x_2000;
	cin >> r >> d >> x_2000;

	int x_i = x_2000;
	for( int i=2001; i<=2010;++i ){
		x_i = r * x_i - d;
		cout << x_i << endl;
	}

	return 0;
}


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


int main() {
  int n;
  cin >> n;
  map<int,int> mp;
  rep(i,n) {
    int x; cin >> x;
    mp[x]++;
  }
  int cnt = 0;
  for(auto p : mp) {
    cnt += p.second-1;
  }
  int ans = n - cnt;
  while(cnt>2) {
    cnt = cnt/3+cnt%3;
  }
  if(cnt==1) ans--;
  if(ans<1) ans = 1;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 8252
/*
#include <boost/multiprecision/cpp_int.hpp>
typedef boost::multiprecision::cpp_int mint; //*/
#include <bits/stdc++.h>
#define  rep(i,n) for(li i=0;i<(n);i++)
#define  red(i,n) for(li i=(n)-1;i>=0;i--)
#define  all(a) begin(a),end(a)
#define  pb(a) push_back(a)
using namespace std;
using li = long long;
using vi = vector<li>;
using vs = vector<string>;



int main()
{
    li n,sum=0,ans,x=0;
    cin>>n;
    li a[n];
    rep(i,n)cin>>a[i],sum+=a[i];
    ans=abs(sum-a[0]-a[0]);
    rep(i,n-1){
        x+=a[i];
        if(abs((sum-x)-x)<ans)ans=abs((sum-x)-x);
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 1792
import sys
import numpy as np

sys.setrecursionlimit(10 ** 9)
#def input():
#    return sys.stdin.readline()[:-1]

N = int(input())
#X, Y = map(int,input().split())
A = list(map(int,input().split()))

B = []
for i in range(N):
    B.append([A[i], i])
B.sort(reverse=True)

#dp = [[0 for _ in range(N+2)] for _ in range(N+2)]
#for x in range(1,N+2):
#    for y in range(1,N+2):
##        print(act,i)
#        dp[x][y] = max(dp[x-1][y] + B[y][0] * (B[y][1] - 0 - (x-2))
#                    , dp[x][y-1] + B[y][0] * (N - 1 - B[y][1] - (y-2)))
        
dp = np.zeros(1, dtype=int)
zero = np.zeros(1, dtype=int)
for act, i in B:
    prev = dp.copy()
    dp = np.append(dp,[0])
    l = len(prev)
        
    right = np.arange((N-1-i)*act,(N-1-i)*act - (act*(l)),-act)
    left = np.arange(i*act-(act*(l-1)),(i+1)*act,act)
#    print(left,right,prev,dp)
    np.maximum(np.concatenate([prev + left, zero]),
               np.concatenate([zero, prev + right]),
               out = dp)
#    print(dp)

print(np.max(dp))

Measured memory_bytes: 27944
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<random>
#include<stack>
#include<queue>
#include<cassert>
using namespace std;

int tot(int n, int k){
  if( k == 0 ) return 1;
  else if( k == 1 ) return n-1;
  else return n * tot(n, k-1);
}
int totient(int n, int k){
  int ret = 1;
  for(int i=2; i<=n; i++){
    int cnt = 0;
    while( n % i == 0 ){
      n /= i;
      cnt++;
    }
    ret *= tot(i, cnt);
  }
  return ret;
}

int main(void) {
  int n;
  cin >> n;
  cout << totient(n, 1) << endl;

  return 0;
}





// EOF

Measured memory_bytes: 3076
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		long K = Long.parseLong(sc.next());
		for(int i = 0; i < S.length(); i++) {
			if(!S.substring(i, i + 1).equals("1") || i == K - 1) {
				System.out.println(S.substring(i, i + 1));
				return;
			}
		}
		System.out.println(1);
	}
}


Measured memory_bytes: 22740
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int h,n,sum=0;
	cin>>h>>n;
	int a[n];
	for(int i=0;i<n;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
	if(sum>=h)
    cout<<"Yes";
    else
        cout<<"No";
}


Measured memory_bytes: 640
s = input()
f = int(s[:2])
b = int(s[2:])

if (1<= f <= 12 and 1<=b<=12):
	print("AMBIGUOUS")
elif (1<=f<=12 and 13<=b) or (1<=f<=12 and b==0):
	print("MMYY")
elif (13<=f and 1<=b<=12) or (f==0 and 1<=b<=12):
	print("YYMM")
else:
	print("NA")

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

using namespace std;

int main() {
	int n, m;
	while (cin >> n >> m) {
		if (n == 0 && m == 0) {
			break;
		} 
		int a;
		int data[100][2] = {0};
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				if (i == 0) {
					data[j][1] = j+1;
				}
				cin >> a;
				if (a == 1) {
					data[j][0]++;
				}
			}
		}
		for (int i = m-1; i > 0; i--) {
			for (int j = 0; j < i; j++) {
				if (data[j][0] < data[j+1][0]) {
					swap(data[j][0], data[j+1][0]);
					swap(data[j][1], data[j+1][1]);
				}
			}
		}
		cout << data[0][1];
		for (int i = 1; i < m; i++) {
			cout << " " << data[i][1];
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        var N = long.Parse(Console.ReadLine());
        long sum = 0;
        for (int k = 1; k <= N; k++)
        {
            var n = N / k;
            var a = k;
            var l = n * k;
            sum += (n * (a + l)) / 2;
        }

        Console.WriteLine(sum);
    }
}

Measured memory_bytes: 27456
#include <bits/stdc++.h>
#define int long long
using namespace std;

const int N = 100005, mod = 1e9 + 7;
vector<int> g[N];
int ans = 0;

int dp[N][2];

bool used[N][2];

// 1 --> black
// 0 --> white

int dfs(int v, int p, int cl) {
	if(used[v][cl])
		return dp[v][cl];
	int tmp = 1;
	for(auto to : g[v]) {
		if(to != p) {
			int x = dfs(to, v, 0) % mod;
			if(!cl) {
				x += dfs(to, v, 1);
			}
			x %= mod;
			tmp *= x;
			tmp %= mod;
		}
	}	
	dp[v][cl] = tmp;
	used[v][cl] = 1;
	return tmp;
}

signed main() {
	int n;
	cin >> n;
	for(int i = 1; i < n; i++) {
		int x, y;
		cin >> x >> y;
		g[x].push_back(y);
		g[y].push_back(x);
	}
	ans = dfs(1, -1, 0) + dfs(1, -1, 1);
	cout << ans % mod;
	return 0;
}

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

using namespace std;

int arr[8]={399,799,1199,1599,1999,2399,2799,3199};
set<int> got;

int main()
{
	int n;
	cin >> n;
	int got2=0;
	int i;
	for(i=0;i<n;i++)
	{
		int x;
		cin >> x;
		int i;
		for(i=0;i<8;i++)
			if(x<=arr[i])
				break;
		if(i<8)
			got.insert(i);
		else
			got2++;
	}
	cout << max((int)got.size(),1) << " " << got2+got.size() << endl;

}

Measured memory_bytes: 256
#include <stdio.h>
char s[101];
long long k, ans;
int  d, x;
int main() {
	scanf("%s", s);
	scanf("%lld", &k);
	while (s[d] != NULL)d++;
	x = 1;
	for (int i = 0; i < d - 1; i++) {
		if (s[i] != s[i + 1])x = 0;
	}
	if (x) {
		printf("%lld\n", (k * d) / 2);
		return 0;
	}
	if (s[0] != s[d - 1]) {
		x = 1;
		for (int i = 1; i < d; i++) {
			if (s[i] == s[i - 1])x++;
			else {
				ans += x / 2;
				x = 1;
			}
		}
		ans += x / 2;
		printf("%lld\n", k * ans);
		return 0;
	}
	x = 1;
	for (int i = 1; i < d; i++) {
		if (s[i] == s[i - 1])x++;
		else {
			ans += x / 2;
			x = 1;
		}
	}
	ans *= k;
	ans += x / 2;
	d = 1;
	while (s[d] == s[d - 1])d++;
	ans -= (k - 1) * (d / 2);
	ans += (k - 1) * ((x + d) / 2);
	printf("%lld\n", ans);
}

Measured memory_bytes: 128
#include<stdio.h>
int main(){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    if((a>=1&&a<=5)&&(b>=1&&b<=7)&&(c>=1&&c<=5))
    {
        printf("YES\n");
    }
    else if((a>=1&&a<=7)&&(b>=1&&b<=5)&&(c>=1&&c<=5))
    {
        printf("YES\n");
    }
    else if((a>=1&&a<=5)&&(b>=1&&b<=5)&&(c>=1&&c<=7))
    {
        printf("YES\n");
    }
    else
    {
        printf("NO\n");
    }
    return 0;
}

Measured memory_bytes: 1612
#include <cstdio>
#include <cmath>

using namespace std;

int main(){
  int W,H,x,y,r;
  scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
  if ( x >= r && y >= r && (W - x) >= r && (H - y) >= r ) {
    printf("%s\n", "Yes");
  } else {
    printf("%s\n", "No");
  }
  return 0;
}



Measured memory_bytes: 2688
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
point0 = sum(B)
for (i,j) in zip(A[:-1],A[1:]):
    if i == j - 1:
        point0 += C[i-1]
print(point0)


Measured memory_bytes: 38356
#include <iostream>
#include <iomanip>
#include <algorithm>
using namespace std;
#include <cstdio>
#include <tuple>
#include <string>
#include <vector> 
#include <set>
#include <string.h>
#include <map>
#include <cmath>
#include <deque>
using ll = long long;
using Graph = vector<vector<int>>;
#include <queue>
#include <stack>
#include <stdlib.h>


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

    vector<ll> a(N);
    for(int i=0;i < N;i++) cin >> a[i];

    vector<ll> s(N + 1,0);
    //累積和
    for(int i = 0;i < N;i++) s[i + 1] = (s[i] + a[i]) % M;


    //[l,r + 1)の部分和がmで割り切れる数
    ll cnt = 0LL;
    // for(int i = 0;i < n;i++){
         
    //     for(int j = i + 1;j < n + 1;j++){
    //         if((s[j] - s[i]) % m == 0LL) cnt++;

    //     }

    // } 
    map<ll,ll> mp;
    for(int i = 0;i < s.size();i++){
        cnt += mp[s[i]];
        mp[s[i]]++;


    }
    cout << cnt << endl;

    return 0; 
}

Measured memory_bytes: 5760
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;


int main()
{ios_base::sync_with_stdio(false);
int h,a;
cin>>h>>a;
ol((h+a-1)/a);
return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include<cstring>

using namespace std;

int main()
{
    int t,c=0;
    cin>>t;
    int dish[t],satisfaction[t],more[t-1];
    for(int i=0; i<t; i++)
        cin>>dish[i];

    for(int i=0; i<t; i++)
        cin>>satisfaction[i];

    for(int i=0; i<t-1; i++)
        cin>>more[i];
        for(int i=0;i<t;i++)
        {

            if(dish[i]==dish[i-1]+1){int y=dish[i];
                 c=c+satisfaction[y-1]+more[y-2];}
            else{int y=dish[i];
                c=c+satisfaction[y-1];}
        }cout<<c<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <set>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

int main(){
    int k;
    cin >> k;
    set<ll> st,st2;
    vector<ll> vec;
    reps(i,1,10) st.insert(i);

    rep(i,10){
        for(auto e: st){
            ll tmp = e*10;
            st2.insert(tmp + (e%10));
            if((e%10) > 0) st2.insert(tmp + (e%10)-1);
            if((e%10) < 9) st2.insert(tmp + (e%10)+1);
        }
        for(auto e: st){
            vec.push_back(e);
        }
        st = st2;
        st2.clear();
    }

    sort(vec.begin(),vec.end(),less<ll>());
    cout << vec[k-1] << endl;

    return 0;
}


Measured memory_bytes: 37744
program dv
  implicit none
  integer(8) :: A,B,C,D,nC,nD,nCD,CD,i

  read(*,*) A,B,C,D
  if(mod(A,C).ne.0) then
     nC=-A/C+B/C
  else
     nC=-A/C+B/C+1
  endif
  if(mod(A,D).ne.0) then
     nD=-A/D+B/D
  else
     nD=-A/D+B/D+1
  endif
  CD=C*D/gcd(C,D)
  if(mod(A,CD).ne.0) then
     nCD=-A/CD+B/CD
  else
     nCD=-A/CD+B/CD+1
  endif
  write(*,'(i0)') B-A+1-nC-nD+nCD
stop
contains
function gcd(x,y) result(z)
  implicit none
  integer(8) :: x,y,z
  integer(8) :: m,n,k
  m=x
  n=y
  do while(.true.)
     k=mod(m,n)
     if(k.eq.0) then
        z=n
        exit
     endif
     m=n
     n=k
  enddo

end function gcd
end program dv

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<string>
#include<sstream>
#include<iomanip>
#include<utility>
#include<cmath>
#include<set>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<map>
#include<set>
#include<cstring>
#include<iterator>
#include<bitset>
#include<assert.h>
using namespace std;
 
struct edge {int /*from,*/to,cost;};
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef vector<int> VI;
typedef vector<long long int> VL;
typedef vector<edge> VE;
static const int MOD = 1000000007;
static const int INF = 2147483647;
//static const long long INF = 9223372000000000000;
//static const long long INF = 9223372000000000000/2;
//static const int INF = 1000010000;
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define NP next_permutation
#define PQ priority_queue
#define UB upper_bound
#define LB lower_bound
#define ALL(x) (x).begin(),(x).end()
#define SZ(a) int((a).size())
#define LEN(a) int((a).length())
#define MAX(a,b,c) max((a),max((b),(c)))
#define MIN(a,b,c) min((a),min((b),(c)))
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REP1(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREP1(i,x) for(int i=((int)(x));i>0;i--)
//#define int ll

signed main(){
    string s;
    cin >> s;
    string t = "CODEFESTIVAL2016";
    int ans = 0;
    REP(i,16){
        if(s[i]!=t[i]) ans++;
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
typedef long long ll;
ll n, s, m, i, p;
int main() {
    
    scanf("%lld", &n);
    scanf("%lld", &s);
    s--;
    
    if (n == 1) {
        printf("%lld\n", s);
        return 0;
    }
    i = 1;
    p = 2;
    while (true) {
        scanf("%lld", &m);
        if (m < p)
            i++;//neglect
        else if (m == p) {
            p++;
            i++;
        } else {
            if (m % p == 0)s += m/p - 1;
            else s += m/p;

            i++;
        }
        
        if (i == n)
            break;
    }
    printf("%lld\n", s);
    
}


Measured memory_bytes: 128
using System;
class _0033
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        for (int i = 0; i < n; i++)
        {
            string[] data = Console.ReadLine().Split();
            Console.WriteLine(Judge(data) ? "YES" : "NO");
        }
    }
    public static bool Judge(string[] data)
    {
        int right = 0;
        int left = 0;
        for (int i = 0; i < data.Length; i++)
        {
            if (right < int.Parse(data[i])) right = int.Parse(data[i]);
            else if (left < int.Parse(data[i])) left = int.Parse(data[i]);
            else return false;
        }
        return true;
    }
}

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

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    int x1, x2, x3;
    if(a <= b && a <= c){
        x1 = a;
        if(b <= c){
            x2 = b;
            x3 = c;
        }else if(c <= b){
            x2 = c;
            x3 = b;
        }else{
            x2 = b;
            x3 = c;
        }
    }else if(b <= a && b <= c){
        x1 = b;
        if(a <= c){
            x2 = a;
            x3 = c;
        }else if(c <= a){
            x2 = c;
            x3 = a;
        }else{
            x2 = c;
            x3 = a;
        }
    }else if(c <= a && c <= b){
        x1 = c;
        if(a <= b){
            x2 = a;
            x3 = b;
        }else if(a > b){
            x2 = b;
            x3 = a;
        }else{
            x2 = a;
            x3 = b;
        }
    }else if(a==b&&a==c){
        x1 = a;
        x2 = b;
        x3 = c;
    }
    cout << x1 << ' ' << x2 << ' ' << x3 << endl;
    return 0;
}


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

int main(){

string S, T;
cin >> S >> T;
vector<int>s(26, -1);
vector<int>t(26, -1);
for(int i = 0; i < S.size(); i++){ 
     
     


    int a = S[i] - 'a';
    int b = T[i] - 'a';

     if(s[a] != -1 || t[b] != -1){
         if(s[a] != b || t[b] != a ){
             cout << "No" << endl;
             return 0;
         }
     }


    s[a] = b;
    t[b] = a;

}

cout << "Yes" << endl;
}


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

int main(){
    int n,m;
    cin >> n >> m;
    int p[m];
    string s[m];
    
    rep(i, m){
        cin >> p[i] >> s[i];
        p[i]--;
    }

    bool act_flg[100010]={false};
    int wa_result[100010] = {0};
    int ac_result = 0;

    for(int i=0; i<m; i++){
        if(!act_flg[p[i]]){
            if(s[i]=="AC"){
                ac_result++;
                act_flg[p[i]]=true;
            }
            else if(s[i]=="WA"){
                wa_result[p[i]]++;
            }
        }
    }

    int result=0;
    for(int i=0; i<n; i++){
        if(act_flg[i]){
            result += wa_result[i];
        }
    }

    cout << ac_result << " " << result << endl;
    return 0;
}

Measured memory_bytes: 6656
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
using namespace std;
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int a,b,c;
int n,m;
double d,e,f;
string s,t,u;
vector<int> v,w,x;
vector<string> y,z;

int main(void) {
    cin >> n >> m;
    REP(i,n-m+1){
        y.push_back("");
    }
    REP(i,n){
        cin >> s;
        REP(j,n-m+1){
            y[j]+=s.substr(j,m);
        }
    }
    t = "";
    REP(i,m){
        cin >> s;
        t += s;
    }
    REP(i,n-m+1){
        if (y[i].find(t)!=-1){
            puts("Yes");
            return 0;
        }
    }
    puts("No");
    return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
import java.util.HashMap;

public class Main {

    public static void main(String[] args){
        new Main().solve();
    }
    int INF=100000000;
    int n;
    int[][]a;
    void solve() {
    	Scanner sc=new Scanner(System.in);
    	n=sc.nextInt();
    	a=new int[n][n];
    	int[][]d=new int[n][n];
    	boolean[][]path=new boolean[n][n];
    	for(int i=0;i<n;i++) {
    		for(int j=0;j<n;j++) {
    			a[i][j]=sc.nextInt();
    			d[i][j]=a[i][j];
    			path[i][j]=true;
    		}
    	}
    	long ans=0;
    	
    	for(int k=0;k<n;k++) {
    		for(int i=0;i<n;i++) {
    			for(int j=0;j<n;j++) {
    				if(d[i][j]>d[i][k]+d[k][j]) {
    					ans=-1;
    					System.out.println(ans);
    					return;
    				}
    				if(i!=j && i!=k && j!=k && d[i][j]==d[i][k]+d[k][j]) {
    					path[i][j]=false;
    				}
    			}
    		}
    	}
    	for(int i=0;i<n;i++) {
    		for(int j=i;j<n;j++) {
    			if(path[i][j]) {
    				ans+=d[i][j];
    			}
    		}
    	}
    	System.out.println(ans);
    }
}

Measured memory_bytes: 52308
import java.util.*;

class Main {
    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      String S = sc.next();
      int day = 0;

      switch (S) {
        case "SUN":
          day = 7;
          break;
        case "MON":
          day = 6;
          break;
        case "TUE":
          day = 5;
          break;
        case "WED":
          day = 4;
          break;
        case "THU":
          day = 3;
          break;
        case "FRI":
          day = 2;
          break;
        case "SAT":
          day = 1;
          break;      
        default:
          break;
      }
      System.out.println(day);
    }      
}

Measured memory_bytes: 22740
import java.util.Arrays;
import java.util.Scanner;

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

        int[] weights = new int[count];
        int[] values = new int[count];
        for (int i = 0; i < count; ++i) {
            weights[i] = scanner.nextInt();
            values[i] = scanner.nextInt();
        }

        long[] dp = new long[maxWeight + 1];
        for (int i = 0; i < count; ++i) {
            for (int w = maxWeight; w >= weights[i]; --w) {
                dp[w] = Math.max(dp[w], dp[w - weights[i]] + values[i]);
            }
        }

        System.out.println(dp[maxWeight]);
    }
}


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

typedef long long ll;
typedef long double ld;
const ll M=1e9+7;
const ll MAXN=1e6+7;
const ld pi=acos(-1);

#define gi(n) ll n=read()
#define endl '\n'
#define rep(i,a,b) for(ll i=a; i<b; ++i)
#define per(i,a,b) for(ll i=b-1; i>=a; --i)

typedef vector<ll> V;
typedef vector<V> VV;
typedef set<ll> S;
typedef pair<ll,ll> pl;
typedef vector<pl> Vp;

#define all(v) v.begin(),v.end()
#define pb push_back
#define fs first
#define sc second

inline ll read(){
	ll x=0,ff=1;
	char ch=getchar();
	while(!isdigit(ch)) {if(ch=='-') ff=-1;ch=getchar();}
	while(isdigit(ch)) {x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
	return x*ff;
}

ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll mul(ll a,ll b,ll P){return b?(mul(a*2%P,b>>1,P)+(b&1?a:0))%P:0;}
ll pow1(ll p,ll d, ll P){return d?mul(pow1(mul(p,p,P),d>>1,P),(d&1?p%P:1),P):1;}

V prime;
bool is_composite[MAXN];
void sieve (ll n){
	std::fill (is_composite, is_composite + n, false);
	rep(i,2,n){
		if(!is_composite[i]) prime.pb(i);
		for(ll j = 0; j < prime.size() && i*prime[j] < n; ++j){
			is_composite[i*prime[j]] = true;
			if(i % prime[j] == 0) break;
		}
	}
}
ll modInverse(ll a, ll m){
	ll m0=m,y=0,x=1;
	if(m==1) return 0;
	while(a>1){
		ll q=a/m,t=m;
		m=a%m;
		a=t; 
		t=y;

		y = x-q*y; 
		x = t;
	}
	if(x<0) x += m0;
	return x; 
}

void doit(){
	cout<<(1000-read()%1000)%1000;
}
int main(){
//	for(gi(t);t--;cout<<endl)
		doit();
	return 0;
}

Measured memory_bytes: 3636
N, W = map(int, input().split())
goods = [tuple(map(int, input().split())) for _ in range(N)]
dp = [[0 for i in range(W+1)] for j in range(N+1)]
for i, item in enumerate(goods):
    i += 1
    for w in range(1, W+1):
        if w < item[0]:
            dp[i][w] = dp[i-1][w]
        else:
            dp[i][w] = max(dp[i-1][w], dp[i-1][w-item[0]] + item[1])

print(dp[N][W])

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

int main()
{
	int N, M, X, Y;
	cin >> N >> M >> X >> Y;
	vector<int> x(N);
	vector<int> y(M);
	for (int i = 0; i < N; i++)
	{
		cin >> x[i];
	}
	for (int i = 0; i < M; i++)
	{
		cin >> y[i];
	}
	sort(x.begin(), x.end());
	sort(y.begin(), y.end());
	int xr = x[N - 1];
	int yl = y[0];

	if (xr<yl && xr<Y && X<yl)
	{
		cout << "No War" << endl;
	}
	else
	{
		cout << "War" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,ThxDem=b;i<ThxDem;++i)
#define pb push_back
#define ALL(s) s.begin(),s.end()
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define SZ(n) ((int)(n).size())
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;

int dp[100010][2], a[110], n;

int solve(int k, int t){
  int &r = dp[k][t];
  if(r >= 0) return r;
  r = 0;
  fore(i,0,n) if(k >= a[i]) r |= !solve(k-a[i], !t);
  return r;
}

int main(){FIN;
  memset(dp,-1,sizeof(dp));
  int k; cin >> n >> k;
  fore(i,0,n) cin >> a[i];
  cout << (solve(k,0) ? "First" : "Second") << "\n";
}


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

typedef long long int ll;
ll powk(ll a, ll n = 2){
    ll r = 1;
    for(ll i = 0;i < n;i++){
        r *= a;
    }

    return r;
}

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

    ll ans = n;
    for(ll i = 1;i * i <= n;i++){
        if(n % i == 0){
            ans = min(ans,i + n / i - 2);
        }
    }

    cout << ans;

    return 0;
}

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

N = int(input())
div = make_divisors(N)
ans = 10 ** 13
for d in div:
    ans = min(ans, d + N // d - 2)
print(ans)


Measured memory_bytes: 9440
#include <stdio.h>
int main(void){
    // Your code here!
    int i, n, value=0, a[101]={};
    
    while(scanf("%d", &n)!=EOF){
        a[n]++;
    }
    
    for(i=1; i<=100; i++){
        if(value<a[i]) value=a[i];
    }
    
    for(i=1; i<=100; i++){
        if(value == a[i]) printf("%d\n", i);
    }
    
    return 0;
}



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

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

    string s;
    string subs;
    cin>>s>>subs;
    int mx=0;
    for(int j=0;j<(int)s.size();j++){
        if(s.size()-j>=subs.size()){
            //cout<<"aaaaaaaa";
            int cnt=0;
            int temp=j;
            for(int i=0;i<(int)subs.size();i++){
               if(s.at(temp)==subs.at(i)){
                cnt++;
               }
                temp++;

            }
            mx=max(mx,cnt);
        }
    }
    //cout<<mx;
    cout<<(int)subs.size()-mx;
}


Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#define PI 3.14159265359
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pai;
typedef pair<ll, ll> pal;
const int MOD = 1e9+7;
const ll LLINF = 1e18;

int dp[2001];
int main(){
	int s;
	cin >> s;
	dp[3] = 1;
	for (int i = 4; i <= s; i++){
		dp[i] = dp[i-1] + dp[i-3];
		dp[i] %= MOD;
	}
	cout << dp[s] << endl;
	return 0;
}



Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep1(i,n) for(ll i=1;i<(ll)n;i++)
#define repf(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define repr(i,a,b) for(ll i=(ll)a-1;i>=(ll)b;i--)
#define Fi first
#define Se second
typedef pair<ll, ll> pll;
const ll MAX = 1000;
const char END = '\n';

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	vector<ll> judge(26, 0);
	string S, T;
	cin >> S >> T;
	vector <pll> pairs(S.size());

	rep(i, S.size())
		pairs[i] = make_pair(S[i] - 'a', T[i] - 'a');
	sort(pairs.begin(), pairs.end());

	bool flag = true;
	
	rep(i, S.size()) {
		if (i < S.size() - 1) {
			if ((pairs[i].Fi == pairs[i + 1].Fi) && (pairs[i].Se != pairs[i + 1].Se)) {
				flag = false;
				break;
			}
		}
		if (i > 1) {
			if (pairs[i].Fi != pairs[i - 1].Fi) {
				if (judge[pairs[i].Se] == 0)
					judge[pairs[i].Se] = 1;
				else {
					flag = false;
					break;
				}
			}
		}
	}
	if (flag == true)
		cout << "Yes";
	else
		cout << "No";
	cout << END;
	return 0;
}

Measured memory_bytes: 4116
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<set>
#include<complex>
#include<string>
#include<cstring>
using namespace std;
#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
#define INF 100000000
#define debug(x) cout<<#x<<": "<<x<<endl

#define all(x) x.begin(),x.end()
typedef pair<int,int> P;
typedef pair<int,P> PP;
int n,m,k;
string s;
int a[1000006];
int main()
{
	cin>>n>>m>>k;
	rep(i,n+1)
	{
		rep(j,m+1)
		{
			if(i*m+j*n-2*i*j==k)
			{
				cout<<"Yes"<<endl;
				return 0;
			}
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
int last[40];
int s[400][400];
int c[26];
int d;
int calc(vector<int> &t){
    int ret = 0;
    
        rep(i,d){
            //use t[i];
            ret += s[i][t[i]-1];
            last[t[i]-1] = i+1;
            rep(j,26){
                ret -= c[j]*(i+1-last[j]);
            }
            
    
    
    
                    
        }
        return ret;

}
signed main(){
    cin >> d;
    rep(i,26)cin >> c[i];
    vector<int> ans(d);
    vector<int> t(d);
    rep(i,d)rep(j,26)cin >> s[i][j];
    int cnt = 0;
    int res = 0;
    int mx[400];
    rep(i,d){
        P v = P(0,0);
        rep(j,26){
            v = max(v,P(s[i][j],j));
        }
        mx[i] = v.second + 1;
    }
    while(cnt < 10000){
        rep(i,d){
            if((cnt*2+i)%5 == 0)t[i] = mx[i];
            else t[i] = (cnt+i)%26+1;
        }
        
        if(res < calc(t)){
            res = max(res,calc(t));
            rep(i,d)ans[i] = t[i];
        }
        cnt++;
    }
    rep(i,d)cout << ans[i] << endl;
    return 0;
}


Measured memory_bytes: 4744
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ll long long
//priority_queue<int, vector<int>, greater<int> > pq;
#define _CRT_SECURE_NO_DEPRECATE
const int N = 1000001;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const int mod =  1e9+7;

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

int n,k;
cin>>n>>k;
if(n==2)
{
	if(k==0)
	cout<<"1\n1 2\n";
	else
	cout<<"-1\n";
	return 0;
}
if(n==3)
{
	if(k==1)
	cout<<"2\n1 2\n2 3\n";
	else if(k==0)
	cout<<"3\n1 2\n2 3\n3 1\n";
	else
	cout<<"-1\n";
	return 0;
}
int mx=(n-1)*(n-2)/2;
if(k>mx)
{
	cout<<"-1";
	return 0;
}
int x=mx-k;
cout<<n-1+x<<endl;
rep(i,2,n+1)
{
	cout<<1<<" "<<i<<endl;
}


int cnt=0;
rep(i,2,n)
{
	rep(j,i+1,n+1)
	{
		if(cnt==x)
		return 0;
		cnt++;
		cout<<i<<" "<<j<<endl;

	}
}

}

Measured memory_bytes: 256
import java.util.*;class Main{public static void main(String[]z){int i=0,e=2,t=5135;int[]p=new int[t];for(;i<t;i++){for(;f(p,e)<1;e++);p[i]=e++;}for(Scanner s=new Scanner(System.in);s.hasNext();System.out.println(p[i-1]+" "+p[p[i]<=e?i+1:i]))for(e=s.nextInt(),i=0;i<t;++i)if(p[i]>=e)break;}static int f(int[]p,int n){for(int e:p)if(e>0&&n!=e&&n%e<1)return 0;return 1;}}

Measured memory_bytes: 12000
//include
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;
//conversion
//------------------------------------------
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();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const long long INF = 1000000007;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
// chmax chmin
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(void){
    int N; cin >> N;
    ll a[N], sum=0; REP(i,N){cin >> a[i]; sum+= a[i];}
    
    ll snuke=a[0], kuma = sum-a[0];
    ll ans = abs(snuke-kuma);
    REP(i,N-2){
        snuke += a[i+1];
        kuma -= a[i+1];
        chmin(ans, abs(snuke-kuma));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vs = vector<string>;
using vpii = vector<pair<int,int>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};



int main(void) {
  int n;
  cin >> n;
  vi a(n);
  vi b(n);
  rep(i,n) cin >> a[i];
  rep(i,n) cin >> b[i];
  vi c = a;
  
  int cnta = -1;
  bool aa = false;
  bool bb = false;
  do{
    cnta++;
    if(c==b) {
      aa = true;
      break;
    }
  }while(next_permutation(c.begin(),c.end()));
  int cntb = -1;
  do{
    cntb++;
    if(a==b){
      bb = true;
      break;
    }
  }while(prev_permutation(a.begin(),a.end()));
  int ans = cnta;
  if( bb) ans = cntb; 
    
  
  cout << ans << endl;
         
         
  
}


Measured memory_bytes: 256
# ABC 088
def getInt(): return int(input())
def getIntList(): return [int(x) for x in input().split()]
def db(x): 
    global debug
    if debug: print(x)
debug = False
N = getInt()
a = getIntList()
a.sort()
a.reverse()
al = 0; bo = 0
for i in range(N):
    if i%2==0: al+=a[i]
    else: bo+=a[i]
print(al-bo)

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

#define MaxN 200005
#define INF 2140000000

using namespace std;

int N,K,X,fr[MaxN],Size=0,Ans=0;
pair<int,int> v[MaxN];

int main()
{
    cin>>N>>K;
    for(int i=1;i<=N;i++)
        cin>>X,fr[X]++;
    for(int i=1;i<MaxN;i++)
        if(fr[i])
            v[++Size]={fr[i],i};
    sort(v+1,v+1+Size);
    for(int i=1;i<=Size-K;i++)
        Ans+=v[i].first;
    cout<<Ans;
    return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <vector>
#include <cstdlib>

using namespace std;

int main(void){

	int x, y;

	while (1) {
		cin >> x >> y;
		if (x == 0 && y == 0)
			break;

		if (x > y)
			cout << y << ' ' << x << endl;
		else
			cout << x << ' ' << y << endl;
	}

	return 0;
}

Measured memory_bytes: 3068
#include<stdio.h>

#define max 100005
#define nil -1

typedef struct Node{
  int p, l, r;
} node;

node t[max];
int n, d[max];

void Pr(int u){
  int i, c;
  printf("node %d: parent = %d, depth = %d, ", u, t[u].p, d[u]);
  if(t[u].p==nil)printf("root, ");
  else if(t[u].l==nil)printf("leaf, ");
  else printf("internal node, ");
  printf("[");
  c=t[u].l;
  for(i=0 ; c!=nil ; i++){
    if(i)printf(", ");
    printf("%d",c);
    c=t[c].r;
  }
  printf("]\n");
}

void Dep(int u, int p){
  d[u]=p;
  if(t[u].r!=nil)Dep(t[u].r, p);
  if(t[u].l!=nil)Dep(t[u].l, p+1);
}

int main(){
  int i, j, d, v, c, l, r;
  scanf("%d",&n);
  for(i=0 ; i<n ; i++)t[i].p=t[i].r=t[i].l=nil;
  for(i=0 ; i<n ; i++){
    scanf("%d%d", &v, &d);
    for(j=0 ; j<d ; j++){
      scanf("%d", &c);
      if(j==0)t[v].l=c;
      else t[l].r=c;
      l=c;
      t[c].p=v;
    }
  }
  for(i=0 ; i<n ; i++){
    if(t[i].p==nil)r=i;
  }
  Dep(r, 0);
  for(i=0 ; i<n ; i++)Pr(i);
  return 0;
}



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


int main() 
{
    int N;
    string S;
    cin >> N >> S;
    
    for (int i = 0; i < S.length(); i++) {
        int x = S[i] - 'A';
        x = (x + N) % 26;
        printf("%c", 'A' + x);
    }
    cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define N int(2e5+10)
#define pb push_back
using namespace std;
vector<int>g[N];
vector<int>t;
bool vis[N];
int n,m,u,v;
int dfs(int s){
	vis[s]=true;
	int sz=1;
	for(int i=0;i<g[s].size();i++)
		if(!vis[g[s][i]])
			sz+=dfs(g[s][i]);
	return sz;
}
int main() {
	// your code goes here
	cin>>n>>m;
	while(m--){
		cin>>u>>v;
		g[u].pb(v);
		g[v].pb(u);
	}
	for(int i=1;i<=n;i++)
		if(!vis[i])
			t.pb(dfs(i));
	sort(t.begin(), t.end());
	int ans=t[0], td=t[0];
	for(int i=1;i<t.size();i++){
		t[i]-=td;
		ans+=t[i];
		td+=t[i];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 24076
def partition(A, p, r):
    x = A[r][1]
    i = p - 2
    for j in range(p-1, r):
        if A[j][1] <= x:
            i = i + 1
            hoge = A[i]
            A[i] = A[j]
            A[j] = hoge
    hoge = A[i+1]
    A[i+1] = A[r]
    A[r] = hoge
    return i+1

def quickSort(A, p, r):
    if p < r:
        q = partition(A, p, r)
        quickSort(A, p, q - 1)
        quickSort(A, q + 1, r)
        
    return

def isStable(inData, outData, N):
    for i in range(N):
        if inData[i][0] != outData[i][0]:
            return False
    return True

def merge(A, left, mid, right):

    n1 = mid - left
    n2 = right - mid
    
    L = list(range(n1+1))
    R = list(range(n2+1))
    
    for i in range(n1):
        L[i] = A[left + i]
    for i in range(n2):
        R[i] = A[mid + i]
        
    L[n1] = ['ban', 100000000000]
    R[n2] = ['ban', 100000000000]
    
    i = 0
    j = 0
    
    for k in range(left, right):
        if L[i][1] <= R[j][1]:
            A[k] = L[i]
            i = i + 1
            
        else:
            A[k] = R[j]
            j = j + 1
            
    return
            
def mergeSort(A, left, right):
    count = 0
    if left+1 < right:
        mid = int((left + right) / 2)
        mergeSort(A, left, mid)
        mergeSort(A, mid, right)
        merge(A, left, mid, right)

    return


import sys
import copy

n = int(sys.stdin.readline())
a = []
for _ in range(n):
    tin = list(sys.stdin.readline().split())
    a.append([tin[0], int(tin[1])])
b = copy.deepcopy(a)

key = quickSort(a, 1, n -1)
mergeSort(b, 0, n)

if isStable(a, b, n):
    print('Stable')
else:
    print('Not stable')

for _ in range(n):
    print(*a[_])



Measured memory_bytes: 39216
import itertools
s = input()
digits = list(s)
length = len(digits)
operators = list(itertools.product([0, 1], repeat=length - 1))
total = 0
for i in operators:
    t = []
    for j in range(length - 1):
        t.append(digits[j])
        if i[j] == 1:
            t.append('+')
    t.append(digits[-1])
    total += eval(''.join(t))
print(total)


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


int main() {
    int N;
    cin>>N;
    vector<int>a(N);
    rep(i,N)cin>>a[i];
    vector<int>b=a;
    sort(a.begin(),a.end());
    rep(i,N){
        if(b[i]<a[N/2])cout<<a[N/2]<<endl;
        else cout<<a[N/2-1]<<endl;
    }
}

Measured memory_bytes: 3840
#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import itertools
import math
import sys

INF = float('inf')


def solve(C: str):
    return 'a' if C.islower() else 'A'


def main():

    sys.setrecursionlimit(10 ** 6)

    print(solve(input()))


if __name__ == '__main__':
    main()


Measured memory_bytes: 69220
fn main() {
    let scan = std::io::stdin();

    let mut line = String::new();
    let _ = scan.read_line(&mut line);
    let v: Vec<&str> = line.split_whitespace().collect();

    let n: usize = v[0].parse().unwrap_or(0);

    let mut din: Vec<i32> = vec![0;n+1];
    let mut line = String::new();
    let _ = scan.read_line(&mut line);
    let vec: Vec<&str> = line.split_whitespace().collect();
    for i in 0..n {
        din[i] = vec[i].parse().unwrap_or(0);
    }

    for (i, e) in vec.iter().rev().enumerate() {
        if i == n - 1 {
            print!("{}",e);
            break;
        } else {
            print!("{} ",e);                                                                                                                                                                                                                         }
    }
    println!("");                                                                                                                                                                                                                            }


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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	4 * MAX5;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;
const int N = 1e4;

ll vis[N]; vll adj[N];

// <------------- Declare Variables Here ------------> //

ll t = 1;
ll n, m, s, cnt = 0, u, v;

// <------------- Implement Functions Here ----------> //



// <------------- Start of main() -------------------> //

void MAIN() {
	ll x,a;
	cin >> x >> a;
	cout<<((x < a)?0:10);
}

int main() {
	fastio; randomINT;
	//cin >> t;
	while (t--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 3804
#include <bits/stdc++.h>
using namespace std;
 
 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
 
/* vector<int> A(N); 
    vector<pair<int, int> > tasks; ＃ソートした場合、１つ目でソート
　tie(b, a) = p.at(i); #pairを分割
    tasks.emplace_back(b, a)  ＃配列tasksの最後に(b,a)を追加
　xの二乗:  pow(x, 2.0) 
    小さい順: sort(v.begin(), v.end());
    大きい順: reverse(v.begin(), v.end());
    int: -2,147,483,648 ～ 2,147,483,647
    ll: -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807
    // int型の2次元配列(3×4要素の)の宣言
    vector<vector<int>> data(3, vector<int>(4));
*/
 
int main() {
  
  int A, B, C, count=0, ans=-1;
  cin >> A >> B;
  rep(i,10000){
  	if(floor(i*0.08)==A&&floor(i*0.10)==B) {
      ans=i;
      break;
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256