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

// dp[i][j][k][m] :=  i: 上位 i 桁目まで決定
//                    j: small(数字を自由に選べる)か
//                    k: started(数字を書き込んだ)か
//                    m: {3,5,7} を選んだかのflag
//                    としたときの753数の数
int dp[11][2][2][8];

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

  string n;
  cin >> n;

  int len = n.size();
  dp[0][0][0][0] = 1;
  for (int i = 0; i < len; ++i)
  {
    for (int j = 0; j < 2; ++j)
    {
      for (int k = 0; k < 2; ++k)
      {
        for (int m = 0; m < 8; ++m)
        {
          if (!dp[i][j][k][m]) continue;

          if (j == 1)                  // small ([0, 9] から数字を選べる)か
          {
            if (k == 0 && m == 0)      // not started (数字を書き込んでいない)か
              dp[i + 1][1][0][0] += dp[i][1][0][0];                // nothing

            dp[i + 1][1][1][m | 1] += dp[i][1][k][m];              // +3
            dp[i + 1][1][1][m | 2] += dp[i][1][k][m];              // +5
            dp[i + 1][1][1][m | 4] += dp[i][1][k][m];              // +7
          }
          else                         // not small ([0, d] から数字を選べる)か
          {
            int d = n[i] - '0';

            if (k == 0 && m == 0)      // not started (数字を書き込んでいない)か
              dp[i + 1][1][0][0] += dp[i][0][0][0];                // nothing

            if (d == 3) dp[i + 1][0][1][m | 1] += dp[i][0][k][m];  // +3
            if (3 < d)  dp[i + 1][1][1][m | 1] += dp[i][0][k][m];  // +3
            if (d == 5) dp[i + 1][0][1][m | 2] += dp[i][0][k][m];  // +5
            if (5 < d)  dp[i + 1][1][1][m | 2] += dp[i][0][k][m];  // +5
            if (d == 7) dp[i + 1][0][1][m | 4] += dp[i][0][k][m];  // +7
            if (7 < d)  dp[i + 1][1][1][m | 4] += dp[i][0][k][m];  // +7
          }
        }
      }
    }
  }

  int ans = dp[len][0][1][7] + dp[len][1][1][7];
  cout << ans << endl;
  return 0;
}

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

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

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

	int preMaxValue = -1;
	int resultValue = 0;
	for (int i = 0; i < N; ++i)
	{
		if (preMaxValue <= array[i])
		{
			preMaxValue = array[i];
			++resultValue;
		}

	}
	cout << resultValue;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int A,B,ans = 0;
    cin >> A >> B;
    A--;
    B--;
    if(B % A == 0){
        ans = B / A;
    }
    else
    {
        ans = B / A + 1;    
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <algorithm>
#include <functional>

using namespace std;

#include <map>

map<int, int> dist_count;

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

	int N, X, Y;
	cin >> N >> X >> Y;
	X--;
	Y--;

	for (int i = 0; i < N - 1; i++)
	{
		for (int j = i + 1; j < N; j++)
		{
			int dist1 = abs(i - j);
			int dist2 = abs(X - i) + abs(Y - j) + 1;

			int min_dist = min(dist1, dist2);
			dist_count[min_dist]++;
		}
	}

	for (int i = 1; i < N; i++)
	{
		cout << dist_count[i] << "\n";
	}

	return 0;
}


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

long long int fun(long long int f)
{
   // cout<<f<<"*"<<(1+f)*f/2<<endl;
    return (1+f)*f/2;

}
long long int a[200005];
long long int s[200005];
int main()
{


    int n;
    cin>>n;

    s[0]=0;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    for(int i=1;i<=n;i++)
        s[i]+=(s[i-1]+a[i]);

    sort(s+1,s+n+1);

    long long int m=0;
    long long int ans=0;
    for(int i=1;i<=n;i++)
    {
        if(s[i]==0) continue;
        if(s[i]==s[i-1])
            m++;
        else
        {
            //cout<<"**************"<<i<<endl;
            ans+=fun(m);
            m=0;
        }
    }
    ans+=fun(m);
    m=0;
    for(int i=1;i<=n;i++)
        if(s[i]==0) m++;
    ans+=fun(m);


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


Measured memory_bytes: 3328
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <assert.h>
#include <deque>
using namespace std;

typedef unsigned long long UL;
typedef long long LL;
typedef long double LD;
#define LP(i, a, b) for (LL i = int(a); i < int(b); i++)
#define LPE(i, a, b) for (LL i = int(a); i <= int(b); i++)
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef vector<vector<PII> > WAL;
typedef vector<vector<int> > SAL;
#define Ep 1e-8
#define INF 1e9
#define LINF 1e18

LL const MOD = 1e9 + 7;
LL const MaxSize = 2000 + 5;
//LL const MOD = 998244353;

/*

https://atcoder.jp/contests/abc132/tasks/abc132_d
D - Blue and Red Balls

 Easy problem, but python version gives TLE in the last two cases
 */

//NOTE WORKS ONLY WHEN MOD IS PRIME
LL N, K;
//test case, either = 1 or all = 1

//NOTE WORKS ONLY WHEN MOD IS PRIME
LL f[MaxSize], invF[MaxSize], r[MaxSize];

void preCalc() {
        r[1] = 1;
        f[1] = 1;
        invF[1] = 1;
        LL m = MOD;

        for (LL i = 2; i < MaxSize; ++i) {
                r[i] = (m - (m / i) * r[m % i] % m) % m;

                f[i] = (i * f[i - 1]) % MOD;
                invF[i] = (r[i] * invF[i - 1]) % MOD;
        }
}

LL choose(LL top, LL bottom) {
        if (top < bottom || top < 0 || bottom < 0)
                return 0;
        else if (top == bottom || bottom == 0)
                return 1;


        LL bfs = (invF[bottom] * invF[top - bottom]) % MOD;

        //      cout << "ftop:" << top << " " << f[top] << endl;

        return (f[top] * bfs) % MOD;
}

int main() {
        ios_base::sync_with_stdio(false);
        //freopen("/Users/georgeli/A_1.in", "r", stdin);

        cin >> N >> K;

        preCalc();

        LPE(i, 1, K){
            LL pos = choose(N-K+1, i);
            LL ways = choose(K - 1, K - i);
        //    cout << i << " " << pos << " " << ways << endl;
            cout << (pos * ways) % MOD << endl;
        }

        return 0;
}


Measured memory_bytes: 256
/*
 * Author: .-O_O-.
 */
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define f first
#define s second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define nx cout<<"\n"
#define int long long
// void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
                                                     
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]"<<endl;}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
const ll mod = 1000000007;
const ll N = 200005;
const ll mm = 1e+18;
void solve()
{
    int n,x;
    cin>>n>>x;
    vector<int>v(n);
    rep0(i,n) cin>>v[i];
    int tot1=0;
    vector<int>v1=v;
    rep1(i,n-1){
        if(v[i]+v[i-1]>x){
            int y=(v[i]+v[i-1])-x;
            tot1+=y;
            v[i]-=min(v[i],y);
        }
    }
    v=v1;
    int tot2=0;
    for(int i=n-2;i>=0;i--){
        if(v[i]+v[i+1]>x){
            int y=(v[i]+v[i+1])-x;
            tot2+=y;
            v[i]-=min(v[i],y);
        }
    }
    pr(min(tot1,tot2));
}
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    //cin>>t;
    rep1(_i,t){
        //cout<<"Case #"<<_i<<": ";
        solve();
        //nx;
    }
    return 0;
}


Measured memory_bytes: 4712
using System;

namespace ConsoleApp1
{

    class Program
    {
        static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            double[] p = new double[n], q = new double[n + 1];
			double[,] sp = new double[n, n], sq = new double[n + 1, n + 1], dp = new double[n + 1, n + 1];

			string[][] pq = new string[2][]; pq[0] = Console.ReadLine().Split(' '); pq[1] = Console.ReadLine().Split(' ');
            for (int i = 0; i < n; i++) {
                p[i] = double.Parse(pq[0][i]);
                q[i] = double.Parse(pq[1][i]);
            } q[n] = double.Parse(pq[1][n]);

			for (int i = 0; i < n; i++)
			{
				sp[i, i] = p[i];
				for (int j = i + 1; j < n; j++) sp[i, j] = sp[i, j - 1] + p[j];
			}

			for (int i = 0; i <= n; i++)
			{
				dp[i, i] = sq[i, i] = q[i];
				dp[i, i] = sq[i, i];
				for (int j = i + 1; j <= n; j++) sq[i, j] = sq[i, j - 1] + q[j];
			}

			for (int i = 1; i <= n; i++)
			{
				for (int j = 0; j + i <= n; j++)
				{
					dp[j, j + i] = double.MaxValue;
					for (int k = 0; k < i; k++)
					{
						double v = dp[j, j + k] + dp[j + k + 1, j + i] + sp[j, j + i - 1] + sq[j, j + i];
						if (v < dp[j, j + i]) dp[j, j + i] = v;
					}
				}
			}

			Console.WriteLine(String.Format("{0:F8}", dp[0, n]));
		}
    }
}




Measured memory_bytes: 23492
#include<stdio.h>
int main(){
int a,b;
scanf("%d%d",&a,&b);
if(a==2){
a=3;
}else if(a==4 || a==6 || a==9 || a==11){
a=2;
}else{
a=1;
}
if(b==2){
b=3;
}else if(b==4 || b==6 || b==9 || b==11){
b=2;
}else{
b=1;
}
printf(a==b?"Yes":"No");
return 0;}


Measured memory_bytes: 128
import math
N, K = [int(item) for item in input().split()]

win = 0

for t in range(1, min(K, N+1)):
    win += ((0.5)**(int(math.log2(K)-math.log2(t)-1e-10)+1))
win *= (1/N)

if N >= K:
    win += (N-K+1)/N
print(win)


Measured memory_bytes: 3060
const input = require('fs').readFileSync('/dev/stdin', 'utf8')

const N = Number(input.split('\n')[0])
const H: number[] = input.split('\n')[1].split(' ').map(Number)
let Max = H[0]
let count = 0
for (let i = 0; i < N; i++) {
  if (H[i] >= Max) {
    Max = H[i]
    count += 1
  }
}
console.log(count)


Measured memory_bytes: 7500
'''
DPで解く
'''
# DPテーブル
dp = [0] * 31

# 初期値
dp[0] = 1
dp[1] = 1
dp[2] = 2

# dp[30]までの値を記録
for i in range(3, 31):
    dp[i] = dp[i - 1] + dp[i - 2] + dp[i - 3]

while True:
    n = int(input())
    if n == 0:
        break
    # 解を出力
    ans = 1 + dp[n] // (365 * 10)
    print(ans)


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

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

Measured memory_bytes: 3604
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>

using namespace std;

int main(){
  int N, X;
  cin >> N >> X;
  vector<int> L(N);
  for(int i = 0; i < N; i++) cin >> L[i];
  int cnt = 1;
  int d = 0;
  for(int i = 0; i < N; i++){
    d += L[i];
    if(d > X) break;
    cnt++;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>

using namespace std ;


int main()
{

   int n , k;
   cin >> n >> k;
   
   int p[n] ;
   for(int i = 0 ;i < n ; i++)
   {
   	   cin >> p[i];
   }
   
   sort(p,p+n);
   int ans = 0;
   for(int i = 0 ; i < k ; i++)
   {
   	  ans += p[i];
   }
   
   cout << ans << endl;
	
	

}

Measured memory_bytes: 3576
#include <stdio.h>

int main(){
  int a, b;

  scanf("%d %d", &a, &b);

  if(a < b) {
    printf("a < b\n");
  } else if(a > b) {
    printf("a > b\n");
  } else {
    printf("a == b\n");
  }
}



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

#define ONLINE_JUDGE
#define pb(a) push_back(a)
#define all(a) (a.begin(), a.end())

using ll = long long;

const int E5 = 1e5;

//////////// Solution /////////////////////////////////

void solve() {
	string s;
	cin >> s;
	int n = (int)s.length();
	bool ok = true;
	if (s[0] != 'A')
		ok = false;
	int cnt = 0;
	for (int i = 2; i < n-1; ++i) {
		if (s[i] == 'C') {
			++cnt;
		} else if (!islower(s[i])) {
			ok = false;
		}
	}
	if (!islower(s[1]) || !islower(s[n-1]))
		ok = false;

	if (cnt != 1)
		ok = false;

	if (ok)
		cout << "AC\n";
	else {
		cout << "WA\n";
	}
}	

/////////// End Solution ///////////////////////////////////////

//////// Initialization ////////////////////////////////////

int main() {

	#ifndef ONLINE_JUDGE
	FILE *FIN = freopen("/home/danil/prog/input.txt", "r", stdin);
	clock_t time_start = clock();
	#endif

	ios::sync_with_stdio(false);
	cin.tie(NULL);

	solve();

	#ifndef ONLINE_JUDGE
	fclose(FIN);
	cerr << "\x1b[031m\n-----------------\nTime=" << (ll)((double)(clock()-time_start) / CLOCKS_PER_SEC * 1000) << "ms\n\x1b[0m";
	#endif

	return 0;
}

	//////// End Initialization ///////////////////////////////////////

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

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		Obj[] arr = new Obj[n + 1];
		String[] sa = br.readLine().split(" ");
		for (int i = 0; i < n; i++) {
			Obj o = new Obj();
			o.t = Integer.parseInt(sa[i]);
			arr[i] = o;
		}
		sa = br.readLine().split(" ");
		for (int i = 0; i < n; i++) {
			arr[i].v = Integer.parseInt(sa[i]);
		}
		br.close();

		Obj o = new Obj();
		o.v = 1000;
		arr[n] = o;
		int sum = 0;
		for (int i = 0; i < n; i++) {
			arr[i].t1 = sum;
			arr[i].a = arr[i].v + sum;
			sum += arr[i].t;
			arr[i].t2 = sum;
			arr[i].b = arr[i].v - sum;
		}
		o.t2 = sum;
		o.b = sum;

		double[] v = new double[sum * 2 + 1];
		for (int i = 0; i < v.length; i++) {
			double x = i / 2.0;
			double min = 1000;
			for (int j = 0; j < arr.length - 1; j++) {
				if (x <= arr[j].t1) {
					min = Math.min(min, -x + arr[j].a);
				}
				if (arr[j].t1 <= x && x <= arr[j].t2) {
					min = Math.min(min, arr[j].v);
				}
				if (arr[j].t2 <= x) {
					min = Math.min(min, x + arr[j].b);
				}
			}
			min = Math.min(min, x + o.a);
			min = Math.min(min, -x + o.b);
			v[i] = min;
		}

		double ans = 0;
		for (int i = 1; i < v.length; i++) {
			double val = (v[i - 1] + v[i]) / 4;
			ans += val;
		}
		System.out.println(ans);
	}

	static class Obj {
		int t, t1, t2, v, a, b;
	}
}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}


signed main() {
    string s, t;
    int a, b;
    string u;
    cin >> s >> t >> a >> b >> u;

    if(u==s) cout << a-1 << " " << b << endl;
    else cout << a << " " << b-1 << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int mod=1e4+7;
const int inf=0x3f3f3f3f;
const double eps=1e-8;
//ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

int main(){
    int n;
    string s;
    cin>>s;
    int cnt=0;
    for(int i=1;i<s.size();i++){
        if(s[i]!=s[i-1]) cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}


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

int main(){
 int N,X;
  cin >> N >> X;
  int sum = 0;
  vector<int> a(N);
  for(int i=0; i<N; i++){
    cin >> a[i];
	sum += a[i];    
  }
  sort(a.begin(),a.end());
  cout << N + (X-sum)/a[0] << "\n";
  return 0;
}

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

int getNum(char c){
  const string R="IVXLCDM";
  const int N[]={1,5,10,50,100,500,1000};
  for(int i=0;i<R.size();++i){
    if(R[i]==c) return N[i];
  }
  return 0;
}

int main(void){
  string s;
  while(cin>>s){
    int ans=0,back=1001;
    for(int i=0,a;i<s.size();++i){
      a=getNum(s[i]);
      ans=(a>back)?ans-back*2+a:ans+a;
      back=a;
    }
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 1188
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF         1e9
#define INFLL       1e18
#define EPS         1e-9
#define REP(i,n)    for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(ll i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP(n)     cout<<fixed<<setprecision(n)
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

ll n, ans;
void dfs(ll a, ll b, ll c)
{
	ll g = a * 200 + b * 300 + c * 500;
	if (g == n) {
		ll y = (a - a % 5) * 304 + a % 5 * 380 + (b - b % 4) / 4 * 1870 + b % 4 * 550 + (c - c % 3) * 748 + c % 3 * 850;
		ans = min(ans, y);
	} else if (g < n) {
		dfs(a + 1, b, c);
		dfs(a, b + 1, c);
		dfs(a, b, c + 1);
	}
}
signed main()
{
	while ((n = in()) != 0) {
		ans = INFLL;
		dfs(0, 0, 0);
		cout << ans << endl;
	}
}


Measured memory_bytes: 2988
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int gi(){
	int x=0,w=1;char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
	if(ch=='-')w=0,ch=getchar();
	while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return w?x:-x;
}
int a[10],b[10];
int main(){
	for(int i=1;i<=6;++i)++a[gi()];
	for(int i=1;i<=4;++i)++b[a[i]];
	puts(b[1]==2&&b[2]==2?"YES":"NO");
	return 0;
}


Measured memory_bytes: 128
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(n-1):
    if a[i+1] < a[i]:
        b = a[i] - a[i+1]
        a[i+1] = a[i+1] + b
        ans = ans + b
    else:
        continue
print(ans)

Measured memory_bytes: 32256
#include<cstdio>
#include<iostream>
using namespace std;
int n,L,a[100005],ans;
bool fl;
int main()
{
    scanf("%d%d",&n,&L);
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        if(a[i]+a[i-1]>=L) fl=true,ans=i-1;
    }
    if(fl){
        puts("Possible");
        for(int i=1;i<n;i++)
            if(i==ans) break;
            else printf("%d\n",i);
        for(int i=n-1;i>=1;i--)
            if(i==ans) break;
            else printf("%d\n",i);
        printf("%d",ans);
    }
    else puts("Impossible");
    return 0;
}

Measured memory_bytes: 1152
#include<stdio.h>
#include<string.h>

int main(void){
  int i;
  char s[100000];
  scanf("%s",s);
  for(i=0;i<(strlen(s)+1)/2;i++){
    printf("%c",s[2*i]);
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int s1,s2,s3,x; //x=s1*100+s2*10+s3
  cin>>x;
  s1=x/100;
  s2=(x-s1*100)/10;
  s3=x-s1*100-s2*10;
  //cout<<s1<<endl;
  //cout<<s2<<endl;
  //cout<<s3<<endl;
  cout<<s1+s2+s3<<endl;
  
}

Measured memory_bytes: 256
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n, m = map(int, input().split())
from collections import defaultdict
ns = defaultdict(set)
pps = [set() for _ in range(n)]
for i in range(n-1+m):
    a,b = map(int, input().split())
    a -= 1
    b -= 1
    ns[a].add(b)
    pps[b].add(a)

for i,s in enumerate(pps):
    if not s:
        r = i
        
def tps(start):
    q = [start]
    # 行きがけ順
    seen = [None] * n
    # 帰りがけ順
    done = [None] * n
    d0 = 0
    d1 = n
    seen[start] = d0
    while q:
        u = q.pop()
        if u>=0:
            q.append(~u)
            for v in ns[u]:
                if seen[v] is None:
                    d0 += 1
                    seen[v] = d0
                    q.append(v)
        else:
            d1 -= 1
            done[~u] = d1            
    return seen, done

done = [None]*n
val = n
def dfs(u, val):
    for v in ns[u]:
        if done[v] is not None:
            continue
        val = dfs(v, val)
    val = val - 1
    done[u] = val
    return val

# seen, done = tps(r)
dfs(r, n)
ps = [-1] * n
ps[r] = 0
for i in range(n):
    if i==r:
        continue
    val = max(pps[i], key=lambda item: done[item])
    ps[i] = val+1
write("\n".join(map(str, ps)))

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

using  namespace  std;

int main()
{
    int a,b;
    cin >> a >> b;
    int temp = b;
    int ck=1;
   while(b>9){
        b/=10;
        ck++;
    }
    if(ck==1){
        a *=10;
    }
    else if(ck==2){
        a*=100;

    }
    else if(ck==3){
    a *= 1000;
    }
    a += temp;
    int m = a;
    int k = sqrt(a);

    if((k*k)==m)
        cout <<"Yes" <<endl;
    else cout << "No" <<endl;
   /// cout << a << endl;

}



Measured memory_bytes: 256
#include <iostream>
#include <utility>

using namespace std;

typedef pair<int, int> PA;

int main(int argc, char **argv)
{
  int n, m, s;
  PA pa[10001], tmp;

  while(1){
    cin >> n >> m;
    if(n == 0 && m == 0){
      break;
    }

    for(int i = 0; i < n; i++){
      cin >> pa[i].first >> pa[i].second;
    }

    for(int i = n-1; i >= 0; i--){
      for(int j = 1; j <= i; j++){
	if(pa[j].second > pa[j-1].second){
	  tmp = pa[j];
	  pa[j] = pa[j-1];
	  pa[j-1] = tmp;
	}
      }
    }

    s = 0;
    for(int i = 0; i < n; i++){
      if(m >= pa[i].first){
	m -= pa[i].first;
      } else {
	s += (pa[i].first - m)*pa[i].second;
	m = 0;
      }
    }
    cout << s << endl;
  }

  return 0;
}

Measured memory_bytes: 944
import sys
fin = sys.stdin.readline
from collections import defaultdict
from heapq import heappop, heappush


def initialize(adj, s):
    MAX_NUM = float('inf')
    parent = {s: None}
    d = {vertex: MAX_NUM for vertex in adj.keys()}
    d[s] = 0
    return d, parent


# Dijkstra can work using a minheap which does not have decrease_key.
# and also we do not have to implement Vertex class.
# Instead, we can use (distance, vertex).
# in this case, the time it takes is O(ElgE).
# E is at most O(V^2), thus O(ElgE) = O(ElgV).
def dijkstra_simple(adj, w, s):
    d, parent = initialize(adj, s)
    priority_queue = []
    heappush(priority_queue, (d[s], s))
    while priority_queue:
        distance, source = heappop(priority_queue) 
        for neighbor in adj[source]:
            new_distance = distance + w[(source, neighbor)]
            if new_distance < d[neighbor]:
                d[neighbor] = new_distance
                parent[neighbor] = source
                heappush(priority_queue, (new_distance, neighbor))
    return d


n, m, s, t = map(int, fin().split())
adj = defaultdict(list)
yen_weights = dict()
snuuk_weights = dict()
for _ in range(m):
    u, v, a, b = map(int, fin().split())
    for v1, v2 in [(u, v), (v, u)]:
        adj[v1].append(v2)
        yen_weights[(v1, v2)] = a
        snuuk_weights[(v1, v2)] = b

d_yen = dijkstra_simple(adj, yen_weights, s)
d_snuuk = dijkstra_simple(adj, snuuk_weights, t)
min_cost = float('inf')
min_cost_after_each_year_reversed = []
for vertex in range(n, 0, -1):
    min_cost = min(min_cost, d_yen[vertex] + d_snuuk[vertex])
    min_cost_after_each_year_reversed.append(min_cost)

initial_money = 10**15
for cost in reversed(min_cost_after_each_year_reversed):
    print(initial_money - cost)



Measured memory_bytes: 130924
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define reprev(i, n) for(int i = (n-1LL); i >= 0; --i)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    rep (i, n) cin >> h[i];
    if (n <= k) cout << 0 << "\n";
    else {
        sort(all(h), [](int a, int b) {return a > b;});
        ll sum = 0;
        repp (i, k, n) sum += (ll)h[i];
        cout << sum  << "\n";
    }
    return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner

object Main {
  def main(args: Array[String]) {
    if (args.length > 0 && args(0) == "TEST") {
      println(test())
    } else {
      val input = io.Source.stdin.getLines().mkString("\n")
      println(solve(input).trim())
    }
  }

  def solve(input: String): String = {
    val s: Scanner = new Scanner(input)
    val a,b = s.nextInt
    ((a + b) / 2.0).ceil.toInt.toString
  }

  val tests = List(
    """1 3""".stripMargin -> """2""",
    """7 4""".stripMargin -> """6""",
    """5 5""" -> "5"
  )

  def test(): String = tests.map { case (i, o) => (i.trim(), o.trim()) }
    .zipWithIndex.map {
    case ((input, outputExpect), i) =>
      val output = solve(input).trim()
      val tnum = i + 1
      s"test$tnum:" + (
        if (output == outputExpect) "Passed"
        else s"Failed\nexpect:\n$outputExpect\noutput:\n$output")
  }
    .mkString("\n")
}

Measured memory_bytes: 25540
# -*- coding:utf-8 -*-
class Cards:
    trump = [False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,]
    def HaveCards(self,num):
        self.trump[num] = True
    def TransCards(self,s,num):
        if(s == 'H'):
            num += 13 
        elif(s == 'C'):
            num +=26  
        elif(s == 'D'):
            num += 39
        return num
    def CheckCards(self,num):
        if(num <= 12):
            return 'S' ,num+1
        elif(num >= 13 and num <= 25):
            return 'H'  ,num-12
        elif(num >= 26 and num <= 38):
            return 'C',num-25
        elif(num >= 39 and num <=51):
            return 'D',num-38
        
n = int(input())
ob = Cards()
for i in range(n):
    s,str_num = input().split()
    number = int(str_num)
    Num=ob.TransCards(s,number-1)
    ob.HaveCards(Num)

for i in range(len(Cards.trump)):
    if Cards.trump[i] == False:
        Str,Num=ob.CheckCards(i)
        print(Str,Num)

Measured memory_bytes: 7808
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#define REP(i,n) for (int i=0;i<(n);i++)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
	long long n,a,b;
	cin >> n >> a >> b;
	vector<int> x(n);
	REP(i,n)cin >> x[i];
	long long ans = 0;
	REP(i,n-1){
		if(a*(x[i+1] - x[i]) < b) ans+= a*(x[i+1] - x[i]);
		else ans += b;
	}
	cout << ans << endl;
  return 0;
}


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

map<int, int> X;

int main() {
    
    int N, M;
    cin >> N >> M;
    
    long long ans = 0, pre = 0;
    X[0] = 1;
    
    for(int i=1; i<=N; i++)
    {
        int x;
        cin >> x;
        pre = (pre + x) % M;
        ans += X[pre];
        X[pre]++;
    }
    
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
int main()
{
  	long long k , x;
  	cin >> k >> x;
  	for(int i = x - k + 1 ; i <= x + k - 1 ; i++)
      	cout << i << " ";
  	cout << endl;
 	return 0; 
}

Measured memory_bytes: 256
#include<iostream>

int main(){
    int a,b;
    std::cin >> a >> b;

    int sum = 0;
    for(int i=0;i < 2; i++) {
	if (a >= b){
	    sum += a;
	    a--;
	}else{
	    sum += b;
	    b--;
	}
    }
    std::cout << sum << std::endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<ctime>
#include<vector>
 
using namespace std;
 
#define eps 0.0000000001
 
struct vec{
  double x, y;
  void nextvec(){ scanf("%lf %lf", &x, &y); return; }
  vec operator+(const vec& a) const { return (vec){x + a.x, y + a.y}; }
  vec operator-(const vec& a) const { return (vec){x - a.x, y - a.y}; }
  vec operator*(const double& k) const { return (vec){k * x, k * y}; }
  vec sca(double t){ return (vec){t * x, t * y}; }
  double dot(vec a){ return x * a.x + y * a.y; }
  double cross(vec a){ return x * a.y - y * a.x; }
  double norm(){ return sqrt(x * x + y * y); }
  double norm2(){ return x * x + y * y; }
};
 
bool xsort(vec qwe, vec rty){ return qwe.x < rty.x; }
bool ysort(vec qwe, vec rty){ return qwe.y < rty.y; }
 
vec pt[100000];
vec ytmp[100000];
vec ymerge[100000];
double ma = 100000000000.0;
 
double closestpair(int l, int r){
  if(r - l <= 1)return ma;
  int m = l + (r - l) / 2;
  double xm = pt[m].x;
  double res = min(closestpair(l, m), closestpair(m, r));
 
  int hdmerge = 0, hdtmp = 0, lhd = l, rhd = m;
  vec now;
  for(;;){
    if(lhd == m && rhd == r)break;
    else if(rhd == r)now = pt[lhd++];
    else if(lhd == m)now = pt[rhd++];
    else if(ysort(pt[lhd], pt[rhd]))now = pt[lhd++];
    else now = pt[rhd++];
 
    ymerge[hdmerge++] = now;
    if(abs(now.x - xm) <= res + eps){
      ytmp[hdtmp++] = now;
      for(int i = hdtmp - 2;i >= 0;--i){
        if(abs(ytmp[i].y - now.y) >= res - eps)break;
        res = min(res, (now - ytmp[i]).norm());
      }
    }
  }
  for(int i = l;i < r;++i)pt[i] = ymerge[i - l];
 
  return res;
}
 
signed main(void){
  int n;
  scanf("%d", &n);
  for(int i = 0;i < n;++i)pt[i].nextvec();
  sort(pt, pt + n, xsort);
  printf("%.13lf\n", closestpair(0, n));
 
  return 0;
}


Measured memory_bytes: 7200
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF (1<<30)-1
using ll = long long;
using namespace std;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }

int main(){
  cin.tie(0), ios::sync_with_stdio(false);
  int h,w; cin >> h >> w;
  vector<string> s(h); rep(i,h) cin >> s[i];
  int ans = 0;
  rep(i,h){
    rep(j,w){
      vector<vector<char>> tmp(h+2,vector<char>(w+2,'#'));
      rep(a,h) rep(b,w) tmp[a+1][b+1] = s[a][b];
      if(tmp[i+1][j+1] == '.'){
        queue<pair<int,int>> q; q.push({i+1,j+1});
        tmp[i+1][j+1] = '#';
        vector<vi> cnt(h,vi(w));
        while(!q.empty()){
          pair<int,int> p = q.front(); q.pop();
          int x = p.second, y = p.first;
          rep(k,4){
            if(tmp[y+dy[k]][x+dx[k]] == '.'){
              cnt[y+dy[k]-1][x+dx[k]-1] += cnt[y-1][x-1]+1;
              tmp[y+dy[k]][x+dx[k]] = '#';
              q.push({y+dy[k],x+dx[k]});
            }
          }
        }
        rep(a,h) rep(b,w) chmax(ans,cnt[a][b]);
      }
    }
  }
  cout << ans;
  cout << "\n";
  return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
const long long N = 1e9+7;
int main() {
	// your code goes here
	int n;
	cin>>n;
	int arr[n+1];
	long long ans=0;
	long long sum[n+1];
	sum[0]= 0;
	for(int i=1;i<=n;i++){
		cin>>arr[i];
		sum[i] = (sum[i-1] + arr[i]) % N;
	}
	
	for(int i=1;i<=n-1;i++){
		ans = ans + ((arr[i])*(((sum[n]-sum[i]) + N )% N))%N;	
		ans =(ans+ N)%N;	
	}
	ans = (ans + N)%N;
			cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 5924
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
#define MAXC 100000
int main()
{
	int n;
	cin>>n;
	double a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	double dp[n+1][n+1];
	memset(dp, 0.0, sizeof(dp));
	dp[0][0] = 1.0;
	for(int i=1;i<=n;i++){
		for(int j=0;j<=i;j++)
		{
			if(j==0) dp[i][j] = dp[i-1][j]*(1-a[i-1]);
			else dp[i][j] = dp[i-1][j]*(1-a[i-1]) + dp[i-1][j-1]*(a[i-1]);
		}
	}
	double sum=0;
	for(int i=(n+1)/2;i<=n;i++) sum+=dp[n][i];
	cout<<setprecision(10)<<sum;
}

Measured memory_bytes: 70528
n, m = map(int, input().split())
v = []
for i in range(n):
    a, b = map(int, input().split())
    v.append((a, b))
v.sort()
ans = 0
cnt = 0
for i in range(n):
    a, b = v[i]
    if cnt + b > m:
        ans += a * (m - cnt)
        break
    else:
        ans += a * b
        m -= b
print(ans)


Measured memory_bytes: 16892
#include<iostream>
#include<cstdio>
using namespace std;
const int N=2e5+10,p=1e9+7;
int fac[N],inv[N],h,w,a,b;
inline int C(int x,int y){
	return 1ll*fac[x]*inv[y]%p*inv[x-y]%p;
}
int main(){
	fac[0]=1;for (int i=1;i<N;++i) fac[i]=1ll*fac[i-1]*i%p;
	inv[0]=inv[1]=1;for (int i=2;i<N;++i) inv[i]=1ll*inv[p%i]*(p-p/i)%p;
	for (int i=2;i<N;++i) inv[i]=1ll*inv[i]*inv[i-1]%p;
	scanf("%d%d%d%d",&h,&w,&a,&b);
	int ans=C(h+w-2,h-1);
	for (int i=h-a,j=1;j<=b;++j) ans=(ans+p-1ll*C(i+j-2,j-1)*C(a-1+w-j,a-1)%p)%p;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 1792
import sys
stdin = sys.stdin

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

h,w = li()

# タテに3つ
if w%3 == 0:
    pat1 = 0
else:
    pat1 = h

# ヨコに3つ
if h%3 == 0:
    pat2 = 0
else:    
    pat2 = w

# T形に分ける
h1to = h//3
h2to = h-h1to

wto = w//2

choco1 = h1to * w
choco2 = h2to*wto
choco3 = h2to*(w-wto)

pat3 = max(choco1,choco2,choco3) - min(choco1,choco2,choco3)

h1to = h//3+1
h2to = h-h1to

wto = w//2

choco1 = h1to * w
choco2 = h2to*wto
choco3 = h2to*(w-wto)

pat4 = max(choco1,choco2,choco3) - min(choco1,choco2,choco3)


# ト型に分ける
w1t = w//3
w2t = w - w1t

ht = h//2

choco1 = w1t * h
choco2 = w2t * ht
choco3 = w2t * (h-ht)

pat5 = max(choco1,choco2,choco3) - min(choco1,choco2,choco3)


w1t = w//3+1
w2t = w - w1t

ht = h//2

choco1 = w1t * h
choco2 = w2t * ht
choco3 = w2t * (h-ht)

pat6 = max(choco1,choco2,choco3) - min(choco1,choco2,choco3)

print(min(pat1,pat2,pat3,pat4,pat5,pat6))

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

int main()
{
  int count = 0;
  string s;
  cin >> s;

  if (s[0] == '1')
    count++;
  if (s[1] == '1')
    count++;
  if (s[2] == '1')
    count++;
  cout << count << endl;
}

Measured memory_bytes: 256
n, k = map(int, input().split())

list = []
p = 0

for a in range(1,n+1):
    x = int(a/k)
    y = int((n+a)/k)
    if  2*a % k ==0:
        p = p + (y-x)**2
    else:
        pass

print(p)

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

#define ed cout << "\n";
#define speed                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define ll long long
#define ffor(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(i, n) ffor(i, 0, n)
#define All(obj) (obj).begin(), (obj).end()
#define INF ((ll)1e9 + 7)
#define c(a) cout << a << "\n";
using namespace std;
const int N = 100005;

int main()
{
    speed;
    cout << fixed << setprecision(6);
    /*start*/
    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    string ans = "";
    rep(i, n)
    {
        ans += s[i];
        ans += t[i];
    }
    c(ans);
    ed;
    return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

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--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}

int main() {
    int n;
    string p = "";
    string q = "";
    string tmp;
    cin >> n;
    REP(i, n) { cin >> tmp; p = p + tmp; }
    REP(i, n) { cin >> tmp; q = q + tmp; }

    vector<int> v;
    FOR(i, 1, n) {
        v.push_back(i);
    }

    int pc = -1;
    int qc = -1;
    int c = 0;
    do {
        tmp = "";
        REP(i, n) {
            tmp += to_string(v[i]);
        }
        if (tmp == p) {
            pc = c;
        }
        if (tmp == q) {
            qc = c;
        }
        c++;
    } while (next_permutation(v.begin(), v.end()));
    cout << abs(pc - qc) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
// debug
#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl;
#define ddd(x, y, z) cerr << "(" #x "," #y "," #z "):(" << x << "," << y << "," << z << ")" << endl;
#define dump(v)              \
  cerr << #v ":[ ";          \
  for (auto macro_vi : v)    \
  {                          \
    cerr << macro_vi << " "; \
  }                          \
  cerr << "]" << endl;
#define ddump(v)                     \
  cerr << #v ":" << endl;            \
  for (auto macro_row : v)           \
  {                                  \
    cerr << "[";                     \
    for (auto macro__vi : macro_row) \
    {                                \
      cerr << macro__vi << " ";      \
    }                                \
    cerr << "]" << endl;             \
  }
#define damp(m)                                                   \
  for (auto macro_pair : m)                                       \
  {                                                               \
    cerr << macro_pair.first << ":" << macro_pair.second << endl; \
  }
#define dpair(p) cerr << #p ":" \
                      << "(" << p.first << "," << p.second << ")" << endl;
// iterate
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define itr(macro_v, i) macro_v.begin() + i
// etc
#define chmin(mi, val) mi = min(mi, val);
#define chmax(ma, val) ma = max(ma, val);
using ll = long long;

using namespace std;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  double n;
  cin >> n;
  double ans = -1;
  for (double x = 0; x < 100000; x++)
  {
    int tmp = x * 1.08;
    if (tmp == n)
    {
      ans = x;
    }
  }
  if (ans == -1)
  {
    cout << ":(" << endl;
  }
  else
  {
    cout << ans << endl;
  }
  return 0;
}

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

int main() {
				    // *constraint*
  int N,K;    	    // 1<=N,K<=10
  				    // enter an integer
  
  int min = 1;
  cin  >> N >> K;
  int i = 1;
  while (i <= N) {
    if((min * 2  - min) < K){
      min *= 2;
    }else{
      min += K;
    }
    i++;
  }
  cout << min << endl;
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>

using namespace std;

int main()
{
	char s[101];
	cin >> s;
	int l;
	l = strlen(s);
	for (int i = 0; i < l; i++) {
		if (i % 2 == 0) {
			if (s[i]=='L') {
				cout << "No" << endl;
				return 0;
			}
		}
		else {
			if (s[i]=='R') {
				cout << "No" << endl;
				return 0;
			}
		}
	}

	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
a = 10**6
b = 0
for i in range(M):
    L, R = map(int, input().split())
    b = L if L>b else b
    a = R if R<a else a
if a-b+1>=0:
    print(a-b+1)
else:
    print(0)

Measured memory_bytes: 3060
#include<atcoder/all>
using namespace std;
using namespace atcoder;
int t,a,b;
int op(int a,int b){return max(a,b);}
int e(){return-1;}
bool f(int X){return b>X;}
main()
{
	int N,Q;
	cin>>N>>Q;
	vector<int>A(N);
	for(int&a:A)cin>>a;
	segtree<int,op,e>P(A);
	for(;Q--;)
	{
		cin>>t>>a>>b;
		if(t==1)P.set(a-1,b);
		else if(t==2)cout<<P.prod(a-1,b)<<endl;
		else cout<<P.max_right<f>(a-1)+1<<endl;
	}
}


Measured memory_bytes: 6180
#include <queue>
#include <string>
#include <iostream>

using namespace std;

struct PosRoute {
    int h;
    int w;
    int d;
};


int main() {
    int H {}, W {};
    cin >> H >> W;
    string A[H];
    for (int h=0; h<H; h++) {
        cin >> A[h];
    }

    // initialize first black positions
    queue<PosRoute> black_list {};
    int **f = new int*[H];
    for (int h=0; h<H; h++) {
        f[h] = new int[W];
        for (int w=0; w<W; w++) {
            if (A[h][w] == '#') {
                f[h][w] = true;
                black_list.push({h, w, 0});
            } else {
                f[h][w] = false;
            }
        }
    }

    int ans = 0;
    // expand black positions until all positions fill
    while (!black_list.empty()) {
        PosRoute pos = black_list.front();
        int h = pos.h;
        int w = pos.w;
        int d = pos.d;
        // up
        if (h-1 >= 0 && f[h-1][w] == false) {
            f[h-1][w] = true;
            black_list.push({h-1, w, d+1});
        }
        // down
        if (h+1 < H && f[h+1][w] == false) {
            f[h+1][w] = true;
            black_list.push({h+1, w, d+1});
        }
        // left
        if (w-1 >= 0 && f[h][w-1] == false) {
            f[h][w-1] = true;
            black_list.push({h, w-1, d+1});
        }
        // right
        if (w+1 < W && f[h][w+1] == false) {
            f[h][w+1] = true;
            black_list.push({h, w+1, d+1});
        }
        ans = d;
        black_list.pop();
    }

    cout << ans << endl;
}


Measured memory_bytes: 17296
#![allow(non_snake_case)]

use std::io;
use std::f64;

fn main() {
    let sin = io::stdin();
    let mut buf = String::new();
    sin.read_line(&mut buf).ok();
    let mut ws = buf.split_whitespace();
    let a: f64 = ws.next().unwrap().parse().unwrap();
    let b: f64 = ws.next().unwrap().parse().unwrap();
    let c: f64 = ws.next().unwrap().parse().unwrap();

    let t: f64 = c / 180.0 * f64::consts::PI;
    let h: f64 = b * f64::sin(t);
    let s: f64 = a * h / 2.0;
    
    // 余弦定理から
    // c = sqrt(a*a + b*b - 2abcosC)
    let _c = (a*a + b*b - 2.0*a*b*f64::cos(t)).sqrt();
    let l: f64 = a + b + _c;

    println!("{}\n{}\n{}", s, l, h);

}



Measured memory_bytes: 5192
/*********বিসমিল্লাহির রাহমানির রাহিম**********/

#include <bits/stdc++.h>
#define ll long long
#define PI 2 * acos(0)
#define MAX 3000000
#define MOD 10000007
#define all(x) (x).begin(), (x).end()
using namespace std;
/*................OMI.................*/

bool isPrime(ll n)
{
   if (n <= 1)
      return false;
   if (n <= 3)
      return true;

   if (n % 2 == 0 || n % 3 == 0)
      return false;

   for (ll i = 5; i * i <= n; i = i + 2)
      if (n % i == 0)
         return false;

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

ll lcm(ll a, ll b)
{
   ll g = gcd(a, b);
   ll ans = (a * b) / g;
   return ans;
}

/************MAIN_FUNCTION***********/

int main(int argc, char *argv[])
{
   int number_of_houses, parimeter;
   cin >> parimeter >> number_of_houses;

   int ara[number_of_houses];
   for (int i = 0; i < number_of_houses; i++)
      cin >> ara[i];

   int anti_clock_dis = (parimeter - ara[number_of_houses - 1]) + ara[0];

   int maximum = anti_clock_dis;

   for (int i = 0; i < number_of_houses - 1; i++)
   {
      if (ara[i + 1] - ara[i] > maximum)
         maximum = ara[i + 1] - ara[i];
   }

   cout << parimeter - maximum << endl;

   return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
template<typename T>
void print(T x) {
    cout << x << endl;
}
int main(void) {
    int a, b, k;
    cin >> a >> b >> k;
    int cnt = 0;
    for(int i=100;i>=1;i--) {
        if(a%i==0 && b%i==0) cnt++;
        if(cnt == k) {
            cout << i;
            return 0;
        }
    }
}


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


void solve(std::string s){
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == ',') {
            s[i] = ' ';
        }
    }
    cout << s << endl;
}

int main(){
    std::string s;
    std::cin >> s;
    solve(s);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi acos(-1.0)

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    if(a + b < 10){
        cout << a + b << "\n";
    }else{
        cout << "error" << "\n";
    }


    return 0;
}


Measured memory_bytes: 256
// ABC141A.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

//#include "pch.h"
#include <iostream>
#include <string>
using namespace std;
int main()
{
	string S;
	cin >> S;
	if (S=="Sunny")
	{
		cout << "Cloudy";
	}
	if (S=="Cloudy")
	{
		cout << "Rainy";
	}
	if (S=="Rainy")
	{
		cout << "Sunny";
	}
}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


Measured memory_bytes: 508
import math

a, b, h, m = map(int, input().split())
theta = abs(6 * m - ((h*60)+m)*0.5)
theta = min(360-theta, theta)
ans = math.sqrt(a**2 + b**2 - 2 * a * b * math.cos(math.radians(theta)))
print(ans)

Measured memory_bytes: 9504
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<iomanip>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
int main(){
  int a, b;
  cin >> a >> b;
  int c = a + b - 1;
  int d = a * b - c;
  cout << d << "\n";
}


Measured memory_bytes: 3612