akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3

import sys
# import math
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import product                # product(iter, repeat=n)
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from fractions import gcd                    # for Python3.4.3


def main():
    mod = 10000007                  # 10^9+7
    inf = float('inf')
    input = sys.stdin.readline      # 改行文字が残ることに注意
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def ii():  return int(input())
    def mi():  return map(int, input().rstrip().split())
    def lmi(): return list(map(int, input().rstrip().split()))
    def li():  return list(input().rstrip())
    
    k, x = mi()
    print("Yes") if k*500>=x else print("No")
    
if __name__ == "__main__":
    main()

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

struct StTrain
{
  StTrain() :
    m_nNext(0), m_nDone(false)
  { }

  int  m_nNext;
  bool m_nDone;
};

void fnInput(vector<StTrain>& rvoTrain)
{
  int nSize;
  cin >> nSize;

  StTrain oTrain;
  rvoTrain.resize(nSize, oTrain);
  
  for (int n = 0; n < nSize; n++)
    cin >> rvoTrain[n].m_nNext;
}

int fnTrain(vector<StTrain>& rvoTrain)
{
  int nCnt = 0;
  int n = 0;
  while (true)
  {
    nCnt++;
    if (rvoTrain[n].m_nDone)       return -1;

    rvoTrain[n].m_nDone = true;
    if (rvoTrain[n].m_nNext == 2)  return nCnt;
 
    n = rvoTrain[n].m_nNext - 1;
  }
}
    
int main()
{
  vector<StTrain> voTrain;
  
  fnInput(voTrain);
  int nRslt = fnTrain(voTrain);
  cout << nRslt << endl;

  return 0;
}

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

using namespace std;

int main(){
	bool a[31];
	fill_n(a, 31, false);
	int in;
	for(int i = 1; i <= 30; i++){
		cin >> in;
		a[in] = true;
	}
	for(int i = 1; i <= 30; i++){
		if(!a[i]) cout << i << endl;
	}

	return 0;
}


Measured memory_bytes: 3108
#include <stdio.h>
#include <ctype.h>

int main(void){
    int n,k,i;
    char s[50];

    scanf("%d %d",&n,&k);
    scanf("%s",s);

    s[k - 1] = tolower(s[k - 1]);

    for (i = 0;i < n;i++){
        printf("%c",s[i]);

    }
    return 0;
}

Measured memory_bytes: 1656
import sys
import math

for e in sys.stdin:
    a, op, b = e.split()
    a = int(a)
    b = int(b)
    if op == "?":
        break
    elif op == "+":
        print(a + b)
    elif op == "-":
        print(a - b)
    elif op == "*":
        print(a * b)
    else:
        print(math.floor(a / b))



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

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

	for (int i = 0; i < s.size(); i += w){
		cout << s[i];
	}
	cout << endl;
	return 0;
}


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

int main(int argc, char *argv[])
{
    int X;
    long double n;
    long double ans;

    cin >> X;

    n = sqrtl( 2.0 * X + 0.25) - 0.5;
    ans = ceill( n );


    //cout << n << endl;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3828
def a(s,i):
    if i == l-1:
        if eval(s)==7:
            print(s+"=7")
            exit()
        return
    a(s+"+"+N[i+1],i+1)
    a(s+"-"+N[i+1],i+1)

N = input()
l = len(N)

a(N[0],0)


Measured memory_bytes: 9060
#include <stdio.h>

int findLimit(int num){
	int i;
	for(i = 1; i*i <= num;i++);
	return i-1;
}

int main(){
	int n,tmp,count = 0,limit;
	scanf("%d",&n);

	for(int i = 0; i < n; i++)
	{
		scanf("%d",&tmp);
		limit = findLimit(tmp);
		for(int j = 2; j <= limit; j++){
			if(tmp%j==0){
				count++;
				break;
			}
		}
	}
	printf("%d\n",n-count);
}

Measured memory_bytes: 1028
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const int INF=1e9;
const int maxn=2e3+10;
const double eps=1e-9;
int dp[maxn][2],a[maxn];
inline int read(){
	int x=0,flag=1;
	char ch=getchar();
	while(!isdigit(ch) && ch!='-')ch=getchar();
	if(ch=='-')flag=-1,ch=getchar();
	while(isdigit(ch))x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return x*flag;
}
int main(){
	int i,j,k,m,n,z,w,id1,id2;
	n=read();z=read();w=read();
	for(i=1;i<=n;i++)a[i]=read();
	for(i=n-1;i>=0;i--){
		dp[i][1]=INF;
		for(j=i+1;j<n;j++){
			int minans=INF,maxans=-INF;
			if(dp[j][1]>maxans){
				maxans=dp[j][1];
				id1=j;
			}
			if(dp[j][0]<minans){
				minans=dp[j][0];
				id2=j;
			}
		}
		if(i<n-1){
			dp[i][0]=dp[id1][1];
			dp[i][1]=dp[id2][0];
		}
		if(i>0){
			dp[i][0]=max(dp[i][0],abs(a[n]-a[i]));
			dp[i][1]=min(dp[i][1],abs(a[n]-a[i]));
		}
	}
	printf("%d\n",max(abs(a[n]-w),dp[0][0]));
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <fstream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <assert.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#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 ALL(s) (s).begin(),(s).end()
#define ITE(c) typeof((c).begin())

#define clr(a) memset((a),0,sizeof(a))
#define nclr(a) memset((a),-1,sizeof(a))
#define pb push_back
#define INRANGE(x,s,e) ((s)<=(x) && (x)<(e))
#define MP(a,b) make_pair((a),(b))

using namespace std;

float getBMI(int h,int w){
	return w/pow(h*0.01,2.0);
}

int main(){
	int n, id, h, w, best_id=0;
	while(cin>>n,n){
		float best=999;
		best_id=999;
		rep(i,n){
			cin>>id>>h>>w;	
			if(abs(getBMI(h,w)-22)<=abs(best-22)){			
				if(abs(getBMI(h,w)-22)==abs(best-22)&&id<best_id){					cout<<"update"<<endl;
					best_id=id;
					best=getBMI(h,w);
				}else if(abs(getBMI(h,w)-22)<abs(best-22)){
					best_id=id;
					best=getBMI(h,w);
				}
			}
		}
		cout<<best_id<<endl;
	}
	return 0;
}

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

int main(){
  int m , d , d1 , d10 , answer ;
  answer = 0 ;
  cin >> m >> d ;
  for(int i=1; i<m+1; i++){
    for(int j=1; j<d+1; j++){
      d1 = j%10 ;
      d10 = j/10 ;
      if(d1>1&&d10>1&i==d1*d10)
        answer++ ;
    }
  }
  cout << answer << endl ;
}

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

#define MOD_BIG 1000000007
#define MOD_BIG2 998244353
using std::string;
using std::cin;
using std::cout;
using std::cerr;
using std::endl;
using ll = long long;
using std::vector;

template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) {
    vec.resize(len);
    for (auto &v : vec) ndarray(v, args...);
}

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



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

int main() {
    
    int H, W, A, B;
    cin >> H >> W >> A >> B;
    
    vector<int> vec(W);
    for (int i = 0; i < H-B; i++) {
        for (int j = 0; j < W-A; j++) cout << 1;
        for (int j = W-A; j < W; j++) cout << 0;
        cout << endl;
    }
    for (int i = H-B; i < H; i++) {
        for (int j = 0; j < W-A; j++) cout << 0;
        for (int j = W-A; j < W; j++) cout << 1;
        cout << endl;
    }
    
    return 0;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define ALL(c) (c).begin(), (c).end()
using namespace std;
using ll = long long;
using ld = long double;

const int N = 1e6+6;


int main(){
	//freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout);
	ios::sync_with_stdio(0);cin.tie(0);//cout.precision(12);cout<<fixed;
	
	int n, m;
	
	cin>>n;
	
	cout<<(n%10==9 || n/10==9 ? "Yes" : "No")<<endl;
	
	return 0;
}


Measured memory_bytes: 256
n,m=gets.split(" ").map(&:to_i) #最初のｎとｍのVALUE　をとる

a=n.times.map do                #matrixをN回やる
gets.split.map(&:to_i)          #空白段落分けて入力するためMAPとSPLIT
end
b=m.times.map do                #VECTORをm回入力
gets.to_i                       #値入力
end

a.each do |r|                   #rのなかをひとつひとつを繰り返す
    puts r.zip(b).map {|x, y| x * y }.reduce( :+)#ZIPはaとbを連動して計算をする #reduceは中身のSUMのためINJECTでも使える
  end
  


Measured memory_bytes: 7076
package main

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

var sc *bufio.Scanner = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}()

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

func nextInts(n int) []int {
	ints := make([]int, n)
	for i := 0; i < n; i++ {
		ints[i] = nextInt()
	}
	return ints
}

func calcRankDiff(n, v, i int, checked []int) int {
	d := v
	for _, c := range checked {
		if v > c {
			d--
		}
	}
	acc := 1
	for j := 2; j < (n - i); j++ {
		acc *= j
	}
	return acc * (d - 1)
}

func calcDiff(ints []int) int {
	n := len(ints)
	checked := []int{}
	diff := 0
	for i, v := range ints {
		diff += calcRankDiff(n, v, i, checked)
		checked = append(checked, v)
	}
	return diff + 1
}

func calcDistance(l, r []int) int {
	ld := calcDiff(l)
	rd := calcDiff(r)
	if ld < rd {
		ld, rd = rd, ld
	}
	return ld - rd
}

func main() {
	n := nextInt()
	ps := nextInts(n)
	qs := nextInts(n)
	fmt.Println(calcDistance(ps, qs))
}


Measured memory_bytes: 640
p [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51][gets.to_i-1]

Measured memory_bytes: 14352
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  string s[N];
  for(int i=0;i<N;i++){
    cin>>s[i];
  }
  int M;
  cin>>M;
  string t[M];
  for(int i=0;i<M;i++){
    cin>>t[i];
  }
  int u[N];
  for(int i=0;i<N;i++){
    u[i]=0;
  }
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      if(s[i]==s[j])
        u[i]++;
    }
    for(int k=0;k<M;k++){
      if(s[i]==t[k])
        u[i]--;
    }
  }
  int x;
  x=u[0];
  for(int i=0;i<N-1;i++){
    x=max(x,u[i+1]);
  }
  int y;
  if(x>=0)
    y=x;
  else
    y=0;
  cout<<y<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int X;

inline bool isprime()
{
	for (int i=2; i*i<=X; i++) if (X%i==0) return false;
	return true;
}

int main()
{
	cin >> X;
	while (!isprime()) X++;
	cout << X << endl;
	return 0;
}

Measured memory_bytes: 256
PROGRAM ATCODER

implicit none
integer :: a(5),i,dp=10,index=6,ans=0

do i = 1, 5
  read*, a(i)
  call chmin(dp,mod(a(i),10),index,i)
end do

do i = 1, 5
  if ( i == index .or. mod(a(i),10) == 0 ) cycle
  a(i) = (a(i)/10)*10 + 10
end do

do i = 1, 5, 1
  ans = ans + a(i)
end do

print'(i0)', ans 

contains

  subroutine chmin(dp,x,index,i)
  implicit none
  integer :: dp,x,index,i

  if (dp > x .and. x /= 0) then
  	dp = x
    index = i
  	return
  end if
  
  end subroutine

END PROGRAM ATCODER


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

long long MIN = 99999999;

template <typename T>
string ToString(const T& n) {
  ostringstream stm;
  stm << n;
  return stm.str();
}

void divisor(long long n) {
  long long t = sqrt(n);
  for (long long i = 1; i <= t; i++) {
    if (n % i == 0) {
      string a, b;
      a = ToString(i);
      b = ToString(n/i);
      if (max(a.size(), b.size()) < MIN) {
        MIN = max(a.size(), b.size());
      }
    }
  }
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(20) << fixed;
  long long N;
  cin >> N;
  divisor(N);
  cout << MIN << endl;
}

Measured memory_bytes: 3676
N,M = list(map(int, input().split()))
S = []
for _ in range(M):
    A,B = list(map(int, input().split()))
    S.append([A,B])
S = sorted(S, key=lambda x:x[1])

rem = 0
now = 0

for ab in S:
    left = ab[0]
    right = ab[1]
    if left <= now:
        continue
    else:
        now = right -1
        rem += 1

print(rem)

Measured memory_bytes: 22516
#include<bits/stdc++.h>
#define MOD 1000000007
#define MOD2 1000000006
#define TEMPMOD1 998244353
#define TEMPMOD2 998244352
#define INF 1000000000000000007
#define NEGINF -1000000000000000007
#define vll vector<ll> 
#define vvll vector<vector<ll>>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define plll pair<ll,pll>
#define vpll vector<pll>
using namespace std;
typedef long long int ll;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    ll n;
    cin>>n;
    if(n%2==1)
    {
        cout<<"0";
        exit(0);
    }
    ll ans=0;
    ll num=n/2;
    while(num!=0)
    {
        num/=5;
        ans+=num;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
# PROXY

N = int(input())
list = [input() for i in range(N)]
def has_duplicates(seq):
    return len(seq) != len(set(seq))    
if has_duplicates(list):
    print("No")
else:
    i = 1
    while i < N:
        if list[i-1][-1] != list[i][0]:
            print("No")
            break
        else:
            i += 1
    else:
        print("Yes")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define lli long long int

using namespace std;

int main() {
    string s,t;
    cin>>s;
    cin>>t;
    lli x,y;
    
    x=s.length();
    y=t.length();
    // cout<<x<<endl;
    // cout<<y<<endl;
    if((y-x)==1)
    {
        t.pop_back();
        if(s.compare(t)) cout<<"No"<<endl;
        else cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 3612
package main

import (
	"fmt"
	"os"
)

func main() {
	var x, y int
	fmt.Scanf("%d %d", &x, &y)

	/*
		xJump = (+2, +1) 移動の回数
		yJump = (+1, +2) 移動の回数

		とすると

		x = 2 * xJump +     yJump
		y =     xJump + 2 * yJump

		になるはずなので、連立して

		2 * x     = 4 * xJump + 2 * yJump
		        y =     xJump + 2 * yJump
		---------------------------------

		2 * x - y = 3 * xJump

		xJump = (2 * x - y) / 3
		yJump = x - 2 * (2 * x - y) / 3
			  = (2 * y - x) / 3
	*/

	if (2*x-y)%3 != 0 || (2*y-x)%3 != 0 {
		fmt.Println("0")
		os.Exit(0)
	}

	xJump := (2*x - y) / 3
	yJump := (2*y - x) / 3

	if xJump < 0 || yJump < 0 {
		fmt.Println("0")
		os.Exit(0)
	}

	// total 回の移動のうち xJump を行う場所を選ぶので total_C_xJump mod 1000000007
	total := xJump + yJump
	mod := 1000000007

	fact := make([]int, total+1)
	fact[0], fact[1] = 1, 1

	inv := make([]int, total+1)
	inv[1] = 1

	factInv := make([]int, total+1)
	factInv[0], factInv[1] = 1, 1

	for x := 2; x <= total; x++ {
		fact[x] = (x * fact[x-1]) % mod
		inv[x] = mod - ((mod/x)*inv[mod%x])%mod
		factInv[x] = (inv[x] * factInv[x-1]) % mod
	}

	// total_C_xJump = total! (x!)^-1 (t - x)!^-1
	ans := (fact[total] * factInv[xJump]) % mod
	ans = (ans * factInv[total-xJump]) % mod
	fmt.Printf("%d\n", ans)
}


Measured memory_bytes: 18076
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, cnt = 0, cru = 0;
  cin >> n;
  vector<int> vec(n);
  vector<bool> ok(n,false);
  REP(i,n) { int a; cin >> a; a--; vec[i] = a; }
  while(true) {
    if(ok[cru]) { cout << -1 << endl; return 0; }
    if(cru == 1) { cout << cnt << endl; return 0; }
    ok[cru] = true;
    cru = vec[cru];
    cnt++;
  }
  return 0;
}
//templete by private_yusuke#include <cctype>

Measured memory_bytes: 640
def main():
    from collections import namedtuple
    from itertools import combinations

    City = namedtuple('City', 'x y')

    def dist(a: City, b: City) -> float:
        dx = a.x - b.x
        dy = a.y - b.y
        return (dx * dx + dy * dy) ** 0.5

    N = int(input())

    cities = []
    for _ in range(N):
        x, y = map(int, input().split())
        c = City(x=x, y=y)
        cities.append(c)

    total = 0
    for comb in combinations(cities, r=2):
        total += dist(*comb)

    ans = total * 2 / N
    print(ans)


if __name__ == '__main__':
    main()

# 特定の2点を固定し、それ以外を並べる + 固定順を逆にする
# [oo]ooo... これを4個の要素の並び替えを見なす
# (n-1)! * 2!
# この2点間の移動が含まれる並び順は、(n-1)! * 2!通り
# 各2点間の距離の総和*(n-1)! * 2!通り / n!
# 各2点間の距離の総和*2/n


Measured memory_bytes: 3444
d[4],e[9],f,k;char s[30];z(){int b,c,a=e[f++];a>9?s[k++]=40,b=z(),s[k++]=a,c=z(),s[k++]=41,a=a-43?a-45?b*c:b-c:b+c:(s[k++]=a+48);return a;}y(o,n,i,j){if(i==7){f=k=0;if(z()==10){s[k]=0;puts(s);return 1;}return 0;}if(o)for(;j--;){e[i]="+-*"[j];if(y(o-1,n+1,i+1,3))return 1;}if(n|i==6)for(j=4;j--;)if(e[i]=d[j]){d[j]=0;if(y(o,n-1,i+1,3))return 1;d[j]=e[i];}return 0;}main(){for(;scanf("%d%d%d%d",d,d+1,d+2,d+3),f=*d;)y(3,0,0,3)||puts("0");}

Measured memory_bytes: 0
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(true){
			int n = sc.nextInt();
			if(n==0) break;
			String[] name = new String[n];
			int[][] map = new int[n][];
			int[] a = new int[30];
			for(int i=0;i<n;i++){
				name[i] = sc.next();
				int m = sc.nextInt();
				map[i] = new int[m];
				for(int j=0;j<m;j++){
					int p = sc.nextInt();
					map[i][j] = p;
					a[p]++;
				}
			}
			
			int[] ans = new int[n];
			int min = Integer.MAX_VALUE;
			int sum;
			for(int i=0;i<n;i++){
				sum = 0;
				for(int j=0;j<map[i].length;j++) sum += (n+1-a[map[i][j]]);
				min = Math.min(min, sum);
				ans[i] = sum;
			}
			
			ArrayList<String> list = new ArrayList<String>();
			for(int i=0;i<n;i++){
				if(ans[i]==min) list.add(name[i]);
			}
			Collections.sort(list);
			System.out.println(min + " " + list.get(0));
		}
	}

}

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

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

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

int n;
ll a[100000],ans,sum;

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

	cin>>n;
	REP(i,n) cin>>a[i];
	REP(i,n) {
		if(a[i]==0) ans+=(sum/2),sum=0;
		else sum+=a[i];
	}
	ans+=sum/2;
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;

int main() {
    string s;
    cin >> s;
    if (s[s.length() - 1] == 's')
        cout << s << "es";
    else cout << s << 's';
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>

using namespace std;
typedef long long ll;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define DEC(i, s) for (int i = (s); i >= 0; i--)

#define SIZE(v) (int)((v).size())
#define MEMSET(v, h) memset((v), h, sizeof(v))
#define FIND(m, w) ((m).find(w) != (m).end())

int n;
int field[6][6];
char memo[1 << 24];

void printField() {
  REP(y, n) {
    REP(x, n) {
      cout << field[y][x] << " ";
    }
    cout << endl;
  }
}

int encode() {
  int ret = 0;
  REP(y, n) REP(x, n) {
    if (y == 0 && x == 0) { continue; }
    ret |= field[y][x] << ((y * 5) + x - 1);
  }
  return ret;
}

int calc(int y, int x) {
  int state = encode();
  if (memo[state] != -1 && y != 0 && x != 0) { return memo[state]; }
  int ret = 100;
  if (x == n) { ret = calc(y + 1, 0); }
  else if (y == n) { ret = 0; }
  else if (field[y][x] == 0) { ret = calc(y, x + 1); }
  else {
    field[y][x] = 0;
    FOREQ(ny, y + 1, n) {
      FOREQ(nx, x + 1, n) {
        field[n][x] = 1;
        field[y][n] = 1;
        field[n][n] = 1;
        if (field[ny][x] + field[y][nx] + field[ny][nx] < 2) { continue; }
        field[ny][x] ^=1;
        field[y][nx] ^=1;
        field[ny][nx] ^=1;
        ret = min(ret, calc(y, x + 1) + 1);
        field[ny][x] ^=1;
        field[y][nx] ^=1;
        field[ny][nx] ^=1;
      }
    }
    field[y][x] = 1;
  }
  if (y == 0 && x == 0) { return ret; }
  return memo[state] = ret;
}

int main() {
  MEMSET(memo, -1);
  while (scanf("%d", &n), n) {
    MEMSET(field, 0);
    REP(y, n) REP(x, n) {
      scanf("%d", &field[y][x]);
    }
    REP(y, n) REP(x, n) {
      if (field[y][x] == 1) {
        FOR(ny, y, n) FOR(nx, x, n) {
          field[ny][nx] ^= 1;
        }
        field[y][x] = 1;
      }
    }
    int ans = calc(0, 0);
    while (ans--) { printf("myon"); }
    puts("");
  }
}

Measured memory_bytes: 16000
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
def pri(x): print('\n'.join(map(str, x)))

S = input()
T = input()

if S == T[:-1]:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9356
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<long long,long long>
#define mod 1000000007
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);

ll power(ll a,ll b){
	ll ans=1;
	while(b>0){
		if(b%2!=0){
			ans=(ans*a)%mod;
		}
		a=(a*a)%mod;
		b>>=1;
	}
	return ans;
}

int main() {
	IOS;
	int t=1;
	//cin>>t;
	while(t--){
		ll n;
      cin>>n;
      cout<<((n*(n-1))/2);
	}
	return 0;
}

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

char grid[50][51];
int now_sum = 0;
int H,W;

void dfs(int y,int x){
  grid[y][x] = '.';
  now_sum++;


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

  for(int i = 0;i < 4;i++){
    int nx = x + dx[i];
    int ny = y + dy[i];
    if(0 <= nx && nx < W && 0 <= ny && ny < H && grid[ny][nx] == '#')dfs(ny,nx);
  }

  return ;
}


int main(){
  cin >> H >> W;

  for(int i = 0;i < H;i++)cin >> grid[i];

  for(int i = 0;i < H;i++){
    for(int j = 0;j < W;j++){
      if(grid[i][j] == '#'){
        now_sum = 0;
        dfs(i,j);
        if(now_sum == 1){
          cout << "No" << endl;
          return 0;
        }
      }
    }
  }

  cout << "Yes" << endl;

}


Measured memory_bytes: 384
program registration
 
 implicit none
 character::s*10,t*11
 integer::n,i,ans

 read*,s,t
 n=len_trim(s)
 !print*,s,t
 
 ans=0
 do i=1,n
  if(s(i:i)/=t(i:i)) then
   ans=ans+1
   exit 
  end if
 end do

 if(ans==0) print*,'Yes'
 if(ans>0) print*,'No'

end program registration 

Measured memory_bytes: 2860
#include<stdio.h>

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

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

#define ll long long
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
const int MAXN = 5e5+5;
const int MOD= 998244353;
int a[MAXN],n;
void dfs(int pos,int maxx){
    if(pos==n+1){
        rep(i,1,n){
            printf("%c",a[i]+'a');
        }
        puts("");
        return;
    }
   rep(i,0,25){
        if(i>maxx+1)break;
        a[pos]=i;
        dfs(pos+1,max(maxx,i));
   }
}
int main(){
    while(cin>>n){
        a[1]=0;
        dfs(2,0);
    }
}


Measured memory_bytes: 1536
// D - Moving Piece
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);++i)

int main(){
	int N, K; cin>>N>>K;
	vector<int> P(N), C(N);
	rep(i, N) cin>>P[i], P[i]--;
	rep(i, N) cin>>C[i];

	ll score = -1e18;
	rep(st, N){
		ll lap_sc = 0, sum_sc = 0;
		int nx = st, lap_cn = 0;
		rep(i, N){
			lap_sc += C[nx];
			if(st == (nx = P[nx])){
				lap_cn = i + 1;
				break;
			}
		}
		lap_sc = max(0LL, lap_sc);

		rep(k_cn, K){
			sum_sc += C[nx];
			score = max(score, sum_sc + lap_sc * ((K - (k_cn + 1)) / lap_cn));
			if(st == (nx = P[nx])) break;
		}
	}
	cout<< score <<endl;
}


Measured memory_bytes: 3692
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

int main(){
	ll n; cin >> n;
	n = n % 10;
	if(n == 3) puts("bon");
	else if(n == 0 || n == 1 || n == 6 || n == 8) puts("pon");
	else puts("hon");
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
//const ll mod=1e9+7;
const ll mod=998244353;
const ll inf=5e18;

int main() {
  char a,b;
  cin >> a >> b;
  if(a<b) {
    cout << "<" << endl;
  }
  else if(a>b) {
    cout << ">" << endl;
  }
  else {
    cout << "=" << endl;
  }
}

Measured memory_bytes: 256
n,k=map(int,input().split())
a=list(map(int,input().split()))
f=list(map(int,input().split()))
a.sort()
f.sort(reverse=True)
ok=10**15
ng=-1
while ok-ng>1:
    check=(ok+ng)//2
    cnt=0
    for i in range(n):
        cnt+=(max(0,a[i]-check//f[i]))
    if cnt > k:ng = (ok+ng)//2
    else: ok = (ok+ng)//2
print(ok)

Measured memory_bytes: 119500
using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string ss = Console.ReadLine();
            int a = int.Parse(ss);
            int b = 0;
            for(int i = 0; i < ss.Length; i++)
            {
                b += int.Parse(ss[i].ToString());
            }
            string buf = "";
            if (a % b == 0)
            {
                buf = "Yes";
            }
            else
            {
                buf = "No";
            }
            Console.Write(buf);
        }
    }
}

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

#define reb(i,b,n) for(int i=(int)(b); i<(int)(n); i++)
#define rep(i,n) reb(i,0,n)
#define rreb(i,b,n) for(int i = b-1; i >= n; i--)
#define rrep(i,n) reb(i,n,0)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define reach(it,v) for(__typeof((v).rbegin()) it=(v).rbegin();it!=(v).rend();it++)
#define vall(x) (x).begin(), (x).end()
#define rvall(x) (x).rbegin(), (x).rend()
#define vsort(v) sort(vall(v))
#define rvsort(v) sort(rvall(v))
#define len(array) (sizeof (array) / sizeof *(array))
#define aall(x) x, x+len(x)
#define asort(x) sort(aall(x))
#define rasort(a, type) sort(aall(a), greater<type>())
#define afill(a, v) fill(aall(a), v)
#define afill2(a, v, type) fill((type *)a, (type *)(a + len(a)), v)
#define sz(x) (int)(x).size()
#define mp(a, b) make_pair(a, b)
#define fi first
#define se second
#define pb push_back
#define _USE_MATH_DEFINES
#define priArr(table, n) rep(i,n){cout<<table[i]<<' ';}cout<<'\n';
#define priAr2(table,W,H) rep(y,H){rep(x,W)cout<<table[y][x]<<' ';cout<<'\n';}
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = ["<<(x)<<"]"<<endl;

using namespace std;
using std::stringstream;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline std::string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class F, class T> inline void convert(const F &f, T &t){stringstream ss;ss<<f;ss>>t;}
template<class T> inline T sqr(T x) {return x*x;}

typedef long long ll; typedef unsigned long long ull;
typedef pair <int, int> P; typedef pair <int, P> PP;
typedef vector<int> vi;typedef vector<vi> vvi;typedef vector<string> vs;
typedef vector<ll> vl; typedef vector<P > vP; typedef vector<char> vc;
typedef long double ld;

const static int INF = 0x3f3f3f3f;
const static ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const static double EPS = 1e-9;
const static ll MOD = 1000000007LL;

int dx[] = {1,0,-1,0}, dy[] = {0,1,0,-1};
/* -------------------------------------------------------------------------- */

int main(int argc, char *argv[])
{
    ll N, M;
    cin >> N >> M;

    ll tmp;
    ll sum = 0;
    rep(i, M) {
        cin >> tmp;
        sum += tmp;
    }

    if (sum <= N) {
        cout << N - sum << endl;
    }else {
        cout << -1 << endl;
    }

    return 0;
}


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

int main(){
  long long A, B;
  cin >> A >> B;
  
  for(int i = 1; i <= B; i++){
    if((A * i) % B == 0){
      cout << A * i << endl;
      break;
    }
  }
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<list>
#include<cstring>
#include<algorithm>
#include <utility>
#include<stdio.h>
#include<climits>
#include <vector>
#include <queue>
#include <cmath>

using namespace std;

int main(){
    int n,x,y;
    int i,j,k,l;
    string str;
    cin >> n;
    for(i = 0;i < n;i++){
        cin >> str;
        x = 0;
        l = 1;
        for(k = 0;k < str.length();k++){
            switch(str[k]){
                case 'm':
                    x += l*1000;
                    l = 1;
                    break;
                case 'c':
                    x += l*100;
                    l = 1;
                    break;
                case 'x':
                    x += l*10;
                    l = 1;
                    break;
                case 'i':
                    x += l;
                    l = 1;
                    break;
                default:
                    l = str[k]-'0';
                    break;
            }
        }
        cin >> str;
        y = 0;
        l = 1;
        for(k = 0;k < str.length();k++){
            switch(str[k]){
                case 'm':
                    y += l*1000;
                    l = 1;
                    break;
                case 'c':
                    y += l*100;
                    l = 1;
                    break;
                case 'x':
                    y += l*10;
                    l = 1;
                    break;
                case 'i':
                    y += l;
                    l = 1;
                    break;
                default:
                    l = str[k]-'0';
                    break;
            }
        }
        x += y;
        if(x/1000){
            if(x/1000>1) cout << x/1000;
            cout << 'm';
            x %= 1000;
        }
        if(x/100){
            if(x/100>1) cout << x/100;
            cout << 'c';
            x %= 100;
        }
        if(x/10){
            if(x/10>1) cout << x/10;
            cout << 'x';
            x %= 10;
        }
        if(x){
            if(x>1) cout << x;
            cout << 'i';
        }
        cout << endl;
    }
}

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

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

    Scanner cin;
    Func cin2;
    void calc()
    {
        cin = new Scanner();
        cin2 = new Func();
        int n = cin.nextInt();
        long[] a = cin.ArrayLong(3 * n, 0);
        Array.Sort(a);
        Array.Reverse(a);
        long ans = 0;
        for (int i = 0; i < n; i++)
        {
            ans += a[i * 2 + 1];
        }
        Console.WriteLine(ans);
    }


}



class Scanner
{
    string[] s;
    int i;

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

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

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

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

        return b;
    }
}


Measured memory_bytes: 41676
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define FastRead        ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl            "\n"
#define pi              acos(-1)
#define ordered_set     tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define MAX             100005

typedef long long ll;


int main()
{
    FastRead

    ll n,k,sum=0;

    cin>>k>>n;

    vector<ll>v(n);

    for(ll i=0;i<n;i++)
    {
        cin>>v[i];
        sum+=v[i];
    }

    if(sum>k)
        cout<<-1;
    else
        cout<<k-sum;
}


Measured memory_bytes: 3684
x,y = map(int,input().split())
kyori = abs(abs(x) - abs(y))

hanten = 0
if (x>0 and y>0 or x<0 and y<0) and y<x:
    hanten = 2
if x>0 and y<0 or x<0 and y>0:
    hanten = 1
if (x==0 or y==0) and y < x:
    hanten = 1

print(kyori + hanten)

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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
ll gcd(ll a,ll b){
    if(b==0)
        return a;
    return gcd(b, a % b);
}

ll N;
ll A[101010], B[101010],As;
pll BA[101010];
pll abv[101010];
ll mk[101010],Sm[101010];
pll ans;
ll i, j, k;

bool comp(pll a){
    if(ans.first/ans.second<a.first/a.second){
        return true;
    }
    if(ans.first/ans.second>a.first/a.second){
        return false;
    }
    ll aa = ans.first % ans.second;
    ll bb = a.first % a.second;
    return aa * a.second < bb * ans.second;
}

pll solve(ll b,ll i){
    ll l = 0, r = N;
    while(l<r){
        ll c = (l + r + 1) / 2;
        ll a = Sm[c] - (c >= i + 1 ? abv[i].first : 0);
        if (a < As - b)
        {
            l = c;
        }
        else
        {
            r = c - 1;
        }
    }
    
    if(l==N)
        return {0l, 1l};
    ++l;
    ll a = As - Sm[l] + (l >= i + 1 ? abv[i].first : 0);
    //printf("%lld %lld\n", l, a);
    if(a<0)
        return {0l, 1l};
    return {(N - l + (l >= i + 1 ? 1 : 0)) * b - a, b};
}

int main(){
    scanf("%lld",&N);
    As = 0;
    fornum(i,0,N){
        scanf("%lld%lld", &A[i], &B[i]);
        abv[i] = {max(A[i], B[i]), i};
        As += A[i];
    }
    if(N==1){
        if(A[0]>=B[0]){
            printf("0 1");
        }else{
            j = gcd(A[0], B[0]);
            A[0] /= j;
            B[0] /= j;
            printf("%lld %lld", B[0] - A[0], B[0]);
        }
        return 0;
    }
    sort(abv, abv + N,greater<pll>());
    fornum(i,0,N){
        Sm[i + 1] = Sm[i] + abv[i].first;
    }

    ans = {0ll, 1ll};
    fornum(i,0,N){
        pll a = solve(B[abv[i].second], i);
        if(comp(a)){
            ans = a;
        }
    }
    ans.second *= N;
    j = gcd(ans.first, ans.second);
    ans.first /= j;
    ans.second /= j;
    printf("%lld %lld", ans.first, ans.second);
    return 0;
}

Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = 1000000007;
#define op(x) (x&(-x))
#define trace1(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 trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define si(n) scanf("%d",&n)
#define s2i(x,y) scanf("%d %d",&x,&y);
#define s3i(x,y,z) scanf("%d %d %d",&x,&y,&z);
#define s4i(x,y,z,w) scanf("%d %d %d %d",&x,&y,&z,&w);
#define print(a,n) for(int i=0;i<n;i++) cout<<a[i]<<" "; cout<<endl;
#define print2d(a,n,m) for(int i=0;i<n;i++) {for(int j=0;j<m;j++) cout<<a[i][j]<<" "; cout<<endl;}

//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);

int main()
{
	ll a,b,c;
	cin>>a>>b>>c;
	if(a%2==0||b%2==0||c%2==0)
	{
		cout<<0<<endl;
		return 0;
	}
	ll ans = min(a*b,min(b*c,a*c));
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define pll pair <ll, ll>
#define pci pair <char, int>
#define pld pair <ld, ld>
#define ppld pair <pld, pld>
#define ppll pair <pll, pll>
#define pldl pair <ld, ll>
#define vll vector <ll>
#define vvll vector <vll>
#define vpll vector <pll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define mll map <ll, ll>
#define fastmap gp_hash_table
#define cd complex <double>
#define vcd vector <cd>
#define PI 3.14159265358979
#pragma 03
using namespace std;
using namespace __gnu_pbds;
// chctxdy
int main(){
	string ip; cin >> ip;
	deque <char> s; 
	for (ll i = 0; i<ip.length(); i++) s.push_back(ip[i]);
	ll q; cin >> q;
	bool rev = false;
	while (q--){
		ll t; cin >> t;
		if (t == 1) rev = 1 - rev;
		else{
			ll d; cin >> d;
			char k; cin >> k;
			bool dir = rev;
			if (d == 1) dir ^= 1;
			else dir ^= 0;
			if (dir == 1) s.push_front(k);
			else s.push_back(k);
		}
	}
	if (!rev){
		for (ll i = 0; i<s.size(); i++) cout << s[i];
	}
	else{
		for (ll i = s.size() - 1; i>=0; i--) cout << s[i];
	}
}

Measured memory_bytes: 896
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

class mint:
    def __init__(self, x):
        self.__x = x % md

    def __str__(self):
        return str(self.__x)

    def __add__(self, other):
        if isinstance(other, mint): other = other.__x
        return mint(self.__x + other)

    def __sub__(self, other):
        if isinstance(other, mint): other = other.__x
        return mint(self.__x - other)

    def __rsub__(self, other):
        return mint(other - self.__x)

    def __mul__(self, other):
        if isinstance(other, mint): other = other.__x
        return mint(self.__x * other)

    __radd__ = __add__
    __rmul__ = __mul__

    def __truediv__(self, other):
        if isinstance(other, mint): other = other.__x
        return mint(self.__x * pow(other, md - 2, md))

    def __pow__(self, power, modulo=None):
        return mint(pow(self.__x, power, md))

md=10**9+7
def main():
    n,m=MI()
    xx=LI()
    yy=LI()
    ans=mint(0)
    byj=mint(0)
    for j in range(m - 1):
        byj+=(j+1)*(m-j-1)*(yy[j+1]-yy[j])
    for i in range(n-1):
        ans+=(xx[i+1]-xx[i])*(i+1)*(n-i-1)*byj

    print(ans)

main()

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

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto pqr = RDR.ARR;
	pqr.sort();

	writeln(pqr[0] + pqr[1]);
	stdout.flush();
	debug readln();
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstring>
#include <cstdio>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map> //pair is also included in this library
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define REP(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define fst first
#define snd second
#define MP make_pair //incase c++11 or later is not available

using namespace std;

typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//prefer define statement
//for reason that const int ver. of INF will raise a silly warning (unused variable)
#define INF (INT_MAX/3)
#define LIM_INF (INT_MAX)
//const int INF = INT_MAX/3;

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

int main(){
  int N;
  cin >> N;
  VI seq(N);
  REP(i, 0, N){
    cin >> seq[i];
  }

  REP(i, 0, N){
    if(i > 0){
      cout << " ";
    }
    cout << seq[i];
  }
  cout << endl;

  REP(i, 1, N){
    int key = seq[i];
    int j = i-1;
    while(j >= 0 && seq[j] > key){
      seq[j+1] = seq[j];
      j--;
    }
    seq[j+1] = key;
    REP(k, 0, N){
      if(k > 0){
        cout << " ";
      }
      cout << seq[k];
    }
    cout << endl;
  }

  return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<int> a(N);
    rep(i, N) cin >> a[i];
    int cnt = 0;
    bool flag = false;
    rep(i, N) {
        if (a[i] == 1) flag = true;
        if (a[i] != i + 1 - cnt) cnt += 1;
    }
    if (flag == false) {
        cout << -1 << endl;
    } else {
        cout << cnt << endl;
    }
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
        while(true){
                int w, d;
                cin >> w >> d;
                if(w == 0 && d == 0){ break; }
                vector<int> hw(21), hd(21);
                for(int i = 0; i < w; ++i){
                        int h;
                        cin >> h;
                        ++(hw[h]);
                }
                for(int i = 0; i < d; ++i){
                        int h;
                        cin >> h;
                        ++(hd[h]);
                }
                int answer = 0;
                for(int i = 0; i < 21; ++i){
                        answer += i * max(hw[i], hd[i]);
                }
                cout << answer << endl;
        }
        return 0;
}

Measured memory_bytes: 0