akhauriyash/Code-Regression huggingface dataset:
//==========================Head files==========================
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
#include<cmath>
#include<set>
#include<iostream>
#include<map>
#define LL long long
#define db double
#define mp make_pair
#define pr pair<int, int>
#define fir first
#define sec second
#define pb push_back
#define ms(i, j) memset(i, j, sizeof i)
using namespace std;
//==========================Templates==========================
inline int read() {
    int x = 0, f = 1; char c = getchar();
    while(c < '0' || c > '9'){if (c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9'){x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
inline LL readl() {
    LL x = 0, f = 1; char c = getchar();
    while(c < '0' || c > '9'){if (c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9'){x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
int power(int a, int b) {
	int ans = 1;
	while (b) {
		if(b & 1) ans = ans * a;
		b >>= 1; a = a * a;
	}
	return ans;
}
int power_mod(int a, int b, int mod) {
	a %= mod;
	int ans = 1;
	while (b) {
		if(b & 1) ans = (ans * a) % mod;
		b >>= 1, a = (a * a) % mod;
	}
	return ans;
}
LL powerl(LL a, LL b) {
	LL ans = 1ll;
	while (b) {
		if(b & 1ll) ans = ans * a;
		b >>= 1ll;a = a * a;
	}
	return ans;
}
LL power_modl(LL a, LL b, LL mod) {
	a %= mod;
	LL ans = 1ll;
	while (b) {
		if(b & 1ll) ans = (ans * a) % mod;
		b >>= 1ll, a = (a * a) % mod;
	}
	return ans;
}
LL gcdl(LL a, LL b) {return b == 0 ? a : gcdl(b, a % b);}
LL abssl(LL a) {return a > 0 ? a : -a;}
int gcd(int a, int b) {return b == 0 ? a : gcd(b, a % b);}
int abss(int a) {return a > 0 ? a : -a;}
//==========================Main body==========================
#define LD "%I64d"
#define D "%d"
#define pt printf
#define sn scanf
#define pty printf("YES\n")
#define ptn printf("NO\n")
//==========================Code here==========================
int n, d[100000 + 5];
int main() {
	cin >> n;
	for (int i = 1; i <= n; ++i) scanf("%d", &d[i]);
	sort(d + 1, d + 1 + n);
	cout << d[n / 2 + 1] - d[n / 2];
	return 0;
}

Measured memory_bytes: 640
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
  int i,N,a[200001],M,h,m=2000000000,val;
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&a[i]);
  }
  sort(a,a+N);
  M = a[N-1];
  if(!(M%2))
    h = M/2;
  else
    h = M/2 + 1;
  for(i=0;i<N;i++)
    if(abs(h - a[i]) < m){
      m = abs(h - a[i]);
      val = a[i];
    }
  printf("%d %d\n",M,val);
}


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

public class Po
{
    public int x { get; set; }
    public int y { get; set; }
}

public class Hello
{
    public static void Main()
    {
        var dx = new int[] { 0, 1, 0, -1 };
        var dy = new int[] { 1, 0, -1, 0 };
        var st = new Stack<Po>();
        while (true)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var h = int.Parse(line[0]);
            var w = int.Parse(line[1]);
            if (h == 0 && w == 0) break;
            var map = new int[h, w];
            for (int i = 0; i < h; i++)
            {
                var s = Console.ReadLine().Trim();
                for (int j = 0; j < w; j++)
                    if (s[j] == '#') map[i, j] = 1;
                    else if (s[j] == '*') map[i, j] = 2;
            }
            var count = 0;
            for (int i = 0; i < h; i++)
                for (int j = 0; j < w; j++)
                    if (map[i, j] <= 2)
                    {
                        st.Push(new Po { x = i, y = j });
                        goDfs(map, st, map[i, j], dx, dy ,h,w);
                        count++;
                    }
            Console.WriteLine(count);
        }
    }
    public static void goDfs(int[,] map, Stack<Po> st, int c, int[] dx, int[] dy ,int h ,int w)
    {
        while (st.Count() > 0)
        {
            var a = st.Pop();
            map[a.x, a.y] = 3;
            for (int i = 0; i < 4; i++)
            {
                var nx = a.x + dx[i];
                var ny = a.y + dy[i];
                if (nx >= 0 && nx < h && ny >= 0 && ny < w && map[nx, ny] == c)
                    st.Push(new Po { x = nx, y = ny });
            }
        }
    }
}

Measured memory_bytes: 11100
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}
int g[9][9];
int main(){
	int n, m;
  cin>>n>>m;
  rep(i, m){
    int a, b;
    cin>>a>>b; a--; b--;
    g[a][b] = g[b][a] = 1;
  }
  vector<int> p(n);
  rep(i, n) p[i] = i;
  int res = 0;
  do{
    int r = 1;
    rep(i, n-1) r *= g[p[i]][p[i+1]];
    res += r;
  } while(next_permutation(p.begin()+1, p.end()));
  cout<<res<<endl;
	return 0;
}


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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)x.size())
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}

/*
 */

using vi = vector<int>;
using vvi = vector<vi>;
using P = pair<int,int>;

const int mod = 1e9+7;

int mpow(int a, int b)
{
  if(b == 0) return 1; 
  return mpow(a*a%mod, b/2)*(b%2?a:1)%mod;
}

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

int lcm(int a, int b){
  return a / gcd(a, b) * b;
}

int cnt[1010101];

signed main() {
  int n;
  cin >> n;


  vi a(n);
  rep(i, 0, n) cin >> a[i];

  vector<P> p;
  rep(i, 0, n){
    int t = a[i];
    rep(i, 2, t/i+1){
      int c = 0;
      while(t%i == 0){
        c++;
        t /= i;
      }
      chmax(cnt[i], c);
    }
    if(t) chmax(cnt[t], 1LL);
  }

  int tmp = 1;
  rep(i, 0, 1010101){
    rep(j, 0, cnt[i]){
      (tmp *= i) %= mod;
    }
  }

  int ans = 0;
  rep(i, 0, n){
    (ans += tmp*mpow(a[i], mod-2)%mod) %= mod;
  }

  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 6656
/******************************************
*    AUTHOR:         CHIRAG AGARWAL       *
*    INSTITUITION:   BITS PILANI, PILANI  *
******************************************/
#include <bits/stdc++.h>
using namespace std;
 
typedef long long LL; 
typedef long double LD;

int main() 
{
	LL n,a,b;
	scanf("%lld %lld %lld",&n,&a,&b);
	printf("%lld\n",max(0ll,(n-2)*(b-a)+1));
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <string>
#include <unordered_map>
using namespace std;


#define ll long long int ;

int main(void){
    
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);
      
    int n,a,b;
    cin >> n >> a >> b;
    cout << min(n*a,b) << endl;
    return 0;
}


Measured memory_bytes: 256
object Main extends App {
  val inputs: Seq[String] = io.Source.stdin.getLines().toList
  val N = inputs(0).toInt
  val K = inputs(1)
  val S = inputs(2).toInt

  println(solve(N, K, S))

  def solve(length: Int, word: String, index: Int): String = {
    val indexedString = word(index - 1)
    word.map(char => {
      if (char == indexedString) {
        char
      } else {
        "*"
      }
    }).mkString("")
  }
}


Measured memory_bytes: 27312
def main():
    n, m = map(int, input().split())
    num = [set() for _ in range(n)]
    ans = ""
    for _ in range(m):
        s, v = input().split()
        num[int(s)-1].add(v)
    if len(num[0]) > 1 or (n > 1 and num[0] and list(num[0])[0] == "0"):
        print(-1)
        return
    if len(num[0]) == 1:
        ans += list(num[0])[0]
    else:
        if n == 1:
            ans += "0"
        else:
            ans += "1"
    for i in num[1:]:
        if len(i) == 0:
            ans += "0"
        elif len(i) == 1:
            ans += list(i)[0]
        else:
            print(-1)
            return
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3188
#include<iostream>
using namespace std;
int main(){
  int i=1;
  int x;
  while(1){
    cin>>x;
    if(x==0) break;
    cout<<"Case "<<i<<":"<<" "<<x<<endl;
    i++;
  }
  return 0;
  /*int i=1;
int n;
 
while(true){
  cin >> n;
  if(n == 0)break;
  cout << "Case " << i << ": " << n << endl;
  i++;
 }
 
 return 0;
  */

}



Measured memory_bytes: 3076
#include <algorithm>
#include <iostream>
#include <string>


using namespace std;


int main()
{
        std::string s,t;
        bool flag = false;
        cin >> s;
        cin >> t;

        for (int i=0; i<s.size(); i++) {
                rotate(s.begin(), s.begin()+1, s.end());
                if (s == t) {
                        flag = true;
                        break;
                }
        }

        if (flag==true) {
                cout << "Yes" << endl;
        } else {
                cout << "No" << endl;
        }



        return 0;
}


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

int main() {
  string S;
  cin >> S;
  int count=0;
  for(int i=0; i<3; i++){
    if(S.at(i)=='o')
      count++;
  }
  cout << 700+100*count << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		Long[] v = new Long[N];
		for(int i=0; i<N; i++)
			v[i] = sc.nextLong();
		
		Arrays.sort(v, new Comparator<Long>(){
			public int compare(Long l1, Long l2) {
				return -Long.compare(l1, l2);
			}
		});
		
		double sum = 0;
		for(int i=0; i<A; i++)
			sum += v[i];
		
		System.out.println(sum/A);
		
		int s = N,t = 0;
		for(int i=0; i<N; i++)
			if(v[i].equals(v[A-1])) {
				s = Math.min(s, i);
				t = Math.max(t, i);
			}
		t++;
		
		long[][] comb = new long[100][100];
		for(int i=0; i<100; i++) {
			comb[i][0] = comb[i][i] = 1;
			for(int j=1; j<i; j++) {
				comb[i][j] = comb[i-1][j] + comb[i-1][j-1];
			}
		}
		
		long ans = 0;
		if(s==0) {
			for(int i=A; i<=Math.min(B, t); i++)
				ans += comb[t][i];
		} else {
			ans = comb[t-s][A-s];
		}
		System.out.println(ans);
		
		sc.close();
	}
}

Measured memory_bytes: 23764
import java.util.HashMap;
import java.util.Scanner;


// 146_a
public class Main {

    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);

        String s = scan.next();

        HashMap<String, Integer> map = new HashMap<>();
        map.put("SUN", 7);
        map.put("MON", 6);
        map.put("TUE", 5);
        map.put("WED", 4);
        map.put("THU", 3);
        map.put("FRI", 2);
        map.put("SAT", 1);

        System.out.println(map.get(s));

    }

}


Measured memory_bytes: 21844
#include <iostream>
#include <cstdio>
#include <iomanip>

using namespace std;

int main()
{
  int a;
  int b;
  int d;
  int r;
  double f;
  
  cin >> a >>b;
  d=a/b;
  r=a%b;
  f=(double)a/(double)b;
  
  cout << d <<" "<< r <<" "<< fixed << f <<"\n";
}

Measured memory_bytes: 1248
/**
  @date Time-stamp: <2019-06-26 18:58:54 tagashira>
  @file a.cpp
  @title A - Still TBD
  @brief https://atcoder.jp/contests/abc119/tasks/abc119_a
**/

#include <bits/stdc++.h>
using namespace std;

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

  string year  = S.substr(0, 4);
  string month = S.substr(5, 2);
  string date  = S.substr(8, 2);
  // cout << year << month << day << endl;

  int day = stoi(year) + stoi(month) * 31 + stoi(date);

  if (day <= (2019 + 4 * 31 + 30)) {
    cout << "Heisei" << endl;
  } else {
    cout << "TBD" << endl;
  }

  return 0;
}


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

main() {
    string S,T,U; cin >> S >> T >> U;
    cout << (char)toupper(S[0]) << (char)toupper(T[0]) << (char)toupper(U[0]) << endl;

    return 0;
}

Measured memory_bytes: 256
// ConsoleApplication7.cpp : ??????????????? ??¢????????±????????§????????¨????????? ?????????????????????????????????
//

#include <stdio.h>


int main(int argc, char* argv[])
{
	int a, b, c;
	int t;
	char temp[100];

	fgets(temp, sizeof(temp), stdin);
	sscanf(temp, "%d %d %d", &a, &b, &c);

	if (a > b) {
		t = a;
		a = b;
		b = t;
	}
	if (b > c) {
		t = b;
		b = c;
		c = t;
	}
	if (a > b) {
		t = a;
		a = b;
		b = t;
	}
	printf("%d %d %d\n", a, b, c);

	return 0;
}

Measured memory_bytes: 2696
function main(input) {
  const A = parseInt(input.split(" ")[0], 10);
  const B = parseInt(input.split(" ")[1], 10);
  const C = parseInt(input.split(" ")[2], 10);
  var arr=[A+10*B+C, 10*A+B+C, 10*C+A+B]
  console.log(Math.max.apply(null, arr));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store")  
#pragma GCC optimize ("-fno-defer-pop")
typedef long long int ll; 
typedef long double ld; 
 


int main()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	string s;
	cin>>s;
	
	ll a=0,b=s.size();
	b--;
	ll ans = 0;
	while(a<=b)
	{
		if(s[a]!=s[b])ans++;
		a++;
		b--;
	}
	
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int main(){

  int *a,i,j,b,N,k;

  scanf("%d",&N);
  a=(int *)malloc(N*sizeof(int));
  for(j=0;j<N;j++){
    scanf("%d",&a[j]);
  }
  for(j=1;j<N;j++){
    for(k=0;k<N;k++){
        printf("%d",a[k]);
	if(k !=N-1)printf(" ");
    }
    printf("\n");
    for(i=j-1;i>=0;i--){
      if(a[i]>a[i+1]){
	b=a[i];
	a[i]=a[i+1];
	a[i+1]=b;   
      }     
    }   
  }
  for(j=0;j<N;j++){
    printf("%d",a[j]);
    if(j !=N-1)printf(" ");
  }
  printf("\n");
  return 0;  
}




Measured memory_bytes: 2044
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
//二項係数の計算
int nCr(int A, int B) {
    ll ans = 1;
    for (int i = 0; i < B; i++) {
        ans *= A - i;
    }
    for (int i = 0; i < B; i++) {
        ans /= i + 1;
    }
    return ans;
}
int main() {
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll ans=0;
    if(0<a&&0<c){
        ans=b*d;
    }
    else if(a<0&&c<0){
        ans=max(a*c,b*d);
    }
    else{
      ll v=max(b*d,b*c);
        ans=max(v,a*d);
      
    }
    cout<<ans<<endl;
}



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

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		long a = stdIn.nextLong();
		long b = stdIn.nextLong();
		long c = stdIn.nextLong();
		long k = stdIn.nextLong();
		
		if(k<=a) {
			System.out.println(k);
		}else if(k<=a+b){
			System.out.println(a);
		}else {
			System.out.println(a-(1*(k-a-b)));
		}
		
	}

}


Measured memory_bytes: 35792
#include<iostream>
#include<stdio.h>

using namespace std;

typedef struct{
	int col;
	int row;
}Point;

int main(){

	int in;
	Point now;

	while(cin >> in && in){
		int num = 1;
		int data[in][in];

		for(int i = 0; i < in; i++){
			for(int j = 0; j < in; j++){
				data[i][j] = 0;
			}
		}
	
		now.col = (in-1)/2;
		now.row = (in-1)/2+1;
		data[now.row][now.col] = num;
		now.col++;
		now.row++;

		while(num < in*in){
			if(now.col >= in) now.col = 0;
			if(now.col < 0) now.col = in-1;
			if(now.row >= in) now.row = 0;

			if(data[now.row][now.col] != 0){
				now.col--;
				now.row++;
				continue;
			}
			num++;
			data[now.row][now.col] = num;
			now.col++;
			now.row++;
		}
		for(int i = 0; i < in; i++){
			for(int j = 0; j < in; j++){
				printf("%4d",data[i][j]);
			}
			cout << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 0
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

N,K,C = LI()
S = list(input())

# oの日
ok = []
for i in range(N):
    if S[i] == 'o':
        ok.append(i)

# 順方向で何日働けるか
dp = [0]*N
dp[0] = 1 if S[0] == 'o' else 0
for i in range(1,N):
    if S[i] == 'o':
        if dp[i-1] == 0:
            dp[i] = 1
        else:
            if i-C-1 >= 0:
                dp[i] = max(dp[i-1],dp[i-C-1]+1)
            else:
                dp[i] = max(dp[i-1],1)
    else:
        dp[i] = dp[i-1]

# 逆方向で何日働けるか
dp2 = [0]*N
dp2[-1] = 1 if S[-1] == 'o' else 0
for i in range(N-1)[::-1]:
    if S[i] == 'o':
        if dp2[i+1] == 0:
            dp2[i] = 1
        else:
            if i+C+1 <= N-1:
                dp2[i] = max(dp2[i+1],dp2[i+C+1]+1)
            else:
                dp2[i] = max(dp2[i+1],1)
    else:
        dp2[i] = dp2[i+1]

# 左右から貪欲をしたときに用いる日
left = []
right = []
now = 0
for i in range(N):
    if dp[i] != now:
        left.append(i)
        now += 1
now = 0
for i in range(N)[::-1]:
    if dp2[i] != now:
        right.append(i)
        now += 1
right = list(reversed(right))

# 次に働ける直近の日
ne = [-1]*N
for i in range(N):
    if S[i] == 'o':
        p = bisect_left(ok,i+C+1)
        if p < len(ok):
            ne[i] = ok[p]

# 次にoが来る日
neo = [-1]*N
for i in range(N):
    if S[i] == 'o':
        p = bisect_left(ok,i+1)
        if p < len(ok):
            neo[i] = ok[p]

ans = []
for i in range(N):
    p1 = bisect_right(left,i-1)-1
    p2 = bisect_left(right,i+1)
    if p1 == -1:
        if p2 == len(right):
            num = 0
        else:
            num = dp2[right[p2]]
    else:
        if p2 == len(right):
            num = dp[left[p1]]
        else:
            v1 = left[p1]
            v2 = right[p2]
            if v1 == v2:
                num = dp[v1]+dp2[v2]-1
            elif v2-v1 >= C+1:
                num = dp[v1]+dp2[v2]
            else:
                nex = ne[v1]
                if nex == -1:
                    num = dp[v1]
                elif nex == i:
                    right = neo[nex]
                    if right == -1:
                        num = dp[v1]
                    else:
                        num = dp[v1]+dp2[right]
                else:
                    num = dp[v1]+dp2[nex]
    if num < K:
        ans.append(i)

for a in ans:
    print(a+1)

Measured memory_bytes: 87112
#include <bits/stdc++.h>
#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 sp(n) cout << fixed << setprecision(n)
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 ll;
using namespace std;
const int mod = 1000000007;
long long modpow(long long a, long long n){
  long long r = 1;
  while (n) {
    r = r * ( (n%2)?a:1 ) %mod;
    a = a * a % mod;
    n >>= 1;
  }
  return r;
}
int main(void){
    ll n;cin>>n;
    map<int,int> mp;
    rep(i,n){
        int a;cin>>a;
        mp[a]++;
    }
    if(n%2==0){
        for(int i=1;i<=n-1;i+=2){
            if(mp[i]!=2){
                cout<<0<<endl;
                return 0;
            }
        }
    }else{
        if(mp[0]!=1){
            cout<<0<<endl;
            return 0;
        }else{
            for(int i=2;i<=n-1;i+=2){
                if(mp[i]!=2){
                    cout<<0<<endl;
                    return 0;
                }
            }
        }
    }
    ll res=modpow(2,n/2);
    cout<<res<<endl;
}

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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define M1 puts("-1")
#define pb push_back

template <typename T>
ostream &operator<<(ostream &os, vector<T> &v)
{
    os << "{";
    rep(i, v.size()) os << v[i] << (i == (int)v.size() - 1 ? "" : ", ");
    os << "}";
    return os;
}
template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }
struct in
{
    const size_t n = 0;
    in() = default;
    in(size_t n) : n(n){};
    template <typename T>
    operator T()
    {
        T ret;
        cin >> ret;
        return ret;
    }
    template <typename T>
    operator vector<T>()
    {
        assert(n != 0);
        vector<T> ret(n);
        for (auto &x : ret)
            cin >> x;
        return ret;
    }
};

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using pll = pair<ll, ll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    int n = in();
    string s = in(), t = in();
    string ans;
    rep(i, s.size())
    {
        ans.pb(s[i]);
        ans.pb(t[i]);
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include <numeric>
#include<map>
#include<queue>
#include<math.h>
#include<iomanip>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define PI acos(-1);
typedef long long ll;
using namespace std;
const int MOD=1000000007;
//scanf("%d", &a); '\n';


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n, k;
	cin >> n >> k;
	vector<int> a(n), b(2 * n);
	rep(i, n) {
		cin >> a[i];
		b[i] = a[i];
		b[i + n] = a[i];
	}

	ll count = 0;;
	ll ans1 = 0;
	rep(i, n - 1) {
		rep2(j, i + 1, n) {
			if (a[i] > a[j]) ++ans1;
		}
	}
	rep(i, n) {
		rep2(j, n, 2 * n) { if (b[i] > b[j])  ++count; }
	}
	ans1 = (ans1* k) % MOD;
	//count = ((count%MOD)*(k * (k - 1)%MOD)* 500000004)%MOD;
	count %= MOD;
	ll al = (k*(k - 1)) % MOD;
	count *= al;
	count %= MOD;
	count *= 500000004;
	count %= MOD;
	cout << (ans1 + count) % MOD;
}
	

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) rep(i, x.size()) cerr << x[i] << (i == x.size() - 1 ? "\n" : " ")
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = ((1LL << 30) + (1LL << 29));
const int MOD = 1000000007;

//=============================
int N, M, K;
string S, T;
vector<int> A;
vector<int> B;
//=============================
void input()
{
    cin >> N;
    A.resize(N);
    rep(i, N)
    {
        cin >> A[i];
    }
}
//=============================
void func() {}
//=============================
void solve()
{
    bool ans = true;
    int state = 0; // 0,1
    int imax = -INF;
    rep(i,N){
        imax = max(imax, A[i]);
        if (imax > A[i]+1){
            ans=false;
            break;
        }
    
    }
    // for (int i = 0; i < N - 1; ++i)
    // {
    //     if (state == 0)
    //     {
    //         if (A[i] > A[i + 1])
    //         {
    //             if (A[i] - 1 == A[i + 1])
    //             {
    //                 state = 1;
    //                 continue;
    //             }
    //             else
    //             {
    //                 ans = false;
    //                 break;
    //             }
    //         }
    //         else{
    //         }
    //     }
    //     else if (state == 1)
    //     { //canno
    //         if (A[i] > A[i + 1])
    //         {
    //             ans = false;
    //             break;
    //         }
    //         else
    //         {
    //             state = 0;
    //             continue;
    //         }
    //     }
    //     else
    //     {
    //     }
    // }
    cout << (ans ? "Yes" : "No") << endl;
}
//=============================
signed main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 1024
import java.util.*;
import java.io.*;

public class Main {
	private static void solve(){
		//Implement solution here.
		int n = ni();
		int k = ni();
		int[] v = na(n);
		int result = 0;
		Queue<Integer> pq = new PriorityQueue<Integer>();
		for(int i = 0; i <= Math.min(n, k); i++) {
			for(int a = 0; a <= i; a++) {
				for(int oa = 1; oa <= a; oa++) {
					pq.add(v[oa - 1]);
				}				
				for(int ob = 1; ob <= i - a; ob++) {
					pq.add(v[n - ob]);
				}				
				int remcnt = k - i;
				while(!pq.isEmpty() && pq.peek() < 0 && remcnt > 0) {
					pq.poll();
					remcnt--;
				}
				int tmpresult = 0;
				while(!pq.isEmpty()) {
					tmpresult += pq.poll();
				}
				result = Math.max(result, tmpresult);
			}	
		}
		System.out.println(result);		
	}

	//Switch input source (stdin/file)
	private static BufferedReader br  = new BufferedReader(new InputStreamReader(System.in));
	public static void main(String[] args){
		String debugDataPath = System.getenv("DD_PATH");        
		if(debugDataPath != null){
			try{
				br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		}
		solve();
	}

	//Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	//Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
	//Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
	//Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
	//Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
	//Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}

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

using namespace std;
#define ll long long
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define PRINT(item) cout << (item) << endl;
#define PRINT_VEC(V) \
    for (auto v : (V)) cout << v << ' ';
const int MOD = 1000000007;
/* cout << fixed << setprecision(10) << decimal << endl; */

int main() {
    /* code */
    string S, T;
    cin >> S >> T;
    int A, B;
    cin >> A >> B;
    string U;
    cin >> U;
    if (U == S) {
        cout << A - 1 << " " << B << endl;
    } else {
        cout << A << " " << B - 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
n,c,k=map(int,input().split())
ans=0
if c==1:
  print(n)
  exit()
l=[]
for i in range(n):
  l.append(int(input()))
l.sort()
ride=[]
while l:
  a=l.pop(0)
  rode=a
  ride.append(a)
  while len(ride)<c:
    if l==[]:
      ans+=1
      break
    b=l[0]
    if b>ride[0]+k:
      ride.clear()
      ans+=1
      break
    l.pop(0)
    ride.append(b)
    if len(ride)==c:
      ans+=1
      ride.clear()
      break
print(ans)

Measured memory_bytes: 7392
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <string>
#include <cassert>
#define SIZE 100005

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int A[SIZE];
ll sum[SIZE];

int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++) scanf("%d",&A[i]);
	sort(A,A+n);
	for(int i=0;i<n;i++)
	{
		sum[i]=A[i];
		if(i>0) sum[i]+=sum[i-1];
	}
	int cnt=0;
	for(int i=0;i<n;i++)
	{
		int pos=0;
		ll sz=A[i];
		while(pos<n)
		{
			ll gt=pos==0?0:sum[pos-1];
			if(pos<=i) gt+=A[i];
			int t=upper_bound(A,A+n,gt*2LL)-A;
			if(t==pos) break;
			pos=t;
		}
		if(pos==n) cnt++;
	}
	printf("%d\n",cnt);
	return 0;
}


Measured memory_bytes: 1280
#include<stdio.h>
#include<ctype.h>
int num[26],a;
char ch;

main()
{
	while(scanf("%c",&ch)!=EOF){
		
		if(isupper(ch)){
		a=tolower(ch)-'a';num[a]++;
		}
		
		else if(islower(ch)){
		a=ch-'a';num[a]++;
		}
	}
	
	for(ch='a';ch<='z';ch++){
		printf("%c : %d\n",ch,num[ch-'a']);
	}
	
	return 0;
}

Measured memory_bytes: 548
package main

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

const mod = 1000000007

// 1MB
const ioBufferSize = 1 * 1024 * 1024

var sc = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	sc.Split(bufio.ScanWords)
	return sc
}()

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

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

func main() {
	n := nextInt()
	v := make([]float64, n)

	for i := 0; i < n; i++ {
		v[i] = float64(nextInt())
	}
	sort.Float64s(v)

	s := v[0]
	for i := 0; i < n-1; i++ {
		s = (s + v[i+1]) / 2
	}

	fmt.Println(s)
}


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

int main() {
	int a, b; cin >> a >> b;
    if(a >= 13){
        cout << b << endl;
    }else if(a >= 6){
        cout << b/2 << endl;
    }else{
        cout << 0 << endl;
    }
}
//g++ -o a.exe a.cpp

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
int n;
main() {
    //freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(false);
    cin >> n;
    int cnt = 0;
    for (int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        while ((x % 2) == 0) {
            cnt++;
            x /= 2;
        }
    }
    cout << cnt;
    return 0;
}


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

#define fi first
#define se second
#define pb push_back
#define int long long
#define all(x) (x).begin(), (x).end()

using LL = long long;
using LD = long double;
using pii = pair<int, int>;
using vii = vector<pii>;

const int INF = 1e18;
const int MOD = 1e9 + 7;
const int N = 1e5 + 5;

int32_t main() {
    //ios::sync_with_stdio(false); cin.tie(nullptr);

    double r;
    cin >> r;

    double pi = acos(-1);
    cout << fixed << setprecision(10);
    cout << 2*pi*r << "\n";
}


Measured memory_bytes: 3784
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<time.h>
#include<set>
#include<map>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i>b;i--)
#define vint vector<int> 
#define vvint vector<vint>
#define ct(a) cout<<a<<endl
using namespace std;
typedef long long ll;
const ll INF = 1e9+7;
const int MOD = 1e9 + 7;


int N,A, B,C,ans;
int l[8];

int cul(int n,int a,int b,int c) {

	if (n == N) {
		if(min(min(a,b),c)>0)
		return abs(a - A) + abs(b - B) + abs(c - C) - 30;
		else return INF;
	}
	  
	int ret0 = cul(n + 1, a, b, c);
	int ret1=cul(n + 1, a + l[n], b, c)+10;
	int ret2= cul(n + 1, a , b+l[n], c) + 10;
	int ret3= cul(n + 1, a , b, c+l[n]) + 10;
	return min(ret0,min(min(ret1, ret2),ret3));
	


}

int main(void) {
	cin >> N>>A >> B>>C;
	FOR(i, 0, N)cin >> l[i];
	
	ans = cul(0,0,0,0);
	ct(ans);


	return 0;
}

Measured memory_bytes: 256
// coding on smartphone
#include<iostream>
#include<numeric>
#include<algorithm>
using namespace std;
typedef long long ll;

int main(){
  int n, x;
  cin >> n >> x;
  ll a[n];
  for(int i = 0; i < n; i++) cin >> a[i];
  ll sum = accumulate(a, a+n, 0ll);
  
  int ans;
  if(x > sum){
    ans = n-1;
  }else if(x == sum){
    ans = n;
  }else{
    sort(a, a+n);
    for(ans = 0;;ans++){
      if(a[ans] > x) break;
      x -= a[ans];
    }
  }
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}
struct range_minimum_query{
  // 管理したい元の配列のサイズ以上の2冪。
  int n;
  // セグメント木(完全二分木)を管理する一次元配列。
  vector<int> segtree;
  // minの単位元としてのINF。値は2^31-1。
  const int INF = INT_MAX;
  
  // @param sz 管理したい元の配列のサイズ
  // nをsz以上の2冪にし、セグメント木のサイズを2*n-1、値をINFに初期化する。
  range_minimum_query(int sz){
    for(n = 1; n<sz;) n <<= 1;
    segtree.assign(2*n-1,INF);
  }
  
  
  // 元の配列の[l,r)のminを求める。
  // @param l,r [l,r)が求めたいminの元の配列での範囲。
  // @param a,b [a,b)が現在見ている頂点の持つminの元の配列における範囲。
  // @param k   セグメント木の現在見ている頂点のindex
  // @return    セグメント木により、求められた[l,r)の最小値。
  // 上からDFSして、[l,r)内の頂点であれば自身の値を返し、そうでなければ単位元を返す。
  // このようにして帰ってきた値を全てminしたものが求めたいものである。
  // デフォルト引数にn(非staticなメンバ変数)を指定できないため、オーバーロードしている。
  int find(int l, int r){
    return find(l,r,0,n,0);
  }
  int find(int l, int r, int a, int b, int k){
    // [a,b)が[l,r)の外側なら、影響のない単位元INFを返す。
    if(b<=l || r<=a) return INF;
    
    // [a,b)が[l,r)の内側なら、その頂点は[l,r)内で最も大きい区間minを持つので、それを返す。
    else if(l<=a && b<=r) return segtree[k];
    
    // どちらでもなければ(解説スライドでの赤線を跨いでいる状態)、もっと細分されたものを確認する必要があるため、子を確認する。
    // 左側の子は[a,(a+b)/2)の区間minを持ち、indexは2*k+1
    // 右側の子は[(a+b)/2,b)の区間minを持ち、indexは2*k+2
    // この２つの[l,r)内の区間minのminを返してやれば良い。
    // 現在見ている頂点が葉に該当する場合は必ず上の２つの条件のどちらかで捕捉されるため考えなくて良い。
    else return min(find(l,r,a,(a+b)/2,2*k+1), find(l,r,(a+b)/2,b,2*k+2));
  }
  
  // 指定した頂点とその影響する範囲の値を更新する。  
  // @param i 書き換えたい値の元の配列におけるindex
  // @param x 更新後の値
  void update(int i, int x){
    // 解説スライドの通り、元の配列を持つ最下段の長さをn(2冪)とすると、
    // その上のセグメント木の構造を持つ部分は n/2 + n/4 + n/8 + .. + 1 = n-1(等比級数の公式より)
    // よって、元の配列を最初に更新したいので、元の配列部分のindexに修正するため、n-1を加える。
    i += n-1;
    
    // その頂点をxに更新する。
    segtree[i] = x;
    // 更新した最下段の情報の影響する範囲を更新する。
    // 具体的には更新した頂点の祖先全てが対象となる。
    while(i>0){
      // 親ノードへと移動
      i = (i-1)/2;
      // 自分の子２つを比較し、小さい方を得る。
      segtree[i] = min(segtree[2*i+1], segtree[2*i+2]);
    }
  }
};



int main() {
    
int N,q;cin>>N>>q;
int A,B,C;
range_minimum_query rmq(N);
rep(i,q){
         cin>>A>>B>>C;
        if(A==0){
                  rmq.update(B,C);
                  }
        else if(A==1){
                       cout<<rmq.find(B,C+1)<<endl;
                      }
        }

}




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


// 有向グラフの接続行列 B に対し，線形方程式 Bx = c を解くライブラリ
template<typename T>
struct LinearSystemIncidence {
  struct Edge {
    int id, to;
    bool fwd;
    Edge(int i, int t, bool f) : id(i), to(t), fwd(f) {}
  };

  int n, m;
  vector<T> x;
  vector<bool> seen;
  vector<vector<Edge>> G;
  
  LinearSystemIncidence(int n, vector<P> &E) : n(n), m(E.size()), G(n) {
    rep(i, m) {
      G[E[i].first].emplace_back(i, E[i].second, true);
      G[E[i].second].emplace_back(i, E[i].first, false);
    }
  }

  T dfs(vector<T> &b, int u) {
    seen[u] = true;
    T res = b[u];
    for (Edge e : G[u]) {
      if (seen[e.to]) continue;
      T tmp = dfs(b, e.to);
      if (e.fwd) x[e.id] = tmp;
      else x[e.id] = -tmp;
      res += tmp;

      // mod2
      x[e.id] %= 2;
      if (x[e.id] < 0) x[e.id] += 2;
      ////
    }
    res %= 2; // mod 2
    return res;
  }

  pair<bool, vector<T>> solve(vector<T> &b) {
    x.assign(m, 0);
    seen.assign(n, false);
    for (int s = 0; s < n; ++s) {
      if (seen[s]) continue;
      if (dfs(b, s)) return {false, vector<T>()};
    }
    return {true, move(x)};
  }
};


int main() {
  int n, m; cin >> n >> m;
  vector<P> E;
  V c(n+1);
  rep(i, m) {
    int u, v; cin >> u >> v;
    E.emplace_back(u, v);
    ++c[u];
  }

  LinearSystemIncidence<int> LSI(n+1, E);
  auto sol = LSI.solve(c);

  if (sol.first) {
    rep(i, m) {
      if (sol.second[i]) swap(E[i].first, E[i].second);
      cout << E[i].first << " " << E[i].second << "\n";
    }
  }
  else cout << -1 << "\n";
  return 0;
}

Measured memory_bytes: 11508
#include <bits/stdc++.h>
int position[8];
bool queen[8];
bool check(int cur) {
    for (int i = 0; i < 8; i++) {
        if (!queen[i]) {
            position[cur] = i;
            queen[i] = true;
            int next = cur + 1;
            while (position[next] != -1 && next < 8) {
                next++;
            }
            if (next == 8) {
                bool fail = false;
                for (int i = 0; i < 8; i++) {
                    int check = position[i] + 1;
                    for (int j = i + 1; j < 8; j++, check++) {
                        if (position[j] == check) {
                            fail = true;
                            break;
                        }
                    }
                    if (fail) {
                        break;
                    }
                }
                for(int i = 7; i >=0 ; i--){
                    int check = position[i]+1;
                    for(int j= i-1; j >=0; j--, check++){
                        if(position[j]==check){
                            fail = true;
                            break;
                        }
                    }
                    if(fail){
                        break;
                    }
                }
                if (fail) {
                    queen[i] = false;
                    position[cur] = -1;
                    return false;
                } else {
                    return true;
                }
            } else {
                bool wtf = check(next);
                if (wtf) {
                    return true;
                } else {
                    queen[i] = false;
                    position[cur] = -1;
                    continue;
                }
            }
        }
    }
    return false;
}
int main(void) {
    int used;
    while (std::cin >> used) {
        for (int i = 0; i < 8; i++) {
            position[i] = -1;
        }
        memset(queen, 0, sizeof(queen));
        for (int i = 0; i < used; i++) {
            int tempa, tempb;
            std::cin >> tempa >> tempb;
            position[tempa] = tempb;
            queen[tempb] = true;
        }
        int start = 0;
        while (start <8&&position[start] != -1) {
            start++;
        }
        if (start < 8) {
            check(start);
        }
        char out[8][8];
        memset(out, '.', sizeof(out));
        for (int i = 0; i < 8; i++) {
            out[i][position[i]] = 'Q';
        }
        for (int i = 0; i < 8; i++) {
            for (int j = 0; j < 8; j++) {
                std::cout << out[i][j];
            }
            std::cout << '\n';
        }
    }
    return 0;
}


Measured memory_bytes: 3088
func main() {
    let fiveHandledCount = Int(readLine()!)!
    let handledCount = Int(readLine()!)!
    let fiftyCount = Int(readLine()!)!
    let amount = Int(readLine()!)!
    
    var hitCount = 0
    
    for fiveHandledSelect in 0...fiveHandledCount {
        if fiveHandledSelect * 500 == amount {
            hitCount += 1
            continue
        }
        for handledSelect in 0...handledCount {
            if (fiveHandledSelect * 500) + (handledSelect * 100) == amount {
                hitCount += 1
                continue
            }
            for fiftyCount in 0...fiftyCount {
                if (fiveHandledSelect * 500) + (handledSelect * 100) + (fiftyCount * 50) == amount {
                    hitCount += 1
                    continue
                }
            }
        }
    }
    
    print("\(hitCount)")
}

main()


Measured memory_bytes: 7676
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 100000000000000 //10^14
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int main()
{
    string S;
    cin >> S;
    if(S.at(sz(S)-1) == 's'){
        cout << S << "es" << endl;
    }
    else{
        cout << S << "s" << endl;
    }
}

Measured memory_bytes: 3624
import math
def gcd_arg3(a,b,c):
    return math.gcd(a,math.gcd(b,c))

k = int(input())

sum = 0
for a in range(1,k+1):
    for b in range(1,k+1):
        gcd_a_b = math.gcd(a,b)
        for c in range(1,k+1):
            sum += math.gcd(gcd_a_b,c)

print(sum)

Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std;
int main(){
	map<string, int> s;
  	int ans = 0;
  	int n; cin >> n;
  	for(int i =0; i<n; i++){
      string b;
    	cin >> b;
      	s[b]++;
      	if(s[b] == 1) ans++;
    }
  	cout << ans << endl;
}

Measured memory_bytes: 19224
#include <bits/stdc++.h>
using namespace std;
int main(){
	int H, W; cin >> H >> W; 
	char C[2010][2010] = {}; 
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			cin >> C[i][j]; 
		}
	}
	int L[2010][2010] = {}; 
	for(int i = 0; i < H; i++){
		int a = 0; 
		for(int j = 0; j < W; j++){
			if(C[i][j] == '#') a = 0; 
			else{
				a++; L[i][j] += a; 
			}	
		}
	}
	for(int i = 0; i < H; i++){
		int a = 0; 
		for(int j = W-1; j >= 0; j--){
			if(C[i][j] == '#') a = 0; 
			else{
				a++; L[i][j] += a; 
			}	
		}
	}
	for(int j = 0; j < W; j++){
		int a = 0; 
		for(int i = 0; i < H; i++){
			if(C[i][j] == '#') a = 0; 
			else{
				a++; L[i][j] += a; 
			}	
		}
	}
	for(int j = 0; j < W; j++){
		int a = 0; 
		for(int i = H-1; i >= 0; i--){
			if(C[i][j] == '#') a = 0; 
			else{
				a++; L[i][j] += a; 
			}	
		}
	}
	int ans = 0; 
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			ans = max(ans, L[i][j]);  
		}
	}
	cout << ans - 3 << endl; 
}

Measured memory_bytes: 19968
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    int x;
    int h;
    int m;
    int s;
    cin >> x;
    
    s = x % 60;
    x = x / 60;
    m = x % 60;
    h = x / 60;
    
    cout << h << ":" << m << ":" << s << endl;
    
    return 0;
}



Measured memory_bytes: 3100
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

struct modint{
    ll a;
    const ll MOD=1e9+7;
    modint(ll a_=0){
        a=((a_%MOD)+MOD)%MOD;
    }
    modint inv()const{
        ll n=1,m=MOD-2,A=a;
        while(m){
            if(m&1)(n*=A)%=MOD;
            (A*=A)%=MOD;
            m>>=1;
        }
        modint y(n);
        return y;
    }
    bool operator==(const modint& x){
        return a==x.a;
    }
    bool operator!=(const modint& x){
        return a!=x.a;
    }
    modint& operator=(const modint& x){
        a=x.a;
        return *this;
    }
    modint operator+(const modint& x){
        modint y(a+x.a);
        return y;
    }
    modint operator-(const modint& x){
        modint y(a-x.a);
        return y;
    }
    modint operator*(const modint& x){
        modint y(a*x.a);
        return y;
    }
    modint operator/(const modint& x){
        return *this * x.inv();
    }
    modint& operator+=(const modint& x){
        *this=*this+x;
        return *this;
    }
    modint& operator-=(const modint& x){
        *this=*this-x;
        return *this;
    }
    modint& operator*=(const modint& x){
        *this=*this*x;
        return *this;
    }
    modint& operator/=(const modint& x){
        *this=*this/x;
        return *this;
    }
};
istream& operator>>(istream &in,modint& x){
    ll a_;
    in>>a_;
    modint y(a_);
    x=y;
    return in;
}
ostream& operator<<(ostream &out,const modint& x){
    out<<x.a;
    return out;
}
modint pwr(ll a,ll b){
    modint n(1),A(a);
    while(b){
        if(b&1) n*=A;
        A*=A;
        b>>=1;
    }
    return n;
}
vector<modint> fc;
modint fct(ll x) {
    if(fc.empty()) fc.resize(100010);
    if(x==0) return 1;
    if(fc[x]==0) fc[x]=fct(x - 1)*x;
    return fc[x];
}

vector<modint> ifc;
modint ifct(ll x) {
    if(ifc.empty()) ifc.resize(100010);
    if(x==100010-1) return ifc[x]=fct(x).inv();
    if(ifc[x] == 0) ifc[x]=ifct(x+1)*(x+1);
    return ifc[x];
}

modint perm(ll n, ll r) {
    if (n < 0 || r < 0 || n < r) return 0;
    return fct(n)*ifct(n-r);
}

void bfs(modint& ans,vector<vector<int>>& v,int k,int i=0,int p=-1){
    if(p<0) ans*=perm(k-1,v[0].size());
    else ans*=perm(k-2,v[i].size()-1);
    for(auto j:v[i]) if(j!=p) bfs(ans,v,k,j,i);
}

class EVirusTree2 {
public:
    void solve(istream& in, ostream& out) {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        int n,k,a,b;
        in>>n>>k;
        vector<vector<int>> v(n);
        fr(i,n-1){
            in>>a>>b;
            v[--a].emplace_back(--b);
            v[b].emplace_back(a);
        }
        modint ans(k);
        bfs(ans,v,k);
        out<<ans<<endl;
    }
};

int main() {
    EVirusTree2 solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


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


int main() {
    int N;
    std::cin >> N;

    int positive_idx;
    std::vector<std::vector<int>> points(N, std::vector<int>(3));
    for (int i = 0; i < N; i++) {
        std::cin >> points[i][0] >> points[i][1] >> points[i][2];
        if (points[i][2] > 0) {
            positive_idx = i;
        }
    }

    bool is_detect = false;
    int x, y, height;
    std::map<int, int> projs;
    for (y = 0; y <= 100; y++) {
        for (x = 0; x <= 100; x++) {
            bool success = true;
            auto pos_pt = points[positive_idx];
            height = pos_pt[2] + std::abs(x - pos_pt[0]) + std::abs(y - pos_pt[1]);
            for (auto pt : points) {
                if (std::max(height - std::abs(pt[0] - x) - std::abs(pt[1] - y), 0) != pt[2]) {
                    success = false;
                    break;
                }
            }
            if (success) {
                is_detect = true;
                break;
            }
        }
        if (is_detect) {
            break;
        }
    }

    std::cout << x << " " << y << " " << height << std::endl;
}


Measured memory_bytes: 3628