akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <deque>
#include <cmath>
#include <map>
#include <set>
#include <unordered_set>
#include <algorithm>
#include "iomanip"
#include <cstdio>
#include <cstring>
#include <set>
#include <vector>
#include <fstream>
#include <algorithm>
#include <queue>
#include <cassert>
#include <stack>

using namespace std;


void print(vector<int> &b) {
    for (auto i : b) {
        cout << i << " ";
    }
}


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

    int n, count = 0;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        if (to_string(i).size() % 2 != 0){
            count++;
        }
    }
    cout << count;
    return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const long long INF = 1LL<<60;
const long long MOD = 1e9 + 7;

vector<vector<char>> grid(1010, vector<char>(1010));
vector<vector<int>> path(1010, vector<int>(1010, 0));

// 数え上げ問題
// DP 初期化: テーブル全体を 00 に初期化する
// DP 初期条件: スタートノードを 11 とする

// マス (i+1,j)(i+1,j) が空マスならば、dp[i+1][j]dp[i+1][j] += dp[i][j]dp[i][j]
// マス (i,j+1)(i,j+1) が空マスならば、dp[i][j+1]dp[i][j+1] += dp[i][j]dp[i][j]

int main(){
    int H, W;
    cin >> H >> W;
    
    for (int i = 0; i < H; i++){
        for (int j = 0; j < W; j++) cin >> grid[i][j];
    }
    
    path[0][0] = 1;
    
    for (int i = 0; i < H; i++){
        if (grid[i+1][0] == '#') continue;
        else path[i+1][0] = path[i][0];
    }
    
    for (int j = 0; j < W; j++){
        if (grid[0][j+1] == '#') continue;
        else path[0][j+1] = path[0][j];
    }
    
    for (int i = 0; i < H; i++){
        for (int j = 0; j < W; j++){
            
            if (grid[i+1][j+1] == '#') continue;
            
            path[i+1][j+1] = (path[i+1][j] + path[i][j+1]) % MOD;
        }
    }
    
    cout << path[H-1][W-1] << endl;
    
}

Measured memory_bytes: 7296
#include <bits/stdc++.h>
#define ll long long
#define fort(i,n) for (int i = 1; i <= n; ++i)
#define pi pair<int,int>
#define vi vector<int>
#define pb push_back
#define sz size()
#define er erase
#define fr first
#define sc second
#define rc(x) return cout << x, 0
using namespace std;

ll h,w,v[405][405],ans,a,b;
char c[405][405];

void go(int i, int j)
{
    if (v[i][j]) return;
    v[i][j]=1;
    if (c[i][j]=='#') ++a;
    else ++b;
    if (i>1&&c[i-1][j]!=c[i][j]) go(i-1,j);
    if (j>1&&c[i][j-1]!=c[i][j]) go(i,j-1);
    if (i<h&&c[i+1][j]!=c[i][j]) go(i+1,j);
    if (j<w&&c[i][j+1]!=c[i][j]) go(i,j+1);
}

int32_t main()
{
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin >> h >> w;
    fort (i,h)
        fort (j,w)
            cin >> c[i][j];
    fort (i,h)
        fort (j,w)
        {
            a=0,b=0;
            go(i,j);
            ans+=a*b;
        }
    cout << ans;
}


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

#define ll long long
#define ld long double
#define debug(x) \
	//    (cout << #x << ": " << (x) << endl)
#define eb emplace_back
#define fi first
#define se second

using namespace std;

const int nm = 200002;

int n;
pair<ll, bool> a[2 * nm];

pair<ll, ll> get(int k) {
	int o = 0, c = 0, cur = 0;
	ll x1 = -1, x2 = -1;
	for (int i = 1; i <= 2 * n; ++i) {
		if (!a[i].se) {
			o++;
			cur++;
		}
		if (o >= k && c < k && cur > 0) {
			if (x1 == -1) {
				x1 = a[i].fi;
			}
			x2 = a[i].fi;
		}
		if (a[i].se) {
			c++;
			cur--;
		}
	}
	return {x1, x2};
}

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
#endif
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) {
		scanf("%lld%lld", &a[2 * i - 1].fi, &a[2 * i].fi);
		a[2 * i - 1].se = 0;
		a[2 * i].se = 1;
	}
	sort(a + 1, a + 2 * n + 1);
	if (n & 1) {
		auto p = get(n / 2 + 1);
		cout << p.se - p.fi + 1 << "\n";
		return 0;
	}
	auto p1 = get(n / 2), p2 = get(n / 2 + 1);
	cout << (p2.se + p1.se - p2.fi - p1.fi + 1) << "\n";
}

Measured memory_bytes: 10012
#include<bits/stdc++.h>
#define maxn 340000
#define M 998244353

using namespace std;
typedef long long ll;
ll dp[maxn][3][3],n,t,f,ans,g;
char s[maxn];

int main()
{
    scanf("%s",s); n=strlen(s); ans=1; g=1;
    f=1; for (int i=1;i<n;i++) f&=s[i]!=s[i-1],g&=s[i]==s[i-1],ans=ans*3%M;
    if (g) {cout << 1 << endl; return 0;}
    if (n==2) {cout << 1+(s[0]!=s[1]) << endl;return 0;}
    if (n==3) {
        if (s[0]==s[1]&&s[0]==s[2]) cout << 1 << endl;
        else if (s[0]!=s[1]&&s[1]!=s[2]&&s[0]!=s[2]) cout << 3 << endl;
        else cout << 6+f << endl;
        return 0;
    }
    for (int i=0;i<n;i++) t=(t+s[i]-'a')%3;
    for (int i=0;i<3;i++) dp[1][i][i]=1;
    for (int i=2;i<=n;i++)
        for (int j=0;j<3;j++)
            for (int k=0;k<3;k++)
                for (int l=0;l<3;l++)
                    if (k!=l) (dp[i][(j+l)%3][l]+=dp[i-1][j][k])%=M;
    cout << ((ans-dp[n][t][0]-dp[n][t][1]-dp[n][t][2])%M+M+f)%M << endl;
    return 0;
}


Measured memory_bytes: 16512
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <unordered_map>
#include <iostream>
#include <cstdio>
#include <cstdlib>

using namespace std;

typedef long long ll;
typedef unsigned int uint;

bool check_order(vector<int> &p)
{
    for (int k = 0; k < p.size() - 1; k++)
    {
        if (p[k] > p[k + 1])
        {
            return false;
        }
    }
    return true;
}

void destroy(vector<uint> &a, vector<uint> &b, int i, int j)
{
    if (!(i - j == 1 || j - i == 0))
    {
        cerr << "ERROR!" << endl;
        exit(1);
    }

    if (a[i] >= b[j])
    {
        a[i] = a[i] - b[j];
        b[j] = 0;
    }
    else
    {
        b[j] = b[j] - a[i];
        a[i] = 0;
    }
}

int main(void)
{
    int n;
    cin >> n;
    vector<uint> a(n + 1);
    vector<uint> b(n);

    ll num_monster = 0;

    for (int i = 0; i < n + 1; i++)
    {
        cin >> a[i];
        num_monster += a[i];
    }
    for (int i = 0; i < n; i++)
    {
        cin >> b[i];
    }

    destroy(a, b, 0, 0);
    destroy(a, b, n, n - 1);
    for (int i = 1; i <= n / 2; i++)
    {
        destroy(a, b, i, i - 1);
        destroy(a, b, i, i);

        destroy(a, b, n - i, n - i);
        destroy(a, b, n - i, n - i - 1);
    }

    ll num_dead = num_monster;
    for (int i = 0; i < n + 1; i++)
    {
        num_dead -= a[i];
    }

    cout << num_dead;

    return 0;
}

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


using namespace std;



int main() {
    //fstream cin("A.in");
    //ofstream cout("A.out");
    int a, b, c, d, e, f;
    ios::sync_with_stdio(false);
    cin >> a >> b >> c >> d >> e >> f;
    std::pair <int, int> ans;
    for(int i1 = 0; i1 * 100 * a <= f; i1++)
        for(int i2 = 0; i2 * 100 * b <= f - i1 * 100 * a; i2++)
           for(int i3 = 0; i3 * c <= f - i1 * 100 * a - i2 * 100 * b; i3++)
               for(int i4 = 0; i4 * d <= f - i1 * 100 * a - i2 * 100 * b - i3 * c; i4++)
                   if((i1 * a + i2 * b) * e >= (i3 * c + i4 * d)) {
                       if(ans.first * (i1 * a * 100 + i2 * b * 100 + i3 * c + i4 * d) <= (i3 * c + i4 * d) * (ans.second + ans.first))
                            ans = {i3 * c + i4 * d, i1 * a * 100 + i2 * b * 100};

                   }
    cout << ans.first + ans.second << " " << ans.first;
    //cin.close();
    //cout.close();
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
s = input()
if s[0] != "A": print("WA")
elif s[2:-1].count("C") != 1: print("WA")
else:
    for i in range(len(s)):
        if s[i] in "AC": pass
        elif 97 <= ord(s[i]) <= 122: pass
        else:
            print("WA")
            exit(0)
    print("AC")

    

Measured memory_bytes: 3060
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        String w = sc.next();
        //英字をカウントするための配列を準備
        int[] alphabet = new int[26];

        for(int i = 0; i < w.length(); i++){
            //char型(実体は整数値)を用いて、英字をカウント
            alphabet[w.charAt(i) - 'a']++;
        }
        
        //配列の要素がすべて偶数であるかチェック
        boolean beauty = true;
        for(int i = 0; i < 26; i++){
            if(alphabet[i] % 2 != 0)beauty = false;
        }
        
        //三項演算子で評価
        System.out.println(beauty? "Yes" : "No");
    }
}


Measured memory_bytes: 21716
N = int(input())
A = list(map(int, input().split()))
S = [0]
for i, a in enumerate(A):
    S.append(S[i]+a)
S = sorted(S)
prev = S[0]
ans = 0
tmp_count = 0
for s in S[1:]:
    if s==prev:
        tmp_count += 1
    else:
        ans += tmp_count*(tmp_count+1)//2
        tmp_count = 0
    prev = s
ans += tmp_count*(tmp_count+1)//2
print(ans)


Measured memory_bytes: 25724
mod io{
    use std::io::*;
    pub fn read<T: ::std::str::FromStr>()->T{
        let stdin=stdin();
        let ret=stdin.lock().bytes().map(|c|c.unwrap()as char)
        .skip_while(|c|c.is_whitespace())
        .take_while(|c|!c.is_whitespace())
        .collect::<String>().parse().ok().unwrap();
        ret
    }
}
use io::read;
fn main(){
    let n=read::<usize>();
    let mut f=0;
    let s=(0..n).map(|_|read::<String>().chars().collect::<Vec<char>>()).collect::<Vec<Vec<char>>>();
    for i in 1..n{
        if s[i][0]!=s[i-1][s[i-1].len()-1]{f+=1}
        for j in 0..i{
            if s[i].iter().eq(s[j].iter()){f+=1}
        }
    }
    println!("{}",if f>0{"No"}else{"Yes"})
}


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

static const int N = 100;
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n, M[N][N];
int color[N], d[N], f[N], tt;

void dfs_visit(int u) {
    color[u] = GRAY;
    d[u] = ++tt;
    for (int v=0; v < n; v++) {
        if (M[u][v] == 0) continue;
        if (color[v] == WHITE) {
            dfs_visit(v);
        }
    }
    color[u] = BLACK;
    f[u] = ++tt;
}

void dfs() {
    for (int u=0; u < n; u++) color[u] = WHITE;
    tt = 0;
    for (int u = 0; u < n; u++) {
        if (color[u] == WHITE) dfs_visit(u);
    }
    for (int i = 0; i < n; i++) {
        cout << i+1 << " " << d[i] << " " << f[i] << endl;
    }
}

int main() {
    cin >> n;

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            M[i][j] = 0;
        }
    }

    for (int i = 0; i < n; i++) {
        int u, l; cin >> u >> l;
        u--;
        for (int j = 0; j < l; j++) {
            int v; cin >> v;
            v--;
            M[u][v] = 1;
        }
    }

    dfs();
    
    return 0;
}




Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef pair<int,int> P;
struct edge{ int from,to,cost;};
edge es[2001];
ll d[1001],V,E,INF=1e18;
int find_negative_loop(){
    rep(i,V+1) d[i]=0;
    rep(i,2*V)rep(j,E){
        edge e=es[j];
        if(d[e.to]>d[e.from]+e.cost){
            d[e.to]=d[e.from]+e.cost;
            if(i>=V-1&&e.to==V-1) return 1;
        }
    }
    return 0;
}
int shortest_path(int s){
    rep(i,V+1) d[i]=INF;
    d[s]=0;
    rep(j,V-1){
        int x=0;
        rep(i,E){
            edge e=es[i];
            if(d[e.from]!=INF&&d[e.to]>d[e.from]+e.cost) d[e.to]=d[e.from]+e.cost,x=1;
        }
        if(!x) break;
    }
}
int main(){
    int a,b,c;
    cin>>V>>E;
    rep(i,E) cin>>a>>b>>c,es[i].from=a-1,es[i].to=b-1,es[i].cost=-c;
    if(find_negative_loop()) cout<<"inf";
    else{
        shortest_path(0);
        cout<<-d[V-1];
    }
}

Measured memory_bytes: 256
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

void solve(){
    ll A;
    cin >> A;
    double B;
    cin >> B;
    ll b = round(B * 1000.0);
    ll v1 = (A / 1000) * b;
    ll a = A % 1000;
    double ad = (double) a;
    ad = floor(ad * B);
    v1 += (ll) ad;
    print(v1);


    

}

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


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

typedef long long int ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ar array
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll mod = 1e9 + 7;
const ll inf = 2e9 + 5;
double PI = 3.14159265358979323846;

const int N = 1e5+5;
vi g[N];
vi dp(N,-1);
int n,m;

int go(int node){

    if(dp[node]!=-1){
        return dp[node];
    }

    bool leaf = 1;
    int best = 0;
    for(auto nbr : g[node]){
        leaf = 0;
        best = max(best, go(nbr));
    }

    return dp[node] = (leaf ? 0 : 1 + best);
}

void solve() {

    cin >> n >> m;
    for(int i = 0;i < m;i++){
        int a,b;
        cin >> a >> b;
        g[a].pb(b);
    }

    int ans = 0;
    for(int i = 1;i <= n;i++){
        ans = max(ans,go(i));
    }

    cout << ans << endl;

}

int32_t main()
{
    IOS
    // int T; cin >> T; while (T--)
    solve();
    return 0;
}


Measured memory_bytes: 11012
N = int(input())
A = list(map(int, input().split()))

pattern = 1
hats = [0, 0, 0]
for a in A:
    if pattern == 0:
        break
    i = 0
    for j in range(3):
        if a == hats[j]:
            i += 1
    pattern *= i
    for j in range(3):
        if a == hats[j]:
            hats[j] += 1
            break
    if pattern >= 1000000007:
        pattern = pattern % 1000000007

print(pattern)

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

A = [[[0 for i in range(10)]for i in range(3)] for i in range(4)]

for i in range(n):
    b, f, r, v = map(int, input().split())
    build = A[b-1]
    build[f-1][r-1] += v

for i in range(4):
    for j in range(3):
        print("", ' '.join(map(str, A[i][j])))
    if i != 3:
        print("#" * 20)


Measured memory_bytes: 5608
#include<iostream>
#include<cmath>
//#include<algorithm>
using namespace std;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
	int n;
	int t;
	int a;
	int temp;
	int mininum;
	float tempsa;
 
	float mini = 1000;
 
	cin >> n >> t >> a;
 
	for (int i = 0; i < n; i++){
		cin >> temp;
		tempsa = abs(a - (t - temp * 0.006));
		if (tempsa < mini){
			mini = tempsa;
			mininum = i + 1;
		}
	}
 
	cout << mininum << "\n";
 
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>

using namespace std;

#define mod 1000000007

int n, k;
int a[510];

int solve(int num)
{
	// numが解の候補となるかを調べる
	vector<int> amari, amari_r;
	for(int i = 0; i < n; i++){
		int tmp = a[i] % num;
		if(tmp == 0) continue;
		amari.push_back(tmp);
		amari_r.push_back(num - tmp);
	}
	int s = amari.size();
	if(s == 0) return 0;
	sort(amari.begin(), amari.end());
	sort(amari_r.begin(), amari_r.end());
	reverse(amari_r.begin(), amari_r.end());
	for(int i = 1; i < s; i++){
		amari[i] += amari[i - 1];
	}
	for(int i = s - 2; i >= 0; i--){
		amari_r[i] += amari_r[i + 1];
	}
	int res = mod;
	for(int i = 0; i < s - 1; i++){
		if(amari[i] == amari_r[i + 1]) res = min(res, amari[i]);
	}
	return res;
}


int main()
{

	cin >> n >> k;
	int sum = 0;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		sum += a[i];
	}
	int ans = 1;
	for(int i = 1; i * i <= sum; i++){
		if(sum % i == 0){
			if(solve(i) <= k) ans = max(ans, i);
			if(solve(sum / i) <= k) ans = max(ans, sum / i);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define R register
#define mp make_pair
#define ll long long
#define pii pair<int, int>
using namespace std;

int a, b, c;

template <class T>
inline void read(T &x) {
	x = 0;
	char ch = getchar(), w = 0;
	while (!isdigit(ch)) w = (ch == '-'), ch = getchar();
	while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
	x = w ? -x : x;
	return;
}

inline int check() {
	int w = a ^ b ^ c;
	if (w != a && w != b && w != c) return 0;
	if (a == b && a == c) return 0;
	return 1;
}

int main() {
	read(a), read(b), read(c);
	printf("%s\n", check() ? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 256
#! /usr/bin/python
# -*- coding: utf-8 -*-

used = [0]*110000
used[0] = 1
used[1] = 1
for i in range(2, 110000):
    if used[i] == 0:
        for j in range(i*2, 110000, i):
            used[j] = 1

(n, p) = map(int, raw_input().split())
while n!=-1:
    prime = []
    cnt = 0
    cur = n+1 
    while cnt <= 100:
        if used[cur] == 0:
            cnt += 1
            prime.append(cur)
        cur += 1
    padd = []
    for i in range(len(prime)):
        for j in range(i, len(prime)):
            padd.append(prime[i]+prime[j])
    padd.sort()
    print padd[p-1]

    (n, p) = map(int, raw_input().split())

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

int main(){
	int N,count=0;
	cin>>N;
	int a[N+1];
	for(int i=1;i<=N;i++)cin>>a[i];

	for(int i=1;i<=N;i++){
		if(i%2==1 and a[i]%2==1){count++;}
	}
	cout<<count<<endl;
}

Measured memory_bytes: 3624
import sys


def input():
    return sys.stdin.readline()[:-1]


def ii(t: type = int):
    return t(input())


def il(t: type = int):
    return list(map(t, input().split()))


def imi(N: int, t: type = int):
    return [ii(t) for _ in range(N)]


def iml(N: int, t: type = int):
    return [il(t) for _ in range(N)]


N = ii()
A, B = il()
P = il()
q1 = [p for p in P if p <= A]
q2 = [p for p in P if A + 1 <= p <= B]
q3 = [p for p in P if B + 1 <= p]
print(min(len(q1), len(q2), len(q3)))


Measured memory_bytes: 3064
n=input()
dig=len(n)
n=int(n)
ans=0

if dig%2==1:
    ans=n+1-10**(dig-1)
    dig-=2
    while dig>2:
        ans+=9*10**(dig-1)
        dig-=2 
else:
    dig-=1
    while dig>2: 
        ans+=9*10**(dig-1)
        dig-=2

if n>9:
    ans+=9

print(ans)


        



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


def create_prime_table(n):
    list = [True for _ in range(n + 1)]
    i = 2
    while i * i <= n:
        if list[i]:
            j = i + i
            while j <= n:
                list[j] = False
                j += i
        i += 1

    table = [i for i in range(n + 1) if list[i] and i >= 2]
    return table


prime = create_prime_table(55555)
cnt = 0
nine = []
for idx, i in enumerate(prime):
    if (i % 100) == 9:
        nine.append(i)
print(*nine[:n])


Measured memory_bytes: 3736
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<ll,vector<ll>,greater<ll>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30);
const int INF = (1LL << 60);
const double EPS = (1 >> 30);
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }
template< typename T > istream &operator>>(istream &is, vector< T > &v) { for(T &in : v) is >> in; return is; }



signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    int k;
    cin>>k;
    int n=50;
    int memo=k/50;
    int alla=memo+n-1;
    k%=50;

    int hitotu=alla+(n-(k-1));

    alla-=k;

    cout<<n<<endl;
    rep(i,50-k){
        cout<<alla<<" ";
    }
    rep(j,k){
        cout<<hitotu<<" ";
    }
    
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <cmath>
#include <numeric>
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <list>
#include <unordered_map>
#include <tuple>
#include <complex>


#define FOR(i, a, b)		for(int i = (int)(a); i < (int)(b); ++i)
#define FORE(i, a, b)		for(int i = (int)(a); i <= (int)(b); ++i)
#define REP(i, n)			FOR(i, 0, n)
#define REPE(i, n)			FORE(i, 0, n)
#define ALL(x)				(x).begin(),(x).end()
#define DEBUG_DC(x)			cout << #x << ": " << x << endl
#define VEC_TYPE			int
#define INF					1e5+1

using namespace std;
typedef long long ll;
typedef vector<VEC_TYPE> vdef;
typedef vector<vdef> vvdef;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmaxE(T& a, T b) { if (a <= b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline bool chminE(T& a, T b) { if (a >= b) { a = b; return 1; } return 0; }
template<typename T> inline T mygcd(T a, T b) { return b ? mygcd(b, a%b) : a; }
template<typename T> inline T mylcm(T a, T b) { return a * b / mygcd(a, b); }

int main()
{
	int ans = 0;
	int a, b;
	cin >> a >> b;

	int deff = abs(a - b);
	if (deff % 2)
	{
		cout << "IMPOSSIBLE" << endl;
		return 0;
	}
	else
	{
		deff /= 2;
		if (a <= b)
			ans = a + deff;
		else
			ans = b + deff;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
use std::collections::HashMap;
use std::io::{BufRead, StdinLock};
fn main() {
    let stdin = std::io::stdin();
    let mut stdinlock = stdin.lock();
    let nk = read_line(&mut stdinlock);
    let mut balls: HashMap<u32, u32> = HashMap::new();
    for &ak in &read_line(&mut stdinlock) {
        let ball = balls.entry(ak).or_insert(0);
        *ball += 1;
    }
    eprintln!("{:?}", balls);
    println!("{}", solve(nk[0], nk[1], &balls));
}

fn solve(_: u32, k: u32, balls: &HashMap<u32, u32>) -> u32 {
    if balls.len() <= k as usize {
        return 0;
    }
    let diff = balls.len() - k as usize;
    let mut nums: Vec<u32> = balls.values().map(|&n| n).collect();
    nums.sort();
    nums.iter().take(diff).sum()
}

fn read_line(st: &mut StdinLock) -> Vec<u32> {
    let mut s = String::new();
    st.read_line(&mut s).expect("read_line");
    s.trim()
        .split_whitespace()
        .map(|n| n.parse().expect("parse"))
        .collect()
}


Measured memory_bytes: 7152
n,q=map(int,input().split())
s=list(str(input()))
lr=[]
for i in range(q):
    lr.append(list(map(int,input().split())))
ctr1=0
t_list=[0]
for i in range(n-1):
    if s[i]=="A" and s[i+1]=="C":
        ctr1+=1
        t_list.append(ctr1)
    else:
        t_list.append(ctr1)

for i in range(q):
    left=lr[i][0]
    right=lr[i][1]
    print(t_list[right-1]-t_list[left-1])


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

int main(){

    int n;
    cin >> n;
    vector<string> s(n);

    rep(i,n){
        cin >> s[i];
    }

    string al="abcdefghijklmnopqrstuvwxyz";
    map<vector<int>,ll> a;
    rep(i,n){
        vector<int> t(26,0);
        rep(j,s[i].size()){
            t[s[i][j]-'a']++;
        }
        a[t]++;
    }
    ll ans=0L;
    for(auto it=a.begin();it!=a.end();it++){
        ll t=it->second-1;
        ans+=t*(t+1)/2;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 25984
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 20000

int p[N];
int d[N];

void init(void){
	f(i, N){
		p[i] = i;
		d[i] = 1;
	}
	return;
}

int pa(int x){
	if (p[x] == x)return x;
	else return p[x] = pa(p[x]);
}


void uni(int x, int y){
	int px = pa(x);
	int py = pa(y);
	if (d[px] < d[py]){
		p[px] = py;
		d[py] = max(d[py], d[px] + 1);
	}
	else{
		p[py] = px;
		d[px] = max(d[px], d[py] + 1);
	}
}

bool jud(int x, int y){
	int px = pa(x);
	int py = pa(y);
	if (px == py)return true;
	else return false;
}


int main(){
	int n, q;
	int x, y, z;
	long long s, ans;
	bool v = true;
	ans = 0;
	scanf("%d", &n);
	init();
	scanf("%d", &q);
	f(qq, q){
		scanf("%d", &z);
		if (z == 0){
			scanf("%d %d", &x,&y);
			uni(x, y);
		}
		else if (z == 1){
			scanf("%d %d", &x, &y);
			v=jud(x, y);
			if (v)printf("1\n");
			else printf("0\n");
		}
	}

	return 0;
}


Measured memory_bytes: 2840
import java.util.Scanner;
 
public class Main {
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
        
        
        //int num[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
        long h = stdIn.nextInt();
        long w = stdIn.nextInt();
        //int b = stdIn.nextInt();
        //int c = stdIn.nextInt();
        //int x = stdIn.nextInt();
        //int num[] = new int[];
        //String s = stdIn.next();
        //String t = stdIn.next();
        if(h == 1 || w == 1){
            System.out.println(1);
        }else{
            if((h * w)% 2 == 0){
                long l = h * w / 2;
                System.out.println(l);
            }else{
                long l = h * w / 2 + 1;
                System.out.println(l);
            }
        }
        
        
        //int sum = 0;
        //boolean flag = true;
        //for(int i = 0; i < s.length(); i++){
        //}
 
 
        //System.out.println();
        //System.out.print();
 
        stdIn.close();
    }
}

Measured memory_bytes: 23764
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
#include <climits>
#include <iterator>
#include <iomanip>
#include <stack>
#include <set>
#include <cstdio>
#include <bitset>
#include <functional>
#include <tuple>
#include <list>
#include <deque>
using namespace std;
typedef pair<int, int> P;

#define FOR(i, a, n) for (ll i = (ll)a; i<(ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long ll;
typedef vector<int> VI;
const int BITSIZE = 100010;

int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
    
    int n, q; cin >> n >> q;
    
    vector<vector<ll> > v(n);
    
    REP(i, q){
        int a, b, c; cin >> a;
        if(a==0){
            cin >> b >> c;
            v[b].push_back(c);
        }
        if(a==1){
            cin >> b;
            if(v[b].size()==0) continue;
            
            cout << v[b][v[b].size()-1] << endl;
        }
        if(a==2){
            cin >> b;
            if(v[b].size()==0) continue;
            
            v[b].pop_back();
        }
    }
	return 0;
}


Measured memory_bytes: 4868
#include<bits/stdc++.h>
using namespace std;
char s[100007];
int main(){
    scanf("%s",s);
    int cnt_0=0,cnt_1=0;
    for(int i=0;s[i]!=0;i++){
        if(s[i]=='0')
            cnt_0++;
        else
            cnt_1++;
    }
    int ans=0;
    ans=min(cnt_0,cnt_1)*2;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 384
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>

using namespace std;

int main(){
	int N;
	char s1[55];
	char s2[55];

	const long long mod = 1000000007;

	scanf("%d",&N);
	scanf("%s",s1);
	scanf("%s",s2);

	long long a;
	int i;

	if(s1[0]==s2[0]){
		a = 3;
		i = 1;
	}else{
		a = 6;
		i = 2;
	}

	while(i<N){
		if(s1[i]==s2[i]){
			if(s1[i-1]==s2[i-1]){
				a *= 2;
			}else if(s1[i-2]==s1[i-1]){
				a *= 1;
			}
			a %= mod;
			i += 1;
		}else if(s1[i]==s1[i+1]){
			if(s1[i-1]==s2[i-1]){
				a *= 2;
			}else if(s1[i-2]==s1[i-1]){
				a *= 3;
			}
			a %= mod;
			i += 2;
		}
	}

	printf("%lld\n",a);

	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <stdio.h>
#define int long long
using namespace std;
signed main() {
	int a, b;
	cin >> a >> b;
	int ans = 0;
	for (int i = b - a - 1; i >= 0; i--) {
		ans += i;
	}
	cout << ans - a << endl;
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws IOException {
        try (BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {
            solve(in);
        }
    }

    private static void solve(BufferedReader in) throws IOException {
        StringTokenizer st = new StringTokenizer(in.readLine());
        int N = Integer.parseInt(st.nextToken()), M = Integer.parseInt(st.nextToken());
        int[] l = new int[N + 1], r = new int[N + 1];
        for (int i = 1; i < N + 1; i++) {
            st = new StringTokenizer(in.readLine());
            l[i] = Integer.parseInt(st.nextToken());// 1 <= l <= r <= M
            r[i] = Integer.parseInt(st.nextToken());
        }

        @SuppressWarnings("unchecked")
        List<Integer>[] nByLen = new List[M + 1];
        for (int n = 1; n < N + 1; n++) {
            int len = r[n] - l[n] + 1;
            if (nByLen[len] == null) {
                nByLen[len] = new ArrayList<>();
            }
            nByLen[len].add(n);
        }

        int accum = N;

        Fenwick F = new Fenwick(M);
        for (int d = 1; d < M + 1; d++) {
            int sum = accum;
            for (int e = d; e < M + 1; e += d) {
                sum += F.accum(e);
            }
            System.out.println(sum);
            if (nByLen[d] != null) {
                accum -= nByLen[d].size();
                for (int i : nByLen[d]) {
                    F.add(l[i], 1);
                    F.add(r[i] + 1, -1);
                }
            }
        }
    }
}

class Fenwick {
    private final int[] fenwick;

    public Fenwick(int n) {
        fenwick = new int[n + 1];
    }

    public int accum(int i) {
        int sum = 0;
        for (; i > 0; i -= i & -i) {
            sum += fenwick[i];
        }
        return sum;
    }

    public void add(int i, int a) {
        for (; i < fenwick.length; i += i & -i) {
            fenwick[i] += a;
        }
    }
}

Measured memory_bytes: 48356
#define STOPIT
#include <bits/stdc++.h>
#define loop(n) for (lint ngtkana_is_a_genius = 0; ngtkana_is_a_genius < lint(n); ngtkana_is_a_genius++)
#define rep(i, begin, end) for (lint i = lint(begin); (i) < lint(end); i++)
#define all(v) v.begin(), v.end()
#define rand(l, r) std::uniform_int_distribution<>(l, r)(mt)
using lint = long long;
auto mt = std::mt19937_64(std::random_device{}());
auto cmn = [](auto& a, auto b){ if (a > b) {a = b; return true;} return false; };
auto cmx = [](auto& a, auto b){ if (a < b) {a = b; return true;} return false; };
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { std::cerr << " " << head; debug_impl(tail...); }
#ifndef STOPIT
#define debug(...)\
	do {\
		std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
		debug_impl(__VA_ARGS__);\
		std::cerr << std::noboolalpha;\
	} while (false)
#else
#define debug(...) {}
#endif

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr>
std::istream& operator>> (std::istream& is, Container& v)
	{ for (auto & x : v) { is >> x; } return is; }

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr >
std::ostream& operator<< (std::ostream& os, Container const& v) {
 os << "{";
	for (auto it = v.begin(); it != v.end(); it++)
		{os << (it != v.begin() ? "," : "") << *it;}
	return os << "}";
}

int main() {
	std::cin.tie(0); std::cin.sync_with_stdio(false);
	int n; std::cin >> n;
	std::vector<int> a(n),b(n),c(n);
	std::cin>>a>>b>>c;
	std::sort(all(a));
	std::sort(all(b));
	std::sort(all(c));

	lint ans = 0;
	for (int y : b) {
		lint x = std::lower_bound(all(a), y) - a.begin();
		lint z = c.end() - std::upper_bound(all(c), y);
		debug(x,a);
		debug(z,c);
		ans += x * z;
	}
	std::cout << ans << std::endl;
	return 0;
}

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

int main(){
  int N,L;
  cin >> N >> L;
  vector<string> S(N);
  for(auto &x:S)
    cin >> x;
  
  sort(S.begin(),S.end());
  
  for(auto &x:S)
    cout << x;
  cout << endl;
  
  return 0;
  
}

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

int main(){
  int N; cin>>N;
  vector<int> a(N);
  for(int i=0;i<N;i++)
    cin>>a[i];
  sort(a.begin(),a.end());
  int n = a.back();
  int r = 0;
  int mxdif = 0;
  for(int i=0;i<N-1;i++){
    int v = max(a[i],n-a[i]);
    int dif = abs(n - v);
    if(dif > mxdif){
      mxdif = dif;
      r = a[i];
    }
  }
  cout<<n<<" "<<r<<endl;
  return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
int main(){
    int a,b,c,k;
    scanf("%d %d %d %d",&a,&b,&c,&k);
    if(a>=k){
        printf("%d\n",k);
    }else if(a+b>=k){
        printf("%d\n",a);
    }else{
        int t=k-a-b;
        printf("%d",a-1*t);
    }
    return 0;
}

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

int main(){
    int n;
    cin >> n;
    int a[n];
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    bool judge = true;
    for(int i=0; i<n; i++){
        if(a[i]%2 == 0){
            if(a[i]%3!=0 && a[i]%5!=0){
                judge = false;
            }
        }
        if(!judge) break;
    }
    if(judge) cout << "APPROVED" << endl;
    else cout << "DENIED" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <vector>
#include <cmath>
#include <map>
#include<algorithm>
using namespace std; 
int main(){
    long long a,s; cin >> a >> s;
    long long sum = 0;
    vector<int> A(a);
    for (int i=0;i<a;i++){
        cin >> A[i];
    }
    sort(A.begin(),A.end());
    if (a<=s) cout << "0" << "\n";
    else{
        for (int i=0;i<a-s;i++){
            sum+=A[i];
        }
        cout << sum << "\n";
    }
}




Measured memory_bytes: 1024
#include <iostream>
#include <string>
using namespace std;
int n[4] = {};
int done = 0;
void dfs(int index, string ops, int sum) {
  // cout << index << " " << ops << " " << sum << endl;
  if (index == 3) {
    if (sum == 7 && !done) {
      for(int i = 0; i < 3; i++) {
        cout << n[i] << ops[i];
      }
      cout << n[3] << "=7" << endl;
      done = 1;
    }
    return;
  }
  if (!done) {
    dfs(index + 1, ops + '+', sum + n[index + 1]);
  	dfs(index + 1, ops + '-', sum - n[index + 1]);
  }
}

int main() {
  string s;
  cin >> s;
  for (int i = 0; i < 4; i++) {
    n[i] = s[i] - '0';
  }
  dfs(0, "", n[0]);
  return 0;
}

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

int main()
{
    int N, sum=0;

    cin >> N;
    vector<int> d(N);

    for (int i = 0; i < N;i++){
        cin >> d.at(i);
    }

    
    for (int i = 0; i < N-1;i++){
        for (int j = i+1; j < N;j++){
            sum += d.at(i) * d.at(j);
            //cout << sum << endl;
        }
    }
    
    cout << sum << endl;
    //cout << N * (N - 1) / 2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std; 
int gi() { 
	int res = 0, w = 1; 
	char ch = getchar(); 
	while (ch != '-' && !isdigit(ch)) ch = getchar(); 
	if (ch == '-') w = -1, ch = getchar(); 
	while (isdigit(ch)) res = res * 10 + ch - '0', ch = getchar(); 
	return res * w; 
} 
typedef long long LL;
const int MAX_N = 1e5 + 5; 
int N, a[MAX_N];
LL sum, per, n; 

int main () { 
#ifndef ONLINE_JUDGE 
    freopen("cpp.in", "r", stdin); 
#endif 
	N = gi(); per = 1ll * N * (N + 1) / 2; 
	for (int i = 1; i <= N; i++) a[i] = gi(), sum += a[i]; 
	if (sum % per) return puts("NO") & 0; 
	n = sum / per; 
	for (int i = 1; i <= N; i++) { 
		int m = a[i] - a[i % N + 1]; 
		LL t = n + m; 
		if (t % N || t / N < 0 || t / N > n) return puts("NO") & 0; 
	} 
	puts("YES"); 
    return 0; 
} 

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

using namespace std;
 
typedef long long int ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector <string> vs;
typedef vector<vector<int>> vvi;
typedef pair<int,int> pi;

//#define int ll
#define forl(i,a,b) for (int i = a; i < b; i++)
#define rfor(i,b,a) for (int i = b; i >= a; i--)
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define srt(x) sort(x.begin(), x.end())
#define sumup(x) accumulate(x.begin(), x.end(), 0)
#define PI 3.141592653589793238
#define MOD 1000000007
#define loop(n) for(int i = 0; i < n; i++)
#define rloop(n) for(int i = n-1; i >= 0; i--)

void io() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

int32_t main() {
    io();
    int t=1;
    //cin>>t;
    while(t--) {
        int x;
        cin>>x;
        if(x>=30) cout<<"Yes\n";
        else cout<<"No\n";
    }
    return 0;
}

Measured memory_bytes: 3644
import java.util.Scanner;

public class Main {


    public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();//n?????\?????????????????±?????°
		int kousya[][][] = new int[4][3][10];
		for(int cnt1 = 0; cnt1 < 4; cnt1++){//kousya???????????????????????????
			for(int cnt2 = 0; cnt2 < 3; cnt2++){
				for(int cnt3 = 0; cnt3 < 10; cnt3++){
					kousya[cnt1][cnt2][cnt3] = 0;
				}
			}
		}
		for(int cnt_n = 0; cnt_n < n; cnt_n++){//??°????????\?????????
			int house = scan.nextInt();//?£?
			int floor = scan.nextInt();//?£????????????¢
			int room = scan.nextInt();//????????¢?????????
			int nin = scan.nextInt();//??????????????°????¢??????°
			kousya[house - 1][floor - 1][room - 1] += nin;//??????????????°?¢???????????????????
		}	

			for(int cnt1 = 0; cnt1 < 4; cnt1++){//kousya??????????????????
				for(int cnt2 = 0; cnt2 < 3; cnt2++){
					for(int cnt3 = 0; cnt3 < 10; cnt3++){
						System.out.print(" " + kousya[cnt1][cnt2][cnt3]);
					}
					System.out.println();
				}
				if(cnt1 != 3){//??????????£???\????????????????????????????????????#????????\??????
					System.out.println("####################");
				}
			}
			scan.close();
	}
}

Measured memory_bytes: 29260
#include <stdio.h>
#include <math.h>

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

const int N_MAX = 1e5+10;

typedef struct node
{
	int x;
	int l;

	bool operator < (const node &t) const
	{
		return x < t.x;
	}
} Node;

int N;
Node A[N_MAX];

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

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

	sort(A, A + N);

	int remain = N;
	for( int i = 1; i < N; i++ )
	{
		int now_lb = A[i].x - A[i].l;
		int now_lf = A[i].x + A[i].l;
		int prev_lf = A[i - 1].x + A[i - 1].l;

		if( prev_lf > now_lb )
		{
			if( prev_lf <= now_lf )
			{
				A[i].x = A[i - 1].x;
				A[i].l = A[i - 1].l;
			}

			remain--;
		}
	}

	printf("%d\n", remain);

	return 0;
}


Measured memory_bytes: 1024
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
      return Array.new(size1){init}
  else
      return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

N,T=get_i
A=get_i
min=INF
diff=0
A.each do|a|
  min=a if min>a
  diff=a-min if diff<a-min
end
kind=Hash.new(0)
ans=0
A.each do|a|
  ans+=1 if kind[a-diff]==1
  kind[a]=1
end
puts ans

Measured memory_bytes: 26620
#include<stdio.h>
  int main(void)
{
   int W,H,x,y,r;
   scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
      if(0 <= y-r && 0 <= x-r && x+r <= W && y+r <= H)
      {
        printf("Yes\n");
      }
    else
    {
        printf("No\n");
    }
   return 0;
}

Measured memory_bytes: 2672
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
    int a,b;
    cin >> a >> b;
    cout << (a+b)%24;
    return 0;
}


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

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

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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

#define f first
#define s second
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define pb push_back

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (int i = (b); i >= (a); i--)
#define R0F(i, a) ROF(i, 0, a-1)
#define trav(x, a) for (auto& x: a)

const int MX  = 2e5+5;
const int MOD = 1e9+7;
const ll  INF = 1061109567; // 4557430888798830399LL
const ld  EPS = 1e-9;
const ld  PI  = acos(-1);

int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int N; cin >> N;

    string S; cin >> S;

    int res = 0, x = 0;
    trav(w, S) {
        if (w == 'I') x++;
        else x--;

        res = max(res, x);
    }

    cout << res << "\n";

}


Measured memory_bytes: 256
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
using namespace std;
//typedef pair<int,int> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[10000001];
//char str[1010][1010];
//vector<pair<int,int> > pc[100001];
//int ABS(int a){return max(a,-a);}
int main(){
	string o,e;
	cin>>o;
	cin>>e;
	for(int i=0;i<o.length();i++){
		cout<<o[i];
		if(i<e.length())cout<<e[i];
	}
	return 0;
}

Measured memory_bytes: 256
program main
	implicit none
    integer(8)::a,b,c,d,e,f
    read(*,*)a,b,c
    if(mod(a,2)==0 .or. mod(b,2)==0 .or. mod(c,2)==0)then
    	write(*,*) 0
    else
    	d=max(a,max(b,c))
        e=(d-1)/2
        f=e+1
        if(d==a)then
        	write(*,*) f*b*c-e*b*c
        else if(d==b)then
        	write(*,*) a*f*c-a*e*c
        else
        	write(*,*) a*b*f-a*b*e
        end if
    end if
    stop
end program main




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fori(i,n) for(int i =0;i<n;i++)
#define pb push_back
#define ll long long
#define int long long
#define F first
#define S second
#define mp make_pair
#define rev(a) reverse(a.begin(),a.end())
#define srt(a) sort(a.begin(),a.end())
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);cout.precision(15);
 
 
int mod = 1e9+7;
 
int pow(int a, int b) {
    int ans = 1;
    a %= mod;
    while(b) {
        if(b%2) {
            ans *= a;
            ans %= mod;
        }
        b /= 2;
        a *= a;
        a %= mod;
    }
    return ans;
}

int inv(int a) {
    return pow(a,mod-2);
}

int mul (int a,int b) {
    return ((a%mod)*(b%mod))% mod;
}

struct cmp {
    bool operator() (pair<int,int> a, pair<int,int> b) const {
        int x = a.F;
        int y = b.F;
        return x>=y;
    }
};


int32_t main() {
    FAST;
    int t;
    // cin>>t;
    t = 1;
    while(t--) {
        int h1,h2,m1,m2,k;
        cin>>h1>>m1>>h2>>m2>>k;
        if(h2 < h1) h2 += 24;
        if(m2 < m1) h2--, m2 += 60;
        int diff = (h2-h1)*60 + (m2-m1);
        int ans = max(0ll, diff-k);
        cout<<ans<<endl;
    }
    
    return 0;
}

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

using pii = pair<int, int>;
using ll  = long long;
#define rep(i, j) for (int i = 0; i < (int)(j); i++)
#define repeat(i, j, k) for (int i = (j); i < (int)(k); i++)
#define all(v) v.begin(), v.end()
#define debug(x) cerr << #x << " : " << x << endl

template <class T>
bool set_min(T &a, const T &b) {
    return a > b ? a = b, true : false;
}

template <class T>
bool set_max(T &a, const T &b) {
    return a < b ? a = b, true : false;
}
// vector
template <class T>
istream &operator>>(istream &is, vector<T> &v) {
    for (T &a : v) is >> a;
    return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    for (const T &t : v) os << "\t" << t;
    return os << endl;
}
// pair
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &v) {
    return os << "<" << v.first << ", " << v.second << ">";
}

const int INF = 1 << 30;
const ll INFL = 1LL << 60;

int main() {
    int A, B, C, D; cin >> A >> B >> C >> D;
    while(A > 0 and C > 0) {
        C -= B;
        if(C <= 0) break;
        A -= D;
    }
    cout << (A <= 0 ? "No" : "Yes") << endl;
    return 0;
}


Measured memory_bytes: 3636
(defun solver ()
  (let ((s (concatenate 'list (string-downcase (string (read)))))
        (w (read))
        (count 0))
    (loop for x in s do
          (when (zerop (mod count w))
            (format t "~a" x))
          (incf count))
    (format t "~%")))

(solver)

Measured memory_bytes: 13664
#include <iostream>
using namespace std;
int main(){
	int N;
	cin>>N;
	int K,P;
	for(int i=0;i<N;i++){
		cin>>K>>P;
		if(K>=P){
			if(K%P==0){
				cout<<P<<endl;
			}
			else{
				cout<<K%P<<endl;
		}
		}
		else{
			cout<<K%P<<endl;
		}
	}
	return 0;
}
			

Measured memory_bytes: 1160