akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define f(i, a, b) for(ll i=a; i<b; i++)
#define fr(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define LB lower_bound
#define UB upper_bound
#define endl "\n"
using namespace std;

bool sortbysec(const pair<ll,ll> &a, 
              const pair<ll,ll> &b) 
{ 
    return (a.second < b.second); 
} 

ll maxSubArraySum(ll a[], ll size) 
{ 
    ll max_so_far = INT_MIN, max_ending_here = 0; 
  
    for (ll i = 0; i < size; i++) 
    { 
        max_ending_here = max_ending_here + a[i]; 
        if (max_so_far < max_ending_here) 
            max_so_far = max_ending_here; 
  
        if (max_ending_here < 0) 
            max_ending_here = 0; 
    } 
    return max_so_far; 
} 

ll findSubarraySum(ll arr[], ll n, ll sum = 0) 
{
    unordered_map<ll, ll> prevSum;
    ll res = 0;
    ll currsum = 0;
    for (ll i = 0; i < n; i++)
    {
        currsum += arr[i];
        if (currsum == sum) res++;
        if (prevSum.find(currsum - sum) != prevSum.end()) res += (prevSum[currsum - sum]);
        prevSum[currsum]++;
    }
    return res; 
} 
ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
  
ll powmp(ll x, ll y, ll p) 
{ 
    ll res = 1;     x = x % p;   
    while (y > 0) 
    {  
        if (y & 1)  res = (res*x) % p; 
        y = y>>1; 
        x = (x*x) % p;   
    } 
    return res; 
} 

int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    ll k,a,b;cin>>k>>a>>b;
    for(int i=a;i<=b;i++)
    {
        if(i%k==0) 
        {
            cout<<"OK\n";
            return 0;
        }
    }
    cout<<"NG\n";
}


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

#define rep(i,n) for(ll i=0;i<n;i++)
#define REP(i,a,n) for(ll i=a;i<n;i++)

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

const int INF = 100000000;
const ll LINF = 1e18+5;

int main() {
    ll N;
    cin >> N;
    ll X[50] = {};
    ll Y[50] = {};
    rep(i,N) {
        cin >> X[i] >> Y[i];
    }
    ld minr = LINF;
    rep(i,N){
        REP(j,i+1,N) {
            ld r = sqrt(pow(X[i]-X[j],2)+pow(Y[i]-Y[j],2))/2.0;
            ld px = ld(X[i]+X[j])/2.0;
            ld py = ld(Y[i]+Y[j])/2.0;
            bool dameflag = false;
            rep(k,N) {
                if(i==k || j==k) continue;
                if(r < sqrt(pow(X[k]-px,2)+pow(Y[k]-py,2))) {
                    dameflag = true;
                    break;
                }
            }
            if(!dameflag && r < minr) {
                minr = r;
            }
        }
    }
    if(N==2) {
        cout << fixed;
        cout << setprecision(8) << minr << endl;
        return 0;
    }
    rep(i,N) {
        REP(j,i+1, N) {
            REP(k,j+1, N) {
                ll x1 = X[i]-X[k];
                ll x2 = X[j]-X[k];
                ll y1 = Y[i]-Y[k];
                ll y2 = Y[j]-Y[k];
                if(x1*y2-y1*x2==0) {
                    continue;
                }
                ld a = X[i];
                ld b = Y[i];
                ld c = X[j];
                ld d = Y[j];
                ld e = X[k];
                ld f = Y[k];
                ld py = ((e-a)*(a*a+b*b-c*c-d*d) - (c-a)*(a*a+b*b-e*e-f*f)) / (2*(e-a)*(b-d)-2*(c-a)*(b-f));
                ld px = 0.0;
                if(X[j]-X[i]!=0) {
                    px = (2*(b-d)*py-a*a-b*b+c*c+d*d)/(2*(c-a));
                } else {
                    px = (2*(b-f)*py-a*a-b*b+e*e+f*f)/(2*(e-a));
                }
                ld r = sqrt((px-a)*(px-a) + (py-b)*(py-b));
 
                bool dameflag = false;
                rep(l,N) {
                    if(l==i || l==k || l==j) continue;
                    ld r2 = sqrt(pow(X[l]-px,2)+pow(Y[l]-py,2));
                    if(r < r2) {
                        dameflag = true;
                        break;
                    }
                }
                if(minr > r && !dameflag) minr = r;
            }
        }
    }
    cout << fixed;
    cout << setprecision(8) << minr << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int N;
    int a[200];
    int c=0;

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

    for(int i=0; i<N; i=i+2){
        if(a[i]%2 == 1) c++;
    }

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

    return 0;
}

Measured memory_bytes: 1688
using System;
					
public class Program
{
	public static void Main()
	{
		string n = Console.ReadLine();
		
		int result = 0;
		if((Convert.ToInt32(n) % 2) == 0){
			result = Convert.ToInt32(n);
		
		}else{
			result = Convert.ToInt32(n) * 2;
		}
		
		Console.WriteLine(result);
	}
}


Measured memory_bytes: 11348
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define f first
#define s second
using namespace std;
int dp[15000001];
int d, g;
int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> d >> g;
    memset(dp,0x3f,sizeof(dp));
    dp[0] = 0;
    for(int i = 1; i <= d; i++){
        int p, c; cin >> p >> c; int foo = i*100;
        for(int j = 10000000; j >= 0; j--){
            if(dp[j] == 1061109567)continue;
            for(int k = p; k >= 1; k--){
                if(k == p){
                    if(dp[j]+k < dp[j+foo*k+c])dp[j+foo*k+c] = dp[j]+k;
                    continue;
                }
                if(dp[j]+k < dp[j+foo*k])dp[j+foo*k] = dp[j]+k;
            }
        }
        /*
        for(int i = 0; i <= 20000000; i++){
            if(dp[i] == 1e9)continue;
            cout << i << " " << dp[i] << endl;
        }
        cout << endl;
        */
    }

    int res = 1e9;
    for(int i = g; i <= 15000000; i++)res = min(res, dp[i]);
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 62240
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

bool ok[20];
int main()
{
	int N, K, D[20];
	cin >> N >> K;
	for (int i = 0; i < 10; i++) ok[i] = true;
	for (int i = 0; i < K; i++) {
		cin >> D[i];
		ok[D[i]] = false;
	}
	for (int i = N; i <= mod; i++) {
		bool out = false;
		int tmp = i;
		while (tmp > 0) {
			if (!ok[tmp % 10]) {
				out = true;
				break;
			}
			tmp /= 10;
		}
		if (out) continue;
		cout << i << endl;
		return 0;
	}
}

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

string s;
int sum;
int main() {
	cin >> s;
	for(int i=0; s[i]; i++) {
		sum += s[i] - '0';
	}
	cout << (sum%9 ? "No" : "Yes");
	return 0;
}


Measured memory_bytes: 3732
N,K,S = map(int,input().split())
ans = []
for i in range(K):
    ans.append(S)
for j in range(N-K):
    if not S == 1000000000:
        ans.append(S+1)
    else:
        ans.append(S-1)
for l in ans:
    print(l,end=" ")
print()      

Measured memory_bytes: 13008
using System;
using System.Linq;

class Program
{
	static void Main(string[] args)
	{
		var input = Console.ReadLine().Split().Select(int.Parse).ToArray();

		Array.Sort(input);
		var ans = "";
		for (var i = 0; i < input.Length; i++)
		{
			if (i != input.Length - 1)
			{
				System.Console.Write(input[i] + " ");
			}
			else
			{
				System.Console.WriteLine(input[i]);
			}
		}
	}
}


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

int run(char map[20][20],int w,int h,int x,int y,int n) {
	static const int dxy[4][2]={
		{0,1},{1,0},{0,-1},{-1,0}
	};
	int d;
	int res=10000;
	if(n>=10)return res;
	for(d=0;d<4;d++) {
		int nx=x,ny=y;
		nx+=dxy[d][0];
		ny+=dxy[d][1];
		if(nx<0 || nx>=w || ny<0 || ny>=h || map[ny][nx]==1)continue;
		for(;;) {
			if(map[ny][nx]==3)return 1;
			nx+=dxy[d][0];
			ny+=dxy[d][1];
			if(nx<0 || nx>=w || ny<0 || ny>=h)break;
			if(map[ny][nx]==1) {
				int nowres;
				map[ny][nx]=0;
				nowres=run(map,w,h,nx-dxy[d][0],ny-dxy[d][1],n+1)+1;
				if(nowres<res)res=nowres;
				map[ny][nx]=1;
				break;
			}
		}
	}
	return res>100 && n==0?-1:res;
}

int main(void) {
	int w,h;
	while(scanf("%d%d",&w,&h)==2 && (w|h)!=0) {
		int i,j;
		int sx,sy;
		char map[20][20];
		for(i=0;i<h;i++) {
			for(j=0;j<w;j++) {
				int buf;
				if(scanf("%d",&buf)!=1)return 1;
				map[i][j]=(char)buf;
				if(buf==2) {
					map[i][j]=0;
					sx=j;
					sy=i;
				}
			}
		}
		printf("%d\n",run(map,w,h,sx,sy,0));
	}
	return 0;
}

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

void solve(){
    int n, d;
    cin >> n >> d;
  if(d % 2 == 1) cout << "No" << endl;
    else if(n*2 <= d && d <= n*4) cout << "Yes" << endl;
  	else cout << "No" << endl;  
  return;
}
int main()
{
    solve();
    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
using namespace std;
 
int main() {
	string s;
	int pat;
	pat=0;
	cin>>s;
	for (int x=0;x<s.length();x++){
		if (s[x]=='1'){
			pat=pat+1;
		}
	}
	cout<<pat<<endl;
	return 0;
}

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

using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define Rep(i, n0, n) for (int i = n0; i < n; i++)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
typedef long long ll;
typedef long li;
#define pb push_back
#define mp make_pair

signed main()
{
	int HH, WW;
	cin >> HH >> WW ;
	char maps[HH][WW];
	int ary1[HH][WW],ary2[HH][WW];
	char temp ;
	rep(i,HH) {
		rep(j,WW) {
			cin >> maps[i][j];
		}
	}
	vector <int> cat;
	cat.push_back(0);
	int catl = 1;
	int count = 0;
	rep(i,HH) {
		rep(j,WW) {
			if(maps[i][j] == '.') {
				count ++;
				ary1[i][j] = catl;
			} else {
				ary1[i][j] = 0;
				cat.push_back(count);
				count = 0;
				catl ++ ;
			}
		}
		if (count > 0) {
			cat.push_back(count);
			count = 0;
			catl ++ ;
		}
	}

	rep(j,WW) {
		rep(i,HH) {
			if(maps[i][j] == '.') {
				count ++;
				ary2[i][j] = catl;
			} else {
				ary2[i][j] = 0;
				cat.push_back(count);
				count = 0;
				catl ++ ;
			}
		}
		if (count > 0) {
			cat.push_back(count);
			count = 0;
			catl ++ ;
		}
	}

	int tm = 1;
	int max = 1;

	rep(i,HH) {
		rep(j,WW) {
			tm = cat[ary2[i][j]] + cat[ary1[i][j]];
			if (tm > max) {
				max = tm;
			}
		}
	}
	cout << max - 1 << endl;
	return 0;
}


Measured memory_bytes: 70244
X,Y = raw_input().split()
def check(a):
    if a == "A":
        return 1
    elif a == "B":
        return 2
    elif a == "C":
        return 3
    elif a == "D":
        return 4
    elif a == "E":
        return 5
    elif a == "F":
        return 6
x = check(X)
y = check(Y)
if x > y:
    print(">")
elif x < y:
    print("<")
else:
    print("=")

Measured memory_bytes: 2568
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int d = Integer.parseInt(sc.next());
        int t = Integer.parseInt(sc.next());
        int s = Integer.parseInt(sc.next());
        int distance = t * s;
        if (distance >= d) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        sc.close();
    }
}

Measured memory_bytes: 35768
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define full(a) a.begin(),a.end()
#define rfull(a) a.rbegin(),a.rend()

using namespace std;
const double pi=acos(-1.0);
const double pii=2*pi;
const double eps=1e-6;
const long long MOD=1e9+7;

void solve(){
	int n;
	cin>>n;
	vector<vector<int>> all_num(n,vector<int>(62,0));
	vector<long long> inp(n,0ll);
	for(int i=0;i<n;i++)
		cin>>inp[i];

	for(int i=0;i<n;i++){
		long long tmp=inp[i];
		for(int j=0;j<62;j++){
			all_num[i][j] = tmp%2;
			tmp/=2;
		}
	}
	long long ans=0,mul=1;
	for(int j=0;j<62;j++){
		long long sm=all_num[n-1][j],ln=1;
		for(int i=n-2;i>=0;i--){
			if(all_num[i][j]==1){
				ans += (mul*(ln-sm))%MOD;
				ans %= MOD;
			}
			else{
				ans += (mul*sm)%MOD;
				ans %= MOD;
			}
			sm += all_num[i][j];
			ln++;
		}
		mul = (mul*2ll)%MOD;
	}
	cout << ans%MOD << "\n";
}

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

Measured memory_bytes: 86656
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;
int digit_num(int num);

int main() {
	int n;
	int cnt = 0;
	int digit;
	cin >> n;
	for (int i = 1; i <= n; i++){
		// 桁数を求める
		digit = digit_num(i);
		if (digit % 2 == 1) cnt++;
	}
	cout << cnt << endl;
	return 0;
}

int digit_num(int num){
	int digit = 0;
	while(num != 0){
		num = num / 10;
		digit++;
	}
	return digit;
}

Measured memory_bytes: 256
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
//class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
        BufferedReader stdReader =
            new BufferedReader(new InputStreamReader(System.in));
        String[] nums = stdReader.readLine().split(" ");
         
        int a = Integer.parseInt(nums[0]);
        int b = Integer.parseInt(nums[1]);
        int c = Integer.parseInt(nums[2]);
        
        if( (a < b) && (b < c) ) {
        	System.out.println("Yes");
        } else {
        	System.out.println("No");
        }
	}
}

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

typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// chmax, chmin
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;
}

void solve(long long N) {
    string s = "";
    while(N > 0 ) {
        s += 'a' + (N - 1) % 26;
        N = (N-1) / 26;
    }
    reverse(s.begin(), s.end());
    cout << s << endl;
}

int main() {
    long long N;
    scanf("%lld", &N);
    solve(N);
    return 0;
}


Measured memory_bytes: 3688
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
}

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

func main() {
	n, _ := strconv.Atoi(input())
	d, _ := strconv.Atoi(input())

	count := 0

	for i := 0; i < n; i++ {
		x, _ := strconv.Atoi(input())
		y, _ := strconv.Atoi(input())

		if x*x+y*y <= d*d {
			count++
		}
	}

	fmt.Println(count)
}


Measured memory_bytes: 4892
#include<algorithm>
#include<cstring>
#include<cctype>
#include<cstdio>
#define rep(i,x,y) for(int i=x; i<=y; ++i)
#define repd(i,x,y) for(int i=x; i>=y; --i)

using namespace std;
int n,cnt[2],ct[2][100005],a[100005];
int f[100005],g[100005],ans;

int main()
{
	scanf("%d",&n);
	rep(i,1,n)
	{
		scanf("%d",&a[i]);
		++cnt[i&1],++ct[i&1][a[i]];
	}
	f[0]=n;
	rep(i,1,100000) f[i]=min(f[i-1],cnt[0]-ct[0][i]);
	
	g[100001]=n;
	repd(i,100000,1) g[i]=min(g[i+1],cnt[0]-ct[0][i]);
	
	ans=n;
	rep(i,1,100000) ans=min(ans,cnt[1]-ct[1][i]+min(f[i-1],g[i+1]));

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

	return 0;
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
main(){
  int n;cin>>n;
  int a[101010],dp[101010];
  for(int i=0;i<n;i++) cin>>a[i];
  dp[0]=0;dp[1]=abs(a[1]-a[0]);
  for(int i=2;i<n;i++) dp[i]=min(dp[i-2]+abs(a[i-2]-a[i]),dp[i-1]+abs(a[i-1]-a[i]));
  cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 1024
from itertools import permutations
n=int(input())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
c=sorted(list(permutations(range(1,n+1))))
a,b,=0,0
for i,c in enumerate(c):
    if p==list(c):
        a=i
    if q==list(c):
        b=i
print(abs(a-b))

Measured memory_bytes: 14152
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
const int INF = 2147483647;

using namespace std;

int main()
{
  int n;
  cin >> n;
  vector<ll> a(n);
  REP(i, n)
  {
    cin >> a[i];
  }

  ll l = 0, r = 0;
  ll ans = 0;
  ll cur = 0;
  bool isZero = true;
  while (l < n)
  {
    if ((cur & a[r]) == 0)
    {
      if (r == n - 1)
      {
        ans += ((r - l + 1) * (r - l + 2)) / 2;
        break;
      }
      if (!isZero)
        isZero = true;
      cur = (cur | a[r]);
      r++;
    }
    else
    {
      if (isZero)
      {
        isZero = false;
        ans += r - l;
        cur = (cur & (~a[l]));
        l++;
      }
      else
      {
        r--;
        cur = (cur & (~a[r]));
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <functional>
#include <iostream>
#define  pb push_back
#define  xx first
#define  yy second
//#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

using namespace std;

typedef long long ll;
typedef vector<string> vi;
typedef pair<int,int> pi;

      ll bigmod ( long long a, int p, int m )
{
    if ( p == 0 )return 1; // If power is 0 ( a ^ 0 ), return 1

    if ( p & 1 ) // If power is odd
    {
        return ( ( a % m ) * ( bigmod ( a, p - 1, m ) ) ) % m;
    }
    else
    {
        long long tmp = bigmod ( a, p / 2, m );
        return ( tmp * tmp ) % m;
    }
}

int main()
{
         //ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
           int t=1,caseno = 0;

   // scanf("%d",&t);

     while(t--){
      ll n,a,b;
      cin >> n >> a >> b;
      if(a==0){
        cout << a << endl;
      }
      else{

      ll ans = n/(a+b);
      ans = ans*a;
       ans +=min(a,n%(a+b));
        cout << ans << endl;
      }
    }

    return 0;
}



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(){
    ll N,D; cin>>N>>D;
    
    int ans=0;
    for(int i=0; i<N; i++){
        ll x,y; cin>>x>>y;
        if(x*x + y*y <= D*D){
            ans++;
        }
    }
    cout << ans << endl;
}


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

const long MAX = 100001;
const long NIL = -1;

struct Node{
	long parent, leftChild, rightSibling;
};

long n, Depth[MAX];

void print(struct Node T[], long id){
	cout << "node " << id << ": ";
	cout << "parent = " << T[id].parent << ", ";
	cout << "depth = " << Depth[id] << ", ";

	if (T[id].parent == NIL) cout << "root, ";
	else if (T[id].leftChild == NIL) cout << "leaf, ";
	else cout << "internal node, ";

	cout << "[";

	for (long i = 0, c = T[id].leftChild; c != NIL; i++, c = T[c].rightSibling){
		if (i) cout << ", ";
		cout << c;
	}
	cout << "]" << endl;
}

long setDepth(struct Node T[], long id, long parent){
	Depth[id] = parent;
	if (T[id].rightSibling != NIL) setDepth(T, T[id].rightSibling, parent);
	if (T[id].leftChild != NIL) setDepth(T, T[id].leftChild, parent + 1);
}

int main(){
	long degree, id, child, left, right;
	struct Node T[MAX];
	cin >> n;
	for (long i = 0; i < n; i++){
		T[i].parent = T[i].leftChild = T[i].rightSibling = NIL;
	}
	for (long i = 0; i < n; i++){
		cin >> id >> degree;
		for (long j = 0; j < degree; j++){
			cin >> child;
			if (j == 0) T[id].leftChild = child;
			else T[left].rightSibling = child;
			left = child;
			T[child].parent = id; 
		}
	}
	for (long i = 0; i < n; i++){
		if (T[i].parent == NIL) right = i;
	}

	setDepth(T, right, 0);

	for (long i = 0; i < n; i++) print(T, i);

	return 0;
}

Measured memory_bytes: 7408
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
#define LL long long 

int main(){
    int n;
    LL ans = 0;
    cin >> n;
    vector<LL> A(n), B(n), C(n);
    for(int i = 0; i < n; i++){
        cin >> A[i];
    }
    for(int i = 0; i < n; i++){
        cin >> B[i];
    }
    for(int i = 0; i < n; i++){
        cin >> C[i];
    }

    sort(A.begin(),A.end());
    sort(B.begin(),B.end());
    sort(C.begin(),C.end());
    for(int i = 0; i < n; i++){
        auto it = lower_bound(A.begin(), A.end(), B[i]);
        LL index = it - A.begin();
        auto it2 = upper_bound(C.begin(), C.end(), B[i]);
        LL index2 = C.end() - it2;
        ans += index * index2;
        // cout << index << index2 << endl;
    }
    cout << ans << endl;

}

Measured memory_bytes: 2560
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;

int main()
{
	string a, b;
	int temp;
	cin >> a >> b;
	temp = stoi(a + b);
	for (int i = 1; i*i <= temp; i++) {
		if (i * i == temp) {
			cout << "Yes" << endl;
			return 0;
		}
	}

	cout << "No" << endl;
	return 0;
}

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

#define ll long long
#define ld long double

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define repA(i,A)   for(auto i:A)

#define err() cout<<"=================================="<<endl;
#define errA(A) for(auto i:A)   cout<<i<<" ";cout<<endl;
#define err1(a) cout<<#a<<" "<<a<<endl
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl

#define mp make_pair
#define pb push_back
#define all(A)  A.begin(),A.end()
#define allr(A)	A.rbegin(),A.rend()
#define ft first
#define sd second

#define pll pair<ll,ll>
#define V vector<ll>
#define S set<ll>
#define VV vector<V> 
#define Vpll vector<pll>

#define endl "\n"

const ll logN = 20;
const ll M = 1000000007;
const ll INF = 1e12;
#define PI 3.14159265

const ll N = 100005;

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll a,b;
    cin>>a>>b;
    ll cur=a;
    ll cnt=1;
    if(b==1){
    	cout<<0<<endl;
    	return 0;
    }
    while(cur<b){
    	cnt++;
    	cur += (a-1);
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<climits>
#include<map>
#include<queue>
#include<iomanip>

using namespace std;

int main(){

	string S;
	cin >> S;
	int N = S.size();
	int current = N;

	while(current >  0){

		if(current >= 7){
			string sub = S.substr(current-7,7);
			if(sub == "dreamer"){
				current -= 7;
				continue;
			}
		}

		if(current >=6){
			string sub = S.substr(current-6,6);
			if(sub == "eraser"){
				current -=6;
				continue;
			}
		}

		if(current >= 5){
			string sub = S.substr(current-5,5);
			if(sub == "dream" || sub == "erase"){
				current -= 5;
				continue;
			}
		}

		cout << "NO" << endl;
		return 0;
	}

	cout << "YES" << endl;

	return 0;

}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

int main(){
	ll H, W;
	cin >> H >> W;
	int a[H][W];
	REP(i, H){
		string S;
		cin >> S;
		REP(j, W){
			a[i][j] = (S[j]=='.'?0:1);
		}
	}
	vector<bool> x(H), y(W);
	REP(i, H){
		ll sum = 0;
		REP(j, W){
			sum += a[i][j];
		}
		x[i] = (sum!=0); 
	}
	REP(j, W){
		ll sum = 0;
		REP(i, H){
			sum += a[i][j];
		}
		y[j] = (sum!=0); 
	}
	REP(i, H){
		if(!x[i]) continue;
		REP(j, W){
			if(!y[j]) continue;
			cout << (a[i][j]==0?'.':'#');
		}
		cout << endl;
	}
    return 0;
}

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;

int main() {
    int N;
    cin >> N;
    map<ll, ll> mp;
    mp[0] = 1;
    ll sum = 0;
    rep(i, N) {
        int a;
        cin >> a;
        sum += a;
        mp[sum]++;
    }

    ll ans = 0;
    for (auto m: mp) {
        ll n = m.second;
        if (n > 1)ans += n * (n - 1) / 2;
    }

    cout << ans << endl;
}

Measured memory_bytes: 12800
n,k,q = list(map(int,input().split()))
l=[]
for i in range (n):
  l.append(k-q)
for ii in range (q):
  a = int(input())
  l[a-1] += 1
for iii in range (n):
  if l[iii] <= 0 :
    print('No')
  else :
    print('Yes')

Measured memory_bytes: 7972
#include <iostream>
#include <sstream>
#include <string>
#include <cmath>

//void Aoj_learning1();
//void Aoj_learning2();
//void Aoj_learning3();
void Aoj_learning4();
//void Aoj_learning5();

int main()
{
	Aoj_learning4();
}

void Aoj_learning4()
{
	std::string sInput;
	int intInputNum = 0;
	std::istringstream ss;	// 汎用文字列ストリーム

	// 入力個数の取得
	std::cin >> sInput;
	ss = std::istringstream(sInput);
	ss >> intInputNum;
	if (intInputNum > 200000 || 2 > intInputNum)
	{
		exit(0);
	}

	// 数値取得
	std::string *sInputNum;
	sInputNum = new std::string[200000];
	for (int count = 0; count < intInputNum; count++)
	{
		std::cin >> sInputNum[count];
	}

	// 配列時系列で見て差分が最大となる値を探す
	long int number;		// 比較元
	long int number2;	// 比較対象
	long int dif;		// 差分

	ss = std::istringstream(sInputNum[0]);
	ss >> number;
	for (int count = 1; count < intInputNum; count++)
	{
		ss = std::istringstream(sInputNum[count]);
		ss >> number2;
		if (count == 1)
		{
			dif = number2 - number;
			if (number > number2)
			{
				number = number2;
			}
		}
		else
		{
			if (dif < (number2 - number))
			{
				dif = number2 - number;
			}
			if (number > number2)
			{
				number = number2;
			}
		}
	}
	std::cout << dif << std::endl;
}


Measured memory_bytes: 16792
from collections import defaultdict

n=int(input())

a=defaultdict(int)
b=defaultdict(int)


for i in range(n):
    a[i],b[i] = map(int,input().split())


bb=sorted(b.items(),key=lambda x:x[1])

sum=0
for k,v in bb:
    sum += a[k]
    if sum > v:print('No');exit()

print('Yes')

# n = int(input())
# d = [list(map(int,input().split())) for i in range(n)]
# d.sort(key=lambda x: x[1])
# ans = 'Yes'
# t = 0
# for i in d:
#     t += i[0]
#     if t>i[1]:ans='No'
# print(ans)

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

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main(){
  ll k,x;
  cin >> k >> x;
  if(k*500 >= x){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String args[]) {
      Scanner sc = new Scanner(System.in);
      
      int num1 = sc.nextInt();
      int num2 = sc.nextInt();
      int ans = (num1 * num2) % 2;
      
      if(ans == 0) {
          System.out.println("Even");
      }
      else {
          System.out.println("Odd");
      }
    }
}

Measured memory_bytes: 21844
/*
hey stop, don't skip the shit till it's solved
*/
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
int main()
{
int n;
cin>>n;
n--;
int a[n];
for(int i=0;i<n;i++)
{
cin>>a[i];
}
int b[n+1];
b[0]=a[0];
b[1]=a[0];
int ans=0;
for(int i=1;i<n;i++)
{
b[i]=min(b[i],a[i]);
b[i+1]=a[i];
}
for(int i=0;i<n+1;i++)
{
ans+=b[i];
}
cout<<ans<<endl;
}

Measured memory_bytes: 3492
from itertools import accumulate

def f():
     n, k = map(int,input().split())
     p = list(input())
     a = [] 
     pre = '1'
     cnt = 0
     for i in range(n):
          if pre != p[i]:
               a.append(cnt)
               cnt = 1
               pre = p[i]
          else:
               cnt += 1
     a.append(cnt)
     if pre == '0':
          a.append(0)

     w = 2*k+1

     if w >= len(a):
          return n
     else:
          acc = [0] + list(accumulate(a))
          ans = 0
          for i in range(0,len(a)-w+1,2):
               ans = max(ans,acc[i+w]-acc[i])
          return ans
          
print(f())

Measured memory_bytes: 9380
#include<stdio.h>

int main(void)
{
  char s[3];
  int i,judge;
  scanf("%s",s);

  judge = 0;
  if(((s[0]=='0')&&(s[1]>'0'))||((s[0]=='1')&&(s[1]<='2'))){
    judge = 1;
    if(((s[2]=='0')&&(s[3]>'0'))||((s[2]=='1')&&(s[3]<='2')))
      judge = 3;
  }
  else if(((s[2]=='0')&&(s[3]>'0'))||((s[2]=='1')&&(s[3]<='2')))
    judge = 2;

  if(judge==0)
    printf("NA\n");
  else if(judge==1)
    printf("MMYY\n");
  else if(judge==2)
    printf("YYMM\n");
  else if(judge==3)
    printf("AMBIGUOUS\n");

  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;
using namespace std;



int main(int argc, char* argv[])
{
    ll x,y;
    scanf("%lld%lld", &x, &y);

    int i;
    ll curr=x;
    for(i=0; i<1000; i++) {
        curr*=2;
        if(curr>y) break;
    }
    printf("%d\n", i+1);



    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main(){
    int num;
    cin >> num ;
    long long int M = 1000000000 + 7;
    vector<int> v(num);
    for(int i=0; i< num ; i++ ){
        cin >> v[i];
    }
    long long int sum = v[0];
    long long int ans = 0;
    for(int i = 1; i< num ; i++ ){
        ans = (ans + v[i]*sum)%(M);
        sum = (sum + v[i])%M;
    }
    cout << ans%(M) ;
    return 0;
}

Measured memory_bytes: 4020
// 問題名:　Square Route
// URL: http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2015&lang=jp
// 所要時間: 20分
// --感想--
// intの配列は今までfor文を用いて1個ずつ0を代入して初期化していたので、今後は"= {}"などを用いて簡略化するようにしたい。

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

int main(){
    while(1){
        int n, m, h[1555], w[1555];
        cin >> n >> m;
        if(n==0)
            break;
        for (int i = 0; i < n;i++)
            cin >> h[i];
        for (int i = 0; i < m;i++)
            cin >> w[i];
        // 間隔がdとなるような東西/南北方向の道2つの組み合わせの数
        int count_h[1500010] = {}, count_w[1500010] = {};
        for (int i = 0; i < n; i++){
            int sum = 0;
            for (int j = i;j<n;j++){
                sum += h[j];
                count_h[sum]++;
            }
        }
        for (int i = 0; i < m; i++){
            int sum = 0;
            for (int j = i; j < m; j++){
                sum += w[j];
                count_w[sum]++;
            }
        }
        int ans = 0;
        for (int i = 1; i < 1500010;i++)
            ans += count_h[i] * count_w[i];
        cout << ans << endl;
    }
}


Measured memory_bytes: 14772
def check():
    N = int(input())
    numList = list(map(int, input().split(" ")))
    numList.sort()
    
    if N % 2 != 0:
        print(0)
    else:
        print(numList[int(len(numList)/2)] - numList[int(len(numList)/2-1)])

check()

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

using pll = pair<long long, long long>;

int main() {
    int N; cin >> N;
    vector<pll> pos(N);
    for (int i = 0; i < N; ++i) cin >> pos[i].first >> pos[i].second;
    
    int par = (abs(pos[0].first) + abs(pos[0].second)) % 2;
    for (int i = 0; i < N; ++i) {
        int par2 = (abs(pos[i].first) + abs(pos[i].second)) % 2;
        if (par2 != par) {
            cout << -1 << endl;
            return 0;
        }
    }
    
    vector<long long> d;
    for (int i = 30; i >= 0; --i) d.push_back(1LL<<i);
    if (par % 2 == 0) d.push_back(1);
    cout << d.size() << endl;
    for (int j = 0; j < d.size(); ++j) cout << d[j] << " ";
    cout << endl;
        
    for (int i = 0; i < N; ++i) {
        long long xt = pos[i].first, yt = pos[i].second;
        long long x = 0, y = 0;
        for (int j = 0; j < (int)d.size(); ++j) {
            if (abs(x - xt) >= abs(y - yt)) {
                if (x >= xt) x -= d[j], cout << "L";
                else x += d[j], cout << "R";
            }
            else {
                if (y >= yt) y -= d[j], cout << "D";
                else y += d[j], cout << "U";
            }
        }
        cout << endl;
    }
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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

    ll N, K;
    cin >> N >> K;
    vector<ll> V(N);
    REP(i, N) cin >> V[i];

    ll ma = -1;
    REP(i, K+1){
    	REP(j, K+1){
    		//dump(i)
    		//dump(j)
    		if(i+j>K || i+j>N) continue;
    		ll res = 0;
    		ll nokori = K - i - j;
    		vector<ll> deteru;
    		REP(k, i){
    			deteru.push_back(V[k]);
    			//dump(V[k])
    			res += V[k];
    		}
    		REP(k, j){
    			deteru.push_back(V[N-1-k]);
    			//dump(V[N-1-k])
    			res += V[N-1-k];
    		}
    		sort(deteru.begin(), deteru.end());
    		REP(k, min(nokori, (ll)deteru.size())){
    			if(deteru[k] < 0)
    			res -= deteru[k];
    		}
    		//dump(res)
    		ma = max(res, ma);
    	}
    }
    cout << ma << endl;
    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 true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

long long n, k;

int main() {
    cin >> n >> k;
    long long ans = k;
    for(int i = 0; i < n-1; ++i) ans *= (k-1);
    cout << ans << endl;
}

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

int fac(int n){
  int num=1;
  for(int i=0;i<n;i++){
    num*=(i+1);
  }
  return num;
}

int main() {
  int N;
  cin >> N;
  vector<int> P(N);
  vector<int> Q(N);
  vector<int> A(N);
  int a,b;

  for(int i=0;i<N;i++){
    cin >> P.at(i);
    A.at(i)=i+1;
  }
  for(int i=0;i<N;i++){
    cin >> Q.at(i);
  }
  
  int count = 0;
  for(int i=0;i<fac(N);i++){
    bool p=true;
    bool q=true;
    for(int k=0;k<N-1;k++){
      if(P.at(k)!=A.at(k)){
        p=false;
      }
      if(Q.at(k)!=A.at(k)){
        q=false;
      }
    }
    if(p){
      a=i;
    }
    if(q){
      b=i;
    }
    next_permutation(begin(A),end(A));
  }
  
  cout << abs(a-b) << endl;


}



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

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

    vector<string> w;
    w.push_back(W);

    for(int i = 1; i < N; i++){
        cin >> W;
        w.push_back(W);
        for(int j = 0; j < i; j++){
            if(w[j] == w[i] || w[i-1].back() != w[i][0]){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
/**akshaykumar99**/
 
#include<bits/stdc++.h>
using namespace std;
 
#define f(i,x,n) for(i=x;i<n;i++)
#define pu push_back           
#define pp pop_back
#define mp(a,b) make_pair(a,b)
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define IOS() ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
const int MOD=1e9+7 ;
const long long INF=INT_MAX;
const long long LINF=LLONG_MAX;
const long long N=2e5+1;
 
typedef long long ll;
typedef long double ld;
typedef vector<ll> ivc;
typedef pair<ll,ll> ipr;
int main()
{
    IOS();
  
    ld n,x;
    cin>>n;
    x=ceil(n/2);
    x/=n;
    cout<<fixed<<setprecision(10)<<x;

    return 0;
}

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

int main() {
  ll h;
  cin >> h;
  ll ans=0;
  ll temp=1;
  while(h) {
    h>>=1;
    ans+=temp;
    temp*=2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
A = gets.chomp.split('')
N = A.length
length = 1
ls = Array.new(N) + [0]
hash = {}

(N - 1).downto(0) do |i|
    c = A[i]
    hash[c] = true
    if hash.length == 26
        length += 1
        hash = {}
    end
    ls[i] = length
end

hash = {}
ans = ''

skip = false
N.times do |i|
    if skip
        skip = false if A[i] == skip
        next
    end
    if ls[i] == ls[i+1]
        hash[A[i]] = true
    else
        c = ('a'..'z').select{|cc| !hash[cc]}.min
        ans += c
        hash = {}
        skip = c unless A[i] == c
    end
end

puts ans

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

typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// chmax, chmin
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;
}

void solve(long long N) {
  cout << N * N * N << endl;
}

int main() {
  long long N;
  scanf("%lld", &N);
  solve(N);
  return 0;
}


Measured memory_bytes: 256
using System;

public class hello
{
    public static void Main()
    {
        while (true)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var n = int.Parse(line[0]);
            var a = int.Parse(line[1]);
            var b = int.Parse(line[2]);
            if (n == 0 && a == 0 && b == 0) break;
            Console.WriteLine(goDP(n, a, b));
        }
    }
    static int goDP(int n, int a, int b)
    {
        var dp = new bool[n + 1];
        dp[0] = true;
        if (a < n + 1) dp[a] = true;
        if (b < n + 1) dp[b] = true;
        var ans = 0;
        for (int i = 1; i < n+1; i++)
            if (dp[i])
            {
                ans++;
                if (i + a <= n) dp[i + a] = true;
                if (i + b <= n) dp[i + b] = true;
            }
        return n - ans;
    }
}




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

int main() {
    int N, H, W;
    cin >> N >> H >> W;
    vector<int> x(N);
    for (int i = 0; i < N; ++i) cin >> x[i];

    vector<int> c(N * W, H);
    for (int i = 0; i < N; ++i) {
        int t = i * W;
        t += (i % 2 ? -x[i] : x[i]);
        for (int j = 0; j < W; ++j) c[t + j] = 0;
    }
    cout << accumulate(c.begin(), c.end(), 0) << endl;

    return 0;
}


Measured memory_bytes: 3140
#include<bits/stdc++.h>  
using namespace std;
#define ll long long
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
const int maxn = 1e9 + 5;
#define INF 100000000000
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;
const ll MAXN = 1e18;



int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio
	int n;
	cin >> n;
	bool ok = false;
	if(n%9==0 and n<=81)ok=true;
	else if(n%8==0 and n<=72)ok=true;
	else if(n%7==0 and n<=63)ok=true;
	else if(n%6==0 and n<=54)ok=true;
	else if(n%5==0 and n<=45)ok=true;
	else if(n%4==0 and n<=36)ok=true;
	else if(n%3==0 and n<=27)ok=true;
	else if(n%2==0 and n<=18)ok=true;
	else if(n==1)ok=true;
	if(ok){
		cout << "Yes\n";
	}else{
		cout << "No\n";
	}
	return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a, b, c;
	cin>>a>>b>>c;
	if(a<b){
		swap(a, b);
	}
	if(a<c){
		swap(a, c);
	}
	cout<<a*10+b+c<<'\n';;
	return 0;
}


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

int main()
{
  char c;
  cin >> c;
  char ans;
  if (c == 'A') {
    ans = 'T';
  } else if (c == 'T') {
    ans = 'A';
  } else if (c == 'C') {
    ans = 'G';
  } else {
    ans = 'C';
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using boost::multiprecision::cpp_int;

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

#define deg_to_rad(deg) (((deg)/360)*2*PI)

const ll LINF = LLONG_MAX;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;

const ld PI = (acos(-1));
const ld EPS = 0.0000000001;
// cout << fixed << setprecision(10) << middle << endl;

int main() {
    // input, ready
    int N;
    cin >> N;
    vector<int> p(1000001,0);
    for (int i=0; i<N; i++) {
        int j;
        cin >> j;
        p[j]++;;
    }

    // resolve
    int ans=0;
    for (int i=1; i<=1000000; i++) {
        if (p[i]) {
            if (p[i]==1) ans++;
            for (int j=i; j<=1000000; j+=i) p[j] = 0;
        }
    }

    // output
    cout << ans << endl;

    return 0;
}


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


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

    long long tmp = N;
    for (long long i = 1; i * i <= N; i++){
        if (N % i == 0) {
            if(i + (N / i) - 2 <= tmp)
                tmp = i + (N / i) - 2;
        }
    }

    cout << tmp << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <sstream>
#include <chrono>

using namespace std;

typedef long long ll;

#ifdef ONPC
    mt19937 rnd(228);
#else
    mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif

int main()
{
#ifdef ONPC
    freopen("a.in", "r", stdin);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    for (int i = 0; i < (int) s.size(); i++)
    {
        for (int j = i; j <= (int) s.size(); j++)
        {
            string cur = "";
            for (int x = 0; x < (int) s.size(); x++)
            {
                if (i <= x && x < j)
                {
                    continue;
                }
                cur += s[x];
            }
            if (cur == "keyence")
            {
                cout << "YES\n";
                return 0;
            }
        }
    }
    cout << "NO\n";
}


Measured memory_bytes: 256
W, H, N = map(int, input().split())
X = [0, 0, W, 0, H]
for k in range(N):
  x,y,a = map(int, input().split())
  if a == 1:
    X[a] = max(x,X[a])
  elif a == 2:
    X[a] = min(x,X[a])
  elif a == 3:
    X[a] = max(y,X[a])
  else:
    X[a] = min(y,X[a])
tate = X[4] - X[3]
yoko = X[2] - X[1]
ans = tate*yoko
if tate<0 or yoko<0:
  print(0)
else:
  print(ans)

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

using namespace std;

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

    vector<int> hps(n);
    for (int i = 0; i < n; ++i) {
        cin >> hps[i];
    }
    sort(hps.begin(), hps.end(), greater<int>());

    long long int atks = 0;
    for (int i = k; i < n; ++i) {
        atks += hps[i];
    }

    cout << atks << endl;

    return 0;
}


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

int main(){
  int n,m;
  cin >> n >> m;
  int P[111111];
  P[0] = 0;
  for(int i=1;i<n;i++){
    int a; cin >> a;
    P[i] = P[i-1] + a;
  }
  int ret = 0,now = 0;
  for(int i=0;i<m;i++){
    int d; cin >> d;
    ret += abs(P[now+d] - P[now]);
    now += d;
    ret = ret % 100000;
  }
  cout << ret << endl;
}

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


def main():
    n, k = map(int, input().split())
    *a, = map(int, input().split())

    asum = sum(a)
    divs = make_divisors(asum)
    ans = 1
    for d in divs:
        r = sorted([aa % d for aa in a])
        j = n - 1 - sum(r) // d
        if sum(r[:j+1]) <= k:
            ans = max(ans, d)
    print(ans)


main()


Measured memory_bytes: 3188
#include <stdio.h>
int main(){
  int N, i, j, k ;
  int num[100];
  while(1){ 
    int ch = 0;   
    scanf("%d",&N);
    if (N == 0)break;
    for( i = 0 ; i < N ; i++)
      scanf("%d",&num[i]);
    for(i = 0 ; i < N ; i++){
      for(j = N - 1 ; j >= i+1 ; j--){
	if(num[j] < num[j-1]){
	  ch++;
	  k = num[j];
	  num[j] = num[j-1];
	  num[j-1] = k;
	}
      }
    }
    printf("%d\n",ch);
  }
    
    return 0;
  }
  
  

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

int main()
{
	char b, a;
	cin >> b;
	if (b == 'A') a = 'T';
	else if (b == 'T') a = 'A';
	else if (b == 'C') a = 'G';
	else if (b == 'G') a = 'C';

	cout << a << endl;
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
using vl = vector<ll>;  // long longの1次元の型に vl という別名をつける
using vvl = vector<vl>; // long longの2次元の型に vvl という別名をつける
int MOD = 1000000007; //10^9 + 7

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; }

// 無限大の値
const ll  lINF = 1LL << 60;
const int iINF = 1 << 29;

int main(void){
  string w;
  cin >> w;
  vi cnt(26,0);

  for(int i=0; i < w.size(); i++){
    cnt[w[i]-'a']+=1;
  }
  rep(i,26){
    if(cnt[i]%2!=0){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
} 

Measured memory_bytes: 3620
#include<bits/stdc++.h>          
using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define int long long
#define mk_p(a,b)	make_pair((a),(b))
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr long long MOD = 1000000007;

int gcd(int a,int b){return b ? gcd(b,a%b) : a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a[3];
	cin >> a[1] >> a[0] >> a[2];
	sort(a,a+3);
	cout << a[2] * 10 + a[1] + a[0] << '\n';
	return 0;
}


Measured memory_bytes: 256
D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]

ans = 0

last = [0 for _ in range(26)]

for d in range(D):
  t = int(input())
  ans += s[d][t-1]
  last[t-1] = d+1
  for j in range(26):
    ans -= (d+1-last[j]) * c[j]
  print(ans)

Measured memory_bytes: 9256