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

public class Main {
    static private Scanner scan = new Scanner(System.in);
    public static void main(String args[]) {
        int int1 = Integer.parseInt(scan.next());
//        int int2 = Integer.parseInt(scan.next());
//        int int3 = Integer.parseInt(scan.next());
//        String temp_str1 = "";
//        String temp_str2 = "";
        int temp_int1 = 0;
//        String str1 = scan.next();
//        String str2 = scan.next();
//        String str3 = scan.next();
        int ans_int = 0;
        String ans = "";
//        double ans_dob = 0;
        ans_int = int1*800 - int1/15*200;
        PrintWriter out = new PrintWriter(System.out);
        out.println(ans_int);
        out.flush();
        scan.close();
    }
}


Measured memory_bytes: 21716
//itp1_topic2_a
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a, b;
    cin>>a>>b;
    
    if(a < b) cout<<"a < b"<<endl;
    if(a == b) cout<<"a == b"<<endl;
    if(a > b) cout<<"a > b"<<endl;
    
    return 0;
}


Measured memory_bytes: 3088
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		long A = in.nextLong();
		long B = in.nextLong();
		long gcd = gcd(A, B);
		System.out.println(primeFactors(gcd).size() + 1);
		in.close();
	}

	static long gcd(long x, long y) {
		if (x < y) {
			long tmp = y;
			y = x;
			x = tmp;
		}
		if (y == 0) {
			return x;
		}
		return gcd(x % y, y);
	}

	static Map<Long, Long> primeFactors(long n) {
		Map<Long, Long> res = new HashMap<>();
		for (long p = 2; p * p <= n; ++p) {
			if (n % p != 0) {
				continue;
			}
			long num = 0;
			while (n % p == 0) {
				++num;
				n /= p;
			}
			res.put(p, num);
		}
		if (n != 1)
			res.put(n, 1l);
		return res;
	}
}

Measured memory_bytes: 23764
local w, h = io.read("*n", "*n")
local wuse, huse = 0, 0
local t = {}
local idx = {}
for i = 1, w + h do
  t[i] = io.read("*n")
  idx[i] = i
end
table.sort(idx, function(a, b) return t[a] < t[b] end)
local ret = 0
local rem = (w + 1) * (h + 1) - 1
for i = 1, w + h do
  local src = idx[i]
  if src <= w then
    local use = h + 1 - huse
    if rem < use then use = rem end
    ret = ret + use * t[src]
    wuse = wuse + 1
    rem = rem - use
  else
    local use = w + 1 - wuse
    if rem < use then use = rem end
    ret = ret + use * t[src]
    huse = huse + 1
    rem = rem - use
  end
  if rem == 0 then break end
end
print(ret)

Measured memory_bytes: 10620
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll MOD = 1e9+7;

#define vec     vector<int>
#define vecll   vector<ll>
#define vec2    vector<vector<int>>
#define vec2ll  vector<vector<ll>>
#define vpair   vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>
#define vecst   vector<string>
#define vecb    vector<bool>

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define mpair(v1, v2)    make_pair(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << var << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << var << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << var;
#define prt2(v1, v2)     cout << v1 << " " << v2 << "\n"
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
void prtok(bool ok){prt((ok ? "OK" : "NG"));}
//----------------------------------------------------------------
ll n, m, q;
vec a(51), b(51), c(51), d(51);

int dfs(vector<int> &v){
  if(v.size()==n){
    int sum = 0;
    rep(i,q){
      if(v[b[i]]-v[a[i]]==c[i]) sum += d[i];
    }
    return sum;
  }

  int last = (v.empty() ? 0 : v.back());
  int mx = 0;
  REP(i,last,m){
    v.push_back(i);
    //prtall(v);
    chmax(mx, dfs(v));
    v.pop_back();
  }
  return mx;
}

int main(void) {
  cin >> n >> m >> q;
  rep(i,q){
    cin >> a[i] >> b[i] >> c[i] >> d[i];
    a[i]--, b[i]--;
  }

  vec v;
  prt(dfs(v));

}


Measured memory_bytes: 3604
import sys
import itertools
import bisect

readInt = lambda : [int(i) for i in input().split()];
n = readInt()[0]
A = readInt()

B = list(itertools.accumulate(A))

cand = 2 * pow(10, 14)
for i in range(2, len(A)-1):
  z = B[i-1]
  s = z // 2
  j = bisect.bisect_right(B, s)
  if (j == 0):
    j0 = j
  else:
    c0 = abs(2 * B[j-1] - z)
    c1 = abs(2 * B[j] - z)
    j0 = j-1 if c0 < c1 else j

  z = B[-1]
  s = B[i-1] + (B[-1] - B[i-1]) // 2
  j = bisect.bisect_right(B, s)
  if (j == i):
    j1 = j
  else:
    c0 = abs(B[j-1] - B[i-1] - (B[-1] - B[j-1]))
    c1 = abs(B[j]   - B[i-1] - (B[-1] - B[j]  ))
    j1 = j-1 if c0 < c1 else j

  c = [B[j0], B[i-1] - B[j0], B[j1] - B[i-1], B[-1] - B[j1]]
  cand = min(cand, max(c) - min(c))

ans = cand
print(ans)


Measured memory_bytes: 25548
import sys

from collections import deque
# q = deque(); q.append(x); q.appendleft(x); q.pop() -> x; q.popleft() -> x
from collections import defaultdict
# d = defaultdict(lambda: []); d[key] -> []
import heapq
# hq = []; heapq.heappush(hq, x); heapq.heappop(hq) -> x; heapq.heappushpop(hq, x) -> x
import bisect
# i = bisect.bisect_left([1,2,3,4], 1.5); i = bisect.bisect_right([4,3,2,1], 1.5)

#import numpy as np
#from scipy.misc import comb

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

# BFS方法
def main():
    N = i2n()
    coins = [1]
    d = 6
    while d <= N:
        coins.append(d)
        d *= 6
    d = 9
    while d <= N:
        coins.append(d)
        d *= 9
    q = deque()
    q.append((0, 0))
    s = set((0,))
    while len(q) > 0:
        i, n = q.popleft()
        for j in coins:
            k = i + j
            if k == N:
                print(n+1)
                return
            if k > N:
                continue
            if k in s:
                continue
            q.append((k, n+1))
            s.add(k)
    print(-1)

main()


Measured memory_bytes: 47088
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=100005;

 main()

{
    fast
    int q;
    cin>>q;
    multiset<int>lo,hi;
    int sl=0,sh=0;
    int mid=0,cnt=0,bsum=0;
    while(q--)
    {
        int typ;
        cin>>typ;
        if(typ==1)
        {
           int x,y;
           cin>>x>>y;
           bsum+=y;
           cnt++;
           if(cnt==1)
           {
               mid=x;continue;
           }
           if(hi.size()>lo.size())
           {
              if(x>=mid)
              {
                  hi.insert(x);
                  int val=*hi.begin();
                  hi.erase(hi.begin());
                  sh+=x;
                  sh-=val;
                  sl+=mid;
                  lo.insert(mid);
                  mid=val;
              }
              else
              {
                  lo.insert(x);
                  sl+=x;
              }
           }
           else
           {
               if(x>mid)
               {
                   hi.insert(x);
                   sh+=x;
               }
               else
               {
                   lo.insert(x);
                   int val=*lo.rbegin();
                   lo.erase(lo.find(val));
                   sl+=x;
                   sl-=val;
                   sh+=mid;
                   hi.insert(mid);
                   mid=val;
               }
           }

        }
        else
        {
            int ses=mid*lo.size()-sl;
            ses+=bsum;
            ses+=(sh-hi.size()*mid);
            cout<<mid<<" "<<ses<<"\n";
        }
    }
    return 0;

}





































Measured memory_bytes: 12908
#include<bits/stdc++.h>
// __builtin_ctz : no of trailing zeros
#define ll long long
#define pp pair<ll,ll>
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define scan() int n; cin>>n ; int a[n]; for(int i = 0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
using namespace std;
ll max(ll x, ll y)
{
    return x>y ? x : y;
}
ll min(ll x, ll y)
{
    return x<y ? x : y;
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;cin >> s;
    for (int i = 0; i < s.size(); ++i)
    {
    	cout << "x";
    }
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
string to_string(pair<A, B> p);
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
string to_string(const string& s) {
  return '"' + s + '"';
}
string to_string(const char* s) {
  return to_string((string) s);
}
string to_string(bool b) {
  return (b ? "true" : "false");
}
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define dbg(...) cout << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define dbg(...) 42
#endif
const long long mod = 1e9+7; // CHECK
long long power(long long a, long long b, long long m = mod) {
    if(b < 0) {
        return power(power(a, -b), mod-2);
    }
    long long x = 1;
    while(b) {
        if(b & 1) {
            x = 1ll * x * a % m;
        }
        a = 1ll * a * a % m;
        b /= 2;
    }
    return x;
}
#define ll long long
const int INT_INF = 1e9+9;
const ll LL_INF = 2e18;
const int N = 3e5+9; // check N, mod

signed main() {  
    ios_base::sync_with_stdio(false); 
    cin.tie(0); cout.tie(0);
    
    int n, m; cin >> n >> m;
    string s, t; cin >> s >> t;
    ll l = 1ll * n * m / __gcd(n, m);
    ll p = l / n;
    // string u = string(l, '-');
    map<ll, char> u;
    for (int i = 0; i < n; i++) {
        u[i * p] = s[i];
    }
    p = l / m;
    for (int i = 0; i < m; i++) {
        if (u.count(i * p) && u[i * p] != t[i]) {
            cout << "-1\n";
            return 0;
        }
    }
    cout << l << endl;
    
    



    

    

    return 0;
}



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

class _0043 {
    private static int Count(int[] list) {
        int sum = 0;
        for (int i = 1; i < 10; i++)
            sum += list[i];
        return sum;
    }

    private static bool FindPair(int[] cls) {
        if (Count(cls) == 0) return true;

        for (int i = 1; i < 8; i++) {
            if (cls[i] >= 1 && cls[i + 1] >= 1 && cls[i + 2] >= 1) {
                cls[i]--;
                cls[i + 1]--;
                cls[i + 2]--;
                if (FindPair(cls)) return true;
                cls[i]++;
                cls[i + 1]++;
                cls[i + 2]++;
            }
        }
        for (int i = 1; i < 10; i++) {
            if (cls[i] >= 3) {
                cls[i] -= 3;
                if (FindPair(cls)) return true;
                cls[i] += 3;
            }
        }

        return false;
    }

    private static bool CheckRole(int check, int[] list) {
        int[] cls = new int[10];

        for (int cpos = 1; cpos < 10; cpos++) {
            list.CopyTo(cls, 0);
            cls[check]++;
            if (cls[cpos] < 2) continue;
            cls[cpos] -= 2;
            if (FindPair(cls)) return true;
            cls[cpos] += 2;
        }
        return false;
    }

    public static void Main() {
        string buf;
        int[] ls = new int[10];
        int check;
        Queue<int> pls = new Queue<int>();
        while((buf = Console.ReadLine()) != null) {
            for (int i = 1; i < 10; i++) ls[i] = 0;
            for (int i = 0; i < buf.Length; i++) ls[buf[i] - '0']++;
            for (int i = 1; i < 10; i++) if (ls[i] < 4) pls.Enqueue(i);
            buf = "";
            while(pls.Count != 0) {
                check = pls.Dequeue();
                if (CheckRole(check, ls)) buf += check + " ";
            }
            Console.WriteLine(buf != "" ? buf.Trim() : "0");
        }
    }
}

Measured memory_bytes: 9952
N = int(input())
D = list(map(int,input().split()))
d = { }
for i in range(N+1):
    d[i] = 0
for i in range(N):
    x = D[i]
    d[x] += 1
p = 0
if D[0] == 0:
    p = 1
q = 0
if d[0] == 1:
    q = 1
M = max(D)
r = 1
e = 998244353
for i in range(1,M):
    x = d[i]
    y = d[i+1]
    r = r*(x**y) % e
ans = p*q*r
print(ans)

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


int main() {
    string x;
    string y;
    cin>>x;
    cin>>y;
    int ans=0;
    rep(i,(int)x.size()){
        if(x[i]!=y[i])ans++;
    }
    cout<<ans;
    
    return 0;
}


Measured memory_bytes: 3804
import java.math.*;
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int n = sc.nextInt();
        if(n%2==0){
            System.out.println(n/2);
        } else {
            System.out.println(n/2+1);
        }
        }
	}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
using Int = long long;
const char newl = '\n';


struct Precision{
  Precision(){
    cout<<fixed<<setprecision(12);
  }
}precision_beet;

//INSERT ABOVE HERE
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  using D = double;
  D r;
  cin>>r;
  cout<<r*asin(1)*4<<newl;
  return 0;
}


Measured memory_bytes: 3788
//保留所有权利。
#include<iostream>
#include<stdio.h>//printするよ
#include<vector>
#include<algorithm>//辞書順はnext_permutationだよ
#include<set>
#include<string>
#include<sstream>
#include<string.h>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swapで数値交換するよ
//END OF LIBRARIES.
#define rt "\n"//改行を最速化させるよ
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(s,n) rep(i,n)cin>>s[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define cncn int cnt=0
#define smsm int sum=0
#define str srting
#define v vector
#define please return
#define AC 0//おまじないだよ
#define Rapid cin.tie(0);ios::sync_with_stdio(false)
//END OF DEFINE.
using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vcha;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvcha;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
//printf("%02d:%02d:%02d\n", h, m, s);・・・2文字は埋める・h、m、ｓ
//END OF TYPEDEF.

//最大公約数（GCD）を求めるよ
//最小公倍数（LCM）は＜＜　A × B ÷ GCD　 ＞＞で求まるよ

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}
/*
  for A以上B未満でI探索 for (int I = A; i <= B; i++)

  string s = to_string(i);

  char　小文字のほうが32大　　  　大文字と小文字の境=93

  大文字→小文字 文字列のn文字目を大文字で出力→ (char)toupper(a[0])

  int i = sqrt (n) で、ｎの平方根(9に対する3)をiに入れる

  pow(a,b) → aのb乗を求める

  s1.erase(n) 文字列s1の、n文字目以降削除             */

int a = 0, b = 0, c = 0, d = 0, x = 0, y = 0
, z = 0, n = 0, sum = 0, i = 0, ans = 0, cnt = 0;
string s = "";

int main(void) {
	vint a(3);
	vcin(a, 3);
	sort(a);
	Yes((a[0] == a[1] && a[1] != a[2])||(a[0]!=a[1]&&a[1]==a[2]));
	please AC;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool arr[100100];
void Eratosthenes(){
  for(int i = 0; i < 100100; i++){ arr[i] = true;}
  arr[0] = false; arr[1] = false;
  for(int i = 0; i < 100100; i++){
    if( !arr[i]){ continue;}
    for(int j = 2; i*j < 100100; j++){
      arr[i*j] = false;}
  }
  
}
      


int main(){
int N; cin >> N;
  Eratosthenes(); int i = 0;
 while( N > 0){
    if( arr[i]){
      if(i%5 == 1){ cout << i << " "; N--;}}
   i++;} cout << endl;
  return 0;}

Measured memory_bytes: 384
N,M=gets.split.map(&:to_i)
ss=Array.new(N){Array.new}
M.times do |i|
  a=gets.split.map(&:to_i)[1..-1]
  a.each do |e|
    ss[e-1] << i
  end
end
ps=gets.split.map(&:to_i)
cnt=0
for i in 0...2**N
  con=Array.new(M,0)
  for j in 0...N
    if (i & (1 << j))!=0
      ss[j].each do |e|
        con[e]+=1
      end
    end
  end
  flag=true
  M.times do |j|
    flag=false if (con[j]%2)!=ps[j]
  end
  cnt+=1 if flag
end
puts cnt


Measured memory_bytes: 1916
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x) (int)((x).size())
#define debug(x) cout << #x << ":" << x << ' ';
#define debugg(x) cout << #x << ":" << x << ' ' << "\n";
#define endl "\n"
#define L(X) ((X)<<1)
#define R(X) (((X)<<1)|1)
#define M(X,Y) (((X)+(Y))>>1)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int MAXN = 1e5 + 5;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const long long int LLINF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-9;
const double PI = acos(-1);

template<typename T>   T max_self(T& a, T b) { if (a < b) a = b; return a; }
template<typename T>   T min_self(T& a, T b) { if (a > b) a = b; return a; }
template<typename T>   T add(T x, T y) { return ((x % MOD)  + (y % MOD)) % MOD;}
template<typename T>   T mul(T x, T y) { return ((x % MOD) * (long long)(y % MOD)) % MOD;}
template<typename T>   T sub(T x, T y) { return add(x, -y + MOD);}
template<typename T>   T gcd(T a, T b) { return b ? gcd(b, a % b) : a;}
template<typename T>   T lcm(T a, T b) { return a / gcd(a, b) * b;}
template<typename T>   vector<T> read(vector<T>& v, int n) {v.resize(n); for (auto &x : v)cin >> x;}
template<typename T>   void trav(vector<T> &v) {for (int i = 0 ; i < (int)v.size() ; ++i) {cout << v[i]; if (i != (int)v.size() - 1) cout << ' ';}}
int lg2(long long x)   {   return 64 - __builtin_clzll(x) - 1;	}
int lg2(int x)   {   return 32 - __builtin_clzll(x) - 1;	}



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

	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>
using namespace std;

int main(){
    int_fast64_t N;
    scanf("%lld", &N);
    int_fast64_t x(1);
    while(2 * N > x * (x - 1)){
        ++x;
    }
    --x;
    while(N && x > 0){
        if(N >= x){
            N -= x;
            printf("%lld\n", x);
        }
        --x;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
const ll INF = 1e9 + 7;
typedef pair<int,int> P;// pair型は２つの値の組を表せる


int main(){
    int N; cin >> N;
    vector <int> X(N);
    rep(i,N) cin >> X[i];
    
    float mid=0;
    rep(i,N) mid+=X[i];
    mid/=N;
    int num=round(mid);
    
    int ans=0;
    rep(i,N){
        ans+=pow(X[i]-num,2);
    }
    cout << ans << endl;
    
    
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
const int INF = 1e9;

int main(){
  int N;
  cin >> N;
  vector<int> P(N);
  for(int i = 0; i < N; ++i) cin >> P[i];
  map<int, int> M;
  int s = 0;
  for(int i = 0; i < N; ++i){
    M[P[i]] = M[P[i]-1] + 1;
    s = max(s, M[P[i]]);
  }
  cout << N - s << endl;
  return 0;
}


Measured memory_bytes: 10368
#include <iostream>

using namespace std;

int main(){
	while(true){
		int m,f,r;
		cin >> m >> f >> r;
		if(m == -1 && f == -1 && r == -1) break;
		
		char ans;
		
		if(m == -1 || f == -1) ans = 'F';
		else if(m + f >= 80) ans = 'A';
		else if(m + f >= 65) ans = 'B';
		else if(m + f >= 50) ans = 'C';
		else if(m + f >= 30){
			if(r >= 50) ans = 'C';
			else ans = 'D';
		}
		else ans = 'F';
		
		cout << ans << endl;
		
	}
}



Measured memory_bytes: 3088
#include <stdio.h>
#include <math.h>
int main() {
	int week;
	double mod, debt = 100000.0;
	scanf(" %d", &week);
	while (week--) {
		debt += debt * 0.05;
		mod = fmod(debt, 1000.0);
		debt = debt - mod + (mod ? 1000.0 : 0);
	}
	printf("%d\n", (int)debt);
	return 0;
}

Measured memory_bytes: 592
#include <iostream>

using namespace std;

int main(){
  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;
  }
  
  return 0;
}


Measured memory_bytes: 256
int main(void){
    int a[200010];
    int ans[200010];

    int n;
    scanf("%d",&n);
    for(int i=2;i<=n;i++)scanf("%d",&a[i]);
    for(int i=2;i<=n;i++)ans[a[i]]++;
    for(int i=1;i<=n;i++)printf("%d\n",ans[i]);
}

Measured memory_bytes: 3720
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include<vector>
#include<iomanip>
#include<map>
#include <queue>
#include<cmath>
#include<cstdio>
#include<iomanip>
#include<set>

using namespace std;
using ll = long long int;


int main(void){
  
  int l;
  cin>>l;
  double a = (double)l/3.0;
  double b = (double)l/3.0;
  double c= (double)l - a- b;

  std::cout << std::fixed;
  cout<<std::setprecision(10)<<a*b*c<<endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cassert>
#include<math.h>
#include<complex>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

ll N,x;
ll ans[200010]={};
ll Abs(ll n){
    if(n<0)return -n;
    else return n;
}
int main(){
    cin>>N>>x;
    if(N==2){
        if(x==2){
            cout<<"Yes"<<endl;
            cout<<1<<endl<<2<<endl<<3<<endl;
        }else{
            cout<<"No"<<endl;
        }
        return 0;
    }
    if(x==1 || x==2*N-1){
        cout<<"No"<<endl;
        return 0;
    }
    cout<<"Yes"<<endl;
    vector<ll> v;
    if(x==2){
        ans[N-1]=2;
        ans[N-2]=1;
        ans[N-3]=4;
        ans[N]=3;
        for(ll i=5;i<=2*N-1;i++){
            v.push_back(i);
        }
    }
    else{
        ans[N-1]=x;
        ans[N]=x+1;
        ans[N-2]=x-1;
        ans[N+1]=x-2;
        for(ll i=1;i<=2*N-1;i++){
            if(Abs(x-i)<=1)continue;
            if(i==x-2)continue;
            v.push_back(i);
        }
    }
    ll now=0;
    for(ll i=0;i<2*N-1;i++){
        if(ans[i]==0){
            ans[i]=v[now];
            now++;
        }
        cout<<ans[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 4720
#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using Graph = vector<vector<int>>;
Graph g;
int dist[101010][2];

void dfs(int cur, int pre, int d, int id) {
    dist[cur][id] = d;

    for (const auto next: g[cur]) {
        if (next != pre) {
            dfs(next, cur, d + 1, id);
        }
    }
}
int main() {
    int n, u, v; cin >> n >> u >> v;
    u -= 1;
    v -= 1;
    g.assign(n, vector<int>());
    rep(i, n - 1) {
        int a, b; cin >> a >> b;
        --a, --b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    dfs(u, u, 0, 0);
    dfs(v, v, 0, 1);

    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (dist[i][0] < dist[i][1]) {
            ans = max(ans, dist[i][1] - 1);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 11648
import java.util.*;
public class Main{
  public static void main(String[]args){
      Scanner sc = new Scanner(System.in);

      int n = sc.nextInt();
      int k = sc.nextInt();
      int x = sc.nextInt();
      int y = sc.nextInt();
      int sum=0;

      if (n<=k) {
        for (int i = 0;i<n ;i++ ) {
          sum = sum + x;
        }
        System.out.println(sum);
        System.exit(0);
      }

      for (int i = 0;i<k ;i++ ) {
        sum = sum + x;
      }
      for (int i = k;i<n ;i++ ) {
        sum = sum + y;
      }
      System.out.println(sum);

  }
}


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

using namespace std;

typedef long long LL;

LL N;

LL check(LL M) {
	if (M == 0) {
		return 0;
	}
	if (N / M == N % M) {
		return M;
	} else {
		return 0;
	}
}

int main() {
	scanf("%lld",&N);
	LL ans = 0;
	for (LL m1=1;m1*m1<=N;m1++) {
		if (N % m1 == 0) {
			ans += check(m1 - 1);
			if (m1 * m1 != N) {
				ans += check(N / m1 - 1);
			}
		}
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 256
#include"stdio.h"
using namespace std;
int i,ans;
char a[20]={0,'C','O','D','E','F','E','S','T','I','V','A','L','2','0','1','6'},c;
int main(){
	for(i=1;i<=16;i++){
		c=getchar();
		if(c!=a[i]) ans++;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 128
def main():
  
	n = int(input())
	a = list(map(int,input().split()))
	uppest = pow(10 , 18)

	ans = 1

	if 0 in a:
  		print (0)
  		return

	for s in a:
	  	ans *= s
  		if ans > uppest:
    			print(-1)
    			return
  
	print(ans)

main()

Measured memory_bytes: 21720
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;

const int maxm = 11;
const int maxn = 128 + 10;
const int maxBit = (1 << maxm);
const int inf = 1000000000;

int n, m;
int array[maxn];

int f[maxBit][maxBit];
bool ok(int t1, int t2)
{
	int res = 0;
	for (int i = 1; i <= n; ++i)
	{
		if ((array[i] & t1) == t2)
			res++;
	}
	return (res <= 1);
}
int dp(int haveAsked, int answer)
{
	int t1 = haveAsked, t2 = answer;
	if (f[t1][t2] != -1)
		return f[t1][t2];

	f[t1][t2] = inf;

	if (ok(t1, t2))
		return f[t1][t2] = 0;

	for (int i = 0; i < m; ++i)
	{
		if (!(t1 & (1 << i)))
			f[t1][t2] = min(f[t1][t2], max(dp(t1 | (1 << i), t2), dp(t1 | (1 << i), t2 ^ (1 << i))) + 1);
	}
	
	return f[t1][t2];
}


int main()
{
	static char s[maxm];
	while (scanf("%d %d", &m, &n) != EOF && n && m)
	{
		memset(f, -1, sizeof f);

		for (int i = 1; i <= n; ++i)
		{
			int res = 0;
			scanf(" %s", s);
			for (int j = 0; j < m; ++j)
			{
				if (s[j] == '1')
					res |= (1 << j);
			}

			array[i] = res;
		}
		
		cout << dp(0, 0) << endl;
	}
	return 0;
}

Measured memory_bytes: 17604
/*input
3000

*/ 
#include <iostream>
#include <bits/stdc++.h>
#include <math.h> 
#include <algorithm>
#include <unordered_map>
#include <unordered_set>

using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define gc getchar_unlocked
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define bloop(i,a,b) for (int i = a ; i>=b;i--)
#define tc(t) int t; cin >> t; while (t--)
#define int long long
#define si(x)   scanf("%d",&x)
#define sl(x)   scanf("%lld",&x)
#define ss(s)   scanf("%s",s)
#define pi(x)   printf("%d\n",x)
#define pl(x)   printf("%lld\n",x)
#define ps(s)   printf("%s\n",s)
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define ms(a,x) memset(a, x, sizeof(a));
#define endl "\n"
#define trav(a,x) for(auto &a:x)
#define bits(n) __builtin_popcount(n)
int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a);}
typedef pair<int, int>  pii;
typedef vector<int>     vi;
typedef vector<pii>     vpii;
typedef vector<vi>      vvi;
int mpow(int base, int exp); 
void ipgraph(int m);
//void dfs(int u, int par);
const int mod = 1000000007;
const int N = 1000000001;
const int MAX = 2*pow(10,6)+5;
 

//standard input and output template
template<typename... T>
void in(T&... args) {
    ((cin >> args), ...);
}

template<typename... T>
void out(T&&... args) {
    ((cout << args << " "), ...);
}

template<typename... T>
void outl(T&&... args) {
    ((cout << args << endl), ...);
}


int fast_exp(int base, int exp) {
    int res=1;
    while(exp>0) {
       if(exp%2==1) res=(res*base)%mod;
       base=(base*base)%mod;
       exp/=2;
    }
    return res%mod;
}




int32_t main() {
  IOS;
  int n;cin>>n;
  int ans = ceil((n*1.0)/1000);
  cout<<ans*1000-n<<endl;
  return 0;
}

Measured memory_bytes: 3704
//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define trav(x,A) for(auto &x:A)
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef vector<int> veci;
typedef vector<long long> vecl;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);

//Required Functions

ll power(ll x,ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % MOD; 
    p = (p * p) % MOD; 
  
    return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

int main()
{
    #ifndef ONLINE_JUDGE
    if (fopen("INPUT.txt", "r"))
    {
        freopen ("INPUT.txt" , "r" , stdin);
        //freopen ("OUTPUT.txt" , "w" , stdout);
    }
    #endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    clock_t clk;
    clk = clock();
//-----------------------------------------------------------------------------------------------------------//

    READV(S);
    READV(W);
    if(S>W)
    {
        cout<<"safe"<<endl;
    }
    else
    {
        cout<<"unsafe"<<endl;
    }
    

//-----------------------------------------------------------------------------------------------------------//


    clk = clock() - clk;
    cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << endl;

    return 0;
}

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

int n;
int g[101][101];

int d[101];
char c[101];
int p[101];

void prim() {
    for (int i = 0; i < n; ++i) {
        d[i] = INT_MAX;
        c[i] = 'w';
    }
    c[0] = 'b';
    d[0] = 0;
    while (true) {
        int u, v;
        int mine = INT_MAX;
        for (int j = 0; j < n; ++j) {
            if (c[j] == 'b') {
                u = j;
                for (int k = 0; k < n; ++k) {
                    if(g[u][k] > -1 && g[u][k] <= d[k] && c[k] != 'b' && g[u][k] <= mine) {
                        d[k] = g[u][k];
                        mine = d[k];
                        v = k;
                    }
                }
            }
        }
        p[v] = u;
        c[v] = 'b';
        if(mine == INT_MAX) break;
    }
}

int main() {
    cin >> n;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            int w;
            cin >> w;
            g[i][j] = w;
        }
    }
    prim();
    int sum = 0;
    for (int k = 0; k < n; ++k) {
        sum += d[k];
    }
    cout << sum << endl;


    return 0;
}



Measured memory_bytes: 3112
from sys import stdin,stdout
from collections import defaultdict,deque

n, q = map(int,stdin.readline().split())
queries = stdin.readlines()
A = defaultdict(deque)
ans = []

#count = 0
for query in queries:
    #print(count)
    #count += 1
    query = query.split()
    if query[0] == '0':
        A[int(query[1])].append(query[2])
    elif query[0] == '1':
        index = int(query[1])
        if A[index]:
            ans.append(A[index][-1])
    else:
        index = int(query[1])
        if A[index]:
            A[index].pop()

print('\n'.join(ans))



Measured memory_bytes: 35832
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;


class Program {


	static long mod = 1000000007;
	//static long mod =998244353; 
	static void Main(string[] args) {

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

		//int n = int.Parse(Console.ReadLine());
		//int val = int.Parse(Console.ReadLine());
		//int[] vals = parseAry(Console.ReadLine().Split(cs));
		//string str = Console.ReadLine();
		//string[] strs = Console.ReadLine().Split(cs);

		//string res = "";
		int res = 0;



		int[] vals = parseAry(Console.ReadLine().Split(cs));


		int[] bo = new int[300]; 
			bo[1]=300000;
		bo[2]=200000;
		bo[3]=100000;

		if ( vals[0] == 1 && vals[1] == 1 ) {
			res += 400000;
		}
		res += bo[vals[0]];
		res += bo[vals[1]];

			Console.WriteLine(res);

		return;

	}


	static long combination(long n, long r) {
		if ( r * 2 > n ) r = n - r;
		long dividend = 1;
		long divisor = 1;
		for ( long i = 1; i <= r; ++i ) {
			dividend = ( dividend * ( n - i + 1 ) ) % mod;
			divisor = ( divisor * i ) % mod;
		}
		return ( dividend * mod_pow(divisor, mod - 2) ) % mod;
		// return dividend / divisor;
	}
	//	x^nを求める
	static public long mod_pow(long x, long n) {
		long res = 1;
		while ( n > 0 ) {
			if ( ( n & 1 ) == 1 ) { res = res * x % mod; }
			x = x * x % mod;
			n >>= 1;
		}
		return res;
	}

	//	int配列をスペース区切りの文字列に変換
	static string stringBuilderArrayInt(int[] a) {
		StringBuilder sb = new StringBuilder();

		for ( int i = 0; i < a.Length; i++ ) {
			sb.Append(a[i] + " "); 
		}
		if ( sb.Length > 1 ) {
			sb = sb.Remove(sb.Length - 1, 1);
		}
		return sb.ToString(); ;
	}


	//	文字列strをindex番目からdで上書き
	static string strOverWrite(string str, int i, string s) {
		return str.Remove(i, s.Length).Insert(i, s);
	}

	//　String[]  ----->  int[]
	static int[] parseAry(string[] str) {
		int[] nums = new int[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = int.Parse(str[i]); }
		return nums;
	}
	//　String[]  ----->  long[]
	static long[] parseAryL(string[] str) {
		long[] nums = new long[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = long.Parse(str[i]); }
		return nums;
	}

	//文字列を1文字ずつString[]に入れる
	static string[] strAry(String str) {
		string[] re = new string[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { re[i] = str[i].ToString(); }
		return re;
	}



}

Measured memory_bytes: 13140
# printデバッグ用
import sys
argVec = sys.argv
if len(argVec) > 1:
    GBN_DEBUG = True
else:
    GBN_DEBUG = False

def dprn(s, i):
    if GBN_DEBUG:
        print(", " + s + " = " + str(i), end = "")

def dprns(s):
    if GBN_DEBUG:
        print(", " + s, end = "")

def dprni(i):
    if GBN_DEBUG:
        print(str(i), end=" ")

#S = input()
#N = int(input())
#S, T = input().split() 
N, L = map(int, input().split()) 
S = [input() for _ in range(N)]
#A = list(map(int, input().split()))

S.sort()
for i in range(N):
    print(S[i], end="")
print('')


Measured memory_bytes: 3064
import copy

N, L = map(int, input().split())
aji = [0]*N
for i in range(1, N+1):
    aji[i-1] = L+i-1
aji_sum = sum(aji)
ansl = [0]*N
for i in range(N):
    aji_tmp = copy.copy(aji)
    aji_tmp.pop(i)
    ansl[i] = abs(aji_sum - sum(aji_tmp))
ans_ind = ansl.index(min(ansl))
aji.pop(ans_ind)
print(sum(aji))


Measured memory_bytes: 3444
#include <stdio.h>
#include <stdlib.h>
 
int main(void){
  int x, a, b;
  int A,B;
  scanf("%d %d %d", &x, &a, &b);
  A = a-x;
  B = b-x;
  
  if(A<0) A = -A;
  if(B<0) B = -B;
  
  if(A<B){
    printf("A\n");
  }else{
    printf("B\n");
  }
  
  return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <complex>
#include <cmath>
#include <vector>

using namespace std;

typedef complex<double> xy_t;

double cross_product(xy_t a, xy_t b) {
	return (conj(a) * b).imag();
}

int main() {
	int id = 1;
	while (1) {
		int n;
		double x, y;
		double s = 0;
		scanf("%d", &n);
		if (n == 0) return 0;
		vector<xy_t> vertex;
		for (int i = 0; i < n; i++) {
			scanf("%lf %lf", &x, &y);
			vertex.push_back(xy_t(x, y));
		}
		for (int i = 1; i < vertex.size() - 1; i++) {
			s += cross_product(vertex[i + 1] - vertex[0], vertex[i] - vertex[0]) / 2;
		}
		printf("%d %.1f\n", id, s);
		id++;
	}
}

Measured memory_bytes: 1092
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <cmath>         // sqrt
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <bits/stdc++.h> // isupper, islower, isdigit, toupper, tolower
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, n) for (int i = (a); i < (n); i++)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> Pl;
typedef pair<int, int> P;
typedef tuple<ll, ll, string> Tlls;

// Greatest Common Divisor (最大公約数)
ll gcd(ll a, ll b)
{
  // Eucledean algorithm
  while (a)
  {
    if (a < b)
    {
      std::swap(a, b);
    }
    a %= b;
  }
  return b;
}

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

// key: value of prime factor素因数分解
// value: number of prime factor
map<ll, ll> prime_factorization(ll n)
{
  map<ll, ll> prime_factors;
  for (ll i = 2; i * i <= n; i++)
  {
    while (n % i == 0)
    {
      prime_factors[i]++;
      n /= i;
    }
  }
  if (n != 1)
    prime_factors[n] = 1;
  return prime_factors;
}

// 約数リスト約数の列挙
vector<ll> get_divisors(const ll n)
{
  vector<ll> divs;
  for (ll i = 1; i < (ll)sqrt((ld)n) + 1; i++)
  {
    if (n % i == 0)
    {
      divs.push_back(i);
      if (i != n / i)
      {
        divs.push_back(n / i);
      }
    }
  }

  // 必要に応じてソート
  // sort(divs.begin(), divs.end());

  return divs;
}

int main()
{

  string A, B;
  cin >> A >> B;
  if (A.length() > B.length())
  {
    cout << "GREATER" << endl;
    return 0;
  }
  else if (A.length() < B.length())
  {
    cout << "LESS" << endl;
    return 0;
  }
  rep(i, A.length())
  {
    if (A.at(i) > B.at(i))
    {
      cout << "GREATER" << endl;
      return 0;
    }
    else if (A.at(i) < B.at(i))
    {
      cout << "LESS" << endl;
      return 0;
    }
  }
  cout << "EQUAL" << endl;

  return 0;
}


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

int main(){
    int n,m; cin >> n >> m;
    vector<int> x(m),y(m-1);
    rep(i,m) cin >> x[i];
    sort(x.begin(),x.end());
    rep(i,m-1) y[i]=x[i+1]-x[i];
    sort(y.begin(),y.end());

    ll ans=0;
    rep(i,m-n){
        ans+=y[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll read(){
	ll a=0,b=getchar(),c=1;
	while(!isdigit(b))c=b=='-'?-1:1,b=getchar();
	while(isdigit(b))a=a*10+b-'0',b=getchar();
	return a*c;
}
void print(ll x){
	if(x<0)putchar('-'),x=-x;
	char y=x%10+'0';
	if(x>=10)print(x/10);
	putchar(y);
}
const int N=4000005;
char s[N],t[N];
int k,n,m,ans,fail[N],dp[N];
int main(){
	scanf("%s%s",s+1,t+1);
	k=strlen(s+1),n=k,m=strlen(t+1);
	while(n<m*2){
		for(int i=1;i<=n;i++)
			s[n+i]=s[i];
		n*=2;
	}
	for(int i=1;i<=n;i++)
		s[n+i]=s[i];
	n*=2,fail[0]=-1;
	for(int i=1;i<=m;i++){
		int j=i-1;
		while(j and t[fail[j]+1]!=t[i])j=fail[j];
		fail[i]=fail[j]+1;
	}
	int j=0;
	for(int i=1;i<=n;i++){
		while(~j and s[i]!=t[j+1])j=fail[j];
		j++;
		if(j==m)dp[i]=dp[i-m]+1,ans=max(ans,dp[i]);	
	}
	if(ans>=n/m-1)ans=-1;
	print(ans);
	return 0;
}

Measured memory_bytes: 23040
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();//回答時間
    int time[] = new int[N];
    for(int i = 0;i < N;i++){
      time[i] = sc.nextInt();
    }
    int M = sc.nextInt();//ドリンク
    int target[] = new int[M];
    int change[] = new int[M];
    for(int j = 0;j < M;j++){
      target[j] = sc.nextInt() - 1;
      change[j] = sc.nextInt();
    }
    //処理
    int total;
    int normaltotal = 0;
    for(int l = 0;l < N;l++){
      normaltotal += time[l];
    }
    for(int k = 0;k < M;k++){
      total = normaltotal;
      total = total - time[target[k]] + change[k];
      System.out.println(total);
    }

  }
}


Measured memory_bytes: 23764
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
 
using namespace std;
 
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
 
long gcd(long a, long b){
	if (a%b==0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}
}
 
long lcm(long a, long b){
	return (a*b) / gcd(a,b);
}
 
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a < b) { a = b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a > b) { a = b; return 1; } return 0; }
 
typedef long long ll;

const ll INF = 1ll<<60;
const ll MOD = 1000000007;
const double EPS = 1e-10;

ll f(ll a, ll b){
	return max((ll)log10(a)+1, (ll)log10(b)+1);
}

int main(){
	ll n;
	
	cin >> n;
	
	double root = pow(n, 0.5);
	
	ll r = (ll)root;
	r++;
	
	ll a = 1;
	
	FOR(i,2,r+1){
		if (n%i == 0) a = i;
	}
	
	cout << f(a, n/a) << endl;
	
	return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
int main(void){
    // Your code here!
    int W, H, x, y;
    
    scanf("%d %d %d %d", &W, &H, &x, &y);
    printf("%lf %d\n", (double)(W) * (double)(H) / 2, x+x == W && y+y == H);
}


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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

int main()
{

    lint a, b;
    cin >> a >> b;

    lint ans;

    ans = (b-1) / (a - 1);
    if ((b - 1) % (a - 1)!=0){
        ans += 1;
    }

        cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 256