akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

struct mint {
  ll x;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  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 {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= 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 {
    mint res(*this);
    return res /= a;
  }
};

mint factorial(ll n) {
  mint answer = 1;
  while (n > 1) {
    answer *= n;
    n--;
  }
  return answer;
}

mint combination(ll n, ll r) {
  return factorial(n) / (factorial(r) * factorial(n - r));
}

mint permutation(ll n, ll r) { return factorial(n) / factorial(n - r); }

// setprecision(8) 桁数指定
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

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

template <typename T>
void remove(std::vector<T>& vector, unsigned int index) {
  vector.erase(vector.begin() + index);
}

map<ll, ll> prime_factor(ll n) {
  map<ll, ll> ret;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}
// for (auto p : prime_factor(n)) {
//	while (p.second--) {
//		cout << p.first << endl;
//	}
//}

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

bool compare_by_b(pair<ll, ll> a, pair<ll, ll> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

vector<ll> Eratosthenes(const ll N) {
  bool is_prime[1000000 + 1];
  vector<ll> P;
  for (ll i = 0; i <= N; i++) {
    is_prime[i] = true;
  }
  for (ll i = 2; i <= N; i++) {
    if (is_prime[i]) {
      for (ll j = 2 * i; j <= N; j += i) {
        is_prime[j] = false;
      }
      P.emplace_back(i);
    }
  }
  return P;
}

typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

int main() {
  int n, m;
  cin >> n >> m;
  int x = (1900 * m + 100 * (n - m)) * pow(2, m);
  cout << x << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
#include <numeric>
using namespace std;
//#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i,j) ((i<0 && j<0) || (i>0 && j>0)) ? true : false 
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double PI = 3.14159265359;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };



signed main() {
	int n, k;
	string s;

	cin >> s;

	int n1 = stoi(s.substr(0,2) );
	int n2 = stoi(s.substr(2, 2));

	if ((n1==0 && n2 == 0) || (n2 == 0 && n1 == 0) || (n1 >= 13 && n2 == 0) || (n2 >= 13 && n1 == 0)) {
		cout << "NA" << endl;
	}
	else if (n1 <= 12 && n1 >=1 && n2 <= 12 && n2 >= 1) {
		cout << "AMBIGUOUS" << endl;
	}
	else if (n1 <= 12 && n1 >= 1 ) {
		cout << "MMYY" << endl;
	}
	else if ( n2 <= 12 && n2 >= 1) {
		cout << "YYMM" << endl;
	}
	else {
		cout << "NA" << endl;
	}





	return 0;
}

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

int main()
{
    int maxv, minv;
    int N;
    cin >> N >> maxv;
    minv = maxv;
    for ( int i = 0; i < N - 1; i++ ) {
        int A;
        cin >> A;
        minv = min(minv, A);
        maxv = max(maxv, A);
    }
    cout << maxv - minv << endl;
    return ( 0 );
}


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

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(" ");
        var A = long.Parse(input[0]);
        var B = long.Parse(input[1]);
        var N = long.Parse(input[2]);

        long left = 0;
        long right = 0;
        long x = (N <= B - 1) ? N : B - 1;
        left = (long)Math.Round(Math.Floor(A * x / (double)B));
        right = (long)Math.Round(A * Math.Floor(x / (double)B));

        Console.WriteLine(left - right);

    }
}

Measured memory_bytes: 27496
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N=INT()
A=LIST()

ans=[]
mn=min(A)
mnidx=A.index(mn)+1
mx=max(A)
mxidx=A.index(mx)+1
if mn<0 and mx>0:
    if abs(mx)>=abs(mn):
        for i in range(N):
            A[i]+=mx
            ans.append((mxidx, i+1))
        mn=min(A)
    else:
        for i in range(N):
            A[i]+=mx
            ans.append((mnidx, i+1))
        mx=max(A)

if mn>=0:
    for i in range(N-1):
        A[i+1]+=A[i]
        ans.append((i+1, i+2))
else:
    for i in range(N-1, 0, -1):
        A[i-1]+=A[i]
        ans.append((i+1, i))

print(len(ans))
for x, y in ans:
    print(x, y)


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

const int mxN = 2e5 + 10;
int last[26][mxN];

int main() {
	for (int i = 0; i < 26; i++) {
		for (int j = 0; j < mxN; j++) {
			last[i][j] = -1;
		}
	}
	string s, t;
	cin >> s >> t;
	int n = s.length();
	for (int i = n - 1; i >= 0; i--) {
		int c = (int)s[i]- 'a';
		last[c][i] = i+1;
		for (int j = i-1; j >= 0; j--) {
			last[c][j] = last[c][j + 1];
		}
	}
	int n1 = t.length();
	bool ok = true;
	long long l = 0;
	long long cnt = 0;
	for (int i = 0; i < n1; i++) {
		char c = (int)t[i] - 'a';
		if (last[c][l] == -1) {
			cnt += n - l;
			l = 0;
			if (last[c][l] == -1) {
				ok = false;
				break;
			}
		}
		cnt += (long long)last[c][l] - l;
		l = last[c][l];
	}
	if (ok) cout << cnt << endl;
	else cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 24008
import java.io.PrintWriter;
import java.util.*;

public class Main {

    static String br = System.getProperty("line.separator");
    static Scanner sc  = new Scanner(System.in);

    public static void main(String[] args){
        int N = nextInt();

        int min = 0;
        for(int i=1; i<=N/2; i++){
            int A = i;
            int B = N-i;

            int sum = sumDigits(A)+sumDigits(B);
            if(i == 1) min = sum;
            else min = Math.min(sum, min);
        }

        println(min);
    }

    //各桁の和
    public static int sumDigits(long n) {
        int sum = 0;
        while (n != 0) {
            sum += n % 10;
            n /= 10;
        }
        return sum;//合計を返す
    }

    //最大公約数gcd
    static long gcd (long a, long b) {
        long temp;
        while ((temp = a % b) != 0) {
            a = b;
            b = temp;
        }
        return b;
    }
    //最小公倍数lcm
    static long lcm (long a, long b) {
        long temp;
        long c = a;
        c *= b;
        while((temp = a%b)!=0) {
            a = b;
            b = temp;
        }
        return (c/b);
    }
    static int nextInt(){
        return Integer.parseInt(next());
    }
    static Long nextLong(){
        return Long.parseLong(next());
    }
    static String next(){
        return sc.next();
    }
    static void println(Object o){
        PrintWriter out = new PrintWriter(System.out);
        out.println(o);
        out.flush();
    }
   static void print(Object o){
       PrintWriter out = new PrintWriter(System.out);
       out.print(o);
       out.flush();
    }
}


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

int main() {
  int D;
  cin >> D;
  string answer;
  if (D == 22) {
    answer = "Christmas Eve Eve Eve";
  } else if (D == 23) {
    answer = "Christmas Eve Eve";
  } else if (D == 24) {
    answer = "Christmas Eve";
  } else {
    answer = "Christmas";
  }
  cout << answer << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int main(){


    long long int n;
    cin >> n;
    long long tmp = n;

    

    long long count = 0;

    while(n/10 != 0){
        count += n%10;
        n /= 10;
    }
    count+=n;
    //cout << count << endl;

    if(tmp%count==0){
        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++)
#define REP(i, s, e) for (int i = (int)(s); i < (int)(e); i++)
#define _rep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define _REP(i, e, s) for (int i = (int)(e - 1); i >= (int)(s); i--)

#define yes cout << "yes" << endl;
#define Yes cout << "Yes" << endl;
#define YES cout << "YES" << endl;

#define no cout << "no" << endl;
#define No cout << "No" << endl;
#define NO cout << "NO" << endl;

#define AC cout << "AC" << endl;
#define WA cout << "WA" << endl;

#define out(s) cout << s << endl;

#define ll long long
#define ull unsigned long long
#define vi vector<int>

const double PI = 3.14159265358979323846;

int main() {
    string S;
    int cnt0 = 0, cnt1 = 0, vmin = 0;
    cin >> S;
    rep(i, S.size()) {
        if (S[i] == '0') {
            cnt0++;
        } else {
            cnt1++;
        }
    }
    vmin = min(cnt0, cnt1);
    cout << vmin * 2 << endl;
}

Measured memory_bytes: 512
n,m=map(int,input().split())
if m-n+1>=673:
    print(0)
else:
    s,t=n%2019,m%2019
    s,t=min(s,t),max(s,t)+1
    c=2019
    for i in range(s,t-1):
        for j in range(s+1,t):
            c=min(c,(i*j)%2019)
    print(c)

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

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 long long INF = 1LL << 60;

int N;
long long h[100010];

long long dp[100010];

int main() {
	cin >> N;
	for (int i = 0; i < N; ++i) cin >> h[i];
	
	//DPテーブル全体を初期化
	for (int i = 0; i < 100010; ++i) dp[i] = INF;
	
	//初期条件
	dp[0] = 0;
	
	//ループ
	for (int i = 1; i < N; ++i) {
		chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
		if (i > 1) chmin(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
	}
	
	cout << dp[N - 1] << endl;
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

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

        if(n==1){
            System.out.println("Hello World");
        } else {
            int a = sc.nextInt();
            int b = sc.nextInt();
            System.out.println(a+b);
        }
    }
}


Measured memory_bytes: 22996
#include<stdio.h>
int main()
{
    int p,q,r,i,j,k;
    scanf("%d%d%d",&p,&q,&r);

    i=p+q;
    j=q+r;
    k=r+p;
    if(p>=1 && q>=1 && r>=1 && p<=100 && q<=100 && r<=100) {
        if(i<=j && i<=k) {
            printf("%d\n",i);
        }
        else if(j<=i && j<=k) {
            printf("%d\n",j);
        }
        else { printf("%d\n",k); }
    }
else
{ printf(" error\n");}
    return 0 ;
}


Measured memory_bytes: 128
let id x = x
let n = Scanf.scanf "%d\n" id

let array = Array.init n (fun _ -> (Scanf.scanf "%d\n") id)

let rec solve n cnt =
  if n = 1 then cnt else
    if cnt > 100005 then -1 else
      solve (array.(n) - 1) (cnt + 1)

let ans = solve 0 0
  
let () =
  Printf.printf "%d\n" ans

Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
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 INF=1e10;
int MOD=1e9+7;
signed main(){
  int a,b;
  cin>>a>>b;
  int c=0,d=0;
  for(int i=b-1;i<=a;i++){
  c+=(i+1)*a;
    c%=1000000007;
  }
  for(int i=b-1;i<=a;i++){
  d+=i*(i+1);
    d%=1000000007;
  }
  int k=c-d+a-b+2;
 k+=1000000007;
  k%=1000000007;
k+=1000000007;
  k%=1000000007;
  cout<<k;
}


Measured memory_bytes: 3672
#include <stdio.h>

#define max 32

int main()
{
    int str[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51}, N;
    
    scanf("%d", &N);
    
    printf("%d", str[N-1]);
    
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int n, k; scanf("%d%d", &n, &k);
	
	long double ans = 0.;
	for(int i = 1; i <= n; i++) {
		i64 now = i;
		long double latte = 1. / (long double)n;
		while(now < k) {
			latte /= 2.;
			now <<= 1;
		}
		ans += latte;
	}
	
	printf("%.12Lf\n", ans);
	return 0;
}


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

int main(){

    int N;
    cin >> N;

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

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

    long long ans = 0;

    for(int i = 0; i < N; i++){

        if(A[i] < B[i]){
            ans += A[i];
            B[i] -= A[i];
        }else{
            ans += B[i];
            B[i] = 0;
        }

        if(A[i+1] < B[i]){
            ans += A[i+1];
            A[i+1] = 0;
        }else{
            ans += B[i];
            A[i+1] -= B[i];
        }
    }

    cout << ans << endl;
}

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

struct P { 
	string name;
	int t;
};

int head, tail, SIZE;
P* p;

void enQueue(P p);
P deQueue();
void print();
void initialize();

int main() {
	
	int n, q, sum = 0;
	P u;

	initialize();

	cin >> n >> q;
	SIZE = n + 10;
	p = new P[SIZE];

	for (int i = 0; i < n; i++) {
		cin >> u.name >> u.t;
		enQueue(u);
	}

	// ????????\??¬????????§???
	while (head != tail) {
		u = deQueue();
		if (u.t > q) {
			u.t -= q;
			sum += q;
			enQueue(u);
		}
		else {
			sum += u.t;
			cout << u.name << ' ' << sum << endl;
		}
	}

	delete[] p;
	return 0;
}

void initialize() {
	head = 0;
	tail = 0;
}

void enQueue(P u) {
	p[head] = u;
	if (++head%SIZE == 0) head = 0;
}

P deQueue() {
	P u = p[tail];
	if (++tail%SIZE == 0) tail = 0;
	return u;
}

void print() {
	int i = tail;
	cout << "head : " << head << endl;
	cout << "tail : " << tail << endl;
	while (i != head) {
		cout << p[i].name << " : " << p[i].t << endl;
		if ((++i) % SIZE == 0) i = 0;
	}
}

Measured memory_bytes: 6000
import sys
input = sys.stdin.readline
n,m = map(int,input().split())
k = [0 for _ in range(m)]
s = [[] for _ in range(m)]
for i in range(m):
  k[i],*s[i] = map(lambda x:int(x)-1,input().split())
p = list(map(int,input().split()))
ans = 0
for i in range(m):
  ds = ["0"]*n
  for j in s[i]:
    ds[j] = "1"
  s[i] = int("".join(ds),2)
for i in range(2**n):
  for j in range(m):
    if not bin(i&s[j]).count("1")%2 == p[j]:
      break
  else:
    ans += 1
print(ans)

Measured memory_bytes: 9028
S = str(input())
N = len(S) + 1
ans = 0

if S[0] == '<':
    pm = 1
else:
    pm = 0

inlist = [1]
for i in range(N - 2):
    if S[i] != S[i+1]:
        inlist.append(1)
    else:
        inlist[-1] += 1
if pm == 0:
    inlist.insert(0,1)
if len(inlist)%2 == 1:
    inlist.append(1)

for j in range(int(len(inlist)/2)):
    p = max(inlist[2*j], inlist[2*j+1])
    ans += ((p + 1) * p / 2)
    p = min(inlist[2*j], inlist[2*j+1]) - 1
    ans += ((p + 1) * p / 2)

print (int(ans))

Measured memory_bytes: 6300
#!/usr/bin/env python3
import sys
from math import *
from itertools import *
from collections import *
from functools import *
from operator import *
try:
    from math import gcd
except Exception:
    from fractions import gcd

MOD = 1000000007  # type: int


def prime_table(n):
    rn = int(ceil(sqrt(n)))
    t = [True] * (rn + 1)
    t[0] = False
    t[1] = False

    i = 2
    while i * i <= n:
        for ii in range(2 * i, rn + 1, i):
            t[ii] = False
        i += 1
    return [x for x, i in enumerate(t) if i == True]


def combination(n, m):
    return reduce(mul, range(n, n - m, -1), 1) // factorial(m)

def solve(N: int, M: int):
    fs = defaultdict(int)
    for p in prime_table(M):
        while (M % p) == 0:
            fs[p] += 1
            M //= p
    if M != 1:
        fs[M] = 1

    ret = 1
    for c in fs.values():
        ret *= combination(c + N - 1, c)

    return ret % MOD


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    result = solve(N, M)
    print(result)

if __name__ == '__main__':
    main()


Measured memory_bytes: 5420
#include <bits/stdc++.h>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    int K,N;
    cin >> K >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    int ans = INF;
    REP(i, N){
        int diff = 0;
        if(i!=N-1){
            diff = A[i+1] - A[i];
        }else{
            diff = (K - A[i]) + A[0];
        }
        chmin(ans, K-diff);
    }
    pr(ans);
}

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

using namespace std;

struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n) {
        for (int i = 0; i < n; i++) par[i] = i;
    }

    int root(int x){
        if (par[x] == x) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y){
        return (root(x) == root(y));
    }

    void unite(int x, int y){
        x = root(x);
        y = root(y);
        if (x == y) return;
        par[x] = y;
    }
};

int main(){
    int N ,M;
    cin >> N >> M;

    vector<int> a(M), b(M);

    for (int i = 0; i < M; i++){
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
    }

    int ans = 0;
    for (int i = 0; i < M; i++){
        UnionFind tree(N);

        for (int j = 0; j < M; j++){
            if (j == i) continue;
            tree.unite(a[j], b[j]);
        }
        if (!tree.issame(a[i], b[i])) ans++;
    }

    cout << ans << endl;

    return 0;
}


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

using namespace std;

typedef long long ll;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    ll n = s.length();
    ll ans = n * (n + 1) / 2 + 1;
    vector<ll> k(26);
    for (char c : s) {
        ++k[c - 'a'];
    }
    for (ll i : k) {
        ans -= i * (i + 1) / 2;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 720
#include<iostream>
using namespace std;
int main() {
	int n;
	cin >> n;
	bool *str, *ans;
	str = new bool[n];
	ans = new bool[n + 1];
	//str[x]==true 'o'
	char dummy;
	for (int i = 0; i < n; ++i) {
		cin >> dummy;
		str[i] = dummy == 'o';
	}
	//ans[x]==true 'S'
	bool check;
	bool mv[2] = { true,false };
	bool ok = false;
	for (int i = 0; i < 2; ++i) {
		for (int j = 0; j < 2; ++j) {
			ans[0] = mv[i];
			ans[1] = mv[j];
			if (ans[0]) {
				if (str[0]) {
					check = ans[1];
				}
				else {
					check = !ans[1];
				}
			}
			else {
				if (str[0]) {
					check = !ans[1];
				}
				else {
					check = ans[1];
				}
			}
			for (int k = 1; k < n; ++k) {
				if (ans[k]) {
					if (str[k]) {
						ans[k + 1] = ans[k - 1];
					}
					else {
						ans[k + 1] = !ans[k - 1];
					}
				}
				else {
					if (str[k]) {
						ans[k + 1] = !ans[k - 1];
					}
					else {
						ans[k + 1] = ans[k - 1];
					}
				}
			}
			if (ans[n - 1] == check&&ans[n] == ans[0]) {
				ok = true;
			}
			if (ok)break;
		}
		if (ok)break;
	}
	if (ok) {
		for (int i = 0; i < n; ++i) {
			cout << (ans[i] ? 'S' : 'W') ;
		}
		cout << endl;
	}
	else {
		cout << -1 << endl;
	}
	return 0;
}

Measured memory_bytes: 512
// g++ -std=gnu++1y -O2 -I/opt/boost/gcc/include -L/opt/boost/gcc/lib -o ./a.out ./X.cpp & a.out //
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define ull unsigned long long


using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);	
    cin.tie(NULL); cout.tie(NULL);
	
	int n; cin >> n; 
	vector<int> h(n);
	
	for(auto &t : h) cin >> t;
	
	vector<int> dp(n, INT_MAX);
	
	dp[0] = 0;
	//dp[1] = dp[0] + abs(h[0] - h[1]);
	for(int i = 0; i < n-1; i++)
	{
		dp[i+1] = min(dp[i+1], dp[i] + abs(h[i]-h[i+1]));
		if(i < n-2) dp[i+2] = dp[i] + abs(h[i]-h[i+2]);
	}
	
	cout << dp[n-1];
    
    return 0;
}



Measured memory_bytes: 1024
#include <stdio.h>
int main ()
{
    int i,n;
    long long s;
    scanf("%d", &n);
    s = 1;
    for (i=1; i<=n;i++)
    {
        s *= i;
        s %= (int)1e9+7;
    }
    printf ("%d", s);
}


Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main(){

  int a,b,k,smaller;
  int counts=0;
  
  cin >> a >> b >> k;
  
  smaller=min(a,b);
  
  for(int i=smaller;i>0;i--){
   if(a%i==0&&b%i==0){
   counts++; 
   }
   if(counts==k){ 
  cout << i << endl;
     break;
     }
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cassert>
using namespace std;

#define REP(i,n) for (ll i = 0; i < n; i++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long ll;

const ll MOD = 1000000007LL;

long long inv_mod(long long n, long long mod) {
    long long a = n % mod, b = mod - 2, ret = 1;
    while (b > 0) {
        if (b & 1) ret = (ret * a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return ret;
}

int main () {

    ll N; cin >> N;
    vector < ll > A(N);
    REP(i,N) cin >> A[i];

    ll ans = 1LL;
    REP(i,N) {
        ans *= (ll)(1LL + i);
        ans %= MOD;
    }

    ll sum_t = 0;
    REP(i,N) {
        sum_t += inv_mod(1LL + i, MOD);
        sum_t %= MOD;
    }

    ll sum = 0;
    REP(i,N) {
        sum += sum_t * A[i];
        sum %= MOD;
        sum_t -= inv_mod(N - i, MOD);
        sum_t += inv_mod(i + 2LL, MOD);
        sum_t += MOD;
        sum_t %= MOD;
    }

    cout << (ans * sum) % MOD << endl;

    return 0;
}


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

int main()
{
    int n;
    cin>>n;
    vector<int> list(n);
    vector<int> list2(n);
    for(int i=0;i<n;i++) {
        cin>>list[i];
    }
    sort(list.begin(),list.end());
    list.erase(unique(list.begin(),list.end()),list.end());
    cout<<list.size()<<"\n";
    return 0;
}

Measured memory_bytes: 256
# 2019-11-18 23:58:23(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# import re
# import heapq
# import array
# from scipy.misc import comb # (default: exact=False)
# import numpy as np 


def main():
    n, *l = [int(x) for x in sys.stdin.read().split()]
    l.sort()
    count = 0
    for i in range(n-2):
        a = l[i]
        for j in range(i+1, n-1):
            b = l[j]
            count += (bi_l(l, a + b) - 1) - j
    
    print(count)

if __name__ == "__main__":
    main()


Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include<algorithm>



using namespace std;


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

	priority_queue<int> pq;
	
	for (int i = 0; i < n; i++) {
		int tmp;
		cin >> tmp;
		pq.push(tmp);
	}

	for (int i = 0; i < m; i++) {
		int price = pq.top();
		pq.pop();

		pq.push(price / 2);
	}

	long long sum = 0;
	while (!pq.empty()) {
		sum += pq.top();
		pq.pop();
	}

	cout << sum << endl;
	
}

Measured memory_bytes: 892
# from pprint import pprint
import math
# import collections

# n = int(input())
n, x, t = map(int, input().split(' '))
# a = list(map(int, input().split(' ')))
# a = []
# for i in range(n):
#     a.append(int(input()))

ans = math.ceil(n / x) * t
print(ans)


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

int D1[10] = {};
int D2[100] = {};
int D3[1000] = {};

int main() {
    int N, M;
    cin >> N >> M;

    bool Sk[M][N] = {};
    int k, sj;
    rep(i, M) {
        cin >> k;
        rep(j, k) {
            cin >> sj;
            Sk[i][sj-1] = true;
        }
    }

    bool P[M];
    rep(i, M) cin >> P[i];

    int ans = 0;
    for (int bit=0; bit<(1<<N); bit++) {
        bool all_light = true;
        rep(m, M) {
            int cnt_on = 0;
            rep(n, N) {
                if ((Sk[m][n]) && (bit & 1<<n)) cnt_on++;
            }
            if (cnt_on%2 != P[m]) all_light = false;
        }
        if (all_light) ans++;
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int H1, M1, H2, M2, K;
	scanf("%d %d %d %d %d", &H1, &M1, &H2, &M2, &K);
	
	int H = H2 - H1;
	int M = M2 - M1;
	M += H * 60;
	printf("%d\n", M - K);
	
	return 0;
}

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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vint;
typedef vector<double> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<int>> vvint;
typedef vector<pair<int, int>> vpii;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<int, vector<int>, greater<int>> spqint; //小さい順に取り出し
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;     //小さい順に取り出し
typedef priority_queue<int, vector<int>, less<int>> bpqint;    //大きい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;        //大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define PF push_front
#define TS to_string
#define BS binary_search
#define LB lower_bound
#define UB upper_bound
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


int INF = 1e9;
int NIL = -1;
ll MOD = 1000000007;
ll LINF = 1e18;
double EPS = 1e-9;
double PI = M_PI;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}
//-----------------------------------------

//-----------------------------------------
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::chrono::system_clock::time_point start,end;
    start = std::chrono::system_clock::now();

    ll n, k ;
    cin >> n >> k ;
    vll a(n) ;
    REP(i,n){
        cin >> a[i] ;
    }
    ll ans = LINF ;
    ll tmp ;
    REP(i,n-k+1){
        ll l = a[i] ;
        ll r = a[i+k-1] ;
        if(l*r<0){
            l = abs(l) ;
            r = abs(r) ;
            tmp = 2*min(l,r) + max(l,r) ;
            ans = min(ans,tmp) ;
        }
        else{
            l = abs(l) ;
            r = abs(r) ;
            tmp = max(l,r) ;
            ans = min(ans,tmp) ;
        }
    }

    cout << ans <<endl;








    end = std::chrono::system_clock::now();
    auto elapsed = std::chrono::duration_cast< std::chrono::milliseconds >(end - start).count();
    //std::cout << elapsed <<"ms"<< std::endl;

    

    return 0;
}



Measured memory_bytes: 3908
/*
title:

url:
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>
#include <map>

using namespace std;

#define REP(i, n) for (int i = 0; i < (n); i++)
#define INF 1000000007

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

int main()
{
    ll n, k;
    cin >> n >> k;

    ll res = 0;
    ll t;
    for (int a = 1; a <= n; a++)
    {
        if (a * 2 % k == 0)
        {
            if ((1 + a) % k == 0)
            {
                t = (n + a) / k - (1 + a) / k + 1;
                res += t * t;
            }
            else
            {
                t = (n + a) / k - (1 + a) / k;
                res += t * t;
            }
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include<iostream>
//#include<algorithm>
//#include<vector>
#define REP(i,n) for(int i = 0;i < (n);i++)
#define pb push_back
using namespace std;
const int INF = 1e9;
typedef long long ll;

int main(){
  int sx,sy,tx,ty;
  cin >> sx >> sy >> tx >> ty;
  int u,d,l,r;
  u = ty - sy;
  r = tx-sx;
  REP(i,u){
    cout << 'U';
  }
  REP(i,r){
    cout << 'R';
  }
  REP(i,u){
    cout << 'D';
  }
  REP(i,r)
    cout << 'L';

  cout << 'L';
  REP(i,u+1)
    cout << 'U';
  REP(i,r+1)
    cout << 'R';
  cout << 'D';
  cout << 'R';
  REP(i,u+1)
    cout << 'D';
  REP(i,r+1)
    cout << 'L';
  cout << 'U';
  cout << endl;
  
  
  return 0;
}


Measured memory_bytes: 256
n = int(input())

adj = [[100001 for j in range(n)] for i in range(n)]

for u in range(n):
    x = list(map(int, input().split()))
    for v, c in zip(x[2::2], x[3::2]):
        adj[u][v] = c

unvisited = [v for v in range(n)]

distance = [9900001] * n


def dijkstra(s):
    distance[s] = 0

    while True:
        mincost = 9900001
        for i in unvisited:
            if distance[i] < mincost:
                mincost = distance[i]
                u = i

        if mincost == 9900001:
            break

        unvisited.remove(u)

        for v in unvisited:
            weight_uv = adj[u][v]
            if weight_uv != 100001:
                t_d = distance[u] + weight_uv
                if t_d < distance[v]:
                    distance[v] = t_d



dijkstra(0)

for v, d in enumerate(distance):
    print(v, d)

Measured memory_bytes: 7944
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	int a, b, c;
	cin >> a >> b >> c;

	if (a == b) {
		cout << c << endl;
	} else if (a == c) {
		cout << b << endl;
	} else {
		cout << a << endl;
	}

	return 0;
}


Measured memory_bytes: 256
using System;

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(' ');
        var x = Convert.ToInt32(input[0]);
        var a = Convert.ToInt32(input[1]);
        var b = Convert.ToInt32(input[2]);

        var result = Math.Abs(x - a) > Math.Abs(x - b) ? "B" : "A";
        Console.WriteLine(result);
    }
}

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

//n+2マス
//0か1が記載、1に止まると失格
//ゴールのマスに止まるか超過するとクリア
//n+1個のサイコロが存在し、j番目のマスは 1<x<j
//ゲームクリアが可能かつ面が最小のサイコロは？

int main()
{
	int n;
	int a[100] = {0};
	int max_1 = 0;

	scanf("%d", &n);

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

	int no_1 = 0;
		
	for (int i = 0; i < n; i++)
	{
		if (a[i] == 1)
		{
			no_1 ++;
			//cout << no_1 << endl;
	
			if (a[i + 1] == 0)
			{
				max_1 = no_1 > max_1 ? no_1 : max_1;
				no_1 = 0;
			}
		}
	}

	int result = max_1 + 1;
	printf("%d\n", result);
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repc(i, a, b) for (int i = a; i <= (int)(b); i++)
#define ll long long
#define vec vector
#define pb push_back
#define ft first
#define sd second
#define all(vec) vec.begin(), vec.end()

typedef pair<int, int> P;

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

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

int main(){
  int n;
  cin >> n;
  vec<int> a(n);
  rep(i, n){
    cin >> a[i];
  }

  ll step = 0;
  rep(i, n-1){
    if(a[i] > a[i+1]){
      step += a[i] - a[i+1];
      a[i+1] += a[i] - a[i+1];
    }
  }
  cout << step << endl;
  return 0;
}

Measured memory_bytes: 3996
// Restoring Road Network
// 所要時間 分
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
#define all(v) v.begin(), v.end()
using ll = long long;
using P = pair<int, int>;

int main() {

    int n;
    cin >> n;
    vector<vector<ll>> a(n, vector<ll>(n));
    rep(i, n){
        rep(j, n){
            cin >> a[i][j];
        }
    }

    vector<vector<ll>> d = a;
    vector<vector<bool>> check(n, vector<bool>(n));
    rep(k, n){
        rep(i, n){
            rep(j, n){
                if(d[k][j] != 0 && d[i][k] != 0 && d[i][j] == d[i][k]+d[k][j]){
                    check[i][j] = true;
                }
                d[i][j] = min(d[i][j], d[i][k]+d[k][j]);

            }
        }
    }

    bool ok = true;
    ll ans = 0;
    rep(i, n){
        for(int j=i+1; j<n; ++j){
            if(d[i][j] != a[i][j]){
                ok = false;
            }
            if(!check[i][j]){
                ans += d[i][j];
            }
        }
    }
    if(ok){
        cout << ans << endl;
    }
    else{
        cout << -1 << endl;
    }

    return 0;
}

Measured memory_bytes: 1664
#!/usr/bin/env python3

from pprint import pprint
import sys

sys.setrecursionlimit(10 ** 6)
INF = float('inf')


N, M, Q = map(int, input().split())
L = []
R = []
for _ in range(M):
    l, r = map(int, input().split())
    L.append(l)
    R.append(r)

queries = []
for _ in range(Q):
    p, q = map(int, input().split())
    # 0-index
    queries.append([p, q])


# s[l][r] := (0, 0), (l, r) の領域に含まれる列車の数
# s[l][r] = s[l-1][r] + s[l][r-1] - s[l-1][r-1] + a[l][r]

s = [[0 for r in range(N+1)] for l in range(N+1)]
for i in range(M):
    s[L[i]][R[i]] += 1

for l in range(1, N+1):
    for r in range(1, N+1):
        s[l][r] += s[l-1][r] + s[l][r-1] - s[l-1][r-1]

for l, r in queries:
    ans = s[r][r] - s[l-1][r] - s[r][l-1] + s[l-1][l-1]
    print(ans)


Measured memory_bytes: 120000
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
import itertools
from collections import Counter

def main():
    n = int(input())
    ans = n - 1
    for i in range(2,math.floor(math.sqrt(n))+1):
        if n%i == 0:
            ans = i-1 + n//i-1
    print(ans)

if __name__=="__main__":
    main()


Measured memory_bytes: 66280
/*
ID: simpgoo1
TASK: 
LANG: C++14            
*/
// timus 219263UI
#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <ctime>
#include <queue>
#include <vector>
#include <cstdlib>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <unordered_map>
using namespace std;
typedef long long ll;
#define y1 needtrainharder
#define F first
#define S second
#define gg exit(0)
#define sz() size()
#define sz() size()
#define sz() size()
#define sz() size()
#define sz() size()
#define sz() size()
#define sz() size()
#define sz() size()
#define sz() size()
#define sz() size()
#define sz() size()
#define sz() size()
#define sz() size()
#define sz() size()
#define sz() size()

#define pb push_back
#define mp make_pair
#define skip continue
#define all(x) x.begin(), x.end()
#define boost ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL)
#define file(s,x) if(x == 1)freopen(s".in","r",stdin),freopen(s".out","w",stdout);
#define task "sorting"
const int INF = 1e9 + 100;  
const ll INFLL = 1e18 + 100;  
const int MAXN = 3e5 + 100; 

ll n, m;

int main(){ 
  boost; 
  srand(time(NULL));
  if(fopen(task".in", "r")){  
    freopen(task".in", "r", stdin);
    freopen(task".out","w",stdout); 
  }
  
  cin>>n;
  cout<<48-n;

  return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1<<30;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};

vector<int> par(0);
vector<int> depth(0);
vector<int> heavy(0);
void init(int n){
   par.resize(n);
   depth.resize(n,0);
   heavy.resize(n,0);
   rep(i,n) par[i]=i;
}

int find(int n){
   if(par[n]==n) return n;
   int parent =find(par[n]);
   heavy[n]+=heavy[par[n]];
   return par[n]=parent;
}

int wei(int x){
    find(x);
    return heavy[x];
}

void unite(int x,int y,int z){//x->y w=z
    z +=-wei(x)+wei(y);
   x=find(x);
   y=find(y);
   if(par[x]==par[y]) return;
   if(depth[x]<depth[y]){
       par[x]=par[y];
       heavy[x]+=z;
   }
   else{
      par[y]=par[x];
      heavy[y] -=z;
   if(depth[x]==depth[y]) depth[x] ++;
   }
}

bool same(int x,int y){
   return find(x)==find(y);
}

int diff(int x,int y){//x-y,比較不可なら-1
    if(!same(x,y)) return -1;
    return wei(x)-wei(y);
}

int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    int n,m,l,r,d;
    cin>>n>>m;
    init(n);
    rep(i,m){
        cin>>r>>l>>d;
        r --;
        l --;
        if(diff(l,r)==d) continue;
        else if(same(l,r)){
            cout<<"No"<<endl;
            return 0;
        }
        else unite(l,r,d);
    }
    cout<<"Yes"<<endl;
}

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

int main(void)
{
    int q;
    cin >> q;
    while(q--)
    {
        long long a, b;
        cin >> a >> b;
        long long sq = (int)sqrt(a*b);;
        long long sum = sq*2;
        if(a <= sq || b <= sq)
            sum--;
            
        if(sq*sq == a*b && a!=b)
            sum--;
        if(sq*(sq+1) >= a*b)
            sum--;

        cout << sum << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int dishes[5];
    for(int i=0;i<5;i++)cin>>dishes[i];
    int ans=0;
    int tmp=0;
    for(int i=0;i<5;i++){
        if(dishes[i]%10!=0){
            if(10-(dishes[i]%10)>tmp)tmp=10-(dishes[i]%10);
        }
    }
    for(int i=0;i<5;i++){
        ans+=dishes[i];
        if(dishes[i]%10!=0){
            ans+=10-(dishes[i]%10);
        }
    }
    ans-=tmp;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as BC
import qualified Data.Sequence as S
import qualified Data.IntMap as M
import Data.Maybe (fromJust)

bsToInt :: BC.ByteString -> Int
bsToInt = fst . fromJust . BC.readInt

getInt2DListBC :: IO [[Int]]
getInt2DListBC = map (map bsToInt . BC.words) . BC.lines <$> BC.getContents

main = do
  n <- getLine
  a <- filter odd . concat <$> getInt2DListBC :: IO [Int]
  if a == []
    then putStrLn "second"
    else putStrLn "first"


Measured memory_bytes: 4092
#include<iostream>
#include<algorithm>

using namespace std;

int main() {
	int N, A[110] = {},sabun, max=0;

	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			sabun = abs(A[i] - A[j]);
			if (max < sabun) {
				max = sabun;
			}
		}
	}

	cout << max << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INF 2e9
#define ll long long
#define MINUS(a) memset(a,0xff,sizeof(a))

ll L, R;
ll mo = 1000000007;
ll dp[2][2][2][61];

/* dp(d, msb, l, r)内のret: x, yのd桁目のより下の値の組み合わせ数
    msb: d桁目より上ですでにMSBとなる桁があったかどうか
    l  : d桁目より上を決めた段階で、L<=xか
    r  : d桁目より上を決めた段階で、y<=Rか

    上を前提にcom()でx, yのd桁目として0, 1を取りうるか見ていく。
*/
ll com(int d, int S, int LT, int RT){
    if(d == -1){
        return S == 1;
    }
    /* メモ */
    if(dp[S][LT][RT][d]>=0){
        return dp[S][LT][RT][d];
    }

    ll ret = 0;

    /* aがxのd桁目、bがyのd桁目 */
    int a, b;
    for(int a=0; a<2; a++){
        for(int b=0; b<2; b++){
            /* x>=Lになっているか */
            if(a==0 && LT && (L&(1LL<<d))>0){
                continue;
            }
            /* y<=Rになっているか */
            if(b==1 && RT && (R&(1LL<<d))==0){
                continue;
            }
            /* y-xで繰り下がりは起こさせない */
            if(a>b){
                continue;
            }
            /* MSBがなくてa==1かつb==1はだめ */
            if(S==0 && a != b){
                continue;
            }
            int NLT = LT && (((L>>d)&1)==a);
            int NRT = RT && (((R>>d)&1)==b);
            int NS = S || (a==1 && b==1);
            ret += com(d-1, NS, NLT, NRT);
        }
    }

    return dp[S][LT][RT][d] = ret % mo;
}

int main(){
    cin>>L>>R;
    MINUS(dp);
    cout<<com(61, 0, 1, 1)<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
#define REP(i, a, n) for(int i=a; i<n; i++)
#define RREP(i, a, n) for(int i=n-1; i>=a; i--)
#define INF 1000000000
#define ll long long

int n, m;
string s;
int main()
{
	cin >> s;
	REP(i, 0, s.size() - 8) {
		cout << s[i];
	}
	cout << endl;
	return 0;
}

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

/*
 (imin,imax] -> imax
 return minimum index such that v[index] >= value
 auto f(int mid) {return v[mid] >= value;}
 */
template<class F>
auto  minimize(Int imin,Int imax,F &f){
    while(imax - imin > 1){
        Int mid = imin + (imax - imin)/2;
        if(f(mid)) imax = mid;
        else imin = mid;
    }
    return imax;
}

int main(){
    Int N, K;
    cin >> N >> K;
    vector<Int>A(N),F(N);
    for(auto& e : A)
        cin >> e;
    for(auto& e : F)
        cin >> e;
    if(K >= accumulate(A.begin(), A.end(),0LL))
        return puts("0") * 0;
    multiset<Int>S;
    for(auto e : A)
        S.insert(e);
    sort(F.begin(), F.end(),greater<>());
    auto comp = [&](Int mid){
        Int tK = K;
        auto tS = S;
        for(Int i = 0; i < N; ++i){
            Int dif = mid;
            if(dif < F[i]){
                auto itr = tS.upper_bound(0);
                if(itr == tS.end())return false;
                tK -= *itr;
                tS.erase(itr);
            } else if(dif == F[i]){
                auto  itr = tS.upper_bound(0);
                if(itr == tS.end()) return false;
                tK -= (*itr  -1);
                tS.erase(itr);
            } else if(dif > F[i]){
                Int dev = dif / F[i];
                auto itr = tS.upper_bound(0);
                if(itr == tS.end()) return false;
                if(*itr > dev){
                    tK -= (*itr - dev);
                }
                tS.erase(itr);
            }
        }
        return tK >= 0;
    };
    Int ub = (1LL << 60);
    cout << minimize(0LL,ub,comp)<< endl;
    
}




Measured memory_bytes: 24192