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

using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;

#define REPS(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (int i = (a); i >= n; --i)
#define DEP(i, n) DEPS(i, n, 0)

#define vint(v, n) vector<int> v(n); REP(i,n) cin >> v[i];
#define vvint(v, w, n) vector<int> v(n); vector<int> w(n); REP(i,n) cin >> v[i] >> w[i];
#define vlint(v, n) vector<ll int> v(n); REP(i,n) cin >> v[i];
#define vdouble(v, n) vector<double> v(n); REP(i,n) cin >> v[i];
#define vvdoube(v, n1, n2) vector<vector<double> > v(n1, vector<double>(n2, 0)); REP(i,n1) REP(j,n1) cin >> v[i][j];
#define string(x) string x; cin >> x;
#define vstring(v, n) vector<string> v(n); REP(i,n){string a; std::cin >> a; v.push_back(a); }

#define all(v) (v).begin(), (v).end()
#define rall(v) (v).begin(), (v).end(), std::greater<int>()
#define len(v) (v).length()
#define FIND(s, n) (s.find(n) != s.end())
#define SORT(a) sort(all(a))

static const string abet("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
static const long long MOD = 1000000007;
static const double PI=3.1415926535897932;
static const int INF = 0x3f3f3f3f;
static const int INFTY = (1 << 29);
static const long long LINFTY = (1LL << 32);

static const int dy4[]={0, 0, 1, -1};
static const int dx4[]={1, -1, 0, 0};
static const int dx8[] = {1, 1, 1, 0, 0, -1, -1, -1};
static const int dy8[] = {-1, 0, 1, -1, 1, -1, 0, 1};


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

	string S;
	cin >> S;

	int a, b;
	REP(i, S.length()) if(S[i]=='A'){a = i; break;}
	DEP(i, S.length()-1) if(S[i]=='Z') {b = i; break;}

	cout << b-a+1 << endl;
	return 0;
}


Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "-----------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T>inline istream& operator>>(istream& is, deque<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    int n; ll x; cin >> n >> x;
    VL a(n); cin >> a;
    ll ans = 0;
    FOR(i, 1, n) {
        if (a[i - 1] + a[i] <= x)continue;
        if (a[i - 1] <= x) {
            ans += a[i - 1] + a[i] - x;
            a[i] -= a[i - 1] + a[i] - x;
        }
        else {
            ans += a[i - 1] + a[i] - x;
            a[i - 1] -= a[i - 1] - x;
            a[i] = 0;
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) int((a).size())
#define out(a) cout<<(a)<<endl;
const int INF=INT_MAX;
const int MAX = 510000;
const ll MOD = 10000;
ll fac[MAX], finv[MAX], inv[MAX];

int main(){
  ll v,e;cin>>v>>e;
  vvll g(v,vll(v,INF)),dp(1<<v,vll(v,INF));
  rep(i,0,e){
    ll s,t,d;cin>>s>>t>>d;
    g[s][t]=d;
  }
  dp[(1<<v)-1][0]=0;
  drep(s,(1<<v)-2,0){
    rep(i,0,v){
      rep(j,0,v){
        if(!(s>>j&1)){
          dp[s][i]=min(dp[s][i],dp[s|1<<j][j]+g[i][j]);
        }
      }
    }
  }
  cout<<(dp[0][0]==INF?-1:dp[0][0])<<endl;
}



Measured memory_bytes: 7528
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(r: int):
    print(3*r*r)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    r = int(next(tokens))  # type: int
    solve(r)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include<iostream>
#include<iomanip>
#include<cassert>
#include<stdexcept>
#include<utility>
#include<functional>
#include<numeric>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<array>
#include<stack>
#include<queue>
#include<deque>
#include<vector>
#include<complex>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<string>
#include<bitset>
#include<memory>
using namespace std;
using ll=long long;

const int SIZE=17;

const ll MOD=1e9+7;

void add(int &lhs,int rhs){
    lhs=(lhs+rhs);
    if(lhs>=MOD) lhs-=MOD;
}
int main(){
    int n;
    cin>>n;
    int xyz[3];
    for(int i=0;i<3;i++) cin>>xyz[i];

    vector<vector<int>> dp(n+1,vector<int>(1<<SIZE));
    dp[0][(1<<SIZE)-1]=1;

    vector<int> isAccept(1<<SIZE);

    for(int bit=0;bit<(1<<SIZE);bit++){
        int st=0;
        int buf=0;
        for(int i=0;i<SIZE;i++){
            buf++;
            if(!((bit>>i)&1) && xyz[st]==buf){
                st++;
                buf=0;
                if(st==3){
                    isAccept[bit]=true;
                    break;
                }
            }
        }
    }

    vector<int> pow10(n);
    pow10[0]=1;
    for(int i=0;i+1<n;i++) pow10[i+1]=ll(pow10[i])*10%MOD;

    ll res=0;
    int mask=(1<<SIZE)-1;
    for(int i=0;i<n;i++){
        for(int bit=0;bit<(1<<SIZE);bit++){
            if(dp[i][bit]==0) continue;
            for(int v=1;v<=7;v++){
                int nex=(bit<<v)+(1<<(v-1))-1;
                nex&=mask;
                add(dp[i+1][nex],dp[i][bit]);
            }
            add(dp[i+1][mask],(3LL*dp[i][bit])%MOD);
        }
        for(int bit=0;bit<(1<<SIZE);bit++){
            if(isAccept[bit]){
                ll r=pow10[n-1-i];
                res+=r*dp[i+1][bit];
                res%=MOD;   
                dp[i+1][bit]=0;
            }
        }
    }

    cout<<res<<endl;
    
    
    return 0;
}


Measured memory_bytes: 21888
#include<stdio.h>

int main(){
  int a[4],b[4];
  int s=0,t=0;
  int i;

  for(i=0;i<4;i++){
    scanf("%d",&a[i]);
    s+=a[i];
  }
  for(i=0;i<4;i++){
    scanf("%d",&b[i]);
    t+=b[i];
  }
  if(s>t)
    printf("%d\n",s);
  else
    printf("%d\n",t);
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    vector<char> s(6);
    for(int i=0;i<6;i++){
    cin >> s[i];
    }
    if(s[0]==s[5]&&s[1]==s[4]&&s[2]==s[3]){
      cout<<"YES"<<endl;
    }
  else{
    cout<<"NO"<<endl;
  }
}


Measured memory_bytes: 256
#include <map>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#define LL long long
using namespace std;
const int MAXN = 2e5+55;
int vis[MAXN];
int main()
{
   int n;
   cin>>n;
   cout<<1ll*n*(n+1)/2;
    return 0;
}


Measured memory_bytes: 1016
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

// ユークリッドの互除法
LL extgcd(LL a, LL b, LL& x, LL& y)
{
	LL g = a; x = 1; y = 0;
	if (b != 0)
	{
		g = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	return g;
}

// 逆元
LL mod_inverse(LL a, LL m)
{
	LL x, y;
	extgcd(a, m, x, y);
	return (m + x % m) % m;
}

// 階乗
std::vector<LL>fact;
void mod_fact(LL n, LL m)
{
	fact.resize(n + 1);
	fact[0] = 1;
	for (LL i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i % m;
}

const LL mod = 1000000007;
LL N, K;
std::vector<std::vector<LL>>G;
std::vector<bool>vis;

LL mod_perm(LL n, LL r)
{
	if (n - r < 0) return 0;
	return (fact[n] * mod_inverse(fact[n - r], mod)) % mod;
}

LL dfs(LL v, LL p)
{
	if (vis[v]) return 0;
	vis[v] = true;

	LL res;
	if (p == 0) res = (K * mod_perm(K - 1, G[v].size())) % mod;
	else res = mod_perm(K - 2, (LL)G[v].size() - 1);
	for (LL u : G[v])
	{
		if (u != p) (res *= dfs(u, v)) %= mod;
	}
	return res;
}

int main()
{
	in >> N >> K;
	std::vector<LL>a(N - 1), b(N - 1);
	rep(i, N - 1) in >> a[i] >> b[i];

	G.resize(N + 1); vis.resize(N + 1);
	rep(i, N - 1)
	{
		G[a[i]].push_back(b[i]);
		G[b[i]].push_back(a[i]);
	}

	mod_fact(std::max(N, K), mod);
	out << dfs(1, 0) << std::endl;
}


Measured memory_bytes: 12800
n = io.read("*n")
x = io.read("*n")
s = {}
for i = 1, n do
	s[i] = io.read("*n")
end

function d(m, n)
	while true do
		r = m%n
		m = n
		n = r
		if r == 0 then
			break
		end
	end
	return m
end

ret = nil
for i = 1, n do
	if s[i] ~= x then
		if ret == nil then
			ret = math.abs(s[i] - x)
		else
			ret = d(ret, math.abs(s[i]-x))
		end
	end
end
print(ret)

Measured memory_bytes: 2424
h,w = map(int,input().split())
c = [input()for _ in range(h)]
ans = []
for i in range(1,2*h+1):
    res = ''
    for j in range(1,w+1):
        res += c[(i+1)//2-1][j-1]
    ans.append(res)
for i in range(2*h):
    print(ans[i])
        

Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);

		int N = sc.nextInt();
		int ans = 0;

		ans = N % 1000;
		if (ans > 0) {
			ans = 1000 - ans;
		}

		System.out.println(ans);
	}

	private static class FastScanner {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;

		public FastScanner(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
			tokenizer = null;
		}

		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

	}
}

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

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

    string S;
    cin >> S;

    int cnt = 0, ans = 0;
    for (int i=0; i<S.size(); ++i) {
        if (S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T') {
            cnt ++;
        } else {
            cnt = 0;
        }
        ans = max(cnt, ans);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import numpy as np


N = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

minV = min([a, b, c, d, e])
q = int(N / minV)
r = int(N % minV)
if q != 0 and r != 0:
    print(5 + q)
elif q != 0 and r == 0:
    print(5 + q - 1)
else :
    print(5)

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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;

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

const ll maxf = 10000000;
ll fact[maxf+5];

void fact_init(){
  fact[0] = 1;
  for(ll i=1; i<=maxf; i++){
    fact[i] = (fact[i-1] * i) % MOD;
  }
}

ll comb(ll a, ll b){
  if(a<b || a<0 || b<0) return 0;
  if(fact[0] == 0) fact_init();
  return (fact[a] * modpow((fact[a-b]*fact[b])%MOD, MOD-2)) % MOD;
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll h,w,a,b; cin>>h>>w>>a>>b;
  ll ans=0;
  rep(i,w-b){
    ans+=(comb(h-a-1+b+i,h-a-1)*comb(a-1+w-b-i-1,a-1))%MOD;
    ans%=MOD;
  }
  cout<<ans<<endl;
}

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

using namespace std;

using int64 = long long;

constexpr int64 P = 1000000007;

// Verified: ABC133E, ABC132D, ABC130E
struct FiniteField {
 private:
  int64 x;
 public:
  FiniteField(int64 x) : x(x) {}
  FiniteField() : x(0) {}
  int64 Value() { return x; }
  inline FiniteField operator+(FiniteField o) {
    FiniteField r(*this); r += o; return r;
  }
  inline FiniteField operator-(FiniteField o) {
    FiniteField r(*this); r -= o; return r;
  }
  inline FiniteField operator* (FiniteField o) {
    FiniteField r(*this); r *= o; return r;
  }
  inline FiniteField operator/ (FiniteField o) {
    FiniteField r(*this); r /= o; return r;
  }
  inline void operator+= (FiniteField o) { x = (x + o.x) % P; }
  inline void operator-= (FiniteField o) { x = (x + P - o.x) % P; }
  inline void operator*= (FiniteField o) { x = (x * o.x) % P; }
  void operator/=(FiniteField o) {
    int64 p = P - 2; while (p) { if (p % 2) { *this *= o; } o *= o; p /= 2; }
  }
};

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

  int n, k;
  cin >> n >> k;
  if (k < n) {
    cout << 0 << endl;
    return 0;
  }
  FiniteField value = 1;
  for (int i = k; i >= k - n + 1; i--) {
    value *= i;
  }
  cout << value.Value() << endl;
}



Measured memory_bytes: 3172
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res
def gcd(x, y):
    if x < y: x, y = y, x
    div = x % y
    while div != 0:
        x, y = y, div
        div = x % y
    return y

N=II()

mp={}

for i in range(N):
    key = "".join(sorted(input()))
    if key in mp:
        mp[key] += 1
    else:
        mp[key] = 1

res = 0
for k, v in mp.items():
    if v >= 2: res += (v * (v-1) // 2)

print(res)


Measured memory_bytes: 17972
//--------------------------------------//
#include <bits/stdc++.h>
#include <vector>
//-------------------------------------//
#define faster               ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ROF(x, y)            for(int i=int(x)-1; i>=int(y); i--)
#define FOR(x, y)            for(int i=int(x); i<int(y); i++)
#define test                 int t; cin >>t; while(t--)
#define strsort(s)           sort(s.begin(), s.end());
#define eofstr               string s; while(cin >>s)
#define cs(i)                printf("Case %d: ", i);
#define eof                  long long int n; while(cin>>n)
#define Y                    cout <<"YES" <<endl;
#define N                    cout <<"NO" <<endl;
#define noo                  cout <<"-1" <<endl;
#define pi a                 cos(-1)
#define cube(x)              (x*x*x)
#define sqr(x)               (x*x)
#include <algorithm>
//-------------------------------------//
typedef unsigned long long   ull;
typedef long long int        lld;
typedef long double          ld;
using namespace std;

//----<<some short ninja function>>----//
//sort(arr, arr+n, greater<int>());
//get line(c i n, s t r);
//*max_element(x, x+n);
//string_stream any_name(s); (string->int)
//-------------------------------------//

lld i, j, f, fn, k, a, l, m, n, o, p;

int main()
{
    lld a, b, c, d;
    cin >>a >>b >>c >>d;
    lld x[4];
    x[0] = max(a, b)* max(c,d);
    x[1] = min(a, b)* max(c,d);
    x[2] = max(a, b)* min(c,d);
    x[3] = min(a, b)* min(c,d);
    sort(x, x+4);
    cout <<x[3] <<endl;
}


Measured memory_bytes: 3636
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.numeric;


void main()
{
  auto x = readln.chomp.to!int;
  immutable m = 200_000 + 1;
  auto f = new bool[](m);
  auto res = 1;
  foreach (i; 2..m) {
    if (f[i]) continue;
    else if (x <= i) {
      res = i;
      break;
    }
    foreach (j; iota(i, m, i)) {
      f[j] = true;
    }
  }
  res.writeln;
}


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

using namespace std;

int main() {
    int n = 0;
    cin >> n;
    
    int sum = 0;
    int maxLen = -1;
    for(int i = 0; i < n; ++i) {
        int x = 0;
        cin >> x;
        sum += x;
        maxLen = max(maxLen, x);
    }
    sum -= maxLen;
    if(sum > maxLen) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
    // ifstream in("data1.txt");
    // cin.rdbuf(in.rdbuf());
    int A, B, C;
    cin >> A >> B >> C;
    int ans = 0;
    if(B / A >= C) {
        ans = C;
    } else {
        ans = B / A;
    }
    cout << ans << endl;
}

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

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

    ll num = (ll)sqrt(N);
    while (num > 0) {
        if (N % num == 0)
            break;
        num--;
    }
    cout << num + N / num - 2 << endl;
}

Measured memory_bytes: 3648
#include<stdio.h>
int main()
{
	int i,j,a,b,c;
	for(c=1;;)
	{
		scanf("%d %d",&a,&b);
		if(a==0 && b==0)break;
		for(j=1;j<=a;j++)
		if(j%2==0)
	{
		for(i=1;i<=b;i++)
			{
				if(i%2==0)
					printf("#");
				else
					printf(".");
		}
			printf("\n");
		}
		else
		{
				for(i=1;i<=b;i++)
				{
				if(i%2==0)
					printf(".");
				else
					printf("#");
				}
					printf("\n");
		}	
			printf("\n");
	}
	return 0;
}



Measured memory_bytes: 2048
#include<bits/stdc++.h>
#include <string>
using namespace std;
#include<chrono>
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define foo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define min3(a,b,c)         min(a,min(b,c))
#define max3(a,b,c)         max(a,max(b,c))
#define min4(a,b,c,d)       min(a,min(b,min(c,d)))
#define max4(a,b,c,d)       max(a,max(b,max(c,d)))
#define max5(a,b,c,d,e)     max(max3(a,b,c),max(d,e))
#define min5(a,b,c,d,e)     min(min3(a,b,c),min(d,e))
typedef pair<int, int>  pii;
typedef pair<ll, ll>  pl;
typedef vector<int>   vi;
typedef vector<ll>    vl;
typedef vector<pii>   vpii;
typedef vector<pl>    vpl;
typedef vector<vi>    vvi;
typedef vector<vl>    vvl;
int mpow(int base, int exp); 
void ipgraph(int m);
void DFS(int n);
bool isprime(ll n);
int gcd(int a,int b);
void rstgraph(int n);

const int mod = pow(10,9)+7;
const int N = 3e5, M = N;

//=======================================================================================
vi g[N];
int vis[N];
int nodes=0;
// ll ans=0;

void iluzn() {
double n,t;int x;
cin>>n>>x>>t;
int d=ceil(n/x);
cout<<int(d*t);

}
 
int main() {
  #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
  #endif
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--)
     {
      iluzn();
    
      }
    return 0;
}
int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}
bool isprime(ll n){
    if(n<=1)
        return false;
    if(n==2)
        return true;
    if(n%2==0)
        return false;
    ll rt = sqrt(n);
    for(ll i=3;i<rt;i+=2){
        if(n%i==0)
            return false;
    }
    return true;
}
int gcd(int a, int b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b); 
} 
void ipgraph(int m){
  int u, v;
  while(m--){
    cin>>u>>v;
    g[u].pb(v);
    // g[v].pb(u);
  }
}

void DFS(int n)
{  ++nodes;
    vis[n] = 1;
    for(vector<int>::iterator i = g[n].begin(); i != g[n].end() ; i++)
    {
        if(!vis[*i])
            DFS(*i);
    }
}
void rstgraph(int n){
  int i;
  fo(i,n+1){
    g[i].clear();
    vis[i]=0;
  }
  nodes=0;
}

Measured memory_bytes: 10748
import sys


def solve(S: str):

    if S == 'ABC':
        print('ARC')
    else:
        print('ABC')

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9044
<?php
ini_set('error_reporting', E_ALL & ~E_NOTICE);

// define('DEBUG', true);
define('DEBUG', false);

fscanf(STDIN, "%d %d %d %d %d", $A, $B, $C, $X, $Y);

$maxC = max($X, $Y) * 2;

$answer = PHP_INT_MAX;

for ($CC = 0; $CC <= $maxC; $CC += 2) {
	// Cピザを2枚買うとAピザを1枚買わなくて済む
	$AA = max(0, $X - $CC / 2);
	// Cピザを2枚買うとBピザを1枚買わなくて済む
	$BB = max(0, $Y - $CC / 2);
	$cost = $AA * $A + $BB * $B + $CC * $C;

	if (DEBUG) {
		printf("A:%d B:%d C:%d\n", $AA, $BB, $CC);
	}

	$answer = min($answer, $cost);
}
echo $answer;


Measured memory_bytes: 4728
#include <bits/stdc++.h>
    
using namespace std;
    
#define endl "\n"
#define ll unsigned long long
#define int long long int
#define vi vector <int >
#define vii vector < pii >
#define vll vector <ll >
#define pii pair <int, int>
#define pdd pair< double, double>
#define piii pair < pii, int > 
#define pll pair<ll, ll >
#define umap unordered_map
#define pb push_back
#define pq priority_queue
#define forn(i, n) for(int i = 0; i < (int)n; i++)
#define rep(i,b,c) for(int i = (int)b; i < (int)c; i++)
#define double long double
// #define a first
// #define b second
const int mod = 1e9 + 7;
vector < vi > v(100010);
stack <int > st;
int dp[1010][1010], n, m;
char arr[1010][1010];

int32_t main(){
    ios::sync_with_stdio(0),cin.tie(0);	
    
    memset(dp, 0, sizeof dp);
    cin >> n >> m;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++)
            cin >> arr[i][j];
    }
    dp[n - 1][m - 1] = 1;
    for(int i = n - 1; i >= 0; i--){
        for(int j = m - 1; j >= 0; j--){
            if(i > 0)
                if(arr[i - 1][j] != '#')
                    dp[i - 1][j] = (dp[i - 1][j]%mod + dp[i][j]%mod)%mod;
            if(j > 0)
                if(arr[i][j - 1] != '#')
                    dp[i][j - 1] = (dp[i][j - 1]%mod + dp[i][j]%mod)%mod;
            dp[i][j] %= mod;
        }
    }
    cout << dp[0][0]%mod << endl;


    return 0;
}

Measured memory_bytes: 11520
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int[] wa = new int[N];
		boolean[] clear = new boolean[N];
		int waCnt = 0;
		int ac = 0;
		
		for (int i=0; i<M; i++) {
			int p = sc.nextInt() - 1;
			String s = sc.next();
			
			if (!clear[p]) {
				if (s.equals("AC")) {
					clear[p] = true;
					waCnt += wa[p];
					ac++;
				} else {
					wa[p]++;
				}
			}
		}
		
		System.out.println(ac + " " + waCnt);
	}
}

Measured memory_bytes: 65444
n,x,y=map(int,input().split())
ans=[0]*(n-1)
for i in range(n-1):
    for j in range(i+1,n):
        ans[min(abs(i-j),abs(i-x+1)+1+abs(j-y+1))-1]+=1
for i in range(n-1):
    print(ans[i])

Measured memory_bytes: 47196
#include<bits/stdc++.h>
using namespace std;
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;

#define int ll
#define rep(i,n) for(int i=0,i##_cond=(n);i<i##_cond;++i)
#define FOR(i,a,b) for(int i=(a),i##_cond=(b);i<i##_cond;++i)
#define ROF(i,a,b) for(int i=(a)-1,i##_cond=(b);i>=i##_cond;--i)
using ll  = long long;
using vi  = vector<int>;

constexpr int inf = 1ll<<62;

main(){
  int n,x; cin >> n >> x;
  vi a(n+1);
  rep(i,n){
    cin >> a[i+1];
    a[i+1] += a[i];
  }
  
  mp::cpp_int ans = inf;
  FOR(k,1,n+1){
    mp::cpp_int tmp = (n+k)*x;
    int j = 1;
    for(int i = n; i > 0; i -= k){
      int l = max(0ll,i-k);
      int c = (j == 1 ? 5 : j*2+1);
      tmp += c * (a[i] - a[l]);
      j++;
    }
    ans = min(ans, tmp);
  }
  cout << ans << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int,int> pi;
typedef long long ll;
int main(){
	ll n,y;
	cin>>n>>y;
	ll maxbill = y/1000;
	if(n>maxbill) cout<<-1<<" "<<-1<<" "<<-1;
	else if(n==maxbill) cout<<0<<" "<<0<<" "<<maxbill;
	else{
		ll diff = maxbill-n;
		// 9a + 4b = diff;
		for(int i=0; i<=diff; i++){
			for(int j=0; j<=diff; j++){
				if(9*i+4*j==diff && n-j-i>=0){
					cout<<i<<" "<<j<<" "<<n-j-i;
					return 0;
				}
			}
		}
		cout<<-1<<" "<<-1<<" "<<-1;
	}
}

Measured memory_bytes: 3588
N, K = map(int, input().split())
XY = []
X = []
Y = []
for _ in range(N):
    x, y = map(int, input().split())
    XY.append((x, y))
    X.append(x)
    Y.append(y)
X.sort()
Y.sort()
ix = {v: i for i, v in enumerate(X)}
iy = {v: i for i, v in enumerate(Y)}
m = [[0] * (len(X) + 1) for _ in range(len(Y) + 1)]
for x, y in XY:
    m[iy[y] + 1][ix[x] + 1] += 1
for y in range(len(Y) + 1):
    for x in range(len(X)):
        m[y][x + 1] += m[y][x]
for x in range(len(X) + 1):
    for y in range(len(Y)):
        m[y + 1][x] += m[y][x]
ans = float("inf")
for x0 in range(len(X) - 1):
    for x1 in range(x0 + 1, len(X)):
        for y0 in range(len(Y) - 1):
            for y1 in range(y0 + 1, len(Y)):
                n = m[y1 + 1][x1 + 1] - m[y0][x1 + 1] - \
                    m[y1 + 1][x0] + m[y0][x0]
                if n >= K:
                    s = (X[x1] - X[x0]) * (Y[y1] - Y[y0])
                    ans = min(ans, s)
print(ans)


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

const int MOD = 1000000007;
const int INF = 1e9;

int main(){
  int n;
  const int max_n = 1e5;
  int a[max_n+1];
  int q;
  int b[max_n+1], c[max_n+1];

  vector<int> num(max_n, 0);
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> a[i];
    num[a[i]] ++;
  }
  cin >> q;
  for(int i = 0; i < q; i++){
    cin >> b[i] >> c[i];
  }

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

  int change = 0;
  for(int i = 0; i < q; i++){
    change = c[i] - b[i];
    ans = ans + num[b[i]] * change;
    num[c[i]] += num[b[i]];
    num[b[i]] = 0;
    cout << ans << endl;
  }



  return 0;
}

Measured memory_bytes: 4788
from sys import stdin
N,M,K = [int(x) for x in stdin.readline().rstrip().split()]
flag = False
for a in range(N+1):
    for b in range(M+1):
        if (N-a)*b + (M-b)*a == K:
            flag = True
if flag:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,s,n) for (int i = (s); i < (n); ++i)
#define rrep(i,n,g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define len(x) (int)(x).size()
#define dup(x,y) (((x)+(y)-1)/(y))
#define append push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int n;
  cin >> n;
  int s = 0,m = 0;
  rep(i,0,n) {
    int l;
    cin >> l;
    s += l;
    m = max(m,l);
  }
  s -= m;
  if (m < s) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3616
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

int main() {
  int64_t a;
  int64_t b, c;
  char _;
  cin >> a >> b >> _ >> c;
  int64_t result = a * (b * 100 + c) / 100;
  cout << result << endl;

  return 0;
}

Measured memory_bytes: 3640
using System;

public class Program
{
	public static void Main(string[] args)
	{
		var ss = new StreamScanner();
		//---------------------------------
		//????????????int, double, string?????????????????£????????????
		while (true)
		{
			var m = ss.Next<int>();
			var f = ss.Next<int>();
			var r = ss.Next<int>();
			if (m == -1 && f == -1 && r == -1)
			{
				break;
			}




			if (m == -1 || f == -1)
			{
				Console.WriteLine("F");
			}
			else if (m + f >= 80)
			{
				Console.WriteLine("A");
			}
			else if (m + f >= 65)
			{
				Console.WriteLine("B");
			}
			else if (m + f >= 50)
			{
				Console.WriteLine("C");
			}
			else if (m + f >= 30 && r >= 50)
			{
				Console.WriteLine("C");
			}
			else if (m + f >= 30 )
			{
				Console.WriteLine("D");
			}
			else 
			{
				Console.WriteLine("F");
			}
		}


		//int x = ss.Next<int>();
		//double d = ss.Next<double>();
		//string s = ss.Next<string>();

		//?????°???????????????????????¨?????????????????????????????????????????????????´???????
		//int[] array = ss.Next<int>(10);
		//---------------------------------
	}
}

public class StreamScanner
{
	private readonly char[] _c = { ' ' };
	private int _index = -1;
	private string[] _input = new string[0];
	private readonly System.IO.StreamReader _sr = new System.IO.StreamReader(Console.OpenStandardInput());

	public T Next<T>()
	{
		if (_index == _input.Length - 1)
		{
			_index = -1;
			while (true)
			{
				string rl = _sr.ReadLine();
				if (rl == null)
				{
					if (typeof(T).IsClass) return default(T);
					return (T)typeof(T).GetField("MinValue").GetValue(null);
				}
				if (rl != "")
				{
					_input = rl.Split(_c, StringSplitOptions.RemoveEmptyEntries);
					break;
				}
			}
		}
		return (T)Convert.ChangeType(_input[++_index], typeof(T), System.Globalization.CultureInfo.InvariantCulture);
	}

	public T[] Next<T>(int x)
	{
		var ret = new T[x];
		for (var i = 0; i < x; ++i) ret[i] = Next<T>();
		return ret;
	}

	public T[][] Next<T>(int x, int y)
	{
		var ret = new T[y][];
		for (var i = 0; i < y; ++i) ret[i] = Next<T>(x);
		return ret;
	}
}

Measured memory_bytes: 9832
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define printYes() cout << "Yes" << endl;
#define printNo() cout << "No" << endl;
#define printVector(v) rep(i, v.size()) cout << v[i] << endl;

int main()
{
  int N, K;
  cin >> N >> K;
  int ans = 0;
  if (N < K)
    ans = 1;
  else if (N % K != 0)
    ans = 1;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

class question {
public:
	int A, B, C;
	void ans() {
		cin >> A >> B >> C;
		C = min(C, A + B + 1);
		cout << B + C << "\n";
	}
};

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

	question q;
	q.ans();

	return 0;
}



Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[][] V = new long[n][2];
        for (int i = 0; i < n; i++) {
            V[i][0] = sc.nextLong();
            V[i][1] = sc.nextLong();
        }
        Arrays.sort(V, (x,y) -> Long.compare(x[0], y[0]));
        int uv = 0, dv = 0;
        long cx = V[0][0], cy = V[0][1];
        long umax = 0L, dmax = 0L;
        for (int i = 1; i < n; i++) {
            long tmp = Math.abs(cx - V[i][0]) + Math.abs(cy - V[i][1]);
            if(cy < V[i][1]){
                if(umax < tmp){
                    umax = tmp;
                    uv = i;
                }
            }else{
                if(dmax < tmp){
                    dmax = tmp;
                    dv = i;
                }
            }
        }
        long ux = V[uv][0], uy = V[uv][1];
        long dx = V[dv][0], dy = V[dv][1];
        long max = 0L;
        for (int i = 0; i < n; i++) {
            long utmp = Math.abs(ux - V[i][0]) + Math.abs(uy - V[i][1]);
            if(max < utmp) max = utmp;
            long dtmp = Math.abs(dx - V[i][0]) + Math.abs(dy - V[i][1]);
            if(max < dtmp) max = dtmp;
        }
        System.out.println(max);
        sc.close();

    }

}


Measured memory_bytes: 66548
main :: IO()
main = do
  n <- readLn
  putStrLn $ show $ solve n

solve :: Int -> Int
solve n = minimum $ map addPairs $ filter ((==0) . (n `mod`)) $ listsUntilSqrtN n
  where
    addPairs d = d + (n `div` d) - 2
  
listsUntilSqrtN :: Int -> [Int]
listsUntilSqrtN n = let sqrtN = ceiling $ sqrt $ fromIntegral n
                      in [1..sqrtN]

Measured memory_bytes: 764
from bisect import bisect_left
N, K = map(int, input().split())
A = list(map(int, input().split()))
B = sorted(A)
p = 10**9+7

list1 = [bisect_left(B,A[i]) for i in range(N)]
list2 = [bisect_left(sorted(A[i+1:]),A[i]) for i in range(N)]
ans = 0
for i in range(N):
  ans += list2[i] * K
  ans %= p
  tmp = K * (K-1) // 2
  ans += list1[i] * tmp
  ans %= p
print(ans)

Measured memory_bytes: 3316
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		sc.close();
		System.out.println(a + b >= 10 ? "error" : a + b);
	}

	public static boolean isPrime(long jud) {
		double root = Math.sqrt(jud);
		for (int i = 2; i <= root; i++) {
			if (jud % i == 0) {
				return false;
			}
		}
		return true;
	}

	// 配列要素数が1だと前触れなくバグるので注意！！！REりたくなければ要素数を保証するか例外処理を入れろ！！！
	public static long gcd(final long[] param) {
		final int len = param.length;
		long g = gcd(param[0], param[1]);
		for (int i = 1; i < len - 1; i++) {
			g = gcd(g, param[i + 1]);
		}
		return g;
	}

	public static long gcd(long a, long b) {
		// a > b にする(swap)
		if (a < b) {
			a = a ^ b;
			b = a ^ b;
			a = a ^ b;
		}
		// ユークリッドの互除法
		long r = -1;
		while (r != 0) {
			r = a % b;
			a = b;
			b = r;
		}

		return a; // b には r=0 の値が入るため、a を返す
	}

	public static long lcm(long m, long n) {
		return m * n / gcd(m, n);
	}

	public static long lcm(final long[] param) {
		final int len = param.length;
		long l = lcm(param[0], param[1]);
		for (int i = 1; i < len - 1; i++) {
			l = lcm(l, param[i + 1]);
		}
		return l;
	}

	public static int[] arrayInt(Scanner sc, int n) {
		int[] array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
		}
		return array;
	}

	public static long[] arrayLong(Scanner sc, int n) {
		long[] array = new long[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextLong();
		}
		return array;
	}

	public static double[] arrayDouble(Scanner sc, int n) {
		double[] array = new double[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextDouble();
		}
		return array;
	}
}


Measured memory_bytes: 21716
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		if (a < b) {
			System.out.println("a < b");
		} else if (a > b) {
			System.out.println("a > b");
		} else {
			System.out.println("a == b");
		}
	}

}

Measured memory_bytes: 17164
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip>
#include <fstream>
#define rep(i,a,b) for (long long i = a; i < b ; i++)

using namespace std;

int main(){
    int a, b;
    cin >> a >> b;
    int how = 0, sum= 1;
    if (b==1){
        cout << 0 << endl;
        return 0;
    }
    while (true){
        how++;
        sum+=a;
        sum--;
        if (sum>=b){
            cout << how << endl;
            return 0;
        }
    }
    
}

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


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

	if(S == "ARC")
		cout<<"ABC"<<endl;
	else
		cout<<"ARC"<<endl;

	return 0;
}

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

using namespace std;
int a[1111];
int main()
{
    int n,sum=0;
    cin >> n;
    for (int i=0;i<n;i++)
    {
        cin >> a[i];
        sum+=a[i];
    }
    double avg=sum*1.0L/n;
    int ans=0;
    for (int i=0;i<n;i++)
    {
        if (abs(a[i]-avg)<abs(a[ans]-avg))
        {
            ans=i;
        }
    }
    cout << ans <<endl;
    return 0;
}

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

int main() {
	int k[] = { 6000,4000,3000,2000 };
	rep(i, 4) {
		int a, b; cin >> a >> b;
		cout << k[--a] * b << endl;
	}
}

Measured memory_bytes: 3092
#include<iostream>
#include<string>
#include<typeinfo>
#include<vector>
#include<algorithm>
#include<map>
#include<iomanip>
using namespace std;
int main()
{
	vector<int> n(3);
  	for(int i=0; i<3; i++){
		cin >> n.at(i);
    }
  	sort(n.begin(),n.end());
  
  	cout << n.at(2)-n.at(0) << endl;
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> B(N);
  vector<int> C(N-1);
  rep(i, N) cin >> A[i];
  rep(i, N) cin >> B[i];
  rep(i, N-1) cin >> C[i];
  int ans = 0;
  rep(i, N){
    ans += B[A[i]-1];
  }
  rep(i, N-1){
    if(A[i+1]-A[i] == 1){
      ans += C[A[i]-1];
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
a,b,c,d = list(input())
sign = '+-'
for i in range(2):
  for j in range(2):
    for k in range(2):
      if eval( a+ sign[i] + b +sign[j]+ c + sign[k]+ d) ==7:
        print(str(a+sign[i]+b+sign[j]+c+sign[k]+d)+ '=7')
        exit()

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

int main(){
  int N,i;
  char S[10000];
  scanf("%d",&N);
  
  for(i=0;i<10000;i++){
    scanf("%s",S);
  }
  
  for(i=0;i<10000;i++){
    if(S[i]==NULL) break;
    if(S[i]+N>'Z') printf("%c",S[i]+N-26);
    else{
      printf("%c",S[i]+N);
    }
  }
}

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

#define ll unsigned long long
#define llong long long
#define REP(i,n) for(auto i=0;i<n;++i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define FOR(i,a,b) for(auto i=a;i<b++i)
#define ALL(v) v.begin(),v.end()
#define pb push_back

using namespace std;

int main(){
  int n;
  ll v;
  
  cin >> n >> v;
  vector<ll> a(n),b(n),c(n),d(n);
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }
  for(int i = 0; i < n; i++){
    cin >> b[i];
  }
  for(int i = 0; i < n; i++){
    cin >> c[i];
  }
  for(int i = 0; i < n; i++){
    cin >> d[i];
  }
  
  map<ll,ll> ab,cd;
  for(int i = 0; i < n; i++){
    for(int j = 0; j < n; j++){
      ll t = a[i]+b[j], s = c[i]+d[j];
      if(ab.find(t) == ab.end()){
        ab[t] = 1;
      }
      else{
        ab[t]++;
      }
      if(cd.find(s) == cd.end()){
        cd[s] = 1;
      }
      else{
        cd[s]++;
      }
    }
  }
  ll ans = 0;
  for(auto e = ab.begin(); e != ab.end(); ++e){
    ll sub = v - e->first;
    auto isfind = cd.find(sub);
    if(isfind != cd.end()){
      ans += e->second * isfind->second;
    }
  }
  cout << ans << endl;


  return 0;
}




Measured memory_bytes: 128080
import java.util.Arrays;
import java.util.Iterator;
import java.util.PrimitiveIterator;
import java.util.Scanner;
import java.util.function.LongFunction;
import java.util.stream.IntStream;
import java.util.stream.Stream;

class Main{

	private void solve(){
		int n=gInt(),a=gInt(),b=gInt(),h[]=ints(n).toArray();
		System.out.println(binarySearch(0,1145141919,i->f(a,b,h,i)));
	}
	long binarySearch(long l,long r,LongFunction<Long>f){
		while(true) {
			if(r-l<=1)
				return r;
			long mid=(l+r)/2,v=f.apply(mid);
			if(v>0)
				l=mid;
			else
				r=mid;
		}
	}
	long f(long a,long b,int[]h,long i){
		return Arrays.stream(h)
				.mapToLong(o->Math.max(((o-b*i)+a-b-1)/(a-b),0))
				.sum()-i;
	}


	public static void main(String[]$){
		new Main().solve();
	}

	static Scanner s=new Scanner(System.in);


	static int gInt(){
		return s.nextInt();
	}

	static long gLong(){
		return s.nextLong();
	}

	static long gDouble(){
		return s.nextLong();
	}


	static Range rep(int i){
		return new Range(i);
	}
	static Range rep(int f,int t,int d){
		return new Range(f,t,d);
	}
	static Range rep(int f,int t){
		return rep(f,t,1);
	}
	static Range rrep(int f,int t){
		return rep(f,t,-1);
	}

	static class Range implements Iterable<Integer>,PrimitiveIterator.OfInt{

		int to,cur,d;

		Range(int from,int to,int d){
			this.cur=from-d;
			this.to=to;
			this.d=d;
		}

		Range(int n){
			this(0,n-1,1);
		}

		@Override
		public Iterator<Integer> iterator(){
			return this;
		}

		@Override
		public boolean hasNext(){
			return cur+d==to||(cur!=to&&(cur<to==cur+d<to));
		}

		@Override
		public int nextInt(){
			return cur+=d;
		}
	}


	static IntStream REPS(int v){
		return IntStream.range(0,v);
	}

	static IntStream REPS(int l,int r){
		return IntStream.rangeClosed(l,r);
	}


	static IntStream ints(int n){
		return REPS(n).map(i->gInt());
	}

	static Stream<String> strs(int n){
		return REPS(n).mapToObj(i->s.next());
	}

}

Measured memory_bytes: 51292
#include <iostream>
#define ll long long
using namespace std;

ll mod=1000000007;
ll fac[510000], finv[510000], inv[510000];
void COMinit(ll m){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for (int i=2; i<510000; ++i){
        fac[i]=(fac[i-1]*i)%m;
        inv[i]=m-(inv[m%i]*(m/i))%m;
        finv[i]=(finv[i-1]*inv[i])%m;
    }
}
ll COM(int n, int k, ll m){
    if(n<k) return 0;
    if(n<0 || k<0) return 0;
    return (fac[n]*((finv[k]*finv[n-k])%m))%m;
}

int main() {
	int H, W, A, B;
	cin >> H >> W >> A >> B;
	COMinit(mod);
	ll ans=0;
	for(int i=0; i+A<H; ++i){
	    ans=(ans+(COM(i+B-1, i, mod)*COM(H-i+W-B-2, H-i-1, mod))%mod)%mod;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 12160
#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>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const ll INF = 1LL << 60;

int main() {
    
    ll N;
    cin >> N;
    ll L[N];
    rep(i,N){
        cin >> L[i];
    }
    ll count = 0;

    for (int i=0;i<N;i++){
        for (int j=i+1;j<N;j++){
            for (int k=j+1;k<N;k++){
                std::set<ll> Se{L[i],L[j],L[k]};
                if(Se.size() == 3){
                    auto itr = Se.begin();
                    ll a = *itr;
                    ll b = *(++itr);
                    ll c = *(++itr);
                    if(((a+b) != c) && (a+b > c)){
                        count += 1;
                        //cout << i+1 << j+1 << k+1 << endl;
                        //cout << a << b << c << endl;
                    }
                }
            }
        }
    }

    cout << count << endl;
    
    return 0;
}

Measured memory_bytes: 3616
import sys
# a, b = map(int,input().split())

# n,k = map(int,input().split())
# n = int(input())
# b_l = list(map(int,input().split()))
S = input()

for i,s in enumerate(S):
        ix = i+1
        if (ix % 2) != 0:
                if s == 'L':
                        print('No')
                        sys.exit()
        else:
                if s == 'R':
                        print('No')
                        sys.exit()
print('Yes')

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

typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1e9+7;
#define rep(i,N) for(ll i=0; i<(N); i++)
#define rep1(i,N) for(ll i=1; i<(N); i++)
#define pb push_back

map<ll,ll> res;
map<ll,ll> prime_fact(ll n){
	for(ll i=2;i*i<=n;i++){
		while(n%i==0){
			++res[i];
			n/=i;
		}
	}
	if(n!=1) res[n]=1;
	return res;
}
const ll MAX=200005;
ll fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}
ll COM(ll n,ll k){
    if (n<k) return 0;
    if (n<0||k<0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

ll N,M;

int main(){

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

cin>>N>>M;
prime_fact(M);
COMinit();
ll ans=1;
map<ll,ll>::iterator it;
for(it = res.begin(); it!=res.end(); it++){
    ll p=it->first;
    ll q=it->second;
    ans=ans*COM(N-1+q,q)%mod;
}

cout<<ans<<endl;

}
	


Measured memory_bytes: 4992