akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long int
#define ff first
#define ss second
#define S size()
#define mod (ll)(1e9+7)
#define mset(a,k) memset(a,k,sizeof(a));
#define fr(i, x, y) for ( ll i = x; i < y;i++)
#define dr(i, x, y) for ( ll i = x; i >= y; i--)
#define all(v) v.begin(), v.end()
#define pqueue priority_queue<ll>
#define piqueue priority_queue<ll,vll ,greater<ll>>
#define mapcl map<char,ll>
#define mapll map<ll,ll>
#define mapsl map<string,ll>
#define vi vector<ll>
#define vs vector<string>
#define vb vector<bool>
#define psi pair<string,ll>
#define pii pair<ll,ll>
#define piii pair<ll,pii>
#define vii vector<pii>
#define vvi vector<vi>
#define llu unsigned long long
using namespace std;
void fast() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
}
//----------------------------------------FUNCTIONS-------------------------------------
ll gcd(ll x, ll y )						{if (y == 0) return x; return gcd(y, x % y);}
ll lcm(ll a, ll b)						{return (a * b) / gcd(a, b);}
ll logx(ll base, ll num)				{int cnt = 0; while (num != 1) {num /= base; ++cnt;} return cnt;}
vi vin(ll n)							{vi a(n); fr(i, 0, n) cin >> a[i]; return a;}
void in(ll *a, ll n)        			{for (ll i = 0; i < n; i++)cin >> a[i];}
void out(ll *a, ll n)					{fr(i, 0, n) {cout << a[i] << " ";} cout << '\n';}
void vout(vi v)							{fr(i, 0, (ll)v.S) {cout << v[i] << " ";} cout << endl;}
//----------------------------------------START-------------------------------------------
const ll maxN = (ll)(2 * 1e5 + 5 );
ll digits(ll n)
{
	ll cnt = 0;
	while (n)
	{
		n /= 10;
		cnt++;
	}
	return cnt;
}
void solve()
{
	ll n;
	cin >> n;
	/*if (n < 7)
	{	cout << -1 << '\n';
		return;
	}*/
	ll val = 7 % n;
	for (ll i = 1; i < 1e7; i++)
	{
		if (val == 0)
		{
			cout << i << '\n';
			return ;
		}
		val = (val * 10 + 7) % n;
		//val %= n;
	}
	cout << -1 << '\n';
}
int main()
{
	fast();
#ifndef ONLINE_JUDGE
	freopen ("inp1.txt", "r", stdin);
	freopen ("out1.txt", "w", stdout);
#endif
	ll t = 1;
	//cin >> t;
	//sieve();
	while (t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 3604
//minamoto
#include<bits/stdc++.h>
#define R register
#define fi first
#define se second
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
typedef pair<int,int> pi;
const int N=1e6+5;
pi st[N];int a[N],n,l,r,mid,ans,top,las,p,nxt;
bool ck(){
	top=0;
	fp(i,1,n){
		if(a[i]>st[top].fi)st[++top]=pi(a[i],0);
		else{
			while(top&&st[top].fi>=a[i])las=st[top].se,--top;
			st[++top]=pi(a[i],las);
			p=top;
			while(p&&st[p].se==mid-1)--p;
			if(!p)return 0;
			if(st[p].fi-1==st[p-1].fi)++st[p].se,nxt=p;
			else --st[p].fi,st[p+1]=pi(st[p].fi+1,st[p].se+1),nxt=p+1;
			if(p!=top)st[nxt+1]=pi(a[i],0),++nxt;
			top=nxt;
		}
	}
	return 1;
}
int main(){
//	freopen("testdata.in","r",stdin);
	scanf("%d",&n);
	fp(i,1,n)scanf("%d",&a[i]);
	l=1,r=n,ans=n;
	while(l<=r){
		mid=(l+r)>>1;
		ck()?(ans=mid,r=mid-1):l=mid+1;
	}
	printf("%d\n",ans);
	return 0;
} 

Measured memory_bytes: 5120
/*
  ∧,,∧
( 'ω' )つ ＜WA,またお前か！！　
（m9 ＼ 　　
　 ＼　 ＼
　 　 ) ) ＼
　 ／／ ＼ ＼
　 (＿） 　 (＿)
*/

#include <bits/stdc++.h>
using namespace std;

#define all(x) (x).begin(),(x).end()
#define rep(x, y) for (int x = 0; x < y; x++)
#define MOD 1000000007

typedef long long LL;
typedef long double LD;

bool compare_by_b(pair<int, int> a, pair<int, int> b)
{
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

ostringstream oss_global;
string s_global = oss_global.str();

int main()
{
    int N, A, B;
    cin >> N >> A >> B;

    int ans = min(N*A, B);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main()
{  
  int N;
  long long power = 1;
  std::cin >> N;
  
  for(int i = 1; i <= N; i++)
  {
    power *= i;
    power %= 1000000000 + 7;
  }
  
  std::cout << power;
  return 0;
}

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

using namespace std;

#define fcout(d) cout << fixed << setprecision(d)
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rep1(i,n) for(int (i) = 1; (i) <= (n); ++(i))
#define repU(i,bottom,ceiling) for(auto (i) = (bottom); (i) <= (ceiling); ++(i))
#define repD(i,ceiling,bottom) for(auto (i) = (ceiling); (i) >= (bottom); --(i))
#define repV(i,v) for(auto (i) = begin(v); (i) < end(v); ++(i))
#define all(v)  begin(v),end(v)
#define clr(v) fill(all(v),0)
#define l_bnd lower_bound
#define u_bnd upper_bound
#define puf push_front
#define pub push_back
#define pof pop_front
#define pob pop_back
#define mkp make_pair
#define mkt make_tuple
#define fir first
#define sec second
#define q_ceil(n,d) ((n - 1)/(d) + 1)
#define parity(a,b) ((a)^(b) & 1LL ^ 1LL)

typedef long long ll;
typedef unsigned long long ull;
typedef double db;

const pair<int,int> DIR[] = { {1,0},{0,1},{-1,0},{0,-1},{1,1},{-1,1},{-1,-1},{1,-1} };
const int INF_32 = -1 + (1 << 30);
const ll INF_64 = -1 + (1LL << 62);
const int MOD = (int)1e9 + 7;

ull next_subset(ull subset){
	ull tem = subset + (subset & -subset);
	ull btm = (~tem & subset) / (subset & -subset) >> 1;
	return btm | tem;
}

int m = INF_32,n,a,b;
ll s = 0;

void solve(){
	
	return;
}

void input(){
	
	cin>>n;
	rep(i,n){
		cin>>a>>b;
		s += a;
		if(b < a) m = min(m,b);
	}
	
	if(m == INF_32){
		cout<<0<<endl;
	}else{
		cout<<s-m<<endl;
	}
	
	return;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	input();
	solve();
	
	return 0;
}





Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
using namespace std;
const long long maxn = 1e6 + 10, mod = 998244353;
int prime[maxn], primesize, mu[maxn], cnt[maxn];
bool isprime[maxn];
long long pre[maxn];
long long qpow(long long a, long long b)
{
    long long res = 1;
    while(b)
    {
        if(b & 1)
        {
            res *= a;
            res %= mod;
        }
        a *= a;
        a %= mod;
        b /= 2;
    }
    return res;
}
void getlist(int listsize)
{
    mu[1] = 1;
    for(int i = 2; i <= listsize; i++)
    {
        if(!isprime[i])
        {
            prime[++primesize] = i;
            mu[i] = -1;
        }
        for(int j = 1; j <= primesize && i * prime[j] <= listsize; j++)
        {
            isprime[i * prime[j]] = 1;
            if(i % prime[j] == 0)
            {
                mu[i * prime[j]] = 0;
                break;
            }
            mu[i * prime[j]] = -mu[i];
        }
    }
    for(long long i = 1; i <= listsize; i++)
    {
        for(long long j = i; j <= listsize; j += i)
        {
            pre[j] = (pre[j] + mu[i] * i + mod) % mod;
        }
    }
}
int main()
{
    getlist(maxn - 5);
    long long n;
    scanf("%lld", &n);
    long long m = -1;
    long long ans = 0;
    for(int i = 0; i < n; i++)
    {
        long long temp;
        scanf("%lld", &temp);
        ans = ((ans - temp) % mod + mod) % mod;
        cnt[temp]++;
        m = max(m, temp);
    }
    //cout << ans << endl;
    n = m;
    for(long long i = 1; i <= n; i++)
    {
        long long tmp = 0;
        for(long long j = 1; j <= n / i; j++)
        {
            tmp = (tmp + j * cnt[i * j] % mod) % mod;
        }
        //cout << pre[i] << endl;
        ans = (ans + i * pre[i] % mod * tmp % mod * tmp % mod) % mod;
    }
    //cout << ans << endl;
    ans = (ans * qpow(2, mod - 2)) % mod;
    ans = (ans % mod + mod) % mod;
    printf("%lld\n", ans);
}


Measured memory_bytes: 20740
import numpy as np
def func(ans, b_list, a_list, c_list, k, x):
    if k == 0:
        b_list = np.asarray(b_list)
        x_list = np.dot(b_list, a_list)
        if np.all(x_list >= x):
            return np.inner(c_list, b_list)
        else:
            return ans
    ans = min(ans, func(ans, b_list + [1], a_list, c_list, k - 1, x))
    ans = min(ans, func(ans, b_list + [0], a_list, c_list, k - 1, x))
    return ans
n, m, x = map(int, input().split())
c_list = [] 
a_list = []
for i in range(0, n):
    c, *a = map(int, input().split())
    c_list.append(c)
    a_list.append(a)
ans = float("inf")
c_list = np.asarray(c_list)
a_list = np.asarray(a_list)
ans = min(ans, func(ans, [1], a_list, c_list, n - 1, x))
ans = min(ans, func(ans, [0], a_list, c_list, n - 1, x))
if ans == float("inf"):
    print(-1)
else:
    print(ans)

Measured memory_bytes: 27228
#include<iostream>
#include<string.h>
using namespace std;
int main(){
string s;
cin>>s;
int j=0;
for(int i=0;i<s.size();i++){
    if(s[i]=='7'){
        j=1;
        break;
    }
}
if(j==1){
  cout<<"Yes"<<endl;
}
else if(j==0){
   cout<<"No"<<endl;
}
}


Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <map>
#include <vector>
using namespace std;

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

    int ans = 1e6;
    int count = 0;
    for (int i = 0; i < s.size(); i++) {
        if (i % 2 == 0 and s[i] == '0') {
            count++;
        } else if (i % 2 == 1 and s[i] == '1') {
            count++;
        }
    }
    ans = min(ans, count);

    count = 0;
    for (int i = 0; i < s.size(); i++) {
        if (i % 2 == 0 and s[i] == '1') {
            count++;
        } else if (i % 2 == 1 and s[i] == '0') {
            count++;
        }
    }
    ans = min(ans, count);

    cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define MAXN 200000
#define MOD 1000000007

using namespace std;

int v[MAXN + 1];
int fr[MAXN + 1];

vector <int> pos;

int fact[MAXN + 1];

inline int lgput(int a, int b) {
    int ans = 1;
    while(b > 0) {
        if(b & 1)
            ans = (1LL * ans * a) % MOD;
        b >>= 1;
        a = (1LL * a * a) % MOD;
    }
    return ans;
}

inline int comb(int n, int k) {
    return (1LL * fact[n] * lgput((1LL * fact[n - k] * fact[k]) % MOD, MOD - 2)) % MOD;
}
//int b[3 * MAXN + 1];

int main() {
   // fstream cin("A.in");
   // ofstream cout("A.out");
    int i,n,val,ans;
    ios::sync_with_stdio(false);
    cin >> n;
    for(i = 1; i <= n + 1; i++) {
        cin >> v[i];
        fr[v[i]]++;
    }
    val = 1;
    while(fr[val] == 1)
        val++;
    for(i = 1; i <= n + 1; i++)
        if(v[i] == val)
           pos.push_back(i);
    fact[0] = 1;
    for(i = 1; i <= n + 1; i++)
        fact[i] = (1LL * fact[i - 1] * i) % MOD;
    cout << n << endl;
    for(i = 2; i <= n; i++) {
        ans = comb(n + 1, i);
       // printf("%d\n" ,ans);
        if(n - pos[1] + pos[0] >= i - 1)
          ans -= comb(n - pos[1] + pos[0], i - 1);
        if(ans < 0)
         ans += MOD;
        cout << ans << endl;
    }
    cout << 1 << endl;
    //cin.close();
   // cout.close();
    return 0;
}


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

int Seisuu(char words[])
{
	int i;
	int kekka;
	i = 0;
	
	kekka = 0;
	
	while (words[i] != '\0'){
		kekka = kekka * 10 + words[i] - '0';
		i++;
	}
	return (kekka);
}

int main(void)
{
	int player;
	int now_playing;
	int now_player[1000];
	int game;
	char words[300];
	int i , j, move;
	int flag;
	
	while (1){
		scanf("%d%d", &player, &game);
		
		if (player == 0 && game == 0){
			break;
		}
		
		memset(now_player, 0, sizeof(now_player));
		
		now_playing = 0;
		
		for (i = 0; i < player; i++){
			now_player[i] = i + 1;
			now_playing++;
			}
		
		move = 0;
		for (i = 0; i < game; i++){
			scanf("%s",words);
			getchar();
			
			flag = 0;
			
			if (now_playing == 1){
				continue;
			}
			
			if ((i + 1) % 15 == 0){
				if (strcmp(words,"FizzBuzz") != 0){
					for (j = move; j < now_playing - 1; j++) {
						now_player[j] = now_player[j + 1];
					}
					flag = 1;
				}
			}
			
			else if ((i + 1) % 3 == 0){
				if (strcmp(words,"Fizz") != 0){
					for (j = move; j < now_playing - 1; j++) {
						now_player[j] = now_player[j + 1];
					}
					flag = 1;
				}
			}
			
			else if ((i + 1) % 5 == 0){
				if (strcmp(words,"Buzz") != 0){
					for (j = move; j < now_playing - 1; j++) {
						now_player[j] = now_player[j + 1];
					}
					flag = 1;
				}
			}
			
			else {
				if (Seisuu(words) != i + 1){
					for (j = move; j < now_playing - 1; j++) {
						now_player[j] = now_player[j + 1];
					}
					flag = 1;
				}
			}
			
			if (flag == 0){
				if (move < now_playing - 1){
					move++;
				}
				
				else {
					move = 0;
				}
			}
			
			else {
				if (move == now_playing - 1){
					move = 0;
				}
				now_playing--;
			}
		}
		
		for (i = 0; i < now_playing; i++){
			printf("%d", now_player[i]);
			
			if (i == now_playing - 1){
				break;
			}
			printf(" ");
		}
		printf("\n");
	}
	
	return (0);
}

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

int main(){
	int W, H, x, y, r;
	cin >> W >> H >> x >> y >> r;

	if (((x - r) < 0) || ((x + r) > W)) cout << "No" << endl;
	else{
		if (((y - r) < 0) || ((y + r) > H)) cout << "No" << endl;
		else cout << "Yes" << endl;
	}

	return 0;
}


Measured memory_bytes: 3088
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#define maxn 300005
#define R register
#define INF 0x3f3f3f3f
#define lxl long long
#define mod 1000000007
using namespace std;

inline lxl read()
{
	lxl x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9') {if(ch=='-') f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9') {x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
	return x*f;
}

char s[maxn];
lxl n,a[maxn],f[maxn][3][3];

int main()
{
	scanf("%s",s);
	n=strlen(s);
	for(R int i=0;i<n;++i)
		a[i+1]=s[i]=='?'?-1:s[i]-'0';
	f[1][0][0]=1;
	for(R int i=1;i<=n;++i)
	{
		if(a[i]==1)
		{
			f[i+1][0][0]+=f[i][0][1];
			f[i+1][0][1]+=f[i][0][2];
			f[i+1][1][0]+=f[i][0][0]+f[i][1][1];
			f[i+1][1][1]+=f[i][1][2];
			f[i+1][2][0]+=f[i][1][0]+f[i][2][1]+f[i][2][0];
			f[i+1][2][1]+=f[i][2][2];
		}
		else if(a[i]==0)
		{
			f[i+1][0][1]+=f[i][0][0]+f[i][0][2];
			f[i+1][0][2]+=f[i][0][1];
			f[i+1][1][1]+=f[i][1][0]+f[i][1][2];
			f[i+1][1][2]+=f[i][1][1];
			f[i+1][2][1]+=f[i][2][0]+f[i][2][2];
			f[i+1][2][2]+=f[i][2][1];
		}
		else
		{
			f[i+1][0][0]+=f[i][0][1];
			f[i+1][0][1]+=f[i][0][2];
			f[i+1][1][0]+=f[i][0][0]+f[i][1][1];
			f[i+1][1][1]+=f[i][1][2];
			f[i+1][2][0]+=f[i][1][0]+f[i][2][1]+f[i][2][0];
			f[i+1][2][1]+=f[i][2][2];
			f[i+1][0][1]+=f[i][0][0]+f[i][0][2];
			f[i+1][0][2]+=f[i][0][1];
			f[i+1][1][1]+=f[i][1][0]+f[i][1][2];
			f[i+1][1][2]+=f[i][1][1];
			f[i+1][2][1]+=f[i][2][0]+f[i][2][2];
			f[i+1][2][2]+=f[i][2][1];
		}
		for(R int a=0;a<3;++a)
			for(R int b=0;b<3;++b)
				f[i+1][a][b]%=mod;
	}
	lxl ans=(((f[n+1][0][0]+f[n+1][1][0])%mod+f[n+1][2][0])%mod+f[n+1][2][1])%mod+f[n+1][2][2];
	printf("%lld\n",ans%mod);
	return 0;
}

Measured memory_bytes: 23936
#include <bits/stdc++.h>
using namespace std;
int n,c,x;
int d[30][39];
int t[3][30];
int main()
{
	int tmp,ans=0x7fffffff,i,j,k,l;
	scanf("%d%d",&n,&c);
	for(i=0;i<c;i++)
		for(j=0;j<c;j++)
			scanf("%d",&d[i][j]);
	for(i=0;i<n;i++)
	{
		for(j=0;j<n;j++)
		{
			scanf("%d",&x);
			t[(i+j)%3][x-1]++;
		}
	}
	for(i=0;i<c;i++)
	{
		for(j=0;j<c;j++)
		{
			if(i!=j)
			{
				for(k=0;k<c;k++)
				{
					if(i!=k&&j!=k)
					{
						tmp=0;
						for(l=0;l<c;l++)
							tmp+=d[l][i]*t[0][l];
						for(l=0;l<c;l++)
							tmp+=d[l][j]*t[1][l];
						for(l=0;l<c;l++)
							tmp+=d[l][k]*t[2][l];
						if(tmp<ans)
							ans=tmp;
					}
				}
			}
		}
	}
	printf ("%d",ans);
}


Measured memory_bytes: 256
import sys
from math import ceil, floor
from collections import deque, Counter, defaultdict
from fractions import gcd
from bisect import bisect_right
input = lambda: sys.stdin.readline().rstrip()


def eprint(s):
    sys.stderr.write('DEBUG: {}'.format(s))
    return


def main():
    n = int(input())
    Ls = list(map(int, input().split()))
    Ls.sort()
    cnt = 0
    for i in range(0,n-2):
        for j in range(i+1,n-1):
            #k以下なら良い
            k =  Ls[i] + Ls[j] -1
            # bisect_right(Ls, k)個の要素が左にある
            # 答え: bisect_right(Ls, k) - j
            cnt += max(bisect_right(Ls, k) - j-1, 0)
            # print(Ls, Ls[i],Ls[j],k, bisect_right(Ls,k)-j-1)
            #012345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
    print(cnt)
            

if __name__ == '__main__':
    main()

Measured memory_bytes: 69276
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
typedef long long ll;
const int N = 1e7 + 1; 



int main(){
    ll a,b,v,w,t;
    cin>>a>>v>>b>>w>>t;
    double dis=abs(a-b),speed;
    speed = v-w;
    if(speed<=0){
        cout<<"NO";
        return 0;   
    }
    double time = dis/speed;
    if(time <= t)cout<<"YES";
    else cout<<"NO";


    return 0;
}

Measured memory_bytes: 3640
str = gets.split
A,B,X = str[0].to_i, str[1].to_i, str[2].to_i
V = A*A*B
V2 = V/2.0

if X > V2
    c = (V-X)/(A*A*0.5)
    d = Math.atan(c/A)
    answer = d / Math::PI * 180
else
    c = X/(A*B*0.5)
    d = Math.atan(c/B)
    answer = 90 - (d / Math::PI * 180)
end
puts answer

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define faster() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const long long int infLL = 9000000000000000000;
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(a) (a).begin(),(a).end()
#define mx_int_prime 999999937
const int inf = 2000000000;
const double PI = acos(-1);
const double eps = 1e-9;
typedef long double ld;
#define MOD 1000000007
typedef long long ll;
const int mx=2e5+125;
ll pr[mx],ar[mx],br[mx];
#define PB push_back
#define endl '\n'
#define S second
#define F first
int main()
{
    ll n;
    cin >> n;
    bool e=false;
    if(n%2==0)
        e=true;

    if(!e)
    {
        cout << 0 << endl;
        return 0;
    }

    ll a=0;
    n /= 10;
    a += n;
    while(n>=5)
    {
        n /= 5;
        a += n;

    }

    cout << a << endl;

    return 0;
}


Measured memory_bytes: 3556
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
template<typename V> constexpr typename V::value_type sum(const V &v) { return accumulate(all(v), 0); }
void solve();
main { solve(); return 0; }
// clang-format on

template<typename A, typename B>
bool cemax(A &a, const B &b) {
  return a <= b ? (a = b, true) : false;
}

void solve() {
  int m, mi, ma;
  while (cin >> m >> mi >> ma, m) {
    mi--, ma--;
    vi p(m);
    rep(i, m) cin >> p[i];
    int c = 0, r = 0;
    for (int i = mi; i <= ma; i++) {
      if (cemax(c, p[i] - p[i + 1])) r = i;
    }
    cout << r + 1 << endl;
  }
}

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

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
typedef long long ll;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
const int INF = 0x3f3f3f3f;
const int maxn = 1100000;
const int mod = 1e9 + 7;
int dp[maxn];
void run_case()
{
    int s;
    cin >> s;
    dp[0] = 1;
    dp[1] = 0;
    dp[2] = 0;
    dp[3] = 0;
    for (int i = 3; i <= s; i++)
    {
        dp[i] = (dp[i - 1] + dp[i - 3]) % mod;
    }
    cout << dp[s] << "\n";
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    run_case();
    cout.flush();
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i = (int)j;i <= (int)k;i ++)
#define debug(x) cerr<<#x<<":"<<x<<endl
const int maxn=(int)1e6+5;
int a[maxn];
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;cin>>n;
    rep(i,0,n-1){cin>>a[i];}
    int q;cin>>q;while(q--){
        int l,m,r;
        cin>>l>>m>>r;
        rotate(a+l,a+m,a+r);
    }
    rep(i,0,n-1){cout<<a[i]<<(i==n-1?'\n':' ');}
}
/* 
rotate(b,m,e): For each integer kk (0≤k<(e−b)), 
move element b+kb+k to the place of element b+((k+(e−m))mod(e−b))).
 */


Measured memory_bytes: 3184
#!/usr/bin/env python3
import sys
input = sys.stdin.readline
INF = 10**9

def main(): 
    h, n = [int(item) for item in input().split()]
    MAX_LEN = h + 10**4 - 2
    dp = [INF] * MAX_LEN
    dp[0] = 0
    vw = []
    for _ in range(n):
        v, w = map(int, input().split())
        vw.append((v, w))
    vw.sort(reverse=True, key=lambda x:x[0])
    for v, w in vw:
        for j in range(h):
            if dp[j] == INF:
                continue
            tmp = dp[j] + w
            if tmp < dp[j+v]:
                dp[j+v] = tmp
    print(min(dp[h:]))

if __name__ == "__main__":
    main()

Measured memory_bytes: 3692
n = int(input())
mod = 10**9+7

s = [0 for _ in range(2*10**5)]
pos = [-1 for _ in range(2*10**5)]
dp = [0 for _ in range(n + 1)]
dp[0] = 1
dp[-1] = 1

for i in range(n):
	x = int(input())
	if i == 0:
		dp[0] = 1
	else:
		p = pos[x - 1]
		if p == i - 1:
			dp[i] = dp[i - 1]
		elif p > -1:
			dp[i] = dp[i - 1] + dp[p]
			dp[i] %= mod
		else:
			dp[i] = dp[i - 1]
	pos[x - 1] = i
print(dp[n - 1])


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

using namespace std;

#define LIMIT 20

struct P{
  int y,x;
  P(int y,int x) : y(y),x(x) {}
};

int limit;
vector<int> v;

P getPos(int x){
  if(x == 0){ return P(0,2); }
  if(1 <= x && x <= 3){ return P(1,x); }
  if(4 <= x && x <= 8){ return P(2,x-4); }
  if(9 <= x && x <= 11){ return P(3,x-8); }
  return P(4,2);
}

int getPos(P p){
  if(p.y == 0){
    if(p.x == 2){ return 0; }
    else{ return -1; }
  }
  if(p.y == 1){
    if(1 <= p.x && p.x <= 3){
      return p.x;
    }else{
      return -1;
    }
  }
  if(p.y == 2){
    if(0 <= p.x && p.x <= 4){
      return p.x+4;
    }else{
      return -1;
    }
  }
  if(p.y == 3){
    if(1 <= p.x && p.x <= 3){
      return p.x+8;
    }else{
      return -1;
    }
  }
  if(p.y == 4){
    if(p.x == 2){
      return 12;
    }else{
      return -1;
    }
  }
  return -1;
}

int getMD(){
  int sum = 0;
  for(int i = 0 ; i < 13 ; i++){
    if(v[i] == 0){ continue; }
    P np = getPos(i);
    P tp = getPos(v[i]);
    sum += abs(np.x-tp.x) + abs(np.y-tp.y);
  }
  return sum;
}

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

bool dfs(int sp1,int sp2,int step){
  int md = getMD();
  if(md == 0){ return true; }
  if(md + step > limit){
    return false;
  }
  P p[2] = {getPos(sp1),getPos(sp2)};
  for(int i = 0 ; i < 2 ; i++){
    int x = p[i].x, y = p[i].y;
    for(int j = 0 ; j < 4 ; j++){
      int nx = x + dx[j], ny = y + dy[j];
      P np(ny,nx);
      int next = getPos(np);
      if(next == -1){ continue; }
      if(i == 0){
        swap(v[sp1],v[next]);
        if(dfs(next,sp2,step+1)){
          return true;
        }
        swap(v[sp1],v[next]);
      }else{
        swap(v[sp2],v[next]);
        if(dfs(sp1,next,step+1)){
          return true;
        }
        swap(v[sp2],v[next]);
      }
    }
  }
  return false;
}

int main(){
  int x;
  while(cin >> x, x != -1){
    int sp[2];
    v.resize(13); v[0] = x;
    for(int i = 1 ; i < 13 ; i++){
      cin >> v[i];
    }
    for(int i = 0, j = 0 ; i < 13 ; i++){
      if(v[i] == 0){
        sp[j++] = i;
      }
    }
    bool found = false;
    for(limit = 0 ; limit <= LIMIT ; limit++){
      if(dfs(sp[0],sp[1],0)){
        cout << limit << endl;
        found = true;
        break;
      }
    }
    if(!found){
      cout << "NA" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1196
#include<stdio.h>
int main()
{
    int a[200001] = {0};
    int n,i,count = 1;
    scanf("%d",&n);
    for(i = 0; i  < n; i++)
        scanf("%d",&a[i]);
    for(i = 0; i < n; i++)
        if(a[i] == count) count++;
    if(count == 1) printf("-1\n");
    else printf("%d\n",n - count + 1);
    return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#ifdef dbg
#include "./printer.hpp"
#else
#define dump(x) void(0)
#endif

#define MOD 1000000007
#define INF 
using namespace std;
#define ll long long
inline long  toInt(string s) {long  v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

int main(){
  ll n,x;

  while(cin >> n >> x && n + x){
    ll cnt = 0;
    for(ll a = 1; a <= n; a++){
      for(ll b = a + 1; b <= n; b++){
	for(ll c = b + 1; c <= n; c++){
	  if(a + b + c == x){
	    cnt++;
	  }
	}
	  
      }
    }
    cout << cnt << endl;
  }

}

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)n; ++i)

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<pair<int, int> > vii;


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

  int r, g, b, n, ans = 0;
	cin >> r >> g >> b >> n;

	for (int i = 0; i <= n; i++) 
		for (int j = 0; j <= n; j++)    // here it can equals n , n is not length
			if (n - i * r - j * g >= 0 && (n - i * r - j * g) % b == 0) 
				ans++;

	cout << ans << endl;
  
  
  
  
  
  
  
  
  
  
  
  
}	

  //cout << "Case #" << caseNum++ << ": " << ans << endl;  



Measured memory_bytes: 256
import java.util.Scanner;

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

	int n = scan.nextInt();
	int f = n / 100;
	int l = n % 10;

	if(f == l){
	    System.out.println("Yes");
	}else{
	    System.out.println("No");
	}
    }
}


Measured memory_bytes: 23636
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>


using namespace std;

int main(){
  int s,w;
  cin>>s>>w;
  if(s>w){
    cout<<"safe";
  }
  else{
    cout<<"unsafe";
  }

}

Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000003
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


#define MAX 3000000
ll fac[MAX];
ll finv[MAX];
ll inv[MAX];

void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    repr(i,2,MAX){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}

ll modpow(ll a, ll n, ll m){
    if(n == 0) return 1;
    ll half = modpow(a,n/2,m);
    ll res = half * half % m;
    if(n & 1) res = res * a % m;
    return res;
}


int main(){
	int Q; cin >> Q;
	COMinit();
	while(Q--){
		int x,d,n; cin >> x >> d >> n;
		ll ans = 0;
		if(d == 0){
			ans = modpow(x,n,MOD);
		}
		else if(n >= MOD) ans = 0;
		else{
			ll k = x*inv[d]%MOD;
			ans = fac[k+n-1]*finv[k-1]%MOD*modpow(d,n,MOD)%MOD;
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 71168
//
//  main.cpp
//  1234
//
//  Created by Moha Jain on 14/04/20.
//  Copyright © 2020 Moha Jain. All rights reserved.
//

#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<queue>
#include<stack>
#include<algorithm>
#include<string>
#include<math.h>
#include <iomanip>
#include <numeric>
#define _USE_MATH_DEFINES

using namespace std;




int main()
{
    long long int a[5],pos;
    for(int i=0;i<5;i=i+1){cin>>a[i];if(a[i]==0){pos=i+1;}}
    cout<<pos<<endl;
}




Measured memory_bytes: 3636
A,B,C=map(int,input().split())
n5=0
n7=0
if A==7:
  n7 += 1
elif A==5:
  n5 += 1
if B==7:
  n7 += 1
elif B==5:
  n5 += 1
if C==7:
  n7 += 1
elif C==5:
  n5 += 1

if n5==2 and n7==1:
  print("YES")
else:
  print("NO")

Measured memory_bytes: 9052
#include<bits/stdc++.h>
#define ll             long long int
#define lb             lower_bound
#define ub             upper_bound
#define fi             first
#define mp             make_pair
#define vll            vector<ll>
#define se             second
#define sz             size()
#define mod            1000000007
#define endl           "\n"
#define fast           ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb             push_back
#define all(v)         v.begin(),v.end()
#define allr(v)        v.rbegin(),v.rend()
#define inp(V,n)      for(int i=0;i<n;i++){cin >> V[i];}
#define oup(V,n)     {for(int i=0;i<n;i++){cout <<  V[i] << " "  ;} cout << endl;}
using namespace std;
ll factorial(ll n)
{
    return (n == 1 || n == 0) ? 1 : n * factorial(n - 1);
}
ll gcd(ll a, ll b)
{
    if (a == 0)
      return b;
    return gcd(b % a, a);
}
ll lcm(ll a, ll b)
{
   return (a*b)/gcd(a, b);
}
bool sortByVal(const pair<double,double> &a,
               const pair<double,double> &b)
{
    if(a.fi==b.fi)
    {
    return (a.second >b.second);
    }
    else
        return (a.fi<b.fi);
}

int main()
{
     fast;
     int q=1;
   // cin>>q;
     while(q--)
    {
     ll n,i,j,k,m,sum=0,ans=0,a=0,b=0,c=0,d=0,e;
      cin>>n;
      cout<<360/gcd(360,n);

    }
   return 0;
}


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

void solve() {
  string str;
  cin >> str;
  int s=0;
  int t=0;
  vector<int> ans(str.length());
  for(;;) {
    if(s >= str.length()) break;
    char c = str[s];
    int count = 0;
    if (c == 'R') {
      while(str[t] == c) {
        count++;
        t++;
      }
      ans[t-1] += (count - count / 2);
      ans[t] += (count / 2);
      s = t;
    } else {
      while(str[t] == c) {
        count++;
        t++;
      }
      ans[s] += (count - count / 2);
      ans[s-1] += (count / 2);
      s = t;
    }
  }
  rep(i,str.length()) cout << ans[i] << " ";
}

int main() {
  solve();
  return 0;
}

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

int main() {
  
  int N, Ans=1, cnt=0, max=0;
  cin >> N;
  for(int i=1; i<=N; i++){
    if(i%2!=0) continue;
    else if(i%2==0){
      int j=i;
      while(j%2==0){
        cnt++;
        j/=2;
      }
      if(max<cnt){
        max=cnt;
        Ans=i;
      }
      cnt=0;
    }
  }
  cout << Ans << endl;
}

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

int nCity , nRoad ;

vector < pair < int , int > > g[1510] ;

int d[1510][1510] ;

void dijistra(int start){
	d[start][start] = 0 ;
	priority_queue < pair < int  , int > > q ; q.push( make_pair(0 , start) ) ;
	while( !q.empty() ){
		int du = -q.top().first , u = q.top().second ;
		q.pop() ;
		if( d[start][u] != du ) continue ;
		for( int i = 0 ; i < (int)g[u].size() ; ++ i ){
			int v = g[u][i].first , w = g[u][i].second ;
			if( d[start][v] > du + w ){
				d[start][v] = du + w ;
				q.push( make_pair( -d[start][v] , v ) ) ;
			}
		}
	}
}

vector < pair < int , int > > MaximumPath ; 

bool ok[1510] ;

vector < int > lis ;

int main(){
	#define NAME "QuietTown"
	//freopen( NAME".inp" , "r" , stdin ) ; freopen( NAME".out" , "w" , stdout ) ;

	cin >> nCity >> nRoad ;

	for( int i = 1 ; i <= nRoad ; ++ i ){
		int u , v , w ; cin >> u >> v >> w ;
		g[u].push_back(make_pair(v , w)) ; g[v].push_back(make_pair(u , w)) ;
	}

	memset(d , 0x3f , sizeof(d)) ;

	for( int i = 1 ; i <= nCity ; ++ i ) dijistra(i) ;

	int max_element = -(int)2e9 ;
 
	for( int u = 1 ; u <= nCity ; ++ u ){
		for( int v = u + 1 ; v <= nCity ; ++ v ){
			max_element = max( max_element , d[u][v] ) ;
		}
	}
	for( int u = 1 ; u <= nCity ; ++ u ){
		for( int v = u + 1 ; v <= nCity ; ++ v ){
			if( d[u][v] == max_element ) MaximumPath.push_back(make_pair(u , v)) , ok[u] = ok[v] = false ;
		}
	}

	for( int u = 1 ; u <= nCity ; ++ u ) ok[u] = true ;

	for( int u = 1 ; u <= nCity ; ++ u ){
		if( !ok[u] ) continue ;
		for( int i = 0 ; i < (int)MaximumPath.size() ; ++ i ){
			pair < int , int > v = MaximumPath[i] ;
			if( d[u][v.first] + d[u][v.second] == max_element ) {ok[u] = false ; break ;}
		}
		if(ok[u]) lis.push_back(u) ;
	}

	cout << (int)lis.size() << endl ;

	for( int i = 0 ; i < (int)lis.size() ; ++ i ) cout << lis[i] << endl ;

	return 0 ;
}


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

int main(void)
{
  int n, k;
  string s;
  cin >> n;
  cin >> k;
  cin >> s;
  s[k-1] = s[k-1] - 'A' + 'a';
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    int k;
    string s;
    char c;
    cin >> n >> k;
    cin >> s;
    c = s[k-1];
    if(c=='A'){
        s[k-1]='a';
    }else if(c=='B'){
        s[k-1]='b';
    }else{
        s[k-1]='c';
    }
    cout << s << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <string>
#include <list>
#include <ctime>
#include <complex>
#include <bitset>
#include <tuple>
#include <functional>

using namespace std;

#define IOS ios::sync_with_stdio(false);cin.tie(0)
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
#define MOD 1000000007LL
#define rep(i,a,n) for (int i=a ; i<n ; i++)
#define per(i,a,n) for (int i=n-1 ; i>=a ; i--)
#define LLINF 100000000000000005LL
#define INF (int)1e9+1
#define endl '\n'
#define pb push_back

// debug 도구

template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
    return '"' + s + '"';
}

string to_string(const char* s) {
    return to_string((string)s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
    bool first = true;
    string res = "{";
    for (int i = 0; i < static_cast<int>(v.size()); i++) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(v[i]);
    }
    res += "}";
    return res;
}

template <size_t N>
string to_string(bitset<N> v) {
    string res = "";
    for (size_t i = 0; i < N; i++) {
        res += static_cast<char>('0' + v[i]);
    }
    return res;
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto& x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}\n";
    return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:\n", debug_out(__VA_ARGS__)

// debug 도구 end

using llong = long long;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using VPII = vector<pair<int, int>>;
using VLL = vector<long long>;
using PII = pair<int, int>;

int main() {
    int a, b;
    cin >> a >> b;
    if (a <= 8 && b <= 8) cout << "Yay!";
    else cout << ":(";
    return 0;
}

Measured memory_bytes: 3572
S = input()
first, second = map(int, (S[:2], S[2:]))
cond1, cond2 = 1 <= int(first) <= 12, 1 <= int(second) <= 12

if cond1:  # 前2桁を「月」とみなせる
    ans = 'AMBIGUOUS' if cond2 else 'MMYY'
else:
    ans = 'YYMM' if cond2 else 'NA'
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int n;
	cin>>n;
	set<int> a;
	rep(i,n){
		int x;
		cin>>x;
		a.insert(x);
	}
	if(a.size()==n){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}
}

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

int main() {
	//cout<<"GfG!";
	unsigned long long int n, i, c1 = 0, j, x, y, c2;
	cin>>n;
	if (n % 2 != 0)
	    cout<<"0";
	else
	{
	   y = 10;
	   while (n/y  != 0)
	   {
	       c1 += n/y;
	       y = y * 5; 
	   } 
	    //c2 = m1;
	    cout<<c1;
	}
	return 0;
}


Measured memory_bytes: 256
import math
N,H = map(int,input().split())
a,b = [],[]
for i in range(N):
    k,kk = map(int,input().split())
    a.append(k)
    b.append(kk)

zanmax = max(a)

b = sorted(b,reverse=True)

num = 0
cnt = 0
for i in b:
    if zanmax < i:
        num += i
        cnt += 1
    if num >= H:
        print(cnt)
        exit()

cnt += ((H-num)/zanmax)
print(math.ceil(cnt))


Measured memory_bytes: 12080
#include<bitset>
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<list>
#include<queue>
#include<algorithm>
#include<functional>
#include<map>
#include<set>
#include<utility>
#include<initializer_list>
#include<tuple>
#include<regex>
using namespace std;
#define ull unsigned long long
#define ll long long
#define rep(i, a, n) for(int i=(a);i<(int)(n);i++)
#define repc(i, a, n) for(int i=(a);i<=(int)(n);i++)
#define all(t) t.begin(), t.end()
#define rall(t) t.rbegin(), t.rend()
#define mat(type, row, col, init) vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout<<(cond? "Yes":"No")<<endl;
#define YES(cond) cout<<(cond? "YES":"NO")<<endl;
#define DBG(str) cerr<<(str)<<endl;
int main() {
	ll n;
	cin >> n;
	vector<pair<ll, int>>x(n);
	vector<ll>y(n);
	rep(i, 0, n) {
		ll a;
		cin >> y[i];
		x[i] = { y[i], i };
	}
	sort(all(y));
	ll left = y[n/2-1];
	ll right = y[n / 2];
	rep(i, 0, n) {
		if (x[i].first < right)cout << right << endl;
		else cout << left << endl;
		
	}

	return 0;
}





Measured memory_bytes: 6912
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ; //何もしない文
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size()) //unsignedのサイズをint型に変換
#define pb push_back

//#define int long long

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

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N,A,B; cin >>N>>A>>B;
    if(abs(A-B)%2 == 0)
    {
        cout << "Alice" << endl;
    }
    else
    {
        cout << "Borys" << endl;
    }

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <tuple>
#include <map>
#include<set>
#include <cmath>
#include <stack>
using namespace std;



int main() {
	int n;
	cin >> n;
	vector<int> a(n,0);
	int k;
	cin >> k;
	int cnt = 0;
	for (int i = 0;i < k;i++) {
		int d;
		cin >> d;
		for (int j = 0;j < d; j++) {
			int c;
			cin >> c;
			a.at(c - 1) += 1;
		}
	}
	for (int i = 0; i < n;i++) {
		if (a.at(i) == 0)cnt += 1;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,sum=1;
	cin>>a>>b;
	for(int i=a;i<=b;i++)
	{
		if(i<0)sum*=-1;
		if(i==0){
			cout<<"Zero";
			return 0;
		}
	}
	if(sum>0)cout<<"Positive"<<endl;
	if(sum<0)cout<<"Negative"<<endl;
	if(sum==0)cout<<"Zero"<<endl;
	return 0;
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP (i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back

using namespace std;

typedef long long ll;

// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const int MOD = 1000000007;

int main() {
  string s;
  cin >> s;
  int a = (s[0] - '0') * 10 + (s[1] - '0');
  int b = (s[2] - '0') * 10 + (s[3] - '0');
  if (1 <= a && a <= 12 && 1 <= b && b <= 12) cout << "AMBIGUOUS" << endl;
  else if (1 <= a && a <= 12) cout << "MMYY" << endl;
  else if (1 <= b && b <= 12) cout << "YYMM" << endl;
  else cout << "NA" << endl;
}


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

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

int main(int argc, char const *argv[])
{
    int n;
    cin >> n;
    char s[n];
    cin >> s;
    int res(0);
    for (int i = 0; i < n - 2; i++)
    {
        if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C')
            res++;
    }
    cout << res;
    return 0;
}

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

using ll = long long;

int cnt_digits(ll N) {
	int digits = 0;
	while (N > 0) {
		N /= 10;
		digits++;

	}

	return digits;

}

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

	int ans = cnt_digits(N); // 1*N=N max(cnt_digits(1),cnt_digits(N))=cnt_digits(N)

	for (ll A = 1LL; A*A <= N; ++A) {
		if (N%A != 0) continue;
		const ll B = N / A;

		const int cur = max(cnt_digits(A), cnt_digits(B));

		if (ans > cur) {
			ans = cur;

		}

	}

	cout << ans << endl;
	return 0;

}

Measured memory_bytes: 256
# https://atcoder.jp/contests/diverta2019/tasks/diverta2019_d

from math import ceil, floor

def divisors(N):
    ans = []
    i = 1
    while i * i <= N:
        if N % i == 0:
            ans.append(i)
            if N // i != i:
                ans.append(N // i)
        i += 1
    ans.sort()
    return ans

N = int(input())
fN = divisors(N)

total = 0
for m in fN[1:]:
    m -= 1
    if floor(N / m) == N % m:
        total += m
print(total)

Measured memory_bytes: 40176
#include<stdio.h>

int main(void){
    int N, L, sum=0; scanf("%d%d", &N, &L);
    int dec=100000;
    for(int i=1; i<=N; i++){
        int temp = L+i-1;
        sum += temp;
        dec = abs(temp)<abs(dec)?temp:dec;
    }
    printf("%d\n", sum-dec);
}

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


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

    vector<pair<int, int>> data(n);

    rep(i, n){
        int temp;
        cin >> temp;
        data[i] = make_pair(temp, i+1);
    }

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

    rep(i, n){
        cout << data[i].second << " ";
    }

    cout << endl;

    return 0;
}


Measured memory_bytes: 1536
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

n,k = nm()
h = nl()
h.sort(reverse=True)
print(sum(h[k:] + [0]))


Measured memory_bytes: 26032
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cmath>
#define ll long long
#define INF 1e+18
#define MOD 998244353
using namespace std;


int main(){
    int N;
    cin >> N;
    int K;
    cin >> K;
    
    ll x[N];
    for(int i=0; i<N; i++){
        cin >> x[i];
    }
    
    ll ans=INF;
    
    for(int i=0; i<=N-K; i++){
        if(x[i]<=0 && x[i+K-1]<=0){
            ans=min(ans,-x[i]);
        }else if(x[i]>=0 && x[i+K-1]>=0){
            ans=min(ans,x[i+K-1]);
        }else{
            ans=min(ans, 2*min(-x[i],x[i+K-1])+max(-x[i],x[i+K-1]));
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024