akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// gp_hash_table<int, int> mapka;

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

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

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

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

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

int n,m;
string s,t;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  cin >> n >> m >> s >> t;
  int nwd = __gcd(n,m);
  R(i,nwd){
    if(s[i * (n / nwd)] != t[i * (m / nwd)]){
      cout << "-1\n";
      return 0;
    }
  }
  cout << n * m / nwd << endl;
}


Measured memory_bytes: 640
#include <stdio.h>
int main(){
  int a,b;
  char op;
  for(;;){
    scanf(" %d %c %d",&a,&op,&b);
    if(op=='?'){
      return 0;
    } else if(op=='+'){
      printf("%d\n",a+b);
    } else if(op=='-'){
      printf("%d\n",a-b);
    } else if(op=='*'){
      printf("%ld\n",a*b);
    } else if(op=='/'){
      printf("%d\n",a/b);
    }
  }
}

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

using namespace std;

typedef long long ll;

ll n,m,k,sum;

void dfs(ll dep,double wa){
    for(int i=1;i<=m;i++){
        if(dep==n){
            if((wa+i-k)<1)sum+=1;
            else sum+=(wa+i-k);
        }
        else dfs(dep+1,wa+i);
    }
}

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

  while(true){
      sum=0;
      cin>>n>>m>>k;
      if(n==0&&m==0&&k==0) break;
      dfs(1,0);
      double bunbo=1;
      for(int i=0;i<n;i++) bunbo*=m;
      //cout<<sum<<endl<<bunbo<<endl;
      cout<<fixed<<setprecision(10)<<sum/bunbo<<endl;
  }
  return 0;
}

Measured memory_bytes: 3224
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  int c,d,e=100000000,q=1;
  cin>>a>>b;
  for(int i=0;i<a;i++){
    cin>>c>>d;
    if(b>=d) e=min(e,c),q=0;
  }
  if(q==0) cout<<e<<"\n";
  else cout<<"TLE\n";

}


Measured memory_bytes: 256
local n = io.read("*n")
local a, b = {}, {}
for i = 1, n + 1 do
  a[i] = io.read("*n")
end
for i = 1, n do
  b[i] = io.read("*n")
end
local tot = 0
for i = 1, n do
  if a[i] < b[i] then
    tot = tot + a[i]
    b[i] = b[i] - a[i]
    local bonus = math.min(a[i + 1], b[i])
    tot = tot + bonus
    a[i + 1] = a[i + 1] - bonus
  else
    tot = tot + b[i]
  end
end
print(tot)


Measured memory_bytes: 4472
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<bitset>
#include<deque>
#include<cstdlib>
#define N 100003 
#include<set>
#include<ctime>
#define ll long long
#define mp make_pair
using namespace std;
ll read()
{
	ll x=0,f=1;
	char c=getchar();
	while(c>'9'||c<'0')
	{
		if(c=='-') f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9')
	{
		x=x*10+c-'0';
		c=getchar();
	}
	return f*x;
}
int n,m,du[N],A,B,num,head[N],size;
struct node{
	int next,to;
}mem[N<<1];
void add(int u,int v){
	mem[++size].to=v;mem[size].next=head[u];head[u]=size;
}
bool flag;
bool dfs(int x,int fa)
{
	if(x==A) return 1;
	if(x==B) return 0;
	for(int i=head[x];i;i=mem[i].next)
	{
		int v=mem[i].to;
		if(v==fa) continue;
		return dfs(v,x);
	}
}
int main()
{
	n=read(),m=read();
	for(int i=1;i<=m;++i)
	{
		int x=read(),y=read();
		du[x]++,du[y]++;
		add(x,y);add(y,x);
	}
	for(int i=1;i<=n;++i) 
	{
		if(du[i]&1)
		{
			cout<<"No"<<'\n';
			return 0;
		}
		if(du[i]>4) flag=1;
		if(du[i]==4)
		{
			if(!A) A=i;
			else B=i;
			num++;
		}
	}
	if(flag||num>2) cout<<"Yes"<<'\n';
	else if(num==2)
	{
		bool flag=0;
		for(int i=head[A];i;i=mem[i].next)
		{
			int v=mem[i].to;
			flag|=dfs(v,A);
		}
		if(!flag) cout<<"No"<<'\n';
		else cout<<"Yes"<<'\n';
	}
	else cout<<"No"<<'\n';
	return 0;
 }


Measured memory_bytes: 2560
import java.util.Scanner;

class Main { 
    	public static void main(String[] args) {
        	Scanner sc = new Scanner(System.in);
        	String str = sc.nextLine();
        	for(int i = 0; i < str.length(); i++){
            		char c = str.charAt(i);
            		if(Character.isLowerCase(c)){
                		System.out.print(Character.toUpperCase(c));
            		}else{
                		System.out.print(Character.toLowerCase(c));
            		}
        	}System.out.println();
    	}
}

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

int isPrime(int number)
{
  int sqrtNumber;
  if (number % 2 > 0)
  {
    for (int i = 3; i <= sqrt(number); i += 2)
    {
      if (number % i == 0)
      {
        return 0;
      }
    }
    return 1;
  }
  return 0;
}

int main()
{
  int inputs, number, primeCounts = 0;
  scanf("%d", &inputs);
  for (int i = 0; i < inputs; ++i)
  {
    scanf("%d", &number);
    if(number == 2 || number == 3){
      primeCounts++;
      continue;
    }
    else if (number % 2 == 0) continue;
    else if (isPrime(number) == 1) primeCounts++;
  }

  printf("%d\n", primeCounts);
  return 0;
}


Measured memory_bytes: 2132
var
  a:array[0..100]of string;
  i,j,n:longint;
begin
  readln(n);
  for i:=1 to n do
    readln(a[i]);
  for i:=1 to n-1 do
    for j:=i+1 to n do
      if a[i]=a[j] then
        begin
          write('No');
          exit;
        end;
  for i:=1 to n-1 do
    if a[i][length(a[i])]<>a[i+1][1] then
      begin
        write('No');
        exit;
      end;
    write('Yes');
  end.

Measured memory_bytes: 128
#include<stdio.h>
int main(){
    int a, b, c, d, e;
    scanf("%d %d %d %d %d", &a, &b, &c, &d, &e);
    if(a == 0){
        printf("%d", 1);
    }
    if(b == 0){
        printf("%d", 2);
    }
    if(c == 0){
        printf("%d", 3);
    }
    if(d == 0){
        printf("%d", 4);
    }
    if(e == 0){
        printf("%d", 5);
    }
}


Measured memory_bytes: 1684
#include <stdio.h>
int main(void)
{
int i,n,d1[101],d2[102];
scanf("%d", &n);
for(i=0;i<n;i++){
  scanf("%d%d", &d1[i], &d2[i]);
}
for(i=0;i<n-2;i++){
  if(d1[i]==d2[i] && d1[i+1] == d2[i+1] && d1[i+2]==d2[i+2]){
    printf("Yes");
    break;
  }
  else if(i+3==n) printf("No");
}
return 0;
}


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

int main() {
	int a, b, c;
	cin>>a>>b>>c;
	if ((a == 5 || a == 7) && (b == 5 || b == 7) && (c == 5 || c == 7))
	{
	if (a == 5)
	{
	    if (b == 7)
	       if (c == 5)
	            cout<<"YES";
	       else
	       {
	           cout<<"NO";
	           return 0;
	       }
	    else if (b == 5)
	       if (c == 7)
	            cout<<"YES";
	       else
	       {
	           cout<<"NO";
	           return 0;
	       }
	   else
	       {
	           cout<<"NO";
	           return 0;
	       } 
	}
	else if (a == 7)
	{
	   if (b == 5)
	       if (c == 5)
	            cout<<"YES";
	       else
	       {
	           cout<<"NO";
	           return 0;
	       }
	   else if (b == 7)
	   {
	       cout<<"NO";
	       return 0;
	   }
	   else
	    {
	       cout<<"NO";
	       return 0;
	   }
	}
	}
	else
	    cout<<"NO";
	return 0;
}

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

struct Graph
{
    int n;
    vector<vector<int>> g;
    
    Graph(int n) : n(n){
        g.resize(n);
    }
    
    void init(int n_){
        n = n_;
        g.resize(n_);
    }
    
    void add_edge(int from, int to){
        g[from].push_back(to);
    }
};

int dfs(Graph &g, int u){
    int k = g.g[u].size();
    vector<int> d(k);
    for(int i = 0; i < k; i++){
        int v = g.g[u][i];
        d[i] = dfs(g, v) + 1;
    }
    sort(d.begin(), d.end(), greater<int>());
    int res = 0;
    for(int i = 0; i < k; i++) res = max(res, d[i] + i);
    return res;
}

int main()
{
    int n;
    cin >> n;
    Graph g(n);
    for(int i = 1; i < n; i++){
        int a;
        cin >> a;
        a--;
        g.add_edge(a, i);
    }
    cout << dfs(g, 0) << endl;
}


Measured memory_bytes: 19380
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>

using namespace std;

int main() {
  int n,m;
  cin >> n >> m;
  int a[n],b[n],c[m],d[m];
  for(int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  for(int i = 0; i < m; i++) {
    cin >> c[i] >> d[i];
  }
  for(int i = 0; i < n; i++) {
    int id = 0;
    int mi = abs(a[i] - c[0]) + abs(b[i] - d[0]);
    for(int j = 1; j < m; j++) {
      if(mi > abs(a[i] - c[j]) + abs(b[i] - d[j])) {
        id = j;
        mi = abs(a[i] - c[j]) + abs(b[i] - d[j]);
      }
    }
    cout << (id+1) << endl;
  }

}


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

int main() {
  int a[3];
  for(int i=0;i<3;i++){
    cin >> a[i];
  }
  int k; cin >> k;
  sort(a,a+3,greater<int>());
  int r = a[0] * pow(2,k);
  r += a[1];
  r += a[2];
  
  cout << r<< endl;
  
  
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define repeat(i, n) for (int i = 0; (i) < (n); ++(i))
#define repeat_from(i, m, n) for (int i = (m); (i) < (n); ++(i))
using namespace std;
template <class T>
void setmax(T &a, T const &b) {
    if (a < b) a = b;
}

template <class T>
void setmin(T &a, T const &b) {
    if (a > b) a = b;
}

template <typename T, typename X>
auto vectors(T a, X x) { return vector<T>(x, a); }

template <typename T, typename X, typename Y, typename... Zs>
auto vectors(T a, X x, Y y, Zs... zs) {
    auto cont = vectors(a, y, zs...);
    return vector<decltype(cont)>(x, cont);
}

// N = m * a + a = a * (m + 1)
// (0 <= a < m)

void divisor(long long n, vector<long long> &ret) {
    for (long long i = 1; i * i <= n; ++i) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    // sort(ret.begin(), ret.end());
    return;
}

int main() {
    long long N;
    cin >> N;
    long long res = 0LL;
    vector<long long> div;
    divisor(N, div);
    for (long long m_1 : div) {
        long long m = m_1 - 1;
        if (m <= 0) continue;
        if (N / m_1 < m) res += m;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

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

int calc_time(const vector<int>& times, const vector<int>& recipe) {
  int time = 0;
  for(int i = 0; i < 4; ++i) {
    auto rt = times[recipe[i]];
    time += (rt / 10 + min(rt % 10, 1)) * 10;
  }
  time += times[recipe[4]];
  return time;
}

int main() {
  vector<int> dts(5);
  vector<int> ns(5);
  for(int i = 0; i < 5; ++i) {
    cin >> dts[i];
    ns[i] = i;
  }

  int min = 100000;
  do {
    chmin(min, calc_time(dts, ns));
  } while(next_permutation(ns.begin(), ns.end()));
  cout << min << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <cmath>
#include <set>
#include <bitset>
#include <limits>

using namespace std;

#define ll long long

int main(void){
    int a, b, c, k;
    cin >> a >> b >> c >> k;

    int ans = 0;
    ans += min(a, k);
    k = k - a - b;

    if(k > 0){
        ans -= k;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define ld long double
#define F first
#define S second
#define P pair<int,int>
#define V vector
#define pb push_back
#define mp make_pair
#define endl "\n"
#define db(...) __f(#__VA_ARGS__, __VA_ARGS__)
#define MOD 1000000007  //1e9+7

template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << '\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

void solve()
{
	int n; cin>>n;
	int ans=1;
	for(int i=1;i<=3;i++) ans*=n;
	cout<<ans<<endl;
}
	
int32_t main()
{
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    //int t; cin>>t;
    //while(t--)
    solve();
    return 0;
}

Measured memory_bytes: 256
N = int(input())
P = list(map(int, input().split()))

check = [0 for _ in range(N)]
ans = 0

for i, v in enumerate(P):
    if i+1 == v:
        check[i] = 1

for i in range(N-1):
    if check[i] == 1:
        ans += 1
        if check[i+1] == 1:
            check[i+1] = 0

print(ans + check[-1])

Measured memory_bytes: 14008
#include<iostream>
using namespace std;
int main()
{
    int A,B,C,X;
    cin >> A >> B >> C >> X;
    int a = 0;
    for(int i = 0; i <= A; i++){
      for(int j = 0; j <= B; j++){
        for(int k = 0; k <= C; k++){
          if(500 * i + 100* j + 50 * k == X){
            a++;
          }
        }
      }
    }
    cout << a << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std; 
  #define ll long long
// Function to count all possible 
// triangles with arr[] elements 
ll findNumberOfTriangles(ll arr[], ll n) 
{ 
    // Count of triangles 
    ll count = 0; 
  
    // The three loops select three 
    // different values from array 
    for (ll i = 0; i < n; i++) { 
        for (ll j = i + 1; j < n; j++) { 
  
            // The innermost loop checks for 
            // the triangle property 
            for (ll k = j + 1; k < n; k++) 
  
                // Sum of two sides is greater 
                // than the third 
                if ( 
                    arr[i] + arr[j] > arr[k] 
                    && arr[i] + arr[k] > arr[j] 
                    && arr[k] + arr[j] > arr[i]
                    && arr[i]!=arr[j]
                    && arr[j]!=arr[k]
                    && arr[k]!=arr[i]) 
                    count++; 
        } 
    } 
    return count; 
} 
  
// Driver code 
int main() 
{ 
    ll n;
    cin>>n;
    ll arr[n];
    for(ll i=0;i<n;i++){
        cin>>arr[i];
    }
  
    cout << findNumberOfTriangles(arr, n)<<endl; 
  
    return 0; 
} 

Measured memory_bytes: 3596
n = gets.to_i

edges = []
g = Array.new(n){[]}

(n-1).times do |i|
    
    e = gets.split.map(&:to_i).map{|k|k-=1}
    e[1], e[0] = e[0], e[1] if e[0] > e[1]
    g[e[0]] << e[1]
    g[e[1]] << e[0]
    edges << e
end
# p [g, edges]

colors = Hash.new()
colors_used = Array.new(n){Hash.new}
used = Array.new(n){false}
# p colors
que = [0]

k = 0
while !que.empty? do
    v = que[0]
    que.shift
    # p ?a
    cur = 1
    # k = g[v].size if k < g[v].size 
    g[v].each do |w|
        k = g[v].size if k < g[v].size 
        v<w ? (i,j = v,w) : (i,j = w,v)
        next if colors[[i,j]] != nil
        # p ?b
        while colors_used[v][cur] == true do
            cur+=1
        end
        colors_used[v][cur] = true
        colors_used[w][cur] = true
        colors[[i,j]] = cur
        que.push(w) if used[w] == false
        used[v] = true
        # p [v,w,colors_used]
    end
end
# p g
# p edges
# p colors_used

p k
edges.each do |e|
    p colors[e]
end








Measured memory_bytes: 83580
import java.util.*;
import java.io.*;

public class Main {	
	
	private static void solve(){
		//Implement solution here.
		String S = next();
		if("ARC".equals(S)) {
			System.out.println("ABC");
		} else {
			System.out.println("ARC");
		}
	}

	//Switch input source (stdin/file)
	private static BufferedReader br;
	public static void main(String[] args){
		br = new BufferedReader(new InputStreamReader(System.in));
		String debugDataPath = System.getenv("DD_PATH");        
		if(debugDataPath != null){
			try{
				br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		}
		boolean hasNext = true;
		while(hasNext){
			solve();	
			try{
				br.mark(1);
				if(br.read() > 0){
					br.reset();			
					System.out.println("---");
				} else {
					hasNext = false;
				}
			}catch(Exception e){
				throw new RuntimeException(e);
			} 
		}
	}

	//Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	//Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
	//Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
	//Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
	//Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
	//Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}

Measured memory_bytes: 25420
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(deprecated)]

use std::cell::{Cell, Ref, RefCell, RefMut};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;
use std::usize;

const MOD_10_9_7: u64 = 1_000_000_007;
const INF: i64 = 1_000_000_000_000;
const MIN_INF: i64 = -1_000_000_000_000;

/// FYI: https://github.com/vain0x/scan-bench
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    let b = read!(String);

    if b == "A" {
        println!("T");
    } else if b == "C" {
        println!("G");
    } else if b == "G" {
        println!("C");
    } else {
        println!("A");
    }
}


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

int main(){
	int N,Y;
	int a = -1;
	int b = -1;
	int c = -1;
	cin >> N>> Y;
	for (int num_yukichi = 0;num_yukichi <= N;num_yukichi++){
		for (int num_ichiyou = 0;num_ichiyou + num_yukichi <=N;num_ichiyou++){
			int num_hide; 
			num_hide = N - num_yukichi - num_ichiyou;
			if (num_yukichi*10000+num_ichiyou*5000+num_hide*1000 == Y){
				a = num_yukichi;
				b = num_ichiyou;
				c = num_hide;
			}
		}
	}
	cout << a << " " << b << " " << c << endl; 
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int l = sc.nextInt();
        int[][] A = new int[n][m];
        int[][] B = new int[m][l];
        long[][] C = new long[n][l];
        for(int i=0; i<n; i++){
            for(int j=0; j<m; j++){
                A[i][j] = sc.nextInt();
            }
        }
        for(int i=0; i<m; i++){
            for(int j=0; j<l; j++){
                B[i][j] = sc.nextInt();
            }
        }
        for(int i=0; i<n; i++){
            for(int j=0; j<l; j++){
                for(int k=0; k<m; k++){
                    C[i][j] += (long)A[i][k] * B[k][j];
                }
            }
        }
        for(int i=0; i<n; i++){
            for(int j=0; j<l-1; j++){
                System.out.print(C[i][j] + " ");
            }
            System.out.println(C[i][l-1]);
        }
    }
}


Measured memory_bytes: 54120
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define Repr(i, n, a) for (int i = (n); i >= (a); i--)
#define rep(i, n) Rep(i, 0, n)
#define repr(i, n) Repr(i, n, 0)
#define all(a) a.begin(), a.end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;

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

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

Measured memory_bytes: 256
use proconio::{input, marker::Usize1};

fn shallowest(b: usize, d: &[usize]) -> Option<usize> {
    let n = d.len();
    assert!(n % 2 == 1);
    let is_ok = |skip| {
        let d: Vec<usize> = d[0..skip]
            .iter()
            .chain(d[skip + 1..n].iter())
            .copied()
            .collect();
        (0..n / 2).all(|i| d[i] + d[n - 2 - i] <= b)
    };
    if is_ok(0) {
        Some(d[0])
    } else {
        let mut l = 0;
        let mut r = n;
        while 1 < r - l {
            let c = (l + r) / 2;
            if is_ok(c) {
                r = c;
            } else {
                l = c;
            }
        }
        if r < n {
            Some(d[r])
        } else {
            None
        }
    }
}

fn main() {
    input!(n: usize, uv: [(Usize1, Usize1); n - 1]);
    let mut g = vec![vec![]; n];
    for (u, v) in uv {
        g[u].push(v);
        g[v].push(u);
    }

    let is_ok = |b| {
        let mut dp = vec![Some(0); n];
        fn dfs(b: usize, x: usize, p: usize, dp: &mut [Option<usize>], g: &[Vec<usize>]) {
            for &y in &g[x] {
                if y == p {
                    continue;
                }
                dfs(b, y, x, dp, g)
            }
            dp[x] = g[x]
                .iter()
                .copied()
                .filter(|&y| y != p)
                .map(|y| dp[y].and_then(|x| if x < b { Some(x + 1) } else { None }))
                .collect::<Option<Vec<usize>>>()
                .and_then(|mut d| {
                    if g[x].len() % 2 == 1 {
                        d.push(0);
                    }
                    if d.len() % 2 == 0 {
                        d.push(0);
                    }
                    d.sort();
                    shallowest(b, &d)
                });
        }
        dfs(b, 0, 0, &mut dp, &g);
        dp[0] == Some(0)
    };
    let a = g.iter().filter(|v| v.len() % 2 == 1).count() / 2;
    let b = {
        let mut l = 0;
        let mut r = n;
        while 1 < r - l {
            let c = l + (r - l) / 2;
            if is_ok(c) {
                r = c;
            } else {
                l = c;
            }
        }
        r
    };
    println!("{} {}", a, b);
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_shallowest() {
        assert_eq!(shallowest(0, &[0, 1, 2]), None);
        assert_eq!(shallowest(1, &[0, 1, 2]), Some(2));
        assert_eq!(shallowest(2, &[0, 1, 2]), Some(1));
        assert_eq!(shallowest(3, &[0, 1, 2]), Some(0));
        assert_eq!(shallowest(4, &[0, 1, 2]), Some(0));
    }
}


Measured memory_bytes: 32620
def main():
    N = int(input())
    abc = [list(map(int, input().split())) for _ in range(N)]
    dp = [[0]*3 for _ in range(N)]
    for i in range(3):
        dp[0][i] = abc[0][i]
    for i in range(1, N):
        for j in range(3):
            dp[i][j] = max(dp[i-1][(j+1) % 3], dp[i-1][(j+2) % 3])+abc[i][j]
    print(max(dp[N-1][0], dp[N-1][1], dp[N-1][2]))


if __name__ == '__main__':
    main()


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

int main(){
  int N, L; cin >> N >> L;
  vector<string> sl(N);
  for(int i = 0; i < N; i++){
    cin >> sl[i];
  }
  sort(sl.begin(), sl.end());
  for(int i = 0; i < N; i++){
    cout << sl[i];
  }
  cout << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<vector>
#define p pair<int,int>
#define P pair<int,p>
#define int long long
using namespace std;

P a[5000];
int dp[5001];
signed main() {
	fill(dp + 1, dp + 5001, LLONG_MAX);
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i].second.first >> a[i].second.second;
		a[i].first= a[i].second.first+ a[i].second.second;
	}
	sort(a, a + n);
	for (int i = 0; i < n; i++) {
		for (int j = 5000; j > 0; j--) {
			if(dp[j-1]<=a[i].second.first)dp[j] = min(dp[j], dp[j - 1] + a[i].second.second);
		}
	}
	for (int i = n; i >= 0; i--) {
		if (dp[i] < LLONG_MAX) {
			cout << i << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;


bool c[26];

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

    if (s.size() < 26){
        rep(i, s.size()) c[s[i] - 'a'] = 1;
        rep(i, 26){
            if (c[i] == 0) {
                cout << s << char(i + 'a') << endl;
                return 0;
            }
        }
    }
    else {
        int cnt = 0;
        rrep(i, 25) {
            if (s[i] > s[i+1]){
                cnt++;
            }
            else break;
        }
        int idx = 25 - cnt;

        if (idx == 0) {
            cout << -1 << endl;
            return 0;
        }

        for(int i = idx; i < 26; i++) c[s[i] - 'a'] = 1;

        
        
        rep(i, 26) {
            if (c[i] == 1 && i > s[idx-1] - 'a') {
                cout << s.substr(0, idx-1) << char(i + 'a') << endl;
                return 0;
            }
        }

    }

    return 0;
}


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

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;
    Func cin2;
    void calc()
    {
        cin = new Scanner();
        cin2 = new Func();
        int[] N=cin.ArrayInt(2,0);
        int[] ans={N[0]+N[1],N[0]*N[1],N[0]-N[1]};
        Array.Sort(ans);
        Console.WriteLine(ans[2]);
        
    }
}



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 Answer
{
    public static void Int2DArrayAns(int[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }//Answer.IntArrayAns(x);
    public static void Char2DArrayAns(char[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
}

class Func
{
    public long GCDLong(long a, long b)
    {
        while(a!=0)
        {
          long t=a;
          a=b%a;
          b= t;
        }
      
        return b;        
    }
}







Measured memory_bytes: 13140
n=gets.to_i
d=gets.split.map(&:to_i)



d2=d.each_with_object([]){|i,memo| memo[i]||=0;memo[i]+=1; }

if d[0]!=0 || d2.any?{|e| e==nil} || d2[0]!=1
    print 0
    exit 0
end


r = d2.each_cons(2).map{|l,r| (l**r)%998244353 }.reduce{|l,r|  (l*r)%998244353 }
p r

Measured memory_bytes: 12292
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define agewari(a, b) ((ll)a + ((ll)b - 1)) / b
const int MOD = 1000000007;
const long long INF = 1LL << 60;
using Graph = vector<vector<ll>>;

int main()
{
    ll n, m;
    cin >> n >> m;
    vector<pair<ll, ll>> BA; //sortのためBが先
    rep(i, m)
    {
        ll a, b;
        cin >> a >> b;
        a--;
        b--;
        BA.emplace_back(b, a);
    }
    sort(BA.begin(), BA.end());

    ll now = -1;
    ll ans = 0;
    rep(i, m)
    {
        ll b = BA[i].first;
        ll a = BA[i].second;
        if (now <a)
        {
            ans++;
            now = b-1;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 5364
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  int n; cin >> n;
  vector<int> x(n), y(n), p(n); REP(i, n) cin >> x[i] >> y[i] >> p[i];
  vector mn_x(n, vector(1 << n, INF)), mn_y(n, vector(1 << n, INF));
  REP(i, n) {
    mn_x[i][0] = abs(x[i]);
    REP(j, 1 << n) REP(k, n) {
      if (!(j >> k & 1)) chmin(mn_x[i][j | (1 << k)], min(mn_x[i][j], abs(x[i] - x[k])));
    }
    mn_y[i][0] = abs(y[i]);
    REP(j, 1 << n) REP(k, n) {
      if (!(j >> k & 1)) chmin(mn_y[i][j | (1 << k)], min(mn_y[i][j], abs(y[i] - y[k])));
    }
  }
  vector ans(n + 1, LINF);
  REP(i, 1 << n) {
    int jk = ((1 << n) - 1) ^ i, j = jk;
    do {
      ll sum = 0;
      REP(l, n) sum += 1LL * p[l] * min(mn_x[l][i], mn_y[l][j]);
      chmin(ans[__builtin_popcount(i | j)], sum);
    } while ((j = (j - 1) & jk) != jk);
  }
  REP(i, n + 1) cout << ans[i] << '\n';
  return 0;
}


Measured memory_bytes: 7200
import sys
import numpy as np
def input(): return sys.stdin.readline().rstrip()
def ii(): return int(input())
def mi(): return map(int, input().split())
def li(): return list(mi())


def main():
    h, w, a, b = mi()
    g = np.zeros((h, w), dtype=int)
    g[:b, :a] = 1
    g[b:, a:] = 1
    for i in range(h):
        print(*g[i], sep='')


if __name__ == '__main__':
    main()

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

using namespace std;

#define maxn 200007
#define ll long long int
#define db(x) cout<<#x<<" ->"<<x<<" "<<endl
#define db2(x,y) cout<<#x<<"->"<<x<<", "<<#y<<" -> "<<y<<endl
#define db3(x,y,z) cout<<#x<<" -> "<<x<<" , "<<#y<<" -> "<<y<<" , "<<#z<<" -> "<<z<<endl
#define prt(x) for(auto it = x.begin(); it!=x.end(); it++) { cout<<*it<<" "; } cout<<endl
#define IN freopen("input.txt","r",stdin)

ll duration[ maxn ] , deadline[ maxn ];
vector< pair< ll , ll > > V ;

int main(){
    ios_base::sync_with_stdio(false); cin.tie(0);
//	IN;
    int n;
    cin>>n;
    for(int i=1; i<=n; i++){
        cin>>duration[i]>>deadline[i];
        V.push_back({deadline[i],duration[i]});
    }
    sort(V.begin(),V.end());
    ll sum = 0LL ;
    for(int i=0; i < V.size(); i++){
        ll x = V[i].first; ll y = V[i].second;
        sum+=y;
//        db3(y,x,sum);
        if( sum > x ){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
	return 0;
}


Measured memory_bytes: 8432
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
ll d1[4] = {1, -1, 0, 0};
ll d2[4] = {0, 0, 1, -1};

int main(){
    ll n;
    cin >> n;
    VL a(n);
    rep(i, 0, n) cin >> a[i];
    ll mx = a[0];
    ll ans = 0;
    rep(i, 1, n) {
        if(mx > a[i]) {
            ans += mx - a[i];
        }else{
            mx = a[i];
        }
        //cerr << i << " " << ans << endl;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4836
/*
                                             ::                     ::
                                             ':                     :
                                              :.                    :
                                           ;' ::                   ::  '
                                          .'  ';                   ;'  '.
                                         ::    :;                 ;:    ::
                                         ;      :;.             ,;:     ::
                                         :;      :;:           ,;"      ::
                                         ::.      ':;  ..,.;  ;:'     ,.;:
                                          "'"...   '::,::::: ;:   .;.;""'
                                              '"""....;:::::;,;.;"""
                                          .:::.....'"':::::::'",...;::::;.
                                         ;:' '""'"";.,;:::::;.'""""""  ':;
                                        ::'         ;::;:::;::..         :;
                                       ::         ,;:::::::::::;:..       ::
                                       ;'     ,;;:;::::::::::::::;";..    ':.
                                      ::     ;:"  ::::::"""'::::::  ":     ::
                                       :.    ::   ::::::;  :::::::   :     ;
                                        ;    ::   :::::::  :::::::   :    ;
                                         '   ::   ::::::....:::::'  ,:   '
                                          '  ::    :::::::::::::"   ::
                                             ::     ':::::::::"'    ::
                                             ':       """""""'      ::
                                              ::                   ;:
                                              ':;                 ;:"


                                                     P_r_A_d_Y
*/
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define endl "\n"
#define mod 1000000007
#define inf 1e18
const int N = 300005;
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
void cs(int &x)
{
    cout << "Case #" << x << ": ";
}
bool cmp(string a, string b)
{
    return a + b < b + a;
}

int32_t main()
{
    fastIO;
    // int t; cin >> t;
    // int x = 1;
    // while (t--)
    // {
        int n;cin>>n;
        vector<int>m(n+1,0);
        for(int i=0;i<n-1;i++)
        {
            int x;cin>>x;
            m[x]++;
        }

        for(int i=1;i<=n;i++)
            cout<<m[i]<<endl;
        



    // }
    return 0;
}


Measured memory_bytes: 4776
package main

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

var sc *bufio.Scanner

const BufferSize = 1024

func nextInt() int {
	if !sc.Scan() {
		panic(nil)
	}
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func answer(reader io.Reader, writer io.Writer) {
	sc = bufio.NewScanner(reader)
	buf := make([]byte, BufferSize)
	sc.Buffer(buf, 1e+6)
	sc.Split(bufio.ScanWords)
	h := nextInt()
	n := nextInt()

	for i := 0;i<n;i++ {
		a := nextInt()
		h -= a
	}

	if h > 0 {
		_, _ = fmt.Fprintf(writer, "No")
	} else {
		_, _ = fmt.Fprintf(writer, "Yes")
	}
}

func main() {
	answer(os.Stdin, os.Stdout)
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
#include <string>
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PL;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;

/*
 for(i=0; i<N; i++)
   cin >> a[i];
*/



int main(void) {
  ll i, j, k;
  
  ll N, C;
  cin >> N >> C;
  ll x[MAX], v[MAX];
  ll s[MAX]={}, t[MAX]={};
  
  x[0]=0; v[0]=0;
  x[N+1]=C; v[N+1]=0;
  for(i=1; i<=N; i++) cin >> x[i] >> v[i];
  for(i=1; i<=N; i++) s[i]=s[i-1]+v[i];
  for(i=N; i>=1; i--) t[i]=t[i+1]+v[i];
  
  ll ans=0;
  ll m=0, mm=0;
  for(i=0; i<=N; i++) {
    chmax(m, s[i]-x[i]);
    chmax(mm, s[i]-x[i]*2);
    
    chmax(ans, m+t[i+1]-(C-x[i+1])*2); //OA+OB*2
    chmax(ans, mm+t[i+1]-(C-x[i+1])); //OA*2+OB
  }
  
  pt(ans);
}


Measured memory_bytes: 3456
#include <bits/stdc++.h>
#define INF 1e18
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
#define MAX 1000
#define ll long long
#define P pair<int,int>
using namespace std;
const int mod = 1000000007;
//char c[MAX][MAX];
int step[MAX][MAX];
int H,W,N; 
int vy[4] ={1,-1,0,0}, vx[4] = {0,0,-1,1}; //up,down,left,right 

signed main(){
    ll n,m; cin >> n >> m;
    vector <ll> H;H.push_back(1);
    rep(i,n) {
        ll a; 
        cin >> a; 
        H.push_back(a);
    }
    vector<vector<pair<ll,ll>>> load(n+1);
    rep(i,m){
        ll a,b; 
        cin >> a >> b;
        load[a].push_back(make_pair (a,b));
        load[b].push_back(make_pair (b,a));
    }
    ll ans=0;
    for(int i=1;i<n+1;i++ ){
        if(load[i].size() == 0) {ans++; continue;} 
        ll h = H[i];
        ll same = 0;
        ll large = h;
        rep(j,load[i].size()){
            ll b = load[i][j].second;
            ll tmp_high = H[b];
            large = max(large,tmp_high);
            if(h == tmp_high) same = 1;
        }
        if(same == 0 && large == h) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 11648
#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define INFF 9223372036854775807
#define ll long long
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,m,n) for(int i=m;i<n;i++)
#define ALL(N) (N.begin(),N.end())
#define de cout << "debug" << endl;
#define pb push_back
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
    cin.tie(0);    
	ios::sync_with_stdio(false);
    int N;
    cin >> N;
    int dp[101][4][4][4] = {};

    //０文字の場合は後ろにくっつく文字は考えなくていいので
    //後々条件に抵触しない文字を適当に１つだけ固定して置いておく
    dp[0][3][3][3] = 1; 

    REP(len,N){
        REP(one,4){
            REP(two,4){
                REP(thr,4){
                      if(dp[len][thr][two][one] == 0) continue;
                    REP(newv,4){
                        

                        if(two == 0 && one == 1 && newv == 2) continue;
                        if(two == 1 && one == 0 && newv == 2) continue;
                        if(two == 0 && one == 2 && newv == 1) continue;
                        if(thr == 0 && one == 1 && newv == 2) continue;
                        if(thr == 0 && two == 1 && newv == 2) continue;

                        dp[len+1][two][one][newv] += dp[len][thr][two][one];
                        dp[len+1][two][one][newv] %= 1000000007;
                    }
                }
            }
        }
    }
    int ans = 0;

    REP(one,4){
        REP(two,4){
            REP(thr,4){
                ans += dp[N][thr][two][one];
                ans %= 1000000007;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int a, b;
    cin >> a >> b;
    int luku = -1;
    for(int i = b*10; i < b*10+10; i++){
        if((int)(i*0.08) == a && (int)(i*0.1) == b){
            luku = i;
            break;
        }
    }
    cout << luku;
}


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

#define rep(i,n) for(i=1;i<=n;i++)
#define Rep(i,n) for(i=0;i<n;i++)
#define For(i,a,b) for(i=a;i<=b;i++)

#define pb(x) push_back(x)
#define sz(x) x.size()

#define mem(ara,val) memset(ara,val,sizeof(ara))
#define eps 1e-9

#define si(x) scanf("%d",&x)
#define sii(x,y) scanf("%d %d",&x,&y)
#define siii(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define sl(x) scanf("%lld",&x)
#define sll(x,y) scanf("%lld %lld",&x,&y)
#define slll(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define ss(ch) scanf("%s",ch)
#define pi(x) printf("%d",x)
#define pii(x,y) printf("%d %d",x,y)
#define piii(x,y,z) printf("%d %d %d",x,y,z)
#define pl(x) printf("%lld",x)
#define pll(x,y) printf("%lld %lld",x,y)
#define plll(x,y,z) printf("%lld %lld %lld",x,y,z)
#define ps(ch) printf("%s",ch)
#define Afridi 0
#define NL printf("\n")
#define debug(x) printf("wow  %d !!\n",x)
#define Max 100005
#define INF (LL)1e15
#define mod 1000000007

#define FI freopen("in.txt","r",stdin)

#define D(x) /*cout << #x << " = " << x << endl*/
#define DD(x,y) /*cout << #x << " = " << x << "   " << #y << " = " << y << endl*/


typedef long long LL;
typedef unsigned long long ULL;

using namespace std;

LL bigmod(LL b,LL p)
{
    if(p == 0)return 1;
    LL my = bigmod(b,p/2);
    my*=my;my%=mod;
    if(p & 1)my*=b,my%=mod;
    return my;
}
LL setb(LL n,LL pos){return n=n | (1 << pos);}
LL resb(LL n,LL pos){return n=n & ~(1 << pos);}
bool checkb(LL n,LL pos){return (bool)(n & (1 << pos));}

LL n,ara[1000005],sum;

int main()
{
	//FI;
	LL i;
	sl(n);
	rep(i,n)sl(ara[i]),sum += ara[i];
	LL tot = 0,ret = (LL)1e18;
	rep(i,n-1)
	{
		tot += ara[i];
		LL baki = sum - tot;
		LL d = llabs(tot - baki);
		ret = min(ret,d);
	}
	pl(ret); NL;
	return 0;
}


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

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);
	int i,q;
	string a,b;
	cin>>a>>b;
	for (i=0;2*i<a.size()-1;i++){
		swap(a[i],a[a.size()-1-i]);
	}
	for (i=0;2*i<b.size()-1;i++){
		swap(b[i],b[b.size()-1-i]);
	}
	q=a.size()+b.size();
	for (i=0;i<q;i++){
		if (i%2==0){
			cout<<a[a.size()-1];
			a.pop_back();
		}
		else {
			cout<<b[b.size()-1];
			b.pop_back();
		}
	}
	return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef pair<ii, int> ri3;
#define mp make_pair
#define pb push_back
#define fi first
#define sc second
#define SZ(x) (int)(x).size()
#define ALL(x) begin(x), end(x) 
#define REP(i, n) for (int i = 0; i < n; ++i) 
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define RFOR(i, a, b) for (int i = a; i >= b; --i)

const int MX_N = 105;

int N;
vector<int> al[MX_N];
int d[MX_N], p[MX_N];

int bfs(vector<int> s) {
    queue<int> q;
    memset(d,-1,sizeof d);
    for (int u : s) d[u] = 0, q.push(u);
    int far = 1;
    while (!q.empty()) {
        int u = q.front(); q.pop();
        if (d[u]>d[far]) far = u;
        for (int v : al[u]) {
            if (d[v]==-1) p[v] = u, d[v] = d[u]+1, q.push(v);
        }
    }
    //cout<<"bfs :: " << far << endl;
    return far;
}

int main() {
    //freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> N;
    FOR(i,1,N-1){
        int a, b; cin >> a >> b;
        al[a].push_back(b);
        al[b].push_back(a);
    }

    int u = bfs({1}), v = bfs({u}), c;
    int dm = d[v];
    for (c = v; d[c] > (dm+1)/2; c = p[c]);
    //cout << c << endl;

    int maxi[N+1];
    if (d[v]&1) {
        bfs({c,p[c]});

        FOR(i,1,N) maxi[i] = 1;
        FOR(i,1,N) maxi[d[i]+1] = max(maxi[d[i]+1], SZ(al[i])-1);
        //FOR(i,1,N) cout << d[i]+1 << " :: " << SZ(al[i])-1 << endl;
        //FOR(i,1,N) cout << maxi[i] << ' ';
        //cout << endl;
        ll ans = 2;
        FOR(i,1,N) ans *= maxi[i];
        cout << dm/2 + 1 << " " << ans;
    } else {
        bfs({c});

        FOR(i,1,N) maxi[i] = 1;
        FOR(i,1,N) maxi[d[i]] = max(maxi[d[i]], SZ(al[i])-1);
        ll ans = SZ(al[c]);
        FOR(i,1,N) ans *= maxi[i];
        for (int v : al[c]) {
            bfs({c,v});

            FOR(i,1,N) maxi[i] = 1;
            FOR(i,1,N) maxi[d[i]+1] = max(maxi[d[i]+1], SZ(al[i])-1);
            ll cur = 2;
            FOR(i,1,N) cur *= maxi[i];
            ans = min(ans,cur);
        }
        cout << dm/2 + 1 << " " << ans;
    }
}



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

#define P 1000000007

using namespace std;

long a[2][100000];
long ab[3][100000];
long abc[4][100000];

long pow(long n, long m){
    int ans = 1;
    for(int i = 0; i < m; i++){
        ans = (ans*n)%P;
    }
    return ans;
}

int main(){
    string S;
    cin >> S;
    int Q = 0;
    for(int i = 0; i < S.size(); i++){
        if(S[i] == '?') Q++;
    }
    if(S[0] == 'A') a[0][0] = 1;
    if(S[0] == '?') a[1][0] = 1;
    for(int i = 1; i < S.size(); i++){
        for(int j = 0; j < 2; j++) a[j][i] = a[j][i-1];
        for(int j = 0; j < 3; j++) ab[j][i] = ab[j][i-1];
        for(int j = 0; j < 4; j++) abc[j][i] = abc[j][i-1];
        if(S[i] == 'A'){
            a[0][i] = (a[0][i-1]+1)%P;
        }
        if(S[i] == 'B'){
            ab[0][i] = (a[0][i-1] + ab[0][i-1])%P;
            ab[1][i] = (a[1][i-1] + ab[1][i-1])%P;
        }
        if(S[i] == 'C'){
            abc[0][i] = (ab[0][i-1] + abc[0][i-1])%P;
            abc[1][i] = (ab[1][i-1] + abc[1][i-1])%P;
            abc[2][i] = (ab[2][i-1] + abc[2][i-1])%P;
        }
        if(S[i] == '?'){
            for(int j = 1; j < 2; j++) a[j][i] = (a[j][i-1] + 1)%P;
            for(int j = 1; j < 3; j++) ab[j][i] = (ab[j][i-1] + a[j-1][i-1])%P;
            for(int j = 1; j < 4; j++) abc[j][i] = (abc[j][i-1] + ab[j-1][i-1])%P;
        }
    }
    long ans = 0;
    ans = (abc[0][S.size()-1]*pow(3, Q))%P + (abc[1][S.size()-1]*pow(3, Q-1))%P + (abc[2][S.size()-1]*pow(3, Q-2))%P + (abc[3][S.size()-1]*pow(3, Q-3))%P;
    ans = ans%P;
    
    cout << ans << endl;
}

Measured memory_bytes: 7488