akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

int main(){
	ll M;
	cin >> M;
	ll N = -1;
	vector<ll> kosu(110, 0);
	REP(i, M){
		ll a;
		cin >> a;
		kosu[a]++;
		N = max(N, a);
	}
	bool flag = true;
	if(N%2==0){
		for(int i=N/2+1;i<=N;i++){
			if(kosu[i]<2){
				flag = false;
				break;
			}else{
				kosu[i] -= 2;
			}
		}
		if(kosu[N/2]<1){
			flag = false;
		}
		kosu[N/2] -= 1;
		REP(i, 110){
			if(i<N/2+1||i>N){
				if(kosu[i]>0){
					flag = false;
					break;
				}
			}
		}
	}else{
		for(int i=(N+1)/2;i<=N;i++){
			if(kosu[i]<2){
				flag = false;
				break;
			}else{
				kosu[i] -= 2;
			}
		}
		REP(i, 110){
			if(i<(N+1)/2+1||i>N){
				if(kosu[i]>0){
					flag = false;
					break;
				}
			}
		}
	}
	cout << (flag?"Possible":"Impossible") << endl;
    return 0;
}

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

map<int, int> div(int n){
  map<int, int> res;
  for(int i = 2; i * i <= n; i++){
    int cnt = 0;
    while(n % i == 0){
      cnt++;
      n /= i;
    }
    res[i] = cnt;
  }
  if(n != 1) res[n] = 1;
  return res;
}

int main() {
  int n;
  cin >> n;
  
  vector<int> num(1100);
  for(int i = 2; i <= n; i++){
    map<int, int> now = div(i);
    for(auto a : now){
      num.at(a.first) += a.second;
    }
  }
  
  long long ans = 1, mod = pow(10, 9) + 7;
  for(int i = 2; i <=n; i++){
    ans *= (num.at(i) + 1);
    ans %= mod;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3568
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007

int main()
{
	long long int n, p;
	cin >> n >> p;
	map<long long int, long long int> m;
	long long int nowp = p;
	for(long long int i = 2; i * i <= p; i++){
		if(nowp % i > 0) continue;
		m[i] = 0;
		while(nowp % i == 0){
			m[i]++;
			nowp /= i;
		}
	}
	m[nowp] = 1;
	long long int ans = 1;
	for(auto itr = m.begin(); itr != m.end(); itr++){
		ans = (ans) * (long long int)pow((*itr).first, (*itr).second / n);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**5+1)

N=int(input())
uvw=[list(map(int, input().split())) for i in range(N-1)]
nodelink=[[] for i in range(N+1)]
for i in range(N-1):
  nodelink[uvw[i][0]].append([uvw[i][1], uvw[i][2]])
  nodelink[uvw[i][1]].append([uvw[i][0], uvw[i][2]])
  
color=[-1]*(N+1)

def f(nuru, iro):
  color[nuru]=iro
  tonari=nodelink[nuru]
  for nuruyo in tonari:
    if color[nuruyo[0]]<0:
      if (nuruyo[1]%2)==0:
        f(nuruyo[0], iro)
      else:
        f(nuruyo[0], 1-iro)
      
f(1, 0)

for i in range(1, N+1):
  print(color[i])

Measured memory_bytes: 98476
#include<iostream>
using namespace std;
int main(){
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  int minimum=1000000000;
  for(int i=1;i<=100;i++){
    int ans=0;
    for(int j=0;j<n;j++){
      ans+=((a[j]-i)*(a[j]-i));
    }
    minimum=min(minimum,ans);
  }
  cout<<minimum<<endl;
  return 0;
}


Measured memory_bytes: 256
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size,n=1,init=nil) #nに配列の次元数、sizeに配列の大きさ、initに初期値を投げることでその配列を返す
  if n==1
    return Array.new(size){init}
  else
    return Array.new(n).map{Array.new(size){init}}
  end
end

s=get_nsp
puts s.count("1")

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  if(n%2==0)
  {
    cout<<0.500000;
  }
  else 
  { 
    cout<<fixed<<setprecision(6)<<((1.0)*(n/2+1))/n;
  }
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    public static bool f = false, t = true;
    static void Main(string[] args)
    {
        long n = long.Parse(Console.ReadLine());
        long[] a = new long[n];
        for (long i = 0; i < n; i++) { a[i] = long.Parse(Console.ReadLine()); }
        Array.Sort(a);
        long lcms = a[n - 1];
        for (long i = 0; i < n - 1; i++) { lcms = lcm(a[i], lcms); }
        Console.WriteLine(lcms);
        Console.ReadLine();
    }

    public static long gcd(long a, long b)
    {
        if (a % b == 0) { return b; }
        if (b % a == 0) { return a; }
        while (true)
        {
            if (a == 0) { return b; }
            if (b == 0) { return a; }
            if (a > b) { a -= b; }
            else { b -= a; }
        }
    }
    public static long GCD(long m, long n)
    {
        if (m < n)
        {
            return GCD(n, m);
        }

        while (n != 0)
        {
            long t = n;
            n = m % n;
            m = t;
        }
        return m;
    }
    public static long lcm(long a, long b)
    {
        if (a < b) { return lcm(b, a); }
        if (a % b == 0) { return a; }
        return  b / GCD(a, b)*a;
    }
    public static bool IsPrime(long n)
    {
        if (n < 2) return false;
        if (n == 2) return true;

        for (long i = 2; i < Math.Sqrt(n); i++)
        {
            if (n % i == 0) return false;
        }
        return true;
    }

}
public static class Read
{
    public static void outl(string n = "") { Console.WriteLine(n); return; }
    public static long Long()
    {
        return long.Parse(Console.ReadLine());
    }
    public static long[] longs()
    {
        return Console.ReadLine().Split().Select(long.Parse).ToArray();
    }
    public static int Int()
    {
        return int.Parse(Console.ReadLine());
    }
    public static int[] ints()
    {
        return Console.ReadLine().Split().Select(int.Parse).ToArray();
    }
    public static string Str() { return Console.ReadLine(); }
    public static string[] Strs() { return Console.ReadLine().Split(); }
}

Measured memory_bytes: 13268
N = int(input())
A = [list(map(lambda x:int(x)-1, input().split())) for _ in range(N)]

indices = [0] * N
def next(i):
    return A[i][indices[i]] if indices[i] < N-1 else -1

from collections import deque
q = deque()
for i in range(N):
    j = next(i)
    if i < j and next(j) == i:
        q.append((i, j))

m = N*(N-1)//2
days = 0
while q:
    days += 1
    nq = deque()
    while q:
        i, j = q.pop()
        m -= 1
        indices[i] += 1
        indices[j] += 1
        ni = next(i)
        nj = next(j)
        if ni >= 0 and next(ni) == i:
            nq.append((i, ni))
        if nj >= 0 and nj != i and next(nj) == j:
            nq.append((j, nj))
    q = nq

if m > 0:
    print(-1)
else:
    print(days)


Measured memory_bytes: 57180
#include <bits/stdc++.h>
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
#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 per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define foreach(i,n) for(auto &&i:n)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define REV(x) reverse(all(x))
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
#define LOWitr(x, n) lower_bound(all(x), n)
#define UPRitr(x, n) upper_bound(all(x), n)
#define cii(x) int x;cin >> x
#define cill(x) LL x;cin >> x
#define cis(x) string x;cin >> x
#define co(x) cout << x << endl
#define dump(x)  cout << #x << " = " << (x) << endl
#define truecheck assert
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef long long int64;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
template<class T,class U>bool chmax(T &a, const U &b) { if (a<b) { a=b; return true; } return false; }
template<class T,class U>bool chmin(T &a, const U &b) { if (b<a) { a=b; return true; } return false; }
template<class T,class U>void cinpb(T &v, U n) { rep(i, n){cill(a);v.pb(a);} }
const int INF = 1e9, MOD = 1e9 + 7;
const LL LLINF = 1e16;

int main() {
    fastcin();
    cout << fixed << setprecision(10);
    cis(s);
    int n = s.length();
    int ans = 0;
    rep(i, n/2){
        if (s[i] != s[n-i-1]){
            ans++;
        }
    }
    co(ans);
    return 0;
}

Measured memory_bytes: 256
if __name__ == '__main__':
    A, B, C, X, Y = map(int, input().split())
    
    ans = 0
    
    X2 = X
    Y2 = Y
    mXY = min(X2, Y2)
    
    
    if C * 2 <= A + B:
        ans += mXY * 2 * C
    else:
        ans += mXY * A + mXY * B
        
    X2 -= mXY
    Y2 -= mXY
    
    
    if Y2 != 0:
        if B <= C * 2:
            ans += Y2 * B
        else:
            ans += Y2 * 2 * C
    elif X2 != 0:
        if A <= C * 2:
            ans += X2 * A
        else:
            ans += X2 * 2 * C
    
    print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <numeric>

using namespace std;

int main(void)
{
    int n;
    cin >> n; 
    vector<string> s(n);
    for (int i = 0;i < n;i++) cin >> s[i];
    sort(s.begin(),s.end());

    decltype(s)::iterator result = std::unique(s.begin(), s.end());

    // 不要になった要素を削除
    s.erase(result, s.end());

    cout << s.size() << endl;
    
    return 0;
}


Measured memory_bytes: 9596
n = int(input())
t1, x1, y1=map(int, input().split())
if t1<x1+y1 or (x1+y1+t1)%2==1:
  print("No")
  exit()
for i in range(n-1):
  t2, x2, y2=map(int, input().split())
  if t2<x2+y2 or (abs(x2-x1)+abs(y2-y1))>t2-t1 or (x2+y2+t2)%2==1:
    print("No")
    exit()
print("Yes")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define MOD 1000000007

int sx,sy,tx,ty;

void solve(bool flag){
  int cx=sx,cy=sy,bx=0,by=0;
  if (flag) cout<<"D";
  while(cx!=tx){
    cout<<"R";
    cx++;
    bx++;
  }
  while(cy!=ty){
    cout<<"U";
    cy++;
    by++;
  }
  if (flag) cout<<"LU";
  while(bx!=0){
    cout<<"L";
    bx--;
  }
  while(by!=0){
    cout<<"D";
    by--;
  }
  if (flag) cout<<"R";
}

int main(){
  cin>>sx>>sy>>tx>>ty;
  int cx=sx,cy=sy,bx=0,by=0;
  solve(false);
  tx++;sy--;
  solve(true);
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
int  a,b,c,d,i,j,k,x,y,z,ans;
char f[100005];
int main(){
	scanf("%s",f);
	c=0;
	while (true){
		d=c+4;
		if ((f[c]=='d') and (f[c+1]=='r') and (f[c+2]=='e') and (f[c+3]=='a') and (f[c+4]=='m')){
			if (d==strlen(f)-1){
				printf("YES\n");
				return 0;
			}
			else if (d==strlen(f)-3){
				if ((f[d+1]=='e') and (f[d+2]=='r')){
					printf("YES\n");
					return 0;	
				}
				else {
					printf("NO\n");
					return 0;					
				}
			}
			else if ((f[d+1]=='e') and (f[d+2]=='r')){
				if (f[d+3]=='a') c+=5; else c+=7;
			}
			else {
				c+=5;
			}
		}
		else if ((f[c]=='e') and (f[c+1]=='r') and (f[c+2]=='a') and (f[c+3]=='s') and (f[c+4]=='e')){
			if (d==strlen(f)-1){
				printf("YES\n");
				return 0;
			}
			else if (d==strlen(f)-2){
				if (f[d+1]=='r'){
					printf("YES\n");
					return 0;	
				}
				else {
					printf("NO\n");
					return 0;					
				}
			}
			else if (f[d+1]=='r') c+=6;
			else {
				c+=5;
			}
		}
		else {
			printf("NO\n");
			return 0;					
		}
	}
}

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

int main(){
  int a,b,array[51],i,c=0;
  cin>>a>>b;
  for(i=0;i<a;i++){
    cin>>array[i];
  }
  sort(array,array+a);
  for(i=a;i>a-b;i--){
    c+=array[i-1];
  }
  cout<<c<<endl;
}

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

using namespace std;

int gcd(int n, int m) {
	if (n < m) {
		swap(n,m);
	}
	if (m == 0) {
		return n;
	}
	return gcd(m,n%m);
}

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

	vector<int> ltr(N+1),rtl(N+1);
	ltr[0] = rtl[N] = 0;
	for (int i = 0; i < N; ++i) {
		ltr[i+1] = gcd(A[i],ltr[i]);
		rtl[N-i-1] = gcd(A[N-i-1],rtl[N-i]);
	}

	int res = -1;
	for (int i = 0; i < N; ++i) {
		res = max(gcd(ltr[i],rtl[i+1]),res);
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 1408
import sys
input = sys.stdin.readline
n,p = [int(i) for i in input().split()]
s = input()
ans = 0
 
if p == 2 or p == 5:
    for i in range(n):
        if int(s[i]) % p == 0:
            ans += i + 1
    print(ans)
    exit()
    
else:
  chk = [0]*p
  chk[0] = 1
  m = 0
  for i in range(n)[::-1]:
    m = (int(s[i])*pow(10,n-1-i,p)+m)%p
    chk[m] += 1
  chk= [i*(i-1)/2 for i in chk]
  print(int(sum(chk)))

Measured memory_bytes: 41196
#define DEBUG 0

/**
 * File    : C.cpp
 * Author  : Kazune Takahashi
 * Created : 2019-4-20 20:49:22
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <functional>
#include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(10101010));
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

int N;
string S;
int sum[200010];

int main()
{
  cin >> N >> S;
  fill(sum, sum + 200010, 0);
  for (auto i = 0; i < N; i++)
  {
    if (S[i] == '#')
    {
      sum[i + 1] = 1;
    }
    sum[i + 1] += sum[i];
  }
  int B = sum[N];
  int W = N - B;
  int ans = N;
  for (auto i = 0; i <= N; i++)
  {
    ans = min(ans, sum[i] + (W - (i - sum[i])));
  }
  cout << ans << endl;
}

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

#define pp push_back
#define pf push_front
#define mp make_pair
#define fs first
#define sc second
#define sf scanf

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;

const int N = (int) 1e5;
const int INF = (int) 1e9 + 7;

int main(int argc, char *argv[])
{
	// ios_base::sync_with_stdio(false);
	// cin.tie(NULL);

	int s, w;
	sf("%d %d", &s, &w);
	puts(w >= s ? "unsafe" : "safe");

	return 0;
}


Measured memory_bytes: 3692
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>
#include <tuple>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  if (n % 2 == 1) {
    cout << ((double)(n / 2) + 1) / n << '\n';
  } else {
    cout << ((double)n / 2) / n << '\n';
  }
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};


int n;

int main(){
	cin>>n;
	cout<<(n+1)/2<<endl;
}

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

const int mod = 1e9 + 7;

void solve()
{
    int n, m;
    cin >> n >> m;
    if (abs(n - m) >= 2)
        cout << 0 << endl;
    else
    {
        ll ans = 1;
        rep(i, n) ans = ans % mod * (i + 1);
        rep(i, m) ans = ans % mod * (i + 1);
        if (abs(n - m) == 0)
            ans = ans % mod * 2;
        ans %= mod;
        cout << ans << endl;
    }
}

int main()
{
    // srand((unsigned)time(NULL));
    // int t = clock();
    solve();
    // double et = 1.0 * (clock() - t) / CLOCKS_PER_SEC;
    // printf("Execution Time: %.4lf sec\n", et);
    return 0;
}

Measured memory_bytes: 3520
class UnionFind:
    def __init__(self, n):
        self.par = [-1]*n
        self.size = [1]*n
        self.point = n*(n-1) // 2

    def root(self, x):
        if self.par[x] < 0:
            return x
        self.par[x] = self.root(self.par[x])
        return self.par[x]

    def unite(self, x, y):
        rx = self.root(x)
        ry = self.root(y)
        if rx == ry:
            return False
        # size において rx>ry にする
        if self.size[rx] < self.size[ry]:
            rx, ry = ry, rx
        self.point -= self.size[rx]*self.size[ry]
        self.size[rx] += self.size[ry]
        # ryの親をrxに設定 (sizeにおいて "小さい方(ry)を大きい方(rx)に" つなげる)
        self.par[ry] = rx
        return True

    def is_same(self, x, y):
        rx, ry = self.root(x), self.root(y)
        return rx == ry

    def get_size(self, x):
        return self.size[self.root(x)]

N, M = map(int, input().split())
P = list(map(int, input().split()))
XY = [list(map(int, input().split())) for _ in range(M)]

uf = UnionFind(N)
for x, y in XY:
    uf.unite(x-1, y-1)

c = 0
for i, p in enumerate(P):
    c += uf.is_same(i, p-1)

print(c)

Measured memory_bytes: 34280
// B - Frog 2
#include <bits/stdc++.h>
using namespace std;

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

	vector<int> dp(N, INT_MAX);
	dp[0] = 0;
	for(int n=0; n<N-1; n++){
		for(int k=1; k<=min(N-n, K); k++){
			dp[n+k] = min(dp[n+k], dp[n] + abs(h[n] - h[n+k]));
		}
	}
	cout<< dp[N-1] <<endl;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long ans = 0l;
        long l0 = 2l;
        long l1 = 1l;
        if(n == 1) {
            System.out.println(1);
            return;
        }
        for (int i = 1; i < n; i++) {
            ans = l0 + l1;
            l0 = l1;
            l1 = ans;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 35620
class Point:
    def __init__(self, x , y):
        self.x = x
        self.y = y
    def __sub__(self, p):
        x_sub = self.x - p.x
        y_sub = self.y - p.y
        return Point(x_sub, y_sub)

class Vector:
    def __init__(self, p):
        self.x = p.x
        self.y = p.y
        self.norm = (p.x ** 2 + p.y ** 2) ** 0.5

def cross(v1, v2):
    return v1.x * v2.y - v1.y * v2.x

def dot(v1, v2):
    return v1.x * v2.x + v1.y * v2.y

def ccw(p0, p1, p2):
    a = Vector(p1 - p0)
    b = Vector(p2 - p0)
    cross_ab = cross(a, b)
    if cross_ab > 0:
        return 1
    elif cross_ab < 0:
        return -1
    elif dot(a, b) < 0:
        return 1
    elif a.norm < b.norm:
        return -1
    else:
        return 0

def intersect(p1, p2, p3, p4):
    if (ccw(p1, p2, p3) * ccw(p1, p2, p4) <= 0) and \
       (ccw(p3, p4, p1) * ccw(p3, p4, p2) <= 0):
        return True
    else:
        return False

def getDistanceSP(sp1, sp2, p):
    a = Vector(sp2 - sp1)
    b = Vector(p - sp1)
    if dot(a, b) < 0:
        return b.norm
    c = Vector(sp1 - sp2)
    d = Vector(p - sp2)
    if dot(c, d) < 0:
        return d.norm
    return abs(cross(a, b) / a.norm)

def getDistance(p1, p2, p3, p4):
    if intersect(p1, p2, p3, p4):
        print("0.00000000")
    else:
        d = min(getDistanceSP(p1, p2, p3), getDistanceSP(p1, p2, p4),
                getDistanceSP(p3, p4, p1), getDistanceSP(p3, p4, p2))
        print("{0:.10f}".format(d))


import sys

file_input = sys.stdin

sq = file_input.readline()

for line in file_input:
    x_p0, y_p0, x_p1, y_p1, x_p2, y_p2, x_p3, y_p3 = map(int, line.split())
    p0 = Point(x_p0, y_p0)
    p1 = Point(x_p1, y_p1)
    p2 = Point(x_p2, y_p2)
    p3 = Point(x_p3, y_p3)
    getDistance(p0, p1, p2, p3)

Measured memory_bytes: 7968
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define ll long long
#define FOR(i,n) for(int i=0;i<n;i++)
//map<key,value>

int main(){
  int n;
  cin >> n;
  vector<ll> a(n+1);
  vector<ll> b(n);
  ll mc=0;
  for(int i=0;i<n+1;i++)cin >> a[i];
  for(int i=0;i<n;i++)cin >> b[i];

  for(int i=0;i<n;i++){
    if(b[i] > a[i]){
      mc+=a[i];
      //cout << mc << "\n";
      ll rest = min((b[i] - a[i]),a[i+1]);
      a[i+1] = a[i+1] - rest;
      mc+=rest;
      //cout << mc << "\n";
    }
    else{
      mc+=b[i];
    }
  }
  cout << mc;
  return 0;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <cmath>

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF
constexpr int INTINF {1000000000};//int = 2*INTINF

#define  rep(i,n)   for(int i = 0; i < (n); ++i)
#define rrep(i,n)   for(int i = 1; i <= (n); ++i)
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T&& y) {
  x=std::min(x,y);
}

int main() {
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int P, Q, R;
  cin >> P >> Q >> R;
  int answer {INTINF};
  mins(answer, P+Q);
  mins(answer, P+R);
  mins(answer, R+Q);
  cout << answer << '\n';
}


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

int main()
{
    double max_value = 0, min_value = numeric_limits<double>::max();
    for (double h; cin >> h;) {
        min_value = min(h, min_value);
        max_value = max(h, max_value);
    }

    cout << fixed << max_value - min_value << endl;

    return 0;
}

Measured memory_bytes: 1280
/*																													   
 Templatka c++ Kacper Fis																							   																											   //
*/																													  
																								   
#include <bits/stdc++.h>																							   
																													   
using namespace std; 																								   
																													   
const int INF = 1000000001;																						   
const float PI = 3.14;																								   
typedef long long LL;																								   
																													   
typedef vector<int> vi;																								   
typedef list<int> li;																								   
typedef queue<int> qi; 																								   
typedef pair<int,int> ii; 																							   
typedef map<string,int> msi; //np msi['nazwa'] = 'liczba'															   
typedef vector<ii> vii; //vector par<int>, do tworzenia tablicy dla grafów wagowych #dijkstra #Bellman_Ford			   
typedef priority_queue< ii, vector<ii>, greater<ii> > pq; //kolejka priorytetowa vectorów par(top()=min) #dijkstra	   
																													   																				   
vector<ii>::iterator iter;																							   
																													   																				   
#define print_list(x) for(it = (x).begin(); it != (x).end(); it++) {cout << *it << " ";}							   
#define print_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++) {cout << *it2 << " ";}						   
#define search_list(x) for(it = (x).begin(); it != (x).end(); it++)													   
#define search_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++);											   
#define pb(x) push_back(x) 																							   
#define pf(x) push_front(x)																							   
#define mp(x, y) make_pair(x, y)                                                                                       
///////////////////////////////////////////////GLOBAL DEFINITIONS////////////////////////////////////////////////////////


///////////////////////////////////////////////////FUNCTIONS/////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////MAIN////////////////////////////////////////////////////////////////
int main(int argc, char* argv[])																					 
{ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);                  												       
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	int a, b;
	cin >> a >> b;
	
	for(int i = 0; i < 1000000000; i++){
		if(abs(a - i) == abs(b - i)){
			cout << i << endl;
			return 0;
		}
	}
	
	cout << "IMPOSSIBLE" << endl;








	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
int main()
{
	int n;
	scanf("%d", &n);
	vector<int> p(n);
	rep(i, n) scanf("%d", &p[i]);
	int count = 0;
	rep(i, n - 2) {
		if(p[i] > p[i + 1] && p[i + 1] > p[i + 2]) count++;
		else if(p[i] < p[i + 1] && p[i + 1] < p[i + 2]) count++;
	}
	printf("%d\n", count);
	return 0;
}

Measured memory_bytes: 3788
<?php

$q = intval(trim(fgets(STDIN)));
$inputList = [];
for ($i = 0; $i < $q; $i++) {
    $var = explode(' ', trim(fgets(STDIN)));
    $inputList[] = [
        'a' => intval($var[0]),
        'b' => intval($var[1]),
    ];
}

foreach ($inputList as $input) {
    $a = $input['a'];
    $b = $input['b'];
    $minValue = min($a, $b);
    if (abs($a - $b) <= 1) {
        $result = ($minValue - 1) * 2;
    } else {
        $c = (int)sqrt($a * $b);
        if ($c * $c == $a * $b) {
            $c--;
        }
        if ($c * ($c + 1) >= $a * $b) {
            $result = $c * 2 - 2;
        } else {
            $result = $c * 2 - 1;
        }
    }
    echo "$result\n";
}


Measured memory_bytes: 3576
n,m,x = map(int,input().split())
li = [list(map(int,input().split())) for i in range(n)]

ans   = 10**30
cost  = 0
score = [0]*m

for i in range(1<<(n+1)):
  for j in range(n):
    # if (j>>i)&1:
    if i&(1<<j):
      for k in range(m):
        score[k] += li[j][k+1]
      cost += li[j][0]
  if min(score)>=x:
    ans = min(ans,cost)
  score = [0]*m
  cost = 0

if ans==10**30:
  print(-1)
else:
  print(ans)


Measured memory_bytes: 9104
#include <bits/stdc++.h> 
#define ll long long
#define ull unsigned long long
#define endl '\n'
#define pb push_back
#define mp make_pair
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

//ll dp[101];
ll dp[101][100005];
/*struct ks
{
    ll weight,value;
};*/

ll fun(ll w, ll n, ll weight[], ll value[])
{
    
    //Base case
    if(n==0)
    return 0;
    if(w <= 0)
    return 0;

    //Lookup
    if(dp[n][w] != -1)
    return dp[n][w];

    //Rec case
    ll op1 = (w-weight[n] >= 0) ? (value[n] + fun(w-weight[n], n-1,weight, value)) : INT_MIN;
    ll op2 = fun(w, n-1,weight,value);

    return dp[n][w] = max(op1, op2); 
}

int main()
{
    fast_io;

    ll n,w;
    cin>>n>>w;
    //vector<ks> ar;
    ll weight[n+1],value[n+1];

    for(ll i=1;i<=n;i++)
    cin>>weight[i]>>value[i];

    memset(dp,-1,sizeof(dp));
    cout<<fun(w,n,weight,value)<<endl;

    return 0;
}


Measured memory_bytes: 79232
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
using namespace std;
#define rep(i,n) for(i=0;i<n;i++)
#define repl(k,n) for(k=0;k<n;++k)

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

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

int main() {
    int N, D; cin >> N >> D;
    vector<vector<double>> x(N, vector<double>(D, 0.0));
    rep(i, N){
        rep(j, D){
            cin >> x.at(i).at(j);
        }
    }

    int cnt = 0;
    rep(i, N) for(int j=i+1; j<N; j++){
        double x_i = 0;
        for(int k=0; k<D; k++){
            x_i += pow(x.at(i).at(k)-x.at(j).at(k), 2);
        }
        x_i = sqrt(x_i);
        int tmp = (int)x_i;
        double tmpx = (double)tmp;
        if(x_i == tmpx) cnt++;
    }

    cout << cnt << endl;
}

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


int main() {
	int n,r[200010],ans = -2000000000 ;
	cin >> n;
	for (int i = 0; i < n;i++) {
		cin >> r[i];
	}
	int m = r[0];
	for (int i = 1; i < n ; i++) {
		if (ans < r[i] - m) {
			ans = r[i] - m;
		}
		if (m>r[i]) {
			m = r[i];
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3888
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
#define MOD (1000000007ll)
#define l_ength size
#define EPS (1e-10)

stack<int> st;

int main(void){
	int i,l,ans=0;
	string x;
	cin >> x;
	l = x.l_ength();
	for(i=0; i<l; ++i){
		if(x[i] == 'T'){
			if(st.empty()){
				++ans;
			}else{
				st.pop();
			}
		}else{
			st.push(i);
		}
	}
	ans += st.l_ength();
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 900
#include <stdio.h>

#define N 2000
#define M 200

int solve(int,int);

int A[N];
int n;

int main(){

  int ans,q,i;
  int mi[M];

  scanf("%d",&n);

  for(i=0 ; i<n ; i++){
    scanf("%d",&A[i]);
  }

  scanf("%d",&q);
  for(i=0 ; i<q ; i++){
    scanf("%d",&mi[i]);
  }


  for(i=0 ; i<q ; i++){
    ans = solve(0,mi[i]);
    if(ans==1) printf("yes\n");
    else printf("no\n");
  }

  return 0;
}

int solve(int i, int m){

  int ans;

    if(m==0)return 1;
    if(i>=n)return 0;

    ans = solve(i+1,m) || solve(i+1,m-A[i]);

}

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

int main(void) {
    vector<char>data(3);
    for (int i = 0; i < 3; i++) {
        cin >> data.at(i);
    }
    int cnt = 0;
    for (int i = 0; i < 3; i++) {
        if ('1' == data.at(i)) {
            cnt++;
        }
    }
    cout << cnt << endl;

    return 0;
}


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

int main() {

  vector<int> a(9);
  for(int i = 0; i < 9; i++) {
    cin >> a.at(i);
  }
  int n;
  cin >> n;
  vector<int> b(n);
  for(int i = 0; i < n; i++) {
    cin >> b.at(i);
  }

  vector<int> tmp(9);
  for(int i = 0; i < 9; i++) {
    for(int j = 0; j < n; j++) {
      if(a.at(i) == b.at(j)) {
        tmp.at(i) = 1;
        break;
      }
    }
  }
  if(tmp.at(0) == 1) {
    if(tmp.at(1) == 1 && tmp.at(2) == 1) {
      cout << "Yes" << endl;
      return 0;
    }
    if(tmp.at(3) == 1) {  
      if(tmp.at(6) == 1) {
      cout << "Yes" << endl;
      return 0;
      } else if(tmp.at(4) == 1 && tmp.at(5) == 1) {
      cout << "Yes" << endl;
      return 0;
      }
    }
    if(tmp.at(4) == 1 && tmp.at(8) == 1) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  if(tmp.at(3) == 1) {
    if(tmp.at(4) == 1 && tmp.at(5) == 1) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  if(tmp.at(6) == 1) {
    if(tmp.at(7) == 1 && tmp.at(8) == 1) {
      cout << "Yes" << endl;
      return 0;
    } else if(tmp.at(2) == 1 && tmp.at(4) == 1) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  if(tmp.at(1) == 1) {
    if(tmp.at(4) == 1 && tmp.at(7) == 1) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  if(tmp.at(2) == 1) {
    if(tmp.at(5) == 1 && tmp.at(8) == 1) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...) 0
#endif

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

    int n;
    cin >> n;
    vector<int> x(n);
    rep(i, 0, n) cin >> x[i];
    int l, q;
    cin >> l >> q;
    vector<vector<int>> t(n + 1, vector<int>(18));
    rep(i, 0, n) {
        t[i][0] = upper_bound(x.begin(), x.end(), x[i] + l) - x.begin() - 1;
    }
    t[n][0] = t[n - 1][0] = n;
    rep(j, 1, 18) {
        rep(i, 0, n + 1) {
            t[i][j] = t[t[i][j - 1]][j - 1];
        }
    }
    rep(i, 0, n)
        debug(t[i]);
    while (q--) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        if (a > b) swap(a, b);
        int ans = 0;
        for (int j = 17; j >= 0; j--) {
            if (j != 0 && t[a][j] <= b) {
                ans += 1 << j;
                a = t[a][j];
            }
            if (j == 0) {
                while (a < b) {
                    ans++;
                    a = t[a][0];
                }
            }
        }
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 11392
#include <iostream>
#include <algorithm>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n) REP(i,0,n)
int n;
void solve() {
  int mp = -1, md = 0;
  rep(i,n) {
    int p, d1, d2; cin>>p>>d1>>d2;
    if (d1+d2 > md) {
      md = d1 + d2; mp = p;
    }
  }
  cout<<mp<<" "<<md<<endl;
}

int main (int argc, char const* argv[]) {
  while (cin>>n, n) {
    solve();
  }
  return 0;
}

Measured memory_bytes: 868
// template version 1.10
using namespace std;
#include <iostream>
#include <bits/stdc++.h>

// varibable settings {{{
#define infile "../test/sample-1.in"
#define int long long
const int INF=1e18;
const int MOD=1e9+7;
int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
// }}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;
template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;
//}}}

// dump macro {{{
#if defined(PCM) || defined(LOCAL)
  #include "dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
// }}}

//%snippet.set('unionfind')%
struct UnionFind {
  vector<int> data;  // size defined only for root node
  int count;

  UnionFind(int size) : data(size, -1), count(size){ }

  bool merge(int x, int y) {
    x=root(x); y=root(y);
    if (x!=y) {
      if (data[y]<data[x]) swap(x, y);
      data[x]+=data[y]; data[y]=x;
      count--;
    }
    return x != y;
  }
  int root(int x) {
    return (data[x]<0 ? x : data[x]=root(data[x]));
  }
  bool same(int x,int y){
    return root(x)==root(y);
  }
  int size(int x) {
    return -data[root(x)];
  }
};
//%snippet.end%

int solve(){
  int N,M;cin>>N>>M;
  UnionFind uf(N);
  rep(m,M){
    int x,y,z;cin>>x>>y>>z;
    x--;y--;
    uf.merge(x,y);
  }
  cout << uf.count << endl;

  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define int long long
int a[114514];
int b[114514];
using namespace std;
signed main(){
    int n,h,w;
    cin>>n>>h>>w;
    for(int i=0;i<n;i++){
        cin>>a[i];
        cin>>b[i];
    }
    int ans=0;
    for(int i=0;i<n;i++){
        if(a[i]>=h&&b[i]>=w){
            ans++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import math

def get_primes(max_number):#return prime list smaller than max_number
    
    if max_number == 2:
        return [2]
    elif max_number < 3:
        return []
    
    numbers=range(1, max_number + 2, 2)
    nroot=math.floor(max_number ** 0.5)
    n=len(numbers)
    numbers[0]=0
    for i in range(1, n):
        x = numbers[i]
        if x > nroot:
            break
        if x and i + x < n:
            for j in range(i+x,n,x):
                numbers[j] = 0
    x=[2] + filter(None, numbers[1:])
    return x

n=[]
i=0
while (True):
    try:
        n.append([i,input(), 0])
        i+=1
    except:
        break

n=sorted(n, key=lambda x: x[1])
for i, e in enumerate(get_primes(n[-1][1])):
    for j in range(len(n)):
        if e<=n[j][1]:
            n[j][2]+=1

n=sorted(n, key=lambda x: x[0])
for e in n:
    print e[2]

Measured memory_bytes: 47476
package main

import (
	"fmt"
)

var arr = make([]int, 100000)

func main() {
	var K int
	fmt.Scan(&K)
	q := queue{
		arr: []int64{1, 2, 3, 4, 5, 6, 7, 8, 9},
		idx: 0,
	}
	var ans int64
	for i := 0; i < K; i++ {
		ans = q.dequeue()
		switch ans % 10 {
		case 0:
			q.enqueue(ans*10 + 0)
			q.enqueue(ans*10 + 1)
		case 9:
			q.enqueue(ans*10 + 8)
			q.enqueue(ans*10 + 9)
		default:
			r := ans % 10
			q.enqueue(ans*10 + r - 1)
			q.enqueue(ans*10 + r)
			q.enqueue(ans*10 + r + 1)
		}
	}
	fmt.Println(ans)
}

type queue struct {
	arr []int64
	idx int
}

func (q *queue) enqueue(i int64) {
	q.arr = append(q.arr, i)
}

func (q *queue) dequeue() int64 {
	val := q.arr[q.idx]
	q.idx++
	return val
}


Measured memory_bytes: 7936
#include<bits/stdc++.h>
using namespace std;
int N, H, W, Ai, Bi;
int answer;
int main(){
 cin >> N >> H >> W;
 for(int i = 0; i < N; i++){
	scanf("%d%d", &Ai, &Bi);
	if(Ai >= H && Bi >= W) answer++;
 }
 cout << answer << endl;
 return 0; 
};


Measured memory_bytes: 256
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;

fn main() {
    input! {
    mut n: Chars,
    }
    for i in 0..3 {
        let d = match n[i] {
            '1' => '9',
            _ => '1'
        };
        print!("{}", d)
    }
}


Measured memory_bytes: 2092
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 100;
int num[maxn];
int Min[maxn];
int main()
{
    //freopen("in", "r", stdin);
    //freopen("out", "w", stdout);
    Min[0] = 0x3f3f3f;
    int n, cnt = 0;
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        scanf("%d", &num[i]);
        if (num[i] < Min[i - 1])
        {
            cnt++;
        }
        Min[i] = min(num[i], Min[i - 1]);
    }
    printf("%d", cnt);
    return 0;
}

Measured memory_bytes: 1792
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Read, StdoutLock, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_imports)]
use std::str::FromStr;

// happy-birthday.rs --- Happy Birthday!
// author: Seong Yong-ju <sei40kr@gmail.com>

#[allow(unused_macros)]
macro_rules! get {
  ($t:ty) => {
    {
      let mut line: String = String::new();
      stdin().read_line(&mut line).unwrap();
      line.trim().parse::<$t>().unwrap()
    }
  };
  ($($t:ty),*) => {
    {
      let mut line: String = String::new();
      stdin().read_line(&mut line).unwrap();
      let mut iter = line.split_whitespace();
      (
        $(iter.next().unwrap().parse::<$t>().unwrap(),)*
      )
    }
  };
  ($t:ty; $n:expr) => {
    (0..$n).map(|_|
                get!($t)
    ).collect::<Vec<_>>()
  };
  ($($t:ty),*; $n:expr) => {
    (0..$n).map(|_|
                get!($($t),*)
    ).collect::<Vec<_>>()
  };
  ($t:ty ;;) => {
    {
      let mut line: String = String::new();
      stdin().read_line(&mut line).unwrap();
      line.split_whitespace()
        .map(|t| t.parse::<$t>().unwrap())
        .collect::<Vec<_>>()
    }
  };
  ($t:ty ;; $n:expr) => {
    (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
  };
}

#[allow(unused_macros)]
macro_rules! debug {
  ($($a:expr),*) => {
    println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
  }
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("Failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("Failed to parse token")
}

#[allow(dead_code)]
fn with_bufwriter<F: FnOnce(BufWriter<StdoutLock>) -> ()>(f: F) {
    let out = stdout();
    let writer = BufWriter::new(out.lock());
    f(writer);
}

fn main() {
    let (a, b) = get!(u32, u32);

    with_bufwriter(|mut out| {
        writeln!(out, "{}", if a <= 8 && b <= 8 { "Yay!" } else { ":(" }).unwrap()
    });
}


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

int main(){
	int n,m;
	cin >> n >> m;
	
	vector<pair<int,int> > arm(m);
	for(int i=0; i<m; i++){
		int x,y;
		cin >> x >> y;
		arm[i]=make_pair(x,y);
	}
	sort(arm.begin(), arm.end());
	
	vector<int> ub(n+1), lb(n+1);
	for(int i=0; i<=n; i++){
		ub[i] = lb[i] = i;
	}
	for(int i=0; i<m; i++){
		int lane = arm[i].second;
		ub[lane] = ub[lane+1];
		lb[lane+1] = lb[lane];
	}
	
	for(int i=1; i<n; i++){
		cout << ub[i]-lb[i]+1 << " ";
	}
	cout << ub[n]-lb[n]+1 << endl;
	
	return 0;
}

Measured memory_bytes: 5188
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ITP1_3_B
{
    class Program
    {
        static void Main(string[] args)
        {
            int i = 0;

            while (true)
            {
                int input = int.Parse(Console.ReadLine());
                i++;

                if (input == 0) break;

                Console.WriteLine("Case {0}: {1}", i, input);
            }
        }
    }
}



Measured memory_bytes: 17996
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;

int main()
{
    string s;
    int K;
    cin >> s;
    cin >> K;
    int n = s.size();
    int dis = 0;
    for (int i = 0; i < n and K > 0; i++)
    {
        if (i == n - 1 and K > 0)
        {
            K %= 26;
            rep(j, K)
            {
                if (s[i] != 'z')
                {
                    s[i]++;
                }
                else
                {
                    s[i] = 'a';
                }
            }
            break;
        }
        dis = 26 - (s[i] - 'a');
        dis %= 26;

        if (K >= dis and dis > 0)
        {
            K -= dis;
            s[i] = 'a';
        }
    }
    cout << s;
    return 0;
}

Measured memory_bytes: 592
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>


#define int long long
#define REP(i,l,r) REPEAT(i,l,r,true) // [l, r)
#define rep(i,n) REP(i,0,n)           // [0, n)
#define REPEAT(i,l,r,condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#ifdef LOCAL
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define showlr(n,l,r) cerr<<#n<<" = ";for(int i=l;i<r;i++){cerr<<n[i]<<", ";}cerr<<endl // [l, r)
#else
#define show(...)
#define showlr(n,l,r)
#endif

#define YN(condition) puts((condition)?"YES":"NO")
#define Yn(condition) puts((condition)?"Yes":"No")
#define yn(condition) puts((condition)?"yes":"no")
#define YES puts("YES")
#define Yes puts("Yes")
#define yes puts("yes")
#define NO  puts("NO")
#define No  puts("No")
#define no  puts("no")

#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

struct io{io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}}io;

template<class T> istream& operator >>(istream &is, vector<T> &v){for(T &e:v)is>>e;return is;}
template<class T> ostream& operator <<(ostream &os, vector<T> v){os<<"{";for(T &e:v)os<<e<<(v.size()-(int)(&e-&v[0])>1?", ":"");os<<"}";return os;}

void _DEBUG(){}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<(sizeof...(b)?",":"\n");_DEBUG(b...);}

inline void in(){}
template<typename H,typename... T>void in(H &a, T&... b){cin>>a;in(b...);}
inline void out(){}
template<typename H,typename... T> void out(H a, T... b){cout<<a<<(sizeof...(b)?" ":"\n");out(b...);}

template<class T> void resz(int n,T& v){v.resize(n);}
template<class H,class... T> void resz(int n,H& a,T&... b){a.resize(n);resz(n,b...);}

template<typename V,typename H> void resize(vector<V>& v,const H a){v.resize(a);}
template<typename V,typename H,typename... T> void resize(vector<V>& v,const H& a,const T... b){v.resize(a);for(auto &v:v) resize(v,b...);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;
/*------------end of definitions------------*/

set<int> st;

signed main(){

    int a;
    rep(i,3){
        in(a);
        st.insert(a);
    }
    out(st.size());

    return 0;
}


Measured memory_bytes: 888