akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define PI 3.141592653589793238462643383279502884L
#define make_unique(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define Sort(vec) sort(vec.begin(),vec.end())
#define RSort(vec) sort(vec.rbegin(),vec.rend())
#define endl "\n"
#define tr1(i) cout<<i<<endl;
#define tr2(i,j) cout<<i<<" "<<j<<endl;
#define tr3(i,j,k) cout<<i<<" "<<j<<" "<<k<<endl;
#define vvi vector<vector<int> > 
#define vvl vector<vector<ll> >
#define all(st) st.begin(),st.end()
#define vpl vector<pair<ll,ll> >
#define vpi vector<pair<int,int> >
#define pi pair<int,int>
#define pl pair<ll,ll>
#define al vector<list<int> >
#define vs vector<string>
#define vb vector<bool>
#define vi vector<int>
#define vl vector<ll>
#define vc vector<char>
#define rep(i,l,r) for(int i=l;i<r;i++)
#define repit(st) for(auto it=st.begin();it!=st.end();it++)
#define cs(ans); cout<<setprecision(20)<<fixed<<ans<<endl;
#define ull unsigned long long int
#define eb emplace_back
#define pb push_back
#define ll long long int
#define minf -(1e18)
#define inf 1e18
#define f first
#define se second
#define mod 1000000007
using namespace std;
using namespace __gnu_pbds; 
ll mi(ll n,ll m){ll pw=n%m;ll ex=m-2;ll ans=1;while(ex){if(ex&1) ans = ans*pw%m;pw = pw*pw%m;ex>>=1;}return ans%mod;}
ll pw(ll a,ll n){ll pw=a;ll ex=n;ll ans=1;while(ex){if(ex&1) ans = ans*pw;pw = pw*pw;ex>>=1;}return ans;}
ll pwm(ll a,ll n){ll pw=a%mod;ll ex=n;ll ans=1;while(ex){if(ex&1) ans = ans*pw%mod;pw = pw*pw%mod;ex>>=1;}return ans%mod;}
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }
template<typename T> using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
//st.order_of_key(num)->number of elements < num
//st.find_by_order(i)->iterator of ith element in sorted order starting from zero
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
ll Abs(ll x){return x>0?x:(-x);}
ll Ceil(ll a,ll b){return a/b+(a%b!=0);}
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define mkp make_pair
//#define int long long int
//Binary_Search->dp->greedy
//auto check = [&](ll x){};
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int X[]={2,1,-1,-2,-2,-1,1,2}; 
int Y[]={1,2,2,1,-1,-2,-2,-1}; 
struct comp{
	bool operator()(const pair<int,int>&a,const pair<int,int>&b) const {
		if(a.first>b.first) return true;
		if(a.first<b.first) return false; 
		if(a.second<b.second) return true;
		return false;
	}
};	
void solve(){
	char c;
	cin>>c;
	int v=int(c);
	if(v>=97 && c<=122) cout<<"a"<<endl;
	else cout<<"A"<<endl;
	
	

		
	
	
	
	
	
	
	
	
	
}
int32_t main(){
int t=1;
//scanf("%d",&t);
while(t--){
	solve();
}
return 0;
}    


Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define inf 1000000007
#define mod 1000000007
//#pragma GCC optimize(2)
//#define int long long
using namespace std;
template <typename T> void read(T &x){
	x=0;char ch=getchar();int fh=1;
	while (ch<'0'||ch>'9'){if (ch=='-')fh=-1;ch=getchar();}
	while (ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
	x*=fh;
}
template <typename T> void write(T x) {
	if (x<0) x=-x,putchar('-');
	if (x>9) write(x/10);
	putchar(x%10+'0');
}
template <typename T> void writeln(T x) {
	write(x);
	puts("");
}

signed main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int a,b,c;
	cin>>a>>b>>c;
	set<int> st;
	st.insert(a);
	st.insert(b);
	st.insert(c);
	if(st.size()==2)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
from bisect import bisect_left
x=input()
s,t=[],[]
n=len(x)
for i in range(n):
    if x[i]=="S":
        s.append(i)
    else:
        t.append(i)
ans,cnt=0,0
#print(t)
for idx in t:
    if bisect_left(s,idx)-cnt>0:
        ans+=1
        cnt+=1
print(n-2*ans)

Measured memory_bytes: 11496
package main

import "fmt"

func luc() func() int {
	a, b := 2, 1
	return func() int {
		a, b = b, a+b
		return a
	}
}

func lucas(n int) int {
	f := luc()
	for i := 1; i < n; i++ {
		f()
	}
	return f()
}

func main() {
	var n int
	fmt.Scan(&n)
	fmt.Println(lucas(n))
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
const double PI=acos(-1);

int main(){
    ll n; cin >> n;
    vector<string> s(n);
    vector<ll> sans(26, 9999), ss(26, 0);
    rep(i, n){
        fill(ss.begin(), ss.end(), 0);
        cin >> s[i];
        sort(s[i].begin(), s[i].end());
        rep(j, s[i].length()) ss[s[i][j]-'a']++;
        rep(j, ss.size()) sans[j] = min(sans[j], ss[j]);
    }
    rep(i, sans.size()){
        rep(j, sans[i]) printf("%c", (char)('a'+i));
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	static int x,y,p,max = 0, minCount = 0;
	public static void main(String args[]){
		int map[][] = new  int [10][10];
		Scanner sc = new Scanner (System.in);
		while(sc.hasNext()){
			String input[] = sc.next().split(",");
			x = Integer.parseInt(input[0]);
			y = Integer.parseInt(input[1]);
			p = Integer.parseInt(input[2]);
			map[x][y]++;
			if(judge(x+1,y))map[x+1][y]++;
			if(judge(x-1,y))map[x-1][y]++;
			if(judge(x,y-1))map[x][y-1]++;
			if(judge(x,y+1))map[x][y+1]++;
			if(p >= 2){
				if(judge(x+1,y+1))map[x+1][y+1]++;
				if(judge(x-1,y-1))map[x-1][y-1]++;
				if(judge(x-1,y+1))map[x-1][y+1]++;
				if(judge(x+1,y-1))map[x+1][y-1]++;
			}
			if(p >= 3){
				if(judge(x+2,y))map[x+2][y]++;
				if(judge(x-2,y))map[x-2][y]++;
				if(judge(x,y+2))map[x][y+2]++;
				if(judge(x,y-2))map[x][y-2]++;
			}
		}
		for(int i = 0; i < 10;i++){
			for(int j = 0; j < 10; j++){
				if(map[i][j] == 0)minCount++;
				if(map[i][j]>max)max = map[i][j];
			}
		}
		System.out.println(minCount +"\n"+ max);
	}
	public static boolean judge(int x,int y){
		if(x < 0 || x > 9 || y < 0 || y > 9)return false;
		else return true;
	}
}

Measured memory_bytes: 26292
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
 
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

int main(){
    vector<int> chars[26];
    char s[100005]={};
    char t[100005]={};
    int mat[26][100005]={};
    REP(i,26)REP(j,100005)mat[i][j]=-1;
    scanf("%s%s",s,t);
    int slen=strlen(s);
    int tlen=strlen(t);
    REP(i,slen){
        chars[s[i]-'a'].push_back(i);
    }
    REP(i,26){
        if(chars[i].size()==0)continue;
        int size=chars[i].size();
        if(size==1){
            REP(j,slen)mat[i][j]=chars[i].at(0);
            continue;
        }
        for(int j=0;j<=size-2;j++){
            int jnext=chars[i].at(j+1);
            //if(jnext==size)jnext=0;
            for(int k=chars[i].at(j);k<jnext;k++)mat[i][k]=jnext;
        }
        for(int k=chars[i].at(size-1);k<slen;k++)mat[i][k]=chars[i].at(0);
        for(int k=0;k<chars[i].at(0);k++)mat[i][k]=chars[i].at(0);
    }
    int now=0;
    ll ans=0;
    if(t[0]==s[0]){
        ans=1;
    }
    else{
        now=mat[t[0]-'a'][0];
        if(now==-1){
            printf("-1\n");
            return 0;
        }
        ans=now+1;
    }
    for(int i=1;i<tlen;i++){
        int move=mat[t[i]-'a'][now];
        if(move==-1){
            printf("-1\n");
            return 0;
        }
        int dist=(now<move)?move-now : move-now+slen;
        now=move;
        ans+=dist;
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 11264
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <fstream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

vector<pii> g[100005];
int z[100005], y = 0;

void dfs(int x, int p, int q) {
    int c = 1;
    if (q == 1) c = 2;
    for (pii i : g[x]) if (i.first != p) {
        z[i.second] = c;
        y = max(y, c);
        dfs(i.first, x, c);
        c++;
        if (c == q) c++;
    }
}

int main() {
    ios::sync_with_stdio(false);
    int n, u[100005] = {}, v[100005] = {};
    cin >> n;
    for (int i = 1; i < n; i++) cin >> u[i] >> v[i], g[u[i]].push_back({v[i], i}), g[v[i]].push_back({u[i], i});
    dfs(1, 1, 0);
    cout << y << '\n';
    for (int i = 1; i < n; i++) cout << z[i] << '\n';
}


Measured memory_bytes: 12332
n = gets.chomp.to_i
for _ in 0...n
  flag = false
  t = gets.chomp
  res = ""
  for alpha in 0...26
    break if flag
    for beta in 0...26
      break if flag
      s = t.dup
      for i in 0...s.length
        code = s[i].ord
        if "a".ord <= code && code <= "z".ord
          code -= "a".ord
          code = (alpha * code + beta)%26
          code += "a".ord
        end
        s[i] = code.chr
      end
      u = s.split
      for i in 0...u.length
        if u[i]=="that" || u[i]=="this"
          res = s
          flag = true
          break
        end
      end
    end
  end
  puts res
end

Measured memory_bytes: 8816
#include<cstdio>
    #include<cstdlib>
    #include<cmath>
    #include<iostream>
    #include<string>
    #include<stack>
    #include<queue>
    #include<vector>
    #include<map>
    #include<set>
    #include<algorithm>
    #include<numeric>
     
    #define rep(n) for(int i=0;i<n;i++)
    #define repp(j, n) for(int j=0;j<n;j++)
    #define reppp(i, m, n) for(int i=m;i<=n;i++)
    #define all(c) c.begin(), c.end()
    #define rall(c) c.rbegin(), c.rend()
    #define pb(x) push_back(x)
    #define eb(x,y) emplace_back(x,y)
    #define MOD 1000000007
    #define MAX 1000000001
    #define INF 1410065408
    #define EPS 1e-9
    #define DEBUG 0
    #define ll long long
    #define Pll pair<ll, ll>
    #define Pii pair<int, int>
    #define Pdd pair<double, double>
     
    using namespace std;
    struct edge{int from, to; ll cost;};
     
    signed main(){
        ios::sync_with_stdio(false); cin.tie(0);
        string s;
        cin >> s;
        ll n = (ll)s.length();
     
        map<char,ll> mp;
        rep(n){
            mp[s[i]]++;
        }
     
        ll ans = (n-1)*n/2;
        for(auto itr=mp.begin(); itr!=mp.end(); itr++){
            ll m = itr->second;
            ans -= (m-1) * m / 2;
        }
        cout << ans + 1;
    }

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

int main(){
  int n;
  cin>>n;
  int count = 0;

  int q = n/25;
  count += q;
  n -= q*25;

  q = n/10;
  count += q;
  n -= q*10;

  q = n/5;
  count += q;
  n -= q*5;

  count += n;
  
  cout<<count<<endl;
}


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

///******************************** C o n t a i n e r ********************************///

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef map<int,int> mii;
typedef map<ll,int> mli;

///*********************************** C o n s t ***********************************///

int const N=1e6+3;
const double PI = acos(-1);

///********************************** M a r c o ***********************************///

#define pb push_back
#define F first
#define S second
#define test int tc; cin>>tc; while(tc--)
#define forn(i,n) for(i=0;i<n;i++)
#define rforn(i,n) for(i=n-1;i>=0;i--)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) x.size()
#define el <<'\n'
#define sp <<' '
#define print(a) {for(auto x:a)cout<<x<<" ";cout<<endl;}
#define mem(a,b) memset(a, b, sizeof(a))
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) (a)*(a)

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

///*********************************** F u n c t i o n ***********************************///

///ll powmod(ll a,ll b){ll p=MOD;a%=p;if(!a) return 0;ll pr=1;while(b>0){if(b&1){pr*=a;pr%=p;--b;}a*=a;a%=p;b/=2;}return pr;}
///bool isPrime(ll n){ if(n<=1)return false;if(n<=3)return true;if(n%2==0 or n%3==0)return false;for(ll i=5;i*i<=n;i+=6){if(n%i==0n%(i+2)==0)return false;}return true;}

///************************************************ C o d e ************************************************///
///-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=///



void _case()
{
    string a;
    ll n,i;
    cin>>n;
    while(n){
        ll f=n%26-1;
        if(f<0) f+=26,n--;
        a+=(char)(f+'a');
        n/=26;
    }
    reverse(all(a));
    cout<<a el;
}

main()
{
///    test
///    while(1)
        _case();

}


///Thank you.


///Brainless_Loco Terminates Here!


Measured memory_bytes: 3624
class UnionFind():
    def __init__(self, n):
        self.parent = [-1 for _ in range(n)]
        # 正==子: 根の頂点番号 / 負==根: 連結頂点数

    def find(self, x):
        if self.parent[x] < 0:
            return x
        else:
            self.parent[x] = self.find(self.parent[x])
            return self.parent[x]

    def unite(self, x, y):
        x, y = self.find(x), self.find(y)
        if x == y:
            return False
        else:
            if self.size(x) < self.size(y):
                x, y = y, x
            self.parent[x] += self.parent[y]
            self.parent[y] = x

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def size(self, x):
        x = self.find(x)
        return -self.parent[x]

    def is_root(self, x):
        return self.parent[x] < 0

N,M=map(int,input().split())
uf = UnionFind(N)
hashi = [list(map(int,input().split())) for _ in range(M)]
lis = [0]*M
lis[M-1] = N*(N-1)//2

for i in range(M-2,-1,-1):
    x = hashi[i+1][0]-1
    y = hashi[i+1][1]-1
    if uf.same(x,y):
        lis[i] = tmp
    else:
        xs = uf.size(x)
        ys = uf.size(y)
        uf.unite(x,y)
        tmp = lis[i+1] - xs*ys
        lis[i] = tmp
        if not tmp:
            break 
for i in range(M):
    print(lis[i])


Measured memory_bytes: 114592
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
}
signed main(){
  init_io();
  ll d,n,cnt=0;
  cin >> d >> n;
  for(int i=1;;i++){
    ll tmp,t=0;
    tmp = i;
    while(tmp%100==0){
      t++;
      tmp /= 100;
    }
    if(d == t){
      cnt++;
    }
    if(cnt==n){
      cout << i << endl;
      break;
    }
  }
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for(int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for(int i = ((int)(n)); i > 0; --i)
#define INF 100000000

using namespace std;

int main() {
    int res = INF;
    int n;
    cin >> n;
    vector<int> abcs(3);
    rep(i, 3) cin >> abcs[i];
    vector<int> l(n);
    for(int i = 0; i < n; i++)
        cin >> l[i];

    vector<int> bits(3);
    for(bits[0] = 1; bits[0] < (1 << n); ++bits[0]) {
        for(bits[1] = 1; bits[1] < (1 << n); ++bits[1]) {
            if(bits[0] & bits[1])
                continue;
            for(bits[2] = 1; bits[2] < (1 << n); ++bits[2]) {
                if(bits[0] & bits[2] || bits[2] & bits[1])
                    continue;
                vector<int> sums(3), nums(3, 0);
                rep(i, n) {
                    rep(j, 3) {
                        if(bits[j] >> i & 1) {
                            sums[j] += l[i];
                            nums[j]++;
                        }
                    }
                }
                int score = 0;
                rep(i, 3) {
                    score += abs(abcs[i] - sums[i]);
                    score += (nums[i] - 1) * 10;
                }
                res = min(res, score);
            }
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 504
object Main extends App {
  val N = scala.io.StdIn.readInt

  getSkew(1, Nil) match {
    case Nil => println("No")
    case skew => print(calc(skew))
  }

  def calc(skew: List[Int]): List[List[Int]] = {
    val n = skew.size
    val line = 1 :: skew.init.map(_ + 1)
    skew :: (0 until n).toList.map{i =>
      Stream.from(line(i)).take(i) ++: line.drop(i).map(_ + i)
    }
  }

  def print(list: List[List[Int]]): Unit = {
    println("Yes")
    println(list.size)
    list.foreach(l => println((l.size :: l).mkString(" ")))
  }

  @scala.annotation.tailrec
  def getSkew(n: Int, skew: List[Int]): List[Int] = sum(n) match {
    case N => (N :: skew).reverse
    case s if s < N => getSkew(n + 1, s :: skew)
    case _ => Nil
  }

  def sum(n: Int): Int = (n + 1) * n / 2
}

Measured memory_bytes: 56336
# -*- coding: utf-8 -*-
N = int(input())
t_list = []
x_list = []
y_list = []
t_list.append(0)
x_list.append(0)
y_list.append(0)
for i in range(N):
    t, x, y = map(int, input().split())
    t_list.append(t)
    x_list.append(x)
    y_list.append(y)

judge = True 
for i in range(N):
    distance = t_list[i + 1] - t_list[i]
    distance_abs = abs(x_list[i + 1] - x_list[i]) + abs(y_list[i + 1] - y_list[i])

    if (distance < distance_abs):
        judge = False
    if (distance % 2 != distance_abs % 2):
        judge = False

if judge is True:
    print('Yes')
if judge is False:
    print('No')

Measured memory_bytes: 11824
#include <bits/stdc++.h>
#define ll long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define deb(x) cout<<#x<<"="<<x<<endl;
#define endl '\n'
#define M 1000000007
#define int long long
#define INF 1e18
#define max_n 1000000

using namespace std;

ll h, w;
string g[1005];
bool vis[1005][1005];

bool check(ll x, ll y)
{
	return x >= 0 && y >= 0 && x < h && y < w && g[x][y] == '.';
}

void solve()
{
	cin >> h >> w;
	ll sx, sy, dx, dy;
	cin >> sx >> sy >> dx >> dy;
	sx--, sy--, dx--, dy--;
	for (int i = 0; i < h; ++i)
	{
		cin >> g[i];
	}
	ll ans[h][w];
	for (int i = 0; i < h; ++i)
	{
		for (int j = 0; j < w; ++j)
		{
			ans[i][j] = INF;
		}
	}
	multiset<pair<ll, pair<ll, ll>>> q;
	memset(vis, false, sizeof vis);
	if (check(sx, sy)) {q.insert({0, {sx, sy}}); ans[sx][sy] = 0;}
	while (q.size())
	{
		pair<ll, pair<ll, ll>> cur = *q.begin();
		q.erase(q.find(cur));
		ll x = cur.second.first, y = cur.second.second;
		ll cost = cur.first;
		if (vis[x][y])continue;
		vis[x][y] = true;
		for (int i = -2; i <= 2; ++i)
		{
			for (int j = -2; j <= 2; ++j)
			{
				ll xx = x + i, yy = y + j;
				if (!check(xx, yy))continue;
				ll addi = (abs(i) + abs(j)) > 1 ? 1 : 0;
				if (ans[xx][yy] > cost + addi)
				{
					ans[xx][yy] = cost + addi;
					q.insert({ans[xx][yy], {xx, yy}});
				}
			}
		}
	}
	if (vis[dx][dy])cout << ans[dx][dy] << endl;
	else cout << -1 << endl;
}

int32_t main()
{
	IOS
	ll T = 1;
	// cin >> T;
	for (ll i = 1; i <= T; ++i)
	{
		// cout<<"Case #"<<i<<": ";
		solve();
	}
	return 0;
}

Measured memory_bytes: 14084
#include<iostream>
using namespace std;
int main() {
    int a[200][200], r, c, sum;
    sum = 0;
    cin >> r >> c;
    for (int i = 0; i < r; i++) {
        for (int j = 0; j < c; j++) {
            cin >> a[i][j];
        }
    }
    for (int i = 0; i < r; i++) {
        for (int j = 0; j < c; j++) {
            cout << a[i][j] << " ";
            sum += a[i][j];
        }
        a[i][c] = sum;
        cout << sum << endl;
        sum = 0;
    }
    for (int j = 0; j < c; j++) {
        for (int i = 0; i < r; i++) {
            sum += a[i][j];
            if (i == r - 1) {
                a[i + 1][j] = sum;
                cout << sum << " ";
                sum = 0;
            }
        }
    }
    for (int i = 0; i < r; i++) {
        for (int j = 0; j < c; j++) {
            sum += a[i][j];
        }
    }

    cout << sum << endl;
    return 0;
}


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

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

ll a, b, c, d, e, f, g;

int main() {
	cin >> a >> b >> e >> c >> d >> f >> g; // no e,f,g

	ll ret = a/2*2 + c/2*2 + d/2*2;
	if (a && c && d) {
		ret = max(ret, 3 + (a-1)/2*2 + (c-1)/2*2 + (d-1)/2*2);
	}

	cout << ret + b << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int a, b, c, x;
  scanf("%d%d%d%d", &a, &b, &c, &x);
  int cnt = 0;

  for (int i=0; i<=a; i++) {
    for (int j=0; j<=b; j++) {
      for (int k=0; k<=c; k++) {
        if (i*500+j*100+k*50==x) {
          cnt++;
        }
      }
    }
  }
  
  printf("%d\n", cnt);

  return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<math.h>

int main(void)
{
 	double r;
	
	scanf("%lf", &r);
	
	//?¨????
	double menseki  =  pow(r, 2.0) * M_PI;  //=double menseki  =  r * r * M_PI;
	double ensyu    =  2 * r * M_PI;
	
	printf("%f %f\n", menseki, ensyu);
	
	return 0;
   
}

Measured memory_bytes: 2664
thelist=[2]
for i in range(3,1000):
        t=0
        for j in range(2,i):
            if i%j==0:
                t=1
                continue
        if t==0:
            thelist.append(i)
while True:
    try:
        n=int(input())
    except:
        break
    thedic={}
    for i in thelist:
        thedic[i]=0
    for i in range(1,n+1):
        t=i
        j=0
        while j!=len(thelist):
            if t%thelist[j]==0:
                thedic[thelist[j]]+=1
                t=t/thelist[j]
                continue
            j=j+1
            if t==1:
                break
    value=1
    for i in thedic:
        value=value%(1000000000+7)*(thedic[i]+1)
    print(value%(1000000000+7))
    

Measured memory_bytes: 3064
import heapq
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
l = []
for i in set(a):
    if c[i] >= 2:
        for j in range(c[i]//2):
            l.append(i)
if len(l) >= 2:
    print(heapq.nlargest(2, l)[0]*heapq.nlargest(2, l)[1])
else:
    print(0)

Measured memory_bytes: 25264
h,w = map(int,input().split())
maze = [input() for x in range(h)]
idou = ([1,0],[0,1],[-1,0],[0,-1])
min_step = [[0 for x in range(w)] for i in range(h)]
next_node = [(0,0)]
past_node = []
min_step[next_node[0][0]][next_node[0][1]] = 1
while next_node:
    for a in idou:
        hei = next_node[0][0] + a[0]
        wei = next_node[0][1] + a[1]
        try:
            if (maze[hei][wei] == "#")|(hei<0)|(wei<0)|(hei>=h)|(wei>=w)|((hei,wei) in past_node):
                continue
            else:
                past_node.append((hei,wei))
                if min_step[hei][wei] != 0:
                    continue
                else:
                    min_step[hei][wei] = min_step[next_node[0][0]][next_node[0][1]]+1
                next_node.append((hei,wei))
        except IndexError:
            continue
    next_node.pop(0)
count = 0
for x in range(h):
    for y in range(w):
        if maze[x][y] == "#":
            count+=1
if min_step[h-1][w-1] == 0:
  print(-1)
else:
  print(h*w-min_step[h-1][w-1]-count)

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


int main() {

string S;
cin>>S;
stack<char> s;
int N=S.size();
s.push(S[0]);
for(int i=1;i<N;i++){
  if(!s.empty()&&s.top()=='S'&&S[i]=='T') s.pop();
  else s.push(S[i]);
}
cout<<s.size()<<endl;

}


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

int main()
{
	int L,R;
	cin >> L >> R;
	//int mini = 2020;
	//int mini2 = 2021;
	int cnt = 0;
	int ans = 2020;

	/*
	for (int i = 0; i < 2020*2020; ++i)
	{
		if (cnt > (R-L))
		{
			break;
		}
		cnt++;
		int temp = (L+i) % 2019;
		//cout << temp << "  " << endl;
		if (temp <= mini)
		{
			//cout << "a";
			mini2 = mini;
			mini = temp;
		}
		else if (temp <= mini2)
		{
			//cout << "b";
			mini2 = temp;
		}
	}
	*/

	int a,b;

	for (int i = 0; i < 2020; ++i)
	{	
		if (L+i < R)
		{
			for (int j = i+1; j < 2020; ++j)
			{
				if (L+j <= R)
				{
					int temp = (((L+i) % 2019)*((L+j) % 2019)) % 2019;
					if (temp < ans)
					{
						ans = temp;
						a = (L+i);
						b = (L+j);
					}
				}
			}
		}
	}

	//cout << mini << " " << mini2 << endl;
	cout << ans << endl;
	//cout << a << " " << b << endl;
	return 0;
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
#define F first
#define S second
#define ll long long int
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define tests int t;cin>>t;while(t--)
#define take(a,i,n) for(i=0;i<n;i++) cin>>a[i]
#define hell 1000000007
#define ret(a) { cout<<a; return 0;}
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);  cout.tie(0);
#define vi vector <int>
#define pii pair <int,int>
#define vii vector < pii >
#define pi 3.14159265
using namespace std;
//Auhtor:-Avinash
 
ll power(ll x, ll y, ll m) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2, m) % m; 
    p = (p * p) % m; 
    return (y%2 == 0)? p : (x * p) % m; 
} 
 
ll modInverse(ll a, ll m) 
{  
    return power(a, m-2, m);  
} 

int main(){
    fastio
    string s;
    cin>>s;
    int count=0;
    for(int i =0;i<3;i++){
      if(s[i]=='R'){
        count+=1;
        if(s[i+1]=='S')
          break;
      }
    }
    cout<<count;
     
}

Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;

namespace AtCoder
{
	public class Program
	{
		static void Main()
		{
			var nm = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
			int n = nm[0];
			int m = nm[1];
			var to = new List<int>[n];
			for (int i = 0; i < n; i++) {
				to[i] = new List<int>();
			}

			for (int i = 0; i < m; i++) {
				var ab = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
				int a = ab[0] - 1;
				int b = ab[1] - 1;
				to[a].Add(b);
				to[b].Add(a);
			}

			foreach (int first in to[0]) {
				foreach (int second in to[first]) {
					if (second == n - 1) {
						Console.WriteLine("POSSIBLE");
						return;
					}
				}
			}

			Console.WriteLine("IMPOSSIBLE");
		}
	}
}

Measured memory_bytes: 38548
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+100;
int a[N];bool b[N];
inline bool check(int n,int mid) {
	for (int i=1;i<=n*2-1;i++) b[i]=a[i]>mid;
	for (int i=1;i<n;i++) {
		if (b[n+i-1]==b[n+i]) return b[n+i];
		if (b[n-i+1]==b[n-i]) return b[n-i];
	}
	return b[n]^(~n&1);
}
int main()
{
	int n,i,l,r,mid;
	for (i=1,cin>>n;i<=n*2-1;i++) cin>>a[i];
	l=1,r=n*2-1;
	while (l!=r) {
		mid=(l+r)>>1;
		if (check(n,mid)) l=mid+1;
		else r=mid;
	}
	printf("%d\n",l);
	return 0;
}


Measured memory_bytes: 1280
n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)
h = Hash.new(0)
a.each do |i|
    h[i] += 1
end
sum = 0
h.each do |key, val|
    sum += val * (val - 1) / 2
end
a.each do |i|
    if h[i] <= 2
        puts sum - h[i] * (h[i] - 1) / 2
    else
        puts sum - (h[i] * (h[i] - 1)) / 2 + ((h[i] - 1) * (h[i] - 2)) / 2
    end
end

Measured memory_bytes: 29964
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 14 20:59:48 2020

@author: Kanaru Sato
"""

dict = list("abcdefghijklmnopqrstuvwxyz")

def gen(n):
    if n == 1:
        return ["a"]
    else:
        rvalue = []
        for s in gen(n-1):
            max = 0
            for i in range(len(s)):
                num = dict.index(s[i])
                if num >= max:
                    max = num
            for i in range(max+2):
                rvalue.append(s+dict[i])
        return rvalue

n = int(input())
l = gen(n)
ans = sorted(l)

for i in range(len(ans)):
    print(ans[i])

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

const int maxn = 1010;
int n, x[maxn], fa[maxn];
long long all[maxn];
bitset<5010> f[maxn];
bool chk[maxn];

int main() {
    scanf("%d", &n);
    for (int i = 2; i <= n; i++) {
        scanf("%d", &fa[i]), chk[fa[i]] = 1;
    }
    for (int i = 1; i <= n; i++) {
        scanf("%d", &x[i]), f[i].set(0);
    }
    for (int i = n; i; i--) {
        if (chk[i]) {
            int t = -1;
            for (int j = x[i]; ~j; j--) {
                if (f[i].test(j)) { t = j; break; }
            }
            if (!~t) printf("IMPOSSIBLE\n"), exit(0);
            f[fa[i]] = (f[fa[i]] << x[i]) | (f[fa[i]] << (all[i] - t));
            all[fa[i]] += all[i] - t + x[i];
        } else {
            f[fa[i]] |= (f[fa[i]] << x[i]);
            all[fa[i]] += x[i];
        }
    }
    printf("POSSIBLE\n");
    return 0;
}

Measured memory_bytes: 896
#include<iostream>
#include<vector>
#include<sstream>
#include<string>
#include<numeric>
#include <algorithm>
#include<math.h>
#include<cstdio>
#include<string.h>
#include<stdio.h>
#include<stdlib.h>



using namespace std;
typedef long long ll;
struct point{
  int x;
  int y;

};
int gcd( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd
int lcm( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm
int input(){
  int x;
  cin>>x;
  return x;
}
int abs(int x){
  if(x>=0){
    return x;
  }else{
    return -x;
  }
}

int moji(char in)
{
    int ans = (int)in-(int)'a'+1;
    if((in < 1) || (in > 26)){
        ans = 100;
    }
    return ans;
}
const int VV=10;//場合に応じてVVの値のみ変更する必要あり
//dijkstra(s)sがスタート地点でそこからの最短距離を配列dで表す。正の重みのみ使用可能
int cost[VV][VV];
int d[VV];
bool used[VV];
void dijkstra(int s){
  fill(d,d+VV,100000);
  fill(used,used+VV,false);
  d[s]=0;
  while(true){
    int v=-1;
    for(int u=0;u<VV;u++){
      if(!used[u]&&(v==-1||d[u]<d[v]))v=u;
    }
    if(v==-1)break;
    used[v]=true;
    for(int u=0;u<VV;u++){
      d[u]=min(d[u],d[v]+cost[v][u]);
    }
  }

}

int compare_int(const void *a, const void *b)//qsort(quick sort利用時に使用)
{
    return *(int*)a - *(int*)b;
}





int main(){
  int X,Y;
  cin>>X>>Y;
  cout<<X+Y/2<<endl;


  



}


  
  

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
string s,t;cin>>s>>t;
char x[4],y[4];
int count1 = 0;
strcpy(x,s.c_str());strcpy(y,t.c_str());
for(int i=0;i<3;i++){
    if(x[i]==y[i])
        count1+=1;
}
cout<<count1<<endl;
return 0;}


Measured memory_bytes: 3612
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.regex.Pattern;

public class Main {
    public void solve(final BufferedReader stdin, final PrintWriter stdout) throws NumberFormatException, IOException {
        long[] line = Pattern.compile(" ").splitAsStream(stdin.readLine()).mapToLong(Long::parseLong).toArray();
        long n = line[0];
        long a = line[1];
        long b = line[2];

        if ((b - a) % 2 == 0) {
            stdout.println("Alice");
        } else {
            stdout.println("Borys");
        }
    }

    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter stdout = new PrintWriter(System.out, false);
        new Main().solve(stdin, stdout);
        stdout.flush();
    }
}


Measured memory_bytes: 26708
#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define sz(v) (int) v.size()
#define pr(v) For(i, 0, sz(v)) {cout<<v[i]<<" ";} cout<<endl;
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(ll i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long
#define int long long
#define mp make_pair
#define F first
#define S second
typedef pair<int, int> pii;
typedef vector<int> vi;
#define MOD 1000000007
#define INF 1000000000000000007LL

const int N = 100005;
 
// it's swapnil07 ;)
 
#ifdef SWAPNIL07
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define endl '\n'
#define trace(...)
#define end_routine()
#endif



void solve(){
    int a, b, n; cin>>a>>b>>n;
    int x = min(n, b-1);
    int val = ((a*x)/b)-a*(x/b);
    cout<<val;
}


signed main()
{
    fast
    #ifdef SWAPNIL07
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    int t=1;
    while(t--){
        solve();
    }
    return 0;
}





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

struct S{
  int left, area;
};

int cnt = 0, sp = 0, asp = 0;
int st[20020];
S ans[200200];

void push( int x ){
  st[sp++] = x;
}

void apush( S s ){
  ans[asp++] = s;
}

int pop(){
  int t = st[--sp];
  return t;
}

S apop(){
  S t = ans[--asp];
  return t;
}

S top(){
  return ans[asp - 1];
}

int main(){
  char str[20010]; cin >> str;

  int sum = 0;
  for( int i = 0; i < strlen( str ); i++ ){
    if( str[i] == '\\' ) push( i );
    else if( str[i] == '/' ){
      if( sp != 0 ){
	int j = pop();
	sum += i - j;

	int tmp = i - j;
	while( asp != 0 && top().left > j ){
	  tmp += top().area;
	  apop();
	}
	apush( S( { j, tmp } ) );
      }
    }
  }

  cout << sum << endl;
  cout << asp;
  for( int i = 0; i < asp; i++ ){
    cout << " " << ans[i].area;
  }
  cout << endl;

}



Measured memory_bytes: 3184
a_s = list(map(int, input().split()))

count = 0
flag = 0

while flag == 0:
    if a_s[0] == a_s[1] and a_s[1] == a_s[2]:
        flag = 1
        break
    a_s = sorted(a_s)
    count += 1
    if a_s[2] > a_s[1] and a_s[2] > a_s[0]:
        a_s[0] += 1
        a_s[1] += 1
    else:
        a_s[0] += 2

print(count)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
struct tree
{
	int value;
//	tree *s,*l,*r;
	int lr,rr,sr;
	tree (int value=0,int lr=0,int rr=0,int sr=0):value(value),sr(sr),lr(lr),rr(rr){}
} node[200005];
int main()
{
	int n,q;
	cin>>n;
	cin>>q;
	for (int i=1;i<n;i++)
	{
		int t1,t2;
		cin>>t1>>t2;
		if (node[t1].lr  ==0)
			node[t1].lr  =t2;		
		else 
			node[t1].rr =t2;
		node[t2].sr =t1;				
	} 
	for (int j=1;j<=q;j++)
	{
		int t1,t2;
		cin>>t1>>t2;
		node[t1].value +=t2;
	}
	for (int i=2;i<=n;i++)
	{
		node[i].value =node[i].value +node[node[i].sr].value ;  
	}
	for (int i=1;i<=n;i++)
	if (i==1)
		cout<<node[i].value ;
	else
		cout<<" "<<node[i].value ;
    return 0;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
string S;
int ret[202020];

bool hoge() {
	int i,j,k,l,r,x,y; string s;
	
	if(count(ALL(S),'0')==0) {
		if(N%2) return false;
		FOR(i,N/2) {
			ret[i*4+0]=ret[i*4+2]=i*2+1;
			ret[i*4+1]=ret[i*4+3]=i*2+2;
		}
		return true;
	}
	
	S+='1';
	S+=S+S;
	FOR(i,S.size()) if(S[i]=='0') break;
	vector<vector<int>> V;
	vector<int> T;
	for(j=1;j<=2*N;j++) {
		if(S[i+j]=='1') {
			if(S[i+j-1]=='0') T.push_back((i+j)%(2*N));
			T.push_back((i+j+1)%(2*N));
		}
		else {
			if(T.size()) V.push_back(T);
			T.clear();
		}
	}
	
	int tot=0;
	vector<int> cand;
	int nex=1;
	FOR(i,V.size()) {
		tot+=V[i].size()-2;
		if(V[i].size()>=3) cand.push_back(i);
	}
	
	if(tot%2) return false;
	if(tot%4) {
		if(cand.size()<2) return false;
		x=cand[0];
		y=cand[1];
		ret[V[x][1]]=ret[V[y][1]]=nex++;
		swap(V[x][0],V[y][0]);
		V[x].erase(V[x].begin()+1);
		V[y].erase(V[y].begin()+1);
	}
	T.clear();
	FOR(i,V.size()) {
		ret[V[i].back()]=ret[V[(i+1)%V.size()][0]]=nex++;
		for(j=1;j<V[i].size()-1;j++) T.push_back(V[i][j]);
	}
	
	assert(T.size()%4==0);
	FOR(i,T.size()/4) {
		ret[T[i*4]]=ret[T[i*4+2]]=nex++;
		ret[T[i*4+1]]=ret[T[i*4+3]]=nex++;
	}
	T.clear();
	FOR(i,2*N) if(ret[i]==0) T.push_back(i);
	FOR(i,T.size()/2) ret[T[i*2]]=ret[T[i*2+1]]=nex++;
	
	return true;
}

void solve() {
	int i;
	
	cin>>N>>S;
	if(hoge()) {
		cout<<"Yes"<<endl;
		FOR(i,2*N) cout<<ret[i]<<" ";
		cout<<endl;
	}
	else {
		cout<<"No"<<endl;
	}
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


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

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef long double LD;
typedef pair<LD, LD> PLDLD;

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


const int N=1000001;
const int INF = 1e9+7;

int main()
{
    int n;
    cin>>n;
    vector<int> a(n);
    REP(i,n)
    {
        cin>>a[i];
    }
    vector<int> b(a);
    map<int,int> m;
    sort(ALL(b));
    REP(i,n)
        m[b[i]]=i;
    
    int cnt=0;
    for(int i=0;i<n;i+=2)
        if(m[a[i]]%2==1) cnt++;
    
    cout<<cnt<<endl;
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i,n) for(ll i=0;i<n;i++)

int main(){
	int n;cin>>n;
	ll a[n],x=0;

	rep(i,n){
		cin>>a[i];
		x^=a[i];
	}
	
	if(x==0) cout<<"Yes"<<"\n";
	else cout<<"No"<<"\n";
}

Measured memory_bytes: 1024
import java.io.*;
import java.util.StringTokenizer;

public class Main {

    FastScanner in;
    PrintWriter out;

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

    void solve() {
        String input = in.nextToken();
        int result = 0;
        for (Character c : input.toCharArray()) {
            if (c.equals('1')) {
                result++;
            }
        }
        out.println(result);
    }

    void run() {
        in = new FastScanner();
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

    public class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public String nextToken() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextToken());
        }

        public long nextLong() {
            return Long.parseLong(nextToken());
        }

        public double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }

}

Measured memory_bytes: 21204
using System; 
using System.Text; 
using System.Collections.Generic;
using System.Linq; 
using E = System.Linq.Enumerable; 

class Program {
     
     static void Main(string[] args) {
     //入力を受け取る
     var N   = int.Parse(Console.ReadLine());
     var A  = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
     
     var ans = new long[N];
     
     if(N%2 == 0){
     for(int i = 0;i < N; i++){
         if(i%2 == 0){
             ans[N/2+i/2] = A[i];
         }else{
             ans[N/2-1-i/2] = A[i];
         }
         
     }
     }else{
         for(int i = 0;i < N; i++){
         if(i%2 == 0){
             
             ans[N/2-i/2] = A[i];
         }else{
             ans[N/2+i/2+1] = A[i];
         }
     }
     }
        Console.WriteLine(
        String.Join(" ",ans));
     }
     
     
}
     
     
     
     
     


Measured memory_bytes: 46008
#include "bits/stdc++.h"
using namespace std;
using namespace literals;

struct Edge {
  int a, b;
  int color;
};

struct EdgeD {
  int id;
  int to;
  EdgeD() = default;
  EdgeD(int id_, int to_)
    : id(id_), to(to_) {}
};

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<Edge> E(N - 1);
  for (auto& v : E) {
    cin >> v.a >> v.b;
    --v.a; --v.b;
  }
  vector<vector<EdgeD>> G(N);
  for (int i = 0; i < N - 1; ++i) {
    G[E[i].a].push_back(EdgeD(i, E[i].b));
    G[E[i].b].push_back(EdgeD(i, E[i].a));
  }
  int K = 0;
  vector<bool> visited(N, false);
  queue<pair<int, int>> que;  // index, color
  que.push(make_pair(0, 0));
  while (!que.empty()) {
    auto cur = que.front(); que.pop();
    visited[cur.first] = true;
    int k = 0;
    for (auto& e : G[cur.first]) {
      if (visited[e.to])continue;
      ++k;
      if (k == cur.second)++k;
      K = max(K, k);
      E[e.id].color = k;
      que.push(make_pair(e.to, k));
    }
  }
  cout << K << endl;
  for (auto& e : E)cout << e.color << "\n";
  cout << flush;
}


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

mod_sum = N*(N-1)//2
print(mod_sum)

#りゅうせいの解答2 不正解2つあり
# N = int(input())
#
# mod_sum = int(N*(N-1)/2)
# print(mod_sum)

# りゅうせいの解答1　実行時間超過
#  N = int(input())
#
# P_list = []
# M_list = []
#
#
# for i in range(N):
#     if i == N-1:
#         P_list.append(1)
#
#     else:
#         P_list.append(i+2)
#
#
# for i in range(N):
#     M_list.append((i+1) % P_list[i])
#
# print(sum(M_list))

Measured memory_bytes: 2940
#include<stdio.h>
#define N 44
int fibonacci(int);

int main(){
  int n,a=0;

  scanf("%d",&n);
  a = fibonacci(n);
  printf("%d\n",a);

  return 0;
}

int fibonacci(int n){
  int F[N],i;

  F[0]=1;
  F[1]=1;

  for(i=2;i<=n;i++){
    F[i]=F[i-2]+F[i-1];
  }

  return (F[n]);

}

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


using namespace std;





int main(){
	int n,k;cin>> n >> k;//n本の木の中からk本選ぶ。ソートした後は、0番目+k-1番目の差を見ていけばよい。
	vector<int> H(n);
  	for(int i = 0; i < n ; i++){
		cin >>H.at(i);
	  }
	  sort(H.begin(),H.end());
	  long long ans=10000000000;
	  for(int i = 0 ; i+k < n+1; i++){
		int a=H.at(i+k-1)-H.at(i);
		if(a<ans){
			ans=a;
		  }
		}
		cout<<ans<<endl;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
using ll = long long;

int main() {
    vector<ll> length(3);
    rep(i, 0, 3) cin >> length[i];
    sort(length.begin(), length.end());
    ll ans = 0;
    if(length[0] % 2 ==1 && length[1] % 2  == 1 && length[2] % 2 == 1){
        ans = length[0] * length[1];
        cout << ans << endl;
        return 0;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
template <class T> void corner(bool flg, T hoge) {
    if(flg) {
        cout << hoge << endl;
        exit(0);
    }
}
#define all(v) v.begin(), v.end()
#define inputv(v, n)                                                           \
    vl v;                                                                      \
    rep(i, n) {                                                                \
        ll x;                                                                  \
        cin >> x;                                                              \
        v.push_back(x);                                                        \
    }
const ll INF = 999999999999999;
const ll MOD = 1000000007;
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l, ans;
int main() {
    cin >> a>>b;
    string s1="0",s2="0",T,U;
    s1[0]+=a;
    s2[0]+=b;
    rep(i,b){
        T=T+s1;
    }
    rep(i,a){
        U=U+s2;
    }
    cout<<min(T,U)<<endl;

}

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

#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())
#define endl "\n"


template <typename T, typename K> struct P {
	T a; K b;
};

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
vector <P <ll, ll> >prime_factorize( ll N );
void initialize( void );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;
int main( void ){
	// initialize();
	int N;
	cin >> N;
	vector <int> f( 1e5 + 5, 0 );
	rep( i, 0, N ){
		int input; cin >> input;
		if (input != 0)
			f[ input - 1 ]++;
		f[ input ]++;
		f[ input + 1 ]++;
	}
	int maximum = 0;
	rep( i, 0, 1e5 + 5 ){
		maximum = max( f[ i ], maximum );
	}
	cout << maximum << endl;
}

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

/*
 * @fn eratosthenes
 * @brief O(NloglogN)~=(N)
 * @param N: その数まで
 * @return 0 or 1 の配列 (boolは都合が悪い)
 */
int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}

/*
 * @fn prime_factorize
 * @brief O(√N): 素因数分解
 * @param N: 素因数分解する数
 * @return vec: (a: 素数, b: 個数)
 */
vector <P <ll, ll> >prime_factorize( ll N ){
	vector <P <ll, ll> > vec;
	int lim = sqrt( N ) + 1;
	rep( i, 2, N + 1 ){
		if (i >= lim){
			vec.push_back( P <ll, ll>{N, 1} );
			break;
		}
		if (N % i == 0){
			vec.push_back( P <ll, ll>{i, 0} );
			while(N % i == 0){
				N /= i;
				vec.back().b++;
			}
		}
	}
	return vec;
}
void initialize( void ){
	cout << fixed << setprecision( 10 );
}


Measured memory_bytes: 640