akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;

const int MAXN = 2e5 + 5;

int n, ansA, leftover[MAXN];
vector<int> adj[MAXN];

int getA(int pos, int prev){
	int sum = 0;
	for(int i : adj[pos]) if(i != prev){
		sum += getA(i, pos);
	}
	if(prev != 0)
		sum += (adj[pos].size()-1)/2;
	else
		sum += (adj[pos].size()+1)/2;
	return sum;
}

bool possible(int pos, int prev, int b){
	vector<int> lens = {};
	// printf("Goto %d\n", pos);
	for(int i : adj[pos]) if(i != prev){
		if(!possible(i, pos, b))
			return false;
		lens.push_back(leftover[i]+1);
	}
	sort(lens.begin(), lens.end());
	// printf("Working with %d (%d)\n", pos, lens.size());
	multiset<int> vacant;
	for(int i = lens.size()-1; i >= 0; --i){
		// printf("(%d)", lens[i]);
		int comp = b-lens[i];
		auto lb = vacant.lower_bound(-comp);
		if(lb != vacant.end()){
			vacant.erase(lb);
		}else{
			vacant.insert(-lens[i]);
		}
	}
	// printf("\n");
	if(vacant.size() > 2)
		return false;
	else if(vacant.size() == 2){
		int u = -(*vacant.begin()); vacant.erase(vacant.begin());
		int v = -(*vacant.begin());
		if(pos != 1 && u <= b)
			leftover[pos] = v; // Case 2 : Cut one leftover, extend the other
		else
			return false;

	}else if(vacant.size() == 1){
		leftover[pos] = -(*vacant.begin());
	}else{
		leftover[pos] = 0;
	}
	return true;
}

bool cekB(int b){
	memset(leftover, 0, sizeof leftover);
	// printf("Ceking %d\n", b);
	return (possible(1, 0, b) && leftover[1] <= b);
}

int main(){
	scanf("%d", &n);
	for(int i = 0; i < n-1; ++i){
		int u, v;
		scanf("%d %d", &u, &v);
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	ansA = getA(1, 0);

	// TODO: Get B!
	int L = 1, R = n;
	while(L < R){
		int mid = (L+R)/2;
		if(cekB(mid)){
			R = mid;
		}else{
			L = mid+1;
		}
	}
	printf("%d %d\n", ansA, L);
}

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  int m = max(a, max(b, c));
  int cntM1 = 0;

  // 答えは m 以上
  // m の手前まで、まず増やす。
  int ans = 0;
  while (a + 2 <= m) {
    a += 2;
    ans++;
  }
  if (a == m - 1) cntM1++;
  while (b + 2 <= m) {
    b += 2;
    ans++;
  }
  if (b == m - 1) cntM1++;
  while (c + 2 <= m) {
    c += 2;
    ans++;
  }
  if (c == m - 1) cntM1++;

  // a,b,c は m または m-1 のはず。
  // m-1 が 0 個 -> ans
  // m-1 が 1 個 -> ans+2
  // m-1 が 2 個 -> ans+1
  // m-1 が 3 個 -> ありえない。(最小がmなので)
  if (cntM1 == 1)
    ans += 2;
  else if (cntM1 == 2)
    ans++;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
typedef long long ll;
ll MOD = 1e9+7;

using namespace std;

vector<int> num;
int cnt[100001];
int main()
{
	int n;
	int ans=0;
	
	cin>>n;
	num.push_back(1);
	for(int i=1;i<6;i++)
	{
		num.push_back((int)pow(9,i));
	}
	for(int i=1;i<7;i++)
	{
		num.push_back((int)pow(6,i));
	}
	sort(num.begin(),num.end());
	fill(cnt,cnt+100001,999999);
	cnt[0]=0;
	for(int i=0;i<30;i++)
	{
		for(int j=0;j<100001;j++)
		{
			if(cnt[j]==i)
			{
				for(int k=0;k<num.size();k++)
				{
					if(j+num[k]<100001)
						cnt[j+num[k]]=min(cnt[j+num[k]],i+1);
				}
			}
		}
	}
	
	cout<<cnt[n]<<endl;
	return 0;
}

Measured memory_bytes: 640
//前置き
#pragma region

#include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>

using namespace std;

typedef  long long ll;

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))

#define PRINT(str) printf(#str "\n")
#define yOUT PRINT(Yes)
#define nOUT PRINT(No)
#define YOUT PRINT(YES)
#define NOUT PRINT(NO)

#pragma endregion

//関数定義
#pragma region 
//偶数 ->　true :: 奇数　-> false
bool EVEN(ll a){
    return a%2-1;
}

//最大公約数
ll gcd(ll a, ll b) {  
    if (!b)  
        return a;  
    return gcd(b, a%b);  
}  

//最小公倍数
ll lcm(ll a, ll b) {  
    return a*b/gcd(a,b);  
} 

#pragma endregion

int main(){
    int n, m;
    cin >> n >> m;
    
    int s, e, inp1, inp2;
    cin >> s >> e;
    REP(i, m-1){
        cin >> inp1 >> inp2;
        s = max(s, inp1);
        e = min(e, inp2);   
    }

    if(e < s) cout << 0;
    else cout << e - s + 1;
    cout << endl;
}




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

namespace AtCoder
{
    class QuestionC
    {
        public static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            long n = int.Parse(input[0]);
            long m = int.Parse(input[1]);

            long result = 0;

            if(n == 1 && m == 1)
            {
                result = 1;
            }
            else if(m == 1 || n == 1)
            {
                result = Math.Max(n, m) - 2;
            }
            else
            {
                result = (n - 2L) * (m - 2L);
            }

            Console.WriteLine(result);
        }
    }
}


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

int main() {
  int A, B;
  string op;
  cin >> A >> op >> B;
  if ( op == "+" ) {
    cout << A + B << endl;
  }
  else if ( op == "-" ) {
    cout << A - B << endl;
  }
}

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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll n,m;
    cin >> n >> m;
    ll sum = 0;
    vector<ll> a(n);
    for(i = 0;i < n;++i){
        cin >> a.at(i);
        sum += a.at(i);
    }
    sort(all(a));
    ll tmp;
    if(sum%(4*m) == 0){
        tmp = sum/(4*m)-1;
    }else{
        tmp = sum/(4*m);
    }
    for(i = 0;i < m;++i){
        if(a.at(n-1-i) > tmp){
            continue;
        }else{
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
h, w = gets.split.map(&:to_i)
matrix = h.times.map{ gets.chomp.chars }

loop do
  x = (0...h).find do |i|
    matrix[i].all?{|cell| cell == '.'}
  end
  unless x.nil?
    matrix.delete_at(x)
    h -= 1
    next
  end

  y = (0...w).find do |j|
    (0...h).all?{|i| matrix[i][j] == '.'}
  end
  unless y.nil?
    (0...h).each{|i| matrix[i].delete_at(y)}
    w -= 1
    next
  end
  break
end

matrix.each{|row| puts row.join}

Measured memory_bytes: 2684
program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils,Classes;
var
  h,w,i,j,count,x,y,sw,m,n,c:Integer;
  a,b,r:array of integer;
  s123,s1,s2,s3:string;
  tf:Boolean;
  nyu:TStringList;
begin
  try
    { TODO -oUser -cConsole Main : ここにコードを記述してください }
    Read(n);
    Readln(m);
    //SetLength(a,m);
    //SetLength(b,m);
    SetLength(r,51);
    for i := 0 to m - 1 do begin
      Read(x);
      inc(r[x]);
      Readln(x);
      inc(r[x]);
    end;

    for i := 1 to n do
      Writeln(r[i]);
    Readln;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <cmath>
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; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>func(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p;
}

int main(){
  int N,M;
  cin>>N>>M;
  vector<bool>ok(N,false);
  vector<int>wa(N);
  int W=0,A=0;
  for(int i=0;i<M;i++){
    int p;
    string s;
    cin>>p>>s;
    if(ok[p]){continue;}
    if(s=="AC"){A++;W+=wa[p];ok[p]=true;}
    else{wa[p]++;}
  }
  cout<<A<<" "<<W<<endl;
  return 0;
}

Measured memory_bytes: 3744
#include <iostream>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
using namespace std;
using namespace __gnu_pbds;

ll int mod=(ll int)1e9+7;
typedef tree<pair<long long int,long long int>,null_type,less<pair<long long int,long long int> >,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

void go()
{
    ll int s;
    cin>>s;
    vector<ll int > dp(2001,0);
    dp[0]=1;
    for(int sum=3;sum<=2000;sum++)
    {
        for(int num=sum;num>=3;num--)
        {
            dp[sum]+=dp[sum-num],dp[sum]%=mod;
        }
    }
    cout<<dp[s];
}
int main()
{
    FIO;
//    int t;
//    cin>>t;
//    while(t--)
        go();
    return 0;
}

/*
        x1 y1
        x2 y2
        x3 y3
*/


Measured memory_bytes: 3668
H, W = map(int, input().split())
S = []
for _ in range(H):
    S.append(input())

row = [[0] * W for _ in range(H)]
line = [[0] * W for _ in range(H)]
ans = 0

for i in range(H):
    for j in range(W):
        if S[i][j] == '.':
            if i != 0:
                if row[i-1][j] != 0:
                    row[i][j] = row[i-1][j]
                    continue
            c = 1
            if i+c == H:
                row[i][j] = c
                continue
            while S[i+c][j] == '.':
                c += 1
                if i+c == H:
                    break
            row[i][j] = c

for i in range(H):
    for j in range(W):
        if S[i][j] == '.':
            if j != 0:
                if line[i][j-1] != 0:
                    line[i][j] = line[i][j-1]
                    ans = max(ans, row[i][j]+line[i][j]-1)
                    continue
            c = 1
            if j+c == W:
                line[i][j] = c
                ans = max(ans, row[i][j]+line[i][j]-1)
                continue
            while S[i][j+c] == '.':
                c += 1
                if j+c == W:
                    break
            line[i][j] = c
            ans = max(ans, row[i][j]+line[i][j]-1)


print(ans)


Measured memory_bytes: 125272
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoderCs
{

    class Program
    {

        const int Mod = 1000000007;

        static void Main()
        {

            var arg = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

            Console.WriteLine((arg[0] <= arg[1] ? "unsafe" : "safe"));
            
        }


    }
}


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

ans = []
lst = []
n = N

while n > 26:
    x = n%26
    if x == 0:
        n = n//26 - 1
    else:
        n = n//26
    lst.append(x)


for i in range(len(lst)):
    x = lst[i]
    if x == 0:
        y = chr(97+25)
    else:
        y = chr(97 + x-1)
    ans.append(y)

ans.append(chr(97 + n-1))

ans = ans[::-1]

ans = ''.join(ans)
print(ans)


Measured memory_bytes: 9184
#include <bits/stdc++.h>
#define r1(i, n) for (int i=0;i<n;i++)
#define r2(i, n) for (int i=1;i<n;i++)
#define intc(n) int n; cin >> n;
#define ll long long
#define llc(n) ll n; cin >> n;
using namespace std;
int main() {
  unsigned ll n,k;
  cin >> n >> k;
  n=n%k;
  n=min(k-n,n);
  cout << n << endl;
}


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

using namespace std;

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

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

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

int main()
{
	ll n,a,b,c,d,e;
	cin>>n>>a>>b>>c>>d>>e;
	ll x=min({a,b,c,d,e});
	cout<<(n+x-1)/x+4<<endl;

	return 0;
}

Measured memory_bytes: 256
N,K,Q=map(int,input().split())
A=[]
for _ in range(Q):
    A.append(int(input()))
ans=[0]*N
for i in range(Q):
    ans[A[i]-1]+=1
for j in range(N):
    if Q-K<ans[j]:
        print("Yes")
    else:
        print("No")

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

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

long long MOD = 1000000000 + 7;

vector<ll> ans;

void solve(pair<pair<int,int>, int> v){
  int start = v.second;
  int r = v.first.first;
  int l = v.first.second;

  int center_r = start + r - 1;
  int center_l = center_r + 1;

  int odd_r, even_r;
  int odd_l, even_l;

  if(r %2 == 0){
    odd_r = r / 2;
    even_r = r / 2;

    ans[center_r] += odd_r;
    ans[center_l] += even_r;

  } else {
    if(center_r %2 != 0){
      odd_r = r/2 + 1;
      even_r = r/2;
      ans[center_r] += odd_r;
      ans[center_l] += even_r;
    } else {
      odd_r = r/2;
      even_r = r/2 + 1;
      ans[center_r] += even_r;
      ans[center_l] += odd_r;
    }
  }

  if(l %2 == 0){
    odd_l = l / 2;
    even_l = l / 2;
    ans[center_r] += even_l;
    ans[center_l] += odd_l;
  } else {
    if(center_l %2 != 0){
      odd_l = l/2 + 1;
      even_l = l/2;
      ans[center_r] += even_l;
      ans[center_l] += odd_l;
    } else {
      odd_l = l/2;
      even_l = l/2 + 1;
      ans[center_r] += odd_l;
      ans[center_l] += even_l;
    }
  }
}

int main(){
  cout << setprecision(10);
  vector<pair<pair<int,int>, int>> v;
  string S;
  cin >> S;
  ans.assign(S.size(), 0);

  S += "R";

  int r = 1;
  int l = 0;
  int start = 0;

  for(int i = 1; i < S.size(); i++){
    if(S[i] == 'R' && l > 0){
      v.push_back(make_pair(make_pair(r,l), start));
      r = 1;
      l = 0;
      start = i;
    } else if(S[i] == 'R'){
      r++;
    } else {
      l++;
    }
  }
  
  for(int i = 0; i < v.size(); i++){
    // cerr << "r: " << v[i].first.first << " l: " << v[i].first.second << " start: " << v[i].second << endl;
    solve(v[i]);
  }


  for(int i = 0; i < ans.size(); i++){
    if(i == ans.size()-1){
      cout << ans[i] << endl;
    } else {
      cout << ans[i] << " ";
    }
  }

}


Measured memory_bytes: 2108
#[macro_use]
mod input {

use std;
use std::io;

const SPLIT_DELIMITER: char = ' ';

#[macro_export]
#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
pub fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
pub fn p<T>(t: T)
where
    T: std::fmt::Display,
{
    println!("{}", t);
}

#[allow(dead_code)]
pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut v: Vec<Vec<T>> = Vec::new();

    for _ in 0..line {
        let vec_line = input_vector();
        v.push(vec_line);
    }
    v
}

#[allow(dead_code)]
pub fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

#[allow(dead_code)]
pub fn str2vec(s: &str) -> Vec<char> {
    let mut v: Vec<char> = Vec::new();
    for c in s.chars() {
        v.push(c);
    }
    v
}

}

use input::*;

fn main() {
    let (a, b): (usize, usize);
    input!(a, b);
    if a + b >= 10 {
        println!("error");
    } else {
        p(a + b);
    }
}

Measured memory_bytes: 4352
n=int(input())
p1=[float(0),float(0)]
p2=[float(100),float(0)]
cos=0.5
sin=0.866025404
def koh(d,p1,p2):
    if d==0:return True
    sx = (2 * p1[0] + p2[0]) / 3
    sy = (2 * p1[1] + p2[1]) / 3
    tx = (p1[0] + 2 * p2[0]) / 3
    ty = (p1[1] + 2 * p2[1]) / 3
    ux=(tx-sx)*cos-(ty-sy)*sin+sx
    uy=(tx-sx)*sin+(ty-sy)*cos+sy

    koh(d-1,p1,[sx,sy])
    print(sx, sy)
    koh(d-1,[sx,sy],[ux,uy])
    print(ux, uy)
    koh(d-1,[ux,uy],[tx,ty])
    print(tx,ty)
    koh(d-1,[tx,ty],p2)
print(p1[0],p1[1])
koh(n,p1,p2)
print(p2[0],p2[1])


Measured memory_bytes: 5704
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
int N,M;
vector<P> graph[200010];
vector<int> dist;
bool dfs(int now, int d){
    //cout << " " << now << endl;
    dist[now] = d;
    for(auto p:graph[now]){
        if(dist[p.first] != INF){
            if(dist[p.first] != d + p.second)return true;
            continue;
        }
        if(dfs(p.first, d + p.second))return true;
    }
    return false;
}
main(){ 
    cin >> N >> M;
    int num = 0;
    rep(i,0,M){
        int a,b,c;
        cin >> a >> b >> c;
        a--,b--;
        graph[a].emplace_back(b,c);
        graph[b].emplace_back(a,-c);
        num = a;
    }
    dist = vector<int>(N,INF);
    rep(i,0,N){
        int cost = dist[i];
        if(cost == INF)cost = 0;
        if(dist[i] == INF && dfs(i, 0) ){
            cout << "No" << endl;
            //cout << i << endl;
            return 0;
        }
        //for(auto i:dist)cout << i << " ";cout << endl;
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 13440
#include<iostream>
#include<string.h>

#define S 128

int run(){
	char A[S], B[S];
	const char *res[3] = {"GREATER", "LESS", "EQUAL"};
	int re = 2;
	std::cin >> A >> B;
	if( strlen(A) > strlen(B) ){
		re = 0;
	}else if( strlen(A) < strlen(B) ){
		re = 1;
	}else{
		re = 2;
		for( int i = 0; A[i] != '\0'; i++ ){
			if( A[i] > B[i] ){
				re = 0;
				break;
			}else if( A[i] < B[i] ){
				re = 1;
				break;
			}
		}
	}
	std::cout << res[re] << std::endl;
	return 0;
}

int main(){
	run();
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#include<queue>

using namespace std;

typedef long long ll;

typedef std::pair<int, int> ipair;
bool lessPair(const ipair& l, const ipair& r){return l.second < r.second;}
bool morePair(const ipair& l, const ipair& r){return l.second > r.second;}

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

const ll MOD = 1e9 + 7;
// const long long INF = 1LL<<60;
void add(long long &a, long long b) { a += b; if (a >= MOD) a -= MOD; }
void sub(long long &a, long long b) { a -= b; if (a < 0) a += MOD; }
void mul(long long &a, long long b) { a *= b; a %= MOD; }
ll llmin(ll a, ll b) { if (a < b) return a; else return b; }
ll llmax(ll a, ll b) { if (a < b) return b; else return a; }
ll llabs(ll a) { if (a >= 0) return a; else return - a; }
ll llmodpow(ll a, ll n) {
   if (n == 0) return 1;
   ll tmp = llmodpow(a, n / 2);
   mul(tmp, tmp);
   if (n & 1) mul(tmp, a);
   return tmp;
}

int main() {
   ll N;
   cin >> N;
   
   int ans = 10;
   for (ll i = 1; i * i <= N; i++) {
      if (N % i != 0) continue;
      string tmp1 = to_string((int)i);
      string tmp2 = to_string((int)(N / i));
      chmin(ans, max((int)tmp1.size(), (int)tmp2.size()));
   }
   cout << ans << endl;
   return 0;
}


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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < n; i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

#define MAX_N 100010

ll GCD(ll a, ll b) {
    if (a <= 0 || b <= 0) {
        return -1;
    }
    if (a > b) {
        if (a % b == 0) {
            return b;
        } else {
            GCD(b, a % b);
        }
    } else if (a < b) {
        if (b % a == 0) {
            return a;
        } else {
            GCD(a, b % a);
        }
    } else {
        return a;
    }
}

bool IsPrime(int n) {
    for (ll i = 2; i*i <= n; i++) {
        if (n%i == 0) {
            return false;
        }
    }
    return n != 1;
}

ll prime[MAX_N];
bool is_prime[MAX_N+1];
ll sieve(ll n) {
    ll p = 0;
    rep (i, n+1) {
        is_prime[i] = true;
    }
    is_prime[0] = is_prime[1] = false;
    for (ll i = 2; i <= n; i++) {
        if (is_prime[i]) {
            prime[p++] = i;
            for (ll j = 2*i; j <= n; j += i) {
                is_prime[j] = false;
            }
        }
    }
    return p;
}

vector<ll> Divisor(int n) {
    vector<ll> res;
    for (ll i = 1; i*i <= n; i++) {
        if (n%i == 0) {
            res.push_back(i);
            if (i != n/i) {
                res.push_back(n/i);
            }
        }
    }
    sort(res.begin(), res.end());
    return res;
}

/*
map<ll, ll> PrimeFactor(int n) {
    map<ll, ll> res;
    for (ll i = 2; i*i <= n; i++) {
        while (n%i == 0) {
            ++res[i];
            n /= i;
        }
    }
    if (n != 1) {
        res[n] = 1;
    } else {
        return res;
    }
}
*/

vector<Pll> PrimeFactor(ll n) {
    vector<Pll> res;
    for (ll i = 2; i*i <= n; i++) {
        if (n%i) {
            continue;
        }
        res.emplace_back(i, 0);
        while (n%i == 0) {
            n /= i;
            res.back().second++;
        }
    }
    if (n != 1) {
        res.emplace_back(n, 1);
    }
    return res;
}

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

    ll A, B;
    cin >> A >> B;

    cout << PrimeFactor(GCD(A, B)).size()+1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <cmath>

using namespace std;
const static int STEP_NUM = 30;

int main() {
  int dp[ STEP_NUM + 1 ];
  dp[ 0 ] = 1;
  dp[ 1 ] = 1;
  dp[ 2 ] = 1 + dp[ 1 ];
  for( int i = 3; i <= STEP_NUM; i++ ) {
    dp[ i ] = dp[ i - 3 ] + dp[ i - 2 ] + dp[ i - 1 ];
  }
  while( true ) {
    int n;
    cin >> n;
    if( !n ) { return EXIT_SUCCESS; }
    cout << ceil( dp[ n ] / 3650.0 ) << endl;
  }

}

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

const long mod = 1e9+7;

long modpow(long a, long b){
	long res = 1;
	while (b > 0){
		if (b & 1) res = res * a % mod;
		a = a * a % mod;
		b /= 2;
	}
	return res;
}

long comb(long a,long b){
	if(a<=0 || b<=0)return 1;
	long x = 1, y = 1;
	for (int i = 1; i <= b; i++){
		x = x * (a - i + 1) % mod;
		y = y * i % mod;
  }
  return x * modpow(y, mod - 2) % mod;
}

int main(){
	long N, A, B;
	cin >> N >> A >> B;
	long ans = modpow(2, N);
	ans--;
	ans += mod - comb(N, A);
	ans %=mod;
	ans += mod - comb(N, B);
	ans %= mod;
	cout << ans << endl;
}

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

int gcd(int a, int b){
    int t;
    if( a < b ){
        t = a;
        a = b;
        b = t;
    }
    while(1){
        t = a%b;
        if(t == 0) return b;
        a = b; b = t; 
    }
    return -1;
}

int main(){
    int a,b;
    cin >> a >> b;
    cout << gcd(a, b) << endl;
    return 0;
}

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

// region template
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

ll gcd(ll a, ll b) { return __gcd(a, b); }

ll euclid(ll a, ll b, ll &x, ll &y) {
    if (b) { ll d = euclid(b, a % b, y, x);
        return y -= a/b * x, d; }
    return x = 1, y = 0, a;
}

typedef unsigned long long ull;
typedef long double ld;
ull mod_mul(ull a, ull b, ull M) {
    ll ret = a * b - M * ull(ld(a) * ld(b) / ld(M));
    return ret + M * (ret < 0) - M * (ret >= (ll)M);
}
ull mod_pow(ull b, ull e, ull mod) {
    ull ans = 1;
    for (; e; b = mod_mul(b, b, mod), e /= 2)
        if (e & 1) ans = mod_mul(ans, b, mod);
    return ans;
}

const ll mod = 1000000007;
struct Mod {
    ll x;
    Mod(ll xx) : x(xx) {}
    Mod operator+(Mod b) { return Mod((x + b.x) % mod); }
    Mod operator-(Mod b) { return Mod((x - b.x) % mod); }
    Mod operator*(Mod b) { return Mod((x * b.x) % mod); }
    Mod operator/(Mod b) { return *this * invert(b); }
    Mod invert(Mod a) {
        ll x, y, g = euclid(a.x, mod, x, y);
        assert(g == 1); return Mod((x + mod) % mod);
    }
    Mod operator^(ll e) {
        if (!e) return Mod(1);
        Mod r = *this ^ (e / 2); r = r * r;
        return e & 1 ? *this * r : r;
    }
};
// endregion

const int N = 0, E = 1, S = 2, W = 3;

int dcw(int x) { return (x + 1) % 4; }
int dccw(int x) { return (x + 3) % 4; }

int main() {
    int ans = 0;
    string s; cin >> s;
    int dir = 0;
    int cn = 0, ce = 0, cs = 0, cw = 0;
    for (char c : s) {
        if (c == 'R') {
            dir = dcw(dir);
            if (dir == N) cn++;
            if (dir == E) ce++;
            if (dir == S) cs++;
            if (dir == W) cw++;
            if (dir == N && cn && ce && cs && cw) {
                cn = ce = cs = cw = 0;
                ans++;
            }
        } else if (c == 'L') {
            dir = dccw(dir);
            if (dir == N) {
                cn = ce = cs = cw = 0;
            }
        }
    }
    cout << ans << endl;
}


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

int main(){
  string N;
  cin >> N;
  if((N.at(0)=='9')||(N.at(1)=='9')){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
	int a,c,d;
	cin>>a;
	c=a%10;
	d=a/100;
	if(c==d)
	{
		cout<<"Yes"<<endl;
	}
	else cout<<"No"<<endl;
}

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define DBG(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define DBG(...)
#endif

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

using ll = long long;

using namespace std;

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

  int digits = 0;
  while (N > 0) {
    N /= K;
    ++digits;
  }
  cout << digits << endl;
}


Measured memory_bytes: 256
import sys
from operator import itemgetter

rl = sys.stdin.readline


def solve():
    N, W = map(int, rl().split())
    w1, w2, w3, w4 = [[0, 0]], [[0, 0]], [[0, 0]], [[0, 0]]
    w1.append(list(map(int, rl().split())))
    min_w = w1[1][0]
    for _ in range(N - 1):
        w, v = map(int, rl().split())
        d = w - min_w
        if d == 0:
            w1.append([w, v])
        elif d == 1:
            w2.append([w, v])
        elif d == 2:
            w3.append([w, v])
        else:
            w4.append([w, v])
    w1.sort(key=itemgetter(1), reverse=True)
    w2.sort(key=itemgetter(1), reverse=True)
    w3.sort(key=itemgetter(1), reverse=True)
    w4.sort(key=itemgetter(1), reverse=True)
    
    ans = 0
    for i in range(len(w1)):
        w_tmp1, v_tmp1 = 0, 0
        for j in range(i):
            w_tmp1 += w1[j][0]
            v_tmp1 += w1[j][1]
        for j in range(len(w2)):
            w_tmp2, v_tmp2 = w_tmp1, v_tmp1
            for k in range(j):
                w_tmp2 += w2[k][0]
                v_tmp2 += w2[k][1]
            for k in range(len(w3)):
                w_tmp3, v_tmp3 = w_tmp2, v_tmp2
                for l in range(k):
                    w_tmp3 += w3[l][0]
                    v_tmp3 += w3[l][1]
                for l in range(len(w4)):
                    w_tmp4, v_tmp4 = w_tmp3, v_tmp3
                    for m in range(l):
                        w_tmp4 += w4[m][0]
                        v_tmp4 += w4[m][1]
                    if w_tmp4 <= W:
                        ans = max(ans, v_tmp4)
    print(ans)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 44268
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
from collections import deque, Counter, defaultdict
def getN():
    return int(input())
def getList():
    return list(map(int, input().split()))
import math
import bisect
from logging import getLogger, StreamHandler, DEBUG, WARNING
logger = getLogger(__name__)
handler = StreamHandler()
handler.setLevel(DEBUG)
logger.setLevel(DEBUG)
# handler.setLevel(WARNING)
# logger.setLevel(WARNING)
logger.addHandler(handler)
def main():
    n, k = getList()
    nums = getList()
    acc = [0]
    tmp = 0
    for num in nums:
        tmp += num - 1
        tmp %= k
        acc.append(tmp)
    ans = 0
    df = {}
    for i in range(n + 1):
        if not acc[i] in df:
            df[acc[i]] = 1
        else:
            df[acc[i]] += 1
        ans += (df[acc[i]] - 1)
        if i >= k-1:
            df[acc[i-k+1]] -= 1



    print(ans)
    # print(acc)
if __name__ == "__main__":
    main()

Measured memory_bytes: 109052
name1, a1, b1 = map(str, input().split())
name2, a2, b2 = map(str, input().split())
name3, a3, b3 = map(str, input().split())
name4, a4, b4 = map(str, input().split())
name5, a5, b5 = map(str, input().split())
name6, a6, b6 = map(str, input().split())
name7, a7, b7 = map(str, input().split())
name8, a8, b8 = map(str, input().split())
name9, a9, b9 = map(str, input().split())

print(name1, int(a1)+int(b1), 200*int(a1)+300*int(b1))
print(name2, int(a2)+int(b2), 200*int(a2)+300*int(b2))
print(name3, int(a3)+int(b3), 200*int(a3)+300*int(b3))
print(name4, int(a4)+int(b4), 200*int(a4)+300*int(b4))
print(name5, int(a5)+int(b5), 200*int(a5)+300*int(b5))
print(name6, int(a6)+int(b6), 200*int(a6)+300*int(b6))
print(name7, int(a7)+int(b7), 200*int(a7)+300*int(b7))
print(name8, int(a8)+int(b8), 200*int(a8)+300*int(b8))
print(name9, int(a9)+int(b9), 200*int(a9)+300*int(b9))


Measured memory_bytes: 5604
import copy
n = int(input())
a = [int(input()) for i in range(n)]
b = copy.deepcopy(a)
b.sort()
amax = b[-1]
amax2 = b[-2]
for i in range(n):
    if a[i] != amax:
        print(amax)
    elif a[i] == amax:
        print(amax2)
    

Measured memory_bytes: 14568
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl
#define show2(a, n, m) rep(i, n) { rep(j, m) {cout << a[i][j] << ' ';} cout << endl;} 
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a = max(a, b)

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<long long, long long> pll;
typedef long double ld;

const int INF = 1 << 30;
const long long INFL = 1LL << 60;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100010;

int main() {
//	cout << fixed << setprecision(15);
	int n, m, q;
	cin >> n >> m >> q;
	vector<vi> d(n+1, vi(n+1));
	rep(i, m) {
		int l, r;
		cin >> l >> r;
		d[l][r]++;
	}
	rep(i, n) rep(j, n) d[i+1][j+1] += d[i+1][j];
	rep(i, n) rep(j, n) d[i+1][j+1] += d[i][j+1];
	vi ans;
	rep(i, q) {
		int l, r;
		cin >> l >> r;
		ans.push_back(d[r][r] + d[l-1][l-1] - d[r][l-1] - d[l-1][r]);
	}
	for(auto i: ans) cout << i << endl;
}


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


ll ll_pow(long long x, long long n) {
    long long ret = 1;
    while (n > 0) {
        if (n & 1) ret = ret * x % MOD;  // n の最下位bitが 1 ならば x^(2^i) をかける
        x = x * x % MOD;
        n >>= 1;  // n を1bit 左にずらす
    }
    return ret;
}


int main() 
{
  ll N; cin>>N;
  ll judge=1;
  int k;
  for(int i=1;;i++)
  {
    judge*=26;
    if(N>judge)
    {
      N-=judge;
      continue;
    }
    k=i; 
    break;
  }
  N--;
  //cout<<N<<" "<<k<<endl;
  
  string ans="";
  rep(i,k)
  {
    ans+=char(N%26+'a');
    N/=26;
  }
  reverse(ans.begin(),ans.end());
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
int main(){
  int N;
  cin >> N;
  int odd = 0;
  for(int i=0;i<N;i++){
    int l;
    cin >> l;
    if(l%2==1) odd++;
  }
  if(odd%2==0) cout << "YES" <<endl;
  else cout << "NO" <<endl;

  return 0;
}

Measured memory_bytes: 256
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.container;
import std.datetime;

void main()
{
	while (1) {
		auto x = readln.chomp.split.map!(to!int);
		if (!x[0]) break;
	
		bool f[21];	 
		int cnt;

		void solve(int s, int sum, int c) {
			if (c == x[1]) {
				if (sum == x[2]) cnt++;
			}
			foreach (i; s..x[0]+1) {
				if (f[i]) continue;
				f[i] = 1;
				solve(i, sum + i, c + 1);
				f[i] = 0;
			}
		}

		solve(1, 0, 0);
		cnt.writeln;
	}
}

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

#define all(v) (v).begin(), (v).end()
#define sortv(v) sort(all(v))
#define uniqv(v) (v).erase(unique(all(v)), (v).end())
#define pb push_back
#define FI first
#define SE second
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define test 1
#define TEST if(test)

using namespace std;

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

const int MOD = 1000000007; // 998244353
const int INF = 2e9;
const ll INFLL = 1e18;
const int MAX_N = 1;

int N, M;

int main(){
	cin>>N>>M;
	if(N==M){
		cout<<"Yes"<<endl;
	}	else{
		cout<<"No"<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#C 解3
S = input()
n = len(S) - 1 # 間の数
Sum = 0
for i in range(2**n):
    #print('%05d' % i)#
    pl = ''
    for j in range(n):
        pl += S[j]
        #print(j)#
        if format(i,'0'+str(n)+'b')[j]=='1': pl += '+' 
    pl += S[n]
    #print(pl,end=',')#
    Sum += sum([int(x) for x in pl.split('+')])
print(Sum)

Measured memory_bytes: 3188
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<set>
#include<queue>
using namespace std;

typedef long long ll;

int main() {
  string s = "MARCH";
  ll c[5] = {0};
  int N; cin >> N;
  for ( int i = 0; i < N; i++ ) {
    string t;
    cin >> t;
    for ( int j = 0; j < 5; j++ ) {
      if( t[0] == s[j] ) c[j]++;
    }
  }
  ll ans = 0;
  for ( int i = 0; i < 5; i++ ) {
    for (int j = i + 1; j < 5; j++ ) {
      for ( int k = j + 1; k < 5; k++ ) {
	ans += c[i] * c[j] * c[k];
      }
    }
  }
  cout << ans << endl;
  return 0;
}


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

#define FOR(i,m,n) for(int i=(m); i<(n); ++i)
typedef vector<int> vi;
typedef pair<int,int> P;
typedef vector<P> vp;
inline int in() { int x; cin >> x; return x; }
const int INF = 1001001001;
#define chmin(x,y) x = min(x,y)

void solve() {
  int h = in(), n = in();
  vi v(h, INF); v[0] = 0;
  vi a(n), b(n); FOR(i,0,n) a[i] = in(), b[i] = in();
  int ans = INF;
  FOR(i,0,h) {
    FOR(j,0,n) {
      int idx = i + a[j];
      chmin((idx>=h ? ans : v[idx]), v[i]+b[j]);
    }
  }
  cout << ans << endl;
}

#undef int
int main() {
  solve();
  return 0;
}


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

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


Measured memory_bytes: 3612
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<queue>
using namespace std;
inline int read(){
	int x=0,f=1;char ch;
	do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');
	do{x=x*10+ch-'0';ch=getchar();}while(ch>='0'&&ch<='9');
	return x*f;
}
const int N=210;
const int INF=0x3f3f3f3f;
struct Node{
	int x,y;
}a[N],b[N];
bool operator<(const Node t1,const Node t2){
	return t1.x<t2.x&&t1.y<t2.y;
}
struct node{
	int u,v,cap,next;
}edge[N*N];
int last[N],cur[N],le;
void cl(){
	memset(last,0,sizeof(last));
	le=1;
}
void add(int u,int v,int cap){
	edge[++le].u=u,edge[le].v=v,edge[le].cap=cap,edge[le].next=last[u],last[u]=le;
	edge[++le].u=v,edge[le].v=u,edge[le].cap=0,edge[le].next=last[v],last[v]=le;
}
int s,t;
int d[N];
queue<int> q;
bool bfs(){
	q.push(s);
	memset(d,0,sizeof(d));
	d[s]=1;
	while (!q.empty()){
		int u=q.front();q.pop();
		for (int i=last[u];i;i=edge[i].next){
			int v=edge[i].v;
			if (!d[v]&&edge[i].cap){
				d[v]=d[u]+1;
				q.push(v);
			}
		}
	}
	return d[t];
}
int dfs(int u,int a){
	if (u==t||!a) return a;
	int flow=0;
	for (int &i=cur[u];i;i=edge[i].next){
		int v=edge[i].v;
		if (d[v]==d[u]+1){
			int f=dfs(v,min(a,edge[i].cap));
			if (f){
				edge[i].cap-=f,edge[i^1].cap+=f;
				flow+=f,a-=f;if (!a) break;
			}
		}
	}
	return flow;
}
int dinic(){
	int flow=0;
	while (bfs()){
		for (int i=1;i<=t;++i) cur[i]=last[i];
		flow+=dfs(s,INF);
	}
	return flow;
}
int main(){
	int n=read();
	cl();
	for (int i=1;i<=n;++i) a[i].x=read(),a[i].y=read();
	for (int i=1;i<=n;++i) b[i].x=read(),b[i].y=read();
	s=n<<1|1,t=s+1;
	for (int i=1;i<=n;++i){
		add(s,i,1);
		add(n+i,t,1);
		for (int j=1;j<=n;++j)
		if (a[i]<b[j]) add(i,n+j,1);
	}
	printf("%d\n",dinic());
	return 0;
}

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

#define mem(arr,x) memset(arr,x,sizeof(arr))
#define pb push_back
#define ll long long
#define mp make_pair
#define rep(i,n)  for(ll i=0;i<n;i++)
#define repi(i,n)  for(ll i=1;i<=n;i++)
#define all(x)   (x.begin(),x.end())

int max(int a,int b)
{
	if(a>b)
	return a;
	return b;
}
 

int main()
{
	
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
ll n;
cin>>n;
int a[n];
rep(i,n)
cin>>a[i];
ll ans=0;
rep(i,n-1)
{
	if(a[i]>a[i+1])
	{
		ans+=a[i]-a[i+1];
		a[i+1]=a[i];
	}
}
cout<<ans<<"\n";

	
	
}


Measured memory_bytes: 4360
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;

class Main{

    public static void main(String args[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] stringArray = br.readLine().split("\\s"); 
        
        Stack<Integer> st = new Stack<Integer>();
        int a = 0,b=0;
        
        for (int i = 0; i < stringArray.length; i++) {
            if (stringArray[i].equals("+")) {
                a = st.pop();
                b = st.pop();
                st.add(b + a);
                continue;
            }
            if (stringArray[i].equals("-")) {
                a = st.pop();
                b = st.pop();
                st.add(b - a);
                continue;
            }
            if (stringArray[i].equals("*")) {
                a = st.pop();
                b = st.pop();
                st.add(b * a);
                continue;
            }
            if (stringArray[i].equals("/")) {
                a = st.pop();
                b = st.pop();
                st.add(b / a);
                continue;
            }
           
            st.push(Integer.parseInt(stringArray[i]));
        }
        System.out.println(st.pop());
    }
}

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

using namespace std;

int main(){

    int a,b,p;

    cin >> a >> b;
    p=a*b;

    if(p%2 == 0){
        cout << "Even\n";
    }
    else{
        cout << "Odd\n";
    }

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>

int main()
{
    long long N;
    scanf("%lld", &N);
    long long sum = 0;
    long long maxi = sqrt(N);
    for(long long i=1; i<=maxi; i++){
        if(N % i == 0){
            long long m = N / i - 1;
            if(i < m) sum += m;
        }
    }
    printf("%lld\n", sum);
}


Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<string.h>
#include<stdio.h>
using namespace std;
int a[10010]={0};
int b[10010]={0};
int ans=1001,w;
void kotani(int i,int j,int c,int n);
int main(){
	while(1){
	int n;
	scanf("%d",&n);
		w=n;
		ans=n;
		if(n==0)break;
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	for(int i=0;i<n;i++){
		for(int j=1;j<=3;j++){
			memcpy(b,a,sizeof(int) *n);
			if(b[i]!=j){
				b[i]=j;
				kotani(0,1,1,n);
			}
		}
	}
	printf("%d\n",ans);
	}
}
void kotani(int i,int j,int c,int n){
	if(b[i]==b[j]&&j<n){
		kotani(i,j+1,c+1,n);
	}
	else{
		if(c>=4){
			int u=0;
			for(int z=j;z<n;z++){
				b[i+u]=b[z];
				u++;
			}
			ans=min(ans,n-c);
			kotani(0,1,1,n-c);
		}
		else if(i+1<n){
			kotani(i+1,i+2,1,n);
		}
	}
}

Measured memory_bytes: 3312
//good luck
# include <iostream>
# include <cstdio>
# include <cmath>
# include <cstdlib>
# include <cstring>
# include <string>
# include <algorithm>
# include <vector>
# include <queue>
# include <ctime>
# include <map>

#define LL long long
#define maxn (int)1e5+5
#define inf  (int)2147483640
#define is(a) (a>='0'&&a<='9')
#define iabs(a) ((a)>0?(a):(-a))
#define imax(a,b) ((a)>(b)?(a):(b))
#define imin(a,b) ((a)<(b)?(a):(b))
 
using namespace std;

int N;

string st;

inline void read(int &x)
{
  x=0;bool f=0;char ch=getchar();
  for (;!is(ch);ch=getchar()) f|=ch=='-';
  for (;is(ch);ch=getchar()) x=(x<<3)+(x<<1)+(ch^48);
  x=f?-x:x;
}

int main()
{
	read(N); cin >> st;
	if (N < 3200) printf("red\n");
	else cout << st;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#define maxn 100005
using namespace std;
int n;
int main()
{
	int ans=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		int x,k;
		scanf("%d%d",&x,&k);
		while(x%k)
		{
			x-=(x/k+1)*((x%k-1)/(x/k+1)+1);
		}
		ans^=(x/k);
	}
	if(ans)
		printf("Takahashi\n");
	else
		printf("Aoki\n");
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int num = 0;

        if(a>b){
            System.out.println(0);
        }else if(a*c<=b){
            System.out.println(c);
        }else if(a*c>b){
            System.out.println(b/a);
        }
        

        
    }

}


Measured memory_bytes: 23764
#include<iostream>
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b>>c;
if(a==b and b==c)
cout<<a*10+b+c;
if(a==b and b!=c)
  {
	if(max(a,c)==a)
	cout<<a*10+b+c;
	if(max(a,c)==c)
	cout<<c*10+a+b;
  }
if(a==c and a!=b)
    {
    if(max(a,b)==a)
	cout<<a*10+b+c;
	if(max(a,b)==b)
	cout<<b*10+a+c;
    } 
if(b==c and b!=a)
        {
          if(max(a,b)==a)
	      cout<<a*10+b+c;
	      if(max(a,b)==b)
	      cout<<b*10+a+c; 
        }
if(a!=b and b!=c and c!=a)	
{
	if(max(max(a,b),c)==a)
	cout<<a*10+b+c;
	if(max(max(a,b),c)==b)
	cout<<b*10+a+c;
	if(max(max(a,b),c)==c)
	cout<<c*10+a+b;
	return 0;
}
return 0;
}


Measured memory_bytes: 256
#if 0
2020.01.30

每行放一个颜色即可构造 n = k 的方案。
如果 k 为 4 的倍数，每行相间放两个颜色即可构造 n = k / 2 的方案。
但是如果 k 不是 4 的倍数的时候这个构造方法就不使用了，
任何一行如果只放一个颜色，由于其相邻的行是相间的，不符合要求。

从斜行方向考虑，每斜行放一个颜色同样可以构造 n = k 的方案。
同样如果 k 为 4 的倍数，每斜行相间放两个颜色即可构造 n = k / 2 的方案。
而这个构造方式很优秀，把一斜行换成只填一种颜色仍然合法，
因为两斜行的相交部分本来就是相邻两个块。
#endif
#include <cstdio>
#include <algorithm>
#define debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long ll;

struct {
	inline operator int () { int x; return scanf("%d", &x), x; }
	inline operator ll () { ll x; return scanf("%lld", &x), x; }
} read;

const int maxn = 500;
int a[maxn][maxn];

int main() {
	int k = read;
	int n = k == 1 ? 1 : (k + 3) >> 2 << 1;

	int c = 0;
	for(int i = 0; i < n; i ++) {
		++ c;
		for(int j = 0; j < n; j += 2)
			a[(i + j) % n][j] = c;
	}

	for(int i = 0; i < n; i ++) {
		int x = ++ c;
		if(x > k)
			x = a[i][0];
		for(int j = 1; j < n; j += 2)
			a[(i + j) % n][j] = x;
	}

	printf("%d\n", n);
	for(int i = 0; i < n; i ++) {
		for(int j = 0; j < n; j ++)
			printf("%d ", a[i][j]);
		puts("");
	}
}


Measured memory_bytes: 2048
N, K = gets.split(' ').map(&:to_i)
a_list = gets.split(' ').take(N).map(&:to_i)

MAX_DIGIT = 60
dp = Array.new(MAX_DIGIT + 10) { Array.new(2, -1) }
dp[0][0] = 0

(0...MAX_DIGIT).each do |i|
  bit_pos = MAX_DIGIT - i - 1
  kb = K[bit_pos]
  digit_value = 2 ** bit_pos
  one_count = a_list.count { |a| a[bit_pos] == 1 }
  zero_count = N - one_count
  cost0 = one_count * digit_value
  cost1 = zero_count * digit_value

  # lower
  dp[i + 1][1] = [
    dp[i + 1][1],
    # lower -> lower
    (dp[i][1] != -1 ? dp[i][1] + [cost0, cost1].max : -1),
    # same -> lower
    (kb == 1 ? dp[i][0] + cost0 : -1)
  ].max

  # same
  dp[i + 1][0] = dp[i][0] + (kb == 1 ? cost1 : cost0)
end

puts [dp[MAX_DIGIT][0], dp[MAX_DIGIT][1]].max


Measured memory_bytes: 10404
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scanner = new Scanner(System.in);
        int S = scanner.nextInt();
        
        int h = 0;
        int m = 0;
        int s = 0;
        
        h = S / 3600;
        if(h > 0){
            S = S % 3600;
        }
        m = S / 60;
        if(m > 0){
            S = S % 60;
        }
        s = S;
        System.out.println(h + ":" + m + ":" + s);
    }
}
 


Measured memory_bytes: 26312
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Math;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = long.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(x => long.Parse(x)-1).Sum();
            Console.WriteLine(a);
        }
    }
}


Measured memory_bytes: 13340
#include <iostream>
using namespace std;
int main(){
  string s;
  cin >> s;
  int head, tail;
  for (int i = 0; i < s.size(); i++){
    if (s.at(i) == 'A'){
      head = i;
      break;
    } 
  }
  for (int i = 0; i < s.size(); i++){
    if (s.at(i) == 'Z'){
        tail = i;
      }
  }
  cout << tail - head + 1 << endl;
}

Measured memory_bytes: 640
#include <iostream>
 
int main(){
  int n,m;
  std::cin >> n >> m;
  int l_max = 0,r_min = 10000000;
  for(int i = 0 ; i < m ; i++){
    int l_i,r_i;
    std::cin >> l_i >> r_i;
    l_max = std::max(l_max,l_i);
    r_min = std::min(r_min,r_i);
  }
  if(r_min < l_max){
    std::cout << 0 << std::endl;
  }else{
    std::cout << r_min - l_max + 1 << std::endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>

using namespace std;
template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}

#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define REV(v) reverse(v.begin(),v.end())
#define SRT(v) sort(v.begin(),v.end())
#define MOD 1000000007

typedef long long ll;
typedef tuple<int,int,bool> Tb;

int atcoder(){
    //入力
    string a;
    cin >> a;
  	int ans = 700;
    //処理
    REP(i,0,3) if(a[i]=='o') ans +=100;
    //出力
    cout << ans << ENT;
    return 0;
}

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


Measured memory_bytes: 256