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

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

const int maxn = 110000;
i64 b[maxn], l[maxn], r[maxn], d[maxn];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;
#ifdef LOCAL_DEFINE
    freopen("input.txt", "rt", stdin);
#endif

    int n;
    i64 x;
    cin >> n >> x;
    i64 lb = 0;
    forn(i, n) cin >> b[i] >> l[i] >> r[i], lb -= l[i] * b[i], d[i] = r[i] * (x - b[i]) + l[i] * b[i];
    vi ord(n);
    iota(all(ord), 0);
    sort(all(ord), [](int i, int j){return d[i] > d[j];});
    vi64 ps(n + 1);
    forn(i, n) ps[i + 1] = ps[i] + d[ord[i]];

    vi pos(n);
    forn(i, n) pos[ord[i]] = i;

    i64 ans = 1e18;
    forn(i, n) {
        int L = -1, R = n;
        while (R - L > 1) {
            int M = (L + R) / 2;
            i64 x = ps[M];
            if (pos[i] >= M) x += d[i];
            (x + lb >= 0 ? R : L) = M;
        }
        i64 need = -(lb + ps[R]);
        i64 hours = x * R;
        if (pos[i] < R) need += d[i], hours -= x;
        i64 extra = 0;
        if (need > l[i] * b[i]) extra = b[i] + (need - l[i] * b[i] + r[i] - 1) / r[i];
        else if (need > 0) extra = (need + l[i] - 1) / l[i];
        uin(ans, hours + extra);
//        cerr << i << ' ' << R << ' ' << hours + extra << '\n';
    }
    cout << ans << '\n';

#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

int main(void) {
	int H,W;
	cin >> H >> W;
	vector< vector<char> > field(H+2, vector<char>(W+2,'#'));
	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j) {
			cin >> field[i+1][j+1];
		}
	}
	int res = 0;
	vector< vector<int> > rtoc(H+2, vector<int>(W+2,0));
	vector< vector<int> > ctor(H+2, vector<int>(W+2,0));
	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j) {
			if (field[i+1][j+1] == '.') {
				if (rtoc[i+1][j+1] == 0) {
					int count = 0;
					for (int c = j+1; field[i+1][c] != '#'; ++c) {
						++count;
					}
					for (int c = j+1; field[i+1][c] != '#'; ++c) {
						rtoc[i+1][c] = count;
					}
				}
				if (ctor[i+1][j+1] == 0) {
					int count = 0;
					for (int r = i+1; field[r][j+1] != '#'; ++r) {
						++count;
					}
					for (int r = i+1; field[r][j+1] != '#'; ++r) {
						ctor[r][j+1] = count;
					}
				}
				res = max(rtoc[i+1][j+1]+ctor[i+1][j+1]-1,res); 
			}
		}
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 35712
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define dbg puts("It's Just Begining.Wait For The End!!!!!\n")
#define CHECK(x) cout << (#x) << " is " << (x) <<"\n";
#define endl printf("\n")
typedef pair<ll,ll> pii;
#define pb push_back
#define ms(a,b) memset(a, b, sizeof(a))
#define in(x) scanf("%lld",&x)
#define out(x) printf("%lld",x)
#define X first
#define Y second
#define sps printf(" ")
#define dou(x) cout<<fixed<<setprecision(6)<<x
#define all(v) v.begin(),v.end()
#define dis(it,it1) distance(it,it1)+1
#define MAX 1005
#define INF 100000000000000
#define MOD 1000000007
#define print(cs) printf("Case %lld: ",cs)
#define Yesno(ok) if(ok)puts("YES");else puts("NO")
#define yesno(ok) if(ok)puts("Yes");else puts("No")
ll lcm(ll a,ll b)
{
    return ((a*b)/__gcd(a,b));
}
ll cost[MAX][MAX];
char lolo[MAX][MAX];
ll dx[]={0,0,1,-1};
ll dy[]={1,-1,0,0};
ll dd[]={0,0,0,0,1,1,1,1,1,-1,-1,-1,-1,-1,2,2,2,2,2,-2,-2,-2,-2,-2};
ll ee[]={1,-1,2,-2,1,-1,2,-2,0,1,-1,2,-2,0,1,-1,2,-2,0,1,-1,2,-2,0};
bool valid(ll xx,ll yy,ll n,ll m)
{
    if(xx>=1&&xx<=n&&yy>=1&&yy<=m&&lolo[xx][yy]!='#')return true;
    else return false;
}
void bfs(ll xx,ll yy,ll n,ll m)
{
    priority_queue<pair< ll, pii > ,vector<pair<ll, pii > >,greater<pair<ll, pii > > >qq;
    qq.push({0,{xx,yy}});
    cost[xx][yy]=0;
    while(!qq.empty())
    {
        pair< ll, pii > pt=qq.top();
        qq.pop();
        pii sorce=pt.Y;
        for(ll i=0;i<4;i++)
        {
            xx=sorce.X+dx[i];
            yy=sorce.Y+dy[i];
            if(valid(xx,yy,n,m)&&cost[xx][yy]>cost[sorce.X][sorce.Y])
            {
                cost[xx][yy]=cost[sorce.X][sorce.Y];
                qq.push({cost[xx][yy],{xx,yy}});
            }
        }
        for(ll i=0;i<24;i++)
        {
            xx=sorce.X+dd[i];
            yy=sorce.Y+ee[i];
            if(valid(xx,yy,n,m)&&cost[xx][yy]>cost[sorce.X][sorce.Y]+1)
            {
                cost[xx][yy]=cost[sorce.X][sorce.Y]+1;
                qq.push({cost[xx][yy],{xx,yy}});
            }
        }
    }
}
int main()
{
    ll test=1;
    while(test--)
    {
        ll i,j,k,l,n,m,r;
        in(n);in(m);
        in(l);in(r);
        ll de,dw;
        in(de);in(dw);
        for(i=1;i<=n;i++)
            for(j=1;j<=m;j++)cin>>lolo[i][j],cost[i][j]=INF;
        bfs(l,r,n,m);
        ll ans=(cost[de][dw]<INF?cost[de][dw]:-1);
        out(ans);endl;
    }
}


Measured memory_bytes: 12680
from collections import Counter

n = int(input())
L = list(map(int, input().split()))
L1 = L[::2]
L2 = L[1::2]
c1 = Counter(L1).most_common()
c2 = Counter(L2).most_common()
if len(set(L1)) == len(set(L2)) == 1:
    if L1[0] == L2[0]:
        print(len(L1))
    else:
        print(0)
else:
    if c1[0][0] != c2[0][0]:
        print(n - c1[0][1] - c2[0][1])
    else:
        print(min(n - c1[0][1] - c2[1][1], n - c1[1][1] - c2[0][1]))

Measured memory_bytes: 21084
from math import *


n, x, y = map(int, input().split())
x -= 1
y -= 1

d = y - x + 1
res = [0] * n
for i in range(n):
    for j in range(i + 1, n):
        if j <= x:
            res[j-i] += 1
        elif i >= y:
            res[j-i] += 1
        elif i >= x and j <= y:
            t = min(j - i, d - j + i)
            res[t] += 1
        elif i <= x and  x <= j <= y:
            d1 = x - i
            t = d1 + min(j - x, d - j + x)
            res[t] += 1
        elif y >= i >= x  and j >= y:
            d1 = j - y
            t = d1 + min(y - i, d - y + i)
            res[t] += 1
        else:
            res[j - i - d + 2] += 1
            

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


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

const int MAXN = 15;
const int INF = 0x7f7f7f7f;

int C[MAXN];
int A[MAXN][MAXN];
int L[MAXN];

int main()
{
    int N, M, X;
    cin >> N >> M >> X;
    for(int i = 0; i < N; i++)
    {
        cin >> C[i];
        for(int j = 0; j <  M; ++j)
            cin >> A[i][j];
    }

    int ans = INF;
    for(int s = 0; s < (1<<N); ++s)
    {
        memset(L, 0, sizeof L);
        int cnt = 0;
        for(int i = 0; i < N; ++i)
        {
            if((s >> i) & 1)
            {
                cnt += C[i];
                for(int j = 0; j < M; ++j)
                    L[j] += A[i][j];
            }
        }

        bool ok = true;
        for(int i = 0; i < M; ++i)
        {
            if(L[i] < X)
            {
                ok = false;
                break;
            }
        }

        if(ok)
            ans = min(ans, cnt);
    }

    if(ans == INF)
        ans = -1;

    cout << ans << endl;


    return 0;
}


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

#define reps(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   reps(i,0,n)
#define all(x) (x).begin(),(x).end()
#define INF (1000000001)
#define MOD (1000000007)
#define PI (acos(-1))


int main(){
  int n;
  cin >> n;
  vector<ll> a(n);
  ll sum=0;
  bool zero = 0;
  int mcnt=0;
  rep(i,n){
    cin >> a[i];
    sum += abs(a[i]);
    if(a[i] == 0)zero=1;
    if(a[i]<0)mcnt++;
  }

  if(zero){
    cout << sum << endl;
    return 0;
  }else{
    if(mcnt%2==0){
      cout << sum << endl;
      return 0;
    }else{
      rep(i,n){
        a[i] = abs(a[i]);
      }
      sort(all(a));
      cout << sum-a[0]*2 << endl;
    }
  }
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string x;
  cin >> x;
  if(x[0] - x[1] == 0 && x[2] - x[1] == 0)
    cout << "Yes" << endl;
  else if (x[1] - x[2] == 0 && x[3] - x[2] == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


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

using namespace std;

#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1){std::cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}

#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define endl '\n'

string s;

int main()
{
	IOS;
	cin >> s;
	int c1 = 0, c2 = 0;
	for (int i = 0; i < s.size(); i++) {
		if (i % 2) {
			if (s[i] == '0') c1++;
		}
		else {
			if (s[i] == '1') c1++;
		}
	}
	for (int i = 0; i < s.size(); i++) {
		if (i % 2) {
			if (s[i] == '1') c2++;
		}
		else {
			if (s[i] == '0') c2++;
		}
	}
	cout << min(c1, c2) << endl;
	return 0;
}



Measured memory_bytes: 512
#include <stdio.h>

int main() {
	char teks[5];
	scanf("%s", teks);
	for (int i = 0; i < 3; i++) {
		if (teks[i] == '1')
			putchar('9');
		else if (teks[i] == '9')
			putchar('1');
		else
			putchar(teks[i]);
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 128
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

A, B = get_ints


if A <= 5
  puts '0'
elsif A <= 12
  puts B / 2
else
  puts B
end


Measured memory_bytes: 14212
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    string s;
    cin >> s;
    while(s.size() >= 0){
        string sub = s.substr(0, s.size() - 1);
        if(sub.size() % 2 == 0){
            if(sub.substr(0, sub.size() / 2) == sub.substr(sub.size() / 2, sub.size() / 2)){
                cout << sub.size() << endl;
                return 0;
            }
        }
        s = sub;
    }
    cout << s.size() << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 30;
 
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  map<int,int> x;
  rep(i,n) {
    cin >> a[i];
    x[a[i]]++;
  }
  int ans = 0;
  rep(i,n) {
    if (x[a[i]] == -1) continue;
    if (x[a[i]] < a[i]) ans += x[a[i]];
    else if (x[a[i]] > a[i]) ans += x[a[i]] - a[i];
    x[a[i]] = -1; 
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 8184
import itertools
N=int(input())
L=sorted(list(map(int,input().split())))
S=list(itertools.combinations(L,3))
n=int(N*(N-1)*(N-2)/6)
ans=0

for i in range(n) :
    if S[i][0]==S[i][1] or S[i][1]== S[i][2] :
        continue
    if S[i][0]+S[i][1]>S[i][2] :
        ans+=1

print(ans)

Measured memory_bytes: 20616
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

		public static void main(String[] args){

			Scanner sc = new Scanner(System.in);
			// 整数の入力
			// スペース区切りの整数の入力
			int A = sc.nextInt();
			int B = sc.nextInt();
			
			if((A<=8)&(B<=8)){
       		// 出力
				System.out.println("Yay!");
				return ;
			}else{
	       		// 出力
					System.out.println(":(");
					return ;
			}
		}
}


Measured memory_bytes: 20820
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
	return list(map(int,input().split()))
def m(): #複数文字
	return map(int,input().split())
def onem(): #Nとかの取得
	return int(input())
def s(x): #圧縮
	a = []
	if len(x) == 0:
		return []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa != x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): #listをスペースごとに分ける
	return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
	return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
	ll = 0
	rr = r
	while True:
		mid = (ll+rr)//2

	if rr == mid:
		return ll
	if (ここに評価入れる):
		rr = mid
	else:
		ll = mid+1
"""

n = onem()

a = l()

po = 0
ans = [0 for i in range(n)]
for i in range(n):
	po ^= a[i]
for i in range(n):
	ans[i] = po^a[i]
print(jo(ans))

Measured memory_bytes: 113744
#include<iostream>
#include<set>
#include<stack>
using namespace std;
static int n, k, s;
void dfs(int deep,int sum,int array[],int arrayLength,set<set<int> > *SET)
{
	if (deep > n)return;
	if (arrayLength > k)return;
	if (sum > s)return;

	if (sum == s && arrayLength == k)
	{
		set<int> addSet;
		for (int i = 0; i < arrayLength; i++)
		{
			addSet.insert(array[i]);
		}
		(*SET).insert(addSet);
	}

	if (arrayLength >= k)return;
	if (sum >= s)return;

	for (int i = deep + 1; i <= n; i++)
	{
		if (sum + i > s)continue;
		int newArray[11];
		for (int j = 0; j < arrayLength; j++)
		{
			newArray[j] = array[j];
		}
		newArray[arrayLength] = i;
		dfs(i, sum + i, newArray,arrayLength + 1,SET);
	}

	return;
}
int main()
{
	while (cin >> n >> k >> s && n != 0 || k != 0 || s != 0)
	{
		set<set<int> >SET;
		for (int i = 1; i <= n; i++)
		{
			int array[11];
			array[0] = i;
			dfs(i, i, array,1,&SET);
		}

		cout << SET.size() << endl;
	}
	return 0;
}

Measured memory_bytes: 4256
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<list>
#include<bitset>
#include<stack>
#include<memory>
#include<numeric>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define REP(i, n) for(int i = 0;i < (n);i++)
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
//const int mod=998244353;
const llint inf=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-10;
template <class T,class U>bool chmin(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool chmax(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(const vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(const vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}

int main(void){
	cin.tie(0);ios::sync_with_stdio(false);
	llint n,ans=0;cin>>n;
	for(llint i=1;i<=n;i++){
		if(i%3!=0&&i%5!=0){ans+=i;}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3656
import java.util.Scanner;

class Main {
	public static void trace(int N, int A[]) {
		for (int i = 0; i < N; ++i) {
			if (i > 0) System.out.print(" ");
			System.out.print(A[i]);
		}
		System.out.println();
	}

	public static int selectionSort(int N, int A[]) {
		int minj, ans = 0, tmp, j;
		for (int i = 0; i < N - 1; ++i) {
			minj = i;
			for (j = i; j < N; ++j) {
				if (A[j] < A[minj]) minj = j;
			}
			tmp = A[i];
			A[i] = A[minj];
			A[minj] = tmp;
			if (i != minj) ++ans;
		}
		return ans;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt(), A[] = new int[N], ans;
		for (int i = 0; i < N; ++i) A[i] = sc.nextInt();
		sc.close();
		ans = selectionSort(N, A);
		trace(N, A);
		System.out.println(ans);
	}
}


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

#define inf (1<<30)-1
#define INF (1LL<<62)-1
#define MOD 1000000007LL
#define MP make_pair
#define PB push_back
#define ALL(x) x.begin(),x.end()
#define PI acos(-1)
#define MEM(x,y) memset(x,y,sizeof (x))
#define debug cout<<"A"<<'\n'
#define REP(i,a,b) for (int i=(a); i<=(b); i++)
#define PER(i,a,b) for (int i=(a); i>=(b); i--)
#define REPL(i,a,b) for (LL i=(a); i<=(b); i++)
#define PERL(i,a,b) for (LL i=(a); i>=(b); i--)
#define print(x) cout<<x<<'\n'
#define dprint(a,x) cout<<setprecision(x)<<fixed<<a<<'\n'
#define itrALL(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int>PII;
typedef pair<LL,LL>PLL;
typedef set<int> SI;
typedef set<LL> SL;
typedef set<string> SS;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef map<int,int> MII;
typedef map<LL,LL> MLL;
typedef queue<int> QI;

/* Direction Array */

// int fx[]={1,-1,0,0};
// int fy[]={0,0,1,-1};
// int fx[]={0,0,1,-1,-1,1,-1,1};
// int fy[]={-1,1,0,0,1,1,-1,-1};

template <class T> inline T bigmod(T p,T e,T M)
{
    T ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    } return (T)ret;
}

template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}
template <class T> inline T lcm(T a,T b) {a=abs(a);b=abs(b); return (a/gcd(a,b))*b;}
template <class T, class X> inline bool getbit(T a, X i) { T t=1; return ((a&(t<<i))>0);}
template <class T, class X> inline T setbit(T a, X i) { T t=1;return (a|(t<<i)); }
template <class T, class X> inline T resetbit(T a, X i) { T t=1;return (a&(~(t<<i)));}

inline LL power(LL a, LL b)
{
	LL multiply=1;
	REP(i,1,b)
	{
		multiply*=a;
	}
	return multiply;
}
inline LL ABS(LL a){return (a>=0)?a:-a;}

/*end of header*/
int n,cnt,a,lft;
LL sum;
int main()
{
    //freopen("input_file_name.in","r",stdin);
    //freopen("output_file_name.out","w",stdout);
    cin>>n;
    cnt=0;
    lft=0;
    sum=0;
    REP(i,1,n)
    {
        cin>>a;
        sum+=a;
        if(lft==1)
        {
            if(a>0)a--;
            else cnt++;
        }
        lft=a%2;
    }
    cnt+=lft;
    sum-=cnt;
    sum/=2;
    print(sum);
    return 0;
}



Measured memory_bytes: 256
class UnionFind():
  def __init__(self, size):
    self.table = [-1 for _ in range(size)]
  
  def find(self, x):
    while self.table[x] >= 0:
      x = self.table[x]
    return x
  
  def union(self, x, y):
    s1 = self.find(x)
    s2 = self.find(y)
    if s1 != s2:
      if self.table[s1] != self.table[s2]:
        if self.table[s1] < self.table[s2]:
          self.table[s2] = s1
        else:
          self.table[s1] = s2
      else:
        self.table[s1] += -1
        self.table[s2] = s1
    return 
  
n, m = map(int, input().split())  
edges = [list(map(int, input().split())) for i in range(m)]
ans = 0

for i in range(m):
  uf = UnionFind(n)
  for j in range(m):
    if i != j:
      uf.union(edges[j][0]-1, edges[j][1]-1)
      c = 0
  for j in range(n):
    if j == uf.find(j):
      c += 1
  if c > 1:
    ans += 1
print(ans)      

Measured memory_bytes: 3188
N = int(input())
shop_list = [0 for _ in range(N)]
for i in range(N):
    s,p = map(str, input().split())
    p = int(p)
    shop_list[i] = {"no":i+1,"city":s,"points":p}
shop_list.sort(key = lambda x:(x["city"],-x["points"]))
for i in range(N):
    print(shop_list[i]["no"])

Measured memory_bytes: 3064
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
a = list(map(int, input().split()))
c = 0
ans = -1
for num in a:
    if num==c+1:
        c = num
    else:
        pass
#     print(ans)
if c>0:
    ans = max(ans, c)
if ans>=0:
    print(n-ans)
else:
    print(-1)

Measured memory_bytes: 101080
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

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

  int H, W, N;
  cin>>H>>W>>N;
	
  vector<string> tab(H+1);
  REP(y,H){
	cin >> tab[y];
	tab[y] += '?';
  }
  tab[H] = string(W+1, '?');

  bool ans = false;
  for(int sy=0;sy<H;++sy)
	for(int sx=0;sx<W-1;++sx){
	  vector<string> tmp = tab;
	  swap(tmp[sy][sx], tmp[sy][sx+1]);

	  REP(x,W){
		int ty = H-1;
		for(int y=H-1;y>=0;--y)
		  if(tmp[y][x] != '.'){
			swap(tmp[y][x], tmp[ty][x]);
			--ty;
		  }
	  }


	  bool updated = true;
	  while(updated){
		updated = false;
		vector< vector<bool> > del(H, vector<bool>(W, false));
		for(int y=0;y<H;++y){
		  char prv = 0;
		  int cnt = 0;
		  for(int x=0;x<=W;++x){
			if(prv == tmp[y][x] && prv != '.') ++cnt;
			else{
			  if(cnt >= N)
				for(int tx=x-1;tx>=0 && cnt>0;--tx,--cnt)
				  del[y][tx] = true;
			  prv = tmp[y][x];
			  cnt = 1;
			}
		  }
		}

		for(int x=0;x<W;++x){
		  char prv = 0;
		  int cnt = 0;
		  for(int y=0;y<=H;++y){
			if(prv == tmp[y][x] && prv != '.') ++cnt;
			else{
			  if(cnt >= N)
				for(int ty=y-1;ty>=0 && cnt>0;--ty,--cnt)
				  del[ty][x] = true;
			  prv = tmp[y][x];
			  cnt = 1;
			}
		  }
		}

		REP(y,H) REP(x,W) if(del[y][x]) updated = true, tmp[y][x] = '.';
		REP(x,W){
		  int ty = H-1;
		  for(int y=H-1;y>=0;--y)
			if(tmp[y][x] != '.'){
			  swap(tmp[y][x], tmp[ty][x]);
			  --ty;
			}
		}
	  }

	  bool left = false;
	  REP(y,H) REP(x,W)
		if(tmp[y][x] != '.') left = true;
	  if(!left){
		ans = true;
		break;
	  }
	}

  cout << (ans? "YES": "NO") << endl;
  
  return 0;
}

Measured memory_bytes: 1224
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	int N=in();
	list<int> B;
	REP(i,N){
		B.push_back(in());
	}
	vector<int> A;
	REP(i,N){
		bool del = false;
		int j=N-i;
		for(auto itr=B.rbegin();itr!=B.rend();++itr,--j){
			if(*itr==j){
				A.push_back(*itr);
				B.erase((++itr).base());
				del = true;
				break;
			}
		}
		if(!del){
			out(-1);
			return 0;
		}
	}
	reverse(ALL(A));
	for(auto& x:A) out(x);
	return 0;
}


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

p = list(map(int, input().split()))

p.sort()

num = [i for i in range(-2, 103)]
for i in p:
    num.remove(i)

for i in range(len(num)):
    if x < num[i]:
        if abs(num[i]-x) >= abs(num[i-1]-x):
            print(num[i-1])
            break
        else:
            print(num[i])
            break

Measured memory_bytes: 61900
#include<bits/stdc++.h>
using namespace std; 
  
typedef long long ll; 
typedef pair<ll, ll> pll;
typedef vector<ll> vl; 
typedef vector<vl> vvl; 
 
#define MOD 1000000007  
#define ffor(a, b, c) for (ll(a) = (b); (a) < (c); ++(a))  
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL)); 
#define rep(i, n) ffor(i, 0, n) 
#define ff first 
#define ss second  
#define pb push_back 
#define ALL(v) v.begin(), v.end()  
#define TC(t) while (t--) 
#define N 200005
#define inf 1e18
#define modd 998244353
#define pp(var) cout<<var<<"\n";
#define pm(var1, var2) cout<<var1<<" "<<var2<<"\n"; 


int main(){
    fast;
    ll l,r,i,j,m,k,a,b,c,q,t,x,y,d,n;
    cin>>x;
    double xx = (double)x;
    double zz = (double)101;
    double yy = 1.01;
    n=1;
    while(zz < xx){
        n++; zz *= yy;
        zz = (double)floor(zz);
    }
    pp(n);
}

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

int main() {
    int N;
    cin >> N;
    for (int i = 1; i <= 9; i++) {
        for (int j = 1; j <= 9; j++) {
            if (i*j == N) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}

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

int main(void) {
	using namespace std;
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	int from = max(A, C);
	int to = min(B, D);
	if(to <= from) {
		cout << "0\n";
	} else {
		cout << (to - from) << '\n';
	}
	return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int i = 1, x;
        while(true){
            x = sc.nextInt();
            if(x == 0){
                break;
            }
            System.out.println("Case " + i + ": " + x);
            i++;
        }
    }
}


Measured memory_bytes: 41552
n,k=map(int,input().split())
MOD=10**9+7
ans=0
mi=0
for i in range(k):
    mi+=i
ma=0
for i in range(k):
    ma+=n-i
ans=ma-mi+1
for i in range(k,n+1):
    mi+=i
    ma+=n-i
    ans+=ma-mi+1
    ans%=MOD
print(ans)

Measured memory_bytes: 9188
#include <stdio.h>
int main(void){
    
    
int a,b,c;

scanf( "%d%d%d" , &a,&b,&c);


 if(a<b&&b<c){
   printf("Yes\n");
 }

 
 else{
    printf("No\n");
     
 }
 
 
return 0;
    
}



Measured memory_bytes: 2096
#include<bits/stdc++.h>
#include<vector>
#include<string>
using namespace std;
#define l long long
#define pb push_back
#define mem(a,n) memset(a,n,sizeof(a))
#define find(v,n) find(v.begin(),v.end(),n)
#define sort1(v) sort(v.begin(),v.end())
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mod 998244353
#define reverse(s) reverse(s.begin(),s.end())
//#define pi pair<l,l> 
const double pi=3.141592653589793;
bool isprime(l n)
{
	for(l i=2;i<=n;i++)
	{
		if(n%i==0)
			return false;
	}
	return true;
}
bool fact(l n)
{
	vector<l> v;
	for(l i=2;i*i<=n;i++)
	{
		if(n%i==0)
		{
			if(i%2==1||(n/i)%2==1)
			{
				return true;
			}
		}
	}
	return false;
}
l power(l a,l b)
{
	l ans=1;
	while(b>0)
	{
		if(b&1)
		{
			ans=(ans*a)%mod;
		}
		b>>=1;
		a=(a%mod*a%mod)%mod;
	}
	return ans;
}//prefixsums
void frooty()
{
	l n,m,x;
	cin>>n>>m>>x;
	vector<pair<l,vector<l> > > v;
	for(l i=0;i<n;i++)
	{
		l a;
		cin>>a;
		vector<l> temp;
		for(l j=0;j<m;j++)
		{
			l x;
			cin>>x;
			temp.pb(x);
		}
		v.pb({a,temp});
	}
	l minn=LLONG_MAX;
	for(l i=0;i<m;i++)
	{
		l sum=0;
		for(l j=0;j<n;j++)
		{
			sum+=(v[j].second)[i];
		}
		minn=min(minn,sum);
	}
	if(minn<x)
	{
		cout<<-1<<"\n";
		return ;
	}
	minn=LLONG_MAX;
	l tot=1<<n;
	for(l f=0;f<tot;f++)
	{
		vector<l> level(m,0);
		l cost=0;
		for(l j=0;j<n;j++)
		{
			if((f>>j)&1)
			{
				cost+=v[j].first;
				for(l k=0;k<m;k++)
				{
					level[k]+=(v[j].second)[k];
				}
			}
		}
		l fl=0;
		for(l j=0;j<m;j++)
		{
			if(level[j]<x)
				fl=1;
		}
		//cout<<cost<<"\n";
		if(fl==0)
		{
			minn=min(minn,cost);
		}
	}
	cout<<minn<<"\n";
	
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int q=1;
//	cin>>q;
	while(q--)
	{
		frooty();
	}
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)
#define MOD 1000000007;

using namespace std;
using namespace __gnu_pbds;
//typedef tree<TYPE, null_type, less<TYPE>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
//typedef tree<TYPE, null_type, less_equal<TYPE>, rb_tree_tag, tree_order_statistics_node_update> indexed_multiset;

int n;
string a, b;

int main(){
	//IO("input.txt", "output.txt");
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n >> a >> b;
	for(int i = 0; i < n; i++) cout << a[i] << b[i];
	cout << "\n";
 	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<(n);i++)
#define FORA(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
const int mod=1000000007;
typedef long long ll;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int a,b;
  cin>>a>>b;
  if(a==b)
  {
    FOR(i,b)
    {
      cout<<a;
    }
    cout<<endl;
  }
  else
  {
    if(a<b)
    {
      FOR(i,b)
        cout<<a;
    }
    else
    {
      FOR(i,a)
        cout<<b;
    }
    cout<<endl;
  }
return  0;
}





Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
    int w,h,x,y,r;
    scanf("%d %d %d %d %d",&w,&h,&x,&y,&r);
    if((x-r)>=0 && (x+r)<=w &&(y-r)>=0 && (y+r)<=h)
        puts("Yes");
    else
        puts("No");
    return 0;
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); ++(i))
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod;
constexpr int MAX = 100010;

template<int_fast64_t MOD> struct modint{
    using i64=int_fast64_t;
    i64 a;
    modint(const i64 a_=0): a(a_){
        if(a>MOD) a%=MOD;
        else if(a<0) (a%=MOD)+=MOD;
    }
    modint inv(){
        i64 t=1, n=MOD-2, x=a;
        while(n){
            if(n&1) (t*=x)%=MOD;
            (x*=x)%=MOD;
            n>>=1;
        }
        modint ret(t);
        return ret;
    }
    bool operator==(const modint x) const{return a==x.a;}
    bool operator!=(const modint x) const{return a!=x.a;}
    modint operator+(const modint x) const{
        return modint(*this)+=x;
    }
    modint operator-(const modint x) const{
        return modint(*this)-=x;
    }
    modint operator*(const modint x) const{
        return modint(*this)*=x;
    }
    modint operator/(const modint x) const{
        return modint(*this)/=x;
    }
    modint operator^(const modint x) const{
        return modint(*this)^=x;
    }
    modint &operator+=(const modint &x){
        a+=x.a;
        if(a>=MOD) a-=MOD;
        return *this;
    }
    modint &operator-=(const modint &x){
        a-=x.a;
        if(a<0) a+=MOD;
        return *this;
    }
    modint &operator*=(const modint &x){
        (a*=x.a)%=MOD;
        return *this;
    }
    modint &operator/=(modint x){
        (a*=x.inv().a)%=MOD;
        return *this;
    }
    modint &operator^=(lint n){
        i64 ret=1;
        while(n){
            if(n&1) (ret*=a)%=MOD;
            (a*=a)%=MOD;
            n>>=1;
        }
        a=ret;
        return *this;
    }
    modint operator-() const{
        return modint(0)-*this;
    }
    modint &operator++(){
        return *this+=1;
    }
    modint &operator--(){
        return *this-=1;
    }
};

using mint=modint<1000000007>;

vector<mint> fact;
vector<mint> revfact;

void setfact(int n){
    fact.resize(n+1); revfact.resize(n+1);
    fact[0] = 1;
    rep(i, n) fact[i+1] = fact[i] * mint(i+1);

    revfact[n] = fact[n].inv();
    for(int i=n-1; i>=0; i--) revfact[i] = revfact[i+1] * mint(i+1);
}

mint getC(int n, int r){
    if(n<r) return 0;
    return fact[n] * revfact[r] * revfact[n-r];
}

int main(){
    int n;
    scanf("%d", &n);
    int a[n];
    rep(i, n) scanf("%d", &a[i]);
    int cnt[3];
    rep(i, 3) cnt[i]=0;
    mint ans=1;
    rep(i, n){
        mint tmp=0;
        rep(j, 3)if(cnt[j]==a[i]) ++tmp;
        ans*=tmp;
        rep(j, 3)if(cnt[j]==a[i]){
            ++cnt[j];
            break;
        }
    }
    printf("%lld\n", ans.a);
}

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

using namespace std;

typedef long long ll;

ll MOD = 1e9 + 7;

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

	ll n;
	cin >> n;

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

	if(a[0] != 0){
		cout << 0 << endl;
		return 0;
	}

	vector<int> v(101010, 0);
	// vector<bool> pd(101010, false);

	ll ans = 3LL;
	v[0] = 2;
	v[1] = 1;

	for(int i = 1; i < n; i++){
		int x = a[i];
		if(x == 0){
			if(v[x] == 0){
				cout << 0 << endl;
				return 0;
			}

			ans *= v[x];
			ans %= MOD;
			v[x]--;
			v[x+1]++;
		}else{
			// if(!pd[x]){
			// 	pd[x] = true;
			// 	v[x] = 3 - v[x-1];
			// }

			if(v[x] == 0){
				cout << 0 << endl;
				return 0;
			}

			ans *= v[x];
			ans %= MOD;
			v[x]--;
			v[x+1]++;
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 1408
// D - Prediction and Restriction
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

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

	int ans = 0;
	rp(i, 0, T.size())
		if(T[i] == 'r') ans += P;//win:r->p
		else if(T[i] == 's') ans += R;//win:s->r
		else ans += S;//win:p->s

	rp(i, K, T.size()){
		if(T[i-K] == T[i]){//fore
			if(T[i] == 'r') ans -= P;//win:r->p -> draw: -p
			else if(T[i] == 's') ans -= R;//win:s->r -> draw: -r
			else ans -= S;//win:p->s -> draw: -s

			if(i+K>=T.size()) continue;

			if(T[i] == T[i+K])//back
				if(T[i] == 'r') T[i] = 's';//lose:r->s
				else if(T[i] == 's') T[i] = 'p';//lose:s->p
				else T[i] = 'r';//lose:p->r
		}
	}
	cout<< ans <<endl;
}

Measured memory_bytes: 512
#pragma region head
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define test(s) \
  if (!(s))     \
    cout << "Line " << __LINE__ << ": [" << #s << "] is false" << endl;
#define int long long
typedef long long ll;
#define double long double
typedef double ld;
const int INF = 1001001001001001001ll;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;
const double PI = acos(-1.0);

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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

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

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
#pragma endregion

signed main() {
  int H, W, h, w;
  cin >> H >> W >> h >> w;

  if (H % h + W % w == 0) {
    cout << "No\n";
    return 0;
  }

  bool T = false;
  if (W % w == 0) {
    T = true;
    swap(H, W), swap(h, w);
  }

  vector<int> s(W + 1);
  s[W] = 1;
  for (int i = 0; i + w <= W; i += w) {
    s[i + w] = s[i] - 1;
  }

  for (int i = W; i - w >= 0; i -= w) {
    s[i - w] = s[i] + 1;
  }

  for (int i = 0; i + w <= W; i++) {
    if (s[i + w] >= s[i])
      s[i + w] = s[i] - 1;
  }

  vector<int> a(W);
  rep(i, W) {
    a[i] = s[i + 1] - s[i];
  }

  vector<vector<int>> ans(H, vector<int>(W));
  rep(i, H) {
    rep(j, W) {
      ans[i][j] = a[j];
    }
  }

  if (T) {
    auto ans_cp = ans;
    ans = vector<vector<int>>(W, vector<int>(H));
    rep(i, H) {
      rep(j, W) {
        ans[j][i] = ans_cp[i][j];
      }
    }
  }

  cout << "Yes\n";
  cout << ans << endl;
}

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

using namespace std;
typedef long long int ll;
ll N1097 = 1000000007LL;

int main(){
    string S;
    cin >> S;
    map<char, int> c;
    for(int i=0;i<4;i++){
        c[S[i]] += 1;
    }
    for(auto itr=c.begin();itr!=c.end();itr++){
        if(itr->second != 2){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
 int a,b,d,r;
 double f;
 scanf("%d %d",&a,&b);
 d=a/b;
 r=a%b;
 f=(double)a/b;
 printf("%d %d %2f\n",d,r,f);
 return 0;
}

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

int N,arr[100000];
int main(){
  int n;
  cin >> N;
  for (int i=0;i<N;i++){
    cin >> arr[i];
  }
  
  sort(arr,arr+N);
  n = N/2;
  //depends on the difference between median-1,median+1
  cout << arr[n]-arr[n-1];
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
using namespace std;
int main(void){
    long long int a,b,c;
    cin >> a >> b;
    c = a*b;
    
    if(a==1||b==1){
        cout << "1" << endl;
    }
    else{
    if(c%2 == 0){
        cout << c/2 << endl;
    }
    else if(c%2 ==1){
        cout << (c+1)/2 << endl;
    }
    }
}

Measured memory_bytes: 256
N = int(input())
a = []
astr = input().split()
for i in astr:
    a.append(int(i))

sorteda = sorted(a)

Alice, Bob = 0, 0
for i in range(len(a)):
    if i%2 == 0:
        Alice += sorteda[-(i+1)]
    else:
        Bob += sorteda[-(i+1)]

print(Alice-Bob)

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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H, W, K;
    cin >> H >> W >> K;
    K--;
    ll MOD = 1e9 + 7;
    vector<vector<ll>> dp(H + 1, vector<ll>(W));
    vector<ll> toorisuuByWide(W); //各幅で可能な線の引き方の通り数。フィボナッチ数列になるらしい
    toorisuuByWide.at(0) = 1;
    for(int i = 1; i < W; i++)
    {
        for(int j = 0; j < 1 << i; j++)
        {
            bool isOK = true;
            for(int k = 0; k < i - 1; k++)
            {
                if((j & (1 << k)) && (j & (1 << (k + 1))))
                {
                    isOK = false;
                }
            }
            if(isOK)
            {
                toorisuuByWide.at(i)++;
            }
        }
    }
    dp.at(0).at(0) = 1;
    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            if (j > 0)
            {
                dp.at(i + 1).at(j) += dp.at(i).at(j - 1) * toorisuuByWide.at(max(0, j - 2)) * toorisuuByWide.at(max(0, W - j - 2));
            }
            dp.at(i + 1).at(j) += dp.at(i).at(j) * toorisuuByWide.at(max(0, j - 1)) * toorisuuByWide.at(max(0, W - j - 2));
            if (j < W - 1)
            {
                dp.at(i + 1).at(j) += dp.at(i).at(j + 1) * toorisuuByWide.at(max(0, j - 1)) * toorisuuByWide.at(max(0, W - j - 3));
            }
            dp.at(i + 1).at(j) %= MOD;
        }
    }
    cout << dp.at(H).at(K) << endl;
    return 0;
}


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

using namespace std; 

int main()
{
    int t; 
    cin >> t; 
    if( t >= 400 && t <= 599) cout << 8 << endl; 
    if( t >= 600 && t <= 799) cout << 7 << endl; 
    if( t >= 800 && t <= 999) cout << 6 << endl; 
    if( t >= 1000 && t <= 1199) cout << 5 << endl; 
    if( t >= 1200 && t <= 1399) cout << 4 << endl; 
    if( t >= 1400 && t <= 1599) cout << 3 << endl; 
    if( t >= 1600 && t <= 1799) cout << 2 << endl; 
    if( t >= 1800 && t <= 1999) cout << 1 << endl; 

    return 0; 

}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define int long long
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll INF = 1LL << 62;
const int inf = 1 << 30;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
string in;
int n;
int res;
void dfs(int i, vi tbl={}){
    if(i == n){
        for(auto& e : tbl) res += e;
        return;
    }
    int cur = 0;
    int sum = 0;
    for(; i < n; i++){
        cur += (in[i] - '0');
        vi ntbl = tbl; ntbl.emplace_back(cur);
        dfs(i + 1, ntbl);
        cur *= 10;
    }
}

signed main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    cin >> in;
    n = in.size();
    dfs(0);
    cout << res << endl;

    return 0;
}


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

int main() {
	int h1,m1,h2,m2,k,m,h;
	cin>>h1>>m1>>h2>>m2>>k;
	m=h1*60+m1;
	h=h2*60+m2;
	h=h-k;
	cout<<(h-m)<<endl;
	
	return 0;
}


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

using namespace std;
typedef  long long int ll;
#define rep(i, n) for (int i = 0; i < (n); i++)



int main () {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    cout << max({a+b, a-b, a*b}) << endl;
    return 0;
 }


Measured memory_bytes: 256
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . ___
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         佛祖保佑       永无BUG
*/
//use readint!
#include<map>
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<set>
#include<cmath>
#include<stdio.h>
#include<fstream>
#include<assert.h>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<string.h>
#define mp make_pair
#define ll long long
using namespace std;
const int INF=1e9;
inline int pt(int a[],int l,int r){
	int p,i,j;
	p=a[l];
	i=l;
	j=r+1;
	for(;;){
		while(a[++i]<p) if(i>=r) break;
		while(a[--j]>p) if(j<=l) break;
		if(i>=j) break;
		else swap(a[i],a[j]);
	}
	if(j==l) return j;
	swap(a[l],a[j]);
	return j;
}
inline void q_sort(int a[],int l,int r){
	int q;
	if(r>l){
		q=pt(a,l,r);
		q_sort(a,l,q-1);
		q_sort(a,q+1,r);
	}
}
inline int readint(){
    int x=0;
    int f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9') ch=getchar();
	if(ch=='-'){
		f=-1;
		ch=getchar();
	}
    while(ch>='0'&&ch<='9'){
        x=x*10+ch-'0';
        ch=getchar();
    }
    return x*f;
}
int main(){
	int a,b;
	cin>>a>>b;
	if(a>b){
		cout<<a-1<<endl;
	}else cout<<a<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskGA solver = new TaskGA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskGA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            char[] ar = in.next().toCharArray();

            int N, S, E, W;
            N = S = E = W = 0;
            for (char c : ar) {
                if (c == 'N') {
                    N++;
                } else if (c == 'S') {
                    S++;
                } else if (c == 'E') {
                    E++;
                } else if (c == 'W') {
                    W++;
                }
            }

            if (N == 0 && S > 0) {
                out.println("No");
            } else if (S == 0 && N > 0) {
                out.println("No");
            } else if (E == 0 && W > 0) {
                out.println("No");
            } else if (W == 0 && E > 0) {
                out.println("No");
            } else {
                out.println("Yes");
            }
        }

    }
}


Measured memory_bytes: 10060