akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define endl '\n'
#define ALL(V) V.begin(), V.end()
#define L_B lower_bound
#define U_B upper_bound
#define pb push_back
#define ll long long
#define rep(i,n) for (i = 0; i < n; ++i) 
#define REP(i,k,n) for (i = k; i <= n; ++i) 
#define REPR(i,k,n) for (i = k; i >= n; --i)
using namespace std;
template<class T, class T1> int chkmin(T &x, const T1 &y) { return x > y ? x = y, 1 : 0; }
template<class T, class T1> int chkmax(T &x, const T1 &y) { return x < y ? x = y, 1 : 0; }
const int MAXN = (1 << 20);
bool prime(ll x)
{
  if(x==1)
    return false;
  if(x==2||x==3||x==5)
    return true;
  for(ll i=2;i<=sqrt(x);i++)
  {
    if(x%i==0)
      return false;
  }
  return true;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#ifndef ONLINE_JUDGE 
   freopen("input.txt", "r", stdin); 
   //freopen("error.txt", "w", stderr); 
   freopen("output.txt", "w", stdout); 
#endif 
   
 ll T = 1 ;
 //cin>>T;

 for(ll t=0;t<T;t++)
 {
  ll n , ans= 0 ;
  cin>>n;
  vector <ll> va(n) , cs(n);
  for(ll i=0;i<n;i++)
    cin>>va[i];
  for(ll i=0;i<n;i++)
    cin>>cs[i];
  for(ll i=0;i<n;i++)
    {
      if(cs[i]<va[i])
        ans = ans + va[i] - cs[i];
    }
    cout<<ans<<endl;
 }
  return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;


int main(void)
{
    int H,W,D;
    cin >> H >> W >> D;
    vector<pii> A(H*W+1);
    REP(i, H){
        REP(j, W){
            int Ai;
            cin >> Ai;
            A[Ai].fi = i;
            A[Ai].se = j;
        }
    }
    vector<int> t(H*W);
    Rep(i, 1, H*W+1){
        if(i <= D) t[i] = 0;
        else{
            t[i] = t[i-D] + [](int x, int y, int i, int j){
                return (int)(abs(x-i) + abs(y-j));
            }(A[i].fi, A[i].se, A[i-D].fi, A[i-D].se);
        }
    }

    int Q;
    cin >> Q;
    vector<int> ans(Q);
    REP(i, Q){
        int l,r;
        cin >> l >> r;
        ans[i] = t[r] - t[l];
    }

    for(auto&& ai : ans) pr(ai);
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> pii;
typedef priority_queue<pii, vector<pii>, greater<pii> > RPQ;
#define mk make_pair
#define INF (1 << 30)
#define INFL (1ll << 60ll);

int N;

signed main(){
    cin >> N;
    printf("%lld\n", N * N * N);



    return 0;
}


Measured memory_bytes: 3148
import java.util.Scanner;
class Main {
    public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] S = new int[n]; 
		
		for(int i = 0; i < n; i++){
			S[i] = scan.nextInt();
		}
		
		int q = scan.nextInt();
		int[] T = new int[q];
		
		for(int i = 0; i < q; i++){
			T[i] = scan.nextInt();
		}
		
		int result = 0;
		for(int i = 0; i < T.length; i++){
			result += BinarySearch(S, T[i]);
		}
		
		System.out.println(result);
	}

	static int BinarySearch(int data[], int serch){
		
		int min = 0;
		int max = data.length - 1;
		
		while(min <= max){
			
			int middle = (min + max) / 2;
			if(serch == data[middle]){
				return 1;
			}else if(serch < data[middle]){
				max = middle - 1;
			}else{
				min = middle + 1;
			}
		}
		return 0;
	}
}

Measured memory_bytes: 78832
N, K = map(int, input().split())
a = list(map(int, input().split()))

dp = [-1] * (K+1)
ans = int(0)

for i in a:
    dp[i] = int(1)
#print(dp)
for i in range(K+1):
    v = int(-1)
    for j in a:
        if i>j and dp[i-j]==-1:
            v = int(1)
    if dp[i]==-1:
        dp[i] = v

if dp[K]==1:
    ans = "First"
else:
    ans = "Second"

print(ans)

Measured memory_bytes: 3828
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;

#define MAX 10000

int data[MAX+1];
int s[MAX+1];
int ans[MAX+1];

int main(){
  int n;
  while(scanf("%d",&n),n){
    int cnt = 0;
    memset(ans , 0, sizeof(int) * n);
    memset(data, 0, sizeof(int) * n);
    for(int i=1; i<n; i++){
      int tmp = (i * i) % n;
      if(data[tmp] == 0){
        data[tmp] = 1;
        s[cnt++] = tmp;
      }
    }
    sort(s, s+cnt);
    for(int i=0; i<cnt; i++){
      for(int j=i+1; j<cnt; j++){
        int tmp = s[i] - s[j];
        int tmp2= s[j] - s[i];
        if(tmp  < 0) tmp  += n;
        if(tmp2 < 0) tmp2 += n;
        if(tmp  > (n-1)/2) tmp  = n - tmp;
        if(tmp2 > (n-1)/2) tmp2 = n - tmp2;
        ans[tmp]++; ans[tmp2]++;
      }
    }
    REP(i,(n-1)/2) printf("%d\n",ans[i+1]);
  }
  return 0;
}

Measured memory_bytes: 980
#include <iostream>
#include <cstdio>
#include <string.h>
#include <vector>
using namespace std;

int n;
int A[200];

int all_even(){
    int count = 0;
    for(int i = 0; i < n; i++){
        if(A[i] % 2 != 0){
            count  = 1;
            break;
        }
        else{
            A[i] = A[i] / 2;
        }
    }

    return count;
}


int main(){

    cin >> n;

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

    int count = 0;
    int re;
    while(1){
        re = all_even();
        if(re == 0){
            count++;
        }
        else{
            break;
        }
    }

    printf("%d\n", count);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    ll ans = 0;
    for(ll i=1;i<=(n/2);i++){
        if(i != n - i){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
//using namespace __gnu_pbds;

#define ll long long int
#define endl "\n"
#define db(x) cout<<#x<<" ->"<<x<<endl
#define db2(x,y) cout<<#x<<"->"<<x<<", "<<#y<<" -> "<<y<<endl
#define db3(x,y,z) cout<<#x<<" -> "<<x<<" , "<<#y<<" -> "<<y<<" , "<<#z<<" -> "<<z<<endl
#define db4(w,x,y,z) cout<<#w <<" -> " << w << " , " << #x<<" -> "<<x<<" , "<<#y<<" -> "<<y<<" , "<<#z<<" -> "<<z<<endl
#define prt(x) for(auto it = x.begin(); it!=x.end(); it++) { cout<<*it<<" "; } cout<< endl
#define IN freopen("input.txt","r",stdin)
//typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int N = (int)4e5+4;

int32_t main(){
    ios_base::sync_with_stdio(false); cin.tie(0);
//    IN;
    ll n;
    cin >> n;
    ll ans = 0LL;
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
            for(int k = 1; k <= n; k++){
                int cur = __gcd(i,j);
                cur = __gcd(cur,k);
                ans+= cur;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3656
# coding=utf-8
import math

if __name__ == '__main__':
    N = int(input())
    mem = 1000000000000000000000000000000000000

    for i in range(1, int(math.sqrt(N)) + 1):
        if N % i == 0 and mem > (i + (N/i) - 2):
            mem = (i + (N/i) - 2)

    print(int(mem))


Measured memory_bytes: 2940
import sys
from collections import deque
s=sys.stdin.readlines()
q=int(s[0].split()[1])
f=lambda x,y:(x,int(y))
d=deque(f(*e.split())for e in s[1:])
t,a=0,[]
while d:
 k,v=d.popleft()
 if v>q:v-=q;t+=q;d.append([k,v])
 else:t+=v;a+=[f'{k} {t}']
print(*a,sep='\n')


Measured memory_bytes: 16940
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
int main() {
    int ans=0, N;
    cin >> N;
    vector<int> A(N);
    rep(i,N) cin >> A[i];
    bool div_by_2 = true;
    while(div_by_2){
        rep(i,N){
            if(A[i] % 2 == 1){
                div_by_2 = false;
                break;
            }else{
                A[i] /= 2;
            }
        }
        if(div_by_2){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main()
{
    int a;

    int cnt5 = 0, cnt7 = 0;
    for(int i = 0;i < 3;i++){
        cin >> a;
        if(a == 5) cnt5++;
        else if(a == 7) cnt7++;
    }
    if(cnt5 == 2 && cnt7 == 1) cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

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

def main():
    n = ri()
    print((n-1)*n//2)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
from collections import defaultdict, deque

N, M, P = map(int, input().split())
G = defaultdict(lambda: defaultdict(lambda: 10000000))
G_rev = defaultdict(lambda: defaultdict(lambda: 10000000))

for _ in range(M):
    A, B, C = map(int, input().split())
    G[A][B] = min(G[A][B], P - C)
    G_rev[B][A] = 1

reachable_N = [0] * (N + 1)
reachable_N[N] = 1
queue = deque([N])

while len(queue) > 0:
    p = queue.popleft()
    for q in G_rev[p].keys():
        if reachable_N[q] == 0:
            reachable_N[q] = 1
            queue.append(q)

reachable_1 = [0] * (N + 1)
reachable_1[1] = 1
queue = deque([1])

while len(queue) > 0:
    p = queue.popleft()
    for q in G[p].keys():
        if reachable_1[q] == 0:
            reachable_1[q] = 1
            queue.append(q)

reachable = [reachable_1[i] * reachable_N[i] for i in range(N + 1)]

dist = [10000000000 for i in range(N + 1)]
res = 0
dist[1] = 0
queue = deque([1])
cnt = 0

update = True

while update:
    update = False
    for p in range(1, N + 1):
        if reachable[p] == 0:
            continue
        for q in G[p].keys():
            if reachable[q] == 0:
                pass
            elif dist[p] + G[p][q] < dist[q]:
                dist[q] = dist[p] + G[p][q]
                update = True
    cnt += 1
    if cnt > N:
        res = -1
        break

if res == -1:
    print(res)
else:
    print(max(0, -dist[N]))


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

using namespace std;

int main() {
  int h, w;
  string s;
  
  cin >> h >> w;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
  		cin >> s;
      	if (s == "snuke") {
          	cout << char('A' + j) << i + 1 << endl;
          	return 0;
        }
    }
  }
}
      	


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

template<typename integer>
integer __lcm(integer a, integer b) {
    return (a * b) / __gcd(a, b);
}

int main() {
    string odd, evn;
    cin >> odd >> evn;

    size_t t = max(odd.size(), evn.size());
    rep (i, t) {
        if (i < odd.size()) {
            cout << odd[i];
        }
        if (i < evn.size()) {
            cout << evn[i];
        }
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
int main()	{
  ll n;
  cin>>n;
  ll res=100;
  ll ans=0;
  while(res<n){
    res+=res/100;
    ans++;
  }
  cout<<ans<<endl;
}

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

int scale(long long a, long long b) {
	int acount = 0; int bcount = 0;
	while (a > 0) {
		acount++;
		a /= 10;
	}
	while (b > 0) {
		bcount++;
		b /= 10;
	}
	return max(acount, bcount);
}
int main() {
	int ans = 1e9;
	long long N;
	cin >> N;
	for (long long i = 1; i*i <= N; ++i) {
		if (N%i != 0) 
			continue;
		else 
			ans = min(ans, scale(i, N / i));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    int N; cin >> N;N*=2;
    int ary[1000];
    for(int i = 0; i< N; i++) {
        cin >> ary[i];
    }
    
    sort(ary, ary + N, std::greater<int>());
    
    int sum = 0;
    for(int i = 0; i < N; i += 2) {
        sum += min(ary[i], ary[i+1]);
    }
    cout << sum << endl;
}


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

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

  rep(i, N) {
    int A;
    cin >> A;
    if (A % 2 == 0 && (A % 3 != 0 && A % 5 != 0)) {
      cout << "DENIED" << endl;
      return 0;
    }
  }
  cout << "APPROVED" << endl;
  return 0;
}

Measured memory_bytes: 3572
#include <stdio.h>

int main(void)
{
	int kosuu;
	int saidai;
	int saisyou;
	int ie[1001];
	int a;  /*くりかえし*/
	
	
	scanf("%d",&kosuu);
	
	for(a = 0;a < kosuu;++a){
		scanf("%d",&ie[a]);
	}
	
	saidai = 0;
	saisyou = 1000;
	
	for(a = 0;a < kosuu;++a){
		if(saidai < ie[a]){
			saidai = ie[a];
		}
		if(saisyou > ie[a]){
			saisyou = ie[a];
		}
	}
	printf("%d\n",saidai - saisyou);
	
	return(0);
}


Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.TreeMap;
 
 
public class Main{
	
	static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    }
	
	static class Pair
	{
		int p;
		int q;
		Pair(int p,int q)
		{
			this.p = p;
			this.q = q;
		}
	}
	
	static int gcd(int a,int b)
	{
		if(a == 0) return b;
		if(b == 0) return a;
		
		return gcd(b,a%b);
	}
	static long gcd(long a,long b)
	{
		if(a == 0) return b;
		if(b == 0) return a;
		
		return gcd(b,a%b);
	}
	static void preCompute(long fact[])
	{
		fact[0] = 1;
		for(int i = 1; i < fact.length; i++)
		{
			fact[i] = i*fact[i-1]%rem;
		}
	}
	static long power(long x, long y, long p) 
    { 
        long res = 1; 
        x = x % p; 
                      
        while (y > 0) 
        {
            if (y % 2 == 1) 
                res = (res * x) % p; 
 
            y = y >> 1; 
            x = (x * x) % p; 
        }
        return res; 
    } 
	static long modInverse(long n, long p) 
    { 
        return power(n, p-2, p); 
    }
	
	static long nCrModPFermat(int n, int r, long p) 
	{ 
 
		if (r == 0) 
			return 1; 
 
		return (fact[n]* modInverse(fact[r], p) % p * modInverse(fact[n-r], p) % p) % p; 
	}
	static long rem = (long)(1e9)+7;
	static long fact[];
	
 
	public static void main(String[] args) 
	{
		OutputStream outputStream = System.out;
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(outputStream);
        
        int x = sc.nextInt();
        
        int y = x%500;
        
        int z = x/500;
        
        long ans = (long)z*1000;
        
        ans += (y/5)*(long)5;
        out.println(ans);
        out.close();
	}
 
}

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

using namespace std;

typedef long long ll;

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

	string b;
	cin >> b;

	if(b == "A"){
		cout << "T" << endl;
	}else if(b == "C"){
		cout << "G" << endl;
	}else if(b == "G"){
		cout << "C" << endl;
	}else{
		cout << "A" << endl;
	}

}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

#ifndef _DEBUG
#define main_ main
#endif
#define FOR(i,s,e) for (int i = int(s); i != int(e); i++)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)

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

template <typename T>
using keyVal = pair<string, T>;
template<typename T>
bool val_greater(const keyVal<T>& left, const keyVal<T>& right) {
	return left.second > right.second;
}

void init_global() {}

int main_() {
	int N, K;
	cin >> N >> K;

	int ans = K * pow(K - 1, N - 1);

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


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

static const int MOD = 1e9+7;

vector<pair<int,int>> prime_factorize(int N){

    vector<pair<int,int>> num;
    
    for(int i=2; i<=N; i++){
        if(N%i != 0) continue;
        int e = 0;
        while(N%i==0){
            e++;
            N /= i;
        }
        num.push_back({i,e});
    }

    if(N != 1) num.push_back({N,1});

    return num;
}

int main(){
    int N;
    cin>>N;
    vector<int> cnt(N+1,0);

    for(int i=2; i<=N; i++){
        auto tmp = prime_factorize(i);
        for(auto a : tmp){
            cnt[a.first] += a.second;
        }
    }

    long long ans = 1;

    for(int i=2; i<=N; i++){
        ans *= cnt[i]+1;
        ans %= MOD;
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.Scanner;


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		String s = sc.next();
		int n = s.length();

		String keyence = "keyence";

		for (int i = 0; i <= n; i++) {
			for (int j = i; j <= n; j++) {
				String tmp = s.substring(0, i);
				tmp += s.substring(j, n);
				
				if (tmp.equals(keyence)) {
					pr.println("YES");
					return;
				}
			}
		}

		pr.println("NO");
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);
			
		solve();
			
		pr.close();
		sc.close();
	}

	static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
}


Measured memory_bytes: 23892
S = input()


def isEasy(s):
    for i in range(len(s)):
        if (i+1) % 2 == 0:
            if S[i] == "R":
                return False
        else:
            if S[i] == "L":
                return False
    return True


print("Yes" if isEasy(S) else "No")

Measured memory_bytes: 3060
package main

import (
	"bufio"
	"fmt"
	"os"
	"reflect"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!coution!!!! you must use Fprint(out, ) not Print()
	/* --- code --- */
	A, B, N := nextInt64(), nextInt64(), nextInt64()
	// A, B, N := int64(5), int64(7), int64(4)

	max_score := int64(0)
	if N >= B-1 {
		max_score = calc(A, B, B-1)
	} else {
		max_score = calc(A, B, N)
	}
	fmt.Println(max_score)

}

func calc(A int64, B int64, x int64) int64 {
	left := int64((A * x) / B)
	right := A * int64(x/B)
	return left - right
	// return int64((A*x)/B) - A*int64(x/B)
}

// -*-*-*-*-*-*-*-*-
// * I/O utilities *
// -*-*-*-*-*-*-*-*-

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextInt64() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func split(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "fuck")
	}
}

// -*-*-*-*-*-*-*-*-
// * tool snippets *
// -*-*-*-*-*-*-*-*-
func duplicate2Int(base [][]int) (ret [][]int) {
	ret = make([][]int, len(base))
	for i, v := range base {
		ret[i] = append([]int{}, v...)
	}
	return
}

// -*-*-*-*-*-*-*-*-*-*-*-*-*-
// * Algorithms Utility Zone *
// -*-*-*-*-*-*-*-*-*-*-*-*-*-

// -*-*-*-*-*-*-*-
// * 1. nibutan  *
// -*-*-*-*-*-*-*-
func lower_bound(arr []int, target int) int {
	l, r := 0, len(arr)
	for l < r {
		mid := (l + r) / 2
		if arr[mid] < target {
			l = mid + 1
		} else {
			r = mid
		}
	}
	return l
}

func upper_bound(arr []int, target int) int {
	l, r := 0, len(arr)
	for l < r {
		mid := (l + r) / 2
		if target < arr[mid] {
			r = mid
		} else {
			l = mid + 1
		}
	}
	return l
}

// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
// * math flavor typical theories *
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
func gcd(a, b int) int {
	if a > b {
		return gcd(b, a)
	}
	for a != 0 {
		a, b = b%a, a
	}
	return b
}

func pow(a, b int) (ret int) {
	ret = a
	// 10^2 = 100ってことは10に10を1回掛けることだね
	// なので初期値を含めると上限b-1未満
	for i := 0; i < b-1; i++ {
		ret *= a
	}
	return
}

func powMod(n, m, mod int) (ret int) {
	ret = 1
	for m > 0 {
		if m&1 == 1 {
			ret *= n
			ret %= mod
		}
		n *= n
		n %= mod
		m >>= 1
	}
	return ret
}


Measured memory_bytes: 1756
import java.util.*;
public class Main{
    public static void main(String[] args){
	new Main().run();
    }
    Scanner sc = new Scanner(System.in);
    Line line;

    void run(){
	while(sc.hasNext()){
	    line = new Line();
	    solve();
	}
    }

    void solve(){
	boolean ans = true;
	double dis1, dis2;
      
	boolean a = line.crossX(1);
	boolean b = line.crossX(2);
	boolean c = line.crossX(3);

	ans = a && b && c;

	if(ans) System.out.println("YES");
	else System.out.println("NO");
    }

    class Point{
	double x;
	double y;
	Point(double x, double y){
	    this.x = x;
	    this.y = y;
	}
	double getX(){ return x; }
	double getY(){ return y; }
    }

    class Line{
	Point k1, k2, k3, p;
	Line(){
	    k1 = new Point(sc.nextDouble(), sc.nextDouble());
	    k2 = new Point(sc.nextDouble(), sc.nextDouble());
	    k3 = new Point(sc.nextDouble(), sc.nextDouble());
	    p = new Point(sc.nextDouble(), sc.nextDouble());
	}
	boolean cross(Point p1, Point p2, Point p3, Point p4){
	    double a = (p1.getX()-p2.getX()) * (p3.getY()-p1.getY());
	    double b = (p1.getY()-p2.getY()) * (p1.getX()-p3.getX());
	    double c = (p1.getX()-p2.getX()) * (p4.getY()-p1.getY());
	    double d = (p1.getY()-p2.getY()) * (p1.getX()-p4.getX());
	    double cr = (a+b)*(c+d);

	    //System.out.println(cr); 
	    if(cr<=0) return false;
	    else return true;
	}

	boolean crossX(int i){
	    if(i==1)
		return cross(k2, k3, p, k1);
	    if(i==2)
		return cross(k1, k3, p, k2);
	    if(i==3)
		return cross(k1, k2, p, k3);
	    return true;
	}
    }
}

Measured memory_bytes: 23468
# -*- coding: utf-8 -*-

n = int(raw_input())
for i in range(n):
    A, B, C = [], [0], [0]
    A = map(int, raw_input().split())
    for i in range(10):
        if A[i] > B[0]:
            B.insert(0, A[i])
        elif A[i] > C[0]:
            C.insert(0, A[i])
        else:
            break
    if len(B) + len(C) == 12:
        print "YES"
    else:
        print "NO"

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

typedef long long ll;
const int maxn=10010;
int n,a[maxn],b[maxn];
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)	scanf("%d",&a[i]);
	for (int i=1;i<=n;i++)	scanf("%d",&b[i]);
	ll cnt=0,qaq=0;
	for (int i=1;i<=n;i++)
	{
		if (a[i]>b[i])	cnt+=a[i]-b[i];
		if (a[i]<b[i])	qaq+=(b[i]-a[i])/2;
	}
	if (cnt<=qaq)	printf("Yes\n");else printf("No\n");
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(void) {
  int a, b;
  cin >> a >> b;
  int c, m;
  c = a * b;
  m = a * b * c;
  if(m % 2 != 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  return 0;
}

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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  
  if (a+b > c+d) {
  	cout << "Left" << endl;
  }
  else if (a+b == c+d)  {
  	cout << "Balanced" << endl;
  }
  else {
  	cout << "Right" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
using namespace std;
typedef long long ll;
const int INF = 1<<15;
const ll MOD = 1e9+7;
const double EPS = 1e-9;


int main(int argc, const char * argv[]) {
  ll N; cin >> N;
  vector<ll> v(5);
  for (int i=0; i<5; i++) {
    cin >> v[i];
  }
  sort(v.begin(), v.end());
  cout << setprecision(16) << 4+ceil((double)N/v.front()) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;
 
int main(){
    int n;
    string s;
    cin >> n >> s;
    vector<int> sum(n,1), rsum(n,1);
    if(s[0] == 'E')sum.at(0)--;
    if(s[n-1] == 'W')rsum.at(n-1)--;
    for(int i = 1; i < n; i++){
        sum.at(i) = sum.at(i-1);
        if(s[i] == 'W')sum.at(i)++;
    }
    for(int i = n-2; i >= 0; i--){
        rsum.at(i) = rsum.at(i+1);
        if(s[i] == 'E')rsum.at(i)++;
    }
    int ans = rsum[1];
    for(int i = 1; i < n-1; i++){
        ans = min(ans, sum[i-1]+rsum[i+1]);
    }
    ans = min(ans, sum[n-2]);
    cout << ans;
}

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

using namespace std;

#define int64 long long 
const int mod = (int) 1e9 + 7;


int main(){
	int n;
	cin>>n;
	vector<int> arr(n);
	for(int i=0; i<n; i++){
		cin>>arr[i];
	}
	int64 ans = 0, sum = 0;
	for(int i=n-1; i>=0; i--){
		ans = (ans + (arr[i]*sum)%mod)%mod;
		sum = (sum + arr[i])%mod;
	}
	cout<<ans;
	
}


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

#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
using ll=long long;
const double PI=3.14159265358979323846;



int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;

    int t,j;
    t = 1;
    j = 0;

    while(j ==0){
        if(t > 0){
            C = C - B;
            if(C <= 0){
                cout << "Yes";
                j = 1;
            }
            t = t * -1;
        }else{
            A = A - D;
            if(A <= 0){
                cout << "No";
                j = 1;
            }
            t = t * -1;

        }

    }


}



/*
    int a[N][2];

    rep(i,N){
        rep(j,2){
            cin >> a[i][j];
        }
    }

    rep(i,N-1){
        for(int j=i+1;j<N;j++){
            int dlx = a[i][0] - a[j][1];
            int dly = a[j][0] - a[j][1];
            rep[]
        }
    }
*/

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int64_t> x(2);
  x[0]=2;
  x[1]=1;
  int64_t a=0;
  for(int i=0;i<n;i++){
    a=x[i]+x[i+1];
    x.push_back(a);
  }
  cout<<x[n]<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define _GLIBCXX_DEBUG
const int MOD = 1000000007;

int main() {
  string s;
  cin >> s;
  for (int i=0; i<s.size(); i++) {
    if (i==5||i==13) cout << " ";
    else if (i!=s.size()-1) cout << s[i];
    else cout << s[i] << endl;
  }
}

Measured memory_bytes: 256
#include<iostream> 
#include<bits/stdc++.h> 
using namespace std; 
int main()
{
    int n,l,i;
    cin>>n>>l;
    string s[n];
    for(i=0;i<n;i++)
       cin>>s[i];
    sort(s,s+n);
    for(i=0;i<n;i++)
       cout<<s[i];
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define repp(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

int main(){
    int n,m; cin >> n >> m;
    map<int,P> mp;
    vector<P> v;
    vector<int> num(n+1,1);
    rep(i,m){
        int p,y;
        cin >> p >> y;
        mp[i]={y,p};
        v.pb({y,p});
    }
    sort(ALL(v));
    map<P,string> ans;
    rep(i,m){
        int y2=v[i].fi;
        int p2=v[i].se;
        string res="";
        string sp=to_string(p2);
        rep(j,6-sp.size()) res+='0';
        res+=sp;
        sp=to_string(num[p2]);
        rep(j,6-sp.size()) res+='0';
        res+=sp;
        ans[{y2,p2}]=res;
        //cout << res << endl;
        num[p2]++;
    }
    rep(i,m){
        P p=mp[i];
        cout << ans[p] << endl;
    }
}


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

const int maxn = 3e5+10;

int n, a, cnt[maxn], ccnt[maxn], len, cur, ans, tot, i, sum;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n;
	for (i = 0; i < n; ++i) {
		cin >> a;
		cnt[a]++;
	}
	for (i = 1; i <= n; ++i) ccnt[cnt[i]]++;
	for (cur = 1, ans = n+1; cur <= n; ++cur) {
		while (ans && tot < cur && (n-sum)/(cur-tot) < ans) {
			ans--;
			tot += ccnt[ans];
			sum += ccnt[ans]*ans;
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  long long int H, N;
  cin >> H >> N;
  long long int sum = 0;
  for(int i=0;i<N;i++){
    int A;
    cin >> A;
    sum += A;
  }
  if(sum < H) cout << "No";
  else cout << "Yes";
  cout << endl;
}

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

using namespace std;
#define ll long long
#define dbug printf("I am here\n");
const int maxn = 2e5+100;

const ll inf = 1e18;
vector < pair <ll , ll> > g[maxn];
int dist[maxn];
bool visit[maxn];

void dfs(int u , int d){
    if(visit[u] == true)return;
    visit[u] = true;
    dist[u] = d;
    for(auto v : g[u]){
        dfs(v.first , (d+v.second)%2);
    }
}

int main()
{
    int n;
    cin >> n;
    for(int i = 1; i<n; i++){
        ll u , v , w;
        cin >> u >> v >> w;
        g[u].push_back({v,w%2});
        g[v].push_back({u,w%2});
    }
    dfs(1 , 0);
    for(int i = 1; i<=n; i++)cout << dist[i] << endl;
    return 0;



}



Measured memory_bytes: 11520
#include <iostream>
using namespace std;
int main() {
    int N;
    cin >> N;
    int p[N],max=0,sum=0,mxi=0;
    for (int i=0; i<N; i++) {
        cin >> p[i];
        if (max < p[i]) {
            max = p[i];
            mxi = i;
        }
    }
    p[mxi] = p[mxi] / 2;
    for (int i=0; i<N; i++) sum += p[i];
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
hi = [int(i) for i in input().split()]
dp = [10000000000]*(n)
dp[0] = 0

for i in range(1,n) :
  
  dp[i] = min(dp[i],dp[i-1] + abs(hi[i-1] - hi[i]))
  
  if 0 < i :
    dp[i] = min(dp[i],dp[i-2] + abs(hi[i-2] - hi[i]))


print(dp[-1])
  

Measured memory_bytes: 13976
// B - Uneven Numbers  2019/8/17

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

int main(void){
    int n,i,len,ans=0;
    char str[200000];
    scanf("%d",&n);
    while(n>0){
        sprintf(str,"%d",n);
        len=strlen(str);
        if(len%2==1){
            ans++;
        }
        n--;
    }
    printf("%d",ans);
    return 0;
}


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

int main(){
    int k;
    cin >> k;
    string s;
    cin >> s;
    if(s.size()<=k){
        cout << s <<endl;
    }else{
        rep(i, k)cout << s[i];
        cout << "..." << endl;
    }
    return 0;
}

Measured memory_bytes: 3592
<?php
while (!feof(STDIN)) {
  $stdin = trim(fgets(STDIN));
  $values  = explode(',', $stdin);
  if (count($values) != 5) {
  } else {
    $temp = array();
    foreach ($values as $value) {
      if (!isset($temp[$value])) {
        $temp[$value] = 1;
      } else {
        $temp[$value]++;
      }
    }
    ksort($temp);
    $ret = 'null';
    foreach ($temp as $t) {
      if ($t == 4) {
        $ret = 'four card';
      } elseif ($t == 3) {
        if ($ret == 'one pair') {
          $ret = 'full house';
        } else {
          $ret = 'three card';
        }
      } elseif ($t == 2) {
        if ($ret == 'one pair') {
          $ret = 'two pair';
        } elseif ($ret == 'three card') {
          $ret = 'full house';
        } else {
          $ret = 'one pair';
        }
      }
    }
    $temp = array_keys($temp);
    if (count($temp) == 5 && $temp[4] - $temp[0] == 4) {
      $ret = 'straight';
    }
    // 1???13????????´
    $temp2 = array();
    foreach ($temp as $t) {
      if ($t == 1) {
        $temp2[] = 14;
      } else {
        $temp2[] = $t;
      }
    }
    sort($temp2);
    if (count($temp2) == 5 && $temp2[4] - $temp2[0] == 4) {
      $ret = 'straight';
    }
    echo $ret . "\n";
  }
}



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

int main(){
    int n,w;
    while(cin>>n>>w,n){
        vector<int> V(11);
        for(int i=0;i<n;i++){
            int v;
            cin>>v;
            V[v/w]++;
        }
        for(int i=V.size()-1;i>=0;i--){
            if(V[i]){
                V.erase(V.begin()+i+1,V.end());
                break;
            }
        }
        int N = V.size();
        int max_H = 0;
        for(int i=0;i<N;i++) max_H = max(max_H,V[i]);
        double ans = 0.01;
        for(int i=0;i<N;i++){
            ans+=double(N-1-i)/double(N-1)*double(V[i])/double(max_H);
        }
        cout<<fixed;
        cout.precision(8);
        cout<<ans<<endl;
    }
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int  ,int > pii;
typedef pair<ll  ,ll > pll;

const ll maxn =8e5+5;
const ll mod = 1e9+7;
const ld PI = 4 * atan((ld) 1);

#define pb(x) push_back(x);
#define endl '\n'
#define dokme(x) cout << x ;  return(0);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_init freopen("input.txt", "r+", stdin); freopen("output.txt", "w+", stdout);
#define ms(x , y) memset(x , y , sizeof x);
ll pw(ll a, ll b) {
    return (!b ? 1 : (b & 1 ? a * pw(a * a % mod, b / 2) % mod : pw(a * a % mod, b / 2) % mod));
}

ll h  , ans = 0;
ll cnt = 1;

int main(){
    migmig
    cin >> h;
    while(h > 0){
        h = h/2;
        ans+=cnt;
        cnt*=2;
    }
    cout << ans;

    return(0);
}


//When we hit our lowest point, we are open to the greatest change.
//If I try, I fail. If I don't try, I'm NEVER GOING TO GET IT.
//Sometimes, life is like this dark tunnel. You can't always see the light at the end of the tunnel. But if you just keep moving... you will come to a better place.
//It is important to draw wisdom from diffrent places. If you take it from only one place it becomes rigid and stale.


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a,b;
  cin>>a>>b;
  int d=a+b;
  int e=a-b;
  int f=a*b;
  if(d>=e&&d>=f)
    cout<<d;
  else if(e>=d&&e>=f)
    cout<<e;
  else if(f>=d&&f>=e)
    cout<<f;
}

Measured memory_bytes: 256
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
lint num[15][15];
int cal(int x){
	while(x>9) x/=10;
	return x;
}
int main()
{
	int n;lint out=0;cin>>n;
	memset(num,0,sizeof(num));
	REP(i,1,n+1){
		//cout<<cal(i)<<' '<<i%10<<endl;
		num[cal(i)][i%10]++;
	}
	rep(i,10) rep(j,10){
		//if(num[i][j]>0) cout<<i<<' '<<j<<' '<<num[i][j]<<endl;
	}
	REP(i,1,10) REP(j,1,10){
		//cout<<i<<' '<<j<<' '<<num[i][j]<<''
		out+=num[i][j]*num[j][i];
	}
	cout<<out<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(){
	int n, ans, sum;
	scanf("%d",&n);
	int x[n];
	for (int i = 0;i < n;i++){
		scanf("%d",&x[i]);
		sum += x[i];
	}
	double ave = round((double) sum/(double) n);
	for (int i = 0;i < n;i++){
		ans += pow((double)(x[i] - ave), 2.0);
		}
	printf("%d",ans);
}

Measured memory_bytes: 384
//Tue Dec 22 22:01:34 JST 2009
#include<set>
#include<iostream>
#include<queue>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
#define mp make_pair
int dx[]={0,1,1,0,-1,-1};
int dy[]={-1,-1,0,1,1,0};
#define CONNECT true
#define UNCONNECT false
#define CANMOVE true
#define CANNOTMOVE false

class state{
public:
  int len;
  int x[8],y[8];
  int cnt;
  int path[8];
  bool is_connected(int me,int you){
    if ( x[me]==x[you]){
      if ( y[me]-1 == y[you] || y[me]+1 == y[you] || y[me]==y[you])return CONNECT;
    }else if ( x[me]+1 == x[you]){
      if (y[me] ==y[you] || y[me]-1==y[you])return CONNECT;
    }else if ( x[me]-1==x[you]){
      if (y[me] ==y[you] || y[me]+1 == y[you])return CONNECT;
    }

    return UNCONNECT;
  }

  bool can_good_pos(int cur){
    rep(i,cur-1){
      if ( is_connected(cur,i)==CONNECT)return false;//©ªÌOÈOÌâÂÆÂÈªÁÄ¢éÌÅ¾ßB
    }
    if (cur==0 ||  is_connected(cur,cur-1)==CONNECT)return true;//©ªÆOÌâÂÆÂÈªÁÄ¢éÌÅ¨
    return false;
  }
  
  void make_next(int now,queue<state>&Q,set<state>&S,bool flag,set<pair<int,int> > & NG){
    if ( now == len){
      if ( S.find((*this))==S.end()){
	cnt++;
	S.insert(*this);
	Q.push(*this);
	cnt--;
      }
      return;
    }

    //don't move
    
    if (can_good_pos(now) ){
      path[now]=-1;
      make_next(now+1,Q,S,CANMOVE,NG);
    }

    if ( flag == CANNOTMOVE)return;//OÌª®¢Ä½ç©ªÍ®¯È¢

    rep(i,6){
      x[now]+=dx[i];
      y[now]+=dy[i];

      path[now]=i;

      if (NG.find(mp(x[now],y[now])) == NG.end() && can_good_pos(now)){
	make_next(now+1,Q,S,CANNOTMOVE,NG);//©ªª®¢½çÌÍ®¯È¢B
      }
      x[now]-=dx[i];
      y[now]-=dy[i];
    }
        
  }
  
  bool operator<(const state & a)const{
    rep(i,len){
      if ( x[i]!=a.x[i])return x[i]<a.x[i];
      if ( y[i]!=a.y[i])return y[i]<a.y[i];
    }
    return false;
  }
  
};



int bfs(state ini,int dx,int dy,set<pair<int,int> > &NG){
  queue<state> Q;
  set<state> S;
  Q.push(ini);
  S.insert(ini);
  while(!Q.empty()){
    state now = Q.front();
    Q.pop();

    if ( now.x[0]==dx && now.y[0]==dy){
      return now.cnt;
    }
    now.make_next(0,Q,S,CANMOVE,NG);
  }
  return -1;
}


main(){
  int n,m,dx,dy;
  while(cin>>n && n){
    state ini;
    set<pair<int,int> > NG;
    
    ini.len=n;
    ini.cnt=0;
    rep(i,n)cin>>ini.x[i]>>ini.y[i];
    cin>>m;
    rep(i,m){
      int f,s;
      cin>>f>>s;
      NG.insert(mp(f,s));
    }
    cin>>dx>>dy;
    cout << bfs(ini,dx,dy,NG)<<endl;
  }
  return false;
}

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

int main()
{
	int k;
	cin>>k;
	string s;
	cin>>s;
	if(s.size()<=k)
		cout<<s;
	else{
		for(int i=0;i<k;i++)
			cout<<s[i];
		cout<<"...";
	}
	return 0;
}


Measured memory_bytes: 3624
s=input()

s1=s[0:2]
s2=s[2:4]

if 1 <= int(s1) <= 12 and 1 <= int(s2) <= 12:
  print('AMBIGUOUS')
elif 1 <= int(s2) <= 12 and not 1 <= int(s1) <= 12:
  print('YYMM')
elif 1 <= int(s1) <= 12 and not 1 <= int(s2) <= 12:
  print('MMYY')
else:
  print('NA')

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


namespace AtCoder
{
    partial class Program
    {
        static void Main(string[] args)
        {
			//↓


            var input = Console.ReadLine();
            var k = input.Length;
            var n = int.Parse(input);

            var r = 0;
            switch (k)
            {
                case 1:
                    r = n;
                    break;
                case 2:
                    r = 9;
                    break;
                case 3:
                    r = (n-99) + 9;
                    break;
                case 4:
                    r = 909;
                    break;
                case 5:
                    r = (n-9999) + 909;
                    break;
                case 6:
                    r = 90909;
                    break;
                default:
                    break;
            }

            Console.WriteLine(r);

			//↑
        }
	}
}

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

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

  long long memo[10][10] = {};
  for(int i = 1; i <= 9; i++){
    for(int j = 1; j <= 9; j++){
      long long & tar = memo[i][j];
      if(i == j && i <= N){
        tar++;
      }
      if(i * 10 + j <= N){
        tar++;
      }
      for(int digits = 1; digits <= 4; digits++){
        int loop_max = 1;
        for(int k = 0; k < digits; k++){
          loop_max *= 10;
        }
        for(int k = 0; k < loop_max && i * 10 * loop_max + 10 * k + j <= N; k++){
          tar++;
        }
      }
    }
  }
  long long ans = 0;
  for(int i = 1; i <= 9; i++){
    for(int j = 1; j <= 9; j++){
      ans += memo[i][j] * memo[j][i];
    }
  }
  cout << ans << endl;
}


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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    ll K;
    cin >> S >> K;
    REP(i, S.length()) {
        if (S[i] == '1')
            K--;
        if (K == 0 || S[i] != '1') {
            cout << S[i] << endl;
            break;
        }
    }
    return 0;
}

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

void solve() {
  int n;
  while (cin >> n, n) {
    map<int, int> t;
    vi s(4000);
    rep(_, n) {
      int i, p, q;
      cin >> i >> p >> q;
      t[i] += p * q;
      s[i] = _;
    }
    vi v;
    for (auto x : t) {
      if (x.se >= 1000000) v.pb(x.fi);
    }
    sort(all(v), [&](int a, int b) {
      return s[a] < s[b];
    });
    if (v.size()) {
      rep(i, v.size()) cout << v[i] << endl;
    } else {
      cout << "NA" << endl;
    }
  }
}

Measured memory_bytes: 3176
def wczytaj_liste(): 
    wczytana_lista = input()
    lista_znakow = wczytana_lista.split()
    ostateczna_lista = []
    for element in lista_znakow:
        ostateczna_lista.append(int(element))
    return ostateczna_lista

def A():
    trzy_liczby = wczytaj_liste()
    suma = 0 
    for liczna in trzy_liczby: 
        suma += liczna
    if suma >= 22: 
        print('bust')
    else: 
        print('win')
A()

Measured memory_bytes: 38384
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Convert;
using static System.Console;
using static System.Math;
class MainClass
{
	static void Main(string[] args)
	{
		Answer();
	}
	public static void Answer()
	{
		var inABC = Console.ReadLine().Split(' ');
      /*
             * 3pattern 
             */
      if (inABC[0] == inABC[1]) { Console.WriteLine(inABC[2]); }
      else if (inABC[0] == inABC[2]) { Console.WriteLine(inABC[1]); }
      else if (inABC[1] == inABC[2]) { Console.WriteLine(inABC[0]); }		
	}
}

Measured memory_bytes: 11092