akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

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

vector<ll> as;

// smaller than or equal to as[0]
vector<vector<ll>> dp1;
// bigger than as[0]
vector<vector<ll>> dp2;

ll solve(ll X, ll S) {
    dp1.resize(42, vector<ll>(2, -1));
    dp2.resize(42, vector<ll>(2, -1));

    dp1[0][0] = 0;

    ll A0 = as[0];
    ll v = 1;

    for (int i = 0; i < 41; i++) {
        const int cs = S & 1;
        const int cx = X & 1;
        const int ca0 = A0 & 1;

        for (int j = 0; j < 2; j++) { // carry
#ifdef DEBUG
            printf("cs: %d, cx: %d, ca0: %d, i: %d, j: %d\n", cs, cx, ca0, i, j);
#endif
            for (ll ca = 0; ca < 2; ca++) {
                for (ll cb = 0; cb < 2; cb++) {
                    ll acc = ca + cb + j;
                    if ((acc & 1) != cs) {
                        continue;
                    }
                    if ((ca ^ cb) != cx) {
                        continue;
                    }

                    int ni = i + 1;
                    int nj = acc >= 2;

                    // dp1
                    if (dp1[i][j] != -1) {
                        if (ca <= ca0) {
                            chmax(dp1[ni][nj], dp1[i][j] | (ca * v));
                        } else {
                            chmax(dp2[ni][nj], dp1[i][j] | (ca * v));
                        }
                    }

                    // dp2
                    if (dp2[i][j] != -1) {
                        if (ca < ca0) {
                            chmax(dp1[ni][nj], dp2[i][j] | (ca * v));
                        } else {
                            chmax(dp2[ni][nj], dp2[i][j] | (ca * v));
                        }
                    }
                }
            }
        }

        S >>= 1;
        X >>= 1;
        A0 >>= 1;
        v <<= 1;
    }

    return max(dp1[41][0], dp1[41][1]);
}

// ref. https://atcoder.jp/contests/abc172/submissions/14783201
int main(void) {
    int N;
    cin >> N;

    as.resize(N);
    for (int i = 0; i < N; i++) {
        cin >> as[i];
    }

    ll X = 0;
    for (int i = 2; i < N; i++) {
        X ^= as[i];
    }

    ll S = as[0] + as[1];

    ll ans = solve(X, S);
    if (ans <= 0) {
        cout << -1 << endl;
    } else {
        cout << as[0] - ans << endl;
    }

#ifdef DEBUG
    printf("dp1: \n");
    for (int i = 0; i < 42; i++) {
        for (int j = 0; j < 2; j++) {
            cout << dp1[i][j] << " ";
        }
        cout << endl;
    }
    cout << endl;

    printf("dp2: \n");
    for (int i = 0; i < 42; i++) {
        for (int j = 0; j < 2; j++) {
            cout << dp2[i][j] << " ";
        }
        cout << endl;
    }
    cout << endl;
#endif

    return 0;
}


Measured memory_bytes: 3616
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Linq.Expressions;

namespace Main
{
    class Program
    {
        static void Main(string[] args)
        {
            //ここから
            //int n=Readint();
            //string[] str = Console.ReadLine().Split(' ');

            int n = Readint();
            var ans = new int[n];

            for(int x = 1; x < n; x++)
            {
                if (x * x > n) break;
                for(int y = 1; y < n; y++)
                {
                    if (x * x + y * y + x * y > n) break;
                    for(int z = 1; z < n; z++)
                    {
                        int[] xyz = { x, y, z };
                        int fn = x * x + y * y + z * z + x * y + y * z + z * x;
                        if (fn > n) break;
                        ans[fn - 1]++;
                    }
                }
            }

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



            //ここまで
        }

        static void Cout(string s)
        {
            Console.WriteLine(s);
            return;
        }

        static void Cout(int n)
        {
            Console.WriteLine(n);
            return;
        }

        static void Cout(long n)
        {
            Console.WriteLine(n);
            return;
        }

        static int Readint()
        {
            return int.Parse(Console.ReadLine());
        }

        static int[] ReadArray(int n)
        {
            string[] str = Console.ReadLine().Split(' ');
            int[] a = new int[n];
            for (int i=0; i < n; i++){ a[i] = int.Parse(str[i]); }
            return a;
        }
        static long[] ReadArray(long n)
        {
            string[] str = Console.ReadLine().Split(' ');
           long[] a = new long[n];
            for (long i = 0; i < n; i++) { a[i] = long.Parse(str[i]); }
            return a;
        }

        static long Readlong()
        {
            return long.Parse(Console.ReadLine());
        }

        static int Min(int a, int b)
        {
            if (a < b) return a;
            return b;
        }

        static int Max(int a, int b)
        {
            if (a > b) return a;
            return b;
        }


    }

}


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

#define rep(i, n) for(int i = 0; i < n; i++)
#define loop(i, s, n) for(int i = s; i < n; i++)
#define MOD 1e9+7
void max_self(int &a, int b) { a=a>b?a:b; }
void min_self(int &a, int b) { a=a<b?a:b; }

typedef long long ll;

using namespace std;

ll h;
ll temp=0;
ll cnt=1;

int main() {

    cin >> h;

    for(h=h; h>0; h>>=1) {
        temp+=cnt;
        cnt<<=1;
    }

    cout << temp << endl;
    
    return 0;
}


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

namespace abc079_d
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[,] d = new int[10, 10];
            for (int i = 0; i < 10; i++)
            {
                int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
                for (int j = 0; j < 10; j++)
                {
                    d[i, j] = a[j];
                }
            }
            for (int k = 0; k < 10; k++)
            {
                for (int i = 0; i < 10; i++)
                {
                    for (int j = 0; j < 10; j++)
                    {
                        d[i, j] = Math.Min(d[i, j], d[i, k] + d[k, j]);
                    }
                }
            }
            int ret = 0;
            for (int i = 0; i < x[0]; i++)
            {
                int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
                for (int j = 0; j < x[1]; j++)
                {
                    if (a[j] >= 0) ret += d[a[j], 1];
                }
            }
            Console.WriteLine(ret);
        }
    }
}

Measured memory_bytes: 15444
n = int(input())
a = list(map(int, input().split()))
a = [i % (10**9 + 7) for i in a]
val = sum(a[1:])

ans = 0
for i in range(n - 1):
    ans += a[i]*val
    ans %= 10**9 + 7
    val -= a[i + 1]
print(ans)

Measured memory_bytes: 103804
let scan_int () = Scanf.scanf " %d" (fun x -> x)
let print_int n = Printf.printf "%d\n" n
let print_list a = 
  let _ = List.iter (Printf.printf "%d ") a in print_newline()

let () =
  let k = scan_int() and x = scan_int() in
  let rec for_loop i ret =
    if i == k then ret
    else for_loop (i+1) ((i+x) :: ret) in
  let l = for_loop (-k+1) [] in
  print_list (List.rev l)


Measured memory_bytes: 384
n, m = map(int, input().split())

g = [[] for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    g[a-1].append(b-1)
    g[b-1].append(a-1)

for first in g[0]:
    if n-1 in g[first]:
        print("POSSIBLE")
        exit()
else:
    print("IMPOSSIBLE")


Measured memory_bytes: 80972
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin >> s;
	int cnt[26]={0};
	for(int i=0;i<s.size();i++)
	{
		cnt[s[i]-'a']++;
	}
	for(int i=0;i<26;i++)
	{
		if(cnt[i]%2)
		{
			cout << "No"; return 0;
		}
	}
	cout << "Yes";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
  int h, n, sum_a = 0;
  cin >> h >> n;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    sum_a += a;
  }
  cout << (sum_a < h ? "No" : "Yes") << endl;
  return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())

#define MOD 998244353 


int n;
int a[300];


void calc(long long dp[301 + 1][300 * 300 + 1], int m) {
	dp[0][0] = 1;
	rep(i, n) {
		rep(k, 300 * 300 + 1)if (dp[i][k]) {
			(dp[i + 1][k] += dp[i][k] * m) %= MOD;
			(dp[i + 1][k + a[i]] += dp[i][k]) %= MOD;
		}
	}
}


long long dp1[301 + 1][300 * 300 + 1];
long long dp2[301 + 1][300 * 300 + 1];


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

	cin >> n;
	rep(i, n)cin >> a[i];

	int sum = 0;
	rep(i, n)sum += a[i];


	calc(dp1, 2);

	long long ans = 1;
	rep(i, n)(ans *= 3) %= MOD;

	for (int j = (sum + 1) / 2; j <= sum; j++) {
		ans -= 3LL * dp1[n][j];
	}
	ans %= MOD;

	if (sum % 2 == 0) {
		calc(dp2, 1);
		ans += 3 * dp2[n][sum / 2];
		ans %= MOD;
	}

	ans %= MOD;
	ans += MOD;
	ans %= MOD;

	cout << ans << endl;





	return 0;
}

Measured memory_bytes: 422272
#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,m;
int k[202];
int s[202][22],h[202][22];
double c[202][202];
int ma[202];
double memo[202][202];
double dfs(int p,int x){
  if(memo[p][x]>=0) return memo[p][x];
  if(p==n) return 0; 
  double res=0;
  for(int i=0;i<=min(x,ma[p]);i++){
    res=max(res,dfs(p+1,x-i)+c[p][i]);
  }
  //cout<<p<<" "<<x<<" "<<res<<endl;
  return memo[p][x]=res;
}
signed main(){
  cin>>n>>m;
  for(int i=0;i<n;i++){
    cin>>k[i];
    for(int j=0;j<k[i];j++){
      cin>>s[i][j]>>h[i][j];
    }
  }
  for(int i=0;i<n;i++){
    ma[i]=0;
    for(int j=0;j<k[i];j++) ma[i]+=s[i][j]*h[i][j];
    for(int j=0;j<=ma[i];j++){
      queue<int> q;
      for(int r=0;r<k[i];r++)
	for(int l=0;l<h[i][r];l++) 
	  q.push(s[i][r]);
      double tmp=0;
      int x=0;
      while(!q.empty()){
	int p=q.front();q.pop();
	if(x+p>j){
	  tmp+=(double)(j-x)/p;
	  break;
	}
	x+=p;
	tmp+=1;
      }
      //cout<<i<<" "<<j<<" "<<ma[i]<<" "<<tmp<<endl;
      c[i][j]=tmp;
    }
  }
  for(int i=0;i<202;i++)
    for(int j=0;j<202;j++)
      memo[i][j]=-1;
  printf("%.12f\n",dfs(0,m));
  return 0;
}

Measured memory_bytes: 3952
import java.util.*;
import java.io.*;

class Main {

	void solve() {

		int L = inint() + inint(), R = inint() + inint();
		out.println(L==R? "Balanced" : L>R? "Left" : "Right");

	}

	public static Scanner in = new Scanner(System.in);
	public static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		new Main().solve();
		out.flush();
	}

	public int inint() {
		return in.nextInt();
	}

	public String instr() {
		return in.next();
	}

	public int[] inintar(int num) {
		int[] a = new int[num];
		for (int i=0; i<num; i++) {
			a[i] = in.nextInt();
		}
		return a;
	}

	public char[] incharar() {
		return in.next().toCharArray();
	}

}

Measured memory_bytes: 23632
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
using namespace std;
using ll = int64_t;
using vi = vector<int>;
using vvi = vector<vi>;

int n, m;
vvi G;
vi check;

int dfs(int i) {
    if(check[i] != -1) {
        return check[i];
    }
    if(!G[i].size()){ 
        check[i] = 0;
        return 0;
    }
    int ma=0;
    for(int nexti:G[i]) {
        ma = max(ma, dfs(nexti));
    }
    ma++;
    check[i] = ma;
    return ma;
}


int main() {
    
    cin >> n >> m;
    vi G_(n);
    G.resize(n);
    rep(i, m) {
        int x, y;
        cin >> x >> y;
        G[x-1].push_back(y-1);
        G_[y-1]++;
    }

    check.assign(n, -1);

    int ma=0;
    rep(i, n) {
        if(G_[i]) continue;
        ma = max(ma, dfs(i));
    }

    cout << ma << '\n';
}

Measured memory_bytes: 11136
H, W, K = map(int, input().split())
c = []
for i in range(H):
    c.append(input())


points = 0
for row in range(2**H):
    for col in range(2**W):
        k_pra = 0
        for i in range(H):
            for j in range(W):
                if row&(1<<i)==0 and col&(1<<j)==0 and c[i][j]=='#':
                    k_pra += 1
        if K == k_pra:
            points += 1

print(points)


Measured memory_bytes: 9184
#include <iostream>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

int main(void) {
    int a, b;
    cin >> a >> b;
    int p = a * b % 2 == 1;
    if (p)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 256
H, W = map(int, input().split())
a = []

for _ in range(H):
    sd = list(input())
    if '#' in sd:
        a.append(sd)

col = [False] * W

for i in range(W):
    if '#' in [row[i] for row in a]:
        col[i] = True

for i in range(len(a)):
    for j in range(W):
        if col[j]:
            print(a[i][j], end='')
    print()

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

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

int findAndCount(const string s, const string target)
{
    int cnt = 0;
    size_t pos = 0;
    while ((pos = s.find(target, pos)) != -1)
    {
        ++cnt;
        ++pos;
    }
    return cnt;
}

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

    int i;
    array<string, 10000> s;
    for (i = 0; i < n; ++i)
    {
        cin >> s[i];
    }

    int nAB = 0;
    for (i = 0; i < n; ++i)
    {
        nAB += findAndCount(s[i], "AB");
    }

    int tailAOnlyCount = 0, headBOnlyCount = 0, tailAHeadBCount = 0;
    bool isTailA, isHeadB;
    for (i = 0; i < n; ++i)
    {
        isTailA = (s[i].back() == 'A');
        isHeadB = (s[i].front() == 'B');
        if (isTailA && isHeadB)
        {
            ++tailAHeadBCount;
        }
        else if (isTailA)
        {
            ++tailAOnlyCount;
        }
        else if (isHeadB)
        {
            ++headBOnlyCount;
        }
    }

    int nPairs = ((tailAOnlyCount > headBOnlyCount) ? headBOnlyCount : tailAOnlyCount);
    nAB += nPairs;
    if (tailAHeadBCount >= 1)
    {
        nAB += (tailAHeadBCount - 1);
        if ((tailAOnlyCount != 0) || (headBOnlyCount != 0))
        {
            nAB += 1;
        }
    }
    
    cout << nAB << endl;

    return 0;
}

Measured memory_bytes: 768
s = input()
true = 'keyence'

from itertools import product
ans = 'NO'
for start, end in product(range(len(s)), range(len(s))):
    if start > end:
        continue
    else:
        temp = s[:start] + s[end:]
        if true == temp:
            ans = 'YES'
            break
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <cmath>

using namespace std;

int main() {
	int n, k;
	int a, b;
	long long int c;

	cin >> n >> k;

	a = k - 1;
	b = n - 1;

	c = pow(a, b);
	cout << c*k << endl;

	return 0;

}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <iomanip>
#include <cmath>

using namespace std;

void solve(){
	int n, an = 2;
	cin >> n;
	vector<pair<double, double> > k_old, k_new;
	k_old.push_back(make_pair(0, 0));
	k_old.push_back(make_pair(100, 0));
	for (int j = 1; j < n + 1; j++){
		for (int i = 0; i < an - 1; i++){
			double x = k_old[i].first;
			double y = k_old[i].second;
			double z = k_old[i + 1].first;
			double w = k_old[i + 1].second;
			double xn = (sqrt(3) / 6) * (y - w + sqrt(3) * (z - x));
			double yn = (sqrt(3) / 6) * (z - x + sqrt(3) * (w - y));
			k_new.push_back(k_old[i]);
			k_new.push_back(make_pair(x + (z - x) / 3, y + (w - y) / 3));
			k_new.push_back(make_pair(x + xn, y + yn));
			k_new.push_back(make_pair(x + 2 * (z - x) / 3, y + 2 * (w - y) / 3));
		}
		k_new.push_back(k_old.back());
		k_old = k_new;
		k_new.clear();
		an = 4 * an - 3;
	}
	for (int i = 0; i < k_old.size(); i++) cout << fixed << setprecision(8) << k_old[i].first << " " << k_old[i].second << endl;
}

signed main(){
	solve();
}

Measured memory_bytes: 3304
def prime_table(n):
    prime = [True]*(n+1)
    prime[0], prime[1] = False, False
    i = 2
    while i*i <= n:
        if not prime[i]:
            i += 1
            continue
        j = 2*i
        while j <= n:
            prime[j] = False
            j += i
        i += 1
    return prime
N = 10**5
pt = prime_table(N)
cum = [0]*(N+1)
for i in range(1, N+1, 2):
    if pt[i] and pt[(i+1)//2]:
        cum[i] = 1
for i in range(1, N+1):
    cum[i] += cum[i-1]
Q = int(input())
ans = []
for _ in range(Q):
    l, r = map(int, input().split())
    ans.append(cum[r]-cum[l-1])
print(*ans, sep="\n")


Measured memory_bytes: 18304
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
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; }

int main(){
  int H, W;
  cin >> H >> W;
  vector<vector<int>> c(10, vector<int>(10));
  rep(i, 10) rep(j, 10) cin >> c[i][j];
  vector<vector<int>> A(H, vector<int>(W));
  rep(i, H) rep(j, W) cin >> A[i][j];
  rep(i, 10) rep(j, 10) rep(k, 10)
    chmin(c[j][k], c[j][i]+c[i][k]);
  int ans = 0;
  rep(i, H) rep(j, W) {
    if(A[i][j] != -1)
      ans += c[A[i][j]][1];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _USE_MATH_DEFINES
#include <math.h>
#define rep(i,n) for(int i = 0;i < n;i++)
#define NIL = -1;

int digit(ll x) {
    if (x / 10 == 0) return 1;
    return digit(x / 10) + 1;
}

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

ll lcm(ll a,ll b){
    a / gcd(a,b) * b;
}
const ll mod = 1e9 + 7;
const ll INF = 1e9 + 7;

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


/////////////////////////////////////////////////////////////////////////////////////////

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> x(n);
    for (int i = 0;i < n;i++){
        cin >> x[i];
    }
    ll ans = 1e9;
    for (int i = 0;i < n - k + 1;i++){
        //startを右端か左端の0から距離が短いほうにする
        ll candle = min(abs(x[i]),abs(x[i+k-1]));
        candle += abs(x[i] - x[i+k-1]);
        ans = min(ans,candle);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
import java.io.BufferedReader
import java.io.InputStreamReader

fun main(args: Array<String>) {
    val br = BufferedReader(InputStreamReader(System.`in`))
    val n = br.readLine().toInt()
    val k = br.readLine().toInt()
    var current = 1
    (1..n).forEach {
        if (current <= k) {
            current *= 2
        } else {
            current += k
        }
    }
    println(current)
}

Measured memory_bytes: 31264
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author NikuKyabe
 */

#include <iostream>
#include <fstream>

#include "bits/stdc++.h"

using namespace std;
#define int long long


class A753 {
public:
    void solve(std::istream &in, std::ostream &out) {
      int x;
      in >> x;
      switch (x) {
        case 7:
        case 5:
        case 3:
          out << "YES" << endl;
          break;
        default:
          out << "NO" << endl;
      }
    }
};


signed main() {
  ios::sync_with_stdio(false);
  cout.tie(0);
  cout << fixed;
  A753 solver;
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  solver.solve(in, out);
  return 0;
}


Measured memory_bytes: 256
N = int(input())
dp = [[0]*N for _ in range(3)] #dp[k][i] i日目にactivity k を実施する

dp[0][0],dp[1][0],dp[2][0] = map(int,input().split())
for i in range(1,N):
    act= list(map(int,input().split()))
    for k in range(3):
        dp[k][i] = max(dp[(k+1)%3][i-1],dp[(k+2)%3][i-1])+act[k%3]
ans = 0
for k in range(3):
    ans = max(ans,dp[k][-1])
print(ans)
    



Measured memory_bytes: 20596
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const ll mod = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;
const ld pi = 3.141592653589793;

long long modpow(long long n, long long k, long long mod)
{
if (k == 0) return 1;
long long r = modpow(n * n % mod, k >> 1, mod);
if (k & 1) r = r * n % mod;
return r;
}

void solve(){
    int n;cin >> n;
    string s;string t;
    cin >> s >> t;
    for(int i = 0;i<n;i++){
        cout << s[i] << t[i];
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;

ll a[200010], f[200010];
int n;

bool isOK(ll x, ll key) {
    ll cost = 0;
    rep(i, n){
        cost += max(a[i] - x/f[i], (ll)0);
    }
    if (cost <= key) return true;
    else return false;
}

ll binary_search(ll key) {
    ll ng = -1;
    ll ok = 1e+18+7;
    while (abs(ok - ng) > 1) {
        ll mid = (ok + ng) / 2;
        if (isOK(mid, key)) ok = mid;
        else ng = mid;
    }
    return ok;
}


int main(){
    ll k;
    cin >> n >> k;
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> f[i];
    sort(a, a+n);
    sort(f, f+n);
    reverse(f, f+n);

    cout << binary_search(k) << endl;

    return 0;
}


Measured memory_bytes: 6756
import * as fs from 'fs';

namespace AtCoder.abc114 {

    class Program {

        /**
         * in
         *  1234567876
         * out
         *  34
         */
        main(inp: string): void {

            let ans: number = 99999;

            let wk: string = '';
            inp.split('').forEach(x => {
                wk += x;

                if (wk.length === 4) {
                    wk = wk[1] + wk[2] + wk[3];
                }

                if (wk.length === 3) {
                    let abs: number = Math.abs(753 - parseInt(wk));
                    if (ans > abs) {
                        ans = abs;
                    }
                }
            });

            console.log(ans);

        }
    }

    const func = new Program();
    func.main(fs.readFileSync('/dev/stdin', 'utf8').trim());
}

Measured memory_bytes: 7372
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		double n=sc.nextDouble();
		if(n%2==0) {
			System.out.println((double)1/2);
		}else {
			double a=(n+1)/2;
			System.out.println(a/n);
		}
	}

}


Measured memory_bytes: 25172
#include <bits/stdc++.h>
#define ll long long
using namespace std;
char str[1020];
int main(int argc, char const *argv[]) {
  scanf("%s", str);
  int len = strlen(str);
  bool W = false, E = false, N = false, S = false;
  for (int i = 0; i < len; ++ i) {
    if (str[i] == 'W') W = true;
    if (str[i] == 'E') E = true;
    if (str[i] == 'N') N = true;
    if (str[i] == 'S') S = true;
  }
  if ((W ^ E) || (N ^ S)) puts("No");
  else puts("Yes");
  return 0;
}

Measured memory_bytes: 256
import java.util.*

class User(val id:Int){
    private val mWait:Stack<Data> = Stack()
    fun waitingData():Iterable<Data> = mWait
    fun waitData(data:Data):Unit {
        mWait.push(data)
    }
}
class Data{
    private var mLocked:User? = null
    fun lockedUser():Iterable<User> = listOf(mLocked).filterNotNull()
    fun lockedByUser(user:User):Unit{
        mLocked = user
    }
}
fun depthFirst(user:User, depth:Int = 0):Boolean {
    if (depth > 100) return true
    return user.waitingData().flatMap(Data::lockedUser).any{depthFirst(it, depth + 1)}
}
fun occurDeadLock(users:Iterable<User>):Boolean {
    return users.any{depthFirst(it)}
}
fun main(args:Array<String>):Unit {
    val users = Array(100){User(it + 1)}
    val data = Array(100){Data()}
    for (i in 0 until readLine()!!.toInt()){
        val (u, q, d) = readLine()!!.split(' ')
        when(q){
            "lock" -> data[d.toInt() - 1].lockedByUser(users[u.toInt() - 1])
            else -> users[u.toInt() - 1].waitData(data[d.toInt() - 1])
        }
    }
    println(when{
        occurDeadLock(users.asIterable()) -> 1
        else -> 0
    })
}


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

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

typedef long long ll;
// union by size + path having
class UnionFind {
 public:
  vector<ll> par;  // 各元の親を表す配列
  vector<ll> siz;  // 素集合のサイズを表す配列(1 で初期化)

  // Constructor
  UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
    for (ll i = 0; i < sz_; ++i)
      par[i] = i;  // 初期では親は自分自身
  }
  void init(ll sz_) {
    par.resize(sz_);
    siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
    for (ll i = 0; i < sz_; ++i)
      par[i] = i;  // 初期では親は自分自身
  }

  // Member Function
  // Find
  ll root(ll x) {  // 根の検索
    while (par[x] != x) {
      x = par[x] = par[par[x]];  // x の親の親を x の親とする
    }
    return x;
  }

  // Union(Unite, Merge)
  bool merge(ll x, ll y) {
    x = root(x);
    y = root(y);
    if (x == y)
      return false;
    // merge technique（データ構造をマージするテク．小を大にくっつける）
    if (siz[x] < siz[y])
      swap(x, y);
    siz[x] += siz[y];
    par[y] = x;
    return true;
  }

  bool issame(ll x, ll y) {  // 連結判定
    return root(x) == root(y);
  }

  ll size(ll x) {  // 素集合のサイズ
    return siz[root(x)];
  }
};

int main() {
  ll N, M;
  cin >> N >> M;
  vector<ll> A(M), B(M);
  rep(i, M) {
    cin >> A[i] >> B[i];
    A[i]--;
    B[i]--;
  }

  reverse(all(A));
  reverse(all(B));

  UnionFind u(N);
  vector<ll> inconv(M);
  inconv[0] = N * (N - 1) / 2;
  repp(i, 1, M - 1) {
    int a = A[i - 1], b = B[i - 1];
    if (u.issame(a, b)) {
      inconv[i] = inconv[i - 1];
    } else {
      inconv[i] = inconv[i - 1] - u.size(a) * u.size(b);
      u.merge(a, b);
    }
  }

  reverse(all(inconv));
  rep(i, M) {
    cout << inconv[i] << endl;
  }
}

Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
const int nmax=8;
bool graph[nmax][nmax];
int dfs(int v,bool visited[nmax],int n)
{
   bool allvisited=true;
   for(int i=0;i<n;i++)
   {
       if(!visited[i])
        allvisited=false;
   }
   if(allvisited)return 1;
   int ret=0;
   for(int i=0;i<n;i++)
   {
       if(graph[v][i]==false)continue;
       if(visited[i])continue;
       visited[i]=true;
       ret+=dfs(i,visited,n);
       visited[i]=false;
   }
   return ret;
}
int main()
{
    int i,j,n,m,ans,a,b;
    cin>>n>>m;
    for(i=0;i<m;i++)
    {
        cin>>a>>b;
        graph[a-1][b-1]=graph[b-1][a-1]=true;
        
    }
    bool visited[nmax];
    for(int i=0;i<n;++i){
    visited[i]=false;
    }
    visited[0]=true;
    ans=dfs(0,visited,n);
    cout<<ans;
}


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

int main() {
  int n, s = 1;
  cin >> n;
  vector<int> v(n);
  cin >> v.at(0);
  for(int i = 1; i < n; i++){
    cin >> v.at(i);
    bool a = 1;
    for(int j = 0; j < i; j++){
      if(v.at(i) < v.at(j))
        a = 0;
    }
    if(a)
      s++;
  }
  cout << s << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define io ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define PI atan(1)*4
typedef long long int ll;
using namespace std;
int h[100005];
vector<vector<int> > v;
int main(){
	io;
	int n,m;
	cin >> n >> m;
	for(int i = 0;i < n;++i){
		cin >> h[i];
	}
	int coun = 0;
	int a,b;
	v.resize(n+5);
	for(int i = 0;i < m;++i){
		cin >> a >> b;
		v[a-1].push_back(b-1);
		v[b-1].push_back(a-1); 
		}
	for(int i = 0;i < n;++i){
		bool f = 1;
		for(int j = 0;j < v[i].size();++j){
			int temp = v[i][j];
			if(h[i] <= h[temp]){
				f = 0;
				break;
			}
		}
		if(f){ 
		//	cout << i << " ";
			coun += 1;
			} 
	}
	//cout << endl;
	cout << coun;
	return 0;
} 

Measured memory_bytes: 8716
(nodes, edges) = (int(tok) for tok in input().split())

edges_start = set()
edges_stop = set()

for _ in range(edges):
  (a, b) = (int(tok) for tok in input().split())
  if a == 1:
    edges_start.add(b)
  elif b == nodes:
    edges_stop.add(a)
    
valid = any(x in edges_stop for x in edges_start)
print("POSSIBLE" if valid else "IMPOSSIBLE")

Measured memory_bytes: 18884
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T,vector<T>,greater<T>>;

constexpr long long MOD = (long long)1e9 + 7;
constexpr long long MOD2 = 998244353;
constexpr long long HIGHINF = (long long)1e18;
constexpr long long LOWINF = (long long)1e15;
constexpr long double PI = 3.1415926535897932384626433;

template <class T> vector<T> multivector(size_t N,T init){return vector<T>(N,init);}
template <class... T> auto multivector(size_t N,T... t){return vector<decltype(multivector(t...))>(N,multivector(t...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max(a,b);}
template <class T> void chmin(T& a, const T b){a=min(a,b);}
void YN(bool flg) {cout << (flg ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << (flg ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << (flg ? "yes" : "no") << endl;}

int main() {
    int A,B; cin >> A >> B;
    if(A<=9&&B<=9) cout << A*B << endl;
    else cout << -1 << endl;


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll= long long;
int main(){
    int n,m,x;
    cin>>n>>m>>x;
    vector<ll> c(n);
    vector<vector<ll>> a(n,vector<ll>(m));
    rep(i,n){
        cin>>c[i];
        rep(j,m) cin>>a[i][j];
    }
    ll INF=1000000007;
    ll ans=INF;
    for(int i=0;i<(1<<n);i++){
        ll  money=0;
        vector<ll> rikai(m);
       bitset<12> s(i);
       rep(j,n){
           if (s[j]==1){
               money +=c[j];
               rep(k,m){
                   rikai[k] +=a[j][k];
               }

           }
       }
       bool ok=true;
       rep(k,m){
           if (rikai[k]<x) ok=false;;
       }
       if (ok) ans=min(ans,money);
    }
    if (ans==INF) cout <<"-1";
    else cout << ans;
}

Measured memory_bytes: 3592
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
// ぜったいあきらめない
#include<bits/stdc++.h>
using namespace std;

#if defined(DAIJOBU)
#include "/home/ichigo/debug.hpp"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif

#define fi first
#define se second
#define FIO {ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);}
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef long double ld;

int main(){
	FIO
	
	ll n, a, b;cin >> n >> a >> b;
	ll ans = (n / (a + b)) * a;
	ll rem = n % (a + b);
	ans += min(a, rem);
	cout << ans;
	return 0;
}



Measured memory_bytes: 256
// ABC077_C
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define MIN(vec) min_element(ALL((vec)))  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))

int main() {
  // input
  ll N;
  cin >> N;
  vector<ll> A(N), B(N), C(N);
  REP(i, N) cin >> A[i];
  REP(i, N) cin >> B[i];
  REP(i, N) cin >> C[i];
  sort(A.begin(), A.end());
  sort(B.begin(), B.end());
  sort(C.begin(), C.end());

  // calculation
  ll now_B, num_A, num_C, res = 0;
  ll idx_bound_A, idx_bound_C;

  for (ll i = 0; i < N; ++i) {
    now_B = B[i];
    num_A = 0;
    num_C = 0;

    // 1 段目: now_B 未満の数を求める
    auto iter_A = lower_bound(A.begin(), A.end(), now_B);
    auto iter_C = upper_bound(C.begin(), C.end(), now_B);
    ll num_A = iter_A - A.begin();
    ll num_C = C.end() - iter_C;

    res += num_A*num_C;
  }

  cout << res << "\n";

  return 0;
}

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

int main() {
	int a[5];
  	
  
  	rep(i,5){
    	cin>>a[i];
    }
  
	int ans =0;
  	int lo=a[0];
  
  	for(int j=1;j<5;j++){
    	if(lo%10>a[j]%10&&a[j]%10!=0){
          	ans +=lo+(10-lo%10);
          	lo=a[j];
        }
      
      	else if(a[j]%10==0){
        	ans+=a[j];
        }
      
      	else{
        	ans+=a[j]+10-(a[j]%10);
        }
    }
  
  cout<<ans+lo<<endl;
  
  
}

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

ans = [0 for i in range(n+1)]

for i in range(1,100):
  for j in range(1,100):
    for k in range(1,100):
      x = i**2+j**2+k**2 + i*j + j*k + k*i
      if x > n:
        continue
      ans[x] += 1
      # print (i,j,k)

for i in ans[1:]:
  print (i)

Measured memory_bytes: 74216
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin >> s;
  int cnt=0, i=0;
  
  for( i=0; i<3; i++){
    if(s[i] == '1'){cnt++;}
  }
   cout << cnt << endl;

  return 0;
}


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

#define FAST ios_base:: sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define FOR(i,a,b) for(ll i=a; i<b ; i++)

typedef long long ll;

int main(){
	FAST;
	ll n;	cin >> n;
	
	if(n==1){
		cout << 0;
		return 0;
	}
	vector<ll> v;
	
	for(ll i=2; i*i<=n ; i++){
		if(n%i==0){
			v.pb(i);
			if(n!=i*i)
				v.pb(n/i);
		}
	}
	v.pb(n);
	ll ans = 0;
	for(auto X: v){
		ll temp = X-1;
		if(n%temp == floor(n/temp))
			ans+= temp;
	}
	cout << ans;
	

}




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

#define int long long
#define ff first
#define ss second
#define endl "\n"
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x.size())
int powmod(int a,int l, int md){a%=md; int res=1;while(l){if(l&1)res=res*a%md;l/=2;a=a*a%md;}return res;}
int binpow(int a,int l){int res=1;while(l){if(l&1)res=res*a;l/=2;a=a*a;}return res;}
int invmod(int a, int md){return powmod(a,md-2,md);}
typedef long long ll; typedef unsigned long long ull; typedef long double ld;
typedef vector<int> vi; typedef pair<int, int> ii; typedef vector< ii > vii;
#define pb push_back
int __set(int b, int i) {return b|(1LL<<i);} //set ith bit
int __unset(int b, int i) {return b&(~(1UL<<i));}
int __check(int b, int i) {return b&(1LL<<i);} //returns 0 if ith bit is 0
int mulmod(int a, int b, int md) {return (((a%md)*(b%md))%md+md)%md;}
int addmod(int a, int b, int md) {return ((a%md+b%md)%md+md)%md;}
int submod(int a, int b, int md) {return (((a%md-b%md)%md)+md)%md;}
int divmod(int a, int b, int md) {return mulmod(a, powmod(b, md-2, md), md);} //if md is prime;
const ll inf = 0xFFFFFFFFFFFFFFFL; //very large number
priority_queue<int, vector<int>, greater<int> > pq; //for min priority_queue
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);


signed main(void)
{
	IOS;
	int n; cin>>n;
	string s; cin>>s;
	vi a(n);
	vector<vi> g(3);
	for(int  i =0 ; i  < n; i++) {
		if(s[i]=='R') {
			a[i]=0;
			g[0].pb(i);
		}
		if(s[i]=='G'){
			a[i]=1;
			g[1].pb(i);
		}
		if(s[i]=='B') {
			a[i]=2;
			g[2].pb(i);
		}
	}
	int ans=0;
	for(int i = 0; i < n; i++) {
		for(int j = i+1; j< n; j++) {
			if(s[i]==s[j]) continue;
			int id=3-a[i]-a[j];
			ans += sz(g[id])-(upper_bound(all(g[id]),j)-g[id].begin());
			auto it=lower_bound(all(g[id]),2*j-i);
			if(it!=g[id].end() && *it==2*j-i)
				ans--;
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;
const long long INF = 1LL <<60;  

int main(void){
  long res=0,tmp;
  long i,j,k;
  long n,d;
  long a_h=0;
  
  cin>>n;
  for(i=0;i<n;i++){
    cin>>tmp;
    if(a_h>tmp){
      res+=a_h-tmp;
    }
    else{
      a_h=tmp;
    }
  }

  cout<<res<<endl;
  return 0;
}

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

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

Measured memory_bytes: 3596
#関数f:入力xの1以外の約数をリストで出力
def f(x):
  out=set() #約数を保存するセット
  for i in range(1, int(-(-pow(x, 1/2)//1))):
    #1-x**(1/2)未満の整数iについて、xを割り切れるか判定
    if x%i==0:
      #xをiで割り切れるのであれば、iとx/iを保存
      out.add(i)
      out.add(x//i)
      
  #x**(1/2)でxを割り切れる(つまりxが平方数)なら、出力にx**(1/2)を追加
  if x%(x**(1/2))==0:
    out.add(x**(1/2))
    
  #セットから昇順のリストに変換します
  out=list(out)
  out.sort()
  
  #昇順にした結果1が先頭に来ているため、インデックス1以降を出力
  return out[1:]

#入力受け取り
N=int(input())
ans=0 #最後に出力する変数

for K in f(N): #Nの1以外の約数について、操作の結果1になるかをそれぞれ調べる
    x=N #Nを直接書き換えると後に影響するため、ここではxとする
    #xをKで割り切れる間は、Kで割り続ける
    while x%K==0:
      x/=K
      
    #xをKで割り切れなくなったら、xからKを引けるだけ引く(=割って余りをとる)
    x%=K
    
    #操作後x=1となったならば、出力に1を足す
    if x==1:
        ans+=1
        
#(N-1)の1を除いた約数はすべて条件を満たすため、出力にf(N-1)の要素数を足す
ans+=len(f(N-1))

#出力
print(ans)

Measured memory_bytes: 3828
//Name: Candy and Class Flag
//Level: 1
//Category: やるだけ
//Note: 

/**
 * 剰余を取ればよい。
 *
 * オーダーは O(1)。
 */
#include <iostream>

using namespace std;

bool solve(bool first) {
    int N;
    if(!(cin >> N)) return false;

    cout << "3C";
    cout.width(2);
    cout.fill('0');
    cout << ((N-1)%39+1) << endl;
    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout.setf(ios::fixed);
    cout.precision(10);

    bool first = true;
    while(solve(first)) {
        first = false;
    }
    return 0;
}

Measured memory_bytes: 1196
str1 = input()
li = list(str1)
anli = []
for i in range(26):
    anli.append(0)
for i in range(len(li)):
   anli[ord(li[i]) - 97] += 1
flag = True
mi = 27
for i in range(len(anli)):
    if anli[i] == 0:
        flag = False
        mi = min(i,mi)
if flag:
    print('None')
else:
    print(chr(mi+97))

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

int main() {
    int64_t N;
    string S;
    cin >> N >> S;

    //各文字がi文字目までで何回出ているか
    const string target = "RGB";
    vector<vector<int64_t>> appear_num(target.size(), vector<int64_t>(N + 1, 0));
    for (int64_t i = 0; i < target.size(); i++) {
        for (int64_t j = 0; j < N; j++) {
            appear_num[i][j + 1] = appear_num[i][j] + (S[j] == target[i]);
        }
    }

    int64_t ans = 0;
    for (int64_t j = 1; j < N; j++) {
        for (int64_t k = j + 1; k < N; k++) {
            if (S[j] == S[k]) {
                continue;
            }

            for (int64_t l = 0; l < target.size(); l++) {
                if (target[l] == S[j] || target[l] == S[k]) {
                    continue;
                }

                int64_t i = j - (k - j);
                int64_t sub = (i < 0 ? 0 : S[i] == target[l]);
                ans += appear_num[l][j] - sub;
            }
        }
    }

    cout << ans << endl;
}

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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'

// n回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii;  // 2次元配列
typedef vector<ll> vll;
typedef vector<double> vd;
typedef pair<int, int> PII;

template<typename T>
using vec = vector<T>;
template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

const ld Pi = std::acos(-1.0L);
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    int START_TIME = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
    // cout << fixed << setprecision(15);

    ll n, a; cin >> n;
    map<ll, int> mp;
    maxheap<ll> hp;

    rep(i,n) {
        cin >> a;
        ++mp[a];
        if(mp[a]>=2) {
            hp.push(a);
            mp[a] = 0;
        }
    }

    ll x,y;
    if(hp.size()) {
        x = hp.top(); hp.pop();
    }
    else {
        cout << 0 << '\n';
        return 0;
    }
    if(hp.size()) {
        y = hp.top(); hp.pop();
    }
    else {
        cout << 0 << '\n';
        return 0;
    }
    cout << x*y << '\n';

    // printf("ExecutionTime: %d /ms\n",1000*(int)((clock()-START_TIME)/CLOCKS_PER_SEC));
}

Measured memory_bytes: 6528
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

class UnionFind {
public:
    vl parent;  // 親ノード
    vl Siz;  // 集合の大きさ
    
    // コンストラクタ
    UnionFind(ll n): parent(n), Siz(n, 1) {
        rep(i, n) {
            parent[i] = i;
        }
    }

    // n要素で初期化
    void init(ll n) {
        parent.resize(n);
        Siz.assign(n, 1);
        rep(i, n) {
            parent[i] = i;
        }
    }

    // xの属する集合の根を求める
    ll root(ll x) {
        if(parent[x] == x) {
            return x;
        }
        else {
            return parent[x] = root(parent[x]);
        }
    }

    // xとyの属する集合を併合
    void unite(ll x, ll y) {
        x = root(x);
        y = root(y);
        if(x == y) {
            return;
        }
        if(Siz[x] < Siz[y]) {
            swap(x, y);
        }
        Siz[x] += Siz[y];
        parent[y] = x;
    }
    
    // xとyが同じ集合に属するかどうか
    bool same(ll x, ll y) {
        return root(x) == root(y);
    }

    // xの属する集合の要素数を求める
    ll size(ll x) {
        return Siz[root(x)];
    }
};
 
int main() {
    ll n, m;
    cin >> n >> m;

    vl p(n);
    rep(i, n) {
        cin >> p[i];
        p[i]--;
    }

    UnionFind Uni(n);
    Uni.init(n);
    rep(i, m) {
        ll x, y;
        cin >> x >> y;
        x--;  y--;
        Uni.unite(p[x], p[y]);
    }
    
    ll ans = 0;
    rep(v, n) {
        if(Uni.root(v) == Uni.root(p[v])) {
            ans++;
        }
    }

    out(ans);
    re0;
}

Measured memory_bytes: 2560