akhauriyash/Code-Regression huggingface dataset:
/*input
20 20
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
*/
 
 
#include <bits/stdc++.h>
using namespace std;
 
#define ld long double
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define vpll vector < pair<long long,long long> >
#define fill(a,val)  memset(a,val, sizeof (a))
#define sort_unique(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define mp make_pair
#define pb push_back
#define f first
#define se second
#define all(cont) cont.begin(), cont.end()
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define INTMAX  2147483647
#define INTMIN  -2147483648
#define LLMAX 9223372036854775807
#define LLMIN -9223372036854775808
#define MOD 1000000007
typedef map<long long int, long long int> mpi;
typedef set<long long int> seti;
typedef multiset<long long int> mseti;
typedef priority_queue<long long int> pq;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define rep(i, n)    for(long long int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(ll i = a; i <= (n); ++i)
#define repD(i, a, n)  for(ll i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define repn(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define PI 3.1415926535
#define dbg(x) cerr << "\n" << (#x) << " = " << (x) << endl ;
//#define cerr if(false)cerr

// cout<<fixed<<setprecision(10)<<(v1+v2+v3)<<endl;
  
struct node{
    ll val;
};
struct Interval {int start, end;};
bool compare(struct node n1, struct node n2) {
    return (n1.val < n2.val);
}




char state[1001][1001];
long long int dp[1001][1001];

int main(){
	int h,w; cin>>h>>w;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++)
			cin>>state[i][j];
	}
	dp[0][0] = 1;
	for(int i=1;i<h;i++){
		if(state[i][0] == '.')dp[i][0] = dp[i-1][0]; 
		else dp[i][0] = 0;
	}
	for(int j=1;j<w;j++){
		if(state[0][j] == '.')dp[0][j] = dp[0][j-1]; 
		else dp[0][j] = 0;
	}
	// for(int i=0;i<h;i++){
	// 	for(int j=0;j<w;j++)
	// 		cout<<dp[i][j]<<" ";

	// 	cout<<endl;
	// }
	for(int i=1;i<h;i++){
		for(int j=1;j<w;j++){
			if(state[i][j] == '#')dp[i][j] = 0;
			else dp[i][j] = (dp[i-1][j]%MOD + dp[i][j-1]%MOD)%MOD;
		}
	}
	cout<<dp[h-1][w-1]<<endl;
	return 0;	
}















 

Measured memory_bytes: 12396
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

signed main(){
	int n;
	cin >> n;
	int h[n];
	rep(i,n){
		cin >> h[i];
	}
	int now = 0, ans = 0;
	rep(i,n){
		if(h[i] >= now){
			ans++;
			now = h[i];
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		final double π = 3.14159265359;

		Scanner scan = new Scanner(System.in);
		int r = Integer.parseInt(scan.next());
		double pre = 2 * π;
		double res = pre * r;

		System.out.println(res);
	}
}


Measured memory_bytes: 35680
#include <stdio.h>
int n,A[20];
int solve(int count,int num)
{
	if(num==0)	
	return 1;
	/*if(count>n||num<0)
	return 0;
	if(solve(count+1,num-A[count])||solve(count+1,num))
	return 1;
	return 0;*/
	if(count>n)
	return 0;
	int res=(solve(count+1,num-A[count])||solve(count+1,num));
	return res;
}

int main(int argc, char *argv[])
{
	int q,m,i;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	scanf("%d",&A[i]);
	scanf("%d",&q);
	for(i=0;i<q;i++)
	{
		scanf("%d",&m);
		if(solve(0,m))
		printf("yes\n");
		else
		printf("no\n");
	}
	return 0;
}


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

using namespace std;
typedef long long ll;

int main() {
  ll X; cin >> X;
  ll Y; cin >> Y;
  ll Z; cin >> Z;
  ll K; cin >> K;
  vector<ll> A(X);
  for (ll j=0; j < X; ++j) cin >> A[j];
  vector<ll> B(Y);
  for (ll j=0; j < Y; ++j) cin >> B[j];
  vector<ll> C(Z);
  for (ll j=0; j < Z; ++j) cin >> C[j];
  vector<ll> D, E;

  priority_queue<ll> q;
  for (ll j=0; j < X; ++j) {
    for (ll k=0; k < Y; ++k) {
      D.push_back(A[j] + B[k]);
    }
  }
  sort(D.rbegin(), D.rend());

  ll len = min(K, static_cast<ll>(D.size()));
  for (ll j=0; j < len; ++j) {
    for (ll k=0; k < Z; ++k) {
      E.push_back(D[j] + C[k]);
    }
  }
  sort(E.rbegin(), E.rend());

  for (ll j=0; j < K; ++j) {
    cout << E[j] << endl;
  }
  return 0;
}


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

int Linear_Search(int S[], int T[], int n, int q) {
  int result = 0;
  for (int i = 0; i < q; i++) {
    for (int j = 0; j < n; j++) {
      if (T[i] == S[j]) {
        result++;
        break;
      }
    }
  }

  return result;
}

int main() {
  int S[10000], T[1000];
  int n, q, result;

  cin >> n;

  for (int i = 0; i < n; i++)
    cin >> S[i];

  cin >> q;

  for (int i = 0; i < q; i++)
    cin >> T[i];

  result = Linear_Search(S, T, n, q);

  cout << result << endl;

  return 0;
}



Measured memory_bytes: 3112
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner scanner = new Scanner(System.in)) {
            String num = scanner.next();

            MultipleOfNine target = new MultipleOfNine();
            System.out.println(target.check(num));
        }
    }
}

class MultipleOfNine {

    public String check(String number) {
        String[] nums = number.split("");
        long total = 0;
        for (String num : nums) {
            int parsed = Integer.parseInt(num);
            total += parsed;
        }

        if (total % 9 == 0) {
            return "Yes";
        }
        return "No";
    }

}

Measured memory_bytes: 55256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func rcvInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func main() {
	sc.Split(bufio.ScanWords)

	n, k := rcvInt(), rcvInt()

	bucket := make(map[int]int, n)
	for i := 0; i < n; i++ {
		bucket[rcvInt()]++
	}

	values := make([]int, 0, len(bucket))
	for _, v := range bucket {
		values = append(values, v)
	}
	sort.Ints(values)

	var ans int
	for i := 0; i < len(values)-k; i++ {
		ans += values[i]
	}
	fmt.Println(ans)
}


Measured memory_bytes: 9344
#include <stdio.h>

int main(void)
{
	int a, b, n, i, s;
	
	while (scanf("%d %d %d", &a, &b, &n) != EOF){
		s = 0;
		a %= b;
		for (i = 0; i < n; i++){			
			a *= 10;
			s += a / b;
			a = a % b;
		}
		
		printf("%d\n", s);
	}
	
	return (0);
}

Measured memory_bytes: 596
S = input()

lists = ['dream', 'dreamer', 'erase', 'eraser']
for i, word in enumerate(lists[:]):
    lists[i] = word[::-1]
S = S[::-1]

while len(S) > 0:
    if S[:7] in lists:
        S = S[7:]
    elif S[:6] in lists:
        S = S[6:]
    elif S[:5] in lists:
        S = S[5:]
    else:
        print('NO')
        exit()

print('YES')

Measured memory_bytes: 3188
import math

def isPrime(y):
  if y == 2 or y == 3:
    return True
  for i in range(2, int(math.sqrt(y)) + 2):
    if y % i == 0:
      return False
  return True
x = int(input())
while not isPrime(x):
  x += 1
print(x)

Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<long long int>;

namespace BasicMath {
    // 最大公約数を求める(ユークリッドの互除法) 
    // O(log max(a, b)) time, O(1) space
    static UInt GreatestCommonDivisor(UInt a, UInt b);

    UInt GreatestCommonDivisor(UInt a, UInt b) {
        if (b == 0) {
            return a;
        } else {
            if (a < b) {
                std::swap(a, b);
            }
            return GreatestCommonDivisor(b, a % b);
        }
    }
#define GCD GreatestCommonDivisor
}
using namespace BasicMath;

int main(void) {
    Int n, x;
    cin >> n >> x;
    VI v(n);
    for (Int i = 0; i < n; ++i) {
        cin >> v[i];
        v[i] = abs(v[i] - x);
    }
    sort(v.begin(), v.end());

    if (x == 1) { 
        cout << v[0] << endl;
    } else {
        UInt ans = GCD(v[0], v[1]);
        for (Int i = 2; i < n; ++i) {
            ans = GCD(ans, v[i]);
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3976
#line 1 "/mnt/c/Users/leafc/dev/compro/lib/template.hpp"


#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
#define MM << " " <<

using namespace std;

template <class T> void say(bool val, T yes = "Yes", T no = "No") { cout << (val ? yes : no) << endl; }

template <class T> void chmin(T &a, T b) {
  if (a > b)
    a = b;
}

template <class T> void chmax(T &a, T b) {
  if (a < b)
    a = b;
}


#line 2 "abc163_a.cpp"

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

  double r;
  cin >> r;
  coutd(10) << 2 * r * M_PI << endl;
  return 0;
}


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

int main(){
    int N;
    cin >> N;
    vector<char> C(N);
    int i;
    int R = 0;
    int ans = 0;

    for(i=0;i<N;i++){
        cin >> C.at(i);
        if(C.at(i) == 'R'){
            R++;
        }
    }
    
    for(i=0;i<R;i++){
        if(C.at(i) != 'R'){
            ans++;
        }
    }

    cout << ans << endl;

}

Measured memory_bytes: 3596
/*
	Author: zxy_hhhh
	date: 2020/05/23
*/
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<set>
#include<vector>
#include<map>
#include<queue>
#include<iostream>
#define ll long long
inline ll rd() {
	ll _x=0;int _ch=getchar(),_f=1;
	for(;!isdigit(_ch)&&(_ch!='-')&&(_ch!=EOF);_ch=getchar());
	if (_ch=='-'){_f=0;_ch=getchar();}
	for(;isdigit(_ch);_ch=getchar()) _x=_x*10+_ch-'0';
	return _f?_x:-_x;
}
void write(ll _x){if (_x>=10) write(_x/10),putchar(_x%10+'0'); else putchar(_x+'0'); }
inline void wrt(ll _x,char _p){if (_x<0) putchar('-'),_x=-_x; write(_x); if (_p) putchar(_p);}
#include<unordered_map>
int T;
ll n,a,b,c,d;
ll ans=0;
std::priority_queue<std::pair<ll,ll>,std::vector<std::pair<ll,ll>>,std::greater<std::pair<ll,ll> > > que;
std::unordered_map<ll,ll> mp;
inline void push(std::pair<ll,ll> x) {
	if ((!mp.count(x.first)||x.second<mp[x.first])&&x.second<1e13)
		que.push(std::make_pair(x.second,x.first)),mp[x.first]=x.second;
}
ll div2(ll n) {
	if (n/2<=1e9) return std::min(n/2*d,a);
	else return a;
}
ll div3(ll n) {
	if (n/3*2<=1e9) return std::min(n/3*d*2,b);
	else return b;
}
ll div5(ll n) {
	if (n/5*4<=1e9) return std::min(n/5*d*4,c);
	else return c;
}
void dijkstra() {
	while(!que.empty()) que.pop();
	que.push(std::make_pair(0,n));
	ll mx=std::min((ll)(n+1e13),n*2);
	mp[n]=0;
	while(!que.empty()) {
		std::pair<ll,ll> now=que.top();que.pop();
		now=std::make_pair(now.second,now.first);
		if (now.first==0) return ;
		if (now.second>mp[now.first]) continue ;
		push(std::make_pair(now.first/2,now.second+now.first%2*d+div2(now.first-now.first%2)));
		if (now.first%2!=0)
			push(std::make_pair(now.first/2+1,now.second+now.first%2*d+div2(now.first+now.first%2)));
		if (now.first%3<=1) {
			push(std::make_pair(now.first/3,now.second+now.first%3*d+div3(now.first)));
		}
		else {
			push(std::make_pair(now.first/3+1,now.second+d+div3(now.first+1)));
		}
		if (now.first%5<=2) {
			push(std::make_pair(now.first/5,now.second+now.first%5*d+div5(now.first)));
		}
		else {
			push(std::make_pair(now.first/5+1,now.second+(5-now.first%5)*d+div5((now.first/5+1)*5)));
		}
	}
}
int main() {
	T=rd();
	while(T--) {
		n=rd(),a=rd(),b=rd(),c=rd(),d=rd();
		// ans=d;
		mp.clear();
		dijkstra();
		wrt(mp[0],'\n');
	}
}

Measured memory_bytes: 3784
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <float.h>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <set>
#include <queue>
#include <limits>
#include <deque>
#include <locale>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <wchar.h>
#include <wctype.h>
#include <algorithm>
#include <bitset>
#include <map>
#include <iomanip>
#include <ios>
#include <iostream>
#include <vector>
#include <cwchar>
#include <cwctype>
#define mp make_pair
#define fs first
#define se second
#define memset(a,t) memset(a,t,sizeof(a))
#define all(v) v.begin(),v.end()
#define eprintf(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define MN 0LL
#define Mx 2000000005
#define Mn -Mx
#define MX 20000000000000005
using namespace std;
int readint(){
	char c;
	while(c=getchar(),(c<'0'||c>'9')&&c!='-');
	bool flag=(c=='-');
	if(flag)c=getchar();
	int x=0;
	while(c>='0'&&c<='9'){
		x=x*10+c-48;
		c=getchar();
	}
	return flag?-x:x;
}
inline string tos(int x){
	string s;
	while(x) s=(char)(x%10+'0')+s,x/=10;
	return s;
}
inline int pt(int a[],int l,int r){
	int p,i,j;
	p=a[l];
	i=l;
	j=r+1;
	for(;;){
		while(a[++i]<p) if(i>=r) break;
		while(a[--j]>p) if(j<=l) break;
		if(i>=j) break;
		else swap(a[i],a[j]);
	}
	if(j==l) return j;
	swap(a[l],a[j]);
	return j;
}
inline void q_sort(int a[],int l,int r){
	int q;
	if(r>l){
		q=pt(a,l,r);
		q_sort(a,l,q-1);
		q_sort(a,q+1,r);
	}
}
long long a,b,n;
long long health[100005];
inline bool ok(long long k){
	long long ck=0;
	for(int i=0;i<n;i++) ck+=max(0,(int)(ceil((float)(health[i]-k*b)/(float)a)));
	return ck<=k;
}
inline long long solve(){
	long long l=0,r=1e14,md,mn=1e14;
	while(l<=r){
		md=(l+r)/2;
		if(ok(md)) r=md-1;
		else l=md+1; 
	}
	return l;
}
int main(){
	ios_base::sync_with_stdio(false);
	int i,j;
	cin>>n>>a>>b;
	a-=b;
	for(i=0;i<n;i++) cin>>health[i];
	cout<<solve();
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<ll, ll>>;
// ceil() 切り上げ, floor() 切り捨て
// next_permutation(all(x))

int		main(void)
{
	int N;
	cin >> N;
	int O = 0;
	ll ans = 0;
	vector<int> A(N+1);
	vector<int> B(N);
	for (int i = 0; i < N+1; i++)
		cin >> A[i];
	for (int i = 0; i < N; i++)
		cin >> B[i];
	for (int i = 0; i < N; i++)
	{
		if (A[i] <= O)
		{
			ans += A[i];
			O = B[i];
			continue;
		}
		else
		{
			ans += O;
			A[i] -= O;
		}
		if (A[i] <= B[i])
		{
			ans += A[i];
			O = B[i] - A[i];
		}
		else
		{
			ans += B[i];
			O = 0;
		}
	}
	ans += min(O, A[N]);
	cout << ans << endl;
}



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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n)　for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod 1e9 +7;

const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

ll lcm(ll x,ll y)
{
    x /= gcd(x,y);
    y /= gcd(x,y);
    return (x*y);
}

int main()
{
    ll n,m;
    cin >> n >> m;
    cout << ((n+m >= 24)?n+m-24:n+m) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <algorithm>
#define ll long long

using namespace std;

const long long mod = 1e9+7;

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

    const char* schar = s.c_str();
    int ans = 0;
    for(int i = 0; i < 4; i++){
        if(schar[i] == '+') ans++;
        else ans--;
    }

    cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  vector<int> vec(n);
  for (int i = 0; i<n; i++){
  	cin >> vec.at(i);
  }
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  
  int ans = vec.at(0);
  for (int i = 0; i<n-1; i++){
    if (i%2 == 0){
      ans -= vec.at(i+1);
    }else{
      ans += vec.at(i+1);
    }
  }
  cout << ans << endl;
}

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

Measured memory_bytes: 580
/*
मनस्वी म्रियते कामं कार्पण्यं न तु गच्छति ।
अपि निर्वाणमायाति नानलो याति शीतताम् ॥
*/

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;
using namespace std;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ll long long int
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define v2i vector<vector<int>>
#define v2l vector<vector<ll>>
#define ppi pair<int,int>
#define ppl pair<ll,ll>
#define vpi vector<ppi>
#define vpl vector<ppl>
#define all(x) x.begin(),x.end()
#define ii int,int 
#define ff first    
#define ss second
#define forn(i,a,b) for(int i=a;i<b;i++)
#define forr(i,a,b) for(int i=a;i>=b;i--)
#define forv(i,m) for(auto i : m)
#define p2d(v) for(auto a:v){for(auto b:a)cout<<b<<" ";cout<<endl;}
#define p1d(v) for(auto a:v)cout<<a<<" ";cout<<endl;
#define ppd(v) for(auto a:v)cout<<a.ff<<" "<<a.ss<<endl;
#define imx INT_MAX
#define imn INT_MIN
#define inf 9000000000000000000
#define minf -inf
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define sze size()
#define rvs reverse 
#define itr iterator 
#define pre cout<<fixed<<setprecision(10);
#define umap unordered_map
#define uset unordered_set
#define pi 3.141592653589793
#define MAXN 100005
#define test1(x) cout << #x " = " << x << endl;
#define test2(x,y) cout << #x " = " << x << " " << #y " = " << y << endl;
#define test3(x,y,z) cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << endl;
#define test4(w,x,y,z) cout << #w " = " << w << " " << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << endl;
const ll infinity = 9e18;

/*
#define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define MODM(a,b,md) ((a%md)*(b%md))%md
#define MODA(a,b,md) ((a%md)+(b%md))%md
#define ull unsigned long long int
*/

/*
bool compare(int a,int b) {return a > b;}
bool compare1(ppi a,ppi b) {return a.ff > b.ff;}
bool compare2(ppi a,ppi b) {return a.ss < b.ss;}
ll Npower(ll a,ll b) {ll product = 1; while(b){if(b&1){product = product*a;}a = a*a;b = b>>1;} return product;}
ll power(ll a,ll b,ll md) {ll product = 1; while(b){if(b&1){product = MODM(product,a,md);}a = MODM(a,a,md);b = b>>1;} return product%md;}
bool isprime(ll n){if(n < 2) return 0; ll i = 2; while(i*i <= n){if(n%i == 0) return 0; i++;} return 1;}
ll GCD(ll a,ll b) {return b==0 ? a:GCD(b,a%b);}
ll LCM(ll a,ll b) {return (a/GCD(a,b))*b; }
*/


int main()
{
    fast

/*
    #ifndef ONLINE_JUDGE
        freopen("input.txt",  "r",  stdin);
        freopen("output.txt", "w", stdout);
    #endif
//*/

        
    ll n;
    cin>>n;

    map<string,ll> m;

    string str[] = {"AC","WA","TLE","RE"};

    forn(i,0,n)
    {
        string s;
        cin>>s;
        m[s]++;
    }
        
    for(int i = 0; i < 4; i++)
    {
        cout<<str[i]<<" x "<<m[str[i]]<<endl;
    }    












    return 0;
}       


Measured memory_bytes: 3664
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		
		while(true){
			int m = stdIn.nextInt();
			int d = stdIn.nextInt();
			
			if(m==0 && d==0){
				break;
			}
			int count = d;
			for(int i=1;i<m;i++){
				if(i==2){
					count += 29;
				}
				else if(i==4 || i==6 || i==9 || i==11){
					count += 30;
				}
				else{
					count += 31;
				}
			}
			
			switch(count%7){
			 case 0:
				 System.out.println("Wednesday");
				 break;
			 case 1:
				 System.out.println("Thursday");
				 break;
			 case 2:
				 System.out.println("Friday");
				 break;
			 case 3:
				 System.out.println("Saturday");
				 break;
			 case 4:
				 System.out.println("Sunday");
				 break;
			 case 5:
				 System.out.println("Monday");
				 break;
			 case 6:
				 System.out.println("Tuesday");
				 break;
			
			}
		}
	}
}

Measured memory_bytes: 17340
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF (LLONG_MAX - 1e5)

using namespace std;

int mod = 1e9 + 7;

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

    int three[100005];
    three[0] = 1;
    REP(i, 100001) {
        three[i + 1] = (three[i] * 3) % mod;
    }

    string S;
    cin >> S;
    int n = S.size();
    vector<int> A(n+10);
    vector<int> C(n+10);
    vector<int> Q(n+10);

    REPS(i, n) {
        A[i] = A[i - 1];
        C[i] = C[i - 1];
        Q[i] = Q[i - 1];
        char c = S[i - 1];
        switch (c) {
            case 'A':
                A[i]++;
                break;
            case 'C':
                C[i]++;
                break;
            case '?':
                Q[i]++;
                break;
        }
    }

    int ans = 0;
    REPS(i, n) {
        char c = S[i - 1];
        if (c == 'A' || c == 'C') continue;
        int la = A[i];
        int rc = C[n] - C[i];
        int lq = Q[i];
        int rq = Q[n] - Q[i];
        int sumq = Q[n];
        if (c == 'B') {
            ans += ((la * rc) % mod * three[sumq]) % mod;
            if (sumq >= 1) ans += ((la * rq) % mod * three[sumq - 1]) % mod;
            if (sumq >= 1) ans += ((rc * lq) % mod * three[sumq - 1]) % mod;
            if (sumq >= 2) ans += ((lq * rq) % mod * three[sumq - 2]) % mod;
        }
        if (c == '?') {
            lq--;
            ans += ((la * rc) % mod * three[sumq - 1]) % mod;
            if (sumq >= 2) ans += ((la * rq) % mod * three[sumq - 2]) % mod;
            if (sumq >= 2) ans += ((rc * lq) % mod * three[sumq - 2]) % mod;
            if (sumq >= 3) ans += ((lq * rq) % mod * three[sumq - 3]) % mod;
        }
    }
    cout << ans % mod << endl;

    return 0;
}


Measured memory_bytes: 3664
s=input()
a=[0]*(len(s)+1)
b=[0]*(len(s)+1)
flag=0
for i in range(len(s)):
    if s[i]=="<" and flag==0:
        flag=1
        a[i+1]=1
    elif s[i]=="<" and flag==1:
        a[i+1]=a[i]+1
    else:
        flag=0
flag=0
for i in range(len(s)-1,-1,-1):
    if s[i]==">" and flag==0:
        flag=1
        b[i]=1
    elif s[i]==">" and flag==1:
        b[i]=b[i+1]+1
    else:
        flag=0
c=[]
for i in range(len(s)+1):
    c.append(max(a[i],b[i]))
print(sum(c))


Measured memory_bytes: 33692
v[20];char t[9],s[9],c;
int main(a,L,i,j,k){
	for(;scanf("%d%d",&a,&L),L;){
		for(v[0]=a,k=1;;v[k++]=a){
			for(sprintf(s,"%%0%dd",L),sprintf(t,s,a),s[L]=0,i=0;i<L;s[i]=t[L-i-1],i++)for(j=1;j<L-i;j++)if(t[j]<t[j-1])c=t[j],t[j]=t[j-1],t[j-1]=c;
			for(a=atoi(s)-atoi(t),i=0;i<k;i++)if(v[i]==a)break;
			if(i<k){printf("%d %d %d\n",i,a,k-i);break;}
		}
	}
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

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

  ll A;
  std::string B;

  std::cin >> A >> B;

  ll C = 0;
  for(char &c : B){
      if(std::isdigit(c)){
          C = C * 10 + (c - '0');
      }
  }

  ll res = (A * C) / 100;
  std::cout << res << std::endl;
}


Measured memory_bytes: 3612
import copy
H, W, K = map(int, input().split())
c = [list(input()) for _ in range(H)]

hlst = [0] * H
wlst = [0] * W
looph = []
loopw = []
def dfs(cnt, lst, loop):
    if cnt == len(lst):
        loop.append(copy.deepcopy(lst))
        return
    for i in range(2):
        lst[cnt] = i
        cnt += 1
        dfs(cnt, lst, loop)
        cnt -= 1

dfs(0, hlst, looph)
dfs(0, wlst, loopw)

total = 0
for i in looph:
    for j in loopw:
        cnt = 0
        for k in range(H):
            for l in range(W):
                if i[k] == 1:
                    continue
                if j[l] == 1:
                    continue
                if c[k][l] == '#':
                    cnt += 1

        if cnt == K:
            total += 1

print(total)

Measured memory_bytes: 9248
import java.util.Scanner;

public class Main {
	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][m];
		int[] B = new int[m];
		int[] C = new int[n];

		for(int i = 0; i < n; i++) 
			for(int j = 0; j < m; j++) 
				A[i][j] = sc.nextInt();
		
		for(int i = 0; i < m; i++)
			B[i] = sc.nextInt();
		
		for(int i = 0; i < n; i++)
			C[i] = 0;
		
		for(int i = 0; i < n; i++)
			for(int j = 0; j < m; j++)
				C[i] += A[i][j] * B[j];
		
		for(int i = 0; i < n; i++)
			System.out.println(C[i]);
		
	}
}



Measured memory_bytes: 40476
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using P   = pair<ll, ll>;
using mat = vector<vector<ll>>;
typedef string::const_iterator State;
class ParseError {};

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

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
const ld EPS = 1e-12;

template <typename T>
void dump(T x) { cout << x << endl; }
void dumpf(ld x, int t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
inline ll mod(ll a, ll b) {
	if (a > 0) return a % b;
	if (a % b == 0) return 0;
	ll x = -a / b + 1;
	a += x * b;
	return a % b;
}
ll powm(ll a, ll b, ll c) {
	if (b == 0)
		return 1;
	else if (b % 2 == 0) {
		ll d = powm(a, b / 2, c);
		return (d * d) % c;
	} else
		return (a * powm(a, b - 1, c)) % c;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
//ll dx[4] = {1, 0, -1, 0};
//ll dy[4] = {0, 1, 0, -1};

ll a[2002];

int main() {
	IOS();
	ll n, k, q;
	cin >> n >> k >> q;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	if (q == 1) {
		dump(0);
		return 0;
	}
	ll ans = INF;
	vector<ll> tmp, unko;
	for (int i = 1; i <= n; i++) {
		ll X = a[i]; //最小値がa[i]
		for (int j = 1; j <= n; j++) {
			if (i == j) continue;
			if (a[j] >= X) {
				unko.push_back(a[j]);
			} else {
				if (unko.empty()) continue;

				sort(unko.begin(), unko.end());
				for (int t = 0; t <= (int)unko.size() - k; t++) {
					tmp.push_back(unko[t]);
				}
				unko.clear();
			}
		}
		sort(unko.begin(), unko.end());
		for (int t = 0; t <= (int)unko.size() - k; t++) {
			tmp.push_back(unko[t]);
		}
		unko.clear();
		if (tmp.size() < q - 1) {
			tmp.clear();
			continue;
		}
		sort(tmp.begin(), tmp.end());
		ll Y = tmp[q - 2];
		tmp.clear();
		ans = min(ans, Y - X);
	}
	dump(ans);
	return 0;
}


Measured memory_bytes: 384
import sys

N=int(sys.stdin.readline().rstrip())
AList=[]
for i in range(N):
  AList.append(int(sys.stdin.readline().rstrip()))
  
Alistsort=sorted(AList,reverse=True)
last=Alistsort[0]
semiLast=Alistsort[1]

for a in AList:
  if a == last:
    print(semiLast)
  else:
    print(last)


Measured memory_bytes: 60892
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  vector<int> cnt(1000001);
  vector<bool> ok(1000001, false);
  for (int i = 0; i < n; ++i) {
    if (cnt[a[i]] != 0) {
      ok[a[i]] = false;
      continue;
    }
    ok[a[i]] = true;
    for (int j = a[i]; j <= 1000000; j += a[i]) {
      cnt[j]++;
    }
  }
  int ans = 0;
  for (int i = 1; i <= 1000000; ++i) {
    if (ok[i]) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 7956
#include <stdio.h>

int main(){
	int input;
	int sisa, temp;
	scanf("%d", &input);
	while(input>9){
		sisa=input%10;
		input=input/10;
	}
	if(sisa==9 || input==9){
		printf("Yes\n");
	} else{
		printf("No\n");
	}
}

Measured memory_bytes: 128
import sys
from operator import itemgetter

read = sys.stdin.read

N, *ab = map(int, read().split())
mod = 10 ** 9 + 7
ab = list(zip(ab, [0] * N + [1] * N))
ab.sort(key=itemgetter(0))

remain_pc = 0
remain_power = 0
answer = 1

for x, p in ab:
    if p == 0:
        if remain_power == 0:
            remain_pc += 1
            continue
        answer *= remain_power
        remain_power -= 1
    else:
        if remain_pc == 0:
            remain_power += 1
            continue
        answer *= remain_pc
        remain_pc -= 1
    answer %= mod

print(answer)


Measured memory_bytes: 27484
n=int(input())
a=[int(i) for i in input().split()]
l=a[0]
m=sum(a)-a[0]
mi=abs(m-l)
for i in range(1,n-1):
    l+=a[i]
    m-=a[i]
    mi=min(mi,abs(m-l))
print(mi)


Measured memory_bytes: 24832
#include <iostream>
using namespace std;
int a,b,c;
bool f=true;

int main(){
	cin>>a>>b>>c;
	int fi=a-b;
	while(fi<0){
		fi+=a;
	}
	int n=fi;
	while(f){
		n+=a;
		while(n>=b){
			n-=b;
		}
		if(n==c){
			f=false;
			cout<<"YES"<<endl;
		}else{
			if(n==fi){
				f=false;
				cout<<"NO"<<endl;
			}
		}
	}
	return 0;
}

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

int main() {
    ll n; cin>>n;
    ll ans = 0;
    for(ll i=2; i*i<n; i++) {
        if(n % i != 0) continue;
        ll res = 0;
        while(n % i == 0) {
            n /= i;
            res++;
        }
        for(ll j=1; ; j++) {
            if(res >= j) {
                res -= j;
                ans++;
            }
            else break;
        }
    }
    if(n != 1) ans++;
    cout<<ans<<endl;
}

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

using namespace std;

int main() {
    int a, b, c, x = 0; cin >> a >> b >> c;
    for(int i = a; i <= b; i++){
        if(c % i == 0){
            x++;
        }
    }
    cout << x << endl;
}


Measured memory_bytes: 3116
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> tlll;
typedef tuple<int,int,int> tiii;
const ll mod=1e9+7;
const int inf=1<<30;

int main(){
  int n; cin >> n;
  ll pay=0;
  while(pay<n){
    pay+=1000;
  }
  cout << pay-n << endl;
}

Measured memory_bytes: 3624
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Set;
import java.util.StringTokenizer;

public class Main {
	private static final int BASE = -2;
	private static final int CAKECOST = 4;
	private static final int DONUTCOST = 7;
	
	public static void main(String[] args) {
	  FastReader sc = new FastReader();
	  int n = sc.nextInt();
	  int cakeLimit = (int)(Math.ceil(n*1.0/CAKECOST));
	  int donutLimit = (int)(Math.ceil(n*1.0/DONUTCOST));
	  for (int i = 0; i <= cakeLimit; i++) {
		  for (int j = 0; j <= donutLimit; j++) {
			  int total = (i * CAKECOST) + (j * DONUTCOST);
			  if (total == n) {
				  System.out.println("Yes");
				  System.exit(0);
			  }
		  }
	  }
	  System.out.println("No");
  }
  
  static class FastReader {
    BufferedReader br;
    StringTokenizer st;

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

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

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

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

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


Measured memory_bytes: 22996
#include<cstdio>
#include<queue>
#include<cstring>

int t,n;
int fie[120][120];
bool used[120][120];
int dx[6]={1,1,0,0,-1,-1};
int dy[6]={1,0,1,-1,0,-1};
int sx,sy;
class data{
public:
	int x,y,t;
	data(){}
	data(int ix,int iy,int it){
		x=ix;
		y=iy;
		t=it;
	}
};

int bfs(){
	std::queue<data> que;
	memset(used,false,sizeof(used));
	que.push(data(sx,sy,0));
	used[sx][sy]=true;
	int res=1;
	while(que.size()){
		data d=que.front();
		que.pop();
		if(d.t==t)continue;
		for(int i=0;i<6;i++){
			int nx=d.x+dx[i],ny=d.y+dy[i];
			//if(nx<5 || nx>=66 || ny<5 || ny>=66)continue;
			if(!used[nx][ny] && fie[nx][ny]==0){
				used[nx][ny]=true;
				res++;
				que.push(data(nx,ny,d.t+1));
			}
		}
	}
	return res;
}

int main(void){
	while(1){
		scanf("%d %d",&t,&n);
		if(t+n==0)break;
		memset(fie,0,sizeof(fie));
		for(int i=0;i<n;i++){
			int bx,by;
			scanf("%d %d",&bx,&by);
			bx+=60;
			by+=60;
			fie[bx][by]=-1;
		}
		scanf("%d %d",&sx,&sy);
		sx+=60,sy+=60;
		printf("%d\n",bfs());
	}
	return 0;
}

Measured memory_bytes: 1128
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
 
template<class T> inline bool chmin(T &a, T b){
	if(a>b){a=b;return true;}
	return false;
}
template<class T> inline bool chmax(T &a, T b){
	if(a<b){a=b;return true;}
	return false;
}
constexpr int mod = 1e9+7;
constexpr long long inf = 3e18;

struct UnionFind{
	vector<int>par,size;
	int find(int x){
		return (par[x]==x?x:par[x]=find(par[x]));
	}
	bool merge(int x,int y){
		x=find(x);y=find(y);
		if(x==y)return false;
		if(size[x]>size[y])swap(x,y);
		par[x]=y;
		size[y]+=size[x];
		return true;
	}
	bool same(int x,int y){
		return find(x)==find(y);
	}
	UnionFind(int x):size(x,1),par(x){
		iota(all(par),0);
	}
};
signed main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int N,M;cin>>N>>M;
	UnionFind uf(N);
	rep(i,M){
		int a,b;cin>>a>>b;a--;b--;
		uf.merge(a,b);
	}
	int ans=0;
	rep(i,N)chmax(ans,uf.size[uf.find(i)]);
	cout<<ans<<endl;
}

Measured memory_bytes: 6360
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll mod = 1e9 + 7;

ll hold[100001];

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//freopen("INP.txt", "r", stdin);
	//freopen("OUT.txt", "w", stdout);
	string s;
	cin >> s;
	ll a = 0, b = 0;
	bool check = 0;
	ll pos = -1;
	for (ll i = 1; i < s.size(); i++) {
		if (!check) {
			if (s[i] == 'R') {
				a++;
			}
			else {
				check = !check;
				pos = i;
			}
		}
		else {
			if (s[i] == 'L') {
				b++;
			}
			else {
				check = !check;
				hold[pos - 1] = (a / 2) + (b - (b / 2)) + 1;
				hold[pos] = (b / 2) + (a - (a / 2)) + 1;
				a = 0, b = 0;
				pos = -1;
			}
		}
	}
	if (pos != -1) {
		hold[pos - 1] = (a / 2) + (b - (b / 2)) + 1;
		hold[pos] = ((b / 2)) + (a - (a / 2)) + 1;
	}
	for (ll i = 0; i < s.size(); i++) {
		cout << hold[i] << ' ';
	}
	return 0;
}


Measured memory_bytes: 1488
#include "bits/stdc++.h"
using namespace std;
#define ASC(vec) vec.begin(), vec.end()			// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
typedef long long ll;

int main() {
	int X, Y; cin >> X >> Y;
	cout << X + Y / 2 << endl;
	return 0;
}

Measured memory_bytes: 256
N , C = map(int,input().split())
tel = [[0,-1] for i in range(C)]
pro = [list(map(int,input().split())) for i in range(N)]
pro.sort()
for s , t , c in pro:
    for i in range(C):
        if tel[i][0] < s - 0.5 or tel[i][1] == c or tel[i][1] == -1:
            tel[i][0] = t
            tel[i][1] = c
            break
for i in range(C):
    if tel[i][1] == -1:
        print(i)
        exit()
print(C)
    

Measured memory_bytes: 27564
import static java.lang.System.*;

import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

	public void solve() {
		String s = next();
		char[] c = s.toCharArray();
		if(c[2]==c[3] && c[4]==c[5]) {
			println("Yes");
		}else {
			println("No");
		}
	}

	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		return (int) nextLong();
	}

	public int gcd(int a, int b) {
		return b == 0 ? a : gcd(b, a % b);
	}

	long gcd(long a, long b) {
		return b == 0 ? a : gcd(b, a % b);
	}

	long lcm(long a, long b) {
		return a * b / gcd(a, b);
	}

	double sqrt(double x) {
		return Math.sqrt(x);
	}

	double pow(double x, double y) {
		return Math.pow(x, y);
	}

	public static void main(String[] args) {
		Main m = new Main();

		m.solve();
	}

	public void println(Object o) {
		out.println(o);
	}

}


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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

//debug
//--------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//IO accelerate
//--------------------------------------------
struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

//template
//--------------------------------------------
template<typename T>
istream& operator >>(istream& is, vector<T>& vec) {
  for(T& x: vec) is >> x;
  return is;
}
template<typename T>
ostream& operator <<(ostream& os, const vector<T>& vec) {
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : "\t" );
  }
  return os;
}
template<typename T>
ostream& operator <<(ostream& s, const vector<vector<T>>& vv) {
	for (int i = 0; i < vv.size(); ++i) {
		s << vv[i] << endl;
	}
	return s;
}

//main code

int main(int argc, char const* argv[])
{
	int n;
	cin >> n;
	VL a(n+1), b(n);
	cin >> a >> b;
	LL ans = 0;
	for (int i = 0; i < n; i++) {
		if (b[i] > a[i]) {
			ans += a[i];
			ans += min(b[i] - a[i],a[i+1]);
			a[i+1] = max((LL)0, a[i+1] - b[i] + a[i]);
			continue;
		}
		ans += b[i];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1792
fn read<T: std::str::FromStr>() -> T {
  let mut s = String::new();
  std::io::stdin().read_line(&mut s).ok();
  s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
  read::<String>().split_whitespace()
    .map(|e| e.parse().ok().unwrap()).collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
  (0..n).map(|_| read_vec()).collect()
}

fn main() {
  let s: String = read();
  let s: Vec<char> = s.chars().collect();


  let mut flag: bool = true;

  for i in 0..s.len() {
    if (i+1)%2 == 0 {
      if s[i] == 'R' { flag = false; break; }
    } else {
      if s[i] == 'L' { flag = false; break; }
    }
  }

  if flag { println!("Yes"); }
  else { println!("No"); }
}

Measured memory_bytes: 4352
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

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

	int h, w;
	cin >> h >> w;

	vector<vector<int>> c(10, vector<int>(10));
	for (int i = 0; i < 10; i++) {
		for (int j = 0; j < 10; j++) {
			cin >> c[i][j];
		}
	}

	vector<vector<int>> cost = c;
	for (int k = 0; k < 10; k++) {
		for (int i = 0; i < 10; i++) {
			for (int j = 0; j < 10; j++) {
				if (cost[i][k] + cost[k][j] < cost[i][j]) {
					cost[i][j] = cost[i][k] + cost[k][j];
				}
			}
		}
	}

	vector<vector<int>> a(h, vector<int>(w));
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> a[i][j];
		}
	}

	int ans = 0;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (a[i][j] == -1) {
				continue;
			}

			ans += cost[a[i][j]][1];
		}
	}

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


Measured memory_bytes: 384
//For higher stack size use g++ -O2 -std=c++11 -Wall -Wl,--stack=268435456 a.cpp -o a.exe in cmd
    #include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;
    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            int p,q,r;
            cin>>p>>q>>r;
            int ans=min({p+q,q+r,p+r});
            cout<<ans<<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;

int main(){
   char a;
   cin >> a;
   bool flag = true;
   if(a=='a'){cout << 'a' << endl; flag = false;}
   if(a=='b'){cout << 'a' << endl; flag = false;}
   if(a=='c'){cout << 'a' << endl; flag = false;}
   if(a=='d'){cout << 'a' << endl; flag = false;}
   if(a=='e'){cout << 'a' << endl; flag = false;}
   if(a=='f'){cout << 'a' << endl; flag = false;}
   if(a=='g'){cout << 'a' << endl; flag = false;}
   if(a=='h'){cout << 'a' << endl; flag = false;}
   if(a=='i'){cout << 'a' << endl; flag = false;}
   if(a=='j'){cout << 'a' << endl; flag = false;}
   if(a=='k'){cout << 'a' << endl; flag = false;}
   if(a=='l'){cout << 'a' << endl; flag = false;}
   if(a=='m'){cout << 'a' << endl; flag = false;}
   if(a=='n'){cout << 'a' << endl; flag = false;}
   if(a=='o'){cout << 'a' << endl; flag = false;}
   if(a=='p'){cout << 'a' << endl; flag = false;}
   if(a=='q'){cout << 'a' << endl; flag = false;}
   if(a=='r'){cout << 'a' << endl; flag = false;}
   if(a=='s'){cout << 'a' << endl; flag = false;}
   if(a=='t'){cout << 'a' << endl; flag = false;}
   if(a=='u'){cout << 'a' << endl; flag = false;}
   if(a=='v'){cout << 'a' << endl; flag = false;}
   if(a=='w'){cout << 'a' << endl; flag = false;}
   if(a=='x'){cout << 'a' << endl; flag = false;}
   if(a=='y'){cout << 'a' << endl; flag = false;}
   if(a=='z'){cout << 'a' << endl; flag = false;}
   if(flag) cout << 'A' <<endl;
 
   return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define all(x) (x).begin, (x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
const int MAX_NUM = 999999999;
void solve() {
	int A, B, C; cin >> A >> B >> C;
	if (B < A) {
		cout << 0 << endl;
		return;
	}
	cout << (A * C >= B ? (B / A) : C) << endl;
	return;
}
int main() {
	solve();
	return 0;
}

Measured memory_bytes: 256
def judgeTriangle(a, b, c):
    if c * c == a * a + b * b:
        result = 'YES'
    else:
        result = 'NO'
    return result


for i in range(int(input())):
    numList = list(map(int, input().split()))
    numList.sort()
    a, b, c = numList
    print(judgeTriangle(a, b, c))



Measured memory_bytes: 5604
from math import factorial as f
a,b=map(int,input().split())
c=int(1e9+7)
if abs(a-b)>=2:
  print(0)
elif abs(a-b)==1:
  print(f(a)*f(b)%c)
else:
  print((f(a)*f(b)*2)%c)

Measured memory_bytes: 5184