akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<cmath>
#include<algorithm>
using namespace std;

int n;
string s;

bool yes() {
  if(n&1) return false;
  return s.substr(0, n/2) == s.substr(n/2, n/2);
}

int main() {
  cin >> n >> s;
  puts(yes()? "Yes": "No");
  return 0;
}


Measured memory_bytes: 256
from scipy.sparse import*
n,*a=map(int,open(0).read().split())
print('FSennunkeec'[sum(g>h for g,h in zip(*csgraph.dijkstra(csr_matrix(([1]*~-n,(a[::2],a[1::2])),[n+1]*2),0,[1,n])))*2>=n::2])

Measured memory_bytes: 34480
//??§?°?
#include<stdio.h>

int main()
{
	int a,b;

	scanf("%d %d",&a,&b);
	if(a==b){
			printf("a == b\n");
		}else{

			if(a>b){
					printf("a > b\n");
				}else{
					printf("a < b\n");
				}
	
		}
	return 0;
}

Measured memory_bytes: 580
////=====BIsmiintahir Rahmanir Rahim =====////

/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
         Comiinta University

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

const int maX=1e5+5;
vector<int>ara[maX];
int dp[maX];
int v[maX];
int dfs(int x){
    if(v[x]==1)return dp[x];
    int ans=0;
    for(int i=0;i<ara[x].size();i++){
        ans=max(ans,1+dfs(ara[x][i]));
    }
    v[x]=1;
    dp[x]=ans;
    return ans;
}

int main()
{
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=m;i++){
        int x,y;
        cin>>x>>y;
        ara[x].push_back(y);
    }
    int mx=-1;
    for(int i=1;i<=n;i++){
        dfs(i);
        mx=max(dp[i],mx);
    }
    cout<<mx<<endl;
return 0;
}


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

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
#define int ll

#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=a;i--)
#define per(i,b) gnr(i,0,b)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define fs first
#define sc second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#ifdef LOCAL
#define dmp(x) cerr<<__LINE__<<" "<<#x<<" "<<x<<endl
#else
#define dmp(x) void(0)
#endif
#define tmp template<class t>

tmp void chmax(t&a,t b){if(a<b)a=b;}
tmp void chmin(t&a,t b){if(a>b)a=b;}

tmp using vc=vector<t>;
tmp using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

template<class t,class u>
ostream& operator<<(ostream& os,const pair<t,u>& p){
	return os<<"{"<<p.fs<<","<<p.sc<<"}";
}

tmp ostream& operator<<(ostream& os,const vc<t>& v){
	os<<"{";
	for(auto e:v)os<<e<<",";
	return os<<"}";
}

constexpr ll ten(int n){
	return n==0?1:ten(n-1)*10;
}

tmp void mkuni(vc<t>&v){
	sort(all(v));
	v.erase(unique(all(v)),v.ed);
}

ll read(){ll i;cin>>i;return i;}

using ld=long double;
using cm=complex<ld>;
#define x real()
#define y imag()
const ld eps=1e-7;
int sgn(ld a){return a<-eps?-1:(a>eps?1:0);}
auto cmcmp=[](const cm&a,const cm&b){
	if(sgn(a.x-b.x))return a.x<b.x;
	else return sgn(a.y-b.y)<0;
};

ld dot(cm a,cm b){return a.x*b.x+a.y*b.y;}
ld crs(cm a,cm b){return a.x*b.y-a.y*b.x;}
int ccw(cm a,cm b){return sgn(crs(a,b));}
int ccw(cm a,cm b,cm c){return ccw(b-a,c-a);}

//(-2)[a,-1](0)[b,1](2)
int bet(cm a,cm b,cm c){
	cm d=b-a;
	ld e=dot(d,c-a);
	if(sgn(e)<=0)return sgn(e)-1;
	return sgn(e-norm(d))+1;
}

ld tri2(cm a,cm b,cm c){
	return crs(b-a,c-a);
}

//0-no,1-edge,2-in
int cont(cm a,cm b,cm c,cm d){
	if(ccw(a,b,c)==-1)
		swap(b,c);
	return min({ccw(a,b,d),ccw(b,c,d),ccw(c,a,d)})+1;
}

//no point in edges
vc<cm> convex(vc<cm> s){
	swap(s[0],*min_element(all(s),cmcmp));
	sort(s.bg+1,s.ed,[&](cm a,cm b){
		int c=ccw(s[0],a,b);
		if(c)return c==1;
		else return bet(s[0],a,b)==2;
	});
	vc<cm> t;
	rep(i,s.size()){
		int ss;
		while((ss=t.size())>=2){
			cm a=t[ss-2];
			cm b=t[ss-1];
			cm c=s[i];
			if(ccw(a,b,c)>0)
				break;
			t.pop_back();
		}
		t.pb(s[i]);
	}
	return t;
}

cm readcm(){
	ld a,b;
	char c;
	cin>>a>>c>>b;
	return cm(a,b);
}

ld readld(){
	ld a;
	cin>>a;
	return a;
}

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
	while(1){
		int n=read();
		if(n==0)break;
		vc<cm> s(n);
		rep(i,n)
			s[i]=readcm();
		cout<<n-convex(s).size()<<endl;
	}
}



Measured memory_bytes: 3292
def distance(y,z):
    ans = 0
    for i,j in zip(y,z):
        ans += (i - j)**2
    return ans**0.5

cnt = 0
n, d = map(int,input().split())
x_arr = []
for i in range(n):
    x_arr.append(list(map(int,input().split())))

for i in range(n-1):
    for j in range(i+1, n):
        tmp = distance(x_arr[i],x_arr[j])
        if tmp//1 == tmp:
            cnt += 1

print(cnt)

Measured memory_bytes: 3188
/*********************
*					 *	
* Nothing Impossible *
*					 *
*********************/
#include <algorithm>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <cmath>
#define GetRand(Min, Max) ((rand()%(int)(((Max) + 1)-(Min))) + (Min))
#define Rep(i, min, max) for (int i = min; i < max; ++i)
#define PB push_back
using namespace std;

int main()
{
	int n;
	cin >> n;
	Rep(i, 1, 10)
	{
		Rep(j, 1, 10)
		{
			if(i*j == n)
			{
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*; 

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

		double r = sc.nextDouble();
		double s = (r*2) * Math.PI;
		double b = (r*r) * Math.PI;
		System.out.printf("%.6f %.6f\n",b,s);
		}
	  }


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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long
const ll MOD = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1);

ll power(ll x,ll n){
    rep(i,n) x*=x;
    return x;
}


int main(void)
{
    ll n; cin>>n;
    string ans;
    
    while(n>0){
        n--;
        ans+='a'+n%26;
        n/=26;
    }
    reverse(ans.begin(),ans.end());
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3628
import sys

input = sys.stdin.readline
sys.setrecursionlimit(10**7)
inf = 10**17
mod = 10**9+7

n, m = map(int, input().split())

ac = [0] * n
wa = [0] * n

acn = 0
wan = 0
for i in range(m):
    p, s = input().split()
    p = int(p)
    p -= 1
    if ac[p] > 0: continue
    if s == 'AC':
        ac[p] = 1
        acn += 1
        wan += wa[p]
    else:
        wa[p] += 1

print(acn, wan)


Measured memory_bytes: 10456
#include <stdio.h>
int main(void)
{
    int m, f, r;
    int x;
    while (1)
    {
        scanf("%d %d %d", &m, &f, &r);
        x = m + f;
        if(m == -1 && f == -1 && r == -1)
        {
            break;
        }
        if (m == -1 || f == -1)
        {
            printf("F\n");
        }
        else if (x >= 80)
        {
            printf("A\n");
        }
        else if (x >= 65)
        {
            printf("B\n");
        }
        else if (x >= 50)
        {
            printf("C\n");
        }
        else if (x >= 30)
        {
            if (r >= 50)
            {
                printf("C\n");
            }
            else
            {
                printf("D\n");
            }
        }
        else if (x <= 30)
        {
            printf("F\n");
        }
    }
    return 0;
}


Measured memory_bytes: 2044
// ABEY SAALE
// QUESTION KHUD KR SOLUTION KYU DEKH RHA H
 
 
 
 
 
 
 
 
//MAAF KIJIYEGA ME GUSSE ME IDHAR UDHAR NIKAL JATA HU
#include<bits/stdc++.h>
#define mod 1000000007
#define fr first
#define se second
#define endl "\n"
#define ll long long
#define PI 3.1415926535 
#define pb push_back
#define mpr make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define senky_bansal ios_base::sync_with_stdio(false);
#define IIIT_ALLAHABAD    cin.tie(NULL);cout.tie(NULL);
using namespace std;

ll fac[2000005];
void pre(){ fac[0]=1; fac[1]=1; for(int i=2;i<200005;i++) fac[i]=(i*fac[i-1])%mod;}
ll power(ll a,ll b){ll res=1;while(b){if(b&1) res=(res*a)%mod;a=(a*a)%mod;b=b/2;}return res%mod;}
ll ncr(ll n,ll r){return ((fac[n]*power(fac[r],mod-2))%mod*power(fac[n-r],mod-2))%mod;}
// DEKHIYE JI  WALID JO THE ABBA HAMARE WO YEH function CHHOD KR GYE THE

ll n;
pair<ll,ll>v[2005];
ll dp[2005][2005];
ll a[2005];
ll solve(ll idx,ll st,ll en)
{
    if(idx>n) return 0;
    if(dp[idx][en]!=-1)
      return dp[idx][en];
    ll ans = 0;
    ll ans1 = abs(st-v[idx].se)*v[idx].fr+solve(idx+1,st+1,en);
    ll ans2 = abs(en-v[idx].se)*v[idx].fr+solve(idx+1,st,en-1);
    return dp[idx][en]=max(ans1,ans2);
}
signed main()
{   



      
      senky_bansal
      IIIT_ALLAHABAD
      
      // pre();
      ll t;
      // cin>>t;
      t=1;
      while(t--)
      { 
         cin>>n;
         for(int i=1;i<=n;i++)
         {
               cin>>a[i];
               v[i].fr = a[i];
               v[i].se = i;
         }
         sort(v+1,v+n+1);
         reverse(v+1,v+n+1);
         memset(dp,-1,sizeof(dp));
         ll ans = solve(1,1,n);
         cout<<ans<<endl;


         
         

      }
      






}



























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

typedef long long int ll;

using namespace std;

char lowCaseAlpha[] = {' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
void fast()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
int main()
{
    fast();

    //freopen("out.txt", "w", stdout);

    ll a, b ,c;
    cin >> a >> b >> c;
    if (a == b) cout << c;
    else if (a == c) cout << b;
    else if (b == c) cout << a;

    return 0;
}

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

using namespace std;

int main(){
    
    int n;
    cin>>n;
    string s;
    cin>>s;
    int count = 0;
    for (int i=0; i<=n-3; i++){
        if (s[i]=='A' and s[i+1]=='B' and s[i+2]=='C'){
            count +=1;
        }
    }
    cout<<count;
    return 0;
}

Measured memory_bytes: 256
n=int(input())
li=[]
ans=0
for x in range(1,int(n**0.5)+1):
    if n%x == 0:
        li.append(x)
        if x != n//x:
            li.append(n//x)
li.pop(0)
for x in li:
    if n//(x-1) == n%(x-1):
        ans+=x-1
print(ans)


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

int main() {
	int n, m;
	cin >> n >> m;
	pair<long long, long long> ab[50], cd[50];
	for (int i = 0; i < n; i++) {
		cin >> ab[i].first >> ab[i].second;
	}
	for (int i = 0; i < m; i++) {
		cin >> cd[i].first >> cd[i].second;
	}
	long long far, old_far;
	vector<int>answer;
	int ans=1;
	for (int i = 0; i < n; i++) {
		far = 200000001;
		for (int j = 0; j < m; j++) {
			old_far = far;
			far = min(abs(ab[i].first - cd[j].first) + abs(ab[i].second - cd[j].second), far);
			if (old_far != far) {
				ans = j + 1;
			}
		}
		answer.push_back(ans);
	}
	for (int i = 0; i < answer.size(); i++) {
		cout << answer[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 256
const config = {
    input: '/dev/stdin',
    newline: '\n'
};

const line = require('fs').readFileSync(config.input, 'utf-8').split(config.newline);

let cnt = 0;

const isort = (arr, g) => {
    for (let i = g; i < arr.length; i++) {
        const v = arr[i];
        let j = i - g;
        while (j >= 0 && arr[j] > v) {
            arr[j+g] = arr[j];
            j -= g;
            cnt++;
        }
        arr[j+g] = v;
    }
};

const shellSort = (arr) => {

    const g = [1];
    for (let i = 1; i < arr.length; i++) {
        const g_i = 3 * g[i-1] + 1;
        if (g_i > arr.length) break;
        g.push(g_i);
    }

    console.log(g.length);
    console.log(g.reverse().map(x => x.toString()).join(' '));

    for (let i = 0; i < g.length; i++) {
        isort(arr, g[i]);
    }

    return arr;
};

const n = parseInt(line[0]);
const data = line.slice(1, n+1).map(x => parseInt(x));
const sorted = shellSort(data);

console.log(cnt);
console.log(sorted.map(x => x.toString()).join('\n'));



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

#define int long long

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

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

const int mod=1000000007;
typedef vector<int>vec;
typedef vector<vec>mat;


int mod_pow(int n,int m){
    int ret=1;
    while(m){
        if(m&1)ret=ret*n%mod;
        n=n*n%mod;
        m>>=1;
    }
    return ret;
}

mat mul(const mat &A,const mat &B){
    mat C(A.size(),vec(B[0].size()));
    for(int i=0;i<A.size();i++){
        for(int j=0;j<B[0].size();j++){
            for(int k=0;k<A[0].size();k++){
                C[i][j]=(C[i][j]+A[i][k]*B[k][j])%mod;
            }
        }
    }
    return C;
}

mat mat_pow(mat A,int m){
    mat B(A.size(),vec(A.size()));
    for(int i=0;i<A.size();i++)B[i][i]=1;
    while(m){
        if(m&1)B=mul(B,A);
        A=mul(A,A);
        m>>=1;
    }
    return B;
}

signed main(){
    int N,M;
    cin>>N>>M;
    mat a(3,vint(1));
    a[0][0]=1;
    mat A(3,vint(3));
    A[0][0]=2;A[0][1]=1;A[0][2]=1;
    A[1][0]=2;A[1][1]=1;A[1][2]=0;
    A[2][0]=1;A[2][1]=1;A[2][2]=1;

    mat B(3,vint(3));
    B[0][0]=1;B[0][1]=0;B[0][2]=0;
    B[1][0]=2;B[1][1]=1;B[1][2]=0;
    B[2][0]=1;B[2][1]=1;B[2][2]=1;

    int pre=0;
    rep(i,M){
        int x;cin>>x;
        a=mul(mat_pow(A,x-1-pre),a);
        a=mul(B,a);
        pre=x;
    }

    a=mul(mat_pow(A,N-1-pre),a);
    cout<<(a[0][0]+a[1][0]+a[2][0])%mod<<endl;
    return 0;
}


Measured memory_bytes: 256
x, y = map(int, input().split())

l1 = [1, 3, 5, 7, 8, 10, 12]
l2 = [4, 6, 9, 11]
l3 = [2]

if x in l1:
    if y in l1:
        print("Yes")
    else:
        print("No")
elif x in l2:
    if y in l2:
        print("Yes")
    else:
        print("No")
else:
    print("No")


Measured memory_bytes: 3060
n = int(input())
mod = 10**9 + 7
dp = [[0]*(4**3) for i in range(n)]
dic = {'A': 0, 'C': 1, 'G': 2, 'T': 3}
agct_to_num = dict()
num_to_agct = dict()
for i in 'AGCT':
    for j in 'AGCT':
        for k in 'AGCT':
            num = dic[i]*16 + dic[j]*4 + dic[k]*1
            agct_to_num[i+j+k] = num
            num_to_agct[num] = i+j+k

dp[0] = [1] * (4**3)
dp[1] = [1] * (4**3)
dp[2] = [1] * (4**3)
dp[2][agct_to_num['AGC']] = 0
dp[2][agct_to_num['ACG']] = 0
dp[2][agct_to_num['GAC']] = 0


def is_ok(s):
    if 'AGC' in s:
        return False
    for i in range(len(s)-1):
        t = list(s)
        t[i], t[i+1] = t[i+1], t[i]
        if 'AGC' in ''.join(t):
            return False
    return True


for i in range(3, n):
    for j in range(64):
        for c in 'ACGT':
            tmp = num_to_agct[j] + c
            if is_ok(tmp):
                dp[i][agct_to_num[tmp[1:]]] += dp[i-1][j]

print(sum(dp[n-1]) % mod)

Measured memory_bytes: 9292
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);++i)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
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; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};

const int MAX=510000;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  int a,b,c,d;
  cin >> a >> b >> c>> d;
  b+=60*a;
  d+=60*c;
  int k;
  cin >> k;
  if(d-b>=k)cout << d-b-k << endl;
  else cout << 0 << endl;
  return 0;
}

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

using namespace std;

typedef long long ll;

ll N, K;
vector<ll> divs;
vector<ll> A;

bool chk(ll x){

	vector<ll> b(N);
	rep(i, N){
		if(A[i] % x == 0){
			b[i] = 0;
		}else{
			ll d = A[i] / x;
			b[i] = x * (d + 1) - A[i];
		}
	}

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

	ll pl = 0;
	ll tot = 0;

	ll l = 0;
	ll r = N-1;
	while(l <= r){
		if(tot > 0){
			tot += b[r] - x;
			r--;

			// cout << ">:" << x << "," << l << "," << r << "," << tot << endl;
		}else{
			tot += b[l];
			pl += b[l];
			l++;

			// cout << "<=:" << x << "," << l << "," << r << "," << tot << endl;
		}
	}

	// cout << x << "," << pl << endl;
	return pl <= K;
}

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

	cin >> N >> K;

	A.resize(N);
	ll sm = 0;

	rep(i, N){
		cin >> A[i];
		sm += A[i];
	}


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

	ll ans = 1;
	for(ll x : divs){
		if(chk(x)) ans = max(ans, x);
	}

	cout << ans << endl;
}


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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll k; cin >> k;

	ll x = 7 % k;
	FOR(i,1,k+10) {
		if (x == 0) {
			cout << i << endl;
			return 0;
		}
		x = (10*x + 7) % k;
	}
	cout << -1 << endl;
}



Measured memory_bytes: 3688
#include <bits/stdc++.h>
#define boost std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
constexpr int MAXN = 2e5 + 5;
constexpr int LOG = 25;
constexpr int BIT = 24;
using namespace std;
template <typename T> inline void read(T &x) {
    int f = 1; x = 0;
    char ch = getchar();
    while (!isdigit(ch)) f = (ch == '-') ? -1 : 1, ch = getchar();
    while (isdigit(ch)) x = x * 10 + ch - 48, ch = getchar();
    x *= f;
}
vector <pair <int, int> > G[MAXN];
long long n, a[MAXN], cnt[MAXN], res;
int main() {
    read(n);
    for (int i = 1; i <= n; i++)
        read(a[i]), cnt[a[i]]++;
    for (int i = 1; i <= MAXN - 5; i++) 
        if (cnt[i]) res += cnt[i] * (cnt[i] - 1) / 2;
    for (int i = 1; i <= n; i++) {
        long long tmp = res;
        res -= cnt[a[i]] * (cnt[a[i]] - 1) / 2;
        res += (cnt[a[i]] - 1) * (cnt[a[i]] - 2) / 2;
        printf("%lld\n", res);
        res = tmp;
    }
    return 0;
}

Measured memory_bytes: 9472
#include <stdio.h>

void trace(int A[], int N) 
{
	int i;
	for(i = 0; i < N; i++) {
		if(i > 0) printf(" ");
		printf("%d", A[i]);
	}
	printf("\n");
}

void insertionSort(int A[], int N)
{
	int j, i , v;
	for(i = 1; i < N; i++) {
		v = A[i];
		j = i - 1;
		while(j >= 0 && A[j] > v) {
			A[j + 1] = A[j];
			j--;
		}
		A[j+1] = v;
		trace(A, N);
	}
}

int 
main()
{
	int N, i, j;
	int A[100];
	scanf("%d", &N);
	for (int i = 0; i < N; i++) 
		scanf("%d", &A[i]);
	trace(A, N);
	insertionSort(A, N);
	return 0;
}



Measured memory_bytes: 2076
from sys import stdin


def main():
    N = int(input())
    H = [int(x) for x in stdin.readline().rstrip().split()]

    sum_ = set()
    count = 0

    if N == 1:
        print(0)
        return

    for i in range(N):
        if H[i] >= H[i+1]:
            count += 1
            sum_.add(count)
        else:
            sum_.add(count)
            count = 0
        if i == N-2:
            break

    print(max(sum_))


if __name__ == "__main__":
    main()


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

using namespace std;

int main() {

	int n;
	cin >> n;

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

	vector<int> b(n + 1, 0);

	for (int i = n ; i >=1; i--) {
		if (i > n / 2) {
			b[i] = a[i];
		}
		else {
			int counter = 2;
			while (i*counter <= n) {
				b[i] += b[i*counter];
				counter++;
			}
			b[i] = (b[i]+a[i]) % 2;
		}
	}

	int counter = 0;
	int maxcounter = 0;
	for (int i = 1; i <= n; i++) {
		if (b[i] == 1) {
			counter++;
			maxcounter = i;
		}
	}
	cout << counter << endl;
	for (int i = 1; i <= n; i++) {
		if (b[i] == 1) {
			if (i != maxcounter) {
				cout << i << " ";
			}
			else {
				cout << i << endl;
			}
		}
	}

}

Measured memory_bytes: 2432
x, y = map(int, input().split())

is_exit = False

for t in range(0, 101):
    for k in range(0, 101):
        if t + k == x and 2*t + 4*k == y:
            is_exit = True
            break

if is_exit:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 9112
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <string>
#include <iomanip>
using namespace std;


int main() {
	int n, m;
	cin >> n >> m;
	cout << (((n - 1) * (n)) / 2 + ((m - 1) * (m)) / 2) << endl;

	
}





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

typedef long long ll;

int main() {
    int N;
    cin >> N;
    vector<pair<int,int>> Ti(N);
    for (int i=0;i<N;i++){
        int A, B;
        cin >> A >> B;
        Ti[i] = make_pair(B, A);
    }
    sort(Ti.begin(),Ti.end());
    int t = 0;
    bool ans = true;
    for (int i=0;i<N;i++){
        t += Ti[i].second;
        if (Ti[i].first < t) ans = false;
    }
    if (ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i ++)
#define irep(i,n) for (int i = (int)(n) - 1;i >= 0;--i)
using namespace std;
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;// = 998244353;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;

struct UnionFind {
    int N;
    vector<int> parents;

    UnionFind(int _N) : N(_N){
        parents.assign(N,-1);
    }

    int find(int x) { //xの親を返す
        if (parents[x] < 0) return x;
        return parents[x] = find(parents[x]);
    }
    
    void unite(int x, int y) {  //xとyの含むグループを併合
        int px = find(x);
        int py = find(y);
        if (parents[px] > parents[py]) swap(px,py); 
        if (px != py) {
            parents[px] += parents[py];
            parents[py] = px;
        }     
    }

    bool same(int x, int y) { //x,yが同じグループにいるか判定
        return find(x) == find(y);
    }

    int size(int x) { //xと同じグループのメンバーの個数
        return -parents[find(x)];
    }
    
    vector<int> root() {//ufの根を列挙
        vector<int> res;
        for (int i = 0; i < N; i ++) {
            if (parents[i] < 0) res.push_back(i);
        }
        return res;
    }

    int group_count() { //ufのグループの数を数える
        int cnt = 0;
        for (int i = 0; i < N; i ++) {
            if (parents[i] < 0) cnt ++;
        }
        return cnt;
    }
};

vector<int> sieve(int n) {
    vector<bool> prime(n + 1,true);
    prime[0] = false;
    prime[1] = false;
    for (int i = 3; i * i <= n; i += 2) {
        if (prime[i]) {
            int j = 2;
            while (i * j <= n) {
                prime[i * j] = false;
                j ++;
            }
        }
    }
    vector<int> ans = {2};
    for (int i = 3; i < n + 1; i += 2) {
        if (prime[i]) ans.push_back(i);
    }
    return ans; 
}

int main() {
    int N,K,L; cin >> N >> K >> L;
    UnionFind uf0(N),uf1(N);
    rep(i,K) {
        int p,q; cin >> p >> q;
        --p; --q;
        uf0.unite(p,q);
    }
    rep(i,L) {
        int p,q; cin >> p >> q;
        --p; --q;
        uf1.unite(p,q);
    }

    vector<int> primes = sieve(10000000);
    vector<ll> groupnum(N);
    int cnt = 0;
    map<int,int> toID0,toID1;
    map<ll,int> group;
    for (int i = 0;i < N;++i) {
        int p = uf0.find(i);
        if (toID0.count(p)) groupnum[i] = primes[toID0[p]];
        else {
            toID0[p] = cnt++;
            groupnum[i] = primes[toID0[p]];
        }
        p = uf1.find(i);
        if (toID1.count(p)) groupnum[i] *= (ll)primes[toID1[p]];
        else {
            toID1[p] = cnt++;
            groupnum[i] *= (ll)primes[toID1[p]];
        }
        group[groupnum[i]] ++;
    }
    rep(i,N) cout << group[groupnum[i]] << ' ';
    cout << '\n';
    return 0;
}

Measured memory_bytes: 37296
#include <bits/stdc++.h>
#define rep(i,n) for(int64_t i=0;i < (int64_t)(n);i++)
#define invrep(i,n) for(int64_t i=n-1;i >= 0L;i--)
#define prep(i,n) for(int64_t i=1;i <= (int64_t)(n);i++)
using namespace std;

//////全探索したいときに開けよ////////
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;

void setfspattern_core(int floor,int number,int degree){
  if(floor==degree){
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  }else{
    rep(i,number){
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor+1,number,degree);
    }
  }
}

void setfspattern(int number,int degree){
  int64_t array_num = 1;
  fspcnt = 0;
  rep(i,degree){
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num,vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0,number,degree);
}

//////nCrのmodを求めたいときに開けよ/////////
//int64_t univMod = 1000000007;
//int64_t factnum = 100000
//vector<int64_t> modfact(factnum);
//vector<int64_t> modinvfact(factnum);

/*void setmodfact(){
  for(int i=0;i<factnum;i++){
    if(i == 0){
      modfact.at(i) = 1;
    }else{
      modfact.at(i) = (modfact.at(i-1)*i)%univMod;
    }
  }
}

int64_t calcmodpower(int64_t a,int64_t n){
  int64_t res = 1;
  while(n != 0){
    if(n & 1){
      res = (res * a) % univMod;
    }
    a = (a*a) % univMod;
    n = n >> 1;
  }
  return res;
}

int64_t calcinverse(int64_t n){
	return calcmodpower(n,univMod-2);
}

void setmodinvfact(){
  for(int i=0;i<factnum;i++){
    if(i==0){
      modinvfact.at(i) = 1;
    }else{
      modinvfact.at(i) = calcmodpower(modfact.at(i),univMod-2);
    }
  }
}

int64_t calcmodcomb(int64_t n,int64_t r){
  return (((modfact.at(n)*modinvfact.at(r))%univMod)*modinvfact.at(n-r))%univMod;
}

int64_t calcmodpositive(int64_t n){
  return (n + ((abs(n)+univMod-1)/univMod)*univMod)%univMod;
}
  
    */


/*
int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}
*/

int main(){
  int k;
  cin >> k;
  cout << (k/2)*((k+1)/2) << endl;
}

Measured memory_bytes: 256
#include<cstdio>
int main(){
	int n,t,tim=0,time,i,total=0;
	scanf("%d%d",&n,&t);
	for(i=0;i<n;i++){
		scanf("%d",&time);
		if(time-tim<=t)total+=time-tim;
		else total+=t;
		tim=time;
	}
	printf("%d\n",total+t);
	return 0;
}

Measured memory_bytes: 128
import scala.io.StdIn.{readLine,readInt}

object Main extends App {
  val seq1 = for(i<-1 to 9) yield List(i,i,i)
  val seq2 = for(i<-1 to 7) yield List(i,i+1,i+2)

  def check(m:List[Int], count:Int,u:Int,v:Int):Boolean =
    if(m.length != count) false
    else if(count==2) {
      val List(x,y) = m
      if(x==y) true else false
    } else
      (u to 8).exists( i=> check(m diff seq1(i),count-3,i+1,v)) || (v to 6).exists(i=> check(m diff seq2(i),count-3,u,i))

  Iterator.continually(readLine).takeWhile ( _!=null ).foreach { line =>
    val l = line.map(_.asDigit).toList
    val m = (1 to 9).filter { i=> l.count( _==i ) < 4 && check(i::l,14,0,0) }
    if(m.length>0) println(m.mkString(" ")) else println(0)
  }
}

Measured memory_bytes: 69276
#include <bits/stdc++.h>
#define sz(c)       int(c.size())
#define rep(i,a,b)  for (int i=a; i<(b); ++i)
#define per(i,a,b)  for (int i=(b)-1; i>=(a); --i)
#define fore(c,...) for (auto __VA_ARGS__:(c))
using namespace std;
typedef long long ll;

bool is_pal(string s){
	string t=s;
	reverse(t.begin(),t.end());
	return s==t;
}

int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	cout<<fixed<<setprecision(10);

	string s;
	cin>>s;
	int N=sz(s);
	if (is_pal(s) && is_pal(s.substr(0,(N-1)/2)) && is_pal(s.substr((N+3)/2-1))) {
		cout<<"Yes"<<'\n';
	} else {
		cout<<"No"<<'\n';
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define plskz ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long
using namespace std;

int main() {
    plskz   
    // 8 3 4    
    ll n, a, b, ans=0;
    cin >> n >> a >> b;
    //ans = 3*(8/(3+5)) = 3
    ans += a*(n/(a+b));
    ans += min(a, n%(a+b)); // ans += min(3, 1); i.e. 3+1 = 4 
    cout << ans << endl;
}


Measured memory_bytes: 256
from math import ceil

a, b = tuple(map(int, input().split()))
min_a = ceil(a / 0.08)
max_a = ceil((a + 1) / 0.08)
min_b = ceil(b / 0.1)
max_b = ceil((b + 1) / 0.1)

if (max_a <= min_b) or (max_b <= min_a):
    print(-1)
else:
    print(max(min_a, min_b))


Measured memory_bytes: 3060
N, X = map(int, input().split())
m = sorted([int(input()) for _ in range(N)], reverse=False)
sum = 0
for i in range(N):
    sum += m[i]
    if sum > X:
        print(i)
        break
    elif i == N - 1:
        print(i + 1 + (X - sum) // m[0])

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define x real() 
#define y imag() 
using namespace std;
typedef complex<double> P;

int ccw(P a,P b,P c){
  b-=a;
  c-=a;
  if(imag(conj(b)*c)>0)return 1;
  if(imag(conj(b)*c)<0)return -1;
  return 0;
}

int main(){
  int H,R;
  while(cin>>H>>R,H){
    P h[100];
    for(int i=0;i<H;i++)
      cin>>h[i].x>>h[i].y;
    int m[3];
    double d[3],w[100],a[100];
    P p[3][10];
    cin>>m[0]>>m[1]>>m[2]>>d[0]>>d[1]>>d[2];

    for(int i=0;i<3;i++)
      for(int j=0;j<m[i];j++)
	cin>>p[i][j].x>>p[i][j].y;

    for(int i=0;i<R;i++)cin>>w[i]>>a[i];

    int c[100]={};

    for(int i=0;i<R;i++){
      bool f[100]={};
      for(int j=0;j<H;j++){
	P D=P(a[i]*cos((M_PI*(w[i]-d[0]/2)/180)),a[i]*sin((M_PI*(w[i]-d[0]/2)/180)));
	P U=P(a[i]*cos((M_PI*(w[i]+d[0]/2)/180)),a[i]*sin((M_PI*(w[i]+d[0]/2)/180)));
	if(abs(h[j])<=a[i]&&ccw(P(0,0),U,h[j])<=0&&ccw(P(0,0),D,h[j])>=0)f[j]=1;
      }

      for(int j=0;j<3;j++)
	for(int k=0;k<m[j];k++)
	  for(int l=0;l<H;l++){
	    P D=P(a[i]*cos((M_PI*(w[i]-d[j]/2)/180)),a[i]*sin((M_PI*(w[i]-d[j]/2)/180)));
	    P U=P(a[i]*cos((M_PI*(w[i]+d[j]/2)/180)),a[i]*sin((M_PI*(w[i]+d[j]/2)/180)));
	    if(abs(p[j][k]-h[l])<=a[i]&&ccw(p[j][k],p[j][k]+U,h[l])<=0&&ccw(p[j][k],p[j][k]+D,h[l])>=0)
	      f[l]=0;
	  }
      for(int j=0;j<H;j++)c[j]+=f[j];
    }
    
    int mx=0;
    vector<int> ans;
    for(int i=0;i<H;i++)mx=max(mx,c[i]);
    if(mx){
      for(int i=0;i<H;i++)
	if(mx==c[i])ans.push_back(i+1);
      for(int i=0;i<ans.size();i++){
	if(i)cout<<" ";
	cout<<ans[i];
      }
    }
    else cout<<"NA";
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[6] = {1, 0, -1, 0,1,1};
const int dy[6] = {0, 1, 0, -1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    set<string> S;
    for(int i=0; i<N; i++){
        string s;
        cin >> s;
        S.insert(s);
    }
    cout << S.size() << enld;
    return 0;
}

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

using ll = long long;

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

    int ans = 100;
    for (ll a = 1; a * a <= n; a++) {
        if (n % a != 0) continue;
        ll b = n / a;

        ans = min(ans, max((int)to_string(a).size(),
                           (int)to_string(b).size()));
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int	N = sc.nextInt(),M=sc.nextInt();
		int[][] arrayM = new int[M][2];
		int[] array=new int[N];

		for(int i=0;i<M;i++) {
			arrayM[i][0] = sc.nextInt();
			arrayM[i][1] = sc.nextInt();
		}

		for(int i=0;i<M;i++) {
			array[arrayM[i][0]-1]++;
			array[arrayM[i][1]-1]++;
		}
		for(int i:array) {
			System.out.println(i);
		}
	}
	public static int sample() {
		return 1;
	}

}


Measured memory_bytes: 21588
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define INF 1000000000
#define EPS 1e-10
#define MOD 1000000007
using namespace std;
typedef pair<int,int> P;
typedef long long ll;

ll rank[18], r;
ll n;

string f(ll x){
	stringstream ss;
	ss << x;
	return ss.str();
}

void pre(){
	rank[0] = 0;
	ll x = 1, y = 1;
	for(int i = 1; i < 18; i++){
		x *= 10;
		ll th = (x-1)/3-(y-1)/3, fi = (x-1)/5-(y-1)/5, thfi = (x-1)/15-(y-1)/15;
		rank[i] = (x-y-th-fi+thfi)*i+(th+fi-thfi*2)*4+thfi*8;
		y = x;
	}
}

int main(){
	pre();
	cin >> n;
	ll sum = 0;
	rep(i,18){
		if(sum+rank[i] >= n){
			r = i;
			break;
		}
		sum += rank[i];
	}
	ll po = 1;
	rep(i,r-1) po *= 10;
	ll s = po, e = po*10, mid;
	while(true){
		if(e-s == 1) break;
		mid = (s+e)/2;
		ll th = mid/3-(po-1)/3, fi = mid/5-(po-1)/5, thfi = mid/15-(po-1)/15;
		if(sum+(mid-(po-1)-th-fi+thfi)*r+(th+fi-thfi*2)*4+thfi*8>=n) e = mid;
		else s = mid;
	}
	ll th = s/3-(po-1)/3, fi = s/5-(po-1)/5, thfi = s/15-(po-1)/15;
	ll pt = n-(sum+(s-(po-1)-th-fi+thfi)*r+(th+fi-thfi*2)*4+thfi*8);
	if(pt <= 0){
		if(s%15==0) pt += 8;
		else if(s%5==0) pt += 4;
		else if(s%3==0) pt += 4;
		else pt += r;
		s--;
	}
	int cnt = 0;
	if(pt != 0 || s != 1){
		s++;
		pt--;
	}
	while(true){
		string str;
		if(s%15 == 0) str = "FizzBuzz";
		else if(s%3 == 0) str = "Fizz";
		else if(s%5 == 0) str = "Buzz";
		else str = f(s);
		rep(i,str.size()){
			if(pt > 0){
				pt--;
				continue;
			}
			cnt++;
			cout<<str[i];
			if(cnt == 20) break;
		}
		if(cnt == 20) break;
		s++;
	}
	cout << endl;
}

Measured memory_bytes: 1216
#include<vector>
#include<iostream>
#include<list>
#include<algorithm>
#include<chrono>
#include<map>
#include<set>
#include<string>
#include<unordered_map>

using namespace std;


int main(){
    int n,m,k;
    cin >> n >> m >> k;
    vector<long long> A(n), B(m), a(n+1,0), b(m+1,0);
    for(int i = 0; i < n; i++) {
        cin >> A[i];
        a[i+1] = a[i] + A[i];
    }
    for(int j = 0; j < m; j++){
         cin >> B[j];
         b[j+1] = b[j] + B[j]; 
    }
    int ans=0;
	for(int i=0, j=m; i<=n; ++i) {
		if(a[i]>k)
			break;
		while(b[j] > k - a[i])
			--j;
		ans=max(i+j, ans);
	}
	cout << ans;
}

Measured memory_bytes: 9100
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i,N){
        cin >> A[i];
        if(A[i]%2==0){
            if(A[i]%3==0||A[i]%5==0) continue;
            else {
                cout << "DENIED" << endl;
                return 0;
            }
        }
    }
    cout << "APPROVED" << endl;
    return 0;
}

Measured memory_bytes: 3660
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

int main(void)
{
    int n;
    ll ans = 0;

    cin >> n;
    vector<int> a(n + 1), b(n);

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

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

    for (int i = 0; i < n; i++)
    {
        int x;
        x = min(a[i], b[i]);
        ans += x;

        b[i] -= x;

        x = min(a[i + 1], b[i]);

        ans += x;

        a[i + 1] -= x;
    }

    cout << ans << endl;
}

Measured memory_bytes: 1024
/*input
20 30
*/
#include "bits/stdc++.h"
using namespace std;
const long long md=1e9+7;
long long a[1000005],n;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	int a, b; cin >> a >> b;
	cout << max(0, a - 2*b);
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

t = [0]
for i in range(n-1):
    t.append(a[i]+1)
#print(t)
ans = 0
for i in range(n):
    ans += b[i]
    if a[i] == t[i]:
        ans += c[t[i]-2]
   #     print(c[t[i]-2])
print(ans)

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
int x;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	for(int i=1;i<=5;i++){
		cin>>x;
		if(x==0){cout<<i<<endl;break;}
	}
}


Measured memory_bytes: 3648
#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>;
int main() {
    int n; cin >> n;
    vector<int> a(n);
    map<int, int> mp;
    rep(i, n) {
        int a; cin >> a;
        mp[a]++;
    }
    int cnt = 0;
    for(auto it=mp.begin();it!=mp.end();it++) {
        cnt += (it->second - 1);
    }
    cout << n - 2*((cnt+1)/2);
}


Measured memory_bytes: 5376
#include <stdio.h>  
#include <string.h>  
#include <stdlib.h>  
#include <iostream>  
#include <algorithm>  
#include <time.h>  
#include<cstdio>
#include<vector>
#include<functional>


using namespace std;

bool  cmp(const int x, const int y) {
	return x < y;
}


int main() {
	int N;
	scanf("%d", &N);
	int a[101] = {0};
	int sum = 0;
	for (int i = 0; i < N; i++) {
		scanf("%d", &a[i]);
		sum += a[i];
	}

	sort(a, a + N, cmp);
	int i = 0;
	while (sum% 10 == 0) {
		if (i >= N)break;
		if ((sum - a[i]) % 10 != 0) {
			sum -= a[i];
		}
		i++;

	}
	if (sum % 10 == 0) printf("0");
	else
	printf("%d",sum);
	return 0;


}

Measured memory_bytes: 256
import math
l=[]
for i in range(5):
  l=l+[int(input())]

li=[i%10 for i in l]
lil = [i for i in li if i!=0]
if lil:
  minimum=min([i for i in li if i!=0])
else:
  minimum=0
ans=l.pop(li.index(minimum))
for i in l:
  ans+=math.ceil(i/10)*10

print(ans)

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

A = sorted(map(int, input().split()))
B = sorted(map(int, input().split()))
C = sorted(map(int, input().split()))

cur_l = 0
cur_r = 0
p = 0
for cur_mid in B:
    while cur_l < len(A):
        if A[cur_l] >= cur_mid:
            break
        cur_l += 1
    while cur_r < len(C):
        if cur_mid < C[cur_r]:
            break
        cur_r += 1
    p += cur_l * (len(C) - cur_r)

print(p)


Measured memory_bytes: 22720
#include <bits/stdc++.h>
using namespace std;
#define rep(i,s,e) for(int i = s; i < e; i++)
vector<long long> dis;
int main() 
{
    long long n;
    cin >> n;
    long long s = sqrt(n);
    rep(i,1,s+1)
    {
        if(n % i == 0)
        {
            long long k = (n/i)+i-2;
            dis.push_back(k);
            
        }
    }
    sort(dis.begin(),dis.end());
    cout << dis[0] << endl;

    return 0;
}

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

using namespace std;
 
int main() {
	int n; cin >> n;
	string ans;
	if (n == 0) ans = '0';
	while (n) {
		int t = n % -2;
		if (t < 0) t += 2;
		n = (n - t) / -2;
		if (t) ans = '1' + ans;
		else ans = '0' + ans;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int mochi[101];
int main()
{
	int ans,i,n;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d",&mochi[i]);
	sort(mochi+0,mochi+n);
	ans=unique(mochi,mochi+n)-mochi;
	printf("%d",ans);
	return 0;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,K;
string S;

int from[5050][2];
int to[5050][2];


void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>K>>S;
	
	if(K==1) {
		string T=S;
		string ret=S;
		reverse(ALL(T));
		S+=T;
		FOR(i,N) ret=min(ret,S.substr(i,N));
		cout<<ret<<endl;
		return;
	}
	
	char ret='z';
	FORR(c,S) ret=min(ret,c);
	
	int num=0,ma=0;
	FORR(c,S) {
		if(c==ret) num++;
		else num=0;
		ma=max(ma,num);
	}
	
	if(K>=14 || (ma<<(K-1))>=N) {
		FOR(i,N) cout<<ret;
		cout<<endl;
		return;
	}
	
	string R="{";
	FOR(i,N) {
		if(S[i]!=ret || (i&&S[i-1]==ret)) continue;
		FOR(j,ma) if(i+j==N || S[i+j]!=ret) break;
		
		if(i+j!=N && j!=ma) continue;
		if(i+j==N) ma=N-i;
		
		string T=S.substr(i,ma);
		if(i+ma==N) {
			FOR(j,K) T=T+T;
			FOR(j,N-(ma<<K)) {
				x=i-1-j;
				if(x>=0) T+=S[x];
				else T+=S[-x+1];
			}
			if(T.size()>N) T.resize(N);
		}
		else {
			FOR(j,K-1) T=T+T;
			x=i+ma;
			FOR(j,N-(ma<<(K-1))) {
				if(x<N) T+=S[x];
				else T+=S[2*N-1-x];
				x++;
			}
			if(T.size()>N) T.resize(N);
		}
		R=min(R,T);
		
	}
	
	
	
	cout<<R<<endl;
	
	
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define int long long 
#define INF 1e9
#define LINF 1e18
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define FORr(i, j, k) for(int i = j; i >= k; --i)
#define repr(i, j) FORr(i, j, 0)
 
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<int, P> Pi;
typedef pair<P, P> PP;
 
const int MOD = 1e9 + 7;
const int dy[] = { 0, 0, 1, -1 };
const int dx[] = { 1, -1, 0, 0 };
 
template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

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

    string s;
    cin >> s;
    string tmp = "";
    repr(i, s.size() - 1) {
        tmp += s[i];
        if(tmp == "maerd" || tmp == "remaerd" || tmp == "esare" || tmp == "resare") {
            tmp = "";
        }
    }
    if(tmp == "") cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 592
import numpy as np

i = list(map(int, input().split()))
N = i[0]
M = i[1]

l = np.array([list(map(int, input().split())) for i in range(M)])

limit1 = max(l[:, 0])
limit2 = min(l[:, 1])

print(max(limit2 - limit1 + 1, 0))

Measured memory_bytes: 46780
#include<bits/stdc++.h>
// #include <boost/lexical_cast.hpp>
using namespace std;

#define ll long long int
#define vll vector<ll>
#define vllv vector<vector<ll>> 
#define vpii vector<pair<ll,ll>>
#define pll  pair<ll,ll>
#define sz size()
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll MOD=1000000000+7;
ll ceil1(ll n,ll m){if(n%m==0){return n/m;}return n/m +1;}
ll factor(ll n){
    vll ans;
	if(n==2)ans.pb(2);
	else
    {for(ll i=2;i*i<=n;i++){if(n%i==0 && n%i!=i){ans.pb(i);if(n/i!=i)ans.pb(n/i);}}ans.pb(n);}
    return ans.sz+1;
}
ll fact(ll n){ll res = 1;for (ll i = 2; i <= n; i++)res = res * i; 
    return res; } 
  
ll nCr(ll n, ll r){ return fact(n) / (fact(r) * fact(n - r)); } 
  
void dfs(vllv &v,ll k,vll &par,vll &dis,ll p)
{
    par[k]=p;
    dis[k]=dis[p]+1;
    for(ll i=0;i<v[k].sz;i++){
        if(v[k][i]!=p){
            dfs(v,v[k][i],par,dis,k);
        }
    }
}
bool sortbysec(const pair<string,int> &a,const pair<string,int> &b){return (a.second<b.second);} 

ll pow2(ll n,ll k){ll ans=1;
    while(k>0){
        if(k%2==1)ans=ans*n;n=n*n;k/=2;
    }return ans;}
bool prime(int n){
    int i,j;
    for(i=2;i<=sqrt(n);i++){
        if(n%i==0){
            return false;
        }
    }
    return true;
}

void solve()
{
	ll a,b,c;
	cin>>a>>b>>c;
	cout<<a+b+c-max({a,b,c});
}            
int main()
{
	fast;
    ll q;
    q=1;
    // cin>>q;
    while(q--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3672
#include <cstdio>
#include <algorithm>
using namespace std;
int n, m;
long long r, a;
long long x[1000], y[1000], z[1000], t[1000];

int main()
{
	scanf("%d %d", &n, &m);
	for (int i = 0; i < n; ++i)
		scanf("%lld %lld %lld", &x[i], &y[i], &z[i]);

	int P[8][3] = { { 1,1,1 },{ 1,1,-1 },{ 1,-1,1 },{ 1,-1,-1 },{ -1,1,1 },{ -1,1,-1 },{ -1,-1,1 },{ -1,-1,-1 } };
	for (int i = 0; i < 8; ++i) {
		for (int j = 0; j < n; ++j)
			t[j] = x[j] * P[i][0] + y[j] * P[i][1] + z[j] * P[i][2];
		sort(t, t + n);
		a = 0;
		for (int k = n - m; k < n; ++k)
			a += t[k];
		if (r < a)
			r = a;
	}
	printf("%lld\n", r);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define eps 1e-7
#define all(x) ((x).begin()),((x).end())
#define usecppio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
#define int ll
const bool debug = 0;
using pii = pair<int, int>;
typedef long double D;

struct entry
{
    multiset<int> elements;
    entry(){};
    entry(int x)
    {
        elements.insert(x);
    }
    bool operator<(int x)
    {
        if (elements.empty()) return true;
        else
            return *elements.begin()<x;
    }
};
int n;
vector <entry> vt;
vector <int> G[202020];
int dp[202020];
int pos[202020];
int arr[202020];
void print_entry()
{
    printf("Printing Current Entry...\n");
    for (auto it:vt)
    {
        for (auto itt:it.elements)
        {
            printf("%lld ",itt);
        }
        printf("\n");
    }
    printf("---------------------------------\n");
}
int sz = 0;
void dfs(int r, int p)
{
    if (vt.empty())
    {
        vt.push_back({arr[r]});
        sz++;
        pos[r] = 0;
    }
    else if (vt.back() < arr[r])
    {
        vt.push_back({arr[r]});
        sz++;
        pos[r] = vt.size()-1;
    }
    else
    {
        auto it = lower_bound(all(vt),arr[r]);
        if (it->elements.empty())
            sz++;
        it->elements.insert(arr[r]);
        pos[r] = it-vt.begin();
    }
    //printf("%lld in\n",r);
    dp[r] = sz;
    //print_entry();
    for (auto it:G[r])
        if (it!=p)
            dfs(it, r);
    //printf("%lld out\n",r);
    vt[pos[r]].elements.erase(vt[pos[r]].elements.lower_bound(arr[r]));
    if (vt[pos[r]].elements.empty())
        sz--;
    while (vt.back().elements.empty())
        vt.pop_back();
    //print_entry();
}
int32_t main()
{
    usecppio
    cin >> n;
    for (int i = 1; i<=n; i++) cin >> arr[i];
    for (int i = 1; i<n; i++)
    {
        int u, v; cin >> u >> v;
        G[u].push_back(v);
        G[v].push_back(u);
    }
    dfs(1, 0);
    for (int i = 1; i<=n; i++)
    {
        cout << dp[i] << '\n';
    }
}

Measured memory_bytes: 53848
#include <iostream>
#include <vector>
using namespace std;
     
int main() {
  while(true){
    vector<int> stones;
    int n,startC,lastC;
    int now;
    int last=0;
    stones.push_back(1);
    cin >> n;
    if(n==0)
      break;
    cin >> lastC;
    startC=lastC;
    for(int i=2;i<=n;i++){
      cin >> now;
      if(lastC==now)
	stones[last]++;
      else if(i%2==1){
	last++;
	stones.push_back(1);
    }
      else if(i%2==0){
	if(last!=0){
	  last--;
	  stones[last]+=1+stones[last+1];
	  stones.pop_back();
	}
	else{
	  stones[0]=i;
	  startC=now;
	}
      }
      lastC=now;
    }
    int a[2]={};
    for(int i=0;i<stones.size();i++){
      a[i%2]+=stones[i];
    }
    cout <<((startC==0)?a[0]:a[1]) << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1216
#from collections import deque,defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7
#R = 998244353

def ddprint(x):
  if DBG:
    print(x)

x = inn()
print(1-x)


Measured memory_bytes: 61740