akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;

void solve() {
	int a; cin >> a;
	int b; cin >> b;
	int c; cin >> c;
	int d; cin >> d;
	if ((a + b) > (c + d)) {
		cout << "Left" << endl;
	} else if((a + b) < (c + d)) {
		cout << "Right" << endl;
	} else {
		cout << "Balanced" << endl;
	}
	return;
}

int main() {
  solve();
  return 0;
}

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

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

  int buf;
  int sum = 0;
  int maxval = 0;
  for (int i = 0; i < N; ++i) {
    scanf("%d", &buf);
    sum += buf;
    if (buf > maxval) maxval = buf;
  }

  printf("%d\n", sum - maxval / 2);
  return 0;
}

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF 9223372036854775807

struct Dinic {
#define Vmax 202
    int s,t,level[Vmax],cup[Vmax][Vmax];
    bool keep_out[Vmax];
    vector<int> v[Vmax];
    stack<int> st;
    int max_flow() {
        int flow = 0,tmp;
        while(bfs()) do {
            int now = s;
            tmp = dfs(s);
            flow += tmp;
            while(!st.empty()) {
                cup[now][st.top()] -= tmp;
                cup[st.top()][now] += tmp;
                now = st.top();
                st.pop();
            }
        } while(tmp);
        return flow;
    }
    bool bfs() {
        queue<pair<int,int>> que;
        rep(i,Vmax) keep_out[i] = false;
        rep(i,Vmax) if (i^t) level[i] = INF;
        rep(i,v[t].size()) if (cup[v[t][i]][t] > 0) que.push(mp(v[t][i], 1));
        while(!que.empty()) {
            int a = que.front().fi, c = que.front().se;que.pop();
            if (level[a] <= c || level[s] < c) continue;
            level[a] = c;
            rep(i,v[a].size()) if (cup[v[a][i]][a] > 0) que.push(mp(v[a][i], c+1));
        }
        if (level[s] == INF) return false;
        else return true;
    }
    int dfs(int a) {
        rep(i,v[a].size()) {
            if (level[a] > level[v[a][i]] && cup[a][v[a][i]] > 0 && !keep_out[v[a][i]]) {
                if (v[a][i] == t) {st.push(t);return cup[a][t];}
                int tmp = dfs(v[a][i]);
                if (tmp) {st.push(v[a][i]);return min(tmp, cup[a][v[a][i]]);}
            }
        }
        keep_out[a] = true;
        return 0;
    }
    //array[Vmax][Vmax] exists!
    //　　-> int cup[Vmax][Vmax] -> map<int,int> cup[Vmax]
};

int n,a[100],b[100],c[100],d[100];
Dinic D;

signed main() {
    cin >> n;
    D.s = 0, D.t = n*2+1;
    rep(i,n) {
        cin >> a[i] >> b[i];
        D.v[0].pb(i+1);
        D.v[i+1].pb(0);
        D.cup[0][i+1] = 1;
    }
    rep(i,n) {
        cin >> c[i] >> d[i];
        D.v[n+i+1].pb(n*2+1);
        D.v[n*2+1].pb(n+i+1);
        D.cup[n+i+1][n*2+1] = 1;
    }
    rep(i,n) rep(j,n) if (a[i] < c[j] && b[i] < d[j]) {
        D.v[i+1].pb(n+j+1);
        D.v[n+j+1].pb(i+1);
        D.cup[i+1][n+j+1] = 1;
    }
    cout << D.max_flow() << endl;
}





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

int main(){
  long long K,N,sa=0;
  std::cin>>K>>N;
  std::vector<long long>a(N);
  for(long long i=0;i<N;i++){
    std::cin>>a[i];
  }
  for(long long i=0;i<N-1;i++){
     sa=std::max(a[i+1]-a[i],sa);
  }
  if(a[N-1]-a[0]>K/2)sa=std::max(K-a[N-1]-a[0],sa);
  else sa=std::max(a[N-1]-a[0],sa);
  if(a[N-1]-a[0]<K-sa){
    std::cout<<a[N-1]-a[0]<<std::endl;
  }else
    std::cout<<K-sa<<std::endl;
 	//std::cout<<"差は"<<sa<<std::endl;
  return 0;
}
  

Measured memory_bytes: 1792
L = input()
L = list(L.split('><'))
if len(L) == 1:
    a = [L[0].count('<'),L[0].count('>')]
    a_max = max(a)
    ans = a_max*(a_max+1)/2
else:
    ans = 0
    for i in range(len(L)):
        if i == 0:
            a = [L[i].count('<'),L[i].count('>')+1]
        elif i == len(L)-1:
            a = [L[i].count('<')+1,L[i].count('>')]
        else:
            a = [L[i].count('<')+1,L[i].count('>')+1]
        a_max = max(a)
        a_min = min(a)

        ans += a_max*(a_max+1)/2
        ans += a_min*(a_min-1)/2

print(int(ans))


Measured memory_bytes: 9756
#include <cstdio>
using namespace std;
int main(){
    // Your code h#include <cstdio
    int h, m, s, S;
    
    scanf("%d", &S);
    
    h=S/3600;
    m=S%3600/60;
    s=S%3600%60;
   
    
    printf("%d:%d:%d\n",h,m,s);
    
    return 0;

}


Measured memory_bytes: 2756
#include<iostream>

using namespace std;

int main(){

    unsigned int a, b, c;
    unsigned int i, counter = 0;

    cin >> a >> b >> c;

    for(i=a;i<=b;i++){
        if(c % i == 0){
            counter++;
        }
    }

    cout << counter << endl;

    return 0;

}


Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'

int main()
{
    ll k;
    cin>>k;
    ll a,b;
    cin>>a>>b;
    if(k>b)
    {
        cout<<"NG"<<endl;
        return 0;
    }
    if(b - b%k >= a) cout<<"OK"<<endl;
    else cout<<"NG"<<endl;
}

Measured memory_bytes: 3632
#pragma warning(disable:4996)
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>
#include <stdio.h>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 998244353;
const long long INF = 1e15;
typedef long long LL;
typedef long double LD;
//typedef boost::multiprecision::cpp_int bigint;
typedef pair<LL, LL> PLL;
typedef pair<int, int> PI;
typedef pair<LD, LL> pdl;
typedef pair<LD, LD> pdd;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef unsigned long long ULL;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	int N;
	cin >> N;
	VLL A(N);
	for (int n = 0; n < N; n++)cin >> A[n];
	sort(A.begin(), A.end(), [](int a, int b) {return a > b; });
	LL ans = 0;
	int i = 0, t = 1;
	for (int n = 1; n < N; n++) {
		ans += A[i];
		t++;
		if (t == 2) {
			i++;
			t = 0;
		}
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 4404
#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
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;
long long a,b;
long long dp[100200][110];
long long w[110],v[110];


int main(){
   int a;
   cin>>a;
   int ans=0;
   rep(i,a){
       ans+=(i+1);
   }
   cout<<ans<<endl;

}



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

int main(void) {
  int A, B, C;
  cin >> A >> B >> C;
  
  if(A==B && B!=C || A==C && A!=B || B==C && A!=B)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 256
/* AtCoder Regular Contest 087 (D - FT Robot) https://arc087.contest.atcoder.jp/tasks/arc087_b
*
* If number of turns that the robot made so far is:
* even --> he is walking on the x-axis now.
* odd  --> he is walking on the y-axis now.
*
* create dpx to know if it's possible to reach the required X-position.
* create dpy to know if it's possible to reach the required Y-position.
* If both are achievable then the answer is "Yes" else the answer is "No".
*
*/

#include <bits/stdc++.h>
#define F first
#define S second
#define SZ size()

using namespace std;
typedef long long ll;

int in(){int a; scanf("%d", &a); return a;}
ll inll(){ll a; scanf("%lld", &a); return a;}

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

const int MAX = 8e3 + 5;
const int INF = 0x3f3f3f3f;

string s;
int X, Y;
vector <int> xsteps, ysteps;


int memx[MAX][MAX];

bool dpx(int i, int curX) {

    if(i == xsteps.SZ) return curX == X;
    int &res = memx[i][curX];
    if(res != -1) return res;
    res = 0;
    res = dpx(i+1, curX + xsteps[i]) || dpx(i+1, curX - xsteps[i]);
    return res;
}

int memy[MAX][MAX];

bool dpy(int i, int curY) {

    if(i == ysteps.SZ) return curY == Y;
    int &res = memy[i][curY];
    if(res != -1) return res;
    res = 0;
    res = dpy(i+1, curY + ysteps[i]) || dpy(i+1, curY - ysteps[i]);
    return res;
}


int main(){
    memset(memx, -1, sizeof memx);
    memset(memy, -1, sizeof memy);

    cin >> s;
    s = s + 'T';

    X = in(), Y = in();

    int steps = 0;
    int turns = 0;
    int xstart = 0;

    for(int i=0; i<s.SZ; i++){

        if(s[i] == 'F') steps++;

        else {

            if(turns == 0) {
                xstart = steps;
            }

            else if(steps > 0) {
                if(turns % 2 == 0) xsteps.push_back(steps);
                else ysteps.push_back(steps);
            }

            turns++;
            steps = 0;
        }
    }

    if(dpx(0, xstart) && dpy(0, 0)) printf("Yes\n");
    else printf("No\n");

}


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

list = []

for i in range(n):
    list.append(input())

AC = list.count('AC')
WA = list.count('WA')
TLE = list.count('TLE')
RE = list.count('RE')

print('AC x ' + str(AC))
print('WA x ' + str(WA))
print('TLE x ' + str(TLE))
print('RE x ' + str(RE))

Measured memory_bytes: 16104
N, Q = gets.split.map(&:to_i)
seq = gets.chomp
lr = Array.new(Q){gets.split.map(&:to_i)}

a = Array.new(seq.length, 0)

(seq.length-1).times do |i|
  a[i+1] = a[i] + (seq[i..i+1].match(/AC/) ? 1 : 0)
end

lr.each do |v|
  puts a[v[1]-1]-a[v[0]-1]
end

Measured memory_bytes: 13820
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<map>
#include<queue>
#include<stack>
#include<iomanip>
#include<set>
using namespace std ;

#define MAXN 107
int n ;
int b[ MAXN ] ;
int a[ MAXN ] ;

void input ( ) {
    scanf ( "%d" , &n ) ;
    for ( int i = 1 ; i < n ; ++ i ) {
        scanf ( "%d" , &b[ i ] ) ;
    }
}

void solve ( ) {
    int ans = 0 ;
    for ( int i = 1 ; i <= n ; ++ i ) {
        if ( i == n ) { a[ i ] = b[ i - 1 ] ; }
        else if ( i == 1 ) { a[ i ] = b[ i ] ; }
        else {
            a[ i ] = min ( b[ i - 1 ] , b[ i ] ) ;
        }
        ans += a[ i ] ;
    }
    printf ( "%d\n" , ans ) ;
}

int main ( ) {
    ios_base :: sync_with_stdio ( false ) ;
    cin.tie ( NULL ) ;
    input ( ) ;
    solve ( ) ;
    return 0 ;
}



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

const int N = 1e5 + 5;
int n, m, v, p;
int a[N];
long long sum[N];

bool can(int i) {
	if (i >= n - p) return 1;
	if (a[n - p] > a[i] + m) return 0;
	long long add = 1LL * (i + p) * m;
	add += 1LL * (n - p - i) * (a[i] + m) - (sum[n - p] - sum[i]);
	return add >= 1LL * m * v;
}

int main() {
	scanf("%d %d %d %d", &n, &m, &v, &p);
	for (int i = 0; i < n; ++ i)
		scanf("%d", &a[i]);
	sort(a, a + n);
	for (int i = 0; i < n; ++ i)
		sum[i] = (i ? sum[i - 1] : 0) + a[i];
	int ans = 0;
	for (int i = v - 1; i < n; ++ i)
		if (upper_bound(a, a + n, a[i] + m) - a >= n - p + 1) ++ ans;
	for (int i = 0; i < v - 1; ++ i)
		if (can(i)) ++ ans;
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main(void){
    int n;
    cin >> n;
    ll sum = 0;
    map<ll, ll> mp;
    REP(i,n){
        ll x = in();
        mp[x]++;
        sum += x;
    }
    int q;
    cin >> q;
    while (q--){
        ll b = in(), c = in();
        sum -= b * mp[b];
        sum += c * mp[b];
        mp[c] += mp[b];
        mp[b] = 0;
        printf("%lld\n", sum);
    }

    return 0;
}


Measured memory_bytes: 9632
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

using System.Collections;

class Program
{
    static void Main()
    {
        int N = int.Parse(Console.ReadLine());

        var items = Enumerable.Repeat(0, N).Select(n => int.Parse(Console.ReadLine())).ToArray();

        items = items.OrderByDescending(n => n).ToArray();

        var ans = items.First() / 2;
        ans += items.Skip(1).Sum();

        Console.WriteLine(ans);
    }
    
    
}

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

int main (){
  int N;
  cin >> N;
  int s = 0,m = 0;
  for (int i = 0; i < N; ++i){
    int L;
    cin >> L;
    m =max(m,L);
    s += L;
  }
  if (m < s-m)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
  

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long LL;
const int MAXN = 1e5 + 5;

int A[MAXN + 5], B[MAXN + 5], C[MAXN + 5];
LL sum_B[MAXN + 5], sumv[MAXN + 5];

int N;

void solve_sum_B()
{
	int tail = N;
	for(int i = N; i >= 1; i--){
		while(C[tail] > B[i] && tail >= 1) tail--;
		sum_B[i] = N - tail;
	}
}

int main() 
{
	scanf("%d", &N);
	for(int i = 1; i <= N; i++) scanf("%d", &A[i]);
	for(int i = 1; i <= N; i++) scanf("%d", &B[i]);
	for(int i = 1; i <= N; i++) scanf("%d", &C[i]);
	sort(A + 1,	A + 1 + N), sort(B + 1, B + 1 + N), sort(C + 1, C + 1 + N);
	solve_sum_B();
	for(int i = N; i >= 1; i--) sumv[i] = sumv[i + 1] + sum_B[i];
	LL sum = 0;
	int tail = 1;
	for(int i = 1; i <= N; i++){
		while(A[i] >= B[tail] && tail <= N) tail++;
		sum += sumv[tail];
	}
	printf("%lld\n", sum);
}


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

int main() {
  long N;
  cin >> N;
  
  int ans = 10;
  for (long a = 1; a <= sqrt(N); a++) {
    if (N % a == 0) {
      int ord = 0;
      long b = N / a;
      while (b > 0) {
        b /= 10;
        ord++;
      }
      ans = min(ans, ord);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3684
#include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin >> S;
if (S == "hi") {cout << "Yes" <<endl;
              }
else if (S == "hihi") {cout << "Yes" <<endl;
              }
else if (S == "hihihi") {cout << "Yes" <<endl;
              }
else if (S == "hihihihi") {cout << "Yes" <<endl;
              }
else if (S == "hihihihihi") {cout << "Yes" <<endl;
              }
else {cout << "No" <<endl;
     }
}

Measured memory_bytes: 256
let S = readLine()!.characters.map{"\($0)"}
let N = S.count
let K = Int(readLine()!)!
var sub = Set<String>()
for i in 0..<N {
    var s = ""
    for c in S[i..<min(i+K, N)] {
        s += c
        sub.insert(s)
    }
}
print(Array(sub).sort()[K-1])

Measured memory_bytes: 6128
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define fi first
#define se second
#define int long long
typedef pair<int,int> P;


std::vector<int> r;
std::vector<P> pp;
P find(int x){
  std::vector<int> v;
  while(x!=pp[x].first){
    v.push_back(x);
    x=pp[x].first;
  }
  for(int i:v)pp[i].first=pp[x].first;
  return pp[x];
}
bool same(int x,int y){
  return find(x).first==find(y).first;
}
void unite(int x,int y){
  x=find(x).first;y=find(y).first;
  if(x==y) return;
  if(r[x]<r[y]) swap(x,y);
  r[x]+=r[y];
  int a=pp[x].second+pp[y].second;
  pp[x].second=pp[y].second=a;
  pp[y].first=x;
}


signed main(){
  int N,M;cin>>N>>M;
  std::vector<int> a(M),b(M);
  for(int i=0;i<M;i++)cin>>a[i]>>b[i];
  r.resize(N);
  pp.resize(N);
  for(int i=0;i<N;i++)pp[i]=P(i,1);
  std::vector<int> ans;
  int w=N*(N-1)/2;
  for(int i=M-1;i>=0;i--){
    ans.push_back(w);
    if(find(a[i]).first==find(b[i]).first)continue;
    w-=find(a[i]).second*find(b[i]).second;
    unite(a[i],b[i]);
  }
  reverse(ans.begin(),ans.end());
  for(auto e:ans)cout<<e<<endl;
}


Measured memory_bytes: 6132
/*
	  Author : @evenbao
	  Created : 2020 / 07 / 27 
*/

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

#include<bits/stdc++.h>

using namespace std;

typedef long long LL;

#define pii pair<int , int>
#define mp make_pair
#define fi first
#define se second

const int N = 55;

int n;
int a[N] , b[N];
int f[N][N];

template <typename T> inline void chkmax(T &x , T y) { x = max(x , y); }
template <typename T> inline void chkmin(T &x , T y) { x = min(x , y); }
template <typename T> inline void read(T &x) {
    T f = 1; x = 0;
    char c = getchar();
    for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
    for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + c - '0';
    x *= f;
}

inline bool ok(LL now) {
		for (int i = 0; i < N; ++i)
		for (int j = 0; j < N; ++j)
				f[i][j] = i == j ? 1 : 0;
		for (int i = 0; i < N; ++i) 
		for (int j = 1; j <= i; ++j)
				if (now & (1LL << j)) f[i][i % j] = 1;
		for (int k = 0; k < N; ++k)
				for (int i = 0; i < N; ++i)
						for (int j = 0; j <= i; ++j)
								f[i][j] |= (f[i][k] & f[k][j]);
		for (int i = 1; i <= n; ++i)
				if (!f[a[i]][b[i]])
						return false;
		return true;
}

int main() {
		
		read(n);
		for (int i = 1; i <= n; ++i) read(a[i]);
		for (int i = 1; i <= n; ++i) read(b[i]);
		LL ans = (1LL << 38) - 2;
		if (!ok(ans)) {
				printf("-1\n");
				return 0;
		}
		for (int i = 37; i >= 1; --i) {
				LL new_ans = ans ^ (1LL << i);
				if (ok(new_ans)) ans = new_ans;
		}
		printf("%lld\n" , ans);
	  return 0;
}



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

int main() {
  int N, M;
  cin >> N >> M;
  int a, b;
  vector<int> res(N);
  for (int i = 0; i < M; ++i) {
    cin >> a >> b;
    ++(res[a - 1]);
    ++(res[b - 1]);
  }
  for (int i = 0; i < N; ++i) {
    cout << res[i] << endl;
  }
  return 0;
}


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

int main() {
  int64_t n;
  std::cin >> n;
  std::vector<int64_t> t(n), v(n);
  for (auto &i : t) {
    std::cin >> i;
  }

  for (auto &i : v) {
    std::cin >> i;
  }

  std::vector<int64_t> t_b(n), t_e(n);
  t_b[0] = 0;
  for (int64_t i = 1; i < n; i++) {
    t_b[i] = t_b[i - 1] + t[i - 1];
  }
  t_e[0] = t[0];
  for (int64_t i = 1; i < n; i++) {
    t_e[i] = t_e[i - 1] + t[i];
  }
  const auto t_max = std::accumulate(t.cbegin(), t.cend(), 0);
  auto speed = [&] (double time) {
    double ans = std::min<double>(time, t_max - time);
    for (int j = 0; j < n; j++) {
      if (time < t_b[j]) {
        ans = std::min<double>(ans, t_b[j] - time + v[j]);
      } else if (t_b[j] <= time && time <= t_e[j]) {
        ans = std::min<double>(ans, v[j]);
      } else {
        ans = std::min<double>(ans, time - t_e[j] + v[j]);
      }
    }
    return std::max<double>(ans, 0.0);
  };

  double l = 0;
  for (double i = 0; i < t_max; i += 0.5) {
    l += 0.25 * (speed(i) + speed(i + 0.5));
  }
  std::cout << std::fixed << std::setprecision(2) << l << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
int A;
  cin >> A;
int B;
  cin >> B;
int C;
  cin >> C;
  
  if (A!=B && B == C)
  {cout << "Yes" << endl;}
    else if (C!=B && A == B)
    {cout << "Yes" << endl;}
  else if (B!= A && A==C)
  {cout << "Yes" << endl;}
    else if ( A == B || B == C)
    {cout << "No" << endl;}
	else if ( A!= B || B!=C || C!=A)
    {cout << "No" << endl;}}

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

using namespace std;

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

    pair<int, int> p[N];
    for (int i = 0; i < N; i++) {
        cin >> p[i].first >> p[i].second;
    }

    sort(p, p + N, [](pair<int, int> x, pair<int, int> y) {
        return x.first < y.first;
    });

    priority_queue<int> pq;
    long long res = 0;
    int j = 0;
    for (int i = 1; i <= M; i++) {
        while (j < N && p[j].first <= i) {
            pq.push(p[j].second);
            j++;
        }
        if (!pq.empty()) {
            res += pq.top();
            pq.pop();
        }
    }

    cout << res << "\n";
}


Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

int main() {
    int N;
    string S;
    cin >> N >> S;
    int res = 0;
    rep(a, 0, 10) {
        int a_i = -1;
        rep(i, 0, N-2) {
            if (S[i] == to_string(a)[0]) {
                a_i = i;
                break;
            }
        }
        if (a_i == -1) continue;
        rep(b, 0, 10) {
            int b_i = -1;
            rep(i, a_i+1, N-1) {
                if (S[i] == to_string(b)[0]) {
                    b_i = i;
                    break;
                }
            }
            if (b_i == -1) continue;
            rep(c, 0, 10) {
                rep(i, b_i+1, N) {
                    if (S[i] == to_string(c)[0]) {
                        res++;
                        break;
                    }
                }
            }
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)
A_ = []
A_ = A[:]
A_max = max(A)

A = [abs(float(x) - float(A_max/2)) for x in A]


ans = 10**10
idx = 0
for i in range(len(A)):
    t = A[i]
    if t <= ans:
        ans = t
        idx = i

print(A_max,A_[idx])

Measured memory_bytes: 14060
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int INT_INF = 2147483647;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef pair<int,int> P;

struct Sieve {
  int n;
  vector<int> f, primes;
  Sieve(int n=1):n(n), f(n+1) {
    f[0] = f[1] = -1;
    for (ll i = 2; i <= n; ++i) {
      if (f[i]) continue;
      primes.push_back(i);
      f[i] = i;
      for (ll j = i*i; j <= n; j += i) {
        if (!f[j]) f[j] = i;
      }
    }
  }
  bool isPrime(int x) { return f[x] == x;}
  vector<int> factorList(int x) {
    vector<int> res;
    while (x != 1) {
      res.push_back(f[x]);
      x /= f[x];
    }
    return res;
  }
  vector<P> factor(int x) {
    vector<int> fl = factorList(x);
    if (fl.size() == 0) return {};
    vector<P> res(1, P(fl[0], 0));
    for (int p : fl) {
      if (res.back().first == p) {
        res.back().second++;
      } else {
        res.emplace_back(p, 1);
      }
    }
    return res;
  }
};

//Sieve sieve(1e6);
//auto f = sieve.factor(x);

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    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;
  }
};

int main(){
  int n;
  cin >> n;
  int a[n];
  rep(i,n)cin >> a[i];
  Sieve sieve(1e6);
  map<int,int>mp;
  rep(i,n){
    auto f = sieve.factor(a[i]);
    for(auto p:f){
      chmax(mp[p.first],p.second);
    }
  }
  mint lcm = 1;
  for(auto p:mp){
    rep(i,p.second){
      lcm *= p.first;
    }
  }
  mint ans=0;
  rep(i,n){
    ans += lcm/a[i];
  }
  cout << ans.x << endl;
}


Measured memory_bytes: 4984
n = int(input())
zo=[False]*n
for i in range(n):
  a,b = map(int,input().split())
  if a==b:
    zo[i] = True
for i in range(n-2):
  if zo[i] and zo[i+1] and zo[i+2]:
    print("Yes");exit()
print("No")

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

typedef long long ll;
typedef int64_t i6;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 1; i <= n; ++i)
#define ALL(v) (v).begin(), (v).end()
#define Sort(x) sort(ALL(x))
#define Sort_rev(x) Sort(x);reverse(ALL(x))

template<typename V,typename T>
T find_num(V v, T num) {
    if ( find(ALL(v), num) == v.end() ) {
        return false;
    } else {
        return true;
    }
}

// π M_PI
// deg = rad*180/M_PI

int main() {
    string s, t;
    cin >> s >> t;
    ll ans = 0;

    if ( s+t[t.length()-1] == t ) {
        ans = 1;
    }
    cout << ( ans ? "Yes" : "No" ) << endl;
    return 0;
}


Measured memory_bytes: 3628
import java.util.ArrayList;
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		// データの取得
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int K = sc.nextInt();
		
		ArrayList<Integer> list = new ArrayList<Integer>();
		int max = Math.max(A, B);
		for(int i=1;i<=max;i++) {
			if(A % i == 0 && B % i ==0) {
		        list.add(new Integer(i));
			}
		}
		System.out.println(list.get(list.size()-K));
	}
}

Measured memory_bytes: 23764
n = gets.chomp

length = n.length

max = 0
(0...length).each do |i|
  pre = n[0..i].to_i
  post = n[(i + 1)...length]
  unless post.each_char.all?{|s| s == "9"}
    pre -= 1
  end
  current = (pre.to_s + ("9" * post.length)).each_char.map(&:to_i).inject(&:+)
  if current > max
    max = current
  end
end

if 9 * (length - 1) > max
  max = 9 * (length - 1)
end

puts(max)

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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define endl '\n';
#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll POSITIVE_INFINITY = 9223372036854775807;
const ll NEGATIVE_INFINITY = -9223372036854775807;
const ll MOD = 1000000007;
const ld PI = acos(-1.0);

template <typename T> inline T bigMod(T A,T B,T M = MOD){A %= M;T ret = 1;while(B){if(B & 1) ret = (ret * A) % M;A = (A * A) % M;B = B >> 1;}return ret;}
template <typename T> inline T invMod (T A,T M = MOD){return bigMod(A,M-2,M);}

const int N = 200005;

int main(){
  FASTER;
  int n = 3;
  int ar[1000];
  for (int i = 0; i < n; i++){
    cin >> ar[i];
  }
  sort(ar, ar + n);
  int ans = 0;
  for (int i = 1; i < n; i++){
    ans += (ar[i] - ar[i - 1]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REP(i,0,n)
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

double dis(double x1, double y1, double x2, double y2) {
  return sqrt(pow(x1-x2, 2) + pow(y1-y2, 2));
}

bool bellman_ford(vector<double>& dist,
                  vector<vector<double> >& cost,
                  int n, int s){
  dist[s] = 0;
  rep(i, n) {
    rep(j, n) {
      rep(k, n) {
        if(j != k && dist[j] != DBL_MAX && dist[k] > dist[j] + cost[j][k]) {
          dist[k] = dist[j] + cost[j][k];
          if(i == n-1) return true;
        }
      }
    }
  }
  return false;
}

int main() {
  double xs, ys, xt, yt;
  cin >> xs >> ys >> xt >> yt;
  int N;
  cin >> N;
  vector<double> X(N+2), Y(N+2), R(N+2);
  rep(i, N)
    cin >> X[i] >> Y[i] >> R[i];
  X[N] = xs, Y[N] = ys;
  X[N+1] = xt, Y[N+1] = yt;
  vector<vector<double> > cost(N+2, vector<double>(N+2));
  rep(i, N+2) {
    REP(j, i+1, N+2) {
      double c = max(0.0, dis(X[i], Y[i], X[j], Y[j]) - (R[i] + R[j]));
      cost[i][j] = cost[j][i] = c;
    }
  }
  vector<double> dist(N+2, DBL_MAX);
  bellman_ford(dist, cost, N+2, N);
  cout << setprecision(15) << dist[N+1] << endl;
  return 0;
}



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

A=[]
B = []
for i in range(n):
  a,b = map(int,input().split())
  A.append(a)
  B.append(b)
count = 0  
for i in range(n-2):
  if A[i]==B[i] and A[i+1]==B[i+1] and A[i+2]==B[i+2]:
    print("Yes")
    exit()
print("No")
    

Measured memory_bytes: 62264
# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
#from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10**7)
import math
#from itertools import product, accumulate, combinations, product
#import bisect
#import numpy as np
#from copy import deepcopy
#from collections import deque
from decimal import Decimal

INF = 1 << 50



def run():
    N = int(sysread())
    A = [Decimal(input()) for _ in range(N)]
    M = [[0] * 19 for _ in range(19)]
    #print(A)
    minus = 0
    
    MULT = 10 ** 9
    for i, a in enumerate(A):
        if a == int(a):
            minus += 1
        a *= MULT
        a = int(a)
        
        #print(a)
        f2 = 0
        f5 = 0
        while True:
            if not a % 2:
                f2 += 1
                a = a // 2
            else:
                break
        while True:
            if not a % 5:
                f5 += 1
                a = a // 5
            else:
                break
        A[i] = (min(f2, 18), min(f5, 18))
        M[min(f2, 18)][min(f5, 18)] += 1

        
    #print(A)
    #for m in M:
    #    print(m)
    
    for i in range(18, -1, -1):
        for j in range(18, -1, -1):
            if i > 0:
                M[i-1][j] += M[i][j]
                
    for i in range(18, -1, -1):
        for j in range(18, -1, -1):
            if j > 0:
                M[i][j-1] += M[i][j]

    ans = 0
    for f2, f5 in A:
        ans += M[max(18-f2, 0)][max(18-f5, 0)]
        
    print((ans-minus)//2)
    
    #for m in M:
    #    print(m)
    

if __name__ == "__main__":
    run()

Measured memory_bytes: 33764
n, m, c = map(int, input().split())

ls_b = list(map(int, input().split()))
ls_a = [[int(i) for i in input().split()] for _ in range(n)]

cnt = 0
ls_dot = [0] * n

for j in range(n):
    for k in range(m):
        ls_dot[j] += ls_b[k] * ls_a[j][k]
    if ls_dot[j] > -c:
        cnt += 1

print(cnt)

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

int main() {
    int n;
    cin >> n;
    deque<int> dq;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        if (i % 2 == 0) {
            dq.push_front(a);
        } else {
            dq.push_back(a);
        }
    }
    if (n % 2) {
        for (int i = 0; i < n; i++) {
            cout << dq[i] << " \n"[i == n - 1];
        }
    }else{
        for (int i = n - 1; i >= 0; i--) {
            cout << dq[i] << " \n"[i == 0];
        }
    }
    return 0;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  int N;
  cin >> N;
  multiset<ll, greater<ll> > se;
  rep(i, N) {
    ll a;
    cin >> a;
    se.insert(a);
  }
  int ans = 0;
  while(!se.empty()) {
    ll tmp = *se.begin();
    ll pair = (ll)pow(2, ceil(log2(tmp))) - tmp;
    if(pair == 0) pair = tmp;
    se.erase(se.begin());
    auto itr = se.find(pair);
    if(itr != se.end()) {
      ans++;
      se.erase(itr);
    }
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 9856
using System;
using System.Linq;
public class B{
    public static void Main(){
        int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int r = input[0];
        int d = input[1];
        int x = input[2];
        for (int i=0;i<10;i++){
            x *= r;
            x -= d;
            Console.WriteLine(x);
        }
        
    }
}


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


int main(){
    int H,W;
    int c[10][10];
    int A;
    long long int cost=0;

    cin >> H >> W;
    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            cin >> c[i][j];
        }
    }

    for(int k=0;k<10;k++){
        for(int i=0;i<10;i++){
            for(int j=0;j<10;j++){
                if(c[i][j] > (c[i][k]+c[k][j])) c[i][j] = c[i][k]+c[k][j];
            }
        }
    }

    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cin >> A;
            if(A!=-1){
                cost += c[A][1];
            }
        }
    }

    cout << cost << "\n";

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  int n,k,i,sum=0;
  int x[110];
  scanf("%d%d",&n,&k);
  for(i=0;i<n;i++){
    scanf("%d",&x[i]);
  }
  for(i=0;i<n;i++){
    if(x[i]<k-x[i]){
      sum+=2*x[i];
    }else{
      sum+=2*(k-x[i]);
    }
  }
  printf("%d\n",sum);
  return 0; 
}

 

Measured memory_bytes: 128
#include<stdio.h>
int linearSearch(int *,int,int);
int main(){
  int n,q,b,count=0;
  int A[10000];
  int i;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&b);
    if(0 <= linearSearch(A,b,n))count++;
    }
  printf("%d\n",count);
  return 0;
}
int linearSearch(int *A,int b,int n){
  int i,NOT_FOUND=-1;
  
  for(i=0;i<n;i++){
    if(A[i]==b)return i;
    
  }
  return NOT_FOUND;
}



Measured memory_bytes: 2100
#include<iostream>
using namespace std;
long L,R,ans=2020;
main()
{
	cin>>L>>R;
	for(long l=L;l<L+2020;l++)for(long r=R;r>R-2020;r--)
	{
		if(l<r)ans=min(ans,l%2019*r%2019);
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str[] = br.readLine().split(" ");
        int n = Integer.parseInt(str[0]);
        int m = Integer.parseInt(str[1]);
        int l = Integer.parseInt(str[2]);
        int[][] a = new int[n][m];
        int[][] b = new int[m][l];
        for(int i=0;i<n;i++){
            str = br.readLine().split(" ");
            for(int j=0;j<m;j++){
                a[i][j] = Integer.parseInt(str[j]);
            }
        }
        for(int i=0;i<m;i++){
            str = br.readLine().split(" ");
            for(int j=0;j<l;j++){
                b[i][j] = Integer.parseInt(str[j]);
            }
        }
        long result;
        for(int i=0;i<n;i++){
            for(int j=0;j<l;j++){
                result = 0;
                for(int k=0;k<m;k++){
                    result += a[i][k] * b[k][j];
                }
                if(j<l-1) System.out.print(result+" ");
                else System.out.println(result);
            }
        }
    }
}

Measured memory_bytes: 34960
import sys

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors


n = int(input())
a = make_divisors(n)
#print(a)
ans = sys.maxsize
for x in a:
    y = n // x
    #print(x, y, x+y)
    ans = min(ans, x + y - 2)
print(ans)

Measured memory_bytes: 3268
k, n = map(int, input().split())
a = list(map(int, input().split()))
m = 0
for i in range(n - 1):
    if a[i + 1] - a[i] > m:
        m = a[i + 1] - a[i]
if k + a[0] - a[n - 1] > m:
    m = k + a[0] - a[n - 1]
ans = k - m
print(ans)


Measured memory_bytes: 26444
#include <iostream>
#include <string>
#include <vector> 
#include <algorithm>
#include <cmath>
#include <map>
#include <numeric>
#include <queue>
using namespace std;
typedef long long ll;
int N,A,B,C;
vector<int> v(10);

int dfs(int a,int b,int c,int i){
   if(i==N){ if(a&&b&&c)return abs(A-a)+abs(C-c)+abs(B-b)-30;
            else return 1<<30;}
    int n1=dfs(a+v[i],b,c,i+1)+10;
    int n2=dfs(a,b+v[i],c,i+1)+10;
    int n3=dfs(a,b,c+v[i],i+1)+10;
    int n4=dfs(a,b,c,i+1);
    return min(min(n1,n2),min(n3,n4));
}

int main(){
    cin>>N>>A>>B>>C;
    for(int i=0;i<N;i++)cin>>v[i];
    cout<<dfs(0,0,0,0);
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ld double
#define ull unsigned long long
#define ll long long
#define pii pair <int, int>
#define iiii pair <int, pii >
#define mp make_pair
#define INF 1000000000
#define rep(i, x) for(int (i) = 0; (i) < (x); (i)++)
inline int getint() {
  int x = 0, p = 1; char c = getchar();
  while (c <= 32) c = getchar();
  if (c == 45) p = -p, c = getchar();
  while (c > 32) x = x * 10 + c - 48, c = getchar();
  return x * p;
}
using namespace std;
const int mod = 1e9 + 7;
inline void reduce(int &x) { x += x >> 31 & mod; }
inline int mul(int x, int y) { return 1ll * x * y % mod; }
//ruogu_alter
const int N = 1e6 + 5;
int n, a[N], b[N], id[N];
char s[N];
//
bool cmp(int x, int y) {
  return min(b[x], a[x] + b[y]) > min(b[y], a[y] + b[x]);
}
int main() {
  n = getint();
  int tot = 0;
  rep(i, n) {
    scanf("%s", s); int now = 0, len = strlen(s);
    rep(j, len) {
      if (s[j] == '(') ++now; else --now;
      b[i] = min(b[i], now);
    }
    a[i] = now; tot += a[i];
    id[i] = i;
  }
  if (tot) return !printf("No\n");
  sort(id, id + n, cmp);
  int now = 0;
  rep(i, n) {
    if (now + b[id[i]] < 0) return !printf("No\n");
    now += a[id[i]];
  }
  cout << "Yes\n";
  return 0;
}


Measured memory_bytes: 15376
import java.util.Scanner;

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

		String result = "NG";
		for(int i = 1; k * i <= b; i++) {
			if(k * i >= a) {
				result = "OK";
			}
		}
		System.out.println(result);
	}
}

Measured memory_bytes: 35756
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define F first
#define S second

using namespace std;
const int N = 1e5 + 5 , mod = 1e9 + 7;

int main()
{
    int n; cin >> n;
    if (n == 25)
        return cout << "Christmas" , 0;
    if (n == 24)
        return cout << "Christmas Eve" , 0;
    if (n == 23)
        return cout << "Christmas Eve Eve" , 0;
    if (n == 22)
        return cout << "Christmas Eve Eve Eve" , 0;

}


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

int main() {
	int a,b;
	cin>>a>>b;
	
	if(a<=2*b)cout<<0<<endl;
	else cout<<a-2*b<<endl;
}


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

#define NIL NULL

struct node{
  int d;
  struct node *p;
  struct node *r;
  struct node *l;
};
typedef struct node *NP;

NP root;

void my_insert(NP);
void my_inorder_print(NP);
void my_preorder_print(NP);
NP make_node(int);

int main(){
  int i,n,input;
  char in[7];
  NP z;
  scanf("%d",&n);
  for(i=0; i<n; i++){
    scanf("%s",in);
    if(strcmp(in,"insert")==0){
      scanf("%d",&input);
      //INSERT
      z=make_node(input);
      my_insert(z);
    }
    if(strcmp(in,"print")==0){
      //PRINT
      my_inorder_print(root);
      printf("\n");
      my_preorder_print(root);
      printf("\n");
    }
  }
  return 0;
}

void my_insert(NP z){
  NP x,y;
  y=NIL;
  x=root;
  while(x!=NIL){
    y=x;
    if(z->d<x->d) x=x->l;
    else x=x->r;
  }
  z->p=y;

  if(y==NIL){
    root=z;
  }else if(z->d<y->d){
    y->l=z;
  }else{
    y->r=z;
  }
}

void my_inorder_print(NP p){
  if(p!=NIL){
    my_inorder_print(p->l);
    printf(" %d",p->d);
    my_inorder_print(p->r);
  }
}

void my_preorder_print(NP p){
  if(p!=NIL){
    printf(" %d",p->d);
    my_preorder_print(p->l);
    my_preorder_print(p->r);
  }
}

NP make_node(int key){
  NP p;
  p=(NP)malloc(sizeof(struct node));
  p->d=key;
  p->p=NIL;
  p->r=NIL;
  p->l=NIL;
  return p;
}



Measured memory_bytes: 25164
#include<iostream>

using namespace std;
int main()
{	
	int n,a[100],v;
	cin>>n;
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
	}
	int i,j;
	for (int i = 0; i < n; ++i)
		{
			if(i!=n-1) cout<<a[i]<<" ";
			else cout<<a[i]<<endl;
		}
	for(i=1;i<n;++i)
	{
		v=a[i];
		j=i-1;
		while(j>=0&&a[j]>v)
		{
			a[j+1]=a[j];
			j--;
		}
		a[j+1]=v;
		for (int i = 0; i < n; ++i)
		{
			if(i!=n-1) cout<<a[i]<<" ";
			else cout<<a[i]<<endl;
		}
	}
	return 0;
}


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


int main() {
    int a,b,c;cin >> a >> b >> c;
    int ans;
    if (a == b && b == c){
        ans = 1;
    }else if(a == b || b == c || c == a){
        ans = 2;
    }else{
        ans = 3;
    }
    cout << ans << endl;
    

}       

Measured memory_bytes: 256
use std::cmp::{max, min};
use std::io::{stdin, Read};

#[allow(unused_macros)]
macro_rules! parse {
    ($it: ident ) => {};
    ($it: ident, ) => {};
    ($it: ident, $var:ident : $t:tt $($r:tt)*) => {
        let $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
}

#[allow(unused_macros)]
macro_rules! parse_val {
    ($it: ident, [$t:tt; $len:expr]) => {
        (0..$len).map(|_| parse_val!($it, $t)).collect::<Vec<_>>();
    };
    ($it: ident, ($($t: ty),*)) => {
        ($(parse_val!($it, $t)),*)
    };
    ($it: ident, $t: ty) => {
        $it.next().unwrap().parse::<$t>().unwrap()
    };
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    parse!(it, n: usize, k: usize, q: usize, a: [usize; n]);
    let mut sorteda: Vec<_> = a.clone();
    sorteda.sort();
    let mut cur = sorteda[0];
    let mut ret = std::usize::MAX;
    loop {
        let mut cl = vec![];
        let mut c = vec![];
        for i in 0..n {
            if a[i] < cur {
                if c.len() > 0 {
                    c.sort();
                    cl.push(c);
                    c = vec![];
                }
            } else {
                c.push(a[i]);
            }
        }
        if c.len() > 0 {
            c.sort();
            cl.push(c)
        }

        let mut m = vec![];
        for c in cl.iter_mut() {
            let l = c.len();
            if l < k {
                continue;
            }
            m.append(&mut c[..(l - k + 1)].to_vec());
        }
        m.sort();
        if m.len() < q {
            break;
        }
        ret = min(ret, m[q - 1] - cur);

        if cur == sorteda[n - 1] {
            break;
        }
        cur = sorteda[sorteda.binary_search(&(cur + 1)).unwrap_or_else(|x| x)];
    }
    println!("{}", ret);
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}


Measured memory_bytes: 4352
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    N = int(readline())

    f = [0] * (N+1)
    for x in range(1,100):
        for y in range(1,100):
            for z in range(1,100):
                tmp = x*x + y*y + z*z + x*y + y*z + z*x
                if tmp <= N:
                    f[tmp] += 1
    
    print("\n".join(map(str, f[1:])))


if __name__ == "__main__":
    main()


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

int main(void){
    int S,h,m,s;
    cin >> S;
    h = S/3600;
    m = (S%3600)/60;
    s = (S%3600)%60;
    cout << h;
    cout << ":";
    cout << m;
    cout << ":";
    cout << s;
    cout << endl;
}


Measured memory_bytes: 3100
{-# LANGUAGE UnboxedTuples #-}

import qualified Data.ByteString.Char8 as B
import Data.Char (isSpace)
import Data.List (unfoldr)

readInt = B.readInt . B.dropWhile isSpace
readInts = unfoldr readInt

inf = 10000

a#b = abs (a-b)


solv :: Int -> Int -> Int -> [Int] -> Int
solv a b c ls = go ls (# 0,0,0 #) 0 where
  go [] tp cost = case tp of
    (# la, lb, lc #)
      | la==0 || lb==0 || lc==0 -> inf
      | otherwise -> cost + a#la + b#lb + c#lc
  go (l:ls) tp cost = case tp of
    (# la, lb, lc #) ->
      let forA = go ls (# la+l, lb, lc #) $ if la>0 then cost+10 else cost
          forB = go ls (# la, lb+l, lc #) $ if lb>0 then cost+10 else cost
          forC = go ls (# la, lb, lc+l #) $ if lc>0 then cost+10 else cost
          unuse = go ls (# la,lb,lc #) cost
      in minimum [forA, forB, forC, unuse]

main = do
  [n,a,b,c] <- readInts <$> B.getLine
  ls <- readInts <$> B.getContents
  print $ solv a b c ls


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

const ll INF = 1e17;
const ll MOD = 1e9+7;

int main() {
    // input, ready
    int K,X;
    cin >> K >> X;

    // resolve
    if (500 * K >= X) cout << "Yes" << endl;
    else cout << "No" << endl;

    // output

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int a, n, G[101][101], i, j, k;

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

  for(i=1;i<=n;i++){
    G[i][i] = 0;
  }

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

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

  return 0;
}



Measured memory_bytes: 2104
#include<stdio.h>
#include<string.h>
char s[101];
int main(void){
  	scanf("%s",s);
  int res = 0;
  int n = strlen(s);
  for(int i = 0; i < n; i++){
    if(s[i] != s[n - 1 - i]) res++;
  }
  printf("%d\n",res / 2);
  return 0;
}
      


Measured memory_bytes: 128
N,K = map(int,input().split())
import sys
S = input()

inside = 0
happy = 0

for i in range(N-1):
    if S[i] == S[i+1]:
        happy += 1
    if S[i] == 'R' and S[i+1] ==  'L':
        inside += 1

happy += 2*(min(K,inside))
if K - inside > 0:
  if S[N-1] == 'R':
    happy += 1
print(happy if happy < N else happy-1)



Measured memory_bytes: 3316