akhauriyash/Code-Regression huggingface dataset:
/*
 * author: Tran Minh Khoa
 * Ho Chi Minh University of Science
 */

#include <bits/stdc++.h>

using namespace std;

const int inf = (int) 1e9 + 7;
const long long INF = (long long) 1e18 + 7;

const int N = 123456;
const int M = 1010;
const int MOD = 1e9 + 7;
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define sz(a) (int) a.size()
#define all(a) a.begin(), a.end()
#define sqrt(x) (x) * (x)

#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define DEBUG(x) cerr << #x << " = " << x << '\n';
#define PR(x, a, b) { cerr << #x << " = "; REP(i, a, b) cerr << x[i] << ' '; cerr << '\n'; }

#define x1 gg1
#define x2 wp1
#define x3 ggwp1


long long dp[M][5][5][5];

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

  int n;
  cin >> n;
  
  const int A = 0, G = 1, C = 2, T = 3;
  memset(dp, 0, sizeof dp);
  
  
  for (int x1 = 0; x1 < 4; x1++) {
    for (int x2 = 0; x2 < 4; x2++) {
      for (int x3 = 0; x3 < 4; x3++) {
        if (x1 == A && x2 == G && x3 == C) continue;
        if (x1 == A && x2 == C && x3 == G) continue;
        if (x1 == G && x2 == A && x3 == C) continue;
        dp[3][x1][x2][x3] = 1;
      }
    }
  }
  
  for (int i = 4; i <= n; i++) {
    for (int x2 = 0; x2 < 4; x2++) {
      for (int x3 = 0; x3 < 4; x3++) {
        for (int x4 = 0; x4 < 4; x4++) {
          for (int x1 = 0; x1 < 4; x1++) {
            if (x1 == A && x3 == G && x4 == C) continue;
            if (x1 == A && x2 == G && x3 == C) continue;
            if (x2 == A && x3 == G && x4 == C) continue;
            if (x3 == A && x2 == G && x4 == C) continue;
            if (x2 == A && x4 == G && x3 == C) continue;
            if (x1 == A && x2 == G && x4 == C) continue;
            dp[i][x2][x3][x4] = (dp[i][x2][x3][x4] + dp[i - 1][x1][x2][x3]) % MOD;
          }
        }
      }
    }
  }


  long long result = 0;
  for (int x1 = 0; x1 < 4; x1++) {
    for (int x2 = 0; x2 < 4; x2++) {
      for (int x3 = 0; x3 < 4; x3++) {
        result = (result + dp[n][x1][x2][x3]) % MOD;
      }
    }
  }
  cout << result << '\n';
  return 0;
}


Measured memory_bytes: 1280
#include <stdio.h>
#include <math.h>
int main(){
	int i=1,flag=0,x,y,box;
	while(1){
		scanf("%d %d",&x,&y);
		if(x > y){
			box = x;
			x = y;
			y = box;
		}
		if (x==0 && y ==0 )
		{
			flag=1;
			break;
		}
		printf("%d %d\n",x,y );
		i++;
	}
	return 0;
}

Measured memory_bytes: 600
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
long long n,x,b[4],k,ans;
int main()
{
	scanf("%lld %lld",&n,&x);
	ans=n;
	b[0]=n-x,b[1]=x,b[2]=n-x,b[3]=x;
	while(b[0])
	{
		if(b[0]>=b[3])
		{
			x=b[0]/b[3];
			b[0]-=x*b[3];
			b[2]-=x*b[3];
			ans+=b[3]*x*2;
			if(!b[0])ans-=b[3];
		}
		else
		{
			x=b[3]-b[0];
			x=(x-1)/b[2]+1;
			b[3]-=x*b[2];
			b[1]-=x*b[2];
			ans+=b[2]*x*2;
		}
	}
	printf("%lld",ans);
}

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

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

int f(int a) {
  return (a * a + 4) / 8;
}

ll memo[1000];
ll fib(ll n) {
  if(n == 0) return 2;
  else if(n == 1) return 1;
  else if(memo[n]) return memo[n];
  else return memo[n] = fib(n-1) + fib(n-2);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n; cin >> n;
  string s; cin >> s;
  int ans = 0;
  for(int i=0;i<SZ(s);++i) {
    map<char, int> mp1, mp2;
    for(int j=0;j<i;++j) {
      mp1[s[j]]++;
    }
    for(int j=i;j<SZ(s);++j) {
      mp2[s[j]]++;
    }

    int cnt = 0;
    for(char j='a';j<='z';++j) {
      if(mp1[j] && mp2[j]) cnt++;
    }
    ans = max(ans, cnt);
  }
  cout << ans << endl;

}


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

db dp[3000][1600];

db fun(int c,int h,db *a)
{
    if(c==0 && h==0)return 1;
    else if(c<h) return 0;
    if(dp[c][h]!=0)return dp[c][h];
    db p=0;
    if(h==0){
        p=a[c-1]*fun(c-1,h,a)+(1-a[c-1])*fun(c-1,h,a);
    }
    else{
        p=a[c-1]*fun(c-1,h-1,a)+(1-a[c-1])*fun(c-1,h,a);
    }
    return dp[c][h]=p;
}
void solve()
{
    int n;
    cin>>n;
    db a[n];
    for(int i=0; i<n; i++){
        cin>>a[i];
    }
    int h=(n+1)/2;
    memset(dp,0,sizeof(dp));
    fun(n,h,a);
    cout<<setprecision(10)<<dp[n][h];
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    t=1;
    while(t--){
        solve();
        cout<<endl;
    }
}


Measured memory_bytes: 79156
#include<bits/stdc++.h>
using namespace std;
const long long INF = 1e7 + 1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector < pair<ll, ll > > vp;
typedef vector <string> vs;
typedef vector <char> vc;
typedef list <ll> lst;

ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
//char c;

#define Endl endl


/*--------------------template--------------------*/

map<char, ll> mp;

int main() {
    cin >> s;
    REP(i, s.size()) {
        mp[s[i]]++;
    }
    if (mp['N'] != 0 && mp['S'] == 0) {
        cout << "No" << endl;
        return 0;
    }
    if (mp['S'] != 0 && mp['N'] == 0) {
        cout << "No" << endl;
        return 0;
    }
    if (mp['W'] != 0 && mp['E'] == 0) {
        cout << "No" << endl;
        return 0;
    }
    if (mp['E'] != 0 && mp['W'] == 0) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << Endl;

}

Measured memory_bytes: 256
# include<stdio.h>
# include<math.h>
long status[10000];
void seive()
{
long i,j,k=2;
status[0]=status[1]=1;
for(i=2;i<=sqrt(10000);i++)
	{
	if(status[i]==0)
		for(j=i+i;j<=10000;j+=i)
		status[j]=1;
	}
}
int main()
{
long n,m,i,count;
seive(n);
while(scanf("%ld",&n)==1)
	{
	m=n;
	i=1;
	count=0;
	while(i<=n)
		{
		if(status[i]==0&&status[m]==0)
		count++;
		i++;
		m--;
		}
	printf("%ld\n",count);
	}
return 0;
}

Measured memory_bytes: 668
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin >> s;
    if(s=="Sunny") cout << "Cloudy" << endl;
    if(s=="Cloudy") cout << "Rainy" << endl;
    if(s=="Rainy") cout << "Sunny" << endl;
    return 0;
   
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include "bits/stdc++.h"
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()



int main() {
    vector<int> a(3);
    for(int i=0;i<3;i++)
        cin>>a.at(i);
        
    sort(a.begin(),a.end());
    cout<<a.at(2)*10+a.at(1)+a.at(0)<<endl;
}

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

int main() {
  int N,A,B;
  cin >> N >> A >> B;
  cout << min(A*N, B) << endl;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define debug2(x, y)                       \
  cerr << "(" << #x << "," << #y << ") = " \
       << "(" << x << "," << y << ")\n"
#define all(x) x.begin(), x.end()
#define each(a, x) for (auto& a : (x))
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define int long long
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
const int MX = 1e5 + 5, INF = 5LL << 57, MOD = 1e9 + 7;

int N, M;
string S;
vi va, vb;
int H, W;
void input() {
  cin >> H >> W >> N;
  ;
  ;
}
void solve() {
  ;
  ;
  int k = max(H, W);
  int cnt = 0;
  rep(i, 1, min(H, W)) {
    cnt += k;
    if (cnt >= N) {
      cout << i << endl;
      return;
    }
  }
}
signed main() {
  input();
  solve();
  return 0;
}

Measured memory_bytes: 256
/*
 * C.cpp
 *
 *  Created on: 2020/07/11
 *      Author: 17k1028
 */



#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0; i<ll(n); i++)
#define REPD(i,n) for(ll i=n-1; i>=0; i--)
#define FOR(i,a,b) for(ll i=a; i<=ll(b); i++)
#define FORD(i,a,b) for(ll i=a; i>=ll(b); i--)

int main(){
	ll N;
	cin >>N;
	ll x,y,z;
	ll temp=0, count=0;
	REP(i, N){
		x=1; y=1; z=1; count=0;
		temp = x*x + y*y + z*z + x*y + x*z + y*z;
		while(temp<=i+1){
			while(temp<=i+1){
				while(temp<=i+1){
					temp = x*x + y*y + z*z + x*y + x*z + y*z;
					if(temp == i+1){
						count++;
					}
					z++;
				}
				z=1;
				y++;
				temp = x*x + y*y + z*z + x*y + x*z + y*z;
			}
			z=1;
			y=1;
			x++;
			temp = x*x + y*y + z*z + x*y + x*z + y*z;
		}
		cout << count << endl;
	}
}






Measured memory_bytes: 3640
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		while(true){
			int n=sc.nextInt(), k=sc.nextInt();
			if(n==0 && k==0) break;

			int[][] map = new int[n+1][n+1];
			
			while(k-- > 0){
				if(sc.nextInt() == 1){
					int c=sc.nextInt(), d=sc.nextInt(), e=sc.nextInt();
					if(map[c][d]==0 || map[c][d]>e)
						map[c][d] = map[d][c] = e;
					continue;
				}
				
				int s=sc.nextInt(), g=sc.nextInt();
				
				Queue<State> open = new PriorityQueue<State>();
				Set<State> closed = new HashSet<State>();
				
				State st = null;
				open.add(new State(0,s));
				
				State ans = null;
				while(!open.isEmpty()){
					st = open.poll();
					if(closed.contains(st)){
						continue;
					}
					closed.add(st);
					if(st.n == g){
						ans = st;
						break;
					}
					open.addAll(st.nexts(map));
				}
				System.out.println(ans==null ? -1 : ans.cost);
			}
		}
	}
	
	static class State implements Comparable<State>{
		int cost,n;
		
		State(int cost,int n){
			this.cost = cost;
			this.n = n;
		}
		
		List<State> nexts(int[][] map){
			List<State> sts = new ArrayList<State>();
			for(int i=1;i<map.length;i++){
				if(map[n][i] > 0) sts.add(new State(cost+map[n][i],i));
			}
			return sts;
		}

		public int compareTo(State st){
			return cost- st.cost;
		}
		
		public boolean equals(Object o){
			State st = (State)o;
			return this.n == st.n;
		}
		
		public int hashCode(){
			return this.n;
		}
	}
}

Measured memory_bytes: 13000
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <iterator>

bool finishGame(std::map<std::string, std::string> hands)
{
    for(const auto& hand : hands)
    {
        if(hand.second.length() == 0)
            return true;
    }
    return false;
}


int main(int argc, char const *argv[]) {

    std::string A,B,C;
    std::cin >> A >> B >> C;

    std::map<std::string, std::string> each_hands;
    each_hands["a"] = A;
    each_hands["b"] = B;
    each_hands["c"] = C;

    std::string current_turn_name = "a";
    while(true)
    {
        auto player_hand = each_hands[current_turn_name];
        std::string card_name = player_hand.substr(0,1);
        if(card_name == ""){
            putchar(std::toupper(current_turn_name[0]));
            putchar('\n');
            break;
        }
        each_hands[current_turn_name] = player_hand.substr(1,player_hand.length());

        current_turn_name = card_name;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

	static int n, a[], b[];
	static List<Integer> list[];

	public static void solve(int ptv) {
		if (ptv >= 0) {
			int min = a[0];
			for (int i = 1; i < n; ++i) {
				if (min > a[i]) {
					list[0].add(i);
					list[1].add(i + 1);
					a[i] += min;
				}
				min = a[i];
			}
		} else {
			int max = a[n - 1];
			for (int i = n - 2; i >= 0; --i) {
				if(max < a[i]) {
					list[0].add(i + 2);
					list[1].add(i + 1);
					a[i] += max;
				}
				max = a[i];
			}
		}
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		a = new int[n];
		b = new int[n];
		list = new List[2];
		for (int i = 0; i < 2; ++i)
			list[i] = new ArrayList<Integer>();
		for (int i = 0; i < n; ++i) {
			a[i] = sc.nextInt();
			b[i] = a[i];
		}
		sc.close();
		Arrays.sort(b);
		int pos1 = 0, pos2 = 0;
		for(int i = 0; i < n; ++i) {
			if(a[i] == b[0])pos1 = i;
			if(a[i] == b[n - 1])pos2 = i;
		}
		int pos;
		if (b[0] < 0 && b[n - 1] > 0) {
			int max = b[0];
			pos = pos1;
			if (Math.abs(max) <= b[n - 1]) {
				max = b[n - 1];
				pos = pos2;
			}
			for (int i = 0; i < n; ++i) {
				b[i] += max;
				a[i] += max;
				list[1].add(i + 1);
				list[0].add(pos + 1);
			}
		}
		int ptv = b[0];
		solve(ptv);
		n = list[0].size();
		System.out.println(n);
		for (int i = 0; i < n; ++i) {
			System.out.println(list[0].get(i) + " " + list[1].get(i));
		}
	}

}


Measured memory_bytes: 22736
#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
#include <utility>
#include <stack>
#include <queue>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <numeric>
using namespace std;
using ll = long long;

typedef pair <int, int> pii;

int main()
{
	ll a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, ans = 0;
	ll n;
	ll x[101][101] = {};
	ll y[101][101] = {};
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		for (int k = 0; k < 10; k++)
		{
			cin >> x[i][k];
		}
	}
	for (int i = 0; i < n; i++)
	{
		for (int k = 0; k < 11; k++)
		{
			cin >> y[i][k];
		}
	}
	b = -9999999999999;
	for (int i1 = 0; i1 < 2; i1++)
	{
		for (int i2 = 0; i2 < 2; i2++)
		{
			for (int i3 = 0; i3 < 2; i3++)
			{
				for (int i4 = 0; i4 < 2; i4++)
				{
					for (int i5 = 0; i5 < 2; i5++)
					{
						for (int i6 = 0; i6 < 2; i6++)
						{
							for (int i7 = 0; i7 < 2; i7++)
							{
								for (int i8 = 0; i8 < 2; i8++)
								{
									for (int i9 = 0; i9 < 2; i9++)
									{
										for (int i10 = 0; i10 < 2; i10++)
										{
											a = 0;
											if (i1 + i2 + i3 + i4 + i5 + i6 + i7 + i8 + i9 + i10 > 0)
											{

												for (int i = 0; i < n; i++)
												{
													a += y[i][i1*x[i][0] + i2*x[i][1] + i3*x[i][2] + i4*x[i][3] + i5*x[i][4] + i6*x[i][5] + i7*x[i][6] + i8*x[i][7] + i9*x[i][8] + i10*x[i][9]];
												}
											b = max(a, b);
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}


	cout << b << endl;
	//cout << ans << endl;

	////std::cout << std::fixed;
	//cout << std::setprecision(20) << << endl;
	//cout << d+1 << endl;
	//cout << "" << endl;

	return 0;
}
//char型の文字数字は、-'0'で数値に変換できる
//accumulate(x, x + a, 0);//int型までの配列の合計
//memcpy(x, visited, sizeof(ll)*n);
//void kansuu(ll num, ll visited[10]) {}
//kansuu(1, zz);
//cout << setprecision(15) << v << endl;
//cout << char(z - 'a');
//log10(i) + 1 //10進数の桁数を取得

//int temp;
//for (int i = 0; i < n - 1; i++) {
//	for (int j = n - 1; j > i; j--) {
//		if (w[j - 1] < w[j]) {  /* 前の要素の方が大きかったら */
//			temp = w[j];        /* 交換する */
//			w[j] = w[j - 1];
//			w[j - 1] = temp;
//		}
//	}
//}

//最小公倍数
//ll x = a * b;
//ll tmp;
///* 自然数 a > b を確認・入替 */
//if (a<b) {
//	tmp = a;
//	a = b;
//	b = tmp;
//}
///* ユークリッドの互除法 */
//ll r = a % b;
//while (r != 0) {
//	a = b;
//	b = r;
//	r = a % b;
//}
//a = x / b;//答え

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

int main() {
    int n;
    string s;
    cin >> n >> s;
    
    long long r = 0, g = 0, b = 0;
    for (const char &c : s) {
        r += (c == 'R');
        g += (c == 'G');
        b += (c == 'B');
    }
    
    long long ans = r * g * b;
    
    auto f = [&](int i, int j, int k) -> bool {
        return (s[i] != s[j] and s[j] != s[k] and s[k] != s[i]);
    };
    
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            const int d = j - i;
            if (j + d < n) ans -= f(i, j, j + d);
        }
    }
    
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define cu continue
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define inf 1000000000
#define pll pair <ll,ll>
#define min_pq priority_queue <pll> ,vector <pll>, greater <pll> > > 
#define f first
#define s second
#define vll vector <ll>
#define dbg(n) cout<<n<<' ';

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

    ll n;
    cin>>n;
    ll a[n];
    for(ll i=0;i<n;i++)
        cin>>a[i];
    ll dp[n][n];
    memset(dp,0,sizeof dp);
    for(ll i=0;i<n;i++)
        dp[i][i]=a[i];
    for(ll k=2;k<=n;k++)
    {
        for(ll i=0;i<n-k+1;i++)
        {
            ll j=i+k-1;
            dp[i][j]=max(a[i]-dp[i+1][j],a[j]-dp[i][j-1]);
        }
    }
    cout<<dp[0][n-1]<<'\n';
}       


Measured memory_bytes: 70656
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
using namespace std;

int a,b;
int main()
{
    cin>>a>>b;
    if (b%a==0) cout<<a+b; else cout<<b-a;
    cout<<endl;
    return 0;
}



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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define VI         vector<int>
#define MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e19;
//const int INF=(1<<30);


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

  regex reg("^A[a-z][a-z]*C[a-z]*[a-z]$");

  if(regex_match(s,reg)){
    cout << "AC" << endl;
  }else{
    cout << "WA" << endl;
  }
}



Measured memory_bytes: 256
macro_rules! scan_sub {
    ( $itr:ident, $t:ty ) => {
        let mut buf = String::new();
        let $itr = {
            while buf.trim().len() == 0 {
                buf = String::new();
                std::io::stdin().read_line(&mut buf).unwrap();
            }
            buf.split_whitespace().map(|n| n.parse::<$t>().unwrap())
        };
    };
}

macro_rules! scan {
    ( $x:ident; Vec<$t:ty> ) => {
        scan_sub!(itr, $t);
        let $x = itr.collect::<Vec<_>>();
    };
    ( $( $x:ident ),*; $t:ty ) => {
        scan_sub!(itr, $t);
        let mut itr = itr;
        $(
            let $x = itr.next().unwrap();
        )*
    };
}

fn main() {
    scan!(n; usize);
    if n == 1 {
        println!("1");
        return;
    } else if n == 2 {
        println!("5");
        return;
    } else if n == 3 {
        println!("11");
        return;
    }

    let mut array = vec![1; n+1];
    array[1] = 1;
    array[2] = 2;
    array[3] = 2;

    let m = (n as f64).sqrt() as usize;
    let mut sieve = vec![true; n+1];
    sieve[0] = false;
    sieve[1] = false;
    let mut d = 2;
    while d <= m {
        let mut t = 2 * d;
        while t <= n {
            sieve[t] = false;
            t += d;
        }

        let mut i = d+1;
        let mut flag = false;
        while i <= m+1 {
            if sieve[i] {
                d = i;
                flag = true;
                break;
            }
            i += 1;
        }
        if !flag {
            break;
        }
    }

    let mut primes = Vec::with_capacity(n+1);
    for i in 0..=n {
        if sieve[i] {
            primes.push(i);
        }
    }

    // println!("{:?}", primes);

    for d in primes.into_iter() {
        array[d] = 2;
        let mut t = 2 * d;
        while t <= n {
            let mut num = 1;
            let mut u = t;
            while u % d == 0 {
                num += 1;
                u /= d;
            }
            array[t] *= num;
            // println!("t:{} d:{} num:{}", t, d, num);
            t += d;
        }
    }

    // println!("{:?}", array);

    /*
    for i in 4..=n {
        let m = (i as f64).sqrt() as usize;
        for d in 1..=m {
            if i % d == 0 {
                array[i] += 2;
            }
        }
        if m * m == i {
            array[i] -= 1;
        }
    }*/

    let res: usize = array
        .into_iter()
        .enumerate()
        .map(|(i, v)| {
            i * v
        }).sum();

    println!("{}", res);
}


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

int main() {
  int A, B;
  cin >> A >> B;

  // ここにプログラムを追記
  int cnt = 0;;
  for(int i=A; i<=B; i++) {
    if(i/10000 == i%10) {
      if(i%10000/1000 == i%100/10) {
        cnt++;
      }
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <iostream>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
int n;
int main() {
	int a, b, c, d;
	while(scanf("%d\n", &n) != EOF) {
		int count = 0;
		rep(a,10) {
			rep(b,10) {
				rep(c,10) {
					rep(d,10) {
						if(a + b + c + d == n) count++;
					}
				}
			}
		}
		cout << count << endl;
	}
	return 0;
}

Measured memory_bytes: 1212
while 1:
	N, M = map(int,raw_input().split())
	if (N,M) == (0,0):
		break
	r = int(raw_input())
	log = [[0,[]] for i in range(M)]
	time_log = [[] for i in range(M)]
	for i in range(r):
		t, n, m, s = map(int,raw_input().split())
		if s == 1:
			log[m-1][1].append(t)
			log[m-1][0] += 1
		else :
			tmp = log[m-1][1].pop()
			if log[m-1][0] == 1:
				time_log[m-1].append((tmp,t))
			log[m-1][0] -= 1
	q = int(raw_input())
	for i in range(q):
		t_s, t_e, m = map(int,raw_input().split())
		ans = 0
		for tl in time_log[m-1]:
			tmp = min(tl[1],t_e)- max(tl[0],t_s)
			ans += tmp if tmp > 0 else 0
		print ans

Measured memory_bytes: 8200
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<float.h>
#include<tuple>
#include<string.h>
#include<iomanip>
#include<stack>
#include<queue>

using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define ALLOF(c) (c).begin(), (c).end()
#define Pa pair<ll,ll>
const ll mod=10e9+7;
const ll INF=10e12;
const ll inf=-1;
ll ABS(ll a){return max(a,-a);}

int main(void){
    ll N;
    cin>>N;
    vector<ll> H(N);
    rep(i,N) cin>>H.at(i);
    
    ll ans=0,times=0;
    rep(i,N-1){
        if(H.at(i)>=H.at(i+1)) times++;
        else{
            ans=max(ans,times);
            times=0;
        }
    }
    ans=max(ans,times);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
#if 0
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>

auto& in = std::cin;
auto& out = std::cout;
#define all(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;

int32_t N;

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	in >> N;

	return 0;
}
#endif


#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>

auto& in = std::cin;
auto& out = std::cout;
#define all(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;

int32_t A[3];

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	in >> A[0]>>A[1]>>A[2];
	std::sort(A, A + 3);
	int count = 0;
	while (A[0] < A[1]) {
		++count;
		A[0] += 2;
	}
	std::sort(A, A + 3);
	while (A[1] < A[2]-1) {
		++count;
		++count;
		A[0] += 2;
		A[1] += 2;
	}
	std::sort(A, A + 3);
	if (A[0] == A[2]) {
	}
	else if (A[0] == A[2]-2) {
		count += 3;
	}
	else if (A[1] == A[2]) {
		count += 2;
	}
	else  {
		++count;
	}
	out << count << endl;


	return 0;
}
#endif


Measured memory_bytes: 256
#!python3

LI = lambda: list(map(int, input().split()))

# input
N, S = LI()
A = LI()

MOD = 998244353


def main():
    dp = [0] * (S + 1)
    dp[0] = 1
    for i in range(N):
        dp, l = [0] * (S + 1), dp
        for j in range(S + 1):
            dp[j] = (dp[j] + 2 * l[j]) % MOD
            if A[i] + j <= S:
                dp[A[i] + j] = (dp[A[i] + j] + l[j]) % MOD
    
    ans = dp[-1]
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 68800
#include <iostream>
#include <complex>
#include <vector>
#include <bitset>
#include <unordered_map>
#include <map>
#include <algorithm>

using namespace std;


int H, W;

int perm[12];
string s[12];

bool same(const string &s, string t) {
    reverse(t.begin(), t.end());
    return s == t;
}

string rev(string s) {
    reverse(s.begin(), s.end());
    return s;
}

void check() {
    string ss[H];
    for (int i = 0; i < H; i++) ss[i] = s[i];
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            ss[i][j] = s[i][perm[j]];
        }
    }
    map<string, vector<string>> grp;

    for (int i = 0; i < H; i++) {
        grp[min(ss[i], rev(ss[i]))].push_back(ss[i]);
    }

    bool ok = true;
    int oddCount = 0;
    for (auto gg: grp) {
        auto &g = gg.second;
        sort(g.begin(), g.end());
        oddCount += g.size() % 2;
        for (int i = 0; i <= g.size() / 2; i++) {
            if (!same(g[i], g[g.size() - i - 1])) {
                ok = false;
            }
        }
    }
    if (ok) {
        if (H % 2) {
            if (oddCount == 1) ok = true;
            else ok = false;
        } else {
            if (oddCount == 0) ok = true;
            else ok = false;
        }
    }
    //for (int i = 0; i < W; i++) cout << perm[i] << " ";
    //cout << endl;
    if (ok) {
        cout << "YES" << endl;
        exit(0);
    }

}

void evenDfs(int x, int bit) {

    int mx = -1;
    for (int i = 0; i < W; i++) {
        if (bit >> i & 1) {
            mx = i;
            break;
        }
    }
    if (bit == 0) {
        // even
        check();
        return;
    }
    for (int i = mx + 1; i < W; i++) {
        if (bit >> i & 1) {
            perm[x] = mx;
            perm[W - 1 - x] = i;
            evenDfs(x + 1, bit - (1 << mx) - (1 << i));
        }
    }

}

int main() {
    cin >> H >> W;
    for (int i = 0; i < H; i++) cin >> s[i];
    if (W % 2 == 0) {
        evenDfs(0, (1 << W) - 1);
    } else {
        for (int k = 0; k < W; k++) {
            perm[W / 2] = k;
            evenDfs(0, (1 << W) - 1 - (1 << k));
        }
    }

    cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <numeric>
#include <bitset>
using namespace std;
#define lint long long
#define ll long long
#define pq priority_queue
long long INF = 1e10;
#define pii pair<long long,long long>
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
/******************************define*********************************/

/*****************************functions********************************/

/****************************main function*****************************/
int main(void) {

	int N; cin >> N;
	vector<int> x(N), y(N), h(N);
	for (int i = 0; i < N; i++) {
		cin >> x[i] >> y[i] >> h[i];
	}

	for (int i = 0; i <= 100; i++) {
		for (int j = 0; j <= 100; j++) {
			int H = -1;
			bool check = true;
			for (int k = 0; k < N; k++) {
				if (h[k] != 0) {
					H = h[k] + abs(i - x[k]) + abs(j - y[k]);
					break;
				}
			}
			for (int k = 0; k < N; k++) {
				if (h[k] != max(H - abs(i - x[k]) - abs(j - y[k]), 0)) {
					check = false;
					break;
				}
			}
			if (check) {
				printf("%d %d %d\n", i, j, H);
				return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;

int main(){
    int N,W,v,w,ans=0;
    scanf("%d %d",&N,&W);
    vector<int> dp(W+1);
    fill(dp.begin(), dp.end(), 0);
    for(int i=0;i<N;i++){
        scanf("%d %d",&v,&w);
        for(int j=W-w;j>0;j--){
            if(dp[j]!=0){
                dp[j+w]=max(dp[j+w],dp[j]+v);
            }
        }
        dp[w]=max(dp[w],v);
            
    }
    printf("%d\n",*max_element(dp.begin(),dp.end()));
    return 0;
}

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

#define pb 		push_back
#define mp 		make_pair
#define prior   priority_queue
#define MOD 	1000000007
#define INF64 	(long long)1e18
#define INF 	(int)1e9
#define PI 		3.1415926535897932384626433832795 
#define ll      long long
#define ld		long double
#define ret     return
#define NUM 	1000001
const int SIZE = 2e5+4;
void fastio(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}
void input(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
}

void swap(int& a, int& b){
	int t=a;
	a = b;
	b = t;
}


void solveTest(){
	int s;
	cin>>s;
	set<int> st;
	st.insert(s);
	int x=2;
	while(1){
		if(s%2==0){
			s = s/2;
		}
		else {
			s = 3*s+1;
		}
		if(st.find(s)!=st.end()){
			cout<<x<<endl;
			return ;
		}
		st.insert(s);
		x++;
	}
	return ;
}

int main(){
	fastio();
	//input();

	int t=1;
	//cin>>t;
	while(t--){
		solveTest();

	}
	
	return 0;
}


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

int main() {
  int N;
  cin >> N;
  for(int i; i<=N; i++){
    string S;
    cin >> S ;
    if (S=="Y") {
      cout << "Four" << endl;
      break;
    }
    if (i==N){
      cout << "Three" << endl;
    }
  }
}


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

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

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    vvll dp(4, vll(s.size() + 1, 0));
    dp[0][0] = 1;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'A') {
            dp[1][i + 1] = (dp[0][i] + dp[1][i]) % MOD;
            dp[0][i + 1] = dp[0][i];
            dp[2][i + 1] = dp[2][i];
            dp[3][i + 1] = dp[3][i];
        } else if (s[i] == 'B') {
            dp[2][i + 1] = (dp[1][i] + dp[2][i]) % MOD;
            dp[0][i + 1] = dp[0][i];
            dp[1][i + 1] = dp[1][i];
            dp[3][i + 1] = dp[3][i];
        } else if (s[i] == 'C') {
            dp[3][i + 1] = (dp[2][i] + dp[3][i]) % MOD;
            dp[0][i + 1] = dp[0][i];
            dp[1][i + 1] = dp[1][i];
            dp[2][i + 1] = dp[2][i];
        } else {
            // A
            dp[1][i + 1] += (dp[0][i] + dp[1][i]) % MOD;
            dp[0][i + 1] += dp[0][i];
            dp[2][i + 1] += dp[2][i];
            dp[3][i + 1] += dp[3][i];
            // B
            dp[2][i + 1] += (dp[1][i] + dp[2][i]) % MOD;
            dp[0][i + 1] += dp[0][i];
            dp[1][i + 1] += dp[1][i];
            dp[3][i + 1] += dp[3][i];
            // C
            dp[3][i + 1] += (dp[2][i] + dp[3][i]) % MOD;
            dp[0][i + 1] += dp[0][i];
            dp[1][i + 1] += dp[1][i];
            dp[2][i + 1] += dp[2][i];
            
            dp[0][i + 1] %= MOD;
            dp[1][i + 1] %= MOD;
            dp[2][i + 1] %= MOD;
            dp[3][i + 1] %= MOD;
        }
    }
    cout << dp[3][s.size()] << '\n';
    return 0;
}


Measured memory_bytes: 4432
h, w, k = map(int, input().split())
fig = [list(input()) for  _ in range(h)]

count = 0
import itertools
for r_paint in itertools.product([0,1], repeat=h): #0:その行を塗りつぶさない 1:その行を塗りつぶす
    for c_paint in itertools.product([0,1], repeat=w): # column
        kuro = 0 #黒塗りの数を数える
        for row in range(h):
            for col in range(w):
                if (fig[row][col] == "#") and (r_paint[row] == 0) and (c_paint[col] == 0): #黒いマスかつ塗りつぶされていない
                    kuro += 1
        if kuro == k:
            count += 1

print(count)

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

map<char,int> m;
vector<int> v = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
set<char> Top;
string S;

int dfs (int n, int sum) {
    if (n == m.size()) return sum == 0;

    int res = 0;
    for (int i = 0; i < v.size(); i++) {
        if (v[i] == 0 && Top.find(S[n]) != Top.end()) continue;
        int tmp = v[i];
        v.erase(v.begin() + i);
        res += dfs (n + 1, sum + (m[S[n]] * tmp));
        v.insert(v.begin() + i, tmp);
    }

    return res;
}

int main ()
{
    int n;
    while (cin >> n, n) {
        set<char> s;
        m.clear();
        Top.clear();
        for (int i = 0; i < n; i++) {
            string str;
            cin >> str;
            int k = 1;
            if (str.size() > 1) Top.insert(str[0]);
            for (int j = str.size()-1, k = 1; j >= 0; j--, k *= 10) {
                s.insert(str[j]);
                if (m.find(str[j]) == m.end()) {
                    if (i == n - 1) m[str[j]] = -k;
                    else m[str[j]] = k;
                } else {
                    if (i == n - 1) m[str[j]] -= k;
                    else m[str[j]] += k;
                }
            }
        }

        S = "";
        for (auto i : s) {
            S += i;
        }

        cout << dfs(0, 0) << endl;
    }

    return 0;
}

Measured memory_bytes: 1232
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(void)
{
  int N,M,i,j,k,l,w_change=0,b_change=0,r_change=0,min=2500,sum=0,loop=0,count=0;
  scanf("%d %d",&N,&M);
  char flag[N][M];
  int w_cost[N],b_cost[N],r_cost[N];
  for(i=0;i<N;i++)
  {
    scanf("%s",flag[i]);
    w_cost[i]=M;
    b_cost[i]=M;
    r_cost[i]=M;
  }
  for(i=0;i<N;i++)
  {
    for(j=0;j<M;j++)
    {
      if(flag[i][j]=='W') w_cost[i]--;
      if(flag[i][j]=='B') b_cost[i]--;
      if(flag[i][j]=='R') r_cost[i]--;
    }
    //printf("%d %d %d\n",w_cost[i],b_cost[i],r_cost[i]);
  }
  for(i=0;i<N-2;i++)
  {
    for(j=i+1;j<N-1;j++)
    {
      for(k=j+1;k<N;k++)
      {
      //  printf("i:%d j:%d k:%d ",i,j,k);
        while(count<j)
        {
          sum+=w_cost[count];
          count++;
        }
        count=0;
        while(j+count<k)
        {
          sum+=b_cost[j+count];
          count++;
        }

        count=0;
        while(k+count<N)
        {
          sum+=r_cost[k+count];
          count++;
        }
        count=0;
      //  printf("%d\n",sum);
        if(sum<min)
        {//printf("\n%d %d %d ",i,j,k);
          min=sum;
        }
        sum=0;
        //printf("\n");
      }
    }
  }
  printf("%d\n",min);
  return 0;
}



Measured memory_bytes: 2040
#include<cmath>
#include<cstring>
#include<cstdio>
#include<queue>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int mod = (1 ? 1e9 + 7 : 998244353);
const int dx[] = { -1,0,1,0 }, dy[] = { 0,1,0,-1 };
ll a, b, c, d, e, f, n, T;



double z[200005];
int main()
{
	ios::sync_with_stdio(false); cin.tie(0);
	cin >> a >> b;
	double maxx = 0;
	for (int i = 0; i < a; i++)cin >> z[i], maxx = max(maxx, z[i]);
	double minn = 0;
	double mid;
	while (maxx - minn > 1e-6)
	{
		mid = (maxx + minn) / 2;
		c = 0;
		for (int i = 0; i < a; i++)c += ceil(z[i] / mid - 1);
		if (c > b)minn = mid;
		else maxx = mid;
	}
	cout << (ll)ceil(maxx) << endl;

}



Measured memory_bytes: 5268
#include<bits/stdc++.h>
using namespace std;
int main()
{
  unsigned long long k;
  cin>>k;
  unsigned long long m=100;
  unsigned long long cnt=0;
  while(m<k)
  {
    m+=m/100.0;
    cnt++;
  }
  cout<<cnt;
  return 0;
}

Measured memory_bytes: 3620
#include<cstdio>
#include<iostream>
using namespace std;
int n;
int B,W;
int a[300050];
int s[300050];
bool judge(int x)
{
	int mn=0;
	if(s[n]>=x) return 1;
	for(int i=2;i<=n;++i)
	{
		if(s[i-1]-mn>=x)
		{
			if(s[n]-s[i]>=x) return 1;
			mn=min(mn,s[i]);
		}
	}
	return 0;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
	{
		scanf("%d",&a[i]);
		if(i&1)
		{
			B+=a[i];
			s[i]=s[i-1]+a[i];
		}
		else
		{
			W+=a[i];
			s[i]=s[i-1]-a[i];
		}
	}
	if(~n&1)
	{
		printf("%d %d\n",max(B,W),min(B,W));
		return 0;
	}
	int l=0,r=B,re=-1;
	while(l<=r)
	{
		int mid=(l+r)>>1;
		if(judge(mid)) l=mid+1,re=mid;
		else r=mid-1;
	}
	int an=max(B,W+re);
	printf("%d %d\n",an,B+W-an);
	return 0;
}

Measured memory_bytes: 2560
fun main(arr:Array<String>) {
    val (n,m,x,y) =  readLine()!!.split(" ").map { it.toInt() }
    val xList = readLine()!!.split(" ").map { it.toInt() }.union(listOf(x)).sorted()
    val yList = readLine()!!.split(" ").map { it.toInt() }.union(listOf(y)).sorted()
    if(xList.last() < yList.first()) {
        println("No War")
    } else {
        println("War")
    }
}


Measured memory_bytes: 36196
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] a = new int[w];
		for(int i = 0 ; i < a.length ; i++){
			a[i] = i+1;
		}
		
		for (int i = 0 ; i < n ; i++){
			String str = sc.next();
			String[] stra = str.split(",");
			int x = Integer.parseInt(stra[0]);
			int y = Integer.parseInt(stra[1]);
			int swap = a[x-1];
			a[x-1] = a[y-1];
			a[y-1] = swap;
		}
		for(int z : a){
			System.out.println(z);
		}
		sc.close();
	}

}

Measured memory_bytes: 17196
// author-Shivam gupta

#include <bits/stdc++.h>


using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))

#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)

#define IN(A, B, C) assert( B <= A && A <= C)

#define MP make_pair
#define FOR(i,a) for(int i=0;i<a;i++)

#define FOR1(i,j,a) for(int i=j;i<a;i++)

#define EB emplace_back

#define INF (int)1e9

#define EPS 1e-9

#define PI 3.1415926535897932384626433832795

#define MOD 1000000007
const int N = 3e5+5;

#define read(type) readInt<type>()
#define max1 100001
#define out(x) cout<<x<<'\n'
#define out1(x) cout<<x<<" "
#define END cout<<'\n'
const double pi=acos(-1.0);

typedef pair<int, int> PII;

typedef vector<int> VI;

typedef vector<string> VS;

typedef vector<PII> VII;

typedef vector<VI> VVI;

typedef map<int,int> MPII;

typedef set<int> SETI;

typedef multiset<int> MSETI;

typedef long int li;

typedef unsigned long int uli;

typedef long long int ll;

typedef unsigned long long int  ull;
const ll inf = 0x3f3f3f3f3f3f3f3f;
const ll mod = 998244353;
using vl = vector<ll>;

bool isPowerOfTwo (int x)
{
  /* First x in the below expression is
    for the case when x is 0 */
  return x && (!(x&(x-1)));
}
void fast(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
ll power(ll x, ll y, ll p)
{
    ll res = 1;      // Initialize result

    x = x % p;  // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}

long long phi[max1], result[max1],F[max1];
// Precomputation of phi[] numbers. Refer below link
// for details : https://goo.gl/LUqdtY
void computeTotient()
{
    // Refer https://goo.gl/LUqdtY
    phi[1] = 1;
    for (int i=2; i<max1; i++)
    {
        if (!phi[i])
        {
            phi[i] = i-1;
            for (int j = (i<<1); j<max1; j+=i)
            {
                if (!phi[j])
                    phi[j] = j;

                phi[j] = (phi[j]/i)*(i-1);
            }
        }
    }
    for(int i=1;i<=100000;i++)
{
	for(int j=i;j<=100000;j+=i)
	{  int p=j/i;
	F[j]+=(i*phi[p])%mod;
         F[j]%=mod;

          }
}
}
int gcd(int a, int b, int& x, int& y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    int x1, y1;
    int d = gcd(b, a % b, x1, y1);
    x = y1;
    y = x1 - y1 * (a / b);
    return d;
}

bool find_any_solution(int a, int b, int c, int &x0, int &y0, int &g) {
    g = gcd(abs(a), abs(b), x0, y0);
    if (c % g) {
        return false;
    }

    x0 *= c / g;
    y0 *= c / g;
    if (a < 0) x0 = -x0;
    if (b < 0) y0 = -y0;
    return true;
}

int main() {
    fast();
 int a[5];
 FOR(i,5){
 cin>>a[i];
 if(a[i]==0){out1(i+1);}
 }
}


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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;
bool od(int x) {
  int len = std::to_string(x).length();
  return len%2==1;
}

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  cout << fixed << setprecision(12);
  int n; cin>>n;
  int ans = 0;
  for (int i=1; i<=n; i++) {
    if (od(i)) ans++;
  }
  cout<<ans;
  

  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void)
{
	int second, h, m, s;
	cin >> second;
	
//	cout << second % 86400 << endl;
//	cout << 46979 / 3600 << endl;
	h = (second % 86400) / 3600;
	m = ((second % 86400) - 3600 * h) / 60;
	s = second % 86400 - 3600 * h - 60 * m;
	cout << h << ":" << m << ":" << s << endl;
}


Measured memory_bytes: 3096
'use strict'

function Main(input) {
  const N = Number(input.split("\n")[0].split(" ")[0])
  const X = Number(input.split("\n")[0].split(" ")[1])
  const L = input.split("\n")[1].split(" ").map(x => Number(x))

  let ans = 1
  let now = 0
  for(const l of L) {
    now += l
    if(now > X) {
      break
    }
    ans++
  }
  console.log(ans)  
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim())

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

#define MOD (1000000000+7)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) x.begin(), x.end()
#define print(vec,l,r) for(int i = l; i <= r; i++) cout << vec[i] <<" "; cout << endl;
#define forf(i,a,b) for(int i = (a); i < (b); i++)
#define forr(i,a,b) for(int i = (a); i > (b); i--)
// template starts
typedef long long int ll;
ll fact(ll n, ll p){
	ll ans = 1;
	for(ll i = 1; i <= n; i++){
		ans *= i;
		ans %= p;
	}
	return ans;
}
ll power(ll x, ll n, ll p){
	ll res = 1;
	if(n == 1) return x%p;
	if(n%2 == 1) res = x%p;

	ll temp = power(x,n/2,p);
	return res*((temp*temp)%p)%p;
}
ll inv(ll a, ll p){
	return power(a,p-2,p);
}
ll nCr(ll n, ll r, ll p){
	if(r > n) return 0;
	ll t1 = fact(n,p);
	ll t2 = inv(fact(r,p),p);
	ll t3 = inv(fact(n-r,p),p);

	return (((t1*t2)%p)*t3)%p;
}
vector<vector<ll> > multiply(vector<vector<ll> > &a, vector<vector<ll> > &b, ll p){
	int r1,c1,r2,c2;
	r1 = a.size(); c1 = a[0].size();
	r2 = b.size(); c2 = b[0].size();

	vector<vector<ll> > result(r1,vector<ll>(c2,0));

	if(c1 != r2) return result;

	for(int i = 0; i < r1; i++){
		for(int j = 0; j < c2; j++){
			for(int k = 0; k < c1; k++){
				result[i][j] += a[i][k]*b[k][j];
				result[i][j] %= p;
			}
		}
	}
	return result;
}

vector<vector<ll> > power(vector<vector<ll> >&a,ll n, ll p){
	int r = a.size();
	vector<vector<ll> > result(r,vector<ll>(r,0));
	for(int i = 0; i < r; i++) result[i][i] = 1;

	while(n > 0){
		if(n%2 == 1){
			result = multiply(result,a,p);
		}
		n /= 2;
		a = multiply(a,a,p);
	}
	return result;
}
// template ends here

void solve(){
	// code starts from here
	int N;
	cin >> N;
	vector<int> vec(N), freq(N+1);
	
	for(int i = 0; i < N-1; i++){
		cin >> vec[i];
		freq[vec[i]]++;
	}
	freq.pb(0);
	for(int i = 0; i < N; i++){
		cout << freq[i+1] << endl;
	}
	cout << endl;
}

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

	int T;
	T = 1;
	while(T--){
		solve();
	}

	return 0;
}


Measured memory_bytes: 5552
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string str;
  int q,t,f,l,c;
  char ch;
  deque<char> dq;
  cin>>str;
  cin>>q;
  l=str.size();
  for(int i=0;i<l;i++)
    dq.push_back(str[i]);
  c=0;
  for(int i=1;i<=q;i++)
  {
    cin>>t;
    if(t==1 && dq.size()>1) c++;
    else
    {
      cin>>f>>ch;
      if(c%2==0)
      {
        if(f==1) dq.push_front(ch);
        else dq.push_back(ch);
      }
      else
      {
        if(f==1) dq.push_back(ch);
        else dq.push_front(ch);
      }
    }
  }
  if(c%2!=0) reverse(dq.begin(),dq.end()); 
  for(int i=0;i<dq.size();i++)
    cout<<dq[i];
  return 0;
}
      
      
      
      
      
      

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

#ifdef LOCAL
#define debug(var) cerr << #var << " = " << var << endl;
#else
#define debug(var)
#endif

void init() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
}

void solve() {
	int n, a, b; scanf("%d%d%d", &n, &a, &b);
	printf("%d", min(n*a, b));
}

int main() {
	init();
	int t = 1; //scanf("%d", &t);
	while (t--) {
		solve();
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;

int main()
{
    int a,b,c,N;
    priority_queue< int, vector<int>, greater<int> > que;
    cin >> N;
    REP(i,N) {
        cin >> a >> b >> c;
        que.push(a);
        que.push(b);
        que.push(c);
        a=que.top();
        que.pop();
        b=que.top();
        que.pop();
        c=que.top();
        que.pop();
        if (a*a+b*b==c*c) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 1208
use std::io::*;
use std::str::FromStr;

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")
}

fn main() {
    let s: Vec<char>=read::<String>().chars().collect();
    let t: Vec<char>=read::<String>().chars().collect();

    let sum=s.iter().zip(t.iter()).filter(|x| x.0!=x.1).count();
    println!("{}",sum);
}

Measured memory_bytes: 3912
#include <stdio.h>

int main (){
int A, B;
  scanf("%d %d", &A, &B);
  if(A!=1&&B!=1){
    printf("1");
  }else if(A!=2&&B!=2){
    printf("2");
  }else if(A!=3&&B!=3){
    printf("3");
  }
}

Measured memory_bytes: 128