akhauriyash/Code-Regression huggingface dataset:
/*																													   
 Templatka c++ Kacper Fis																							   																											   //
*/																													  																						   
#include <bits/stdc++.h>																							   
																													   
using namespace std; 																								   
																													   
const int INF = 1000000001;																						   
const float PI = 3.14;	
const int mod = 1e9+7;																							   
typedef long long LL;																								   
																													   
typedef vector<int> vi;																								   
typedef list<int> li;																								   
typedef queue<int> qi; 																								   
typedef pair<int,int> ii; 																							   
typedef map<string,int> msi; //np msi['nazwa'] = 'liczba'															   
typedef vector<ii> vii; //vector par<int>, do tworzenia tablicy dla grafów wagowych #dijkstra #Bellman_Ford			   
typedef priority_queue< ii, vector<ii>, greater<ii> > pq; //kolejka priorytetowa vectorów par(top()=min) #dijkstra																													   																				   list<int>::iterator it;																								   
																				   
vector<ii>::iterator iter;																							   
																													   																				   
#define print_list(x) for(it = (x).begin(); it != (x).end(); it++) {cout << *it << " ";}							   
#define print_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++) {cout << *it2 << " ";}						   
#define search_list(x) for(it = (x).begin(); it != (x).end(); it++)													   
#define search_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++);											   
#define pb(x) push_back(x) 																							   
#define pf(x) push_front(x)																							   
#define mp(x, y) make_pair(x, y)                                                                                       
///////////////////////////////////////////////GLOBAL DEFINITIONS//////////////////////////////////////////////////////


///////////////////////////////////////////////FUNCTIONS/////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////MAIN////////////////////////////////////////////////////////////////
int main(int argc, char* argv[])																					 
{ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);                  												       
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	int a, b;
	cin >> a >> b;
	cout << (a-1) * (b-1) << endl;
	
	
	
						
	return 0;
}


Measured memory_bytes: 256
k, n = STDIN.gets.split.map(&:to_i)
a_list = STDIN.gets.split.map(&:to_i)

first_a = a_list.shift
max = 0
before_a = first_a

a_list.each do |a|
  s = a - before_a
  before_a = a
  max = s if s > max
end

last_s = k - a_list[-1] + first_a
max = last_s if last_s > max
puts k - max

Measured memory_bytes: 17412
#include <bits/stdc++.h>
using namespace std;
#define ll          long long
#define PI 		    acos(-1)
#define pb          push_back
#define ins         insert
#define INF        	1000000000000000007 //1e18+7
#define mk          make_pair
#define lb(v,x)     lower_bound(all(v),x)
#define ub(v,x)     upper_bound(all(v),x)
#define ff          first
#define ss          second
#define rev         reverse
#define endl        "\n"
#define max3(x,y,z)  max(x,max(y,z))
#define min3(x,y,z)  min(x,min(y,z))
#define sz(a)       (ll)a.size()
#define ld     		long double
#define minpq       priority_queue <ll,vector<ll>,greater<ll> > 
#define fill(x,y)   memset(x,y,sizeof(x))
#define all(x)      (x).begin(), (x).end()
#define rall(x)     (x).rbegin(), (x).rend()
#define mod         1000000007		//1e9+7
#define bp(n)       __builtin_popcountll(n)
#define mxt(a)      *(max_element(a.begin(),a.end()))
#define mnt(a)      *(min_element(a.begin(),a.end())
#define unique_sort(c) (sort(all(c)), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define rep(i, a, mp) for(ll i = (a); i<=(mp); ++i)
#define trav(a, x) 	  for(auto &a : x)
#define re(i,n)       for(ll i = 0; i < n; ++i) 
const int N = 5e5 + 7;
const ld eps=1e-7;
typedef pair<ll,ll>   pii;
typedef vector<pii>   vpii;
typedef vector<ll>    vll;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
int dx[8]={+1, +1, +1, 0, 0, -1, -1, -1};
int dy[8]={+1, 0, -1, +1, -1, +1, 0, -1};
ll power(ll x,ll y){ll res=1;x=x;while(y>0){if(y&1)res=(res*x);y=y>>1;x=(x*x);}return res;}
template <typename T> T gcd(T a,T mp){ if(a==0) return mp; return gcd(mp%a,a); }
template <typename T> T powm(T a,T mp, ll m){T cnt=1; while(mp>0){ if(mp%2==1) cnt=(cnt*a)%m; mp/=2; a=(a*a)%m; }return cnt%m;}
ll ncr(ll n,ll r){ll res=1;if(r>n)return 0;if(r>n-r)r=n-r;for(ll i=0;i<r;i++){res*=(n-i);res/=(i+1);}return res;}
ll sqr(ll x) { return x * x;} 
void prec(){

}
vll ad[N];
ll dp[N][2],x,y;
int vis[N];
void dfs(ll r)
{
	vis[r]=1;
	dp[r][0]=1;
	dp[r][1]=1;
	vector<ll>v;
	for(auto it:ad[r])
		if (!vis[it]) v.pb(it),dfs(it);
	for(auto it:v){
		dp[r][0]=(dp[r][0]*(dp[it][0]+dp[it][1]))%mod;
		dp[r][1]=dp[r][1]*dp[it][0]%mod;
	}
}
void run(){
	int n;cin>>n;
	rep(i,1,n-1){
		cin>>x>>y;
		ad[x].pb(y);
		ad[y].pb(x);
	}
	dfs(1);	
	cout<<(dp[1][0]+dp[1][1])%mod;
}
int main()
{
    cin.sync_with_stdio(0);cin.tie(0);
	cin.exceptions(cin.failbit);
    int tc=1;
    //cin>>tc;
    prec();
    re(i,tc)
    	run();
    return 0; 
}


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

int main(){
  int A,B,C,X,Y;
  cin >> A >> B >> C >> X >> Y;
  int p = 2*max(X,Y);
  int ans = A*X+B*Y;
  int q;
  int a,b;
  for(int c = 2;c <= p;c += 2){
    if(X-c/2 > 0){
      a = X-c/2;
    }else{
      a = 0;
    }
    if(Y-c/2 > 0){
      b = Y-c/2;
    }else{
      b = 0;
    }
    q=A*a+B*b+C*c;
    if(q<ans){ans=q;}
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3636
#include<stdio.h>
using namespace std;
int main()
{
    int n,x;
    scanf("%d%d",&n,&x);
    while(n!=0||x!=0)
    {
       int co=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;(j<=n)&&(i>j);j++)
        {
            for(int k=1;(k<=n)&&(j>k);k++)
            {
                if(i+j+k==x)
                {
                    co++;
                    //printf("%d %d %d\n",i,j,k);
                }

            }
        }

    }
    printf("%d\n",co);
   scanf("%d%d",&n,&x);

    }


}



Measured memory_bytes: 2696
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using str = string;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
const double PI = 3.141592653589793238;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define REP(i, m, n) for (int i = m; i < (int)n; i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greator<>()
#define d20 std::setprecision(20)
#define veci vector<int>
#define vecll vector<long long int>
#define vecb vector<bool>
#define vecd vector<double>
template <typename T>
T lcm(T a, T b)
{
	return a / __gcd(a, b) * b;
}

int main()
{
	int n;
	cin >> n;
	vecll a(n);
	rep(i, n)
	{
		cin >> a[i];
	}
	sort(all(a), greater<ll>());
	ll ans = a[0];
	if (n % 2 == 1)
	{
		int i = 1;
		for (i = 1; i < n / 2; i++)
		{
			ans += a[i] * 2;
		}
		ans += a[i];
	}
	else
	{
		for (int i = 1; i < n / 2; i++)
		{
			ans += a[i] * 2;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4828
import java.util.*;
public class Main {
  
  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int L = sc.nextInt();
    int R = sc.nextInt();
    
    if ((R / 2019) > (L / 2019)) {
      System.out.println(0);
      return;
    }

    int ans = Integer.MAX_VALUE;
    for (int l = L; l < R; l++) {
      for (int r = l+1; r <=R; r++) {
        int mod = (int)(((long)l*r)%(long)2019);
        if (mod < ans) {
          ans = mod;
        }
      }
    }
    
    System.out.println(ans);
  }  
}


Measured memory_bytes: 23764
import string
import bisect

s=input()
t=input()
tng=len(t)
sng=len(s)

komoji=string.ascii_lowercase
kjlist=[]
kjlist2=[]
mada=[]
for kj in komoji:
    kjlist.append([kj, []])
    kjlist2.append(kj)
    mada.append(kj)

for tt in range(sng):
    ban=kjlist2.index(s[tt])
    kjlist[ban][1].append(tt)

kosu=0
now=-1
nasi=0
zerosw=0
for ss in range(tng):
    ban=kjlist2.index(t[ss])
    if len(kjlist[ban][1])>0:
        basho=bisect.bisect_right(kjlist[ban][1], now)
        if basho==len(kjlist[ban][1]):
            now=kjlist[ban][1][0]
            maekos=kosu
            kosu=(int(kosu/sng)+1)*sng+now
        else:
            now=kjlist[ban][1][basho]
            maekos=kosu
            kosu=int(kosu/sng)*sng+now
    else:
        nasi=1
    
if nasi==0:
    print(kosu+1)
else:
    print(-1)

Measured memory_bytes: 46448
#include <fstream>
#include <numeric>
#include <unordered_set>
#include <sstream>
#include <cassert>
#include <tuple>
#include <iomanip>
#include <random>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <chrono>
#include <stack>
#include <string>
#include <bitset>
#include <unordered_map>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x.size())
#define pb push_back
#define pii pair <int, int>
#define print(x) for(auto it : x) cout << it << ' ';
#define endl "\n" // TODO: remove
#define int long long

const int N = (int)(1e6) + 322;
const int inf = (int)(2e18);
const int mod = (int)(1e9) + 7; // check modulo

int a[N], b[N], n, m, k, mx;

void solve() {
    cin >> n >> m >> k;
    for(int i = 1; i <= n; ++i) {
        cin >> a[i];
        a[i] += a[i - 1];
    }
    for(int i = 1; i <= m; ++i) {
        cin >> b[i];
        b[i] += b[i - 1];
    }
    for(int i = 0; i <= n; ++i) {
        int rest = k - a[i];
        if (rest < 0) continue;
        int id = upper_bound(b, b + m + 1, rest) - b - 1;
        mx = max(mx, id + i);
    }
    cout << mx;
}

signed main () {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
//    int test; cin >> test;
//    for(int tt = 0; tt < test; ++tt) {
        solve();
//    }
    return 0;
}

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

using namespace std;
char a[300];

int main() {
    long long x;
    scanf("%s%lld", a, &x);
    for (int i = 0; a[i]; i++)
        if (a[i] != '1')
            return putchar(x <= i ? '1' : a[i]), 0;
    putchar('1');
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        string s;
        while (!string.IsNullOrEmpty(s = Console.ReadLine()))
        {
            var t = Array.ConvertAll(s.Split(), int.Parse);
            // 0 1 2
            // 3 4 5
            double det = t[0] * t[4] - t[1] * t[3];
            double x = (t[2] * t[4] - t[1] * t[5]) / det;
            double y = (t[0] * t[5] - t[2] * t[3]) / det;
            Console.WriteLine(x.ToString("f3") + " " + y.ToString("f3"));
        }
    }
}

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

int main() {

	std::string s;
	std::cin >> s;
	int len = s.size();//
	
	
	std::vector<int> res(26,0);

	for (int i = 0; i < len; i++) {
		res[s[i] - 'a']++;

	}
	
	int ans = -1;

	for (int i = 0; i < 26; i++) {

		if (res[i] == 0) {
			ans = i;
			break;
		}
	}

	if (ans >= 0)std::cout << (char)(ans + 'a') << std::endl;
	else std::cout << "None" << std::endl;

}

Measured memory_bytes: 512
/*
 * main.c
 *
 *  Created on: 2019/07/21
 *      Author: family
 */

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

int main()
{
	int X = 0;
	int i = 0, j = 0, ans = 0;;
	scanf("%d", &X);
	i = X/100;
	j = X%100;

	if (i*5 >= j) {
		ans = 1;
	} else {
		ans = 0;
	}
	printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
#define MOD 1000000007
using ll = long long;
using namespace std;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int k;
cin>>k;
vector<int> n{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
cout<<n[k-1]<<endl;
//system("pause");
return 0;
}

Measured memory_bytes: 256
import itertools

S = list(input())
KEY = list('keyence')
LK = len(KEY)
L = len(S)
ok = False
for s,t in itertools.combinations(range(L),2):
  idx = 0
  sub_S = S[0:s] + S[t:]
  if sub_S == KEY:
    ok = True
    
if ok or S == KEY:
  print('YES')
else:
  print('NO')


Measured memory_bytes: 3060
from collections import defaultdict
N = int(input())
C = defaultdict(int)
for i in range(N):
  D = int(input())
  C[D] = i + 1
E = []
H = [1] * (N + 1)
DD = sorted([[k, v] for k, v in C.items()], reverse=True)
Adj = [[] for i in range(N)]
for D, n in DD[:-1]:
  try:
    p = C[D - N + 2 * H[n]]
    if n == p:
      raise Error
    E.append([n, p])
    Adj[n - 1].append(p - 1)
    Adj[p - 1].append(n - 1)
    H[p] += H[n]
  except:
    print(-1)
    break
else:
  dist = [N] * N
  dist[DD[-1][1] - 1] = 0
  Q = [DD[-1][1] - 1] + [N] * N
  tail = 1
  for i in range(N):
    s = Q[i]
    if s == N:
      print(-1)
      break
    for adj in Adj[s]:
      if dist[adj] == N:
        dist[adj] = dist[s] + 1
        Q[tail] = adj
        tail += 1
  else:
    if sum(dist) == DD[-1][0]:
      for e in E:
        print(e[0], e[1])
    else:
      print(-1)

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

int n, k;
vector<int> v;

int solve();

int main() {
  cin >> n >> k;
  v.resize(n);
  for(int i = 0; i < n; ++i) cin >> v[i];
  cout << solve() << endl;
  return 0;
}

int solve() {
  int ans = 0;
  for(int i = 0; i <= min(k, n); ++i)
    for(int j = 0; j + i <= min(k, n); ++j) {
      vector<int> now;
      for(int l = 0; l < i; ++l) now.push_back(v[l]);
      for(int l = 0; l < j; ++l)
        now.push_back(v[n - 1 - l]);
      sort(now.begin(), now.end());
      int cnt = 0, nows = 0;
      for(int l = 0; l < now.size(); ++l) {
        if(cnt < (k - i - j) && now[l] < 0)
          ++cnt;
        else {
          nows += now[l];
        }
      }
      ans = max(nows, ans);
    }
  return ans;
}

Measured memory_bytes: 256
N = int(input())
ls = list(map(int, input().split()));
# 先頭と末尾に0を追加（a0とaN+1)
a_list = [0] + ls + [0];
# 全てを経由した時の合計Sを求める
S = 0;
for i in range(N + 1):
  	# |Aj - Aj+1|を足し合わせる
  	S += abs(a_list[i] - a_list[i+1]);
    
# Sを使って各Siを求め、出力
# Si = S + （不連続部分） - （不連続に置き換わる連続部分）
#    = S + |Ai-1 - Ai+1| - (|Ai-1 - Ai| + |Ai - Ai+1|)
for i in range(N):
	Si = S + abs(a_list[i] - a_list[i + 2]) - (abs(a_list[i] - a_list[i + 1]) + abs(a_list[i + 1] - a_list[i + 2]));
	print(Si);

Measured memory_bytes: 20496
#include<stdio.h>

int main(void)
{
	int a,b;
	scanf("%d %d",&a,&b);
	if(a<b){
		printf("a < b\n");
	}
	if(a>b){
		printf("a > b\n");
	}
	if(a==b){
		printf("a == b\n");
	}

	return 0;
}

Measured memory_bytes: 580
#include<bits/stdc++.h>
using namespace std;
#define mods 1000000007
#define pb push_back
#define mp make_pair
#define st first
#define nd second
typedef long long int lint;
typedef unsigned long long int ulint;
lint dp[1020][1020];
char tab[1020][1020];
lint r,c;
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    lint i,j,k,l;
	cin>>r>>c;
	for(i=0;i<r;i++){
		for(j=0;j<c;j++) cin>>tab[i][j];
	}
	for(i=0;i<c && tab[0][i]!='#';i++) dp[0][i]=1;
	for(i=0;i<r && tab[i][0]!='#';i++) dp[i][0]=1;
	for(i=1;i<r;i++){
		for(j=0;j<c;j++){
			if(tab[i][j]=='#') dp[i][j]=0;
			else dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mods;
		}
	}
	cout<<dp[r-1][c-1];
	
	return 0;
}


Measured memory_bytes: 9216
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1000000007 // 1e9+7
#define PI acos(-1.0)
#define ll long long int // 10^18
#define INF 1000000001 // 1e9+1

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

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  string a,b,c;cin>>a>>b>>c;
  cout<<'A'<<b[0]<<'C'<<endl;
  return 0;
}


Measured memory_bytes: 256
# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
import math
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)
from collections import deque

inf = 10 ** 15
mod = 10 ** 9 + 7

n = int(input())
d = list(map(int, input().split()))
Dlist = [0 for i in range(12)]
for num in d:
    if num == 0:
        print(0)
        sys.exit()
    Dlist[num-1]+=1
    if Dlist[num-1] == 3:
        print(0)
        sys.exit()
judge = [0]
unknown = []
if Dlist[11] >= 2:
    print(0)
    sys.exit()
elif Dlist[11] == 1:
    judge.append(12)
for i,num in enumerate(Dlist[1:11]):
    if num == 2:
        judge.append(i+2)
        judge.append(24-i-2)
    if num == 1:
        unknown.append(i+1)
nujeng = len(unknown)
ans = 0
for i in range(2**nujeng):
    tmp = []
    for num in judge:
        tmp.append(num)
    for j in range(nujeng):
        dnow = unknown[j]
        if ((i >> j) & 1):
            tmp.append(dnow+1)
        else:
            tmp.append(24-dnow-1)
    dic = 50
    if tmp:
        tmp.sort()
        pre = -inf
        for num in tmp:
            if num-pre < dic:
                dic = num-pre
            pre = num
        if 24-tmp[-1] < dic:
            dic = 24-tmp[-1]
        ans = max(dic, ans)
print(ans)


Measured memory_bytes: 40944
// C++ program to illustrate Edge Coloring 
#include <bits/stdc++.h> 
using namespace std; 

// function to determine the edge colors 
void colorEdges(int ptr, vector<vector<pair<int, int> > >& gra, 
				vector<int>& edgeColors, bool isVisited[]) 
{ 
	queue<int> q; 
	int c = 0; 

	set<int> colored; 

	// return if isVisited[ptr] is true 
	if (isVisited[ptr]) 
		return; 

	// Mark the current node visited 
	isVisited[ptr] = 1; 

	// Traverse all edges of current vertex 
	for (int i = 0; i < gra[ptr].size(); i++) { 
		// if already colored, insert it into the set 
		if (edgeColors[gra[ptr][i].second] != -1) 
			colored.insert(edgeColors[gra[ptr][i].second]); 
	} 

	for (int i = 0; i < gra[ptr].size(); i++) { 
		// if not visited, inset into the queue 
		if (!isVisited[gra[ptr][i].first]) 
			q.push(gra[ptr][i].first); 

		if (edgeColors[gra[ptr][i].second] == -1) { 
			// if col vector -> negative 
			while (colored.find(c) != colored.end()) 

				// increment the color 
				c++; 

			// copy it in the vector 
			edgeColors[gra[ptr][i].second] = c; 

			// then add it to the set 
			colored.insert(c); 
			c++; 
		} 
	} 

	// while queue's not empty 
	while (!q.empty()) { 
		int temp = q.front(); 
		q.pop(); 

		colorEdges(temp, gra, edgeColors, isVisited); 
	} 

	return; 
} 

// Driver Function 
int main() 
{ 
	set<int> empty; 

	// declaring vector of vector of pairs, to define Graph 
	vector<vector<pair<int, int> > > gra; 

	vector<int> edgeColors; 

	bool isVisited[100000] = { 0 }; 

	// Enter the Number of Vertices 
	// and the number of edges 
	int ver; cin >> ver; 
	int edge = ver - 1; 

	gra.resize(ver); 
	edgeColors.resize(edge, -1); 

	// Enter edge & vertices of edge 
	// x--; y--; 
	// Since graph is undirected, push both pairs 
	// (x, y) and (y, x) 
	// graph[x].push_back(make_pair(y, i)); 
	// graph[y].push_back(make_pair(x, i)); 

  int degree[ver+1] = {0};
  int maxx = -1;

  for(int i=0;i<edge;i++){
    int a,b; cin >> a >> b;
    gra[a-1].push_back(make_pair(b-1, i)); 
	  gra[b-1].push_back(make_pair(a-1, i)); 
    degree[a]++;
    degree[b]++;
    maxx = max(maxx,degree[a]);
    maxx = max(maxx,degree[b]);
  }
	
	colorEdges(0, gra, edgeColors, isVisited); 

  cout << maxx << '\n';

	// printing all the edge colors 
	for (int i = 0; i < edge; i++) 
		cout << edgeColors[i] + 1 << "\n"; 

	return 0; 
} 


Measured memory_bytes: 60544
import math
from collections import defaultdict
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:input()

"""========main code==============="""
t=1
#t=ii()
for _ in range(t):
    n=ip()
    ans=0
    for i in n:
        ans+=ord(i)-ord('0')
    if(ans%9==0):
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 68408
from collections import deque

n = int(input())
ab = [list(map(int, input().split())) for i in range(n-1)]
c = sorted(list(map(int, input().split())), reverse = True)
tree = [list() for i in range(n)]
already = [1] * n 
ans = [0] * n
k = 0
queue = deque([0])

for index,(a,b) in enumerate(ab):
  a -= 1
  b -= 1
  tree[a].append((index,b))
  tree[b].append((index,a))
while queue:
  now = queue.popleft()
  already[now] = 0
  ans[now] = c[k]
  k += 1
  for index,i in tree[now]:
    if already[i]:
      queue.append(i)
         
print(sum(c[1:]))
print(*ans)


Measured memory_bytes: 52696
n,k=[int(i) for i in input().split()]
d=[i for i in input().split()]

i=n
while True:
    check=0
    for number in d:
        if not number in str(i):
            continue
        else:
            check=1
            break
    if check==0:
        print(i)
        break
    else:
        i+=1

Measured memory_bytes: 9188
W,H,N = [int(x) for x in raw_input().split(" ")]
x = []
y = []
a = []

for n in range(N):
	i,j,k = [int(w) for w in raw_input().split(" ")]
	x.append(i)
	y.append(j)
	a.append(k)

X = 0
Y = 0

for i in range(N):
	if a[i] == 1:
		X = max(X,x[i])

	elif a[i] == 2:
		W = min(W,x[i])

	elif a[i] == 3:
		Y = max(Y,y[i])

	elif a[i] == 4:
		H = min(H,y[i])

if X >= W:
	print 0
elif Y >= H:
	print 0
else:
	print (H-Y)*(W-X)


		

Measured memory_bytes: 2696
# coding:utf-8

import sys

input = sys.stdin.readline


def inpl(): return list(map(int, input().split()))


n = int(input())
H = inpl()
H = [H[0]] + H

dp = [0] * (n + 1)

for i in range(1, n):
    dp[i + 1] = min(abs(H[i + 1] - H[i]) + dp[i], abs(H[i + 1] - H[i - 1]) + dp[i - 1])
    # print(i, dp)

print(dp[n])


Measured memory_bytes: 13876
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <unordered_map>
#include <unordered_set>
using namespace std;

#define ABS(a) (((a) >= 0) ? (a) : -(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define NINTH_POWER_OF_TEN 1000000000
#define LL_INF (numeric_limits<long long>::max()/2)
#define int long long

typedef long long ll;
typedef pair<int, int> Pair;

const int kMaxN = 100;
const int kMaxM = 100;

int N, M, X, Y;
string ans;

int x[kMaxN], y[kMaxM];

signed main() {
  cin >> N >> M >> X >> Y;
  REP(i, N) { cin >> x[i]; }
  REP(i, M) { cin >> y[i]; }

  sort(x, x+N);
  sort(y, y+M);
  if (x[N-1] < y[0] && x[N-1] < Y && X < y[0]) {
    ans = "No War";
  } else {
    ans = "War";
  }

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


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int A, B, C, K; 
    cin >> A >> B >> C >> K;
    int ans = 0; 
    for(int n = 0; n < A && 0 < K; n++) {
        ans++;
        K--;
    }

    for(int n = 0; n < B && 0 < K; n++) {
        K--;
    }

    for(int n = 0; n < C && 0 < K; n++) {
        ans--;
        K--;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3556
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <cassert>
#include <string.h>
#include <unordered_set>
#include <unordered_map>

using namespace std;

typedef long long int64;
typedef unsigned long long uint64;
#define two(X) (1<<(X))
#define twoL(X) (((int64)(1))<<(X))
#define contain(S,X) (((S)&two(X))!=0)
#define containL(S,X) (((S)&twoL(X))!=0)
const double pi=acos(-1.0);
const double eps=1e-11;
template<class T> inline void ckmin(T &a,T b){if(b<a) a=b;}
template<class T> inline void ckmax(T &a,T b){if(b>a) a=b;}
template<class T> inline T sqr(T x){return x*x;}
typedef pair<int,int> ipair;
#define SIZE(A) ((int)A.size())
#define LENGTH(A) ((int)A.length())
#define MP(A,B) make_pair(A,B)
#define PB(X) push_back(X)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,a) for(int i=0;i<(a);++i)
#define ALL(A) A.begin(),A.end()

const int maxn=2048;

int n;
char a[maxn];
char b[maxn];
int l[maxn],r[maxn];

int calc(int a,int b)
{
	a%=n;
	if (a<0) a+=n;
	b%=n;
	if (b<0) b+=n;
	int d=abs(a-b);
	return min(d,n-d);
}
int compute(int l,int r,int w)
{
	return min(l+l+r+calc(r,w),r+r+l+calc((n-l)%n,w));
}
int solve()
{
	int ret=1000000000;
	bool has_one=false;
	REP(i,n) if (b[i]=='1') has_one=true;
	if (has_one)
		REP(i,n)
		{
			for (l[i]=0;b[(i-l[i]+n)%n]=='0';++l[i]);
			for (r[i]=0;b[(i+r[i])%n]=='0';++r[i]);
		}
	int f[maxn];
	REP(key,n) 
	{
		bool ok=true;
		REP(i,n) if (a[(key+i)%n]!=b[i]) { ok=false; break; }
		if (ok) 
		{
			ckmin(ret,calc(0,key));
			continue;
		}
		if (has_one)
		{
			memset(f,255,sizeof(f));
			int maxl=0;
			int cnt=0;
			REP(i,n) if (a[(key+i)%n]!=b[i])
			{
				++cnt;
				ckmax(f[l[i]],r[i]);
				ckmax(maxl,l[i]);
			}
			int w=0;
			for (int i=maxl;i>=0;i--)
			{
				ckmin(ret,compute(i,w,key)+cnt);
				ckmax(w,f[i]);
			}
		}
	}
	return ret;
}
int main()
{
#ifdef _MSC_VER
	freopen("input.txt","r",stdin);
#endif
	std::ios::sync_with_stdio(false);
	cin>>a>>b;
	n=strlen(a);
	int ret=solve();
	if (ret>=100000000) ret=-1;
	printf("%d\n",ret);
	return 0;
}



Measured memory_bytes: 384
from itertools import accumulate
n, k = map(int, input().split())
s = input() + "_"

compressed = []

first = s[0]
prev = s[0]
cnt = 1
for x in s[1:]:
    if prev == x:
        cnt += 1
    else:
        if x == "1":
            compressed.append(cnt)
            cnt = 1
        else:
            compressed.append(cnt)
            cnt = 1
    prev = x


result = [0] + list(accumulate(compressed))

ans = []
if first == "1":
    for i in range(0, len(result), 2):
        ans.append(result[min(i + k * 2 + 1, len(result) - 1)] - result[i])
    for j in range(1, len(result), 2):
        ans.append(result[min(j + k * 2, len(result) - 1)] - result[j])
else:
    for i in range(0, len(result), 2):
        ans.append(result[min(i + k * 2, len(result) - 1)] - result[i])
    for j in range(1, len(result), 2):
        ans.append(result[min(j + k * 2 + 1, len(result) - 1)] - result[j])

print(max(ans))

Measured memory_bytes: 11760
/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
        Comilla  University

*/
#include<bits/stdc++.h>
#define pi 2*acos(0.0)
#define ll long long
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node
#define spc " "
#define  E  2.71828182845904523536
#define pb push_back
#define pp pop_back
#define valid(nx,ny) nx>=0 && nx<n && ny>=0 && ny<m
#define ee endl
#define pii pair<int,int>
#define infinity 10000000000000000
#define mod 1000000007
int fx[]={0,0,+1,-1};
int fy[]={+1,-1,0,0};

using namespace std;
///check n=1;
///check corner case;
const int maX=1e5+1;
vector<ll>Graph[maX],cost[maX];
ll visit[maX];
ll x[10];
ll y[10];

int main()
{
    ll n,i,j,cc=0,mx=-1;
    cin>>n;
    for(i=0;i<n;i++){
        cin>>j;
        cc+=j;
        mx=max(j,mx);
    }
    cc-=mx;
    if(cc>mx)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
return 0;
}


Measured memory_bytes: 4992
/* AOJ 0076
 *
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0076
 *
 */

#include <stdio.h>
#include <math.h>


double f(double* ux, double* uy){
    double vx, vy;
    vx = -*uy;
    vy = *ux;

    *ux += (vx / sqrt(vx*vx + vy * vy));
    *uy += (vy / sqrt(vx*vx + vy * vy));
}


int main(){
    int n;
    int i;
    double x, y;

    while((scanf("%d", &n) == 1) && (n > -1)){
        x = 1.0;
        y = 0.0;

        for(i=1;i<n;i++){
            f(&x, &y);
        }
        printf("%.2f\n", x);
        printf("%.2f\n", y);
    }

    return 0;
}

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

int main(){
	long n;
	cin >> n;
	string s;
	map<string,long> m;
	for(int i=0;i<n;i++){
		cin >> s;
		m[s]++;
	}

	long maxa=0;
	
	for(auto it=m.begin();it!=m.end();it=next(it,1)){
		if(it->second>maxa)maxa=it->second;
	}

	for(auto it=m.begin();it!=m.end();it=next(it,1)){
		if(it->second==maxa)cout << it->first << endl;
	}
	return 0;
}


Measured memory_bytes: 25216
#ifndef LOCAL
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#endif
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
#define sim template < class c
#define int long long
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << '\n'; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef tree< pair<int,int>, null_type, less<pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef long long ll;
const ll MOD = 1e9 + 7 ;
const ll N = 2e5 + 10 ;
const ll INF = 1e18 + 10 ;
signed main(){
    fastio
    int n ;
    cin >> n ;
    vector<int> v(n) ;
    for(int i = 0; i < n; i++){
        cin >> v[i] ;
    }
    sort(v.begin(), v.end()) ;
    int ans = 0 ;
    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++){
            for(int k = j + 1; k < n; k++){
                set<int> s ;
                s.insert(v[i]) ;
                s.insert(v[j]) ;
                s.insert(v[k]) ;
                if ( s.size() < 3 ) continue ;
                if ( v[i] + v[j] > v[k] && v[j] + v[k] > v[i] && v[k] + v[i] > v[j] ) ans++ ;
            }
        }
    }
    cout << ans << endl;
    return 0; 
}

Measured memory_bytes: 3660
N,step = list(map(int,input().split()))
node = list(map(int,input().split()))
dp = [10**30 for i in range(N)]
def chmin(now_point,next_point):
    if dp[next_point] > dp[now_point] + abs(node[now_point] - node[next_point]):
        dp[next_point] = dp[now_point] + abs(node[now_point] - node[next_point])

dp[0] = 0
for i in range(0,N-1,1):
    chmin(i,i+1)
    for j in range(2,step+1):
        if i < N-j:chmin(i,i+j)
print(dp[-1])

Measured memory_bytes: 56544
#include <iostream>
using namespace std;
#define X 0
#define Y 1

int main()
{
	int n,table,dir,posi[200][2],xmax,xmin,ymax,ymin;
		
	while(cin>>n,n!=0)
	{
		posi[0][X]=0;
		posi[0][Y]=0;
		for(int i=1;i<n;i++)
		{
			cin>>table>>dir;
			switch(dir)
			{
			case 0:posi[i][X]=posi[table][X]-1;
				posi[i][Y]=posi[table][Y];
				break;
			case 1:posi[i][X]=posi[table][X];
				posi[i][Y]=posi[table][Y]-1;
				break;
			case 2:posi[i][X]=posi[table][X]+1;
				posi[i][Y]=posi[table][Y];
				break;
			case 3:posi[i][X]=posi[table][X];
				posi[i][Y]=posi[table][Y]+1;
				break;
			}
		}

		xmax=0;
		xmin=0;
		for(int i=1;i<n;i++)
		{
			if(posi[i][X]>xmax)
				xmax=posi[i][X];
			if(posi[i][X]<xmin)
				xmin=posi[i][X];
		}

		ymax=0;
		ymin=0;
		for(int i=1;i<n;i++)
		{
			if(posi[i][Y]>ymax)
				ymax=posi[i][Y];
			if(posi[i][Y]<ymin)
				ymin=posi[i][Y];
		}

		cout<<xmax-xmin+1<<' '<<ymax-ymin+1<<endl;
	}
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define pii pair<int, int>
#define pll pair<long long, long long>
#define ull unsigned long long
#define mp make_pair
#define F first
#define S second
#define mod 1000000007
ll n;
vector<ll> dp(2005, 0);
ll countWays() 
{ 
    
    
    dp[0] = 0;
    dp[1] = 0;
    dp[2] = 0;
    dp[3] = 1;
  
    for (int i = 4; i <= n; i++)
    {
        dp[i]++;
        for(int j = 3; j<=i-3; j++ )
        {
            dp[i] = (dp[i] + dp[j])%mod;
        }
        
    }  
         
    return dp[n]%mod; 
} 
  
int main()
{
    cin >> n;
    cout << countWays() << endl;
}

Measured memory_bytes: 3636
#include<cstdio>
#include<vector>
#include<queue>
#include<climits>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> PP;
int ve[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
int main(){
    for(;;){
        int r;
        scanf("%d",&r);
        if(r==0) break;
        vector<vector<int> > rtole(2,vector<int>(r+1,-1));
        for(int ii=0;ii<2;ii++){
            int w,h,xe,ye;
            scanf("%d%d%d%d",&w,&h,&xe,&ye);
            xe--;ye--;
            vector<vector<int> > levs(h,vector<int>(w));
            for(int iy=0;iy<h;iy++){
                for(int ix=0;ix<w;ix++){
                    scanf("%d",&levs[iy][ix]);
                }
            }
            vector<vector<bool> > isused(h,vector<bool>(w,false));
            priority_queue<PP,vector<PP>,greater<PP> > pq;
            pq.push(PP(levs[ye][xe],P(ye,xe)));
            int nowlev=0,nowro=0;
            rtole[ii][0]=0;
            isused[ye][xe]=true;
            for(;;){
                if(pq.empty())break;
                PP te=pq.top();
                pq.pop();
                int le=te.first,yy=te.second.first,xx=te.second.second;
                if(le<=nowlev){
                    nowro++;
                    if(nowro<=r) rtole[ii][nowro]=nowlev;
                }else{
                    nowlev=le;
                    nowro++;
                    if(nowro<=r) rtole[ii][nowro]=nowlev;
                }
                for(int jj=0;jj<4;jj++){
                    int newy=yy+ve[jj][0],newx=xx+ve[jj][1];
                    if(newy>=0&&newy<h&&newx>=0&&newx<w&&!isused[newy][newx]){
                        isused[newy][newx]=true;
                        pq.push(PP(levs[newy][newx],P(newy,newx)));
                    }
                }
            }
        }
        int mi=INT_MAX;
        for(int i=0;i<rtole[0].size();i++){
            if(rtole[0][i]!=-1&&rtole[1][r-i]!=-1){
                mi=min(mi,rtole[0][i]+rtole[1][r-i]);
            }
        }
        printf("%d\n",mi);
    }
}

Measured memory_bytes: 3236
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int iinf = 1 << 28;
const long long llinf = 1ll << 60;
const double PI = 3.14159265;

void work() {
    int n,k; cin>>n>>k;
    int nd = 0;
    while (n) {
        ++nd;
        n /= k;
    }
    cout << nd << endl;
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    work();

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace ITP1_8
{
    class Program
    {
        static void Main()
        {
            List<char> w = Console.ReadLine().ToCharArray().ToList();
            string a = Console.ReadLine();
            for(int i = 0; i < w.Count; i++)
            {
                char c = w[0];
                w.RemoveAt(0);
                w.Add(c);
                if(new String(w.ToArray()).Contains(a))
                {
                    Console.WriteLine("Yes");
                    return;
                }
            }
            Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 10068
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>
#include<math.h>
#define MAX 200002
typedef long long ll;
ll compare_ll(const void *a,const void *b){
    return (-1)*(*(ll*)a - *(ll*)b);
}

int main(){
    ll N;
    scanf("%lld",&N);
    ll A[MAX];
    for(ll i=0;i<N;i++)
        scanf("%lld",A+i);
    qsort(A,N,sizeof(ll),compare_ll);
    ll table[MAX];
    ll ans=0;
    if(N%2 == 1){
        for(ll i=0;i<=N/2;i++){
            if(i==0 || i == N/2) ans += A[i];
            else ans += A[i]*2;

        }
    }
    else{
        for(ll i=0;i<N/2;i++){
            if(i==0) ans += A[i];
            else ans += A[i]*2;
        }
    }

    printf("%lld",ans);
}


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

int main(){
    long k,n;
    cin >> k >> n;
    vector<long> a(n);
    vector<long> c(n);
    rep(i,n) cin >> a[i];
    c[0] = a[0] + k - a[n-1];
    long nagasa = 0;
    for(long i=1;i<n;i++){
        c[i] = a[i] - a[i-1];
        nagasa = max(c[i],nagasa);
    }
    if(c[0] > nagasa) nagasa = c[0];
    cout << k - nagasa << endl;
    return 0;
}

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

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


int N;
int a[100];

int main(void) {
  cin >> N;
  REP(i, N) {
    cin >> a[i];
  }

  int min = 200 * 200 * 100;
  for(int i = -100; i <= 100; i++) {
    int cost = 0;
    REP(j, N) {
      cost += (a[j] - i) * (a[j] - i);
    }
    if(min > cost) {
      min = cost;
    }
  }

  cout << min << endl;

  return 0;
}


Measured memory_bytes: 256
/*
    ????????°??§???????????¨????????????
*/

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <limits.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iterator>
#include <vector>
#include <map>
#include <utility>
#define LLU unsigned long long int
#define LL long long int
#define LD long double
using namespace std;
#define LLUmax ULLONG_MAX
#define LLmax LLONG_MAX
#define dmax INT_MAX
#define vd vector<int>
#define vLL vector<long long int>
#define vLLU vector<unsigned long long int> 
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define debug printf("asd\n")
#define debugd(a) printf("--%d\n",a)
#define debugdd(a,b) printf("--%d %d\n",a,b)
#define debugarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i]);printf("\n")
#define newline printf("\n")
#define forin(a,b,c) for(int a=b ; a<c ; a++)
#define forde(a,b,c) for(int a=b ; a<c ; a--)


inline void scd(int &a){scanf("%d",&a);}
inline void scdd(int &a,int &b){scanf("%d %d",&a,&b);}
inline void sctd(int &a,int &b,int &c){scanf("%d %d %d",&a,&b,&c);}
inline void scdlld(long int &a,long int &b){scanf("%I64d %I64d",&a,&b);}
inline void sclld(long long int &a){scanf("%I64d",&a);}

#define scarrd(a,b) for(int index=0 ; index<b ; index++)scanf("%d",&a[index])
#define prdlld(a,b) printf("%I64d %I64d",a,b)
#define prdd(a,b) printf("%d %d",a,b)
#define prd(a) printf("%d",a)
#define prarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i])
#define iniarr(a,b) for(int i=0 ; i<b ;i++)a[i]=0
#define arr(a,b) int *a=(int *)malloc(b*sizeof(int))
#define llarr(a,b) long long int *a=(long long int *)malloc(b*sizeof(long long int))
#define st(a,b) char *a=(char *)malloc(b*sizeof(char))
#define grav 9.8
#define pi 3.14159265

bool cmp(int a,int b)
{
	return a>b;
}
int main()
{
	int a[2000];
	scarrd(a,10);
	sort(a,a+10,cmp);
	forin(i,0,3)
	printf("%d\n",a[i]);
	
	return 0;
}

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

#define ll long long
#define all(x) (x).begin(), (x).end()
const long long INF = 1LL << 60;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    // cout << fixed << setprecision(5);

    // 入力
    int a, b, c;
    cin >> a >> b >> c;

    // 処理
    // 出力
    cout << (b - a == c - b ? "YES" : "NO") << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T, class U> inline bool chmin(T& a, U b){T bb = b;if(a>bb){a = bb;return 1;}return 0;}
template<class T, class U> inline bool chmax(T& a, U b){T bb = b;if(a<bb){a = bb;return 1;}return 0;}
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define int long long
#define double long double
#define PI 3.141592653589793
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1e16;
const double EPS = 1e-10;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

vector<int> divisor(int n){
  vector<int> ret;
  for(int i = 1;i*i <= n;i++){
    if(n%i == 0){
      ret.push_back(i);
      if(i*i != n)ret.push_back(n/i);
    }
  }
  sort(ret.begin(), ret.end());
  return ret;
}

/*
void dijkstra(){
  priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>> pq;pq.push(make_pair(0,0));
  rep(i,110000)d[i] = INF;d[0] = 0;
  while(!pq.empty()){
    pair<int,int> from = pq.top();pq.pop();
    int fromV = from.second, fromC = from.first;
    if(d[fromV] < fromC)continue;
    rep(i,g[fromV].size()){
      int to = g[fromV][i];
      if(d[to] <= fromC+costs[to])continue;
      d[to] = fromC+costs[to];
      pq.push(make_pair(d[to], to));
    }
    //cout << fromV << " " << fromC << endl;
  }
}*/

int n;string s;
signed main(){
  cin>>n>>s;
  if(n % 2 != 0){
    cout << "No" << endl;
    return 0;
  }
  bool y = true;
  rep(i,n/2){
    if(s[i] != s[i+n/2]){
      y = false;break;
    }
  }
  cout << (y ? "Yes" : "No") << endl;
}



Measured memory_bytes: 256
/*
ID: learnin7
TASK: test
LANG: C++                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include<bits/stdc++.h>

/*  Macros from Endagorion */
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#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)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;


int main(){
        
    ios_base::sync_with_stdio(0);
    
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //fin >> a >> b;
    //fout << a+b << endl;
    i64 a,b;
    cin>>a>>b;
    //cout<<__gcd(a,b)<<endl;
    //cout<<i64(a*b)<<endl;
    i64 res = (a*b)/__gcd(a,b);
    cout<<res<<endl;
    return 0;
}



Measured memory_bytes: 256
import math

a, b, x = map(int, input().split())
if x/(a*a) > b/2:
    tanr = 2*b/a - 2*x/(a*a*a)
else:
    tanr = a*b*b/(2*x)
    
ans = math.degrees(math.atan(tanr))
if ans<0:
    ans = 0
print(ans)

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

int main() {
    vector<int> vec(3);
    for (int i = 0; i < 3; i++) {
        cin >> vec.at(i);
    }
    sort(vec.begin(), vec.end());
    cout <<vec.at(0)+vec.at(1)+10*vec.at(2)<<endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
const lint mod=1e9+7;


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

  map<int, set<int>> mods;
  mods[0].insert(-1);
  reverse(ALL(s));
  lint num = 0;
  int keta = 1;
  REP(i,s.size()){
    int x = s[i]-'0';
    num = (num+x*keta)%2019;
    keta = keta*10%2019;
    //cout << num << endl;
    mods[num].insert(i);
  }

  lint sum = 0;
  for(auto p : mods){
    sum += p.second.size()*(p.second.size()-1)/2;
  }

  cout << sum << "\n";
  return 0;
}


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

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

  string ans;
  rep(i, s.size()){
    if (i % 2 == 0){
      ans.push_back(s[i]);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3688
list1 = [int(a) for a in input().split()]
m_a = list1[0] #a
m_b = list1[1] #b
m_c = list1[2] #c
m_d = list1[3] #d

if abs(m_a - m_c) <= m_d:
    print("Yes")
elif abs(m_b - m_c) <= m_d:
    if abs(m_b - m_a) <= m_d:
        print("Yes")
    else:
        print("No")
else:
    print("No")

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

using namespace std;

typedef long long LL;

#define ALL(a) (a).begin(), (a).end()
#define PB push_back
#define MP make_pair
#define LEN(a) int((a).size())
#define SORT(a) sort((a).begin(), (a).end())
#define CLR(a) memset((a), 0, sizeof(a))

const double EPS = 1e-10;
const double PI = acos(-1.0);

int main() {
    int n;
    cin >> n;
    cout << (n - 2) * 180 << endl;
    return 0;
}


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

int main() {
	int N, Q;
	//cin >> N >> Q;
	scanf("%lld %lld", &N,&Q);
	vector<long long>A(N);
	for (int i = 0; i < N; ++i) {
		//cin >> A[i];
		scanf("%lld", &A[i]);
	}
	vector<long long>Sum(N);//累積和
	vector<long long>SumSub(N);//奇数番目のみ
	for (int i = 0; i < N; ++i) {
		if (0 == i) {
			Sum[i] = A[i];
			SumSub[i] = A[i];
			continue;
		}
		Sum[i] = Sum[i - 1] + A[i];
		if (0 == i % 2) {
			SumSub[i] = SumSub[i - 2] + A[i];
		}
		else {
			SumSub[i] = 0;
		}
	}



	for (int i = 0; i < Q; ++i) {
		long long x;
		scanf("%lld", &x);
		long long l = 0;//NG
		long long r = N;//OK
		while (l + 1 < r) {
			long long c = (l + r) / 2;
			//Tがcを取れるかどうかは
			//c は(N-c+1)枚目
			//Aがすでにcをとってないことが条件。
			// [2 * A[c] - x,A[c])の枚数がT-c以下なこと
			int count = lower_bound(A.begin(), A.end(), A[c]) - lower_bound(A.begin(), A.end(), 2 * x - A[c]);
			if (count >= (N - c - 1)) {
				r = c;
			}
			else {
				l = c;
			}
		}
		long long ans = Sum[N - 1] - Sum[r - 1];
		if ((2 * r - N) > 0) {
			if (0 == (2 * r - N)%2) {
				ans += Sum[2*r-N-1] - SumSub[2 * r - N - 2];
			}
			else {
				ans += SumSub[2 * r - N - 1];
			}
		}
		printf("%lld\n", ans);
	}
	return 0;
}


Measured memory_bytes: 5664
#include <bits/stdc++.h>
#define endl '\n'

using namespace std;

const int N = 65;

int n, a[N];

bool is_sorted() {
  for(int i=2;i<=n;i++) {
    if(a[i-1]>a[i]) return false;
  }
  
  return true;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int i, j;

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

  if(is_sorted()) {
    cout<<"YES"<<endl;
    return 0;
  }

  for(i=1;i<=n;i++) {
    for(j=i+1;j<=n;j++) {
      swap(a[i], a[j]);

      if(is_sorted()) {
        cout<<"YES"<<endl;
        return 0;
      }

      swap(a[i], a[j]);
    }
  }

  cout<<"NO"<<endl;

  return 0;
}


Measured memory_bytes: 256