akhauriyash/Code-Regression huggingface dataset:
# AOJ 1141: Dirichlet's Theorem on Arithmetic Progre...
# Python3 2018.7.15 bal4u

MAX = 1000000
SQRT = 1000     # sqrt(MAX)

prime = [True]*MAX
def sieve():
	prime[1] = 0
	for i in range(4, MAX, 2): prime[i] = False
	for i in range(3, SQRT, 2):
		if prime[i]:
			for j in range(i*i, MAX, i): prime[j] = False
sieve()
while True:
	a, d, n = map(int, input().split())
	if a == 0: break
	a -= d
	while n > 0:
		a += d
		if prime[a]: n -= 1
	print(a)



Measured memory_bytes: 13172
#include<stdio.h>

int main(void){
  int n;
  scanf("%d", &n);
  n = n % 10;
  if(n == 0 || n == 1 || n == 6 || n == 8)
    printf("pon");
  else if(n == 3)
    printf("bon");
  else
    printf("hon");
  return 0;
}

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

struct UnionFind{
    vector<int> parent;
    vector<int> rank;
    vector<int> member;
    UnionFind(int n):rank(n+1,0),parent(n+1),member(n+1){
        rep(i,n+1) parent[i]=i;
        rep(i,n+1) member[i]=1;
    }

    int find(int x){
        if (parent[x] == x) return x;
        else return parent[x] = find(parent[x]);
    }

    void unite(int x, int y){
        x = find(x);
        y = find(y);
        if (x==y) return;


        else if(rank[x]<rank[y]) {
            member[y]+=member[x];
            member[x]=member[y];
            parent[x]=y;
        }
        else{
            member[x]+=member[y];
            member[y]=member[x];
            parent[y]=x;
            if (rank[x]==rank[y]){
                rank[x]+=1;
            }
        }
    }
};

int main(){
    int n,q;
    cin >> n >> q;
    UnionFind uf(n);
    rep(i,q){
        int com,x,y;
        cin >> com >> x >> y;
        if(com == 0){
            uf.unite(x,y);
        }
        else{
            if(uf.find(x)==uf.find(y)) cout << "1" << endl;
            else cout << "0" << endl;
        }
    }
}


Measured memory_bytes: 3224
import sys
import math
import itertools
import collections
from collections import deque

sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():
    R,C = NMI()
    #sy, sx = NMI()
    #gy, gx = NMI()
    board = [list(input()) for _ in range(R)]
    
    ans = 0

    #移動4方向のベクトル
    dx = [1, 0, -1, 0]
    dy = [0, 1, 0, -1]

    #すべての点をINFで初期化
    INF = R*C*2
    distance = [[INF for _ in range(C)] for _ in range(R)]

    #地点を保存するqueを作成
    que = deque([])
    
    #スタート地点を取り出す
    for r in range(R):
        for c in range(C):
            if board[r][c] == '#':
                que.append((r,c))
                #スタート地点の距離は0
                distance[r][c] = 0

                
    cnt = 0
    
    #queが空になるまでループ
    while len(que) != 0:
        #取り出してきた状態
        pop = que.popleft()
        
        #移動4方向をループ
        for i in range(len(dx)):
            #移動した後の点をny,nxとする
            ny = pop[0]+dy[i]
            nx = pop[1]+dx[i]

            #nyが0以上R未満   nxが0以上C未満   まだ訪れたことがない
            if 0<= ny < R and 0 <= nx < C and distance[ny][nx] == INF:
                #つまり移動可能でまだ行ったことがなければqueへ入れる
                que.append((ny,nx))
                #その距離をもとのpopの最短距離+1でdistanceに記録
                distance[ny][nx] = distance[pop[0]][pop[1]]+1
                if ans < distance[ny][nx]:
                    ans = distance[ny][nx]
                
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 155388
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1LL<<60;
const int inf = 1e5;
//typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
ll mo = 998244353;
struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};
int main(){
  int n;  cin>>n;
  map<ll,ll> ma;
  rep(i,0,n){
    int x;
    cin >> x;
    ma[x-1]++;
    ma[x]++;
    ma[x+1]++;
  }
  ll ans = 0;
  for(auto j : ma){
    chmax(ans, j.se);
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<int> L(n);
    for(int i=0;i<n;i++){
        cin >> L[i];
    }
    sort(L.begin(),L.end());
    
    int ans = 0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            //1番小さい辺(L[i])と2番目に小さい辺(L[j])を固定
            //1番大きい辺はL[j]より長く一定の長さ以下(L[i]+L[j])のもの
            int c = L[i]+L[j];
            vector<int>::iterator it = lower_bound(L.begin(),L.end(),c);
            //c以上の最初の要素の位置を返す
            //要素が見つからなかった場合L.end()を返す
            int dist = distance(L.begin(),it) - (j+1); 
            //distance(L.begin(),it)= it
            ans += dist;
        }
    }
    cout << ans << endl;
}

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

/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
int main() {
	int N,K;
	cin >> N;
	cin >> K;
	vector<long long int>s;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		s.push_back(a);
	}

	long long int sum = 100000000000000000;

	for (int i = 0; i <= N-K; i++) {
		if (s[i + K - 1] >= 0 && s[i] >= 0) {
			sum = min(sum, s[i + K - 1]);
		}
		else if (s[i + K - 1] >= 0 && s[i] <= 0) {
			long long int k = min(abs(s[i + K - 1]), abs(s[i]));
			sum = min(sum, s[i + K - 1]-s[i]+k);
		}
		else if (s[i + K - 1] <= 0 && s[i] <= 0) {
			sum = min(sum, abs(s[i]));
		}
	}
		cout << sum;
}

Measured memory_bytes: 1400
unittest
{
	assert( [ "5", "ababa" ].parse.expand.solve == 2 );
	assert( [ "2", "xy" ].parse.expand.solve == 0 );
	assert( [ "13", "strangeorange" ].parse.expand.solve == 5 );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	input.popFront;
	auto s = input.front.to!( dchar[] );
	return tuple( s );
}

auto solve( dchar[] s )
{
	auto ans = 0L;
	foreach( a; 0L .. s.length.signed )
	{
		foreach( i, l; s[ a .. $ ].z_algorithm )
		{
			l = min( i, l );		// 重複個所を除く
			ans = max( ans, l );
		}
	}
	return ans;
}



// 最長共通接頭辞の長さ（s[ 0 .. l ] == s[ b .. l ] が成り立つbごとのlの最大値）
auto z_algorithm( dchar[] s )
{
	auto zs = new long[ s.length ];
	zs[ 0 ] = s.length;
	for( auto b = 1L, l = 0L; b < s.length; /* nop */ )
	{
		while( b + l < s.length && s[ l ] == s[ b + l ] ) l++;
		zs[ b ] = l;
		if( l == 0 )
		{
			b++;
			continue;
		}
		
		auto c = 1L;
		while( b + c < s.length && zs[ c ] + c < l )
		{
			zs[ b + c ] = zs[ c ];
			c++;
		}
		b += c;
		l -= c;
	}
	return zs;
}


Measured memory_bytes: 4732
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <string.h>
#include <ctype.h>
#include <algorithm>
#include <math.h>

using namespace std;

int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  
  if(abs(a-c) <= d)
    cout << "Yes" << endl;
  else if(abs(a-b) <= d & abs(b-c) <= d)
    cout << "Yes" << endl;
  else cout << "No" << endl; 
}

Measured memory_bytes: 3628
import java.util.*;

class Main {

    static void solve ( double speed ) {
        double time = speed / 9.8;
        double height = 4.9 * time * time;

        System.out.println( (int)(height / 5) + 2 );
    }

    public static void main (String [] args) {

        Scanner sc = new Scanner(System.in);

        while(sc.hasNext()) {
            double speed = sc.nextDouble();
            solve(speed);
        }

    }
}

Measured memory_bytes: 12000
#include <iostream>
#include <cstdio>
#include<ios>
#include <vector>
using namespace std;

template<class T> inline bool chmin(T& a, T b) {
    if(a>b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

int main(){
    ios::sync_with_stdio(false);
    int N,  a[100001], b[100001], c[1000001];
    const int INF = INT32_MAX>>3;
    cin >> N;
    vector<vector<int>> dp(N, vector<int>(3));
    for(int i = 0; i < N; i++) {
        cin>>a[i];    
        cin>>b[i];
        cin>>c[i];
    }
    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];
    for(int i = 1; i < N; i++) {
        dp[i][0] = max(dp[i-1][1]+a[i], dp[i-1][2]+a[i]);
        dp[i][1] = max(dp[i-1][0]+b[i], dp[i-1][2]+b[i]);
        dp[i][2] = max(dp[i-1][0]+c[i], dp[i-1][1]+c[i]);
    }
    cout << max(max(dp[N-1][0], dp[N-1][1]), dp[N-1][2]) << "\n";
}

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

int main() {
int64_t n,k;
  cin>>n>>k;
  vector<int64_t> vec(n);
  for(int64_t i=0;i<n;i++){
  cin>>vec.at(i);
  }
 for(int64_t i=0;i<n-k;i++){
 if(vec.at(i)<vec.at(i+k)){cout<<"Yes"<<endl;}
   else{cout<<"No"<<endl;}
 } 
  
  
}

Measured memory_bytes: 4836
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define PI 3.14159265358979

using namespace std;

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

  int s = 0;
  int h;

  for (int i = 0; i < n; i++){
    cin >> h;
    if (h >= k)
      s++;
  }


  cout << s << endl;


  return 0;
}


Measured memory_bytes: 256
#gcdは3.4.3だとfractionsにある
from fractions import gcd
import math

from math import factorial as f

from math import ceil,floor,sqrt


import bisect
import re
import heapq


from copy import deepcopy
import itertools

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))



def main():
    n = ii()
    a = li()

    a = sorted(a)
    
    for i in range(1,n):
        if a[i] == a[i-1]:
            print('NO')
            exit()
            
    print('YES')
            




main()


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

int main() {
    int n, k;
    scanf("%d%d", &n, &k);
    if (n >= k) {
        if (2 * k - 1 <= n) {
            printf("YES\n");
            return 0;
        }
    }
    printf("NO\n");
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int N;
	scanf("%d",&N);
	if(N>=65&&N<=90){
		printf("1\n");
	}
	else if(N>=97&&N<=122){
		printf("2\n");
	}
	else{
		printf("0\n");
	}
	return 0;
}



Measured memory_bytes: 2112
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

int a[105][5][2],p[105][11];

int main()
{ios_base::sync_with_stdio(false);
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
int n;
cin>>n;
rep(i,0,n-1)rep(j,0,4)rep(k,0,1)cin>>a[i][j][k];

rep(j,0,n-1)rep(k,0,10)cin>>p[j][k];

int mm=1;
rep(i,0,4)mm*=4;
ll ans=-1e17;
rep(msk,1,mm-1)
{
	ll s=0;
	rep(i,0,n-1)
	{
		int cc=0,m1=msk;
		rep(ii,0,4)
		{
			int x=m1%4;
			m1/=4;
			if(x==1)cc+=a[i][ii][0];
			else if(x==2)cc+=a[i][ii][1];
			else if(x==3)cc+=a[i][ii][0]+a[i][ii][1];
		}
		s+=p[i][cc];
		//o2(i,cc);os;o2(p[i][cc],msk);on;
	}
	ans=max(ans,s);
}
ol(ans);
return 0;
}



Measured memory_bytes: 256
#define _USE_MATH_DEFINES 
#include <iomanip> 
#include <cmath>  
#include<iostream>
#include <fstream>
#include<vector>
#include<algorithm>
#include<bitset>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<queue>
#include<deque>
#include<stack>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i = (ll)(a) ; i < (ll)(b) ; i++)
#define repd(i,a,b) for(ll i = (ll)(a) ; i > (ll)(b) ; i--)
#define rd(x) cin >> x
#define wr(x)  cout << x
#define wrln(x) cout << x << endl

int main() {
	string s;
	cin >> s;
	if (s[0] == '9' || s[1] == '9') wrln("Yes");
	else wrln("No");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long n,m,k,a,b,c,ans=0,cnt=0;
string s,t;
int main(){
	cin >> a >> b;
	for(int i=1;i<b-a;i++){
		cnt+=i;
	}
	cout << cnt-a << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
input=sys.stdin.readline
s=input().rstrip()
n=len(s)
pre='R'
rcount=1
rl=[]
for i in range(1,n):
    if s[i]=='R':
        if pre=='R':
            rcount+=1
        else:
            rcount=1
            rl[-1][2]=lcount
    else:
        if pre=='R':
            lcount=1
            rl.append([i-1,rcount,0])
        else:
            lcount+=1
    pre=s[i]
rl[-1][2]=lcount
ans=[0]*n
for i in rl:
    if i[1]%2==0:
        ans[i[0]]+=i[1]//2
        ans[i[0]+1]+=i[1]//2
    else:
        ans[i[0]]+=(i[1]+1)//2
        ans[i[0]+1]+=(i[1]-1)//2
    if i[2]%2==0:
        ans[i[0]]+=i[2]//2
        ans[i[0]+1]+=i[2]//2
    else:
        ans[i[0]]+=(i[2]-1)//2
        ans[i[0]+1]+=(i[2]+1)//2
for i in ans:
    print(i,end='')
    print(' ',end='')


Measured memory_bytes: 68572
#include <iostream>
using namespace std;
typedef long long ll;
ll s[101][4][4][4],n,ans;
int main(void){
    cin>>n;
    s[0][1][1][1]=1;
    for(int c=1;c<=n+1;c++){
        for(int i=0;i<4;i++){
            for(int j=0;j<4;j++){
                for(int k=0;k<4;k++){
                    if(c==n+1){
                        ans+=s[n][i][j][k];
                        ans%=1000000007;
                        continue;
                    }
                    for(int a=0;a<4;a++){
                        if(i==0&&j==2&&a==3)continue;
                        if(i==0&&k==2&&a==3)continue;
                        if(j==2&&k==0&&a==3)continue;
                        if(j==0&&k==3&&a==2)continue;
                        if(j==0&&k==2&&a==3)continue;
                        s[c][j][k][a]+=s[c-1][i][j][k];
                        s[c][j][k][a]%=1000000007;
                    }
                }
            }
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
fn main() {
    let (_, _, h, path) = input();
    println!("{}", solve(h, path));
}

struct Hill {
    height: usize,
    path: Vec<usize>,
}

impl Hill {
    fn new(height: usize, path: Vec<usize>) -> Self {
        Hill {
            height: height,
            path: path,
        }
    }
    fn push_path(&mut self, path: usize) {
        self.path.push(path);
    }
}

fn input() -> (usize, usize, Vec<usize>, Vec<(usize, usize)>) {
    let mut buf1 = String::new();
    std::io::stdin().read_line(&mut buf1).unwrap();
    buf1.pop();
    let mut iter1 = buf1.split_whitespace();
    let n: usize = iter1.next().unwrap().parse().unwrap();
    let m: usize = iter1.next().unwrap().parse().unwrap();
    let mut buf2 = String::new();
    std::io::stdin().read_line(&mut buf2).unwrap();
    buf2.pop();
    let iter2 = buf2.split_whitespace();
    let h: Vec<usize> = iter2.map(|i| i.parse().unwrap() ).collect();
    let mut path: Vec<(usize, usize)> = Vec::new();
    for i in 0..m {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        buf.pop();
        let mut iter = buf.split_whitespace();
        let a: usize = iter.next().unwrap().parse().unwrap();
        let b: usize = iter.next().unwrap().parse().unwrap();
        path.push((a, b));
    }
    (n, m, h, path)
}

fn from_input(h: Vec<usize>, path: Vec<(usize, usize)>) -> Vec<Hill> {
    // make empty path hills
    let mut hills: Vec<Hill> = h.iter().map(|v| Hill{height: *v, path: vec![]}).collect();
    for p in path.iter() {
        hills[p.0 - 1].push_path(p.1-1);
        hills[p.1-1].push_path(p.0-1);
    }
    hills
}

fn solve(h: Vec<usize>, path: Vec<(usize, usize)>) -> usize {
    let hills = from_input(h, path);
    let mut ans = 0;
    for hill in hills.iter() {
        let mut high = true;
        for p in hill.path.iter() {
            if hills[*p].height >= hill.height {
                high = false;
                break;
            }
        }
        if high {
            ans += 1;
        }
    }
    ans
}

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

using namespace std;

/*  テンプレここから */
typedef long long ll;

#define rep(i, n) for(int i = 0; i < n; ++i)
#define repi(i, start, end) for(int i = start; i < end; ++i)
#define all(x) (x).begin(), (x).end()
#define INF (1e9)
#define INFL (1e18)
#define add_mod(a, b, x) ( (ll)(a) + (ll)(b) ) % (ll)(x)
#define mul_mod(a, b, x) ( ((ll)(a) % (ll)(x)) * ((ll)(b) % (ll)(x)) ) % (ll)(x)
#define out(x) cout << (x) << endl;
#define outyes(bool_val) cout << (bool_val ? "yes" : "no") << endl;
#define outYes(bool_val) cout << (bool_val ? "Yes" : "No") << endl;
#define outYES(bool_val) cout << (bool_val ? "YES" : "NO") << endl;
#define outPossible(bool_val) cout << (bool_val ? "Possible" : "Impossible") << endl;
#define outPOSSIBLE(bool_val) cout << (bool_val ? "POSSIBLE" : "IMPOSSIBLE") << endl;

template<typename A, size_t N, typename T>
void array_fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

ll sub_mod(ll a, ll b, ll x){
    ll tmp = (a - b) % x;
    if(tmp < 0) tmp += x;
    return tmp;
}
ll gcd(ll a, ll b){
    if(b == 0) return a;
    else return gcd(b, a % b);
}

int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
/*  テンプレここまで */

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

    int n;
    cin >> n;
    string s;
    cin >> s;

    outYes(count(all(s), 'R') > count(all(s), 'B'))
}

Measured memory_bytes: 256
// Aizu Vol0 0073: Surface Area of Quadrangular Pyramid
// 2017.7.30

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

char *gets(char *);

int main()
{
	int x, h;
	char buf[100];
	double s;
	
	while (1) {
		gets(buf), x = atoi(buf);
		gets(buf), h = atoi(buf);
		if (x <= 0) break;
		s = sqrt(4.0*h*h + x*x) + x;
		s *= x;
		printf("%.8lf\n", s);
	}
	return 0;
}

Measured memory_bytes: 572
import sys

N, K = map(int, sys.stdin.readline().strip().split())

snukes = [0] * N
for i in range(K):
    d = int(sys.stdin.readline().strip())
    A = list(map(int, sys.stdin.readline().strip().split()))
    for a_i in A:
        snukes[a_i-1] += 1

ans = 0
for count in snukes:
    if count == 0:
        ans += 1
print(ans)

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

int main()
{
	int n, x;
	int i, j, k;
	int count=0;
	
	while(1){
		cin >> n >> x;
		if(n==0&&x==0)
			break;
		
		for(i=1;i<=n-2;i++){
			for(j=i+1;j<=n-1;j++){
				for(k=j+1;k<=n;k++){
					if(i+j+k==x)
						count++;
				}
			}
		}
		
		cout << count << endl;
		count=0;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define DEBUG
#define PI 3.141592653589793238462643383279
 
#define _GLIBCXX_DEBUG
#ifdef DEBUG
#define s(...) show(__VA_ARGS__);
#define sl(...) show(__VA_ARGS__);cout<<endl;
#else
#define s(...)
#define sl(...)
#endif
void show() {}
template <class Head,class... Args>void show(Head t,Args... args){std::cout<<t<<" ";show(args...);}
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define REP1(i, n) for(ll i = 1; i <= n; i++)
#define REPR1(i, n) for(ll i = n; i >= 1; i--)
#define FOR1(i, m, n) for(ll i = m; i <= n; i++)
const ll INF = LLONG_MAX;
const ull MOD = 1000000007;
#define VEC(type,A,N) vector<type> A(N)
#define VECi(type,A,N,i) vector<type> A(N,i)
#define VEC2(type,A,N,M) vector<vector<type>> A(N,vector<type>(M))
#define VEC2i(type,A,N,M,i) vector<vector<type>> A(N,vector<type>(M,i))
#define ALL(v) v.begin(), v.end()
ll frac(ll k){
    int s = 1;
    for (ll i=1; i<=k; ++i)s *= i;
    return s;
}
ll gcd(ll a, ll b){
   if (a%b==0)return(b);
   else return(gcd(b, a%b));
}
ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}
ll antidiv(ll N,ll C,ll D){
    return N-floor(N/C)-floor(N/D)+floor(N/lcm(C,D));
}
vector<ll> yakusuu(ll N){
    vector<ll> ret;
    for (ll i = 1; i * i <= N; i++) {
        if (N % i == 0) {
            ret.push_back(i);
            if (i * i != N) ret.push_back(N / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}
ll digitPoor(ll n)
{
    assert(INT_MAX == 2147483647);
    assert(n >= 0);

    if (n < 10)         return 1;
    if (n < 100)        return 2;
    if (n < 1000)       return 3;
    if (n < 10000)      return 4;
    if (n < 100000)     return 5;
    if (n < 1000000)    return 6;
    if (n < 10000000)   return 7;
    if (n < 100000000)  return 8;
    if (n < 1000000000) return 9;
    return 10;
}
struct p{
  ll x;
  bool end;
};

int main(){
    ll X,Y;
    cin>>X>>Y;
    if(Y-2*X>=0&&(Y-2*X)%2==0&&4*X-Y>=0&&(4*X-Y)%2==0){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
    //cout<<fixed<<setprecision(32)<<m;
    //sort(ALL(C),[](auto& a, auto& b) {return a[2] < b[2];});
    //if(equal(D.begin(), D.end()-1, K.begin()))cout<<"Yes";else cout<<"No";
    cout<<endl;
    return 0;
}


Measured memory_bytes: 3628
ans = 0
N = int(input())
s_list = [''.join(sorted(input())) for _ in range(N)]
s_list.sort()

count = 1
for i in range(1, N):
    if s_list[i] == s_list[i-1]:
        count += 1
    else:
        ans += (count*(count-1))/2
        count = 1

    if i == N-1:
        ans += (count*(count-1))/2

print(int(ans))

Measured memory_bytes: 10640
/*
    Mbak Rose Dong
*/
#include<bits/stdc++.h>
using namespace std;
vector<pair<int,int> > vi;
int main()
{
    int n,i,j,k,x,y,ans,curr,temp;
    scanf("%d %d",&n,&k);
    int rose = (n * (n-1)) / 2;
    if(k > (rose - (n - 1)))
    {
        cout << "-1" << endl;
        return 0;
    }
    for(i=2;i<=n;i++)
    {
        vi.push_back(make_pair(1, i));
    }
    rose -= (n-1);
    i = 2;
    j = i+1;
    while(rose > k)
    {
        rose--;
        vi.push_back(make_pair(i,j));
        j++;
        if(j > n)
        {
            i++;
            j = i+1;
        }
    }
    cout << vi.size() << "\n";
    for(auto x : vi)
        printf("%d %d\n", x.first, x.second);
    return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
#include<string.h>
int main(void)
{
	int a[5],b[5],d,i,j;
	char c[6]="ABCDE";
	scanf("%d %d",&a[0],&b[0]);
	while(a[0]!=0 && b[0]!=0){
		j=0; d=a[0]+b[0];
		for(i=1;i<5;i++){
			scanf("%d %d",&a[i],&b[i]);
		}
		for(i=0;i<5;i++){
			if(a[i]+b[i]>d){
				d=a[i]+b[i]; j=i;
			}
		}
		printf("%c %d\n",c[j],d);
		scanf("%d %d",&a[0],&b[0]);
	}
	return 0;
}

Measured memory_bytes: 2588
H,W = map(int,input().split())
C = [list(map(int,input().split())) for _ in range(10)]
# warshall-floydで各数字から1に変換するまでの最小魔力を計算
for k in range(10):
    for j in range(10):
        for i in range(10):
            C[i][j] = min(C[i][j], C[i][k]+C[k][j])
# print(C)
powerto1 = {idx: C[idx][1] for idx in range(10)}
#print(powerto1)
ans = 0
for _ in range(H):
    A = list(map(int,input().split()))
    for i in range(W):
        if A[i] != -1:
            ans += powerto1[A[i]]
print(ans)

Measured memory_bytes: 3064
#include<stdio.h>
int main()
{
	int s[105];
	for(int i=0;i<3;i++)
	{
		scanf("%d",&s[i]);
	}
	for(int i=0;i<3;i++)
	{
		for(int j=2;j>i;j--)
		{
			if(s[j]>s[j-1]){
			
			int t;
			t=s[j];
			s[j]=s[j-1];
			s[j-1]=t;
		
		  }
		}
	}
	printf("%d",s[0]-s[2]);
}

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

int main()
{
	int l, flag;
	char s[100], t[100];
	scanf("%s%s", s, t);
	l = strlen(s);
	for (int i = 0; i < l; i++)
	{
		flag = 1;
		for (int j = 0; j < l; j++)
			if (s[j] != t[(i + j) % l])
			{
				flag = 0;
				break;
			}
		if (flag)
			break;
	}
	if (flag)
		printf("Yes\n");
	else
		printf("No\n");

	return 0;
}

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

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

    string s;
    cin >> s;
    int tile[s.length()];
    for(int i=0; i<s.length(); i++){
        int temp;
        if(s[i] == '0'){
            temp = 0;
        }else{
            temp = 1; 
        }

        tile[i] = temp;
    }

    int count = 0;
    for(int i=0; i<s.length(); i++){
        if(i%2 == 0){
            if(tile[i] != 1){
                count ++;
            }
        }else{
            if(tile[i] != 0){
                count ++;
            }
        }
    }

    int count2 = 0;
    for(int i=0; i<s.length(); i++){
        if(i%2 == 0){
            if(tile[i] != 0){
                count2 ++;
            }
        }else{
            if(tile[i] != 1){
                count2 ++;
            }
        }
    }

    cout << min(count, count2) << endl;

    return 0;
}

Measured memory_bytes: 848
/*
* @Author: wxyww
* @Date:   2020-05-21 15:53:33
* @Last Modified time: 2020-05-21 16:09:36
*/
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<queue>
#include<vector>
#include<ctime>
#include<cmath>
using namespace std;
typedef long long ll;
const int N = 200010;
#define int ll
ll read() {
	ll x = 0,f = 1;char c = getchar();
	while(c < '0' || c > '9') {
		if(c == '-') f = -1; c = getchar();
	}
	while(c >= '0' && c <= '9') {
		x = x * 10 + c - '0'; c = getchar();
	}
	return x * f;
}
int n;
ll tmp[N];
void mul(int *a,int *b) {
	for(int i = 1;i <= n;++i) {
		tmp[i] = a[b[i]];
	}
	for(int i = 1;i <= n;++i) a[i] = tmp[i];
}
int a[N],p[N];
void qm(ll y) {
	int ret[N];
	for(int i = 1;i <= n;++i) ret[i] = i;

	for(;y;y >>= 1,mul(p,p))
		if(y & 1) mul(ret,p);
	for(int i = 1;i <= n;++i) p[i] = ret[i];
}
signed main() {
	n = read();
	for(int i = 1;i <= n;++i) {
		a[i] = read();p[i] = i;
	}
	
	int m = read();ll K = read();
	
	for(int i = n;i >= 1;--i) a[i] -= a[i - 1];
	
	for(int i = 1;i <= m;++i) {
		int x = read();
		swap(p[x],p[x + 1]);
	}

	qm(K);

	for(int i = 1;i <= n;++i) tmp[i] = a[p[i]];
	// for(int i = 1;i <= n;++i) printf("%d ",tmp[i]);
	// puts("");
	for(int i = 1;i <= n;++i) {
		printf("%lld.0\n",tmp[i] += tmp[i - 1]);
	}
	return 0;
}

Measured memory_bytes: 5504
#include <stdio.h>
int main() {
  int a,b;
  scanf("%d %d", &a, &b);
  if (a > b) {
    printf("a > b\n");
  } else if (a < b) {
    printf("a < b\n");
  } else {
    printf("a == b\n");
  }
  return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
using namespace std;
int n,m,tmp,ptmp;
uint64_t sum=0;
priority_queue<int> pd;



void solve(){
  for(int i=0;i<m;i++){
    tmp=pd.top()/2;
    pd.pop();
    pd.push(tmp);
  }

  for(int i=0;i<n;i++){
    sum+=pd.top();
    pd.pop();
  }

  cout<<sum<<endl;
}

int main(){
  cin>>n>>m;
  for(int i=0;i<n;i++){
    cin>>ptmp;
    pd.push(ptmp);
  }


  solve();
  return 0;
}


Measured memory_bytes: 892
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string.h>
#define INF 123456789
#define MOD 1000000007


int main()
{

	int N = 0;

	char str[123];

	scanf("%s", str);

	for (int a = 0; a < 123; ++a)
	{
		if (str[a] == '\0')
		{
			N = a;
			break;
		}
	}

	printf("%c%d%c\n", str[0], N - 2, str[N - 1]);

	return 0;
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
 
int main(){ 
  int a,b;
  cin >> a >> b;
  if(a==1) a= 14;
  if(b==1) b= 14;
 
  if(a>b)      cout << "Alice"<< endl;
  else if(a<b) cout << "Bob"  << endl;
  else         cout << "Draw" << endl;
}

Measured memory_bytes: 256
#ifdef ConanYu
#include "E:\yuzining\code\local.hpp"
#else
#pragma GCC optimize("-O3")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define debug(...) do { } while(false)
void Main();
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie();
  Main();
  return 0;
}
#endif

int a[200005];

ll b[200005], c[200005];
map<tuple<int, int, int>, ll> mp;
ll dfs(int i, int n, int d) {
  if(d <= 0) return 0;
  if((n - i + 1) % 2 != 0 && d == (n - i + 1) / 2 + 1) {
    if(n & 1) return b[n] - b[i - 1];
    return c[n] - c[i - 1];
  }
  tuple<int, int, int> cur = {i, n, d};
  auto it = mp.find(cur);
  if(it != mp.end()) return it->second;
  ll c1 = dfs(i + 1, n, d);
  ll c2 = a[i] + dfs(i + 2, n, d - 1);
  mp[cur] = max(c1, c2);
  return max(c1, c2);
}

void Main() {
  int n; cin >> n;
  for(int i = 1; i <= n; i++) cin >> a[i];
  for(int i = 1; i <= n; i++) {
    b[i] = b[i - 1];
    c[i] = c[i - 1];
    if(i & 1) b[i] += a[i];
    else c[i] += a[i];
  }
  cout << dfs(1, n, n / 2) << '\n';
}

Measured memory_bytes: 27832
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <bitset>
#include <iomanip>
#include <deque>
#include <tuple>
#include <algorithm>

using namespace std;

int main()
{
    long long int a, b, c, k, ans = 0;

    cin >> a >> b >> c >> k;

    if (a > k) {
        ans = k;
        k = 0;
    }
    else {
        ans = a;
        k -= a;
    }

    if (k >= b) {
        k -= b;
    }


    if (k >= c) {
        k -= c;
        ans -= c;
    }
    else {
        ans -= k;
    }

    cout << ans << endl;
}


Measured memory_bytes: 3620
arr = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
n = gets.chop.to_i
puts arr[n-1]

Measured memory_bytes: 1788
from copy import  deepcopy
def bubble_sort(lst):
    size=len(lst)
    for i in xrange(size):
        for j in reversed(range(i+1,size)):
            if lst[j].num<lst[j-1].num:
                tmp=lst[j]
                lst[j]=lst[j-1]
                lst[j-1]=tmp
def selection_sort(lst):
    size=len(lst)
    for i in xrange(size):
        mn=i
        for j in xrange(i+1,size):
            if lst[mn].num>lst[j].num:
                mn=j
        tmp=lst[i]
        lst[i]=lst[mn]
        lst[mn]=tmp
class pock:
    def __init__(self,val):
        self.val=val
        self.num=int(val[1:])
    def __gt__(self,other):
        return self.num>other.num


num=raw_input().strip()
inp=raw_input().strip().split()
arr=[]
for ii in inp:
    arr.append(pock(ii))
bubb=deepcopy(arr)
bubble_sort(bubb)
insec=deepcopy(arr)
selection_sort(insec)
print " ".join(pp.val for pp in bubb)
print "Stable"

print " ".join(pp.val for pp in insec)
ok=1
ln=len(arr)
for i  in xrange(ln):
    if(bubb[i].val!=insec[i].val):
        ok=0
        break
if ok==1:
    print "Stable"
else:
    print "Not stable"



Measured memory_bytes: 4736
#include<stdio.h>
int main(){
  int a, b, c, i, tmp;
  scanf("%d %d",&a,&b);

  if( a > b ){
    tmp=a;
    a=b;
    b=tmp;
  }

  scanf("%d",&c);

  if(b > c){
    tmp=b;
    b=c;
    c=tmp;
  }

  if(a > b){
    tmp=a;
    a=b;
    b=tmp;
  }

  printf("%d %d %d\n",a,b,c);
  return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
#define int long long

signed main() {
    int n;
    cin >> n;
    int count[n][26];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 26; j++) {
            count[i][j] = 0;
        }
    }
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        for (int j = 0; j < s.size(); j++) {
            count[i][s[j] - 'a']++;
        }
    }
    int res[26];
    for (int i = 0; i < 26; i++) {
        res[i] = 100;
        for (int j = 0; j < n; j++) {
            res[i] = min(res[i], count[j][i]);
        }
    }
    string ans;
    for (int i = 0; i < 26; i++) {
        for (int j = 0; j < res[i]; j++) {
            ans.push_back(i + 'a');
        }
    }
    cout << ans << endl;
    return 0;
}


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

string s[7] = {"fri", "sat", "sun", "mon", "tue", "wed", "thu"};

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

	int day = 1;
	while(day <= x) day += 7;
	day -= 7;
	cout << s[x - day] << endl;

	return 0;
}



Measured memory_bytes: 3176
import java.util.Scanner;

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

    long c = N / 11;
    N -= c * 11;
    c *= 2;
    if (N > 0) c += (N - 1) / 6 + 1;
    System.out.println(c);
  }
}


Measured memory_bytes: 21204
#include<iostream>
#include<vector>

int main(){
	int n;
	int lIdx;
	int rIdx;
	long long ans;
	long long mod= 1000000007;

	std::vector<int> aList;
	std::vector<bool> isDup;
	std::vector<long long> fact;
	std::vector<long long> inv;
	std::vector<long long> finv;

	std::cin>>n;
	aList.resize(n+1);
	isDup.resize(n,true);
	fact.resize(n+2, 1);
	inv.resize(n+2, 1);
	finv.resize(n+2, 1);

	for(int i=0; i<n+1; i++)
		std::cin>>aList[i];

	for(int i=2; i< n+2; i++){
		fact[i]= fact[i-1]*i % mod;
		inv[i]= mod - inv[mod%i]*(mod/i) % mod;
		finv[i]= finv[i-1]*inv[i] % mod;
	}

	for(int i=0; i<n+1; i++)
		isDup[aList[i]-1] = !isDup[aList[i]-1];

	for(int i=0; i<n+1; i++){
		if(isDup[aList[i]-1])
			rIdx= i;

		if(isDup[aList[n-i]-1])
			lIdx= n-i;
	}

	for(int i=1; i<=n+1; i++){
		ans=0;
		ans= fact[n+1]*(finv[i]*finv[n+1-i]%mod)%mod;

		if(i==1)
			ans-=1;
		else if(lIdx+n-rIdx >= i-1)
			ans-= fact[lIdx+n-rIdx]*(finv[i-1]*finv[lIdx+n-rIdx-(i-1)]%mod)%mod;		

		if(ans<0)
			ans+= mod;

			std::cout<<ans<<std::endl;

	}
	return 0;
	
}

Measured memory_bytes: 3968
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
const int maxn = 100000;
long long x,y,Max;
bool f;
int main()
{
    cin>>x;
    Max = 0;
    f = false;
    for (long long i = 1; i <= x; i++)
    {
        y = i * i;
        if(y > x)
        {
            cout<<Max<<endl;
            f = true; 
            break;
        }
        else
            if(y >= Max)
                Max = y;
    }
    if(!f)
        cout<<Max<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define f first
#define s second
using namespace std;
const int N=109,inf=1e18;
int h,w,g[N][N],dp[N][N][2];
int f(int i,int j,int l){
	if(i>=h or j>=w)return inf;
	if(dp[i][j][l]!=-1)return dp[i][j][l];
	int r=0,sum;
	if(l and !g[i][j])r=1;
	sum=min(f(i+1,j,g[i][j]),f(i,j+1,g[i][j]))+r;
	if(i==h-1 and j==w-1)sum=r;
	return dp[i][j][l]=sum;
}
int32_t main(){
	if(fopen("input.txt", "r"))
	freopen("input.txt", "r", stdin),
	freopen("output.txt", "w", stdout);
	ios::sync_with_stdio(0),cin.tie(0);
	cin >> h >> w;
	memset(dp,-1,sizeof dp);
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			char ch;
			cin >> ch;
			if(ch=='.')g[i][j]=1;
			else g[i][j]=0;
		}
	}
	cout << f(0,0,1) << endl;
}


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

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

const int mod = 1000000007;
const int inf = 1000000007;

int main()
{
    int n, m, x;
    cin >> n >> m >> x;
    int c[12];
    int a[12][12];
    for (int i = 0; i < 12; i++)
    {
        c[i] = 0;
        for (int j = 0; j < 12; j++)
        {
            a[i][j] = 0;
        }
    }
    for (int i = 0; i < n; i++)
    {
        cin >> c[i];
        for (int j = 0; j < m; j++)
        {
            cin >> a[i][j];
        }
    } /*
    for (int i = 0; i < 12; i++)
    {
        cout << c[i];
        for (int j = 0; j < 12; j++)
        {
            cout << a[i][j];
        }
    }*/
    int ans = 0;
    rep(i, n) ans += c[i];
    bool ok2 = false;
    for (int bits = 1; bits < (1 << n); bits++)
    {
        int sum[12];
        rep(i, 12) sum[i] = 0;
        int val = 0;
        for (int i = 0; i < n; i++)
        {
            if (bits & (1 << i))
            {
                val += c[i];
                for (int j = 0; j < m; j++)
                {
                    sum[j] += a[i][j];
                }
            }
        }
        //rep(i, m) cout << sum[i] << endl;
        bool ok = true;
        for (int i = 0; i < m; i++)
        {
            if (sum[i] < x)
            {
                ok = false;
            }
        }
        if (ok)
        {
            ok2 = true;
        }
        if (ok && val < ans)
        {
            ans = val;
        }
    }
    if (!ok2)
    {
        cout << -1 << endl;
    }
    else
    {
        cout << ans << endl;
    }
}


Measured memory_bytes: 3652
S = input()
K = int(input())
length = len(S)
alpha, n = 'abcdefghijklmnopqrstuvwxyz', 26
i = 0
ans = ''
while i < length:
    diff = (n - (ord(S[i]) - ord('a'))) % 26
    
    if 0 <= diff <= K:
        ans += 'a'
        K -= diff
    else:
        ans += S[i]
    i += 1
if K: ans = ans[:-1] + chr(ord('a') + (ord(ans[-1]) - ord('a') + K) % 26)
print(ans)

Measured memory_bytes: 3572
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#define ll long long
#define N 310
using namespace std;
int n,m,cnt,ans;
char ss[N][N];
int main()
{
	int i,s,a,b,j,k;
	scanf("%d",&n);
	for(i=0;i<n;i++)scanf("%s",ss[i]);
	for(i=0;i<n;i++)
	{
		j=1;
		for(s=0;s<n && j;s++)
		for(k=0;k<n && j;k++)
		if(ss[s][(k+i)%n]!=ss[k][(s+i)%n])j=0;
		ans+=j*n;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 384
#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

constexpr ll INF = 1e16;

#define rep(i, N) for(ll i=0; i<N; ++i)

ll max(ll a, ll b) {return a < b ? b : a; }
ll min(ll a, ll b) {return a > b ? b : a; }
double maxf(double a, double b) { return a < b ? b : a; }

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

  if(n%2 == 0){
    for (int i = 0; i<n/2; i++){
      int k;
      k = n/2;
      if(s.substr(0, k) == s.substr(k, k)){
      }else {
        cout<<"No"<<endl;
        exit(0);
      }
    }
  }else{
    cout<<"No"<<endl;
    exit(0);
  }

  cout<<"Yes"<<endl;

  return 0;
}

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

int main(){
    string S;
    cin >> S;
    //size_t len = S.length()
    

    int count = 0;

    for (int i=0; i<(int)(S.length())-1; i++){
        if (S[i] != S[i+1]){
            count = count + 1;
        }
    }

    cout << count;
    return 0;

}

Measured memory_bytes: 512
using System;

class Program
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var s = Console.ReadLine().Split(' ');
        var ans = int.MaxValue;
        for (int i = 0; i < n; i++)
        {
            ans = Math.Min(ans, m1(int.Parse(s[i])));
        }
        Console.WriteLine(ans);
    }

    static int m1(int n)
    {
        var ans = 0;
        while (n % 2 == 0)
        {
            ans++;
            n /= 2;
        }
        return ans;
    }
}


Measured memory_bytes: 11092
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
using namespace std;
typedef long long int llint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long &x, long long &y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a%b, y, x);
	y -= a / b * x;
	return d;
}

bool check(int a, int b) {
	return a > b;
}

int main() {
	int n;
	cin >> n;
	vint a(n);
	rep(i, n) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	int ans = 0;
	int tmp;
	rep(i, n) {
		tmp = 1;
		while (i < n - 1) {
			if (a[i] == a[i + 1]) {
				tmp++;
				i++;
			}
			else {
				break;
			}
		}
		if (tmp < a[i]) {
			ans += tmp;
		}
		else {
			ans += tmp - a[i];
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
program prob3
    implicit none
    integer::X,i,j,k,ans
    integer::v(1000)
    read(*,*) X
    v = 0
    do i = 1, 34
        do j = 2,10
            if(i**j > 1000)then
                exit
            else
                v(i**j) = 1
            end if
        end do
    end do

    do i = 1,X
        if(v(i) == 1) then
            ans = i
        end if
    end do

    write(*,*) ans

end program

Measured memory_bytes: 2928
#include <iostream>

using namespace std;

int N, A, B;
int ans;

void OneDigit(){
    for(int i = 0; i <= 9; i++){
        if(i > N){ break; }
        if(i >= A && i <= B){ ans += i; }
    }
}
void TwoDigit(){
    int mycount;
    if(N >= 10){
        for(int i = 10; i <= 99; i++){
            if(i > N){ break; }
            mycount = 0;
            mycount += i % 10;
            mycount += i / 10;
            if(mycount >= A && mycount <= B){ ans += i; }
        }
    }
}
void ThreeDigit(){
    int mycount, temp;
    if(N >= 100){
        for(int i = 100; i <= 999; i++){
            if(i > N){ break; }
            mycount = 0;
            temp = i;
            mycount += temp % 10;
            temp /= 10;
            mycount += temp % 10;
            mycount += temp / 10;
            if(mycount >= A && mycount <= B){ ans += i; }
        }
    }
}
void FourDigit(){
    int mycount, temp;
    if(N >= 1000){
        for(int i = 1000; i <= 9999; i++){
            if(i > N){ break; }
            mycount = 0;
            temp = i;
            mycount += temp % 10;
            temp /= 10;
            mycount += temp % 10;
            temp /= 10;
            mycount += temp % 10;
            mycount += temp / 10;
            if(mycount >= A && mycount <= B){ ans += i; }
        }
    }
}

int main()
{
    ans = 0;
    cin>>N>>A>>B;

    OneDigit();
    TwoDigit();
    ThreeDigit();
    FourDigit();
    if(N == 10000){
        if(A <= 1 && B >= 1){ ans += 10000; }
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 3624
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		// 計算
		String result = "No";
		if(a + b >= c) result = "Yes";
		
		// 出力
		System.out.println(result);
	}
}




Measured memory_bytes: 23764
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long N = lread();
    auto A = new long[](N);
    auto B = new long[](N);
    foreach (i; 0 .. N)
        scan(A[i], B[i]);

    long ans;
    foreach_reverse (i; 0 .. N)
    {
        ans += (B[i] - ((A[i] + ans) % B[i])) % B[i];
    }
    writeln(ans);
}


Measured memory_bytes: 4860
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main() {
  vector<int> A(3);
  rep(i, 3) cin >> A[i];

  sort(all(A), greater<int>());
  cout << A[0] - A[2] << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

    public static void main(String[] args) throws Exception {

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }

        String arr_temp[] = mylist.get(0).split(" ");

        int a = Integer.valueOf(arr_temp[0]);
        int b = Integer.valueOf(arr_temp[1]);

        //        System.out.println(a + " " + b);

        //        System.out.println(gcd(a, b));

        int ans = gcd(a, b);
        long temp = (long) a * (long) b;
        System.out.println(temp / ans);

    }

    public static int gcd(int a, int b) {

        // 引き数のint値を表示
        //        System.out.println(a + " " + b);

        // bがゼロならaを返却
        if (b == 0) {
            return a;
        }

        // そうじゃないなら再計算
        return gcd(b, a % b);
    }

}


Measured memory_bytes: 25044