akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define ALL(v) v.begin(),v.end()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cout<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct Edge{ll from, to, cost;};
struct node{ll cost, to;
  bool friend operator>(node a, node b){
    return a.cost>b.cost;
  }
};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

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

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N, K;
  cin >> N >> K;
  ll ans = 0;
  if(K==0){
    cout << N*N <<endl;
    return 0;
  }
  FOR(i, K+1, N+1){
    if(K!=0){
      ans += N-floor(N/i)*K-min(N%i+1, K) + 1;
    }
  }
  cout << ans<<endl;

  return 0;
}


Measured memory_bytes: 256
// 基本テンプレート
 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, -1};
int dy[] = {-1, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

int board[2][110], dp[2][110];
 
signed main() {
    int N; cin >> N;
    rep(i,0,2) rep(j,0,N) cin >> board[i][j];

    rep(i,0,2) rep(j,0,N) {
        int cost = 0;
        rep(k,0,2) {
            int x = i + dx[k], y = j + dy[k];
            if(x < 0 || x >= 2 || y < 0 || y >= N) continue;
            chmax(cost, dp[x][y]);
        }
        dp[i][j] = cost + board[i][j];
    }

    cout << dp[1][N-1] << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define rrep(i, n) for (int i = (int)n-1; i >= 0; --i)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;

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; }

__attribute__ ((constructor))
void init() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
}

signed main(){
    ll n;
    cin >> n;
    vector<ll> v(n);
    rep(i, n) cin >> v[i];
    vector<ll> sum(n + 1, 0);
    rep(i, n) sum[i + 1] = sum[i] + v[i];
    ll ans = 0;
    rep(i, n) { 
        ll now = v[i] * ((sum[n] - sum[i + 1]) % MOD);
        now %= MOD;
        ans += now;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6352
class Stack:

  def __init__(self):
    self.S = list()

  #0:insert
  def push(self,x):
    self.S.append(x)

  #1:top
  def top(self):
    if len(self.S) > 0:
      print(self.S[-1])
      
  #2:erase
  def pop(self):
    if len(self.S) > 0:
      self.S.pop()

n,q = map(int,input().split())
SList = list()

for i in range(n):
  SList.append(Stack())

for i in range(q):
  cmd = input()
  
  if cmd.startswith("0"):
    c,t,x = map(int,cmd.split(" "))
    SList[t].push(x)
    
  if cmd.startswith("1"):
    c,t = map(int,cmd.split(" "))
    SList[t].top()
  
  if cmd.startswith("2"):
    c,t = map(int,cmd.split(" "))
    SList[t].pop()



Measured memory_bytes: 13804
n=int(input())
a=input()
b=input()
c=input()
ans=0
for i in range(n):
    if a[i]==b[i] and b[i]==c[i]:
        ans+=0
    elif a[i]!=b[i] and b[i]!=c[i] and c[i]!=a[i]:
        ans+=2
    else:
        ans+=1
print(ans)


Measured memory_bytes: 3060
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<vector>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#define ll long long
#define F(i,a,b) for(int i=(a);i<=(b);i++)
#define mst(a,b) memset((a),(b),sizeof(a))
#define PII pair<int,int>
using namespace std;
template<class T>inline void read(T &x) {
    x=0; int ch=getchar(),f=0;
    while(ch<'0'||ch>'9'){if (ch=='-') f=1;ch=getchar();}
    while (ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
    if(f)x=-x;
}
const int inf=0x3f3f3f3f;
const int maxn=1050;
const int maxm=20000010;
int h,n,v[maxn],w[maxn],f[maxm],maxx;
int main()
{
	cin>>h>>n;
	memset(f,0x3f,sizeof(f));
	f[0]=0;
	for(int i=1;i<=n;i++) cin>>v[i]>>w[i],maxx=max(v[i],maxx);
	for(int i=1;i<=n;i++)
	{
		for(int j=v[i];j<=h+maxx;j++)
			f[j]=min(f[j],f[j-v[i]]+w[i]);	
	}
	int ans=inf;
	for(int i=h;i<=h+maxx;i++) ans=min(ans,f[i]);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 78336
import math
from functools import reduce

N, K = map(int, input().split())
A = list(map(int, input().split()))


def gcd(*numbers):
    return reduce(math.gcd, numbers)


# 最大公約数を取得
gc = gcd(*A)
max_A = max(A)

if (K % gc == 0 and K <= max_A):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Measured memory_bytes: 20464
{-# LANGUAGE BangPatterns #-}

import qualified Data.Map as M
import Data.List
import Data.Maybe
import qualified Data.ByteString.Lazy.Char8 as B

data RecItem = RecItem {
    riStart :: Int
  , riEnd :: Int
  , riChannel :: Int
  } deriving (Show)

genRecItem !s !e !c = RecItem s e c

data EventType = ETStart | ETEnd
                           deriving (Eq, Ord)

data Event = Event {
    evTime :: Int
  , evType :: EventType
} deriving (Eq, Ord)

calc :: M.Map Int [RecItem] -> Int -> Int
calc ris numC =
  countPara $ sort $ concat [eventList ris c | c <- [1 .. numC]]

eventList :: M.Map Int [RecItem] -> Int -> [Event]
eventList ris c = 
  concat [[Event s ETStart, Event e ETEnd] |
          RecItem s e _ <- paste $ sortOn riStart $ ris M.! c]
  where 
    ffilt (RecItem s e c') = c == c'
    paste = paste2 []
    paste2 acc [] = reverse acc
    paste2 [] (ri : ris) = paste2 [ri] ris
    paste2 acc@((RecItem sA eA c) : risA) (riB@(RecItem sB eB _) : ris)
      | eA == sB  = paste2 ((RecItem sA eB c) : risA) ris
      | otherwise = paste2 (riB : acc) ris


--    paste = foldr gen []
--    gen ri [] = [ri]
--    gen ri1@(RecItem s1 e1 _) ris2@((RecItem s2 e2 c) : ris)
--      | e1 == s2  = RecItem s1 e2 c : ris
--      | otherwise = ri1 : ris2

countPara :: [Event] -> Int
countPara evs = f 0 0 evs
  where f cur vMax [] = vMax
        f cur vMax ((Event t ETStart) : evs) = f (cur + 1) vMax' evs
          where vMax' = if cur == vMax then vMax + 1 else vMax
        f cur vMax ((Event t ETEnd)   : evs) = f (cur - 1) vMax evs

{-
main :: IO ()
main = do
  x <- getLine
  let [numRI, numC] = [read w | w <- words x]
  ris <- readData numRI numC
  putStrLn $ show $ calc ris numC

readData :: Int -> Int -> IO (M.Map Int [RecItem])
readData numRI numC = do
  f numRI (M.fromList [(c, []) | c <- [1 .. numC]])
  where
    f :: Int -> M.Map Int [RecItem] -> IO (M.Map Int [RecItem])
    f n acc | n == 0    = return acc
            | otherwise = do
                x <- getLine
                let [s, e, c] = [read w | w <- words x]
                f (n - 1) (M.adjust ((genRecItem s e c) :) c acc)
-}

myReadInt :: B.ByteString -> Int
myReadInt = fst . fromJust . B.readInt

main :: IO ()
main = do
  all <- B.getContents
  let (head:rest) = B.lines all
  let [numRI, numC] = [myReadInt w | w <- B.words head]
  let ris = foldr bin (M.fromList [(c,[]) | c <- [1 .. numC]]) rest
        where bin line m = M.adjust ((genRecItem s e c) :) c m
                where [s, e, c] = [myReadInt w | w <- B.words line]
  putStrLn $ show $ calc ris numC



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

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<pi> vpi;
typedef vector<bool> vbool;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define forall(it,s) for(auto it = s.begin(); it != s.end(); ++it)
#define F0(i,n) for(ll i = 0; i < n; i++)
#define F1(i,n) for(ll i = 1; i <= n; i++)
#define rep(i,a,b) for(int i = a; i <= b; i++)
#define per(i,a,b) for(int i = b-1; i >= a; i--)
#define FIN ios::sync_with_stdio(false);cin.tie(0);
#define db(x) cout<<#x<<" = "<<x<<"\n"
#define all(v) v.begin(),v.end()
#define modulo(a,b) ((a%b)+b)%b
#define F first
#define S second
#define INF 1000000010
#define eps 0.000000000001
#define mod 1000000007
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

//=======================//
int n,k;
vi h;
vi dp;
int main () {
	//FIN
	cin >> n >> k;
	h = dp = vi(n, INF);
	F0(i,n) cin >> h[i];
	dp[0] =  0;
	rep(i,1,n-1) {
		for (int j = 1; j <= k; j++) {
			if (i-j < 0 ) break;
			dp[i] = min(dp[i], dp[i-j] + abs(h[i] - h[i-j]));
		}
	}
	cout << dp[n-1] << "\n";

	return 0;
}










Measured memory_bytes: 3968
#include <stdio.h>
#include <queue>
using namespace std;
#define INF ((int)1e9)
int dp[50][50],n,m;int T[9][9];
#define p(a,b) (a*m+b)
struct air{int first,second,third;air() {};air(int f, int s, int t) {first=f,second=s,third=t;}};
bool operator <(air a, air b) {if (a.first!=b.first) return a.first<b.first; return a.second<b.second;}
priority_queue<air>stak;
int main() {
	int i,j,x,y,z,f;while (scanf("%d %d",&m,&n)!=EOF && (n || m)) {
		for (i=0;i<n;i++) for (j=0;j<m;scanf("%d",&T[i][j++]));f=n*m;
		for (i=0;i<f;i++) for (j=0;j<f;dp[i][j++]=INF);
		for (i=0;i<n;i++) for (j=0;j<m;j++) {
			if (T[i][j]==4) x=p(i,j),T[i][j]=0;
			else if (T[i][j]==2) y=p(i,j),T[i][j]=0;
			else if (T[i][j]==3) z=p(i,j),T[i][j]=0;
		}
		dp[x][y]=0;stak.push(air(0,x,y));
		while (!stak.empty()) {
			air here=stak.top();
			if (here.third==z) {printf("%d\n",-here.first);break;}
			stak.pop();
			int k[4][2]={0,-1,0,1,-1,0,1,0};
			int coor[4];coor[0]=here.second/m,coor[2]=here.third/m;
			coor[1]=here.second-coor[0]*m,coor[3]=here.third-coor[2]*m;
			for (i=0;i<4;i++) {
				x=coor[0]+k[i][0],y=coor[1]+k[i][1];
				if (x>=0 && y>=0 && x<n && y<m) {
					if (x==coor[2] && y==coor[3]) {
						x=coor[2]+k[i][0],y=coor[3]+k[i][1];
						if (x>=0 && y>=0 && x<n && y<m && T[x][y]==0) {
							if (dp[p(coor[2],coor[3])][p(x,y)]>dp[here.second][here.third]+1)
								dp[p(coor[2],coor[3])][p(x,y)]=dp[here.second][here.third]+1,stak.push(air(-dp[here.second][here.third]-1,p(coor[2],coor[3]),p(x,y)));
						}
					} else if (T[x][y]==0) {
						if (dp[p(x,y)][here.third]>dp[here.second][here.third])
							dp[p(x,y)][here.third]=dp[here.second][here.third],stak.push(air(-dp[here.second][here.third],p(x,y),here.third));
					}
				}
			}
		}
		if (stak.empty()) printf("-1\n");
		while (!stak.empty()) stak.pop();
	}
	return 0;
}

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

public class Main{

	private static int[] x;
	private static int[] top = {0,0,0};
	
	public static void main(String args[]) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		x = new int[10];
		for(int i=0;i<10;i++){
			x[i] = Integer.parseInt(br.readLine());
			
			if(x[i] > top[0]){
				top[2] = top[1];
				top[1] = top[0];
				top[0] = x[i];
			}
			else if(x[i] > top[1]){
				top[2] = top[1];
				top[1] = x[i];
			}
			else if(x[i] > top[2]){
				top[2] = x[i];
			}
		}
		System.out.println(top[0]);
		System.out.println(top[1]);
		System.out.println(top[2]);
	}
}

Measured memory_bytes: 16860
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

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

	void run() {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		++N;
		ArrayDeque<Integer> deque = new ArrayDeque<>();
		int curVal = 1;
		ArrayList<Integer> lis = new ArrayList<>();
		while (N > 0) {
			if (N % 2 == 0) {
				lis.add(0);
			} else {
				lis.add(1);
			}
			N /= 2;
		}
		for (int i = lis.size() - 2; i >= 0; --i) {
			deque.addLast(curVal);
			if (lis.get(i) == 1) {
				++curVal;
				deque.addFirst(curVal);
			}
			++curVal;

		}
		--curVal;
		System.out.println(curVal * 2);
		for (int i = 0; i < curVal; ++i) {
			System.out.print(deque.pollFirst() + " ");
		}
		for (int i = 1; i <= curVal; ++i) {
			System.out.print(i + (i == curVal ? "\n" : " "));
		}
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}

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

vector<int> p;
vector<int> look;

int func(int i,int n) {
	if (i == 0) {
		swap(p[0], p[1]);
		if (look[1] == 1) look[1] = 0;
		return 1;
	}
	else if(i == n-1){
		swap(p[n - 1], p[n - 2]);
		return 1;
	}
	else {
		swap(p[i], p[i + 1]);
		if (look[i + 1] == 1) look[i + 1] = 0;
		return 1;
	}
}


int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	p.resize(n);
	look.resize(n);
	rep(i, n) {
		cin >> p[i];
		if (p[i] == i+1) look[i]++;
	}
	int h = 0;
	for (int i = 0; i < n ; i++) {
		if (look[i]) {
			h += func(i, n);
		}
	}
	cout << h << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
struct Tree{
  Tree *left, *right;
  int32_t *key;
  Tree(): left(nullptr), right(nullptr), key(nullptr){}
  void insert(int32_t x){
    if(Tree::key==nullptr) Tree::key=new int32_t(x);
    else{
      if(x<*Tree::key){
        if(Tree::left==nullptr) Tree::left=new Tree;
        Tree::left->insert(x);
      } else{
        if(Tree::right==nullptr) Tree::right=new Tree;
        Tree::right->insert(x);
      }
    }
  }
  bool find(int32_t x){
    if(Tree::key==nullptr) return false;
    if(x<*Tree::key){
      if(Tree::left==nullptr) return false;
      return Tree::left->find(x);
    } else{
      if(Tree::right==nullptr) return false;
      return Tree::right->find(x);
    }
  }
  void preorder(){
    if(Tree::key!=nullptr){
      cout<<' '<<*Tree::key;
      if(Tree::left!=nullptr) Tree::left->preorder();
      if(Tree::right!=nullptr) Tree::right->preorder();
    }
  }
  void inorder(){
    if(Tree::key!=nullptr){
      if(Tree::left!=nullptr) Tree::left->inorder();
      cout<<' '<<*Tree::key;
      if(Tree::right!=nullptr) Tree::right->inorder();
    }
  }
};

int32_t main(){
  size_t n; cin>>n;
  Tree tree;
  string cmd;
  int32_t key;
  for(int i=0; i<n; ++i){
    cin>>cmd;
    switch(cmd[0]){
      case 'i': cin>>key; tree.insert(key); break;
      case 'f': cin>>key; cout<<(tree.find(key)?"yes\n":"no\n"); break;
      default: tree.inorder(); cout<<'\n'; tree.preorder(); cout<<'\n';
    }
  }
}


Measured memory_bytes: 34380
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int k, x;
	cin >> k >> x;
	int l = x - k + 1;
	int r = x + k - 1;
	for (int i = l; i <= r; i++)
	{
		cout << i;
		if (i != r) cout << " ";
	}
}

Measured memory_bytes: 256
#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;

int main()
{
	int N;
	cin >> N;
	int cnt = 0, ans = 0;
	rep(i,N)
	{
		int d1,d2;
		cin >> d1 >> d2;
		if (d1 == d2) cnt++;
		else cnt = 0;
		ans = max(ans,cnt);
	}
	if (ans >= 3) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3592
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (in i = 0; i < (in)(n); i++)
#define REP(i,a,b) for(in i=(in)(a);i<(in)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const in inf=1e9+7;
using P=pair<in,in>;
vector<in> dx={0,1,-1,0};
vector<in> dy={1,0,0,-1};



int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    in n,k;
    cin>>n>>k;
    in ans=0ll;
    in mini=0ll,maxi=0ll;
    rep(i,k) mini +=i;
    rep(i,k) maxi +=(n-i);

    REP(i,k,n+2){
        ans +=(maxi-mini+1ll);
        ans %=MOD;
        mini +=i;
        maxi +=n-i;
    }
    cout<<ans<<endl;
}/*
./problem.exe
*/

Measured memory_bytes: 3652
N, M, C = map(int, input().split())
B = [int(x) for x in input().split()]

answer = 0

for i in range(N):
  A = [int(x) for x in input().split()]
  assert len(A) == len(B) == M
  if sum([a*b for a, b in zip(A, B)])+C > 0:
    answer += 1

print(answer)

Measured memory_bytes: 3060
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
template<typename V> constexpr typename V::value_type sum(const V &v) { return accumulate(all(v), 0); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  double x, h;
  while (cin >> x >> h, x) {
    cout << prec(8) << x * x + x * hypot(h, x / 2) * 2 << endl;
  }
}

Measured memory_bytes: 3320
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ull unsigned long long
#define db long double
#define pb push_back
#define ppb pop_back
#define F first
#define S second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <int> vi;
typedef vector <ll> vl;

int get(ll x) {
	int res = 0;
	do {
		res += x % 10;
		x /= 10;
	}	while (x);
	return res;
}

int len(ll x) {
	int res = 0;
	do {
		res++;
		x /= 10;
	}	while (x);
	return res;
}

ll pw(int x, int y) {
	ll res = 1;
	while (y--) {
		res *= x;
	}
	return res;
}

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	ll n;
	cin >> n;
	int ans = get(n);
	ll nine = 0;
	while (true) {
		n /= 10;
		if (n == 0) {
			break;
		}
		n--;
		nine = nine * 10 + 9;
		ll tmp = pw(10, len(nine));
		n = n * tmp + nine;
		ans = max(ans, get(n));
		n = (n - nine) / tmp;
		n++;
	}
	cout << ans;
}


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

int main(void){
    double n,m,s,a;
    int point[1000];
    while(true){
        s = 0;
        m = 0;
        cin >> n;
        if (n == 0){
            break;
        }
        for (int i = 0 ; i < n; i++){
            cin >> point[i];
            m += point[i];
        }
        m = m/n;
        for (int i = 0; i < n; i++){
            s += pow((point[i] - m),2);
        }
        s = s/n;
        a = sqrt(s);
        cout << fixed << setprecision(8) << a << endl;
    }
}



Measured memory_bytes: 3236
#include <iostream>
using namespace std;
int main(void){
    int n,m,a[100],i,j,sum,ave;
    while(1){
        cin >> n >> m ;
        if(n==0 && m==0) break;
        ave=m/n;
        sum=0;
        for(i=0;i<n;i++) cin >> a[i] ;
        for(j=0;j<n;j++){
            if(a[j]>=ave) sum+=ave;
            else if(a[j]>0) sum+=a[j];
        }
        cout << sum << endl;
    }
    
}



Measured memory_bytes: 3092
#include<iostream>
using namespace std;
int main(){
	string s;
	cin >> s;
	cout << s[0] << s[1] << s[2] << s[3] << " " << s[4] << s[5] << s[6] << s[7] << s[8] << s[9] << s[10] << s[11] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define all(aaa) aaa.begin(), aaa.end()

const int N = 5e3 + 5;
int dp[N];

int get_mx_with_three_items(int n, const vector<int> &wt, const vector<int> &val) {
    int ans = 0;
    for (int i = 0; i * wt[0] <= n; i++) {
        for (int j = 0; j * wt[1] + i * wt[0] <= n; j++) {
            int rem = n - i * wt[0] - j * wt[1];
            ans = max(ans, n + i * val[0] + j * val[1] + rem / wt[2] * val[2]);
        }
    }
    return ans;
}

ll get_mx_with_two_items(int n, const vector<int> &wt, const vector<int> &val) {
    ll ans = 0;
    for (int i = 0; i * wt[0] <= n; i++) {
        ll rem = n - i * wt[0];
        ans = max(ans, n + i * (ll)val[0] + rem / wt[1] * val[1]);
    }
    return ans;
}

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

    ll n;
    int a[2][3];
    cin >> n;

    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> a[i][j];
        }
    }

    int z = 0;

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

    if (z == 0 || z == 3) {
        if (z == 0) {
            for (int i = 0; i < 3; i++) {
                swap(a[0][i], a[1][i]);
            }
        }
        vector<int> wt, val;
        for (int i = 0; i < 3; i++) {
            wt.push_back(a[0][i]);
            val.push_back(a[1][i] - a[0][i]);
        }
        cout << get_mx_with_three_items(n, wt, val) << "\n";
    }
    else if (z == 1) {
        int p;
        vector<int> wt, val;
        for (int i = 0; i < 3; i++) {
            if (a[0][i] < a[1][i]) {
                p = i;
            }
            else {
                wt.push_back(a[1][i]);
                val.push_back(a[0][i] - a[1][i]);
            }
        }
        n += n / a[0][p] * (a[1][p] - a[0][p]);
        cout << get_mx_with_two_items(n, wt, val) << "\n";
    }
    else {
        int p;
        vector<int> wt, val;
        for (int i = 0; i < 3; i++) {
            if (a[0][i] < a[1][i]) {
                wt.push_back(a[0][i]);
                val.push_back(a[1][i] - a[0][i]);
            }
            else {
                p = i;
            }
        }
        n = get_mx_with_two_items(n, wt, val);
        n += n / a[1][p] * (a[0][p] - a[1][p]);
        cout << n << "\n";
    }

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<string>
#include<map>
#include<vector>
#include<queue>
#include<set>
#include<stack>
#include<sstream>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=100+10;
int main() {
    int x,a,b;
    while(~scanf("%d%d%d",&x,&a,&b)){
        printf("%d\n",(x-a)%b);
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,n,m) for(int i=n;i<=(int)(m);i++)
#define RFOR(i,n,m) for(int i=(int)(n);i>=m;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) int(x.size())
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<ll> sums(n+1,0);
    rep(i,n){
        ll a;
        cin>>a;
        sums[i+1]=sums[i]+a;
    }
    
    ll ans=LINF;
    FOR(i,2,n-2){
        ll left_sum=sums[i];
        int l=lower_bound(sums.begin(),sums.begin()+i-1,(left_sum/2))-sums.begin();
        
        ll right_sum=sums[n]-sums[i];
        int r=lower_bound(sums.begin()+i+1,sums.end(),left_sum+(right_sum/2))-sums.begin();
        
        ll now=LINF;
        rep(j,2){
            rep(k,2){
                ll p=sums[max(0,l-j)];
                ll q=sums[max(i+1,r-k)];
                
                now=min(now,max({p,sums[i]-p,q-sums[i],sums[n]-q})-min({p,sums[i]-p,q-sums[i],sums[n]-q}));
            }
        }
        ans=min(ans,now);
        
    }
    cout<<ans<<endl;
    
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> VI;
typedef pair <int,int> ii;
typedef long long LL;
#define pb push_back
const int INF = 2147483647;
const LL INFF = INF * 1LL * INF;
const int MAX = 100001;

int n, W, i, j, v, w;
LL res[MAX];

int main() {
scanf("%d %d", &n, &W);
for (i=0;i<MAX;i++) res[i] = INF * 1LL * INF;
res[0] = 0;
for (i=0;i<n;i++) {
	scanf("%d %d", &w, &v);
	for (j = MAX - 1 - v;j>=0;j--) if (res[j] != INF) res[j + v] = min(res[j + v], res[j] + w);
}
for (i=MAX - 1;i >= 0;i--) if (res[i] <= W) {
	printf("%d\n", i);
	return 0;
}
return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
    using namespace std;
    
    int main(){
        int x , y ;
        cin >> x >> y ;
        if(x == 2 || y == 2){
            cout << "No" << endl;
        }else if(x == 4 || x == 6 || x == 9 || x == 11){
            if(y == 4 || y == 6 || y == 9 || y == 11){
                cout << "Yes" << endl;
            }else{
                cout << "No" << endl;
            }
        }else{
            if(y == 4 || y == 6 || y == 9 || y == 11){
                cout << "No" << endl;
            }else{
                cout << "Yes" << endl;
            }
        }
        
        return 0;
    }

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	b := make([]int, n)
	c := make([]int, n-1)

	for i:=0; i<len(a); i++{
		fmt.Scan(&a[i])
	}
	for i:=0; i<len(b); i++{
		fmt.Scan(&b[i])
	}
	for i:=0; i<len(c); i++{
		fmt.Scan(&c[i])
	}

	point := b[a[0]-1]
	for i:=1; i<len(a); i++{
		point += b[a[i]-1]
		if a[i-1] + 1 == a[i]{
			point += c[a[i-1]-1]
		}
	}
	fmt.Println(point)
}

Measured memory_bytes: 1772
local n = io.read("n")
-- local n = 3600
local total = 0
local value_stack = {0}
local mark_stack = {0}
while true do
	local len = #value_stack
	local value = value_stack[len]
	local mark = mark_stack[len]
	if not value then
		break
	end
	table.remove(value_stack, len)
	table.remove(mark_stack, len)
	if value <= n then
		if mark == 7 then
			total = total + 1
		end
		table.insert(value_stack, value * 10 + 3)
		table.insert(mark_stack, mark | 1)
		table.insert(value_stack, value * 10 + 5)
		table.insert(mark_stack, mark | 2)
		table.insert(value_stack, value * 10 + 7)
		table.insert(mark_stack, mark | 4)
	end
end
print(total)

Measured memory_bytes: 504
def BFS(x):
    v = deque([x])
    d[x]=0
    
    while v:
        a = v.popleft()
        for num in L[a]:
            if d[num]==-1:
                d[num]= d[a]+dic[(a,num)]
                v.append(num)

from collections import deque
N=int(input())
u=[0]*(N-1)
v=[0]*(N-1)
w=[0]*(N-1)
d=[-1 for _ in range(N)]
dic={}
L=[ [] for _ in range(N)]
for i in range(N-1):
    u[i],v[i],w[i] = map(int,input().split())
    u[i] -=1
    v[i] -=1
    L[u[i]].append(v[i])
    L[v[i]].append(u[i])
    dic[ (u[i],v[i])]=w[i]
    dic[ (v[i],u[i])]=w[i]
    
#print(L)
#print(dic)

BFS(0)
#print(d)
for num in d:
    if num%2==0:
        print(0)
    else:
        print(1)

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

typedef long long ll;
typedef vector<long long> VLL;
typedef vector<pair<int,int>> VP;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define MOD (1e9+7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
/*--------------------------------------------*/

ll N,A,B,C,D,E;

int main(){
  cin >> N >> A >> B >> C >> D >> E;
  
  ll mini = min({A,B,C,D,E});
  
  cout << ((N > mini)?((N - 1)/mini):(ll)0) + 5 << endl;
}

Measured memory_bytes: 256
import sys

A = list(map(int, list(input())))

def calc(index, result, operation):
    
    if index == 4 and result == 7:
        print(operation + "=7")
        sys.exit()
    elif (index == 4):
        return
        
    calc(index + 1, result + A[index], operation + "+" + str(A[index]))
    calc(index + 1, result - A[index], operation + "-" + str(A[index]))
    
calc(1,A[0],str(A[0]))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define X first
#define Y second
#define PB push_back
#define ll long long
#define pii pair<ll,ll>
#define MEM(x,y) memset(x,y,sizeof(x))
#define bug(x) cout<<"debug "#x" is "<<x<<endl;
#define FIO ios::sync_with_stdio(false);
#define ALL(x) x.begin(),x.end()
#define LOG 20
#define lson(x) ((x)<<1)
#define rson(x) ((x)<<1|1)

const int maxn=1e6+10;
using namespace std;
int n;
double a,b,c;
int main()
{
	cin>>n;
	a=b=c=1.0*n/3;
	printf("%.10f\n",a*b*c);
	return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;

int main()
{
    ll N, D;
    cin >> N >> D;
    two_sat ts(N);
    vector<ll> X(N), Y(N);
    for(int i=0;i<N;i++){
        cin >> X[i] >> Y[i];
    }
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            if(abs(X[i] - X[j]) < D){
                ts.add_clause(i, false, j, false);
            }
            if(abs(X[i] - Y[j]) < D){
                ts.add_clause(i, false, j, true);
            }
            if(abs(Y[i] - X[j]) < D){
                ts.add_clause(i, true, j, false);
            }
            if(abs(Y[i] - Y[j]) < D){
                ts.add_clause(i, true, j, true);
            }
        }
    }
    if(!ts.satisfiable()){
        cout << "No" << endl;
        return 0;
    }

    cout << "Yes" << endl;
    auto ret = ts.answer();
    for(int i=0;i<N;i++){
        cout << (ret[i]? X[i]:Y[i]) << endl;
    }

    return 0;
}

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

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

  long long b = B / X + 1;
  long long a = 0;
  if (A != 0) a = (A - 1) / X + 1;
  cout << b - a << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main()
{
    int n;
    scanf("%d", &n);
    if (n < 1200)
    {
        printf("ABC\n");
    }
    else if(n < 2800)
    {
        printf("ARC\n");
    }
    else
    {
        printf("AGC\n");
    }
}


Measured memory_bytes: 768
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;


int main() {
	
	int a, b, c;
	
	cin >> a >> b >> c ;
	if (a + b + c == 17) cout << "YES\n";
	else cout << "NO\n";

	return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <string>
#include <limits>
#include <algorithm>
#include <map>
#include <sstream>
#include <unordered_map>
#include <set>

using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
static ull tenq = 1000000000;
static ull mod = tenq + 7;

using namespace std;

int main()
{
  ll a, b, c, d, e, k;
  cin >> a >> b >> c >> d >> e >> k;
  if ((e - a) > k ){
    cout << ":(" << endl;
  }
  else {
    cout << "Yay!" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import collections
import heapq
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


N = int(input())
nums = list(map(int,input().split(" ")))
nums.sort()
ans = 0
di = collections.defaultdict(lambda :0)
for i in range(N):
    for j in range(i+1,N):
        key = nums[i] + nums[j]
        di[key] += 1
co = 0
for k,v in di.items():
    for temp in nums:
        if k <= temp:
            co += v

temp = combinations_count(N,3)
print(temp- co)

Measured memory_bytes: 3700
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int a, b, c;
  cin >> a >> b;
  int OOTJNY;
  OOTJNY = 0;
  int KYR, YABAI, WAYO, MRKT;
  KYR = 0;
  MRKT = 0;
  while(KYR < a){
    cin >> c;
    OOTJNY = c * 2;
    WAYO = b - c;
    WAYO *= 2;
    if(OOTJNY > WAYO){
      MRKT += WAYO;
      KYR ++;
    }
  else{
    MRKT += OOTJNY;
    KYR ++;
  }
  }
    cout << MRKT <<endl;
}

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

int main(){
  int h, n, a;
  cin >> h >> n;
  int sum = 0;
  for(int i = 0; i < n; i++){
    cin >> a;
    sum += a;
  }
  if(h <= sum) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

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

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

    int min = 9999, max = -1, a;
    for (int i = 0; i < N; ++i) {
        std::cin >> a;
        min = std::min(min, a);
        max = std::max(max, a);
    }

    std::cout << max - min << std::endl;

    return 0;
}


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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
}

Node treeMaximum(Node x){
}

Node treeSearch(Node u, int k){
}

Node treeSuccessor(Node x){
}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = (Node)malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  while(x!=NIL){
    y=x;
    if(z->key<x->key)x=x->left;
    else x=x->right;

  }
  z->parent=y;
  if(y==NIL)root=z;
  else if(z->key<y->key)y->left=z;
  else y->right=z;
}

void inorder(Node u){
  if(u==NIL)return;

    inorder(u->left);
    cout<<" "<<u->key;
    inorder(u->right);

}
void preorder(Node u){
   if(u==NIL)return;
    cout<<" "<<u->key;
    preorder(u->left);
    preorder(u->right);

}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}


Measured memory_bytes: 26564
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

int n, a, b; 

void solve() {
	cin >> n >> a >> b;
	if(a + b - 1 > n || n > a * b) {
		cout << -1 << endl;
		return;
	}
	if(b == 1) {
		rep(i, n) {
			cout << i + 1 << " ";
		}
		return;
	}
	for(int i = n - a + 1; i <= n; ++ i) {
		cout << i << " ";
	}
	int x = (n - a) / (b - 1);
	int y = n - a - x * (b - 1);
	int cur = n - a + 1;
	rep(i, y) {
		cur -= (x + 1);
		rep(j, x + 1) {
			cout << cur + j << " ";
		}
	}
	rep(i, b - 1 - y) {
		cur -= x;
		rep(j, x) {
			cout << cur + j << " ";
		}
	}
	cout << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 3696
C=[[int(x) for x in input().split()] for _ in range(3)]
a=[C[0][0],C[0][1],C[0][2]]
b=[0,C[1][0]-C[0][0],C[2][0]-C[0][0]]
hantei= True
for i in range(3):
  for j in range(3):
    if C[i][j]!=a[j]+b[i]:
      hantei = False
print('Yes' if hantei else'No')

Measured memory_bytes: 3064
#include <bits/stdc++.h> 
using namespace std; 
	bool prime[1000000]; 

void SieveOfEratosthenes(int n) 
{ 
	// Create a boolean array "prime[0..n]" and initialize 
	// all entries it as true. A value in prime[i] will 
	// finally be false if i is Not a prime, else true. 
	memset(prime, true, sizeof(prime)); 

	for (int p=2; p*p<=n; p++) 
	{ 
		// If prime[p] is not changed, then it is a prime 
		if (prime[p] == true) 
		{ 
			// Update all multiples of p greater than or 
			// equal to the square of it 
			// numbers which are multiple of p and are 
			// less than p^2 are already been marked. 
			for (int i=p*p; i<=n; i += p) 
				prime[i] = false; 
		} 
	} 

	// Print all prime numbers 
//	for (int p=2; p<=n; p++) 
//	if (prime[p]) 
//		cout << p << " "; 
} 

// Driver Program to test above function 
int main() 
{ 
	int n = 1000000;
	SieveOfEratosthenes(n); 
	int x;
	cin>>x;
	for(int p=x;p<=n;p++)
	{
		if(prime[p])
		{
			cout<<p<<'\n';
			return 0;
		}
	}
} 


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

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int n; cin>>n;
	pair<int,int> a[100000];
	rep(i,n) cin>>a[i].first, a[i].second=i+1;

	sort(a,a+n);

	rep(i,n) cout<<a[i].second<<" ";

	return 0;
}


Measured memory_bytes: 1536
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <string>
using namespace std;

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

	for (size_t i = 111; i < 1000; i += 111)
	{
		if (i >= n)
		{
			cout << i << endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace AIZU
{
    class Program
    {
        static void Main(string[] args)
        {
            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var num = int.Parse(Console.ReadLine());

            if (num == 0)
            {   
                Console.WriteLine("0" + ":" + "0" + ":" + "0");
            }
            else 
            {
                var hour = num / 3600;
                num = num % 3600;
                var min = num / 60;
                num = num % 60;

                Console.WriteLine(hour.ToString() + ":" + min.ToString() + ":" + num.ToString());
            }
        }
    }
}


Measured memory_bytes: 17836
import numpy as np

inf = float('inf')

n = int(input())
a = tuple(map(int, input().split()))

dp = np.zeros((n + 1, 2))
dp[0][1] = -inf
# dp[idx][マイナスを使う必要がある個数]

for i, aa in enumerate(a):
    if aa >= 0:
        dp[i + 1][0] = max(dp[i][0] + aa, dp[i][1] - aa)
        dp[i + 1][1] = max(dp[i][1] + aa, dp[i][0] - aa)
    else:
        dp[i + 1][0] = max(dp[i][1] - aa, dp[i][0] + aa)
        dp[i + 1][1] = max(dp[i][0] - aa, dp[i][1] + aa)

# print(dp)
print(int(dp[n][0]))


Measured memory_bytes: 23416
#include<iostream>
#include<algorithm>
#include<vector>
#include<math.h>

using namespace std;

int main(){
  int n, x;

  while(cin >> n >> x && n){
    int cnt = 0;
    for(int i = 0; i < n; i++){
      for(int j = i + 1; j < n; j++){
        for(int k = j + 1; k < n; k++){
          if(i+j+k+3 == x) cnt++;
        }
      }
    }
    cout << cnt << endl;
  }
}



Measured memory_bytes: 3096
#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <sstream>
#include <chrono>
#include <cstring>
 
using namespace std;
 
typedef long long ll;

int main() {
	ll n, a, b;
	cin >> n >> a >> b;
	if ((b - a) % 2 == 0) {
		cout << (b - a) / 2 << '\n';
	} else {
		ll ans = min(b - 1, n - a);
		//
		{
			ll go = a - 1;
			ll aa = 1;
			ll bb = b - a + 1;
			if ((bb - aa) % 2 == 1) {
				bb--;
				go++;
			}
			go += (bb - aa) / 2;
			ans = min(ans, go);
		}
		//
		{
			ll go = n - b;
			ll aa = a + n - b;
			ll bb = n;
			if ((bb - aa) % 2 == 1) {
				aa++;
				go++;
			}
			go += (bb - aa) / 2;
			ans = min(ans, go);
		}
		cout << ans << '\n';
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define fix(n) cout<<fixed<<setprecision(n)
#define co(n) cout<<n<<endl
#define all(n) (n).begin(),(n).end()
using namespace std;
typedef long long ll;
const ll mod=1000000007;
double pi=3.1415926535;

int main(){
  int n,ans=1;
  cin>>n;
  int a[n];
  rep(i,0,n) cin>>a[i];
  sort(a,a+n);
  vector<int> c={};
  rep(i,1,n){
    if(a[i]!=a[i-1]){
      c.push_back(ans%2);
      ans=1;
    }
    else ans++;
  }
  c.push_back(ans%2);
  ans=0;
  rep(i,0,c.size()) ans+=c[i];
  co(ans);
  
  return 0;
}

Measured memory_bytes: 1276
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <sstream>
 
using namespace std;

vector<string> vec_splitter(string s) {
  s += ',';
  vector<string> res;
  while(!s.empty()) {
    res.push_back(s.substr(0, s.find(',')));
    s = s.substr(s.find(',') + 1);
  }
  return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx,
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
  if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
  stringstream ss; ss << H;
  cerr << args[idx] << " = " << ss.str();
  debug_out(args, idx + 1, LINE_NUM, T...);
}

#ifndef ONLINE_JUDGE
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif
 
#define MOD 1000000007
#define A first
#define B second
#define all(x) (x).begin(), (x).end

typedef long long ll;
 
inline int mulmd(ll a, ll b){
  ll ret = (a * b) % MOD;
  return (int) ret;
}
 
inline int power(ll x, ll y, int m){
  ll res = 1;
  x = x % m;
  while(y > 0){
    if(y & 1){
      res = mulmd(res, x);
    }
    y = y >> 1;
    x = mulmd(x, x);
  }
  return (int) res;
}
 
inline int submd(ll a, ll b){
  ll ret = (a - b);
  if(ret < 0) ret += MOD;
  return (int) ret;
}
 
inline int addmd(ll a, ll b){
  ll ret = (a + b) % MOD;
  return (int) ret;
}
 
inline int invPow(ll a){
  return power(a, MOD - 2, MOD);
}
 
inline int divmd(ll a, ll b){
  ll ret = mulmd(a, invPow(b));
  return (int) ret;
}
 
const int N = 1e5 + 5;

int arr[N];

void solve(){
  int n;
  cin >> n;
  int ans = n + n * n + n * n * n;
  cout << ans;

}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  t = 1;
  //cin >> t;
  while(t--){
    solve();
  }
}



Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

const double pai = acos(-1);

int main() {
    double a, b, h, m;
    cin >> a >> b >> h >> m;
    double theta_l = (double)2 * pai * m / 60;
    double theta_s = (double)2 * pai * h / 12;
    theta_s += (double)2 * pai / 12 * m / 60;
    double theta = abs(theta_l-theta_s);
    double x = pow(a,2) + pow(b,2) - 2 * a * b * cos(theta);
    x = sqrt(x);
    printf("%.10f\n",x);
}

Measured memory_bytes: 4160
#include<stdio.h>
int main(){
  int a, b, i=0, j=0;
  
  scanf("%d %d",&a,&b);
  
  while(1){
    i++;
    if(i*8/100==a){
      break ;
    }
  }
  
    while(1){
    j++;
    if(j*10/100==b){
      break ;
    }
  }
  
  while(1){
    if(i==j){
      printf("%d\n", i);
      return 0;
    }
    if(i>j){
      j++;
      if(j*10/100!=b){
        printf("-1\n");
        return 0;
      }
    }
      if(i<j){
        i++;
      if(i*8/100!=a){
        printf("-1\n");
        return 0;
      }
      }
  }
}


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

using namespace std;
#define DIM  107
#define DIM2 100007
#define INF 10E16
#define MAXN 107
#define LG 18
#define MODULO 1000000007
typedef long long  ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef ll arr[DIM];
typedef vector<ll> vec;
typedef vector<ll> graph[DIM];
typedef pll parr[DIM];
typedef ll table[DIM][DIM2];
typedef ll arr2[DIM2];
struct pp {
	ll a, b;
	bool operator <(const pp& V)const {
		if (a == V.a)return b < V.b;
		return a < V.a;
	}
	bool operator ==(const pp& V)const {
		if (a == V.a && b == V.b)return 1;
		return 0;
	}
};
ll n, k;
arr A;
ll D[DIM2];
int main()

{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> n >> k;
	for (int i = 1; i <= n; i++)cin >> A[i];
	D[0] = 1;
	sort(A + 1, A + 1 + n);
	for (int i = 1; i <= k; i++) {
		D[i] = 2;
		for (int j = 1; j <= n; j++) {
			if (A[j] > i) {
				break;
			}
			if (A[j] == i)D[i] = 1;
			D[i] = min(3-D[i-A[j]], D[i]);
		}
		//cout << D[i] << ' ';
	}
	//cout << endl;
	if (D[k] == 1)cout << "First\n";
	else cout << "Second\n";
}


Measured memory_bytes: 1024
def dfs(c,l):
  n=list()
  for i in l:
    for j in range(max(0,i%10-1),min(i%10+2,10)):
      n.append(i*10+j)
      c-=1
      if c==0:
        return i*10+j
  else:
    return dfs(c,n)

K=int(input())
print(K if K<10 else dfs(K-9,[1,2,3,4,5,6,7,8,9]))


Measured memory_bytes: 7236