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

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
#define rep(i,a,b) for(int (i)=int(a);(i)<int(b);(i)++)
#define rrep(i,a,b) for(int (i)=int(a);(i)>=int(b);(i)--)

#define put(a) cout << (a) << endl
#define puts(a) cout << (a) << " "

#define llint long long int

#define INF (long long)(1e9+1)
#define MOD (long long)(1e9+7)
#define INF64 (long long)(1e18+1)

#define F first
#define S second

#define Pii  pair<int,int>
#define Pll  pair<long long,long long>
#define Piii pair<int,pair<int,int>>
#define Plll pair<long long,pair<long long,long long>>

#define Vll(a,b,c)    vector<vector<long long>> (a)((b),vector<long long>((c))
#define Vlll(a,b,c,d) vector<vector<vector<long long>>> (a)((b),vector<vector<long long>>((c),vector<long long>((d)))

#define MAX_N 1000000

llint my_binary_search(llint ary[], llint key, llint left, llint right) {
	llint middle;
	if (right < left) {
		return -(INF64);
	} else {
		middle = left + (right - left) / 2;
		if (ary[middle] > key) {
			return my_binary_search(ary, key, left, middle - 1);
		} else if (ary[middle] < key) {
			return my_binary_search(ary, key, middle + 1, right);
		} else {
			return middle;
		}
	}
}

struct UnionFind {
	vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
	
	UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
		for(int i = 0; i < N; i++) par[i] = i;
	}
	
	int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}
	
	void unite(int x, int y) { // xとyの木を併合
		int rx = root(x); //xの根をrx
		int ry = root(y); //yの根をry
		if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
		par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
	}
	
	bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};

int main (void)
{
	//INPUT
	char N,M;
	cin >> N;
	// vector<llint> A(N);
	// rep(i,0,N) {
	// 	cin >> A[i];
	// }
	// string S;
	// cin >> S;
	// llint len;
	// len = S.length();
	
	
	//SOLVE
	char ans=(char)((llint)N+1);
	
	//OUTPUT
	cout << ans << endl;
	
	return 0;
}






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

int main() {
  string S,T;
  int A,B;
  string U;
  
  cin >> S >> T;
  cin >> A >> B;
  cin >> U;
  
  if (S == U) {
    cout << A - 1 << " "  << B << endl;
  }
  
  else if (T == U) {
    cout << A << " " << B - 1 << endl;
  }
  
  
}

 







Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ALL(a) (a).begin(), (a).end()
const ll mod = 1e9 + 7;

int main()
{
    string s;
    cin >> s;
    int n = s.size();
    ll ans = 0;
    for (int i = 0; i < (1 << (n - 1)); i++)
    {
        ll now = s[0] - '0';
        for (int j = 0; j < n - 1; j++)
        {
            if ((i >> j) & 1)
            {
                ans += now;
                now = s[j + 1] - '0';
            }
            else
            {
                now = now * 10 + s[j + 1] - '0';
            }
        }
        ans += now;
    }
    cout << ans << endl;
}

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

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
    
    string s;
    cin>>s;
    int ans = 0;
    int n  = s.size();
    for(int i=0;i<s.size();i++){
        if(s[i]!=s[n-1-i]){
            ans++;
            s[i] = s[n-1-i];
        }
    }
    cout << ans << endl;
}

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

using namespace std;
using ll = long long;

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

  if (n * 2 >= m) {
    cout << m / 2 << '\n';
  } else {
    ll ans = n;
    m -= n * 2;
    cout << ans + (m / 4) << '\n';
  }
  return 0;
}

Measured memory_bytes: 3576
// g++ macro.cpp -std=c++14
#include <bits/stdc++.h> //STL include
typedef long long ll;// long long int
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;//namespace

#define dump(x)  cout << #x << " = " << (x) << endl;// debug cout
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;

#define SANKOU(n,a,b) cout << ((n) ? (a) : (b) ) << endl;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)// for macro
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j]);// warshall-floyd

#define CIN(x) int x;cin>>x;
#define SCIN(x) string x;cin>>x;
#define COUT(x) cout<<(x)<<endl;
#define SCOUT(x) cout<<(x)<<" ";
#define ENDL cout<<endl;

#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_;
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl;

#define ALL(obj) (obj).begin(),(obj).end()// iterator

#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end());

#define P pair<int,int>
#define V vector<int>
#define M map<int,int>

#define pb(a) push_back(a)//push_back
#define mp make_pair// make_pair


int main(){

    SCIN(n);
    Yes(n[0]=='9'||n[1]=='9');

    return 0;
}


Measured memory_bytes: 256
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
      return Array.new(size1){init}
  else
      return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

H,W,M=get_i
we=array(H,0)
he=array(W,0)
kind=Hash.new(0)
M.times do
    h,w=get_i
    h-=1
    w-=1
    we[h]+=1
    he[w]+=1
    kind[h.to_s+":"+w.to_s]+=1
end

ans=0
mh=0
mw=0
H.times do|i|
    mh=i if we[mh]<=we[i]
end
ans=0
W.times do|i|
  v=we[mh]+he[i]-kind[mh.to_s+":"+i.to_s]
  ans=max(ans,v)
end
W.times do|i|
    mw=i if he[mw]<=he[i]
end
H.times do|i|
    v=we[i]+he[mw]-kind[i.to_s+":"+mw.to_s]
    ans=max(ans,v)
end
puts ans

Measured memory_bytes: 62808
//inlclude前用define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
//#include<deque>
#include<iomanip>
#include<set>
#include<tuple>
#include<map>
#include<limits>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef long long int ll;

//define
#define INF 1e9 
#define NUM 1000000007
#define all(x) begin(x), end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)

int main(){
  int n,k;
  cin>>n>>k;
  vector<ll> h(n);
  rep(i,n){
    cin>>h[i];
  }
  sort(all(h));
  reverse(all(h));
  ll ans=0;
  if(k>n) k=n;
  for(int i=0;i<k;i++){
    h[i]=0;
  }
  rep(i,n){
    ans+=h[i];
  }  
  cout<<ans<<endl;

}


Measured memory_bytes: 1792
#include <iostream>
#include <string>

#define INC(i, a, b) for(i = a; i < b; ++i)
#define DEC(i, a, b) for(i = a; i > b; --i)
#define REP(i, n) INC(i, 0, n)

typedef unsigned int uint;
typedef unsigned long ul;
typedef long long  ll;
typedef unsigned long long ull;

int abs(int x){
    return x > 0? x : -x;
}

int max(int a, int b){
    return a > b? a : b;
}

int min(int a, int b){
    return a < b? a : b;
}

void TFprint(bool b, std::string T, std::string F){
    if(b){
        std::cout << T;
    }else{
        std::cout << F;
    }
}

long calc(long init, long goal){
    long ret;

    if((init >= 0 && goal >= 0)|| (init < 0 && goal < 0)){
        if(init > goal){
            ret = init - goal + 2;
            if(goal == 0){
                ret--;
            }
        }else{
            ret = goal - init;
        }
    }else{
            ret = abs(init + goal) + 1;
            if(goal == 0){
                ret--;
            }
    }
    return ret;
}

int main(){
    long init, goal;
    std::cin >> init >> goal;
    //std::cout << init << ' ' << goal << std::endl;
    long ans = calc(init, goal);
    std::cout << std::dec << ans << std::endl;
}

Measured memory_bytes: 256
D, G = map(int, input().split())
PC = [0] + [list(map(int, input().split())) for _ in range(D)]
def dfs(i, g):
  if i == 0:
    return 1e9
  mc = min(g // (100 * i), PC[i][0])
  s = mc * 100 * i
  if mc == PC[i][0]:
    s += PC[i][1]
  if s < g:
    mc += dfs(i - 1, g - s)
  return min(dfs(i - 1, g), mc)
print(dfs(D, G))

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

namespace CSharp
{
    class Program
    {
        public static void Main()
        {
            var N = int.Parse(Console.ReadLine());
            var d = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            var result = 0;
            for (int i = 0; i < N; i++)
            {
                for (int j = i + 1; j < N; j++)
                {
                    result += d[i] * d[j];
                }
            }
            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> a(n + 1);
	for (int i = 1; i <= n; ++i) cin >> a[i];
	vector<int> res(n + 1);
	vector<int> ans;
	for (int i = n; i >= 1; --i) {
		int tmp = 0;
		for (int j = i + i; j <= n; j += i) {
			tmp += res[j];
		}
		if (a[i]) {
			if (tmp % 2 == 0) res[i] = 1;
		}
		else {
			if (tmp % 2 != 0) res[i] = 1;
		}
		if (res[i] == 1) ans.push_back(i);
	}
	cout << ans.size() << endl;
	reverse(ans.begin(), ans.end());
	for (int c : ans) cout << c << endl;
	return 0;
}

Measured memory_bytes: 5276
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a=scan.nextInt();
		int b=a%10;
		a/=10;
		int c=a%10;
		if(b==9||c==9) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 21332
#include<iostream>
#include<utility>
#include<algorithm>
#include<vector>
#define all(v) v.begin(),v.end()
#define pb push_back
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define INF 1e9
using namespace std;
typedef pair<long long,int> pli;

long long func(long long a){
	if(a<0)return -a;
	else return a;
}

long long min(long long a,long long b){
	if(a<b)return a;
	else return b;
}

int main(){
	int n,k;
	cin>>n>>k;
	long long val[n];
	rep(i,n)cin>>val[i];
	long long ans=INF;
	rep(i,n-k+1){
		if(val[i]>=0)ans=min(ans,val[i+k-1]);
		else if(val[i+k-1]<0)ans=min(ans,func(val[i]));
		else{
			ans=min(ans,min(func(val[i])*2+func(val[i+k-1]),func(val[i])+2*func(val[i+k-1])));
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
n = int(input())
tasks = [list(map(int, input().split())) for i in range(n)]
sorted_t = sorted(tasks, key=lambda x: x[1])

res = 'Yes'
times = 0

for i in range(n):
  times += sorted_t[i][0]
  if times > sorted_t[i][1]:
    res = 'No'
    break

print(res)

Measured memory_bytes: 55264
import collections
D = collections.defaultdict(int)
N = int(input())
for i in range(N):
    D[input()] += 1
high = -1
ans = dict()
for k,v in sorted(D.items(), key=lambda x:x[1], reverse=True):
    if high <= v:
        high = v
        ans[k] = v
    else:
        break
ans = sorted(ans.keys())
for a in ans:
    print(a)

Measured memory_bytes: 66524
N,M,X = map(int, input().split())
CA = [list(map(int, input().split())) for _ in range(N)]
ans = 1e9
for i in range(2**N):
    cnt = [0]*(M+1)
    for j in range(N):
        if i>>j & 1:
            cnt = [x+y for (x,y) in zip(cnt,CA[j])]
    if len([i for i in cnt[1:] if i>=X]) == M:
        ans = min(ans, cnt[0])
print(ans if ans<1e9 else -1)

Measured memory_bytes: 9232
#include <stdio.h>

int main(void) {
	int n; scanf("%d",&n);
	int ary[n]; for (int i=0; i<n; i++) scanf("%d",&ary[i]);
	
	int i;
	for (i=n-1; i>0; i--) {
		if (ary[i-1] > (ary[i]+1)) {
			break;
		} else if (ary[i-1] == (ary[i]+1)) {
			ary[i-1]--;
		}
	}
	if (i > 0) {
		puts("No");
	} else {
		puts("Yes");
	}
	
	return 0;
}


Measured memory_bytes: 512
import itertools

def getPoint(m,x,y):
    if not (0 <= x < 12) or not (0 <= y < 12):
        return 0
    return m[y][x]

def setPoint(m,x,y,v):
    m[y][x] = v

while 1:
    try:
        m = [list(map(int,input().strip())) for _ in range(12)]
        count = 0
        empty = False
        while not empty:
            empty = True
            for x,y in itertools.product(range(12),repeat=2):
                if(getPoint(m,x,y)):
                    count += 1
                    empty = False
                    q = []
                    q.append((x,y))
                    while q != []:
                        p = q.pop()
                        if(getPoint(m,p[0],p[1])):
                            setPoint(m,p[0],p[1],0)
                            for o in [(1,0),(-1,0),(0,1),(0,-1)]:
                                q.append((p[0] + o[0], p[1] + o[1]))
        print(count)
        input()
    except:
        exit()

Measured memory_bytes: 6756
import java.io.*;

public class Main {

    public static void main(String args[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        int n = Integer.parseInt(br.readLine());
        int h = 0, m = 0, s = 0;
        while (n >= 3600) {
            n -= 3600;
            h++;
        }
        while (n >= 60) {
            n -= 60;
            m++;
        }
        s = n;
        bw.append(h + ":" + m + ":" + s + "\n");
        bw.flush();
    }


}


Measured memory_bytes: 24312
N = int(input())


ans = [0]*(N+1)
i = 102
for x in range(1,i):
    for y in range(1,i):
        for z in range(1,i):
            total = (x + y + z)**2 - (x*y + y*z + x*z)
            if total <= N:
                ans[total] += 1

for i in range(1,N+1):
    print(ans[i])

Measured memory_bytes: 9316
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++)
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b);
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={1,0,-1,0,1,-1,-1,1};
int dy[]={0,1,0,-1,1,1,-1,-1};
const int MOD = 1e9+7;
const long long INF = 1e18+10;

/*--------------------------------------------------------------------*/
signed main(){
	int n;cin>>n;
	string s;
	cin>>s;

	vi black(n+1,0);
	// [i]=#Black(s[0]-s[i-1])  [0]=-1,[n]=sum
	
	rep(i,n){
		black[i+1]=black[i]+(s[i]=='#');
	}
	int ans=INF;

	rep(i,n){
		int b=black[i];
		int w=(n-1-i)-(black[n]-black[i+1]);
		chmin(ans,b+w);
	}
	cout<<ans<<endl;


	return 0;
}


Measured memory_bytes: 5236
#include<iostream>
#include<vector>
#include<string>
#include <cstring>
using namespace std;
int main(){
    const char Day [][4] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    char tmp[4];
    int result = 0;
    cin >> tmp;
    for(int i=0; i<sizeof(Day)/sizeof(Day[0]); i++){
        if(strcmp(Day[i], tmp) == 0){
            result = i;
            break;
        }
    }
    cout << sizeof(Day)/sizeof(Day[0]) - result << "\n";
    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

cnt = [0] * 110000
for i in a:
    cnt[i] += 1

q = int(input())

sum_a = sum(a)
for i in range(q):
    b, c = map(int, input().split())
    
    sum_a += (c - b) * cnt[b]
    print(sum_a)
    cnt[c] += cnt[b]
    cnt[b] = 0
    

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

int main()
{
  	long long s=0,n;
  	cin>>n;
  	vector <int> ar(n);
  	for(long long i=0; i<n; i++)	cin>>ar[i];
  	for(long long i=1; i<n; i++)
    {
      if(ar[i-1]>ar[i])
      {
        s+=(ar[i-1]-ar[i]);
      	ar[i]=ar[i-1];
      }
    }
  cout<<s<<"\n";
}  


Measured memory_bytes: 3972
while True:
    a, op, b = input().split()   # 3変数ともに文字列として読み込む
    a =int(a)                   # a を整数に変換
    b = int(b)                   # b を整数に変換


    if op=="?": # opが"?"の時は終了
        break
    else:
        if op == "+":
            print(a+b)
        elif op == "-":
            print(a-b)
        elif op == "*":
            print(a*b)
        elif op == "/":
            print(a//b)
            #opが"?"以外の時
        # ここ処理を書いてください
        # else のなかです。この通りのインデントを付けてください。


Measured memory_bytes: 5596
// 2020-07-30 22:57:28
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
using P = pair<int, int>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }
namespace prime {
  bool is_prime(ll n) {
    if(n < 2) return false;
    for(ll i = 2; i * i <= n; i++) {
      if(n % i == 0) return false;
    }
    return true;
  }
  vector<ll> divisors(ll n) {
    vector<ll> res;
    for(ll i = 1; i * i <= n; i++) {
      if(n % i == 0) {
        res.push_back(i);
        if(i != n / i) res.push_back(n / i);
      }
    }
    return res;
  }
  map<ll, int> prime_factors(ll n) {
    map<ll, int> res;
    if(n < 2) return res;
    for(ll i = 2; i * i <= n; i++) {
      while(n % i == 0) {
        res[i]++;
        n /= i;
      }
    }
    if(n > 1) res[n] = 1;
    return res;
  }
};

void answer() {
  ll n, k;
  cin >> n >> k;
  vector<ll> a(n);
  ll s = 0;
  rep(i, n) {
    cin >> a[i];
    s += a[i];
  }
  vector<ll> ds = prime::divisors(s);
  sort(RALL(ds));
  auto ok = [&](ll d) {
    auto comperator = [&](ll l, ll r) {
      ll lx = l % d;
      ll ly = d - lx;
      ll rx = r % d;
      ll ry = d - rx;
      return min(lx, ly) < min(rx, ry);
    };
    sort(ALL(a), comperator);
    ll up = 0, down = 0;
    rep(i, n-1) {
      ll x = a[i] % d;
      ll y = d - x;
      if(up + y > k) {
        down += x;
      } else if(down + x > k) {
        up += y;
      } else if(x < y) {
        down += x;
      } else if(x > y) {
        up += y;
      } else if(up < down) {
        up += y;
      } else {
        down += x;
      }
    }
    return max(up, down) <= k;
  };
  for(ll d : ds) {
    if(ok(d)) {
      cout << d << '\n';
      return;
    }
  }
  cout << 1 << '\n';
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

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

string base_2(int64_t n){
  string s;
  while(abs(n)>1){
    if(n%2==0){
      s='0'+s;
      n=n/(-2);
    }
    else{
      s='1'+s;
      n=(n-1)/(-2);
    }
  }
  if(n==1){
    return '1'+s;
  }
  else if(n==-1){
    return "11"+s;
  }
  else if(n==0){
    return "0";
  }
}

int main(){
  int64_t N;
  cin>>N;
  
  cout<<base_2(N)<<endl;

}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
using namespace std;
int pn=0;
void print(int a,int n){
	pn++;
	if(pn!=n)cout<<a<<" ";
	else cout<<a<<endl;
}

int main(){
	int n;
	int i,j,k;
	cin>>n;
	if(n==3){
		print(2,3),print(5,3),print(63,3);
		return 0;
	}
	for(i=0,j=0;j+4<n;i++,j+=4){
		print(6*i+2,n);
		print(6*i+3,n);
		print(6*i+4,n);
		print(6*i+6,n);
	}
	if(i%2==0){
		if(n%4==0){
			print(6*i+2,n);
			print(6*i+3,n);
			print(6*i+4,n);
			print(6*i+9,n);
		}else if(n%4==1){
			print(6*i+6,n);
		}else if(n%4==2){
			print(6*i+2,n);
			print(6*i+4,n);
		}else if(n%4==3){
			print(6*i+2,n);
			print(6*i+4,n);
			print(6*i+6,n);
		}
	}else{
		if(n%4==0){
			print(6*i+2,n);
			print(6*i+3,n);
			print(6*i+4,n);
			print(6*i+6,n);
		}else if(n%4==1){
			print(6*i+3,n);
		}else if(n%4==2){
			print(6*i+3,n);
			print(6*i+6,n);
		}else if(n%4==3){
			print(6*i+2,n);
			print(6*i+3,n);
			print(6*i+4,n);
		}
	}
	return 0;
}
		
			


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

#define REP(i,n) for(ll i=0; i<(ll)(n); i++)
#define FOR(i,n,m) for (ll i=n; i<(ll)(m); i++)
#define pb push_back
#define INF 1000000007LL
#define all(a) (a).begin(),(a).end()

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

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

int H, W;
int main(){
    ios::sync_with_stdio(false);
    cin >> H >> W;
    string ans;
    REP(i,H)REP(j,W) {
        string t;
        cin >> t;
        if (t=="snuke") {
            cout << char('A' + j) << i+1 << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
package main

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

func main() {
	s := readR()
	if s[len(s)-1] == 's' {
		fmt.Println(string(s) + "es")
	} else {
		fmt.Println(string(s) + "s")
	}
}

/*-----------Input utils-----------*/

var sc = bufio.NewScanner(os.Stdin)

func init() {
	if len(os.Args) >= 2 {
		if os.Args[1] == "debug" {
			debug()
		}
	}
	const buf = 200100
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, buf), buf)
}

func debug() {
	testFile, err := os.Open("./test/sample-1.in")
	if err != nil {
		fmt.Fprintln(os.Stderr, "There is no testfile.")
		os.Exit(1)
	}
	sc = bufio.NewScanner(testFile)
}

func readS() string {
	sc.Scan()
	return sc.Text()
}

func readR() []rune {
	return []rune(readS())
}

func readI() int {
	i, _ := strconv.Atoi(readS())
	return i
}

func readF() float64 {
	f, _ := strconv.ParseFloat(readS(), 64)
	return f
}


Measured memory_bytes: 1804
from collections import Counter
def main():
   s = input()
   k = int(input())
   li = []
   num = 1
   for i in range(len(s)-1):
       if s[i] != s[i+1]:
           li.append(num)
           num = 1
       else:
           num += 1
   li.append(num)
   temp = 0
   ans = 0
   if len(li) == 1:
       ans += len(s) * k // 2
   else:
       for i in li:
           temp += i//2
       if s[0] != s[-1]:
           ans = temp * k
       else:
           li[0] += li[-1]
           for i in li[:-1]:
               ans += i//2
           ans = ans * (k-1) + temp
   print(ans)
main()

Measured memory_bytes: 3316
#define _USE_MATH_DEFIMES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1'000'000'007;
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

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









int main(){
    int N, K; std::cin >> N >> K;
    std::vector<int> A(N), cnt(N+1, 0);
    for(int i(0); i < N; ++i) std::cin >> A[i];
    for(int j(0); j < K; ++j){
        for(int i(0); i < N; ++i) cnt[i] = 0;
        for(int i(0); i < N; ++i){
            ++cnt[std::max(0, i-A[i])];
            --cnt[std::min(N, i+A[i]+1)];
        }
        for(int i(0); i < N; ++i){
            cnt[i+1] += cnt[i];
            A[i] = cnt[i];
        }
        bool allN(true);
        for(int i(0); i < N; ++i){
            if(A[i] != N) allN = false;
        }
        if(allN) break;
    }
    for(int i(0); i < N; ++i){
        if(i) std::cout << " ";
        std::cout << A[i];
    }
    std::cout << std::endl;
    return 0;
}


Measured memory_bytes: 4812
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// gp_hash_table<int, int> mapka;

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  int n;
  cin >> n;
  map<int,int> mapka;
  vector<int> roz;
  R(i,n){
    int pom;
    cin >> pom;
    if(mapka[pom] == 0){
      roz.PB(pom);
    }
    mapka[pom]++;
  }
  if(SZ(roz) == 1 && roz[0] == 0){
    cout << "Yes\n";
//     R(i,n){
//       cout << roz[0] << " ";
//     }
//     cout << "\n";
    return 0;
  }
  if(n % 3 == 0 && SZ(roz) == 2){
    sort(ALL(roz));
    if(roz[0] == 0 && mapka[0] == n / 3){
      cout << "Yes\n";
      return 0;
    }
  }
  if(n % 3 == 0 && SZ(roz) == 3 && (roz[0] ^ roz[1] ^ roz[2]) == 0){
    for(PII el:mapka){
      if(el.SE != n/3){
        cout << "No\n";
        return 0;
      }
    }
    cout << "Yes\n";/*
    R(i,n){
      cout << roz[i % 3] << " ";
    }
    cout << "\n";*/
    return 0;
  }
  cout << "No\n";
}


Measured memory_bytes: 5748
#[allow(unused_macros)]
macro_rules! input {
    ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } };
    ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } };
}
#[allow(unused_macros)]
macro_rules! input_inner {
    ( $ next : expr ) => { };
    ( $ next : expr , ) => { };
    ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } };
}
#[allow(unused_macros)]
macro_rules! read_value {
    ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) };
    ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) };
    ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) };
    ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 };
    ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) };
}

fn main() {
    input! {
        n: usize, tc: u64,
        t: [u64; n]
    }

    let mut d = vec![0u64;n-1];
    for i in 0..n-1 {
        d[i] = std::cmp::min(t[i+1] - t[i], tc);
    }
    println!("{}", d .iter().fold(0, |acc, &x| acc + x) + tc);
}


Measured memory_bytes: 8444
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<queue>
#include<vector>
typedef long long int ll;
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR_IN(i, a, b) for(int i = (a); i < (b); i++)
#define BETWEEN(x, a, b) ((x) >= (a) && (x) <= (b))
#define BIT(b, i) (((b) >> (i)) & 1)
#define LOG_F 1
#define LOG(...) if(LOG_F) fprintf(stderr, __VA_ARGS__)

using namespace std;

ll pow(int x, int n){
  return n == 0 ? 1 : x * pow(x, n - 1);
}

void Yn(bool f)
{
  cout << (f ? "Yes" : "No") << endl;
}

void yn(bool f)
{
  cout << (f ? "yes" : "no") << endl;
}

void YN(bool f)
{
  cout << (f ? "YES" : "NO") << endl;
}

int h, w, n, sc,sr;
string s, t;
int N[4][200000], M[4][200000]; //LRUD
map<char, int> mp = {{'L' , 0}, {'R' , 1}, {'U' , 2}, {'D' , 3}};

bool solve(){
  LOG("----- L ---------\n");
  int pos = sc;
  REP(i, n)
  {
    if(s[i] == 'L'){
      pos--;
      if(pos<1)
        return false;
    }
    if(t[i] == 'R' && pos < w)
      pos++;

    cerr << pos << endl;
  }

  LOG("----- R ---------\n");
  pos = sc;
  REP(i, n)
  {
    if (s[i] == 'R')
    {
      pos++;
      if (pos > w)
        return false;
    }
    if (t[i] == 'L' && pos > 1)
      pos--;
    cerr << pos << endl;
  }

  LOG("----- U ---------\n");
  pos = sr;
  REP(i, n)
  {
    if (s[i] == 'U')
    {
      pos--;
      if (pos < 1)
        return false;
    }
    if (t[i] == 'D' && pos < h)
      pos++;
    cerr << pos << endl;
  }

  LOG("----- D ---------\n");
  pos = sr;
  REP(i, n)
  {
    if (s[i] == 'D')
    {
      pos++;
      if (pos > h)
        return false;
    }
    if (t[i] == 'U' && pos > 1)
      pos--;
    cerr << pos << endl;
  }

  return true;
}

int main(){
  cin >> h>>w>>n>>sr>>sc;
  cin >> s>>t;

  vector<int> nn(4, 0), mm(4,0);
  REP(i, n)
  {
    nn[mp[s[i]]]++;
    mm[mp[t[i]]]++;

    REP(k, 4){
      N[k][i] = nn[k];
      M[k][i] = mm[k];
    }
  }

  YN(solve());

  return 0;
}


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

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define Rrep(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<string, int> P;

string warm;

/*???????????????????????????*/
bool SameCol(string col) {
	rep(i, col.size() - 1) {
		if(col[i] != col[i + 1]) return false;
	}
	return true;
}
/*????????????*/
char ChangeCol(char a, char b) {
	if((a == 'r' && b == 'b') || (a == 'b' && b == 'r')) return 'g';
	else if((a == 'r' && b == 'g') || (a == 'g' && b == 'r')) return 'b';
	else if((a == 'b' && b == 'g') || (a == 'g' && b == 'b')) return 'r';
}

int solve(string s) {
	map<string, bool> m;	/*???????????\??¨*/
	queue<P> q;
	q.push(P(s, 0));

	while(!q.empty()) {
		P p = q.front(); q.pop();

		/*????????????*/
		if(m[p.first]) continue;
		m[p.first] = true;

		if(SameCol(p.first)) return p.second;
		string now = p.first;
		rep(i, now.size() - 1) {
			if(now[i] != now[i + 1]) {
				char tmp = ChangeCol(now[i], now[i + 1]);
				string tmp2 = now;
				tmp2[i] = tmp; tmp2[i + 1] = tmp;
				q.push(P(tmp2, p.second + 1));
			}
		}
	}
	return -1;
}

int main() {
	while(cin >> warm) {
		if(warm == "0") break;
		int ans = solve(warm);
		if(ans == -1) printf("NA\n");
		else printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 5348
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
using ll=long long;
static const int mod = 2019;
static const int INF = 3000;
using namespace std;

int main(){
	ll l,r;
	cin>>l>>r;
	ll ans=2019;
	//基本は全探索
	if(r-l>=2020)ans=0;
	else{//全探索が間に合わないものだけ省く
		for(ll i=l;i<r;++i){
			for(ll j=i+1;j<=r;++j){
				ans=min(ans,(i*j)%mod);
			}
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
local h, w, n = io.read("*n", "*n", "*n")
local t = {}

local function add(i_h, i_w)
  local idx = i_h .. ":" .. i_w --(i_h - 1) * 1000000000 + i_w
  if t[idx] then t[idx] = t[idx] + 1 else t[idx] = 1 end
end

local function subtask(ah, bw)
  if 3 <= bw then add(ah, bw - 2) end
  if 2 <= bw and bw < w then add(ah, bw - 1) end
  if bw < w - 1 then add(ah, bw) end
end

for i = 1, n do
  local ah, bw = io.read("*n", "*n")
  if 3 <= ah then subtask(ah - 2, bw) end
  if 2 <= ah and ah  < h then subtask(ah - 1, bw) end
  if ah < h - 1 then subtask(ah, bw) end
end

local sum = 0LL
local tbl = {}
for i = 1, 9 do tbl[i] = 0 end
for k, v in pairs(t) do
  tbl[v] = tbl[v] + 1
  sum = sum + 1LL
end
local rem = (h - 2LL) * (w - 2LL) - sum
local str = tostring(rem):gsub("LL", "")
print(str)
for i = 1, 9 do print(tbl[i]) end


Measured memory_bytes: 113036
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

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

    while(n > 1){
        n /= 2;
        vector<int> b(n);
        for(int i=0; i<n; ++i){
            if(a[2*i] == a[2*i+1])
                b[i] = a[2*i];
            else
                b[i] = abs(a[2*i] - a[2*i+1]);
        }
        a.swap(b);
    }
    cout << a[0] << endl;

    return 0;
}


Measured memory_bytes: 1792
def solve():
    D, N = map(int, input().split())
    add_val = 0
    if D == 0:
        add_val = 1
    if D == 1:
        add_val = 100
    if D == 2:
        add_val = 10000

    if N == 100:
        print(add_val + (add_val * (N)))
    else:
        print(add_val + (add_val * (N-1)))

if __name__ == '__main__':
    solve()

Measured memory_bytes: 38256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;


unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    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);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        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)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

int main() {
    ll n;
    cin >> n;
    string s;
    cin >> s;
    int q;
    cin >> q;
    vector<ll> m(n+1);
    for (int j = 0; j < n; j++) {
        m[j + 1] = m[j];
        if (s[j] == 'M')m[j + 1]++;
    }
    vector<ll> c(n + 1);
    for (int j = 0; j < n; j++) {
        c[j + 1] = c[j];
        if (s[j] == 'C')c[j + 1]++;
    }
    vector<ll> crui(n + 1);
    for (int j = 0; j < n; j++) {
        crui[j + 1] = crui[j];
        if (s[j] == 'C')crui[j + 1] += m[j];
    }
    for (int i = 0; i < q; i++) {
        ll v;
        cin >> v;
        ll ans = 0;
        for (int j = 0; j < n; j++) {
            if (s[j] == 'D')ans += crui[min(n, j + v)]-crui[j]-m[j]*(c[min(n, j + v)]-c[j]);
        }
        cout << ans << endl;
    }

}

Measured memory_bytes: 27708
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const int MOD=998244353;
const int MAX=1e5+10;
const ll INF=1e18;
const double PI=acos(-1);


int main() {
    ios_base::sync_with_stdio(false);

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

    return 0;   
}

Measured memory_bytes: 3592
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
using namespace std;
#define ll long long
#define MAX 100001

/*
int dp[MAX][MAX] = {};

void make(){
	for (int i=0;i<MAX;i+=2) {
	dp[0][i] = 1;
	}
	for (int i=1;i<MAX;i++) {
	for (int j=1;j<MAX;j++) {
	if (dp[i-1][j-1]==1 || dp[i+1][j-1]==1) {
	dp[i][j]=1;;
	}
	}
	}
}
*/

int main(){
	int n,t,x,y;
	cin >> n;
	int sum;
	for (int i=0;i<n;i++) {
	cin >> t>>x>>y;
	sum=x+y;
	if (!(t>=sum) || (t%2!=sum%2)) {
	cout << "No" <<endl;
	return 0;
	}
	}

	cout << "Yes" << endl;
	return 0;
}



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

if 111 <= n <1000:
    #main
        n1 = int (n / 100)
#        print(n1)
#        print("   ")
        
        n2 = n - (n1 *100)
        n2 = int (n2 / 10)
#       print(n2)
#       print("   ")
        
        n3 = n - n1 *100 - n2*10
#        print(n3)
#        print("   ")
        
        if n1 == 9:
            n1 = 1
        elif n1 == 1:
            n1 = 9
        if n2 == 9:
            n2 = 1
        elif n2 == 1:
            n2 = 9
        if n3 == 9:
            n3 = 1
        elif n3 == 1:
            n3 = 9

        nn = n1 *100 + n2*10 + n3

        print(nn)

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <list>
#include <math.h>
#include <string.h>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define INF (1LL<<60)
#define int long long
#define ll long long
#define mod 1000000007



signed main(){

	int N, K;
	cin >> N >> K;
	int ans = 0;
	for (int b = K + 1; b <= N; b++){
		ans += N / b*(b - 1 - K + 1) + max(0LL, N % b - K +1);
		if (K == 0) ans--;
	}
	cout << ans << endl;

	return 0;
}


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

using namespace std;

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

  bool yes = false;
  for (int i = 0; i < s.size(); i++) {
    yes |= s.substr(i, 2) == "AC";
  }

  cout << (yes ? "Yes" : "No") << endl;

  return 0;
}

Measured memory_bytes: 764
import java.util.Objects;
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner scn = new Scanner(System.in);
        String a = scn.next();
        String[] week = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
        for (int i = 0; i < week.length; i++){
            if(Objects.equals(week[i], a)) {
                System.out.println(7 - i);
            }
        }
    }
}

Measured memory_bytes: 22100
import sys

def solve():
    input = sys.stdin.readline
    L, R = map(int, input().split())
    if R - L >= 2018: print(0)
    else:
        ans = 2019
        for i in range(L, R):
            for j in range(L + 1, R + 1):
                ans = min(ans, (i * j) % 2019)
        print(ans)
    
    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 3060
#include <stdio.h>


int		main(void)
{
	int K, A, B;
	int i;

	scanf("%d", &K);
	scanf("%d %d", &A, &B);

	for (i = 0; i <= B; i += K)
	{
		if (A <= i && i <= B)	
		{
			printf("OK");
			return (0);
		}
	}
	printf("NG");
	return (0);
}

Measured memory_bytes: 1732
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		if (s.equals("Sunny")) {
			System.out.println("Cloudy");
		} else if (s.equals("Cloudy")) {
			System.out.println("Rainy");
		} else {
			System.out.println("Sunny");
		}
	}
}


Measured memory_bytes: 21076
#include <iostream>

int main() {
  unsigned int A, B;
  std::cin >> A >> B;

  if ((A + B) % 2 == 0) {
    std::cout << (A + B) / 2 << std::endl;
  } else {
    std::cout << "IMPOSSIBLE" << std::endl;
  }

  return 0;
}


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

int x,n;
int p[110];
bool ans[110];
bool check[110];
queue<int> que;

int near(int x){
  check[x]=true;
  if(x-1<0)return 0;
  else if(!ans[x-1])return x;
  else{
    if(!check[x-1])que.push(x-1);
    if(!check[x+1])que.push(x+1);
    int next=que.front();
    que.pop();
    return near(next);
  }
}

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

  if(n==0){
    cout << x << endl;
    return 0;
  }
  
  rep(i,n)cin >> p[i];
    
  memset(ans,false,sizeof(ans));
  rep(i,n)ans[p[i]-1]=true;

  cout << near(x) << endl;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

ll a[100002];
ll sub[100002];
int main(){
    int n;
    cin>>n;
    ll sum=0;
    a[0]=0;
    rep(i,n){
        cin>>a[i+1];
        sub[i]=abs(a[i+1]-a[i]);
        sum+=sub[i];
    }
    sub[n]=abs(a[0]-a[n]);
    sum+=sub[n];
    rep(i,n){
        ll ans=sum-sub[i]-sub[i+1]+abs(a[(i+2)%(n+1)]-a[i]);
        cout<<ans<<endl;
    }
    return 0;
}

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

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) ll(x.size()) //sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define Umap unordered_map
#define Uset unordered_set

int main(){
    ll n;
    cin >> n;
    cout << n*n*n;

    return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
int top,S[1000];

void push(int x){
 S[++top]=x;
}

int pop(){
 top--;
 return S[top+1];
}

int main(){
int v;
char n[100];
while (scanf("%s", n) != EOF){
  if (n[0] == '+'){
    v=pop() + pop();
   push(v);
  }else if (n[0] == '-'){
    int b=pop();
    int a=pop();

   push(a-b);
  }else if (n[0] == '*'){
    v=pop() * pop();
   push(v);
  }else {
   push(atoi(n));
  }
}
  printf("%d\n",pop());
  return 0;
}

Measured memory_bytes: 3184
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String[] tokens = in.nextLine().split(" ");
		int N = Integer.parseInt(tokens[0]);
		int K = Integer.parseInt(tokens[1]);
		int[] x = new int[N];
		tokens = in.nextLine().split(" ");
		List<Integer> rights = new ArrayList<>();
		List<Integer> lefts = new ArrayList<>();
		boolean originExists = false;
		for (int i = 0; i < N; ++i) {
			x[i] = Integer.parseInt(tokens[i]);
			if (x[i] < 0) {
				lefts.add(x[i]);
			} else if (x[i] > 0) {
				rights.add(x[i]);
			} else {
				originExists = true;
			}
		}
		Collections.reverse(lefts);

		// 原点から左と右にある点の座標列を求める．
		int k = originExists ? K - 1 : K;
		int result = Integer.MAX_VALUE;
		for (int r = 0; r <= Math.min(k, rights.size()); ++r) {
			int l = k - r;
			if (l > k || l < 0 || l > lefts.size()) {
				continue;
			}
			// 右側からとる数: r, 左側からとる数: l
			// System.out.println(l + ", " + r);
			result = Math.min(result, calcDistance(rights, lefts, r, l));
		}
		System.out.println(result);
		in.close();
	}

	public static int calcDistance(List<Integer> rights, List<Integer> lefts, int r, int l) {
		int rightFirst = 0, leftFirst = 0;
		if (r > 0) {
			rightFirst += rights.get(r - 1) * 2;
			leftFirst += rights.get(r - 1);
		}
		if (l > 0) {
			rightFirst += lefts.get(l - 1) * -1;
			leftFirst += lefts.get(l - 1) * -2;
		}
		return Math.min(rightFirst, leftFirst);
	}
}

Measured memory_bytes: 48700
package main

import "fmt"

func main() {
	var a, b, c, d int
	fmt.Scan(&a, &b, &c, &d)

	res := min(b, d) - max(a, c)
	if res < 0 {
		res = 0
	}

	fmt.Println(res)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}


Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AOJ1_2_D
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int W = int.Parse(str[0]);
            int H = int.Parse(str[1]);
            int x = int.Parse(str[2]);
            int y = int.Parse(str[3]);
            int r = int.Parse(str[4]);

            if(x+r>W|y+r>H | x-r<0|y-r<0)
            {
                Console.WriteLine("No");
            }
            else
            {
                Console.WriteLine("Yes");
            }
        }
    }
}



Measured memory_bytes: 17928