akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<double,double> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    int n;
    while(cin>>n,n){
    vector<pii>v;
    rep(i,n){
        pii ujimatsu; int gotiusa;
        cin>>gotiusa>>ujimatsu.first>>ujimatsu.second;
        v.push_back(pii(abs(22-(((double)ujimatsu.second/(pow((double)ujimatsu.first/100,2))))),gotiusa));
    }
    sort(all(v));
    cout<<v[0].second<<endl;}
}

Measured memory_bytes: 3232
import math

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
a2 = (math.ceil(a / 10)) * 10
b2 = (math.ceil(b / 10)) * 10
c2 = (math.ceil(c / 10)) * 10
d2 = (math.ceil(d / 10)) * 10
e2 = (math.ceil(e / 10)) * 10
ls = [0 for i in range(5)]
ls[0] = a + b2 + c2 + d2 + e2
ls[1] = a2 + b + c2 + d2 + e2
ls[2] = a2 + b2 + c + d2 + e2
ls[3] = a2 + b2 + c2 + d + e2
ls[4] = a2 + b2 + c2 + d2 + e
print(min(ls))


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

int main()
{
    long long int n,a,b,s,y,r,z;
    cin>>n>>a>>b;
     s=a+b;
     y=n/s;
     r=n%s;
     z=min(a,r)+(y*a);
    cout<<z<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <string>

int fn(int x){
	return (x - 1)*(x - 2)*(x - 3)/6*2000
		+ (x - 1)*(x - 2)*(x - 4)*(-1500)
		+ (x - 4)*(x - 2)*(x - 3)*(-1000)
		+ (x - 1)*(x - 4)*(x - 3)*(2000);
}

using namespace std;
int main(){
	int a[4];
	int b[4];
	for (int i = 0; i < 4; i++){
		cin >> a[i] >> b[i];
	}

	for (int i = 0; i < 4; i++){
		cout << fn(a[i])*b[i] << endl;
	}
}

Measured memory_bytes: 1160
a = gets.to_i
b = gets.to_i
c = gets.to_i
x = gets.to_i
d = 0
e = 0
for i in 0..a
  for j in 0..b
    for k in 0..c
      d = 500*i + 100*j +50*k
      if d == x
        e = e + 1
      end
    end
  end
end
puts e
      

Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include<numeric>
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<vector<int> > vvi;
typedef vector<vector<ll> > vll;
const ll inf = 1LL << 60;



int main(){
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
    int N;cin>>N;
    vector<int> A(N);
    int count_1 = 0;
    REP(i,N){
        cin>>A[i];
        if(A[i] == 1)count_1++;
    }

    if(count_1 > 0){
        if(count_1 == 1){
            cout << 1 << endl;
            return 0;
        }
        else{
            cout << 0 << endl;
            return 0;
        }
    }
    sort(ALL(A));

    vector<vector<int> > G(N);
    vector<bool> seen(N,false);
    REP(i,N){
        for(int k = 2; k*k <= A[i]; k++){
            if(A[i] % k == 0){
                G[i].push_back(k);
                G[i].push_back(A[i] / k);
            }
        }
    }

    int ans = 0;
    REP(i,N){
        if(A[lower_bound(ALL(A),A[i]) + 1 - A.begin()] == A[i]) continue;
        bool flag = true;
        REP(k,G[i].size()){
            if(binary_search(ALL(A), G[i][k])) flag = false;
        }
        if(flag) ans++;

    }
    cout << ans << endl;
}

Measured memory_bytes: 61592
s = list(input())
s1 = s.count(s[0])
s2 = s.count(s[1])
s3 = s.count(s[2])
s4 = s.count(s[3])
if s1 == 2 and s2 == 2 and s3 == 2 and s4 == 2:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
import itertools

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

zenbu = list(itertools.permutations(range(1,n + 1)))
print(abs((zenbu.index(tuple(p)) + 1) - (zenbu.index(tuple(q)) + 1)))

Measured memory_bytes: 8052
from decimal import Decimal, ROUND_HALF_UP
n = int(input())
x = list(map(int, input().split()))
num = Decimal(str(sum(x)/n)).quantize(Decimal('0'), rounding=ROUND_HALF_UP)
num = int(num)

cost=0
for i in range(n):
    cost += (x[i]-num)*(x[i]-num)
print(cost)

Measured memory_bytes: 5588
use std::collections::BTreeMap;

// product-and-gcd.rs --- Product and GCD
// author: Seong Yong-ju <sei40kr@gmail.com>

// tanakah's input macro
// cf https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    input! {
        n: u64,
        p: u64,
    };

    let mut t = p;
    let mut memo = BTreeMap::new();
    while 1 < t {
        let x = (2..((t as f64).sqrt() as u64) + 1)
            .filter(|x| t % x == 0)
            .next()
            .unwrap_or(t);
        t /= x;

        let cnt = memo.get(&x).unwrap_or(&0) + 1;
        memo.insert(x, cnt);
    }

    let ans = memo
        .into_iter()
        .filter(|&(_, cnt)| n <= cnt)
        .fold(1, |acc, (x, cnt)| acc * x.pow((cnt / n) as u32));
    println!("{}", ans);
}


Measured memory_bytes: 4352
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Remoting.Lifetime;
using System.Text;
using static System.Console;

namespace BubbleSort
{
    internal class Program
    {
        private static int _count = 0;
        public static void Main(string[] args)
        {
            OutPut(Bubble(Input()));
        }

        static IEnumerable<int> Input()
        {
            var n = int.Parse(ReadLine());
            var list = ReadLine()
                .Split(' ')
                .Select(int.Parse);
            return list;
        }

        static IEnumerable<int> Bubble(IEnumerable<int> input)
        {
            var list = input.ToList();
            var isCompleted = false;
            while (!isCompleted)
            {
                isCompleted = true;
                for (var i = list.Count() - 1; i >= 1; i--)
                {
                    if (list[i] < list[i - 1])
                    {
                        var tmp = list[i];
                        list[i] = list[i - 1];
                        list[i - 1] = tmp;
                        _count++;
                        isCompleted = false;
                    }
                }
            }

            
            return list;
        }

        static void Swap<T>(ref T a, ref T b) where T: IComparable<T>
        {
            var tmp = a;
            a = b;
            b = tmp;
            _count++;
        }

        static void OutPut(IEnumerable<int> sorted)
        {
            var sw = new StreamWriter(OpenStandardOutput()) {AutoFlush = false};
            SetOut(sw);
            WriteLine(string.Join(" ", sorted).Trim());
            WriteLine(_count);
            Out.Flush();
        }
        
    }
}


Measured memory_bytes: 18228
import std.algorithm, std.conv, std.range, std.stdio, std.string;
import std.math;

void main()
{
  auto pi = primes(999_999);

  string line;
  while ((line = readln) !is null) {
    auto n = line.chomp.to!int;
    writeln(pi.assumeSorted.lowerBound(n + 1).length);
  }
}

int[] primes(int n)
{
  auto sieve = new bool[]((n + 1) / 2);
  sieve[] = true;

  foreach (p; iota(1, (n.to!real.sqrt.to!int - 1) / 2 + 1))
    if (sieve[p])
      foreach (q; iota(p * 3 + 1, (n + 1) / 2, p * 2 + 1))
        sieve[q] = false;

  auto r = sieve.enumerate
    .filter!("a[1]")
    .map!("a[0]").map!("a * 2 + 1")
    .map!(to!int).array;
  r[0] = 2;

  return r;
}

Measured memory_bytes: 3216
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1000000007
#define INF 1e9
#define PIE 3.14159265358979323

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;
}
template <class T>
T GCD(T a, T b) {
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}
template <class T>
inline T LCM(T a, T b) {
    return (a * b) / GCD(a, b);
}

using namespace std;
//#inculude <bits/stdc++.h>
#define int long long

signed main() {
    vector<int> a(3);
    cin >> a[0] >> a[1] >> a[2];
    int cnt = 0;
    while (!(a[0] == a[1] && a[1] == a[2])) {
        sort(a.begin(), a.end());
        if (a[0] < a[1]) {
            cnt++;
            a[0] += 2;
        }
        else {
            cnt++;
            a[0]++;
            a[1]++;
        }
    }
    //cout << a[0] << ' ' << a[1] << ' ' << a[2] << endl;
    cout << cnt << endl;
}

Measured memory_bytes: 256
K = int(input())
tmp = input()
A, B = tmp.split(' ')
A = int(A)
B = int(B)

flag = 0

list = range(A, B + 1)
for num in list:
  if num % K == 0:
    print('OK')
    flag = 1
    break

if flag == 0:
  print('NG')


Measured memory_bytes: 9180
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>
#include <bitset>

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

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 MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

int main(){
  int N; cin >> N;
  vector<ll> a(N); rep(i, N) cin >> a[i];

  deque<ll> dq;
  rep(i, N){
    int index = lower_bound(dq.begin(), dq.end(), a[i]) - dq.begin();
    if (index == 0) dq.push_front(a[i]);
    else dq[index - 1] = a[i];
  }
  cout << dq.size() << endl;
}


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

#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define SUBL freopen("/home/ajinkya/Desktop/input.txt","r",stdin); freopen("/home/ajinkya/Desktop/output.txt","w",stdout); 
#define ll long long
#define ull unsigned long long
#define FI(i,a,n) for(int i=a; i<=n; i++)
#define RFI(i,n,a) for(int i=n; i>=a; i--)
#define FLL(i,a,n) for(ll i=a; i<=n; i++)
#define RFLL(i,n,a) for(ll i=n; i>=a; i--)
#define vi vector<int>
#define vll vector<ll>
#define all(v) v.begin(),v.end()
#define pll pair<ll,ll>
#define pi pair<int, int>
#define GCD(a,b) __gcd(a,b)
#define MP make_pair
#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define debug(x) cout << x << endl
#define MOD 1000000007
#define INF LLONG_MAX
#define PI 3.14159265359
using namespace std;


bool valid(int x, bool a[])
{
	while(x)
	{
		if(a[(x%10)]) return false;
		x/=10;
	}
	return true;
}

int main()
{
    fastio 
    //SUBL
    int n, k, x;
    cin >> n >> k;
    bool a[10]={};
    for(int i=0; i<k; i++) cin >> x, a[x]=true;
    while(!valid(n, a)) n++;
	cout << n;
    return 0;
}         	

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#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 ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
#define SZ(x) ((int)(x).size)
const long long mod = 1e9+7;
typedef priority_queue<int> PQ;
typedef vector<long long> Vl;
typedef vector<int> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<VS> VSS;  
typedef vector<VI> VVI;   // VVI a(n,vector<int>(m)) n * m 
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef vector<pair<int, int> > PS;
typedef long long ll;  //ll とdoubleは違う
// cout << << endl;
// cin >> ;
     

int main(){
    ll c=0,d=0,n,h,w,l,r,ans=0,ptr=0;
    string s,s1,s2;
    cin >> n;
    VI a(n);
    rep(i,n){
        cin >> a[i];
	}
    rep(i,n){
        while(a[i]%2==0){
            a[i] /= 2;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
int main() {
  int A, B, C;
  cin >> A >> B >> C;
  cout << min(C, B) << " ";
  if(A >= B + C) {
    cout << 0 << endl;
  }
  else {
    cout << B + C - A << endl;
  }
}


Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
int n,k,x,jenis=0,ans=0;
int m[200010]={0};
vector<int> v;
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin>>n>>k;
  for (int i=1; i<=n; i++){
    cin>>x;
    if (m[x]==0) ++jenis;
    m[x]++;
  }
  for (int i=0; i<=200000; i++)
    if (m[i]>0){
      v.push_back(m[i]);
    }
  sort(v.begin(),v.end());
  for (int i=0; i<(jenis-k); i++){
   ans+=v[i];
  }
  cout<<ans<<"\n";
}

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


int main() {
  
  
  int N;
  string S;
  
  cin>>N>>S;
  
  for(int i=0;i<S.size();i++){
    if(S.at(i)+N>'Z'){
      S.at(i)='A'+S.at(i)+N-'Z'-1;
    }else{
      
    S.at(i)=S.at(i)+N;
    }
  }
  
  cout<<S<<endl;
}




Measured memory_bytes: 256
n=int(input())
a=[int(input()) for i in range(n)]

ans=0
li=[0]*n
ans+=a[0]//2
li[0]=(a[0]%2)
for i in range(1,n):
    if li[i-1]==1 and a[i]>0:
        ans+=1
        a[i]-=1    

    ans+=a[i]//2
        
    if a[i]%2 != 0:
        li[i]=1
print(ans)

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

int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n, k,x,kd,count = 0;;
cin>>n>>k;
int arr[n] = {};
while(k--){
    cin>>kd;
    for(int i = 0; i<kd; i++){
        cin>>x;
        arr[x-1]++;
    }
}
for(int i = 0; i<n; i++){
    if(arr[i] == 0){
        count++;
    }
}cout<<count;
return 0;
}


Measured memory_bytes: 3560
#include <iostream>

int main(void){
  int i,s,a;
  std::cin>>a;
  s=0;
  
  for(i=10;i<=a;i*=100){
    s+=i-i/10;
  }
  
  if(a-i/10>=0)
    s+=a-i/10+1;
  
  std::cout<<s;
  
  return 0;
}


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

int main(){
  int N, X, Y, H, HH, Cx, Cy;
  bool flag = true;
  cin >> N;
  
  int x[N], y[N], h[N];
  
  for (int i = 0; i < N; i++){
    cin >> x[i] >> y[i] >> h[i];
    if (h[i] != 0){
      X = x[i];
      Y = y[i];
      H = h[i];
    }
  }
  
  for (int i = 0; i < 101; i++){
    for (int j = 0; j < 101; j++){
      HH = H + abs(X-i) + abs(Y-j);
      flag = true;
      for (int k = 0; k < N; k++){
        if (h[k] != max(HH - abs(x[k]-i) - abs(y[k]-j), 0)){
          flag = false;
          break;
        }
      }
      if (flag){
        cout << i << " " << j << " " << HH << endl;
        i = 101;
        break;
      }
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define lld long double
#define REP(i,s,n) for(lli i=s;i<n;i++)
#define RREP(i,s,n) for(lli i=s;i>=n;i--)
#define MOD 1000000007
#define NUM 2520
#define DEBUG 1
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define INF (1LL<<50)

signed main(){

	lli n,l;
	cin>>n>>l;

	vector<string> ss;
	REP(i,0,n){
		string s;
		cin>>s;
		ss.push_back(s);
	}

	sort(ss.begin(),ss.end());
	REP(i,0,n)cout<<ss[i];
	cout<<endl;

	return 0;
}

Measured memory_bytes: 256
n = int(input())
#n,k = map(int,input().split())
L= list(map(int, input().split()))
min1 = min(L)
max1 = max(L)
ans = 10**10

for i in range(min1,max1+1):
    sum1 =0
    for j in range(n):
        sum1 += (L[j]-i)**2
        #print(sum1)
    ans = min(ans,sum1)
print(ans)

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

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

set_a = set(a)
a.sort()
k = 0
p = 0
ans = 0
for a_ in set_a:
    s = a[k]
    while True:
        if k<len(a) and a[k]==s:
            k+=1
            p+=1
        else:
            if p>=s:
                ans+=p-s
            else:
                ans+=p
            p=0
            break
print(ans)


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

int main(){
   string s;
   getline(cin, s);
   for(int i = 0; i < (int)s.size(); i++){
     if('a' <= s[i] && s[i] <= 'z') s[i] = 'A' + s[i] - 'a';
     else if('A' <= s[i] && s[i] <= 'Z') s[i] = 'a' + s[i] - 'A';
  }
  cout << s << endl;
}



Measured memory_bytes: 3188
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <iomanip>

using namespace std;

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

typedef long long int  ll;


int main()
{
	FAST;
	int w,a,b;
	cin >> w >> a >> b;
	
	if(abs(a-b) <= w)
		cout << "0";
	else
		cout << abs(a-b)-w;

	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)

n = int(input())
ab = [[int(item) for item in input().split()] for _ in range(n-1)]
c = [int(item) for item in input().split()]
c.sort()
c.reverse()
sum_score = sum(c[1:])

edge = [[] for _ in range(n)]
score = [0] * n

for a, b in ab:
    a-=1; b-=1
    edge[a].append(b)
    edge[b].append(a)

it = 0
def dfs(f ,n):
    global it
    score[n] = c[it]
    it += 1
    for item in edge[n]:
        if item == f:
            continue
        dfs(n, item)
    return True

dfs(-1, 0)
print(sum_score)
print(" ".join([str(item) for item in score]))

Measured memory_bytes: 15840
using System;

namespace ITP1_9_C{
    class Sample{
        static void Main(string[] args){
            var turn = int.Parse(Console.ReadLine());
            int[] score = new int[2];
            int check=0;
            for(int i=0; i<turn; i++){
                string[] animalname = Console.ReadLine().Split(' ');
                check = animalname[0].CompareTo(animalname[1]);
                switch(check){
                    case 0:
                        score[0] += 1;
                        score[1] += 1;
                        break;
                    case 1:
                        score[0] += 3;
                        break;
                    case -1:
                        score[1] += 3;
                        break;
                    default:
                        break;
                }
            }
            Console.WriteLine("{0} {1}", score[0], score[1]);
        }
    }
}


Measured memory_bytes: 16744
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdlib.h>
#include <cmath>
#include <numeric>
#include <functional>
#include <stack>
#include <iomanip>
#include <map>
#include <cstdio>

int main() {
	int k, n;

	std::cin >> k >> n;

	std::vector<int> v(n), v2(n);

	for (size_t i = 0; i < n; i++)
	{
		std::cin >> v[i];
	}

	for (size_t i = 0; i < n; i++)
	{
		v2[i] = (i + 1 == n ? k + v[0] : v[i + 1]) - v[i];
	}

	std::sort(v2.begin(), v2.end());

	long long sum = std::accumulate(v2.begin(), v2.end(), 0LL) - *std::max_element(v2.begin(), v2.end());

	std::cout << sum << std::endl;

	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int q;
  cin>>q;
  int u = 0;
  list<char> l;
  for(auto x : s)l.push_back(x);
  while(q){
    int t;
    cin>>t;
    if(t==1){
      u++;
    }
    else{ // hello 
      int f;
      cin>>f;
      if(f==1){
	char t;
	cin>>t;
	if(u%2){
	  l.push_back(t);
	}
	else{
	  l.push_front(t);
	}
      }
      else{
	char t;
	cin>>t;
	if(u%2){
	  l.push_front(t);
	}
	else{
	  l.push_back(t);
	}
      }
    }
    q--;
  }
  if(u%2)reverse(l.begin(),l.end());
  string ans;
  for(auto x : l)ans+=x;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 10500
#include<bits/stdc++.h>
using namespace std;
namespace io{
    const int l=1<<20;
    char buf[l],*s,*t,c;
    inline void gc(){
        if(s==t){
            t=(s=buf)+fread(buf,1,l,stdin);
            c=s==t?EOF:*s++;
        }else c=*s++;
    }
    template<class IT>inline void gi(IT &x){
        x=0;gc();while(c<'0'||c>'9')gc();
        while('0'<=c&&c<='9'){x=(x<<1)+(x<<3)+(c^48);gc();}
    }
    char buf0[20];int a;
    template<class IT>inline void pi(IT x){
        if(x<0){putchar('-');x=-x;}
        do buf0[++a]=x%10+48;while(x/=10);
        while(a)putchar(buf0[a--]);
        putchar('\n');
    }
};
using io::gi;
using io::pi;
typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<int,ll > pil;
typedef pair<ll ,int> pli;
typedef pair<ll ,ll > pll;
typedef vector<int> vi;
typedef vector<ll > vl;
#define pque priority_queue
#define rep(i,l,r) for(i=(l);i<=(r);++i)
#define per(i,l,r) for(i=(l);i>=(r);--i)
#define REP(i,l,r) for(i=(l);i< (r);++i)
#define PER(i,l,r) for(i=(l);i> (r);--i)
#define mp make_pair
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define fi first
#define se second
template<class IT>inline void cmax(IT &a,IT b){if(a<b)a=b;}
template<class IT>inline void cmin(IT &a,IT b){if(b<a)a=b;}
const int N=105;
int a[N],s[N];
int main(){
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
    int n,i,j,t=0;
    scanf("%d",&n);
    rep(i,1,n)scanf("%d",&a[i]);
    while(n){
        per(i,n,1)if(a[i]==i){
            REP(j,i,n)a[j]=a[j+1];
            --n;
            s[++t]=i;
            break;
        }
        if(!i){puts("-1");return 0;}
    }
    while(t)printf("%d\n",s[t--]);
    return 0;
}

Measured memory_bytes: 256
T1,T2,A1,A2,B1,B2=map(int, open(0).read().split())
D1,D2 = (A1-B1)*T1, (A1-B1)*T1+(A2-B2)*T2
if D1*D2 > 0:     print(0)
elif D2 == 0:     print("infinity")
elif -D1%D2 == 0: print(-D1//D2*2)
else:             print(-D1//D2*2+1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<int,int> ii;
 
int main() {
    int n, t;
    cin >> n;
    --n;
    int ar[n];
    for (int ctr1 = 0; ctr1 < n; ++ctr1)
        cin >> ar[ctr1];

    int rez = ar[0] + ar[n - 1];
    for (int ctr1 = 0; ctr1 + 1 < n; ++ctr1)
        rez += min(ar[ctr1], ar[ctr1 + 1]);

    cout << rez << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long LL;

int main() {
  int D, N; cin >> D >> N;
  int base = 1;
  for (int i = 0; i < D; ++i) base *= 100;

  int cnt = 0;
  for (int i = 0;; ++i) {
    if (i % base == 0 && i % (base * 100) != 0) ++cnt;
    if (cnt == N) {
      cout << i << endl;
      break;
    }
  }
}


Measured memory_bytes: 3636
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>

using ll = long long;

using namespace std;

const int inf = 1e6 + 7;

int main(){	
	int n;
	cin >> n;
	vector<int> a(n);
	vector<vector<int>> x(n),y(n);
	for(int i = 0; i < n; i++){
		cin >> a[i];
		for(int j = 0; j < a[i]; j++){
			int xx , yy;
			cin >> xx >> yy;
			xx--;
			x[i].push_back(xx);
			y[i].push_back(yy);
		}
	}
	
	vector<vector<int>> bit((1 << n));
	for(int i = 0; i < (1 << n); i++){
		for(int j = 0; j < n; j++){
			if(i & (1 << j))bit[i].push_back(1);
			else bit[i].push_back(0);
		}
	}
	
	int ans = 0;
	for(int i = 0; i < (1 << n); i++){
		bool ok = true;
		for(int j = 0; j < n; j++){
			if(bit[i][j] == 0)continue;
			for(int k = 0; k < x[j].size(); k++){
				if(bit[i][x[j][k]] == y[j][k])continue;
				ok = false;
			}
		}
		if(ok)ans = max(ans , __builtin_popcount(i));
	}
	
	cout << ans << endl;
				
	return 0;
}
 

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

int divide(int a, int b) {
	return (a+b-1)/b;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n, d;
	cin >> n >> d;
	cout << divide(n, 2*d+1) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using vi = vector<i64>;
using vvi = vector<vi>;

int main() {
    int n, m;
    cin >> n >> m;
    vector<set<int>> adj_i(n), adj_o(n);
    for (int i = 0; i < n - 1 + m; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        adj_i[b].insert(a);
        adj_o[a].insert(b);
    }

    int r = -1;
    for (int i = 0; i < n; i++) {
        if (adj_i[i].empty()) r = i;
    }
    assert(r != -1);
    
    queue<int> que;
    que.push(r);
    int erased = 0;
    while (que.size()) {
        int v = que.front();
        que.pop();
        set<int> tmp;
        for (int s : adj_o[v]) {
            if (adj_i[s].size() > 1) {
                erased++;
                adj_i[s].erase(v);
                tmp.insert(s);
            } else {
                que.push(s);
            }
        }
        for (int s : tmp) {
            adj_o[v].erase(s);
        }
    }
    assert(erased == m);

    vi par(n);
    function<void(int, int)> dfs = [&](int v, int p) {
        par[v] = p;
        for (int s : adj_o[v]) {
            dfs(s, v);
        }
    };
    dfs(r, -1);
    for (int i = 0; i < n; i++) {
        par[i]++;
    }
    for (int i = 0; i < n; i++) {
        cout << par[i] << '\n';
    }
}

Measured memory_bytes: 26624
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
	int n,k;
	cin >> n >> k;
	for(int i = 1; i <= 2*k; i+=2){
		if(i>n){
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 256
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    token.parse().ok().unwrap()
}

fn main() {
    let n = input::<i64>();

    let mut m = n;
    let mut sum = 0;
    while m > 0 {
        sum += m % 10;
        m /= 10;
    }
    println!("{}", if n % sum == 0 { "Yes" } else { "No" });
}


Measured memory_bytes: 4352
#include<stdio.h>

int part(int A[],int p,int r){
int i,j;
int temp;

i=p-1;
for(j=p;j<r;j++){
 if(A[j]<=A[r]){
  i++;
  temp=A[i];
  A[i]=A[j];
  A[j]=temp;
 }
}
temp=A[i+1];
A[i+1]=A[r];
A[r]=temp;

return i+1;
}





int main(){
int i;
int n;
int A[100001];
int index;

scanf("%d",&n);
for(i=0;i<n;i++){scanf("%d",&A[i]);}
index=part(A,0,n-1);

for(i=0;i<n;i++){
 if(i==index){printf("[%d] ",A[i]);}
 else if(i==n-1){printf("%d\n",A[i]);}
 else{printf("%d ",A[i]);}
}

return 0;
}

Measured memory_bytes: 2084
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
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; 
}
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  cout << fixed << setprecision(10);
  ll n;
  cin>>n;
  COUT(2.0*3.14*n);
}


Measured memory_bytes: 3756
#include <bits/stdc++.h>
#include<math.h>
using namespace std;
int main() {
  int N;
  cin>>N;
  vector<int> h(N);
  for (int i = 0; i < N; i++) {
    cin >> h.at(i);
  }
  vector<int> dp(N);
  dp.at(0)=0;
  dp.at(1)=abs(h.at(1)-h.at(0));
  for (int i = 2; i < N; i++) {
    dp.at(i)=min(dp.at(i-1)+abs(h.at(i)-h.at(i-1)),dp.at(i-2)+abs(h.at(i)-h.at(i-2)));
  }
    cout<<dp.at(N-1)<<endl;
  
}



Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;
using ll = long long int;

int main(){
    ll N,K;
    cin>>N>>K;
    
    ll a=N%K;
    if(a>K-a) a=K-a;
    
    cout<<a<<endl;
    
    return 0;
}




Measured memory_bytes: 256
import sys
sys.setrecursionlimit(300000)
class UnionFind(object):
    def __init__(self, N):
        self.parent = [i for i in range(N)]
        self.size = [1 for i in range(N)]
    
    def merge(self, a, b):
        if self.issame(a,b):
            return
        pa = self.root(a)
        pb = self.root(b)
        self.parent[pa] = pb
        self.size[pb] += self.size[pa]
    def root(self, x):
        p = self.parent[x]
        if p == x:
            return x
        else:
            r = self.root(p)
            self.parent[x] = r
            return r
    
    def issame(self, x, y):
        return self.root(x) == self.root(y)
    
    def getsize(self, x):
        return self.size[self.root(x)]
n,m = map(int,input().split())
uf = UnionFind(n)
for i in range(m):
    a,b = map(int,input().split())
    a-=1;b-=1
    uf.merge(a,b)
ma = 0
for i in range(n):
    ma = max(ma, uf.getsize(i))
print(ma)

Measured memory_bytes: 182064
#include <stdio.h>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
    int n,x[110];
    bool b=1;
    cin>>n;
    for(int i=1;i<=n;i++)
    cin>>x[i];
    for(int i=1;i<=n;i++)
        if(x[i]%2==0)
    {
        if(x[i]%3!=0&&x[i]%5!=0)
        {
             b=0,cout<<"DENIED";
             break;
        }
    }
    if(b)
    cout<<"APPROVED";
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <math.h>
using namespace std;

int main()
{
    double a;
    double b;
    double x;
    
    cin >> a;
    cin >> b;
    cin >> x;
    
    // 水が半分より多く入っているとき
    if((a*a*b)/2 < x){
        double arctan;
        arctan = (2*b)/a -(2*x)/(a*a*a);
        cout.precision(10);
        cout << atan(arctan)*180/M_PI << endl;
    }
    else{
        double arctan;
        arctan = (2*x)/(a*b*b);
        cout.precision(10);
        cout << 90 - atan(arctan)*180/M_PI << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll=long long;
#define print(n) cout<<n<<endl
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vl vector<ll>
#define vi vector<int>
#define vvl vector<vector<ll>>
#define vvi vector<vector<int>>
const int M=200111;
const int inf=1000000007;
const int MOD=1000000007;
const double PI = 3.1415926535897932384626433;
const long long INF=1e18;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
int ddx[8]={1,-1,0,0,1,-1,-1,1},ddy[8]={0,0,1,-1,1,-1,1,-1};


struct UnionFind {
	vector<int> par;
	UnionFind(int n) : par(n, -1) { }

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

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

	bool merge(int x, int y) {
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y); // merge technique
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x) {
		return -par[root(x)];
	}
};

vvl comb(int n) {
	vvl v(n + 1,vl(n + 1, 0));
	for (int i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (int j = 1; j < v.size(); j++) {
		for (int k = 1; k < j; k++) {
			v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
		}
	}
	return v;
}

void sosu(ll x,bool f[]){
	ll y=x;
	for(ll i=2;i<=sqrt(y);i++){
		if(x%i==0){
			x/=i;
			f[i]=true;
			i--;
		}
	}
}

ll __gcd(ll x,ll y){
	if(x<y)swap(x,y);
	while(1){
		ll tmp=x%y;
		x=y;
		y=tmp;
		if(y==0)break;
	}
	return x;
}

int keta(ll a){
	int ke=1;
	while(a/=10)ke++;
	return ke;
}

vector<long long> enum_divisors(long long N) {
	vector<long long> res;
	for (long long i = 1; i * i <= N; ++i) {
		if (N % i == 0) {
			res.push_back(i);
			// 重複しないならば i の相方である N/i も push
			if (N/i != i) res.push_back(N/i);
		}
	}
	// 小さい順に並び替える
	sort(res.begin(), res.end());
	return res;
}

ll zyou(ll x,ll n){
	ll y=1;
	rep(i,0,n){
		y*=x;
	}
	return y;
}

int main() {
	int a,b;
	cin>>a>>b;
	print((a+b)%24);

}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N: int, X: "List[int]"):

    m = INF
    for i in range(1, 101):
        tot = 0
        for j in range(N):
            tot += (X[j]-i)**2
        m = min(tot, m)
    print(m)

    return


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
    X = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, X)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define dump(o) {cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL

signed main() {
	ll a[3];
	for (int i = 0; i < 3; i++) {
		cin >> a[i];
	}
	sort(a, a + 3);
	ll b = a[0] * a[1];
	ll c = a[2] % 2;
	ll ans = b*c;
	cout << ans << 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++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

int main(){
    int x, t; cin >> x >> t;
    cout << max(0, x-t) << endl;
}

Measured memory_bytes: 256
W, H, N = map(int, input().split())
W0 = 0
H0 = 0
for i in range(N):
    x, y, a = map(int, input().split())
    if a == 1 and W0 < x:
        W0 = x
    elif a == 2 and x < W:
        W = x
    elif a == 3 and H0 < y:
        H0 = y
    elif a == 4 and y < H:
        H = y
if W-W0 < 0 or H-H0 <0:
    print(0)
    exit()
print((W-W0)*(H-H0))

Measured memory_bytes: 3064
def int_raw():
    return int(input())


def ss_raw():
    return raw_input().split()


def ints_raw():
    return list(map(int, ss_raw()))


S = [int(s) for s in raw_input()]
current = 0
ans = 0
for s in S:
    if s != current:
        ans += 1
    current = 1 - current
print(min(ans, len(S) - ans))


Measured memory_bytes: 3652
/* Don't try to copy it!
                    nhi too,
                         goli maar ke cheed bana dunga...;););)
 
                 
    _/﹋\_
    (҂`_´)
    <,︻╦╤─҉- - - - - - - - => - => - =>
    _/﹋\_
                
*/
 
#include "bits/stdc++.h"
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define pb push_back
#define f(a) for(ll i = 0;i<a;i++)
#define rep(i,a,b) for(ll i = a;i<b;i++)
#define rrep(i,a,b) for(ll i = a;i>b;i--)
#define vll vector<ll>
#define T ll t; cin>>t; while(t--)
#define freeopen freopen("input.txt","r",stdin);
#define freeclose freopen("output.txt","w",stdout);
#define MOD 1000000007
using namespace std;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
ll a[100004];
ll n,k;
ll dp[100004];
ll min_cost(ll p)
{
    
    if(p>=n-1)
        return 0;

    if(dp[p]!=-1)
        return dp[p];


        dp[p]=100000000000000000l;

        for(ll i=p+1;i<=p+k;i++)
        {
            if(i<n)
            dp[p]=min(dp[p],abs(a[p]-a[i])+min_cost(i));
        }
    

    return dp[p];
}

main()
{
    //ll n;
    cin>>n>>k;
    //ll a[n];
    memset(dp,-1,sizeof(dp));
    f(n)
    cin>>a[i];

    ll ans=min_cost(0);

    cout<<ans;

}



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

#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define F first
#define S second
#define int long long

int32_t main() {
	string s;
	int n;
	cin >> s;
	n = s.size();
	for (int i = 0; i < n; i++) if(s[i] != s[n - i - 1]) return cout << "No", 0;
	for (int i = 0; i < (n - 1) / 2; i++) {
		if(s[i] != s[((n - 1) / 2) - i - 1]) return cout << "No", 0;
	}
	for (int i = ((n + 3) / 2) - 1; i < n; i++) {
		if(s[i] != s[n - i - 1]) return cout << "No", 0;
	}
	return cout << "Yes", 0;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;


int main(){
  int n;
  cin>>n;
  cout<<48-n<<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))

int main() {
    int W, H, N; cin >> W >> H >> N;
    pair<int, int> lp, rp;
    lp = pair<int, int>(0, 0);
    rp = pair<int, int>(W, H);
    rep(i, N) {
        int x, y, a; cin >> x >> y >> a;
        if (a == 1) { lp.first = max(x, lp.first); }
        else if (a == 2) { rp.first = min(x, rp.first); }
        else if (a == 3) { lp.second = max(y, lp.second); }
        else if (a == 4) { rp.second = min(y, rp.second); }
    }
    int w = (rp.first - lp.first);
    int h = (rp.second - lp.second);
    if (h < 0 or w < 0) cout << 0 << endl;
    else cout << h * w << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	string a, b;
	cin >> a >> b;
	int ans = 0;
	for (int i = 0; i < a.size(); i++)
	if (a[i] != b[i]) ans++;
	cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3840
N = int(input())
A = [int(a) for a in input().split()]

def gcd(a, b):
  while(b):
    a, b = b, a%b
  return a  

L = [0 for _ in range(N)]
R = [0 for _ in range(N)]

for i in range(1, N):
  L[i] = gcd(L[i-1], A[i-1])

for i in range(N-2, -1, -1):
  R[i] = gcd( R[i+1], A[i+1] )

M = []  
for i in range(N):
  M.append(gcd(L[i], R[i]))
print(max(M))  

Measured memory_bytes: 14432
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,num=0;
	cin>>n;
	string s;
	cin>>s;
	for(int i=0;i<n-2;i++){
		if(s.at(i)=='A'&&s.at(i+1)=='B'&&s.at(i+2)=='C')num++;
	}
	cout<<num<<endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

using static Input;
using static Util;
class Program
{
    static int N;
    static void INPUT()
    {
        N = NextInt();
    }

    static void OUT()
    {
        var d = new int[N + 1];
        var sum = 0L;
        for (long k = 1; k <= N; k++)
        {
            for (int i = 1; k * i <= N; i++)
            {
                d[k * i]++;
            }

            sum += k * d[k];
        }

        Console.WriteLine(sum);
    }

    static void Main(string[] args)
    {
#if DEBUG  
        //TESTINPUT();
        INPUT();

#else
        INPUT();
#endif
        OUT();
    }

    static void TESTINPUT()
    {
    }

}

public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}

class Util
{
}


Measured memory_bytes: 56108
/*
  ->->->->->-> Vora Mahammadasim <-<-<-<-<-<-
*/
#include<bits/stdc++.h>
#include<stdio.h>
#define int long long
#define pb emplace_back
#define Mod 1000000007
#define all(a) a.begin(),a.end()
using namespace std;
signed main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    int s,w;
    cin>>s>>w;
    if(w >= s) cout<<"unsafe";
    else cout<<"safe";
}


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

int main(void) {
	string S;
	vector<int> V;
	V.resize(26, 0);

	cin >> S;
	int cnt = 0;
	for (int i = 0; i < (int)S.length(); ++i) {
		int idx = (int)(S[i] - 'a');
		if (V[idx] == 0)
			++cnt;
		if (cnt == 26)
			break;
		++V[idx];
	}
	if (cnt == 26)
		cout << "None\n";
	else {
		char c = 'a';
		for (int i = 0; i < 26; ++i) {
			if (V[i] == 0) {
				c += (char)i;
				break;
			}
		}
		cout << c << '\n';
	}

	return 0;
}


Measured memory_bytes: 512
/*
======================
[     ___T_          ]
[    | 6=6 | =>HI :-)] 
[    |__o__|         ]
[ >===]__o[===<      ]
[     [o__]          ]
[      .".           ]
[      |_|           ]
[                    ]
======================
 */

#include<bits/stdc++.h>
using namespace std;
using lli = int64_t;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int T = 1;
	for(int t = 1; t <= T; t++){
		map<string,vector<pair<int,int>>> idx;
		int n;
		cin >> n;
		for(int i = 0;i < n; i++){
			string s;
			int p;
			cin >> s >> p;
			idx[s].push_back(make_pair(p,i + 1));
		}
		for(auto i : idx){
			sort(i.second.begin(),i.second.end(),[](pair<int,int> x,pair<int,int> y){
					return x.first > y.first;
					});
			for(auto j : i.second){
				cout << j.second << "\n";
			}
		}
	}
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
    using namespace std; 
    //typedef long long int ll; 
    
    int judge(int N){
      int j;
      for(int i=0; i*i<=N; i++){
        j=i;
      }
      return (j*j==N);
    }
     
    int main() {
       int N, D; 
       cin >> N >> D;
       int A[N][D]; 
       for(int i=0; i<N; i++){
         for(int j=0; j<D; j++){
           cin>> A[i][j]; 
         }
       }
      
      int count=0; 
      
      for(int i=0; i<N-1; i++){
         for(int j=i+1; j<N; j++){
           int S=0; 
           for(int k=0; k<D; k++){
             int x = A[i][k] - A[j][k];
             S+= x*x;
           }
          count+=judge(S);
         }
       }
       cout<< count <<endl;
                }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

vector<pair<ll ,ll>> prime_factorize(ll n) {
    vector<pair<ll, ll>> res;
    for (ll p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) {
            num++;
            n /= p; 
        }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

int main() {

    ll N;
    cin >> N;

    for(int i = sqrt(N); i >= 0; i--) {
        if (i*(N/i) == N) {
            cout << (i-1) + (N/i - 1) << endl;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;

	bool can = false;
	if (abs(c - a) <= d)
		can = true;
	else if (abs(a - b) <= d && abs(c - b) <= d)
		can = true;

	if (can)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
import sys

# sys.stdin = open('c1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_int():
    return int(input())


def read_str_list():
    return input().split()


def read_str():
    return input()


H, W, h, w = read_int_list()


def solve(H, W, h, w):
    if H % h == 0 and W % w == 0:
        return False, None
    a = [[0] * W for _ in range(H)]
    m = 10 ** 9 - 1
    M = m + 1
    for i in range(0, H, h):
        for j in range(0, W, w):
            a[i][j] = m
    for i in range(h - 1, H, h):
        for j in range(w - 1, W, w):
            a[i][j] = -M
    return True, a


possible, res = solve(H, W, h, w)
if possible:
    print('Yes')
    for row in res:
        print(' '.join(map(str, row)))
else:
    print('No')


Measured memory_bytes: 11636