akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { os << p.first << ' ' << p.second; return os; }

f80 dp[3010][3010];

void solve() {
  int n; cin >> n;
  vf80 p(n); cin >> p;
  dp[0][0] = 1;
  rep(i, n) rep(j, 3010) {
    dp[i + 1][j + 1] += dp[i][j] * p[i];
    dp[i + 1][j] += dp[i][j] * (1.0 - p[i]);
  }
  f80 ans = 0;
  for (int i = (n + 1) / 2; i <= n; i++) {
    ans += dp[n][i];
  }
  cout << ans << '\n';
}


Measured memory_bytes: 141568
#include<iostream>

using namespace std;

int main() {
  int A, B, K;

  cin >> A >> B >> K;

  int len = B - A + 1;
  len = (len <= K * 2) ? len : K * 2;

  int i = 0;
  while (i < len / 2) {
    printf("%d\n", A + i);
    i++;
  }
  if (len % 2 == 1)
    printf("%d\n", A + i);


  i = len / 2 - 1;
  while (i >= 0) {
    printf("%d\n", B - i);
    i--;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <string>
#include <set>
#include <iomanip>
#include <map>
#define REP(i,n) for (int i=0;i<(n);++i)
using namespace std;

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


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <map>
#include <sstream>
#include <stdexcept>
#define ll long long
// #include <bits/stdc++.h>
#define req(i,h) for(int i = 0; i < h; i++)

using namespace std;


int main(void) {
    string s;
    cin >> s;
    int ma = 1e5;
    req(i,s.length() - 2) {
       int x = (int)(s[i] - '0');
       int y = (int)(s[i+1] - '0');
       int z = (int)(s[i+2] - '0');
     int a = x * 100 + y * 10 + z;
     int absolute = abs(a - 753);
     ma = min(absolute, ma);
    }
    cout << ma;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <map>
using namespace std;

#define INF 1e9
#define LLINF 1e18
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;

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


int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<char>> a(n, vector<char> (n));
    vector<vector<char>> b(m, vector<char> (m));
    rep(i, n) {
        rep(j, n) {
            cin >> a.at(i).at(j);
        }
    }
    rep(i, m) {
        rep(j, m) {
            cin >> b.at(i).at(j);
        }
    }
    rep(i, n - m + 1) {
        rep(j, n - m + 1) {
            rep(k, m) {
                rep(h, m) {
                    if (a.at(k + i).at(h + j) != b.at(k).at(h)) {
                        goto next;
                    }
                }
            }
            goto last;
            next:;
        }
    }
    cout << "No" << endl;
    return 0;
    last:
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include<cstdio>

int main(){
  int L,R;
  scanf("%d %d",&L, &R);
  
  int minR=(R<L+2019? R: L+2019);
  int reminder_min=2019;
  for(int i=L;i<minR;i++){
    for(int j=i+1;j<minR+1; j++){
      if(reminder_min> ((i%2019)*(j%2019))%2019 ){
        reminder_min=((i%2019)*(j%2019))%2019;
      }
    }
  }
  printf("%d\n",reminder_min);
  return 0;
}

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

struct node{
    int key;
    struct node *left,*right,*par;
};
typedef struct node* node_pointer; 

node_pointer nil,root;

void insert(int);
void Preorder(node_pointer);
void Inorder(node_pointer);
node_pointer search(int);
node_pointer Minimum(node_pointer);
node_pointer Successor(node_pointer);
void delete(node_pointer); 

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

    for(i=0; i<n; i++){
        char order[7];
        int num;
        scanf(" %s",order);

        if(strcmp(order,"insert") == 0 ){
            scanf("%d",&num);
            insert(num);
        }

        else if(strcmp(order,"find") == 0){
            scanf("%d",&num);
            if(search(num)) printf("yes\n");
            else printf("no\n");
        }

        else if(strcmp(order,"delete") == 0){
            scanf("%d",&num);
            delete(search(num));
        }

        else if(strcmp(order,"print") == 0){
            Inorder(root);
            printf("\n");
            Preorder(root);
            printf("\n");
        }
    }

    return 0;
}

void insert(int num){
    node_pointer a,b,c;
    a = root;
    b = nil;
    c = (node_pointer)malloc(sizeof(struct node));
    c->key = num;
    c->right = nil;
    c->left = nil;

    while(a != nil){
        b = a;       
        if(c->key < a->key) a = a->left;
        else a = a->right;
    }

    c->par = b;

    
    if(b == nil) root = c;
    else if(c->key < b->key) b->left = c;
    else b->right = c;
}

void Preorder(node_pointer a){
    if(a == nil) return;
    printf(" %d",a->key);
    if(a->left != nil) Preorder(a->left);
    if(a->right != nil) Preorder(a->right);
}

void Inorder(node_pointer a){
    if(a == nil) return;
    if(a->left != nil) Inorder(a->left);
    printf(" %d",a->key);
    if(a->right != nil) Inorder(a->right);
}

node_pointer search(int num){
    node_pointer a;
    a = root;

    while(1){
        if(a == nil) break;
        if(a->key == num) return a;
        if(num < a->key) a = a->left;
        else if(num >= a->key) a = a->right;
    }

    return nil;
}

node_pointer Minimum(node_pointer a){
    while(a->left != nil){
        a = a->left;;
    }
    return a;
}

node_pointer Successor(node_pointer a){
    if(a->right != nil) return Minimum(a->right);
    node_pointer b = a->par;
    while(1){
        if(b == nil || b->right) break;
        a = b;
        b = b->par;
    }

    return b;
}

void delete(node_pointer a){
    node_pointer b,c;
    if(a->left != nil && a->right != nil) b = Successor(a);
    else b = a;

    //cはaを削除した後にaの場所に来るノードの子
    if(b->left != nil){
        c = b->left;
    }else {
        c = b->right;
    }

    if(c != nil) c-> par =b->par;

    if( b->par == nil){
        root = c;
    }else{
        if(b != b->par->left) b->par->right = c;
        else b->par->left = c; 
    }

    a->key = b->key;

    free(b);
}


Measured memory_bytes: 20464
using System;
using System.Linq;
using System.Runtime.InteropServices;

namespace AtCoder.Problems
{
    public class ProblemAbc079C
    {
        public static void Main(string[] args)
        {
            var s = new Solve079C();
            s.Solve();
        }

        public class Scanner
        {
            private string[] _s;
            private int _i;
            private readonly char[] _separators = new char[] {' '};

            public Scanner()
            {
                _s = new string[0];
                _i = 0;
            }

            public string Next()
            {
                if (_i < _s.Length) return _s[_i++];
                string st = Console.ReadLine();
                while (st == "") st = Console.ReadLine();
                _s = st.Split(_separators, StringSplitOptions.RemoveEmptyEntries);
                if (_s.Length == 0) return Next();
                _i = 0;
                return _s[_i++];
            }

            public int NextInt() => int.Parse(Next());
            public long NextLong() => long.Parse(Next());
            public ulong NextULong() => ulong.Parse(Next());
            public double NextDouble() => double.Parse(Next());

            public int[] GetIntArray(int n, int add = 0)
            {
                int[] array = new int[n];
                for (int i = 0; i < n; i++)
                {
                    array[i] = NextInt() + add;
                }
                return array;
            }

            public long[] GetLongArray(int n, long add = 0)
            {
                long[] array = new long[n];
                for (int i = 0; i < n; i++)
                {
                    array[i] = NextLong() + add;
                }
                return array;
            }

            public double[] GetDoubleArray(int n, double add = 0)
            {
                double[] array = new double[n];
                for (int i = 0; i < n; i++)
                {
                    array[i] = NextDouble() + add;
                }
                return array;
            }
        }
    }

    public class Solve079C
    {
        public void Solve()
        {
            var cin = new ProblemAbc079C.Scanner();
            var s = cin.Next();

            var result = GetAnswer(s);
            Console.WriteLine(result);
        }

        private int[] _abcd;
        private int _n;
        private int _k = 7;
        private string _answer = "=7";

        public string GetAnswer(string s)
        {
            _abcd = s.Select(c => c - '0').ToArray();
            _n = s.Length;

            dfs(1, _abcd[0]);
            return $"{_abcd[0]}{_answer}";
        }

        private bool dfs(int i, int sum)
        {
            if (i == 4) { return sum == _k; }

            var v = _abcd[i];
            if (dfs(i + 1, sum + v))
            {
                _answer = $"+{v}{_answer}";
                return true;
            }
            if (dfs(i + 1, sum - v))
            {
                _answer = $"-{v}{_answer}";
                return true;
            }

            return false;
        }
    }
}



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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<char> vc;
typedef vector<string> vs;
const ll mod = 1e9+7;
const ll inf = 1e17;
const int INF = 1e9;
const double PI = acos(-1);
#define fo(i, a, b) for(int i = a; i < b; i++)
#define re(i, n) fo(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(s) s.begin(), s.end()
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
int main()
{
  string s;
  cin >> s;

  bool beauty = true;
  if(s.size() % 2 != 0) beauty = false;
  else {
    sort(all(s));
    string x, y;
    for(int i = 0; i < s.size(); i += 2) {
      x.pb(s[i]);
    }
    for(int i = 1; i < s.size(); i += 2) {
      y.pb(s[i]);
    }
    if(x != y) beauty = false;
  }
  if(beauty) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N = 2e5 + 11;
#define LL long long
#define P pair<LL, LL>
#define fs first
#define sc second
#define ls ch[u][0]
#define rs ch[u][1]
#define mk_p make_pair
vector<P> f[N];
int n, ch[N][2];
LL wei[N][2];
P tmp1[N], tmp2[N];
bool dfs(int u, LL lim){
    f[u].clear();
    if(!ls){
        f[u].push_back(mk_p(0, 0));
        return 1;
    }
    if(!dfs(ls, lim) || !dfs(rs, lim))return 0;
    if(f[ls].size() > f[rs].size())swap(ls, rs), swap(wei[u][0], wei[u][1]);
    LL w0 = wei[u][0], w1 = wei[u][1];
    int s1 = 0, s2 = 0, j = 0;
    for(int i = 0;i < f[ls].size(); i++){
        while(j + 1 < f[rs].size() && f[rs][j+1].fs + w1 + f[ls][i].sc + w0 <= lim)
            j++;
        if(f[rs][j].fs + w1 + f[ls][i].sc + w0 <= lim)
            tmp1[++s1] = mk_p(f[ls][i].fs + w0, f[rs][j].sc + w1);
    }
    j = 0;
    for(int i = 0;i < f[ls].size(); i++){
        while(j + 1 < f[rs].size() && f[ls][i].fs + w0 + f[rs][j].sc + w1 > lim)
            j++;
        if(f[ls][i].fs + w1 + f[rs][j].sc + w0 <= lim)
            tmp2[++s2] = mk_p(f[rs][j].fs + w1, f[ls][i].sc + w0);
    }
    int i = 1; j = 1;
    LL mi = 1e11;
    while(i <= s1 || j <= s2){
        if(i <= s1 && j <= s2){
            if(tmp1[i].fs < tmp2[j].fs) f[u].push_back(tmp1[i++]);
            else  f[u].push_back(tmp2[j++]);
        }
        else{
            if(i <= s1)f[u].push_back(tmp1[i++]);
            else f[u].push_back(tmp2[j++]);
        }
        if(mi >= f[u][f[u].size()-1].sc) mi = f[u][f[u].size()-1].sc;
        else f[u].pop_back();
    }
    //printf("u=%d w0=%lld w1=%lld\n", u, w0, w1);
    //for(int i = 0;i < f[u].size(); i++){
        //printf("ls=%d i=%d f.fs=%lld f.sc=%lld\n", ls, i, f[u][i].fs, f[u][i].sc);
    //}
    return f[u].size() > 0;
}
int main(){

    cin>>n;
    int fa; LL w;
    for(int i = 2;i <= n; i++){
        scanf("%d%lld", &fa, &w);
        if(ch[fa][0])ch[fa][1] = i, wei[fa][1] = w;
        else ch[fa][0] = i, wei[fa][0] = w;
    }
    LL l = 0, r = 1e11, ans = 1e18;
    while(l <= r){
        LL mid = l + r >> 1;
        if(dfs(1, mid))r = mid - 1, ans = min(ans, mid);
        else l = mid + 1;
    }
    cout<<ans<<endl;
    return 0;
}


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

int main(void){
    // 入力IF
    int n,m;
    cin >> n >> m;
    if(m==0 || n==0){
        cout << 0 << ' ' << 0 << endl;
        return 0;
    }
    vector<int> p(m);
    string s[m];
    rep(i,m) cin >> p[i] >> s[i];

    // 演算の用意
    vector<bool> ac_flag(n+3);
    rep(i,n+3) ac_flag[i]=false;
    vector<int> pena_sum(n+3);
    int ans=0,pena=0;

    rep(i,m){
        // 解いたことない
        if(ac_flag[p[i]]==false){
            if(s[i]=="AC"){
                ans++;
                ac_flag[p[i]] = true;
            }
            else{
                pena_sum[p[i]]++;
            }
        }
    }

    rep(i,n+3){
        if(ac_flag[i]){
            pena+=pena_sum[i];
        }
    }

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

Measured memory_bytes: 6528
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<vector>
#include<queue>
#include<deque>
#include<iomanip>
#include<map>
using namespace std;
typedef pair<int, pair<int, int> >PP;
typedef long long ll;
typedef pair<int, int>P;
typedef vector<int>vec;
int inf=-1;
ll mod = pow(10, 9) + 7;

int main(){
    int n,m;cin>>n>>m;
    ll a[100010];
    priority_queue<ll> que;
    for(int i=0;i<n;i++){
        cin>>a[i];
        que.push(a[i]);
    }
    for(int i=0;i<m;i++){
        int b=que.top()/2;
        que.pop();
        que.push(b);
    }
    ll ans=0;
    for(int i=0;i<n;i++){
        ans+=que.top();
        que.pop();
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1912
count = gets.to_i
head = []
tail = []

nums = gets.split.map(&:to_i)

nums.each{|n|
    head.push(head.empty? ? n : head.last.gcd(n))
}

nums.reverse_each{|n|
    tail.push(tail.empty? ? n : tail.last.gcd(n))
}

tail.reverse!
last_index = count - 1

puts (0..last_index).map{|index|
    if index == 0
        tail[1]
    elsif index == last_index
        head[last_index -1]
    else
        head[index - 1].gcd(tail[index + 1])
    end
}.max

Measured memory_bytes: 11012
#include<stdio.h>
#include<string.h>
int a[27];
 int main()
 {
 	char b[100005];
 	scanf("%s",b);
 	for(int i=0;i<strlen(b);i++)
 	a[b[i]-96]++;
 	int j;
 	for( j=1;j<=26;j++)
 		if(a[j]==0)
 			{
			 printf("%c\n",j+96);
			 break;
 		}
 		if(j>26)
 		printf("None\n");
 	
 	return 0;
 }

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

int main(void){
	int n, dp[1001], i, j;
	while(1){
		scanf("%d",&n);
		if(!n) return 0;
		memset(dp,0,sizeof(dp));
		for(i = 1;i < n;i++){
			for(j = n - 1;j >= 0;j--){
				if(i + j <= n && dp[j]){
					dp[i + j]++;
					dp[j]--;
				}
			}
			dp[i]++;
		}
		printf("%d\n",dp[n]);
	}
}

Measured memory_bytes: 1032
def gcd(x, y):
  while y != 0:
      x, y = y, x%y
  return x
  
N = int(input())

monst = [int(i) for i in input().split()]

for i in range(N-1):
  ans = gcd(monst[i], monst[i+1])
  monst[i+1] = ans

print(ans)

Measured memory_bytes: 14252
n, m = map(int, input().split())
H = list(map(int, input().split()))
A = [0 for i in range(n)]

for i in range(m):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1
    if H[a] == H[b]:
        A[a] += 1
        A[b] += 1
    elif H[a] > H[b]:
        A[b] += 1
    else:
        A[a] += 1

ans = 0
for i in range(n):
    if A[i] == 0:
        ans += 1
    else:
        pass
print(ans)

Measured memory_bytes: 20136
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
typedef vector<int> vi;
#define endl '\n'
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define rf(i,a,b) for(int i=a;i>=b;i--) 
#define fast_io ios_base::sync_with_stdio(0);
#define show(x) cout<<x<<endl;
#define pret(x) cout<<x<<endl; return 0;
#define disp(x) cout<<x<<" ";
#define let(x,y) cout<<x<<" "<<y<<endl;
ll MOD=1e9+7;
const int maxn=2e5+5;

int32_t main(){
    fast_io;
    int l,r,d;
    cin>>l>>r>>d;
    int ans = 0;
    fo(i,l,r){
    	if(i%d == 0) ans++;
    }
    show(ans);
    return 0;
}

Measured memory_bytes: 3648
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(str, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
S = LIST()

print("Three" if len(set(S))==3 else "Four")

Measured memory_bytes: 5148
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
using namespace std;
#define rep(i, s, n) for(int i = s; i < n; i++) 
#define ll long long

int main() {
    const ll N = 1e9+7;
    int n, k;
    cin >> n >> k;

    vector<vector<ll>> dp(2020, vector<ll>(2020, 0));
    dp[0][0] = 1;
    dp[1][0] = 1;
    dp[1][1] = 1;
    rep(i, 2, 2001) {
        dp[i][0] = 1;
        rep(j, 1, i) {
            dp[i][j] = dp[i-1][j]+dp[i-1][j-1]%N;
        }
        dp[i][i] = 1;
    }
    
    /*
    rep(i, 0, n+1) {
        rep(j, 0, n+1) {
            cout << dp[i][j] << " ";
        }
        cout << endl;
    }
    */
    

    int select = n-k+1;
    rep(i, 1, k+1) {
        ll ans = (dp[select][i]%N) * (dp[k-1][i-1]%N);
        cout << ans%N << endl;
    }
    return 0;
}

Measured memory_bytes: 32256
#include<cstdio>/*c++输入输出*/
#include<iostream>/*c++输入输出*/
#include<cmath>//c++数学 函数
#include<algorithm>//c++算法
#include<cstring>//字符串
#include<map>//数组
#include<queue>//队列
#include<stack>//栈
using namespace std;//……

int main(){
    int a,b,sum;
    while(~scanf("%d %d",&a,&b)){
    sum = a + b;
    if(sum < 10)
        printf("%d\n",sum);
    else
        printf("error\n");
    }
}


Measured memory_bytes: 256
def solve():
  x,y=map(int,input().split())
  k=y-2*x
  if (k&1 or k<0): 
    print("No")
    return
  j=4*x-y
  if(j&1 or j<0):
    print("No")
    return
  print("Yes")
  
solve()

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

int main(){
    int N;cin>>N;
    string S,T;cin>>S>>T;
    string A="";
    rep(i,N){
        A+=S[i];
        A+=T[i];
    }
    cout<<A<<endl;
    return 0;
}

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

int main() {
    int x;
    cin >> x;
    if (x) cout << 0 << endl;
    else cout << 1 << endl;
    return 0;
}

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

using LLONG = long long;
using namespace std;

int main()
{
    LLONG N; cin >> N;
    LLONG max = 0;
    for(max = sqrt(2 * N);; ++max)
    {
        LLONG tmp = max * (max + 1) / 2;
        if(tmp > N)
        {
            break;
        }
    }
    LLONG ng = max * (max + 1) / 2 - N;
    for(int i = 1; i <= max; ++i)
    {
        if(i != ng)
        {
            cout << i << endl;
        }
    }
}

Measured memory_bytes: 3636
class Problem
  attr_accessor *(?a..?z).to_a.map(&:to_sym)
  def initialize
    @n,@x = gets.to_s.split.map{ |v| v.to_i }
    @a = gets.to_s.split.map{ |v| v.to_i }
  end

  def solve
    gaps.inject(&:gcd)
  end

  def gaps
    a << x
    a.sort.each_cons(2).with_object([]) do |(a,b),ans|
      ans << b - a
    end
  end

  def show(ans)
    puts ans
  end
end

Problem.new.instance_eval do
  show(solve)
end

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

int main() {
    int n;
    int ans=0;
    cin>>n;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=i;j++){
            if(j*j+2*j>i-3) break;
            for(int k=1;k<i;k++){
                if(j*j+k*k+j*k+k+j>i-1) break;
                for(int l=1;l<i;l++){
                    if(j*j+k*k+l*l+j*k+k*l+j*l>i) break;
                    if(j*j+k*k+l*l+j*k+k*l+j*l==i) ans++;
                }
            }
        }
        cout<<ans<<endl;
        ans=0;
    }
}

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

int main()
{
	unsigned int K;
	cin >> K;

	string S;
	cin >> S;

	if (S.length() <= K)
	{
		cout << S << endl;
	}
	else
	{
		string sdot = S.substr(0, K);
		sdot.append("...");
		cout << sdot << endl;
	}

	return 0;
}

Measured memory_bytes: 3636
#include<iostream>
using namespace std;
int main(){
    int h,w;
    while(1){
        cin>>h>>w;
        if(h==0 && w==0)    break;
        for(int i=0; i<h; i++){
            for(int j=0; j<w; j++){
                if((i==0 || i==h-1) || (j==0 || j==w-1))    cout<<"#";
                else cout<<".";
            }
            cout<<endl;
        }
        cout<<endl;
    }
}


Measured memory_bytes: 3092
_ = int(input())
h = list(map(int, input().split()))
c = 0
while sum(h) != 0:
    c += 1
    non0 = False
    for i, n in enumerate(h):
        if non0 and n == 0:
            break
        if 1 <= n:
            non0 = True
            h[i] = n - 1
print(c)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}

int main() {
 int N,H;
 cin>>N>>H;
 vector<int>a(N),b(N);
 for(int i=0;i<N;i++){
   cin>>a[i]>>b[i];
 }
 int c=*max_element(a.begin(),a.end());
 sort(b.rbegin(),b.rend());
 int64_t sum=H,cnt=0;
 for(int i=0;i<N;i++){
   if(b[i]>c&&sum>0){sum-=b[i];cnt++;}
 }
 if(sum<=0){cout<<cnt<<endl;}
 else{cout<<(sum+c-1)/c+cnt<<endl;}
  return 0;
}

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

using namespace std;

#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
using ll = long long;
using Pint = pair<int, int>;
const ll mod = 1e9+7;

Pint f(int x) {
  int l = x%10;
  int t = 0;
  while (x) {
    t = x;
    x /= 10;
  }
  return Pint(t, l);
}

int main(int argc, char const* argv[])
{
  int n;
  cin >> n;
  map<Pint,int> freq;
  for (int i = 1; i <= n; i++) {
    Pint p = f(i);
    freq[p]++;
  }

  int ans = 0;
  for (int i = 1; i <= n; i++) {
    Pint p = f(i);
    Pint q = Pint(p.second, p.first);
    ans += freq[q];
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
using namespace std;

void solve(long long Q, long long H, long long S, long long D, long long N){
	H = min(H,2*Q);
	S = min(S,2*H);
	D = min(D,2*S);
	cout << (N / 2) * D + (N%2) * S << endl;
}

int main(){	
	long long Q;
	long long H;
	long long S;
	long long D;
	long long N;
	scanf("%lld",&Q);
	scanf("%lld",&H);
	scanf("%lld",&S);
	scanf("%lld",&D);
	scanf("%lld",&N);
	solve(Q, H, S, D, N);
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
constexpr int MOD = 1000000007;
constexpr int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
using Graph = vector<vector<int>>;
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; }
const long double PI = acos(-1.0);
// cout << fixed << setprecision(14);
 
signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int ans{};
	string S, T;
	cin >> S >> T;
	int N = S.size();
	rep(i,N){
		if(S[i] != T[i]) ++ans;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3772
#!/usr/bin/env python3

import math
from functools import reduce

k = int(input())


def gcd(*numbers):
    return reduce(math.gcd, numbers)


res = 0
for a in range(1, k + 1):
    for b in range(1, k + 1):
        for c in range(1, k + 1):
            res += gcd(a, b, c)

print(res)


Measured memory_bytes: 69552
n = int(raw_input())
S = []
for i in range(n):
    S.append(raw_input())

result = ""
for i in range(97, 97 + 26):
    num = []
    for j in range(len(S)):
        num.append(S[j].count(unichr(i)))
    repeat = min(num)
    result = result + unichr(i) * repeat

print(result)

Measured memory_bytes: 2568
import java.util.*;

//update 2020/1/1 23:01

public class Main{

  static Scanner sc = new Scanner(System.in);
  static StringBuilder sb = new StringBuilder();

  public static void main(String[] args) {

    int n = nextInt();
    int m = nextInt();
    int q = nextInt();
    int[] a = new int[q+1];
    int[] b = new int[q+1];
    int[] c = new int[q+1];
    int[] d = new int[q+1];
    for(int i=1;i<=q;i++){
      a[i] = nextInt();
      b[i] = nextInt();
      c[i] = nextInt();
      d[i] = nextInt();
    }

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

    long score = 0;

    long ans = 0;

    while(A[0]<=0){
      //得点計算ゾーン
      for(int i=1;i<=q;i++){
        if(A[b[i]]-A[a[i]]==c[i]){
          score += d[i];
        }
      }
      ans = Math.max(ans,score);
      score = 0;
      /////////////////

      for(int j=n;0<=j;j--){
        A[j]++;
        for(int k=j+1;k<=n;k++){
          A[k] = A[k-1];
        }
        if(A[j]<=m){
          break;
        }
      }
    }


    System.out.println(ans);

  }

  static int lcm(int a,int b){
    return a*b*gcd(a,b);
  }

  static int gcd(int a,int b){
    if(a%b!=0){
      return gcd(b,a%b);
    }
    else{
      return b;
    }
  }

  /*
    static String toSmall(String s){
      char c = s.charAt(0);
      //if(Character.isUpperCase(c)){
      if(c<=90){
        c += 32;
      }
      return String.valueOf(c);
    }
    static String toBig(String s){
      char c = s.charAt(0);
      //if(Character.isLowerCase(c)){
      if(c>=97){
        c -= 32;
      }
      return String.valueOf(c);
    }
  */

  static String toSmall(String s){
    return s.toLowerCase();
  }

  static String toBig(String s){
    return s.toUpperCase();
  }

  static String next(){
    return sc.next();
  }

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

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

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

  static String[] splitString(String s){
    return s.split("");
  }

  static char[] splitChar(String s){
    return s.toCharArray();
  }

  static int charToInt(char a){
    return a - 48;
  }

////////////////////////////////////////////
  public static int max(int[] a){
    int lng = a.length;
    int max = a[0];
    for(int i=1;i<lng;i++){
      max = Math.max(max,a[i]);
    }
    return max;
  }
  public static long max(long[] a){
    int lng = a.length;
    long max = a[0];
    for(int i=1;i<lng;i++){
      max = Math.max(max,a[i]);
    }
    return max;
  }
////////////////////////////////////////////

////////////////////////////////////////////
  public static int min(int[] a){
    int lng = a.length;
    int min = a[0];
    for(int i=1;i<lng;i++){
      min = Math.min(min,a[i]);
    }
    return min;
  }
  public static long min(long[] a){
    int lng = a.length;
    long min = a[0];
    for(int i=1;i<lng;i++){
      min = Math.min(min,a[i]);
    }
    return min;
  }
////////////////////////////////////////////

}


Measured memory_bytes: 36452
#include<bits/stdc++.h>
using namespace std;
char c[1005][1005];
int dp[1005][1005];
const int MOD=1e9+7;
int main(){
	int h,w;
	cin>>h>>w;
	for(int i=0;i<h;i++){
		cin>>c[i];
	}
	dp[0][0]=1;
	for(int i=1;i<w;i++) dp[0][i]=(c[0][i]=='#')?0:dp[0][i-1];
	for(int i=1;i<h;i++) dp[i][0]=(c[i][0]=='#')?0:dp[i-1][0];
	for(int i=1;i<h;i++){
		for(int j=1;j<w;j++){
			if(c[i][j]=='#'){
				dp[i][j]=0;
				continue;
			}
			if(c[i-1][j]!='#'){
				dp[i][j]+=dp[i-1][j];
			}
			if(c[i][j-1]!='#'){
				dp[i][j]+=dp[i][j-1];
			}
			if(dp[i][j]>=MOD) dp[i][j]-=MOD;
		}
	}
	cout<<dp[h-1][w-1];
	return 0;
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
using  namespace std;
typedef long long ll;
#define RAP(i, n) for(ll i=0;i<(n);i++)
#define FOR(i, a, b) for(ll i=(a);i<(b);i++)
vector<ll> ans;
vector<vector<ll>> Tree;
void dfs(ll index, ll prev_index){
  ans[index] += ans[prev_index];
  for(int itr:Tree[index]){
    if(itr != prev_index){
      dfs(itr, index);
    } 
  }
}
int main(){
  ll n, q, a, b, p, x;
  cin >> n >> q;
  Tree.resize(n+1);
  ans.resize(n+1, 0);
  RAP(i, n-1){
    cin >> a >> b;
    Tree[a].push_back(b);
    Tree[b].push_back(a);
  }
  RAP(i, q){
    cin >> p >> x;
    ans[p] += x;
  }
  dfs(1, 0);
  for(ll i=1;i<=n;i++){
    cout << ans[i] << " ";
  }
  cout  << endl;
  return 0;
}


Measured memory_bytes: 24320
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    static int MOD = 1_000_000_007;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] a = new int[N];
        int[] b = new int[M];
        int[][] c = new int[N*M][2];
        for(int i = 0; i <N*M; i++)Arrays.fill(c[i], -1);
        int min = Integer.MAX_VALUE;
        long ans = 1;
        boolean valid = true;
        for(int i = 0; i < N; i++) {
            a[i] = sc.nextInt();
            if(a[i] < min) min = a[i];
            if(c[a[i]-1][0] != -1){
                valid = false;
                break;
            }else c[a[i]-1][0] = i;
        }
        for(int i = 0; i < M; i++) {
            b[i] = sc.nextInt();
            if(b[i] < min) min = b[i];
            if(c[b[i]-1][1] != -1){
                valid = false;
                break;
            }else c[b[i]-1][1] = i;
        }
        if(valid){
            long n = 0;
            long m = 0;
            long count = 0;
            for(int i = N*M; i >= min; i--){
                count = N*M-i;
                if(c[i-1][0] != -1 && c[i-1][1] != -1){
                    n++; m++;
                    continue;
                }else if(c[i-1][0] == -1 && c[i-1][1] == -1){
                    if(n*m <= count){
                        ans = 0;
                        break;
                    }else{
                        ans = (ans * (n*m -count))%MOD;
                    }
                }else if(c[i-1][0] == -1 && c[i-1][1] != -1){
                    ans = (ans * n)%MOD;
                    m++;
                }else if(c[i-1][0] != -1 && c[i-1][1] == -1){
                    ans = (ans * m)%MOD;
                    n++;
                }
            }
            if(min >2) for(int i = min-1; i >0; i--) ans = (ans * i)%MOD;
            System.out.println(ans);
        }else{
            System.out.println(0);
        }
        sc.close();
    }

}


Measured memory_bytes: 57212
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define fi first
#define se second
#define INF 1000000009
#define LLINF 1000000000000000009LL
using ll = long long;

int main(){
  int n;
  ll k;
  cin>>n>>k;
  vector<int>a(n);
  rep(i,n)cin>>a[i],a[i]--;
  vector<int>s;
  vector<int>d(n,-1);
  int ans=0;
  {
    int v=0;
    while(d[v]==-1){
      d[v]=s.size();
      s.push_back(v);
      v=a[v];
    }
    int c=s.size()-d[v];
    ll l=d[v];
    if(k<l)ans=s[k];
    else ans=s[(k-l)%c+l];
  }
  cout<<ans+1<<endl;
  return(0);
}


Measured memory_bytes: 5868
#include<bits/stdc++.h>
using namespace std;
typedef signed long long int ll;
ll inf=1000000007;

vector<pair<int, int>> fs;//素因数分解の素数，指数のペア
void fuctorization(int base){
    //base以下のiが約数か
    for(int i=2;i*i<=base;i++){
        //iで割り切れるならで限界まで割る
        if(base%i==0){
            int cnt=0;
            while(base%i==0){
                base/=i;
                cnt++;
            }
            fs.emplace_back(i,cnt);
        }
    }
    //baseが素数
    if(base>1){
        fs.emplace_back(base,1);
    }
}


/*vector<ll> fac;
void factorial_prepare(ll n){
    fac[0]=1;
    for(ll i=0;i<n;i++){
        fac[i+1]=fac[i]*(i+1);
    }
}


ll split(ll n,ll k){
    factorial_prepare(n+k-1);
    ll c=fac[n+k-1];
    c/=fac[n];
    c/=fac[k-1];
    c%=inf;
    return c;
}*/

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll comb(ll n,ll k){
    ll c=1;
    for(ll i=0;i<k;i++){
        c*=(n-k+i+1);
        c/=(i+1);
        c%=inf;
    }
    
    c%=inf;
    return c;
}

int main(){
    int n,m;
    cin>>n>>m;
    
   
    COMinit();
    
    
    fuctorization(m);
    ll ans=1;
    for(ll i=0;i<fs.size();i++){
        ans*=COM(n+fs[i].second-1,fs[i].second);
        ans%=inf;
    }
    ans%=inf;
    cout<<ans;
}


Measured memory_bytes: 12160
package main

import (
	"fmt"
	"sort"
)

func main() {
	var x_count, y_count, x, y int
	fmt.Scan(&x_count, &y_count, &x, &y)

	x_arr := make([]int, x_count)
	y_arr := make([]int, y_count)

	for i := 0; i < x_count; i++ {
		fmt.Scan(&x_arr[i])
	}

	for i := 0; i < y_count; i++ {
		fmt.Scan(&y_arr[i])
	}

	sort.Ints(x_arr)
	sort.Ints(y_arr)

	last_x := x_arr[x_count-1]
	first_y := y_arr[0]

	ans := "War"
	for i := x + 1; i <= y; i++ {
		if last_x < i && i <= first_y {
			ans = "No War"
			break
		}

	}

	fmt.Println(ans)
}


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

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N; cin >> N;
  vector<int> x(N), y(N);
  vector<ll> h(N);
  vector<pair<ll, pair<int, int> > > hh;
  REP(i, N){
    cin >> x[i] >> y[i] >> h[i];
    hh.push_back({h[i], {x[i], y[i]}});
  }
  sort(hh.begin(), hh.end());
  REP(i, 101){
    REP(j, 101){
      bool flag = true;
      ll H = abs(i-hh[N-1].second.first)+abs(j-hh[N-1].second.second)+hh[N-1].first;
      REP(k, N-1){
        if(H-abs(i-hh[k].second.first)-abs(j-hh[k].second.second) != hh[k].first){
          if(H-abs(i-hh[k].second.first)-abs(j-hh[k].second.second) < 0 && hh[k].first == 0){
            continue;
          }else{
            flag = false;
            break;
          }
        }
      }
      if(flag){
        cout << i << " " << j << " " << H << endl;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 3584
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var N = cin.ReadInt;
            var M = cin.ReadInt;
            if (N == M)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}

Measured memory_bytes: 11220
#include<stdio.h>

int main(){
    int h, w, k;
    scanf("%d%d%d", &h, &w, &k);
    int t[h][w];
    int x = 1;
    for(int i=0; i<h; i++){
        char s[w+1];
        scanf("%s", s);
        for(int j=0; j<w; j++){
            if(s[j] == '.'){
                t[i][j] = -1;
            }else{
                t[i][j] = x;
                x++;
            }
        }
    }
    for(int i=0; i<h; i++){
        int buf = 0, id = -1;
        for(int j=0; j<w; j++){
            if(t[i][j] != -1){
                id = t[i][j];
                for(int l=buf; l<=j; l++){
                    t[i][l] = id;
                }
                buf = j+1;
            }
        }
        if(buf < w && id != -1){
            for(int l = w-1; l>=0; l--){
                if(t[i][l] != -1){
                    break;
                }
                t[i][l] = id;
            }
        }
    }
    if(t[0][0] == -1){
        int buf = 0;
        for(int i=0; i<h; i++){
            if(t[i][0] != -1){
                buf = i;
                break;
            }
        }
        for(int i=buf-1; i>=0; i--){
            for(int j=0; j<w; j++){
                t[i][j] = t[i+1][j];
            }
        }
    }
    for(int i=1; i<h; i++){
        if(t[i][0] == -1){
            for(int j=0; j<w; j++){
                t[i][j] = t[i-1][j];
            }
        }
    }
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            printf("%d", t[i][j]);
            if(j < w-1){
                printf(" ");
            }else{
                printf("\n");
            }
        }
    }

    return 0;
}

Measured memory_bytes: 1024
import java.util.*;

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

        while(N >= 500){
            N -= 500;
        }
        if(N <= A){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 21716
#include<stdio.h>

int main(void){

    int N, X, T, ans;

    scanf("%d %d %d",&N,&X,&T);

    if(N % X == 0){
        ans = (N/X) * T;
    }else{
        ans = ((N/X)+1) * T;
    }

    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 1736
#include <bits/stdc++.h>
/* #include <iostream> */
/* #include <vector> */
using namespace std;
#define _GLIBCXX_DEBUG

const int INF = 1001001001;
template <typename itr> void output(itr first, itr last) {
  for (auto iter = first; iter != last; ++iter) {
    for (int i : *iter) {
      if (i == INF)
        cerr << "INF"
             << ", ";
      else
        cerr << i << ", ";
    }
    cerr << endl;
  }
  cerr << endl;
}
/* auto output = [](auto first, auto last) { */
/*   cerr << '{'; */
/*   for (auto iter = first; iter != last; ++iter) { */
/*     cerr << *iter << ", "; */
/*   } */
/*   cerr << '}' << endl; */
/* }; */

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  vector<vector<int>> K(n + 1, vector<int>(n + 1, INF));
  for (int i = 0; i < m; i++) {
    int a, b, c, d;
    scanf("%d,%d,%d,%d", &a, &b, &c, &d);
    K[a][b] = c;
    K[b][a] = d;
  }
  int s, g, V, P;
  scanf("%d,%d,%d,%d", &s, &g, &V, &P);
  for (int k = 1; k <= n; k++) {
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        if (K[i][j] > K[i][k] + K[k][j]) {
          K[i][j] = K[i][k] + K[k][j];
        }
      }
    }
  }
  cout << V - P - K[s][g] - K[g][s] << endl;
}



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

int main() {
  int n, y, b[100], r, t;
  double money[100];
  while( cin >> n, n) {
    cin >> y;

    int maxim = 0;
    for(int i=0; i<n; i++) {
      cin >> b[i] >> r >> t;
      if( t == 1 ) money[i] = 1 + r*y/100.0;
      else money[i] = pow((100+r)/100.0, y); 
    }

    for(int i=1; i<n; i++) {
      if( money[maxim] < money[i] ) maxim = i;
    }
    cout << b[maxim] << endl;
  }
}

Measured memory_bytes: 1164
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <iomanip>
#include <queue>
#include <functional>
#include <cassert>
#include <cmath>

using namespace std;
using ll = unsigned long long;

int main() {

	string s;
	int ans = 0;

	cin >> s;

	for (auto c : s) {
		if (c == '+') {
			ans++;
		}
		else {
			ans--;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll MOD=1e9+7;
static const int MAX = 100;
static const int INF = (1<<23);
template<class T> T gcd(T a, T b){return b? gcd(b,a%b) : a;}
template<class T> T lcm(T a,T b){return a / gcd(a,b)*b;}

int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    int ans = 0;
    rep(i,n){
        if(i+2<n&&s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C'){
            ans++;
        }
    }
    cout<<ans<<endl;
    
    
    
return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
typedef long long ll;
char s[610][610];
int map[305][305];

#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<=n;++i)
int main(){
  int n,x,y;
  char buf;
  cin>>n;
  rep(i,n){
    rep(j,n){
      cin>>buf;
      s[i][j]=buf;
      s[i+n][j]=buf;
      s[i][j+n]=buf;
      s[i+n][j+n]=buf;
      map[i][j]=0;
    }
  }
  int ans=0;
  rep(a,n){
      int check=0;
      rep(i,n){
	for(int j=i+1;j<n;j++){
	  if(s[i+a][j]!=s[j+a][i])goto FINE;
	}
      }
      ans+=n-a;
    FINE:;
  }
  rep1(b,n-1){
    int check=0;
    rep(i,n){
      for(int j=i+1;j<n;j++){
	if(s[i][j+b]!=s[j][i+b])goto FINE2;
      }
    }
    ans+=n-b;
  FINE2:;
  }
  cout<<ans<<endl;
  return 0;
}


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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector <vector<int>>;
using vvl = vector <vector<ll>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  vector<int> v;
  int n = s.size();
  s.push_back('$');
  int c = 0, now = '-';
  ll ans = 0;
  for (int i = 0; i < n; i++) {
    if (now == 'A') {
      if (s[i] == 'A') {
        c++;
      } else if (s[i] == 'B' && s[i + 1] == 'C') {
        ans += c;
        now = 'A';
        i++;
      } else {
        c = 0;
        now = '-';
      }
    } else {
      if (s[i] == 'A') {
        c = 1;
        now = 'A';
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 720
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define INF 1000000
using namespace std;
int main(){
    int n;
    cin >> n;
    long long ans = 1;
    while(1){
        if(n == 1) break;
        //cout << ans << endl;
        ans *= n;
        n--;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3088
#include<stdio.h>
int main(void) {
	int d, n;
	scanf("%d", &d);
	scanf("%d", &n);
	if (n == 100) {
		if (d == 0)
			printf("%d", n+1);
		else if (d == 1) printf("%d", (n+1) * 100);
		else printf("%d", (n+1) * 10000);
	}
	else {
		if (d == 0)
			printf("%d", n);
		else if (d == 1) printf("%d", n * 100);
		else printf("%d", n * 10000);

	}
	









	





	return 0;

}

Measured memory_bytes: 128