akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>

int main(void) {
	long long int a;
	float b;
	scanf("%lld %f",&a,&b);
	//printf("%lld\n",a);
	//printf("%lf\n",b);
	printf("%lld",(a*(int)(100*b+0.5))/100);
	return 0;
}


Measured memory_bytes: 1740
#include <stdio.h>
#include <vector>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>
 
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef pair<int, int> pi;


int main() {
  int n, r;
  cin >> n >> r;
  if (n < 10) r += 100 * (10 - n);
  cout << r << endl;
  return 0;
}

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

A = sorted(A,reverse = True)
prime = [0] * (10**6+1)
eratos = [True] * (A[0] + 1)
D = [0] * (A[0]+1)
D[1] = 1
for i in range(2,A[0] + 1):
  if not eratos[i]:
    continue
  else:
    for j in range(i,A[0] + 1,i):
      if not D[j]:
        D[j] = i
      if j!=i:
      	eratos[j] = False
  
for a in A:
  while a!=1:
    x = D[a]
    while a%x==0:
      a//=x
    prime[x] += 1

if max(prime)<=1:
  print('pairwise coprime')
  
elif max(prime)!=N:
  print('setwise coprime')
else:
  print('not coprime')

Measured memory_bytes: 212764
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
struct UnionFind
{
    vector<ll> par;
    vector<ll> rank;
    vector<ll> sz;
    UnionFind(ll n) : par(n), rank(n), sz(n)
    {
        for(ll i = 0; i < n; i++)
        {
            par[i] = i;
            rank[i] = 0;
            sz[i] = 1;
        }
    }
    ll root(ll x)
    {
        if(par[x] == x) return x;
        else return par[x] = root(par[x]);
    }
    void unite(ll x, ll y)
    {
        x = root(x);
        y = root(y);
        if(x == y) return;
        if(rank[x] < rank[y])
        {
            par[x] = y;
            sz[y] += sz[x];
        }
        else
        {
            par[y] = x;
            sz[x] += sz[y];
            if(rank[x] == rank[y]) rank[x]++;
        }
    }
    bool same(ll x, ll y)
    {
        return root(x) == root(y);
    }
    ll size(ll x)
    {
        x = root(x);
        return sz[x];
    }
};
struct edge {ll u, v, cost;};
bool comp(const edge& e1, const edge& e2)
{
    return e1.cost < e2.cost;
}
int main()
{
    int n;
    cin >> n;
    vector<P> vx(n);
    vector<P> vy(n);
    for(int i = 0; i < n; i++)
    {
        int x, y;
        cin >> x >> y;
        vx[i] = P(x, i);
        vy[i] = P(y, i);
    }
    sort(vx.begin(), vx.end());
    sort(vy.begin(), vy.end());

    // kruscal start
    vector<edge> es;

    // set es
    for(int i = 0; i < n-1; i++)
    {
        int xcost = vx[i+1].first - vx[i].first;
        int ycost = vy[i+1].first - vy[i].first;
        es.push_back(edge{vx[i].second, vx[i+1].second, xcost});
        es.push_back(edge{vx[i+1].second, vx[i].second, xcost});
        es.push_back(edge{vy[i].second, vy[i+1].second, ycost});
        es.push_back(edge{vy[i+1].second, vy[i].second, ycost});
    }

    ll V = n;
    UnionFind tree(V);
    ll E = es.size();
    sort(es.begin(), es.end(), comp);
    ll res = 0;
    for(int i = 0; i < E; i++)
    {
        edge e = es[i];
        if(!tree.same(e.u, e.v))
        {
            tree.unite(e.u, e.v);
            res += e.cost;
        }
    }
    cout << res << endl;
    // kruscal end
}


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

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

    bool ans = true;
    int a = 0;
    for(int i=0;i<n;++i){
        string s;
        cin >> s;
        if(s[0] == 'A') ++a;
        else{
            --a;
            if(a < 0) ans = false;
        }
    }

    cout << ((ans && a == 0) ? "YES" : "NO") << endl;
    return 0;
}


Measured memory_bytes: 3164
# coding: utf-8
import os
from sys import stdin

# __dirname = os.path.dirname(__file__)
# __basename = os.path.splitext(os.path.basename(__file__))[0]
# __targetname = './input/' + __basename + '.txt'
# target_path = os.path.join(__dirname, __targetname)
# stdin = open(target_path)

def main():
    input_line = stdin.readline().rstrip().split(' ')
    N, M, C = map(int, input_line)
    B = list(map(int,stdin.readline().rstrip().split(' ')))
    A = [list(map(int,stdin.readline().rstrip().split(' '))) for _ in range(N)]
    ans = 0
    for i in range(N):
        a = sum([A[i][j]*B[j] for j in range(M)])
        a += C
        if(a>0):
            ans+=1

    # print(N,M,C)
    # print(B)
    # print(A)
    print(ans)

if __name__ == "__main__":
    main()
    

Measured memory_bytes: 3064
N = int(input())

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

ans = 0

d = []
for x in divisor(N):
  if x==1: continue
  tmp = N
  while tmp%x==0: tmp //= x
  tmp %= x
  if tmp == 1: ans += 1

ans += len(divisor(N-1)) - 1
print(ans)

Measured memory_bytes: 66076
#include<bits/stdc++.h>
using namespace std;
int solve(int A, int B)
{
  if(A == 1 && B == 1) return 0;
  if(A == B) return 2*(A-1);
  if(abs(A-B)<=2) return A+B-3;
  long long sqrtd = sqrt((long double)(1LL*A*B-1));
  int ans = 2*(sqrtd-1);
  if(A <= sqrtd-1) --ans;
  if(B <= sqrtd-1) --ans;
  if(1LL*sqrtd*(sqrtd+1) < 1LL*A*B && A != sqrtd && A!=sqrtd+1 && B != sqrtd && B != sqrtd+1)
    return ans+2;
  return ans+1;
  
}
int main()
{
  int Q; scanf("%d", &Q);
  while(Q--)
  {
    int A, B; scanf("%d%d", &A, &B);
    printf("%d\n", solve(A, B));
  }
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 9999999999999999;
using ll = long long;
int main(){
  ll N;
  cin>>N;
  vector <ll> a(N);
  for(ll i = 0;i<N;i++){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  ll kei = 0;
  ll ans = 0;
  for(ll i = 0;i<(N-1);i++){
    kei += a[i];
    if(kei*2>=a[i+1]){
      ans++;
    }
    else{
      ans = 0;
    }
  }
  cout << ans+1 << endl;
  return 0;
}

Measured memory_bytes: 1024
S = input()[::-1]

dreams = ['dream', 'dreamer', 'erase', 'eraser']
dreams = [dream[::-1] for dream in dreams]

i = 0
while i < len(S):
    flag = False
    for j in dreams:
        if S[i:i+len(j)] == j:
            i = i + len(j)
            flag = True
    if not flag:
        break

print("YES" if flag else "NO")


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

int main () {
  int N, K, X, Y;
  cin >> N >> K >> X >> Y;
  
  if ( N <= K ) {
	cout << N*X << endl;
  }
  else {
    cout << X*K+(N-K)*Y << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int tmp, a, b, c;
  scanf("%d %d %d",&a,&b,&c);

  if(a>b){
    tmp = a;
    a = b;
    b = tmp;
  }
  if(b>c){
    tmp = b;
    b = c;
    c = tmp;
  }
  if(a>b){
    tmp = a;
    a = b;
    b = tmp;
  }

  printf("%d %d %d\n",a,b,c);
  return 0;
}
   
    

Measured memory_bytes: 596
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <queue>
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rrep(i,n) for(int i = 1; i <= n; ++i)
using namespace std;
typedef pair<int,int> P;
const int INF = 1000000000;

int main(){
	int i,a,b;
	rep(i,4){
		int scr;
	scanf("%d%d",&a,&b);
	switch(a){
		case 1:
		scr = 6000*b;
		break;
		case 2:
		scr = 4000*b;
		break;
		case 3:
		scr = 3000*b;
		break;
		case 4:
		scr = 2000*b;
		break;
		
	}
	printf("%d\n",scr);
	}
	return 0;
}

Measured memory_bytes: 1028
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n = I()
    d = collections.defaultdict(int)
    d[''] = 1
    t = [
            'AGC',
            'ACG',
            'GAC',
            'AGAC',
            'AGCC',
            'AGTC',
            'ACGC',
            'AGGC',
            'ATGC'
        ]
    for i in range(n):
        e = collections.defaultdict(int)
        for c,v in d.items():
            v %= mod
            for g in 'ACGT':
                if c + g in t or (c + g)[-3:] in t:
                    continue
                e[(c + g)[-3:]] += v
        d = e

    return sum(d.values()) % mod


print(main())




Measured memory_bytes: 6224
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T

main :: IO ()
main = do
  (n : _) <- map unsafeSignedDecimal . T.words <$> T.getLine :: IO [Int]
  putStrLn $ if n `elem` ((*) <$> [1..9] <*> [1..9]) then "Yes" else "No"

unsafeSignedDecimal :: T.Text -> Int
unsafeSignedDecimal s = case T.signed T.decimal s of
  Right (n, _) -> n


Measured memory_bytes: 508
#include <iostream>
#include <cassert>
#include <algorithm>
#include <vector>
using namespace std;
using ULL = unsigned long long;
using LL = long long;
using pii = pair<int, int>;
const int MAX_M = 2e5;
int N, M, K;
vector<int> books_A, books_B;
LL pref_sum_B[MAX_M + 1];


int b_search(const LL &max_val, const int &M)
{
    int left = 0, right = M - 1, mid;
    int nr_books = 0;
    while (left <= right)
    {
        mid = left + (right - left) / 2;

        if (pref_sum_B[mid] <= max_val)
        {
            assert(mid + 1 > nr_books);
            nr_books = mid + 1;
            left = mid + 1;
        }
        else
        {
            right = mid - 1;
        }
    }

    return nr_books;
}


int main()
{
    cin.sync_with_stdio(0);

    cin >> N >> M >> K;

    for (int i = 0; i < N; ++i)
    {
        int book_A;
        cin >> book_A;

        books_A.emplace_back(book_A);
    }
    for (int i = 0; i < M; ++i)
    {
        int book_B;
        cin >> book_B;

        books_B.emplace_back(book_B);
        if (i == 0)
        {
            pref_sum_B[i] = book_B;
        }
        else
        {
            pref_sum_B[i] = pref_sum_B[i - 1] + book_B;
        }
    }

    LL cur_pref_sum_A = 0;
    int res_nr_books = 0;
    for (int i = 0; ; ++i)
    {
        res_nr_books = max(res_nr_books, i + b_search(K - cur_pref_sum_A, M));
        if (i == N || cur_pref_sum_A + books_A[i] > K)
        {
            break;
        }
        cur_pref_sum_A += books_A[i];
    }

    cout << res_nr_books;
}

Measured memory_bytes: 6692
import java.util.*; 
public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		long a=sc.nextInt(), b=sc.nextInt(); 
		if(a==0 || b==0 || a*b<0) System.out.println("Zero");
		else if(a>0 && b>0) System.out.println("Positive");
		else System.out.println(((b-a+1)%2==0)?"Positive":"Negative");
		sc.close(); 
	}

}

Measured memory_bytes: 35580
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll int64_t
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

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


int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int L[252525],R[252525];
int cnt=0;
int n;

void merge(int A[],int left, int mid, int right){
    int n1 = mid - left;
    int n2 = right - mid;
    REP(i,n1) L[i] = A[left+i];
    REP(i,n2) R[i] = A[mid+i];
    L[n1] = INF;
    R[n2] = INF;
    int i=0,j=0;
    for(int k=left;k<right;k++){
        cnt++;
        if(L[i]<=R[j]){
            A[k] = L[i];
            i++;
        }
        else{
            A[k] = R[j];
            j++;
        }
    }
}
void mergeSort(int A[],int left,int right){
    if(left+1 < right){
        int mid = (left+right)/2;
        mergeSort(A,left,mid);
        mergeSort(A,mid,right);
        merge(A,left,mid,right);
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>n;
    int A[505050];
    REP(i,n) cin>>A[i];
    mergeSort(A,0,n);

    REP(i,n){
        if(i) cout<<" ";
        cout<<A[i];
    }
    cout<<endl;
    cout<<cnt<<endl;
}


Measured memory_bytes: 7136
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        String s = sc.next();
        if(s.charAt(0) == '7' || s.charAt(1) == '7' || s.charAt(2) == '7'){
            System.out.println("Yes");

        }else{
            System.out.println("No");
        }
    }



    private static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            }else{
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while(true){
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                }else if(b == -1 || !isPrintableChar(b)){
                    return minus ? -n : n;
                }else{
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }
        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }
        public double nextDouble() { return Double.parseDouble(next());}
    }
}


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

using namespace std;
typedef long long ll;

#define INF (long long)(1e9+7)
#define REP(i,n) for(ll i = 0; i < n; i++)
#define REP1(i,n) for(ll i = 1; i <= n; i++)

ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  return gcd(b, a % b);
}



int main(void)
{
  ll k;
  ll ans = 0;
  cin >> k;
  REP1(a, k) {
    REP1(b, k) {
      REP1(c, k) {
	ans += gcd(a,gcd(b,c));
      }
    }
  }
  cout << ans << endl;

}


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

int main() {
while(true){
int ans;
ans = 0;
int check[3][1000000];


int n, x;
cin >> n >> x;
if(n == 0 && x == 0){
break;
}

for(int i = 1; i <= n; i++){
for(int j = i+1; j <= n; j++){
for(int k = j+1; k <= n; k++){
if(i+j+k == x && i != j && j != k && k != i){



ans++;

}
}

}

}
cout << ans << endl;
}



}



Measured memory_bytes: 3084
#define _USE_MATH_DEFINES
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
#pragma endregion //#include
/////////

#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)4e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int a,b,ans=0;
	cin>>a>>b;
	ans = a-1;
	if(a<=b){
		++ans;
	}
	cout<<ans<<endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REPR(i, n) for(int i = (n); i >= 0; i--)
#define FOR(i, m, n) for(int i = (m); i < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << ": " << x << endl;

using namespace std;
typedef long long ll;

signed main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  int sum = 0;
  REP(i, n) {
    cin >> a[i];
    sum += a[i];
  }

  sort(ALL(a));

  int cnt = 0;

  REP(i, n) {
    if(double(a[i]) >= (double)sum / (double)(4 * m)) {
      cnt++;
    }
  }

  if(cnt >= m)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


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

#ifdef HELTHAZAR
#define derr if (true) cerr
#else
#define derr if (false) cerr
#endif

#define rep(i, from, to) for (int i = from; i < int(to); i++)
#define repn(i, from, to) for (int i = from; i <= int(to); i++)
#define repr(i, from, to) for (int i = int(from); i >= to; i--)
#define trav(a, x) for (auto& a: x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define pb push_back
#define fi first
#define se second

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef vector<ll> vll;

const ll MOD = 1e9 + 7;
const int INF = 1e9;
const int MAXN = 1e5 + 1;

void solve() {
	int n;
	cin >> n;
	ll sum = 0, res = 0;
	map<ll, ll> mp;
	mp[0] = 1;
	rep(i, 0, n) {
		ll x;
		cin >> x;
		sum += x;
		if (mp.count(sum)) res += mp[sum];
		mp[sum]++;
	}
	cout << res;
}

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

	solve();
}


Measured memory_bytes: 12800
#include<stdio.h>
int main(void){
	int n,i;
	char s[10000],t[10000];
	scanf("%d",&n);
	scanf("%s %s",s,t);
	for(i=0;i<n;i++){
		printf("%c%c",s[i],t[i]);
	}
	return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <algorithm>

int main(void){
	int i,j,k,n,p[101], m[101][101];
	scanf("%d", &n);
	for(i=0;i<n;i++){
		scanf("%d %d", &p[i], &p[i+1]);
	}
	
	for(i=n-2;i>=0;i--){
		m[i+1][i+1] = 0;
		for(j=i+1;j<n;j++){
			m[i][j] = p[i]*p[i+1]*p[j+1] + m[i+1][j];
			for(k=i+1;k<j;k++){
				m[i][j] = std::min(m[i][j], m[i][k] + m[k+1][j] + p[i]*p[k+1]*p[j+1]);
			}
		}
	}

	printf("%d\n", m[0][n-1]);

	return 0;
}

Measured memory_bytes: 2772
#include <iostream>
using namespace std;
using LL = long long; 
LL GCD(LL a, LL b) {
  if(b == 0) return a;
  if(a % b == 0) return b;
  return GCD(b, a % b);
}

LL LCM(LL a, LL b) {
  return a / GCD(a, b) * b;
}

int main() {
  int N;
  cin >> N;
  
  long long sum = 1;
  for(int i = 0; i < N; ++i) {
    long long a;
    cin >> a;
    sum = LCM(sum, a);
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int N = in.Int();
            int K = in.Int();
            int[] A = in.Int(N);

            while (K-- > 0) {
                int[] B = new int[N + 1];
                for (int i = 0; i < N; i++) {
                    int l = Math.max(0, i - A[i]);
                    int r = Math.min(N - 1, i + A[i]) + 1;
                    B[l] += 1;
                    B[r] -= 1;
                }
                int v = 0;
                int min = N;
                for (int i = 0; i < N; i++) {
                    v += B[i];
                    A[i] = v;
                    min = Math.min(A[i], min);
                }
                if (min == N) break;
            }
            StringBuilder sb = new StringBuilder();
            for (int a : A) {
                sb.append(a).append(' ');
            }
            out.println(sb.substring(0, sb.length() - 1));
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    return null;
                }
            }
            return st.nextToken();
        }

        public int Int() {
            return Integer.parseInt(next());
        }

        public int[] Int(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = Int();
            }
            return a;
        }

    }
}



Measured memory_bytes: 55948
N = int(input())
*S, = [input() for _ in [0]*N]

cnt = {}
for s in S:
    cnt[s] = cnt.get(s,0) + 1

M = max(cnt.values())
ans = []
for k,v in cnt.items():
    if v==M:
        ans.append(k)
ans.sort()
for out in ans:
    print(out)

Measured memory_bytes: 38116
S = int(input())
from math import factorial
ans = 0


m = S // 3 #最大桁数

from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under



for p in range(1,m+1):
    x = S - 3*(p) #p桁 自由度x
    """
    a = factorial(x+p-1) 
    b = factorial(p-1) 
    c = factorial(x)
    ans += ( a / b / c )%(10**9+7)
    """
    ans += cmb(x+p-1,p-1)


print(int((ans)%(10**9+7)))




Measured memory_bytes: 9564
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cassert>
#include <memory>
#include <stack>
#include <set>
#include <map>
#include <cctype>

#define MAX_SIZE 100000000
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

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

  int W,a,b; cin>>W>>a>>b;
  const int a_right = W + a;
  const int b_right = W + b;
  if((b_right >= a && b_right <= a_right) || (b >= a && b <= a_right)) {
    cout << 0 << endl; exit(0);
  }

  int diff = 0;
  if(b > a_right) {
    diff = b - a_right;
  } else if(b_right < a) {
    diff = a - b_right;
  }

  cout << diff << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i = 1; i <= (n); ++i)
#define drep(i,n) for(ll i = (n)-1; i >= 0; --i)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a,ll b){if(a%b==0){return b;}else{return(gcd(b,a%b));}}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const int INF=1e9;
const ll MX = 1e18;
const int MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);
 
int main() {
  int x;
  cin>>x;
  x/=5;
  x*=5;
  int x5=(x%500);
  int x500=x/500*1000;
  cout<<x5+x500<<endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = 1e18;
/* テンプレートここまで */

int main() {
  ll n, m; cin >> n >> m;
  vector<ll> cnt(n+1,0);
  REP(i, m){
    ll a,b; cin >> a >> b;
    cnt[a]++;
    cnt[b]++;
  }
  REP(i, n){
    cout << cnt[i+1] << endl;
  }
}

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

using namespace std;

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

  int k, x;
  cin >> k >> x;
  for (int i = max(x-k+1, -1000000); i < min(x+k, 1000001); ++i) 
    cout << i << " ";
  cout << endl;

  return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<set>
using namespace std;
struct obs{
	int h;
	vector<int> r;
};
typedef struct obs obs;
obs v[100000];
int main(){
	int n,m,a,b;
	int sum=0;
	cin>>n>>m;
	for(int i=0;i<n;i++)cin>>v[i].h;
	for(int j=0;j<m;j++){
		cin>>a>>b;
		v[a-1].r.push_back(b-1);
		v[b-1].r.push_back(a-1);
	}
	for(int i=0;i<n;i++){
		bool bo=1;
		for(int j=0;j<v[i].r.size();j++){
			if(v[v[i].r[j]].h>=v[i].h){
				bo=0;break;
			}
		}
		if(bo)sum++;
	}
	cout<<sum<<'\n';
} 

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

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

    rep(i,s.size()){
        s[i] += n;
        if(s[i] > 'Z') s[i] -= 26;
    }

    cout << s << endl;
}

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

int n;

int checktop(int i){
  while(i>=10){
    i/=10;
  }
  return i;
}

int checkbottom(int i){
  return i%10;
}

int keta(int i,int j){
  int res=0;
  for(int u=1;u<=n;u++){
    if(checktop(u)==i && checkbottom(u)==j) res++;
  }
  return res;
}

int main() {
  cin>>n;
  int c[10][10];
  for(int i=0;i<10;i++){
    for(int j=0;j<10;j++) c[i][j]=keta(i,j);
  }
  int res=0;
  for(int i=0;i<10;i++){
    for(int j=0;j<10;j++) res+=c[i][j]*c[j][i];
  }
  cout<<res<<endl;
  return 0;
}


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

using namespace std;

int main() {
    int n, i, a, same, max_num=0;
    string s, left, right, alpha="abcdefghijklmnopqrstuvwxyz";
    cin >> n >> s;
    for(i=1; i<n; i++) {
        same=0;
        left = s.substr(0, i);
        right = s.substr(i, n-i);
        for(a=0; a<26; a++) {
            if(left.find(alpha[a]) != string::npos && right.find(alpha[a]) != string::npos) {
                same++;
            }
        }
        max_num = max(max_num, same);
    }
    cout << max_num << endl;
}

Measured memory_bytes: 256
# n = int(input())
s = input()
# a,b = map(int,input().split())
# da = list(map(int,input().split()))
# a = [int(input()) for i in range(n)]

if s[2] == s[3] and s[4] == s[5]:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 2940
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
cnt = 0
for n in range(N):
    if A[n] <= B[n]:
        cnt += A[n]
        B[n]  -= A[n]
    else:
        cnt += B[n]
        A[n] -= B[n]
        B[n] = 0
    if A[n+1] <= B[n]:
        cnt += A[n+1]
        A[n+1] = 0
    else:
        cnt += B[n]
        A[n+1] -= B[n]
print(cnt)

Measured memory_bytes: 18624
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
typedef long long ll;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define FOR(i,n) for(int i=0;i<n;i++)
#define all(s) s.begin(),s.end()
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e18;

template <typename T>
vector<T> dijkstra(int s,vector<vector<pair<int, T> > > & G){  
  const T INF = numeric_limits<T>::max();    
  using P = pair<T, int>;
  int n=G.size();
  vector<T> d(n,INF);
  vector<int> b(n,-1);
  priority_queue<P,vector<P>,greater<P> > q;
  d[s]=0;
  q.emplace(d[s],s);
  while(!q.empty()){
    P p=q.top();q.pop();
    int v=p.second;
    if(d[v]<p.first) continue;
    for(auto& e:G[v]){
      int u=e.first;
      T c=e.second;
      if(d[u]>d[v]+c){
        d[u]=d[v]+c;
        b[u]=v;
        q.emplace(d[u],u);
      }
    }
  }
  return d;
}


signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,x,y;
    cin>>n>>x>>y;
    vector<vector<P>>G(n);
    vector<int>dlist(n+1,0);
    rep(i,0,n-1){
        G[i].push_back({i+1,1});
        G[i+1].push_back({i,1});
    }
    x--;y--;
    G[x].push_back({y,1});
    G[y].push_back({x,1});
    rep(i,0,n){
        vector<int>dijk=dijkstra(i,G);
        rep(j,i+1,n){
            dlist[dijk[j]]++;
        }
    }
    rep(i,1,n){
        cout<<dlist[i]<<endl;
    }
}

Measured memory_bytes: 512
#include <stdio.h>

struct data {int y,m,d;} table[100],*d;

int main(){
  int n,i,j,date;
  scanf("%d",&n );
  for(i=0; i<n; i++) {
    d=&table[i];
    scanf("%d%d%d",&d->y,&d->m,&d->d);
  }

  for(i=0; i<n; i++) {
    d=&table[i];
    date=0;
    for(j=d->m;j<=10;j++){
      if(j==d->m){
        if(d->y%3==0||j%2==1)date+=20-d->d+1;
        else date+=19-d->d+1;
      }else{
        if(d->y%3==0||j%2==1)date+=20;
        else date+=19;
      }
    }
    for(j=d->y+1;j<1000;j++){
      if(j%3==0)date+=20*10;
      else date+=19*5+20*5;
    }
    printf("%d\n",date );
  }

  }

Measured memory_bytes: 2680
import java.util.*;

class Main{

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int[] p = new int[n];

        for (int i = 0; i < p.length; i++) {
            p[i] = sc.nextInt();
        }

        Arrays.sort(p);

        int sum = 0;
        for (int i = 0; i < p.length-1; i++) {
            sum += p[i];
        }
        System.out.println(sum + p[n-1]/2);
    }
}

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

#define ms(s,n) memset(s,n,sizeof(s))
#define all(a) a.begin(),a.end()
#define present(t, x) (t.find(x) != t.end())
#define sz(a) int((a).size())
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); --i)
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define mp make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;

const int MOD = (int) 1e9+7;
const int INF = (int) 1e9+1;
inline ll gcd(ll a,ll b){ll r;while(b){r=a%b;a=b;b=r;}return a;}
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

string s,t;

void inp(){
	int ans=1e9,dem=0,j=0;
	cin>>s>>t;
	int len1=s.length(),len2=t.length();
	FOR(i,0,len1-len2+1){
		dem=0;
		FOR(j,0,len2){
			if(s[i+j]==t[j])
				dem++;
		}
		ans=min(ans,len2-dem);
	}
	cout<<ans<<endl;
}
int main(){
	inp();
	return 0;
}


Measured memory_bytes: 3588
// Problem : A - Takoyaki
// Contest : AtCoder - AtCoder Beginner Contest 176
// URL : https://atcoder.jp/contests/abc176/tasks/abc176_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

//Macros

#define ll long long
#define db long double
#define pb push_back
#define eb emplace_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int,int>
#define mii map<pii,int>
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define sz(x) (int)x.size()
#define mod 1000000007
#define EPS 1e-9
#define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define inf 1e10
#define PI acos(-1.0)
#define int long long
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define N 100005

//Solution

void solve(){
    int n,x,t;
    cin>>n>>x>>t;
    int ans = t*((n+x-1)/x);
    cout<<ans;
}

signed main(){
    io;
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    int tests;
    //cin>>tests;
    tests = 1;
    while(tests--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3648
N=int(input())
W=[0]*N
for i in range(N):
    W[i] = input()
cnt = 0
for i in range(N-1):
    moji=len(W[i])
    if W[i][moji-1] == W[i+1][0]:
        cnt +=1
    else:
        print('No')
        break
if cnt == N-1:
    if len(set(W)) == len(W):
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 38384
#include<iostream>
#include<cmath>

using namespace std;
using ll = long long;

int main() {
	ll x, k, d;
	cin >> x >> k >> d;
	x = abs(x);
	long long ido = x / d;
	if (ido > k) {
		cout << x - d * k << endl;
		return 0;
	}
	x = x - d * ido;
	k -= ido;
	if (k % 2 == 0) {
		cout << x << endl;
	}
	else {
		cout << d - x << endl;
	}
}

Measured memory_bytes: 3192
s=list(input())
a,b=-1,-1
flag=False
for i in range(len(s)-1):
    if s[i]==s[i+1]:
        a,b=i+1,i+2
        flag=True
        break
if not flag:
    for i in range(len(s)-2):
        if s[i]==s[i+2]:
            a,b=i+1,i+3
            break
print(a,b)

Measured memory_bytes: 3956
require 'pp'
$DEBUG ? define_method(:dpp){|e|pp e} : define_method(:dpp){|e|}

# 入力値を数値で返却する
def gets_i()
  gets.chomp.to_i
end
x = gets_i

if x >= 30
  puts "Yes"
else
  puts "No"
end

Measured memory_bytes: 14572
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<cstring>
#include<iostream>
#define IOS ios::sync_with_stdio(0);cin.tie(0)
#define MEM(X,Y) memset(X,Y,sizeof(Y))
#define FRE freopen("abc.in", "r", stdin)
long long int gcd(long long int a, long long int b) { return b ? gcd(b, a % b) : a; }
using namespace std;


int main(void)
{
	long long int a, b, result = 0;
	scanf("%lld%lld", &a, &b);
	if (a >= 2 && b >= 2)
	{
		if (b & 01)
			result = ((b + 1) / 2) * ((a + 1) / 2) + (b / 2) * (a / 2);
		else
			result = (b / 2) * a;
	}
	else
		result = 1;
	printf("%lld", result);
}

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

public class Main {

    public static void main(String[] args) {
        FastReader sc = new FastReader();
        String str = sc.next();
        char c = str.charAt(str.length() - 1);
        if (c == '3') {
            System.out.println("bon");
        } else if (c == '0' || c == '1' || c == '6' || c == '8') {
            System.out.println("pon");
        } else {
            System.out.println(("hon"));
        }

        System.exit(0);
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try{
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 32700
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0)
#define pb push_back
//#define mp make_pair
#define ff first
#define ss second
#define debug(x) cout<<"### x is: "<<x<<"###"<<endl
#define all(a) a.begin(),a.end()
#define tc int t;scanf("%d",&t);while (t--0)
#define int long long
const int MOD=1e9+7;
const int N=2e5+5;
int power(int a, int b) {int ret=1;while(b) {if(b&1) ret*=a;a*=a;if(ret>=MOD) ret%=MOD;if(a>=MOD) a%=MOD;b>>=1;}return ret;}
int invmod(int x) {return power(x,MOD-2);}
int pre[N],a[N],b[N];
map<int,int>mp;
int seive(int n)
{
	if(n<=3)
		return 1;
	else if(n%2==0||n%3==0)
		return 0;
	int i=5;
	while(i*i<=n)
	{
		if(n%(i)==0||n%(i+2)==0)
			return 0;
		i+=6;
	}
	return 1;
}
void primeFactors(int n) 
{ 
    
    while (n%2 == 0) 
    { 
        mp[2]++;
        n = n/2; 
    } 
  
     
    for (int i = 3; i <= sqrt(n); i = i+2) 
    { 
        
        while (n%i == 0) 
        { 
            mp[i]++;
            n = n/i; 
        } 
    } 
  
    if (n > 2) 
        mp[n]++;
} 
int32_t main()
{
	int n,m;
	cin>>n>>m;
	primeFactors(m);
	//cout<<mp.size()<<endl;
	map<int,int>:: iterator it;
	int ans=1;
	for(it=mp.begin();it!=mp.end();it++)
	{
		//cout<<it->second<<" "<<it->first<<endl;
		if(((it->second)/n)>0)
			ans*=pow(it->first,it->second/n);
	}
	cout<<ans<<endl;

}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define INF 1000000000
int main(){
cin.tie(0);
ios::sync_with_stdio(false);

	int N,co=0;
	cin>>N;
	vector<int>a(N);
	cin>>a[0];
	FOR(i,1,N){
		cin>>a[i];
		if(a[i]==a[i-1]){
			a[i]=-1;
			co++;
		}
	}
	
	cout<<co<<endl;
	return 0;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

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

signed main(){
    int a,b;
    cin>>a>>b;
    cout<<a*b-a-b+1<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<algorithm> // sort
#include<map> // pair
#include<cmath>
#include<cstring>
#include<set>
using namespace std;
typedef long long ll;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
const ll mod = 1e9+7;
const int INF = 1e9;
const ll INFLONG = 1e18;
vector<ll> vec((ll)2e5,0);
vector<ll> isleft((ll)2e5,0);
int main(){
  ll n;
  string s;
  cin >> n;
  cin >> s;
  ll lefcou = 0;
  ll sum = 1;
  rep(i,2*n){
    //cout << lefcou << " ";
    if(lefcou < 0){sum = 0;break;}
    if(s[i] == 'B'){
      if(lefcou % 2 == 0){
        isleft[i] = 1;
        lefcou++;
      }else{
        isleft[i] = 0;
        sum = (sum * lefcou) % mod;
        lefcou--;
      }
    }else{
      if(lefcou % 2 == 0){
        isleft[i] = 0;
        sum = (sum * lefcou) % mod;
        lefcou--;
      }else{
        isleft[i] = 1;
        lefcou++;
      }
    }
  }
  // cout << endl;
  // rep(i,2 * n){
  //   cout << isleft[i] << " ";
  // }
  //cout << endl;
  // rep(i,2*n){
  //   cout << lefcou << " ";
  //   if(s[2*n-1-i] == 'B'){
  //     if(lefcou % 2 == 0){
  //       isleft[i] = 1;
  //       lefcou++;
  //     }else{
  //       isleft[i] = 0;
  //       sum *= lefcou % mod;
  //       lefcou--;
  //     }
  //   }else{
  //     if(lefcou % 2 == 0){
  //       isleft[i] = 0;
  //       sum *= lefcou % mod;
  //       lefcou--;
  //     }else{
  //       isleft[i] = 1;
  //       lefcou++;
  //     }
  //   }
  // }
  rep(i,n){
    sum = (sum * (i+1)) % mod;
  }
  //sum = (sum * (n*(n-1)/2%mod)) % mod;
  if(lefcou != 0){sum = 0;}
  cout << sum;
}


Measured memory_bytes: 3716
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;


int main(int argc, char** argv) {
	int a;
	cin>>a;
	if(a>=1000){
		printf("ABD\n");
	}
	else printf("ABC\n");
	return 0;
}

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


using namespace std;
using ll = long long;


int main() {
    string s;
    cin >> s;
    int cur = 0;
    for(int i = 0; i < (int) s.length(); i++) {
      int tmp = s[i] - '0';
      cur = (cur + tmp) % 9;
    }
    if(!cur) {
      cout << "Yes" << "\n";
    } else {
      cout << "No" << "\n"; 
    }



  return 0;
}



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

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF 2e8
#define INF_LL 1LL<<60
#define ll long long
#define MAX_V 100005

vector<int> alpha(26);

int main() {
    string s, u = "";
    cin >> s;

    bool hanten = false;

    int q;
    cin >> q;
    REP(query, q) {
        int t;
        cin >> t;
        if(t == 1) {
            if(hanten) {
                hanten = false;
            } else {
                hanten = true;
            }
        } else {
            int f;
            cin >> f;
            string tmp;
            cin >> tmp;
            if(f == 1) {
                if(hanten) {
                    s += tmp;
                } else {
                    u += tmp;
                }
            } else {
                if(hanten) {
                    u += tmp;
                } else {
                    s += tmp;
                }
            }
        }
    }

    reverse(u.begin(), u.end());

    s = u + s;

    if(hanten) {
        reverse(s.begin(), s.end());
    }

    cout << s << endl;

    return 0;
}
 

Measured memory_bytes: 1180
def main():
	_, t, *L = map(int, open(0).read().split())
	d = [0] * t
	cand = 0
	for w, v in sorted((x, y) for x, y in zip(*[iter(L)] * 2)):
		if cand < d[-1] + v:
			cand = d[-1] + v
		for i in range(t - 1, w - 1, -1):
			if d[i - w] + v > d[i]:
				d[i] = d[i - w] + v
	print(max(cand, max(d)))

if __name__=="__main__":
	main()


Measured memory_bytes: 42068
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
typedef long long ll;

void solve() {
    REP(i,5) {
        int x;
        cin >> x;
        if (x == 0) {
            cout << i+1 << endl;
            return;
        }
    }
}

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




Measured memory_bytes: 3588
N,T=(int(i) for i in input().split())
t = [int(i) for i in input().split()]
a=0
for b in range(N-1):
    if (t[b+1] - t[b]) < T:
        a = a + t[b+1] - t[b]
    else:
        a = a + T
a = a+T
print(a)

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

int a, b, c;
set<int> s;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
 	
 	cin >> a >> b >> c;
 	s.insert(a);
 	s.insert(b);
 	s.insert(c);
 	cout << (int) s.size() << '\n';
 	
	return 0;
}

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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {

            string a = Console.ReadLine();

            char c = a[0];

            c++;

            Console.Write(c);

            //Console.ReadKey();
        }
    }
}

Measured memory_bytes: 11092
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String S = sc.next();
		String T = sc.next();
		sc.close();
		String U = "";
		for(int i=0; i<N; i++) {
			U += S.charAt(i);
			U += T.charAt(i);
		}
		System.out.println(U);
	}

}

Measured memory_bytes: 23380
from copy import deepcopy

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

A = deepcopy(a)
j = 0
cnt = 0
for i in range(n-1):
    minj = i
    for j in range(i, n):
        if A[j] < A[minj]: # 未ソート部からargminを持ってくる
            minj = j
    A[i], A[minj] = A[minj], A[i] # 未ソート先頭と最小値を交換する
    if i != minj: # ソートした場合はカウント+1する
        cnt += 1

print(*A)
print(cnt)


Measured memory_bytes: 6336
#include "bits/stdc++.h"
using namespace std;

#define print(n) cout  << n << "\n"
#define amari 1.0e9 + 7
int main() {
	int n, m;
	cin >> n >> m;
	if (abs(n-m)>1) {
		print(0);
		return 0;
	}
	long long ans = 1;
	if ((n + m) % 2 == 0) {
		ans *= 2;
	}
	for (int i = 1; i<=n;i++) {
		ans *= i;
		ans %= (long long)amari;
	}
	for (int i = 1; i <= m; i++) {
		ans *= i;
		ans %= (long long)amari;
	}
	print(ans);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include <stdio.h>
#include<iostream>
using namespace std;
int main(){
int a[3];
for(int i=0;i<3;i++)
cin >>a[i];
int count5=0;
int count7=0;
for(int i=0;i<3;i++){
  if(a[i]==5) count5++;
  if(a[i]==7) count7++;
}
if(count5==2 &&count7==1) cout<<"YES"<<endl;
else cout<<"NO"<<endl;

}


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

int main() {
	// your code goes here
	string s,t;
	cin>>s>>t;
	int count=0;
	for(int i=0;i<s.length();i++)
	{
	    if(s[i]!=t[i])
	    {
	        count++;
	    }
	}
	cout<<count<<endl;
	
	return 0;
}


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

using namespace std;

#define reep(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) reep((i),0,(n))

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> v(n);
	rep(i, n) cin >> v[i];
	vector<int> w(m);
	rep(i, m) cin >> w[i];
	vector<int> ans(n,1e9);
	rep(i,m){
		for(int j=n-1;j>=0;j--){
			if(j) ans[j] = min(ans[j],ans[j-1]+v[j]*w[i]);
			else ans[j] = min(ans[j],v[j]*w[i]);
		}
	}
	cout<<ans[n-1]<<endl;
}

Measured memory_bytes: 3096
#include<stdio.h>
    #include<string.h>
     
    int main(void)
    {
       char a[11],b[11],c[11];
     
       scanf("%s%s%s",a,b,c);
       if ((a[strlen(a)-1]==b[0])&&(b[strlen(b)-1]==c[0]))
       printf("YES\n");
       else printf("NO\n");
       return 0;
    }

Measured memory_bytes: 128