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

string chmax(string a, string b){
  if(a.size() < b.size()) return b;
  else if(a.size() > b.size()) return a;
  else return a > b ? a : b;
}

int main(){
  int W, H;
  char C[70][70];
  string dp[70][70];

  while(cin >> W >> H, W){
    for(int i = 0; i < H; ++i){
      for(int j = 0; j < W; ++j){
        cin >> C[i][j];
      }
    }
    for(int i = 0; i < H; ++i){
      for(int j = 0; j < W; ++j){
        if(isdigit(C[i][j])) dp[i][j] = string( 1, C[i][j]);
        else dp[i][j] = "0";
      }
    }
    for(int j = 0; j < H; ++j){
      for(int k = 0; k < W; ++k){
        if(dp[j][k] == "0") continue;
        if(k + 1 < W && isdigit(C[j][k + 1])) dp[j][k + 1] = chmax( dp[j][k + 1], dp[j][k] + C[j][k + 1]);
        if(j + 1 < H && isdigit(C[j + 1][k])) dp[j + 1][k] = chmax( dp[j + 1][k], dp[j][k] + C[j + 1][k]);
      }
    }
    string ret = "0";
    for(int i = 0; i < H; ++i){
      for(int j = 0; j < W; ++j) ret = chmax( ret, dp[i][j]);
    }
    cout << ret << endl;
  }
}

Measured memory_bytes: 1440
// C - Neither AB nor BA
#include <bits/stdc++.h>

using namespace std;

#define	MOD	998244353

vector<long long> fact, finv;

void init_fact(int n = 1000000)
{
	fact.resize(n); finv.resize(n);
	fact[0] = finv[n - 1] = 1;
	for (int i = 1; i < n; i++) fact[i] = fact[i - 1] * i % MOD;
	for (long long x = MOD - 2, a = fact[n - 1]; x > 0; a = a * a % MOD, x >>= 1)
		if (x & 1) finv[n - 1] = finv[n - 1] * a % MOD;
	for (int i = n - 2; i >= 0; i--) finv[i] = finv[i + 1] * (i + 1) % MOD;
}

long long cnr(int n, int r)
{
	if (r < 0 || r > n) return 0;
	if (r == 0 || r == n) return 1;
	return fact[n] * finv[r] % MOD * finv[n - r] % MOD;
}

int main(int argc, char *argv[])
{
	long long n;
	cin >> n;

	init_fact(n + 1);

	long long ans = 1;
	for (int i = 0; i < n; i++) ans = ans * 3 % MOD;

	vector<long long> p2(n + 1, 1);
	for (int i = 0; i < n; i++) p2[i + 1] = (p2[i] * 2) % MOD;
	for (long long i = n / 2 + 1; i <= n; i++)
		ans = (ans - cnr(n, i) * p2[n - i] * 2 % MOD + MOD) % MOD;

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 234624
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define fore(x, c) for(auto &&x : c)
#define rep(i, a, n) for(int i = a, i##len = (int)(n); i < i##len; ++i)
#define rrep(i, a, n) for(int i = (int)(n - 1); i >= a; --i)
#define sz(c) ((int)c.size())
#define contains(c, x) (c.find(x) != end(c))
#define inseg(l, x, r) ((l) <= (x) && (x) < (r))
#define dump(...)
#define pb push_back
#define eb emplace_back
#define _ 0
const signed INF_ = 1001001001; const long long INF = 1001001001001001001LL;
const int DX[9] = {0,1,0,-1,1,1,-1,-1,0}, DY[9] = {-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is, vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
  is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a, const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a, const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap = priority_queue<T, deque<T>, greater<T>>;
struct before_main_function {
  before_main_function() {
      cin.tie(nullptr); ios::sync_with_stdio(0);
      cout << setprecision(15) << fixed;
  }
} before_main_function;
// clang-format on
//------------------8<------------------------------------8<--------------------

signed main() {
  int H;
  cin >> H;
  int ans = 0;
  int w = 0;
  int x = H;
  while (x) {
    w++;
    x >>= 1;
  }
  ans = (1LL << w) - 1;
  cout << ans << endl;
  return (0 ^ _ ^ 0);
}



Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class APassword {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long n = in.nextLong();
            out.println(Long.valueOf((long) Math.pow(n, 3)));
        }

    }
}



Measured memory_bytes: 21716
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)



int main() {
	ll A, B,ans=0;
	std::cin >> A >> B;

	repeq(i, A, B) {
		ans++;
		string s = to_string(i);
		rep(j, 0, s.length()) {
			if (s[j] != s[s.length() - 1 - j]) {
				ans--;
				break;
			}
		}
	}

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


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

inline int ceiling_div(int a, int b){ // ceiling(a/b)= floor((a+b-1)/b)
  return (a+b-1)/b;
}

int main(){
  using station= tuple<int, int, int>;
  int N,atTstart,forTwait,forTtrans;
  cin >> N;

  vector<station> data(N);
  for(int i=0; i<N-1; i++){
    cin >> forTtrans >> atTstart >> forTwait;
    data.at(i)= make_tuple(atTstart, forTwait, forTtrans);
  }
  data.back()= make_tuple(0, 1, 0);

  vector<int> ans(N);
  for(int s=0; s<N-1; s++){
    int atTarrive= 0;
    for(int i=s; i<N; i++){
      tie(atTstart, forTwait, forTtrans)= data.at(i);

      int atToff= atTstart+ forTwait* max(0, ceiling_div(atTarrive- atTstart, forTwait));
      atTarrive= atToff+ forTtrans;
    }

    ans.at(s)= atTarrive;
  }

  for(auto elem:ans){
    cout << elem << endl;
  }
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

from itertools import accumulate
from bisect import bisect, bisect_left
from collections import Counter, deque, defaultdict
from functools import reduce
from itertools import accumulate
from operator import itemgetter, xor
from string import ascii_lowercase as abc

from sys import setrecursionlimit
setrecursionlimit(10**9)
 
import sys
#input = sys.stdin.readline
from collections import Counter
def inpl(): return list(map(int, input().split()))

N, M, P = inpl()
INF = 10**12
G = [[] for _ in range(N)]
E = []
G2 = [[] for _ in range(N)]
rG2 = [[] for _ in range(N)]
for _ in range(M):
    a, b, c = inpl()
    G[a-1].append([b-1, -c+P])
    G2[a-1].append(b-1)
    rG2[b-1].append(a-1)
    E.append([a-1, b-1, -c+P])


def SCC(G, rG):
    N = len(G)
    def dfs(i):
        nonlocal t, rorder, searched
        searched[i] = True
        for j in G[i]:
            if not searched[j]:
                dfs(j)
        rorder[t] = i
        t += 1

    def rdfs(i):
        nonlocal t, group, g
        group[i] = g
        for j in rG[i]:
            if group[j] == -1:
                rdfs(j)

    t = 0
    rorder = [-1]*N
    searched = [0]*N
    group = [-1]*N

    for i in range(N):
        if not searched[i]:
            dfs(i)
    g = 0
    for i in range(N-1, -1, -1):
        if group[rorder[i]] == -1:
            rdfs(rorder[i])
            g += 1
    return group, g


def belman_ford(V, edges, r):
    "If glaph contains negative cycles then return True"
    D = [INF]*(V)
    D[r] = 0
    if V == 1:
        return False, [0]
    OK = True
    for _ in range(V-1):
        update = False
        for s, t, d in edges:
            if D[t] > D[s] + d:
                D[t] = D[s] + d
                update = True
        if not update:
            OK = False
    return OK, D

group, gsize = SCC(G2, rG2)
groups = [[] for _ in range(gsize)]
for i in range(N):
    groups[group[i]].append(i)

score = [10**12 for _ in range(N)]
negative_groups = [0]*N


for g in range(gsize):
    ggs = set(groups[g])
    s = groups[g][0]
    score[s] = 0
    Q = deque([s])
    while Q:
        p = Q.popleft()
        for q, c in G[p]:
            if not q in ggs:
                continue
            if score[p] + c < score[q]:
                score[q] = score[p] + c
                Q.append(q)
        if score[s] < 0:
            for g in ggs:
                negative_groups[g] = 1
            break

s = 0
Q = deque([s])
reach1 = [0]*N
reach1[0] = 1

while Q:
    p = Q.popleft()
    for q in G2[p]:
        if not reach1[q]:
            reach1[q] = 1
            Q.append(q)

s = N-1
Q = deque([s])
reachN = [0]*N
reachN[-1] = 1

while Q:
    p = Q.popleft()
    for q in rG2[p]:
        if not reachN[q]:
            reachN[q] = 1
            Q.append(q)

NEGATIVE, D = belman_ford(N, E, 0)

if any([reach1[i]&reachN[i]&negative_groups[i] for i in range(N)]) or reach1[-1]==0:
    print(-1)
else:
    print(max(0, -D[-1]))


Measured memory_bytes: 73440
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
    int a[4];
    scanf("%d%d%d",&a[1],&a[2],&a[3]);
    sort(a+1,a+4);
    if(a[3]>=a[2])printf("%d\n",a[1]+a[2]);
    else printf("%d\n",a[2]+a[3]);
    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(){

    int a,b,c;
    int count = 0;

    scanf("%d %d %d",&a,&b,&c);

    for(int i=a;i<=b;i++){
        if(c%i==0){
            count++;
        }
    }

    printf("%d\n",count);
    
}


Measured memory_bytes: 2104
#include <stdio.h>
double max(double a, double b){
  if(b<a)return a;
  else return b;
}
int main(){
  double a,b,c,d,e,f;
  scanf("%lf%lf%lf%lf%lf%lf", &a,&b,&c,&d,&e,&f);
  int res2=-1,res1=0;
  double tmp2=0;
  for(int i=0;i<100;i++){
    for(int j=0;j<100;j++){
        double mass = (i*a + j*b)*100;
        if(mass>f)break;
        double max_sugar = (i*a+j*b)*e;

        for(int k=0;k<100;k++){
          for(int l=0;l<100;l++){
            double sug = k*c+l*d;
            double tmp3=tmp2;
            if(sug<=max_sugar &&  mass+sug <= f){
              tmp2 = max(tmp2,(sug*100/(mass+sug)));
            }
            if(tmp3!=tmp2){
              res1 = mass+sug;
              res2 = sug;
            }
          }
        }
    }
  }
  printf("%d %d\n", (int)res1,(int)res2);
  return 0;
}


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

using namespace std;
int main()
{
	int N,L;
	cin >> N >> L;
	vector<string> s(N);
	for(int i=0; i<N; i++){
		cin >> s[i];
	}
	sort(s.begin(),s.end());
	for(int i=0; i<N; i++){
		cout << s[i];
	}
	cout << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i < (n); i++)
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
using namespace std;
using ll = long long;
int INF = 1001001001;

int main() {
  int x;
  cin >> x;
  while(1) {
    bool ok = true;
    rep(i, sqrt(x)) {
      if(i<=1) continue;
      if(x % i == 0) ok = false;
    }
    if(ok) {
      cout << x << endl;
      break;
    }
    x++;
  }
  return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vl;
#define pll pair<ll, ll>
#define vpl vector<pll>
#define vb vector<bool>
#define PB push_back
#define MP make_pair
#define ln "\n"
#define forn(i,e) for(ll i=0; i<e; i++)
#define forsn(i,s,e) for(ll i=s; i<e; i++)
#define rforn(i,e) for(ll i=e; i>=0; i--)
#define rforsn(i,s,e) for(ll i=s; i>=e; i--)
#define vasort(v) sort(v.begin(), v.end())
#define vdsort(v) sort(v.begin(), v.end(),greater<int>())
#define F first
#define S second

#define out1(x1) cout << x1 << ln
#define out2(x1,x2) cout << x1 << " " << x2 << ln
#define out3(x1,x2,x3) cout << x1 << " " << x2 << " " << x3 << ln
#define out4(x1,x2,x3,x4) cout << x1 << " " << x2 << " " << x3 << " " << x4 << ln
#define out5(x1,x2,x3,x4,x5) cout << x1 << " " << x2 << " " << x3 << " " << x4 << " " << x5 << ln
#define out6(x1,x2,x3,x4,x5,x6) cout << x1 << " " << x2 << " " << x3 << " " << x4 << " " << x5 << " " << x6 << ln

#define in1(x1) cin >> x1
#define in2(x1,x2) cin >> x1 >> x2
#define in3(x1,x2,x3) cin >> x1 >> x2 >> x3
#define in4(x1,x2,x3,x4) cin >> x1 >> x2 >> x3 >> x4
#define in5(x1,x2,x3,x4,x5) cin >> x1 >> x2 >> x3 >> x4 >> x5
#define in6(x1,x2,x3,x4,x5,x6) cin >> x1 >> x2 >> x3 >> x4 >> x5 >> x6

#define mz(a)   memset(a,0,sizeof(a))
#define arrin(a,n) forn(i,n) cin >> a[i];
#define arrout(a,n) forn(i,n) {cout << a[i] << " ";} cout << ln;
#define TYPEMAX(type)   std::numeric_limits<type>::max()
#define TYPEMIN(type)   std::numeric_limits<type>::min()

#define zoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
int main() {
    zoom;
    ll x;
    in1(x);
    if (x>=30) out1("Yes");
    else out1("No");
    return 0;
}

Measured memory_bytes: 3660
/// In The Name Of God

#include <bits/stdc++.h>

#define f first
#define s second

#define pb push_back
#define pp pop_back
#define mp make_pair

#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()

#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, l, r) for (int i = (l); i >= (r); i--)

#define Kazakhstan ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);

#define nl '\n'
#define ioi exit(0);

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int N = (int)1e5 + 7;
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
const ll linf = (ll)1e18 + 7;

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

using namespace std;

int n;
int nxt[N][2];
ll A, B;
ll a[N];

void add(int &x, int y) {
	x += y;
	if (x >= mod) x -= mod;
	if (x < 0) x += mod;
}
int sum(int x, int y) {
	add(x, y);
	return x;
}

struct tree {
	int f[N];
	void upd(int p, int x) {
		for (; p < N; p |= p + 1) add(f[p], x);
	}
	int get(int p) {
		int res = 0;
		for (; p >= 0; p = (p & (p + 1)) - 1) {
			add(res, f[p]);
		}
		return res;
	}
	int get(int l, int r) {
		return sum(get(r), get(l - 1));
	}
} t[2];

bool good(int l, int r, bool type) {
	rep(i, l + 1, r) {
		if (!type && a[i] - a[i - 1] < A) return 0;
		if (type && a[i] - a[i - 1] < B) return 0;
	}
	return 1;
}
int dp[N][2], to[N][2];
int calc(int v = 1, bool type = 0) {
	if (v > n) return 1;
	if (~dp[v][type]) return dp[v][type];

	/*
	rep(i, v, to[v][type]) {
		//if (to[i + 1][type ^ 1] >= nxt[i][type]) add(res, calc(nxt[i][type], type ^ 1));
		/// [i + 1, nxt[i][type] - 1)
	}*/
	if (to[v + 1][type ^ 1] >= nxt[v][type]) t[type].upd(v, calc(nxt[v][type], type ^ 1));
	return dp[v][type] = t[type].get(v, to[v][type]);
}
int main() {
	#ifdef IOI2018
		freopen ("in.txt", "r", stdin);
	#endif
	Kazakhstan
	cin >> n >> A >> B;
	rep(i, 1, n) {
		cin >> a[i];
	}
	a[n + 1] = a[n] + linf;	
	{
		int p = n;
		to[n + 1][1] = to[n + 1][0] = n + 1;
		per(i, n, 1) {
			while (a[p] - a[i] >= A) p--;
			nxt[i][0] = p + 1;
			if (a[i + 1] - a[i] >= A && i < n) to[i][0] = to[i + 1][0];
			else to[i][0] = i;
		}
		p = n;
		per(i, n, 1) {
			while (a[p] - a[i] >= B) p--;
			nxt[i][1] = p + 1;
			if (a[i + 1] - a[i] >= B && i < n) to[i][1] = to[i + 1][1];
			else to[i][1] = i;
		}
	}
	rep(i, 1, n) {
		rep(type, 0, 1) {
			nxt[i][type] = max(nxt[i][type] - 1, i + 1);
		}
	}

/*
	dp[n + 1][0] = dp[n + 1][1] = 1;
	per(i, n, 1) {
		rep(type, 0, 1) {
			int l = i, r = to[i][type], res = n + 2;
			
			while (l <= r) {
				int mid = (l + r) >> 1;
				if (to[mid + 1][type ^ 1] >= nxt[i][type]) res = mid, r = mid - 1;
				else l = mid + 1;
			}
			rep(j, i, to[i][type]) {
				if (to[i + 1][type ^ 1] >= nxt[i][type]) add(dp[i][type], dp[nxt[i][type]][type ^ 1]);
			}
		}
	}
	*/

	
	memset(dp, -1, sizeof(dp));
	per(i, n, 1) {
		calc(i, 0);
		calc(i, 1);
	}
	cout << sum(calc(1, 0), calc(1, 1));
	ioi
}


Measured memory_bytes: 4224
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
typedef long long int ll;


int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    if(n%10==3){
        printf("bon\n");
    }
    else if(n%10==0||n%10==1||n%10==6||n%10==8){
        printf("pon\n");
    }
    else{
        printf("hon\n");
    }
}


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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    string O, E, answer;
    cin >> O >> E;
    int diff = O.size() - E.size();
    for (int i = 0; i < O.size(); ++i) {
        if(diff == 1) {
            answer.push_back(O[i]);
            if (i <= O.size() - 2) answer.push_back(E[i]);
        } else {
            answer.push_back(O[i]);
            answer.push_back(E[i]);
        }
    }
    cout << answer << endl;
    return 0;
}

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

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

  int p, sum = 0;
  for (int i = 0; i < C; i++) {
    cin >> p;
    sum += p;
  }

  if (sum % (N + 1) == 0) cout << sum / (N + 1) << endl;
  else cout << sum / (N + 1) + 1 << endl;
  
  return 0;
}


Measured memory_bytes: 3096
#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>;
#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))

int main()
{
  double N, M;
  cin >> N >> M;
  vector<int> A(N);
  rep(i, N) {
    cin >> A.at(i);
  }
  int sum = accumulate(A.begin(), A.end(), 0);
  sort(A.begin(), A.end(), greater<int>());
  rep(i, M) {
    if (A.at(i) < (sum * (1 / (4 * M))))
    {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

		for(int i=0;i<N;i++) {
			for(int j=0;j<D;j++) {
				map[i][j]=sc.nextInt();
			}
		}

		for(int i=0;i<N;i++) {
			for(int j=i+1;j<N;j++) {
				double d=0;
				for(int k=0;k<D;k++) {
					d+=(map[i][k]-map[j][k])*(map[i][k]-map[j][k]);
				}
				d=Math.sqrt(d);
				if(d==Math.floor(d)) {
					ans++;
				}
			}
		}
		System.out.println(ans);
	}
}


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

public class Main {
	static int mod = (int) 1e9 + 7;
	static int DX[] = { -1, 0, 1, 0 }, DY[] = { 0, -1, 0, 1 };

	public static void main(String[] args) {
		FastScanner fs = new FastScanner(System.in);
		long a = fs.nextLong(), b = fs.nextLong(), c = fs.nextLong(), d = fs.nextLong();
		long lcm = lcm(c,d);
		long na = 0, nb = 0;
		
		na = (a-1)/c + (a-1)/d - (a-1)/lcm;
		nb = b/c + b/d - b/lcm;
		long ans = (b - a + 1) - (nb - na);
		System.out.println(ans);
		
	}
	static long lcm(long x, long y) {
		return x / gcd(x, y) * y;
	}

	static long gcd(long x, long y) {
		return y == 0 ? x : gcd(y, x % y);
	}
}

//高速なScanner
class FastScanner {
	private BufferedReader reader = null;
	private StringTokenizer tokenizer = null;

	public FastScanner(InputStream in) {
		reader = new BufferedReader(new InputStreamReader(in));
		tokenizer = null;
	}

	public String next() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public String nextLine() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken("\n");
	}

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

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

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

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

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

Measured memory_bytes: 21076
from copy import deepcopy

H, W, K = map(int, input().split())

cs = [list(map(lambda c: 1 if c == '#' else 0, input())) for _ in range(H)]

count = 0
for hbits in range(1<<H):
    for wbits in range(1<<W):
        cs_copy = deepcopy(cs)
        for i in range(H):
            if (1 << i) & hbits:
                for j in range(W):
                    cs_copy[i][j] = 0
        for j in range(W):
            if (1 << j) & wbits:
                for i in range(H):
                    cs_copy[i][j] = 0
        blacks = sum(map(sum, cs_copy))
        if blacks == K:
            count += 1

print(count)

Measured memory_bytes: 71596
#include<iostream>
#include<vector>
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main()
{
  int n,count=1;
  cin>>n;
  vector<int> h(n);
  rep(i,n)
  {
    cin>>h[i];
  }
  for (int i = 1; i < n; i++)
  {
    bool flag=false;
    for(int j=0;j<=i;j++)
    {
      if(h[i]<h[j])
      {
        flag=true;
        break;
      }
    }
    if(flag)continue;
    else count++;
  }
  cout<<count<<endl;

  return 0;
}


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

char table[6][5] = {
    {'a', 'b', 'c', 'd', 'e'},
    {'f', 'g', 'h', 'i', 'j'},
    {'k', 'l', 'm', 'n', 'o'},
    {'p', 'q', 'r', 's', 't'},
    {'u', 'v', 'w', 'x', 'y'},
    {'z', '.', '?', '!', ' '}
};

string translate(string s) {
    if (s.length() % 2 == 1) {
        return "NA";
    }
    for (int i = 0; i < s.length(); i++) {
        if (i % 2 == 1 && !('1' <= s[i] && s[i] <= '5')) {
            return "NA";
        }
        if (!('1' <= s[i] && s[i] <= '6')) {
            return "NA";
        }
    }
    string ts;
    for (int i = 0; i < s.length(); i+=2) {
        int a = s[i]   - '0' - 1;
        int b = s[i+1] - '0' - 1;
        ts.push_back(table[a][b]);
    }
    return ts;
}

int main() {
    string s;
    while (cin >> s) {
        cout << translate(s) << endl;
    }
    return 0;
}

Measured memory_bytes: 0
package main

import "fmt"

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	var N, L int
	fmt.Scan(&N, &L)
	s := 0
	ans := 100 * 200
	x := -1
	for i := 0; i < N; i++ {
		s += L + i
		if abs(L+i) < ans {
			ans = abs(L + i)
			x = i
		}
	}
	fmt.Println(s - (L + x))
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <string>
#include <stdio.h>
#include <map>
#include <set>
#include <algorithm>

using namespace std;

int main()
{
  int x1, x2, y1, y2;
  cin >> x1 >> y1 >> x2 >> y2;

  int diff_x = x2 - x1, diff_y = y2 - y1;
  cout << x2 - diff_y << " " << y2 + diff_x << " " << x1 - diff_y << " " << y1 + diff_x;
}

Measured memory_bytes: 256
n = int(input())
s = list(map(int,input().split()))
s = [i-1 for i in s]
ans = 0
while(sum(s)!=-n):
    s_new=[i.replace("-1","a") for i in map(str,s)]
    s_join = ''.join(s_new)
    non = s_join.split("a")
    num = len([x for x in non if x])
    ans += num
    s = [max(i-1,-1) for i in s]
print(ans)

Measured memory_bytes: 3064
H, W = map(int, input().split())

lst = [input() for i in range(H)]

ans = []
for i in range(W):
	row = [j[i] for j in lst]
	if ("".join(row) != "." * H):
		ans.append("".join(row))

for i in range(H):
	row = [j[i] for j in ans]
	if ("".join(row) != "." * len(row)):
		print("".join(row))


Measured memory_bytes: 3064
#include <iostream>
//#include <iomanip>
//#include <vector>
//#include <string>
#include <algorithm>
#include <functional>

using namespace std;

int main(){

	int a, b, c, ans ;


	while (1){
		ans = 1;

		if(!(cin >> a)) break;
		cin >> b;

		c = a + b;

		while (c /= 10){
			ans++;
		}
		cout << ans << endl;
	}


	return 0;
}

Measured memory_bytes: 1160
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

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

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

const ll mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

struct combination {
  std::vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

ll N, M;
mint dp[500010];
combination comb( 1000000 );

int main()
{
  std::cin >> N >> M;

  mint ans = 0;

  rep( i, N+1 ) {
    ans += comb(N,i)*comb(M-i,N-i)*comb.fact[N-i]*(i&1 ? -1 : 1);
  }

  ans *= comb(M,N)*comb.fact[N];

  std::cout << ans.x << std::endl;

  return 0;
}

Measured memory_bytes: 22504
from collections import deque
def main():
    n,q = map(int,input().split())
    node = [[]for _ in range(n)]
    looked = [1]*n
    for i in range(n-1):
        a,b = map(int,input().split())
        node[b-1].append(a-1)
        node[a-1].append(b-1)
    counter = [0]*n
    for i in range(q):
        p,x = map(int,input().split())
        counter[p-1] += x
    queue = deque([0])
    looked[0] = 0
    while(queue):
        now = queue.pop()
        for i in node[now]:
            if looked[i]:
                queue.append(i)
                counter[i] += counter[now]
                looked[i] = 0
    print(*counter)
main()

Measured memory_bytes: 56088
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  map<string, int> m;
  for(int i =0;i < n; i++){
    string temp;
    cin >> temp;
    m[temp]++;
  }
  cout<<m.size()<<"\n";
  return 0;
}

Measured memory_bytes: 19100
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
int main() {
    int N,D,X;
    cin >> N >> D >> X ;
    vector<int> a(N);
    for(int i=0; i<N;i++){
        cin >> a.at(i);
    }
    int ans = 0;
    for(int i=0; i<N; i++){
        int count = 0;
        while(1+count*a.at(i) <= D){
            ans += 1;
            count += 1;
        }
    }
    ans += X;
    cout << ans << endl;
}

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

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}


int main() {

int a,b,x;
cin >> x >> a >> b;

if(abs(a-x)>abs(b-x))cout << 'B' << endl;
else cout << 'A' << endl;

return 0;

}

Measured memory_bytes: 256
#pragma GCC optimize("O3")

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

typedef long long ll;
typedef pair<int, int> pi;
tree<int,int,greater<int>,rb_tree_tag,tree_order_statistics_node_update> map_t;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for(int i = 0; i < (a); ++i)
#define pb push_back
#define sz(x) (int)x.size()
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
const int INF=1e9;

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    string s;
    cin >> s;
    int n=sz(s);
    vector<vector<int>> dp(n,vector<int>(2,INF));
    int first=s[0]-'0';
    dp[0][0]=min(first,10-first+1);
    dp[0][1]=min(first+1,10-(first+1)+1);
    FOR(i,1,n)
    {
        int num=s[i]-'0';
        dp[i][0]=min(dp[i][0],dp[i-1][0]+num);
        dp[i][0]=min(dp[i][0],dp[i-1][0]+10-num+1);
        dp[i][0]=min(dp[i][0],dp[i-1][1]+10-num);
        dp[i][0]=min(dp[i][0],dp[i-1][1]+1+num);
        num++;
        dp[i][1]=min(dp[i][1],dp[i-1][0]+num);
        dp[i][1]=min(dp[i][1],dp[i-1][0]+10-num+1);
        dp[i][1]=min(dp[i][1],dp[i-1][1]+10-num);
        dp[i][1]=min(dp[i][1],dp[i-1][1]+1+num);
    }
    cout << dp[n-1][0];

    return 0;
}


Measured memory_bytes: 55964
#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
	cin>>n;
	int a[n],b[n];
	for(int i=0;i<n;i++) {
		cin>>a[i];
		cin>>b[i];
	}
	for(int i=0;i<n-2;i++) {
		if(a[i]==b[i]&&a[i+1]==b[i+1]&&a[i+2]==b[i+2]){
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
}


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

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

int main() {
    int n;
    while (cin >> n, n) {
        int x[n], y[n];
        x[0] = y[0] = 0;
        rep(i, n-1) {
            int a, b;
            cin >> a >> b;
            x[i+1] = x[a] + dx[b];
            y[i+1] = y[a] + dy[b];
        }
        int xma=0, xmi=1e8, yma=0, ymi=1e8;
        rep(i, n) {
            xma=max(xma, x[i]);
            xmi=min(xmi, x[i]);
            yma=max(yma, y[i]);
            ymi=min(ymi, y[i]);
        }
        cout << xma-xmi+1 << " " << yma-ymi+1 << endl;
    }
}

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

int main() {
  // ここにプログラムを追記
  int  a,b;
  cin >> a>>b;
  if ((a+b)%2 >=1){
  cout << (a+b)/2+1 <<endl;
  }

  else{
  cout << (a+b)/2<< endl;
  }
}


Measured memory_bytes: 3596
n, m = map(int, input().split())
l = [list(map(int, input().split())) for i in range(n)]
p = [list(map(int, input().split())) for i in range(m)]
for i in range(n):
    min_l = 1000000000
    index = 0
    for j in range(m):
        d = abs(l[i][0] - p[j][0]) + abs(l[i][1] - p[j][1])
        if min_l > d:
            min_l = d
            index = j
    print(index + 1)

Measured memory_bytes: 3064
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>

const int mod = 1e9 + 7;
const int kmax = 510000;

long long fact[kmax], fact_inv[kmax], inv[kmax];

int gcd(int a, int b)
{
    if (!b) {
        return a;
    }

    return gcd(b, a % b);
}

void init_comb()
{
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < kmax; i++) {
        fact[i] = fact[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
    }
}

long long comb(int n, int r)
{
    if (n < r) {
        return 0;
    }

    if (n < 0 || r < 0) {
        return 0;
    }

    return fact[n] * (fact_inv[r] * fact_inv[n - r] % mod) % mod;
}

template <typename T, T N>
class UnionFind {
    T parent_[N];
    T rank_[N];
    T size_[N];

public:
    UnionFind();
    T Root(T idx);
    bool IsSame(T x, T y);
    void Unite(T x, T y);
    T GetSize(T idx);
};

template <typename T, T N>
UnionFind<T, N>::UnionFind()
{
    for (T i = 0; i < N; i++) {
        parent_[i] = i;
        rank_[i] = 0;
        size_[i] = 1;
    }
}

template <typename T, T N>
T UnionFind<T, N>::Root(T idx)
{
    return parent_[idx] == idx ? idx : parent_[idx] = Root(parent_[idx]);
}

template <typename T, T N>
bool UnionFind<T, N>::IsSame(T x, T y)
{
    return Root(x) == Root(y);
}

template <typename T, T N>
void UnionFind<T, N>::Unite(T x, T y)
{
    x = Root(x);
    y = Root(y);
    if (x == y) {
        return;
    }

    if (rank_[x] < rank_[y]) {
        parent_[x] = y;
        size_[y] += size_[x];
    } else {
        parent_[y] = x;
        size_[x] += size_[y];
        if (rank_[x] == rank_[y]) {
            rank_[x]++;
        }
    }
}

template <typename T, T N>
T UnionFind<T, N>::GetSize(T idx)
{
    return size_[Root(idx)];
}

long long pow_mod(long long n, long long p, long long m)
{
    if (p == 0) {
        return 1;
    }

    if (p % 2 == 0) {
        long long t = pow_mod(n, p / 2, m);
        return t * t % m;
    }
    return n * pow_mod(n, p - 1, m) % mod;
}

long long nCr_mod(long long n, long long r)
{
    long long x = 1;
    for (long long i = n - r + 1; i <= n; i++) {
        x *= i;
        x %= mod;
    }

    long long a = 1;
    for (long long i = 1; i <= r; i++) {
        a *= i;
        a %= mod;
    }

    long long y = pow_mod(a, mod - 2, mod) % mod;

    return x * y % mod;
}

int main()
{
    long long n, m;
    std::cin >> n >> m;

    std::vector<long long> h(n);
    std::vector<long long> max(n, 0);
    for (int i = 0; i < n; i++) {
        std::cin >> h[i];
    }

    for (int i = 0; i < m; i++) {
        long long a, b;
        std::cin >> a >> b;

        a--;
        b--;
        max[a] = std::max(max[a], h[b]);
        max[b] = std::max(max[b], h[a]);
    }

    long long sum = 0;
    for (int i = 0; i < n; i++) {
        if (h[i] > max[i]) {
            sum++;
        }
    }

    std::cout << sum << std::endl;
}


Measured memory_bytes: 4844
import Data.List (sort, group)

main = do
  getLine
  an <- map read . words <$> getLine::IO[Int]
  let valueFreq = map (\x -> (head x,length x)) $ group $ sort an
  print $ foldl (\acc (a, b)-> if a > b then acc + b else acc + (b-a)) 0 valueFreq

Measured memory_bytes: 39548
#include <stdio.h>
int main(){
int a,b,c;
scanf("%d %d %d", &a, &b, &c);
if(a==b && a==c && c==b) printf("No");
if(a==b && a!=c)  printf("Yes");
if(a==c && a!=b) printf("Yes");
if(b==c && b!=a) printf("Yes");
if(a!=b && a!=c && b!=c) printf ("No");

return 0 ;
}

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

#define int long long
#define ll long long
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<(int)n ; i++)
#define rf(i,n,a) for(int i=n ; i>=a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
#define fill(a,v) memset(a,v,sizeof(a))
#define d1(a) cout << a << "\n"
#define d2(a,b) cout << a << " " << b << "\n"
#define d3(a,b,c) cout << a << " " << b << " " << c << "\n"
#define d4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << "\n"
#define fast ios:: sync_with_stdio(false),cin.tie(nullptr);

typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;

const int inf = 1e9;
const int inf64 = 1e18;
const int MOD = inf + 7;

int32_t main(){
	fast;
	int n,k,c;
	cin >> n >> k >> c;
	string s;
	cin >> s;

	int l[k] = {0} , r[k] = {0};
	int pre = -1e9 , id = 0;
	for(int i=0 ; i<n ; i++){
		if(s[i] == 'o' && i - pre > c){
			l[id++] = i;
			pre = i;
		}
		if(id == k)	break;
	}
	int post = 1e9;
	id = k - 1;
	for(int i=n-1 ; i>=0 ; i--){
		if(s[i] == 'o' && post - i > c){
			r[id--] = i;
			post = i;
		}
		if(id == -1) break;
	}
	for(int i=0 ; i<k ; i++){
		if(l[i] == r[i]){
			cout << l[i] + 1 << "\n";
		}
	}
}	

Measured memory_bytes: 5012
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define forn(i,n) for (int i=0; i<int(n); ++i)
#define ff first

void cxxio() {
    ios::sync_with_stdio(false);
    cin.tie(0);
}

int main() {
    cxxio();
    int n;
    cin>>n;
    vi xs(n);
    forn(i, n) cin>>xs[i];
    map<int, int> m;
    forn(i, n) m[xs[i]]++;
    int hi=m.rbegin()->ff;
    int lo=(hi+1)/2;
    int c=hi%2==0? 1:2;
    if (m[lo]!=c) return cout<<"Impossible\n", 0;
    for (int i=lo+1; i<=hi; i++)
        if (m[i]<2) return cout<<"Impossible\n", 0;
    cout<<"Possible\n";
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int d = sc.nextInt();
        int result = 0;
        List<Integer> nList = new ArrayList<Integer>();

        for (int i = 1; i <= n; i++) {
            nList.add(i);
        }

        int tempResult = d + 1;

        while(true) {
            final int min = tempResult - d;
            final int max = tempResult + d;

            result = result + 1;
            nList = nList.stream().filter(n2 -> min > n2 || n2 > max).collect(Collectors.toList());

            if (nList.isEmpty()) {
                break;
            } else {
                tempResult = nList.get(0) + d > n ? nList.get(0) : nList.get(0) + d;
            }
        }
        System.out.println(result);
    }
}

Measured memory_bytes: 36028
//abcofABC.java
import java.util.Scanner;
class Main
{
	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
        String s=sc.next();
        
        if(s.equals("abc")||s.equals("acb")||s.equals("bac")||s.equals("bca")||s.equals("cab")||s.equals("cba")){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
        sc.close();
    }
}	

Measured memory_bytes: 21716
import math
a,b,x = map(int,input().split())
h = x/(a**2)
if b//2 >= h:

    d = 2*h*a/b

    sin = math.degrees(math.acos(d/((d**2+b**2)**0.5)))
    print(sin)
else:
    d = 2*(b-h)*a/a
    sin = math.degrees(math.acos(d/((d**2+a**2)**0.5)))
    print(90-sin)


Measured memory_bytes: 3060
#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 a,b,c,d;
  cin>>a>>b>>c>>d;
  while(true){ 
    c-=b;
    if(c<=0){
      cout<<"Yes";
      return 0;
    }
    a-=d;
    if(a<=0){
      cout<<"No";
      return 0;
    }


  }
  return 0;
}

Measured memory_bytes: 3596
// ABC061B.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
using namespace std;
int main()
{
	int N, M;
	cin >> N >> M;
	int a[51],b[51];
	for (int i = 1; i <= M; i++)cin >> a[i] >> b[i];
	int c[51] = {};

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

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var keyWord = Console.ReadLine();
            var count = 0;

            while (true)
            {
                var t = Console.ReadLine();
                if (t == "END_OF_TEXT") break;

                var array = t.ToLower().Split();

                for (var i = 0; i < array.Length; i++)
                {
                    if (array[i] == keyWord) count++;
                }
            }

            Console.WriteLine(count);
        }
    }
}



Measured memory_bytes: 17864
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define vec vector<int>
#define fo(i,n) for(int i=0;i<n;i++)
#define foo(i,a,b) for(int i=a;i<=b;i++)A
#define mp make_pair
#define deb(x) cout<<#x<<"-->"<<x<<endl;
#define deb1a(v) for(auto it:v) {cout<<it<<" ";} cout<<endl;
#define deb2a(v) for(auto it:v){for(auto it1:it) {cout<<it1<<" ";}cout<<endl;}
int32_t main()
{
ios_base::sync_with_stdio(false);
    cin.tie(NULL);
int n;
cin>>n;
cout<<(n*(n+1))/2-n;


}


Measured memory_bytes: 256
import sys
N = int(input())
A = [int(i) for i in input().split()]
cur = A[0]
if N == 1:
    print(0)
    sys.exit()
ans = 0
for a in A[1:]:
    if a < cur:
       ans += abs(cur-a)
    else:
        cur = a
print(ans)

Measured memory_bytes: 32180
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) {
        //inputStream
        try (var br = new BufferedReader(new InputStreamReader(System.in))) {
            var s = br.readLine().split(" ");
            int[] a = Stream.of(s).mapToInt(Integer::parseInt).toArray();

            if((2 * a[0] <= a[1] && a[1] <= 4 * a[0]) && a[1] % 2 == 0){
                System.out.println("Yes");
            }else{
                System.out.println("No");
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

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

using namespace std;

int main() {
    int a,b;
    cin >>a >>b;
    if((a==1 && b==2) || (a==2 && b==1)){
        cout << 3;
    }
    else if((a==1 && b==3)||(a==3 && b==1)){
        cout << 2;
    }
    else if((a==2 && b==3)||(a==3 && b==2)){
        cout << 1;
    }
}


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

int
main ()
{
    std::string s, t, u;
    int a, b;
    std::cin >> s >> t;
    std::cin >> a >> b;
    std::cin >> u;
    std::map<std::string, int> m;
    m[s] = a;
    m[t] = b;
    m[u]--;

    std::cout << m[s] << " " << m[t] << std::endl;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  long long p=1000000007;
  long long n,k;
  long long ans=0;
  cin >> n >> k;
  rep(i,n+2-k){
    long long y=n-i;
    long long mi=y*(y+1)/2;
    long long ma=(n+i)*(n-i+1)/2;
    ans=(ans+ma-mi+1)%p;
    //cout << mi << " " << ma << endl;
  }
  cout << ans << endl;
}


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

using namespace std;


void solve() {
    int n;
    cin >> n;
    int res = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            for (int k = 1; k <= n; k++) {
                res += __gcd(__gcd(i,j), k);
            }
        }
    }
    cout << res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}


Measured memory_bytes: 3648
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        String[] number = line.split(" ");
        int result = Integer.parseInt(number[0]) + Integer.parseInt(number[1]);
        if(result < 10) {
            System.out.println(result);
        } else {
            System.out.println("error");
        }
    }
}

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

int main() {
    size_t R;
    std::cin >> R;
    std::string output = "AGC";
    if (R < 1200) {
        output = "ABC";
    } else if (R < 2800) {
        output = "ARC";
    }
    cout << output << endl;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <stdio.h>
using namespace std;
#define M1 (ll)1000000007
#define M2 (ll)998244353
#define Pi 3.141592653
#define exp 2.71828
#define ll long long
#define ull unsigned long long
#define pi pair<int,int>
#define pl pair<ll,ll> 
#define vi vector<int>
#define vl vector<ll>
#define di deque<int>
#define dl deque<ll>
#define dii deque<pi>
#define dll deque<pl>
#define vvi vector<vi>
#define vvl vector<vl>
#define vii vector<pi>
#define vll vector<pl>
#define pb push_back
#define pp pop_back
#define pf push_front
#define pt pop_front
#define mp make_pair
#define in insert
#define er erase
#define ff first
#define ss second
#define ub upper_bound
#define lb lower_bound
#define rp(i,a,b) for(int i=a;i<b;i++)
#define rpt(i,a,b,t) for(int i=a;i<b&&t<1;i++)
#define rep(i,n) for(int i = 0 ; i<n ; i++)
#define rept(i,n,t) for(int i = 0 ; i<n&&t<1 ; i++)
#define repr(i,n) for(int i = n-1 ; i>=0 ; i--)
#define reprt(i,n,t) for(int i=n-1;i>=0&&t<1;i--)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define SORT(v) sort(v.begin(),v.end())
using namespace std;
int dp[100005];
vi graph[100005];
int v[100005]={0};
int main() {
    fast
    int h,w;
    cin>>h>>w;
    char grid[h][w];
    for(int i=0;i<h;++i) for(int j=0;j<w;++j) cin>>grid[i][j];
    ll result[h][w];
    int i;
    for(i=0;i<w;++i){
        if(grid[0][i]!='.') break;
        result[0][i] = 1;
    }
    while(i<w) result[0][i]=0,++i;
    for(i=0;i<h;++i){
        if(grid[i][0]!='.') break;
        result[i][0] = 1;
    }
    while(i<h) result[i][0]=0,++i;
    for(int i=1;i<h;++i){
        for(int j=1;j<w;++j){
            result[i][j]=0;
            if(grid[i][j]=='#') continue;
            result[i][j] = ((result[i-1][j]%M1)+(result[i][j-1]%M1))%M1;
        }
    }
    cout<<result[h-1][w-1];
}


Measured memory_bytes: 14668