akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << '\n';
#define SAY(X) cout << (X) << '\n';
#else
#define DBG(X)
#define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

std::string pad(int num)
{
    char buffer[4];
    std::snprintf(buffer, sizeof(buffer), "%03d", num);
    return buffer;
}

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

string normalise(string str) {

}

void dfs(string &curr, int N, char max) {

    if (curr.length() == N) {
        cout << curr << endl;
        return;
    }

    for (char c = 'a'; c <= max; ++c) {
        curr += c;
        dfs(curr, N, c == max ? std::min(static_cast<char>(max+1), 'z') : max);
        curr.pop_back();
    }
}

int solve()
{
    int N;

    std::cin >> N;

    string str;
    dfs (str, N, 'a');

    return 0;
}

int main()
{
//    std::cout << solve() << std::endl;
    solve();

    return 0;
}

Measured memory_bytes: 1536
#include <algorithm>
#include <iostream>
#include <vector>

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(a) (a).begin(), (a).end()

#define INF 1000000000

typedef unsigned long long ull;

using namespace std;

int main() {
    int N, K;
    cin >> N >> K;

    vector<int> snuke(N, 0);

    REP(i, K) {
        int d;
        cin >> d;

        REP(j, d) {
            int who;
            cin >> who;
            who--;

            snuke[who]++;
        }
    }

    int no = 0;
    REP(i, N) {
        if (snuke[i] == 0) no++;
    }

    cout << no << endl;

    return 0;
}


Measured memory_bytes: 3628
#include<stdio.h>
int main(void){
 
     int N[100],n;
     int i,j,m;
     int k;
 
     scanf("%d",&n);
     for(i=0;i<n;i++){
         scanf("%d",&N[i]);
     }
 
     for(i=1;i<n;i++){
 
         for(j=0;j<n;j++){
             if(j!=0){
                 printf(" ");
             }
             printf("%d",N[j]);
         }
         printf("\n");
 
         m=i;
 
         for(j=i-1;j>=0;j--){
             if(N[j]<N[m]){
                 break;
             }
             else{
                 k=N[j];
                 N[j]=N[m];
                 N[m]=k;
                 m--;
             }
         }
 
     }
 
     for(j=0;j<n;j++){
             if(j!=0){
                 printf(" ");
             }
             printf("%d",N[j]);
         }
     printf("\n");
 
     return 0;
 }


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

int main()
{
    string str;

    cin >> str;

    int cnt = 0, sum = 0;
    for( int i = 0; i < str.size(); i++ )
    {
        if( str[i] == 'R' )
            cnt++;
        else
            cnt--;
        if( cnt == 4 )
        {
            sum++;
            cnt = 0;
        }
        if( cnt == -4 )
            cnt = 0;
    }

    cout << sum << endl;

    return 0;
}


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

int main(){
	int n,m;
	cin >> n >> m;
	
	
	vector<vector<int>> bounds(m, vector<int>(2));
	rep(i,m) cin >> bounds[i][0] >> bounds[i][1];
	
	vector<int> pass(2);
	pass[0] = bounds[0][0];
	pass[1] = bounds[0][1];
	
	rep(i,m-1){
		if( pass[0] < bounds[i+1][0] ) pass[0] = bounds[i+1][0];
		if( bounds[i+1][1] < pass[1] ) pass[1] = bounds[i+1][1];
		
		if( pass[0] > pass[1] ) break;
	}

	int res = pass[1] - pass[0];
	if(res < 0) cout << 0 << endl;
	else cout << res+1 << endl;
	
	return 0;
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;            //

int main(void)
{
    int X, A, B;
    cin >> X >> A >> B;

    string ans;
    if (B <= A)
    {
        ans = "delicious";
    }
    else if (B - A < X + 1)
    {
        ans = "safe";
    }
    else
    {
        ans = "dangerous";
    }
    cout << ans << endl;
    return (0);
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int x,y;
	cin>>x>>y;
	char a[x+2][y+2];
	for(int i=0;i<=x+1;i++)
		for(int j=0;j<=y+1;j++)
			a[i][j]='.';
	for(int i=1;i<=x;i++)
		for(int j=1;j<=y;j++)
			cin>>a[i][j];
	for(int i=1;i<=x;i++)
		for(int j=1;j<=y;j++)
			if(a[i][j]=='#'&&a[i-1][j]=='.'&&a[i+1][j]=='.'&&a[i][j+1]=='.'&&a[i][j-1]=='.'){
				cout<<"No"<<endl;
				return 0;
			}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 764
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from itertools import combinations


def main():

    N = int(input())

    count = {x: 0 for x in "MARCH"}

    for _ in range(N):
        s = input()[0]
        if s in count:
            count[s] += 1

    result = 0
    for a, b, c in combinations("MARCH", 3):
        result += count[a] * count[b] * count[c]

    print(result)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
string a,b,c;
int main()
{
	cin>>a;
	int len=a.size();
	for(int i=0;i<len;i+=2)
	{
		cout<<a[i];
	}
	cout<<endl;
	return 0;
}

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

int main(void)
{
	string S;
	int value = 700;

	cin >> S;
	for (int i = 0; i < 3; ++i) {
		if (S[i] == 'o')	value += 100;
	}

	cout << value << endl;

	return 0;
}

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

int N, T = 0; 
vector<vector<int>> G(110);

vector<int> d(110, -1), f(110, -1);

void dfs(int v){
  T++; d[v] = T;
  for(int i=0; i<G[v].size(); i++){
    int u = G[v][i];

    if(d[u] == -1){
      //cout << v << " " << u << " " << T << endl;
      dfs(G[v][i]);
    }
  }
  T++;
  f[v] = T;
}

int main(){ 
  cin >> N;
  
  for(int i=0; i<N; i++){
    int u, k; cin >> u >> k;
    for(int j=0; j<k; j++){
      int v; cin >> v;
      G[u-1].push_back(v-1);
    }
  }

  for(int i=0; i<N; i++){
    if(d[i] == -1) dfs(i);
  }
  
  for(int id=0; id<N; id++){
    cout << id+1 << " "<< d[id] << " " << f[id] << endl; 
  }
}


Measured memory_bytes: 3144
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
inline int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9')
    {
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9')
    {
        x=x*10+ch-'0';
        ch=getchar();
    }
    return x*f;
}
inline void write(int x)
{
    if(x<0)
    {
        putchar('-');
        x=-x;
    }
    if(x>9)
    {
        write(x/10);
    }
    putchar(x%10+'0');
}
int main()
{
    int a,b;
    cin>>a>>b;
    cout<<(a-1)*(b-1)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
int n,s;
scanf("%d",&n);
if(n>=0 && n<=9)
{
if(n==2 || n==4|| n==5 || n==7 || n==9)      
{printf("hon\n");}
else if(n==0|| n==1|| n==6|| n==8)  
{printf("pon\n");} 
else
printf("bon\n");                   
}
if(n>=10 && n<=999)   
{
s=n%10;        
if(s>=0 && s<=9)
{
if(s==2 || s==4|| s==5 || s==7 || s==9)      
{printf("hon\n");}
else if(s==0|| s==1|| s==6|| s==8)  
{printf("pon\n");} 
else
{printf("bon\n");}                          
}   
return 0;    
}
 }

Measured memory_bytes: 1648
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N, L = LI()
    S = [SS() for _ in range(N)]

    S.sort()
    print(''.join(S))

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 10056
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<iostream>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<ll, ll>pii;
typedef pair<pii, ll>pi3;
ll mod = 1000000007;
ll gcd(ll a, ll b)
{
	for (;;)
	{
		if (a < b)swap(a, b);
		a %= b;
		if (a == 0)return b;
	}
}
int main()
{
	int num;
	scanf("%d", &num);
	ll r = 1;
	for (int i = 0; i < num; i++)
	{
		ll z;
		scanf("%lld", &z);
		ll g = gcd(r, z);
		r = r / g*z;
	}
	printf("%lld\n", r);
}

Measured memory_bytes: 256
from collections import Counter
n = int(input())
alphabet_ls = [chr(i) for i in range(97, 97+26)]
alphabet_dict = {alphabet:float('inf') for alphabet in alphabet_ls}
for i in range(n):
    s = input()
    c = Counter(s)
    for alphabet, before in alphabet_dict.items():
        if alphabet not in c.keys():
            alphabet_dict[alphabet] = 0
        else:
            if c[alphabet] < before:
                alphabet_dict[alphabet] = c[alphabet]
sorted_ls = sorted(alphabet_dict.items())
ans_ls = []
for alphabet, count in sorted_ls:
    for _ in range(count):
        ans_ls.append(alphabet)
ans = ''.join(ans_ls)
print(ans)


Measured memory_bytes: 3316
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
using namespace std;
#define pow2(a) (pow(1.*a,2))
typedef struct D
{
	int c,pp,np;
	double d;
	bool operator <(const D &a)const{ return d>a.d;};
}D;

int N,X[21],Y[21],res=0,g[21][21][21];
double R,O,d[21][21],F[21][21][10010];
double ang(int pre,int now,int next)
{
	double a=d[pre][now],b=d[now][next],c=d[pre][next];
	double dd=acos((pow2(a)+pow2(b)-pow2(c))/(2*a*b));
	double df=180-(dd*180/3.141592);
	return df;
}

int main()
{
	scanf("%d%lf%lf",&N,&R,&O);
	memset(g,0,sizeof(g));
	for(int i=0;i<21;i++)for(int k=0;k<21;k++)for(int j=0;j<10010;j++)F[i][k][j]=1e14;
	for(int i=0;i<N;i++)scanf("%d%d",X+i,Y+i);
	for(int i=0;i<N;i++)
		for(int j=0;j<N;j++)
			d[i][j]=sqrt(pow2(X[i]-X[j])+pow2(Y[i]-Y[j]));
	for(int i=0;i<N;i++)
		for(int j=0;j<N;j++)
			for(int k=0;k<N;k++)
				if(ang(i,j,k)<O)
					g[i][j][k]=1;
	priority_queue<D>Q;
	for(int i=1;i<N;i++)
	{
		if(d[0][i]>R)continue;
		D tmp={1,0,i,d[0][i]};
		F[0][i][1]=d[0][i];
		Q.push(tmp);
	}
	for(;!Q.empty();)
	{
		D tmp=Q.top();Q.pop();
		res=max(tmp.c,res);
		if(F[tmp.pp][tmp.np][tmp.c]-tmp.d>0.001)
			continue;
		F[tmp.pp][tmp.np][tmp.c]=tmp.d;
		for(int i=0;i<N;i++)
		{
			if(i==tmp.np)continue;
			if(g[tmp.pp][tmp.np][i]&&tmp.d+d[tmp.np][i]<=R)
			{
				D ins={tmp.c+1,tmp.np,i,tmp.d+d[tmp.np][i]};
				if(F[ins.pp][ins.np][ins.c]-ins.d>0.001)
				{
					Q.push(ins);
					F[ins.pp][ins.np][ins.c]=ins.d;
				}
			}
		}
	}
	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 35960
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;


int main(void){
  int h,w,k,i,j,t,ck[303][303]={};
  string s[303];
  
  cin >> h >> w >> k;
  for (i=0;i<h;i++) cin >> s[i];
  
  t=1;
  for (i=0;i<h;i++) for (j=0;j<w;j++){
    if (s[i][j]=='#'){
      ck[i][j]=t;
      t++;
    }
  }
  
  for (i=0;i<h;i++) for (j=1;j<w;j++){
    if (ck[i][j]==0) ck[i][j]=ck[i][j-1];
  }
  for (i=0;i<h;i++){
    if (ck[i][w-1]==0) continue;
    j=w-1;
    while (j>=0 && ck[i][j]>0) j--;
    while (j>=0){
      ck[i][j]=ck[i][j+1];
      j--;
    }
  }
  
  for (j=0;j<w;j++) for (i=1;i<h;i++){
    if (ck[i][j]==0) ck[i][j]=ck[i-1][j];
  }
  for (j=0;j<w;j++){
    i=h-1;
    while (i>=0 && ck[i][j]>0) i--;
    while (i>=0){
      ck[i][j]=ck[i+1][j];
      i--;
    }
  }
  
  for (i=0;i<h;i++){
    for (j=0;j<w;j++) cout << ck[i][j] << ' ';
    cout << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1000000007;

int main(){
  vector<int> N(4);
  for (int i=0;i<4;i++){
    cin>>N[i];
  }
  sort(N.begin(),N.end());
  if (N[0]==1&&N[1]==4&&N[2]==7&&N[3]==9) {
    cout<<"YES"<<endl;
  }
  else {
    cout<<"NO"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
int INF = 1e9 + 5;
 
int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    int n, w;
    cin >> n >> w;
    vector<long long> item(w+1);
    for (int i = 0; i < n; i++) {
        int weight, val;
        cin >> weight >> val;
        for (int j = w; j >= weight; j--) {
            item[j] = max(item[j], val + item[j-weight]);
        }
    }
    cout << item[w] << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
const long long MOD = 1e9+7;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ll> pdl;
typedef pair<ld, ld> pdd;
//typedef boost::multiprecision::cpp_int bigint;

ll A, B;
int main() {
	cin >> A >> B;
	if ((A & 1) && (B & 1))cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define all(obj) obj.begin(), obj.end()
#define db(x) cerr << #x << ":" << x << " "
#define dbl(x) cerr << #x << ":" << x << "\n"
#define dbv(vec) cerr << #vec << ":"; for (auto e : vec) cerr << e << " "; cout << "\n"
#define dbgvv(vv) cerr << #vv << ":\n"; for (auto vec : vv) { for (auto e : vec) cerr << e << " "; cerr << endl; }
#define YN(f) cout << (f ? "YES" : "NO") << endl
#define Yn(f) cout << (f ? "Yes" : "No") << endl
#define yn(f) cout << (f ? "yes" : "no") << endl
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;

int main () {
	int N; cin >> N;
	vi A(N), B(N), C(N);
	rep(i, N) cin >> A.at(i); sort(all(A));
	rep(i, N) cin >> B.at(i);
	rep(i, N) cin >> C.at(i); sort(all(C));
	ll ans = 0;
	for (int Bi : B) {
		ans += (lower_bound(all(A), Bi) - A.begin()) * (C.end() - upper_bound(all(C), Bi));
	}
	cout << ans << endl;	
}

Measured memory_bytes: 1408
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	private static final int MAX_ARRAY = 30;
	private static final int MAX_INPUT = 999999;
	private static final int MIN_INPUT = 1;
	
	private static ArrayList<Integer> array = new ArrayList<Integer>();
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		//System.out.println("#######INPUT#######");
		input();
		
		//System.out.println("#######OUTPUT#######");
		//showArray();
		showResult();
	}
	
	public static void input(){
		Scanner stdIn = new Scanner(System.in);
		
		while(stdIn.hasNext()){
			String buf = stdIn.next();
			if(isNumber(buf)){
				int tmp = Integer.parseInt(buf);
				if(MIN_INPUT <= tmp && tmp <= MAX_INPUT){
					array.add(tmp);
				}
			}
			if(array.size() == MAX_ARRAY){
				break;
			}
		}
		
		stdIn.close();
	}
	
	public static void showArray(){
		for(Integer i : array){
			System.out.println(i);
		}
	}
	
	public static void showResult(){
		for(Integer i : array){
			System.out.println(isPrimeCount(i));
		}
	}
	
	public static int isPrimeCount(int num){
		int count = 0;
		
		for(int i = 1;i <= num;i++){
			if(isPrimeF(i)){
				count++;
			}
		}
		
		return count;
	}
	
	public static boolean isPrime(int num){
		if(num == 1){
			return false;
		}else{
			for(int i = 2;i <= num-1;i++){
				if(num % i == 0){
					return false;
				}
			}
		}
		return true;
	}
	
	public static boolean isPrimeF(int num){
		if(num == 2){
			return true;
		}
		if(num < 2 || num % 2 == 0){
			return false;
		}
		for(int i = 3;i <= Math.sqrt(num);i = i+2){
			if(num % i == 0){
				return false;
			}
		}
		return true;
	}
	
	public static boolean isNumber(String num){
		try{
			Integer.parseInt(num);
			return true;
		}catch(NumberFormatException ex){
			return false;
		}
	}

}

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

#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define forn(i,n) for(ll i=0;i<n;i++)
#define fore(i,a,b) for(ll i=a;i<=b;i++)
#define ford(i,n) for(ll i=n-1;i>=0;i--)
#define fi first
#define se second
#define endl "\n"
#define all(a) a.begin(),a.end()
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define PI 3.14159265

const ll maxn=1e5+1,mod=1e9+7;
vector<bool> vis(maxn,false);
vector<int> g[maxn];
int k;
ll ans = 1;

void dfs(int cur,int par,int cnt){
    int cnt1 = (cur!=par);
    if(cur==par){
    if(k-cnt<=0){
        cout<<0;
        exit(0);
    }
    ans*=(k-cnt);
    ans%=mod;
    }
    else{
    if(k-cnt-1<=0){
        cout<<0;
        exit(0);
    }
    ans*=(k-cnt-1);
    ans%=mod;
    }
    for(auto it:g[cur]){
        if(it==par) continue;
        dfs(it,cur,cnt1);
        cnt1++;
    }
}

int main(){
    sync
    int n;
    cin>>n>>k;
    forn(i,n-1){
        int x,y;
        cin>>x>>y;
        g[x].pb(y);
        g[y].pb(x);
    }
    dfs(1,1,0);
    // cout<<ans;
    cout<<max(ans,0LL);

    return 0;
}

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

int main()
{
    int W, H, x, y, r;
    cin >> W >> H >> x >> y >> r;
    if((x + r <= W && x - r >= 0) &&
       (y + r <= H && y - r >= 0))
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3124
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int rows = in.nextInt();
		int cols = in.nextInt(); in.nextLine();
		char[][] fig = new char[rows][cols];
		
		String s = "";
		for ( int i = 0; i < rows; i++ ) {
			s = in.nextLine();
			for ( int j = 0; j < cols; j++ ) {
				fig[i][j] = s.charAt(j);
			}
		}
		// System.out.println(Arrays.deepToString(fig));
		
		boolean possible = true;
		
		for ( int i = 0; i < rows; i++ ) {
			for ( int j = 0; j < cols; j++ ) {
				if ( fig[i][j] == '#' && i == 0 && j == 0 ) { //upper left corner
					if ( fig[i][j+1] == '.' && fig[i+1][j] == '.' )
						possible = false;
				} else if ( fig[i][j] == '#' && i == 0 && j == cols-1 ) { //upper right corner
					if ( fig[i][j-1] == '.' && fig[i+1][j] == '.' )
						possible = false;
				} else if ( fig[i][j] == '#' && i == rows-1 && j == 0 ) { //lower left corner
					if ( fig[i][j+1] == '.' && fig[i-1][j] == '.' )
						possible = false;
				} else if ( fig[i][j] == '#' && i == rows-1 && j == cols-1 ) { // lower right corner
					if ( fig[i][j-1] == '.' && fig[i-1][j] == '.' )
						possible = false;
				} else if ( fig[i][j] == '#' &&  i == 0) { // upper edge
					if ( fig[i+1][j] == '.' && fig[i][j-1] == '.' && fig[i][j+1] == '.')
						possible = false;
				} else if ( fig[i][j] == '#' && i == rows-1 ) { // lower edge
					if ( fig[i-1][j] == '.' && fig[i][j-1] == '.' && fig[i][j+1] == '.') 
						possible = false;
				} else if ( fig[i][j] == '#' && j == 0 ) { // left edge
					if ( fig[i][j+1] == '.' && fig[i-1][j] == '.' && fig[i+1][j] == '.' ) 
						possible = false;
				} else if ( fig[i][j] == '#' && j == cols-1 ) { // right edge
					if ( fig[i][j-1] == '.' && fig[i-1][j] == '.' && fig[i+1][j] == '.' )
						possible = false;
				} else if ( fig[i][j] == '#' ) {// center tiles
					if ( fig[i][j+1] == '.' && fig[i][j-1] == '.' && fig[i+1][j] == '.' && fig[i-1][j] == '.' )
						possible = false;
				}
			}
		}
		
		if (possible)
			System.out.println("Yes");
		else
			System.out.println("No");
		
	}
}

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

#define int long long int
#define ll long long
#define quickie ios_base::sync_with_stdio(false); cin.tie(NULL);
#define rep(i, a, b) for(int i=a; i<b; i++)
#define rep1(i, a, b) for(int i=a; i<=b; i++)
#define repp(i, a, b) for(int i=b-1; i>=a; i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define db double
#define mi map<int, int>
#define vi vector<int>
#define qi queue<int>
#define MI(x) power(x, mod-2)
#define test int t; cin >> t;
#define all(a) a.begin(),a.end()
#define mod 1000000007
#define pi 3.141592653589
#define fact(n) rep(i, 1, n+1)ft.pb((ft[i-1]*i)%mod) ;
int power(int x, int y) ;
int gcd(int a, int b) ;

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template<typename T>
// using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
// template<typename T>
// using ordered_multiset = tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;
//(*****FOR USING ORDERED SET CHANGE INT*******)

// struct chash {
//     const int RANDOM = (long long)(make_unique<char>().get()) ^ chrono::high_resolution_clock::now().time_since_epoch().count();
//     static unsigned long long hash_f(unsigned long long x) {
//         x += 0x9e3779b97f4a7c15;
//         x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
//         x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
//         return x ^ (x >> 31);
//     }
//     static unsigned hash_combine(unsigned a, unsigned b) { return a * 31 + b; }
//     int operator()(int x) const { return hash_f(x)^RANDOM; }
// };

int power(int x, int y) ;
int gcd(int a,int b) ; 

signed main() {
    quickie
    int n ;
    cin >> n ;
    rep(i, 0, n) {
        cout << "ACL" ;
    }
    cout << "\n" ;
}

int power(int x, int y) {
    int res = 1; x %= mod;
    while (y > 0) {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res%mod;
}

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



Measured memory_bytes: 3572
/* Author - Ankur Kumar Singh 
	IDE :- Offine Linux
	
 ---------------------------------*/
#include <bits/stdc++.h>
using namespace std;
/* variable type :- */
	# define ll long long int
	# define ld long double
	# define I int
/* map */
	# define abc  pair<long long int,long long int>
	map < pair < abc,abc > , long long int > pqr;
	map <  pair < long long int,long long int > ,long long int > xyz;	
/* vector */
	# define pb push_back
	# define pp pop_back
	# define ff first
	# define ss second
	# define mp make_pair
	# define ac accumulate
/* pairs */
	vector<pair<ll,ll>>a;
	vector<pair<pair<int,int>,pair<int,int> > > b;
	vector<pair<ll,pair<ll,ll>>>c;
 
bool compare( const pair<long long int,long long int>&x , const pair<long long int,long long int>&y )
{
	return x.ff>y.ff;
}
bool sortbysec(const pair<int,int> &a,const pair<int,int> &b)
{
        return (a.ss < b.ss);
}
int main()
{
	ll n,k;
	cin>>n>>k;
	ll arr[n+1];
	ll freq[200002]={0};
	for(ll i=1;i<=n;i++)
	{
		arr[i]=i%k;
		freq[arr[i]]++;
		//cout<<i<<" "<<arr[i]<<endl;
	}
	ll sum=0;
	//cout<<endl;
	for(ll i=1;i<=n;i++)
	{
		ll x=arr[i];
		if(x==0)
		{
			ll z=freq[0];
			sum=sum+z*z;
			continue;

		}
		ll y=k-x;
		ll z=freq[y];
		ll f=2*y;
		//cout<<i<<" "<<x<<""<<endl;
		if(f%k!=0)continue;
		sum=sum+z*z;
		//cout<<i<<" "<<sum<<endl;
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 3328
def dfs(v,n,visited):
    all_visted=1
    for i in range(n):
        if visited[i]==0:
            all_visted=0
    if all_visted==1:
        return 1
    count=0#全ての辺を訪問する回数を格納する変数
    for i in range(n):
        if path[v][i]==0:#辺がないとき、つまり隣接していない時
            continue
        if visited[i]==1:#既に訪問している
            continue
        visited[i]=1#訪問する
        count+=dfs(i,n,visited)
        visited[i]=0
    return count
#グラフの位置情報を読み取る
n,m=map(int,input().split())
path=[[0]*n for i in range(n)]#0は未訪問,1は訪問済み
for i in range(m):
    a,b=map(int,input().split())
    path[a-1][b-1]=1#隣接しているところは1になる
    path[b-1][a-1]=1
visited=[0]*n
visited[0]=1#点1は既に訪問済みなので記録
print(dfs(0,n,visited))

Measured memory_bytes: 3064
from itertools import accumulate
from collections import defaultdict


def main():
    n = int(input())
    prime_counter = defaultdict(int)  # key ^ value
    accum = tuple(accumulate(range(1, 38)))  # because 10^12 < 2^39

    def facs(n):
        yield 2
        for x in range(3, int(pow(n, 0.5)) + 1, 2):
            yield x

    for fac in facs(n):
        while n % fac == 0:
            n //= fac
            prime_counter[fac] += 1
    if n != 1:
        prime_counter[n] += 1

    ans = 0
    for c in prime_counter.values():
        for accum_count, accum_value in enumerate(accum):
            if c < accum_value:
                break
        ans += accum_count
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9628
#!/usr/bin/env python3
import sys


def solve(N: int):
    print(int(N / 2) + N % 2)


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include<stdio.h>
#include<algorithm>
using namespace std;
int sen[10010][20];
int tate,yoko;
int cou(int sum[10010][2],int row)
{
    if(row == tate)
    {
        int ans = 0;
        for(int i = 0; i < yoko; i++)ans = ans + max(sum[i][0],sum[i][1]);
        return ans;
    }
    int sum0[10010][2] ={0},sum1[10010][2] = {0},ans0,ans1;
    for(int i = 0; i < yoko; i++)
    {
        sum0[i][0] = sum[i][0];
        sum0[i][1] = sum[i][1];
        sum1[i][0] = sum[i][0];
        sum1[i][1] = sum[i][1];
        if(sen[i][row] == 0)
        {
            sum0[i][0]++;
            sum1[i][1]++;
        }
        else
        {
            sum0[i][1]++;
            sum1[i][0]++;
        }
    }
    ans0 = cou(sum0,row + 1);
    ans1 = cou(sum1,row + 1);
    return max(ans0,ans1);
}
int main()
{
    while(scanf("%d%d",&tate,&yoko),tate + yoko)
    {
        int sam[10010][2] = {0};
        for(int i = 0; i < tate; i++)
        for(int j = 0; j < yoko; j++)
        scanf("%d",&sen[j][i]);
        printf("%d\n",cou(sam,0));
    }
    return 0;
}

Measured memory_bytes: 5080
// ਅਗਮਜੋਤ ਸਿੰਘ
// AGAMJOT SINGH

#include <bits/stdc++.h>
using namespace std; 
#define int long long
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define tc int t; cin >> t; while(t--)
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define CLK clock_t clk = clock();                                                                  //Start of main
#define OCLK cerr << "Time (in ms): " << (double)(clock() - clk) * 1000.0 / CLOCKS_PER_SEC << '\n'; //End of main
#define f(i,start,lessthan) for(int i=start;i<lessthan;i++)

// a_gamer

signed main(){
    int n, k;
    cin >> n >> k;
    char arr[n][k];
    f(i,0,n){
        f(j,0,k){
            cin >> arr[i][j];
        }
    }
    int dp[n][k];
    f(i,0,n){
        f(j,0,k){
            dp[i][j] = 0;
        }
    }
    f(i,0,n){
        f(j,0,k){
            if(i == 0){
                if(j == 0){
                    dp[i][j] = 1;
                }
                else{
                    if(arr[i][j] == '#'){
                        continue;
                    }
                    dp[i][j] = (dp[i][j-1]%mod + dp[i][j]%mod)%mod;
                }
            }
            else{
                if(arr[i][j] == '#'){
                    continue;
                }
                if(j == 0){
                    dp[i][j] = (dp[i-1][j]%mod + dp[i][j]%mod)%mod;
                }
                else{
                    dp[i][j] = (dp[i-1][j]%mod + dp[i][j-1]%mod + dp[i][j]%mod)%mod;
                }
            }
            // cout << dp[i][j] << "  " << i << "  " << j << endl;
        }
    }
    cout << dp[n-1][k-1]%mod << endl;
}

Measured memory_bytes: 9088
#include<bits/stdc++.h>
// Begin Header {{{
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i,n) for(ll i=0; i<n; i++)
#define loop(i, j, n) for(ll i=j; i<n; i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF  = 0x3f3f3f40;
const long long mod=1e9+7;
const long double PI = acos(0);
template <class T>void UNIQUE(vector<T> &x){
	sort(all(x));
	x.erase(unique(all(x)), x.end());
}

// }}} End Header
int main() {
	int set, set2;
	vector<vector<int>> a(3, vector<int>(3));
	rep(i,3){
		rep(j,3){
			cin >> a[i][j];
		}
	}
	rep(i,3){
		rep(j,3){
			if(j == 0) set = a[i][j];
			a[i][j]-=set;
		}
	}

	/*rep(i,3){
		rep(j,3){
			cout << a[i][j];
		}
		cout << endl;
	}
	*/
	int memo = 0;
	bool ok = true;
	rep(i,3){
		int sum = 0;
		rep(j,3){
			sum+=a[i][j];
		}
		if(i == 0) memo = sum;
		else{
			if(memo != sum) ok = false;
		}
	}
	if(ok) cout << "Yes";
	else cout << "No";
	return 0;
}

Measured memory_bytes: 3604
S = input()
flg = True
if S != S[::-1]:
    flg = False
if S[:(len(S)-1)//2] != S[:(len(S)-1)//2][::-1]:
    flg = False
if S[((len(S)+3)//2)-1:] != S[((len(S)+3)//2)-1:][::-1]:
    flg = False
if flg:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 38256
import bisect
N,M,K = map(int, input().split())
A = [int(a) for a in input().split()]
B = [int(b) for b in input().split()]

for i in range(N-1):
    A[i+1] += A[i]
for i in range(M-1):
    B[i+1] += B[i]

ans = bisect.bisect_right(B, K)
for i in range(N):
    if A[i] > K:
        break
    if K-A[i] < B[0]:
        ans = max(ans, i+1)
        continue
    j = bisect.bisect_right(B, K-A[i])
    ans = max(ans, i+j+1)

print(ans)

Measured memory_bytes: 111480
/* by Natsu Kinmoe */
#include <bits/stdc++.h>
using namespace std;

#define all(x) (x).begin(),(x).end()
#define loop(i,n) for(int i=0;i<(n);i++)
#define cont(i,n) for(int i=1;i<=(n);i++)
#define circ(i,a,b) for(int i=(a);i<=(b);i++)
#define range(i,a,b,c) for(int i=(a);((c)>0?i<=(b):i>=(b));i+=(c))
#define foreach(it,v) for(__typeof((v).begin()) it=(v).begin(),_e_D_=(v).end();it!=_e_D_;it++)
#define y0 y0O0OO00OO0OO0OO0OOO00OO0OO0O0O000OO0
#define y1 y1II11II11III11I1III11II111IIII1II1I1
#define pub push_back
#define pob pop_back
#define mak make_pair

typedef long long ll;
typedef long double lf;
const int Inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3fll;
/* Source code starts here */

int n,m;
pair<int,int> p[1<<17];
int c[1<<17];
vector<pair<int,int> > nei[1<<17];
bool lgl[1<<17];
vector<int> ans;

bool dfs(int now){
	lgl[now]=1;
	bool res=0;
	foreach(i,nei[now]){
		if(lgl[i->first])continue;
		bool ch=dfs(i->first);
		if(ch^c[i->first]){
			res^=1;
			ans.pub(i->second);
		}
	}
	return res;
}

int main(){
	scanf("%d%d",&n,&m);
	loop(i,n)scanf("%d%d",&p[i].first,&p[i].second);
	p[n].first=Inf;sort(p,p+n+1);
	c[0]=p[0].second;
	cont(i,n)c[i]=(p[i-1].second^p[i].second);
	loop(i,m){
		int l,r;scanf("%d%d",&l,&r);
		l=lower_bound(p,p+n,mak(l,0))-p;
		r=upper_bound(p,p+n,mak(r,1))-p;
		nei[l].pub(mak(r,i+1));
		nei[r].pub(mak(l,i+1));
	}
	loop(i,n+1)if(!lgl[i]&&(dfs(i)^c[i]))return 0&puts("-1");
	sort(all(ans));printf("%d\n",(int)ans.size());
	foreach(i,ans)printf("%d ",*i);return 0;
}

Measured memory_bytes: 17768
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn solve(a: i64, b: i64) -> Option<i64> {
    let max = std::cmp::max(a, b);
    let min = std::cmp::min(a, b);
    if (max - min) % 2  == 0 {
        Some((max + min) / 2)
    } else {
        None
    }
}

fn main() {
    input!{
        a: i64,
        b: i64,
    }
    match solve(a, b) {
        Some(k) => println!("{}", k),
        None => println!("IMPOSSIBLE"),
    }
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <string.h>

int main(void) {
  int counter=0;
  char S[4],T[4];
  scanf("%s", S);
  scanf("%s", T);
  for (int i = 0; i < 3; i++) {
    if (S[i]==T[i]) {
      counter++;
    }
  }
  printf("%d\n", counter);
  return 0;
}


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

int main(){
  int N,K,X,Y;
  cin>>N>>K>>X>>Y;
  if(N<K+1){
    cout <<N*X<<endl;
    return 0;
  }
  cout<<K*X+(N-K)*Y<<endl;
  return 0;

}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

const int Z = 1e9+7;

int bexp(int a, int x) {
    if (x == 0) {
        return 1;
    }
    if (x % 2 == 1) {
        return 1ll * a * bexp(a, x - 1) % Z;
    }
    int t = bexp(a, x / 2);
    return 1ll * t * t % Z;
}

int inv(int a) {
    return bexp(a, Z - 2);
}

int c(int n, int x) {
    int r = 1;
    for (int i = 1; i <= x; i++) {
        r = 1ll * r * (n + 1 - i) % Z * inv(i) % Z;
    }
    return r;
}

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

    int n, a, b;
    cin >> n >> a >> b;

    cout << (0ll + 2 * Z + bexp(2, n) - 1 - c(n, a) - c(n, b)) % Z << endl;

    return 0;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>

using namespace std;

typedef long long ll;
const ll nmax = 1e9 + 7;
const ll mod = 998244353;
const long long INF = 1e18;
const double PI = 2 * asin(1);

int main(){
  int N; cin >> N;
  string S, T; cin >> S >> T;

  for (int i = 0; i < N; i++){
    cout << S[i] << T[i];
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

bool dp[101010];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    dp[0] = false;
    for(int i = 1; i <= k; i++) {
        for(int j = 0; j < n; j++) {
            if(i - a[j] >= 0) {
                dp[i] = !dp[i - a[j]] | dp[i];
            }
        }
    }
    cout << (dp[k] ? "First" : "Second") << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
#define INF 1e18

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef vector < pair<int, int> > vii;
typedef long double ld;
typedef tree<pair<int,int>, null_type, less<pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n, a, b;
	cin >> n >> a >> b;
	if((b-a)%2==0){
		cout << "Alice\n";
	}
	else{
		cout << "Borys\n";
	}
	return 0;
}


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

#define N 10000
#define M 2000000

int main()
{
  unsigned short *A,*B;
  int i,j,n,C[N+1];

  scanf("%d",&n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

  for(i=1;i<n+1;i++) scanf("%d",&A[i]);

  for(i=0;i<N;i++) C[i] = 0;

  for(j=1;j<n+1;j++) C[A[j]]++;

  for(i=1;i<N;i++) C[i] = C[i]+C[i-1];

  for(j=n;j>0;j--){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }

  for(i=1;i<n;i++) printf("%d ",B[i]);
  printf("%d\n",B[n]);

  return 0;
}



Measured memory_bytes: 9712
A, B, C, D, E, F = map(int, input().split())

w = set()
for i in range(F // (100 * A) + 1):
    for j in range(F // (100 * B) + 1):
        a = (A * i + B * j) * 100
        if a < F:
            w.add(a)
w.remove(0)

best_concentration = -1
best_a = -1
best_b = -1
for a in w:
    for i in range((F - a) // C + 1):
        for j in range((F - a) // D + 1):
            b = C * i + D * j
            if a + b > F:
                continue
            if b > E * a // 100:
                continue
            concentration = 100 * b / (a + b)
            if concentration > best_concentration:
                best_concentration = concentration
                best_a = a
                best_b = b
print(best_a + best_b, best_b)


Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main(){
    int w, h;
    string c;
    cin>>w>>h>>c;
    int a[21][21]={};
    for(int i=0;i<h;i++)
        for(int j=0;j<w;j++){
            if(i == 0 || i == h - 1) a[i][j]++;
            if(j == 0 || j == w - 1) a[i][j] += 2;
            if(i == h / 2 && j == w / 2)a[i][j] += 5;
        }
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(a[i][j] == 1) cout<<"-";
            if(a[i][j] == 2) cout<<"|";
            if(a[i][j] == 3) cout<<"+";
            if(a[i][j] == 0) cout<<".";
            if(a[i][j] == 5) cout<<c;
        }
        cout<<endl;
    }
    return 0;
}



Measured memory_bytes: 3148
def main():
    N = int(input())
    A = list(map(int, input().split()))

    S = sum(A)
    X1 = S - 2 * sum([a for i, a in enumerate(A, 1) if i >= 2 and i % 2 == 0])
    res = []
    res.append(X1)
    for i in range(0, N-1):
        X_new = 2 * A[i] - res[i]
        res.append(X_new)

    print(" ".join([str(x) for x in res]))


if __name__ == '__main__':
    main()

Measured memory_bytes: 19144
using static System.Math;
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        var ans = -1;
        for (int i = 0; i < n; i++)
            for (int j = i + 1; j < n; j++)
            {
                var w1 = a[i] * a[j];
                if (check(w1.ToString())) ans = Max(ans,w1);
            }
        Console.WriteLine(ans);

    }
    static bool check(string a)
    {
        var aL = a.Length;
        if (aL == 1) return true;
        var pre = a[0] - '0';
        for (int i = 1; i < aL; i++)
        {
            if (pre + 1 != a[i] - '0') return false;
            pre = a[i] - '0';
        }
        return true;
    }
}



Measured memory_bytes: 22140
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
	int n,k;
	cin >> n >> k;
	cout << ((n%k == 0) ? 0 : 1) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <queue>

#define FOR(idx, begin, end) for(int idx = (int)(begin); idx < (int)(end); ++idx)

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

using namespace std;
typedef long long lint;

const int MOD = 100000007;
const int INF = 1 << 29;
const double EPS = 1e-9;


int main() {

	cin.tie(0);

	lint N, ans;
	vector<lint> A(5);

	cin >> N;
	FOR(i, 0, 5) cin >> A[i];

	ans = 5 + ((N - 1) / *min_element(A.begin(), A.end()));

	cout << ans;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdlib.h>

using namespace std;

int main(){
  string a,b;cin>>a>>b;
  string str=a+b, ans="No";
  int num=atoi(str.c_str());
  for(int i=1;i<=10000;i++){
    if(num==(i*i)){ans="Yes"; break;}
    if(num<(i*i)) break;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
main::IO()
main = do
  n <- getLine
  ss <- getLine
  putStrLn $ show $ getSlimeNumber ss

getSlimeNumber :: [Char] -> Int
getSlimeNumber (s0:[]) = 1
getSlimeNumber (s0:s1:ss) = if s0 /= s1 then 1 + getSlimeNumber (s1:ss) else getSlimeNumber (s1:ss)

Measured memory_bytes: 4988
#include <iostream>

using namespace std;

int main(){
    string daystr[] = {"Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"};
    int day[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30};
    int m, d;
    while(cin >> m >> d && m){
        for(int i = 0; i < m; i++){
            d += day[i];
        }
        cout <<  daystr[d % 7] << "\n";
    }
}


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

using namespace std;

#define uint unsigned int
#define llong long long int
#define ullong unsigned long long int
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(STL) STL.begin(), STL.end()
#define stl_rep(itr, STL) for (auto itr = STL.begin(); itr != STL.end(); ++itr)

const static long long int MOD = 1000000000 + 7;
const static int dy[] = {0, 1, 0, -1};
const static int dx[] = {1, 0, -1, 0};

int main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, m;
    cin >> n >> m;

    llong ans = (1900 * m + 100 * (n - m)) * pow(2, m);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import sys
## io
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
MIIZ = lambda: list(map(lambda x: x-1, MII()))
## dp
INIT_VAL = 0
MD2 = lambda d1,d2: [[INIT_VAL]*d2 for _ in range(d1)]
MD3 = lambda d1,d2,d3: [MD2(d2,d3) for _ in range(d1)]
## math
DIVC = lambda x,y: -(-x//y)
DIVF = lambda x,y: x//y
from collections import namedtuple

def main():
    n = II()
    tt = [MII() for _ in range(n-1)]
    for i in range(n-1):
        t = 0
        for j in range(i, n-1):
            c, s, f = tt[j]
            # 待ち時間の計算
            if t <= s:
                t = s
            elif t%f == 0:
                pass
            else:
                t += f - (t%f)
            # 電車移動時間を加算
            t += c
            pass
        print(t)
    print(0)


if __name__ == '__main__':
    main()

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

import sys
sys.setrecursionlimit(300000)

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(X: int):
    if X >= 30:
        ret = YES
    else:
        ret = NO
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()


Measured memory_bytes: 61788
///-----Bismillahir Rahmanir Rahim-----///

#include<bits/stdc++.h>
using namespace std;

///---FAST I/O---///
#define Boost() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

///---DATA TYPE---///
typedef long long ll;
typedef long long int lli;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;

///---LOOP---///
#define rep0(i,n) for(i=0;i<n;i++)
#define rep1(i,n) for(i=1;i<=n;i++)

///---I/O---///
#define sf scanf
#define pf printf

///---OTHERS---///
#define pb push_back
#define all(c)		c.begin(),c.end()
#define MK make_pair
#define F first
#define S second
#define endl '\n'


///---INITIALIZATION---//
#define mem(a,b) memset(a, b, sizeof(a) )

///---CALCULATE---///
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))

///---BIT OPERATION---///
inline bool checkBit(ll n, int i)
{
    return n&(1LL<<i);
}
inline ll setBit(ll n, int i)
{
    return n|(1LL<<i);;
}
inline ll resetBit(ll n, int i)
{
    return n&(~(1LL<<i));
}

///------String/Char Related Functions-----///
string makeintString(int x)
{
    stringstream ss;
    ss << x;
    string str = ss.str();
    ///cout<<str<<endl;
    return str;
}
string makellString(ll x)
{
    stringstream ss;
    ss << x;
    string str = ss.str();
    ///cout<<str<<endl;
    return str;
}
char cpp(char c)
{
    return static_cast<char>(c + 1);
}

///------------Sorting STL----------///
struct func
{
	//this is a sample overloading function for sorting stl
	bool operator()(pii const &a, pii const &b)
	{
		if(a.F==b.F)
			return (a.S<b.S);
		return (a.F<b.F);
	}
};

///---CONSTANT---///
const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007

int main()
{
    Boost();

    int t;
    t=1;
    //cin>>t;
    while(t--)
    {
        int a[3];
        cin>>a[0]>>a[1]>>a[2];
        sort(a,a+3);
        if(a[0]==5 && a[1]==5 && a[2]==7) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n) for (int i=1; i < (int)(n); i++)
#define rrep(i, n) for (int i=((int)(n)-1); i>=0; i--)
#define rreps(i, n) for (int i=((int)(n)-1); i>0; i--)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
using namespace std;
using lint = long long;
using p = pair<int, int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
  int N; cin >> N;
  vector<int> a(N);
  vector<int> b(N, 0);
  rep (i, N-1) cin >> b[i];
  a[0] = b[0];
  a[N-1] = b[N-2];
  reps (i, N-1) a[i] = min(b[i-1], b[i]);
  
  int sum = 0;
  sum = accumulate(ALL(a), sum);
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256