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

int main() {
  int n,m;
  int a,b;
  cin >> n >> m;
  int l=1,r=n;
  for(int i=0;i<m;i++){
    cin >> a >> b;
    if(l<a)l=a;
    if(r>b)r=b;
  }
  int res=r-l+1;
  if(res<0)res=0;
  cout << res << endl;
}


Measured memory_bytes: 256
//
// Created by yamunaku on 2019/08/30.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> mti;
typedef vector<ll> vl;
typedef vector<vector<ll>> mtl;

int main(){
    int n;
    ll aa;
    cin >> n >> aa;
    vl a(n);
    rep(i,n) cin >> a[i];
    ll ans=LINF;
    vl rui(n+1);
    rui[0]=0;
    repl(i,1,n+1) rui[i]=rui[i-1]+a[i-1];
    int s=1;
    if(n>2000) s=10;
    repl(i,s,n+1){
        ll tmp=aa*i+2*(rui[n]-rui[n-i]);
        int k=1;
        for(int j=n;j>0;j-=i){
            tmp+=(rui[j]-rui[max(j-i,0)])*(2*k+1);
            k++;
        }
        ans=min(ans,tmp);
    }
    cout << ans+aa*n << endl;
    return 0;
}


Measured memory_bytes: 3328
#include<queue>
#include<cctype>
#include<cstdio>
using namespace std;
const int maxn=800,dir[4][2]={0,1,1,0,0,-1,-1,0};
bool a[maxn+10][maxn+10]; int stx,sty,n,m,k,ans=1e9;
struct node{int x,y,d;}; queue<node> q;
void work(int x){ans=min(ans,(x-1)/k+2);}
int main(){
	scanf("%d%d%d",&n,&m,&k);
	for(int i=1;i<=n;++i)
		for(int j=1;j<=m;++j){
			char c=getchar(); for(;!isgraph(c);c=getchar()); 
			if(c=='S') q.push((node){i,j,k}),a[i][j]=1;
			else if(c=='#') a[i][j]=1;
		}
	for(;!q.empty();q.pop()){
		node x=q.front(); 
		if(x.x==1||x.x==n||x.y==1||x.y==m) ans=1;
		else{
			work(x.x-1); work(n-x.x); work(x.y-1); work(m-x.y);
		}
		if(x.d) for(int i=0;i<4;++i){
			node e=(node){x.x+dir[i][0],x.y+dir[i][1],x.d-1};
			if(e.x<=0||e.x>n||e.y<=0||e.y>m||a[e.x][e.y]) continue;
			a[e.x][e.y]=1; q.push(e);
		}
	}
	printf("%d",ans); 
}

Measured memory_bytes: 896
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace mondai0009
{
	class Program
	{
		static void Main(string[] args)
		{
			bool[]	prime	= new bool[ 1000000 ];
			for( int i = 1; i < 1000000; i++ ) {
				if( is_prime( i ) ) {
					prime[ i ]	= true;
				}
			}


			while( true ) {
				var	s	= Console.ReadLine();
				if( s == null ) {
					break;
				}
				var	n	= int.Parse( s );

				int	cnt	= 0;
				for( int i = 1; i <= n; i++ ) {
					if( prime[ i ] ) {
						cnt++;
					}
				}
				Console.WriteLine( cnt );
			}
		}


		// 素数判定
		static bool is_prime( int n )
		{
			if( n <= 1 ) {
				return( false );
			} else if( n <= 3 ) {
				return( true );
			} else if( (n % 2) == 0 ) {
				return( false );
			} else {
				for( int i = 3; i <= (int)Math.Sqrt( n ); i += 2 ) {
					if( (n % i) == 0 ) {
						return( false );
					}
				}
			}
			return( true );
		}

	}
}

Measured memory_bytes: 6560
#include <bits/stdc++.h>
using namespace std;
struct iofix
{
   ios_base::Init i;
   iofix() {
      cin.sync_with_stdio(0);
      cin.tie(0);
      cout.sync_with_stdio(0);
      cout.tie(0);
      cout.precision(10);
      cout << fixed;
   }
} iofix;

void solve(){
	double  D, T, S; cin >> D >> T >> S;
	if(D / S <= T)
		cout << "Yes";
	else 
		cout << "No";
}

int main(){


   	solve();

#ifndef Time
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
   return 0;
}

Measured memory_bytes: 3816
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
//typedef pair<long long,long long> P;
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  string s;
  cin>>s;
  int n=s.size();
  stack<char> chars;
  REP(i,n){
    if(s[i]=='S'){
      chars.push(s[i]);
    }else{
      if(chars.empty()){
        chars.push(s[i]);
      }else if(chars.top()=='T'){
        chars.push(s[i]);
      }else{
        chars.pop();
      }
    }
  }
  int ans;
  ans = chars.size();
  cout<<ans<<endl;
  return 0; 
}


Measured memory_bytes: 644
MAX = 10**6+3

mod = 1000000007

prime = [0 for i in range(MAX)]

max_map = dict() 

def power(a, n): 

	if n == 0: 
		return 1
	p = power(a, n // 2) % mod 
	p = (p * p) % mod 

	if n & 1: 
		p = (p * a) % mod 
	return p 

def sieve(): 
	prime[0], prime[1] = 1, 1
	for i in range(2, MAX): 
		if prime[i] == 0: 
			for j in range(i * 2, MAX, i): 
				if prime[j] == 0: 
					prime[j] = i 
			prime[i] = i 

def lcmModuloM(arr, n): 

	for i in range(n): 
		num = arr[i] 

		temp = dict() 

		while num > 1: 

			factor = prime[num] 

			if factor in temp.keys(): 
				temp[factor] += 1
			else: 
				temp[factor] = 1

			num = num // factor

		for i in temp:
			if i in max_map.keys():
				max_map[i] = max(max_map[i], temp[i])
			else:
				max_map[i] = temp[i]

	ans = 1

	for i in max_map:
		ans = (ans * power(i, max_map[i])) % mod
	return ans

n = int(input())
a = list(map(int, input().split()))
sieve()
LCM = lcmModuloM(a, n)
ans = 0
for ai in a:
    ans += pow(ai, mod-2, mod)
ans *= LCM
ans %= mod
print(ans)


Measured memory_bytes: 115312
#include<bits/stdc++.h>
#define pb push_back 
 #define fo(i,n) for(int i=0;i<n;i++)
#define ll long long 
#define int long long 
#define Mod 1000000007 
#define MAX 4294967296  // 2^32
const int M=1e9+7;
#define ip pair<int,int>
#define test(t) ll t;cin>>t;while(t--)
  
using namespace std;

long long gcd(int x,int y){
    if(y>x)swap(x,y);
    if(y==0)return x;
    return gcd(y,x%y);
}


void solve(){
int n;
cin>>n;
int a[n];
int count=0;
fo(i,n){
    cin>>a[i];

}
int ans=a[0];
for(int i=1;i<n;i++){

if(a[i]==1 || ans==1)break;
    ans=gcd(ans,a[i]);
}

if(ans>1){
    cout<<"not coprime";
    return ;
}

map<int,int>mp;

fo(i,n){
int t=a[i];
if(t==1){
    
    continue;
}
if(t%2==0){
    mp[2]++;
    while(t%2==0 && t!=1)t/=2;

}
for(int j=3;j<=sqrt(t);j+=2){
if(t%j==0){
mp[j]++;
while(t%j==0 && t!=1)t/=j;
if(t==1)break;

}

}
if(t>2)mp[t]++;

}
for(auto it=mp.begin();it!=mp.end();it++){
    if(it->second>(int)1){
        cout<<"setwise coprime";
        return ;
    }
}
cout<<"pairwise coprime";





}

signed main(){


    // std::string binary = std::bitset<8>(n).to_string();
    ios::sync_with_stdio(0);
    cin.tie(0);
  solve();
  


}

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

#define N 100001
int n, h[N], dp[N];

signed main() {
        scanf("%d", &n);
        for (int i = 1; i <= n; i++)
                scanf("%d", &h[i]);

        dp[1] = 0;
        dp[2] = abs(h[2]-h[1]);
        for (int i = 3; i <= n; i++)
                dp[i] = min(dp[i-1] + abs(h[i]-h[i-1]), dp[i-2] + abs(h[i]-h[i-2]));

        printf("%d \n", dp[n]);

        return 0;
}


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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

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<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

// ------------------------------------------------------------------------------------------

int Len[55], Pat[55];

int rec(int N, int X) {
  if (N == 0) {
    return X <= 0 ? 0 : 1;
  } else if (X <= 1 + Len[N-1]) {
    return rec(N-1, X-1);
  } else {
    return Pat[N-1] + 1 + rec(N-1, X-2-Len[N-1]);
  }
}

signed main() {
   int N, X;
   cin >> N >> X;

   Len[0] = Pat[0] = 1;
   for (int i = 1; i <= N; i++) {
      Len[i] = Len[i-1] * 2 + 3;
      Pat[i] = Pat[i-1] * 2 + 1;
   }

   cout << rec(N, X) << endl;

   return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
using Weight = int;
using Flow = int;
struct Edge {
	int src, dst;
	Flow cap;
	Edge() : src(0), dst(0), cap(0) {}
	Edge(int s, int d, Flow w) : src(s), dst(d), cap(w) {}
};
using Edges = std::vector<Edge>;
using Graph = std::vector<Edges>;
using Array = std::vector<Weight>;
using Matrix = std::vector<Array>;

void add_edge(Graph &g, int a, int b, Flow w = 1) {
	g[a].emplace_back(a, b, w);
	//g[b].emplace_back(b, a, w);
}
void add_arc(Graph &g, int a, int b, Weight w = 1) { g[a].emplace_back(a, b, w); }
struct dinic {
	int n, s, t;
	std::vector<int> level, prog, que;
	std::vector<std::vector<Flow>> cap, flow;
	std::vector<std::vector<int>> g;
	Flow inf;
	dinic(const Graph &graph)
		: n(graph.size()),
		cap(n, std::vector<Flow>(n)),
		flow(n, std::vector<Flow>(n)),
		g(n, std::vector<int>()),
		inf(std::numeric_limits<Flow>::max() / 8) {
		for (int i = 0; i < n; i++) {
			for (auto &e : graph[i]) {
				int u = e.src, v = e.dst;
				Flow c = e.cap;
				cap[u][v] += c;
				cap[v][u] += c;
				flow[v][u] += c;
				g[u].push_back(v);
				g[v].push_back(u);
			}
		}
	}
	inline Flow residue(int u, int v) { return cap[u][v] - flow[u][v]; }
	Flow solve(int s_, int t_) {
		this->t = t_, this->s = s_;
		que.resize(n + 1);
		Flow res = 0;
		while (levelize()) {
			prog.assign(n, 0);
			res += augment(s, inf);
		}
		return res;
	}
	bool levelize() {
		int l = 0, r = 0;
		level.assign(n, -1);
		level[s] = 0;
		que[r++] = s;
		while (l != r) {
			int v = que[l++];
			if (v == t) break;
			for (const int &d : g[v])
				if (level[d] == -1 && residue(v, d) != 0) {
					level[d] = level[v] + 1;
					que[r++] = d;
				}
		}
		return level[t] != -1;
	}
	Flow augment(int v, Flow lim) {
		Flow res = 0;
		if (v == t) return lim;
		for (int &i = prog[v]; i < (int)g[v].size(); i++) {
			const int &d = g[v][i];
			if (residue(v, d) == 0 || level[v] >= level[d]) continue;
			const Flow aug = augment(d, std::min(lim, residue(v, d)));
			flow[v][d] += aug;
			flow[d][v] -= aug;
			res += aug;
			lim -= aug;
			if (lim == 0) break;
		}
		return res;
	}
};
int X = (int)1e9 + 1;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<int> A(N);
	int res = 0;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	Graph g(N + 2);
	for (int i = 1; i <= N; i++) {
		add_edge(g, 0, i, X);
		add_edge(g, i, N + 1, X - A[i - 1]);
	}
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) {
			if (i % j == 0) {
				add_edge(g, i, j, ((int)1 << 60));
			}
		}
	}
	dinic d(g);
	res = d.solve(0, N + 1);
	//cerr << res << endl;
	res = X*N - res;
	cout << res << endl;
}

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

int main(){
    int N,Y;
    cin >> N >> Y;
    
    bool flg = false;
    for(int i=0; i<=N; i++){
        for(int j=0; j<=N-i; j++){
            int k = N - (i+j);
            if(10000*i + 5000*j + 1000*k == Y){
                cout << i << " " << j << " " << k << endl;
                flg =true;
                break;
            }
            if(flg) break;
        }
        if(flg) break;
    }
    
    if(!flg){
        cout << -1 << " " << -1 << " " << -1 << endl;
    }

}


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

int main(){
  int N,M;cin>>N>>M;
  int left=1,right=N;
  for (int i=0;i<N;++i){
    int a,b; cin>>a>>b;
    left=max(left,a);
    right=min(right,b);
  }
  cout<<max(right-left+1,0)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
main() {
    while(1) {
        int t, d, l;
        cin >> t >> d >> l;
        if(!t) return 0;
        int pre = 0;
        int ans = 0;
        for(int i = 0; i < t; ++i) {
            int x;
            cin >> x;
            if(x >= l) {
                int nxt = i + d;
                if(pre < i)
                    ans += d;
                else
                    ans += nxt - pre;
                pre = nxt;
            }
        }
        t--;
        if(pre > t) ans -= pre - t;
        cout << ans << endl;
    }
}


Measured memory_bytes: 3088
import java.util.*;

public class Main {

	@SuppressWarnings("resource")
	void run() {

		//
		// 画面入力
		//
		Scanner sc = new Scanner(System.in);
    	int n = sc.nextInt();
    	int k = sc.nextInt();

    	int digit = 1;
    	for(int i = 1; n - Math.pow(k, i) >= 0; i++){
    		digit = i + 1;
    	}
    	System.out.println(digit);

	}
	
    public static void main(String[] args) {
        new Main().run();
    }
}

Measured memory_bytes: 22996
N,Y = [int(x) for x in input().split()]
Y = Y // 1000
for y in range(N+1):
  if (Y - N - 4*y) % 9 != 0:
    continue
  x = int((Y - N - 4*y) / 9)
  z = N - y - x
  if 0 <= x and 0 <= z and x <= N and z <= N:
    print(x,y,z)
    exit()
print("-1 -1 -1")

Measured memory_bytes: 3060
#include "iostream"
#include "cstdio"
#include "cstring"
#include "string"
#include "cmath"
using namespace std;
const int maxn=50+10;
const long long INF=500000001;
int n,m;
int vis[maxn];
typedef struct 
{
	long long  x,y;
}point;
typedef struct{
	long long x,y;
	int num;
}fun;
point p[maxn];
fun s[maxn];
int main()
{
	while(cin>>n>>m)
	{
		memset(vis,0,sizeof(vis));
		for(int i=1;i<=n;i++)
			scanf("%lld%lld",&p[i].x,&p[i].y);
		for(int i=1;i<=m;i++){
			scanf("%lld%lld",&s[i].x,&s[i].y);
			s[i].num=i;
		}
		for(int i=1;i<=n;i++){
			long long minx=INF;
			int k=0;
			for(int j=1;j<=m;j++){
				long long t=abs(p[i].x-s[j].x)+abs(p[i].y-s[j].y);
				if(t<minx){
					minx=t;
					k=j;
				}
			}
			printf("%d\n",k);
		}
	}
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define veci vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vec2(a,b) vector<vec>(a,vec(b))
#define vec2ll(a,b) vector<vec>(a,vecll(b))
#define vec3(a,b,c) vector<vector<vec>>(a,vec2(b,c))
#define vec3ll(a,b,c) vector<vector<vecll>>(a,vec2ll(b,c))
#define fi first
#define se second
#define all(c) begin(c),end(c)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))


using namespace std;
int in() {int x;cin>>x;return x;}
ll lin() {ll x;cin>>x;return x;}
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;}
template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";}
//template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;}
//template<class T> inline void print(T v){for(auto e:v)cout<<e<<" ";cout<<endl;}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x:vec) is >> x;
    return is;
}
const ll INF=1e9+7;

int main()
{
    ll n;
    cin >> n;
    if(n==0){
        cout << 0 << endl;
        return 0;
    }
    ll i=1;
    vector<ll> q;
    ll t=4;
    while(n!=0){
        ll p;
        if(abs(n)%2==0){
            n/=2;
            p=0;
        }
        else{
            n-=i;
            n/=2;
            p=1;
        }
        if(i==1){
            i=-1;
        }
        else{
            i=1;
        }
        q.push_back(p);
    }
    ll m=q.size();
    for(ll i=m-1;i>=0;i--){
        cout << q[i];
    }
    return 0;
} 


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

vector<string> S(120);

int main(void){

  int H,W;
  cin >> H >> W;

  for(int i=0; i<H+2; i++){
    if(i == 0 || i == H + 1){
      for(int j=0; j<W+2; j++){
        S.at(i).push_back('#');
      }
    }
    else{
      S.at(i).push_back('#');
      string x;
      cin >> x;

      for(int k=0; k<W; k++){
        S.at(i).push_back(x.at(k));
      }

      S.at(i).push_back('#');
    }
  }

  for(int i=0; i<H+2; i++){
    cout << S.at(i) << endl;
  }

  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long; //using lll=__int128;
using pii=pair<int,int>;
#define repeat(i,a,b) for(int i=(a),iE=(b);i<iE;i++)
#define repeat_back(i,a,b) for(int i=(b)-1,iE=(a);i>=iE;i--)
#define mst(a,x) memset((a),(x),sizeof(a))
#define N 1000010
#define inf 1e9
#define qwq {cout<<"qwq"<<endl;}
#define quit {cout<<-1<<endl; exit(0);}
#define int ll
const int mod=998244353;
signed main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n;
	cin>>n;
	int x=n/1.08;
	repeat(i,-5,6){
		if(llround(floor((x+i)*1.08))==n){
			cout<<x+i<<endl;
			exit(0);
		}
	}
	cout<<":("<<endl;
	return 0;
}

Measured memory_bytes: 256
use std::io::Read;

fn nmax(a: Option<i64>, b: Option<i64>) -> Option<i64> {
    if a.is_none() {
        return b;
    }
    if b.is_none() {
        return a;
    }
    Some(std::cmp::max(a.unwrap(), b.unwrap()))
}
fn main() {
    let mut line = String::new();
    std::io::stdin().read_to_string(&mut line);
    let mut it = line.split_whitespace();
    it.next().unwrap();
    let mut a = it.map(|a|a.parse().unwrap()).collect::<Vec<i64>>();
    let mut n = a.len();
    let mut k = n as i64 / 2;
    // i番目を選択前にk個選んでいるとした時に最大と最小のk
    let mut min_count = vec![0usize; n + 1];
    let mut max_count = vec![0usize; n + 1];
    for i in 0..(n + 1) {
        max_count[i] = std::cmp::min(k as usize, (i + 1) / 2);
    }
    min_count[n] = k as usize;
    let mut flip = true;
    for i in (0..n).rev() {
        min_count[i] = min_count[i + 1] - if flip && min_count[i + 1] > 0{
            1
        } else {
            0
        };
        flip = !flip;
    }
    let max_diff = (&min_count).iter().zip((&max_count).iter()).map(|(mi, ma)| ma-mi).max().unwrap() as usize;
    let mut dp = vec![vec![vec![None; 2]; max_diff + 1];n + 1];
    dp[0][0][0] = Some(0);
    for i in 0..n {
        for j in 0..=max_diff {
            let cur = min_count[i] + j;
            if cur > max_count[i] {
                break;
            }
            // その数を足す
            if let Some(cur_max) = dp[i][j][0] {
                dp[i + 1][cur + 1 - min_count[i + 1]][1] = nmax(dp[i + 1][cur + 1 - min_count[i + 1]][1], Some(cur_max + a[i]));
            }
            // 足さない
            if cur >= min_count[i + 1] {
                dp[i + 1][cur - min_count[i + 1]][0] = nmax(dp[i + 1][cur - min_count[i + 1]][0], dp[i][j][0]);
                dp[i + 1][cur - min_count[i + 1]][0] = nmax(dp[i + 1][cur - min_count[i + 1]][0], dp[i][j][1]);
            }
        }
    }
    let mut ret =  None;
    for j in 0..=max_diff {
        for k in 0.. 2 {
            ret = nmax(ret, dp[n][j][k]);
        }
    }
    println!("{}", ret.unwrap());
}


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

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

void sink(vs& grid,int i,int j)
{
	if(i<0 || 12<=i || j<0 || 12<=j)
		return;
	if(grid[i][j]=='0')
		return;
	grid[i][j]='0';
	
	sink(grid,i-1,j);
	sink(grid,i+1,j);
	sink(grid,i,j-1);
	sink(grid,i,j+1);
}

int solve(vs& grid)
{
	int res=0;
	rep(i,12)
		rep(j,12){
			if(grid[i][j]=='1'){
				res++;
				sink(grid,i,j);
			}
		}
	return res;
}

int main()
{
	for(string s;!cin.eof();getline(cin,s)){
		vs grid(12);
		getline(cin,grid[0]);
		if(grid[0].size()==0)
			break;
		repi(i,1,12)
			getline(cin,grid[i]);
		
		cout<<solve(grid)<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <iostream>

using namespace std;

int main()
{
	int n; cin >> n;
	int *a = new int[n];
	for (int i = 0; i < n; i++)
		cin >> a[i];

	for (int i = n - 1; i > 0; i--)
		cout << a[i] << " ";
	cout << a[0] << endl;

	delete[] a;
	return 0;
}



Measured memory_bytes: 3076
#include <bits/stdc++.h>
#define DEBUG if(0)
#define lli long long int
#define ldouble long double
using namespace std;

int main()
{
  lli n;
  while (scanf("%lld", &n) != EOF)
  {
    n -= 1;
    lli sz = 1, at = 0, pot = 26;
    while (n - pot >= 0)
    {
      n -= pot;
      at += pot;
      pot *= 26;
      sz++;
    }
    string ans;
    for (int i = 0; i < sz; i++)
    {
      ans += (n % 26) + 'a';
      n /= 26;
    }
    reverse(ans.begin(), ans.end());
    DEBUG printf("\t%lld %lld\n", sz, n);
    printf("%s\n", ans.c_str());
  }
  return 0;
}

Measured memory_bytes: 3688
S = list(map(int, input().split('/')))

if S[0] > 2019:
    ans = 'TBD'
elif S[0] < 2019:
    ans = 'Heisei'
else:
    if S[1] > 4:
        ans = 'TBD'
    elif S[1] <= 4:
        ans = 'Heisei'

print(ans)

Measured memory_bytes: 3060
#include <stdio.h>

int main(void){

  int m, nmax, nmin, i, gap, gapmax, p;

  while(1){
    scanf("%d %d %d", &m, &nmin, &nmax);
    if( (m == 0)&&(nmin == 0)&&(nmax == 0) ) break;

    int P[m];
    for(i = 0; i < m; i++){
      scanf("%d", &P[i]);
    }

    gapmax = 0;
    gap = 0;
    p = 0;
    for(i = nmin; i <= nmax; i++){
      gap = P[i-1] - P[i];
      if(gapmax <= gap) {
        gapmax = gap;
        p = i;
      }
      
    }

    printf("%d\n", p);
    
  }

  
  return 0;
}


Measured memory_bytes: 2140
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#define F first
#define S second
using namespace std;
using namespace __gnu_pbds;
//using namespace pb_ds;
typedef long long ll;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin>>n;
	vector<pair<int, int> > a;
	for (int i=0;i<n;i++){
		int t;
		cin>>t;
		a.push_back({t, i});
	}
	sort(a.begin(), a.end());
	int w=0;
	for (int i=0;i<n;i++){
		if (a[i].S%2 != i%2) w++;
	}
	cout<<w/2<<endl;
}

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

typedef long long int ll;
typedef unsigned long long ull;
typedef double db;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
#define fi first
#define sc second 
#define w(n) while(n--)
#define f(i,n) for(ll i=1;i<=n;i++)
#define fr(i,n) for(ll i=0;i<n;i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
db pie=3.141592653589793238;
int main()
{
	 ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   ll t;
   t=1;
  //cin>>t;
   w(t)
   {
   		ll n;
   		cin>>n;
   		for(int i=1;i<=n;i++)
   		{
   		    if(i==1 || i==2 || i==3 || i==4 || i==5)
   		    cout<<0<<"\n";
   		    else if(i==6)
   		    cout<<1<<"\n";
   		}
   		       unordered_map<int,int>m;
   		        for(int x=1;x<=sqrt(n);x++)
   		        {
   		            for(int j=1;j<=sqrt(n);j++)
   		            {
   		                for(int k=1;k<=sqrt(n);k++)
   		                {
   		                    
   		                    int n1=x*x+j*j+k*k+x*j+j*k+k*x;
   		                    m[n1]++;
   		                }
   		            }
   		        }
   		        
   		  for(int i=7;i<=n;i++)
   		  {
   		      cout<<m[i]<<"\n";
   		  }
   }
}

Measured memory_bytes: 4996
# 解説放送
def check(var):
    in_range = var <= N
    all_num_in = all(c in str(var) for c in '753')
    return in_range and all_num_in


def dfs(x):
    res = 0
    if check(x):
        res += 1
    if x <= N:
        res += dfs(10 * x + 3)
        res += dfs(10 * x + 5)
        res += dfs(10 * x + 7)
    return res


N = int(input())
print(dfs(0))


Measured memory_bytes: 2940
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static long process(TestCase testCase) {
        final int K = testCase.K;
        final List<Integer> h = testCase.h;
        final int N = h.size();

        h.sort(Integer::compareTo);

        long minDiff = h.get(K - 1) - h.get(0);

        for (int i = 1; (i + K - 1) < N; ++i) {
            minDiff = Math.min(h.get(i+K-1)-h.get(i), minDiff);
        }

        return minDiff;
    }

    // Util func

    public static void main(String[] args) {
        TestCase testCase = readFromInput();

        final long result = process(testCase);

        output(result);
    }

    private static TestCase readFromInput() {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int K = sc.nextInt();
        List<Integer> h = new ArrayList<>();
        for (int i = 0; i < N; ++i) {
            h.add(sc.nextInt());
        }

        sc.close();
        return new TestCase(N, K, h);
    }

    private static void output(long result) {
        System.out.println(result);
    }

    public static class TestCase {
        final int N;
        final int K;
        final List<Integer> h;

        public TestCase(int N, int K, List<Integer> h) {
            this.N = N;
            this.K = K;
            this.h = h;
        }
    }
}


Measured memory_bytes: 54228
//بسم الله الرحمن الرحيم
///   ***   ---   |||		 In the name of ALLAH		|||   ---   ***   ///
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define el << endl
#define PI 3.141592653589793238
#define _test_ int t; cin >> t; while(t--)
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define file() freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout)
ll gcd ( ll  a, ll b ) { return __gcd ( a, b ); }
ll lcm ( ll a, ll b ) { return a * ( b / gcd ( a, b ) ); }
int dx[]={0,0,+1,-1,+1,-1,-1,+1};
int dy[]={+1,-1,0,0,+1,-1,+1,-1};
///*......................*//* LET'S BEGIN (-_^) *//*............................///
const int mx= 2e6+123;
int a,b,sum=1,ans;

void _case_()
{
    cin >> a >> b;
    while(sum<b)
    {
        ans++;
        sum--;
        sum+=a;
    }
    cout << ans el;
}

int main()
{

    optimize();
    //_test_
    _case_();
    return 0;

}

///////////*  N A Y E M  *///////////

Measured memory_bytes: 3636
import sys
from collections import defaultdict as dd
import heapq
input = sys.stdin.readline
N, M = map(int, input().split())
a = []
e = dd(list)
s = []
for _ in range(M):
  a.append(list(map(int, input().split())))
  e[a[-1][0]].append((a[-1][1], a[-1][2]))
a.sort(key = lambda x: (x[0], x[1]))
x = 0
for i in range(1, N):
  e[i + 1].append((i, 0))
class dijkstra:
  def __init__(self, n, e):
    self.e = e
    self.n = n
  def path(self, s, t):
    d = [float("inf")] * (self.n + 1)
    vis = set()
    d[s] = 0
    h = [s]
    while not t in vis and len(h):
      v = heapq.heappop(h)
      v1 = v % (10 ** 10)
      v0 = v // (10 ** 10)
      if v1 in vis: continue
      vis.add(v1)
      for p in self.e[v1]:
        d[p[0]] = min(d[p[0]], d[v1] + p[1])
        if p[0] in vis: continue
        heapq.heappush(h, d[p[0]] * (10 ** 10) + p[0])
    return d[t]
d = dijkstra(N, e)
res = d.path(1, N)
if res == float("inf"): print(-1)
else: print(res)

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

int main(){
  string s;
  cin>>s;
  int g=0,p=0;
  int ans=0;
  rep(i,s.size()){
    if(s[i]=='g'){
      if(p<g){
        ans++;
        p++;
      }else g++;
    }else{
      if(p<g){
        p++;
      }else{
        ans--;
        g++;
      }     
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
#define MOD 1000000007
#define INF 100000000
#define MAX 100001
//#define int ll
#define ll long long
#define ld long double
#define vi vector<int>
#define pa pair<ll, ll>
#define pb push_back
#define mp make_pair
 
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...)type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T& t) { cin >> t; }
template<typename First, typename...Rest>void MACRO_VAR_Scan(First& first, Rest&...rest) { cin >> first; MACRO_VAR_Scan(rest...); }
#define VEC(type, c, n) vector<type> c(n);for(auto& i:c)cin>>i;
#define MAT(type, c, m, n) vector<vector<type>> c(m, vector<type>(n));for(auto& r:c)for(auto& i:r)cin>>i;
 
#define BR cout << "\n";
#define SP cout << " ";
#define ENDL cout<<endl;
#define OUT(d) cout<<(d);
#define OUTL(d) cout<<(d)<< "\n";
#define YES OUTL("YES")
#define Yes OUTL("Yes")
#define NO OUTL("NO")
#define No OUTL("No")
#define RET return 0;
 
#define REP(i, n) for(int i=0;i<(n);i++)
#define RREP(i, n) for(int i=n-1;i>=0;--i)
#define FOR(i, m, n) for(int i = m;i < n; i++)
#define RFOR(i, a, b) for(int i=(a)-1;i>=(b);--i)
#define AREP(a, n) for(auto (a):(n))
#define ALL(a) (a).begin(),(a).end()
#define IN(n, a, b) ((a)<=(n)&&(n)<(b))

signed main(){ INIT;
    VAR(string, s);

    FOR(i, 1, s.size()) if(s[i-1] == s[i]) {
        OUT(i); SP; OUTL(i+1);
        RET;
    }
    FOR(i, 2, s.size()) if(s[i-2] == s[i] && s[i-1] != s[1]){
        OUT(i-1); SP; OUT(i+1);
        RET;
    }
    OUTL("-1 -1");
RET;}


Measured memory_bytes: 512
/*
 * I'm strong. Stronger than all of you. Extremely strong.
 * I can kill all those Titans there. Even if I'm alone.
 * You're either incompetent or you're spineless cowards.
 * How pathetic.
 * You can sit here and suck on your fingers. Yeah, do that.
 * ~ Mikasa Ackerman
 */

#include <bits/stdc++.h>

using namespace std;

typedef pair<int, int> II;
typedef vector<II> VII;
typedef vector<int> VI;
typedef vector<VI> VVI;

typedef long long int LL;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(), a.end()
#define SET(a, b) memset(a, b, sizeof(a))
#define si(n) scanf("%d", &n)
#define dout(n) printf("%d\n", n)
#define sll(n) scanf("%lld", &n)
#define lldout(n) printf("%lld\n", n)

#define TRACE

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

#define fast_io                                                                \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL)

#define endl '\n'
const int N = 101;
int x[N][10];
int X[N];
int p[N][11];
int main() {
  fast_io;
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++)
    for (int j = 0; j < 10; j++) {
      cin >> x[i][j];
      X[i] = X[i] << 1;
      X[i] = X[i] | x[i][j];
    }
  for (int i = 1; i <= n; i++)
    for (int j = 0; j <= 10; j++)
      cin >> p[i][j];
  int bprof = INT_MIN;
  for (int i = 1; i < 1024; i++) {
    int prof = 0;
    for (int j = 1; j <= n; j++) {
      prof += p[j][__builtin_popcount(X[j] & i)];
    }
    bprof = max(prof, bprof);
  }
  cout << bprof << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
  int n,l;
  cin >> n >> l;
  int ans=-1;
  int k=0;

  for(int i=0 ; i<n ; i++){
    int a;
    cin >> a;
    if(a+k>=l) ans=i;
    k=a;
  }

  if(ans != -1){
    cout<<"Possible\n";
    for(int i=1 ; i<ans ; i++)  cout<<i<<"\n";
    for(int i=n-1 ; i>ans ; i--)  cout<<i<<"\n";
    if(ans != 0)  cout<<ans<<"\n";
  }

  else
    cout<<"Impossible\n";
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define repm(i,a,b) for(ll i=(ll)(a);i>(ll)(b);i--)
#define all(v) v.begin(), v.end()
#define rall(x) (x).rbegin(),(x).rend()
#define pll pair<long long,long long>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vc vector<char>
#define vvc vector<vc>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<long long>;
using vvll = vector<vll>;
using vb =vector<bool>;
using vvb=vector<vb>;
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; }
//snippets:tmp,cl,cvl,cs,co,coy,con,cov,setp

int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    ll d;
    cin >> d;
    vll c(26);
    rep(i, 26) cin >> c[i];
    vvll s(d,vll(26));
    rep(i,d){
        rep(j,26) cin>>s[i][j];
    }
    ll v=0;
    vector<set<int>>set(26);
    vll ans(d);
    rep(i,26) set[i].insert(0);
    rep(i,d){
        ll ma=0;
        ll key=0;;
        rep(j,26){
            if(ma<c[j]*(i+1-(*--set[j].end()))+s[i][j]){
                key=j;
                ma=c[j]*(i+1-(*--set[j].end()))+s[i][j];
            }
            v-=c[j]*(i+1-(*(--set[j].end())));
        }
        set[key].insert(i+1);
        ans[i]=key;
    }
    rep(i,10000){
        ll day=rand()%d;
        ll cont=rand()%26;
        if(ans[day]==cont)continue;
        auto itr=set[ans[day]].find(day+1);
        ll prev=*--itr;ll next=*++itr;
        if(++itr==set[ans[day]].end()) next=d-1;
        else next=*++itr;
        if(--itr==set[ans[day]].begin()) prev=0;
        else prev=*--itr;
        ll lost=((next-prev)*(next-prev+1)/2-(next-day+1)*(next-day+2)/2-(day+1-prev)*(day-prev+2)/2)*c[ans[day]]+s[day][ans[day]];
        auto itr2=upper_bound(all(set[cont]),day+1);
        if(itr2==set[cont].end()) next=d-1;
        else next=*itr2;
        if(--itr2==set[cont].begin()) prev=0;
        else prev=*--itr2;
        ll prof=((next-prev)*(next-prev+1)/2-(next-day+1)*(next-day+2)/2-(day-prev+1)*(day-prev+2)/2)*c[cont]+s[day][cont];
        if(prof>=lost){
            set[ans[day]].erase(day+1);
            ans[day]=cont;
            set[cont].insert(day+1);
        }
    }
    rep(i,d){
        cout<<ans[i]+1<<endl;
    }
}

Measured memory_bytes: 3760
import heapq
N,M = map(int,input().split())
jobs = [ [] for _ in range(M+1) ]
for _ in range(N):
  a,b = map(int,input().split())
  if a <= M:
    jobs[a].append(b)

pq = []
d = 1
res = 0
for _ in range(M-1, -1, -1):
  for b in jobs[d]:
    heapq.heappush(pq, -b)
  if pq:
    res += -heapq.heappop(pq)
  d += 1

print(res)

Measured memory_bytes: 72864
// ABC153-E
#include <bits/stdc++.h>
#define endl "\n"
#define rep(i,n) for(int i=0;i<int(n);i++)
#define e_b emplace_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> ipair;
typedef pair<ll,ll> lpair;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v) //vectorの中身を見る
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
void map_p(map<int,int>& d){cout<<"map: ";for(auto a : d){cout<<"{"<<a.first<<":"<<a.second<<"}";}cout<<endl;} //mapの中身を見る
void set_p(set<int>& d){cout<<"set: ";for(int a : d){cout<<a<<" ";}cout<<endl;} //setの中身を見る


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

    ll h,n;
    cin>>h>>n;
    vector<ll> a(n);
    vector<ll> b(n);
    rep(i,n){
        cin>>a[i]>>b[i];
    }
    ll inf=pow(10,18);
    vector<ll> dp(h+100,inf);
    dp[0]=0;
    rep(i,n){ //使う魔法
        rep(j,h){ //スタート地点
            ll next=min(h,j+a[i]);
            if(dp[j]!=inf) dp[next]=min(dp[next],dp[j]+b[i]);
        }
    }
    cout<<dp[h]<<endl;
    return 0;
}

Measured memory_bytes: 3688
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
  
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555; // TL MB
const double PI = acos(-1.0);
 
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
	return r;
}

void solve()
{
	int a, b, c;
	cin >> a >> b >> c;
	cout << c << " " << a << " " << b << endl;
}


 
 
int main()
{
    Red;
	int T = 1;
	//cin >> T; 
	for(int i = 1; i <= T; ++i){
		solve();
	}
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n,k;
	cin>>n>>k;
	vector<int>arr(n);
	for(int i=0; i<n; i++)
	 cin>>arr[i];
	int ans=0;
	sort(arr.begin(),arr.end());
	for(int i=0; i<k; i++)
	 ans+=arr[i];
	cout<<ans;
	return 0;
	
	
}



Measured memory_bytes: 3660
#pragma region Header
#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#define IFD(...)
#ifndef NDEBUG
#define NDEBUG
#endif
#endif
#include <utility>
#include <cstdint>
#include <cmath>
#include <cassert>
#include <vector>
#include <array>
#include <deque>
#include <queue>
#include <stack>
#include <tuple>
#include <set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <string>
#include <functional>
#include <algorithm>
#include <numeric>
#include <stdexcept>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <boost/hana/functional/fix.hpp>
using boost::hana::fix;
using namespace std;
using i32 = int32_t;
using i64 = int64_t;
using u32 = uint32_t;
using u64 = uint64_t;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repd(i, n) for (int i = (n)-1; i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define FORD(i, b, a) for (int i = (b); i >= (a); --i)
template <typename T>
int SZ(T const &x)
{
    return static_cast<int>(x.size());
}
template <class T>
bool chmax(T &a, T const &b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
bool chmin(T &a, T const &b)
{
    if (b < a)
    {
        a = b;
        return true;
    }
    return false;
}
#pragma endregion

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

    int x;
    cin >> x;
    cout << 1 - x << endl;

    return 0;
}


Measured memory_bytes: 3648
#include <iostream>
using namespace std;
typedef long long ll;

const ll INF = 1e18;
const int N = 100;
ll as[N];

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

	int n;
	cin >> n;

	ll sum = 0;
	for (int i = 0; i < n; ++i) {
		cin >> as[i];
		sum += as[i];
	}
	int res = -1;
	ll diff = INF;
	for (int i = 0; i < n; ++i) {
		ll off = abs(sum - as[i] * n);
		if (off < diff) {
			diff = off;
			res = i;
		}
	}
	cout << res << '\n';
}

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

long long Ceil(long long a, long long b) {
	return (a + b - 1) / b;
}

int main() {
	long long k, a, b;
	cin >> k >> a >> b;
	
	if (a > b) {
		cout << 2 * Ceil(k - b, a - b) - 1 << endl;
	}
	else {
		if (a >= k) { cout << 1 << endl; }
		else { cout << -1 << endl; }
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

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

int n, a;
vi x;
ll dp[55][55][2555];

ll solve(int i, int used, int sum)
{
	if (dp[i][used][sum] >= 0) return dp[i][used][sum];
	ll res;
	if (i == n)
	{
		if (used != 0 && used * a == sum)
		{
			res = 1;
		}
		else res = 0;
	}
	else
	{
		res = solve(i + 1, used, sum) + solve(i + 1, used + 1, sum + x[i]);
	}
	return dp[i][used][sum] = res;
}

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	MS(dp, -1);
	cin >> n >> a;
	x.resize(n);
	REP(i, n) cin >> x[i];
	cout << solve(0, 0, 0) << endl;
	return 0;
}

Measured memory_bytes: 60672
/**********************************************
 * author : deepak nayan
 * file   : e:/Solutions/atcoder/abc053_b.cpp
 * time   : Sun May  3 01:51:52 2020
 * quest  : B - A to Z String
 *********************************************/
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>

using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  cout << s.rfind('Z') - s.find('A') + 1 << "\n";
  return 0;
}


Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, m, x, y;
    cin >> n >> m >> x >> y;
    int aa, bb;
    vector<int> a(n);
    vector<int> b(m);
    for (int i = 0; i < n ; i++){cin >> aa;x = max(x, aa);}
    for (int i = 0; i < m ; i++){cin >> bb;y = min(y, bb);}
    if (y <= x){cout << "War" << endl;}
    else{cout << "No War" << endl;}
    return 0;
}

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

int main()
{
    int a[5],c;
    for(int i=0 ; i<5 ; i++){
        cin >> a[i];
    }
    for(int i=0 ; i<4 ; i++){
        for(int j=i+1 ; j<5 ; j++){
            if(a[j]>a[i]){
                c=a[j];
                a[j]=a[i];
                a[i]=c;
            }
        }
    }
    for(int i=0 ; i<5 ; i++){
        cout << a[i];
        (i!=4) ? cout << ' ' : cout << '\n';
    }
    return 0;
}

Measured memory_bytes: 1160
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define YY cout << "Yes" << endl;
#define NN cout << "No" << endl;
#define ve vector
#define pint pair<int,int>
const int INF = 1000000007;
const long double EPS = 1e-15;
const long double PI = acos(-1);
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
// *max_element(all(d))
// priority_queue<int,vector<int>,greater<int>>
int solve(){
  int n,s = 0;
  cin >> n;
  while(n > 0){
    s += n % 10;
    n /= 10;
  }
  if(s == 1)cout << 10 << endl;
  else cout << s << endl;
  return 0;
}
int main(){
  // ios::sync_with_stdio(false);cin.tie(nullptr);
  // cout << fixed;cout << setprecision(16);
  solve();
  return 0;
}

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

using namespace std;

int main(int argc, char const *argv[])
{
    int N;
    cin >> N;
    map<int, int> num;
    int in;
    for (int i = 0; i < N; i++)
    {
        cin >> in;
        num[in]++;
    }

    int cnt;
    int max = 0;
    for (map<int, int>::iterator itr = num.begin(); itr != num.end(); itr++)
    {
        cnt = 0;
        cnt += itr->second;
        if (num.count((itr->first) - 1))
        {
            cnt += num[(itr->first) - 1];
        }
        if (num.count((itr->first) + 1))
        {
            cnt += num[(itr->first) + 1];
        }
        if (cnt > max) max = cnt;
        
    }
    
    cout << max << endl;
    
    return 0;
}

Measured memory_bytes: 3200