akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String s = br.readLine();
		String[] array = s.split(" ");
		int a = Integer.parseInt(array[0]);
		int b = Integer.parseInt(array[1]);

		if (a == b) {
			System.out.println("Draw");
		} else if ((a > b || a == 1) && !(b == 1)) {
			System.out.print("Alice");
		} else if (b > a || b == 1) {
			System.out.println("Bob");
		}
	}
}


Measured memory_bytes: 25044
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define print(A,x,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i]x;}cout<<endl;
#define pprint(A,y,m,n) rep(j,0,m){print(A[j],y,n);}
const long mod=1e9+7;
const int size=1e5;
const int inf=1e9;
int main(){
	char C[2][3];
	rep(i,0,2)rep(j,0,3){
		cin>>C[i][j];
	}
	rep(i,0,3){
		if(C[0][i] != C[1][2-i]){
			cout<<"NO"<<endl;
			return 0;
		}
	}cout<<"YES"<<endl;
}

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

int main() {
  int n;
  cin >> n;
  if(n < 105)
    cout << 0;
  else if(n < 135)
    cout << 1;
  else if(n < 165)
    cout << 2;
  else if(n < 189)
    cout << 3;
  else if(n < 195)
    cout << 4;
  else
    cout << 5;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main(){
	var n int
	fmt.Scan(&n)
	
	a := make([]int, n)
	m := make(map[int]int, n)
	for i := range a {
		fmt.Scan(&a[i])
		m[a[i]]++
	}
	
	sum := 0
	for _, v := range m {
		sum += v * (v - 1) / 2
	}
	
	for i := range a {
		fmt.Println(sum - (m[a[i]] - 1))
	}
}

Measured memory_bytes: 14404
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, tmp;
  vector <int> v;
  set <int> s;
  cin >> n;

  for(int i = 0; i < n; i++){
    cin >> tmp;
    v.push_back(tmp);
    s.insert(tmp);
  }

  if(s.size() == v.size()){
    cout << "YES";
  }else{
    cout << "NO";
  }
}

Measured memory_bytes: 10356
/*Saurav Paul*/
#include<bits/stdc++.h>
#define endl '\n'
#define ll long long int
#define loop(i,a,b)           for(ll i=a;i<=b;++i)
#define boost		          ios_base::sync_with_stdio(0);
#define eb                    emplace_back
#define mp                    make_pair
#define clr(x)                x.clear()
#define MOD                   1e9+7
#define itoc(c)               ((char)(((int)'0')+c))
#define ctoi(c)               ((int)(((int)c)-'0'))
#define all(p)                p.begin(),p.end()
#define iscn(num)             scanf("%d",&num);
#define scn(num)              scanf("%lld",&num);
#define scn2(num,num2)        scanf("%lld%lld",&num,&num2);
using namespace std;


int main()
{
	int n,l,sum = 0;
	scanf("%d%d",&n,&l);
	vector <int > v(n);
	
	for(int i = 0  ; i < n; i++)
		v[i] = l+i,sum += v[i];
	
	
	int ans = sum;
	sort(all(v));
	for(int i = 0 ; i < n; i++){

		if(i==n-1)
			ans = sum-v[i];
		else if(v[i] >= 0){
			ans = sum-v[i];
			break;
		}
	}
	
	printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
k = int(input())

lunlun = [1, 2, 3, 4, 5, 6, 7, 8, 9]
for li in lunlun:
     if 10**10 < li:
         break
     lunlun.append(li * 10 + li % 10)
     if 0 <= li % 10 < 9:
         lunlun.append(li * 10 + li % 10 + 1)
     if 0 < li % 10 <= 9:
         lunlun.append(li * 10 + li % 10 - 1)
lunlun.sort()
print(lunlun[k - 1])

Measured memory_bytes: 76200
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>

using namespace std;

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

    int ans = 0;
    for(int i=0; i < 3; i++){
        if(s[i] == t[i]) ++ans;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fr(i,c,b) for(int i=c;i<b;i++)
#define frl(i,c,b) for(ll i=c;i<b;i++)
#define si(x) int x; scanf("%d", &x)
#define sll(x) ll x; scanf("%lld", &x)
#define pi(x) printf("%d", x)
#define pll(x) printf("%lld", x)
#define nl printf("\n")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define MAX 100001
#define M 1000000007
#define pb push_back

typedef long long int ll;

using namespace std;

int main()
{
    int n;
    cin>>n;
    int c=0;
    bool flag=false;
    for(int i=0;i<n;i++)
    {
        si(x); si(y);
        if(x==y)
            c++;
        if(c==3)
            flag=true;
        if(x!=y)
            c=0;
    }
    if(flag)    cout<<"Yes";
    else    cout<<"No";
}

Measured memory_bytes: 3760
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())
    A = list(map(int, readline().split()))

    ans = INF

    for x in A:
        cur = x
        score = 0
        while cur % 2 == 0:
            cur //= 2
            score += 1
        ans = min(ans, score)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 63020
#include<bits/stdc++.h>
using namespace std;
const int maxn=100100;
const int drx[4]={-1,-1,1,1};
const int dry[4]={-1,1,1,-1};
int Abs(int x){
	return x<0?-x:x;
}
struct node{
	int x,y,v;
}a[maxn];
int n,k;
int ans;
int sum[1010][1010][4];
void solve(){
	memset(sum,0,sizeof(sum));
	int x,y;
	int vx,vy;
	for(int i=1;i<=n;i++){
		x=(k-a[i].x%k);				//if psx<x c^=vx
		if(a[i].x%(k*2)>=k) vx=1;
		else vx=0;

		y=(k-a[i].y%k);				//if psy<y c^=vy
		if(a[i].y%(k*2)>=k) vy=1;
		else vy=0;
		if((vx^vy)==a[i].v){
			sum[x-1][y-1][0]++;
			sum[x][y][2]++;
		}
		else{
			sum[x-1][y][1]++;
			sum[x][y-1][3]++;
		}
	}
	for(int i=0;i<=k;i++){
		for(int j=1;j<=k;j++){
			sum[i][j][1]+=sum[i][j-1][1];
			sum[i][j][2]+=sum[i][j-1][2];
		}
		for(int j=k;j>=1;j--){
			sum[i][j-1][0]+=sum[i][j][0];
			sum[i][j-1][3]+=sum[i][j][3];
		}
	}
	for(int i=0;i<=k;i++){
		for(int j=1;j<=k;j++){
			sum[j][i][2]+=sum[j-1][i][2];
			sum[j][i][3]+=sum[j-1][i][3];
		}
		for(int j=k;j>=1;j--){
			sum[j-1][i][0]+=sum[j][i][0];
			sum[j-1][i][1]+=sum[j][i][1];
		}
	}
	int st;
	for(int i=0;i<k;i++){
		for(int j=0;j<k;j++){
			st=0;
			for(int s=0;s<4;s++)
				st+=sum[i][j][s];
			if(st>ans) ans=st;
		}
	}
}
int main(){

//	freopen("A.in","r",stdin);
	scanf("%d%d",&n,&k);
	static char str[10];
	for(int i=1;i<=n;i++){
		scanf("%d%d",&a[i].x,&a[i].y);
		scanf("%s",str);
		if(str[0]=='B') a[i].v=1;
		else a[i].v=0;
	}
	solve();
	for(int i=1;i<=n;i++)
		a[i].v^=1;
	solve();
	printf("%d\n",ans);
	return 0;
}


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

int main() {
	int n;
	cin>>n;
	int arr[n][3];
	int dp[n+1][3];
	for(int i=0;i<n;i++){
	    for(int j=0;j<3;j++){
	        cin>>arr[i][j];
	    }
	}

  dp[1][0]=arr[0][0];
  dp[1][1]=arr[0][1];
  dp[1][2]=arr[0][2];
	
	for(int i=2;i<=n;i++){
	    for(int j=0;j<=2;j++){
	        dp[i][0]=arr[i-1][0]+max(dp[i-1][1],dp[i-1][2]);
	        dp[i][1]=arr[i-1][1]+max(dp[i-1][0],dp[i-1][2]);
	        dp[i][2]=arr[i-1][2]+max(dp[i-1][0],dp[i-1][1]);
	    }
	}
	
	int max1=max(dp[n][0],dp[n][1]);
	int max2=max(max1,dp[n][2]);
	cout<<max2;
	
	return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <map>
#include <queue>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
#pragma warning (disable: 4996)

int N; bool flag = true;
string S[1 << 18];
map<string, int> Map;

int main() {
	cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> S[i];
		Map[S[i]]++;
		if (Map[S[i]] >= 2) flag = false;
	}
	for (int i = 2; i <= N; i++) {
		if (S[i - 1][S[i - 1].size() - 1] != S[i][0]) flag = false;
	}
	if (flag == true) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 2304
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    x,y = map(int, readline().split())

    a = 4 * x - y
    b = y - 2 * x

    if a % 2 == 0 and b % 2 == 0:
        if a >= 0 and b >= 0:
            print("Yes")
        else:
            print("No")
    else:
        print("No")


if __name__ == "__main__":
    main()


Measured memory_bytes: 9060
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <deque>
#include <queue>
#include <stack>
#include <numeric>
#include <cmath>
#include <map>
#include <set>
#define ull unsigned long long
#define ll long long
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    string t = "";
    int ans=1e9;
    for(int i=1;i<s.size()-1;i++){
        t+=s[i-1];
        t+=s[i];
        t+=s[i+1];
        ans=min(ans,abs(stoi(t)-753));
        t="";
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())

LM = 0
RM = N+1

for i in range(M):
  L, R = map(int, input().split())
  if L > LM:
    LM = L
  
  if R < RM:
    RM = R
if LM <= RM:
  print(N-(LM-1)-(N-RM))
else:
  print(0)

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

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

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

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

const string YES = "Yes";
const string NO = "No";

int main(){
    string s;
    cin >> s;
    bool ans = false;
    if (s.find("7") != string::npos) ans = true;
    cout << (ans?YES:NO) << endl;
    return 0;
}


Measured memory_bytes: 3596
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main (void)
{
 long long N, tmp;
 cin >> N;
 tmp = N;
 vector <char> p;
 p.resize (1);
 int n = 0;
 for ( ; tmp > 0; n++)
 {
	tmp--;
	p [n] = ((char)'a') + (int)(tmp%26);
	p.resize (n + 2);
	tmp /= 26;
 }
 for (int i = 0; i < n; i++)
 {
	cout << p [n-1-i];
 }
 
 return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include<algorithm>
#include<sstream>
#include<iomanip>


using namespace std;


int main() {
	int h, w;
	cin >> h >> w;
	int max = 0;
	vector<string> maze(h);
	for (int i = 0; i < h; i++) {
		cin >> maze[i];
	}

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (maze[i][j] == '#') {
				continue;
			}
			else {
				vector<vector<int>> cnt(h, vector<int>(w, 1000));
				queue<pair<int, int>> q;
				q.push(make_pair(i, j));
				cnt[i][j] = 0;
				while (!q.empty()) {
					int x = q.front().first;
					int y = q.front().second;
					q.pop();
					if (x > 0) {
						
						if (cnt[x - 1][y] > cnt[x][y] + 1 && maze[x-1][y] !='#') {
							cnt[x - 1][y] = cnt[x][y] + 1;
							q.push(make_pair(x - 1, y));
						}
 					}
					if (x < h-1) {

						if (cnt[x + 1][y] > cnt[x][y] + 1 && maze[x + 1][y] != '#') {
							cnt[x + 1][y] = cnt[x][y] + 1;
							q.push(make_pair(x + 1, y));
						}
					}
					if (y > 0) {

						if (cnt[x][y-1] > cnt[x][y] + 1 && maze[x][y-1] != '#') {
							cnt[x ][y-1] = cnt[x][y] + 1;
							q.push(make_pair(x , y-1));
						}
					}
					if (y < w-1) {

						if (cnt[x][y+1] > cnt[x][y] + 1 && maze[x][y+1] != '#') {
							cnt[x][y+1] = cnt[x][y] + 1;
							q.push(make_pair(x , y+1));
						}
					}


				}

				for (int x = 0; x < h; x++) {
					for (int y = 0; y < w; y++) {
						if (cnt[x][y] != 1000 && max < cnt[x][y]) {
							max = cnt[x][y];
						}
					}
				}

			}


			
		}
	}

	std::cout << max << endl;
}

Measured memory_bytes: 256
K=int(input())

L=9*K//7 if K%7==0 else 9*K

if L%2==0 or L%5==0:
    print('-1')

else:
    surplus=1
    for i in range(1,L):
        surplus=(surplus*10)%L
        if surplus==1:
            print(i)
            break

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main() {
  int n ;
  cin >> n ;
  map<string ,int> data;
  rep(i,n){
    string s ;
    cin >> s ;
    data[s] ++;
  }
  
  int m;
  cin >> m;
  rep(i,m){
    string s ;
    cin >> s ;
    data[s]--;
  }
  
  int  ans = 0;
  for(auto p : data){
    auto k = p.second;
    if( k>0) {
      ans = max(ans, k);
    }
  }
  
  cout << ans ;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int N, T;
int min_cost = 1001;
int main()
{
  cin >> N >> T;
  int c[N], t[N];
  for (int i = 0; i < N; i++) {
    cin >> c[i] >> t[i];
    if ((t[i] <= T) && (min_cost > c[i])) {
      min_cost = c[i];
    }
  }
  if (min_cost ==1001) 
    cout << "TLE" << endl;
  else
    cout << min_cost << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bitset>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <algorithm>

using namespace std;

int main()
{
	long long n, m, x=-1, y=-1, z=-1;
	bool flag = false;
	cin >> n >> m;

	for (long long i = 0; i <= n; i++)
	{
		for (long long j = 0; j <= n; j++)
		{
			long long k = n - i - j;

			if (k < 0)
				continue;

			if (i * 10000 + j * 5000 + k * 1000 == m)
				if (i + j + k == n)
				{
					x = i;
					y = j;
					z = k;
					flag = true;
					break;
				}

		}
	}

	cout << x << " " << y << " " << z << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>

using namespace std;

const int N = 100;

int n[N];
struct number {
	int cs;
	int value;
}num[N];

int cmp(const void *a, const void *b) {
	return *(int *)a - *(int *)b;
}

int cmp1(const void *a, const void *b) {
	number *c = (number *)a;
	number *d = (number *)b;
	if (c->cs != d->cs) return d->cs - c->cs;
	return c->value - d->value;
}

int main() {
	int k = 0, i = 0, maxs = -1;
	while (scanf("%d", &n[i++]) != EOF);//注意，i&#20540;比&#36755;入的整数个数大1 
	qsort(n, --i, sizeof(int), cmp);//i&#20540;要&#20943;一 
	num[k].cs = 1;
	num[k].value = n[0];
	for (int j=1; j<i; ++j) {//&#32479;&#35745;&#27599;个数出&#29616;的个数，并保存&#35813;数及其个数 
		if (num[k].value == n[j]) ++num[k].cs;
		else {
			if (num[k].cs > maxs) maxs = num[k].cs;
			++k;
			num[k].cs = 1;
			num[k].value = n[j];
		}
	}
	if (num[k].cs > maxs) maxs = num[k].cs;
	qsort(num, k+1, sizeof(number), cmp1);
	for (int j=0; j<=k; ++j) {//&#36755;出答案 
		if (num[j].cs == maxs) printf ("%d\n", num[j].value);
		else break;
	}
	return 0;
}

Measured memory_bytes: 0
# coding: utf-8
import sys
sys.setrecursionlimit(1000000)
N,M,K=map(int,input().split())
MOD=998244353

MAX_N=N+10

#a**n mod p を再帰的に求める
def modPow(a,n,p):
    if n==0:
        return 1
    if n == 1:
        #n=1ならaを返す
        return a % p

    elif n % 2 == 1:
        #nが奇数ならば a * modPow(a,n-1(偶数),p)を返す
        return a * modPow(a,n-1,p) % p

    else:
        #nが偶数なら modPow(a,n//2,p) * modPow(a,n//2,p)とすると速い
        t = modPow(a,n//2,p)
        return t * t % p

fac=[None for i in range(MAX_N)]
finv=[None for i in range(MAX_N)]
inv=[None for i in range(MAX_N)]

def COMinit(num):
    global fac
    global finv
    global inv
    fac[0]=1
    fac[1]=1
    finv[0]=1
    finv[1]=1
    inv[1]=1

    for i in range(2,num):
        fac[i] = fac[i-1] * i % MOD
        inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
        finv[i] = finv[i-1] * inv[i] % MOD

def COM(n,k):
    if n<k:
        return 0
    elif n<0 or k<0:
        return 0
    else:
        return int(fac[n] * (finv[k] * finv[n - k] % MOD) % MOD)


COMinit(MAX_N)

ans=0

for i in range(K+1):
    v=COM(N-1,N-1-K+i)%MOD
    v*=M
    v=v%MOD
    v*=modPow(M-1,N-1-K+i,MOD)
    v=v%MOD
    ans+=v
    ans=ans%MOD
print(ans)

Measured memory_bytes: 32628
N = int(input())
Xinput = input().split()


X = [int(s) for s in Xinput]

Xmean = sum(X) / N
Xmean = round(Xmean)

Xout = [(x - Xmean) * (x - Xmean) for x in X]

print(sum(Xout))

Measured memory_bytes: 3188
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
int main(){
  ll n,k;
  cin>>n>>k;
  vll a(n);
  rep(i,n) cin>>a[i];
  vll b(0);
  rep(i,n){
    ll cu=0;
    for(int j=i;j<n;j++){
      cu+=a[j];
      b.pb(cu);
    }
  }
  ll cu=modpow(2,40,INF);
  ll ans=0;
  rep(i,41){
    ll kk=0;
    rep(j,sz(b)){
      if(((cu+ans)&b[j])==cu+ans)kk++;
    }
    if(kk>=k) ans+=cu;
    cu/=2;
  }
  COUT(ans);
}


Measured memory_bytes: 6388
#include <bits/stdc++.h>
#define long long long int
using namespace std;

// @author: pashka

int mod = 998244353;

struct mint {
    int value;
    constexpr mint() : value() {}
    mint(const long &x) {
        value = normalize(x);
    }
    static long normalize(const long &x) {
        long v = x % mod;
        if (v < 0) v += mod;
        return v;
    }
    bool operator==(const mint &x) { return value == x.value; };
    mint operator+(const mint &x) { return value + x.value; };
    mint operator*(const mint &x) { return (long)value * x.value; };
    void operator+=(const mint &x) { value = normalize(value + x.value);};
};

mint d[301][301][301];
mint w[301][301][301];

int main() {
    ios::sync_with_stdio(false);

    string s;
    int k;
    cin >> s >> k;
    int n = s.size();
    k = min(k, n);
    d[0][0][0] = 1;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j <= n; j++) {
            for (int t = 0; t <= k; t++) {
                if (d[i][j][t] == 0 && w[i][j][t] == 0) continue;
//                cout << i << " " << j << " " << t << " " << d[i][j][t].value << "\n";
                if (s[i] == '1') {
                    d[i + 1][j][t] += d[i][j][t];
                    if (j > 0) {
                        w[i + 1][j - 1][t] += d[i][j][t] + w[i][j][t];
                    }
                } else {
                    if (j < k && t < k) {
                        d[i][j + 1][t + 1] += d[i][j][t];
                    }
                    d[i + 1][j][t] += d[i][j][t] + w[i][j][t];
                }
            }
        }
    }
    mint res = 0;
    for (int t = 0; t <= k; t++) {
        res += d[n][0][t];
        res += w[n][0][t];
    }
    cout << res.value << "\n";

    return 0;
}

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

int main () {
    int c[3][3];
    rep(i, 3) {
        rep(j, 3) cin >> c[i][j];
    }
    int p = c[0][0] - c[0][1];
    int q = c[0][1] - c[0][2];
    int r = c[0][0] - c[1][0];
    int s = c[1][0] - c[2][0];
    rep(i, 3) {
        if (c[i][0] - c[i][1] != p) {
            cout << "No" << endl;
            return 0;
        }
        if (c[i][1] - c[i][2] != q) {
            cout << "No" << endl;
            return 0;
        }
        if (c[0][i] - c[1][i] != r) {
            cout << "No" << endl;
            return 0;
        }
        if (c[1][i] - c[2][i] != s) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;  
}

Measured memory_bytes: 256
import math
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
mod = 10**9 + 7 
sys.setrecursionlimit(1000010)

s = []
N = int(input())
A=[]
Rules=[]

def check():
    for i in range(len(Rules)):
        if s[i] != True:
            continue
        r = Rules[i]
        for rr in r:
            (x,y) = rr
            if y == 1:
                if s[x -1 ] == False:
                    return False
            else:
                if s[x-1] == True:
                    return False
            # print(rr)
    return True

for _ in range(N):
    a = ni()
    A.append(a)
    r = []
    for _ in range(a):
        rr = nl()
        r.append(rr)
    Rules.append(r)

# print(A,Rules)

l = 2 **N 
maxgood = 0
for i in range(1,l ):
    s=[]
    ix = i 
    good = 0
    for _ in range(N):
        if ix %2 != 0:
            good += 1
        s.append(ix%2 !=0 )
        ix = ix //2
    # print(good,s)
    if good > maxgood:
        if check():
            maxgood = good
print(maxgood)


Measured memory_bytes: 49372
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <functional>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define SQ(x) ((x)*(x))
#define Mod(x, mod) (((x)+(mod)%(mod))
#define MP make_pair
#define PB push_back
#define Fi first
#define Se second
#define INF (1LL<<60)
#define EPS 1e-10
#define MOD 1000000007
typedef long long ll;
typedef pair<ll, ll> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;


ll N, M;
vector<ll>G[100005];

vector<ll> dijkstra(ll s)
{
  vector<ll>d(N, INF);

  priority_queue<pi, vector<pi>, greater<pi> >Q;
  Q.push(pi(0, s));
  d[s] = 0;
  while(!Q.empty()){
    pi p = Q.top(); Q.pop();
    ll n = p.second;
    if(d[n] < p.first) continue;
    for(auto g:G[n]){
      if(d[g] > d[n] + 1){
	Q.push(pi(d[n]+1, g));
	d[g] = d[n] + 1;
      }
    }
  }
  return d;
}

int main()
{
  ll s, t;
  scanf("%lld%lld%lld%lld", &N, &M, &s, &t); s--; t--;
  rep(i, M){
    ll x, y; scanf("%lld%lld", &x, &y); x--; y--;
    G[x].push_back(y);
    G[y].push_back(x);
  }

  vector<ll>S = dijkstra(s);
  vector<ll>T = dijkstra(t);
  map<ll, ll>dist1;
  multiset<ll>dist2;
  for(auto x: S){
    if(dist1.count(x)) dist1[x] = dist1[x] + 1;
    else dist1[x] = 1;
  }
  for(auto x: T) dist2.insert(x);

  ll d = S[t];
  ll res = 0;
  for(auto x: dist1){
    //    cout << x << " " << d - x - 2 << " " << dist.count(d-x-2) << endl;
    res += x.second*dist2.count(d - x.first - 2);
  }
  printf("%lld\n", res);
  return 0;
}

Measured memory_bytes: 16228
#include<stdio.h>
int num[51];
int main()
{
    int n,m;
    int a,b;
    scanf("%d %d",&n,&m);
    int i;
    for(i=1;i<=n;i++)
        num[i]=0;
    for(i=1;i<=m;i++)
    {
        scanf("%d%d",&a,&b);
        num[a]++;
        num[b]++;
    }
    for(i=1;i<=n;i++)
    {
        printf("%d\n",num[i]);
    }
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <algorithm>
#include <vector>
#include <iostream>
#include <string>
using namespace std;
 
int main() {
  //input
  string s; cin >> s;
  int n;
  n = s.size();
  int counter = 0;
  
  //compute
  for(int i = 0;i < n-1; i++) {
         if(s.at(i) != s.at(i+1)){
           counter += 1;
         }
  }
 
  //output
  cout << counter << endl;
  
}

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

int main(){
  int a, b, x;
  cin >> x >> a >> b;
  if(abs(a - x) < abs(b - x)){
    cout << 'A' << endl;
  } else {
    cout << 'B' << endl;
  }
  return 0;
}

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

int main(){
  int a,b;
  cin >> a >> b;

  int ans[10001],a_008[10001],b_01[10001];
  for(int i = 0;i < 10001;i++){
    ans[i] = i;
    a_008[i] = (int)(ans[i] * 0.08);
    b_01[i] = (int)(ans[i] * 0.1);
  }
  int count = 0;
  for(int i = 0;i < 10001;i++){
    if(b_01[i] == b && a_008[i] == a){
      cout << ans[i] << endl;
      return 0;
    }else{
      if(b_01[i] > b || a_008[i] > a){
	cout << "-1" << endl;
	return 0;
      }
    }
  }
}


Measured memory_bytes: 384
def s():
	n, l, *a = map(int, open(0).read().split())
	for i, (x, y) in enumerate(zip(a, a[1:])):
		if x + y >= l:
			print("Possible")
			r = list(range(n))
			print("\n".join(map(str, r[1:i + 1] + r[n:i:-1])))
			break
	else:
		print("Impossible")
if __name__=="__main__":
	s()

Measured memory_bytes: 19660
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    N = int(readline())
    A = [int(i) for i in readline().split()]
    A.sort(reverse=True)

    ans = 0
    for i in range(1, N):
        ans += A[i // 2]
    
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 31448
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
signed main(){
  int N;
  cin>>N;
  string ans="No";
  rep(i,0,N/4+1){
    if((N-i*4)%7==0){
      ans="Yes";
      break;
      }
    }
  cout<<ans;
  }


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

#define fi first
#define se second
#define be begin
#define en end
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ALL(a) (a).be() , (a).en()

template<typename T> using V = vector< T >;
using Vi = V<int>;

template<typename T1,typename T2> using P = pair< T1, T2 >;
using Pii = P<int,int>;

int main(){
    int n;
    cin>>n;
    V<Pii> a;
    for(int i=0; i<n; i++){
        int tmp;
        cin>>tmp;
        a.pb(mp(tmp,i+1));
    }

    sort(ALL(a));

    for(int i=0; i<n; i++){
        cout<<a[i].se<<" ";
    }
    cout<<endl;

    return 0;
}

Measured memory_bytes: 1780
h,w,k = list(map(int,input().split()))
check = k
hw = [""]*h
for i in range(h):
	hw[i] = input()

ans = 0
for i in range(0,2**h):
	for j in range(0,2**w):
		iro = [[0]*w for i in range(h)]
		# 縦
		for v in range(h):
			if (i & (1 <<v)) != 0:
				for k in range(w):
					iro[v][k] = 1
		# 横
		for v in range(w):
			if (j & (1 <<v)) != 0:
				for k in range(h):
					iro[k][v] = 1
		count = 0
		
		for k in range(h):
			for l in range(w):
				if iro[k][l] == 0 and hw[k][l] == '#':
					count += 1

		if count == check:
			ans += 1
print(ans)

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

#define whole(f, x, ...)                                 \
  ([&](decltype((x)) whole) {                            \
    return (f)(begin(whole), end(whole), ##__VA_ARGS__); \
  })(x)

using namespace std;
using ll = long long;

void solve() {
  string s1, s2;
  cin >> s1 >> s2;
  int cnt = 0;
  for (int i = 0; i < 3; i++) {
    if (s1[i] == s2[i]) {
      ++cnt;
    }
  }
  cout << cnt << endl;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);

  solve();
  return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10000000)
import numpy as np
from heapq import heapify, heappop, heappush
import copy
from math import gcd, ceil
from collections import deque
# queueとして使う場合 push, popleftを使う
from bisect import bisect_left, bisect_right
# bisect_left: 配列の順序関係が崩れない条件で挿入することができる一番左の点
# bisect_right: 配列の順序関係が崩れない条件で挿入することができる一番右の点
# A = [1, 1, 1, 2, 2, 2, 4]
# print(bisect_left(A, 2))  # 3
# print(bisect_right(A, 2))  # 6
# print(bisect_left(A, 3))  # 6
# print(bisect_right(A, 3))  # 6


def main():
    S = input()
    if len(S) == 1 and S == '?':
        print('D')
        sys.exit()
    i = 0
    S = list(S)
    while i < len(S):
        if S[i] == '?':
            if i == 0:
                if S[1] == '?':
                    S[0] = 'P'
                    S[1] = 'D'
                    i = 2
                    continue
                elif S[1] == 'D':
                    S[0] = 'P'
                    i = 2
                    continue
                else:
                    S[0] = 'D'
                    i = 2
                    continue
            else:
                if i + 1 == len(S):
                    S[i] = 'D'
                    i += 1
                    continue
                elif S[i - 1] == 'P':
                    S[i] = 'D'
                    i += 1
                    continue
                elif S[i + 1] == '?':
                    S[i] = 'P'
                    S[i + 1] = 'D'
                    i = i + 2
                    continue
                elif S[i + 1] == 'D':
                    S[i] = 'P'
                    i += 1
                    continue
                else:
                    S[i] = 'D'
                    i += 1
        else:
            i += 1
    print(''.join(S))
            

if __name__ == '__main__':
    main()


Measured memory_bytes: 28856
#include<bits/stdc++.h>
using namespace std;
long long a,b,c;
int main() {
    cin>>a>>b>>c;
    if(a%2==0 || b%2==0 || c%2==0)
        return cout<<0<<endl,0;
    cout<<min(min(a*b,a*c),b*c)<<endl;
    return 0;
}

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    N = int(input())
    AtoE = [int(input()) for _ in range(5)]

    min_i = 0
    min_v = AtoE[min_i]
    for i, v in enumerate(AtoE):
        if min_v > v:
            min_i = i
            min_v = v
    
    ans = 0
    for i, v in enumerate(AtoE):
        if min_i == i:
            ans += (N + v - 1 ) // v
        else:
            ans += (min_v + v - 1) // v
    print(ans)

if __name__ == '__main__':
    main()


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

int H, W;
vector<vector<int>> L;
vector<vector<int>> R;
vector<vector<int>> U;
vector<vector<int>> D;

int main()
{
	int h, w;
	cin >> h >> w;
	vector<string> s(h);
	for (int i = 0; i < h; i++) {
		cin >> s.at(i);
	}

	H = h;
	W = w;
	L = vector<vector<int>>(H);
	R = vector<vector<int>>(H);
	U = vector<vector<int>>(W);
	D = vector<vector<int>>(W);

	for (int i = 0; i < h; i++) {
		vector<int> temp(w);
		for (int j = 0; j < w; j++) {
			int num = 0;
			if (j == 0 || s.at(i)[j] == '#') {
				num = 0;
			} else if(s.at(i)[j - 1] == '#'){
				num = 0;
			} else {
				num = temp.at(j - 1) + 1;
			}
			temp.at(j) = num;
		}
		L.at(i) = temp;
	}
	for (int i = 0; i < h; i++) {
		vector<int> temp(w);
		for (int j = w - 1; j >= 0; j--) {
			int num = 0;
			if (j == w - 1 || s.at(i)[j] == '#') {
				num = 0;
			} else if (s.at(i)[j + 1] == '#') {
				num = 0;
			} else {
				num = temp.at(j + 1) + 1;
			}
			temp.at(j) = num;
		}
		R.at(i) = temp;
	}
	for (int i = 0; i < w; i++) {
		vector<int> temp(h);
		for (int j = 0; j < h; j++) {
			int num = 0;
			if (j == 0 || s.at(j)[i] == '#') {
				num = 0;
			} else if (s.at(j - 1)[i] == '#') {
				num = 0;
			} else {
				num = temp.at(j - 1) + 1;
			}
			temp.at(j) = num;
		}
		U.at(i) = temp;
	}
	for (int i = 0; i < w; i++) {
		vector<int> temp(h);
		for (int j = h - 1; j >= 0; j--) {
			int num = 0;
			if (j == h - 1 || s.at(j)[i] == '#') {
				num = 0;
			} else if (s.at(j + 1)[i] == '#') {
				num = 0;
			} else {
				num = temp.at(j + 1) + 1;
			}
			temp.at(j) = num;
		}
		D.at(i) = temp;
	}

	int ans = 0;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			ans = max(ans, L.at(i).at(j) + R.at(i).at(j) + U.at(j).at(i) + D.at(j).at(i) + 1);
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 67200
from collections import Counter

N = int(input())
list_s = []
for i in range(N):
    S = input()
    list_s.append(S)

D = Counter(list_s)

print("AC x " + str(D["AC"]))
print("WA x " + str(D["WA"]))
print("TLE x " + str(D["TLE"]))
print("RE x " + str(D["RE"]))


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

typedef long long ll;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define ANS(n) cout << (n) << endl

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

#define ALL(obj) (obj).begin(),(obj).end()

#define pii pair<int,int>

#define pb(a) push_back(a)
#define mp make_pair

int main()
{
	ll n,a[5];
	cin >> n;
	ll ans = 5;
	ll m = LLINF;
	FOR(i,0,5){
		cin >> a[i];
		m = min(m, a[i]);
	}
	ans += (n + m - 1) / m - 1;
	ANS(ans);
	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()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

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


Measured memory_bytes: 256
N=io.read("n")
x={}
u={}
local total=0
for i=1,N do
  x[i]=io.read("n")
  u[i]=io.read():match("%a+")
  if u[i]=="BTC" then
    x[i]=380000*x[i]
  end
  total=total+x[i]
end
print(total)


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		long K = sc.nextLong();
		long A[]=  new long[N];
		long B[] = new long[M];
		long sumA[] = new long[N];
		long sumB[] = new long[M];
		for (int i=0;i<N;i++) {
			A[i] = sc.nextLong();
			if (i>0) {
				sumA[i] =A[i]+sumA[i-1];
			} else {
				sumA[i] =A[i];
			}
		}
		for (int i=0;i<M;i++) {
			B[i] = sc.nextLong();
			if (i>0) {
				sumB[i] =B[i]+sumB[i-1];
			} else {
				sumB[i] =B[i];
			}
		}
		int nowj=M-1;
		while (nowj>=0&&sumB[nowj]>K) {
			nowj--;
		}
		int maxi =N-1;
		while (maxi>=0&&sumA[maxi]>K) {
			maxi--;
		}
		int count =Math.max(nowj+1, maxi+1);
		for (int i=0;i<=maxi;i++) {
			while (nowj>=0&&sumA[i]+sumB[nowj]>K) {
				nowj--;
			}
			if (nowj+2+i>count) {
				count = nowj+2+i;
			}
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 67352
#include<iostream>
#include<cstdio>
#include<string>
#include<ctime>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<stack>
#include<climits>
#include<queue>
#include<map>
#include<set>
#include<sstream>
using namespace std;
typedef long long ll;   
typedef unsigned long long ull;
const int MAXN=2000;
inline long long read()//inline 加速读入
{
	long long x=0;char c=getchar();//x代表返回值，c代表读取的字符
	while (c<'0'||c>'9') c=getchar();//读取所有非数部分
	while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();//如果读取的字符为数，加入返回值
	return x;
}
ll n,k,t,aa[MAXN+10][MAXN+10];
struct hh{
	ll x;
	int y;
}a[MAXN+10];
int cmp(hh a,hh y)
{
	return a.x>y.x;
}
ll run(int l,int r){
	if(l>r)return 0;
	if(aa[l][r])return aa[l][r];
	int i=n-(r-l);
	return aa[l][r]=max(run(l,r-1)+a[i].x*abs(r-a[i].y),run(l+1,r)+a[i].x*abs(a[i].y-l)) ; 
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++){
		a[i].x=read();a[i].y=i;
	}
	sort(a+1,a+n+1,cmp);
	run(1,n);
	cout<<aa[1][n]<<endl;
} 

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

int main(){
  int N,L;
  cin >> N >> L;
  int x[N];
  int sum=0;
  for(int i=0;i<N;i++){
    sum += L+(i+1)-1;
  }
  
  int min = L+1-1;
  int max = L+N-1;
  
  if(max<0){
    cout << sum-max;
  }else if(min<=0 && 0<=max){
    cout << sum;
  }else{
    cout << sum-min;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define dl double long
#define rep(i, m, n) for(ll i = (ll)(m); i < (ll)(n); ++i)
#define rrep(i, m, n) for(ll i = (ll)(m); i > (ll)(n); --i)
const ll MOD = 1000000007;
const double pi = 3.14159265358979323846;

struct Q{
    int a, b, c, d;
} qset[50];

int  m, q, maxp;
vector<int> now;

void check(){
    int point = 0;
    rep(i, 0, q){
        if(now[qset[i].b - 1] - now[qset[i].a - 1] == qset[i].c) point += qset[i].d;
    }
    maxp = max(maxp, point);
    return;
}

void rec(int n, int num){
    if(n == 0) {
        check();
        return;
    }
    rep(i, num, m+1){
        now.push_back(i);
        rec(n-1, i);
        now.pop_back();
    }
    return;
}
int main(void){
    int n;
    cin >> n >> m >> q;
    rep(i, 0, q)cin >> qset[i].a >> qset[i].b >> qset[i].c >> qset[i].d;
    rec(n, 1);
    cout << maxp << endl;
    return 0;
}

Measured memory_bytes: 3628
// https://atcoder.jp/contests/abc144/tasks/abc144_b

#include "algorithm"
#include "iostream"
#include "queue"
#include "set"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
using namespace std;
typedef long long ll;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

void solve() {
  ll N;
  cin >> N;

  repf(i, 1, 10) repf(j, 1, 10) {
    if (N == i * j) {
      cout << "Yes" << endl;
      return;
    }
  }

  cout << "No" << endl;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

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


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <numeric>
#include <climits>
#define ll long long
#define LIM 1000
using namespace std;
int main() {
  int w, a, b;
  cin >> w >> a >> b;
  cout << max(max(0, b - a - w), max(0, a - b - w)) << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e7+3;
int n,cnt,tot,sum1,sum2;
int head[maxn],fa[maxn],siz[maxn];

struct EDGE{
    int next;
    int to;
};
EDGE edge[maxn];

void add(int u,int v)
{
    edge[++cnt].next=head[u];
    edge[cnt].to=v;
    head[u]=cnt;
}

void dfs(int u,int f)
{
    int i,v;
    fa[u]=f;
    siz[u]=1;
    for(int i=head[u];~i;i=edge[i].next)
    {
        v=edge[i].to;
        if(v!=f)
        {
            dfs(v,u);
            siz[u]+=siz[v];
        }
    }
}

int main()
{
    memset(head,-1,sizeof(head));
    int i,x,y;
	scanf("%d",&n);
	for(i=1;i<n;i++)
	{
		scanf("%d%d",&x,&y);
		add(x,y);
		add(y,x);
	}
	dfs(1,0);
	//printf("1\n");
	i=n;
	tot=0;
	while(fa[i]!=1)i=fa[i],tot++;
	x=n;
	for(int i=1;i<=tot/2;i++)
        x=fa[x];
    y=x;
    if(y==n)
    {
        sum1=siz[y];
        sum2=n-sum1;
        if(sum2>sum1)
        cout<<"Fennec";
	else cout<<"Snuke";
            return 0;
    }
    y=fa[y];
	dfs(n,0);
	sum1=siz[y];
	sum2=n-sum1;
	if(sum1>sum2)cout<<"Fennec";
	else cout<<"Snuke";

}


Measured memory_bytes: 50304
#pragma warning(disable:4786)
#pragma warning(disable:4996)
#include<list>
#include<bitset>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<functional>
#include<string>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<utility>
#include<fstream>
#include<sstream>
#include<cmath>
#include<stack>
#include<assert.h>
using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))
#define CLR(a) memset(a, 0, sizeof(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) )
#define S(X) ( (X) * (X) )
#define SZ(V) (int )V.size()
#define FORN(i, n) for(i = 0; i < n; i++)
#define FORAB(i, a, b) for(i = a; i <= b; i++)
#define ALL(V) V.begin(), V.end()
#define IN(A, B, C)  ((B) <= (A) && (A) <= (C))

typedef pair<int,int> PII;
typedef pair<double, double> PDD;
typedef vector<int> VI;
typedef vector<PII > VP;

#define AIN(A, B, C) assert(IN(A, B, C))

//typedef int LL;
//typedef long long int LL;
//typedef __int64 LL;

char S[100005];

int main()
{
	scanf("%s", S);
	int rock = 0;
	int paper = 0;
	int score = 0;

	for (int i = 0; S[i]; i++) {
		if (S[i] == 'g') // rock 
		{
			if (paper + 1 <= rock) {
				paper++;
				score++;
			}
			else {
				rock++;
			}
		}
		else { // paper
			if (paper + 1 <= rock) {
				paper++;
			}
			else {
				rock++;
				score--;
			}
		}

	}

	printf("%d\n", score);
	return 0;
}


Measured memory_bytes: 384
fn main() {
    proconio::input! {
        a: f64,
        b: f64,
        h: f64,
        m: f64,
    }
    let ar = (-1_f64).acos() * (60.0 * h + m) / 360.0;
    let br = (-1_f64).acos() * m / 30.0;
    let x = a * ar.cos() - b * br.cos();
    let y = a * ar.sin() - b * br.sin();
    println!("{:.20}", (x * x + y * y).sqrt());
}


Measured memory_bytes: 2840
/* AtCoder Grand Contest 041. Task .A */
#include <bits/stdc++.h>

using namespace std;

#define COUT_PRECISION 10

namespace abreto {

typedef long long int ll;

ll N, A, B;

void main(void) {
    ll ans = 0x3f3f3f3f3f3f3f3f;
    cin >> N >> A >> B;
    ll diff = B - A;
    if (0 == (diff & 1ll)) {
        ans = diff >> 1;
    } else {
        diff = (diff - 1) >> 1;
        ans = min(A, N - B + 1) + diff;
    }
    cout << ans << '\n';
}

}

int main(void) {
    cin.sync_with_stdio(false); cin.tie(0);
    cout << fixed << setprecision(COUT_PRECISION);
    abreto::main();
    return 0;
}


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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

template<typename T>
constexpr T inf = static_cast<T>(pow(10, static_cast<int>(log10(numeric_limits<T>::max())))) + 7;
constexpr llong mod = 1e9+7;

int main() {
  llong A, B, M;
  vector<llong> a, b;

  cin >> A >> B >> M;
  a.resize(A);
  b.resize(B);
  for (auto &in: a) {
    cin >> in;
  }
  for (auto &in: b) {
    cin >> in;
  }

  llong ans = inf<llong>;
  for (llong x, y, c, i = 0; i < M; ++i) {
    cin >> x >> y >> c;
    ans = min(ans, a[x - 1] + b[y - 1] - c);
  }

  sort(ALL(a));
  sort(ALL(b));
  ans = min(ans, a[0] + b[0]);
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
inline ll read(){
	ll res=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-f;ch=getchar();}
	while(ch>='0'&&ch<='9'){res=(res<<3)+(res<<1)+ch-'0';ch=getchar();}
	return res*f;
}
void write(ll x){
	if(x<0) putchar('-'),x=-x;
	if(x>9) write(x/10);
	putchar(x%10|'0');
}
char a[1005];

signed main(){
	cin>>(a+1);
	int len=strlen(a+1);
	int h=0;
	for(int i=1;i<=len;i++){
		if(a[i]=='C') h=1;
		if(h==1&&a[i]=='F') {
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include "math.h"
#include <algorithm>
#include <complex>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <unordered_map>
#include <vector>
#define ifor(i, a, b) for (int i = (a); i < (b); i++)
#define rfor(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
using namespace std;
typedef long double ld;
typedef long long int lli;
const double eps = 1e-11;
int vex[4] = {1, 0, -1, 0};
int vey[4] = {0, 1, 0, -1};
typedef vector<double> Vec;
typedef vector<int> vec;
typedef vector<Vec> MAT;
typedef vector<vec> mat;
lli MOD = 1000000007;
struct P {
    lli x, y;
    P(lli x, lli y)
    {
        this->x = x;
        this->y = y;
    }
};
int main()
{

    lli h, w, n;
    unordered_map<lli, unordered_map<lli, lli> /**/> used;
    //hash[x][y]ですでにしらべられたかどうか
    unordered_map<lli, unordered_map<lli, lli> /**/> fed;

    //塗られているかどうか
    queue<P> que;
    cin >> h >> w >> n;
    lli a, b;
    rep(i, n)
    {
        cin >> b >> a;
        a--, b--;
        fed[a][b] = 1;
        for (int i = -1; i <= 1; i++) {
            for (int j = -1; j <= 1; j++) {
                if (1 > a + i || b + j < 1 || a + i >= w - 1 || b + j >= h - 1 || used[a + i][b + j]) {
                    continue;
                }
                used[a + i][b + j] = 1;
                que.push(P(a + i, b + j));
            }
        }
    }
    /* rep(j, h) rep(i, w)
    {
        if (fed[i][j])
            cout << "x";
        else
            cout << "o";
        if (i == w - 1)
            cout << endl;
    }
    */
    lli num = 0;
    lli ans[10] = {};
    while (!que.empty()) {
        P p = que.front();
        que.pop();
        int sum = 0;
        num++;
        for (int i = -1; i <= 1; i++) {
            for (int j = -1; j <= 1; j++) {
                if (fed[i + p.x][j + p.y])
                    sum++;
            }
        }
        ans[sum]++;
    }
    ans[0] += (h - 2) * (w - 2) - num;
    rep(i, 10) cout << ans[i] << endl;
}


Measured memory_bytes: 238580
#include <iostream>
#include <stdio.h>
using namespace std;
int main(void){
    // Your code here!
    int H,W;
    scanf("%d %d",&H,&W);
    for (int k=0;k<10000;k++){
    if (H==0 && W==0){
        break;
    }
    else{
        for (int i=0;i<=H-1;i++){
            for (int j=0;j<=W-1;j++){
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
        scanf("%d %d",&H,&W);
    }
}
return 0;
}



Measured memory_bytes: 3140
import java.io.*;
import java.util.*;
class Main{
    public static void main(String[] args){
	try{
	    BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
	    String st;
	    int d, t=0;
	    double x=0.0, y=0.0, deg;
	    while(true){
		st = sc.readLine();
		if(st.equals("0,0"))
		    break;
		String[] s = st.split(",");
		d = Integer.valueOf(s[0]);
		deg = Math.toRadians(t);
		x += d*Math.sin(deg);
		y += d*Math.cos(deg);
		t += Integer.valueOf(s[1]);
	    }
	    System.out.printf("%d\n%d\n",(int)x,(int)y);
	}catch(Exception e){
	    System.out.println("Error");
	}
    }
}

Measured memory_bytes: 11000