akhauriyash/Code-Regression huggingface dataset:
//Dragon_warrior7(IITK)
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;
#define umap unordered_map
#define uset unordered_set
#define ll long long
#define lll long long
#define pb push_back
#define nl cout << '\n'
#define sor(x) sort(x.begin(), x.end())
#define rev(v) reverse(v.begin(), v.end())
#define lb(v, temp) lower_bound(v.begin(), v.end(), temp)
#define ub(v, temp) upper_bound(v.begin(), v.end(), temp)
#define fi first
#define se second
#define llmax 1000000000000000000
#define pll pair<ll, ll> 
#define ull unsigned ll
#define vll vector<ll> 
#define rub cout << "\n------------------------------------\n"
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
#define fo(i,a,b) for(int i=a;i<b;i++)
#define Lets_be_precise cout<<fixed<<setprecision(10)
//typedef  tree < int ,  null_type ,  greater<int> ,  rb_tree_tag ,  tree_order_statistics_node_update > oset;
// const int mod=1e9+7;
// ll power(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;}
// ll modInverse(ll a){return power(a,mod-2);}
ll n,m,a,b,c,k,temp,x,y;
const int MAXN=100000+11;
void read(vector<ll> &v)
{
	for (int i = 0; i < v.size(); i++)
	cin>>v[i];
}
//#define cerr if(false)cerr//uncomment to remove cerr from program...
void solveforthiscase(const int & test)
{//deb(test);
cin>>a>>b>>c;
cout<<c<<' '<<a<<' '<<b;











return ;
}

int main()
{
	ios_base::sync_with_stdio(false);
	Lets_be_precise;
	cin.tie(NULL);
	cout.tie(NULL);
	int test=1;
// 	cin>>test;
    for(int i=1;i<=test;i++)
    {
        solveforthiscase(i);
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	string str1,str2;
	cin>>str1>>str2;
	ll n=str1.length(),m=str2.length();
	ll dp[n+1][m+1];
	memset(dp,0,sizeof(dp));
	for(ll i=1;i<=n;i++)
	{
		for(ll j=1;j<=m;j++)
		{
			if(str1[i-1]==str2[j-1])
				dp[i][j]=1+dp[i-1][j-1];
			else
				dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
		}
	}
	string ans;
	ll i=n,j=m;
	while(i>0 && j>0)
	{
		if(str1[i-1]==str2[j-1])
		{
			ans+=str1[i-1];
			i--;j--;
		}
		else if(dp[i-1][j]>dp[i][j-1])
			i--;
		else
			j--;
	}
	reverse(ans.begin(),ans.end());
	cout<<ans;
}

Measured memory_bytes: 73836
#include<iostream>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<cctype>
#define szxb 210
using namespace std;
bool a[szxb];
signed main()
{
	memset(a,0,sizeof(a));char c;
	while((c=getchar())!=10){if(a[c]){puts("no");goto endreturn;}a[c]=1;}
	puts("yes");
	endreturn:return 0;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i, c) for(__typeof(c.begin()) i = c.begin(); i != c.end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main(int argc, char *argv[]) {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;

    vector<pair<char, int> > list;
    list.push_back(make_pair(' ', 0));
    rep(i, s.size()) {
        if (s[i] != s[i+1] || i == n - 1) {
            list.push_back(make_pair(s[i], i + 1));
        }
    }

    // REP(i, 1, list.size()) printf("list[%d] = (%c, %d, %d)\n", i, list[i].first, list[i].second - list[i-1].second, list[i].second);

    int ans = 0;
    REP (i, 1, list.size()) {
        int pos = list.size() - 1;
        if (list[i].first == '0') {
            if (i + 2*k-1 < (int)list.size()) pos = i + 2*k-1;
        } else {
            if (i + 2*k < (int)list.size()) pos = i + 2*k;
        }
        ans = max(ans, list[pos].second - list[i-1].second);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1528
#include <stdio.h>
 
int main(void)
{
    int n;
    int c[100];
    int v;
    int i, j;
     
    scanf("%d", &n);
     
    for (i = 0; i < n; i++){
        scanf("%d", &c[i]);
    }
     
    for (i = 1; i < n; i++){
        for (j = 0; j < n; j++){
            printf("%d", c[j]);
            if (j < n - 1){
                printf(" ");
            }
        }
        printf("\n");
        v = c[i];
        j = i - 1;
        while (j >= 0 && c[j] > v){
            c[j + 1] = c[j];
            j--;
        }
        c[j + 1]= v;
    }
     
    for (i = 0; i < n; i++){
        printf("%d", c[i]);
        if (i < n - 1){
            printf(" ");
        }
    }
    printf("\n");
    return (0);
}

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

namespace AtCoder.Abc
{
    class Q_A
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数配列の入力
            var inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();




            string result = ( inputLongArray[0] * inputLongArray[1]).ToString() ;

            Console.WriteLine(result);

            Console.Out.Flush();
        }

        class Global
        {

            public static string Left(string str, int len)
            {
                if (str == null || len <= 0)
                {
                    return "";
                }

                if (str.Length >= len && str.Length >= 0)
                {
                    return str.Substring(0, len);
                }
                else
                {
                    return str;
                }
            }


            public static string Right(string str, int len)
            {
                if (str.Length >= len && str.Length >= 0)
                {
                    return str.Substring(str.Length - len);
                }
                else
                {
                    return "";
                }
            }

            public static string Middle(string str, int Left, int Right)
            {
                if (str.Length >= 0)
                {
                    return str.Substring(Left - 1, (Right - Left) + 1);
                }
                else
                {
                    return "";
                }
            }



        }

    }


}


Measured memory_bytes: 28228
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define fs first
#define sc second
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
int main(){
  int n;
  cin>>n;
  vector<char>a(n);
  rep(i,n)cin>>a[i];
  set<char>b;
  rep(i,n)
  b.insert(a[i]);
  if(b.size()==4)
  cout <<"Four"<<endl;
  else cout<<"Three"<<endl;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
a=[]
for i in range(m):
    a.append(list(map(int,input().split())))
a.sort()
#print(a)
d=[]
for i in range(m):
    if a[i][0]==1:
        d.append(a[i][1])
    else:
        break
e=[]
for i in range(m):
    if a[i][1]==n:
        e.append(a[i][0])
if len(set(e) & set(d))!=0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')



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

int main(){
    string str;
    cin>>str;
    char comp[]="abcdefghijklmnopqrstuvwxyz";
    char *cp=comp;
    string::size_type ind;
    while(*cp!='\0'){
        ind=str.find(*cp);
        if(ind==string::npos){
            break;
        }
        cp++;
    }
    if(*cp=='\0'){
        cout<<"None"<<endl;
    }else{
        cout<<*cp<<endl;
    }
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#pragma GCC optimize ("O2")
#pragma GCC optimize ("unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const ld eps=1e-7;
const int inf=1000000010;
const ll INF=10000000000000010LL;
const int mod = 1000000007;
const int MAXN = 2010, LOG=20;

ll n, m, k, u, v, x, y, t, a, b, ans;
ll A[MAXN];
ll cnt[MAXN*2];
ll ps[MAXN*2];

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin>>n;
	for (int i=1; i<=n; i++) cin>>A[i], cnt[A[i]]++;
	for (int i=1; i<MAXN; i++) ans+=1ll*cnt[i]*(cnt[i]-1)*(cnt[i]-2)/6, ps[i]=ps[i-1]+cnt[i];
	for (int i=1; i<MAXN; i++) ans+=1ll*cnt[i]*(cnt[i]-1)/2*(ps[2*i-1]-cnt[i]);
	//debug(ans)
	for (int b=2; b<MAXN; b++) for (int c=b+1; c<2*b && c<MAXN; c++) ans+=1ll*cnt[b]*cnt[c]*(ps[b-1]-ps[c-b]);
	kill(ans)
	
	return 0;
}
/*
3
1 1 2

*/

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

using namespace std;
int main()
{
    int W, H, x, y, r;
    cin >> W >> H >> x >> y >> r;
    
    if (x + r <= W && x - r >= 0 && y + r <= H && y - r >= 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
        
}


Measured memory_bytes: 3116
use std::io::{self, Read};
fn main() {
    let mut input = String::new();
    io::stdin().read_to_string(&mut input).unwrap();
    let output = run(input);
    println!("{}", output);
}

fn run(input: String) -> String {
    let vec: Vec<&str> = input.split_whitespace().collect();
    let a: f64 = vec[0].parse().unwrap();
    let b: f64 = vec[1].parse().unwrap();
    let x = (a + b) / 2.0;
    x.ceil().to_string()
}

Measured memory_bytes: 4352
def ri():
    return int(input())


def rii():
    return [int(v) for v in input().split()]


def solve():
    N = ri()
    ans = ""
    
    while N:
        N, r = divmod(N - 1, 26)
        ans  = chr(ord("a") + r) + ans
        
    print(ans)

if __name__ == "__main__":
    solve()

Measured memory_bytes: 9096
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF= 1LL << 60;
#define REP(i,n) for(ll i=0; i<n; i++)
#define FOR(i,a,n) for(ll i=a; i<n; i++)
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> card(n);
    vector<ll> A(n+2);
    vector<ll> B(n+2);
    ll ans;

    REP(i,n){
        cin >> card[i];
        if(i==0)A[0]= card[0];
        else A[i]= A[i-1] +card[i];
    }
    A[0]= card[0];
    B[n-1]= card[n-1];
    for(int i=n-2; i>=0; i--){
        B[i]= B[i+1] +card[i];
    }
    // REP(i,n){
    //     cout << A[i]<<" "<<B[i] << endl; 
    // }
    ans= abs(A[0]- B[1]);
    FOR(i,1,n){
        ll tt=0;

        tt= abs(A[i-1]- B[i]);
        // cout << tt;
        if(ans>tt){
            ans= tt;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 4992
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;



int main(void){
  int a, b, c;
  cin >> a >> b >> c;
  int tmp = 4 * c - 2 * a - b;
  cout << a << " " << b << " " << 3 * c - a - b << endl;
  cout << tmp << " " << c << " " << 2 * c - tmp  << endl;
  cout << a + b - c << " " << 2 * c - b << " " << 2 * c - a << endl;
}


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

struct edge {
	long long from;
	long long to;
	long long cost;
};

int main() {
	long long N, M, P, INF = 1000000000;
	static long long Dist[2500] = {};
	bool visitA[2500] = {}, visitB[2500] = {};
	vector<edge> VE;
	cin >> N >> M >> P;
	visitA[0] = true;
	visitB[N - 1] = true;
	for (int i = 0; i < N; i++) Dist[i] = INF;
	Dist[0] = 0;
	for (int i = 0; i < M; i++) {
		long long A, B, C;
		cin >> A >> B >> C;
		A--, B--;
		edge NE;
		NE.from = A, NE.to = B, NE.cost = P-C;
		VE.push_back(NE);
	}
	for (int i = 0; i < N; i++) {
		for (edge E : VE) {
			if (visitA[E.from]) visitA[E.to] = true;
			if (visitB[E.to]) visitB[E.from] = true;
		}
	}
	for (int i = 0; i < N; i++) {
		for (edge E : VE) {
			if (Dist[E.to] > Dist[E.from] + E.cost) {
				Dist[E.to] = Dist[E.from] + E.cost;
				if (i == N - 1 && visitA[E.from] && visitA[E.to] && visitB[E.from] && visitB[E.to]) {
					cout << -1 << endl;
					return 0;
				}
			}
		}
	}
	cout << max(0LL, -Dist[N - 1]) << endl;
}


Measured memory_bytes: 576
using System;

namespace First
{
    class Program
    {
        static void Main(string[] args)
        {
            string data = Console.ReadLine();
            int data2 = Int32.Parse(data) % 10;
            switch(data2)
            {
                case 3:
                    Console.WriteLine("bon");
                    break;
                case 0:
                case 1:
                case 6:
                case 8:
                    Console.WriteLine("pon");
                    break;
                default:
                    Console.WriteLine("hon");
                    break;
            }
        }
    }
}


Measured memory_bytes: 27436
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

int main(void) {
    Int X;
    cin>>X;
    Int y = 1;
    Int ans = 100;
    for(;ans < X;y++) {
        ans *= 1.01;
    }

    cout<<y-1<<endl;

    return 0;
}


Measured memory_bytes: 3116
import java.util.Scanner;

// Problema atcoder

public class Main {


	public static void main(String args[])  {
		
		String s;
		int n;
		
		
		
		Scanner input = new Scanner(System.in);
		
		n = input.nextInt();
		
		long total = n + (n*n) + (n*n*n);
		
		
	    input.close();
	    
		System.out.println( total);
	
}
}

















Measured memory_bytes: 35756
#include <bits/stdc++.h> 
using namespace std; 
int main()
{
	int a,cnt=0;
	string b;
	char now='A';
	cin>>a>>b;
	for (int i=0;i<a;i++)
		if (b[i]!=now)
		{
			cnt++;
			now=b[i];
		}
	cout<<cnt;
	return 0;
}


Measured memory_bytes: 512
#include<iostream>

using namespace std;

#define HMAX 10

int main(){

	int H;
	int puzz[HMAX][5];
	bool lf,ff;
	int cnt,bef;
	int score;

	while(1){
		cin>>H;
		if(H==0) break;
		for(int i=0;i<H;i++){
			for(int j=0;j<5;j++){
				cin>>puzz[i][j];
			}
		}
		score=0;
		while(1){
			lf=false;
			for(int i=0;i<H;i++){
				bef=puzz[i][0];
				cnt=1;
				for(int j=1;j<6;j++){
					if(j!=5&&bef==puzz[i][j]) cnt++;
					else if(cnt<3||bef==-1){
						cnt=1;
						bef=puzz[i][j];
					}
					else{
						for(int k=j-cnt;k<j;k++){
							puzz[i][k]=-1;
						}
						score+=bef*cnt;
						lf=true;
						break;
					}
				}

			}
			if(!lf) break;
			while(1){
				ff=false;
				for(int i=0;i<H-1;i++){
					for(int j=0;j<5;j++){
						if(puzz[i+1][j]==-1&&puzz[i][j]!=-1){
							puzz[i+1][j]=puzz[i][j];
							puzz[i][j]=-1;
							ff=true;
						}
					}
				}
				if(!ff) break;
			}
		}
		cout<<score<<endl;
	}
}

Measured memory_bytes: 1160
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

int main()
{
	int n, m;
	cin >> n >> m;

	vector<string> a(n), b(m);
	for(int i=0; i<n; ++i)
		cin >> a[i];
	for(int i=0; i<m; ++i)
		cin >> b[i];

	for(int sy=0; sy<=n-m; ++sy){
		for(int sx=0; sx<=n-m; ++sx){
			bool ok = true;
			for(int y=0; y<m; ++y){
				for(int x=0; x<m; ++x){
					if(a[sy+y][sx+x] != b[y][x])
						ok = false;
				}
			}
			if(ok){
				cout << "Yes" << endl;
				return 0;
			}
		}
	}

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

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

using namespace std;

typedef long long ll;

int l[100005];
int dp[100005];
int n;

void solve() {
  cin >> n;
  for(int i = 0; i < n; i++) {
    cin >> l[i];
    dp[i+1] = 1e9;
  }
  for(int i = 0; i < n; i++) {
    for(int j = 1; j <= 2 && i+j < n; j++) {
      dp[i+j] = min(dp[i+j], dp[i] + abs(l[i] - l[i+j]));
    }
  }
  cout << dp[n-1] << endl;
}

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


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n) for (ll(i) = 0; (i) < (n); (i)++)
#define all(x) (x).begin(), (x).end()
#define print(x) cout << (x) << endl;

typedef long long ll;
const ll INF = 99999999999999;
const ll MOD = 1000000007;
const double PI = acos(-1.0);

using namespace std;

int main()
{
    int n, m;
    string ans = "Yes";
    cin >> n >> m;
    if (n != m)
    {
        ans = "No";
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
#include<queue>
#include<stack>
#include<math.h>
#include<map>
typedef long long int ll;
using namespace std;
#define maxn 0x3f3f3f3f

int main()
{
    int n;
    map<int,int>vis;
    while(~scanf("%d",&n))
    {
        int a;
        int acm=1;
        vis.clear();
        for(int i=1;i<=n;i++)
        {
            scanf("%d",&a);
            if(vis[a])
                acm=0;
            vis[a]=1;
        }
        if(acm)
            printf("YES\n");
        else
            printf("NO\n");
    }
}


Measured memory_bytes: 9600
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <queue>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

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

int gcd(int a, int b){
   int tmp;
   while(a%b==0){
      tmp=a%b;
      a=b;
      b=tmp;
   }
}

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

bool prime_number(int n){
   if(n < 2){
      return false;
   }
   else if(n == 2){
      return true;
   }
   if(n % 2 == 0){
      return false;
   }
   for(int i=3;i<=n/i;i+=2){
      if(n % i == 0) return false;
      return true;
   }
}

int main(){
   string s;
   getline(cin,s);
   REP(i,s.size()){
      if(s[i]>='a'&&s[i]<='z') s[i]+=('A'-'a');
   }
   cout << s << endl;
}

Measured memory_bytes: 1176
#include<iostream>
using namespace std;
int main(){
    int a;
    int b;
    cin >>a >>b;
    if (a<b) cout << "a < b" << endl;
    if (a==b) cout << "a == b" << endl;
    if (a > b) cout << "a > b" << endl;
    
    return 0;
    
    
}


Measured memory_bytes: 3084
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#define INF 0x3f3f3f3f
const int MOD=1e9+7;
const double eps=1e-8;
typedef long long ll;
//orz yht
using namespace std;
int n;
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
    cin>>n;
    for(int i=1;i<=9;i++)
    for(int j=1;j<=9;j++)
    if(i*j==n){
    	cout<<"Yes";
		return 0; 
	}
	cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#B - Ordinary Number(ABC132)
n=int(input())
P=list(map(int, input().split()))
C=0
for i in range(n-2):
    A=[P[i],P[i+1],P[i+2]]
    if A[1]!=max(A) and A[1]!=min(A):
        C+=1
print(C)

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n;
    cin>>n;
    ll a[n+1];
    for(int i=1;i<=n;i++)
        cin>>a[i];
    a[0]=1000000000;
    
    ll dp[n+1];
    dp[1]=0;
    for(ll i=2;i<=n;i++)
        dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
    cout<<dp[n]<<endl;
    
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define ld long double
#define vi vector<vector<ll> >
using namespace std;
const int MOD=1000000007;
const int MOD2=998244353;
const ll MAX=9187201950435737471;
const int N=100005;
const int INF=1e9;
const long double PI=acos(-1);



void solve(int T){
    int a,b;
    cin>>a>>b;
    string s="",m="";
    for(int i=0;i<a;i++){
        s+=b+'0';
    }
    for(int i=0;i<b;i++){
        m+=a+'0';
    }
    cout<<min(s,m)<<"\n";
}

int main() {
    //fastio

    int T=1;
    //cin>>T;
    for(int i=1;i<=T;i++){
        solve(i);
        //if(i<T)cout<<"\n";
    }
    return 0;
}


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

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

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

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

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

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

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

  vector<int> A(3);
  rep(i, 3) cin >> A[i];

  std::sort(A.begin(), A.end());
  int answer {};
  srep(i,1,3) {
    answer += A[i] - A[i-1];
  }
  cout << answer << '\n';
}


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

int main(){
    int n;
    cin>>n;
    vector<int> a(n+1);
    REP(i,n){
        cin>>a[i];
    }
    map<int,int> mp;
    map<int,int> pm;
    REP(i,n){
        mp[-a[i]-i]+=1;
    }
    ll ans  = 0;
    for(int i=n;i>0;i--){
        mp[-a[i]-i] -=1;
        int t = mp[a[i]-i];
        ans+=t;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 20992
#include <stdio.h>

int main()
{
	long long H, W;
	scanf("%lld %lld", &H, &W);
	if (H % 3 == 0 || W % 3 == 0) {
		printf("0\n");
		fflush(stdout);
		return 0;
	}

	long long min = (H < W)? H: W;
	if ((H + 1) / 2 * (W - W / 3) - H * (W / 3) < min) min = (H + 1) / 2 * (W - W / 3) - H * (W / 3);
	if ((W + 1) / 2 * (H - H / 3) - W * (H / 3) < min) min = (W + 1) / 2 * (H - H / 3) - W * (H / 3);
	if (H * (W / 3 + 1) - (H / 2) * (W - W / 3 - 1) < min) min = H * (W / 3 + 1) - (H / 2) * (W - W / 3 - 1);
	if (W * (H / 3 + 1) - (W / 2) * (H - H / 3 - 1) < min) min = W * (H / 3 + 1) - (W / 2) * (H - H / 3 - 1);

	printf("%lld\n", min);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using ll = long long;
const ll MOD = 1000000007;
#define rep(i,n) for (ll i=0; i < (n); i++)
using namespace std;
int get_gcd(int a, int b) {
  while(1) {
    if (a < b) swap(a, b);
    if (b == 0) return a;
    a %= b;
  }
}
int get_lcm(int a, int b){return a * b / get_gcd(a, b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

ll dp[100001][13];

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

  if (s[0] != '?') {
    dp[1][s[0] - '0'] = 1;
  }
  else {
    rep(j,10) {
      dp[1][j] = 1;
    }
  }

  for (int i = 1; i < s.size(); i++) {
    rep(j,13) {
      if (s[i] != '?') {
        const int next_j = (10*j + s[i] - '0')%13;
        dp[i+1][next_j] = dp[i][j];
      }
      else {
        rep(k,10) {
          const int next_j = (10*j + k)%13;
          dp[i+1][next_j] += dp[i][j];
          dp[i+1][next_j] %= MOD;
        }
      }
    }
  }

  cout << dp[s.size()][5] << endl;

  return 0;
}


Measured memory_bytes: 10624
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <map>
#include <math.h>

using namespace std;

int main()
{
	int A, B, T, ans;
	cin >> A >> B >> T;
	ans = (T + 0.5) / A;
	cout << ans * B << endl;
}

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

const int nax = 405;
const ll INF = 1e18L + 5; // 10^18+5
ll dp[nax][nax];
// dp[i][j] - the minimum total cost of combining interval [i,j] into one vertex
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);

    // all the code goes here
    int n;
    scanf("%d", &n);
    vector<int> a(n);
    for(int& x : a) {
        scanf("%d", &x);
    }
    auto sum = [&](int L, int R) {
        ll s = 0;
        for(int i = L; i <= R; ++i) {
            s += a[i];
        }
        return s;
    };
    for(int L = n - 1; L >= 0; --L) {
        for(int R = L; R < n; ++R) {
            if(L == R) {
                dp[L][R] = 0;
            }
            else {
                dp[L][R] = INF;
                ll s = sum(L, R);
                for(int i = L; i < R; ++i) {
                    dp[L][R] = min(dp[L][R], dp[L][i] + dp[i+1][R] + s);
                }
            }
        }
    }
    
    printf("%lld\n", dp[0][n-1]);

    return 0;
}

Measured memory_bytes: 1536
from collections import deque

N = int(input())

V = list(map(int, input().split(" ")))

V.sort()

V_deque = deque(V)

while len(V_deque) > 1:
    V1 = V_deque.popleft()
    V2 = V_deque.popleft()

    V_deque.append((V1 + V2)/2)

    V_list = list(V_deque)
    V_list.sort()
    V_deque = deque(V_list)

print(V_deque.popleft())

Measured memory_bytes: 3316
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>
#include <random>

#define FOR_LT(i, beg, end) for (int i = (int)(beg); i < (int)(end); i++)
#define FOR_LE(i, beg, end) for (int i = (int)(beg); i <= (int)(end); i++)
#define FOR_DW(i, beg, end) for (int i = (int)(beg); (int)(end) <= i; i--)
#define REP(n)              for (int repeat_index = 0; repeat_index < (int)n; repeat_index++)


using namespace std;
template<int64_t M = 1000000007>
class ModInt {
public:
	ModInt() : val_(0) {};

	ModInt(int64_t val) {
		this->val_ = val;
		this->val_ %= M;
		while (this->val_ >= M) this->val_ -= M;
		while (this->val_ < 0)  this->val_ += M;
	}

	operator int64_t() const {
		return this->val_;
	}

	ModInt& operator += (int64_t val) {
		this->val_ += val;
		this->val_ %= M;
		while (this->val_ >= M) this->val_ -= M;
		while (this->val_ < 0) this->val_ += M;

		return *this;
	}

	ModInt& operator -= (int64_t val) {
		this->val_ -= val;
		this->val_ %= M;
		while (this->val_ >= M) this->val_ -= M;
		while (this->val_ < 0) this->val_ += M;

		return *this;
	}

	ModInt& operator *= (int64_t val) {
		this->val_ *= val;
		this->val_ %= M;

		return *this;
	}

	ModInt& operator /= (int64_t val) {
		ModInt v = ModInt::pow(val, M - 2);
		*this *= v;

		return *this;
	}

	ModInt operator + (int64_t v) const {
		ModInt ret = *this;
		return (ret += v);
	}

	ModInt operator - (int64_t v) const {
		ModInt ret = *this;
		return (ret -= v);
	}

	ModInt operator * (int64_t v) const {
		ModInt ret = *this;
		return (ret *= v);
	}

	ModInt operator / (int64_t v) const {
		ModInt ret = *this;
		return (ret /= v);
	}

	static ModInt pow(ModInt n, int64_t m) {
		if (m == 0) {
			ModInt ret(1);
			return ret;
		}
		if (m == 1) {
			return n;
		}

		ModInt v = pow(n, m / 2);
		ModInt ret = v * v;
		if (m & 1) {
			ret *= n;
		}
		return ret;
	}

	ostream& operator << (ostream& out) {
		out << this->val_;
		return out;
	}

private:
	int64_t val_;
};
static const int64_t kRem = 998244353;

ModInt<kRem> dp[3001][3001][2];

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(20);

	int a, b, c, d; cin >> a >> b >> c >> d;

	dp[a][b][0] = 1;
	dp[a][b][1] = 0;
	FOR_LE(i, a, c) {
		FOR_LE(j, b, d) {
			if (i == a && j == b) continue;

			if (i == a) {
				dp[i][j][0] = dp[i][j-1][0] * (int64_t)(i);
				continue;
			}
			if (j == b) {
				dp[i][j][0] = dp[i-1][j][0] * (int64_t)j;
				continue;
			}

			dp[i][j][0] = (dp[i - 1][j][0] + dp[i - 1][j][1]) * (int64_t)(j);
			dp[i][j][1] = (dp[i][j - 1][0] + dp[i][j - 1][1]) + dp[i][j - 1][1] * (int64_t)(i - 1);
		}
	}

	cout << (dp[c][d][0] + dp[c][d][1]) << endl;

	return 0;
}

Measured memory_bytes: 144332
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef vector<int> vi;
const int inf = 1e9+7;
const int INF = 1e18+7;
const int mod = 1e9+7;

int a[1000000];
signed main(){
	int n;
	scanf("%lld", &n);
	rep(i,n)scanf("%lld", &a[i]);
	rep(i,n){
		if(a[i] > i){
			printf("-1\n");
			return 0;
		}
	}
	
	int ans = 0, p = 0;
	rep(i,n){
		if(p+1 < a[i]){
			printf("-1\n");
			return 0;
		}
		if(p+1 == a[i]){
			ans++;p++;
			continue;
		}
		ans += a[i];
		p = a[i];
	}
	printf("%lld\n", ans);
	return 0;
}




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

// 小数点以下桁数
// fixed << setprecision(i)

int64_t gcd(int64_t a,int64_t b){return (a%b==0?b:gcd(b, a%b));}
int64_t lcm(int a,int b){return (int64_t)a*b/gcd(a, b);}
int factorial(int a){int b=1;while(a){b*=a--;}return b;} //13以下対応
bool is_prime(int a){if(a<=1)return false;for(int i=2;(int64_t)i*i<=a;i++){if(a%i==0)return false;}return true;}
int get_adp(double x, int n){return (int)round((x-(int)x)*pow(10,n))%10;} // 小数点以下の指定桁の値を取得
int64_t sigma(int64_t s, int64_t n){return n*(2*s+n-1)/2;}

//順列の全列挙
// vector<int> v(N);
// iota(v.begin(), v.end(), 1);       // v に 1, 2, ... N を設定
// do {
//	for(auto x : v) cout << x << " "; cout << "\n";     // v の要素を表示
// } while( next_permutation(v.begin(), v.end()) ); 

//bit全探索
// for (int tmp = 0; tmp < (1 << ビット数); tmp++) {
//	bitset<ビット数> s(tmp);
//	// (ビット列sに対する処理)
// }

int main()
{
  int64_t x, k, d, ans;
  cin >> x >> k >> d;
  if (abs(x) / d > k)
  {
    if (x > 0)
      ans = x - k * d;
    else
      ans = abs(x + k * d);
  }
  else
  {
    if ((k - abs(x) / d) % 2 == 0)
      ans = abs(x) % d;
    else
      ans = abs(abs(x) % d - d);
    // ans = min(abs(x) % d, abs(abs(x) % d - d));
  }
  cout << ans << endl;
  
}


Measured memory_bytes: 3672
/*
  AtCoder Beginner Contest 105
  A - AtCoder Crackers
*/

#include<iostream>
using namespace std;

int N, K;

int main() {
  scanf("%d%d", &N, &K);
  if (N % K == 0) printf("0\n");
  else printf("1\n");
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
//using namespace boost::multiprecision;
typedef long long int ll;
typedef long double ld;
#define MOD 1000000007
#define ALL(obj) (obj).begin(),(obj).end()
template<class T>inline bool chmax(T& a,T b){if (a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T& a,T b){if (a>b){a=b;return 1;}return 0;}
const long long INF = 1LL << 60;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
bool pairCompareSecond(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.second < secondElof.second;
}
//四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

struct edge{//グラフに使うヤツ
    ll from,to,cost;
};

typedef vector<vector<edge> > G;
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}


int main(){
    ll n;
    cin >> n;
    ll a[n],ans=1;
    for (ll i=0;i<n;i++){
        cin >> a[i];
    }
    ll f=-1;
    for (ll i=1;i<n;i++){
        if (a[i-1]==a[i])continue;
        if (a[i-1]>a[i]){
            if (f==-1){
                f=1;
                continue;
            }
            if (f==0){
                f=-1;
                ans++;
                continue;
            }
        }
        if (a[i-1]<a[i]){
            if (f==-1){
                f=0;
                continue;
            }
            if (f==1){
                f=-1;
                ans++;
                continue;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4388
N, K = map(int, input().split())
count = 0
E = 0
for i in range(N):
    count = 0
    while i+1 <= K-1:
        count += 1
        i = 2*i + 1
    E += (1/N)* (1/2)**count
if E <= 1:
    print(E)
else:
    print("1")

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

#define MAX_N 1000

int N, T, A;
int H[MAX_N];

int main() {
  std::cin >> N >> T >> A;
  for(int i = 0; i < N; ++i) {
    std::cin >> H[i];
  }

  int ans = 0;
  double ansDiff = std::abs(A - (T - H[0] * 0.006));
  for(int i = 1; i < N; ++i) {
    double diff = std::abs(A - (T - H[i] * 0.006));
    if(ansDiff > diff) {
      ans = i;
      ansDiff = diff;
    }
  }

  std::cout << ans + 1 << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>

int main() {
    char s[102], t[102], a[102], b[102];
    scanf("%s\n%s", s, t);
    sprintf(a, "%101s", s);
    sprintf(b, "%101s", t);
    int ret = strcmp(a, b);
    puts(ret > 0 ? "GREATER" : ret < 0 ? "LESS" : "EQUAL");
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
void solve(){
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	if(b>0&&d>0){
		cout<<max(a*c,b*d)<<"\n";
	}else if(a<0&&c<0){
		cout<<a*c<<"\n";
	}else{
		cout<<max(b*c,d*a)<<"\n";
	}
}
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	long t=1;
//	cin>>t;
	while(t--)
		solve();
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
#define ALL(a)  (a).begin(),(a).end()
const ll INF = 1e18+18;
const ll MAX = 200000;
const ll MOD = 1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
static const double pi = 3.141592653589793;


int main(){
    long double A, B;
    cin>>A>>B;
    long double H, M;
    cin>>H>>M;
    long double Small=M/30;
    long double Big=H/6+M/360;
    long double Dif=abs(Big-Small);
    long double CC=A*A+B*B-2*A*B*cos(Dif*pi);
    CC=sqrt(CC);
    cout<<setprecision(15)<<CC<<endl;
    return 0;

}

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

int main(){
  int a;
  int b;
  int c;
  int d;
  
  cin >> a;
    b=a/100;
    c=a%100/10;
    d=a%100%10;
  
  cout << b+c+d << endl;
}

Measured memory_bytes: 256
n = int(input())

ab = [list(map(int, input().split())) for _ in range(n)]

ab.sort(key=lambda x: x[1])

s = 0

flag = True

for a, b in ab:
    s += a
    if s > b:
        flag = False
        break

if flag:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 115944
#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define UNIQUE(v) { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); }
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) { cerr << "[DEBUG] " #q ": ["; REP(i, (q).size()) { cerr << (q)[i] << (i == i_len-1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; }
template<class T> T gcd(const T &a, const T &b) { return a < b ? gcd(b, a) : b ? gcd(b, a % b) : a; }
template<class T> T lcm(const T &a, const T &b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
#define DANCE_ long
#define ROBOT_ unsigned
#define HUMAN_ signed
#define CHOKUDAI_ const
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using cll = DANCE_ DANCE_ CHOKUDAI_;
using  ld = long double;
using namespace std;

// モジュール


// 処理内容
int main() {
    
    ll n; cin >> n;

    switch (n) {
        case 3:
            cout << "2 5 63\n";
            return 0;
        case 4:
            cout << "2 5 20 63\n";
            return 0;
    }
    
    vector<ll> ans; ans.reserve(30010);

    ll tmod = n % 2 ? 3 : 0;
    ll gn = min(10000LL, (n+1) / 2);
    if (gn % 2) gn--;
    ll kn = n - gn;
    while (kn % 4 != tmod) {
        gn--;
        kn++;
    }

    for (ll i = 3; kn > 0; kn--, i += 3) {
        ans.push_back(i);
    }
    for (ll i = 2; gn > 0; i += 2) {
        if (i % 3 == 0) continue;
        gn--;
        ans.push_back(i);
    }
    
    sort(ALL_OF(ans));
    REP(i, ans.size()) {
        cout << ans[i] << " \n"[i == i_len-1];
    }

    // cerr << endl;
    // DUMP(n);

    // DUMP(kn);
    // DUMP(gn);
    
    // ll gcdall = accumulate(ALL_OF(ans), ans[0],
    //     [](ll a, ll b) -> ll { return gcd(a, b); });
    // DUMP(gcdall);
    // ll sum = accumulate(ALL_OF(ans), 0LL);
    // DUMP(sum % 6);
    // ll ansmax = ans.back();
    // DUMP(ansmax);
    // if (gcdall != 1 || sum % 6 != 0 || ansmax > 30000) {
    //     cerr << "FAIL!!!" << endl;
    // }

}

Measured memory_bytes: 512
#include <cstdio>
#include <algorithm>

using namespace std;

typedef long long ll;

int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    //freopen("debug.txt", "w", stderr);

    ll N, M;

    scanf("%lld %lld", &N, &M);

    if (N * 2 < M) {
        ll remC = M - (N * 2);

        printf("%lld\n", N + remC / 4);
    } else {
        printf("%lld\n", min(N, M / 2));
    }

    return 0;
}


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

int main(){
    double a,b,C;
    cin>>a>>b>>C;
    double PI=acos(-1);
    double radC=C*PI/180;
    double S=a*b*sin(radC)/2;
    double L=sqrt(a*a+b*b-2*a*b*cos(radC))+a+b;
    double h=b*sin(radC);
    printf("%.8f\n%.8f\n%.8f\n",S,L,h);
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define lli long long int
using namespace std;

const int maxN = 1e5 + 1; int sSize, tSize;
char s[maxN], t[maxN];
int letterCnt[26][maxN];
int required[26];

int main()
{
  while (scanf("%s %s", s, t) != EOF)
  {
    // printf("%s || %s\n", s, t);
    getchar();
    memset(letterCnt, 0, sizeof(letterCnt)), memset(required, 0, sizeof(required));
    sSize = strlen(s), tSize = strlen(t);

    for (int i = 0; i < sSize; i ++)
    {
      if (i) for (int j = 0; j < 26; j ++) letterCnt[j][i] = letterCnt[j][i - 1];
      letterCnt[s[i] - 'a'][i] ++;
    }
    for (int i = 0; i < tSize; i ++) required[t[i] - 'a'] ++;

    bool can = true;
    for (int i = 0; i < 26; i ++)
      if (required[i] && !letterCnt[i][sSize - 1])
        can = false;
    if (!can) printf("-1\n");
    else
    {
      lli ans = 0; int at = 0;
      for (int i = 0; i < tSize; i ++)
      {
        int target = at == 0 ? 1 : letterCnt[t[i] - 'a'][at - 1] + 1;
        int pos = lower_bound(letterCnt[t[i] - 'a']+at, letterCnt[t[i] - 'a']+sSize, target) - letterCnt[t[i] - 'a'];
        if (pos == sSize)
        {
          ans += (sSize - at); at = 0;
          pos = lower_bound(letterCnt[t[i] - 'a']+at, letterCnt[t[i] - 'a']+sSize, 1) - letterCnt[t[i] - 'a'];
        }
        ans += (pos - at + 1); at = pos + 1;
        if (pos == sSize) ans ++, at = 0;
      }
      printf("%lld\n", ans);
    }
  }

  return(0);
}

Measured memory_bytes: 10624
from bisect import bisect_right

N, D, A = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]

X.sort()
place = []
hps = []
for x, h in X:
    place.append(x)
    hps.append(h)

buf = [0] * (N + 2)
ans = 0
for i in range(N):
    # Update
    buf[i + 1] += buf[i]

    # Calc count
    tmp = -(-max(0, hps[i] - buf[i + 1] * A) // A)
    ans += tmp

    # Calc range
    j = bisect_right(place, place[i] + D * 2)
    buf[i + 1] += tmp
    buf[min(j + 1, N + 1)] -= tmp

print(ans)


Measured memory_bytes: 139820
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  string s;
  cin >> s;
  if(s[2] == s[3] && s[4] == s[5])cout<<"Yes"<<endl;
  else cout<<"No" <<endl;
  return 0;
}

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

int n;
ll dp[N];

int main() {
    cin.sync_with_stdio(0); cin.tie(0);
    cin >> n;
    for (int i = 1; i < N; i++) {
        dp[i] = dp[i - 1] + 1;
        for (int x = 1; i - (int)(pow(6, x) + 0.5) >= 0; x++) {
            dp[i] = min(dp[i], dp[i - (int)(pow(6, x) + 0.5)] + 1);
        }

        for (int x = 1; i - (int)(pow(9, x) + 0.5) >= 0; x++) {
            dp[i] = min(dp[i], dp[i - (int)(pow(9, x) + 0.5)] + 1);
        }
    }

    cout << dp[n];
}



Measured memory_bytes: 1024
#include <cstdio>
#include <vector>
#include <tuple>

int n;
std::vector<std::vector<int> > G;

constexpr int mod = 1000000007;

int dp[100000];

std::pair<int, int> dfs(int p, int x){
  long long int s = 1;
  long long int t = 1;
  for(int y: G[x]){
    if(y == p) continue;
    int a, b;
    std::tie(a, b) = dfs(x, y);
    s = s * (a + b) % mod;
    t = t * a % mod;
  }
  return {s, t};
}

int main(){
  scanf("%d", &n);
  G.resize(n);
  for(int i = 0; i < n-1; i++){
    int x, y;
    scanf("%d%d", &x, &y);
    G[x-1].push_back(y-1);
    G[y-1].push_back(x-1);
  }

  int a, b;
  std::tie(a, b) = dfs(-1, 0);
  printf("%d\n", (a+b) % mod);
  return 0;
}


Measured memory_bytes: 12672
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

int main() {
  int n;
  cin >> n;
  vector<int> ps(n, 0);
  rep(i, n) { cin >> ps[i]; }
  int ans = 0;
  int m = ps[0];
  rep(i, n) {
    if (ps[i] == m) {
      ans++;
    }
    if (i != n - 1) {
      m = min(m, ps[i + 1]);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4020
m = 55555

p = [True] * m
for i in range(3, m):
    if not p[i]:
        continue
    for j in range(2, m):
        if j * i >= len(p):
            break
        p[i*j] = False

n = int(input())
if n <= 5:
    t = [2, 3, 5, 7, 11]
    print(" ".join([str(a) for a in t[:n]]))
else:
    ans = []
    for i in range(m):
        if len(ans) == n:
            break
        t = i*5+7
        if not p[t]:
            continue
        ans.append(t)
    print(" ".join([str(a) for a in ans]))


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

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

    int k, x; cin >> k >> x;
    for (int i = x-k+1; i <= x+k-1; i++) {
        cout << i << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import sys
input=sys.stdin.readline
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[0]*n
for i in range(1,n):
  kk=max(i-k,0)
  dp[i]=min(d+abs(hh-h[i])for d,hh in zip(dp[kk:i],h[kk:i]))
print(dp[n-1])

Measured memory_bytes: 14016