akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <math.h>
#include <string>

using namespace std;

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

	int city[51] = {};

	while(M-- > 0){
		int a, b;
		cin >> a >> b;

		city[a - 1]++;
		city[b - 1]++;
	}
	
	for(int i = 0; i < N; ++i){
		cout << city[i] << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x)  x.begin(),x.end()
#define vi vector<int>
#define print(x) for(auto it=x.begin();it!=x.end();it++) cout<<*it<<' '; cout<<'\n';
#define in(x,n) for(int e=0;e<n;e++){int y;cin>>y;x.pb(y);}
#define inl(x,n) for(int e=0;e<n;e++){long long y;cin>>y;x.pb(y);}
#define lower(sl)  transform(sl.begin(), sl.end(), sl.begin(), ::tolower); 
//Available in Snips
#define fi(i, x, y)   for (__typeof(x) i = x; i < y; i ++)
#define fir(i, x, y)  for (__typeof(x) i = x; i > y; i --)
#define fv(x)   for (auto itr = x.begin(); itr != x.end(); itr ++)
#define fvr(x)  for (auto itr = x.end() - 1; itr != x.begin() - 1; itr --)

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//code here
	string s;
    cin >> s;
    for(char x: s){
        if(x=='7') {
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
    return 0;
}


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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplece_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; scanf("%lld", &x);
#define int2(x, y) int x, y; scanf("%lld %lld", &x, &y);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second

//int dxy[5] = {0, 1, 0, -1, 0};
// assign avl ncm dij geo2 kruskal graph uf lca BIT

int n;
string state;

bool solve(int bef, int now)
{
    string ans;
    int en = bef, st = now;
    rep(i, n-1) {
        ans.pb( (now == 1) ? 'S' : 'W' );
        if (now == 1) {
            if (state[i] == 'o') {
                int tmp = now;
                now = bef;
                bef = tmp;
            } else {
                int tmp = now;
                now = -bef;
                bef = tmp;
            }
        } else {
            if (state[i] == 'o') {
                int tmp = now;
                now = -bef;
                bef = tmp;
            } else {
                int tmp = now;
                now = bef;
                bef = tmp;
            }
        }
    }
    ans.pb( (now == 1) ? 'S' : 'W' );
    if (now != en) return false;
        if (now == 1) {
            if (state[state.size()-1] == 'o') {
                if (bef == st) {
                    std::cout << ans << std::endl;
                    return true;
                } else {
                    return false;
                }
            } else {
                if (bef != st) {
                    std::cout << ans << std::endl;
                    return true;
                } else {
                    return false;
                }
            }
        } else {
            if (state[state.size()-1] == 'o') {
                if (bef != st) {
                    std::cout << ans << std::endl;
                    return true;
                } else {
                    return false;
                }
            } else {
                if (bef == st) {
                    std::cout << ans << std::endl;
                    return true;
                } else {
                    return false;
                }
            }
        }
}

signed main()
{
    cin >> n;
    cin >> state;

    if (solve(1, 1)) {
   //     std::cout << 1 << std::endl;
        return 0;
    } else if (solve(1, -1)) {
  //      std::cout << 2 << std::endl;
        return 0;
    } else if (solve(-1, 1)) {
 //       std::cout << 3 << std::endl;
        return 0;
    } else if (solve(-1, -1)) {
//        std::cout << 4 << std::endl;
        return 0;
    } else {
        cout << -1 << endl;
    }

    return 0;
}


Measured memory_bytes: 640
#include <queue>
#include <iostream>
#include <cstring>
#include <vector>
using namespace std;

typedef int F;
const int MAXV = 301;
const int MAXE = MAXV * MAXV;
const F MAXF = 1<<29;

struct MaxFlow {
    F cap[2*MAXE], flow[2*MAXE];
    int V, E, level[MAXV], edge[MAXV];
    int prev[2*MAXE], to[2*MAXE];
    MaxFlow(int n) : E(0), V(n) { memset(edge, -1, sizeof(edge)); }
    void add_edge(int s, int t, F f, F g = 0) {
        flow[E] = 0; cap[E] = f; to[E] = t; prev[E] = edge[s]; edge[s] = E; E++;
        flow[E] = 0; cap[E] = g; to[E] = s; prev[E] = edge[t]; edge[t] = E; E++;
    }
    void make_level(int s) { // bfs
        memset(level, -1, sizeof(level));
        queue<int> q; q.push(s); level[s] = 0;
        while(!q.empty()) {
            int v = q.front(); q.pop();
            for (int e = edge[v]; e != -1; e = prev[e]) {
                if (cap[e] - flow[e] > 0 && level[to[e]] == -1)
                    q.push(to[e]), level[to[e]] = level[v]+1;
            }
        }
    }
    F augment(int s, int t, F f) { // dfs
        if (s == t || f == 0) return f;
        F r = 0;
        for (int e = edge[s]; e != -1; e = prev[e]) {
            if (level[to[e]] > level[s] && cap[e] - flow[e] > 0) {
                F g = augment(to[e], t, min(f - r, cap[e] - flow[e]));
                if (g > 0) flow[e] += g, flow[e^1] -= g, r += g;
                if (r == f) return r;
            }
        }
        return r;
    }
    F max_flow(int s, int t) {
        F f = 1, ret = 0;
        for (; f > 0; ) {
            make_level(s);
            f = augment(s, t, MAXF);
            ret += f;
        }
        return ret;
    }
};

int main() {
    ios::sync_with_stdio(false);
    int x[MAXE], y[MAXE];
    int N,M,a,b;
    cin>>N>>M;
    MaxFlow mf(N);
    for (int i=0; i<M; ++i) {
        cin>>a>>b; a--, b--;
        mf.add_edge(a, b, 1, 1);
        x[i] = a, y[i] = b;
    }
    cin>>a>>b; a--, b--;
    cout<<mf.max_flow(a, b)<<endl;
    vector<int> rev;
    for (int i=0; i<M; ++i) {
        int e = mf.edge[y[i]];
        while(e != -1) {
            if (mf.to[e] == x[i] && mf.flow[e] > 0) rev.push_back(i);
            e = mf.prev[e];
        }
    }
    cout<<rev.size()<<endl;
    for (int i=0; i<rev.size(); ++i) cout<<rev[i]+1<<endl;
}

Measured memory_bytes: 3316
#include <stdio.h>

int main(void) {
    int i, j, k, l, n, cnt;

    while(scanf("%d", &n)!=EOF) {
        cnt=0;
        for (i=0;i<10;i++) {
            for (j=0;j<10;j++) {
                for (k=0;k<10;k++) {
                    for (l=0;l<10;l++) {
                        if (i+j+k+l==n) cnt++;
                    }
                }
            }
        }
        printf("%d\n", cnt);
    }

    return 0;
}



Measured memory_bytes: 2036
// B - Comparison

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

int main() {
	string A, B;
	cin >> A >> B;

	string ans;
	if (A.size() > B.size()) {
		ans = "GREATER";
	} else if (A.size() < B.size()) {
		ans = "LESS";
	} else {
		if (A > B) {
			ans = "GREATER";
		} else if (A < B) {
			ans = "LESS";
		} else {
			ans = "EQUAL";
		}
	}

	cout << ans << endl;

	return 0;
}

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

int nth_bit(int xorr, int k) {
  return (xorr >> k) & 1;
}

int res[200010];
int main() {
  int N;
  cin >> N;
  int A[N];
  int xorr = 0;
  for (int i = 0; i < N; i++ ) {
    cin >> A[i];
    xorr ^= A[i]; 
  }

  for (int k = 0; k < 32; k++) {
    if (nth_bit(xorr ^ A[0], k) != nth_bit(A[0], k)) {
      for (int i = 0; i < N; i++) {
        res[i] += (!nth_bit(A[i], k) << k);
      }  
    } else {
      for (int i = 0; i < N; i++) {
        res[i] += (nth_bit(A[i], k) << k);
      } 
    }
  }
  for (int i = 0; i < N; i++) {
    cout << res[i] << " ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 5196
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll N;
  cin >> N;
  ll ans = N / 3;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3636
N = gets.to_i
S = gets.chomp

def f(len)
  list = Hash.new { |h, k| h[k] = [] }

  0.upto(N - len) do |i|
    str = S[i...i + len]
    list[str] << i
  end

  list.each do |str, points|
    min, max = points.minmax

    return true if max - min >= len
  end

  false
end

if !f(1)
  puts 0
  exit
end

ok = 1
ng = N

while ng - ok > 1
  mid = (ng + ok) / 2

  if f(mid)
    ok = mid
  else
    ng = mid
  end
end

puts ok


Measured memory_bytes: 47356
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>

using lint = long long;

template <class T>
T gcd(T a, T b) {
    while (b > 0) {
        a %= b;
        std::swap(a, b);
    }
    return a;
}

bool solve(int N, std::vector<lint>& A) {
    lint sum = std::accumulate(A.begin(), A.end(), 0LL);

    // Nが偶数の場合、和の偶奇がそのまま勝敗になる
    if (N % 2 == 0) return sum % 2 != 0;

    // Nが奇数の場合も、和が偶数なら絶対勝てる
    if (sum % 2 == 0) return true;

    // 奇数を前に持っていく
    std::sort(A.begin(), A.end(), [](int a, int b) { return a % 2 > b % 2; });
    // 奇数が複数個ある、あるいは唯一の奇数が1(減らせない)なら負け
    if (A[0] == 1 || (A[1] & 1) != 0) return false;

    // そうでなければ、唯一の奇数を減らしてシミュレート
    --A[0];
    int g = accumulate(A.begin(), A.end(), 0LL, gcd<lint>);  // 全体のgcdを取る
    for (auto& a : A) a /= g;
    return !solve(N, A);
}

int main() {
    int N;
    std::cin >> N;
    std::vector<lint> A(N);
    for (auto& a : A) std::cin >> a;

    std::cout << (solve(N, A) ? "First" : "Second") << std::endl;
    return 0;
}


Measured memory_bytes: 1024
import math

a,b = input().split()
c = int(a)
d = int(b)

tax8 = math.floor(c/0.08)
tax10 = int(d / 0.1)
ans = tax10
flag = True

while math.floor(ans * 0.1) == d:
    if math.floor(ans*0.08) == c and math.floor(ans * 0.1) == d:
        print(ans)
        flag = False
        break
    else:
        ans += 1

if flag:
    print(-1)



Measured memory_bytes: 3064
using System;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using Debug = System.Diagnostics.Debug;
using LayoutKind = System.Runtime.InteropServices.LayoutKind;
using StructLayoutAttribute = System.Runtime.InteropServices.StructLayoutAttribute;
using FieldOffsetAttribute = System.Runtime.InteropServices.FieldOffsetAttribute;


static class P
{
    static void Main()
    {
        var abt = Console.ReadLine().Split().Select(int.Parse).ToArray();
        Console.WriteLine((abt[2] / abt[0]) * abt[1]);
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define all(c) c.begin(), c.end()
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
using namespace std;

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


struct op{
	int x,y,a,b;
};

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	int h,w;
	cin >> h >> w;
	int g[h][w];
	rep(i,0,h){
		rep(j,0,w){
			cin >> g[i][j];
		}
	}
	vector<op> v;
	rep(i,0,h){
		rep(j,0,w){
			if(g[i][j]&1){
				if(j == w-1 && i != h-1){ // down
					--g[i][j];
					++g[i+1][j];
					v.push_back({i,j,i+1,j});
				}
				else if(j < w-1){
					--g[i][j];
					++g[i][j+1];
					v.push_back({i,j,i,j+1});
				}
			}
		}
	}
	cout << v.size() << '\n';
	for(op o: v){
		cout << o.x + 1 << ' ' << o.y + 1 << ' ' << o.a + 1 << ' ' << o.b + 1<< '\n';
	}
}


Measured memory_bytes: 5232
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
using i64 = int64_t;
using namespace std;
int main() {
    int N, D;
    cin >> N >> D;
    vector<vector<double>> X(N, vector<double>(D));
    for(int i = 0; i < N; i++) {
        for(int j = 0; j < D; j++) {
            cin >> X[i][j];
        }
    }
    int ans = 0;
    for(int i = 0; i < N; i++) {
        for(int j = i + 1; j < N; j++) {
            double x = 0;
            for(int k = 0; k < D; k++) {
                x += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
            }
            x = sqrt(x);
            if(x == floor(x)) {
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#![allow(unused)]
use proconio::*;
use std::collections::BinaryHeap;

const N: usize = 5e5 as usize + 10;

fn main() {
    input! {t:usize}
    for i in 0..t {
        input! {
        n:usize,
        mut a:[(usize, i64, i64); n],
        }

        let mut sum = 0;
        let mut pos = vec![];
        let mut neg = vec![];
        for (k, l, r) in a {
            sum += if l >= r {
                pos.push((k, r - l));
                r
            } else {
                if k < n {
                    neg.push((n - k, l - r))
                }
                l
            }
        }
        for mut a in vec![pos, neg] {
            a.sort();
            let mut heap = BinaryHeap::new();
            for (k, d) in a {
                heap.push(d);
                if heap.len() > k {
                    heap.pop();
                }
            }
            for v in heap {
                sum += -v;
            }
        }
        println!("{}", sum);
    }
}


Measured memory_bytes: 13692
//AtCoder ABC107
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
int main() {
#if LOCAL&0
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    ll N,K; cin>>N>>K;
    vector<ll> xn(N);
    vector<ll> lx,rx;
    bool zero_flag=false;
    for(auto& x:xn){
        cin>>x;
        if(x==0)zero_flag=true;
        else if(x>0) rx.push_back(abs(x));
        else if(x<0) lx.push_back(abs(x));
    }
    rx.push_back(0);
    lx.push_back(0);
    sort(rx.begin(),rx.end());
    sort(lx.begin(),lx.end());
    ll ans=INT64_MAX;
    if (zero_flag) --K;
    for(ll r=0;r<=K;++r){
        ll l=K-r;
        if(r >= rx.size()) continue;
        if(l >= lx.size()) continue;
        ll cur=2*min(rx[r],lx[l])+max(rx[r],lx[l]);
        ans=min(cur,ans);
    }
    cout<<ans<<endl;
    return 0;
}

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

//定数
const long long MOD1=1000000007;
const long long MOD2=998244353;
const long double PI=3.1415926535897932;
const long long MAXLL=9223372036854775807;
const long long INF=2305843009213693951;
const long long dx[]={0,1,0,-1,1,-1,1,-1};
const long long dy[]={1,0,-1,0,1,1,-1,-1};

//型名省略
#define ll long long
#define ull unsigned long long
#define ld long double
#define uld unsigned long double
#define pll pair<long long,long long>
#define tll(n) array<long long,(int)(n)>
#define pcc pair<char,char>
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vp vector<pair<long long,long long>>
#define vt(n) vector<array<long long,(int)(n)>>
#define umap unordered_map
#define uset unordered_set
#define Lqueue priority_queue<long long>
#define Squeue priority_queue<long long,vector<long long>,greater<long long>>
#define Fi first
#define Se second
#define mp make_pair
#define eb emplace_back

//マクロ
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rbf(a,x) for(auto& a:x)
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s);i<(long long)(n);i++)
#define bitrep(i,s,n) for(long long i=(s);i<(1LL<<(n));i++)
#define Maxe(x) *max_element((x).begin(),(x).end())
#define Mine(x) *min_element((x).begin(),(x).end())
#define Size(x) ((long long)(x).size())
#define lin(s) getline(cin,(s))
#define Ssort(v) sort((v).begin(),(v).end(),[](auto &left,auto &right){return left.second<right.second;})

//Yes,No
void Yes(bool a){cout<<(a?"Yes":"No")<<endl;}
//YES.NO
void YES(bool a){cout<<(a?"YES":"NO")<<endl;}

//MAX,MIN
template<class T,class U> auto max(T a,U b){return a>b?a:b;}
template<class T,class U> auto min(T a,U b){return a<b?a:b;}

//最大公約数,最小公倍数
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a,long long b){return a/gcd(a,b)*b;}

//累乗
template<typename t>
constexpr t mypow(t a,long long b){
    if(b==0)return 1;
    if(a==0)return 0;
    t x=1;
    while(b>0){
        if(b&1LL)x*=a;
        a*=a;
        b>>=1LL;
        }
    return x;
}
#define pow mypow

//chmin,chmax
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;}

//組み合わせ O(r)
template<typename t>
constexpr t nCr(t n,long long r){
    if(r==0)return 1;
    if(n==0)return 0;
    if(n<r)return 0;
    t x=1;
    for(long long i=1;i<=r;i++){
        x*=n-i+1;
        x/=i;
    }
    return x;
}

//main関数
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll x;
    cin>>x;
    bool c;
    if(x>=30)c=true;
    else c=false;
    Yes(c);
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int main(){
  vector<double> ans (1001);
  double s = 0;
  for(int i = 1; i < 1001; i++){
    s += i;
    ans[i] = s / i;
  }
  int N, K; cin >> N >> K;
  vector<double> p (N);
  for(int i = 0; i < N; i++){
    int v; cin >> v;
    p[i] = ans[v];
  }
  double sum = 0;
  for(int i = 0; i < K; i++) sum+=p[i];
  double res = sum;
  for(int i = 1; i <= N-K; i++){
    sum -= p[i - 1];
    sum += p[i + K - 1];
    res = max(res, sum);
  }
  cout << setprecision(10) << res << endl;
}


Measured memory_bytes: 1792
#include "stdio.h"

int main(int argc, char const *argv[]) {
  int A[5],a[5];
  for (size_t i = 0; i < 5; i++) {
    scanf("%d", &a[i]);
  }
  for (size_t i = 0; i < 5; i++) {
    if (a[i]%10==0) {A[i]=a[i];}else{A[i]=a[i]+10-(a[i]%10);}
  }
  int max=0;
  int flag=0;
  for (size_t i = 0; i < 5; i++) {
    if (max<=A[i]-a[i]) {
      max=A[i]-a[i];
      flag=i;
    }
  }
  int ans=0;
  for (size_t i = 0; i < 5; i++) {
    ans=ans+A[i];
  }
  ans=ans-A[flag]+a[flag];
  printf("%d", ans);
  return 0;
}


Measured memory_bytes: 128
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
res = 0
for i in range(N):
    tmp = C
    for i, a in enumerate(list(map(int, input().split()))):
        tmp += a * B[i]
    if tmp > 0:
        res += 1
print(res)


Measured memory_bytes: 3060
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

use std::collections::BTreeMap;

fn main() {
    let n: usize = read();
    let a: Vec<i32> = read_vec();

    let mut map: BTreeMap<i32, u32> = BTreeMap::new();

    let mut ans = 0;

    for i in 0..n {
        ans += *map.get(&(i as i32 - a[i])).unwrap_or(&0) as u64;
        let tmp = *map.get(&(i as i32 + a[i])).unwrap_or(&0);
        map.insert(i as i32 + a[i], tmp + 1);
    }

    println!("{}", ans);
}


Measured memory_bytes: 6912
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
static const int MAX = 200000;

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if (a + b == c || b + c == a || c + a == b) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin >> s;
  long sum=0;
  long litsum=0;
  for(int i=0;i<s.length();i++){
    if(s[i]=='A')litsum+=1;
    else if(s[i]=='B'){
      if(i==s.length()-1)break;
      else if(s[i+1]=='C'){
        sum+=litsum;
      }
      else if(s[i+1]=='A'){
        litsum=0;
      }
      else litsum=0;
    }
    else if(s[i]=='C'){
      if(i==0)continue;
      else if(s[i-1]=='B')continue;
      else litsum=0;
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 640
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type contest struct {
	in  io.Reader
	out io.Writer
}

func (con *contest) Scan(a ...interface{}) (int, error) {
	return fmt.Fscan(con.in, a...)
}
func (con *contest) Scanln(a ...interface{}) (int, error) {
	return fmt.Fscanln(con.in, a...)
}
func (con *contest) Scanf(f string, a ...interface{}) (int, error) {
	return fmt.Fscanf(con.in, f, a...)
}
func (con *contest) Print(a ...interface{}) (int, error) {
	return fmt.Fprint(con.out, a...)
}
func (con *contest) Println(a ...interface{}) (int, error) {
	return fmt.Fprintln(con.out, a...)
}
func (con *contest) Printf(f string, a ...interface{}) (int, error) {
	return fmt.Fprintf(con.out, f, a...)
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	con := &contest{in: in, out: out}
	con.main()
}

func (con *contest) main() error {
	var K, S int
	con.Scan(&K, &S)
	if K > S {
		K = S
	}
	C := 0
	for X := 0; X <= K; X++ {
		for Y := 0; Y <= S-X && Y <= K; Y++ {
			if S-X-Y <= K {
				C++
			}
		}
	}
	con.Println(C)
	return nil
}


Measured memory_bytes: 640
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
    int m1, d1, m2, d2;
    cin >> m1 >> d1 >> m2 >> d2;

    int ans;
    if(m1 != m2) ans = 1;
    else ans = 0;

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

using ll = long long int;

struct entry {
  ll price;
  ll count;

  bool operator<(const entry &a) const {
    return price < a.price;
  }
};

// ll a[100000 + 1];
// ll b[100000 + 1];

vector<entry> hoge;

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

  for (int i = 0; i < n; i++) {
    entry e;
    cin >> e.price >> e.count;
    hoge.push_back(e);
  }

  sort(hoge.begin(), hoge.end());

  ll money = 0;
  int index = 0;
  while (m > 0) {
    if (m < hoge[index].count) {
      money += m * hoge[index].price;
      m = 0;
    } else {
      money += hoge[index].count * hoge[index].price;
      m -= hoge[index].count;
    }
    ++index;
  }

  cout << money << endl;

  return 0;
}


Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
#define int long long int
mt19937 rng(std::chrono::duration_cast<std::chrono::nanoseconds>(chrono::high_resolution_clock::now().time_since_epoch()).count());
#define mp make_pair
#define pb push_back
#define F first
#define S second
const int N=400015;
#define M 1000000007
#define double long double
#define BINF 100000000000000
#define init(arr,val) memset(arr,val,sizeof(arr))
#define MAXN 15000001
#define deb(x) cout << #x << " " << x << "\n";
const int LG = 22;



#undef int
int main() {
#define int long long int
ios_base::sync_with_stdio(false); 
cin.tie(0); 
cout.tie(0);


	int n, k;
	cin >> n >> k;
	int a[n];
	for(int i = 0; i < n; i++)
		cin >> a[i];
	sort(a, a + n);
	k = min(k, n);
	int ans = 0;
	int id = n - 1;
	while(k > 0 and id >= 0)
		k--, id--;


	for(int i = 0; i <= id; i++)
		ans += a[i];
	cout << ans << endl;
	
 
return 0;
}



Measured memory_bytes: 1792
x, y = map(int, input().split())
if (x + y)%3 != 0:
    print(0)
else:
    k = (x + y)//3
    if k <= x <= 2*k:
        MOD = 10**9 + 7
        fac = [0]*(k + 1)
        finv = [0]*(k + 1)
        inv = [0]*(k + 1)
        fac[0] = 1; fac[1] = 1; finv[0] =1; finv[1] = 1; inv[1] = 1
        for i in range(2, k + 1):
            fac[i] = fac[i - 1] * i % MOD
            inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
            finv[i] = finv[i - 1] * inv[i] % MOD
        
        i = x - k
        print(fac[k] * (finv[i] * finv[k - i] % MOD) % MOD)
    else:
        print(0)

Measured memory_bytes: 82072
#include<stdio.h>
#include<stack>
#include<queue>
#include<string.h>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
using namespace std;
int main()
{
	int n;
	scanf("%d",&n);
	int zuo=0;
	int bushu=0;
	int you=0;
	int f=1;
	int a,b,c;
	for(int i=0;i<n;i++)
	{
		scanf("%d %d %d",&a,&b,&c);
		if(f==0)
		continue;
		int g,h;
		g=abs(b-zuo);
		h=abs(c-you);
		bushu=a-bushu;
		if(b==zuo&&c==you&&bushu%2!=0)
	    {
		   f=0;
		}
		else if((g+h)>bushu)
		{
		   f=0;
	    }
		else if(bushu%2==0&&(g+h)%2!=0)
		{
		   f=0;
		}
		else if(bushu%2!=0&&(g+h)%2==0)
		{
			f=0;
		}
		else
		{
		   zuo=b;
		   you=c;
		   bushu=a;
		}
	}
	if(f==0)
	printf("No\n");
	else if(f==1)
	printf("Yes\n");
	return 0;
}

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

int main(){
	int L, R, d;
	cin >> L >> R >> d;
	int ans = 0;
	for(int i = L; i <= R; i++){
		if(i%d==0) ans++;
	}
	cout << ans << endl;

}










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

string to_string(string s) {
	return '"' + s + '"';
}

string to_string(bool b) {
	return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
	return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
	bool first = true;
	string res = "{";
	for (const auto &x : v) {
		if (!first) {
			res += ", ";
		}
		first = false;
		res += to_string(x);
	}
	res += "}";
	return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
	cerr << " " << to_string(H);
	debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

void test_case() {
	string s;
	cin >> s;
	int diff = 1e3;
	for (int i = 0; i + 2 < s.size(); ++i) {
		string t = s.substr(i, 3);
		diff = min(diff, abs(753 - stoi(t)));
	}
	cout << diff << "\n";
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	test_case();
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b)
{
    if (a % b == 0)
        return b;
    else
        return gcd(b, a % b);
}
ll lcn(ll a, ll b)
{
    return a * b / gcd(a, b);
}
int main()
{
    ll a, b, c, d, n1, n2;
    cin >> a >> b >> c >> d;
    n1 = b - (b / c + b / d - b / lcn(c, d));
    n2 = a - 1 - ((a - 1) / c + (a - 1) / d - (a - 1) / lcn(c, d));
    cout << n1 - n2;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
using namespace std;
using P=pair<int,int>;
using ll=long long;
int main(){
    int n,k;
    cin>>n>>k;
    vector<P> dt(n);
    for(int i=0;i<n;i++){
        cin>>dt[i].second>>dt[i].first;
        dt[i].second--;
    }
    sort(dt.begin(),dt.end(),greater<>());
    ll ret=0,each=0,kind=0;
    vector<bool> used(n,false);
    stack<int> p;
    queue<int> q;
    for(int i=0;i<k;i++){
        if(used[dt[i].second])p.push(i);
        else {
            used[dt[i].second]=true;
            kind++;
        }
        each+=dt[i].first;
    }
    for(int i=k;i<n;i++){
        if(used[dt[i].second]==false){
            q.push(i);
            used[dt[i].second]=true;
        }
    }
    ret=each+kind*kind;
    while(!p.empty()&&!q.empty()){
        int pp=p.top(),qq=q.front();
        p.pop();
        q.pop();
        each-=dt[pp].first;
        each+=dt[qq].first;
        kind++;
        ret=max(ret,each+kind*kind);
    }
    cout<<ret<<endl;
}

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

int main() {
    int n;
    bool spaceFlag = false;
    while (cin >> n) {
        if (spaceFlag) {
            cout << endl;
        } else {
            spaceFlag = true;
        }
        int digit[5];
        for (int i = 0; i < 5; i++) {
            digit[i] = (n % (int) pow(10, i + 1)) / (int) pow(10, i);
        }
        char line[8][6] = {};
        for (int i = 0; i < 5; i++) {
            line[0][i] = (digit[4 - i] < 5) ? '*' : ' ';
            line[1][i] = (digit[4 - i] < 5) ? ' ' : '*';
            line[2][i] = '=';
            line[3][i] = (digit[4 - i] % 5 == 0) ? ' ' : '*';
            line[4][i] = (digit[4 - i] % 5 == 1) ? ' ' : '*';
            line[5][i] = (digit[4 - i] % 5 == 2) ? ' ' : '*';
            line[6][i] = (digit[4 - i] % 5 == 3) ? ' ' : '*';
            line[7][i] = (digit[4 - i] % 5 == 4) ? ' ' : '*';
        }
        for (int i = 0; i < 8; i++) {
            cout << line[i] << endl;
        }
    }
}

Measured memory_bytes: 876
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
using namespace std;

const int MOD = (int)1e9 + 7;
int add(int x, int y)
{
	x += y;
	if (x >= MOD) return x - MOD;
	return x;
}

const int N = 43;
const int M = (1 << 17) + 10;
int n, x, y, z;
int dp[N][M];

int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%d%d%d%d", &n, &x, &y, &z);
	int ansMask = (1 << (z - 1)) + (1 << (y + z - 1)) + (1 << (x + y + z - 1));
	int m = 1 << (x + y + z);
	dp[0][0] = 1;
	for (int i = 0; i < n; i++)
		for (int mask = 0; mask <= m; mask++)
		{
			if (dp[i][mask] == 0) continue;
			for (int p = 1; p <= 10; p++)
			{
				if (mask == m)
				{
					dp[i + 1][m] = add(dp[i + 1][m], dp[i][m]);
					continue;
				}
				int nmask = ((mask << p) | (1 << (p - 1))) & (m - 1);
				if ((nmask & ansMask) == ansMask) nmask = m;
				dp[i + 1][nmask] = add(dp[i + 1][nmask], dp[i][mask]);
			}
		}
	printf("%d\n", dp[n][m]);

	return 0;
}

Measured memory_bytes: 18944
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] h = new int[n];
        for(int i = 0; i < n; i++) {
            h[i] = sc.nextInt();
        }
        int count = 0;
        while(!isAllZero(h)) {
            int l = 0;
            int r = 1;
            while(l < n && h[l] == 0) l++;
            r = l + 1;
            while(r < n && h[r] != 0) r++;
            water(l, r, h);
            count++;
        }
        System.out.println(count);
    }
    private static boolean isAllZero(int[] h) {
        for(int i = 0; i < h.length; i++) {
            if(h[i] != 0) return false;
        }
        return true;
    }
    private static void water(int l, int r, int[] h) {
        while(l < h.length && l < r) {
            h[l]--;
            l++;
        }
    }
}


Measured memory_bytes: 23764
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

h,w = iim()
l = []
l.append(['.']*(w+2))
for _ in range(h):
    l.append(['.']+list(input())+['.'])
l.append(['.']*(w+2))

flag = True
for i in range(1,h+1,):
    for j in range(1,w+1):
        if l[i][j] == '#':
            tmp = [l[i-1][j],l[i+1][j],l[i][j-1],l[i][j+1]]
            if '#' not in tmp:
                flag = False
print('Yes' if flag else 'No')

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

int main()
{
    string s;
    cin >> s;
    int ans = 0;
    for(int i=0;i<4;i++){
        if(s[i] == '+'){
            ans++;
        }
        else{
            ans--;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
  ll n;
  cin >> n;
  ll a,b;
  rep(i,n){
    if(n % i == 0){
      a = i;
      b = n/i;
    }
  }
  //cout << a << b << endl;
  string A;
  string B;
  A = to_string(a);
  B = to_string(b);
  cout << max(A.size(),B.size()) << endl;
  return 0;
}


Measured memory_bytes: 256
k = gets.to_i

arr = [*1..9]

keta = 1
start_idx = 0
end_idx = arr.size - 1
while keta < 11
  tmp = []
  start_idx.upto end_idx do |i|
    a = arr[i]
    if a % 10 == 0
      tmp << (a.to_s + '0').to_i
      tmp << (a.to_s + '1').to_i
      next
    end

    if a % 10 == 9
      tmp << (a.to_s + '8').to_i
      tmp << (a.to_s + '9').to_i
      next
    end

    p = a % 10
    tmp << (a.to_s + (p - 1).to_s).to_i
    tmp << (a.to_s + p.to_s).to_i
    tmp << (a.to_s + (p + 1).to_s).to_i
  end

  keta += 1
  arr += tmp
  start_idx = end_idx + 1
  end_idx = arr.size - 1
end

p arr[k - 1]


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

int main(){
    int n;
    cin >> n;
    ll sum_a = 0;
    ll sum_b = 0;
    vector<ll> a(n),b(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
        sum_a += a[i];
    }
    for(int i = 0; i < n; i++) {
        cin >> b[i];
        sum_b += b[i];
    }

    if(sum_b < sum_a){
        cout << "No" << endl;
    }
    else{
        ll cnt = sum_b - sum_a;
        ll cnt_a = 0, cnt_b = 0;
        for(int i = 0; i < n; i++){
            if(a[i] > b[i]){
                cnt_b += a[i]-b[i];
            }
            else if(a[i] < b[i]){
                if((b[i]-a[i])%2 == 0){
                    cnt_a += (b[i] - a[i])/2;
                }
                else{
                    cnt_a += (b[i]-a[i])/2 + 1;
                    cnt_b++;
                }
            }
        }
        if(2*(cnt-cnt_a) == cnt - cnt_b && cnt>=cnt_a && cnt >= cnt_b) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

Measured memory_bytes: 384
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
constexpr ll INF = 1e18;

int main(void) {
    ll A, B, N;
    cin >> A >> B >> N;
    ll x = (B-1 <= N) ? (B-1) : N;
    cout << ((A*x)/B) - (A*(x/B)) << endl;
    return 0;
}



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

using namespace std;

const int MAXN = 100005;

int n, sol;
int a[MAXN], p[MAXN];

int main () {
    cin >> n;
    for (int i=0; i<n; i++) {
        cin >> a[i];
        p[i] = a[i];
    }
    sort(p, p + n);
    for (int i=0; i<n; i++) {
        a[i] = lower_bound(p, p + n, a[i]) - p;
        if (a[i] % 2 != i % 2) sol++;
    }
    cout << sol / 2;
    return 0;
}


Measured memory_bytes: 1024
import bisect

n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
ans = 0
for b in B:
    ans += bisect.bisect_left(A,b) * (len(C) - bisect.bisect(C,b))

print(ans)

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

int main ()
{
	int n;
	long a ,b;
	cin >> n >> a >> b;
	if (n <= 0) cout << 0 <<endl;
	else if (n == 1)
	{
		if (a == b && a > 0 && b > 0) cout << 1 << endl;
		else cout << 0 << endl;
	}
	else 
	{
		if (a > 0 && b > 0)
		{
			if (a > b) cout << 0 << endl;
			else if (a == b) cout << 1 << endl;
			else 
			{
				long count = (n - 2) * (b - a) + 1;
				cout << count << endl; 
			}
		}
		else cout << 0 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
	// your code goes here
	ll n;
	cin>>n;
  ll cnt=0;
  for(ll i=1;i<n;i++)
  {
    cnt+=(n-1)/i;
  }
  cout<<cnt<<"\n";
  return 0;
}

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

const int inf = 1000000000000000LL;

int dp[5432];

signed main() {
	int n, a, b;
	cin >> n >> a >> b;
	vector<int> v;
	rep(i, n) {
		int p;
		cin >> p;
		dp[i] = inf;
		int count = 0;
		for(int j = i - 1; j >= 0; j--) {
			if(v[j] < p) {
				dp[i] = min(dp[i], dp[j] + count * a + (i - j - 1 - count) * b);
			}
			if(v[j] > p) {
				count++;
			}
		}
		if(count == i) {
			dp[i] = min(dp[i], count * a);
		}
		v.push_back(p);
	}
	int ans = inf;
	int ma = 0;
	for(int i = n - 1; i >= 0; i--) {
		if(ma < v[i]) {
			ans = min(ans, dp[i] + (n - 1 - i) * b);
		}
		ma = max(ma, v[i]);
	}
	cout << ans << endl;
}

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

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

    bitset<26> bs(0);
    for (char c : s) bs.set((c - 'a'));

    for (auto i = 0; i < bs.size(); i++) {
        if(!bs.test(i)) {
            cout << (char)('a' + i) << endl;
            return 0;
        }
    }
    cout << "None" << endl;
    return 0;
}

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

using namespace std;

int dp[88][333];

int main() {
  int T;
  cin >> T;
  while(T--) {
    int L;
    cin >> L;
    vector<int> E(L);
    for(int i = 0; i < L; ++i) cin >> E[i];
    
    memset(dp, 0, sizeof(dp));
    dp[0][0] = E[0];
    for(int i = 1; i < L; ++i) {
      for(int j = 0; j < 333; ++j) {
	dp[i][dp[i-1][j]] = max(dp[i][dp[i-1][j]], E[i]);
	if(dp[i-1][j] > 0) {
	  dp[i][dp[i-1][j]-1] = max(dp[i][dp[i-1][j]-1], j+E[i]);
	}
      }
    }
    int ans = *max_element(dp[L-1], dp[L]);
    cout << ans << endl;
  }
  return 0;
}



Measured memory_bytes: 3104
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	static int count = 0;

	public static void main(String[] args) throws IOException {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int[][] mat = new int[n+1][n+1];

		// 初回訪問リスト
		int[] d = new int[n+1];
		Arrays.fill(d, -1);

		// 訪問完了リスト
		int[] f = new int[n+1];
		Arrays.fill(f, -1);

		for (int i = 0; i < n; i++) {
			int u = sc.nextInt();			// 番号
			int k = sc.nextInt();			// uの出次数
			for (int j = 0; j < k; j++) {
				int v = sc.nextInt();
				mat[u][v] = 1;
			}
		}

		// 深さ優先探索（再帰）
		for (int index = 1; index <= n; index++) {
			dfs(mat, d, f, index);
		}

		for (int i = 1; i <= n; i++) {
			System.out.println(i + " " + d[i] + " " + f[i]);
		}
	}
	public static void dfs(int[][] mat, int[] d, int[] f, int index) {
		int from = index;
		if (d[from] != -1) {
			return;
		}
		d[from] = ++count;

		for (int to = 1; to < mat[from].length; to++) {
			if (mat[from][to] == 1 && d[to] == -1) {
				dfs(mat, d, f, to);
			}
		}
		f[from] = ++count;
	}

}




Measured memory_bytes: 28416
/// // // // // // // // // ///
// Author : Kh@ntil S@nghani //
/// // // // // // // // // ///

#include <bits/stdc++.h>

using namespace std;
#define pb push_back
#define ll long long int
#define ld long double
#define ss second
#define ff first
#define inf LLONG_MAX
#define con continue
#define all(x)  x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define M 1000000007
#define endl '\n'
// if vector isn't soted then it will remove consecutive same elements
#define make_unique(vec) vec.erase(unique(all(vec)), vec.end())
template<class T> ostream& operator<<(ostream& cout,vector<T> V){cout<<"[ ";for(auto v:V)cout<<v<<' ';return cout<<']';}
template <typename T>ostream& operator << (ostream& out, const set <T> &N_A) {out << "{ "; for(const auto &i: N_A) out << i << ", "; return out << "}" << endl;}
template <typename T, typename G>ostream& operator << (ostream& out, const map <T, G> &N_A) {out << "< "; for(const auto &i: N_A) out << i << ", "; return out << ">" << endl;}
template<typename T> inline istream &operator>>(istream &in,vector<T> &N_A){for(auto &x:N_A)in >> x;return in;}
#define MAXN   10000001 

ll n;
string s;
ll dp[505][505];

ll rec(ll l,ll r)
{
	if(l>r) return 0;
	if(l<0 or r>=n) return 0;
	if(l==r) return 1;
	if(dp[l][r]!=-1) return dp[l][r];
	ll ans=1+rec(l+1,r);
	for(ll i=l+1;i<=r;i++)
	{
		if(s[i]==s[l]) ans=min(ans,rec(l+1,i-1)+rec(i,r));
	}
	return dp[l][r]=ans;
}

int main() {
	#ifndef ONLINE_JUDGE
	 freopen("input.txt","r",stdin);
	 freopen("output.txt","w",stdout);
	#endif
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	ll _;
	_=1;
	// cin>>_;

	while(_--) 	
	{
		// cout<<fixed<<setprecision(9)<<y<<" "<<x<<endl;
		// cout<<_<<endl;
		ll n;
		cin>>n;
		for(ll i=0;i<n;i++)
		{
			cout<<"ACL";
		}
	}
	return 0;
}




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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 (a>b) { a=b; return 1; } return 0; }

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,x,d; cin>>n>>x>>d;
    if (d==0){
        if (x!=0) cout<<n+1<<endl;
        if (x==0) cout<<1<<endl;
        return 0;
    }else if(d<0){
        d = -d;
        x = -x;
    }
    unordered_map<ll,int> Map;
    vector<vector<pll> > rs;
    int idx=0;
    FOR(i,0,n){
        ll X = x*i;
        ll m = X%d;
        ll os = X/d;
        if (!Map.count(m)){
            rs.pb(vector<pll>());
            Map[m] = idx++;
        }
        ll L = (ll)(i-1)*i/2 + os;
        ll R = (2*n-i-1)*i/2 + os;
        rs[Map[m]].emplace_back(L,R);
    }
    ll ans=0;
    for(auto r:rs){
        sort(all(r));
        ll now = r[0].fi;
        for(auto e:r){
            if (now>e.se) continue;
            if (now>=e.fi){
                ans+=e.se-now+1;
            }else{
                ans+=e.se-e.fi+1;
            }
            now = e.se+1;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 20724
A,B,C = map(int,input().split())
A,B,C = A-min(A,B,C),B-min(A,B,C),C-min(A,B,C)

X = max(A,B,C)

ans = (3*X)-(A+B+C)
if ans%2 == 1:
  ans += 3

print(ans//2)


Measured memory_bytes: 2940
#include <iostream>
#include <cstdio>

using namespace std;
typedef long long ll;
ll N, b = 0, a = 0, ans = 0;

int main() {
	scanf("%lld", &N);
	for(int i=0;i<N;i++) {
		scanf("%lld", &a);
		ans += (b + a) >> 1;
		if(b == 1) a = a ? (b + a) % 2 : 0;
		else a %= 2;
		b = a;
	}
	printf("%lld\n", ans);
	return 0;
}


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

int main(){
  int A, B;
  cin >> A >> B;

  int ans[3];
  ans[0] = A+B;
  ans[1] = A-B;
  ans[2] = A*B;

  sort(ans, ans+3);

  cout << ans[2] << endl;

  return 0;
}

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

#define ll long long
#define pb push_back
#define debug1(x) cerr << #x << " = " << x << '\n';
#define debug2(x, y) cerr << #x << " = " << x << "   " << #y << " = " << y << "\n";
#define _ ios_base::sync_with_stdio(0);cin.tie(NULL);

void solve() {
    int x, y;
    cin >> x >> y;
    if(y%2 == 0) {
        if(y >= 2*x && y <= 4*x) {
            cout << "Yes\n";
        }
        else
            cout << "No\n";
    }
    else{
        cout << "No\n";
    }
}

int main() {_
    int t = 1;
    //cin >> t;
    // Please remember to uncomment for taking test cases
    for(int i = 1; i<=t; i++) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3688
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
class Main{
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(br.readLine());
    while(n > 0){
      n -= 1000;
    }
    System.out.println(-n);
  }
}


Measured memory_bytes: 32596
from sys import stdin
x, n = map(int, stdin.readline().rstrip().split())
if n ==0:
    print(x)
else:
    data = list(map(int, stdin.readline().rstrip().split()))

    data_sorted = sorted(data)

    abs_min = 100000000
    res = data_sorted[0]-1
    for i in range(data_sorted[0]-1, data_sorted[-1]+2):
        if (i in data_sorted) == False and abs_min > abs(i-x):
            abs_min = abs(i-x)
            res = i
    print(res)

Measured memory_bytes: 9204
// All Heil Fire Lord Zuko

#include <bits/stdc++.h>
using namespace std;

#define F first
#define S second
#define PB push_back
#define debug(x) cerr << #x << " = " << x << endl

#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()

typedef long long ll;
typedef long double ld;

const int N = 2 * 100 * 1000 + 19;

int32_t main() {
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int a, b;
    cin >> a >> b;
    if ((a + b) % 2)
        cout << "IMPOSSIBLE";
    else
        cout << (a + b) / 2;
    return 0;
}


Measured memory_bytes: 256