akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define INF 99999999
#define rep(i,n) for(int i=0,temp=(int)(n);i<temp;++i) //vec.size()がnの時等の高速化
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define vint vector<int>
#define vvint vector<vector<int>>

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}


int main(){
  int n;
  vector<ll> v;v.resize(87);
  cin >> n;
  v[0]=2;v[1]=1;
  for(int i=2;i<=86;++i) v[i]=v[i-1]+v[i-2];
  cout << v[n] << endl;
  return 0;
}

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


int main(){
   
    int n;
    cin >> n;
    int A[n];
    for(int i=0;i<n;i++){
        cin >> A[i]; 
    }
    int s,count = 0;
    for(int i=1;i<n;i++){
      for(int k=n-1;k > 0;k--){
          if(A[k] < A[k-1]){
              s = A[k];
              A[k] = A[k-1];
              A[k-1] = s;
              count++;
          }
      }
    }

    for(int i=0;i<n;i++){
        if(i != n-1)
            cout << A[i] <<  " ";
        else cout << A[i];
    }
        cout << endl;
        cout << count << endl;
}


Measured memory_bytes: 3104
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const int dx[4] = { 0, -1, 1, 0 };
const int dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}

template<class T1, class T2> void chmin(T1 &a, T2 b) { if (a>b)a = b; }

template<class T1, class T2> void chmax(T1 &a, T2 b) { if (a<b)a = b; }
template<class T>
void Add(T &a, const T &b, const T &mod = 1000000007) {
	int val = ((a % mod) + (b % mod)) % mod;
	if (val < 0) { val += mod; }
	a = val;
}
////////////////////////////////////////


int main() {
	int N; cin >> N;
	int a[200010];
	REP(i, N)cin >> a[i];
	int ans = 0;
	int key = 1;
	REP(i, N) {
		if (a[i] == key) {
			ans++;
			key++;
		}
	}
	if (ans == 0)cout << -1 << endl;
	else {
		cout << N - ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1024
import fractions
N = int(input())
T = list(map(int, input().split()))
lcm = T[0]
ans = 0
MOD = 1000000007
for i in range(1, N):
  lcm = lcm * T[i] // fractions.gcd(lcm, T[i])
for x in T:
  ans += lcm // x
print(ans % MOD)

Measured memory_bytes: 6112
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include<math.h>
#include <queue>
using namespace std;
#define Minf -1e9
#define scan(n) scanf("%lld",&n)
typedef long long ll;
const int maxn = 1*1e5+10;
const ll INF = 1e9+100;
const int mod = 998244353;

int a[maxn];
int main()
{
	int n, x, t;
	scanf("%d%d%d", &n, &x, &t);
	int te = n / x + (n % x ? 1 : 0);
	printf("%d", t * te);
}

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

int main()
{
    int H, W;
    vector<vector<string>> S;
    vector<char> ans1;
    cin >> H >> W;
    for (char i = 'A'; i <= 'Z'; i++)
    {
        ans1.push_back(i);
    }
    for (int i = 0; i < H; i++)
    {
        vector<string> tmp;
        for (int j = 0; j < W; j++)
        {
            string str;
            cin >> str;
            tmp.push_back(str);
        }
        S.push_back(tmp);
    }
    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            if (S[i][j] == "snuke")
            {
                cout << ans1[j] << i + 1;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		if (b>=a){
        System.out.println(a);
        }else{
        System.out.println(a-1);
        }
      
    }
}

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

template <class T>
inline void read(T &res)
{
	char ch; bool flag = false; res = 0;
	while (ch = getchar(), !isdigit(ch) && ch != '-');
	ch == '-' ? flag = true : res = ch ^ 48;
	while (ch = getchar(), isdigit(ch))
		res = res * 10 + ch - 48;
	flag ? res = -res : 0;
}

template <class T>
inline void put(T x)
{
	if (x > 9)
		put(x / 10);
	putchar(x % 10 + 48);
}

template <class T>
inline void CkMax(T &x, T y) {x < y ? x = y : 0;}
template <class T>
inline void CkMin(T &x, T y) {x > y ? x = y : 0;}
template <class T>
inline T Max(T x, T y) {return x > y ? x : y;}
template <class T>
inline T Min(T x, T y) {return x < y ? x : y;}

typedef long long ll;
const int N = 5e5 + 5;
char s[N];
int a[N], vis[N];
int n, now;
ll ans;

int main()
{
	scanf("%s", s + 1);
	n = strlen(s + 1) + 1;
	s[0] = '>'; s[n] = '<';

	for (int i = 1; i <= n; ++i)
		if (s[i - 1] == '>' && s[i] == '<')
			vis[i] = 1;
		else if (s[i - 1] == '<' && s[i] == '>')
			vis[i] = 2;
	for (int i = 1; i <= n; ++i)
		if (s[i - 1] == '>' && s[i] == '<')
		{
			for (int l = i - 1; l >= 1; --l)
			{
				CkMax(a[l], i - l);
				if (vis[l] == 2)
					break ;
			}
			for (int r = i + 1; r <= n; ++r)
			{
				CkMax(a[r], r - i);
				if (vis[r] == 2)
					break ;
			}
		}
	for (int i = 1; i <= n; ++i)
		ans += a[i];
	std::cout << ans << std::endl;

	return 0;
}

Measured memory_bytes: 4608
N,T = map(int,raw_input().split())
t_list = map(int,raw_input().split())

t_sum=0
for i in range(N-1):
    t_span = t_list[i+1]-t_list[i]
    if t_span<T:
        t_sum+=t_span
    else:
        t_sum+=T
t_sum+=T
print str(t_sum)

Measured memory_bytes: 20060
#include <bits/stdc++.h>
#define N 3010
#define pb push_back
#define fi first
#define se second
#define si size()
#define ll long long
#define mp make_pair
#define iter ::iterator
#define all(v) v.begin(), v.end()
#define pp pop_back
#define mapiter map<int, int>::iterator
#define forn(i, n) for(int i = 0; i < n; ++i)
#define forn1(i, n) for(int i = 1; i <= n; ++i)
#define forr(i, n)	for(int i = n - 1; i >= 0; --i)
#define forr1(i, n)	for(int i = n; i >= 1; --i)
#define form(l, r, i)	for(int i = l; i <= r; ++i)
#define forv(r, l, i)	for(int i = r; i >= l; --i)
#define r0 return 0
#define barnarnar ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define lld long double
#define elif else if
 
const int inf = 1e9 + 7;
const lld EPS = 0.00000001;
const ll modw = 998244353ll;

using namespace std;

ll dp[N][N];
ll a[N];

int main()
{
	barnarnar
	int n;
	cin >> n;
	forn1(i, n)	cin >> a[i];
	for(int l = n; l >= 1; l--)
	{
		for(int r = l; r <= n; r++)
		{
			dp[l][r] = max(a[l] - dp[l + 1][r], a[r] - dp[l][r - 1]);
		}
	}
	cout << dp[1][n];
	return 0;
}





Measured memory_bytes: 70016
import heapq
import sys

inp = sys.stdin.readline

Q = int(input())
B = 0

q, a, b = map(int, inp().split())
L, R = [-a], [a]
L_sum, R_sum = a, a
B = b

for i in range(Q - 1):
    q = list(map(int, inp().split()))
    if len(q) == 3:
        A = q[1]
        B += q[2]

        if A <= -L[0]:
            heapq.heappush(L, -A)
            M = -heapq.heappushpop(L, -A)
            heapq.heappush(R, M)

            L_sum += (2 * A - M)
            R_sum += M
        else:
            heapq.heappush(R, A)
            M = heapq.heappushpop(R, A)
            heapq.heappush(L, -M)

            R_sum += (2 * A - M)
            L_sum += M
    else:
        N = len(L)
        X = -L[0]
        print(X, (abs(L_sum - X * N) + abs(R_sum - X * N)) // 2 + B)


Measured memory_bytes: 81752
// --https://kenkoooo.com/atcoder/#/table/soma62jp
#include <iostream>
#include <string>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstring>

using namespace std;

int main(int argc, char* argv[]) {

	int N, A, B, ans = 0;

	cin >> N >> A >> B;

	for(int i=0;i<=N;i++){
    	std::stringstream ss;
		ss << i;
		std::string str = ss.str();
		int sum = 0;
		char wrk[2]={0};
		for(int j=0;j<str.length();j++){
			wrk[0] = str[j];
			sum+=atoi(wrk);
		}
		if(sum>=A && sum<=B){
        	ans+=i;
		}
	}

	cout << ans << endl;

	return 0;
}



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

bool seen[110000];
int vec[110000];
map<pair<int,int>,int> ma;

void dfs(const vector<vector<int>> &G,int v){
  seen[v]=true;
  for(auto next_v:G[v]){
    if(seen[next_v])continue;
    vec[next_v]=vec[v]+ma[{v,next_v}];
    dfs(G,next_v);
  }
}

int main(){
  int n;
  cin>>n;
  vector<vector<int>> g(n);
  for(int i=0;i<n-1;i++){
    int a,b,c;
    cin>>a>>b>>c;
    a--;
    b--;
    c%=2;
    g[a].push_back(b);
    g[b].push_back(a);
    ma[{a,b}]=c;
    ma[{b,a}]=c;
  }
  vec[0]=0;
  dfs(g,0);
  for(int i=0;i<n;i++){
    cout<<vec[i]%2<<endl;
  }
}

Measured memory_bytes: 23808
#include <bits/stdc++.h>
using namespace std;
const double BTCtoJPY = 380000.0;
int main(){
    int N;
    cin >> N;
    double sum;
    for(int i=0;i<N;i++){
        double value;
        string type;
        cin >> value >> type;
        sum += (type=="BTC" ? value*BTCtoJPY : value);
    }
    cout << sum;
    return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
using namespace std;
int main()
{
  int N,K;
  cin>>N>>K;
  int p[N];
  for(int i=0;i<N;i++)
    cin>>p[i];
  sort(p,p+N);
    int min_ans=0;
  for(int i=0;i<K;i++)
  {
    min_ans+=p[i];
  }
  cout<<min_ans<<endl;
  return 0;
}

Measured memory_bytes: 3160
// Aizu Vol-5 0570: Zig-Zag Numbers
// 2017.9.5 bal4u@uu

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

#define UP 0
#define DOWN 1
#define M 10000

char a[503], b[503];
int la, lb;
int m;
int dp[2][2][2][10][502];   // prev, org?, up/down, digit, sum %m

int zigzag(char *c, int len)
{
	int i, j, k, s, t, x, k1, k2;

	memset(dp, 0, sizeof(dp));

	if (*c == '0') c++, len--;
	k = *c - '0';
	if (len == 1) for (i = 1; i <= k; i++) dp[0][0][UP][i][i % m] = 1;
	else {
		for (i = 1; i < k; i++) dp[0][0][UP][i][i % m] = dp[0][0][DOWN][i][i % m] = 1;
		dp[0][1][UP][k][k % m] = dp[0][1][DOWN][k][k % m] = 1;
	}

	for (k1 = 0, k2 = 1, i = 1; i < len; i++, k1 = k2, k2 = !k2) {
		for (s = 0; s < 2; s++) for (t = 0; t < 2; t++) for (j = 0; j < 10; j++) for (k = 0; k < m; k++)
			dp[k2][s][t][j][k] = 0;
		
		for (k = 0; k < m; k++) for (j = 0; j < 10; j++) {
			for (s = j+1; s < 10; s++) {
				x = (10*k + s) % m;
				dp[k2][0][UP][s][x] += dp[k1][0][DOWN][j][k];
				if (s <  c[i] - '0')      dp[k2][0][UP][s][x] += dp[k1][1][DOWN][j][k];
				else if (s == c[i] - '0') dp[k2][1][UP][s][x] += dp[k1][1][DOWN][j][k];
			}
			for (s = j-1; s >= 0; s--) {
				x= (10*k + s) % m;
				dp[k2][0][DOWN][s][x] += dp[k1][0][UP][j][k];
				if (s <  c[i] - '0')      dp[k2][0][DOWN][s][x] += dp[k1][1][UP][j][k];
				else if (s == c[i] - '0') dp[k2][1][DOWN][s][x] += dp[k1][1][UP][j][k];
			}
		}
		for (j = 1; j < 10; j++) {
			dp[k2][0][UP][j][j % m]++;
			if (i < len-1) dp[k2][0][DOWN][j][j % m]++;
		}

		for (s = 0; s < 2; s++) for (t = 0; t < 2; t++) for (j = 0; j < 10; j++) for (k = 0; k < m; k++) 
			dp[k2][s][t][j][k] %= M;
	}
	for (s = 0, j = 0; j < 10; j++) {
		s += dp[k1][0][UP][j][0] + dp[k1][1][UP][j][0] +
			 dp[k1][0][DOWN][j][0] + dp[k1][1][DOWN][j][0];
	}
	return s % M;
}

int main()
{
	int i, t;

	scanf("%s%s%d", a, b, &m); la = strlen(a), lb = strlen(b);
	for (i = la-1; ; i--) {
		if (a[i] > '0') { a[i]--; break; }
		a[i] = '9';
	}
	t = zigzag(b, lb);
	if (!(la == 1 && *a == '0')) t -= zigzag(a, la);
	if (t < 0) t += M;
	printf("%d\n", t);
	return 0;
}

Measured memory_bytes: 1896
#include <iostream>
#include <algorithm>
#define rep(i,a,b) for(int i=a; i< (int)(b); ++i)
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
typedef long double ld;
using ll=long long;
using namespace std;
const auto mod=1e9+7;


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string s,ans="No"; cin >> s;
  sort(ALL(s));
  if(s[0]==s[1] && s[1]!=s[2] && s[2]==s[3]) ans ="Yes";
  cout << ans << endl;
 }

Measured memory_bytes: 256
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#include "bitset"

#define lp(n) for (int i = 0; i < n; i++)
#define LP(n,i) for (int i = 0; i < n; i++)
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define intmin -2147483647
#define llmax 9223372036854775807
typedef long long ll;
using namespace std;

int n;

int main(){
	cin >> n;
	lp(n) {
		if ((i + 1)*(i + 2) / 2 <= n && (i + 2)*(i + 3) / 2 > n) {
			int mem = (i + 2)*(i + 3) / 2 - n;
			LP(i+2,j) {
				if (j + 1 != mem)cout << j + 1 << endl;
			}
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
N=int(input())
A=[int(input()) for i in range(N)]

m1=max(A)
Imax=A.index(max(A))
b=A.pop(Imax)
m2=max(A)

M=[m1 for i in range(N)]
M[Imax]=m2

for i in range(N):
  print(M[i])

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

bool isVisited[200001];
int dest[200001];
vector<int> route;
vector<int> cycle;

int main() {
	int n, cycleStart = 0;
	long long k;
	int ans = 0;
	cin >> n >> k;
	for (int i = 1; i <= n; i++) {
		cin >> dest[i];
	}

	int curVilliage = 1;
	while (!isVisited[curVilliage]) {
		isVisited[curVilliage] = true;
		route.push_back(curVilliage);
		curVilliage = dest[curVilliage];
	}

	for (int i = 0; i < route.size(); i++) {
		if(route[i] == curVilliage){
			cycleStart = i;
			for (int j = i; j < route.size(); j++) {
				cycle.push_back(route[j]);
			}
			break;
		}
	}

	k++;
	if (k <= cycleStart) {
		ans = route[k - 1];
	}
	else {
		int idx = (k - cycleStart) % cycle.size();
		if (idx == 0) {
			idx = cycle.size();
		}
		ans = cycle[idx - 1];
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 6448
from collections import deque
H, W = map(int, input().split())
A = [list(input()) for i in range(H)]


D = [[-1] * W for i in range(H)]
queue = deque([])
for h in range(H):
    for w in range(W):
        if A[h][w] == '#':
            queue.append([h, w])
            D[h][w] = 0


while queue:
    nh, nw = queue.pop()
    for dh, dw in [[-1, 0], [1, 0], [0, -1], [0, 1]]:
        if not ((0 <= nh + dh < H) and (0 <= nw + dw < W)):
            continue

        if D[nh + dh][nw + dw] >= 0:
            continue

        D[nh + dh][nw + dw] = D[nh][nw] + 1
        queue.appendleft([nh + dh, nw + dw])


ans = 0
for h in range(H):
    for w in range(W):
        ans = max(ans, D[h][w])

print(ans)


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

int main() {
    int num_query; scanf("%d", &num_query);
    int command, x;
    set<int> S;
    
    for (int i = 0; i < num_query; ++i) {
        scanf("%d%d", &command, &x);
        int find_result = 0;
        switch (command) {
            case 0:
                S.insert(x);
                printf("%d\n", (int) S.size());
                break;
            case 1:
                if (S.find(x) != S.end()) find_result = 1;
                printf("%d\n", find_result);
                break;
            case 2:
                S.erase(x);
                break;
        }
    }
    return 0;
}


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

using namespace std;

typedef long long ll;
const int MOD = (int) 1e9 + 7;

int add(int a, int b)
{
    a += b;
    if (a >= MOD)
    {
        return a - MOD;
    }
    if (a < 0)
    {
        return a + MOD;
    }
    return a;
}

int mul(int a, int b)
{
    return a * (ll) b % MOD;
}

int pw(int a, int b)
{
    int r = 1;
    while (b)
    {
        if (b & 1)
        {
            r = mul(r, a);
        }
        a = mul(a, a);
        b /= 2;
    }
    return r;
}

const int N = (int) 1e5 + 7;
int n;
int k;
int cnt[N];
int sol;

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

    cin >> n >> k;
    for (int i = k; i >= 1; i--)
    {
        cnt[i] = pw(k / i, n);
        for (int j = 2 * i; j <= k; j += i)
        {
            cnt[i] = add(cnt[i], -cnt[j]);
        }
        sol = add(sol, mul(i, cnt[i]));
    }
    cout << sol << "\n";
}



Measured memory_bytes: 3964
#include<bits/stdc++.h>
using namespace std;
using PQ = priority_queue<int64_t>;
int main(){
  int64_t X, Y, A, B, C;
  cin >> X >> Y >> A >> B >> C;
  vector<PQ> vec(3);
  for(int i=0; i<3; i++){
    vec.at(i).push(-1);
  }
  for(int i=0; i<A; i++){
    int x;
    cin >> x;
    vec.at(0).push(x);
  }
  for(int i=0; i<B; i++){
    int x;
    cin >> x;
    vec.at(1).push(x);
  }
  for(int i=0; i<C; i++){
    int x;
    cin >> x;
    vec.at(2).push(x);
  }
  int64_t ans = 0;
  int64_t cnt = 0;
  int64_t x = 0;
  int64_t y = 0;
  while(cnt < X+Y){
    int out = 2;
    int64_t num = vec.at(2).top();
    if(num < vec.at(0).top() && x < X){
      out = 0;
      num = vec.at(0).top();
    }
    if(num < vec.at(1).top() && y < Y){
      out = 1;
      num = vec.at(1).top();
    }
    ans += num;
    vec.at(out).pop();
    cnt++;
    if(out == 0){
      x++;
    }
    if(out == 1){
      y++;
    }
  }
  cout << ans << endl;  
}

Measured memory_bytes: 3316
from sys import stdin
from bisect import bisect_left
readline = stdin.readline


dp = [-float('inf')]
n = int(readline())
a = (int(readline()) for _ in range(n))
for ai in a:
    if dp[-1] < ai:
        dp.append(ai)
    else:
        dp[bisect_left(dp, ai)] = ai
print(len(dp) - 1)

Measured memory_bytes: 11016
#include <stdio.h>
#include <stdlib.h>

int gcd(int a,int b){
	if(!b)	return a;
	else gcd(b, a % b);
}

int main(int argc, char const *argv[])
{
	long n,*a;
	long min1 = 10000000000,im;
	long min2 = 10000000000;

	scanf("%ld",&n);
	a = (long *)malloc(sizeof(long) * n);
	for (int i = 0; i < n; ++i){
		scanf(" %ld",&a[i]);
		if(a[i] == 1){
			printf("1\n");
			return 0;
		}
		if(a[i] < min1){
			min1 = a[i];
			im = i;
		}
	}
	for (int i = 0; i < n; ++i){
		a[i] = gcd(a[i],min1);
		if(a[i] < min2)	min2 = a[i];
	}
	printf("%ld\n", min2);
	return 0;
}

Measured memory_bytes: 896
#include <stdio.h>
#include <cctype>
#include <limits.h>
#include <math.h>
#include <complex>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) static_cast<bitset<16> >(x);
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))

const int INF = 1000000000;
const double EPS = 1e-8;
const double PI = 3.14159;
int dx[4]={-1, 0, 1, 0}, dy[4]={0, -1, 0, 1};
using namespace std;
typedef pair<int, int> P;

/** Problem1052 : Old Bridges **/
int main()
{
	int N;
	while (cin>>N, N) {
		vector<P> a(N);
		rep(i, N) cin>> a[i].second >> a[i].first;
		sort(a.begin(), a.end());
		
		int W=0; bool ok=true;
		rep(i, N) {
			W+=a[i].second;
			if (W>a[i].first) {
				ok = false;
				break;
			}
		}
		
		cout << (ok?"Yes":"No") << endl;
		
	}
}

Measured memory_bytes: 1192
using System;
using System.Linq;
    class Program
    {

        static void Main(string[] args)
        {
            var inputNMXY = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var maxX = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).Max();
            var minY = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).Min();
            var X = inputNMXY[2];
            var Y = inputNMXY[3];

            if((X<=Y) &&
               (maxX<minY) &&
               (X< minY) &&
               (maxX <Y) 
               )
            {
                Console.WriteLine("No War");
                return;
            }
            Console.WriteLine("War");
        }
    }

Measured memory_bytes: 13396
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <cmath>
#include <climits>
#include <iomanip>
#include <queue>
#include <stack>

using namespace std;

typedef long long ll;

int main() {
    int n, k;   cin >> n >> k;
    vector<int> sunuke(n,0);
    for (int i = 0; i < k; i++) {
        int d;  cin >> d;
        for (int j = 0; j < d; j++) {
            int a;  cin >> a;
            a--;
            sunuke[a]++;
        }
    }

    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (sunuke[i] == 0)
            ans++;
    }

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

Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
using System.Dynamic;
using System.Linq;
using System.Numerics;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;

namespace atcorder
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int cnt = 0;
            for(int i = 1; i <= N; i++)
            {
                string s = i.ToString();
                if(s.Length % 2 != 0)
                {
                    cnt++;
                }
            }
            Console.WriteLine(cnt);
        }
    }
}


//文字配列の取得
//string[] strArray = Console.ReadLine().Split(' ').ToArray();
//string S = strArray[0];
//string T = strArray[1];

//文字列の取得
//string s = Console.ReadLine();

//数字配列の取得
//int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
//int H = intArray[0];
//int W = intArray[1];

//数字の取得
//int N = int.Parse(Console.ReadLine());

//リスト型(int)の取得
//List<int> A = new List<int>(Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray());

//出力
//Console.WriteLine(ans);
//Console.WriteLine("Yes");
//Console.WriteLine("No");
//Console.WriteLine(cnt);



Measured memory_bytes: 30500
#include <bits/stdc++.h>
using namespace std;
using ull = uint64_t;
using ll = int64_t;
using ld = long double;

const int MAXN = 200228;
vector<int> e[MAXN];
int c[MAXN][2];
int q[MAXN];
bool w[MAXN];

int qe;

void upd(int x) {
    if (w[x] || (c[x][0] && c[x][1])) {
        return;
    }

    w[x] = true;
    q[qe++] = x;
}

int main() {
#ifdef BZ
    freopen("input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cout.setf(ios::fixed); cout.precision(20);
    int n, m;
    cin >> n >> m;
    string s;
    cin >> s;
    for (int i = 0; i < m; ++i) {
        int a, b;
        cin >> a >> b;
        e[b].push_back(a);
        e[a].push_back(b);
        ++c[a][s[b - 1] - 'A'];
        ++c[b][s[a - 1] - 'A'];
    }

    for (int i = 1; i <= n; ++i) {
        upd(i);
    }

    for (int qb = 0; qb < qe; ++qb) {
        int v = q[qb];
        for (int u: e[v]) {
            --c[u][s[v - 1] - 'A'];
            upd(u);
        }
    }

    cout << ((qe == n) ? "No" : "Yes") << "\n";
}



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

#define int long long

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

    bool flag = true;
    for(int i = 0;i < s.size()-1;i++){
        if(s[i] != s[i+1]){
            flag = false;
            break;
        }
    }

    if(flag){
        cout << s.size()*k / 2 << endl;
        return 0;
    }


    string t = s;

    for(int i = 1;i < min(3ll, k);i++){
        t += s;
    }

    int ans = 0;
    for(int i = 0;i < t.size()-1;i++){
        if(t[i] == t[i+1]){
            t[i+1] = '-';
            ans++;
        }
    }

    if(k < 3){
        cout << ans << endl;
    }else{

        int cnt = 0;
        for(int i = 0;i < s.size();i++){
            if(t[i + s.size()] == '-') cnt++;
        }

        cout << ans + cnt * (k-3) << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
  string s;
  cin>>s;
  if(s=="oxx"||s=="xox"||s=="xxo"){
    cout<<800;
  }
  else if(s=="oox"||s=="oxo"||s=="xoo"){
    cout<<900;
  }
  else if(s=="ooo"){
    cout<<1000;
  }
  else if(s=="xxx"){
    cout<<700;
  }
}

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

ll n;
ll dp[105][11];
int main(){
    cin >> n;
    vector<ll> vec={3ll,3ll,1ll,3ll,3ll,0ll,0ll,0ll,1ll,1ll,1ll};
    rp(i,11){
        dp[2][i]=vec.at(i);
    }
    for(ll i=3ll; i<=n; i++){
        //cout << "here" << endl;
        dp[i][10]=dp[i-1][9]+dp[i-1][4];
        dp[i][9]=dp[i-1][10]+dp[i-1][7]+dp[i-1][6]+dp[i-1][3];
        dp[i][8]=dp[i-1][4];
        dp[i][7]=dp[i-1][10];
        dp[i][6]=dp[i-1][2];
        dp[i][5]=dp[i-1][10];
        dp[i][4]=dp[i-1][9]+dp[i-1][8]+dp[i-1][5]+dp[i-1][4]+dp[i-1][2]+dp[i-1][1]+dp[i-1][0];
        dp[i][3]=dp[i-1][7]+dp[i-1][6]+dp[i-1][5]+dp[i-1][3]+dp[i-1][1]+dp[i-1][0];
        dp[i][2]=dp[i-1][9]+dp[i-1][4];
        dp[i][1]=dp[i-1][8]+dp[i-1][3]+dp[i-1][2]+dp[i-1][1]+dp[i-1][0];
        dp[i][0]=dp[i-1][8]+dp[i-1][7]+dp[i-1][6]+dp[i-1][5]+dp[i-1][3]+dp[i-1][2]+dp[i-1][1]+dp[i-1][0];
        for(int j=0;j<11;j++){
            dp[i][j] %= 1000000007ll;
        }
    }
    ll ans=0;
    rp(i,11){
        ans += dp[n][i];
    }
    ans %= 1000000007;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/
 
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x
 
using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;
 
const ll MODBASE = 1000000007LL;
const int MAXN = 11;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;

int n, m, k, now[MAXN], tmp[MAXN];
char ch[MAXN][MAXM];
bool cut[MAXN];

int solve(int mask) {
    int res = 0;
    FOR(i,1,n-1)
        if (mask & (1<<(i-1))) {
            cut[i] = true;
            res++;
        }
        else cut[i] = false;
    FOR(i,1,n) now[i] = 0;
    FOR(j,1,m) {
        FOR(i,1,n) tmp[i] = now[i];
        FOR(i,1,n)
            if (ch[i][j] == '1') tmp[i]++;
        
        int sum = 0;
        bool co = true;
        FOR(i,1,n) {
            sum += tmp[i];
            if (sum > k) {
                co = false;
                break;
            }
            if (cut[i]) sum = 0;
        }

        if (co) {
            FOR(i,1,n) now[i] = tmp[i];
        }
        else {
            res++;
            FOR(i,1,n)
                if (ch[i][j] == '1') now[i] = 1;
                else now[i] = 0;
            co = true;
            sum = 0;
            FOR(i,1,n) {
                sum += now[i];
                if (sum > k) {
                    co = false;
                    break;
                }
                if (cut[i]) sum = 0;
            }
            if (!co) return 1000000000;
        }
    }
    return res;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n >> m >> k;
    FOR(i,1,n)
        FOR(j,1,m) cin >> ch[i][j];
    int res = 1000000000;
    FOR(mask,0,(1<<(n-1))-1) res = min(res, solve(mask));
    cout << res;
    return 0;
}


Measured memory_bytes: 256
m,i,j,k,c[];main(n){for(;scanf("%d%d",&n,&m)*n;printf("%d\n",j>m?i:j)){for(k=-3;k++;)for(scanf("%d",&i);j=i--;c[n-j]=k)scanf("%d",&j);for(i=n;i--;k-=c[i])j+=pow(3,i)*abs(k*2%4+c[i]);j=fmin(j,pow(3,n)+~j);}}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>

int main(int argc, char** argv) {
  int a, b, c;
  std::cin >> a >> b >> c;
  
  auto minmax = std::minmax({a,b,c});
  auto min = minmax.first;
  auto max = minmax.second;
  auto mid = a + b + c - min - max;
  
  auto cost = 0;
  cost += mid - min;
  cost += max - mid;
  std::cout << cost << std::endl;
  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    ll A, B, K;
    cin >> A >> B >> K;

    ll i = 0;
    while(A + i <= B && A + i < A + K) {
        print(A + i);
        ++i;
    }

    ll b1 = A + i;
    for(int j = max(b1, B - K + 1); j <= B; ++j) {
        print(j);
    }
}


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

int main()
{
 	int incode;
  
	cin >> incode;
  	int a[4];
  	a[0] = incode / 1000;
  	incode -= a[0] * 1000;
  	a[1] = incode / 100;
  	incode -= a[1] * 100;
  	a[2] = incode / 10;
  	incode -= a[2] * 10;
  	a[3] = incode;
  
  	if (a[0] == a[1]) {
      cout << "Bad" << endl;
    }
  	else if (a[1] == a[2]) {
      cout << "Bad" << endl;
    }
   	else if (a[2] == a[3]) {
      cout << "Bad" << endl;
    }
  	else {
      cout << "Good" << endl;
    }
 
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bitset>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <regex>
using namespace std;
using ll = long long int;
using dd = long double;
const ll MOD = 1e9 + 7;

vector<string> dfs(string s, ll depth, vector<char> symbol)
{
    vector<string> ret;
    if (depth == 0)
    {
        ret.push_back(s);
        return ret;
    }

    for (ll i = 0; i < symbol.size(); i++)
    {
        auto vec = dfs(s + symbol[i], depth - 1, symbol);
        for (auto &&e : vec)
        {
            ret.push_back(e);
        }
    }
    return ret;
}

ll gcd(ll a, ll b)
{
    if (a % b == 0)
    {
        return b;
    }
    return gcd(b, a % b);
}

int main()
{
    ll X;
    cin >> X;

    cout << (X == 7 || X == 5 || X == 3 ? "YES" : "NO") << endl;
}

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

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

    }
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<=2; j++)
        {
            if(i>0)
            {
                if(j==0)
                    dp[i][j]+=max(dp[i-1][j+1],dp[i-1][j+2]);
                else if(j==1)
                    dp[i][j]+=max(dp[i-1][j-1],dp[i-1][j+1]);

                else if(j==2)
                    dp[i][j]+=max(dp[i-1][j-1],dp[i-1][j-2]);
            }
        }
    }
    cout<<max(max(dp[n-1][0],dp[n-1][1]),dp[n-1][2]);


}





Measured memory_bytes: 5532
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;

/*BigInteger
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/rational.hpp>
namespace xxx = boost::multiprecision;
using Bint = xxx::cpp_int;
using Real = xxx::number<xxx::cpp_dec_float<1024>>;
*/

#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0LL, sizeof(x))
#define mm(x) memset((x), -1LL, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;

// bit_macro
#define Bit(n) (1LL << (n))
#define Bitset(a, b) (a) |= (1LL << (b))
#define Bitunset(a, b) (a) &= ~(1LL << (b))
#define Bitcheck(a, b) ((((a) >> (b)) & 1LL) == 1LL)
#define Bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
constexpr int INF = (int)1e18;
constexpr int MOD = (int)1e9 + 7;
constexpr double PI = (double)acos(-1);
constexpr double EPS = (double)1e-10;
constexpr int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
constexpr int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
} Accelerate_Cin;

signed main() {
  int X, Y;
  cin >> X >> Y;
  if (X % Y == 0) {
    cout << -1 << endl;
    return 0;
  }

  for (int i = X; i <= 1e18; i += X) {
    if (i % Y != 0) {
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}


Measured memory_bytes: 256
# 根付き木に対して根から最大でどれだけかかるかを使う方法

import sys
sys.setrecursionlimit(1000000000)
input = sys.stdin.readline
n, m = map(int, input().split())
co = [[] for i in range(n)] # 有効辺の向きを逆にした
for i in range(m):
    a, b = map(int, input().split())    
    co[b - 1].append(a - 1)

dp = [-1] * n

def memo(v):
    if dp[v] != -1: #更新済
        return dp[v]

    for i in co[v]:
        x = memo(i) + 1
        if x > dp[v]:
            parent[v] = i + 1
            dp[v] = x

    return max(dp[v], 0)
# 経路復元
parent = [0] * n


ans = 0
for i in range(n):
    ans = max(ans, memo(i))

print(ans)

Measured memory_bytes: 194100
#include <cstdio>
#include <map>
using namespace std;
typedef map<int,int>mii;
int d[999],n,m,a,b,i,x;
map<int,mii>z;
int D(int c){
	if(d[c]>=0)return d[c];
	int i=0,x=0;
	mii::iterator it=z[c].begin();
	for(;it!=z[c].end();it++){
		x=max(x,D(it->first)+it->second);
	}
	return d[c]=x;
}
main(){
	for(scanf("%d%d",&n,&m);i<m;i++)scanf("%d%d%d",&a,&b,&x),z[b][a]=x;
	for(i=1;i<n;i++)d[i]=-1;
	printf("%d\n",D(n-1));
}

Measured memory_bytes: 1124
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
int main() {
  int N;
  cin >> N;
  int digits;
  int ans = 0;
  
  for(int i=1;i<=N;i++){
	digits = 0;
    int a = i;
    while(a>0){
      digits++;
      a /= 10;
    }
    if(digits%2 ==1){
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

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

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

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>Set;
typedef tree<int,int,less<int>,rb_tree_tag,tree_order_statistics_node_update> Map;

#define ipow(a,b)+0.5 (int)pow(a,b)
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define fi first
#define se second
#define pll pair<ll,ll>
#define ook order_of_key
#define findby find_by_order

#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,a,b) for(int i=a;i<=b;i++)

template<typename X> inline X abs(const X& a) { return (a < 0 ? -a : a); }
template<typename X> inline X sqr(const X& a) { return (a * a); }

const ld EPS = ld(1e-9);
const ld PI = ld(3.141592653589);

class Task
{
public:
    void solve(istream& in,ostream& out)
    {
          int a,b;
          in>>a>>b;
          out<<(a+b)%24<<endl;
    }
};


int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	Task solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in,out);
	out.flush();

    return 0;
}





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

def yakusu(n):
    L=[]
    for i in range(1,int(n**0.5)+1):
        if n%i==0:
            if i not in L:
                L.append(i)
            if n//i not in L:
                L.append(n//i)
    return len(L)

c=0            
for i in range(1,n+1,2):
    if yakusu(i)==8:
        c+=1

print(c)

Measured memory_bytes: 3316
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
	public static void main(String[] args) {
		try (Scanner scn = new Scanner(System.in)) {
			final int N = scn.nextInt();
			//final int[] A = IntStream.generate(scn::nextInt).limit(N).toArray();

			System.out.println(1 /
					IntStream.generate(scn::nextInt).limit(N)
							.mapToDouble(d -> 1.0 / d)
							.reduce((a, b) -> a + b)
							.getAsDouble());
		}
	}
}


Measured memory_bytes: 29012
#include <iostream>
#include <cstdio>

auto main () -> int
{
    int amida [31];
    
    int w;
    std::cin >> w;
    for (auto i = 1; i <= w; ++ i)
    {
        amida [i] = i;
    }

    int n;
    std::cin >> n;
    for (auto i = 0; i < n; ++ i)
    {
        int a , b;
        std::scanf ("%d,%d" , & a , & b);
        std::swap (amida [a] , amida [b]);
    }

    for (auto i = 1; i <= w; ++ i)
    {
        std::cout << amida [i] << std::endl;
    }
}

Measured memory_bytes: 3148
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K, x, sum = 0;
    cin >> N >> K;
  
    for (int i = 0; i < N; i++) {
      cin >> x;
      int d = abs(K - x);
      if (x < d) sum += x;
      else sum += d;
    }
  
  sum *= 2;
  cout << sum;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define pli pair<ll, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template<typename T, typename U> T pow_(T a, U b) { return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<class T> ostream& operator << (ostream& os, const set<T>& s) { for (auto e : s) os << e << " "; return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { (a += b % mod) %= mod; if (a < 0) a += mod; }
template<class T> void operator += (vector<T>& v, vector<T> v2) { rep(i, sz(v2)) v.eb(v2[i]); }


void solve();

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(12); // debuged
  int T;
  T = 1;
  while (T--) solve();
}

void solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  if (n % 2 == 0 && s.substr(0, n / 2) == s.substr(n / 2, n / 2)) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 3676
#include <stdio.h>

int nums[105][105];
int oth[105];

int main() {
#ifdef TEST
    freopen("input", "r", stdin);
#endif

    int a, b;
    scanf("%d %d", &a, &b);
    for(int i = 0; i < a; ++i) {
        for (int j = 0; j < b; ++j) {
            scanf("%d", &nums[i][j]);
        }
    }

    for (int k = 0; k < b; ++k) {
        scanf("%d", &oth[k]);
    }

    for (int l = 0; l < a; ++l) {
        int sum = 0;
        for (int i = 0; i < b; ++i) {
            sum += nums[l][i] * oth[i];
        }
        printf("%d\n", sum);
    }
    return 0;
}



Measured memory_bytes: 2120
#include "bits/stdc++.h"

using namespace std;

#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define debug(x) cerr << #x << " == " << (x) << '\n';
#define all(X) (X).begin(), (X).end()
#define sz(X) (int)X.size()

using ll = long long;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;

template<typename T>
struct SegmentTree
{
private:
    const int n; const T Tid;
    vector<T> st;
    T combine(T l, T r) { return max(l, r); }
public:
    SegmentTree(int n, T Tid) : n(n), Tid(Tid) { st.assign(2 * n, Tid); }
    void modify(int p, T value)
    {
        for (st[p += n] = value; p > 1; p >>= 1)
            st[p >> 1] = combine(st[p & ~1], st[p | 1]);
    }
    T query(int l, int r) // inclusive
    {
        T resl = Tid, resr = Tid;
        for (l += n, r += n + 1; l < r; l >>= 1, r >>= 1)
        {
            if (l & 1) resl = combine(resl, st[l++]);
            if (r & 1) resr = combine(st[--r], resr);
        }
        return combine(resl, resr);
    }
};

int main()
{ _
    int n, k; cin >> n >> k;
    vector a(n, 0);
    for (int i = 0; i < n; ++i) cin >> a[i];

    const int N = 3e5;
    SegmentTree st(N + 1, 0);

    int ans = 0;
    for (int i = 0; i < n; ++i)
    {
        int l = max(0, a[i] - k), r = min(N, a[i] + k);
        int cur = 1 + st.query(l, r);
        ans = max(ans, cur);
        st.modify(a[i], cur);
    }
    cout << ans << endl;

    exit(0);
}



Measured memory_bytes: 7172
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
using namespace std;
typedef long long LL;

string s,t;

int main(){
	ios::sync_with_stdio(false);
	cin >> s >> t;
	cout << t + s << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<iomanip>
#define ll long long int
using namespace std;

void solve();

int main() {

   solve();

   return 0;
}

void solve() {

   ll in;
   ll h,m,s;
   char c=':';

   cin >> in;

   h=in / 3600;
   m=(in / 60) % 60;
   s=in % 60;

   cout << h << c << m << c << s << endl;

}

Measured memory_bytes: 3084
import sys
input = sys.stdin.readline


def get_key(item):
    return item[1]

def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = []

    for (k, v) in enumerate(A):
        B.append((k,v))

    B = sorted(B, key=get_key)
    B = [i[0]+1 for i in B]

    print(*B)


if __name__ == '__main__':
    main()


Measured memory_bytes: 68828
n=int(input())
a=list(map(int,input().split()))
maxa=max(a)
mina=min(a)
if abs(mina)<=abs(maxa):
  idx=a.index(maxa)
  print(2*(n-1))
  pre=idx+1
  for i in range(1,n):
    print(pre,i+1)
    print(pre,i+1)
    pre=i+1
elif abs(mina)>abs(maxa):
  idx=a.index(mina)
  print(2*(n-1))
  pre=idx+1
  for i in range(n-1,0,-1):
    print(pre,i)
    print(pre,i)
    pre=i
    


Measured memory_bytes: 62484
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
	int n,m;
	while(1){
		cin >> n >> m;
		vector<pair<int,int> > data;
		if(n==0&&m==0) break;
		REP(i,n){
			int tmp1,tmp2;
			cin >> tmp1 >> tmp2;
			data.pb(make_pair(tmp2,tmp1));
		}
		sort(All(data));
		ll int ans = 0;
		for(int i=n-1;i>=0;i--){
			if(m>data[i].second) m-=data[i].second;
			else if(m<=data[i].second){
				ans+= (data[i].second-m)*data[i].first;
				m = 0;
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 1320
import java.util.ArrayDeque;
import java.util.HashMap;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;

public class Main {

    static Map<State, Queue<String>> Qmap = new HashMap<>();
    static {
        Qmap.put(State.A, new ArrayDeque<>());
        Qmap.put(State.B, new ArrayDeque<>());
        Qmap.put(State.C, new ArrayDeque<>());
    }
    static State CURRENT_STATE = State.A;

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String sa = scan.next();
        String sb = scan.next();
        String sc = scan.next();

        addToQueue(State.A, sa);
        addToQueue(State.B, sb);
        addToQueue(State.C, sc);

        while (true) {
            String elm = poll();
            // System.err.printf("state:%s poll:%s\n", CURRENT_STATE, elm);
            changeQueueState(elm);

            if (isEnd()) {
                System.out.println(CURRENT_STATE);
                break;
            }
        }
    }

    /**
     * 操作するキューオブジェクトを引数のオブジェクト名の対象に変更する
     */
    private static void changeQueueState(String elm) {
        CURRENT_STATE = State.getEnum(elm);
    }

    /**
     * 現在の参照キューが空かどうかを判定する
     */
    private static boolean isEnd() {
        return Qmap.get(CURRENT_STATE).isEmpty();
    }

    /**
     * 現在の参照キューから値をpollする
     */
    private static String poll() {
        return Qmap.get(CURRENT_STATE).poll();
    }

    /**
     * 入力文字を属性に応じたキューに追加する。
     */
    private static void addToQueue(State state, String s) {
        Queue<String> queue = Qmap.get(state);
        for (int i = 0; i < s.length(); i++) {
            queue.add(String.valueOf(s.charAt(i)));
        }
    }

    /**
     * どのキューを参照しているかを示す為の文字列属性
     */
    enum State {
        A, B, C;
        public static State getEnum(String s) {
            for (State state : State.values()) {
                if (state.name().toLowerCase().equals(s)) {
                    return state;
                }
            }
            throw new IllegalArgumentException();
        }
    }
}


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

namespace _0358
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Console.WriteLine(x[0] + x[1] >= x[2] ? Math.Max(x[2] - x[0],0).ToString() : "NA");
        }
    }
}

Measured memory_bytes: 9576