akhauriyash/Code-Regression huggingface dataset:
#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;

struct mint {
	ll x;
	mint(ll x=0):x((x%MOD+MOD)%MOD){}
	mint operator-() const { return mint(-x);}
	mint& operator+=(const mint a) {if ((x+=a.x)>=MOD) x-=MOD; return *this;}
	mint& operator-=(const mint a) {if ((x+=MOD-a.x)>=MOD) x-=MOD; return *this;}
	mint& operator*=(const mint a) {(x*=a.x)%=MOD; return *this;}
	mint operator+(const mint a) const {mint res(*this); return res+=a;}
	mint operator-(const mint a) const {mint res(*this); return res-=a;}
	mint operator*(const mint a) const {mint res(*this); return res*=a;}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t>>1);
		a *= a;
		if (t&1) a *= *this;
 		return a;
	}

	// for prime mod
	mint inv() const { return pow(MOD-2);}
	mint& operator/=(const mint a) { return (*this) *= a.inv();}
	mint operator/(const mint a) const {mint res(*this); return res/=a;}
};

int main() {
//	cout << fixed << setprecision(15);
	ll n, k;
	cin >> n >> k;
	vector<mint> dp(k + 1);
	mint ans;
	for(int i = k; i >= 1; i--) {
		dp[i] = mint(k / i).pow(n);
		for(int j = i * 2; j <= k; j += i) {
			dp[i] -= dp[j];
		}
		ans += dp[i] * i;
	}
	cout << ans.x << endl;
}


Measured memory_bytes: 4044
/*
*Bismillahir Rahmanir Rahmin
* @Author: {{Syed Yasir Shahriar
{
/*//*\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\*/
 
//أعوذ بالله من الشيطان الرجيم
//بسم الله الرحمن الرحيم
 
/*//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\*/
 
/*};/* @Date:   {{create_time}}typedef int MyCustomType;
* @Last Modified by:   mrinm
* @Last Modified time: 2020-07-01 22:16:44
*/
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define pll pair<ll,ll>
#define v vector<ll>
#define st stack<ll>
#define pq  priority_queue <int>
#define q queue<ll>
#define mod 1000000005
using namespace std;
 
 int solve(int arr[],int n){

 	   int res=0;
 	   for (int i =0; i<= n - 1; i++) { 
        int val = 0; 
        for (int j =i; j<= n - 1; j++) { 
            val = val + arr[j]; 
            if (val % 2 != 0) 
                res++; 
        } 
    } 
 	   return (res);
 }
 
int main(){
 /*    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif*/
     //ios::sync_with_stdio(0);
	 int a,b,c;
	 cin>>a>>b>>c;
	 if(c>=a && c<=b){
	 	cout<<"Yes"<<endl;
	 	return 0;
	 }
	cout<<"No"<<endl;
     return 0;
}

Measured memory_bytes: 3568
#include<iostream>

using namespace std;

int main(){
	for(int n;cin>>n,n;){
		int pmax,dmax=-1;
		while(n--){
			int p,d1,d2;	cin>>p>>d1>>d2;
			if(dmax<d1+d2)	dmax=d1+d2,pmax=p;
		}
		cout<<pmax<<' '<<dmax<<endl;
	}
	return 0;
}

Measured memory_bytes: 864
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
typedef pair<int, int> PI;
typedef pair<ll, ll> PL;

const ll mod = 1000000007;


int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	ll a, b; cin >> a >> b;
	ll c, d; cin >> c >> d;
	ll p = c * d/__gcd(c, d);
	ll cnt1, cnt2;
	cnt1 = b / c + b / d - b/p;
	cnt2 = (a-1) / c + (a-1)/ d - (a-1)/p;
	cout << (b - a + 1) -(cnt1 - cnt2) << endl;
} 

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(998244353)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
ll pow(ll x, ll ntimes) {
    ll ret = 1;
    while (ntimes > 0) {
        if ((ntimes & 1) == 1) {
            ret = ret * x;
            ret %=mod;
        }
        x = x * x;
        x%=mod;
        ntimes >>= 1;
    }
    ret%=mod;
    return ret;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vll d(n);
    REP(i,n) cin >> d[i];
    if(d[0]>0){
        cout << 0 << endl;
        return 0;
    }
    if(n==1){
        cout << 1 << endl;
        return 0;
    }
    if(d[1]==0){
        cout << 0 << endl;
        return 0;
    }
    sort(ALL(d));
    ll ans = 1;
    ll now = 1;
    ll par = 1;
    ll dis = 1;
    ll t;
    while(now<n){
        t = 0;
        while(now<n){
            if(d[now]==dis){
                t++;
                now++;
            }else{
                if(t==0){
                    cout << 0 << endl;
                    return 0;
                }
                ll tmp = pow(par,t);
                ans*=tmp;
                ans%=mod;
                par = t;
                dis++;
                break;
            }
        }
        //cout << par << " " << t << endl;
    }
    ans*=pow(par,t);
    cout << ans%mod << endl;
    return 0;
}

Measured memory_bytes: 1024
import math
from decimal import *
a,b,x=map(int,input().split())
S=Decimal(a*b)
s=Decimal(x/a)
if S/2<=s:
  l=Decimal(2*Decimal(s/a)-b)
  print(math.degrees(math.atan(Decimal(Decimal((b-l))/a))))
else:
  l=Decimal(2*Decimal(s/b))
  print(math.degrees(math.atan(Decimal(b/l))))

Measured memory_bytes: 5204
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
string base="IOI";
int main(){
    int n;
    while(cin>>n,n){
        int gar; cin>>gar;
        string hoge; cin>>hoge;
        string key="IOI";
        rep(i,n-1)key+="OI";
        bool flag=true;
        int ans=0;
        int  gotisa=0;
        while(flag){
            int var=(int)hoge.find(key,gotisa);
            if(var==-1)break;
            gotisa=var+1;
            ans++;
        }
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 3908
from collections import deque

n, m = map(int,input().split())
ex = [[] for i in range(n+1)]
for i in range(m):
    a, b = map(int, input().split())
    ex[a].append(b)
    ex[b].append(a)

d = deque()
d.append(1)
ans = [-1] * (n+1)
ans[1] = 1
while d:
    f = d.popleft()
    for t in ex[f]:
        if ans[t] == -1:
            ans[t] = f
            d.append(t)

for i in range(2, n+1):
    if ans[i] == -1:
        print('No')
        exit()

print('Yes')
for i in range(2,n+1):
    print(ans[i])

Measured memory_bytes: 98884
n,k=map(int,input().split())
a=list(map(int,input().split()))
f=[[0 for j in range(60)] for i in range(n)]
for i in range(len(a)):
    a[i]-=1
    f[i][0]=a[i]
#do binary lifting 
for j in range(1,60):
    for i in range(n):
        f[i][j]=f[f[i][j-1]][j-1]
ans=0
for j in range(59,-1,-1):
    if 1<<j<=k:
        ans=f[ans][j]
        k-=1<<j
print(ans+1)


Measured memory_bytes: 205684
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (1LL<<60)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
typedef unsigned long long int ull;
typedef long long lint;
 
int main(void){
  int N[4];
  rep(i,4) cin >> N[i];
  sort(N,N+4);
  if(N[0]==1 && N[1]==4 && N[2]==7 && N[3]==9) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
long long a,b,c,ans=2019;
int main(void){
    cin>>a>>b;
    c=min(b-a,2018LL);
    a%=2019;
    b%=2019;
    for(int i=0;i<c;i++){
        for(int j=i+1;j<=c;j++){
            ans=min(ans,(a+i)*(a+j)%2019);
            if(!ans){cout<<0<<endl;return 0;}
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int N,a,i,c=0,m=0;
  int r[8]={0};
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&a);
    if(a<3200)
      r[a/400]=1;
    else
      c++;
  }
  for(i=0;i<8;i++)
    if(r[i])m++;
  if(m==0)
    printf("1 %d\n",c);
  else
    printf("%d %d\n",m,m+c);
}


Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main() {
    int h,w;

    while (true) {
        cin >> h >> w;

        if (h == 0 && w == 0)
            break;

        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;
    }
}

Measured memory_bytes: 1152
import scala.io.StdIn.{readInt, readLine};
import scala.reflect.ClassTag;
object Main {
    def main(args: Array[String]): Unit = {
        val n = readInt; // 要素数
        val arr = readLine.split(" ").map(_.toLong);
        val h = Heap[Long](arr, (a: Long, b: Long) => if (a < b) -1 else if (a > b) 1 else 0);
        h.dump;
    }
}
class Heap[A](heap: Array[Option[A]], compare: (A, A) => Int) {
    val size = heap.length;
    var ptr = 1;
    def dump(): Unit = {
        println(" " + heap.filter(_ != None).map(_.get).mkString(" "));
    }
    def add(key: A): Unit = {
        if (ptr < size) {
            heap(ptr) = Some(key);
            buildHeap();
            ptr += 1;
        }
    }
    
    private def buildHeap(): Unit = {
        def _go(idx: Int): Unit = {
            if (idx < size && heap(idx) != None) {
                _go(idx * 2 + 1);
                _go(idx * 2 + 2);
                heapify(idx)
            }
        }
        _go(0);
    }
    
    private def heapify(idx: Int): Unit = {
        val lIdx = idx * 2 + 1;
        val rIdx = idx * 2 + 2;
        val curr = heap(idx);
        val left = if (lIdx < size) heap(lIdx) else None;
        val right = if (rIdx < size) heap(rIdx) else None;
        if (left != None && right != None) { // 左右の子ノードが存在
            if (compare(curr.get, left.get) < 0 || compare(curr.get, right.get) < 0 ) {
                val sp = if (compare(left.get, right.get) < 0) rIdx else lIdx;
                swap(idx, sp);
                heapify(sp)
            }
        } else if (left != None) { // 左の子ノードのみ存在
            if (compare(curr.get, left.get) < 0) {
                swap(idx, lIdx);
                heapify(lIdx)
            }
        }
    }

    private def swap(idx1: Int, idx2: Int): Unit = {
        val tmp = heap(idx1);
        heap(idx1) = heap(idx2);
        heap(idx2) = tmp;
    }
}

object Heap {
    def apply[A](arr: Array[A], compare: (A, A) => Int): Heap[A] = {
        val h = new Heap[A](arr.map(Option[A]), compare);
        h.buildHeap();
        h
    }
    def apply[A](size: Int, compare: (A, A) => Int)(implicit m: ClassTag[Option[A]]): Heap[A] = {
        val arr = m.newArray(size);
        new Heap[A](arr, compare);
    }
}


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

int main(){
  int n;
  string s;
  cin >> n >> s;
  int allb = 0;
  for(int i=0; i<n; ++i) if(s[i] == '.') ++allb;
  int ans = allb;
  for(int i=0; i<n; ++i){
    if(s[i] == '#') ++allb;
    else --allb;
    ans = min(ans, allb);
  }
  cout << ans << endl;
}

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

int main() {
  std::string S;

  std::cin >> S;

  long long ans = 0;
  long long cnt_black = 0;

  for (auto const c : S) {
    if (c == 'B')
      cnt_black++;
    else
      ans += cnt_black;
  }

  std::cout << ans << std::endl;

  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
//typedef tree <int,null_type,less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#define rep(g, i, n) for (ll g = i; g < n; g++)
#define rev(g, n, i) for (ll g = n - 1; g >= i; g--)
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(v) v.begin(), v.end()
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define cc continue
#define bb break
#define rem 1000000007
#define PI 3.141592653589793238462643383279502
//fflush(stdin);
// do {
// // process permutation
// } while (next_permutation(permutation.begin(),permutation.end()));
//vector.assign (n,value)... for global vectors
class abc
{
    public:
    ll x,y;
};
int main()
{
    FAST
    // freopen("input1.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    /*ll tests;
    cin>>tests;
    rep (gg,0,tests)
    {}*/
    ll n,k;
    cin>>n>>k;
    ve <ld> arr(n),sum(n);
    rep (i,0,n)
    {
        cin>>arr[i];
        sum[i]=(arr[i]+1)/2;
    }
    ve <ld> ps(n+1,0);
    rep (i,0,n)
    {
        ps[i+1]=ps[i]+sum[i];
    }
    ld ans=0;
    rep (i,0,n-k+1)
    {
        ld x2=ps[i+k]-ps[i];
        ans=max(ans,x2);
    }
    cout<<fixed<<setprecision(15)<<ans<<"\n";
}


Measured memory_bytes: 9600
#include <iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
#include<tuple>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
	ll n;
	cin >> n;
	ll sum = 0;
	ll copy = n;
	while (copy > 0) {
		sum += copy % 10;
		copy /= 10;
	}
	if (n%sum == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int y = sc.nextInt();

    for (int i = 0; i <= x; i++) {
      int turu = i;
      int kame = x - i;
      if (2 * turu + 4 * kame == y) {
        System.out.println("Yes");
        return;
      }
    }
    System.out.println("No");

  }

}

Measured memory_bytes: 35732
class UnionFind
  def initialize(size)
    @rank = Array.new(size, 0)
    @parent = Array.new(size, &:itself)
  end

  def unite(id_x, id_y)
    x_parent = get_parent(id_x)
    y_parent = get_parent(id_y)
    return if x_parent == y_parent

    if @rank[x_parent] > @rank[y_parent]
      @parent[y_parent] = x_parent
    else
      @parent[x_parent] = y_parent
      @rank[y_parent] += 1 if @rank[x_parent] == @rank[y_parent]
    end
  end

  def get_parent(id_x)
    @parent[id_x] == id_x ? id_x : (@parent[id_x] = get_parent(@parent[id_x]))
  end

  def same_parent?(id_x, id_y)
    get_parent(id_x) == get_parent(id_y)
  end
end
#n = gets.chomp.to_i
n,k,l = gets.chomp.split().map(&:to_i)

ufroad = UnionFind.new(n+1)
k.times do
  p, q = gets.chomp.split().map(&:to_i)
  ufroad.unite(p, q)
end
uftrain = UnionFind.new(n+1)
l.times do
  r, s = gets.chomp.split().map(&:to_i)
  uftrain.unite(r,s)
end

hash = {}
hash.default = 0
1.upto(n) do |i|
  road_parent = ufroad.get_parent(i)
  train_parent = uftrain.get_parent(i)
  hash[[road_parent, train_parent]] += 1
end
1.upto(n) do |i|
  road_parent = ufroad.get_parent(i)
  train_parent = uftrain.get_parent(i)
  print hash[[road_parent, train_parent]]
  print ' '
end

puts ''


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

int main() {
    string s;cin>>s;
    ll c[2019]{};
    c[0]=1;
    int mod=2019;
    int prev=0;
    int mul=1;
    ll ans=0;
    for (int i=s.size()-1;i>=0;i--) {
        int a=s[i]-'0';
        int b=(a*mul+prev)%mod;
        ans+=c[b];
        c[b]++;
        prev=b;
        mul=mul*10%mod;
    }
    cout<<ans<<endl;
    return 0;
}

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

enum inf = 10L^^15;
enum mod = 10L ^^ 9 + 7;

void main() {
    int n, k;
    scan(n, k);
    auto a = readln.split.to!(int[]);
    a.sort();
    auto dp = new int[][](k + 1, 2);

    dp[0][0] = 1;
    dp[0][1] = 0;

    foreach (i ; 1 .. k + 1) {
        foreach (p ; 0 .. 2) {
            dp[i][p] = p ^ 1;

            foreach (j ; 0 .. n) {
                if (i - a[j] < 0) {
                    break;
                }
                if (dp[i - a[j]][p ^ 1] == p) {
                    dp[i][p] = p;
                    break;
                }
            }
        }
    }

    writeln(dp[k][0] == 0 ? "First" : "Second");
}







void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}


void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

Measured memory_bytes: 7036
n = int(input())
a = list(map(int, input().split()))

check = [0]*(n//2 + n%2)
flag = True
for i in a:
    check[i//2] += 1
    if i%2 == n%2:
        flag = False
        break
    if (i//2 == 0 and n%2 == 1 and check[0] > 1) or check[i//2] > 2:
        flag = False
        break
if flag:
    print(2**(n//2) % (10**9 + 7))
else:
    print(0)

Measured memory_bytes: 13880
solve :: String -> String -> String -> Bool
solve acc [] t = acc == t
solve acc s t
  | acc ++ s == t = True
  | otherwise = solve (last s:acc) (init s) t

main :: IO ()
main = do
  s <- getLine
  t <- getLine
  putStrLn $ if solve "" s t then "Yes" else "No"

Measured memory_bytes: 764
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;

int main(void){
  int X, A;
  cin >> X >> A;
  if(X < A) cout << 0 << endl;
  else cout << 10 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long 
using namespace std;
int main() {
	int n; cin >> n;
	int ans = 0;
	int h, w; cin >> h >> w;
	while(n--) {
		int h1, w1;
		cin >> h1 >> w1;
		if(h1 >= h && w1 >= w) {
			ans += min((h1 / h), (w1 / w));
		}
	}
	cout << ans << endl;
		

	return 0;
}


Measured memory_bytes: 256
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Linq;
using System.Diagnostics;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Math;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;

public static class P
{
    public static void Main()
    {
        var ab = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var a = ab[0];
        var b = ab[1];
        Console.WriteLine(Max(a - b * 2, 0));
    }
}



Measured memory_bytes: 13268
#include<iostream>
#include<string>
using namespace std;
int main(){
	int count;
	string s, p;
	cin >> s >> p;
	for (int i = 0; i < s.size(); i++){
		count = 0;
		for (int j = 0; j < p.size(); j++){
			if (((i+j)>=s.size())?s[i+j-s.size()]==p[j]:s[i+j]==p[j])
				count++;
		}
		if (count == p.size())
			break;
	}
	if (count == p.size())
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
//s[i + j] == p[j] || (i + j)>s.size() && s[i + j-s.size()]==p[j]


Measured memory_bytes: 3228
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
  int n,k;cin>>n>>k;
  for(int i=0,a,b,p;i<k;++i){
  	bool f,g;f=g=false;
    cin>>a>>b;a-=1;b-=1;
    p=n+((n%2)?1:0);
    //cerr<<"p:"<<p<<endl;
    if(a>p/2){a=a-p/2-((n%2)?1:0);f=true;}else a=p/2-a;
    if(b>p/2){b=b-p/2-((n%2)?1:0);g=true;}else b=p/2-b;
    //cerr<<"#"<<a<<" "<<b<<endl;
    cout<<((p/2-max(a-(f?0:1),b-(g?0:1))-((n%2&&f)?0:1))%3+1)<<endl;
  }
  return 0;
}

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

int main(){
    int n, k;
    int r, s, p;
    string T;
    cin >> n >> k >> r >> s >> p >> T;

    int point = 0;
    for(int i = 0; i < k; i++){
        char before = T[i];
        int count = 1;
        for(int j = i + k; j < n; j += k){
            if (before != T[j]){
                int l;
                if (before == 'r')l = p;
                else if (before == 's')l = r;
                else if (before == 'p')l = s;
                point += (count + 1) / 2 * l;

                before = T[j];
                count = 1;
            }
            else{
                count++;
            }
        }
        int l;
        if (before == 'r')l = p;
        else if (before == 's')l = r;
        else if (before == 'p')l = s;
        point += (count + 1) / 2 * l;
    }
    cout << point << endl;
    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
#define N 100
int count = 0;
void BubbleSort(int A[], int n){
    int k, l, tmp;
    for(k = 0; k <= n-1; k++){
        for(l = n-1; l >= k+1; l--){
            if(A[l] < A[l-1]){
                tmp = A[l];
                A[l] = A[l-1];
                A[l-1] = tmp;
                count++;
            } }
    } }
int main(){
    int i, j, n;
    int A[N+1];
    scanf("%d", &n);
    for(i = 0; i < n; i++){
        scanf("%d", &A[i]);
    }
    BubbleSort(A, n);

    for(j = 1; j <= n; j++){
        if(j > 1){printf(" ");
        }
        printf("%d", A[j-1]);
    }
    printf("\n");
    printf("%d\n", count);
    return 0; }



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

int debug=0;
int N;
vector<long long> A;
vector<long long> B;
vector<long long> C;
long long Ans=0;

int main(){
    cin >> N;
    long long tmp;
    for(int i=0;i<N;++i){
        cin >> tmp;
        A.push_back(tmp);
    }
    for(int i=0;i<N;++i){
        cin >> tmp;
        B.push_back(tmp);
    }
    for(int i=0;i<N;++i){
        cin >> tmp;
        C.push_back(tmp);
    }
        
    /*
    sort(A.begin(),A.end(),greater<long long>());
    sort(B.begin(),B.end(),greater<long long>());
    sort(C.begin(),C.end(),greater<long long>());
    */
    sort(A.begin(),A.end());
    sort(B.begin(),B.end());
    sort(C.begin(),C.end());


    if(debug !=0){
        for(long long tmp:A)
            cout << tmp << " ";
        cout << endl;
        for(long long tmp:B)
            cout << tmp << " ";
        cout << endl;
        for(long long tmp:C)
            cout << tmp << " ";
        cout << endl;
    }


    for(auto j:B){
        auto iter1 = lower_bound(A.begin(),A.end(),j);
        auto iter2 = upper_bound(C.begin(),C.end(),j);

        auto m = iter1 - A.begin();
        auto n = C.end()- iter2;

        if(debug!=0){
            cout << "m,n=" << m << "," << n <<endl;
        }
        Ans += m*n;
    }
   
    cout << Ans << endl;


}

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
int a,b,val=1;
int main()
{
	cin>>a>>b;
	for(register int i=0;i<a;i++)
	{
		if(val<b)
		{
			val*=2;
		}
		else
		{
			val+=b;
		}
	}
	cout<<val;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define collect(arr, size) rep(i,size) cin >> arr[i];
#define int long long

const int INF = 1e9;

signed main(){
    int N, K, S;
    cin >> N >> K >> S;
    if(K>0) cout << S;
    rep(i,K-1){
        cout << " " << S;
    }
    int another = (S==INF) ? INF-1 : INF;
    rep(i,N-K){
        cout << " " << another;
    }
    cout << endl;
}

Measured memory_bytes: 1280
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N;
		String cardSet;
		Bonze b;
		
		for(;;) {
			N = sc.nextInt();
			if(N == 0) {
				break;
			}
			cardSet = sc.next();
			b = new Bonze(cardSet,N);
			System.out.println(b.getResult());
		}
	}
}

class Bonze {
	private String cardSet;
	private int N,fieldScore,current,currentCard;
	private int[] score;
	
	public Bonze(String cardSet,int N) {
		this.cardSet = cardSet;
		this.N = N;
		fieldScore = 0;
		current = 0;
		score = new int[N];
	}
	
	public String getResult() {
		game();
		String result = "";
		Arrays.sort(score);
		for(int s:score) {
			result += s + " ";
		}
		result += fieldScore;
		return result.trim();
	}
	
	private void game() {
		for(int i=0; i<100; i++) {
			currentCard = i;
			draw();
			current ++;
			if(current == N) {
				current = 0;
			}
		}
	}
	
	private void draw() {
		String next = cardSet.charAt(currentCard)+"";
		if(next.equals("M")) {
			man();
		} else if(next.equals("S")) {
			bonze();
		} else if(next.equals("L")) {
			princess();
		}
	}
	
	private void man() {
		score[current] ++;
	}
	
	private void bonze() {
		fieldScore += score[current] + 1;
		score[current] = 0;
	}
	
	private void princess() {
		score[current] += fieldScore + 1;
		fieldScore = 0;
	}
}

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

#define sp ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define v(t) vector<t>
#define vv(t) vector<vector<t>>
#define vn(t,n,val) vector<t>(n,val)
#define vvn(t,r,c,val) vector<vector<t>>(r, vector<t>(c,val))
#define vvv(t) vector<vector<vector<t>>>
#define vvvn(t,l,b,h,val) vector<vector<vector<t>>>(l,vector<vector<t>>(b,vector<t>(h)))

int main() {
	sp;

	////////////////To Remove//////////////
	// freopen("../../input.txt", "r", stdin);
	// freopen("../../output.txt", "w", stdout);
	///////////////////////////////////////


	int n,m;
	cin>>n>>m;
	vector<long long> a(n);
	for(auto& x: a) cin>>x;

	sort(a.rbegin(), a.rend());

	long long sum = accumulate(a.begin(), a.end(), 0ll);

	if((m <= n) && (a[m-1]*4*m >= sum)) cout<<"Yes";
	else cout<<"No";

	// int count = 0;
	// double limit = sum/(4.0*m);
	// for(auto& x: a){
	// 	if(x < limit) count++;
	// } 

	// if(n-count >= m) cout<<"Yes";
	// else cout<<"No"; 

  	return 0;
}

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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

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

constexpr llong mod = 1e9+7;
constexpr llong inf = mod * mod;

int main() {
  llong N;
  vector<llong> A;
  vector<llong> rui;

  cin >> N;
  A.resize(N);
  rui.push_back(0);
  for (auto &in: A) {
    cin >> in;
    rui.push_back((rui.back() + in) % mod);
  }

  llong ans = 0;
  for (int i = 0; i < N; i++) {
    ans = (ans + A[i] * (rui[N] - rui[i + 1] + mod) % mod) % mod;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 6924
using System;
using System.Collections.Generic;

class MyClass
{
    static void Main(string[] args)
    {
        Stack<string> train = new Stack<string>();
        string str;
        while ((str = Console.ReadLine()) != null)
        {
            if (str == "0")
            {
                Console.WriteLine(train.Pop());
            }
            else
            {
                train.Push(str);
            }
        }
    }
}


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

    void insersionsort(int A[100],int N){
        int v,j;
        for(int i=1;i<=N;i++){
            for(int l=0;l<N;l++){
                cout<<A[l];
                if(l!=N-1)  cout<<' ';
                if(l==N-1)  cout<<'\n';
                
            }
            
            v = A[i];
            j = i - 1;
            while(j>=0 && A[j]>v){
                A[j+1] = A[j];  A[j] = v;
                j--;
            }
        }

    }

int main(){
    int N;
    int A[100];

    cin>>N;

    for(int i=0;i<N;i++){
        cin>>A[i];
    }

    insersionsort(A,N);

}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
    int n;
    cin >> n;
    map<string, int> m;
    rep(i,n) {
        string st;
        cin >> st;
        if (m.count(st)) m.at(st)++;
        else m[st] = 1;
    }
    int cnt = 0;
    for (auto x : m) {
        cnt = max(cnt, x.second);
    }
    vector<string> y;
    for (auto x : m) {
        if (x.second == cnt) y.push_back(x.first);
    }
    sort(y.begin(), y.end());
    for (string s : y) {
        cout << s << endl;
    }
    return 0;
}

Measured memory_bytes: 27280
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
char t[50][50];
bool used[50][50];
vector<P> v;
P g;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };
bool add(P x) {
	rep(k, 4) {
		int nx = x.first + dx[k];
		int ny = x.second + dy[k];
		if (P{ nx,ny } == g) {
			v.push_back({ nx,ny });
			return true;
		}
		if (nx < 0 || ny < 0 || nx == 50 || ny == 50)continue;
		if (t[nx][ny] == '#')continue;
		if (used[nx][ny])continue;
		used[nx][ny] = true;
		if (add({ nx,ny })) {
			v.push_back({ nx,ny }); return true;
		}
	}
	return false;
}
struct cost { ll keep, on, off; };
cost c[50][50];
int w, h, m;
vector<int> loc[50][50];
void solve() {
	rep(i, 50) {
		rep(j, 50) {
			t[i][j] = '#';
		}
	}
	cin >> h >> w >> m;
	rep(i, h) {
		rep(j, w) {
			cin >> t[i][j];
		}
	}
	rep(i, h) {
		rep(j, w) {
			cin >> c[i][j].keep;
		}
	}
	rep(i, h) {
		rep(j, w) {
			cin >> c[i][j].on;
		}
	}
	rep(i, h) {
		rep(j, w) {
			cin >> c[i][j].off;
		}
	}
	P memo;
	cin >> memo.first >> memo.second;
	v.push_back(memo);
	rep(i, m-1) {
		rep(j, 50) {
			rep(k, 50) {
				used[j][k] = false;
			}
		}
		int x, y; cin >> x >> y;
		g = { x,y };
		used[memo.first][memo.second] = true;
		int l1 = v.size();
		add(memo);
		memo = g;
		reverse(v.begin() + l1, v.end());
	}
	ll out = 0;
	int len = v.size();
	rep(i, len) {
		loc[v[i].first][v[i].second].push_back(i);
	}
	rep(i, h) {
		rep(j, w) {
			int len2 = loc[i][j].size();
			if (len2)out += c[i][j].on;
			rep(k, len2) {
				if (k == len2 - 1) {
					out += c[i][j].off;
				}
				else {
					out += min(c[i][j].on + c[i][j].off, c[i][j].keep*(loc[i][j][k + 1] - loc[i][j][k]));
				}
			}
		}
	}
	cout << out << endl;
}
int main(){
	solve();
	return 0;
}


Measured memory_bytes: 19552
#include <bits/stdc++.h>
using namespace std;
#define fast_io cin.tie(0);ios_base::sync_with_stdio(0);
string to_string(string s) { return '"' + s + '"';}
string to_string(char s) { return string(1, s);}
string to_string(const char* s) { return to_string((string) s);}
string to_string(bool b) { return (b ? "true" : "false");}
template <typename A> string to_string(A);
template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}
template <typename A> string to_string(A v) {bool f = 1; string r = "{"; for (const auto &x : v) {if (!f)r += ", "; f = 0; r += to_string(x);} return r + "}";}
void debug_out() { cout << endl; }
void show() { cout << endl; }
void pret() { cout << endl; exit(0);}
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {cout << " " << to_string(H); debug_out(T...);}
template <typename Head, typename... Tail> void show(Head H, Tail... T) {cout <<H<<" "; show(T...);}
template <typename Head, typename... Tail> void pret(Head H, Tail... T) {cout <<H<<" "; pret(T...);}
#define pr(...) cout << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
typedef long long ll;
#define int ll
typedef long double ld;
typedef vector<int> vi;
#define disp(x) cout<<x<<" ";
#define rep(i,a,b) for(int i=a;i<(int)b;i++)
#define fo(i,a,b) for(int i=a;i<=(int)b;i++)
#define rf(i,a,b) for(int i=a;i>=(int)b;i--)
#define mp make_pair
#define pb emplace_back
#define F first
#define S second
#define endl '\n'
//cout.setf(ios::fixed);cout.precision(18)
const int MOD = 1e9+7;
const int maxn = 300000+10;

bool visited[maxn];

void help(vi v, int n){
    // show("FDSA")
    int ans = 0;
    for (int i = 0; i < n; ++i)
    {
        ans += v[i];
    }
    show(ans);
    exit(0);
}

int32_t main(){
    fast_io;
    int n, x, m;
    cin >> n >> x >> m;
    vi v;
    v.emplace_back(x);
    visited[x] = 1;
    int repeat = -1;
    while(1){
        int curr = v.back();
        curr = (curr * curr) % m;
        if(visited[curr]) {
            repeat = curr;
            break;
        }
        visited[curr] = 1;
        v.emplace_back(curr);
    }
    if((int)v.size() >= n){
        help(v, n);
    }
    int ans = 0;
    int id = 0;

    // pr(v);

    for (int i = 0; i < (int)v.size(); ++i)
    {
        if(v[i] == repeat) {
            id = i;
            break;
        }
        ans += v[i];
        n--;
    }
    int temp = v.size();
    int tot = 0;
    fo(i, id, temp - 1) tot += v[i];
    int denominator = temp - id;
    int rem = n % denominator;
    int div = n / denominator;
    ans += div * tot;
    for (int i = 0; i < rem; ++i)
    {
        ans += v[i + id];
    }
    show(ans);
    return 0;
}

Measured memory_bytes: 4624
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#define INF 1000000007
using namespace std;

int main(void){
    int n,t,a;
    cin >> n >> t >> a;
    vector<int> h(n);
    for(int i=0; i<n; i++)cin >> h[i];
    int place;
    double ans=INF, ave;
    for(int i=0; i<n; i++){
        ave=(double)t-(double)h[i]*0.006;
        if(ans>fabs(a-ave)){
            ans=fabs(a-ave);
            place=i+1;
        }
    }
    cout << place << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            solve(sc);
        }
    }

    static void solve(Scanner sc) {
        int n = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        int ans = 0;
        for (int i = 1; i <= n; i++) {
            char[] tmp = String.valueOf(i).toCharArray();
            int sum = 0;
            for (char c : tmp) {
                sum += c - '0';
            }

            if (a <= sum && sum <= b) {
                ans += i;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define dhoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);  
typedef long long ll;
typedef long double ld;
const ll inf = 1e18;
const int nax = 2e6 + 7;
const ll mod = 1e9 + 7;
//ll tree[4 * nax];
//9uS-22RSwk7gQqh
int count(ll x){
	int cnt = 0;
	while(x != 0){
		cnt++;
		x /= 10;
	}
	return cnt;
}
int main()
{
	char a , b;
	cin >> a >> b;
	if(a == b)
		cout << "H" << endl;
	else 
		cout << "D" << endl;
	return 0;
	
}



Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<vector>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm> 
#include<climits>
#include<stack>
#include<queue>
#include<set>
#include<cctype>
#include<bitset> 
using namespace std;

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
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;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}

template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

const int mod = 1000000007;
const int MOD = 1000000007;
const ll INF = (ll)1e12;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

bool compare_by_second(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

// a^b mod M
long myPow(long a,long b,int M) {
    long ret = 1;
    long tmp = a;
    while(b>0) {
        if((b&1)==1) ret = (ret * tmp) % M;
        tmp = (tmp * tmp) % M;
        b = b>>1;
    }
    return ret;
}

 // nCk mod M
int nCk(int n,int k,int M) {
    long ret = 1;
    int mi = min(k, n-k);
    for(int i=1;i<=mi;i++) {
        ret = (ret * myPow(i,M-2,M)) % M;
    }
    for(int i=n-mi+1;i<=n;i++) {
        ret = (ret * i) % M;
    }
    return (int)ret;
}


int main() {
    ll n,m,k;cin >> n >> m >> k;

    ll x_sum=0;
    REP(i,n) x_sum += ((n-1-i) * (i+1))%mod;
    x_sum = ((x_sum%mod) * (m*m)%mod)%mod;

    ll y_sum=0;
    REP(i,m) y_sum += ((m-1-i) * (i+1))%mod;
    y_sum = ((y_sum%mod) * (n*n)%mod)%mod;

    ll sum = ((x_sum+y_sum)%mod * nCk(n*m-2,k-2,mod))%mod;

    pl(sum)

}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	long long int num[100][21]{0};
	int n;
	cin >> n;
	int input[100];
	for (int i = 0; i < n; ++i) {
		cin >> input[i];
	}
	num[0][input[0]]=1;
	for (int i = 1; i < n - 1; ++i) {
		for (int j = 0; j <= 20; ++j) {
			if (j + input[i] <= 20) {
				num[i][j] += num[i - 1][j + input[i]];
			}
			if (j - input[i] >= 0) {
				num[i][j] += num[i - 1][j - input[i]];
			}
		}
	}
	cout << num[n - 2][input[n - 1]] << endl;
	return 0;
}

Measured memory_bytes: 3076
s = gets.strip.split('').map(&:to_i)
n = s.length


sum_1 = 0

n.times do |i|
  if i.odd? && s[i] == 0
    sum_1 += 1
  elsif i.even? && s[i] == 1
    sum_1 += 1
  end
end

sum_2 = n - sum_1

sum = [sum_1,sum_2].min

puts sum

Measured memory_bytes: 9724
fun main(args: Array<String>) {

    // 行でデータが入ってくるということは、軸はaになる。1行目はa1, 2行目はa2であるので。x軸と行は対になるのかな
    // inputデータを2次元の配列に格納した方が良いのでは？
    // 直感的にはreadして、000102にいれる、101112にいれる 配列の結合的なことできる？000102 101112をマージする
    // できるかも、イメージ的には２次元配列は配列の配列として入れ子になってくるはずなので・・・
//    val a1 = readLine()!!.split(" ").map { it.toInt() }
    // よく考えるとsplit自体が配列化だった
    val x0Arr = readLine()!!.split(" ")
    val x1Arr = readLine()!!.split(" ")
    val x2Arr = readLine()!!.split(" ")

    val aArr = arrayOf(x0Arr, x1Arr, x2Arr)
    var xArr = arrayOfNulls<Int>(3)
    var yArr = arrayOfNulls<Int>(3)


    // LOOK だめだ全然頭入っていない、ノート持ってきて出直し！！２次元配列のインデックスの操作軸と数列的な物の操作軸があっていないので
    // 要訓練かもしれない
    // x[0]=0とする それにより、y[i]はa[0][i]-x[0]で確定する
    // y[0]が定まるので、x[i]も確定する。x[i] = a[i][0] - y[0]
    xArr[0] = 0
    for (i in 0..2)
        yArr[i] = aArr[0][i].toInt() - xArr[0]!!
    for (i in 0..2)
        xArr[i] = aArr[i][0].toInt() - yArr[0]!!
// validationを考える。2重ループで演算値の比較をすればOK
    var result = true
    for (i in 0..2)
        for (j in 0..2)
            if (aArr[i][j].toInt() == xArr[i]!! + yArr[j]!!)
            else
                result = false
    if (result)
        println("Yes")
    else println("No")

    // 2次元配列の初期化を忘れた
    // IntelliJのプロジェクト検索 ショートカット
//    var aArr: Array<Array<Int>> = Array(3)
    // LOOK Ologn
}

Measured memory_bytes: 38000
m = [input()for i in range(5)]

ma = 0
for i in range(1,5):
  if m[i][-1] == '0':
    continue
  if int(m[ma][-1]) > int(m[i][-1]):
    ma = i
c = 0
for i in range(5):
  tmp = int(m[i])
  if i != ma and tmp % 10 !=0:
    tmp = tmp // 10 * 10 + 10
  c += tmp
print(c)                      

Measured memory_bytes: 9188
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
using namespace std;

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

	cout << (N+M+1)/2 << endl;
	
}


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

int main(){
  int n;
  int mode[101];
  memset(mode,0,sizeof(mode));
  int a = 0;
  while(cin >> n){
    mode[n]++;
    a = max(a,mode[n]);
  }
  for(int i=0; i<101; i++){
    if(mode[i] == a)
      cout << i << endl;
  }
  return 0;
}

  

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

int main(){
  int n,k;
  cin >> n >> k;
  int a[n];
  int ans =0;
  for(int i=0;i<n;i++)cin >> a[i];
  for(int l=0;l<=k;l++){
    for(int r=0;r<=k-l;r++){
      if(l+r>n)break;
      int d = k-r-l;
      int now = 0;
      vector<int>s;
      for(int i=0;i<l;i++){
        now += a[i];
        s.push_back(a[i]);
      }
      for(int i=0;i<r;i++){
        now += a[n-i-1];
        s.push_back(a[n-i-1]);
      }
      sort(s.begin(),s.end());
      for(int i=0;i<d;i++){
        if(i>=s.size())break;
        if(s[i]>0)break;
        now -= s[i];
      }
      ans = max(ans,now);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long 
#define mp make_pair
#define pb push_back
#define pi 3.14159265358979323846
#define reus ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
int32_t main()
{
	reus;
	int n,i,ans=0;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		ans+=((double(i/2.0))*floor((double)n/i)*floor((double(1+(n/i)))));
		
	}
	cout<<ans<<endl;
	return 0;
}

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

PB, P = [1] * (n + 1), [1] * (n + 1)
for i in range(1, n + 1):
    PB[i] = 2 * PB[i - 1] + 3; P[i] = 2 * P[i - 1] + 1

def f(n, x):
    c = PB[n] // 2 + 1
    if x == 0:
        return 0
    if x == PB[n]:
        return P[n]
    if x < c:
        return f(n - 1, x - 1)
    else:
        return P[n - 1] + 1 + f(n - 1, x - c)

print(f(n, x))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
 
int main() {
    ll N, K;
    ll ans = 10000000000000001;
    cin >> N >> K;
    vector<ll>x(N);
    for (ll i = 0; i < N; i++) {
        cin >> x[i];
    }
 
    for (ll l = 0; l < N-K+1; l++) {
        ll r = l+K-1;
        ll cost1, cost2;
        cost1 = abs(x[l]) + abs(x[r]-x[l]);
        cost2 = abs(x[r]) + abs(x[r]-x[l]);
        ans = min({ans, cost1, cost2});
    }
 
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<int(n);i++)
#define FOR(i,n,m) for(int i=n;i<int(m);i++)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
using namespace std;
 
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
 
int vx[]={0,0,-1,1};
int vy[]={1,-1,0,0};
int dx[]={1,0,-1,1,-1,1,0,-1};
int dy[]={1,1,1,0,0,-1,-1,-1};
 
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a*b/gcd(a,b);}	
 
const ll mod=1e9+7;
const int INF=INT_MAX/2;

int main(){
	string s;
	cin>>s;
	if(s[2]==s[3] && s[4]==s[5])cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main()
{
//	std::cout << "Hello, World" << std::endl;
   ll n,k;
   cin>>n>>k;
   if(n<k) {
   	    if(n<abs(n-k))
           cout<<n;
           else
           cout<<abs(n-k);
   }
   else if (n>=k)
   {
   	   if(n%k==0) cout<<"0";
   	   else
   	   {
   	   	if(n%k<abs(k-n%k))
   	   	cout<<n%k;
   	   	else cout<<abs(k-n%k);
   	   }
    }
	return 0;
}


Measured memory_bytes: 256
from collections import Counter
from itertools import combinations

n = int(input())
l = [input()[0] for _ in range(n)]
lc = Counter(l)

con = []
for c in "MARCH":
    if c in lc:
        con.append(lc[c])
ans = 0
for a, b, c in combinations(con, 3):
    ans += a * b * c
print(ans)


Measured memory_bytes: 4224
A = gets.chomp
B = gets.chomp

ans = "EQUAL"
if A.size > B.size
  ans = "GREATER"
elsif A.size < B.size
  ans = "LESS"
else
  for i in 0..A.size do
    aa = A[i].to_i
    bb = B[i].to_i
    if aa < bb
      ans = "LESS"
      break
    elsif aa > bb
      ans = "GREATER"
      break
    end
  end
end

puts ans


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
constexpr double EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max()/2;
constexpr int MOD = 1e9+7;

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

    int a,b,c,d;cin>>a>>b>>c>>d;
    if(a+b>c+d) cout<<"Left"<<endl;
    else if(a+b==c+d) cout<<"Balanced"<<endl;
    else cout<<"Right"<<endl;
}


Measured memory_bytes: 256