akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
	static Scanner  sc = new Scanner(System.in);
	static int h;
	static int w;
	
	public static void main(String[] args){
		h=sc.nextInt();
		w=sc.nextInt();
		int area = h*w;
		int leng = h*2+w*2;
		System.out.println(area+" "+leng);
	}
	
}

Measured memory_bytes: 17160
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define ll unsigned long long
#define vi vector<int>
#define pii pair<int,int>
#define F first
#define S second
#define pb push_back
#define forn(b) for(int i = 0; i < b; i++)
#define rforn(b) for(int i = b - 1 ;i >= 0; i--)
#define It(m) for(auto it = m.begin(); it != m.end(); it++)
#define N 500500
#define PI 3.14159265358979323846264338327950L
#define speed ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);
    
const ll mod = (ll)1e9 + 7;
    
int main() {
	speed;
	int n; cin >> n;
    vi v(n);
    vi ans(n);
    stack<pii> two;
    stack<pii> four;
    stack<pii> prime;
    bool t = false;
    for(int i = 0; i < n; i++) {
        cin >> v[i];
        if(v[i] % 4 == 0) {
            four.push({v[i], i});
        }
        else if(v[i] % 2 == 0) {
            two.push({v[i], i});
            t = true;
        }
        else {
            prime.push({v[i], i});
        }
    }
    int k = 0;
    while(!two.empty()) {
        int value = two.top().first;
        int key = two.top().second;
        ans[k] = value;
        k++;
        two.pop();
    }
    if(t) {
        if(!four.empty()) {
            int value = four.top().first;
            int key = four.top().second;
            ans[k] = value;
            k++;
            four.pop();
        }
    }
    while(true) {
        bool out = true;
        if(!prime.empty()) {
            int value = prime.top().first;
            int key = prime.top().second;
            ans[k] = value;
            k++;
            prime.pop();
            out = false;
        }
        if(!four.empty()) {
            int value = four.top().first;
            int key = four.top().second;
            ans[k] = value;
            k++;
            four.pop();
            out = false;
        }
        if(out) break;
    }
    bool yes = true;
    for(int i = 1; i < n; i++) {
        if(ans[i] * ans[i - 1] % 4 != 0) {
            yes = false;
            break;
        }
    }
    if(yes) {
        cout << "Yes";
    }
    else {
        cout << "No";
    }
}


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

int main() {
    int N;
    cin >> N;
    string s[N];
    int t[N];
    for (int i=0;i <N; i++) cin >> s[i] >> t[i];
    string x;
    cin >> x;
    int total = 0;
    for (int j=0; j<N; j++) {
        if (s[j] == x) {
            for (int k=j+1; k<N; k++) {
                total += t[k];
            }
            break;
        }
    }
    cout << total << endl;
}

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

using namespace std;

int main() {
  char s[100000];
  cin >> s;
  char prev = s[0];
  int ans = 0;
  for (int i = 1; s[i]; i++) {
    if (prev != s[i]) {
      ans++;
      prev = s[i];
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif


using namespace std;
using ll = long long;

const ll MOD = 1000000007;
const ll INF = 1e18;
const double pi = acos(-1);
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1,1,0,-1,-1,-1,0,1};
const int dy8[8] = {0,1,1,1,0,-1,-1,-1};


#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()


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; }

int pow2k(int n,int k){
    int pow2 = 0;
    while(pow(2,pow2)*n < k){
        pow2++;
    }
    return pow2;
}

void solve(){
    
    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,k; cin >> n >> k;
    
    double ans = 0.0;
    for (int i = 1; i <= n; i++) {
        ans += pow(0.5,pow2k(i,k));
    }
    cout << setprecision(10) << ans/n << endl;
    
}



signed main() {
    solve();
    return 0;
}



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

using namespace std;

using ll = long long;

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int n; cin >> n;
    vector<int> w(n); for (int& x : w) cin >> x;
    vector<int> pre(n + 1);
    pre[0] = 0;
    for (int i = 1; i <= n; i++) {
        pre[i] = pre[i - 1] + w[i - 1];
    }
    int ans = INT_MAX;
    for (int i = 1; i < n; i++) {
        ans = min(ans, abs(pre[n] - 2 * pre[i]));
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
#define All(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
using namespace std;
typedef long long llint;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = 999999999;

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

    string s;
    char c = '0', cb = '0';
    while(cin >> c){
        if(c != cb) s += c;
        cb = c;
    }

    if(c != cb) s += c;
    cout << s.size()-1 << "\n";
    
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep1(i, n) for (ll i = 1; i <= (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
#define to_s to_string
#define len(v) (ll)v.size()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define print(x) cout << (x) << '\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;
ll MOD = 1e9 + 7;
ll devc(ll x, ll y) { return 1 + (x - 1) / y; }

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

    ll N;
    cin >> N;
    vector<ll> A(N), B(N);
    rep(i, N) cin >> A[i];
    sort(ALL(A));
    B = A;
    UNIQUE(B);
    if(len(A) == len(B)) print("YES");
    else print("NO");

    return 0;
}

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

namespace ABC094B
{
    class Program
    {
        static void Main(string[] args)
        {
            var NMX = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var Ai = Console.ReadLine().Split().Select(int.Parse).ToArray();

            int ans0 = 0;
            int ansN = 0;
            foreach(int A in Ai)
            {
                if (A < NMX[2]) ans0++;
                else ansN++;
            }

            int ans = Math.Min(ans0, ansN);
            Console.WriteLine(ans);
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11348
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;

class Solver {
    Scanner sc = new Scanner();
   
    public void Solve() {
        var N = sc.nextInt();
        var M = sc.nextInt();
        var X = sc.ArrayInt(M).OrderBy(i => i).ToArray();

        var dist = new int[M - 1];
        for (int i = 0; i < M-1; i++) {
            dist[i] = Math.Abs(X[i] - X[i+1]);
        }
        WriteLine(dist.OrderByDescending(i => i).Skip(N - 1).Sum());
    }
}


class Scanner {
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble() {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0) {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Program {
    static void Main(string[] args) {
        Solver s = new Solver();
        s.Solve();
    }
}


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

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


#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    ll n;
    cin>>n;
    vector<ll> a(n);
    for (int i = 0; i < n-1; i++)
    {
        int k;
        cin>>k;
        k--;
        a[k]++;
    }
    for (int i = 0; i < n; i++)
    {
        cout<<a[i]<<endl;
    }
    
    
    return 0;
}

Measured memory_bytes: 4844
if __name__ == "__main__":
    input_str = input()
    splited = input_str.split(' ')
    A = int(splited[0])
    B = int(splited[1])
    C = int(splited[2])

    nokori = C - (A - B)
    if nokori >= 0:
        print(nokori)
    else:
        print('0')


Measured memory_bytes: 3060
#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;

void solve()
{
	ll n;
	cin>>n;
	cout<<(n+n*n+n*n*n)<<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: 3644
#include<bits/stdc++.h>
using namespace std;
string s,s1,s2;
int ans = 1;
int main()
{
	cin >> s;
	int len = s.length();
	s1 +=s[0];
	for(int i = 0;i < len;i++){
		for(int j = i+1;j<len;j++){
			s2 += s[j];
			if(s1!=s2){
				s1 = s2;
				s2.clear();
				i = j;
				ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
const int maxn = 100100;
long long A[maxn], B[maxn];
int M(){
    long long n, k;
    if(!(cin >> n >> k)) return 0;
    for(int e = 0; e < n; e++){
        scanf("%lld %lld", A + e, B + e);
    }
    long long best = 0, sum = 0;
    for(int e = 0; e < n; e++)
        if((A[e]|k) == k) sum += B[e];
    best = max(best, sum);
    for(int e = 0; e < 30; e++){
        long long tmp = k;
        sum = 0;
        if(tmp & (1<<e)){
            tmp ^= (1<<e);
            if(e > 0)
                tmp |= ((1<<(e)) - 1);
            for(int f = 0; f < n; f++)
                if((A[f] | tmp) == tmp) sum += B[f];
        }
        best = max(best, sum);
    }
    printf("%lld\n", best);
    return 1;
}
int main(){
    while(M());
    return 0;
}


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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(ll i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 110

int imos[MAX_N] = {};

signed main()
{
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    REP(i, MAX_N) {
        if(i >= A && i < B) { imos[i]++; }
        if(i >= C && i < D) { imos[i]++; }
    }
    int ans = 0;
    REP(i, MAX_N) {
        if(imos[i] == 2) { ans++; }
    }
    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 256
#include <string>
#include <vector>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <map>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
const int MOD=1e9+7;
const int INF=1e10;

signed main(){
  int n;
  cin>>n;
  vector<int> c(n);
  REP(i,n)cin>>c[i];
  int q;
  cin>>q;
  vector<int> val(n);
  int ans=0;
  bool f=true;
  REP(i,q){
    int t,x,d;
    cin>>t>>x>>d;
    x--;
    if(t==1){
      val[x]+=d;
      if(val[x]>c[x]){
        if(f){
          ans=x+1;
          f=false;
        }
      }
    }else if(t==2){
      val[x]-=d;
      if(val[x]<0){
        if(f){
          ans=x+1;
          f=false;
        }
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 3108
import math

A, B = map(int, input().split())

def gcd(a, b):
    if b == 0:
        return(a)
    else:
        return(gcd(b, a % b))

def prime_factorize(n):
    res = []
    tmp = n

    for i in range(2, int(math.sqrt(n))+1):
        if tmp % i == 0:
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            res.append([i, cnt])

    if tmp != 1:
        res.append([tmp, 1])

    if len(res) == 0 and n != 1:
        res.append([n, 1])

    return(res)

c = gcd(A, B)
#print(c)
div = prime_factorize(c)
#print(div)
ans = len(div) + 1
print(ans)



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

int main(){

    int a,b;
    cin>>a>>b;
    if(a==1) a=14;
    if(b==1) b=14;

    if(a>b) cout<<"Alice"<<endl;
    else if(a==b) cout<<"Draw"<<endl;
    else cout<<"Bob"<<endl;



    return 0;
}

Measured memory_bytes: 256
//#define LOCAL

#include <fstream>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <cstring>
#include <climits>
#include <set>

//#define int long long
//typedef long long ll;
using ll = long long;
using R = double;

//#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)

#define MOD 1000000007

using namespace std;

typedef vector<int> V;
typedef vector<V> VV;



signed main()
{
    string s[3];

    REP(i,3) cin >> s[i];
    REP(i,3) cout << char(s[i][0] + 'A' - 'a');
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int Max = 1000000;
int N;
int A, B, C, D;
string S;
bool possi(int a, int b){
	bool res = true;
	for(int i=a+1;i<b;i++){
		if(S[i]==S[i+1] && S[i+1]=='#') res = false; 
	}
	return res;
}

int main(){
	cin >> N;
	cin >> A >> B >> C >> D; 	
	cin >> S;

	if(C==D){
		cout << "No" <<endl;
		return 0;
	}
	if(C<D){
		if(possi(B-1,D-1) && possi(A-1, C-1)){
			cout << "Yes" <<endl;
		}else{
			cout << "No" <<endl;
		}
		return 0;
	}

	if(!possi(B-1, D-1)){
		//cout << 1 << endl;
		cout << "No" <<endl;
		return 0;
	}
	if(!possi(A-1, C-1)){
		//cout << 2 << endl;
		cout << "No" <<endl;
		return 0;
	}

	for(int i=B-1;i<D;i++){
		if(S[i]=='.' && S[i-1]=='.' && S[i+1]=='.'){
			//cout << 3 << endl;
			cout << "Yes" <<endl;
			return 0;
		}
	}
	cout << "No" <<endl;
    
  	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main () {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if(abs(b - a) <= d && abs(c - b) <= d || abs(c - a) <= d)cout << "Yes" << endl;
  else cout << "No" << endl;;
  return 0;
}


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

long f(char *s, int d, int a){
	long sum=0;
	long now=s[0]-'0';
	int i;
	for(i=1; i<d; i++){
		if((a&(1<<(i-1)))!=0){
			sum+=now;
			now=s[i]-'0';
		}else{
			now=now*10+s[i]-'0';
		}
	}
	sum+=now;
	return sum;
}

int main(void){
	char c, n=0, s[11];
	while((c=getchar())!=10) s[n++]=c;
	s[n]=0;
	int i, l=1<<(n-1);
	long sum=0;
	for(i=0; i<l; i++){
		sum+=f(s, n, i);
	}
	printf("%ld\n", sum);
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#define nmax_def 110000
using namespace std;
typedef long long ll;

int main() {
	int i, j;
	int N, A, B;
	cin >> N >> A >> B;
	int ans = min(N * A, B);
	cout << ans << endl;

	return 0;
}

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

int main() {
    ll m,k;
    std::cin >> m>>k;
    
    if(m==0){
        if(k==0){
            std::cout << "0 0" << std::endl;
        }else{
            std::cout << -1 << std::endl;
        }
    }else if(m==1){
        if(k==0){
            std::cout << "0 1 1 0" << std::endl;
        }else{
            std::cout << -1 << std::endl;
        }
    }else{
        if(k<pow(2,m)){
            for (int i = 0; i < pow(2,m); i++) {
                if(i==k)continue;
                std::cout << i<<" ";
            }
            std::cout << k<<" ";
            for (int i = pow(2,m)-1; i>=0; i--) {
                if(i==k)continue;
                std::cout << i<<" ";
            }
            std::cout << k << std::endl;
        }else{
            std::cout << -1 << std::endl;
        }
    }
}


Measured memory_bytes: 1792
import numpy as np
from numpy import linalg as LA

N = int(input())
li = [[1,N]]

for i in range(2,int(np.sqrt(N))+1):
    if N%i == 0:
        li.append([i,N//i])

ans = 10**12
for i in li:
    x,y = i
    tmp = LA.norm([x-1,y-1],1)
    if ans > tmp:
        ans = tmp

print(ans)


Measured memory_bytes: 14412
#include<iostream>

#define MAX 8

typedef struct{
	int root[MAX-1];
	int mem_of_root;
	bool use;
}POINT;
using namespace std;

void process(POINT point[], int n, int pos, int *ans);
bool check(POINT point[], int n);
int main(){
	POINT point[MAX];
	int i;
	int n,m;
	int a,b;
	int pos;
	int ans = 0;
	for(i=0; i<MAX;i++){
		point[i].mem_of_root = 0;
		point[i].use = false;
	}
	cin >> n >> m;
	
	for(i=0;i<m;i++){
		cin >> a >> b;
		point[a-1].root[point[a-1].mem_of_root++] = b - 1;
		point[b-1].root[point[b-1].mem_of_root++] = a - 1;
	}
 	process(point,n,0,&ans);
 	cout << ans << endl;
}
void process(POINT point[], int n, int pos, int *ans){
	int i;
	if( point[pos].use == true )
		return;
	point[pos].use = true;
	if( check(point,n) ){
		*ans = *ans + 1;
		point[pos].use = false;
		return;
	}
	for(i=0;i<point[pos].mem_of_root;i++){
		process(point,n,point[pos].root[i],ans);
	}
	point[pos].use = false;
	return;
}
bool check(POINT point[], int n){
	int i;
	
	for(i=0; i<n;i++){
		if( point[i].use == false)
			return false;
	}
	
	return true;
}

Measured memory_bytes: 256
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    n = [int(c) for c in "0" + input()]
    I = len(n)
    ans = 0
    for i in range(I-1, -1, -1):
        b = n[i]
        if b < 5:
            ans += b
        elif b == 5:
            c = n[i-1]
            ans += b
            if c >= 5:
                n[i-1] += 1
        else:
            ans += 10 - b
            n[i-1] += 1
    print(ans)

if __name__ == "__main__":
    resolve()


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

using namespace std;
using ll = long long;
using ld = long double;
using Vec = vector<int>;
using Graph = vector<vector<int>>;
int main(){

ll n;
cin>>n;
int count=1;
while(n>1){
    n/=2;
    count++;
}
ll ans=0;
ll x=1;
for(int i=0;i<count;i++){
    ans+=x;
    x*=2;
}
cout<<ans<<endl;

}

Measured memory_bytes: 3636
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, n)       for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, s, t)   for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#ifndef DBG
#define trace(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> make_v(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto make_v(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initValue, args...))>(sz, make_v<T>(initValue, args...));
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &out, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) out << e << delim[&e == &vec.back()];
    return out;
}
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);

    int N, K;
    read(N, K);

    vector<int> a(N);
    rep(i, N) read(a[i]);
    sort(all(a));

    const auto isNeed = [&](int idx) -> bool {
        auto dp = make_v<int>(false, N+1, K+5);
        dp[0][0] = true;

        rep(i, N) {
            reps(s, 0, K) {
                dp[i + 1][s] |= dp[i][s];
                if (i != idx && s + a[i] <= K) dp[i + 1][s + a[i]] |= dp[i][s];
            }
        }

        reps(s, max<i64>(0, K - a[idx]), K - 1) {
            if (dp[N][s]) return true;
        }
        return false;
    };

    int noNeed = -1;
    int need = N;
    while (need - noNeed > 1) {
        const int mid = (noNeed + need) / 2;
        if (isNeed(mid)) need = mid;
        else noNeed = mid;
    }

    print(noNeed + 1);

    return 0;
}


Measured memory_bytes: 98304
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <math.h>
#include <vector>
#include <queue>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
using namespace std;
#define rep(I,N) for(int I = 0; I < (int)(N); I++)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 30)
typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;

int main(void){
	pq que;
	rep(i, 10){
		int a;
		cin >> a;
		que.push(a);
	}
	rep(i, 3){
		int x = que.top();
		que.pop();
		cout << x << endl;
	}
	return 0;	
}

Measured memory_bytes: 1212
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<cmath>
#include<math.h>
#include<algorithm>
#include<string.h>
#include <iomanip>
#include <sstream>
using namespace std;

int main() {
  int N, i;
  int ans = 0;

  cin >> N >> i;
  ans = N - i +1;

  cout << ans << endl;

}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    static int[] memo = new int[10];
    static int[][] c = new int[10][10];
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int H = scan.nextInt();
        int W = scan.nextInt();

        for (int i = 0; i < 10; i++) {
            for (int j = 0; j < 10; j++) {
                c[i][j] = scan.nextInt();
            }
        }

        for (int i = 0; i < 10; i++) {
            memo[i] = djikstra(i);
        }
        int sum = 0;
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                int num = scan.nextInt();
                if(num == -1 || num == 1) {
                    continue;
                }
                sum += memo[num];
            }
        }
        System.out.println(sum);
    }

    static int djikstra(int from) {
        if (from == 1) {
            return 0;
        }
        PriorityQueue<Path> deque = new PriorityQueue<>((x, y) -> x.score - y.score);
        Set<Integer> itta = new HashSet<>();
        itta.add(from);
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < 10; i++) {
            if(min == from) {
                continue;
            }
            deque.add(new Path(i, c[from][i]));
        }
        while(!itta.contains(1)) {
            Path next = deque.poll();
            if(next.currentnode == 1) {
                return next.score;
            }
            itta.add(next.currentnode);
            for (int i = 0; i < 10; i++) {
                if(itta.contains(i)) {
                    continue;
                }
                deque.add(new Path(i, next.score + c[next.currentnode][i]));
            }
        }
        throw new RuntimeException();
    }

    static class Path {
        int score = 0;
        int currentnode;
        public Path(int currentnode, int score) {
            this.currentnode = currentnode;
            this.score = score;
        }
    }
}


Measured memory_bytes: 48128
#include <bits/stdc++.h>
#define SIZE 10
#define PI 3.141592653589793

using namespace std;
typedef long long ll;

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

	ll N;
	ll mod;
	ll div;
	int i,j;
	// 0-25
	char abc[]="abcdefghijklmnopqrstuvwxyz";
	ll counter=0;
	vector<int> given;
	vector<char> answer;

	cin >> N;

	do{
		// 0-25
		mod=(N-1)%26;
		answer.push_back((mod));

		N=(N-1)/26;
		counter++;
	}while(N>0);

	for(i=counter-1;i>=0;i--)
		cout << abc[answer[i]];
	cout << endl;


	return 0;
}



Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int mod = 1000000007;

int main() {
  ll n, m, k;
  cin >> n >> m >> k;
  vector<ll> a(n), b(m);
  rep(i, n) cin >> a[i];
  rep(i, m) cin >> b[i];
  vector<ll> suma(n + 1), sumb(m + 1);
  rep(i, n) suma[i + 1] = suma[i] + a[i];
  rep(i, m) sumb[i + 1] = sumb[i] + b[i];


  ll ans = 0;
  for(ll i = 0; i < n + 1; ++i) {
    ll remain = k - suma[i];
    if (remain < 0) continue;
    // cout << i << endl;
    int it = upper_bound(sumb.begin(), sumb.end(), remain) - sumb.begin();
    // cout << it << endl;
    --it;
    if (it <= 0) it = 0;
    chmax(ans, i + it);

  }

  cout << ans << endl;
}

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

using namespace std;

int main()
{
  string S, tmp;
  int min = 753, dif;
  cin >> S;

  for (int i = 0; i < S.length() - 2; i++)
  {
    tmp = S.substr(i, 3);
    dif = abs(753 - stoi(tmp));
    if (min >= dif)
    {
      min = dif;
    }
  }
  cout << min << endl;
}

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

namespace Contest
{
	class Program
	{
		static void Main(string[] args)
		{
			var O = Console.ReadLine();
			var E = Console.ReadLine();
			for (int i = 0; i < E.Length; i++)
			{
				Console.Write($"{O[i]}{E[i]}");
			}
			if (O.Length > E.Length)
			{
				Console.Write(O[O.Length - 1]);
			}
			Console.WriteLine();
		}
	}
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
 
/*  struct fruit {
  int name;  // 名前
  int price; // 価格
};
*/
int main() {
    int a,p;
    std::cin >> a>>p;
    std::cout << (3*a+p)/2 << std::endl;
    /*int i,j,k=0;
    int n,m;
    int b,c;
    int flag=0;
    std::cin >> n>> m;
    
    vector<int> a(n);
    vector<fruit> fruits(m);
    for (i=0;i<n;i++){
        std::cin >> a.at(i);
    }
    sort(a.begin(), a.end());
    
    for (i=0;i<m;i++){
        std::cin >> fruits.at(i).name>>fruits.at(i).price;
    }
    sort(fruits.begin(), fruits.end(), 
    [](const fruit& x, const fruit& y) { return x.price > y.price;});
    
    for(i=0;i<m;i++){
        if (flag==-1)break;
        b=fruits.at(i).name;
        c=fruits.at(i).price;
        for(j=0;j<b;j++){
            if(k==n){flag=-1;break;}
            else if(a[k]<c){a[k]=c;k++;}
            else {flag=-1;break;}
        }
    }
    
    
    long long int ans=0;
     for (i=0;i<n;i++){
        ans+=a.at(i);
    }
    std::cout << ans << std::endl;
*/
}


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

int main(void){
  char s[8];
  char t[8];
  int count = 0;
  scanf("%s", s);
  scanf("%s", t);
  if(s[0] == t[0]) count++;
  if(s[1] == t[1]) count++;
  if(s[2] == t[2]) count++;
  printf("%d", count);
  return 0;
}

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

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define DUMPP(xs) for (auto x:xs) cout<<'('<<x.first<<','<<x.second<<')'<<' ';cout<<endl
#define FOR(i,a,b) for (ll i=(ll)(a);i<(ll)(b);++i)
#define OUT(x) cout<<x<<endl
#define OUTP(x) cout<<'('<<x.first<<','<<x.second<<')'<<endl;
#define REP(i,n) FOR(i,0,n)
#define YES(cond) cond ? OUT("YES") : OUT("NO")
#define Yes(cond) cond ? OUT("Yes") : OUT("No")

template<class T> T gcd(const T x,const T y){if(!y){return x;}return gcd(y,x%y);}
template<class T> T lcm(const T x,const T y){return x/gcd(x,y)*y;};
template<class T> T modpow(T x,T n,const T mod) {
  T res=1;while(n>0){if(n%2)res=res*x%mod;x=x*x%mod;n/=2;};return res;
}
template<class T> T modinv(T x,const T mod){return modpow(x,mod-2,mod);}
template<class T> bool alltrue(const T &a){return all_of(ALL(a),[](bool x){return x;});}
template<class T> bool anytrue(const T &a){return any_of(ALL(a),[](bool x){return x;});}
template<class T> bool contain(const T &a,const T &b){for(auto x:b){if (a.find(x)==a.end()){return false;}}return true;}
template<class T> bool mmax(T &m,const T q){ if (m < q) {m = q; return true;} else return false; }
template<class T> bool mmin(T &m,const T q){ if (m > q) {m = q; return true;} else return false; }
template<class T> int siz(const T &a) {return (int)a.size();}
template<class T> set<T> devisers(T n) {
  set<T> res;for(T i=1;i<(T)sqrt(n)+1;i++){if(n%i==0){res.insert(i);res.insert(n/i);}}return res;
}
template<class T> void concat(T &a, const T &b){a.insert(a.end(),ALL(b));}
template<class T> void getand(const T &a,const T &b,T &c) {
  set_intersection(ALL(a),ALL(b),inserter(c,c.end()));
}
template<class T> void getor(const T &a,const T &b,T &c) {
  set_union(ALL(a),ALL(b),inserter(c,c.end()));
}
template<class T> void getdiff(const T &a,const T &b,T &c) {
  set_difference(ALL(a),ALL(b),inserter(c,c.end()));
}
template<class T> T deg2rad(T deg) {return deg*2*M_PI/360;}
template<class T> T rad2deg(T rad) {return rad*360/(2*M_PI);}

typedef long long ll;
typedef pair<ll, ll> P;

const ll MOD=1e9+7;
const ll MAX=5e6;

int main() {
  ll N,K;cin>>N>>K;
  ll tmp = N%K;
  OUT(min(tmp,K-tmp));

  return 0;
}

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

using namespace std;

int main() {
    vector <long long> side;
    int s;
    bool even = false;
    for(int i = 0; i < 3; i++){
    	cin >> s;
    	side.push_back(s);
    	if(s % 2 == 0){
    		even = true;
    	}
    }
    sort(side.begin(), side.end());
    if(even == true){
    	cout << 0;
    }
    else{
    	cout << (side[0] * side[1]);
    }
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<functional>
#include<iostream>
#define INF 200
#define rep(i,a) for(i=0;i<a;i++)
using namespace std;
int main(void) 
{
	int glid[20][20],n,m,a,b,c,d,i,j,k,p,q,w,v;
	cin>>n>>m;
	rep(i,n)rep(j,n)glid[i][j]=INF;rep(i,n)glid[i][i]=0;
	rep(i,m) {
		scanf("%d,%d,%d,%d",&a,&b,&c,&d);
		a--;b--;glid[a][b]=c;glid[b][a]=d;
	}
	scanf("%d,%d,%d,%d",&p,&q,&w,&v);
	rep(k,n)rep(i,n)rep(j,n)glid[i][j]=min(glid[i][j],glid[i][k]+glid[k][j]);
	p--;q--;
	cout<<w-v-(glid[p][q]+glid[q][p])<<endl;
	return 0;
}

Measured memory_bytes: 1240
#include <stdio.h>

int
main(int argc, char *argv[])
{
  char s[20];
  int n, k;
  scanf("%d%s%d", &n, s, &k);

  for(int i = 0; i < n; i++){
    if(s[i] != s[k - 1]){
      s[i] = '*';
    }
  }

  printf("%s\n", s);
    

  return 0;
}

Measured memory_bytes: 128
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop;

immutable long MOD = 10^^9 + 7;

void main() {
    auto N = readln.chomp.to!int;
    auto C = readln.split.map!(x => x.to!int-1).array;
    auto G = new int[][](N);
    foreach (i; 0..N-1) {
        auto s = readln.split.map!(to!int);
        G[s[0]-1] ~= s[1]-1;
        G[s[1]-1] ~= s[0]-1;
    }

    auto sub = new int[](N);
    auto colorsub = new int[](N);
    colorsub[] = N;

    void dfs1(int n, int p) {
        sub[n] = 1;
        foreach (m; G[n]) if (m != p) {
            dfs1(m, n);
            sub[n] += sub[m];
        }
    }

    dfs1(0, -1);

    auto ans = new long[](N);
    auto prev = new int[](N);
    prev[] = -1;
    auto tmp = new long[](N);

    void dfs(int n, int p) {
        auto c = C[n];
        if (prev[c] != -1) {
            tmp[prev[c]] -= sub[n];
        } else {
            colorsub[c] -= sub[n];
        }
        auto prevprev = prev[c];
        prev[c] = n;
        foreach (m; G[n]) if (m != p) {
            tmp[n] = sub[m];
            dfs(m, n);
            ans[c] += 1L * tmp[n] * (tmp[n] + 1) / 2;
        }
        prev[c] = prevprev;
    }


    dfs(0, -1);

    foreach (i; 0..N) {
        ans[i] += 1L * colorsub[i] * (colorsub[i] + 1) / 2;
    }

    auto S = 1L * N * (N + 1) / 2;
    ans.each!(a => writeln(S - a));
}


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

int main(){
  int a,b; cin>>a>>b;
  if(a!=1 && b!=1)cout<<1<<endl;
  if(a!=2 && b!=2)cout<<2<<endl;
  if(a!=3 && b!=3)cout<<3<<endl;

  
}

Measured memory_bytes: 256
using System;
using System.Text;

namespace ITP_8_C{
    public class Program{
        public static void Main(string[] args){
            
            string literal;
            int[] answer = new int[26];

            //?????°????????????
            while((literal = Console.ReadLine()) != null){
                //?°??????????
                literal = literal.ToLower();

                //????????????????????????????????????
                for(int i=0; i<literal.Length; i++){
                    //a???char??§97???z???char??§122->if(x<97 && 122<x ){x-97????????????add}
                    if(97 <= literal[i] && literal[i] <= 122){
                        answer[literal[i]-97]++;
                    }
                }
            }
            Output(answer);
        }

        //?°???????????????????????????¨???????????????????????°???26(alphabet?????°)?????§???int????????????
        private static void Output(int[] answer){
            StringBuilder outputStr = new StringBuilder();

            for(int i=0; i<26; i++){
                //??????????????????????£??????´?????????
                outputStr.Append((char)(97+i)).ToString();
                outputStr.Append(" : ");
                outputStr.AppendLine(answer[i].ToString());
            }

            Console.Write(outputStr.ToString());
        }
    }
}

Measured memory_bytes: 9120
/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=1e18;
using P=pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int n,a,b,c,g[105][105]={};
  cin >> n;
  for(int i=0; i<n; i++) {
    cin >> a >> b;
    a--;
    for(int j=0; j<b; j++) {
      cin >> c;
      c--;
      g[a][c]=1;
    }
  }
  for(int i=0; i<n; i++) {
    for(int j=0; j<n-1; j++) {
      cout << g[i][j] << " ";
    }
    cout << g[i][n-1] << endl;
  }
}


Measured memory_bytes: 3272
// inputに入力データ全体が入る
function Main(input) {
  var r;
  r = Number(input.split('\n')[0].split(' ')[0]);
  
  console.log(3 * r * r);
  
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include <cstdio>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;
#define fors(i,a,b) for(int i=(a);i<=(b);++i)
int main(){
    ios::sync_with_stdio(0);
    register int a,wh[9],b,e;
    cin>>a>>b>>e;
    fors(c,-100,200){
        wh[1]=a+b+c;
        if(wh[1]<a+e) continue;
        fors(i,-100,200){
            wh[7]=a+e+i;
            if(wh[7]!=wh[1]) continue;
            fors(f,-100,200)
            {
                wh[6]=c+f+i;
                if(wh[6]!=wh[7]) continue;
                fors(d,-100,200){
                    wh[2]=d+e+f;
                    if(wh[2]!=wh[6]) continue;
                    fors(g,-100,200)
                    {
                        wh[4]=g+d+a;
                        wh[8]=c+e+g;
                        if((wh[8]!=wh[4])) continue;
                        fors(h,-100,200){
                            wh[3]=g+h+i;
                            wh[5]=b+e+h;
                            if((wh[3]!=wh[5]) || (wh[3]!=wh[4]) || (wh[3]!=wh[8])) continue;
                                cout<<a<<" "<<b<<" "<<c<<endl;
                                cout<<d<<" "<<e<<" "<<f<<endl;
                                cout<<g<<" "<<h<<" "<<i<<endl;
                                return 0;
                        }
                    }       
                }
            }
        }
    }
    return 0;
}

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

int main() {
  int n, k;
  double o, odd = 1;
  cin >> n >> k;
  if(k == 1) {
    cout << 1 << endl;
    return 0;
  }
  o = 1.0 / n * max(0, n - k + 1);
  int t = min(n, k - 1);
  int tm = 0;
  while((t << tm) < k) {
    tm++;
    odd /= 2;
  }
  t = k;
  for(int i = 0; i < tm; i++)
    t = (t + 1) / 2;
  for(int i = min(n, k - 1); i > 0; i--) {
    o += 1.0 / n * odd;
    if(t == i) {
      odd /= 2;
      t = (t + 1) / 2;
    }
  }
  cout << setprecision(12) << o << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


int main(){
    ll A[3];
    cin >> A[0] >> A[1] >> A[2];
    sort(A, A + 3);

    cout << A[0] + A[1] + A[2] * 10 << endl;

    return 0;
}

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

int main()
 {
	//code
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

    int n,t,a,b,flag=0;
    int ans=10000;
    cin>>n>>t;
    while(n--){
        cin>>a>>b;
        if(b<=t){
            ans=min(ans,a);
            flag=1;
        }
       
    }
  if(flag==1){
      cout<<ans<<endl;
  }
  else
  cout<<"TLE"<<endl;
 
 
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll         long long int
#define co         cout
#define ci         cin
#define sf1(n)     scanf("%lld",&n)
#define sf2(n,m)   scanf("%lld %lld",&n,&m);
#define sf3(n,m,p) scanf("%lld %lld %lld",&n,&m,&p);
#define pf1(n)     printf("%lld\n",n);
#define en         cout<<endl;
#define pb         push_back
#define fi         first
#define se         second
#define coy        cout<< "YES"<<endl;
#define con        cout<< "NO"<<endl;
#define f(a,b)     for(ll i=a;i<b;i++)
#define pi         pair<ll,ll>
#define br         break;
#define i64        long long
int main()
{
    ll t,n,g,k,m,mx=0,mn=1e9,c,res,c1,x,y,w,z,c2;
    ll a[5];
    f(0,5)
    {
        ci>>a[i];
    }
    f(0,5)
    {
        if(a[i]==0)
        {
            co<<i+1;
            return 0;
        }
    }
}


Measured memory_bytes: 3596
import sys
input=sys.stdin.buffer.readline
inputs=sys.stdin.buffer.readlines
sys.setrecursionlimit(10**9)
n,m=map(int,input().split())
edges=[[] for i in range(3+3*n)]
o=inputs()
s,T=map(int,o.pop().split())
for i in o:
    _,__=map(int,i.split())
    _*=3;__*=3
    edges[_].append(__+1)
    edges[_+1].append(__+2)
    edges[_+2].append(__)

from collections import deque
dq=deque([])
dq.append((3*s,0))
T*=3
seen=set()
seen.add(3*s)
while dq:
    now,c=dq.popleft()
    if now==T :print(c//3);exit()
    for t in edges[now]:
        if t not  in seen:
            dq.append((t,c+1))
            seen.add(t)
print("-1")


Measured memory_bytes: 158324
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    private const int INF = 1000000007;
    private const long INFINITY = 9223372036854775807;
    private struct Pair<T> { public T x, y; public Pair(T xx, T yy) { x = xx; y = yy; } }
    private static int[] dx = { 1, 0, -1, 0 };
    private static int[] dy = { 0, -1, 0, 1 };
    public static void Main()
    {
        int N = NextInt();
        long[] A = LineLong();
        long[] sum = new long[N + 1];
        long[] xor = new long[N + 1];
        sum[0] = xor[0] = A[0];
        for (int i = 0; i < N; i++)
        {
            sum[i + 1] = sum[i] + A[i];
            xor[i + 1] = xor[i] ^ A[i];
        }
        long ans = 0;
        for (int left = 0; left < N; left++)
        {
            //満たされなくなる場所を探す
            ans += BinarySearch(sum, xor, left, N) + 1 - left;
        }
        Console.WriteLine(ans);
    }

    public static int BinarySearch(long[] sum, long[] xor, int left, int right)
    {
        int ok = left;
        int ng = right;
        while (ng - ok != 1)
        {
            int x = (ng + ok) / 2;
            if (sum[x + 1] - sum[left] == (xor[x + 1] ^ xor[left])) ok = x;
            else ng = x;
        }
        return ok;
    }
}

public class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static char NextChar() { Confirm(); return char.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}


Measured memory_bytes: 37120
from enum import Enum
from queue import Queue
import collections

import sys
import math

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

def countingSort(A,k):
    for i in range(k+1):
        C=[0]*(k+1)
        n = len(A)
    for a in A:
        C[a] += 1
    for i in range(1,k+1):
        C[i] += C[i-1]
    B = [0]*n
    for i in reversed(range(n)):
        B[C[A[i]]-1] = A[i]
        C[A[i]] -= 1
    return B

n = int(input())
A = list(map(int,input().split()))
B = countingSort(A,max(A))
print(*B)



Measured memory_bytes: 229316
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <cstdlib>
#include <iomanip>
#define rep(i,x) for(ll i=0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
using ld = long double;
using ll = long long;
const ll INF = 10010010010;
typedef pair<ll, ll> P;
using graph = vector<vector<ll>>;
const ll mod = 1000000007;
ll gcd(ll a, ll b) {//a>b
    if (a < b)swap(a, b);
    if (a % b == 0) return b;
    else return gcd(b, a % b);
}/*フィボナッチテンプレ
ll memo[50];
ll fibo(ll n) {
    if (memo[n] != 0)return memo[n];
    if (n <= 1)return memo[n] = n;
    else return memo[n] = fibo(n - 1) + fibo(n - 2);
}
*/
bool isp(ll n) {
    bool res = true;
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            res = false;
            break;
        }
    }
    return res;
}

int main() {
  ll N;
  cin >> N;
  cout << N /3 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define ALL(a) a.begin(),a.end()
typedef long long ll;
#define INF 1<<30

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

Measured memory_bytes: 256