akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define SZ(a) ((int)(a).size())
typedef long long int64;
string S[55][2];
int C[55];
bool vis[55][55][2], isp[55][55][2];
int main() {
#ifdef LOCAL
  freopen(".a.in", "r", stdin);
#endif
  ios_base::sync_with_stdio(false), cout.tie(0), cin.tie(0);
  int n;
  cin >> n;

  for (int i = 0; i < n; ++i) {
    cin >> S[i][0] >> C[i];
    S[i][1] = S[i][0];
    reverse(S[i][1].begin(), S[i][1].end());
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j <= SZ(S[i][0]); ++j) {
      for (int a = 0; a < 2; ++a) {
        int l = SZ(S[i][0]) - j, r = SZ(S[i][0]) - 1;
        isp[i][j][a] = 1;
        while (l < r) {
          if (S[i][a][l] != S[i][a][r]) isp[i][j][a] = 0;
          ++l;
          --r;
        }
      }
    }
  }
  using pi = pair<pair<int64, int>, pair<int, int>>;
#define mp make_pair
  priority_queue<pi> que;
  int64 ans = 2e18;
  for (int i = 0; i < n; ++i) {
    que.emplace(mp(-C[i], i), mp(SZ(S[i][0]), 0));
  }
  while (SZ(que)) {
    auto t = que.top();
    que.pop();
    int64 v = -t.first.first;
    int idx = t.first.second, len = t.second.first, rv = t.second.second;
    vis[idx][len][rv] = 1;
    if (isp[idx][len][rv]) {
      ans = min(ans, v);
      continue;
    }
    int ssz = SZ(S[idx][rv]);
    for (int i = 0; i < n; ++i) {
      int sz = SZ(S[i][0]);
      int a = rv ^ 1;
      if (sz <= len) {
        if (S[idx][rv].substr(ssz - len, sz) == S[i][a]) {
          if (!vis[idx][len - sz][rv]) {
            que.emplace(mp(-C[i] - v, idx), mp(len - sz, rv));
          }
        }
      } else {
        if (S[idx][rv].substr(ssz - len, len) == S[i][a].substr(0, len)) {
          if (!vis[i][sz - len][a]) {
            que.emplace(mp(-C[i] - v, i), mp(sz - len, a));
          }
        }
      }
    }
  }
  if (ans == 2e18)
    cout << -1;
  else
    cout << ans;
  return 0;
}
//2020.08.15 23:16:07


Measured memory_bytes: 3568
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int main()
{
	LL a, b;
	in >> a >> b;
	out << (a <= 9 && b <= 9 ? a*b : -1) << std::endl;
}


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

int min(int x,int y){if(x<=y)return x; return y;}

int main(){
	int a,b,c,d,e;
	scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);
	printf("%d\n",min(a,min(b,c))+min(d,e)-50);
}

Measured memory_bytes: 1168
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;

/* --------------------------------------------------- */

int main() {
    int h, w, k;
    cin >> h >> w >> k;
    vector<string> c(h);
    rep(i, h) cin >> c[i];

    int ans = 0;
    for(int s = 0; s < (1 << h); s++) {
        for(int t = 0; t < (1 << w); t++) {
            int tot = 0;
            rep(i, h) {
                rep(j, w) {
                    if(s >> i & 1) continue;
                    if(t >> j & 1) continue;
                    if(c[i][j] == '#') tot++;
                }
            }
            if(tot == k) ans++;
        }
    }
    cout << ans << endl;

    return 0;
}

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

const int MOD = 1e9 + 7;

int main() {
    int N, K;  cin >> N >> K;
    vector<int> a(N);
    for (int i = 0; i < N; ++i) cin >> a[i];

    vector<vector<long long>> dp(N + 1, vector<long long>(K + 1));
    dp[0][0] = 1;
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j <= K; ++j) {
            dp[i + 1][j] = dp[i][j];
            if (j >= 1) dp[i + 1][j] = (dp[i + 1][j] + dp[i + 1][j - 1]) % MOD;
            if (j - a[i] - 1 >= 0) dp[i + 1][j] = (dp[i + 1][j] - dp[i][j - a[i] - 1] + MOD) % MOD;
        }
    }

    cout << dp[N][K] << endl;
}


Measured memory_bytes: 80256
#include<stdio.h>
int main()
{
  int W,a,b;
  int con=0;
  
  scanf("%d %d %d",&W,&a,&b);
  
  while(b>W+a||b+W<a){
    if(b>W+a) {
      b--;
      con++;
    }
    else if(b+W<a){
      b++;
      con++;
    }
  }
  printf("%d",con);
  
  return 0;
}

Measured memory_bytes: 128
N = int(input())
L = list(map(int,input().split()))
L.sort(reverse=True)
 
ck = [0]*(N-2)
#print(L)

ans = 0
for i in range(N-2):
  j = i + 1
  k = N - 1
  #print(i,j,k)
  while j < k:
    if L[i]-L[j]-L[k] < 0:
      ans += k-j
      j += 1 
    else:
      k -=1
  
print(ans)

Measured memory_bytes: 3188
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include <algorithm>
#include<initializer_list>
using namespace std;
#define ul long long

#define rup(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define rdn(i, a, b) for(int (i) = (a); (i) > (b); (i)--)

ul frac(int n) {
	ul res = 1;
	const ul m = (ul)1e9+7;
	for (int i = 1; i <= n; i++) {
		res = (res*i)%m;
	}
	return res;
}

int main() {
	int n, m;
	cin >> n >> m;
	if (abs(n - m) > 1) {
		cout << 0;
	}
	else {
		ul monkey, dog;
		dog = frac(n);
		monkey = frac(m);
		if (n == m) {
			cout << (2*dog * monkey) % ((ul)1e9 + 7);
		}
		else {
			cout << (dog * monkey) % ((ul)1e9 + 7);
		}
	}
	return 0;
}



Measured memory_bytes: 384
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
MOD=10**9+7

@lru_cache(maxsize=2000)
def fact(num):
  if num <= 1:
    return 1
  return num * fact(num-1)

def comb(a, b):
  # print((a, b))
  return fact(a) // fact(b) // fact(a-b)

n, k = map(int, input().split())

for i in range(k):
  print(comb(k-1, i) * comb(n-k+1, i+1) % MOD)

Measured memory_bytes: 116440
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define fs first
#define sc second
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
 
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

    int N; cin >> N;
    vector<int> H(N);
    rep(i,N) cin >> H[i];
    int cnt = 1;
    bool ans = true;

    rep1(i,N) {
        ans = true;
        rep(j,i + 1) if (H[j] > H[i]) ans = false;
        if (ans == true) cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	_, k := intScanner(), intScanner()-1
	s := Scanner()
	for i, r := range s {
		if i == k {
			fmt.Print(string(r + 32))
		} else {
			fmt.Print(string(r))
		}
	}
	fmt.Println("")
}


Measured memory_bytes: 1780
#include<iostream>
#include<math.h>

using namespace std;

int main(){
    string a;
    cin>>a;
    for(int i=0;i<3;i++){
      if(a[i]=='1'){
        a[i]='9';
      }else if(a[i]=='9'){
        a[i]='1';
      }
    }
    cout<<a<<endl;
}

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

int main(void){
  int i, tmp, w, n, *lot, a, b;

  scanf("%d%d", &w, &n);
  lot = (int *)malloc(sizeof(int) * w);
  if(lot == NULL){
    printf("?????¢????¢??????¨??????\n");
    return -1;
  }
  for(i = 0; i < w; i++){
    lot[i] = i+1;
  }
  for(i = 0; i < n; i++){
    scanf(" %d,%d", &a, &b);
    tmp = lot[a-1];
    lot[a-1] = lot[b-1];
    lot[b-1] = tmp;
  }
  for(i = 0; i < w; i++){
    printf("%d\n", lot[i]);
  }
  free(lot);
  return 0;
}

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


class Program {

	const long mod = 1000000007;
	//public static int[] max;

	static void Main(string[] args) {

		char[] cs = new char[] { ' ', ',' };
		//int val = int.Parse(Console.ReadLine());
		//int[] vals = parseAry(Console.ReadLine().Split(cs));
		//string str = Console.ReadLine();
		//string[] strs = Console.ReadLine().Split(cs);

		//int[] vals = parseAry(Console.ReadLine().Split(cs));
		//int n = vals[0];
		//string res="";

		//int y = vals[0];
		//int x = vals[1];

		int[] vals = parseAry(Console.ReadLine().Split(cs));
		int[] pay = parseAry(Console.ReadLine().Split(cs));
		int x = vals[2];
		int low = 0, hight = 0;
		for (int i = 0; i < pay.Length; i++) {
			if (x < pay[i]) {
				hight++;
			} else { low++; }
		}

			//deug
			Console.WriteLine(Math.Min(low, hight));

		int stop=1;
		return;
	}



	//　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] = int.Parse(str[i]); }
		return nums;
	}




}

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

int main()
{
ll n ;
cin >> n ;
char v[n][10];
rep(i, n)rep(j,10){
  char a;
  cin >> a;
  v[i][j]=a;
}
rep(i,n){
  sort(v[i],v[i]+10);
}
vector<string> s(n);
rep(i,n)rep(j,10){
  s[i]+=v[i][j];
}
sort(s.begin(),s.end());
map<string,ll> m;
rep(i,n){
  m[s[i]]++;
}
for (auto i = m.begin(); i != m.end(); ++i) {
  if((i->second)>1)ans+=i->second*(i->second-1);
}

cout << ans/2 << endl;
return 0;
}


Measured memory_bytes: 16000
package main

import (
    "bufio"
    "os"
    "strings"
    "strconv"
    "fmt"
    "sort"
    "container/heap"
    "math"
)

var sc = bufio.NewScanner(os.Stdin)

func readLineToInt() []int {
    sc.Scan()
    line := strings.Split(sc.Text(), " ")
    var intLine []int
    for _, str := range line {
        n, _ := strconv.Atoi(str)
        intLine = append(intLine, n)
    }
    return intLine
}


/****************** Pair ********************/
type Pair struct {
    a int
    b int
}

type SortablePairs struct {
    arr []*Pair
    lessfunc []lessFunc
}

type lessFunc func(i, j *Pair) bool

func (sp SortablePairs) Len() int {
    return len(sp.arr)
}

func (sp SortablePairs) Swap(i, j int) {
    sp.arr[i], sp.arr[j] = sp.arr[j], sp.arr[i]
}

func (sp SortablePairs) Less(i, j int) bool {
    p, q := sp.arr[i], sp.arr[j]
    for k := 0; k < len(sp.lessfunc); k++ {
        less := sp.lessfunc[k]
        if less(p, q) {
            return true
        } else if less(q, p) {
            return false
        }
    }
    return false
}

/***************** HeapQue *****************/

type PriorityQueue struct {
    arr []*Pair
    size int
}
/** sort **/
func (pq PriorityQueue) Len() int {
    return len(pq.arr)
}

func (pq PriorityQueue) Swap(i, j int) {
    pq.arr[i], pq.arr[j] = pq.arr[j], pq.arr[i]
}

func (pq PriorityQueue) Less(i, j int) bool{
    return pq.arr[i].a < pq.arr[j].a
}

/**** pq ****/
func (pq *PriorityQueue) Push(x interface{}) {
    item := x.(*Pair)
    pq.arr = append(pq.arr, item)
    pq.size++
}

func (pq *PriorityQueue) Pop() interface{} {
    n := pq.size
    item := pq.arr[n - 1]
    pq.arr = pq.arr[:n - 1]
    pq.size--
    return item
}

func max(a, b int) int {
    return int(math.Max(float64(a), float64(b)))
}

func main() {
    nk := readLineToInt()
    n, k := nk[0], nk[1]
    var dic map[int][]int = map[int][]int{}
    var keys []int
    for i := 0; i < n; i++ {
        td := readLineToInt()
        t, d := td[0], td[1]
        _, ok := dic[t]
        if !ok {
            keys = append(keys, t)
        }
        dic[t] = append(dic[t], d)
    }

    var sp SortablePairs
    less := func(p, q *Pair) bool {
        return p.a >= q.a
    }
    sp.lessfunc = append(sp.lessfunc, less)
    for _, key := range keys {
        sort.Ints(dic[key])
        length := len(dic[key])
        sp.arr = append(sp.arr, &Pair{dic[key][length - 1], key})
        dic[key] = dic[key][:length - 1]
    }
    sort.Sort(sp)
    var que PriorityQueue
    heap.Init(&que)
    queScore := 0
    defaultScore := 0
    cnt := 0
    ans := 0
    for _, p := range sp.arr {
        defaultScore += p.a + cnt * 2 + 1
        cnt++
        if cnt >= k {
            ans = max(ans, defaultScore)
            break
        }
        for _, add := range dic[p.b] {
            heap.Push(&que, &Pair{add, p.b})
            queScore += add
        }
        for que.size > k - cnt {
            item := heap.Pop(&que).(*Pair)
            queScore -= item.a
        }
        ans = max(ans, defaultScore + queScore)
    }
    fmt.Println(ans)

}

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

int main() {
  int a,b,c;
  cin>>a>>b>>c;
  if(a==b and b==c){
    cout<<"Yes";
  }
  else{
    cout<<"No";
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define LLINF (1e18)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    int ans = -INF;
    chmax(ans, a + b);
    chmax(ans, a - b);
    chmax(ans, a * b);
    cout << ans << endl;
}

Measured memory_bytes: 256
import std.stdio;
import std.algorithm;
import std.string;
import std.container;
import std.typecons;

void log(A...)(A arg) {
    stderr.writeln(arg);
}

void main() {
    long N, K; scanf("%d %d\n", &N, &K);
    long f(long n) {
        return n + 1 + (n / (K - 1));
    }
    long x = 0;
    for (long n = 1; n < N; n++) {
        x = f(x);
    }
    writeln(x);
}

Measured memory_bytes: 2424
const input = require("fs").readFileSync("/dev/stdin", "utf8")
const lines = input.trim().split('\n')
let [N, M] = lines[0].trim().split(' ').map(Number)

const g = {}
const map = {}
let ai = 0
for (let i = 1; i <= M; i++) {
    const [a, b] = lines[i].trim().split(' ').map(Number)
    if (!map[a] && !map[b]) {
        ai++
        g[ai] = [a, b]
        map[a] = ai
        map[b] = ai
    } else if (map[a] && map[b]) {
        if (map[a] !== map[b]) {
            if (g[map[a]].length > g[map[b]].length) {
                const _b = map[b]
                g[map[b]].forEach(n => {
                    g[map[a]].push(n)
                    map[n] = map[a]
                })
                delete g[_b]
            } else {
                const _a = map[a]
                g[map[a]].forEach(n => {
                    g[map[b]].push(n)
                    map[n] = map[b]
                })
                delete g[_a]
            }
        }
    } else if (map[a]) {
        g[map[a]].push(b)
        map[b] = map[a]
    } else if (map[b]) {
        g[map[b]].push(a)
        map[a] = map[b]
    }
}

let ans = 1
for (var key in g)  {
    ans = Math.max(ans, g[key].length)
}
console.log(ans)


Measured memory_bytes: 99064
def main():
    from sys import stdin, setrecursionlimit
    #setrecursionlimit(10**9)
    #n = int(stdin.readline()[:-1])   
    r = stdin.readline()[:-1]
    #n = int(stdin.readline()[:-1])   
    #r = [stdin.readline() for i in range(n)]
    #t = [int(stdin.readline()) for i in range(n)]
    #a = r.split()
    a = list(map(int, r.split()))
    #a = [int(s[i]) for i in range(1, n+1)]
    #a = [list(map(int, r.split())) for i in range(1,n+1)]
    #res = 0

    g1 = [1,3,5,7,8,10,12]
    g2 = [4,6,9,11]
    g3 = [2]

    x = [0]*2
    for i in range(len(a)):
        if a[i] in g1:
            x[i] = 1
        elif a[i] in g2:
            x[i] = 2
        elif a[i] in g3:
            x[i] = 3
    if x[0] != 0 and x[0] == x[1]:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()


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

bool allZero(vector<int> s, int cur) {
	/*for (int i = 0; i < ns.size(); i++) {
		if (ns[i].size() > 0) return false;
	}*/
	for (int i = 0; i < s.size(); i++) {
		if (s[i] > 0 && i != cur) return false;
	}
	
	return true;
}
int main()
{
	int n, p, cur;
	//vector<int> s;
	//vector<vector<int>> ns;
	int curP;
	vector<int> s; 
	
	while (cin >> n >> p) {
		if (n == 0 && p == 0) {
			break;
		}


		//cout << n << " " << p << endl;
		cur = 0;
		curP = p;
		s.clear();
		s.resize(n);
		/*ns.clear();
		ns.resize(0);
		for (int i = 0; i < n; i++) {
			ns[i].resize(0);
		}*/

		// 現在の候補者が碗から石を取り出す
		// 番号が降ってあるわけではない！
		//while (!(curP == 0 && isZero(s))) {
		while (true) {
			
			// 現在ターンである候補者が1つ取り出す
			//ns[cur].push_back(p[cur]);
			if (curP > 0) {
				s[cur]++;
				curP--;
			} else if (curP == 0 && s[cur] > 0) {// 手元に小石があれば全て碗の中に入れる
				/*for (int i = 0; i < ns[cur].size(); i++) {
					s.push_back(ns[cur][i]);
				}*/
				curP += s[cur];
				s[cur] = 0;
			}
			
			// 条件を満たして入れば終了
			if (curP == 0 && allZero(s, cur)) {
				cout << cur << endl;
				break;
			}

			// 次の候補者へ
			cur++;
			if (cur == n) cur = 0;
		}
	
		
	}

	return 0;
}

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

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

  char C = s[K-1];
  for(int i=0; i<s.length(); i++){
    if(s[i] != C)
      s[i] = '*';
  }

  cout << s << endl;
}

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

int INF = 1e9;

struct Edge{
  int to, cost;

  Edge(int t, int c = 0): to(t), cost(c)
  {}
  bool operator>(const Edge& rhs) const{
	return cost > rhs.cost;
  }
  bool operator<(const Edge& rhs) const{
	return cost < rhs.cost;
  }

};
using Graph =  vector< vector<Edge> >;

// ????????°???????????¨???
void add_edge(Graph& graph, int u, int v, int cost = 0){
  graph[u].push_back(Edge(v,cost));
  graph[v].push_back(Edge(u,cost));
}

// precondition: d.size == V
// O(V*E)
// if graph has negative cycle, then return false, o.w. return true
bool BellmanFord(const Graph& G, vector<int>& d, int s){
  const int V = G.size();
  for(int i=0;i<V;++i)
	d[i] = INF;
  d[s] = 0;

  bool updated;
  for(int lp=0;lp<=V;++lp){
	updated = false;
	for(int i=0;i<V;++i){
	  for(const auto& e: G[i]){
		if(d[i] != INF && d[e.to] > d[i] + e.cost){
		  d[e.to] = d[i] + e.cost;
		  updated = true;
		}
	  }
	}
	if(!updated) break;
  }
  return !updated;
}


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

  int V, E, R;
  cin >> V >> E >> R;
  Graph G(V);
  for(int i=0;i<E;++i){
	int s, t, d;
	cin >> s >> t >> d;
	G[s].emplace_back(t, d);
  }

  vector<int> dist(V);
  if(!BellmanFord(G, dist, R)){
	cout << "NEGATIVE CYCLE" << endl;
  }
  else{
	for(int i=0;i<V;++i)
	  if(dist[i] == INF) cout << "INF" << endl;
	  else cout << dist[i] << endl;
  }

  return 0;
}

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

#define ll long long
#define ii pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pi acos(-1.0)
#define oo 1000000007
#define loo 10000000000000007

#define prime 1000000007

#define W(x) cerr << "\033[31m" << #x << " = " << x << "\033[0m" << "\n";
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    ll n, m, mi = prime; cin >> n >> m;
    ll sum = 0;
    for (int i = 0; i < n; ++i){
        ll x; cin >> x;
        mi = min(mi, x);
        sum+=x;
    }

    cout << n + (m-sum)/mi << "\n";
    return 0;
}

Measured memory_bytes: 3584
# -*- coding: utf-8 -*-
a = int(input())
b = int(input())
c = int(input())
x = int(input())

counter = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if (500*i+100*j+50*k == x):
                counter += 1

print(counter)

Measured memory_bytes: 3064
import java.util.ArrayList;
import java.util.Scanner;
public class Main{

	public static void main(String[] args){

		Scanner sc= new Scanner(System.in);

		int n = sc.nextInt();
		ArrayList<Integer>array = new ArrayList<>();
		long totalInt = 0L;
		int maxInt = Integer.MIN_VALUE;
		int minInt = Integer.MAX_VALUE;

		for(int i = 0; i < n;i++) {
			array.add(sc.nextInt());
		}
		for(int arrayInt:array) {
			totalInt += arrayInt;
			minInt = Math.min(minInt, arrayInt);
			maxInt = Math.max(maxInt, arrayInt);
		}
		System.out.println(minInt + " " + maxInt + " " + totalInt);


	}
}


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


      String y = oll.substring(0, 4);
      String m = oll.substring(5, 7);
		
      int ye = Integer.parseInt(y);
      int mo = Integer.parseInt(m);
      
      if(ye<=2018){flag=1;}
      if(ye<=2019&&mo<=4){flag=1;}

		if(flag==1){System.out.print("Heisei");}
      else{System.out.print("TBD");}


 
    }
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
#define Rep(i, n) for(int i = 0; i < (int)(n); i++)
#define Repi(i, a, b) for(int i = int(a); i < (int)(b); i++)
#define Repl(i, list) for(int i : list)
#define Sort(v) sort(v.begin(), v.end())
#define Rev(v) reverse(v.begin(), v.end())
#define ll long long
template<typename _T> void Out(_T x) { cout << x << endl; }
template<typename _T> void PrintVec(vector<_T> vec) { Rep(i, vec.size()) { cout << vec.at(i) << " "; } cout << endl; }

int main()
{
    // input
    string S;
    cin >> S;

    // algorithm
    
    // output
    if (S.at(2) == S.at(3) && S.at(4) == S.at(5)){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, j, n) for (int i = j; i < n; i++)
#define all(x) (x).begin(),(x).end()
#define INF (1<<30)
#define MOD (1000000007)

/////////////////////////////////////////////////////////

void Main(){
  int N, T; cin >> N >> T;
  vector<int> t(N);
  rep(i, 0, N) cin >> t[i];
  ll sum = 0;
  rep(i, 0, N){
    if(i == N - 1){
      sum += T;
      continue;
    }
    sum += min(t[i + 1] - t[i], T);
  }
  cout << sum << endl;
}

/////////////////////////////////////////////////////////

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  //cout << std::fixed << std::setprecision(15);

  Main();
}


Measured memory_bytes: 1024
s = input()

l = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
flag = True
for i in l:
    if not i in s:
        print(i)
        flag = False
        break
if flag:
    print('None')

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





int main() 
{
  ll R,G,B,N; cin>>R>>G>>B>>N;
  ll count=0;
  rep(r,N/R)
  {
    rep(g,N/G)
    {
      if(R*r+G*g<=N&&(N-R*r-G*g)%B==0) 
      {
        //cout<<r<<" "<<g<<" "<<N-r-g<<endl;
        count++;
      }
    }
  }
  cout<<count<<endl;
  return 0;
}


Measured memory_bytes: 3632
A, B, C = sorted(map(int, input().split()))

def calculate(P, Q, R):
    num = 0
    if abs(P - Q) % 2 == 0:
        num += abs(P - Q) // 2
    else:
        num += 1 + (abs(P - Q) + 1) // 2
        P += 1
        R += 1

    if P - R >= 0:
        if abs(P - R) % 2 == 0:
            num += abs(P - R) // 2
        else:
            num += 1 + (abs(P - R) + 1) // 2

    else:
        num += abs(P - R)

    return num

ans = min(calculate(C, B, A), calculate(C, A, B), calculate(B, A, C))

print(ans)

Measured memory_bytes: 3064
//メモ再帰
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define mkp make_pair
#define fi first
#define se second
#define pt(num) cout << num << "\n"
#define mCalc(a, s, b) (a)=((a)s(b)+MOD)%MOD
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define chmax(a, b) (a<b ? a=b : 0)
#define chmin(a, b) (a>b ? a=b : 0)
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 101010
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;

ll N;
ll dp[MAX];

ll rec(ll n) {
    if(n==0) return 0;
    if(dp[n]!=-1) return dp[n];
    
    ll i;
    ll res=INF;
    for(i=1; i<=N && n-i>=0; i*=6)
        res=min(res, rec(n-i)+1);
    
    for(i=1; i<=N && n-i>=0; i*=9)
        res=min(res, rec(n-i)+1);
    
    
    return dp[n]=res;
}


int main(void) {;
    cin >> N;
    memset(dp, -1, sizeof(dp));
    
    pt(rec(N));
}


Measured memory_bytes: 5760
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define vec(s) vector

#define vvec(s) vector<vector
>
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Yes(x) cout<<(x?"Yes":"No")<<endl;
#define YES(x) cout<<(x?"YES":"NO")<<endl;
#define out(s) cout<<s<<endl;
#define Reverse(x) reverse(all(x));
#define Sort(x) sort(all(x));
#define pb(s) push_back(s);
#define sp " " 
#define INF 10000000000
#define LINF 9000000000000000000
#define all(s) s.begin(),s.end()
void vout(vi v){
    for(lli i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    cout << std::fixed << std::setprecision(10);
    lli n, t;
    cin >> n >> t;
    vi rec;
    rep(i, n) {
        lli c, l;
        cin >> c >> l;
        if(l<=t)
        {
            rec.push_back(c);
        }
    }
    Sort(rec);

    cout << (rec.size() == 0 ? "TLE" : to_string(rec[0]));
}

Measured memory_bytes: 3724
#include <stdio.h>
#include <stdlib.h>

void main(void)
{
  int sum=0,a,b,c[10000];
  scanf("%d",&a);
  scanf("%d",&b);
  for(int i=0;i<b;i++){
    scanf("%d",c+i);
    sum+=c[i];
  }
  if(sum>a){
    printf("-1");
  }
  else{
    printf("%d",a-sum);
  }
}

Measured memory_bytes: 1736
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize ("Ofast")
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
using namespace __gnu_pbds;
using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<long long,long long> ii; 	
typedef complex<long double> com;

const ll mod = 1e9+7;


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    ll a,b;
    cin >> a >> b;
    ll n = (b-a)*(b-a+1)/2;
    cout << n-b << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
// #include <atcoder/all>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) for(int sz=0;sz<int(vec.size());sz++) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    V<int> a(n), b(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) cin >> b[i];
    map<int, int> cnt;
    map<int, int> bmap;
    for (int i = 0; i < n; i++) {
        cnt[a[i]]++, cnt[b[i]]++;
        bmap[b[i]]++;
    }

    int maxc = 0, mnum = -1;
    V< P<int, int> > aaa;
    for (P<int, int> c: cnt) {
        if (c.second > n) {
            cout << "No\n";
            return 0;
        }
        if (chmax(maxc, c.second)) mnum = c.first;
        aaa.emplace_back(c.second, c.first);
    }

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

    cout << "Yes\n";
    set<int> idxs;
    for (int i = 0; i < n; i++) idxs.insert(i);
    V<int> ans(n);
    for (int i = 0; i < aaa.size(); i++) {
        P<int, int> aa = aaa[i];
        int freq = aa.first, num = aa.second;
        if (bmap.find(num) == bmap.end()) continue;
        V<int> used;
        int ai = upper_bound(ALL(a), num) - a.begin();
        auto it = idxs.lower_bound(ai);
        if (it == idxs.end()) it = idxs.lower_bound(0);
        for (int j = 0; j < bmap[num]; j++) {
            ans[*it] = num;
            used.emplace_back(*it);
            it = next(it);
            if (it == idxs.end()) it = idxs.lower_bound(0);
        }

        for (int u: used) idxs.erase(u);
    }
    for (int i = 0; i < n; i++) cout << ans[i] << (i == n - 1 ? '\n' : ' ');
    return 0;
}


Measured memory_bytes: 35344
import java.io.BufferedReader;
import java.io.InputStreamReader;


public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve(args);
    }

    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();
        int t = scanner.nextInt();
        int x = scanner.nextInt();
        System.out.println(((double)t/(double)x));
    }

    private class MyScanner {
        String[] s;
        int i;
        BufferedReader br;
        String reg = " ";
        MyScanner () {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        public String next() {
            try {
                if (i < s.length) return s[i++];
                String line = br.readLine();
                while (line.equals("")) {line = br.readLine();}
                s = line.split(reg, 0);
                i = 0;return s[i++];
            } catch (Exception e) {e.printStackTrace();}
            return null;
        }
        public int nextInt() {
            try {return Integer.parseInt(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public double nextDouble() {
            try {return Double.parseDouble(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public long nextLong()  {
            try {return Long.parseLong(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
    }
}




Measured memory_bytes: 23252
#include <iostream>
#include <fstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <cstdio>
#include <stack>
#include <climits>

using namespace std;

int main() {

	string s;
	long long k = 0;

	cin >> s;
	cin >> k;

	//cout << s[0];

	if (s[0] != '1') {
		cout << s[0] << endl;
		return 0;
	}

	long long cnt = 0;
	for (long long i = 0; i < k; ++i) {
		if (s[i] == '1') {
			cnt++;
		}
		else {
			cout << s[i] << endl;
			return 0;
		}
		if (cnt == k) {
			cout << 1 << endl;
			return 0;
		}
	}

	return 0;

}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if(a<b)
    {
        if(b<c)
        {
            printf("Yes\n");
        }
        else
        {
            printf("No\n");
        }
    }
    else
    {
        printf("No\n");
    }
    return 0;
}



Measured memory_bytes: 2104
#include<bits/stdc++.h>
using namespace std;
#define INF 100010
typedef pair<int,int> P;
vector<int> G[100010];
int V,E;
int ord[100010];
int low[100010];

int lowlink(int x,int p,int n){
  if(ord[x]==INF)ord[x]=n;
  else return ord[x];
  int ans=INF;
  for(int i=0;i<G[x].size();i++){
    if(G[x][i]==p)continue;
    ans=min(ans,lowlink(G[x][i],x,n+1));
  }
  return low[x]=ans;
}

int main(){
  for(int i=0;i<100010;i++)
    low[i]=ord[i]=INF;
  cin>>V>>E;
  P p[100010];
  for(int i=0;i<E;i++){
    int s,t;
    cin>>s>>t;
    G[s].push_back(t);
    G[t].push_back(s);
    if(s>t)swap(s,t);
    p[i]=P(s,t);
  }
  sort(p,p+E);
  lowlink(0,-1,0);
  for(int i=0;i<E;i++){
    int f=0;
    int u=p[i].first,v=p[i].second;
    if(ord[u]>ord[v])swap(u,v);
    if(ord[u]<low[v])cout<<p[i].first<<" "<<p[i].second<<endl;
  }
  return 0;
}



Measured memory_bytes: 8472
n = int(input())
b = list(map(int, input().split()))
a = [10000000 for i in range(n)]

res = 0
for i, e in enumerate(b):
    a[i] = min(a[i], e)
    a[i + 1] = min(a[i + 1], e)

print(sum(a))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n,ans=0;
  cin>> n;
  for(int i=0;i<n;i++){
    int x;
    cin >> x;
    bool a=true;
    for(int j=2;j<=sqrt(x);j++){
      if(x%j==0){
        a=false;
        break;
      }
    }
    if(a)ans++;
  }
  cout<<ans<<endl;
  return 0;
}
      


Measured memory_bytes: 3092
const MAX_N: usize = 200100;
fn solve() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let k: usize = sc.read();
    let p: Vec<usize> = sc.vec(n);
    let mut a = vec![0; n];
    for i in 1..n {
        if p[i - 1] < p[i] {
            a[i] = 1;
        }
        a[i] += a[i - 1];
    }
    let mut st = std::collections::BTreeSet::new();
    for i in 0..k {
        st.insert(p[i]);
    }
    let mut cute = if a[k - 1] == k - 1 { 1 } else { 0 };
    let mut result = if cute == 1 { 0 } else { 1 };
    for i in 0..n - k {
        let mut ok = true;
        let min = *st.iter().next().unwrap();
        if min != p[i] {
            ok = false;
        }
        st.remove(&p[i]);
        st.insert(p[i + k]);
        let max = *st.iter().next_back().unwrap();
        if max != p[i + k] {
            ok = false;
        }
        if a[i + k] - a[i + 1] == k - 1 {
            cute = 1;
        } else if !ok {
            result += 1;
        }
    }
    println!("{}", result + cute);
}

fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| solve())
        .unwrap()
        .join()
        .unwrap();
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 14716
import java.util.Scanner;

public class Main{
 public static void main(String[] args){
  Scanner scanner=new Scanner(System.in);
  int a=scanner.nextInt();
  int b=scanner.nextInt();
  int c=scanner.nextInt();
  int d=scanner.nextInt();
  int e=scanner.nextInt();
  int f=scanner.nextInt();
  scanner.close();
  double concentration=0;
  int total=0;
  int sugar=0;
  for(int na=0;a*na*100<=f;na++)
   for(int nb=0;a*na*100+b*nb*100<=f;nb++)
    for(int nc=0;a*na*100+b*nb*100+c*nc<=f;nc++)
     for(int nd=0;a*na*100+b*nb*100+c*nc+d*nd<=f;nd++)
      if(c*nc+d*nd<=e*(a*na+b*nb)&&(double)(c*nc+d*nd)/(double)(a*na*100+b*nb*100+c*nc+d*nd)>=concentration){
       concentration=(double)(c*nc+d*nd)/(double)(a*na*100+b*nb*100+c*nc+d*nd);
       total=a*na*100+b*nb*100+c*nc+d*nd;
       sugar=c*nc+d*nd;
      }
  System.out.println(total+" "+sugar);
 }
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

int main(){
    int N;
    cin >> N;
    set<int> d;
    rep(i, N){
        int di;
        cin >> di;
        d.insert(di);
    }
    cout << d.size() << endl;
}

Measured memory_bytes: 256
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val X = sc.nextLong()
  @scala.annotation.tailrec
  def loop(i: Long, count: Int): Int = 
    if (X <= i) count else loop(i + i / 100, count + 1)
  println(loop(100L, 0))
}


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


int main() {
    int n;cin>>n;
    vector<ll> temp(100000,0);
    ll ans=0;
    rep(i,n){
        int a;cin>>a;
        temp[a]++;
        ans+=a;
    }
    int q;cin>>q;
    rep(i,q){
        int b,c;cin>>b>>c;
        ans+=temp[b]*(c-b);
        temp[c]+=temp[b];
        temp[b]=0;
        cout<<ans<<endl;
    }
}

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

using namespace std;

int main(int argc, char const *argv[]) {
        string integer;
        int sum = 0;
        while(cin >> integer) {

                for(int i = 0; integer[i]!='\0'; i++) {
                        sum += (integer[i]-'0');
                }
                if(sum == 0) break;
                cout << sum << '\n';
                sum = 0;
        }
        return 0;
}



Measured memory_bytes: 3016
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n); i++) 
#define dunk(n) cout << n << endl
#define all(a) (a).begin(),(a).end()
typedef pair<int,int> P;
typedef long long ll;

int main() {
    int k,a,b;
    cin >> k >> a >> b;
    for(int i = a; i <= b; i++){
        if(i%k == 0){
            dunk("OK");
            return 0;
        }
    }
    dunk("NG");
    return 0;
}

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

#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORTASC(c) sort((c).begin(), (c).end())
#define SORTDESC(c, t) sort((c).begin(), (c).end(), std::greater<t>());
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

const double PI = acos(-1.0);

using ll = long long;
using namespace std;

int main()
{
    ll a, b;
    vector<ll> h;

    while(cin >> a >> b){
        auto tmp = a + b;
        cout << to_string(tmp).length() << endl;
    }
    
    return 0;
}


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

   typedef long long ll;
   typedef pair<ll, ll> Pii;
   typedef vector<ll> Vi;
   typedef vector<Vi> VVi;

   const double EPS = (1e-7);
   const ll INF =(1e13);
   const double PI = (acos(-1));
   const ll MOD = ll(1e9) + 7;

   #define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
   #define REPR(i, n) for(ll i = n; i > -1; i--)
   #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
   #define ALL(x) (x).begin(),(x).end()
   #define SORT(x) sort((x).begin(), (x).end())
   #define RSORT(x) sort((x).rbegin(), (x).rend())
   #define REVERSE(x) reverse((x).begin(), (x).end())
   #define SZ(x) ((ll)(x).size())
   #define pb push_back
   #define mp make_pair

   //chmax(a, b): a>bならaをbで更新　更新したときにtrueを返す
   //chmin(a, b): a<bならaをbで更新　更新したときにtrueを返す
   template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
   template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

   #define dump(x) cerr<< #x << "= " << (x) << endl;

   ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
   ll pow(ll a, ll b){if (b == 0) return 1; else if (b % 2 == 0) return pow(a * a, b / 2); else return pow(a * a, b / 2) * a;}
   ll pow(ll a, ll b, ll m){if (b == 0) return 1; else if (a == 0) return 0; else if (b % 2 == 0) return (pow((a * a) % m, b / 2, m) % m); else return (pow((a * a) % m, b / 2, m) * a) % m;}
   ll residue(ll a, ll m){return ((a % m) + m) % m;};

   ll dx[4]={1,0,-1,0};
   ll dy[4]={0,1,0,-1};

int main(){
   Vi x(5); REP(i, 5) cin >> x[i];
   ll k; cin >> k;
   REP(i, 5){
      REP(j, 5){
         if(x[i] - x[j] > k){
            cout << ":(" << endl;
            return 0;
         }
      }
   }
   cout << "Yay!" << endl;
}


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

int main()
{
	int n = 0, a[10] = {0};
	unsigned long long lcm = 1, prd = 1;

	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> a[i];
		prd *= a[i];
	}

	int p = 2;

	while (prd > 1) {
		int k = 0;
		for (int i = 0; i < n; i++) {
			int j = 0;
			while (a[i] % p == 0) {
				a[i] /= p;
				j++;
			}
			if (k < j)
				k = j;
		}

		lcm *= (int)pow(p, k);
		prd = 1;
		for (int i = 0; i < n; i++)
			prd *= a[i];
		if (p == 2)
			p++;
		else
			p += 2;
	}

	cout << lcm << endl;

	return 0;
}

Measured memory_bytes: 3272
package main

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

type Task struct {
	a, b int
}

type Tasks []Task

func (t Tasks) Len() int { return len(t) }
func (t Tasks) Less(i, j int) bool {
	return t[i].b < t[j].b
}
func (t Tasks) Swap(i, j int) {
	t[i], t[j] = t[j], t[i]
}

func main() {
	var n, sum int
	fmt.Scan(&n)

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	tasks := make([]Task, n)
	for i := range tasks {
		sc.Scan()
		tasks[i].a, _ = strconv.Atoi(sc.Text())
		sc.Scan()
		tasks[i].b, _ = strconv.Atoi(sc.Text())
	}
	sort.Sort(Tasks(tasks))

	for _, task := range tasks {
		sum += task.a
		if sum > task.b {
			fmt.Println("No")
			return
		}
	}
	fmt.Println("Yes")
}


Measured memory_bytes: 6272
#include <iostream>
#include <vector>
using namespace std;
const int MOD = 1000000007;


int main(){
    int n, m;
    cin >> n >> m;
    vector<int> a(m);
    for(int i = 0; i < m; i++) cin >> a[i];
    
    vector<long int> memo(n+1);
    for(int i = 0; i <= n; i++) memo[i] = 0;
    for(int i = 0; i < m; i++) memo[a[i]] = -1;
    
    memo[0] = 1;
    if(memo[1] != -1) memo[1] = 1;
    for(int i = 2; i <= n; i++){
        if(memo[i] != -1 && memo[i-2] != -1){
            memo[i] += memo[i-2];
            memo[i] %= MOD;
        }
        if(memo[i] != -1 && memo[i-1] != -1){
            memo[i] += memo[i-1];
            memo[i] %= MOD;
        }
    }
    
    cout << memo[n] << endl;
    
    return 0;
}

Measured memory_bytes: 1408
#include <cmath>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

class team
{
public:
	int num;	// number of team
	int cnt;	// solved problems
	int tim;	// total consumed time

	team(void) {};
	team(int _num, int _cnt, int _tim) :
		num(_num), cnt(_cnt), tim(_tim) {};

	friend bool operator == (const team &a, const team &b)
	{
		return a.cnt == b.cnt && a.tim == b.tim;
	}

	friend bool operator < (const team &a, const team &b)
	{
		if (a.cnt != b.cnt)
			return a.cnt > b.cnt;
		else if (a.tim != b.tim)
			return a.tim < b.tim;
		else
			return a.num < b.num;
	}
};

class record
{
public:
	int tim;	// elapsed time
	int num;	// number of team
	int pro;	// problem number
	int jud;	// judgement of submission	

	record(void) {};
	record(int _tim, int _num, int _pro, int _jud) :
		tim(_tim), num(_num), pro(_pro), jud(_jud) {};
};

team tm[55];
record rc[2005];
bitset<15> sl[55];	// if team i solved problem j

signed main(void)
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	int m, t, p, r;

	while (cin >> m >> t >> p >> r, m || t || p || r)
	{
		for (int i = 1; i <= t; ++i)
			sl[i].reset();
		
		for (int i = 1; i <= r; ++i)
		{
			int ti, ni, pi, ji;
			cin >> ti >> ni >> pi >> ji;
			rc[i] = record(ti, ni, pi, ji);

			if (ji == 0)sl[ni].set(pi);	// team ni solved pi
		}

		for (int i = 1; i <= t; ++i)
			tm[i] = team(i, sl[i].count(), 0);

		for (int i = 1; i <= r; ++i)
		{
			int ti = rc[i].tim;
			int ni = rc[i].num;
			int pi = rc[i].pro;
			int ji = rc[i].jud;

			if (ji == 0)
				tm[ni].tim += ti;
			else if (sl[ni][pi])
				tm[ni].tim += 20;
		}

		sort(tm + 1, tm + 1 + t);

		int stk[55], tot = 0;

		for (int i = 1, j = 1; i <= t; i = j)
		{
			while (j <= t && tm[i] == tm[j])
				stk[++tot] = j++;
			
			cout << tm[stk[tot--]].num;

			while (tot)
				cout << "=" << tm[stk[tot--]].num;

			if (j <= t)
				cout << ",";
			else 
				cout << endl;
		}
	}

//	system("pause");
}

Measured memory_bytes: 3108
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <vector>
#include <stack>
#include <unordered_set>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
const int maxn = 2e6 + 10;
const double eps = 1e-8;
const ll mod = 1e9 + 7;
const ull base = 131;
const ull mod1 = 1e9 + 9;
const ull mod2 = 1610612741;

inline int read()
{
    int x = 0, f = 1;
    char ch = getchar();
    while(ch < '0' || ch > '9'){
        if (ch == '-')
            f = -1;
        ch = getchar();
    }
    while(ch >= '0' && ch <= '9'){
        x = (x<<1) + (x<<3) + (ch^48);
        ch = getchar();
    }
    return x * f;
}

ll a, b, c;

int main()
{
    scanf("%lld%lld%lld", &a, &b, &c);
    ll ans = b*c*(a-a/2-a/2);
    ans = min(ans, a*b*(c-c/2-c/2));
    ans = min(ans, a*c*(b-b/2-b/2));
    printf("%lld\n", ans);
    return 0;
}



Measured memory_bytes: 3224