akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<vector>
#include<string>
#include <ios>     
#include <iomanip> 
using namespace std;
typedef long long llong;
typedef unsigned long long ullong;

const llong MOD = 1000000007;

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

llong lcm(llong a, llong b) {
	llong g = gcd(a, b);
	return a * b / g;
}

//ここまで共通

int N;
vector<pair<llong, llong>> V;

bool OPERATOR1(pair<llong, llong>X, pair<llong, llong>Y) {
	if (X.first == Y.first) return X.second > Y.second;

	else return X.first > Y.first;
}

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		llong x, y;
		cin >> x >> y;
		pair<llong, llong> p = make_pair(x, y);
		V.push_back(p);
	}

	sort(V.begin(), V.end(), OPERATOR1);

	/*
	for (int i = 0; i < V.size(); i++) {
		cout << V[i].first << ' ' << V[i].second << endl;
	}
	*/
	int ANS = N;

	for (int i = 0; i < N - 1; i++) {
		for (int j = i + 1; j < N; j++) {
			llong p, q,x,y;
			p = V[j].first - V[i].first;
			q = V[j].second - V[i].second;
			
			int ans = N;
			bool F[60] = { false };
			for (int k = i; k < N - 1; k++) {
				x = V[k].first + p;
				y = V[k].second + q;
				for (int l = j; l < N; l++) {
					if (F[l]) continue;

					if (V[l].first == x && V[l].second == y) {
						x += p;
						y += q;
						ans--;
						F[l] = true;
					}
				}
			}
			
			if (ans < ANS) ANS = ans;
		}
	}
	cout << ANS;
}

Measured memory_bytes: 256
import java.util.*;
import java.math.BigDecimal;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String r = sc.next();
		String g = sc.next();
		String b = sc.next();
		int rgb = new Integer(r + g + b).intValue();
		if (rgb % 4 == 0) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}

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

int main(){
int a, b,c,d;
  cin >> a >> b >> c >> d;
 int e = (a+d-1)/d;
  int f = (c+b-1)/b;
  
if(e == f)
  cout << "Yes" << endl;
else if(e < f)
  cout << "No" << endl;
  else
    cout << "Yes" << endl;  
}

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

int main(void){
    int n, m;
    std::cin >> n >> m;
    bool flag = false;

    std::vector<int> a(n, -1);
    int s, c;

    for(int i = 0; i < m; i++){
        std::cin >> s >> c;
        if(a[s-1] == -1 || a[s-1] == c){
            a[s-1] = c;
        }else{
            std::cout << -1 << std::endl;
            flag = !flag;
            break;
        }
    }

    
    //std::string ans = "";


    if(!flag){
        if(a[0] > 0){

        }else if(a[0] == -1 && n != 1){
            a[0] = 1;
        }else if(a[0] <= 0 && n == 1){
            std::cout << 0 << std::endl;
            flag = !flag;
        }else{
            std::cout << -1 << std::endl;
            flag = !flag;
        }
    }

    if(!flag){
        for(int i=1; i<n; i++){
            if(a[i]>0){

            }else{
                a[i] = 0;
            }
        }
        for(auto i : a){
            std::cout << i << "";
        }
        std::cout << std::endl;
    }
    
}

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

using namespace std;

typedef long long ll;

ll fd(ll i) {
    if(i % 4 == 0) return i;
    if(i % 4 == 1) return 1;
    if(i % 4 == 2) return i + 1;
    return 0;
}

int main() {
    ll a, b;
    cin >> a >> b;
    cout << (fd(a - 1) ^ fd(b));
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

typedef long long  ll;

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

int main() {
    ll n;
    ll m;
    cin>>n>>m;
    ll cnt=1;
    ll mod=1e9+7;
    ll f=1;
    //(N+M)PN*M!を求める 
    if(abs(n-m)<=1){
    if(m>=n){ 
   cnt=((m+n)/m)%mod;
    //cout<<cnt<<endl;
    for(int i=1;i<=m;i++){
        cnt*=i%mod;
        cnt=cnt%mod;
    }
   
    //cout<<cnt<<endl;
    for(int i=n;i>0;i--){
        cnt*=i%mod;
         cnt=cnt%mod;
    }
    }
    else{
       
    cnt=((n+m)/n)%mod;
   // cout<<cnt<<endl;
    for(int i=1;i<=n;i++){
        cnt*=i%mod;
         cnt=cnt%mod;
    }
    
    //cout<<cnt<<endl;
    for(int i=m;i>0;i--){
        cnt*=i%mod;
         cnt=cnt%mod;
    }
    }
    cout<<cnt<<endl;
    }
    else{
        cout<<0<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
int main()
{
    int max = -10000000; // 最大值
    int min = 10000000;  // 最小值
    long long sum = 0;   // 和
    int tmp;
    int num = 0; // 案例次数
    scanf("%d", &num);
    for (int i = 0; i < num; i++)
    {
        scanf("%d", &tmp);
        sum += tmp;
        if (tmp > max)
            max = tmp;
        if (tmp < min)
            min = tmp;
    }
    printf("%d %d %lld\n", min, max, sum);
    return 0;
}


Measured memory_bytes: 2752
# -*- coding: utf-8 -*-
"""
Created on Tue Jun  2 22:08:10 2020

@author: NEC-PCuser
"""

N, M, K =  map(int, input().split())
ans = "No"
for i in range(0, N + 1):
    for j in range(0, M + 1):
        kosu = i * M - 2 * j * i + j * N
        if (kosu == K):
            ans = "Yes"
            break
    else:
        continue
    break
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
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; }
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long int ll;
typedef long double ld;
const ll INF=(1LL<<62);
const ld pi=acosl((ld)-1);
const ll mod = 1000000007;
// const ll mod = 1234567;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
#define endn "\n"
#define TO_STRING(VariableName) # VariableName

template <typename T>ostream &operator<<(ostream &out,const vector<T> &v) {rep(i,(int)v.size()-1)cout<<v[i]<<" ";cout<<v[(int)v.size()-1];return out;}
template <typename T1, typename T2>ostream &operator<<(ostream &out, const map<T1, T2> &p) {out << "(" << p.first << ", " << p.second << ")";return out;}
template <typename T1, typename T2>ostream &operator<<(ostream &out, const pair<T1, T2> &p){out << "(" << p.first << ", " << p.second << ")";return out;}
template<class T>void debag(const T &obj){cout<<obj<<endl;}

bool solve(){
  ll x;cin>>x;
  ll num=100;
  ll i=0;
  while(num<x){
    i++;
    num=num+num/100;
  }
  cout<<i<<endl;
  return false;
}

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout<<fixed<<setprecision(30);
  solve();
}


Measured memory_bytes: 3640
using System;
using System.Collections;
using System.Linq;
class Program{
    static void Main(){
        while (true){
            int[] nm = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            int n = nm[0], m = nm[1];
            if (n == 0 && m == 0)
                break;
            int[][] dp = new int[n][];
            for (int i = 0; i < n; i++)
                dp[i] = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            Array.Sort(dp, (a, b) => a[1] - b[1]);
            Array.Reverse(dp);
            long ans = 0;
            for (int i = 0; i < n; i++){
                ans += dp[i][0] * dp[i][1];
                if (dp[i][0] > m){
                    ans -= dp[i][1] * m;
                    m = 0;
                }
                else{
                    m -= dp[i][0];
                    ans -= dp[i][0] * dp[i][1];
                }
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 10456
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <cmath>
#include <ios>
#include <ctype.h>
#include <stack>
#include <istream>
#include <stdio.h>
#include <map>
#include <set>
#include <queue>
#include <unordered_map>
#include <functional>
#include <bitset>
#include <list>
#include <deque>
#include <time.h>
#include <random>
#include <iomanip>
#include <fstream>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
#define pint pair<int,int>
#define SEG_LEN (1 << 20)
const int INF = 1000000007;
const long double EPS = 1e-15;
const long double PI = acos(-1);
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
using Graph_weighted = vector<vector<pair<int,int>>>;
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
ll ceil(const ll a, const ll b) { return (a + b - 1) / b; }
int main(){
  string s;
  int k;
  cin >> s >> k;
  map<string,bool>ans;
  int n = s.size();
  rep(i,n)REP(j,1,6)if(i + j - 1 < n)ans[s.substr(i,j)] = true;
  int cnt = 0;
  for(auto i : ans){
    cnt++;
    if(cnt == k){
      cout << i.first << endl;
      return 0;
    }
  }
  return 0;
}
 

Measured memory_bytes: 1920
# coding: utf-8
N = gets.to_i
X = []
Y = []
N.times do |_|
  _x, _y = gets.split.map {|e| e.to_i}
  X << _x
  Y << _y 
end
ansA = []

# 順列分繰り返し
towns = (0..N-1).to_a
towns.permutation(towns.size).each do |ptn|
  _m = ptn.size - 2
  _sum = 0.0
  (0.._m).each do |i|
    fi = ptn[i]
    ti = ptn[i+1]
    _sum += Math.sqrt(((X[fi] - X[ti])**2) + ((Y[fi] - Y[ti])**2))
  end
  ansA << _sum
end

# 平均値を算出
puts ansA.inject(:+) / ansA.size



Measured memory_bytes: 2464
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP for(int i=n-1;i>=0;i--)

int main()
{
	int a,b,m;

	cin>>a>>b>>m;
	int aCost[a], bCost[b], mValues[m][3];

	REP(i,a)
	{
		cin>>aCost[i];

	}

	REP(i,b)
	{
		cin>>bCost[i];
	}

	REP(i,m)
	{
		cin>>mValues[i][0]>>mValues[i][1]>>mValues[i][2];
		mValues[i][0]--;
		mValues[i][1]--;
	}

	int dmin = INT_MAX;
	REP(i,m)
	{
		int tempCost = aCost[mValues[i][0]] + bCost[mValues[i][1]] - mValues[i][2];
		if(tempCost<dmin)
			dmin = tempCost;
	}

	sort(aCost,aCost+a);
	sort(bCost,bCost+b);
	int nmin = aCost[0]+bCost[0];
	
  
	(dmin<nmin)? cout<<dmin:cout<<nmin;


  return 0;
}


Measured memory_bytes: 2176
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


#隣接リスト 1-order
def make_adjlist_d(n, edges):
    res = [[] for _ in range(n + 1)]
    for edge in edges:
        res[edge[0]].append(edge[1])
        res[edge[1]].append(edge[0])
    return res


def make_adjlist_nond(n, edges):
    res = [[] for _ in range(n + 1)]
    for edge in edges:
        res[edge[0]].append(edge[1])
    return res


#nCr
def cmb(n, r):
    return math.factorial(n) // math.factorial(r) // math.factorial(n - r)


def main():
    N = NI()
    A = sorted(NLI())
    ans = 1
    for a in A:
        ans *= a
        if ans > 10**18:
            print(-1)
            exit()
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 22568
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()

ll inq(ll x, ll y)
{
    if (!y) return 1;
    ll l = inq(x, y / 2);
    if (y % 2) return l * l * x;
    return l * l;
}

signed main()
{
    ll n, c;
    cin >> n >> c, c *= n;
    vector<ll> Len(n), p(n - 1);
    forn(i, n) cin >> Len[i], Len[i] *= n;
    sort(all(Len));
    iota(all(p), 0);
    ll good = 0, all_ways = 0, k = (1 << (n - 1)), we, le, m2, wc;
    do {
        all_ways += inq(c / n, n - 1);
        vector<vector<ll> > dp(c + 1, vector<ll>(k));
        dp[Len.back()][0] = 1;
        forn(i, c)
        {
            if (i % n == 0) continue;
            we = p[i % n - 1];
            le = Len[we];
            forn(mask, k)
            {
                if ((1 << we) & mask) continue;
                m2 = mask + (1 << we);
                for (ll ac = i; ac <= c; ac++)
                {
                    wc = max(ac, min(c, le + i));
                    dp[wc][m2] += dp[ac][mask];
                }
            }
        }
        good += dp[c][k - 1];
    } while (next_permutation(all(p)));
    printf("%.15f", 1.0 * good / all_ways);
}


Measured memory_bytes: 384
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define ll long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int INF = 1e8;

signed main() {
	int N;
	cin >> N;
	cout << lcm(2, N);
}

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

using namespace std;

int main(void){
    int n, m;
    cin >> n >> m;
    if(n == m){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main() {
  int i, count;
  count = 0;
  char S[3];
  char T[3];
  scanf("%s", S);
  scanf("%s", T);
  for (i = 0; i < 3; ++i) {
    if (S[i] == T[i]) {
      ++count;
    }
  }
  printf("%d", count);
  return 0;
}

Measured memory_bytes: 256
K = int(input())
A = list(map(int, input().split()))

_min=2
_max=2

for a in A[::-1]:
  # min ~ maxでaの倍数 minはそのまま、maxは＋(a-1)
  if _min%a:
    if a*(_min//a) + a > _max:
      print(-1)
      break
    else:
      _min = a*(_min//a) + a
  else:
    _min = _min
  
  _max = a*(_max//a) + a-1
else:
  print(_min, _max)

Measured memory_bytes: 14252
void main()
{
    long[] tmp = readln.split.to!(long[]);
    long n = tmp[0], m = tmp[1];

    long[] dp = new long[](1<<n);
    dp[1..$] = 1L << 60;
    foreach (i; 0 .. m)
    {
        tmp = readln.split.to!(long[]);
        long a = tmp[0], b = tmp[1];
        long[] c = readln.split.to!(long[]);

        long pos;
        foreach (x; c)
        {
            pos |= 1 << (x - 1);
        }

        foreach (j; 0 .. 1<<n)
        {
            dp[j|pos] = min(dp[j|pos], dp[j]+a);
        }
    }

    writeln(dp[$-1] != 1L << 60 ? dp[$-1] : -1);
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 2684
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>

using namespace std;

int main()
{
	int n, a;
	cin >> n >> a;
	cout << n * n - a << endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define int long long
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

vector<int> init(int size){
  vector<int> par(size,-1);
  return par;
}

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

bool same(int x, int y, vector<int>& par){
  return root(x, par) == root(y, par);
}

void unite(int x, int y, vector<int>& par){
  x = root(x, par), y = root(y, par);
  if(same(x,y, par))return;
  par[x] += par[y];
  par[y] = x;
}

int size(int x, vector<int>& par){
  return -par[root(x, par)];
}

int pow(int x, int n){
  if(n == 0)return 1;
  if(n % 2 == 0)return pow(x * x % MOD, n/2);
  else return x * pow(x, n-1) % MOD;
}

signed main(){
  int n;cin>>n;int cnt = 0;
  int p;
  rep(i,n){
    cin>>p;
    if(p != (i+1))cnt++;
  }
  if(cnt == 2 || cnt == 0)cout << "YES" << endl;
  else cout << "NO" << endl;
}


Measured memory_bytes: 256
#coding:utf-8
w, h, x, y = map(int, input().split())

#与えられた点が中心を通ればどちらにしろ半分ずつに分割
if x == w/2 and y == h/2:
    print((w*h)/2, 1)
else:
    print((w*h)/2, 0)

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

string solve(string a, string b, string c, int x, int y, int z) {
	if (y + z == 0) {
		string res = "";
		for (int i = 0; i < x; ++i) res += a;
		return res;
	}
	if (x == 0) return solve(b, c, "", y, z, 0);
	int p = x / (y + z);
	int r = x % (y + z);
	string A = "";
	for (int i = 0; i < p; ++i) A += a;
	if (z >= r) return solve(A + a + c, A + b, A + c, r, y, z - r);
	else return solve(A + a + b, A + a + c, A + b, r - z, z, y + z - r);
}

int main() {
	int x, y, z;
	while (cin >> x >> y >> z) {
		cout << solve("a", "b", "c", x, y, z) << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
    enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
    ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
    *this << "[";
    for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
    ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef long long ll;

int mxn = 2e5+5, n;
ll k;
vector<vector<int>> adj(mxn);
vector<int> vis(mxn), level(mxn);
int cyc_start, cyc_end;
vector<int> path;

void dfs()
{
	stack<int>st;
	st.push(1);
	bool ok = true;
	while (!st.empty() && ok) {
		int cur = st.top();
		st.pop();
		path.push_back(cur);
		vis[cur] = 1;
		for (int x:adj[cur]) {
			if (!vis[x]) {
				level[x] = level[cur] + 1;
				st.push(x);
			}
			else {
				cyc_start = x;
				cyc_end = cur;
				ok = false;
				break;
			}	
		}
	}
}

void solve()
{
	cin>>n>>k;
	for (int i=1; i<=n; i++) {
		int x;
		cin>>x;
		adj[i].push_back(x);
	}
	dfs();
	debug() << imie(path);
	if (k <= level[cyc_end]) {
		cout << path[k] << "\n";
		return;
	}
	k -= level[cyc_start];
	k = k%(level[cyc_end] - level[cyc_start] + 1);
	cout << path[level[cyc_start]+k] << "\n";
}

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

Measured memory_bytes: 16732
#include "stdio.h"

int ido(int x,int y,int aw[90][90])
{
int a[90][90];
for(int i = 0; i < 90; i++)
{
for(int ii = 0; ii < 90; ii++)
{
a[i][ii] = aw[i][ii];
}
}
a[x][y] = 0;
int max = 0;
if(x + 1 < 90)
{
if(a[x + 1][y] == 1)
{
int w = ido(x + 1,y,a);
if(max < w)
{
max = w;
}
}
}
if(0 <= x - 1)
{
if(a[x - 1][y] == 1)
{
int w = ido(x - 1,y,a);
if(max < w)
{
max = w;
}
}
}
if(y + 1 < 90)
{
if(a[x][y + 1] == 1)
{
int w = ido(x,y + 1,a);
if(max < w)
{
max = w;
}
}
}
if(0 <= y - 1)
{
if(a[x][y - 1] == 1)
{
int w = ido(x ,y - 1,a);
if(max < w)
{
max = w;
}
}
}
return max + 1;
}

int main()
{
while(1)
{
int m,n;
scanf("%d",&m);
scanf("%d",&n);
if(n == 0 && m == 0)
{
break;
}
int aw[90][90];
for(int i = 0; i < 90; i++)
{
for(int ii = 0; ii < 90; ii++)
{
aw[i][ii] = 0;
}
}
for(int i = 0; i < n; i++)
{
for(int ii = 0; ii < m; ii++)
{
scanf("%d",&aw[i][ii]);
}
}
int max = 0;
for(int i = 0; i < n; i++)
{
for(int ii = 0; ii < m; ii++)
{
if(aw[i][ii] == 1)
{
int h = 0;
if(0 <= i - 1)
{
h += aw[i - 1][ii];
}
if(i + 1 < 90)
{
h += aw[i + 1][ii];
}
if(0 <= ii - 1)
{
h += aw[i][ii - 1];
}
if(ii + 1 < 90)
{
h += aw[i][ii + 1];
}
if(h == 1)
{
int w = ido(i,ii,aw);
if(max < w)
{
max = w;
}
}
}
}
}
printf("%d\n",max);
}
return 0;
}

Measured memory_bytes: 2072
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int sum = A+B;
        if(sum>=10){
            System.out.println("error");
        }else{
            System.out.println(sum);
        }
    }
}


Measured memory_bytes: 22228
#include <iostream>

using namespace std;

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

    int cnt_o = 0, cnt_f = 0;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;

        if (a % 2 != 0) {
            cnt_o++;
        } else if (a % 4 == 0) {
            cnt_f++;
        }
    }

    cout << (cnt_o <= cnt_f || (cnt_o == cnt_f + 1 && cnt_o + cnt_f == n) ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep2(i,m,n) for (int i = (int)(m); i < (int)(n); i++)
#define rep(i,n) rep2(i,0,n)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
using namespace std;
using ll = long long;
template <typename T>
T sq(T x){
  return x * x;
}

signed main (){
  char c;
  cin >> c;

  if(c == 'a' || c == 'i' ||c == 'u'||c == 'e' ||c =='o'){

cout << "vowel" <<endl;

  }else{

cout << "consonant" << endl;

  }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    int n;
    cin>>n;
    int ans=0;
    for(int a=1;a*a<=n;a++){
        for(int b=a;b*a<=n;b++){
            int c=n-a*b;
            if(c>0){
                if(a==b) ans++;
                else ans+=2;
            }
        }
    }
    cout<<ans;
}

Measured memory_bytes: 3632
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int calc(string t,char c){
    int cnt=0, res=-1;
    t=c+t;
    rrep(i,t.size()-1){
        if(t[i]==c){
            chmax(res,cnt);
            cnt=0;
        }else{
            cnt++;
        }
    }
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s;
    cin>>s;
    
    int ans=INF;
    rep(i,26){
        chmin(ans,calc(s,'a'+i));
    }
    cout1(ans)
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define BUGAVOID(x) x
#define rep(...) BUGAVOID(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define sz(c) (int)(c.size())
#define all(c) c.begin(),c.end()
#define ms(a,v) memset(a,v,sizeof(a))
#define mp make_pair
#define write(x) cout<<(x)<<endl
using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll;
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; }
constexpr ll pow2(const int n) { return 1ll << n; }
const int INF = 1 << 28; const ll LINF = 1ll << 60;
const int MAX = 1e5 + 5; const int MOD = 1e9 + 7; const double EPS = 1e-6;
const int dy[4] = { 0,1,0,-1 }; const int dx[4] = { 1,0,-1,0 };
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;
// 1. 問題よくよめえええええええええええええええええええええええええ
// 2. intオーバーフロー << * + あたり
// 3. 落ち着け

int N;
string s;

vector<ll> cnt;

int main() {
    cin >> N >> s;
    cnt.resize(26, 0);
    
    rep(i, N) {
        cnt[s[i] - 'a']++;
    }

    ll ans = 0;
    rep(i, 26) {
        if (cnt[i]) {
            if (ans == 0) {
                ans += cnt[i];
            }
            else {
                ans = ((ans + ans * cnt[i] % MOD) % MOD + cnt[i]) % MOD;
            }
        }
    }

    write(ans);
}

Measured memory_bytes: 512
from Queue import Queue
INF = 20000000
q = Queue()
dx = [-1, 0, 1, 0]
dy = [0, -1, 0, 1]
smp = [[INF for i in range(1002)] for j in range(1002)]
mp = [['X' for i in range(1002)] for j in range(1002)]
H, W, n = map(int,raw_input().split())
for i in range(1, H+1):
    ipt = raw_input()
    for j in range(1, W+1):
        mp[i][j] = ipt[j-1];
x = y = 0
for i in range(1, H+1):
    for j in range(1, W+1):
        if mp[i][j]=='S':
            x = j; y = i;
c = 0; ans = 0;
q.put([x,y]); smp[y][x] = 0;
while c<n:
    p = q.get()
    x = p[0]; y = p[1];
    if mp[y][x]==chr(ord('1')+c):
        ans += smp[y][x]; c+=1;
        if c==n: break;
        while q.empty()==False: q.get()
        for i in range(1, H+1):
            for j in range(1, W+1):
                smp[i][j] = INF
        smp[y][x] = 0
    for i in range(4):
        if mp[y+dy[i]][x+dx[i]]!='X' and smp[y+dy[i]][x+dx[i]]==INF:
            q.put([x+dx[i], y+dy[i]]);
            smp[y+dy[i]][x+dx[i]] = smp[y][x]+1;
print(ans)

Measured memory_bytes: 33280
#!/usr/bin/env python3

#import
#import math
#import numpy as np
S = input()
ls = len(S)

li = [0] * ls

r = 0
l = 0

for i in range(ls):
    if S[i] == "L":
        l += 1
    else:
        if l == 0:
            r += 1
        else:
            li[i - l] += r // 2 + (l + 1) // 2
            li[i - l - 1] += (r + 1) // 2 + l // 2

            r = 1
            l = 0

li[ls - l] += r // 2 + (l + 1) // 2
li[ls - l - 1] += (r + 1) // 2 + l // 2

li = [str(li[i]) for i in range(ls)]

print(" ".join(li))




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

long long a[4]={0};

int main(void){
	long long q, h, s, d, n, ans = 0;
	cin >> q >> h >> s >> d >> n;

	if(n%2==1){
		a[0] = 4*q;
		a[1] = 2*h;
		a[2] = s;
		sort(a, a+3);
		ans += a[0];
	}

	n /= 2;

	a[0] = 8*q;
	a[1] = 4*h;
	a[2] = 2*s;
	a[3] = d;
	sort(a, a+4);

	ans += n*a[0];

	cout << ans << endl;

	return 0;
}

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

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define X                           first
#define Y                           second
#define Mp                          make_pair
#define sep                         ' '
#define endl                        '\n'
#define debug(x)                    cerr << #x << " = " << x << endl
#define SZ(x)                       ll(x.size())
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define set_random                  mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

set_random;

const ll MAXN = 1e6 + 10;
const ll INF = 8e18;
const ll MOD = 1e9 + 7; // 998244353; // 1e9 + 9;

ll n , x;
string s;
pair<string , pll> p[MAXN];

int main() {
    fast_io;

    cin >> n;
    for(ll i = 1 ; i <= n ; i++){
        cin >> s >> x;
        p[i] = {s , {-x , i}};
    }
    sort(p + 1 , p + n + 1);

    for(ll i = 1 ; i <= n ; i++)    cout << p[i].Y.Y << endl;

    return 0;
}
/*

*/


Measured memory_bytes: 23680
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
typedef long long ll;
int main() {
  int r, D, x_2000; cin >> r >> D >> x_2000;
  vector<int> a(10);
  a[0]=r*x_2000 - D; cout << a[0] << endl;
  for(int i=1; i<10;i++) {
    a[i]=r*a[i-1] - D;
    cout << a[i] << endl;
  
  }
  
}       

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using namespace std;
int main()
{
    int n,k,i,j,sum=0;
    scanf("%d%d",&n,&k);
    int a[n];
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    sort(a,a+n);
    for(i=n-1;i>n-k-1;i--)
    {
        sum+=a[i];
    }
    printf("%d\n",sum);
}


Measured memory_bytes: 128
a,b,k=map(int,input().split())

while k>0:
  if a%2==0:
    b+=a/2
    a-=a/2
  else:
    a-=1
    b+=a/2
    a-=a/2
  
  k-=1
  if k==0:
    break
    
  if b%2==0:
    a+=b/2
    b-=b/2
  else:
    b-=1
    a+=b/2
    b-=b/2
    
  k-=1
  
print(int(a),int(b))

Measured memory_bytes: 3064
#include<iostream>
#include<iomanip>
//#include<cstdio>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cassert>
using namespace std;
typedef long long ll;
const int Nmax = 100;
int N, A[Nmax], B[Nmax], C[Nmax], D[Nmax];
const int INF = 1e8;

struct edge {
	int to, cap, rev; // destination, capacity, index for reversed edge
};

class FlowGraph{
	vector<vector<edge> > graph;
	int dfs(int v, int t, int f, vector<bool> &used){
		if(v == t) return f;
		used[v] = true;
		for(int i=0; i<graph[v].size(); i++){
			edge &e = graph[v][i];
			if(!used[e.to] && e.cap > 0){
				int d = dfs(e.to, t, min(e.cap, f), used);
				if(d>0){
					e.cap -= d;
					graph[e.to][e.rev].cap += d;
					return d;
				}
			}
		}
		return 0;
	}

	public:
	FlowGraph(int n_vertex){
		graph = vector<vector<edge> >(n_vertex);
	}

	void add_edge(int from, int to, int cap){
		graph[from].push_back((edge){to, cap, (int)graph[to].size()});
		graph[to].push_back((edge){from, 0, (int)graph[from].size()-1});
	}

	unsigned int size(){
		return graph.size();
	}

	int max_flow(int s, int t){
		int flow = 0;
		while(true){
			vector<bool> used(size(), false);
			int f = dfs(s, t, INF, used);
			if(f==0) return flow;
			flow += f;
		}
	}

};

int main(){
	cin >> N;
	for(int i=0; i<N; i++) cin >> A[i] >> B[i];
	for(int i=0; i<N; i++) cin >> C[i] >> D[i];

	FlowGraph fg(2*N+2);
	for(int i=0; i<N; i++){
		for(int j=0; j<N; j++){
			if(A[i]<C[j]&&B[i]<D[j]) fg.add_edge(i, j+N, 1);
		}
	}

	for(int i=0; i<N; i++){
		fg.add_edge(2*N, i, 1);
		fg.add_edge(i+N, 2*N+1, 1);
	}

	cout << fg.max_flow(2*N, 2*N+1) << endl;

	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>
#include <functional> 
#include <vector>
#include <numeric>
#include <stack>
#include <queue>
#include <utility>
#include <map>
#include <cstdlib>
typedef long long ll;
#define fi first
#define se second
 
using namespace std;

long long kaijo(int x){
    if(x == 0) return 1;
    return x*kaijo(x-1);
}

//整数の累乗 xのy乗
ll ruijo(int x,int y){
    if(y == 0) return 1;
    else return x*ruijo(x,y-1);
}

ll nCk[60][60];
ll nck(int n, int k){
    if(k == 0 || n == k) return 1;
    if(nCk[n][k] != 0) return nCk[n][k];
    return nCk[n][k] = nck(n-1,k-1) + nck(n-1,k);
}
 
int main(){
 
    int n,p,k=0;
    cin >> n >> p;

    for(int i=0;i<n;i++){
        int a;
        cin >> a;
        if(a%2) k++;
    }

    ll ans = 0;
    for(int i=0;i<=k;i += 2){
        ans += nck(k,i)*ruijo(2,n-k);
    }

    if(p == 0)cout << ans;
    else cout << ruijo(2,n) - ans;
  	//cout << nck(9,4);

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
ll n;
cin >> n;
if(n>=30){
cout<<"Yes"<<endl;
}
else{
cout <<"No"<<endl;
}
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

string S;
ll K;

int main(void){
    
    cin >> S >> K;
    ll first = 0;
    for(ll i = 0; i < S.size() && i < K && S[i] == '1'; ++i) ++first;
    
    if(first == K) cout << 1 << endl;
    else cout << S[first] << endl;
    
    return 0;
}


Measured memory_bytes: 256
import sys

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


def main():
    m1, d1 = map(int, readline().split())
    m2, d2 = map(int, readline().split())

    if m1 != m2:
        print(1)
    else:
        print(0)


if __name__ == '__main__':
    main()


Measured memory_bytes: 61872
#include<cstdio>
#include<iostream>
using namespace std;
const int Maxn=200000+10;
char s[Maxn];
int n,cnt,ans;
int main()
{
	scanf("%d",&n);
	scanf("%s",s+1);
	for(int i=1;i<=n;++i)
	if(s[i]=='W')++cnt;
	for(int i=n-cnt+1;i<=n;++i)
	if(s[i]=='R')++ans;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3996
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] W = new int[N];
		int sum = 0;
		for (int i = 0; i < N; i++) {
			W[i] = sc.nextInt();
			sum += W[i];
		}
		sc.close();

		int now = 0;
		int prev = 0;
		for (int i = 0; i < N; i++) {
			now += W[i];

			if (now >= sum / 2) {
				prev = now - W[i];
				break;
			}
		}

		System.out.println(Math.min(Math.abs(sum - now * 2), Math.abs(sum - prev * 2)));
	}
}


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

const int MAX = 510000;
const int MOD = 1000000007;
const int MAX_N = 200000;

ll N;

ll calc_head(ll x){
  ll d=100000;
  ll ret=1;
  while(d!=0){
    if(x/d!=0){
      ret = x/d;
      break;
    }
    d/=10;
  }
  return ret;
}

ll calc_tail(ll x){
  return x%10;
}

ll calc_digit(ll x){
  ll d=100000;
  ll cnt=0;
  while(x!=0){
    x /= 10;
    cnt++;
  }

  return cnt;
}


int main(int argc, const char * argv[]) {
  cin >> N;

  ll cnt=0;
  ll cnt1=0;
  ll cnt2=0;
  ll cnt3=0;
  for(ll i=1;i<=N;i++){
    ll head = calc_head(i);
    ll tail = calc_tail(i);
    ll N_digit = calc_digit(N);
    if(tail==0) continue;

    // 1桁の相手の個数をカウント
    if(head==tail) cnt1++;

    // Nの桁数-1までの相手の個数をカウント
    ll d=1;
    for(ll i=1;i<N_digit-1;i++){
      cnt2 += d;
      d *= 10;
    }


    // Nの桁数の場合の相手の個数をカウント
    ll x = tail*pow(10,N_digit-1)+head;
    if(N>=x && N_digit!=1){
      ll N_head = calc_head(N);
      ll N_tail = calc_tail(N);
      ll x_head = tail;
      ll x_tail = head;
      if(N_head==x_head){
        ll save_N=N;
        if(N_tail>x_tail){
          save_N = (save_N/10)*10 + x_tail;
        }else if(N_tail<x_tail){
          save_N = (save_N/10)*10  + x_tail - 10;
        }
        
        cnt3 += (save_N - x)/10 + 1;
        
      }else if(N_head > x_head){
        cnt3 += d;
      }
    }
    // printf("i:%ld cnt1:%ld cnt2:%ld cnt3:%ld total:%ld \n", i,cnt1,cnt2,cnt3,cnt1+cnt2+cnt3);

    cnt+=cnt1+cnt2+cnt3;
    cnt1=0; cnt2=0; cnt3=0;

  }

  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'

const int mod = 1000000007;

struct mint {
    ll x;

    mint(ll x = 0) : x((x % mod + mod) % mod) {}

    mint operator-() const { return mint(-x); }

    mint &operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }

    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }

    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }

    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }

    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    mint inv() const {
        return pow(mod - 2);
    }

    mint &operator/=(const mint a) {
        return (*this) *= a.inv();
    }

    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

mint comb(int N , int C){
    mint res = N;
    for(int i = N - 1; i >= N - C + 1; i--){
        res *= i;
    }
    mint div = 1;
    for(int i = 1; i <= C; i++){
        div *= i;
    }
    return res / div;
}

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

    mint ans(2);
    ans = ans.pow(n);
    ans -= 1;

    mint A = comb(n,a);
    mint B = comb(n,b);
    ans = ans - A - B;
    cout << ans.x << endl;
}

Measured memory_bytes: 256
//F5で実行 Shift+F5で停止
//F9でブレークポイント
#include<cmath>
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
//Shift+PageUpで上部の大半を選択できる
// 1e18 = 10の18乗

int N;
int A[100];
int a, b;
string S,T;
string ans = "";

void _main() {
	cin >> N;
	cin >> S >> T;

	rep(i, 0, N) {
		ans += S[i];
		ans += T[i];
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int n= sc.nextInt();
		int a[]=new int[n];
		long shiguma=0;
		int sabunn=0;


		for(int i=0;i<n;i++) {
			a[i]=sc.nextInt();
			if(i==0) {
				sabunn=a[i];

			}
			else {
				sabunn=a[i]-a[i-1];

			}

			if(sabunn<0)
				sabunn=-sabunn;

			shiguma+=sabunn;

		}
		sabunn=a[n-1];
		if(sabunn<0)
			sabunn=-sabunn;
		shiguma+=sabunn;

		for(int i=0;i<n;i++) {
			if(i==0) {
				sabunn=returnSabunn(0, a[i], a[i+1]);

			}
			else if(i==n-1) {
				sabunn=returnSabunn(a[i-1], a[i], 0);
			}
			else {
				sabunn=returnSabunn(a[i-1], a[i], a[i+1]);
			}
			System.out.println(shiguma-sabunn);
		}

	}

	public static int returnSabunn(int ichi, int ni, int sann) {
		if(ni>=ichi&&sann>=ni||ni<=ichi&&sann<=ni||ni==ichi||ni==sann) {
			return 0;
		}
		else {
				int sabunnA=ni-sann;
				if(sabunnA<0)
					sabunnA=-sabunnA;
				int sabunnB=ni-ichi;
				if(sabunnB<0)
					sabunnB=-sabunnB;

				if(sabunnA<sabunnB)
					return sabunnA*2;
				else
					return sabunnB*2;

		}
	}

}


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

using namespace std;
#define local
#ifdef local

template<class T>
void _E(T x) { cerr << x; }

void _E(double x) { cerr << fixed << setprecision(6) << x; }

void _E(string s) { cerr << "\"" << s << "\""; }

template<class A, class B>
void _E(pair<A, B> x) {
    cerr << '(';
    _E(x.first);
    cerr << ", ";
    _E(x.second);
    cerr << ")";
}

template<class T>
void _E(vector<T> x) {
    cerr << "[";
    for (auto it = x.begin(); it != x.end(); ++it) {
        if (it != x.begin()) cerr << ", ";
        _E(*it);
    }
    cerr << "]";
}

void ERR() {}

template<class A, class... B>
void ERR(A x, B... y) {
    _E(x);
    cerr << (sizeof...(y) ? ", " : " ");
    ERR(y...);
}

#define debug(x...) do { cerr << "{ "#x" } -> { "; ERR(x); cerr << "}" << endl; } while(false)
#else
#define debug(...) 114514.1919810
#endif
#define _rep(n, a, b) for (ll n = (a); n <= (b); ++n)
#define _rev(n, a, b) for (ll n = (a); n >= (b); --n)
#define _for(n, a, b) for (ll n = (a); n < (b); ++n)
#define _rof(n, a, b) for (ll n = (a); n > (b); --n)
#define oo 0x3f3f3f3f3f3f3f3f
#define ll  long long
#define db long double
#define eps 1e-3
#define bin(x) cerr << bitset<10>(x) << endl
#define what_is(x) cerr << #x << " is " << x << endl
#define met(a, b) memset(a, b, sizeof(a))
#define all(x) x.begin(), x.end()
#define pii pair<ll, ll>
#define pdd pair<db, db>
#define endl "\n"
const ll mod = 1e9 + 7;
const ll maxn = 1e6 + 10;
const db pi = acos(-1.0);

ll qpow(ll a, ll b) {
    ll ret = 1;
    for (; b; a = a * a % mod, b >>= 1) {
        if (b & 1) {
            ret = ret * a % mod;
        }
    }
    return ret;
}

vector<ll> f(maxn), invf(maxn);

ll inv(ll a) {
    return qpow(a, mod - 2);
}

void prework() {
    f[0] = 1;
    _rep(i, 1, maxn - 1) {
        f[i] = f[i - 1] * i % mod;
    }
    invf[maxn - 1] = qpow(f[maxn - 1], mod - 2);
    for (ll i = maxn - 2; i >= 0; i--) {
        invf[i] = invf[i + 1] * (i + 1) % mod;
    }
}

ll C(ll n, ll m) {
    if (n > m || m < 0)return 0;
    if (n == 0 || m == n) return 1;
    ll res = (f[m] * invf[m - n] % mod * invf[n]) % mod;
    return res;
}


signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector<ll> dp(n + 1);
    dp[3] = 1;
    _rep(i, 4, n) {
        dp[i] = 1;
        _rep(j, 1, i - 3) {
            dp[i] = (dp[j] + dp[i]) % mod;
        }
    }

    cout << dp[n] << endl;
}

Measured memory_bytes: 18636
#include <iostream>

using namespace std;

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

	bool ret = a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0;
	cout << (ret ? "Possible" : "Impossible") << endl;
	return 0;
}


Measured memory_bytes: 256
function Main(s){
  var n = +s;
  var ans = "No";
  for(var i = 0; i < n; i++){
    if(i * 4 > n)break;
    if((n - i * 4) % 7 === 0)ans = "Yes";
  }
  console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin","utf8"));

Measured memory_bytes: 21064
// In the name of God

#include <bits/stdc++.h>

using namespace std;

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

	int n;
	cin >> n;

	vector<int> v(n);

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

	int x = 0;

	for(int i = 0; i < n - 2; i += 2) {
		x ^= v[i];
		x ^= v[i + 1];
	}

	vector<int> a(n);

	a[n - 1] = x ^ v[n - 2];

	for(int i = 0; i < n - 1; i++) {
		a[i] = a[n - 1] ^ v[n - 1] ^ v[i];
	}

	for(int i = 0; i < n; i++) cout << a[i] << " ";

	
	return 0;
}


Measured memory_bytes: 4752
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int res = (int) ((int) a + Math.pow(a, 2) + Math.pow(a, 3));
        System.out.println(res);

    }

}

Measured memory_bytes: 35704
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define enter putchar('\n')
#define space putchar(' ')
#define MAXN 500005
#define eps 1e-8
//#define ivorysi
using namespace std;
typedef long long int64;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;char c = getchar();T f = 1;
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 + c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
const int MOD = 998244353;
int N,K,fac[MAXN * 2],invfac[MAXN * 2],inv[MAXN * 2];
int inc(int a,int b) {
    return a + b >= MOD ? a + b - MOD : a + b;
}
int mul(int a,int b) {
    return 1LL * a * b % MOD;
}
int C(int n,int m) {
    if(n < m) return 0;
    return mul(fac[n],mul(invfac[m],invfac[n - m]));
}
void update(int &x,int y) {
    x = inc(x,y);
}
void Solve() {
    read(N);read(K);
    inv[1] = 1;
    for(int i = 2 ; i <= 1000000 ; ++i) inv[i] = mul(inv[MOD % i],MOD - MOD / i);
    invfac[0] = fac[0] = 1;
    for(int i = 1 ; i <= 1000000 ; ++i) {
	fac[i] = mul(fac[i - 1],i);
	invfac[i] = mul(invfac[i - 1],inv[i]);
    }
    int ans = 0;
    for(int i = 0 ; i <= K ; ++i) {
	int r = i,b = K - i;
	if(r < b || r < N) continue;
	if(r - (N - 1) > b) {
	    update(ans,C(K,r));
	}
	else if(r == b) {
	    int t = r - (N - 1);
	    update(ans,inc(C(K - 1,r),MOD - C(K - 1,r + t)));
	}
	else {
	    int t = r - (N - 1);
	    update(ans,inc(C(K,r),MOD - C(K,r + t)));
	}
    }
    out(ans);enter;
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}


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

void solve()
{
	ll n,a,b,c;;
	cin >> n;
	ll dp[n+1][3];
	// ll a[n];
	cin >> a >> b >> c;
	dp[1][0]=a;
	dp[1][1]=b;
	dp[1][2]=c;
	for(ll i=2;i<=n;i++)
	{
		cin >> a >> b >> c;
		dp[i][0]=a+max(dp[i-1][1],dp[i-1][2]);
		dp[i][1]=b+max(dp[i-1][0],dp[i-1][2]);
		dp[i][2]=c+max(dp[i-1][0],dp[i-1][1]);
	}
	cout << max(max(dp[n][0],dp[n][1]),dp[n][2]);
}
int main()
{
	//#ifndef ONLINE_JUDGE
	//freopen("input.txt","r",stdin);
	//freopen("ouput.txt","w",stdout);
	//#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	solve();
	return 0;
}

Measured memory_bytes: 5984
#include<bits/stdc++.h>
using namespace std;
#define fio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define inf 1000000009
ll dp[100009];
ll a[100009];
ll n,k;

ll jump(ll i)
{
    if(i==n)
    return 0;
    
    if(i>n)
    return inf;
    
    if(dp[i]!=-1)
    return dp[i];
    else
    dp[i]=inf;
    for(ll j=i+1;j<=i+k;j++)
    dp[i]=min(dp[i],jump(j)+abs(a[i]-a[j]));
    
    return dp[i];
}


int main()
{
    fio;
    cin>>n>>k;
    for(ll i=1;i<=n;i++)
    cin>>a[i];
    
    memset(dp,-1,sizeof(dp));
    ll res=jump(1);
    
    // for(ll i=1;i<=n;i++)
    // cout<<dp[i]<<" ";
    // cout<<endl;
    cout<<res;
}

Measured memory_bytes: 4992