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

using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr int inf = 1<<30;
constexpr int mo = 1e9+7;
constexpr ll infl = 1ll<<60;

int n;
vector<int> p;
vector<int> prime(){
    vector<int> ret;
    vector<bool> v(55555,true);
    v[0] = v[1] = true;
    for(int i=2;i<=55555;++i)if(v[i]){
        if(i%5 == 1)ret.push_back(i);
        for(int j=2*i;j<=55555;j+=i){
            v[j] = false;
        }
    }
    return ret;
}
vector<int> sol(){
    vector<int> v;
    p = prime();
    vector<int> ret;
    for(int i=0;i<n;++i){
        ret.push_back(p[i]);
    }
    return ret;
}
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    cin>>n;
    auto ret = sol();
    for(int i=0;i<(int)ret.size();++i){
        if(i)cout << " ";
        cout << ret[i];
    }
    return 0;
}

Measured memory_bytes: 3620
// https://atcoder.jp/contests/abc076/tasks/abc076_b

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

int main()
{
  /* Magic word */
  // cin.tie(0);
  // ios::sync_with_stdio(false);
  /* ---------- */

  int n, k, c = 1;

  cin >> n >> k;

  REP(i, n)
  {
    if (c * 2 < c + k)
      c *= 2;
    else
      c += k;
  }

  cout << c << '\n';

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x) cout<<#x<<" = "<<(x)<<endl;
#define Yes(x) cout<<(x?"Yes":"No")<<endl;
#define YES(x) cout<<(x?"YES":"NO")<<endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  int n,k; cin >> n >> k;
  int h[n]; REP(i,n) cin >> h[i];
  sort(h,h+n);

  int ans = INF;
  REP(i,n-k+1) {
    int d = h[i+k-1] - h[i];
    ans = min(ans, d);
  }
  COUT(ans);
  return 0;
}

Measured memory_bytes: 640
N,M=list(map(int,input().split()))
pref=[]
flag=[0*i for i in range(M)]
ans=0
for i in range(N):
  pref.append(list(map(int,input().split())))
for j in range(N):
  for k in range(1,pref[j][0]+1):
    flag[pref[j][k]-1] += 1

for l in range(len(flag)):
  if flag[l] == N: ans += 1
  else: pass
  
print(ans)

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

#define PI 4*atan(1)
#define INF 1e8

int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};

int main(){
  int N, P;
  cin >> N >> P;
  vector<int> A(N);
  int odd = 0, even = 0;
  for(int i = 0; i < N; i++){
    cin >> A[i];
    if(A[i] % 2 == 0)even++;
    else odd++;
  }
  unsigned long long ans = 1;
  if(P == 1){
    if(odd == 0){
      cout << 0 << endl;
      return 0;
    }
    for(int i = 0; i < even + odd - 1; i++){
      ans *= 2;
    }
  }else{
    if(even == 0 && odd < 2){
      cout << 0 << endl;
      return 0;
    }
    if(odd == 0){
      for(int i = 0; i < N; i++){
        ans *= 2;
      }
    }else{
      for(int i = 0; i < even + odd - 1; i++){
        ans *= 2;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
//const int inf =0x3f3f3f3f;
//struct node{
//	int cost;
//	int weight;
//}p[1010];
//int dp[10010] ;
//int n,m;
int main()
{
//	scanf("%d%d",&n,&m);
//	
//	
//	printf("%d %d\n",fg,jg);
	string s;
	cin >> s;
	int f=0;
	for(int i=0;i<s.size();i++) {
		if(i%2==0&&(s[i]=='R'||s[i]=='U'||s[i]=='D'))  f=1;
		else if(i%2==1&&(s[i]=='L'||s[i]=='U'||s[i]=='D')) f=1;
		else { 
			f=0;
			break;
		}
	}
	if(f) cout <<"Yes" <<endl;
	else cout <<"No" <<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
#define PI 3.14159265358979323846264338327950L
int main( )
{
	int a,b,h,m;
	cin>>a>>b>>h>>m;
    ld rad = PI * 2 * (
            (ld)h / 12.0 + ((ld)m / 60.0) / 12.0 - (ld)m / 60.0);

    ld rsq = ( ld)(a * a + b * b) - (ld)(2 * a *b) * cosl(rad);


    printf("%20.20Lf\n", sqrtl(rsq));
}


Measured memory_bytes: 4160
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#define rep(i,a,b) for (int i = (a); i < (b); i++)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const int inf = 2e9;

ll mpow(ll a, ll b) {
	ll res = 1;
	a %= mod;
	while (b) {
		if (b & 1) res = res * a % mod;
		a = a * a % mod;
		b >>= 1;
	}
	return res;
}
vector<int> fac, finv;
void factor(int N) {
	fac.resize(N); finv.resize(N);
	fac[0] = finv[0] = 1;
	rep(i, 1, N)fac[i] = 1LL * fac[i - 1] * i % mod;
	finv[N - 1] = mpow(fac[N - 1], mod - 2);
	for (int i = N - 2; i; --i) finv[i] = 1LL * finv[i + 1] * (i + 1) % mod;
}
int nCr(int n, int m) {
	if (m < 0 || n < m) return 0;
	return 1LL * (1LL * fac[n] * finv[m] % mod) * finv[n - m] % mod;
}


int main() {
	int n, a, b, c, d; cin >> n >> a >> b >> c >> d;
	factor(200010);
	vector<vector<ll>> dp(n+10);
	rep(i, 0, n + 10) dp[i].resize(n + 10, 0);
	dp[0][0] = 1;
	rep(i, 0, n + 1)rep(j, 0, b - a + 2) {
		int idx = a + j;
		dp[i][j + 1] = (dp[i][j + 1] + dp[i][j]) % mod;
		rep(k, c, d + 1) {
			int sum = idx * k + i;
			if (sum > n) break;
			ll base = nCr(n - i, idx * k);
			base = (1LL * base * fac[idx * k]) % mod;
			base = (1LL * base * mpow(finv[idx], k)) % mod;
			base = (1LL * base * finv[k]) % mod;
			dp[sum][j + 1] = (dp[sum][j + 1] + (dp[i][j] * base) % mod) % mod;
		}
	}
	printf("%lld", dp[n][b - a + 1]);
	return 0;
}


Measured memory_bytes: 9856
import sys
input = sys.stdin.readline
import math

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

N = int(input())
divisors = make_divisors(N)
ans = 11
for i in range(0, len(divisors), 2):
    d1 = int(math.log10(divisors[i]))+1
    d2 = int(math.log10(divisors[i+1]))+1
    ans = min(ans, max(d1, d2))
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <limits.h>	
#define inf INT_MAX
#define INF 9223372036854775807
#define rep(i,n) for(i=0;i<n;i++)

int in(void){
	int i;scanf("%d",&i);
	return i;
}
long long llin(void){
	long long i;scanf("%lld",&i);
	return i;
}
void chin(char s[]){
	scanf("%s",s);
}
void print(int a){
	printf("%d\n",a);
}
void llprint(long long a){
	printf("%lld\n",a);
}
void print2(int a,int b){
	printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
	return a>b?a:b;
}
long long min(long long a,long long b){
	return a<b?a:b;
}

int main(void){
	int h=in(),w=in(),i;
	char s[100][101];
	rep(i,h){
		chin(s[i]);
	}
	rep(i,w+2){
		printf("#");
	}
	puts("");
	rep(i,h){
		printf("#");
		printf("%s",s[i]);
		puts("#");
	}
	rep(i,w+2){
		printf("#");
	}
	puts("");
	return 0;
}

Measured memory_bytes: 128
/*  -*- coding: utf-8 -*-
 *
 * e.cc: E - All-you-can-eat
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 3000;
const int MAX_T = 3000;
const int MAX_A = 3000;
const int MAX_M = MAX_T + MAX_A;

/* typedef */

typedef pair<int,int> pii;

/* global variables */

pii ps[MAX_N];
int dp[MAX_M];

/* subroutines */

inline void setmax(int &a, int b) { if (a < b) a = b; }

/* main */

int main() {
  int n, t;
  scanf("%d%d", &n, &t);

  for (int i = 0; i < n; i++)
    scanf("%d%d", &ps[i].first, &ps[i].second);
  sort(ps, ps + n);
  int maxa = ps[n - 1].first;

  memset(dp, -1, sizeof(dp));
  dp[0] = 0;
  
  for (int i = 0; i < n; i++) {
    int &a = ps[i].first, &b = ps[i].second;

    for (int j = t - 1; j >= 0; j--)
      if (dp[j] >= 0) setmax(dp[j + a], dp[j] + b);
  }

  int maxd = 0;
  for (int i = t + maxa - 1; i >= 0; i--) setmax(maxd, dp[i]);

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


Measured memory_bytes: 256
#include<cstdio>
int main() {
	char a[6] = "aeiou", c;
	scanf("%c", &c);
	for (int i = 0; i < 5; i++) {
		if (a[i] == c) {
			printf("vowel");
			return 0;
		}
	}
	printf("consonant");
	return 0;
}

Measured memory_bytes: 128
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))
const int MOD = 1e9 + 7;

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

ll fact[100005];

ll mypow(ll a, ll p){
	if(p == 0) return 1;
	if(p == 1) return (a % MOD);
	if(p & 1) return ((a % MOD) * (mypow(a, p - 1) % MOD)) % MOD;
	ll x = mypow(a, p / 2) % MOD;
	return (x * x) % MOD;
}

ll inv(ll base){
	return mypow(base, MOD - 2);
}

ll choose(ll a, ll b){
	ll ret = fact[a] * inv((fact[b] * fact[a - b]) % MOD);
	return (ret % MOD);
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	ll n, k;
	cin >> n >> k;
	vector<ll> a(n);
	rep(i, n) cin >> a[i];
	fact[0] = 1LL;
	for(ll i = 1; i < 100005; i++) fact[i] = ((fact[i - 1] * i) + MOD) % MOD;
	sort(all(a));
	ll ans = 0;
	for(ll i = 0; i < n; i++){
		if(i >= (k - 1)){
			ans = (ans + (((a[i] * choose(i, k - 1)) + MOD) % MOD) + MOD) % MOD;
		}
	}
	for(ll i = 0; i < n; i++){
		if(i <= (n - k)){
			ans = (ans - (((a[i] * choose(n - i - 1, k - 1) + MOD) % MOD)) + MOD) % MOD;
		}
	}
	cout << (ans + MOD) % MOD << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/

Measured memory_bytes: 1792
s=input()
ans=[0 for i in range(len(s))]
rnow=0
lnow=0

for i in range(len(s)):
    if s[i]=="R":
        rnow+=1
        if lnow>0:
            ans[i-lnow-1]+=lnow//2
            ans[i-lnow]+=lnow//2+lnow%2
            lnow=0
    
    if s[i]=="L":
        lnow+=1
        if rnow>0:
            ans[i-1]+=rnow//2+rnow%2
            ans[i]+=rnow//2
            rnow=0


#print(rnow,lnow,i)
i+=1
rnow+=1
if lnow>0:
    ans[i-lnow-1]+=lnow//2
    ans[i-lnow]+=lnow//2+lnow%2
    lnow=0

answer=[str(i) for i in ans]
print(" ".join(answer))

Measured memory_bytes: 10876
N = int(input())
d = {}
for i in range(N):
  s = input()
  if s in d:
    d[s] += 1
  else:
    d[s] = 1
M = int(input())
for i in range(M):
  s = input()
  if s in d:
    d[s] -= 1
  else:
    d[s] = -1
l = []
for thisKey in d:
  l.append(d[thisKey])
if max(l) >= 0:
  print(max(l))
else:
  print(0)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<(n);++i)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
double N,A;

signed main(){
  cin >> N;
  double mother=0,child=0;
  rep(i,N){
    cin >> A;
    mother+=1/A;
  }
  child=1/mother;
  printf ("%.5f\n", child) ;
  return 0;
}


Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
# include <bitset>
# include <random>
# include <chrono>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
typedef pair<LL, LL> P;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
# define ALL(x)      (x).begin(),(x).end()
# define UNIQ(c)     (c).erase(unique(ALL((c))),(c).end())
# define mp          make_pair
# define eb          emplace_back
# define FOR(i,a,b)  for(int i=(a);i<(b);i++)
# define RFOR(i,a,b) for(int i=(a);i>=(b);i--)
# define REP(i,n)    FOR(i,0,n)
# define INIT        std::ios::sync_with_stdio(false);std::cin.tie(0)

int h[5050], p[5050], a[5050];
int n;
LL dp[5050];
int compare(int k1, int k2) {
	return h[k1] + p[k1] < h[k2] + p[k2];
}

int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> h[i] >> p[i];
	}
	for (int i = 1; i <= n; i++) a[i] = i;
	sort(a + 1, a + n + 1, compare);
	REP(i, 5050)dp[i] = LINF;
	dp[0] = 0;
	for (int i = 1; i <= n; i++)for (int j = n; j >= 0; j--)if (dp[j] <= h[a[i]]) dp[j + 1] = min(dp[j + 1], dp[j] + p[a[i]]);
	int ans = 0;
	for (int i = 1; i <= n; i++) if (dp[i] < HLINF) ans = i;
	cout << ans << endl;
}

Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main(){
  char math[60][60];
  int H,W;

  cin >> H >> W;

  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin >> math[i][j];
    }
  }
  int s_check=0;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      char temp=math[i][j];
      if(temp=='#'){
        int check=0;
        if((j+1)<W){if(temp==math[i][j+1]) check++;} 
        if((i+1)<H){if(temp==math[i+1][j]) check++;} 
        if((i-1)>=0){if(temp==math[i-1][j]) check++;} 
        if((j-1)>=0){if(temp==math[i][j-1]) check++;} 
        if(check==0){
          cout << "No" << endl;
          return 0;
        }
      }
    }
  }
  cout << "Yes" <<endl;
  return 0;
}






Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  int c = b-a;
  int sum = 0;
  for(int i = c; i>0; i-- ){
    sum += i;
  }
  cout << sum - b << endl;
  return 0;
}


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

int main(void) {
    int n;
    while (cin >> n) {
        if (n == 0) break;

        vector<vector<int> > masu(n);
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                masu[i].push_back(0);
            }
        }

        int num = 2;
        int dx = n/2+1, dy = n/2;
        masu[dx][dy] = 1;
        while (num <= n*n) {
            dx = (dx+1)%n; dy = (dy+1)%n;
            if (masu[dx][dy] == 0) {
                masu[dx][dy] = num;
            } else {
                do {
                    dx = (dx+1)%n;
                    dy--; if (dy == -1) dy = n-1;
                    if (masu[dx][dy] == 0) {
                        masu[dx][dy] = num;
                    }
                } while (masu[dx][dy] != num);
            }
            num++;
        }

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                cout << right << setw(4) << masu[i][j];
            }
            cout << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 1232
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>

using namespace std;
#define vsort(v) sort(v.begin(), v.end());
#define vunique(v) unique(v.begin(), v.end());

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

	int X, t;
	cin >> X >> t;
	if(X >= t) cout << X - t << endl;
	if(X < t) cout << 0 << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<math.h>
#include<bitset>
#include<tuple>
#include<time.h>
#include<list>

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)

typedef long long i64;
typedef pair<i64,i64> P;

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 n, a[202020], b[202020];
P p[202020];
void solve(){
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> a[i] >> b[i];
		p[i] = P(b[i],a[i]);
	}
	sort(p,p+n);
	i64 cnt = 0;
	for(int i = 0; i < n; i++){
		cnt += p[i].second;
		if(cnt > p[i].first){
			cout << "No" << endl;
			return;
		}
	}
	cout << "Yes" << endl;
}

int main(){
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 4992
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
int main(){
	int n,m,c,ans=0;
	cin >>n>>m>>c;
	vector<int>b(m);
	rep(i,m)
		cin>>b[i];
	rep(i,n){
		int tmp=0;
		vector<int>a(m);
		rep(j,m)
			cin >>a[j];
		rep(j,m){
			tmp+=a[j]*b[j];
		}
		ans+= tmp+c>0 ? 1:0;
	}
	cout <<ans<<endl;
}

Measured memory_bytes: 256
N = int(input())
num = [[]for _ in range(N)]
for i in (range(N-1)):
  a, b = map(int, input().split())
  num[a-1].append([i, b-1])
answer = [0] * (N-1)
color = [-1] * (N)
max_num = 0
for i in range(len(num)):
  if max_num <= len(num[i]):
    if i == 0:
      max_num = len(num[i])
    else:
      max_num = len(num[i]) + 1
  c = 1
  for j in range(len(num[i])):
    if c == color[i]:
      c += 1
    answer[num[i][j][0]] = c
    color[num[i][j][1]] = c
    c += 1
print(max_num)
for i in answer:
  print(i)
  

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

int main(){
    while(1){
        int h,w;
        cin >> h >> w;
        if(h==0) break;
        
        for(int i=1; i<=h; i++){
            for(int j=1; j<=w; j++){
                if(i==1 || j==1 || i==h || j==w){
                    cout << "#";
                }else{
                    cout << ".";
                }
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}

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

long long n, a, b;
vector<long long> H(100010);

bool binary_search(long long x){
    long long t = 0;
    for(int i = 0; i < n; i++){
        if(H[i] - b * x > 0){
            t += (H[i] - b * x + a - b - 1) / (a - b);
        }
    }
    if(t <= x) return true;
    else return false;
}

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

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

    long long ng = 0, ok = 1e9, mid;
    while(ok - ng > 1){
        mid = (ok + ng) / 2;
        if(binary_search(mid)){
            ok = mid;
        }else{
            ng = mid;
        }
    }

    cout << ok << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <climits>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
//typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define revrep(i, n) for(ll i = (n)-1; i >= 0; i--)
#define pb push_back
#define f first
#define s second
#define chmin(x, y) x = min(x, y);
#define chmax(x, y) x = max(x, y);

//const ll INFL = LLONG_MAX;//10^18 = 2^60
const ll INFL = 1LL<<60;
//const int INF = INT_MAX;
const ll INF = 1 << 30;//10^9
ll MOD = 1000000007;
//ll MOD = 998244353;

vector<ll> dy = {0, 1, 0, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, 0, -1, 0, 1, -1, 1, -1, 0};

void pres(double A, ll x = 10){cout << fixed << setprecision(x) << A << endl;}
void BinarySay(ll x, ll y = 60){rep(i, y) cout << (x>>(y-1-i) & 1); cout << endl;}
ll cnt_bit(ll x){return __builtin_popcountll(x);}

ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x; k /= 2;
  }
  return res;
}

ll pow_mod(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}

ll inverse(ll x){return pow_mod(x, MOD - 2);};

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

ll lcm(ll x, ll y){
  ll res = x / gcd(x, y);
  res *= y;
  return res;
};

//コンビネーション
const int MAXcomb = 200010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAXcomb; i++){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
ll comb(int n, int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * finv[k] % MOD * finv[n-k] % MOD;
}

const int MAXkai = 200010;
ll kai_memo[MAXkai];
ll kai(ll N){
  if(kai_memo[N] != 0) return kai_memo[N];
  if(N <= 1) return 1;
  return kai_memo[N] = N * kai(N-1) % MOD;
}


void solve(){
  set<int> S;
  rep(i, 3){
    int a;
    cin >> a;
    S.insert(a);
  }
  if(S.size() == 2){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


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


Measured memory_bytes: 256
import sys
import math
sys.setrecursionlimit(10**6)

N = int(input())

INF = 10**10

dp = [0]*(N+1)

for i in range(N+1):
    dp[i] = INF
    
W = [1,6,9]

def rec(v):
    if dp[v] < INF:
        return dp[v]
    if v == 0:
        dp[v] = 0
        return 0
    
    # v-n を再帰
    res = INF
    for w in range(3):
        for x in range(int(math.log(N+1,6))+1):
            n = W[w]**x
            if v<n:
                continue
            res = min(res,rec(v-n) + 1)
            # メモして返す
            dp[v] = res
    return res
rec(N)
print(dp[N])

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

int main(){
   
    string S;cin>>S;
    int m=0;
    for(int i=0;i<S.size();i++){
        if(S[i]=='x') m++;
    }
    if(m<=7) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}




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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



string s;
void solve(){
	cin >> s;
	int n = s.size();
	for(int i = n-2; i >= 0; i-=2){
		bool b = 0;
		for(int j = 0; j < i/2; j++){
			if(s[j] == s[j+i/2]) continue;
			b = 1;
			break;
		}
		if(!b){
			cout << i << endl;
			return;
		}
	}
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}


Measured memory_bytes: 256
until(n,m=gets.split.map(&:to_i))==[0,0]do
r,p,a=[],[],[]
n.times{r.unshift(gets.gsub("?",".").split)}
m.times{p<<gets.split}
p.each{|p|r.each{|r|if p[0]=~/#{r[1]}/&&p[1]=~/#{r[2]}/
a<<p*" "if r[0]=~/p/
break
end}}
puts a.size,a
end

Measured memory_bytes: 9444
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
    int i,len;
    int pass = 0;
    char line[100];
    while(1){
        if(scanf("%s",line) == -1)break;
        len = strlen(line);
        for(i = 0; i < len; i++){
            if(line[i] < '0' || line[i] > '9')line[i] = 0;
        }
        for(i = 0; i < len; i++){
            if(line[i]!=0){
                pass += atoi(&line[i]);
                i += strlen(&line[i]);
            }
        }
    }
    printf("%d\n",pass);
    return 0;
}

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

// Shabdan Batyrkulov

using namespace std;

#define MAX 107
#define pb push_back
#define fr first
#define sc second
#define mk make_pair
#define ll long long
#define ld long double

const long long N = (int)1e5 + 7;
const int inf = (int)1e9 + 7;

int main () {
        int a, b, c;
        scanf ("%d %d %d", &a, &b, &c);
        int cnt = 0, sum = 0;
        while (cnt++ < 100000) {
                sum += a;
                if (sum % b == c) {
                        puts("YES");
                        return 0;
                }
        }
        puts("NO");
}


Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "functional"

using namespace std;

//constexpr long long int MOD = 1000000007;
constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;


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

	long double pi = 3.1415926535;
	long double a, b, c;
	cin >> a >> b >> c;
	c /= a;
	long double l = 0;
	long double r = 3.1415926535 / 2;
	for (int loop = 0; loop < 100; loop++) {
		long double mid = (l + r) / 2;
		if (a*sin(mid) > b*sin(pi / 2 - mid)) {
			long double box = b * cos(mid) / sin(mid);
			if (box*b / 2 > c)l = mid;
			else r = mid;
		}
		else {
			long double box = a * sin(mid) / cos(mid);
			if (a*b - box * a / 2 > c)l = mid;
			else r = mid;
		}
	}
	cout <<setprecision(20)<< l * 180 / pi << endl;
}



Measured memory_bytes: 512
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=(b-1);i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

string ntos(long long n) {
  string s;
  stringstream ss;
  ss << n;
  ss >> s;
  return s;
}

int main() {
  string s;
  cin >> s;
  ll d[4];
  rep(i, 0, 4) {
    d[i] = s[i] - '0';
  }
  rep(i, 0, 1 << 3) {
    ll a = d[0];
    rep(j, 0, 3) {
      if (((i >> j) & 1) == 1) {
        a += d[j + 1];
      }
      else {
        a -= d[j + 1];
      }
    }
    if (a == 7) {
      string ans;
      ans += ntos(d[0]);
      rep(j, 0, 3) {
        if (((i >> j) & 1) == 1) {
          ans += "+";
        }
        else {
          ans += "-";
        }
        ans += ntos(d[j+1]);
      }
      ans += "=7";
      cout << ans << endl;
      return 0;
    }
  }
  return 0;
}

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

using lint = long long;
using ll = pair < lint, lint >;

lint a[30];

int main() {
	int n, p;
	scanf("%d%d", &n, &p);
	for (int i = 0; i < n; i++) {
		scanf("%lld", a + i);
	}
	lint b[2];
	b[0] = 1;
	b[1] = 0;
	for (int i = 0; i < n; i++) {
		
		lint b2[2] = { 0,0 };
		if (a[i] & 1LL) {
			b2[0] = b[0] + b[1];
			b2[1] = b[0] + b[1];
		}
		else {
			b2[0] = b[0] + b[0];
			b2[1] = b[1] + b[1];
		}
		b[0] = b2[0];
		b[1] = b2[1];
	}
	printf("%lld\n", b[p & 1]);
	return 0;
}

Measured memory_bytes: 128
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        ArrayList<Point> redList = new ArrayList<>();

        for (int i = 0; i < n; i++) {
            redList.add(new Point(sc.nextInt(), sc.nextInt()));
        }

        ArrayList<Point> blueList = new ArrayList<>();

        for (int i = 0; i < n; i++) {
            blueList.add(new Point(sc.nextInt(), sc.nextInt()));
        }
        sc.close();

        int ans = 0;

        redList.sort(Comparator.comparingInt(a -> a.y));
        blueList.sort(Comparator.comparingInt(a -> a.x));

        for (Point bp : blueList) {
            for (int i = redList.size() - 1; i >= 0; i--) {
                Point rp = redList.get(i);
                if (bp.x > rp.x && bp.y > rp.y) {
                    ans++;
                    redList.remove(rp);
                    break;
                }
            }
        }
        System.out.println(ans);
    }

    private static class Point {
        int x;
        int y;

        public Point(int x, int y) {
            this.x = x;
            this.y = y;
        }
    }
}

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

using i64 = int_fast64_t;
using f64 = double;

constexpr i64 INF = INT_FAST64_MAX / 2;
constexpr f64 EPS = DBL_EPSILON;

void solve() {
    i64 n, k;
    cin >> n >> k;
    cout << n - k + 1 << endl;
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}


Measured memory_bytes: 256
def resolve():
    import math
    n = int(input())
    a = list(set(map(int, input().split())))
    maxa = max(a)

    ggcd = a[0]
    for i in range(1, len(a)):
        ggcd = math.gcd(ggcd, a[i])
        if ggcd == 1:
            break

    pair = False

    c = [0] * (10**6+ 1)
    for i in a:
        c[i] += 1

    for i in range(2, maxa+1):
        cnt = 0
        for j in range(i, maxa+1, i):

            cnt += c[j]
        if cnt > 1:
            pair = True

    if ggcd != 1:
        print("not coprime")
    else:
        if pair:
            print("setwise coprime")
        else:
            print("pairwise coprime")
resolve()

Measured memory_bytes: 245244
n, k = map(int, input().split())
lst = list(map(int, input().split()))

dp = [0] * (k+1) #dp[i]は石の数が残りi個のときに手番プレイヤーが勝利できるか

for i in range(1, k+1):
    flg = 0
    for j in lst:
        if i - j >= 0:
            if not dp[i-j]: #一度でも0(False)があればflg1(True)
                flg = 1
                break
    if flg:
        dp[i] = 1
            
if dp[k]:
    print('First')
else:
    print('Second')

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define itn int

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


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

  ll hoge = n / k;
  ll res = pow(hoge, 3);
  
  if(k % 2 == 0)
  {
    ll tmp = n/k + ((n % k) >= k/2); 
    tmp = pow(tmp, 3);
    res += tmp;
  }

  cout << res << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
typedef pair<int,int> P;

int main(void){
	          int i;

	      	  cin.tie(0);  ios_base::sync_with_stdio(false);
	      	  
	      	  int N,A,B;
	      	  cin >> N >> A >> B;
	      	  
	      	  cout << min(A*N,B) << endl;


	          return 0;
}


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

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

	//素因数分解する
	ll n = N;
	vector<P> vec;//vec[i].first:素因数, second:その素因数の個数
	for(ll i=2; i*i < n; i++){
		ll num = 0;
		while(true){
			if(n%i != 0) break;
			n /= i;
			num++;
		}
		vec.emplace_back(i, num);
	}
	if(n!=1) vec.emplace_back(n, 1);//nが1じゃないならnは素因数となっている(√Nかな)

	// cout << " 素因数分解...:   ";
    // for(int i=0; i<vec.size(); i++){
	// 	for(int j=0; j<vec[i].second; j++){
	// 		cout << vec[i].first << ",  ";
	// 	}
	// }
	// cout << endl;

	ll ans = 0;
	for(int i=0; i<vec.size(); i++){
		ll cnt = 0;
		while(true){
			cnt++;
			if(vec[i].second - cnt < 0) break;
			vec[i].second -= cnt;
			ans++;
		}
	}

	cout << ans << endl;
}

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

int main(){
    int n,price;
    bool flag=false;
    cin >> n;

    for(int i=1; i<=50000; i++){
        if(floor(i*1.08)==n){
            flag=true;
            price=i;
        }
    }
    if(flag) cout << price << endl;
    else cout << ":(" << endl;
}

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;

int dx4[] = {0, 1, 0, -1}, dy4[] = {1, 0, -1, 0};

// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, m, x, y, q, k;
string s, t;

// <------------- Implement Functions Here ----------> //

bool comp(pll &a , pll &b) {
	if(a.s == b.s) return a.f > b.f;
	return a.s > b.s;
}

// <------------- Start of main() -------------------> //

void MAIN() {
	cin>>n;
	vll a(n),pre(n),suf(n);
	for(ll i=0;i<n;i++) {
		cin>>a[i];
	}
	pre[0] = a[0];
	suf[n-1] = a[n-1];

	for(ll i=1;i<n;i++) pre[i] = pre[i-1] + a[i];
	for(ll i=n-2;i>=0;i--) suf[i] = suf[i+1] + a[i];

	ll mini = INF;
	for(ll i=0;i<n-1;i++) {
		mini = min(mini, abs(pre[i] - suf[i+1]));
	}
	cout<<mini;
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 3596
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#define INF 0x3f3f3f3f
using namespace std;
typedef long long LL;
const int maxn=1e5+6;
const int mod=1e9+7;
int n,m,sum;
int a[maxn];
int read(){        
    int s = 0, f = 1;        
    char ch = getchar();        
    while(!isdigit(ch)) {        
        if(ch == '-') f = -1;        
        ch = getchar();        
    }        
    while(isdigit(ch)) {        
        s = s * 10 + ch - '0';        
        ch = getchar();        
    }        
    return s * f;        
}   
bool cmp(int x,int y){
	return x>y;
}
bool check(){
	for(int i=1;i<=m;i++){
		if(a[i]*4*m<sum)
		  return false;
	}
	return true;
}     
int main(){
	LL n,k;
	cin>>n>>k;
	LL ans;
	if(n<=k)
	    ans=min(n,k-n);
	else
	    ans=min(n-(n/k)*k,abs(n-(n/k+1)*k));
	cout<<ans;
	return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(int argc, const char * argv[]) {
    string s;
    cin >> s;
    if (s == "Sunny") {
        cout << "Cloudy" << endl;
    } else if (s == "Cloudy") {
        cout << "Rainy" << endl;
    } else {
        cout << "Sunny" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
from collections import Counter
n, m = map(int, input().split())
h = [int(_) for _ in input().split()]
ab = [[int(_) for _ in input().split()] for i in range(m)]
ans = [1 for i in range(n)]

for i in range(m):
    if h[ab[i][0]-1] < h[ab[i][1]-1]:
        ans[ab[i][0]-1] = 0
    elif h[ab[i][0]-1] == h[ab[i][1]-1]:
        ans[ab[i][0]-1]=0
        ans[ab[i][1]-1]=0
    else:
        ans[ab[i][1]-1] = 0

ans_count = Counter(ans)
print(ans_count[1])

Measured memory_bytes: 30808
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(){
    int n;
    ll a[200005];
    ll res=0;
    cin>>n;
    for(int i=1;i<=n;i++) scanf("%lld",&a[i]),res^=a[i];
    for(int i=1;i<=n;i++) printf("%lld%c",res^a[i],i ==n?'\n':' ');
    return 0;
}


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

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

using namespace std;                    

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

const int N = (int)1e5 + 123, mod = (int)1e9 + 7;

int n, a[N], b[N], cnt[2];
map<int, int> pos;
int main(){    
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		b[i] = a[i];
	}

	sort(b, b + n);

	for(int i = 0; i < n; i++)
		pos[b[i]] = i;
	for(int i = 0; i < n; i++)
		if( i % 2 != pos[a[i]] % 2 )
			cnt[i%2]++;

	cout << min(cnt[0], cnt[1]);
	return 0;
}


Measured memory_bytes: 5760
#pragma region header
#include <bits/stdc++.h>
#define int long long
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr int inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
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;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
#pragma endregion
signed main() {
    string s;cin >> s;
    while(true) {
        s.pop_back();
        bool ok = false;
        rep(i, (s.size()+1)/2){
            if(s.size()%2==1){
                ok=true;
                break;
            }
            if(s[i]!=s[i+s.size()/2]) {
                ok=true;
                break;
            }
        }
        if(ok)continue;
        cout << s.size() << endl;
        // cout << s << endl;
        return 0;
    }
    return 0;
}

Measured memory_bytes: 3632
// D - Lazy Faith
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
#define lower(v,x) lower_bound((v).begin(),(v).end(), (x))
#define INF (10000000000*2)

int main(){
	int A,B,Q; cin>>A>>B>>Q;

	vl S(A+2), T(B+2);
	for(int i=1; i<=A; ++i) cin>>S[i]; S[0] = -INF; S[A+1] = INF;
	for(int i=1; i<=B; ++i) cin>>T[i]; T[0] = -INF; T[B+1] = INF;

	for(int i=0; i<Q; ++i){
		ll x; cin>>x;

		ll mini = INF;
		vl::iterator apos, bpos;

		apos = lower(S, x);
		for(int j=0; j<2; ++j){
			ll ax = *(apos - j);
			bpos = lower(T, ax);
			for(int k=0; k<2; ++k){
				ll bx = *(bpos - k);
				mini = min(mini, abs(x-ax) + abs(ax-bx));
			}
		}

		apos = lower(T, x);
		for(int j=0; j<2; ++j){
			ll ax = *(apos - j);
			bpos = lower(S, ax);
			for(int k=0; k<2; ++k){
				ll bx = *(bpos - k);
				mini = min(mini, abs(x-ax) + abs(ax-bx));
			}
		}

		cout<< mini <<endl;

	}

}

Measured memory_bytes: 2944
/*
First, solve the problem.Then write the code. - John Johnson
@author: returnAC
*/
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define need_for_speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); // Thanks Joshua :)
#define watch(x) cout<<"->"<<#x<<" : "<<x<<endl;
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c)) 
typedef long long ll;
typedef unsigned long long llu;
const double PI = 2*acos(0.0);

signed main()
{
	//freopen("","r",stdin);
	//freopen("","w",stdout);
	need_for_speed;
	int a,b;
	cin>>a>>b;
	if(b%a==0)cout<<a+b<<endl;
	else cout<<b-a<<endl;
}

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

using namespace std;
using ll =long long;
using db = double;

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

#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define leftunique(v) SORT(v);(v).erase(unique((v).begin(),(v).end()),(v).end())
//leftuniqueは配列から同じ要素のものを取り除く 例 4 6 2 1 3 4 1 2 なら 1 2 3 4 6 になる
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
bool coY() {cout <<"Yes"<<endl;}
bool coN(){cout <<"No"<<endl;}
const int mod = 1e9 + 7;
const ll INF = 1LL << 60;

ll n;
ll dp[10001000];


//ここから書き始める
int main()
{
	cout << setprecision(10);
	dp[0] = 1;
	dp[1] = 1;
	dp[2] = 2;
	for(int i = 3; i < 100100 ; i++){
		dp[i] = dp[i-3] + dp[i-2] + dp[i-1];
	}

	//各段数について求めて、cinで与えられたｎについてのをポンって出せばいい。
	while (cin >> n){
		if(n == 0) return 0;
		ll days = (dp[n] + 9) / 10;
		ll years = (days + 364) / 365 ;
		cout << years << endl;
	}

}



Measured memory_bytes: 3848
#include <iostream>
#include <vector>
#include <list>
#include <chrono>
#include <random>

using namespace std;
typedef long long ll;

int DAYS;
const int TYPES = 26;

vector<int> c;
vector<vector<ll>> s;
chrono::system_clock::time_point startTime, endTime;
mt19937 engine(random_device{}());

vector<ll> simulate(vector<int> &t) {
    vector<list<int>> last(TYPES, {-1});
    vector<ll> ret(DAYS);
    ll now = 0;
    for (int i = 0; i < DAYS; i++) {
        now += s[i][t[i]], last[t[i]].push_back(i);
        for (int j = 0; j < TYPES; j++) {
            now -= c[j] * (i - last[j].back());
        }
        ret[i] = now;
    }
    return ret;
}

ll mod_rnd(ll mod) { return engine() % mod; }

int main() {
    startTime = chrono::system_clock::now();

    cin >> DAYS;
    c.resize(TYPES);
    for (int i = 0; i < TYPES; i++)cin >> c[i];
    s.assign(DAYS, vector<ll>(TYPES));
    for (int i = 0; i < DAYS; i++) {
        for (int j = 0; j < TYPES; j++) {
            cin >> s[i][j];
        }
    }

    vector<int> t(DAYS);
    for (int i = 0; i < DAYS; i++) t[i] = i % TYPES;

    ll currentScore = simulate(t).back();
    while (chrono::duration_cast<chrono::milliseconds>(endTime - startTime).count() < 1850) {
        int ope = mod_rnd(10);
        if (ope == 0) {
            int d = -1, q = -1;
            do {
                d = mod_rnd(DAYS), q = mod_rnd(TYPES);
            } while (t[d] == q);

            int original = t[d];
            t[d] = q;
            int changedScore = simulate(t).back();

            if (currentScore < changedScore)currentScore = changedScore;
            else t[d] = original;
        } else {
            int x = -1, y = -1;
            do {
                x = mod_rnd(DAYS), y = mod_rnd(DAYS);
            } while (x == y);

            swap(t[x], t[y]);
            int changedScore = simulate(t).back();

            if (currentScore < changedScore)currentScore = changedScore;
            else swap(t[x], t[y]);
        }
        endTime = chrono::system_clock::now();
    }

    for (auto &x:t)cout << x + 1 << endl;
    return 0;
}

Measured memory_bytes: 3744
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	s := getNextString(scanner)
	n := len(s)
	ans := n
	for a := 0; a < 26; a++ {
		prev := -1
		mx := 0
		for i := 0; i < n+1; i++ {
			if i == n || int(s[i]-'a') == a {
				if mx < i-prev-1 {
					mx = i - prev - 1
				}
				prev = i
			}
		}
		if ans > mx {
			ans = mx
		}
	}
	fmt.Println(ans)
	writer.Flush()
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<V>;
using VVV = vector<VV>;
using VL = vector<ll>;
using VVL = vector<VL>;
using VVVL = vector<VVL>;
template<class T> using VE = vector<T>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
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; }
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -UPPER;
const long double pi = 3.141592653589793;
const int N = 101010;
V dp(N, -1);
int path(int n, VV& g) {
	if (dp[n] != -1) return dp[n];
	int res = 0;
	for (auto c : g[n]) {
		chmax(res, path(c, g) + 1);
	}
	dp[n] = res;
	return dp[n];
}
int main() {
	int n, m;
	cin >> n >> m;
	VV g(n);
	rep(i, m) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		g[a].push_back(b);
	}
	int ans = 0;
	rep(i, n) chmax(ans, path(i, g));
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 11064