akhauriyash/Code-Regression huggingface dataset:
X, K, D = map(int, input().split())
X_a = abs(X)
if X_a - K * D > D:
    print(X_a - K * D)
else:
    K -= X_a // D
    X_a = X_a % D
    while X_a >= D:
        X_a -= D
        K -= 1
    if  K % 2 == 0:
        print(X_a)
    else:
        print(abs(X_a-D))

Measured memory_bytes: 9144
n,k = map(int,input().split())
A = list(map(int,input().split()))

k1 = ((k-1)*k//2)
k2= ((k)*(k+1)//2)

normal = 0
reverse = 0
for i in range(n):
    normal += sum(1 for a in A[i+1:] if a > A[i])
    reverse += sum(1 for a in A[i+1:] if a < A[i])

print((normal * k1 + reverse * k2)%(10**9 + 7))

Measured memory_bytes: 9232
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k; cin >> n >> k;
  int a[100];
  for(int i = 0; i<n;++i)cin >> a[i];
  sort(a,a+n);
  int sum = 0;
  for(int i = 0; i < k; ++i)sum += a[n-1-i];
  cout << sum << endl;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define l long
#define pb push_back
#define mp make_pair
#define mt make_tuple
int main() {
	// your code goes here
	//ifstream cin("input.txt");
	//ofstream cout("output.txt");
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
	
	int n,k; cin>>n>>k;
	double ans =log(n)/log(k);
	ans = ans+1.0;
	cout<<(ll)ans;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using vll = vector<ll>;
using vll2 = vector<vector<ll>>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr ll MOD = 1e9 + 7;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w;
    cin >> h >> w;
    vector<string> c(h);
    for (int i = 0; i < h; i++) {
        cin >> c[i];
    }
    int dx[4] = {0, 1, 0, -1};
    int dy[4] = {1, 0, -1, 0};
    ll res = 0;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            vll2 d(h, vll(w, INF));
            if (c[i][j] == '#') {
                continue;
            }
            queue<P> q;
            d[i][j] = 0;
            q.push(P(i, j));
            while (!q.empty()) {
                int y = q.front().first, x = q.front().second;
                chmax(res, d[y][x]);
                q.pop();
                for (int k = 0; k < 4; k++) {
                    int ny = y + dy[k], nx = x + dx[k];
                    if (ny < 0 || ny >= h || nx < 0 || nx >= w) {
                        continue;
                    }
                    if (c[ny][nx] == '#') {
                        continue;
                    }
                    if (d[ny][nx] == INF) {
                        d[ny][nx] = d[y][x] + 1;
                        q.push(P(ny, nx));
                    }
                }
            }
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable : 4996)
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define pb(a) push_back
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), (n))
#define ub(v,n) upper_bound(v.begin(), v.end(), (n))
#define int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7; const int MAX = 200020;
const double pi = acos(-1); const double EPS = 1e-12;
const ll INF = 1e18;

void solve() {
	int N; cin >> N;
	int K; cin >> K;
	int ans = 0;
	while (N > 0) {
		ans++;
		N /= K;
	}
	print(ans);
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q; cin >> q;
	//while (q--)
	solve();
}


Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

H, W, N = map(int, input().split())
sr, sc =  map(int, input().split())
sr -= 1
sc -= 1

S = input()
T = input()

def solve2(sc, W, S, T, inc, dec):
    x = sc
    for s, t in zip(S, T):
        if s == inc:
            x += 1
            if x == W:
                return True
        if t == dec:
            x = max(x - 1, 0);

    x = sc
    for s, t in zip(S, T):
        if s == dec:
            x -= 1
            if x == -1:
                return True
        if t == inc:
            x = min(x + 1, W - 1);

    return False


def solve(H, W, N, sr, sc, S, T):
    res1 = solve2(sc, W, S, T, 'R', 'L')
    res2 = solve2(sr, H, S, T, 'D', 'U')
    return res1 or res2

    # x = sc
    # for s, t in zip(S, T):
    #     if s == 'R':
    #         x += 1
    #         if x == W:
    #             return True
    #     if t == 'L':
    #         x = max(x - 1, 0);

    # x = sc
    # for s, t in zip(S, T):
    #     if s == 'L':
    #         x -= 1
    #         if x == -1:
    #             return True
    #     if t == 'R':
    #         x = min(x + 1, W - 1);


            


res = solve(H, W, N, sr, sc, S, T)
if res:
    print('NO')
else:
    print('YES')



Measured memory_bytes: 8356
#include <iostream>

using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  int x = a + b, y = b + c, z = c + a;
  if (x <= y && x <= z) {
    cout << x << endl;
  } else if (y <= z && y <= x) {
    cout << y << endl;
  } else {
    cout << z << endl;
  }
  return 0;
}


Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < int(n); i++)
#define FOR(i, a, b) for (int i = a; i < int(b); i++)
#define FOREACH(i, v) for (__typeof((v).begin()) i = (v).begin(); i != (v).end(); i++)
#define SIZE(v) ((int)(v).size())
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define ll long long
#define llint long long
#define pii pair<int, int>
#define UNVISITED -1


template<typename T>
string to_string(const vector<T>& vc, int w) {
	if(vc.empty()) return "";
	if(w + 1 == vc.size()) return to_string(vc[w]);
	return to_string(vc[w]) + "," + to_string(vc, w + 1);
}
 
template<typename T>
string to_string(const vector<T>& vc) {
	return "{" + to_string(vc, 0) + "}";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef DEBUG
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
 
class DebugStream {}LOG;
template <typename T>DebugStream &operator<<(DebugStream &s, const T&) { return s; }
#ifdef DEBUG
#define LOG clog
#endif

const int MAX = 1010;
char S[MAX], T[MAX];

int main() {
	scanf("%s", S);
	scanf("%s", T);
	int lenS = strlen(S);
	int lenT = strlen(T);
	int ans = INFINITY;
	REP(i, lenS) {
		if(i + lenT - 1 < lenS) {
			int local = 0;
			REP(j, lenT) if(T[j] != S[i + j]) local++;
			ans = min(ans, local);
		}
	}
	printf("%d\n", ans);
}

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

int main() {
  int D;
  cin >> D;
  
  vector<int> c(27), tmp(27);
  vector<vector<int>> s(D+1 , vector<int>(27));
  for(int i = 1; i <= 26; i++)  cin >> c.at(i);
  for(int i = 1; i <= D; i++)  for(int j = 1; j <= 26; j++)  {
    cin >> s.at(i).at(j);
  }
  
  vector<int> last(27);
  for(int i = 1; i <= 26; i++) last.at(i) = 0;
  
  for(int i = 1; i <= D; i++) {
    int typ = 0;
    int smax = 0,sf;
    for(int j = 1; j <= 26; j++) {
      sf = s.at(i).at(j) + (i-last.at(j)) * c.at(j);
      if (sf > smax) {
        smax = sf;
        typ = j;
      }
    }
    
    last.at(typ) = i;
    
    cout << typ << endl;
    
  }
  
}

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

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.setf(ios::fixed);
	cout.precision(4);
	
	int A, B, ans = 0;

	cin >> A >> B;

	for (int i = 0; i < 2; i++) {
		if (A >= B){
			ans += A;
			A--;
		} else {
			ans += B;
			B--;
		}
	}

	cout << ans << '\n';

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int h,w,a,b;
map<int,int>m;
multiset<int>s;
int main(){
    cin>>h>>w;
    for(int i=0;i<w;i++) m[i]=i,s.insert(0);
    for(int i=0;i<h;i++){
        cin>>a>>b;
        a--;
        auto pos=m.lower_bound(a);
        int mx=-1;
        while(pos!=m.end()&&pos->first<=b){
            mx=max(mx,pos->second);
            int x=pos->first-pos->second;
            s.erase(s.find(x));
            m.erase(pos++);
        }
        if(mx!=-1&&b<w){
            s.insert(b-mx);
            m[b]=mx;
        }
        cout<<(s.empty()?-1:*s.begin()+i+1)<<endl;
    }
}


Measured memory_bytes: 22304
#include <iostream>
#include <assert.h>
#include <vector>
#include <unordered_map>
#include <queue>
#include <climits>
#include <cmath>
#include <algorithm>
#include <unordered_set>
using namespace std;
constexpr int64_t MOD = 1e9 + 7;

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

  int64_t a, b, c;
  cin >> a >> b >> c;
  if (c - a - b < 0) {
    cout << "No" << endl;
    return 0;
  }
  int64_t right = (c - a - b) * (c - a - b);
  int64_t left = 4 * a * b;
  
  if (left < right) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  //double sq_a = sqrt(a);
  //double sq_b = sqrt(b);
  //double sq_c = sqrt(c);
  //if (sq_a + sq_b < sq_c) {
  //  cout << "Yes" << endl;

  //} else {
  //  cout << "No" << endl;

  //}

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int a, b, c;
	cin >> a >> b >> c;
	cout << c <<" "<< a <<" "<< b;

	//system("pause");


	return 0;
}

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

int gcd(int x, int y);
int fac(ll n, vector<int> num);

const int INF = 1001001001;

//mint�p�̕ϐ� (10��9��)
const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }

//��߂����Ƃɂ���āA�Z�k����鋗����ۑ����Ă���(�����2
//�̋��������̏�ŋ��߂�΂悳����

//���鋗�� = (i-1)��i�̋���+(i+1)��i�̋���������
//�����鋗�� = (i-1)��(i+1)�̋���
int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    int num = 0;
    int mae = 0;
    rep(i, n) {
        num += abs(mae - a[i]);
        mae = a[i];
    }
    num += abs(0 - a[n - 1]);

    rep(i, n) {
        int ans = num;
        if (i == 0) {
            ans -= abs(0 - a[i]);
            ans -= abs(a[i] - a[i + 1]);
            ans += abs(0 - a[i + 1]);
        }
        else if (i == n - 1) {
            ans -= abs(0 - a[i]);
            ans -= abs(a[i] - a[i - 1]);
            ans += abs(0 - a[i - 1]);
        }
        else {
            ans -= abs(a[i - 1] - a[i]) + abs(a[i + 1] - a[i]);
            ans += abs(a[i - 1] - a[i + 1]);
        }
        cout << ans << endl;
    }
    return 0;
}

/*���C�u�����ő����*/
//���[�O���b�h�̌ݏ��@
int gcd(int x, int y) {
    int num[3];
    num[0] = (x > y) ? x : y;
    num[1] = (x <= y) ? x : y;
    num[2] = num[0] % num[1];

    while (num[2]) {
        num[0] = num[1];
        num[1] = num[2];
        num[2] = num[0] % num[1];
    }

    return num[1];
}

/*�f��������*/
//���색�C�u����
int fac(ll n, vector<int> num) {
    ll kazu = n;
    for (int i = 2; i <= sqrt(n); i++) {
        while (1) {
            if (kazu % i != 0) break;

            kazu /= i;
            num[i]++;
        }
    }
    if (kazu == n && n != 1) return 1;
    int ans = 0;
    if (kazu != 1) ans++;
    for (int i = 2; i <= sqrt(n); i++) {
        for (int j = 1; j <= num[i]; j++) {
            num[i] -= j;
            ans++;
        }
    }
    return ans;
}

Measured memory_bytes: 3784
//By Vlgd
#include<bits/stdc++.h>
using namespace std;
const int N=1401;
int M[N][N],h,w;
struct rect{int h,pos;};
int maxrect(int r){
	stack<rect>S;
	int ans=0;
	for(int i=0;i<=w;i++){
		rect cur;
		cur.h=M[r][i],cur.pos=i;
		if(S.empty()) S.push(cur);
		else if(S.top().h<cur.h) S.push(cur);
		else if(S.top().h>cur.h){
			rect l;
			int left;
			while(!S.empty()&&S.top().h>=cur.h){
				l=S.top();S.pop();
				left=l.pos;
				int s=l.h*(cur.pos-l.pos);
				ans=max(ans,s);
			}
			cur.pos=left;
			S.push(cur);
		}
	}
	return ans;
}
void pre(){
	for(int i=0;i<=w;i++) M[0][i]=0;
	for(int i=1;i<=h;i++) M[i][w]=0;
	for(int i=1;i<=h;i++){
		for(int j=0;j<w;j++){
			if(M[i][j]) M[i][j]=0;
			else M[i][j]=M[i-1][j]+1;
		}
	}
}
int main(){
	int ans=0;
	scanf("%d%d",&h,&w);
	for(int i=1;i<=h;i++) for(int j=0;j<w;j++) scanf("%d",&M[i][j]);
	pre();
	for(int i=1;i<=h;i++) ans=max(ans,maxrect(i));
	printf("%d\n",ans);
//	for(int i=1;i<=h;i++){
//		for(int j=1;j<=w;j++) printf("%d ",M[i][j]);
//		printf("\n");
//	}
} 


Measured memory_bytes: 10888
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
	ios::sync_with_stdio(false); cin.tie(0);
	int n;
	cin >> n;
	long long ans[2] = {};
	long long sum[2] = {};
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		for (int j = 0; j < 2; j++) {
			sum[j] += x;
			if (j % 2 == i % 2) {
				if (sum[j] <= 0) {
					ans[j] += 1 + abs(sum[j]);
					sum[j] = 1;
				}
			} else {
				if (sum[j] >= 0) {
					ans[j] += 1 + abs(sum[j]);
					sum[j] = -1;
				}
			}
		}
	}
	cout << min(ans[0], ans[1]) << endl;
	return 0;	
}

Measured memory_bytes: 256
void main() {
	auto N = ri;
	auto S = rs;
	auto K = ri;
	auto c = S[K-1];
	foreach(v; S) {
		if(v == c) c.write;
		else '*'.write;
	}
	writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define rep(i,n) for(int i=0; i<(n); ++i)
#define per(i,n) for(int i=n-1;i>=0;++i)
#define rep1(i,n) for(int i=1; i<=n; ++i)
#define per1(i,n) for(int i=n; i>=1; ++i)
#define debug cout << "line : " << __LINE__ << " debug" << endl
#define Dcout(N) cout << setprecision(20) << N << endl
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() ) //被り削除
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define INF 1e9
#define MOD 1000000007
typedef long long ll;
//------------------------------------------------------------------------

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<int> a(10);
  rep(i,4){
    int n; cin >> n;
    a[n]++;
  }

  if(a[1]==1&&a[9]==1&&a[7]==1&&a[4]==1) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


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

 class PG
    {
        public static void Main(string[] args)
        {
            int[] array = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int a = array[0];
            int b = array[1];
            int c = array[2];

            double S, L, h;
            h = b * Math.Sin(Math.PI / 180 * c);
            S = h * a / 2;
            L =Math.Sqrt((double)a*a+b*b-Math.Cos(Math.PI / 180 * c)*a*b*2)+a + b;
            Console.WriteLine(S);
            Console.WriteLine(L);
            Console.WriteLine(h);
        }

    }


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

public class Program
{
    public static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var dp = new double[n];
        for (int i = 1; i < dp.Length; i++)
        {
            dp[i] = Math.Pow(2, 1024);
        }
        var vals = Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray();
        for (int i = 1; i < n; i++)
        {
            dp[i] = chmin(dp[i], dp[i - 1] + Math.Abs(vals[i] - vals[i - 1]));
            if (i - 2 > -1)
            {
                dp[i] = chmin(dp[i], dp[i - 2] + Math.Abs(vals[i] - vals[i - 2]));
            }
        }
        Console.WriteLine(dp[dp.Length - 1]);
    }

    public static double chmin(double x, double y)
    {
        return x > y ? y : x;
    }
}

Measured memory_bytes: 21344
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<functional>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef queue<P> Q;

int H,W;
int N;
int a[100010];
int main(){
    cin >>H>>W>>N;
    for(int i=0;i<N;i++){
        cin >> a[i];
    }
    P now(0,0);
    int nowColor=0;
    int coloredNum=0;
    int c[101][101]={};
    while(1){
        c[now.first][now.second]=nowColor;
        coloredNum++;
        if(now.first%2==0){
            if(now.second>=W-1){
                now.first++;//下へ
            }else{
                now.second++;//右へ
            }
        }
        else{
            if(now.second<=0){
                now.first++;//下へ
            }else{
                now.second--;//左へ
            }
        }
        if(now.first>=H){
            break;
        }
        if(coloredNum>=a[nowColor]){
            nowColor++;
            coloredNum=0;
        }
    }
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cout << c[i][j]+1<<" ";
        }
        cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define mp(a, b) make_pair(a, b)
typedef long long ll;
typedef pair<int, int> pii;
const int maxn = 2e5 + 10;
int main()
{
	int n, x, t;
	cin >> n >> x >> t;
	cout << (n + x - 1) / x * t << endl;
	return 0;
}
	

Measured memory_bytes: 3616
#include<iostream>
#include<utility>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
int main(){
int a[3];
cin >> a[0] >> a[1] >> a[2];
sort(a, a+3);

cout << a[0] + a[1] << endl;
return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Xml.Schema;
using static System.Console;

namespace ConsoleApp2
{
    class Program
    {
        static public int[] Sarray() { return ReadLine().Split().Select(int.Parse).ToArray(); }
        static public List<int> Slist() { return new List<int>(ReadLine().Split().Select(int.Parse)); }
        static void Main(string[] args)
        {
            var N = Sarray()[0];
            var An = Sarray();
            long x2 = 0;
            for(var i=0;i<N;i++)
            {
                if (i % 2 != 0) x2 -= An[i];
                else x2 += An[i];
            }
            var ans = new List<long>();
            ans.Add(x2 / 2);
            for(var i=0;i<N-1;i++)
            {
                ans.Add(An[i] - ans[i]);
            }
            for(var i=0;i<N;i++)
            {
                ans[i] *= 2;
            }
            for(var i=0;i<N;i++)
            {
                Write($"{ans[i]} ");
            }
            WriteLine();
        }
    }
}


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

int main() {
    int N,M;
    cin >> N >> M;
    vector<int> vec(M);
    for (int i = 0; i < M; i++) {
        cin >> vec.at(i);
    }
    for (int i = 0; i < M; i++) {
        N = N - vec.at(i);
    }

    if(N>=0)    cout << N << endl;
    else    cout << "-1" << endl;
}

Measured memory_bytes: 3672
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();

        int res = b;

        if (a <= 5) {
            res = 0;
        } else if (a <= 12) {
            res /= 2;
        }
        System.out.println(res);
    }
}

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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
typedef long long ll;

int main(){
  int a,b;
  cin >> a >> b;
  if(a==1)a += 13;
  if(b==1)b += 13;
  if(a==b)cout << "Draw" << endl;
  else if(a>b)cout << "Alice" << endl;
  else cout << "Bob" << endl;
}


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

void print(int N,char A[][2]){
   for(int i=0;i<N;i++){
    if(i>0)cout<<" ";
    cout<<A[i][0];
    cout<<A[i][1];
   }
   cout<<endl;

}

bool isStable(int N,char in[][2],char out[][2]){
  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
        for(int a=0;a<N;a++){
            for(int b=a+1;b<N;b++){
             //   if(in[i][1]==in[j][1]&&in[i][1]==out[a][1]&&in[j][1]==out[b][1])
             //       if(in[i][0]!=out[a][0]||in[j][0]!=out[b][0])
                  if(in[i][1]==in[j][1]&&out[a][1]==out[b][1]&&in[i][0]==out[b][0]&&in[j][0]==out[a][0])
                      return false;

            }
        }
    }
  }
  return true;

}

/*bool isStable(int N,char C1[][2],char C2[][2]){
  for(int i=0;i<N;i++){
    if(C1[i][0]!=C2[i][0])return false;

  }
  return true;


}*/

void BubbleSort(int N,char A[][2]){
  for(int i=0;i<N;i++){
    for(int j=N-1;j>i;j--){
        if(A[j][1]<A[j-1][1]){
            char t1=A[j][1],t2=A[j][0];
            A[j][1]=A[j-1][1]; A[j][0]=A[j-1][0];
            A[j-1][1]=t1; A[j-1][0]=t2;
        }
    }

  }


}

void SelectionSort(int N,char A[][2]){
  for(int i=0;i<N-1;i++){
    int minj=i;
    for(int j=i;j<N;j++){
        if(A[j][1]<A[minj][1])minj=j;

    }
    char t1=A[i][0],t2=A[i][1];
    A[i][0]=A[minj][0];A[i][1]=A[minj][1];
    A[minj][0]=t1;A[minj][1]=t2;

  }


}

int main(){
  int N;
  cin>>N;
  char A[N][2],A1[N][2],A2[N][2];
 // for(int i=0;i<N;i++)cin>>A[i];//空格回车为字符结束标志，空格不计算字符
//  for(int i=0;i<N;i++)scanf("%c",&B[i]);//空格回车计算字符
  for(int i=0;i<N;i++)
  for(int j=0;j<2;j++){
    cin>>A[i][j];
  }
  memcpy(A1,A,sizeof(A));
  memcpy(A2,A,sizeof(A));
   // cout<<A[0][1]<<endl;
 //   cout<<A[1][1]<<endl;
  //  cout<<(A[0][1]>A[1][1])<<endl;
  BubbleSort(N,A1);
  print(N,A1);
  //if(isStable(N,A,A1))cout<<"Stable"<<endl;
  //else cout<<"Not stable"<<endl;
  cout<<"Stable"<<endl;
  SelectionSort(N,A2);
  print(N,A2);
  if(isStable(N,A,A2))cout<<"Stable"<<endl;
  else cout<<"Not stable"<<endl;

  //for(int i=0;i<N;i++)cout<<A[i]<<" ";
 // for(int i=0;i<N;i++)printf("%c",B[i]);



  return 0;
}


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

#define all(v) v.begin(), v.end()
#define V vector
#define P pair
typedef long long ll;
const int INT_INF = 1e9;
const ll INF = 1LL << 30;

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

    int ss = s.size();
    int ts = t.size();

    bool flag = false;
    int p = 0;
    for(int i = 0; i < ss; i++){
        if(s[i] == '?' || s[i] == t[0]){
            int cnt = 1;
            for(int j = 1; j < ts; j++){
                if(s[i + j] == '?' || s[i + j] == t[j]) cnt++;
                else break;
            }
            if(cnt == ts){
                p = i;
                flag = true;
            }
        }
    }

    if(flag){
        for(int i = 0; i < ss; i++){
            if(p == i){
                cout << t;
                i += ts - 1;
            }else if(s[i] == '?'){
                cout << 'a';
            }else{
                cout << s[i];
            }
        }
        cout << "\n";
    }else{
        cout << "UNRESTORABLE" << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define forn(i, start, end) for (ll i = start; i < ll(end); i++)
#define input(arr, n) forn(i, 0, n) cin >> arr[i];
#define MOD 1000000007
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define vvll vector<vector<ll>>
#define mll map<ll, ll>
#define mcl map<char, ll>
#define sc set<char>
#define sll set<ll>
#define ssll stack<ll>
#define CHK(param) cout << #param << " is : " << param << "\n";
#define pb push_back
#define ppb pop_back
#define mk make_pair
#define f first
#define s second
#define all(x) (x).begin(), (x).end()
#define LAUV                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);
#define TC       \
    ll TTTT;     \
    cin >> TTTT; \
    while (TTTT--)
using namespace std;

int32_t main()
{
    LAUV;
    // TC
    {
        ll n=5;
        ll arr[n];
        input(arr, n);
        forn(i,0,5){
            if(arr[i]==0){
                cout<<i+1<<'\n';
                break;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
//vector<int> vec(N); for (int i = 0; i < N; i++) cin >> vec.at(i);

int main() {
  int n;
  cin >> n;
  
  int sum = 0, l,r;
  for (int i = 0; i < n; i++){
    cin >> l >> r;
    sum += r -(l-1);
  }
  cout << sum << endl;
}


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 int ll;
typedef pair<ll, ll> P;
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 main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, a, b;
	cin >> n >> a >> b;
	if((b-a)%2 == 0) cout << "Alice" << endl;
	else cout << "Borys" << endl;
	return 0;
}

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

int main() {
	int n;
	cin >> n;
	int bc=0,k=0;
	for(int i=0;i<n;i++)
	{
		int nc;
		cin >> nc;
		if(nc == bc)
		{
			k++;
			bc = 0;
		}
		else
		{
			bc = nc;
		}
	}
    cout << k << endl;
	return 0;
}


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

using namespace std;

inline int gi()
{
	int f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}

int a, dp[100003];

int main()
{
	a = gi();
	for (int i = 100; i <= 105; i+=1) dp[i] = 1;
	for (int i = 106; i <= a; i+=1)
	{
		if (dp[i - 100] || dp[i - 101] || dp[i - 102] || dp[i - 103] || dp[i - 104] || dp[i - 105])
			dp[i] = 1;
	}
	printf("%d\n", dp[a]);
	return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
	int l, o, i, j, count;
	count = 0;
	string str,v,w;
	getline(cin, v);
	l = v.length();
	while(true){
		getline(cin, str);
		if (str == "END_OF_TEXT")break;
		o = str.length();
		for (i = 0; i < o; i++) {
			str[i] = tolower(str[i]);
		}
		for (j = 0; j < o - l + 1; j++) {
			w = "";
			while ('a' <= str[j] && str[j] <= 'z') {
				w += str[j];
				j++;
			}
			if (w == v)count++;
		}
	}
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 3180
//int a = stoi(c); 文字列をintへ
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//等価なものに変換する思考
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//配列はvector<>を使う：意味わからないエラーがなくなる。
//背反な事象にちゃんとわける
//チェックリストはマップを使う
//数が大きい時の比較はstring型で行う
//全て0になったか調べたい->0になるたびにcntする
//またはかかつか
//例外処理は最初にする
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

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

//nC2の計算
ll C(ll N) {
	return N * (N - 1) / 2;
}

//円周率
const double PI = 3.14159265358979323846;
//割るやつ
const ll MOD = (pow(10, 9) + 7);

int main() {
	ll N; cin >> N;
	string S; cin >> S;

	vector <ll> e(N), w(N);
	for (int i = 0; i < N; i++) {
		if (S[i] == 'W') {
			if (i == 0) w[i] = 1;
			else w[i] = w[i - 1] + 1;
		}
		else {
			if (i == 0) w[i] = 0;
			else w[i] = w[i - 1];
		}
	}
	for (int i = N-1; i >= 0; i--) {
		if (S[i] == 'E') {
			if (i == N-1) e[i] = 1;
			else e[i] = e[i + 1] + 1;
		}
		else {
			if (i == N-1) e[i] = 0;
			else e[i] = e[i + 1];
		}
	}

	ll mi = 1e+10;
	for (ll l = 0; l < N; l++) {
		if (l == 0) mi = e[l + 1];
		if (l == N - 1) mi = min(mi, w[l - 1]);
		else mi = min(mi, w[l - 1] + e[l + 1]);
	}

	cout << mi << endl;
}

Measured memory_bytes: 5380
// luogu-judger-enable-o2
#include<bits/stdc++.h>
using namespace std;
int n;
double d,x,ans;
int main(){
	scanf("%d%lf%lf",&n,&d,&x);
	for (;n;--n){
		ans+=d+(n-0.5)*x;
		d=(((n+1)<<1)*d+5*x)/(n<<1);
		x=((n+2)<<1)*x/(n<<1);
	}
	printf("%.9f\n",ans);
}

Measured memory_bytes: 384
program ABC150B
    implicit none
    integer(8)::N,i
    integer(8)::result=0
    character(50)::S
    read(5,*)N
    read(5,*)S

    do i=1,N-2
        if(S(i:i+2)=="ABC")then
            result=result+1
        end if
    end do

    print'(i0)',result
end program ABC150B

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

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
    string S[3];
    REP(i, 3)
    {
        cin >> S[i];
    }
    REP(i, 3)
    {
        cout << S[i][0];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
K, N  = map(int,input().split())
List = list(map(int,input().split()))
d = []
for i in range(1,N):
  x = min(abs(List[i]-List[i-1]), K-abs(List[i]-List[i-1]))
  d.append(x)
d.append(min(abs(List[N-1]-List[0]), K-abs(List[N-1]-List[0])))
result = K - int(max(d))
print(result)

Measured memory_bytes: 25840
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    int n;
    while(cin>>n)
    {
        int s[111];
        for(int i=0;i<n;i++)
        {
            cin>>s[i];
        }
        sort(s,s+n);
        int ans=1;
        for(int i=0;i<n-1;i++)
        {
            if(s[i]!=s[i+1])
                ans++;
        }
        cout<<ans<<endl;
    }
    return 0;
}


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

#define DEBUG(x) cerr << #x << ": " << x << endl;
#define ll long long

int main() {
    int a, b, h;
    cin >> a >> b >> h;
    cout << (a + b) * h / 2 << endl;

    return 0;
}

Measured memory_bytes: 256
n=int(input())
p=[]
m=[]

for i in range(n):
    x,y=list(map(int,input().split()))
    p.append(x+y)
    m.append(x-y)

minp=min(p)
maxp=max(p)
minm=min(m)
maxm=max(m)

ans=[maxp-minp,maxm-minm,minm,maxm,minp-maxp]
print(max(ans))

Measured memory_bytes: 24948
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cmath>

#define EPS	1.0e-10
#define rep(idx, max)	for(int idx = 0, idx##Max = max; idx < idx##Max; idx ++)
#define rrep(idx, min, max)	for(int idx = min, idx##Max = max; idx < idx##Max; idx ++)
#define erep(idx, min, max)	for(int idx = min, idx##Max = max; idx <= idx##Max; idx ++)

#define rev(idx, max)	for(int idx = max - 1; idx >= 0; idx --)
#define MAX_N	128
char g_map[MAX_N][MAX_N];

int main()
{
	static int dx[] = { -1, 0, 1, 0 };
	static int dy[] = { 0, -1, 0, 1 };
	int dir;
	int edgeLen;
	int testCases;

	std::cin >> testCases;
	while (testCases -- > 0)
	{
		int x, y;
		std::cin >> edgeLen;
		::memset(g_map, ' ', sizeof(g_map));

		rep(y, edgeLen)
		{
			g_map[y][edgeLen] = '\0';
		}

		dir = 0;
		// ????????????????????????????????????????????????2????????????
		x = edgeLen + 2 - 1;
		y = edgeLen + 2 - 1;
		for (int n = edgeLen + 2; n >= 2; )
		{
			rep(i, n == 2 ? 1 : 2)
			{
				rep(j, n)
				{
					g_map[y][x] = '#';
					//::printf("(%d, %d)\n", x, y);
					x += dx[dir];
					y += dy[dir];
				}
				x -= dx[dir];
				y -= dy[dir];
				dir = (dir + 1) & 0x03;
			}
			n -= 2;
		}

		rep(y, edgeLen)
		{
			::puts(&g_map[y][0]);
		}
		if (testCases != 0) { ::puts(""); }
	}

	return(0);
}

Measured memory_bytes: 1140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define rep(i, n) for(ll i = 0;i < n;i++)
template<class T, class U> void cmax(T& a, U b) { if (a<b) a = b; }
template<class T, class U> void cmin(T& a, U b) { if (a>b) a = b; }
int main() {
  cin.tie(0); ios::sync_with_stdio(false);

  int N;
  vector<int> take(3);
  cin >> N;
  rep(i, 3) cin >> take[i];
  vector<int> l(N);
  rep(i, N) {
    cin >> l[i];
  }

  int ans = 10000000;
  rep(i, 1<<2*N) {
    vector<int> sum(3);
    vector<int> cnt(3);
    rep(j, N) {
      if (i & 1 << j*2) {
        if (i & 1 << j*2+1) {
          sum[0] += l[j];
          cnt[0]++;
        } else {
          sum[1] += l[j];
          cnt[1]++;
        }
      } else {
        if (i & 1 << j*2+1) {
          sum[2] += l[j];
          cnt[2]++;
        }
      }
    }

    if (any_of(cnt.begin(), cnt.end(), [](int n){return n==0;})) continue;
    

    int mp = 0;
    rep(i, 3) {
      mp += abs(take[i]-sum[i]) + (cnt[i]-1)*10;
    }
    cmin(ans, mp);
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vl = vector<ll>;
using vvll = vector<vl>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
int main(){
  int n,W;
  cin>>n>>W;
  vl w(n);
  vl v(n);
  rep(i,n){
    cin>>w[i]>>v[i];
  }
  vvll dp(110,vl(100100,MOD));
  dp[0][0]=0;
  rep(i,n){
    rep(j,100100){
      if(j>=v[i]){
        dp[i+1][j]=min(dp[i][j],dp[i][j-v[i]]+w[i]);
      }
      else{
        dp[i+1][j]=dp[i][j];
      }
    }
  }
  ll ans=0;
  int cu=0;
  rep(i,100100){
    if(dp[n][i]<=W){
      ans=dp[n][i];
      cu=i;
    }

  }
  COUT(cu);
}

        
    


Measured memory_bytes: 87296
H,W = gets.split.map(&:to_i)
A = Array.new(H).map{Array.new(W)}
num = 0
H.times do |i|
    a = gets.chomp.split('')
    num += a.count{|z| z=='#'}
end
puts num == H+W-1 ? "Possible" : "Impossible"

Measured memory_bytes: 1788
#include <cstdio>
#include <cstring>
#include <string>
using namespace std;

typedef long long LL;

int h, w;
LL L;
int visit[102][102][4];
int log[41000];
char c[102][102];

int main(){
	const string dirstr = "NESW";
	int dy[] = {-1, 0, 1, 0};
	int dx[] = {0, 1, 0, -1};

	while(scanf("%d%d%lld", &h, &w, &L), h){
		memset(visit, -1, sizeof visit);
		memset(c, '#', sizeof c);
		for(int i = 1; i <= h; ++i){
			scanf("%s", c[i] + 1);
			c[i][w + 1] = '#';
		}

		int y, x, d;
		for(int i = 1; i <= h; ++i)
		for(int j = 1; j <= w; ++j){
			if(c[i][j] != '.' && c[i][j] != '#'){
				y = i;
				x = j;
				d = dirstr.find(c[i][j]);
				c[i][j] = '.';
				break;
			}
		}

		for(LL t = 0; ;){
			int ny = y + dy[d], nx = x + dx[d];
			if(c[ny][nx] != '#'){
				++t;
				log[t] = (ny << 10) | (nx << 2) | d;
				y = ny;
				x = nx;

				if(t == L){
					break;
				}

				int p = visit[y][x][d];
				if(p < 0){
					visit[y][x][d] = t;
				}
				else{
					LL dif = t - p;
					LL rem = (L - t) % dif;
					int q = log[p + rem];
					y = q >> 10;
					x = (q >> 2) & 0xff;
					d = q & 3;
					break;
				}
			}
			else{
				d = (d + 1) & 3;
			}
		}
		
		printf("%d %d %c\n", y, x, dirstr[d]);
	}
}

Measured memory_bytes: 1268
#include<stdio.h>

int n,a[100];

void print(){
    for(int i=0;i<n;i++){
        if(i)printf(" ");
        printf("%d",a[i]);
    }
    printf("\n");
}

void InsertionSort(){
    int v;
    for(int i=1;i<n;i++){
        int j=i-1;
        v=a[i];
        while(j>=0&&v<a[j]){
            a[j+1]=a[j];
            j--;
        }
        a[j+1]=v;
        print();
    }
}

int main(){
    scanf("%d",&n);

    for(int i=0;i<n;i++)scanf("%d",&a[i]);
    print();
    InsertionSort();
    return 0;
}


Measured memory_bytes: 2748
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    int low = max(a,c);
    int up = min(b,d);
    int ans = up-low;
    cout << (ans < 0 ? 0: ans) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// define #Asukaminato is cute
#define ll long long
#define rep(i, m) for (int i = 0; i < (int)(m); i++)
const int inf = 1000000000; // 10^9 Ten to the power of nine.

const double PI=3.1415;
int main(){
	ll N;
	cin>>N;
 cout<< setprecision(5)<<2*N*PI;
	
}


Measured memory_bytes: 3780
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const int MOD = 998244353;
const ll INF = 1000000000000000000;

struct UnionFind {
	vector<int> par;
	UnionFind(int x) : par(x, -1) {}
	void init(int x) { par.assign(x, -1); }
	int root(int x) {
		if (par[x] <= -1) return x;
		else return root(par[x]);
	}
	bool issame(int x, int y) {
		return root(x) == root(y);
	}
	bool merge(int x, int y) {
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}
	int size(int x) {
		return -par[root(x)];
	}
};
int main()
{
	int N, M;
	cin >> N >> M;
	UnionFind uf(N);
	for (int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		uf.merge(a, b);
	}
	int ans = 0;
	for (int i = 0; i < N; i++) {
		ans = max(ans, uf.size(i));
	}
	cout << ans << endl;
}

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

int main(){
    int N; cin >> N;
    vector<vector<int> > F(N, vector<int>(10,0)), P(N, vector<int>(11,0));
    for(int i = 0; i < N; i++){
        for(int j = 0; j < 10; j++){
            cin >> F[i][j];
        }
    }
    for(int i = 0; i < N; i++){
        for(int j = 0; j <= 10; j++){
            cin >> P[i][j];
        }
    }
    /*
    for(int i = 0; i < N; i++){
        for(int j = 0;j < 10; j++){
            cout << "i j:" << i << " " <<j << " " <<  P[i][j] << endl;
        }
    }*/
    int ans = -1e9;
    for(int i = 1; i < 1 << 10; i++){
        int num[N] = {0};
        for(int k = 0; k < N; k++){
            for(int j = 0; j < 10; j++){
                if(i >> j & F[k][j]) num[k]++;
            }
        }

        int pft = 0;
        for(int k = 0; k < N; k++){
            //if(num[k] >= 5) cout << "num[k]: " << num[k] <<endl;
            pft += P[k][num[k]];
        }
        //cout << pft << endl;
        ans = max(pft, ans );
    }
    cout << ans <<endl;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
ES = []
D = {}

*parent, = range(M)
def root(x):
    if x == parent[x]:
        return x
    parent[x] = y = root(parent[x])
    return y
def unite(x, y):
    px = root(x); py = root(y)
    if px < py:
        parent[py] = px
    else:
        parent[px] = py

E = {}
for i in range(M):
    p, q, c = map(int, input().split()); p -= 1; q -= 1
    ES.append((p, q, c))
    if (p, c) in D:
        unite(D[p, c], i)
    D[p, c] = i
    E.setdefault(p, set()).add(c)
    if (q, c) in D:
        unite(D[q, c], i)
    D[q, c] = i
    E.setdefault(q, set()).add(c)
#P = [[] for i in range(M)]
P = {}
for i in range(M):
    j = root(i)
    p, q, c = ES[i]
    s = P.setdefault(j, set())
    s.add(p); s.add(q)

from collections import deque
que = deque([(0, 0, 0)])
INF = 10**18
dist = [INF]*N
dist[0] = 0
gdist = [INF]*M

while que:
    cost, v, t = que.popleft()
    if t:
        # edge
        if gdist[v] < cost or v not in P:
            continue
        for w in P[v]:
            if cost + 1 < dist[w]:
                dist[w] = cost + 1
                que.append((cost + 1, w, 0))
    else:
        # node
        if dist[v] < cost or v not in E:
            continue
        for c in E[v]:
            w = root(D[v, c])
            if cost < gdist[w]:
                gdist[w] = cost
                que.appendleft((cost, w, 1))

print(dist[N-1] if dist[N-1] < INF else -1)


Measured memory_bytes: 205128
n=int(input())
x=y=1
q=10**(-5)
import math
for i in range(n):
	a,b=map(int,input().split())
	# aa=math.ceil((x+q)/a)
	# bb=math.ceil((y+q)/b)
	# if x%a==0:
	# 	aa=x//a
	# if y%b==0:
	# 	bb=y//b
	aa=(x-1)//a+1
	bb=(y-1)//b+1
	p=max(aa,bb)
	x=p*a
	y=p*b
print(x+y)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n, x;
    cin >> n >> x;
    vector<int> l(n);
    for (int i = 0; i < n; i++) {
        cin >> l[i];
    }
    int ans = 1;
    int aa = 0;
    for (int i = 0; i < n; i++) {
        aa += l[i];
        if (aa <= x) {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

typedef long long ll;

#define p_ary(ary,a,b,i) do { cout << "["; for (int i = a;i < b;++i) cout << ary[i] << (b-1 == i ? "]\n" : ", "); } while(0)
#define p_map(map,it) do {cout << "{";for (auto it = map.begin();;++it) {if (it == map.end()) {cout << "}\n";break;}else cout << "" << it->first << "=>" << it->second << ", ";}}while(0)

int main() {
    int n,m;
    cin >> n >> m;
    vector<vector<int>> edges(n);
    for (int i = 0;i < m;++i) {
        int x,y;
        cin >> x >> y;
        edges[x-1].push_back(y-1);
    }

    vector<bool> used(n,false);
    vector<int> dp(n,0),l;
    for (int i = 0;i < n;++i) if (!used[i]) {
        vector<int> stack;
        stack.push_back(i);
        used[i] = true;
        while (!stack.empty()) {
            int p = stack.back();
            for (int j = 0;j < edges[p].size();++j) if (!used[edges[p][j]]) {
                stack.push_back(edges[p][j]);
                used[edges[p][j]] = true;
                break;
            }
            if (p == stack.back()) {
                stack.pop_back();
                l.push_back(p);
            }
        }
    }
    reverse(l.begin(),l.end());

    for (int i = 0;i < n;++i) for (int j = 0;j < edges[l[i]].size();++j) dp[edges[l[i]][j]] = max(dp[edges[l[i]][j]],dp[l[i]]+1);

    cout << *max_element(dp.begin(),dp.end()) << endl;
    return 0;
}

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

string s;
bool sub() {
  for (int i = 0; i < s.size(); ++i) {
    if (i % 2 == 0) {
      if (s[i] == 'L') return false;
    } else {
      if (s[i] == 'R') return false;
    }
  }
  return true;
}

int main() {
  cin >> s;
  cout << (sub() ? "Yes" : "No") << endl;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

int main() {
	int n;
	scanf("%d", &n);

	int *a;
	int head, tail,b;

	a = (int *)malloc(n * sizeof(int));
	if (n % 2 == 1) {
		head = (n - 1) / 2 - 1;
		tail = (n - 1) / 2 + 1;
		for (int i = 0; i < n; i++) {
			scanf("%d", &b);
			if (i == 0) {
				a[head + 1] = b;
			}
			else if (i % 2 == 1) {
				a[tail] = b;
				tail++;
			}
			else {
				a[head] = b;
				head--;
			}
		}
	}
	else{
		head = n / 2 - 1;
		tail = n / 2;
		for (int i = 0; i < n; i++) {
			scanf("%d", &b);
			if (i % 2 == 0) {
				a[tail] = b;
				tail++;
			}
			else {
				a[head] = b;
				head--;
			}
		}
	}
	for (int i = 0; i < n; i++) {
		printf("%d ", a[i]);
	}
	return 0;
}

Measured memory_bytes: 2816
//√.
//本代码经过lm开光处理。
#include<bits/stdc++.h>
using namespace std;
int n,m; 
void init()
{
	cin>>n>>m;
	if(n-2*m<=0)
	{
		cout<<"0";
	}
	else
	{
		cout<<n-2*m;
	}
}
void work()
{
}
void print()
{
}
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	init();
	work();
	print();
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

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

int main()
{
    int n;
    std::cin >> n;
  	n%=10;

    if (n == 2 ||
        n == 4 ||
        n == 5 ||
        n == 7 ||
        n == 9)
        std::cout << "hon" << std::endl;
    else if (n == 0 || n == 1 || n == 6 || n == 8)
        std::cout << "pon" << std::endl;
    else
    {
        std::cout << "bon" << std::endl;
    }

    return 0;
}


Measured memory_bytes: 3640