akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define F first
#define S second
#define mp make_pair
#define pb push_back
//#define ll __int128
#define ll long long int
#define LEFT(a) ((a)<<1)
#define RIGHT(a) (LEFT(a) + 1)
#define MID(a,b) ((a+b)>>1)
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))

/*
#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2,fma")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")

#pragma comment(linker, "/STACK: 20000000005")
*/

using namespace std;

const int N = 205;

int n, m;

int a[N][N];
int b[N];

pair < int, int > P[N];

bool F[N];

vector < int > g[N];

int mt[N];


bool kuhn (int x){
    if (F[x])
        return 0;
    F[x] = 1;
    for (int to : g[x]){
        if (mt[to] == 0 || kuhn (mt[to])){
            mt[to] = x;
            mt[x] = to;
            return 1;
        }
    }
    return 0;
}

main()
{
    //freopen ("in.in", "r", stdin);freopen ("out.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++)
            cin >> a[i][j];
    for (int I = 1; I <= m; I++){
        for (int i = 1; i <= n * 2; i++)
            g[i].clear();
        for (int i = 1; i <= n; i++){
            for (int j = 1; j <= n; j++)
                F[j] = 0;
            for (int j = I; j <= m; j++){
                int x = (a[i][j] - 1) / m + 1;
                F[x] = 1;
            }
            for (int j = 1; j <= n; j++){
                if (F[j] == 0)
                    continue;
                g[i].pb (j + n);
                g[j + n].pb (i);
            }
        }
        for (int i = 1; i <= n * 2; i++)
            mt[i] = 0;
        for (int i = 1; i <= n; i++){
            if (mt[i] == 0){
                for (int j = 1; j <= n * 2; j++)
                    F[j] = 0;
                kuhn (i);
            }
        }
        /*cout << I << endl;
        for (int i = 1; i <= n; i++)
            cout << mt[i] << " ";
        cout << endl;
        for (int i = 1; i <= n; i++)
            cout << mt[i + n] << " ";
        cout << endl;*/
        for (int i = 1; i <= n; i++)
            mt[i] -= n;
        for (int i = 1; i <= n; i++){
            for (int j = I; j <= m; j++){
                int x = (a[i][j] - 1) / m + 1;
                if (x == mt[i]){
                    swap (a[i][j], a[i][I]);
                    break;
                }
            }
        }
    }
    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= m; j++)
            cout << a[i][j] << " ";
        cout << endl;
    }
    for (int j = 1; j <= m; j++){
        for (int i = 1; i <= n; i++)
            b[i] = a[i][j];
        sort (b + 1, b + n + 1);
        for (int i = 1; i <= n; i++)
            a[i][j] = b[i];
    }
    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= m; j++)
            cout << a[i][j] << " ";
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<vector>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define CEVCOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define P pair<int , int>
#define V vector<int>
#define M map<int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

int main(void) {

	ios::sync_with_stdio(false);	cin.tie(0);
	priority_queue<int , vector<int> , greater<int>> que;
	int A, B, C;	cin >> A >> B >> C;
	int ans = 0;
	que.push(A);	que.push(B);	que.push(C);
	while(true){
	 int a = que.top();	que.pop();
	 int b = que.top();	que.pop();
	 int c = que.top();	que.pop();

	 if(a == b && b == c)	break;

	 if(a == b){
	  a += 1; b += 1;
	  que.push(a);	que.push(b); que.push(c);
	  ans += 1;
	 }else{
	  a += 2;
	  que.push(a);	que.push(b); que.push(c);
	  ans += 1;
	 }
	}

	SCOUT(ans) << endl;

	return 0;
}


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

using namespace std;

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

	int N;
	int res = 0;

	cin >> N;

	for(int i=1;i<=N;i++)
	{
		int cnt = 0;
		int val = i;
		while(val > 0)
		{
			cnt++;
			val/=10;
		}
		if(cnt%2==1)
		{
			res++;
		}
	}

	cout << res << '\n';
	
	return 0;
}


Measured memory_bytes: 3624
n, k = map(int, input().split())
a = list(map(int, input().split()))
_sum = [0]*41
ans = 0
f = 0
 
for x in a:
  for i in range(41):
    _sum[i] += (x >> i) & 1
for i in range(41):
  if _sum[i] <= n//2:
    _sum[i] = 1
  else:
    _sum[i] = 0
for i in range(40, -1, -1):
  s = _sum[i] << i
  ans += s
  if ans > k:
    ans -= s
for x in a:
  f += x ^ ans
print(f)

Measured memory_bytes: 14620
N = int(input())
A = [0] * 2
if N != 1:
    for i in range(2):
        A[i] = [int(j) for j in input().split()]
    ans = 0
    count = 0
    for i in range(N):
        k = A[0][0]
        a = 0
        for j in range(N):
            if j == i:
                a = 1
            if a ==0:
                k+=A[0][j+1]
            if a ==1:
                k+=A[1][j]
        ans = max(k,ans)
    print(ans)
else :
    for i in range(2):
        A[i] = int(input())
    print(A[0]+A[1])

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;
long long n,m;

void compute(char * a, char * b,char *c)
{
  int i,j,m,n;
  long sum,carry;
  m = strlen(a)-1;
  n = strlen(b)-1;
 for(i=m;i>=0;i--)
    a[i] -= '0';
 for(i=n;i >=0;i--)
    b[i] -='0';
  c[m+n+2] ='\0';
 carry =0;
 for(i=m+n;i>=0;i--)
 {
   sum=carry;
   if((j=(i-m))<0)
     j=0;
   for(;j<=i&& j <=n;j++)
      sum += a[i-j]*b[j];
   c[i+1] = sum %10 + '0';
   carry = sum/10;
 }
 if((c[0]=carry+'0')=='0')
   c[0] = '/040';
}

int main()
{
    scanf("%lld %lld",&n,&m);
    if(n==1&&m==1)
        printf("1");
    else if(n==1)
        printf("%lld",m-2);
    else if(m==1)
        printf("%lld",n-2);
    else if(n==2||m==2)
        printf("0");
    else
    {
        char a[100],b[100],c[100];
        n=n-2;
        m=m-2;
        sprintf(a,"%lld",n);
        sprintf(b,"%lld",m);
        compute(a,b,c);
        for(int i=0;i<100;i++)
        {
            if(c[i]=='0')
            {
                for(int j=0;j<100;j++)
                    c[j]=c[j+1];
                i--;
            }
            else
                break;
        }
        printf("%s",c);
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;  
 
typedef long long ll;
typedef long double ld;
 
#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define rs resize
#define all(x) x.begin(), x.end()   
 
void read(){
    freopen("pudge.in", "r", stdin);
    freopen("pudge.out", "w", stdout);
}
 
void pre(){    
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}

void pudge(){
    ll mod = 1e9 + 7;
    int n;
    cin >> n;
    map<int, int> m;
    m[0] = 3;
    ll ans = 1;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a; 
        ans = (ans * m[a]) % mod;
        m[a]--;
        m[a + 1]++;
    }
    
    cout << ans << endl;
}
 
int main(){ 
    pre();
    pudge();
    return 0;
}

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

using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define endl			"\n"

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

int32_t main(){

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

	int k, a, b, c;
	cin>>k;
	unsigned long long s = 0;

	for(a = 1; a <= k; a++){
		for(b = 1; b <= k; b++){
			for(c = 1; c <= k; c++){
				s += gcd(a, gcd(b, c));
			}
		}
	}
	
	cout<<s;

	return 0;
}

Measured memory_bytes: 3640
import collections

def solve():
  n = int(input())
  a = collections.deque(sorted(list(int(i) for i in input().split())))
  big = a.pop()
  mini = a.popleft()
  queue = collections.deque([])
  #print(big,mini)
  while (a):
    if a[0] <= 0:
      tmp = a.popleft()
      queue.append((big,tmp))
      big -= tmp
    else:
      tmp = a.pop()
      queue.append((mini,tmp))
      mini -= tmp
  print(big-mini)
  queue.append((big,mini))
  for i in range(len(queue)):
    print(*queue[i])
  
solve()


Measured memory_bytes: 18820
use std::io::{BufRead, StdinLock};
use std::str::FromStr;

fn read<T: FromStr>(stdin_lock: &mut StdinLock, buf: &mut Vec<u8>, delimiter: u8) -> T {
    buf.clear();
    let l = stdin_lock.read_until(delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let a = read(&mut stdin_lock, &mut buf, b' ');
    let b = read(&mut stdin_lock, &mut buf, b' ');
    let t = read(&mut stdin_lock, &mut buf, b'\n');
    println!("{}", solve(a, b, t));
}

fn solve(a: u16, b: u16, t: u16) -> u16 {
    let mut count = 0;
    for i in 1..(t + 1) {
        if (i % a) == 0 {
            count += b
        }
    }
    count
}

#[test]
fn example1() {
    assert_eq!(10, solve(3, 5, 7))
}

#[test]
fn example2() {
    assert_eq!(6, solve(3, 2, 9))
}

#[test]
fn example3() {
    assert_eq!(0, solve(20, 20, 19))
}

#[test]
fn my_example() {
    assert_eq!(400, solve(1, 20, 20))
}


Measured memory_bytes: 4352
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop;

void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.map!(to!int).array;
    
    int[] B;
    foreach (a; A) {
        foreach (b; a-1..a+1) {
            if (B.length > 0 && B[$-1] == b) B.popBack;
            else B ~= b;
        }
    }

    auto P = new bool[](10^^7 + 10);
    fill(P, true);
    P[0] = P[1] = false;
    for (int i = 2; i < 10^^7 + 10; i++) {
        if (!P[i]) continue;
        for (int j = i + i; j < 10^^7 + 10; j += i) P[j] = false;
    }


    B.sort!"a % 2 > b % 2"();
    int M = B.length.to!int;
    int source = M;
    int sink = M + 1;
    int odd = B.map!(b => b % 2).sum;
    int even = B.map!(b => 1 - b % 2).sum;
    auto FF = new FordFulkerson(M + 2, source, sink);
    foreach (i; 0..odd) FF.add_edge(source, i, 1);
    foreach (i; odd..odd+even) FF.add_edge(i, sink, 1);
    foreach (i; 0..odd) {
        foreach (j; odd..odd+even) {
            if (P[abs(B[i] - B[j])]) FF.add_edge(i, j, 1);
        }
    }
    
    int one = FF.run;
    odd -= one;
    even -= one;
    int two = odd / 2 + even / 2;
    int three = odd % 2;

    writeln(one + two * 2 + three * 3);
}



class FordFulkerson {
    int N, source, sink;
    int[][] adj;
    int[][] flow;
    bool[] used;

    this(int n, int s, int t) {
        N = n;
        source = s;
        sink = t;
        assert (s >= 0 && s < N && t >= 0 && t < N);
        adj = new int[][](N);
        flow = new int[][](N, N);
        used = new bool[](N);
    }

    void add_edge(int from, int to, int cap) {
        adj[from] ~= to;
        adj[to] ~= from;
        flow[from][to] = cap;
    }

    int dfs(int v, int min_cap) {
        if (v == sink)
            return min_cap;
        if (used[v])
            return 0;
        used[v] = true;
        foreach (to; adj[v]) {
            if (!used[to] && flow[v][to] > 0) {
                auto bottleneck = dfs(to, min(min_cap, flow[v][to]));
                if (bottleneck == 0) continue;
                flow[v][to] -= bottleneck;
                flow[to][v] += bottleneck;
                return bottleneck;
            }
        }
        return 0;
    }

    int run() {
        int ret = 0;
        while (true) {
            foreach (i; 0..N) used[i] = false;
            int f = dfs(source, int.max);
            if (f > 0)
                ret += f;
            else
                return ret;
        }
    }
}


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


int main() {
    int N, M, X, Y;
    cin >> N >> M >> X >> Y;
    
    int xm = -200;
    int ym = 200;
    for (int i = 0; i<N; i++) {
        int get;
        cin >> get;
        xm = max(get, xm);
    }
    for (int i = 0; i<M; i++) {
        int get;
        cin >> get;
        ym = min(get, ym);
    }
  
    if (xm >= ym) {
        cout <<"War"<< endl;
    } else if ((xm+1) <= X || ym > Y){
        cout <<"War"<< endl;
    } else {
        cout <<"No War"<< endl;
    }
    
    return 0;
}



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

int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = 0;
  for (int i = 0; i < n-2; i++) {
    if (s.at(i) == 'A' && s.at(i+1) == 'B' && s.at(i+2) == 'C') {
      ans++;
    }
  }
  cout << ans << endl;
}


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

int main(void){

	int H, W;
	while (1){
		cin >> H >> W;
		if (H == 0 && W == 0){
			break;
		}
		for (int i = 0; i < H; i++){
			for (int j = 0; j < W; j++){
				if ((i+j)%2==1){
					cout << ".";
				}
				else{
					cout << "#";
				}

			}
			cout << endl;//??±??????????????????

		}
		cout << endl;//?¬??????±??????????????????

	}
	//system("pause");
	return 0;
}

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

int dp[100005], a[100005], n;
int LIS_nlgn() {
  int len = 1;
  dp[1] = a[1];
  for (int i = 2; i <= n; ++i) {
    if (a[i] >= dp[len]) {
      dp[++len] = a[i];
    } else {
      int pos = upper_bound(dp, dp + len, a[i]) - dp;
      dp[pos] = a[i];
    }
  }
  return len;
}
int main() {
  cin >> n;
  for (int i = n; i >= 1; i--) {
    cin >> a[i];
  }
  cout << LIS_nlgn() << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long n,m;
  cin >> n >> m;
  long long a[m],b[m],c[n+1]={},d[n+1]={};
  for(int i=0;i<m;i++){
    cin >> a[i] >> b[i];
    if(a[i]==1){
      c[b[i]]++;
    }else if(b[i]==n){
      d[a[i]]++;
    }
  }
  for(int i=1;i<=n;i++){
    if(c[i]>0&&d[i]>0){
      cout << "POSSIBLE" << endl;
      return 0;
    }
  }
  cout << "IMPOSSIBLE" << endl;
  return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define repr(i,x,n) for(int i=x; i<(n); i++)
#define ALL(x) (x).begin(),(x).end()
#define INF 1e9
typedef long long ll;
using VI = vector<int>;
using VS = vector<string>;
using graph = vector<vector<int>>;
int main()
{
int a,b;
cin>>a>>b;
double ret=0;
for (int i = 1; i <= a; i++)
{
    double tmp=1.0/a;
    int now=i;
    while (now<b)
    {
        now*=2;
        tmp/=2;
    }
    ret+=tmp;
}
cout<<setprecision(14)<<ret<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long u_ll;
typedef pair<int, int> pair_;
 
const int INF = 1001001001;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
int k;
 
int gcd(int a, int b){
    if(b == 0) return a;
 
    return gcd(b, a%b);
}
 
int main(){

    int n,k,q;
    cin >> n >> k >> q;

    vector<int> a(q);

    rep(i,q) cin >> a[i];

    vector<int> crt(n, 0);

    rep(i,q) {
        crt[a[i]-1]++;
    }
    int ans = 0;
    rep(i, n){
        if(k+crt[i]-q>0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 1408
import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N = int(read())
ans = 0

for i in range(1, N + 1):
    if (i % 3 == 0) | (i % 5 == 0):
        continue
    ans += i

print(ans)


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

int main(){
    ll n,k;
    cin >> n >> k;
    cout << min(n%k,abs((n%k)-k)) << endl;
    return 0;
}

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

int main() {
    int n, m, sum = 0;
    int t[100], p[100], x[100];
    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> t[i];
        sum += t[i];
    }
    cin >> m;
    for(int i = 0; i < m; i++) cin >> p[i] >> x[i];
    for(int i = 0; i < m; i++) {
        int ans = sum;
        ans = sum - t[p[i] - 1] + x[i];
        cout << ans << endl;
    } 
}

Measured memory_bytes: 256
import java.util.*;
class Main{
	public static void main(String[] args){
		Scanner s=new Scanner(System.in);
		while(s.hasNext()){
			String str=s.nextLine();
			String[]arg=str.split(" ");
			int a=Integer.parseInt(arg[0]);
			int[]b=new int[arg.length-1];
			for(int i=0;i<arg.length-1;i++)b[i]=Integer.parseInt(arg[i+1]);
			double dp[][]=new double[4096][12];
			int n=arg.length-1;
			for(int i=0;i<4096;i++)
				for(int j=0;j<12;j++)
					dp[i][j]=999999999;
			for(int i=0;i<n;i++){
				dp[1<<i][i]=b[i];
			}
			for(int i=0;i<(1<<n)-1;i++){
				for(int j=0;j<n;j++){
					for(int k=0;k<n;k++){
						if((i&(1<<k))==0){
							dp[i+(1<<k)][k]=Math.min(dp[i+(1<<k)][k],dp[i][j]+Math.sqrt((b[j]+b[k])*(b[j]+b[k])-(b[j]-b[k])*(b[j]-b[k])));
						}
					}
				}
			}
			boolean ok=false;
		//	for(int i=0;i<n;i++)System.out.print(dp[(1<<n)-1][i]+" ");
			for(int i=0;i<n;i++)if(dp[(1<<n)-1][i]+b[i]<(double)a+0.000001)ok=true;
			if(ok)System.out.println("OK");
			else System.out.println("NA");
		}
	}
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

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

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;
const ll INF = 1LL << 60;

struct Edge{ ll cost, to; };

void solve()
{
	ll n, u, v, w;
  cin >> n;
  vector< vector<Edge> > G(n, vector<Edge>());
  for(int i = 0; i < n - 1; ++i)
  {
    cin >> u >> v >> w;
    u--; v--;
    G[u].emplace_back(Edge{w, v});
    G[v].emplace_back(Edge{w, u});
  }

  vector<ll> d(n, INF);
  d[0] = 0;
  priority_queue<P, vector<P>, greater<P>> que;
  que.push(P(0, 0));
  while (!que.empty())
  {
    P p = que.top();
    que.pop();
    ll node = p.second;
    if (d[node] < p.first) continue;
    for (const auto& edge : G[node])
    {
        if (d[edge.to] > d[node] + edge.cost)
        {
            d[edge.to] = d[node] + edge.cost;
            que.push(P(d[edge.to], edge.to));
        }
    }
  }

  for(int i = 0; i < n; ++i)
  {
    cout << (d[i] & 1) << endl;
  }
}

int main()
{
	fastio;
	solve();

	return 0;
}

Measured memory_bytes: 11300
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define ALL(x)				(x).begin(),(x).end()
#define REP(i, n)			for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)		for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF					(ll)1e9
#define EPS					(double)1e-9
#define MOD					(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)			(((((x))+((n)-1))/(n)))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)			(((((x))+((n)-1))/(n))*(n))	/* Nの倍数に切り上げ */
#define FloorN(x, n)		((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)			(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)			(!IsOdd((x)))						
#define M_PI				3.14159265358979323846
typedef long long			ll;
typedef pair<ll, ll>		P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
// メイン
int main()
{
	int N, K, S;
	cin >> N >> K >> S;
	vector<int>	res(N);
	
	REP(i, N) {
		res[i] = S;
	}
	if (K < N) {
		int diff = N - K;
		if (S < INF) {
			REP(i, diff) {
				res[i] = INF;
			}
		} else {
			REP(i, diff) {
				res[i] = 1;
			}
		}
	}

	REP(i, N) {
		cout << res[i] << " ";
	}
	cout << endl;
	return 0;
}



Measured memory_bytes: 1664
#include <iostream>
#include <algorithm>
#include <string>
#include <numeric>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define MAX 1000000007

using namespace std;


int main(void){
	int n;
	cin>>n;
	double v[n];
	rep(i,n)cin>>v[i];
	sort(v,v+n);
	rep(i,n-1){
		v[i+1] = (v[i]+v[i+1])/2;
	}

	cout<<v[n-1]<<endl;
	return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


int main()
{
    int n, m;
    cin >> n >> m;
    vector<P> a(m);
    rep(i, m){ cin >> a[i].first >> a[i].second;}

    sort(a.begin(), a.end());

    int r = 0;
    int ans = 0;
    rep(i, m){
        if (r <= a[i].first){
            r = a[i].second;
            ans++;
        } else if (a[i].second < r){
            r = a[i].second;
        }
    }

    cout << ans << endl;

}



Measured memory_bytes: 1024
/*
ベルマンフォード法に思い至らず．
O(V*E)だがシンプルなアルゴリズム．負の重み閉路検出もできて色々便利
*/
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
typedef long long int ll;
using namespace std;

int N, M, P;
int a[5001], b[5001], c[5001];
ll cost[5001], cost_[5001];
bool fok[5001], bok[5001];

int main(){
  cin >> N >> M >> P;
  vector<vector<int> > fAdjList(N);
  vector<vector<int> > bAdjList(N);
  for(int i=0;i<M;i++) {
    cin >> a[i] >> b[i] >> c[i];
    a[i]--; b[i]--;
    fAdjList[a[i]].pb(b[i]);
    bAdjList[b[i]].pb(a[i]);
  }
  
  // ベルマンフォード
  for(int i=0;i<N;i++){
    cost[i] = INT_MAX;
  }
  cost[0] = 0;
  for(int i=0;i<N;i++){
    for(int j=0;j<M;j++){
      cost[b[j]] = min(cost[b[j]], cost[a[j]] + (P - c[j]));
    }
  }
  for(int i=0;i<N;i++) cost_[i] = cost[i];
  
  for(int i=0;i<N;i++){
    for(int j=0;j<M;j++){
      cost[b[j]] = min(cost[b[j]], cost[a[j]] + (P - c[j]));
    }
  }
    
  // 各頂点が，始点と終点から到達可能かどうかを調べる
  queue<int> q; q.push(0); fok[0] = true;
  while(!q.empty()){
	int now = q.front(); q.pop();
    for(auto i : fAdjList[now]){
      if (!fok[i]){
        fok[i] = true; q.push(i);
      }
    }
  }
  queue<int>().swap(q); // clear
  q.push(N-1); bok[N-1] = true;
  while(!q.empty()){
	int now = q.front(); q.pop();
    for(auto i : bAdjList[now]){
      if (!bok[i]){
        bok[i] = true; q.push(i);
      }
    }
  }
  
  for(int i=0;i<N;i++){
    if (fok[i] && bok[i] && cost[i] != cost_[i]){
      cout << -1 << endl;
      return 0;
    }
  }
  cout << max(0LL, -cost[N-1]) << endl;
  
  
  return 0;
}
  


Measured memory_bytes: 768
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		i := scanner.Text()
		var total int
		inputNum := strings.Fields(i)
		for _, v := range inputNum {
			num, err := strconv.Atoi(v)
			if err != nil {
				break
			}
			total += num
		}
		fmt.Println(DigitCount(strconv.Itoa(total)))
	}
}

func DigitCount(str string) int {
	return len(str)
}



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

using namespace std;

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

int main(){
 long n,k;
  cin >> n >> k;
  vector<long> x(n),y(n);
  vector<long> xary,yary;
  rep(i,n) {
    cin >> x[i] >> y[i];
     xary.push_back(x[i]);
     yary.push_back(y[i]);
  }
  sort(xary.begin(),xary.end());
  sort(yary.begin(),yary.end());
  
  long res=(xary[n-1]-xary[0])*(yary[n-1]-yary[0]);
  
  rep(xi,n){
   for(int xj=xi+1;xj<n;xj++){
    rep(yi,n){
       for(int yj=yi+1;yj<n;yj++){
          long num=0; 
         
         rep(i,n){
         if(xary[xi]<=x[i]&&x[i]<=xary[xj]&&yary[yi]<=y[i]&&y[i]<=yary[yj]) num++;
         }
         
         if(num>=k) res=min(res,(xary[xj]-xary[xi])*(yary[yj]-yary[yi]));
       }   
       }    
    }
   }   
  
  cout << res << endl;
  
}


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

int n, t, G[101][101], S[101], T[101];

void dfs(int p) {
    if (S[p] != 0) return;
    S[p] = ++t;
    for (int i = 0; i < n; i++)
        if (G[p][i] == 1)
            dfs(i);

    T[p] = ++t;
}


int main(void) {
    int u, k, v, s;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> u >> k;
        for (int j = 0; j < k; j++) {
            cin >> v;
            G[u - 1][v - 1] = 1;
        }
    }

    t = 0;
    for (int i = 0; i < n; i++)
        dfs(i);

    for (int i = 0; i < n; i++)
        printf("%d %d %d\n", i + 1, S[i], T[i]);

    return 0;
}

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

int main() {

  int64_t H, W; 
  cin >> H >> W;


  int64_t number;
  
  if (H == 1 || W == 1) number = 1;
  
  else if (H%2 ==1 && W%2 == 1) number = (H*W)/2 +1;
  
  else number = (H*W)/2;
  
  cout << number << endl;
  
}


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

//型定義
typedef long long ll;

//定数
const int INF=1e+9;
const int MOD=1e+9+7;

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

int main(){
    ll N;
    cin>>N;
    vector<ll> a(N);

    ll a_min=INF;
    bool ok=true;

    REP(i,N){
        cin>>a[i];
        a_min=min(a_min,a[i]);
    }
    REP(i,N){
        if(a[i]-a_min>=2) ok=false;
    }

    if(ok){
        ll m=0;
        ll n=0;
        ll k=a_min;
        REP(i,N){
            if(a[i]==k) n++;
            else m++;
        }
        if(m==0){
            if(N<2*k&&N!=k+1) ok=false;
        }else{
            if(k<n) ok=false;
            if(m==1) ok=false;
            if(m<2*(k+1-n)) ok=false;
        }
    }
    

    if(ok){
        
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }

}

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

int main() {
    int n;
    cin >> n;
    unsigned long long ans = 0;
    for (int a = 1; a < n; a++) {
        ans += (n-1) / a;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    s = str(readline().rstrip().decode('utf-8'))
    cnt = 0
    for i in range(len(s)):
        if s[i] != s[-i-1]:
            cnt += 1
    print(cnt // 2)


if __name__ == '__main__':
    solve()


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

int main(){
    int n;
    cin >> n;
    vector<string> s(n);
    for(int i=0;i<n;i++){
      cin >> s[i];
    }
    int ans = 1;
    sort(s.begin(),s.end());
  
    for(int i=1;i<n;i++){
      if(s[i-1]!=s[i]){
        ans++;
      }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9604
#include <stdio.h>

int main(){
  int x,y,t,gcd;

  scanf("%d%d",&x,&y);

  if(x < y){
    t = x;
    x = y;
    y = t;
  }

  gcd = x % y;
  
  while(gcd != 0){
    x = y;
    y = gcd;
    gcd = x % y;
  }

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



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

#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
using ll=long long;

int main() {
  int A,B,K;
  cin >> A >> B >> K;
  int ans;
  for(int i=min(A,B)+1;i>0;i--){
    if(!(A%i) && !(B%i))K--;
    if(!K){
      ans=i;
      goto ok;
    }
  }
  ok:
  cout << ans;
}

Measured memory_bytes: 256
var obj = init();
Main();
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function next(){return obj.next();}
function hasNext(){return obj.hasNext();}
function myin(){return require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");}
function init(){
  var inputFile = myin();
  var returnObj = {
    "list" : inputFile, "index" : 0, "max" : inputFile.length,
    "hasNext" : function(){return (this.index < this.max);},
    "next" : function(){if(!this.hasNext()){return "";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var N = nextInt();
  var list = new Array();
  var oddSet = new Set();
  var evenSet = new Set();
  for(var i = 0; i < N; i++){
    var tmp = nextInt();
    list[i] = tmp;
    if(i % 2 == 0){
      oddSet.add(tmp);
    }else{
      evenSet.add(tmp);
    }
  }
  list.sort(function(a,b){
  	return a - b;
  });
  var output = 0;
  for(var i = 0; i < N; i++){
    if(i % 2 == 0){
      if(!oddSet.has(list[i])){
        output++;
      }
    }else{
      if(!evenSet.has(list[i])){
        output++;
      }
    }
  }
  myout(output / 2);
}

Measured memory_bytes: 46048
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define sz(x) int(x.size())

typedef long long ll;

using namespace std;

/*******-c++14 don't include-*******/
template<typename T>
T gcd(T a, T b){if( b == 0)return a; return gcd(b, a%b); }
template<typename T>
T lcm(T a, T b){return a*b/gcd(a,b); }
void printArr(int *a, int len){for(int i=0; i<len; i++){if(i)cout << " ";cout << a[i];}cout << endl;}
/*******---------------------*******/

static const int INTINF = (2147483647);
static const ll LLINF = (9223372036854775807);
static const int MAX = 100001;
static const ll MOD = 1000000007;

//--global--//

ll s[2000][2000];
ll hscore[2000];
ll wscore[2000];

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

int main(int argc, const char * argv[]) {
    //提出時、消す----//
    //--------------//
    
    int h, w;
    cin >> h >> w;
    string m[2000];
    rep(i, h){
        cin >> m[i];
    }
    vector<int> row[2000];
    vector<int> column[2000];
    rep(i, h){
        row[i].push_back(-1);
    }
    rep(i, w){
        column[i].push_back(-1);
    }
    rep(i, h){
        rep(j, w){
            if(m[i][j] == '#'){
                row[i].push_back(j+1);
                column[j].push_back(i+1);
            }
        }
    }
    rep(i, h){
        row[i].push_back(w+1);
    }
    rep(i, w){
        column[i].push_back(h+1);
    }

    ll sum = 0;
    rep(i, h){
        rep(j, w){ 
            if(m[i][j] == '#')continue;
            auto it = lower_bound(row[i].begin(), row[i].end(), j+1);
            auto it2 = lower_bound(column[j].begin(), column[j].end(), i+1);
            ll a = *it;
            //if(a == w+1)a = w;
            ll b = *(it-1);
            if(b == -1)b = 0;
            ll c = *it2;
            //if(c == h+1)c = h;
            ll d = *(it2-1);
            if(d == -1)d = 0;
            ll rowcnt = a-b-1;
            ll columncnt = c-d-1;
            sum = max(sum, rowcnt + columncnt-1);
        }
    }
    cout << sum << endl;
    
    return 0;
}


Measured memory_bytes: 38528
#pragma target("avx")
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;
using V = std::vector<ll>;
template<typename T> using pq = std::priority_queue<T>;
template<typename T> using rpq = std::priority_queue<T, std::vector<T>, std::greater<T>>;

#define rep(i,b,e) for(ll i=b; i<e; i++)
#define be(vec) vec.begin(),vec.end()
#define print(vec) printf("[ ");for(auto &i:vec)printf("%ld ",i);puts("]");
#define scan(vec) for(auto &i:vec)scanf("%ld",&i)
#define fi first
#define se second

const int MOD = 1e9+7;
const ll INF = 1e18;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

int main(){
	int n, k;
	scanf("%d %d", &n, &k);
	V a(n+1, 0);
	rep(i, 1, n+1){
		scanf("%ld", &a[i]);
		a[i] = (a[i] + a[i-1] - 1) % k;
	}

	ll ans = 0;
	std::map<ll, ll> mp;
	rep(i, 0, n+k-1){
		if(i>n and k-1>i) i = k-1;
		if(i<=n) mp[a[i]]++;
		if(k-1<=i) ans += --mp[a[i-k+1]];
	}
	printf("%ld\n", ans);
	return 0;
}


Measured memory_bytes: 14336
#include <stdio.h>
#define N 100
int G[N+1][N+1];
int main(){
  int i,j;
  int n,k,v,u;
  //int G[N+1][N+1];

  scanf("%d",&n);
  G[0][0]=0;
  for(i=1;i<=n;i++){
    scanf("%d%d",&u,&k);
    for(j=1;j<=k;j++){
      scanf("%d",&v);
      G[i][v]=1;
    }
  }

  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      printf("%d",G[i][j]);
      if(j!=n)printf(" ");
    }
    printf("\n");
  }

  return 0;
}



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

int main()
{
    int n; cin>>n;
    int a=0, b=0;
    for(int i=0; i<n; ++i) {
        int t; cin>>t;
        if (t%4==0)
            ++a;
        else if (t%2==0)
            ++b;
    }
    cout<<(2*a+1+b/2*2>=n ? "Yes" : "No")<<endl;
}


Measured memory_bytes: 256
def FindSumOfDigits(n):
  Sum = 0
  while n>0:
    Sum += n%10
    n //= 10
  return Sum

N, A, B = map(int, input().split())
total = 0
for i in range(N):
  Sum = FindSumOfDigits(i+1)
  if A <= Sum and Sum <= B:
    total += i+1

print(total)


Measured memory_bytes: 9112
#include <algorithm>
#include <array>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#include <cassert>

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

bool match(int off_i, int off_j, vector<string>& A, vector<string>& B) {
//    int N = A[0].size();
    int M = B[0].size();
    rep(i, M) {
        rep(j, M) {
            if(A[off_i+i][off_j+j] != B[i][j])
                return false;
        }
    }
    return true;
}

int main() {
    int N, M;
    cin >> N >> M;
    vector<string> A;
    string tmp;
    rep(i, N) {
        cin >> tmp;
        A.push_back(tmp);
    }

    vector<string> B;
    rep(i, M) {
        cin >> tmp;
        B.push_back(tmp);
    }

    int cnt = N - M + 1;
    rep(i, cnt) {
        rep(j, cnt) {
            if(match(i, j, A, B)) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}



Measured memory_bytes: 3152
x,y = map(int,input().split())
res = 10**32
#print(res)
cnt = 0
for mask in range(1<<2):
    #print(mask)
    _x = x
    _y = y
    if mask & 1:
        _x *= -1 # 最初に反転させる
        cnt += 1
    if mask >> 1 & 1:
        _y *= -1 # 最後に反転させる
        cnt += 1
    if _x <= _y:
        cnt += _y-_x
        res = min(res,cnt)
    cnt = 0
print(res)

Measured memory_bytes: 8960
#include <bits/stdc++.h>
using namespace std;
double P,E,T;

double dfs(int k,double L,double R){
  double H=(R+L)/2,PP=H>=T ?1-P:P;
  if(k==0||(abs(L-T)<=E&&abs(R-T)<=E))return abs(H-T)<=E;
  if(T<R-E||L+E<T)return 0;
  return PP*dfs(k-1,H,R)+(1-PP)*dfs(k-1,L,H);
}

int main(){
  double K,R,L;
  cin>>K>>R>>L>>P>>E>>T;
  printf("%.10f\n",dfs(K,L,R));
  return 0;
}

Measured memory_bytes: 1240
/**Bismillahir Rahmanir Rahim.**/

/**
 *    author:  nasimnoob
**/

#include<bits/stdc++.h>
#include<stdlib.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<cstring>
#include<cstdio>

using namespace std;

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

typedef long long int                        ll;
typedef unsigned long long int              ull;
typedef long double                          ld;

//-----------------------------------------------------------//
#define      test                       int t; cin>>t;  while(t--)

#define      cube(x)                    (x*x*x)
#define      sqr(x)                     (x*x)

#define      INPUT                      freopen("input.txt", "r", stdin)
#define      OUTPUT                     freopen("output.txt", "w", stdout)

#define      srev                       reverse(s.begin(),s.end())
#define      sortstr                    sort(s.begin(), s.end());
#define      gtl(x)                     getline(cin, (x))
#define      dot(x)                     fixed << setprecision(x)

#define      Case                       cout << "Case " << ++tt << ": " ;

#define      PI                         acos(-1) // 3.1415926535897932
#define      MIN                        9999999

#define      Faster                     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);




//scanf("%[^\n]%*c", str);
//sort(s,s+n,greater<int>());
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);


//--------------------------------------Solution------------------------------//

int main()
{
    //Faster;


    int tt = 0 ;

    string s;
    ll n ;

    cin >> n ;

    vector < ll > ar;
    ll b;

    for (ll i = 0 ; i < n ; i++)
    {
        cin >> b ;
        ar.push_back(b);
    }


    ll sum = 0 ;

   for (int i = 0 ; i < n - 1 ; i++)
   {
       ll dif = 0 ;
       if (ar[i] > ar[i + 1])
       {
           dif = ar[i] - ar[i+1];
           ar[i+1] = ar[i+1] + dif ;
           sum += dif;
       }
   }

    cout << sum << endl;



    return 0 ;
}







Measured memory_bytes: 5312
N = int(input())
f = N//3
b = N//5
fb = N//15
S = int(N*(N+1)/2)
F = int((3+3*f)*f/2)
B = int((5+5*b)*b/2)
FB = int((15+15*fb)*fb/2)
s = S-F-B+FB
print(s)

Measured memory_bytes: 9180
N = int(input())
List1 = [[]*2]*N
Dict = []*N
Score = []*N
Num = list(range(1,N+1))

for i in range(N):
    List1[i] = list(map(str, input().split()))
    
for i in range(N):
    for j in range(2):
        if j % 2 == 0:
            Dict.append(List1[i][j])
        else:
            Score.append(int(List1[i][j]))

for i in range(N):
    for j in range(N-1-i):
        if Dict[j] > Dict[j+1]:
            Dict[j], Dict[j+1] = Dict[j+1], Dict[j]
            Score[j], Score[j+1] = Score[j+1], Score[j]
            Num[j], Num[j+1] = Num[j+1], Num[j]
        elif Dict[j] == Dict[j+1]:
            if Score[j] < Score[j+1]:
                Dict[j], Dict[j+1] = Dict[j+1], Dict[j]
                Score[j], Score[j+1] = Score[j+1], Score[j]
                Num[j], Num[j+1] = Num[j+1], Num[j]
            else:
                pass
        else:   
            pass
        
for i in range(N):            
    print(Num[i])

Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cassert>
#include <climits>
#define int long long
#define bogo_sort   std::sort
#define bozo_sort   std::stable_sort
#define alles(obj)  obj.begin(), obj.end()
#define elif        else if
#define unless(flg) if(!(flg))
#define elless(flg) else if(!(flg))
#define echo        std::cout <<
#define read        std::cin >>
#define endl        std::endl
#define fin         << '\n'
#define bash        push_back
#define fish        push_front
#define makePair    std::make_pair
#define _           << ' ' <<
// type-define
#define Stack       std::stack
#define Queue       std::queue
#define Deque       std::deque
#define PQueue      std::priority_queue
#define Set         std::set
#define Vector      std::vector
#define Pair        std::pair
#define Map         std::map
#define HashMap     std::unordered_map
#define Greater     std::greater
using String  =     std::string;
using llong   =     long long;
using boolean =     bool;
using Pii     =     Pair<int, int>;
using Vi      =     Vector<int>;
using Vii     =     Vector<Pii>;
// utils
constexpr int   dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int   dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
constexpr int   INF  = 0x3f3f3f3f;
constexpr llong LINF = 0x3f3f3f3f3f3f3f3fLL;

namespace {
    template<class A, class B, class C> A power ( A x, B n, C mod ) {
        llong ans = 1;
        while ( n > 0 ) {
            if ( n & 1 ) ans = ( ans * x ) % mod;
            x = ( x * x ) % mod;
            n >>= 1;
        }
        return ans;
    }
    template<class A, class B> A power ( A x, B n ) { return power( x, n, 1000000007 ); }
    template<class A> A gcd ( A x, A y ) { return x % y ? gcd( y, x % y ) : y; }
    template<class A> A lcm ( A x, A y ) { return ( x / gcd(x, y) * y ); }
    template<class A> inline A abs ( A n ) { return ( n < 0 ) ? -n : n; }
    template<class A> inline boolean chmax ( A &a, const A &b ) { return b > a ? a = b, true : false; }
    template<class A> inline boolean chmin ( A &a, const A &b ) { return b < a ? a = b, true : false; }
    inline boolean isMovable ( int x, int y, int w, int h ) {
        return ( x >= 0 && y >= 0 && x < w && y < h );
    }
}

namespace Rlyeh {

    int f ( int n ) {
        if ( n & 1 ) return ( n % 4 == 1 );
        return n + ( n % 4 == 2 );
    }

    signed call_of_Cthulhu( signed datum ) {

        int a, b;
        read a >> b;
        echo (f(b) ^ f(a-1)) fin;

        return 0;
    }
}

signed main(){std::cin.tie(0); std::ios::sync_with_stdio(false); int main_result = Rlyeh::call_of_Cthulhu(114514); return 0;}


Measured memory_bytes: 256
import heapq
A = list(map(int, input().split()))
A = [-a for a in A]
K = int(input())
heapq.heapify(A)
for i in range(K):
    max_val = heapq.heappop(A)
    heapq.heappush(A, 2*max_val)

print(sum([-a for a in A]))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef complex<double> Point;
typedef pair<Point, double> Tree;

int H;
Point home[100];

int U, M, S, du, dm, ds;
Tree tree[31];

int R;
int w[100], a[100];

double toRad(double theta)
{
	return theta / 180 * acos(-1);
}

double cross(Point a, Point b)
{
	return a.real() * b.imag() - a.imag() * b.real();
}

bool contains(Tree tree, Point home, double dir, double len)
{
	if (abs(home - tree.first) > len) return false;
	double left = dir + tree.second / 2;
	double right = dir - tree.second / 2;
	Point vh = home - tree.first;
	Point vl = polar(len, left);
	Point vr = polar(len, right);
	return (cross(vr, vh) > -1e-6) && (cross(vh, vl) > -1e-6);
}

void solve()
{
	// day, home
	static int reach[100][100];
	fill_n(*reach, 100 * 100, 0);
	
	for (int i = 0; i < R; i++){
		for (int j = 0; j < H; j++){
			for (int k = 0; k <= U + M + S; k++){
				if (contains(tree[k], home[j], toRad(w[i]), a[i])){
					reach[i][j] |= 1 << k;
				}
			}
		}
	}
	
	static int cnt[100];
	fill_n(cnt, 100, 0);
	
	int maxi = 0;
	for (int i = 0; i < H; i++){
		for (int j = 0; j < R; j++){
			cnt[i] += (reach[j][i] == 1);
			maxi = max(maxi, cnt[i]);
		}
	}
	
	if (maxi == 0) puts("NA");
	else {
		bool f = false;
		for (int i = 0; i < H; i++){
			if (cnt[i] == maxi){
				if (f) printf(" ");
				f = true;
				printf("%d", i + 1);
			}
		}
		puts("");
	}
}

int main()
{
	while (scanf("%d %d", &H, &R), H){
		for (int i = 0; i < H; i++){
			int x, y;
			scanf("%d %d", &x, &y);
			home[i] = Point(x, y);
		}
		
		scanf("%d %d %d", &U, &M, &S);
		scanf("%d %d %d", &du, &dm, &ds);
		tree[0] = Tree(Point(0, 0), toRad(du));
		for (int i = 0; i < U + M + S; i++){
			int x, y, d;
			scanf("%d %d", &x, &y);
			if (i < U) d = du;
			else if (i < U + M) d = dm;
			else d = ds;
			tree[i + 1] = Tree(Point(x, y), toRad(d));
		}
		
		for (int i = 0; i < R; i++){
			scanf("%d %d", &w[i], &a[i]);
		}
		
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 1256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;

//
#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0, sizeof(x))
#define mm(x) memset((x), -1, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;

// bit_macro
#define bit(n) (1LL << (n))
#define bitset(a, b) (a) |= (1 << (b))
#define bitunset(a, b) (a) |= ~(1 << (b))
#define bitcheck(a, b) ((((a) >> (b)) & 1) == 1)
#define bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
const int INF = (int)1e18;
const int MOD = (int)1e9 + 7;
const double PI = (double)acos(-1);
const double EPS = (double)1e-10;
const int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

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

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};

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

  if (B % A == 0) {
    cout << A + B << endl;
  } else {
    cout << B - A << endl;
  }

  return 0;
}


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

int main(void){
    ll d;
    cin >> d;

    if(d == 25)
        puts("Christmas\n");
    if(d == 24)
        puts("Christmas Eve\n");
    if(d == 23)
        puts("Christmas Eve Eve\n");
    if(d == 22)
        puts("Christmas Eve Eve Eve\n");

    return 0;
}


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

double calc(double n, double d, double x) {
        if (n == 0) return 0;
        double res = n * (2.0 * d + (n - 1) * x) / (2.0 * n);
        res += calc(n - 2, ((n + 2) * d + 5 * x) / n, (n + 4) * x / n);
        return res;
}

int main() {
        double n, d, x;
        scanf("%lf%lf%lf", &n, &d, &x);
        double ans = calc(2 * n, d, x);
        printf("%.15lf\n", ans);
        return 0;
}


Measured memory_bytes: 6528