akhauriyash/Code-Regression huggingface dataset:
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let (A, B, C) = read!(i64, i64, i64);

    println!("{}", C - min(C, A - B))
}


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

int d[200][200];
int R[200];
signed main() {
	int n,m,r;scanf("%d%d%d",&n,&m,&r);
	memset(d,0x3f,sizeof(d));
	rep(i,n)d[i][i]=0;
	rep(i,r){
		scanf("%d",&R[i]);R[i]--;
	}
	rep(i,m){
		int a,b,c;scanf("%d%d%d",&a,&b,&c);a--;b--;
		d[a][b]=d[b][a]=c;
	}
	rep(k,n)rep(i,n)rep(j,n)d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
	vector<int>v(r);rep(i,r)v[i]=i;
	int Min=INT_MAX;
	do{
		int cnt=0;
		rep(i,v.size()-1)cnt+=d[R[v[i]]][R[v[i+1]]];
		Min=min(Min,cnt);
	}while(next_permutation(v.begin(),v.end()));
	cout<<Min<<endl;
}


Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=998244353 ;
#define PI 3.141592653589793

/* SegTree<X>(n,fx,ex): モノイド(集合X, 二項演算fx, 単位元ex)についてサイズnで構築
    set(int i, X x), build(): i番目の要素をxにセット。まとめてセグ木を構築する。O(n)
    update(i,x): i 番目の要素を x に更新。O(log(n))
    query(a,b):  [a,b) 全てにfxを作用させた値を取得。O(log(n))
*/
template <typename X>
struct SegTree {
    using FX = function<X(X, X)>;
    int n;
    FX fx;
    const X ex;
    vector<X> dat;
    SegTree(int n_, FX fx_, X ex_) : n(), fx(fx_), ex(ex_), dat(n_ * 4, ex_) {
        int x = 1;
        while (n_ > x) {
            x *= 2;
        }
        n = x;
    }
 
    void set(int i, X x) { dat[i + n - 1] = x; }
    void build() {
        for (int k = n - 2; k >= 0; k--) dat[k] = fx(dat[2 * k + 1], dat[2 * k + 2]);
    }
 
    void update(int i, X x) {
        i += n - 1;
        dat[i] = x;
        while (i > 0) {
            i = (i - 1) / 2;  // parent
            dat[i] = fx(dat[i * 2 + 1], dat[i * 2 + 2]);
        }
    }
 
    // the minimum element of [a,b)
    X query(int a, int b) { return query_sub(a, b, 0, 0, n); }
    X query_sub(int a, int b, int k, int l, int r) {
        if (r <= a || b <= l) {
            return ex;
        } else if (a <= l && r <= b) {
            return dat[k];
        } else {
            X vl = query_sub(a, b, k * 2 + 1, l, (l + r) / 2);
            X vr = query_sub(a, b, k * 2 + 2, (l + r) / 2, r);
            return fx(vl, vr);
        }
    }
    /* debug */
    inline X operator[](int a) { return query(a, a + 1); }
    void print() {
        for (int i = 0; i < n; ++i) {
            cout << (*this)[i];
            if (i != n) cout << ",";
        }
        cout << endl;
    }
};


int main(){
  int n, K; cin >> n >> K; 
  auto fx = [](int x1, int x2) -> int { return max(x1, x2); };
  int ex = 0;
  SegTree<int> rmq(303030, fx, ex);
  int a[n];
  rep(i, n){
    cin >> a[i];
    int dainyu = rmq.query(max(0, a[i]-K), min(303029, a[i]+K+1));
    rmq.update(a[i], dainyu+1);
  }
  cout << rmq.query(0, 303029) << endl; 
}

Measured memory_bytes: 9032
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int a[100][100]={0},b[100]={0};
    int i=0,j=0;
    int n,m,count=0;
    scanf("%d %d",&m,&n);
    for(i=0;i<m;i++){
        for(j=0;j<n;j++){
            scanf("%d",&a[i][j]);
        }
    }
    for(i=0;i<n;i++){
        scanf("%d",&b[i]);
    }
    for(i=0;i<m;i++){
        for(j=0;j<n;j++){
            count += a[i][j]*b[j];
        }
        printf("%d\n",count);
        count = 0;
    }
    
    return 0;
}

Measured memory_bytes: 648
#include<iostream>
#include<string>
#include<vector>
#include<stdbool.h>
#include<numeric>
typedef long long ll;
using namespace std;

int main() {
	int N, D, X;
	int *A, *num;
	cin >> N;
	cin >> D >> X;
	A = (int*)malloc(sizeof(int)*N);
	num = (int*)malloc(sizeof(int)*N);
    for (int i = 0;i < N;i++)cin >> A[i];
	for (int i = 0;i < N;i++)num[i] = 1;
	for (int i = 0;i < N;i++) {
		for (int j = 1;j <= D;j++) {
			if (j*A[i] + 1 <= D)num[i]++;
		}
	}
	
	cout << accumulate(num, num + N, 0)+X << endl;

	return 0;
}

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

h = list(map(int, input().split()))

l = [1]*n

for i in range(m):
    a,b = map(int, input().split())
    if h[a - 1] <= h[b - 1]:
        l[a - 1] = 0
    if h[b - 1] <= h[a - 1]:
        l[b - 1] = 0

print(sum(l))


Measured memory_bytes: 20044
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < N; X++)
#define PI (acos(-1.0))
#define sorta(V) sort(V.begin(), V.end())
#define pback push_back
#define mpair make_pair

using namespace std;

int main(){

    //nが奇数ならn-1,n-3,..0,1,3...
    //nが偶数ならn-1,n-3,...1,0,2...のようにインデックスが並ぶ数列になる

    int n;
    cin >> n;

    vector<int> v;
    vector<int> ansv;

    rep(i,n){
        int tmp;
        cin >> tmp;
        v.pback(tmp);
    }

    if(n % 2 == 0){
        int index = n - 1;

        while(index != 1){
            ansv.pback(v[index]);
            index = index - 2;
        }

        ansv.pback(v[1]);
        ansv.pback(v[0]);

        index = 2;

        while(index <= n - 2){
            ansv.pback(v[index]);
            index = index + 2;
        }

    }else{

        int index = n - 1;

        while(index != 0){
            ansv.pback(v[index]);
            index = index - 2;
        }
        ansv.pback(v[0]);

        index = 1;

        while(index <= n - 2){
            ansv.pback(v[index]);
            index = index + 2;
        }        

    }

    rep(i,n){
        cout << ansv[i] << " ";
    }

    cout << endl;

    return 0;
}

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

using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

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

    string s1, s2;
    cin >> s1 >> s2;
    if (s1[0] == s2[2] && s1[1] == s2[1] && s1[2] == s2[0]) {
        cout << "YES" << "\n";
    } else {
        cout << "NO" << "\n";
    }


}




















Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define pq priority_queue
#define P pair<ll, ll>
#define P2 pair<int, P>
#define P3 pair<int, P2>
using namespace std;
typedef long long ll; typedef long double ld;
constexpr int gcd(int a, int b){return b ? gcd(b, a % b) : a;}
constexpr int lcm(int a, int b){return a / gcd(a, b) * b;}
constexpr int INF = 1e9, MOD = INF + 7, around[] = {0, 1, 1, -1, -1, 0, -1, 1, 0, 0};
constexpr int inv(const int x, int n, const int mod){ll ret=1,pos=x;while(n){if(n&1)(ret*=pos)%=mod;(pos*=pos)%=mod;n>>=1;}return ret;}
template<int n> struct Factorial{ll arr[n+1],ary[n+1];constexpr Factorial():arr(),ary(){arr[0]=1;ary[0]=1;for(int i=0;i<n;i++){arr[i+1]=arr[i]*(i+1)%MOD;ary[i+1]=inv(arr[i+1],MOD-2,MOD);}}};
constexpr Factorial<10> fact;
constexpr int comb(int a, int b){ll pos = fact.arr[a], pot = fact.ary[a - b], por = fact.ary[b];return pos * pot % MOD * por % MOD;}
constexpr int vx[] = {1, 0, -1, 0}, vy[] = {0, 1, 0, -1};
constexpr int sqrtN = 512, logN = 32;
constexpr ld PI = abs(acos(-1));
const ll LINF=1e18;

struct UnionFind{
	vector<int> data;
	
	UnionFind(int n){
		data.assign(n, -1);
	}
	
	void unite(int x, int y){
		x = find(x); y = find(y);
		if(x == y) return;
		if(data[x] > data[y]) swap(x, y);
		data[x] += data[y];
		data[y] = x;
	}
	
	int find(int k){
		if(data[k] < 0) return k;
		return data[k] = find(data[k]);
	}
	
	int size(int k){
		return -data[find(k)];
	}
	
	bool same(int x, int y){
		x = find(x); y = find(y);
		if(x == y) return true;
		return false;
	}
};

int n, a, b, dist, x[100010], y[100010];
ll li[100010];
UnionFind uf(100010);

void solve(int f){
	map<int, vector<pair<int, int>>> mp;
	for(int i = 0; i < n; i++) mp[x[i]].push_back({y[i], i});
	
	for(auto &s : mp) {
		vector<pair<int, int>> &ss = s.second;
		sort(ss.begin(), ss.end());
	}
	
	for(int i = 0; i < n; i++) {
		if(!mp.count(x[i] - dist)) continue;
		auto &s = mp[x[i] - dist];

		auto p = lower_bound(s.begin(), s.end(), make_pair(y[i] - dist - f, INF));
		auto q = lower_bound(s.begin(), s.end(), make_pair(y[i] + dist + f, -INF));
		li[i] += q - p;
		if(p != q) uf.unite(i, p->second);
	}
	
	for(int i = 0; i < n; i++) {
		if(!mp.count(x[i] + dist)) continue;
		auto &s = mp[x[i] + dist];

		auto p = lower_bound(s.begin(), s.end(), make_pair(y[i] - dist - f, INF));
		auto q = lower_bound(s.begin(), s.end(), make_pair(y[i] + dist + f, -INF));
		li[i] += q - p;
		if(p != q) uf.unite(i, p->second);
	}
}
		
signed main(){
	cin >> n >> a >> b; a--; b--;
	for(int i = 0; i < n; i++){
		int pos, pot; cin >> pos >> pot;
		x[i] = pos + pot;
		y[i] = pos - pot;
	}
	
	dist = max(abs(x[a] - x[b]), abs(y[a] - y[b])); solve(0);
	for(int i = 0; i < n; i++) swap(x[i], y[i]); solve(1);
	uf.unite(a, b); ll c = 0; int s = 0;
	for(int i = 0; i < n; i++) if(uf.find(a) == uf.find(i)) c += li[i];
	cout << c / 2LL << endl;
	return 0;
};


Measured memory_bytes: 13160
#include <bits/stdc++.h>
#define f(i,j,k) for(int i=j;i<k;i++)
#define f2(i,j,k) for(int i=j;i>k;i--)
using namespace std;
int main(){
    long long n,ans=0,a;
    cin>>n;
    f(i,0,n){
        cin>>a;
        ans+=a-1;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <numeric>
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG true
#define LL long long
#define Num 1000000007
// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;

int main(){
    int n;
    cin>>n;
    if(n%2==0) cout<<n<<endl;
    else cout<<n*2<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define MAX(a, b)  ((a > b) ? a : b)

void do_right(int v[], char s[], int idx, int n){
  while(idx < n && s[idx + 1] == '<'){
    v[idx + 1] = MAX(v[idx] + 1, v[idx + 1]);
    idx += 1;
  }
}

void do_left(int v[], char s[], int idx, int n){
  while(idx >= 0 && s[idx] == '>'){
    v[idx - 1] = MAX(v[idx] + 1, v[idx - 1]);
    idx -= 1;
  }
}

int main(){
  char s[500002];
  fgets(&s[1], 500000, stdin);
  s[0] = '>';
  int n = strlen(s);
  while(s[n - 1] != '>' && s[n - 1] != '<'){
    n -= 1;
  }
  
  s[n] = '<';
  s[n + 1] = '\0';
   
  int v[n] = {0};
  
  for(int i = 0; i < n + 1; i++){
    if(s[i] == '>' && s[i + 1] == '<'){
      v[i] = 0;
      do_right(v, s, i, n);
      do_left(v, s, i, n);
    }
  } 

  //for(int i = 0; i < n; i++){
  //  printf("%d,", v[i]);
  //}
  //printf("\n");

  long x = 0;
  for(int i = 0; i < n; i++){
    x += v[i];
  }
  printf("%ld\n", x);
}


Measured memory_bytes: 2560
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cmath>
#include <stack>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}

const long long MOD = 1000000007;

int main(){
  ll n, k;
  cin>>n>>k;
  vector<pair<ll,ll>> v(n);
  rep(i,n) {
    ll a, b;
    cin>>a>>b;
    v[i] = make_pair(a,b);
  }
  sort(v.begin(), v.end());
  ll cnt = 0;
  rep(i,n) {
    cnt += v[i].second;
    if(k<=cnt) {
      std::cout << v[i].first << std::endl;
      break;
    }
  }
  
  
  return 0;
}


Measured memory_bytes: 1792
import math
import sys
import random
from operator import itemgetter
input = sys.stdin.readline

# a = int(input().rstrip())
# a, b = map(int, input().rstrip().split())
# D = list(map(int, input().rstrip().split()))
# H = [int(input().rstrip()) for _ in range(L)]
# DD = [[0 for j in range(100)] for i in range(200)]
# dict = {} ## dictionary

# a = sorted(a, key=lambda x: x[1]))
# if __name__ == '__main__':


N, M = map(int, input().rstrip().split())
ans = []
for i in range(M):
	ans.append(i+1)
ans_set = set(ans)

for i in range(N):
	tmp = list(map(int, input().rstrip().split()))
	ans_set = ans_set & set(tmp[1::])
print(len(ans_set))


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

using namespace std;

typedef long long LL;

const int maxn=100000;
const int INF=0x3f3f3f3f;
const int MOD=1e9+7;

struct Point{
	int x,y;
};

int fac[maxn*2+5];

void pre(){
	fac[0]=1;
	for(int i=1;i<=maxn*2;i++){
		fac[i]=1ll*fac[i-1]*i%MOD;
	}
}

LL q_pow(LL x,LL k){
	LL r=1,base=x%MOD;
	while(k){
		if(k&1)r*=base,r%=MOD;
		base*=base,base%=MOD;
		k>>=1;
	}
	return r;
}

LL Cal(Point a,Point b){
	int disx=abs(a.x-b.x),disy=abs(a.y-b.y);
	int dis=disx+disy;
	return 1ll*fac[dis]*q_pow(1ll*fac[disx]*fac[disy],MOD-2)%MOD;
}

int main()
{
	int H,W,A,B;
	scanf("%d%d%d%d",&H,&W,&A,&B);
	pre();
	LL ans=0;
	for(int i=1;i<=H-A;i++){
		ans+=Cal((Point){1,1},(Point){i,B})*Cal((Point){i,B+1},(Point){H,W})%MOD,ans%=MOD;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
class c{
    public static void Main(){
        string[] str = Console.ReadLine().Split(' ');
        int[] a = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        int n = int.Parse(str[0]);
        int k = int.Parse(str[1]);
        for(int i=0; i<n-k; i++){
            if(a[i] < a[i+k]){
                Console.WriteLine("Yes");
            }
            else{
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 44208
#include<bits/stdc++.h>
using namespace std;
#define N 1111116
#define K 20
int n,m,v,a[N],l[N][K],r[N][K],f[N],g[N],h[N];

int read(){
	int x=0,f=1;char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-') f=-f;
	for (;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
	return x*f;
}

int main(){
	n=read();v=read();
	for (int i=1;i<=n;i++) a[i]=read();
	while (true){
		l[1][m]=1;r[n][m]=n;
		l[0][m]=1;r[n+1][m]=n;
		for (int i=2;i<=n;i++)
			l[i][m]=(a[i]-a[i-1]<=v)?l[i-1][m]:i;
		for (int i=n-1;i>=1;i--)
			r[i][m]=(a[i+1]-a[i]<=v)?r[i+1][m]:i;
		m++;if (!v) break;v/=2;
	}
	fill(g,g+(1<<m),n+1);
	for (int i=2;i<(1<<m);i+=2)
		for (int j=1;j<m;j++)
			if (i&(1<<j))
			f[i]=max(f[i],r[f[i-(1<<j)]+1][j]),
			g[i]=min(g[i],l[g[i-(1<<j)]-1][j]);
	fill(h,h+n+1,0x3fffffff);
	for (int i=0;i<(1<<m);i+=2)
		h[f[i]]=min(h[f[i]],g[(1<<m)-2-i]);
	for (int i=n-1;i>=0;i--)
		h[i]=min(h[i],h[i+1]);
	for (int i=1;i<=n;i++)
		printf((h[l[i][0]-1]<=r[i][0]+1)?"Possible\n":"Impossible\n");
	return 0;
}

Measured memory_bytes: 48256
cnt = [0]*4
for i in range(3):
    a,b = map(int,input().split())
    cnt[a-1] += 1
    cnt[b-1] += 1
if cnt[0] == 1 and cnt[1] == 2 and cnt[2] == 2 and cnt[3] == 1:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 9040
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(), a.end()
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T, v(T), greater<T>>
#define bn(x) ((1 << x) - 1)
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int mod = 1000000007;

int main(){
    string s;
    cin >> s;
    if(s[2]==s[3] && s[4]==s[5]) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#define rep(i,n)for(int i=1;i<n;i++)
typedef long long ll;
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector< vector<int> >g(n + 1, vector<int>(n + 1, 0));
    rep(i, n + 1)
    {
        int u, k;
        cin >> u >> k;
        rep(j,k+1)
        {
            int v;
            cin >> v;
            g[u][v] = 1;
        }
    }
    rep(i, n + 1)
    {
        rep(j, n + 1)
        {
            cout << g[i][j];
            if(j!=n)cout<<" ";
        }
        cout << endl;
    }
    return 0;
}



Measured memory_bytes: 3156
#include <iostream>
using namespace std;
int main(void){
    int n, num;
    char mark;
    int s[13]{}, h[13]{}, c[13]{}, d[13]{};
    
    cin >> n;
    
    for(int i=0; i < n; i++){
        cin >> mark >> num; 
        if(mark == 'S')
            s[num-1] = 1;
        if(mark == 'H')
            h[num-1] = 1;
        if(mark == 'C')
            c[num-1] = 1;
        if(mark == 'D')
            d[num-1] = 1;
    }
    
    for(int i=0; i < 13; i++){
        if(s[i] == 0)
            cout << "S " << i+1 << endl; 
    }
    for(int i=0; i < 13; i++){
        if(h[i] == 0)
            cout << "H " << i+1 << endl; 
    }
    for(int i=0; i < 13; i++){
        if(c[i] == 0)
            cout << "C " << i+1 << endl; 
    }
    for(int i=0; i < 13; i++){
        if(d[i] == 0)
            cout << "D " << i+1 << endl; 
    }


    return 0;
}



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

#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef long long ll ;
typedef unsigned long long ull ;
typedef long double ld ;

const ll MOD = 998244353, INF = 2E18 + 5 ;
const double PI = 2 * acos(0.0) ;
const long double EPS = 1.0E-14 ;

int main()
{
    string s ;
    cin >> s ;
    if (s == "ARC") cout << "ABC" ;
    else if (s == "ABC")    cout << "ARC" ;

    return 0 ;
}


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

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if((a<=b)&&(b<=c)){
        cout<<a<<" "<<b<<" "<<c<<endl;
    }else if((a<=c)&&(c<=b)){
        cout<<a<<" "<<c<<" "<<b<<endl;
    }else if((b<=c)&&(c<=a)){
        cout<<b<<" "<<c<<" "<<a<<endl;
    }else if((b<=a)&&(a<=c)){
        cout<<b<<" "<<a<<" "<<c<<endl;
    }else if((c<=a)&&(a<=b)){
        cout<<c<<" "<<a<<" "<<b<<endl;
    }else if((c<=b)&&(b<=a)){
        cout<<c<<" "<<b<<" "<<a<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 3072
import math
H,W = map(int, input().split())
y_list = [0] * H
x_list = [0] * W
val_list = [[0 for i in range(W)] for j in range(H)]
for i in range(H):
    tmp_list = list(map(int, input().split()))
    y_list[i] = sum(tmp_list)
    for j in range(W):
        x_list[j] += tmp_list[j]
        val_list[i][j] = tmp_list[j]


min_val = math.inf
for y_loc in range(H):
    for x_loc in range(W):
        wa = 0
        for i in range(H):
            y_weight = abs(i - y_loc)
            for j in range(W):
                x_weight = abs(j - x_loc)
                if y_weight > x_weight:
                    wa += x_weight * val_list[i][j]
                else:
                    wa += y_weight * val_list[i][j]
        min_val = min(min_val, wa)
print(min_val)


Measured memory_bytes: 5676
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;
const int MAX_A=1e5;
int N,cnt[MAX_A];
int main(){
	cin>>N;
	REP(i,N){
		int a;
		cin>>a;
		cnt[a]++;
	}
	int ans=0;
	FOR(x,1,MAX_A-1){
		ans=max(ans,cnt[x-1]+cnt[x]+cnt[x+1]);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(a) a.begin(),a.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;




int main() {
  char c;
  cin >> c;
  if(c >= 'a' && c <= 'z') cout << 'a' << endl;
  else cout << 'A' << endl;

  return 0;
}










Measured memory_bytes: 3064
using System;
class OrdNum{
	static void Main(string[] args){
		int n = int.Parse(Console.ReadLine());
		string[] pi = Console.ReadLine().Split(' ');
		int[] p = new int[n];
		for(int i = 0;i < n;i++){
			p[i] = int.Parse(pi[i]);
		}
		int Ans = 0;
		for(int i = 0;i < n - 2;i++){
			if((p[i] <= p[i+1] && p[i+1] <= p[i+2]) || (p[i] >= p[i+1] && p[i+1] >= p[i+2])) Ans++;
		}
		Console.WriteLine(Ans);
	}
}

Measured memory_bytes: 13140
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <cctype>
#include <tuple>
#include <array>
#include <climits>
#include <bitset>
#include <cassert>
#include <ctime>
#include <list>
#ifdef _MSC_VER
#include <agents.h>
#endif

#define FOR(i, a, b) for(int i = (a); i < (int)(b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define REV(v) v.rbegin(), v.rend()
#define MEMSET(v, s) memset(v, s, sizeof(v))
#define UNIQUE(v) (v).erase(unique(ALL(v)), (v).end())
#define MP make_pair
#define MT make_tuple

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

const ll INF = 1e7;

struct Tree{
	ll repeat, period;
	char c;
	vector<Tree> ch;

	Tree(string s, int _repeat) : repeat(_repeat){
		if (s.size() == 1){
			period = 1;
			c = s[0];
			return;
		}

		int nest = 0, cnt = 0, l;
		rep(i, s.size()){
			char c = s[i];
			if (isalpha(c)){
				if (!nest){
					ch.push_back(Tree(s.substr(i, 1), max(1, cnt)));
					cnt = 0;
				}
			}
			else if (c == '('){
				if (!nest++){
					l = i + 1;
				}
			}
			else if (c == ')'){
				if (!--nest){
					ch.push_back(Tree(s.substr(l, i-l), cnt));
					cnt = 0;
				}
			}
			else if(!nest) cnt = cnt * 10 + c - '0';
		}

		period = 0;
		for (auto &t : ch){
			period += t.period*t.repeat;
			period = min(period, INF);
		}
		//cout << s << ' ' << period << endl;
	}

	char get(int x){
		if (ch.empty() && !x) return c;
		for (auto &t : ch){
			if (x < t.period*t.repeat) return t.get(x%t.period);
			x -= t.period*t.repeat;
		}
		return '0';
	}
};

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


	string s;
	int x;
	while (cin >> s >> x, s != "0"){
		Tree t(s, 1);
		cout << t.get(x) << '\n';
	}



	return 0;
}

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

ll func(int n)
{
    if (n % 2 == 0)
        return n / 2;
    return 3 * n + 1;
}

int main()
{
    ll S;
    cin >> S;
    map<ll, int> m;
    m[S] = 1;
    FOR(i, 1000001, 2)
    {
        S = func(S);
        if (m[S] > 0)
        {
            cout << i << endl;
            break;
        }
        m[S] = 1;
    }
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
input = sys.stdin.readline

a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())

dist = abs(a - b)
if w >= v:
    print("NO")
    exit()
diff = v - w
if t * diff >= dist:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 61636
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>
#include<bitset>
#include<cassert>
 
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()
 
using namespace std;
using ll = long long int;
 
const int inf = 1001001000;
const long long int Inf = 1001001001001001000;
 
template<typename T>
void print1d(vector<T> a){
    for (auto x:a){
        cout << x << " ";
    }
    cout << endl;
}
 
template<typename T>
void print2d(vector<vector<T>> a){
	for (auto v:a){
		for (auto x:v){
			cout << x << " ";
		}
		cout << endl;
	}
}

template<typename T>
void print(T a){
	for (auto x:a){
		cout << x << " ";
	}
	cout << endl;
}

int main()
{
	int n;
	string s;
	cin >> n >> s;
	vector<int> a(3);
	
	int ans = 0;
	rep(i, 1000)
	{
		a[0] = i / 100;
		a[1] = (i / 10) % 10;
		a[2] = i % 10;
		int f = 0;
		rep(j, n)
		{
			if(a[f] + '0' == s[j]){
				f++;
			}
			if(f==3)
				break;
		}
		if(f==3)
			ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3676
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<ll>;
using vii = vector<vi>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const int INF = 2e9;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
    ll n,m;
    cin >> n >> m ;
    vi x(m);
    vi y(m);
    y[0] = -10007;
    rep(i, m){
        cin >> x[i];
    }
    sort(all(x));
    for (ll i = 1; i < m;i++){
        y[i] = x[i] - x[i - 1];
    }
        sort(all(y));
    if (n >= m){
        print(0);
    }
    else{
        ll k = n- 1;
        ll total = x[m - 1] - x[0];
        for (ll i = m - 1; i >= m - k; i--){
            total -= y[i];
        }
        print(total);
    }
}

Measured memory_bytes: 1792
//#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <bits/stdc++.h>
using namespace std;

#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;

#define boost ios::sync_with_stdio(0); cin.tie(0)

#define fi first
#define se second

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

const int N = 1e6 + 5;

/***************************************************************************/

int A[N];

int main() {

	boost;
	int all = (1 << 20) - 1;

	int n; cin>>n;
	for(int i=1; i<=n; i++) {
		cin>>A[i];
	}

	int la = 1, ra = 0;
	int cur = 0;

	ll ans = 0;

	while(la <= n) {

		while((ra == n and la <= n) or (cur & A[ra+1])) {
			ans += ra - la + 1;
			cur &= A[la] ^ all;
			la++;
		}
		ra++;
		cur |= A[ra];
	}

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

Measured memory_bytes: 1024
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<bitset>
#include<iomanip>
#include<list>
#include <numeric>
using namespace std;
typedef unsigned long long int ulint;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define RE return 0
//ios::sync_with_stdio(false);
//std::cin.tie(0);
//<< setprecision(20)
const int mod=(int)1e9+7;
const llint big=(llint)(2.19e15+1);
const long double pai=3.141592653589793238462643383279502884197;
const long double ena=2.71828182845904523536;
const long double eps=1e-7;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
template <class T> void soun(T& ar)
{sort(ar.begin(),ar.end());ar.erase(unique(ar.begin(),ar.end()),ar.end());}
llint gcd(llint a,llint b){if(a%b==0){return b;}else{return gcd(b,a%b);}}
llint lcm(llint a,llint b){return a/gcd(a,b) *b;}
template<class T,class U> auto LB(T& ve,U in){return lower_bound(ve.begin(),ve.end(),in);}
template<class T,class U> auto UB(T& ve,U in){return upper_bound(ve.begin(),ve.end(),in);}
template<class T,class U> auto LBI(T& ve,U in){return LB(ve,in)-ve.begin();}
template<class T,class U> auto UBI(T& ve,U in){return UB(ve,in)-ve.begin();}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
int main(void){
	cout<<setprecision(20);
	int n,i;cin>>n;
	lldo ar[100];
	lldo br[100];
	for(i=0;i<n;i++){cin>>ar[i];}
	for(i=0;i<n;i++){cin>>br[i];}
	lldo q=0,w=0,e=0,r=0;
	for(i=0;i<n;i++){
		lldo d=abs(ar[i]-br[i]);
		q+=d;
		w+=d*d;
		e+=d*d*d;
		maxeq(r,d);
	}
	cout<<q<<endl;
	cout<<pow(w,0.5)<<endl;
	cout<<pow(e,0.3333333333)<<endl;
	cout<<r<<endl;
	RE;
}


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

vector<int>G[100010];
ll dp[100010][2];

// {white, black} : 0, 1

ll dfs(int u, int p, int color) {
    ll &ret = dp[u][color];
    if(ret != -1)
        return ret;
    ret = 1;

    //cerr << u << " " << p << " " << color << endl;
    for(auto v : G[u])
        if(v != p) {
            ll tmp = dfs(v, u, 0);
            //cerr << u << " " << color << " " << v << " 0 in " << dfs(v, u, 0) << " ways\n";  
            if(color == 0) {
                tmp = (tmp + dfs(v, u, 1))%MOD;
                //cerr << u << " " << color << " " << v << " 1 in " << dfs(v, u, 1) << " ways\n";
            }

            ret = (ret * tmp)%MOD;
        }

    return ret;
}

int main() {
    int n, u, v;
    cin >> n;
    for(int i = 1; i < n; ++i) {
        cin >> u >> v;
        G[u].push_back(v);
        G[v].push_back(u);
    }

    memset(dp, -1, sizeof dp);
    cout << (dfs(1, 0, 0) + dfs(1, 0, 1))%MOD << endl;
    return 0;
}

Measured memory_bytes: 15616
#include <iostream>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#define ll long long int
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
void print(vector<vector<ll> >&v)
{
    ll n=v.size();
    ll m=v[0].size();
    cout<<"\n";
    for(ll i=0;i<n;i++)
    {
        for(ll j=0;j<m;j++)
            cout<<v[i][j]<<" ";
        cout<<"\n";
    }
}
void print(vector<ll>&v)
{
    ll n=v.size();
    cout<<"\n";
    for(ll i=0;i<n;i++)
    {
            cout<<v[i]<<" ";
    }
        cout<<"\n";

}
void print(set<ll>&s)
{

cout<<endl;

set<ll>::iterator it;
for(it=s.begin();it!=s.end();it++)
    cout<<*it<<" ";
cout<<endl;
}

const int mod=1e9+7;
ll power(ll a,ll p)
{
    ll res=1;
    while(p>0)
    {
        if(p&1)
            res=(res*a)%mod;
            p--;

            a=(a*a)%mod;
            p=p>>1;
    }

    return res;


}

void solve(){
ll n,a,b;
cin>>n;
cin>>a>>b;
ll res=b/n;
if(res*n>=a)
    cout<<"OK";
else
    cout<<"NG";

}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll t=1;
//	ll i=1;
//	cin >> t;
	while(t--){
//    cout<<"Case #"<<i<<": ";
		solve();


//i++;
	}
	return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define rrep(i, n, g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define len(x) (int)(x).size()
#define dup(x, y) (((x) + (y)-1) / (y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int a, b;
  cin >> a >> b;
  cout << (a + b) % 24 << endl;
}

Measured memory_bytes: 3632
N = int(input())
K = int(input())
x = list(map(int, input().split()))

a = 0 # aはタイプBからボールまでの距離

ans = 0

for i in range(N):

    if K>x[i]:
        a = K - x[i]
    else:
        a = x[i] - K
    
    if x[i]<a:
        ans += x[i]
    else:
        ans += a

print(str(ans * 2))        


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

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

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  int H,W;
  cin>>H>>W;
  vector<string>a(H);
  for(int i=0;i<H;i++)cin>>a[i];
  vector<vector<int>>dp(H,vector<int>(W,0));
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(i==0&&j==0)dp[0][0]=1;
      if(a[i][j]=='.'){
        if(i-1>=0)dp[i][j]=(dp[i][j]+dp[i-1][j])%MOD;
        if(j-1>=0)dp[i][j]=(dp[i][j]+dp[i][j-1])%MOD;
      }
    }
  }
  cout<<dp[H-1][W-1]%MOD<<endl;
  return 0;
} 


Measured memory_bytes: 5248
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>

using std::cerr;
using std::cin;
using std::cout;
using std::endl;

int main(){
  cout << std::fixed << std::setprecision(16);
  cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  int64_t h,w,n;
  cin>>h>>w>>n;
  std::vector<std::pair<int64_t,int64_t>> pos;
  for(int i=0;i<n;i++){
    int a,b;
    cin>>a>>b;
    for(int vr=-1;vr<=1;vr++){
      for(int vc=-1;vc<=1;vc++){
        if(1<=vr+a&&vr+a<=h&&1<=vc+b&&vc+b<=w){pos.push_back(std::make_pair(vr+a,vc+b));}

      }
    }
  }

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

  int64_t result[10]={};
  int64_t count=0;
  int64_t cum=0;
  for(int i=0;i<pos.size();i++){
    if(2<=pos[i].first&&pos[i].first<=h-1&&2<=pos[i].second&&pos[i].second<=w-1){
      int64_t count=0;
      int64_t itr=i;
      while(itr<pos.size()&&pos[i]==pos[itr]){
        itr++;
        count++;
      }
      assert(count<=9);
      result[count]++;
      i=itr-1;
      cum++;

    }

  }

  result[0]=std::max((h-2)*(w-2)-cum,0l);


  for(auto v:result){
    cout<<v<<endl;
  }



  return 0;
}

Measured memory_bytes: 18280
#include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;
typedef long long ll;
int n;

bool check(ll num){
	ll a[3]={};
	while(num>0){
		if(num%10==3)a[0]++;
		if(num%10==5)a[1]++;
		if(num%10==7)a[2]++;
		num/=10;
	}
	if(a[0]>=1&&a[1]>=1&&a[2]>=1)return true;
	else return false;
}

ll func(ll num){
	ll res=(check(num)?1:0);
	if(num*10+3<=n)res+=func(num*10+3);
	if(num*10+5<=n)res+=func(num*10+5);
	if(num*10+7<=n)res+=func(num*10+7);
	return res;
}

int main(){
	cin>>n;
	cout<<func(0)<<endl;
	return 0;
}

Measured memory_bytes: 384
s = gets.chomp.split('')
k = gets.chomp.to_i

def c(a)
  arr = []
  count = 0
  a.size.times do |t|
    if t > 0 && a[t] != a[t-1]
      arr.push(count)
      count = 1
    else
      count += 1
      arr.push(count) if t == a.size - 1
    end
  end
  ans = 0
  arr.each do |i|
    ans += i / 2
  end
  ans
end

if s.all? { |t| t == s[0] } # 全部一緒
  p (s.size * k) / 2
  exit
elsif s.first == s.last
  f_ind = nil
  1.upto(s.size - 1) do |i|
    if s.first != s[i]
      f_ind = i
      break
    end
  end
  new_arr = s[f_ind..s.size-1] + s[0...f_ind]
  p (f_ind / 2) + c(new_arr) * (k-1) + c(s[f_ind..s.size-1])
  exit
else
  p c(s) * k
end

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int ans=0;
    int n;scanf("%d",&n);
    int mn=n;
    for(int i=1;i<=n;i++)
    {
        int x;scanf("%d",&x);
        mn=min(mn,x);
        if(mn>=x) ans++;
    }
    printf("%d\n",ans);
}


Measured memory_bytes: 384
//
//  main.cpp
//  CoderProj
//
//  Created by Minoru Hayashi on 2020/04/04.
//  Copyright © 2020 Minoru Hayashi. All rights reserved.
//
//  ABC162
//
//

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

#define REP(i,n) for (int i=0; i<(n); i++)
#define REP2(i,x,n) for (int i=x; i<(n); i++)
#define ALL(n) begin(n), end(n)

using ll = long long;

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;}

// const ll INF = 1LL<<60;
// const int INF = 1<<29;
// const ll MOD = 1000000007;
//#define __DBG__

void solve(void){
  
  int N;
  ll ans=0;
  
  cin >> N;
  
  REP2(i,1,N+1){
    if(i%3==0 || i%5==0){
      ans+=0;
    }
    else
    {
      ans +=i;
    }
  }
 
  cout << ans <<endl;
   
  
  return;
   
}



#define TESTCASES 1

int main(int argc, const char * argv[]) {

    cin.tie(0);
    ios::sync_with_stdio(false);

    REP(i,TESTCASES){
      solve();
    }
 
    return 0;
}



Measured memory_bytes: 3652
#include<stdio.h>
int main(void)
{
    int a,b;
    
    scanf("%d",&a);
    scanf("%d",&b);
    
    if(a<b){
        printf("a < b\n");
    }
    else if(a>b){
        printf("a > b\n");
    }
    else{
        printf("a == b\n");
    }
    
    return 0;
}


Measured memory_bytes: 2064
<?php

$line = explode(' ', fgets(STDIN));

$A = (int)$line[0];
$B = (int)$line[1];
$C = (int)$line[2];
$K = (int)$line[3];

if($A > $K){
  echo $K; 
}else if($A >= $K || $A + $B >= $K){
  echo $A;
}else {
  echo $A - ($K - ($A + $B));
}


Measured memory_bytes: 16152
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    n = int(input())
    A = list(map(int, input().split()))
    s = sum(A)

    if n == 0:
        print(1 if A[0] == 1 else -1)
        return

    if A[0] != 0:
        print(-1)
        return

    not_leaf = 1
    # check
    for d in range(n + 1):
        if not_leaf < A[d]:
            print(-1)
            return
        not_leaf -= A[d]
        not_leaf *= 2

    res = 0
    not_leaf = 1
    count = 1 # 枝分かれの個数、最大 s
    for d in range(n + 1):
        not_leaf -= A[d]
        # 最大で not_leaf 個、枝分かれを増やせる
        add = min(s - count, not_leaf)
        count += add
        not_leaf += add
        res += not_leaf
        # print(d, add)

    print(res + 1)
resolve()

Measured memory_bytes: 83568
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i=a; i<n; i++)
#define RREP(i, a, n) for(ll i=n-1; i>=a; i--)
typedef long long ll;
const ll mod =1e9+7;
const ll inf =1e18;
using namespace std;

ll a, b, k;
int main() {
    cin>>a>>b>>k;

    if(a<k){
        k-=a;
        a=0;
    }
    else{
        a-=k;
        k=0;
    }

    if(b<k){
        b=0;
    }
    else{
        b-=k;
    }
    cout<<a<<" "<<b<<endl;
    return 0;
}

Measured memory_bytes: 256
//{{{
#include<algorithm>
#include<cmath>
#include<deque>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(printde) FUNC(printdbe) FUNC(printdwe) FUNC(printdu) FUNC(printe) FUNC(printe0);
#endif
template <template <class T, class = std::allocator<T>> class V, class E>
istream& operator >> (istream& in, V<E>& v){ for(auto& e : v){ in >> e; } return in; }
//}}}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    string s, t;
    cin >> s >> t;
    int ans = 0;
    for(int i = 0; i < (int)s.size(); i++){
        ans += s[i] != t[i];
    }
    cout << ans << '\n';
}


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

int main() {
    int a, b;
    cin >> a >> b;
    string s;
    cin >> s;
    
    int hinum = 0;

    rep(i, s.size()) if(s[i] == '-') hinum++;

    if(hinum != 1) cout << "No" << endl;
    else {
        if(s[a] == '-') cout << "Yes" << endl;
        else cout << "No" << endl;
    }

  	return 0;
}


Measured memory_bytes: 256
n, m = gets.chomp.split(" ").map(&:to_i)
arr = Array.new(m+1,0)
n.times do |i|
    a = gets.chomp.split(" ").map(&:to_i)
    ni = a.shift
    a.each do |j|
        arr[j] += 1
    end

end
#p arr
count = 0
arr.each do |l|
    if l == n
        count += 1
    end
end
puts count

Measured memory_bytes: 14244
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
int main()
{
    int i,j,k,l,m,n;
    cin>>m>>n;
    char s[100],s1[100];
     char a=m+48;
    for(i=0;i<n;i++)
    {

        s[i]=a;
    }
    s[n]='\0';
    char b=n+48;
    for(i=0;i<m;i++)
    {

        s1[i]=b;
    }
    s1[m]='\0';
    if( lexicographical_compare(s, s+n, s1, s1+m))
    {
        cout << s;

    }
    else
    {
        cout << s1;

    }


}


Measured memory_bytes: 256
import java.util.Scanner;

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

        if (N < 10) {
            R = R + 100 * (10 - N);
        }
        System.out.println(R);
    }
}

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,M; cin >> N >> M;
    vector<pair<int,int>> AB(N);
    for (int i=0;i<N;++i) cin >> AB[i].first >> AB[i].second;
    sort(AB.begin(),AB.end());
    vector<int> A(N),B(N+1,0);
    for (int i=0;i<N;++i) A[i]=AB[i].first,B[i]=AB[i].second;
    for (int i=N-1;i>0;--i) B[i]^=B[i-1];
    for (int i=0;i<N;++i) B[N]^=B[i];
    vector<int> L(M),R(M);
    vector<vector<pair<int,int>>> G(N+1);
    for (int i=0;i<M;++i){
        cin >> L[i] >> R[i];
        L[i]=lower_bound(A.begin(),A.end(),L[i])-A.begin();
        R[i]=upper_bound(A.begin(),A.end(),R[i])-A.begin();
        G[L[i]].emplace_back(R[i],i);
        G[R[i]].emplace_back(L[i],i);
    }
    vector<int> seen(N+1,0),used(M,0);
    int whole;
    auto dfs=[&](auto self,int v,int num)->void{
        seen[v]=1; whole^=B[v];
        int now=1;
        for (auto e:G[v]){
            int u=e.first,id=e.second;
            if (seen[u]) continue;
            used[id]=1;
            self(self,u,id);
            now^=used[id];
        }
        if (~num&&B[v]!=now) used[num]^=1;
    };
    for (int i=0;i<N+1;++i) if (!seen[i]){
        whole=0; dfs(dfs,i,-1);
        if (whole){cout << -1 << '\n'; return 0;}
    }
    vector<int> ans;
    for (int i=0;i<M;++i){
        if (used[i]){
            ans.emplace_back(i+1);
        }
    }
    int s=ans.size();
    cout << s << '\n';
    for (int i=0;i<s;++i) cout << ans[i] << (i+1==s?"":" ");
    cout << '\n';
}

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

namespace abc139
{
    class Program
    {

        public static int hantei(int x, int y)
        {
            int count = 0;
            for (int i = 1; i < y; i = i + x - 1)
            {
                count += 1;
            }
            return count;
        }

        static void Main(string[] args)
        {
            string[] P = Console.ReadLine().Split(' ');
            int A = int.Parse(P[0]);
            int B = int.Parse(P[1]);
            Console.WriteLine(hantei(A, B));
            Console.Read();
        }
    }
}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int sum=0,rem=0;
	for(int i=0;i<5;++i){
		int a; cin>>a;
		int e=10-a%10;
		sum+=a;
		if(e!=10){
			rem=max(rem,e);
			sum+=e;
		}
	}
	cout<<sum-rem<<"\n"s;
}


Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;

class Program{

  static int n = 0;
  static char[] s;
  static int cnt = 0;

  static int Main() {

    string nyu = Console.ReadLine();
    n = int.Parse(nyu);

    string nya = Console.ReadLine();
    s = nya.ToCharArray();

    for (int i = 0; i < n; i++) {
      if (s[i] == 'R') {
        cnt++;
      }
    }

    if (cnt > s.Length/2) {
      Console.WriteLine("Yes");
    } else {
      Console.WriteLine("No");
    }

    return 0;
  }


}


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



int main(void){
    int x1,y1,x2,y2;
    cin>>x1>>y1>>x2>>y2;
    int dist_x=x2-x1;
    int dist_y=y2-y1;
    cout<<x2-dist_y<<" "<<y2+dist_x<<" "<<x1-dist_y<<" "<<y1+dist_x<<endl;
    return 0;
}



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

using namespace std;
typedef long long ll;
int main(){
    
    ll N,T;
    ll t[200005] = {};

    cin>>N>>T;
    for(int i=0;i<N;i++){
        cin >> t[i];
    }
    ll ans = 0;
    for (int i = 1; i < N; i++){
        if(t[i]-t[i-1]<T)
            ans += t[i] - t[i - 1];
        else
            ans += T;
    }
    ans += T;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
let levenshtein_distance (x, y) =
  if x = y then 0
  else begin
    let m = String.length x in
    let n = String.length y in
    if m = 0 then n
    else if n = 0 then m
    else begin
      let s = Array.init (n + 1) (fun i -> i) in
      let t = Array.make (n + 1) 0 in
      for i = 0 to m - 1 do
        t.(0) <- i + 1;
        for j = 0 to n - 1 do
          t.(j+1) <- min (s.(j) + (if x.[i] = y.[j] then 0 else 1)) (min t.(j) s.(j+1) + 1);
        done;
        Array.iteri (fun i e -> s.(i) <- e) t;
      done;
      t.(n)
    end
  end

let () =
  Scanf.scanf "%s %s " (fun x y -> x, y)
  |> levenshtein_distance
  |> Printf.printf "%d\n"

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

void solve(double a[], int n) {
	double dp[n+1][n+1];
	memset(dp, 0.0, sizeof(dp));

	dp[0][0] = 1.0;

	for(int i = 1; i <= n; i++) {
		for(int j = 0; j <= i; j++) {
			if(j == 0) {
				dp[i][j] = dp[i-1][j]*(1.0 - a[i]);
			}
			else {
				dp[i][j] = dp[i-1][j] * (1.0 - a[i]) + dp[i-1][j-1] *a[i];
			}
		}
	}

	double sum = 0.0;
	for(int i = (n+1)/2; i<=n; i++) {
		sum+=dp[n][i];
	}

	printf("%.10f",sum);
	// for(int i=0; i<=n; i++) {
	// 	for(int j =0; j<=n; j++) {
	// 		cerr<<dp[i][j]<<" ";
	// 	}
	// 	cerr<<"\n";
	// }
}

//Driver code
int main() {
	/*freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error", "w", stderr);*/
    int n;
    cin>>n;
    double a[n+1];
    for(int i=1; i<=n; i++) {
    	cin>>a[i];
    }
    solve(a, n);

}


Measured memory_bytes: 74096