akhauriyash/Code-Regression huggingface dataset:
#ifdef Prateek
  #include "Prateek.h"
#else
  #include <bits/stdc++.h>
  using namespace std;
  #define debug(...) 42
#endif
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
const int MOD = 1e9+7, N = 1e5 + 10; 

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   int l,r,d;
   cin >> l >> r >> d;
   int ans = 0;
   f(i,l,r+1){
      ans += (i%d == 0);
   }
   cout << ans << '\n';
   return 0;
}

Measured memory_bytes: 3652
#include<iostream>
#include<string>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<tuple>
#include<vector>
#include<map>
#include<numeric>
#include<limits>
#include<type_traits>
using namespace std;

int main(void){
  //入力
  long long int N;
  cin >> N;
  if (N == 1){
    cout << 0;
  }
  else if(N / 2 == 0){
    cout << N / 2 - 1;
  }
  else{
    cout << (N - 1) / 2;
  }
  return 0;
}


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

int main(void) {
  int64_t N, A, B;
  cin >> N >> A >> B;

  int64_t diff = abs(A - B);
  if (diff % 2 == 0) {
    cout << diff / 2 << endl;
    return 0;
  }

  int64_t answer;
  if (B < A) swap(A, B);
  if ((A - 1) <= (N - B)) {
    answer = A - 1 + 1;
    answer += (B - A) / 2;
  } else {
    answer = N - B + 1;
    // N - (A + N - B + 1)
    answer += (B - A - 1) / 2;
  }
  cout << answer << 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();
		int R = sc.nextInt();
		if(N < 10){			
			R += 100 * (10 - N);
		}
		System.out.println(R);
	}
}


Measured memory_bytes: 21204
#include<stdio.h>
#include<stdlib.h>

int main(){

int R,G,B,K;
scanf("%d%d%d",&R,&G,&B);
scanf("%d",&K);

while (K>0)
{
  K--;
  if (G<B){
    if (R<G){ 
      puts("Yes");
      exit(0);
    }else{
      G *= 2;
    }
  }else{
    B *= 2;
  }
}
if(R<G&&G<B){
  puts("Yes");
}else{
  puts("No");
}

return 0;

}

Measured memory_bytes: 1664
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#define REP(i,n) for(ll i = 0;i < (n);i++)
#define pb push_back
using namespace std;
const int INF = 1e9;
typedef long long ll;

int main(){
  ll n,a,b;
  cin >> n >> a >> b;
  vector <ll> h;
  REP(i,n){
    ll c;
    cin >> c;
    h.pb(c);
  }

  sort(h.begin(),h.end(),greater<ll>());
  
  ll sum = 0;
  ll r = 1,ed = h[0]/b;
  if(h[0]%b != 0)
    ed++;
  ll mid = (r+ed)/2;
  REP(i,h.size()){
    sum += (h[i]-b)/(a-b);
    if((h[i]-b)%(a-b) != 0 && (h[i]-b) > 0)
      sum++;
  }
  if(sum > 1){
    while(1){
      sum = 0;
      REP(j,h.size()){
	if((h[j]-b*mid) > 0)
	  sum += (h[j]-b*mid)/(a-b);
	if(((h[j]-b*mid)%(a-b)) != 0 && (h[j]-b*mid) > 0)
	  sum++;
      }
      if(sum <= mid){
	ed = mid;
	mid = (r+ed)/2;
      }
      else{
	r = mid;
	mid = (r+ed)/2;
      }
      //cout << "r : " << r << endl;
      //cout << sum << endl;
      if(r == mid){
	cout << r+1 << endl;
	break;
      }
    }
  }
  else
    cout << 1 << endl;
  //cout << num << endl;
  return 0;
}


Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
typedef long long lint;
typedef pair<long long,long long> pl;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
lint a[20010],b[20010];
lint zyo[19];
int n;
vector<pl> mer(vector<pl> a,vector<pl> b){
	vector<pl> ret;
	rep(i,b.size()) a.pb(b[i]);
	sort(a.begin(),a.end());
	lint l=0,h=0;
	rep(i,a.size()){
		if(h<a[i].fi){
			if(l>0 && h>0) ret.pb(mp(l,h));
			l=a[i].fi;h=a[i].se;
		}
		else{
			h=max(h,a[i].se);
		}
	}
	ret.pb(mp(l,h));
	return ret;
}
bool cal(int x,lint y){
	//cout<<x<<' '<<y<<endl;
	vector<pl> v;
	v.pb(mp(zyo[x]*y,zyo[x]*(y+1)));
	rep(i,n) b[i]=a[i]%zyo[x+1];
	//rep(i,n) cout<<b[i]<<' ';cout<<endl;
	rep(i,n){
		//rep(j,v.size()) printf("(%lld,%lld),",v[j].fi,v[j].se);cout<<endl;
		vector<pl> w;
		rep(j,v.size()){
			if(v[j].fi<=b[i] && b[i]<v[j].se) return true;
			//cout<<v[i].fi<<' '<<v[i].se<<endl;
			//cout<<b[i]<<endl;
			//cout<<(zyo[x+1]+v[i].fi-b[i])%zyo[x+1]<<' '<<(zyo[x+1]+v[i].se-b[i])%zyo[x+1]<<endl;
			lint z=(zyo[x+1]+v[j].se-b[i])%zyo[x+1];
			if(z<1) z+=zyo[x+1];
			w.pb(mp((zyo[x+1]+v[j].fi-b[i])%zyo[x+1],z));
		}
		v=mer(v,w);
	}
	return false;
}
int main()
{
	int out=0;
	cin>>n;
	rep(i,n) cin>>a[i];
	zyo[0]=1;rep(i,18) zyo[i+1]=zyo[i]*10;
	rep(i,18){
		int x=0;
		rep(j,10){
			if(cal(i,j)) x=max(x,j);
		}
		//cout<<x<<endl;
		out+=x;
	}
	cout<<out<<endl;
}


Measured memory_bytes: 512
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))

def main():
    N, X = input_nums()
    L = input_nums()
    s = 0
    cnt = 1
    for i in range(N):
        s += L[i]
        if s <= X: cnt += 1
    print(cnt)

if __name__ == '__main__':
    main()

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

void answer1() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N;
  cin >> N;
  vector<vector<int> > a(2, vector<int>(N));
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < N; j++) {
      cin >> a.at(i).at(j);
    }
  }

  for (int i = 1; i < N; i++) {
    a.at(0).at(i) += a.at(0).at(i - 1);
  }
  a.at(1).at(0) += a.at(0).at(0);
  for (int i = 1; i < N; i++) {
    a.at(1).at(i) += max(a.at(1).at(i - 1), a.at(0).at(i));
  }

  cout << a.at(1).at(N - 1) << endl;
}

void answer2() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N;
  cin >> N;
  int a[3][101] = {0};
  for (int i = 1; i <= 2; i++) {
    for (int j = 1; j <= N; j++) {
      cin >> a[i][j];
    }
  }

  for (int i = 1; i <= 2; i++) {
    for (int j = 1; j <= N; j++) {
      a[i][j] += max(a[i][j - 1], a[i - 1][j]);
    }
  }
  cout << a[2][N] << endl;
  }

int main() {
  //answer1();
  answer2();
}


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

using namespace std;

#define ll long long 
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mkp make_pair
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define ff first
#define ss second
#define endl "\n"
#define MOD 1000000007
#define MOD1 998244353
#define inf LLONG_MAX

ll GCD(ll x,ll y){if(y==0)return x;return GCD(y,x%y);}
ll LCM(ll x,ll y){return (x*y)/(GCD(x,y));}
ll LOGK(ll x,ll k){if(x>=k)return 1+LOGK(x/k,k);return 0;}
ll MPOW( ll a, ll b, ll m) { if(b==0) return 1; ll x=MPOW(a,b/2,m); x=(x*x)%m; if(b%2==1) x=(x*a)%m; return x;}
ll MINV(ll a,ll m) {return MPOW(a,m-2,m);}

class pnc{
  ll FACT_MAX,MODU;
  vector<ll> fact;
public:
  pnc( ll n, ll m) { FACT_MAX = n; fact.resize(FACT_MAX); MODU = m; MFACT_INIT(MODU);}
  void MFACT_INIT( ll m) { fact[0]=1; for(ll i=1;i<FACT_MAX;++i) fact[i]=(i*fact[i-1])%MODU;}
  ll MFACT( ll n) { return fact[n];}
  ll PERM( ll n, ll r) { return (fact[n]*::MINV(fact[n-r],MODU))%MODU;}
  ll COMB( ll n , ll r) { return (PERM(n,r)*::MINV(fact[r],MODU))%MODU;}
};

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);    

    ll test=1;
    //cin>>test;
    while(test--)
    {
        ll n,m,k;
        cin>>n>>m>>k;


        ll ans=0;

        pnc pc(n+1,MOD1);

        for(ll p=n-k;p<=n;p++)
        {
            ll a=pc.COMB(n-1,p-1);
            a*=m;
            a%=MOD1;
            ll c=MPOW(m-1,p-1,MOD1);
            a*=c;
            a%=MOD1;

            ans+=a;
            ans%=MOD1;
        }

        cout<<ans;
    }
}

Measured memory_bytes: 4784
INF=10**9
f=lambda:[*map(int,input().split())]
n,k=f()
p,c=f(),f()
p=[*map(lambda x:x-1,p)]
tp=[[*range(n)] for _ in range(n+1)]
tc=[[0]*n for _ in range(n+1)]
lt=[0]*n
lc=[0]*n
for i in range(n):
  for j in range(n):
    t=p[tp[i][j]]
    tp[i+1][j]=t
    tc[i+1][j]=tc[i][j]+c[t]
    if t==j and lt[j]==0:
      lt[j]=i+1
      lc[j]=tc[i+1][j]
a=-INF
for i in range(n):
  if lc[i]<1 or k<=lt[i]:
    for j in range(min(lt[i],k)):
      a=max(a,tc[j+1][i])
  else:
    for j in range(lt[i]):
      t=k//lt[i]*lc[i]+tc[j+1][i]
      if k%lt[i]<j+1: t-=lc[i]
      a=max(a,t)
print(a)

Measured memory_bytes: 467196
import  heapq
 
N, M = map(int, input().split())
data = [[int(x) for x in input().split()] for i in range(N)]
data.sort(reverse=True, key=lambda x: (-x[0], x[1]))
 
day = M
reward = 0
 
# d日前
q = []
i = 0
for d in range(1, M + 1):
    for t in range(i, N):
        if data[t][0] > d:
            break
        i += 1
        heapq.heappush(q, -1 * data[t][1])
    if q:
        reward += heapq.heappop(q)
 
print(-1 * reward)

Measured memory_bytes: 32544
n = int(input())
A = [int(x) for x in input().split()]

cnt = 0
for i in range(n - 1):
    for j in range(n - 2, i - 1, -1):
        if A[j] > A[j + 1]:
            A[j], A[j + 1] = A[j + 1], A[j]
            cnt += 1

print(*A)
print(cnt)



Measured memory_bytes: 5612
#include<bits/stdc++.h>
using namespace std;
long long cnt;
vector<int> G;
int arr[1000010];
int m,n;
void sert(int g){
	for(int i=g;i<n;i++){
		int v = arr[i];
		int j = i - g;
		while(j>-1&&arr[j]>v){
			arr[j+g] = arr[j];
			j -= g;
			cnt++;
		}
		arr[j+g] = v;
	}
}
void shell(){
	int h=1;
	while(h<=n){
		G.push_back(h);
		h = 3*h + 1;
	}
	m = G.size();
	for(int i=m-1;i>=0;i--) sert(G[i]);
}
int main(){
	cin>>n;
	cnt = 0;
	for(int i=0;i<n;i++) scanf("%d",&arr[i]);
	shell();
	cout<<m<<endl;
	for(int i=m-1;i>=0;i--) {
		printf("%d",G[i]);
		if(i) printf(" ");
	}
	printf("\n");
	cout<<cnt<<endl;
	for(int i=0;i<n;i++) printf("%d\n",arr[i]);
}


Measured memory_bytes: 7140
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long


signed main(){

  int n; cin >> n;
  vector<int> d(n);
  for(int i = 0; i < n; i++){
    cin >> d[i];
  }
  sort(d.begin(),d.end());

  vector<int> v(n+1);
  int pre = 0;
  for(int i = 0; i < n; i++){
    if(pre == 0){
      v[i] = d[i];
      pre = 1;
    }
    else {
      v[i] = 24 - d[i];
      pre = 0;
    }
  }
  v[n] = 0;
  sort(v.begin(),v.end());

  int ans = 24;
  for(int i = 1; i < n+1; i++){
    ans = min(ans,v[i] - v[i-1]);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include <climits>
#include<fstream>
using namespace std;
//---------------------------------------------------
//library zone!!!!!
typedef long long ll;
typedef long double ld;
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ld mod_pow(ld x, ll n, ll p) {
	ld res = 1;
	while (n > 0) {
		if (n & 1) res = res * x;
		x = x * x;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
signed main() {
	string s;
	cin>>s;
	bool l=0;
	for(int i=2;i<s.size()-1;i++){
		if(s[i]=='C') l=1;
	}
	if(s[0]!='A') l=0;
	bool r=0;
	for(int i=1;i<s.size();i++){
		if(!r&&s[i]=='C') r=1;
		else{
			if(!('a'<=s[i]&&s[i]<='z')){
				l=0;
			}
		}
	}
	if(l) cout<<"AC"<<endl;
	else cout<<"WA\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define REP(i,a,n) for(ll i=a;i<(n);i++)
#define RE return
#define FILL(a,b) memset(a,b,sizeof(a))
#define SO(a) sort(all(a))
#define pb push_back
#define sz(a) a.size()
#define V vector
#define ld long double
#define viit(a) vector<int>::iterator a
#define IT iterater
#define FOR(i,a,n) for(ll i=a;i<=(n);i++)
#define B(s) s.back()
#define all(a) a.begin(),a.end()
#define ER1(a) a.erase(a.begin())
#define ER0(a) a.erase(a.end())
#define pii pair<int,int>
#define pause system("PAUSE")
#define cls system("CLS")
using namespace std;
int z(int x,int y){
	int s,i=1;
    if(x>y)swap(x,y);
	s=y*i;
	while(s%x!=0)
	{
	i++;
	s=y*i;
	} 
	return s;
}
int main()
{
    ios::sync_with_stdio(0);
	int x;
	cin>>x;
	int zui=z(x,360);
	cout<<zui/x;
    return 0;
}


Measured memory_bytes: 3608
#include <stdio.h>

char cat_stu(int pm, int pe, int pj)
{
    int ave;
    ave = (pm + pe + pj) / 3;
    
    if (pm == 100 || pe == 100 || pj == 100) {
        return 'A';
    } else if ((pm + pe) / 2 >= 90) {
        return 'A';
    } else if (ave >= 80) {
        return 'A';
    } else if (ave >= 70) {
        return 'B';
    } else if (ave >= 50 && (pm >= 80 || pe >= 80)) {
        return 'B';
    } else {
        return 'C';
    }
}

int main(void)
{
    int a;
    int pm, pe, pj;

    while(1) {
        scanf("%d", &a);
        
        if (a == 0) {
            break;
        }
    
        for (int i = 0; i < a; i++) {
            scanf("%d %d %d", &pm, &pe, &pj);
            printf("%c\n", cat_stu(pm, pe, pj));
        }
    }
        
    return 0;
}

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

int main() {
  int N,M;
  int x = 0;
  
  cin >> N;
  vector<string> s(N);
  for(int i = 0; i < N; i++) {
    cin >> s.at(i);
  }
  
  cin >> M;
  vector<string> t(M);
  for(int i = 0; i < M; i++) {
    cin >> t.at(i);
  }
  
  for(int i = 0; i < N; i++) {
    int count = 0;
    for(int j = 0; j < N; j++) {
      if(s.at(i) == s.at(j) ) {
        count++;
      }
    }
    for(int j = 0; j < M; j++) {
      if(s.at(i) == t.at(j) ) {
        count--;
      }
    }
    x = max(x,count);
  }
         
  cout << x << endl;
}


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

const int N = 2e3;

const int MOD = 1e9+7;

int n,m;
int a[N+5],b[N+5];

int memo[N+5][N+5];

int dp(int idx1, int idx2){
	if(idx1 > n || idx2 > m) return 0;
	int &ret = memo[idx1][idx2];
	if(ret!=-1) return ret;
	ret = dp(idx1+1,idx2);
	ret = (ret+dp(idx1,idx2+1))%MOD;
	ret  = (ret-dp(idx1+1,idx2+1)+MOD)%MOD;
	if(a[idx1] == b[idx2]){
		ret = (ret+dp(idx1+1,idx2+1)+1)%MOD;
	}
	return ret;
}

int main(){
	memset(memo,-1,sizeof(memo));
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	for(int i=1;i<=m;i++) scanf("%d",&b[i]);
	int ans = dp(1,1);
	printf("%d\n",(ans+1)%MOD);
	return 0;
}

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

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

    int n, p;
    cin >> n >> p;
    string s;
    cin >> s;
    long long hoge = 0;
    if (p == 2 || p == 5) {
        for (int i = 0; i < n; i++) {
            if ((s[i] - '0') % p == 0) {
                hoge += i + 1;
            }
        }
        cout << hoge << endl;
        return 0;
    }
    int b = 1;
    vector<int> as(n);
    for (int i = n - 1; i >= 0; i--) {
        as[i] = b * (s[i] - '0') % p;
        b = b * 10 % p;
    }
    int sum = 0;
    map<int, int> mp;
    mp[0]++;
    for (int i = n - 1; i >= 0; i--) {
        sum += as[i];
        sum %= p;
        mp[sum]++;
    }
    long long ans = 0;
    for (auto& p : mp) {
        ans += 1LL * p.second * (p.second - 1) / 2;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1684
N = int(input())
h = list(map(int, input().split()))
h.append(0)
min_n = 100
ans = 0
cnt = 0
i = 0
while i < N + 1:
    if h[i] != 0:
        cnt += 1
        min_n = min(min_n, h[i])
    elif h[i] == 0 and cnt != 0:
        ans += min_n
        for j in range(i+1):
            h[j] = max(h[j]-min_n, 0)
        min_n = 100
        cnt = 0
        i = -1
    i += 1
print(ans)
    

Measured memory_bytes: 39536
#include<bits/stdc++.h>
#define int long long
#define pb emplace_back
#define mp make_pair
#define mt make_tuple
#define all(v) v.begin(),v.end()
#define rep(i,start,lim) for(long long (i)=(start);i<(lim);i++)
#define revrep(i,n) for(long long i=n-1;i>=0;i--)
#define boost ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define osit ostream_iterator<int> output (cout," ")
#define endl '\n'
#define f first
#define s second
#define PI 3.141592653589793
#define MOD 1000000007
#define set0(x) memset(x,0,sizeof(x))
#define set1(x) memset(x,1,sizeof(x))
using namespace std;
typedef vector<int> vi;
typedef list<int> li;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef tuple<int, int, int> iii;
template<typename T> T gcd(T a,T b){if(a==0) return b; return gcd(b%a,a);}
template<typename P> P dectobin(P a){if(a==0)return 0; else return(a%2 + 10*dectobin(a/2));}
template<typename Y> Y bintodec(Y a){int ans=0,b=1,t=a; while (t){int ld=t%10; t/=10;ans+=ld* b;b=b*2;} return ans; }
template<typename H> H modExp(H x, H n){ int r=1; while(n>0){if(n%2==1){r=(r*x)%MOD;}x=(x*x)%MOD;n/=2;}return r;}
template<typename T> T isPowerOfTwo(T x){return x && (!(x & (x - 1)));}	
template<typename T> T lcm(T a,T b) {return a*b/gcd(a,b);}
//template<typename T> T extendedEuclid(T A,T B){if(B==0){d=A; x=1;y=0;}else{ extendedEuclid(B,A%B);int temp=x; x=y; y=temp-(A
//B)*y;}}

int32_t main(){
	boost;osit;
	int n;
    cin>>n;
    double sum=0;
    int arr[n];
    rep(i,0,n){
        cin>>arr[i];
        sum+=(double)(1*1.0)/arr[i];
    }
    double ans=1.0/sum;
    cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

  if(a < b) {
    for(int i = 0; i < b; i++) {
      cout << a;
    }
  } else {
    for(int i = 0; i < a; i++) {
      cout << b;
    }
  }

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		while(sc.hasNextDouble()){
			double kg = sc.nextDouble();
			String str = "";
			if(48.00 >= kg)str = "light fly";
			else if(48.00 < kg && 51.00 >= kg)str = "fly";
			else if(51.00 < kg && 54.00 >= kg)str = "bantam";
			else if(54.00 < kg && 57.00 >= kg)str = "feather";
			else if(57.00 < kg && 60.00 >= kg)str = "light";
			else if(60.00 < kg && 64.00 >= kg)str = "light welter";
			else if(64.00 < kg && 69.00 >= kg)str = "welter";
			else if(69.00 < kg && 75.00 >= kg)str = "light middle";
			else if(75.00 < kg && 81.00 >= kg)str = "middle";
			else if(81.00 < kg && 91.00 >= kg)str = "light heavy";
			else if(91.00 < kg)str = "heavy";
			System.out.println(str);
		}
	}
}

Measured memory_bytes: 17420
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int mod = pow(10, 9) + 7;
const int mod2 = 998244353;
const int INF = 1LL << 60;
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string abc = "abcdefghijklmnopqrstuvwxyz";
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}

signed main()
{
  int N, P;
  cin >> N >> P;

  int ev = 0, od = 0;
  for (int i = 0; i < N; i++)
  {
    int A;
    cin >> A;
    if (A % 2 == 0) ev++;
    else od++;
  }
  
  int ans = 1;
  if (P == 1)
  {
    if (od == 0) 
    {
      cout << 0 << endl;
      return 0;
    }
    else
    {
      od--;
      ans *= 2;
    }
  }
  else if (od == 0) ans *= 2; 
  ans *= pow(2, ev) * pow(2, od - 1);

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <string.h>
#include <string>
#include <complex>
using namespace std;
 
#define INT_max 2147483647
 
 
typedef long long ll;
typedef long double ld;
 
 
int main(){
	int n;
	cin>>n;
	if(n < 4){
		int ans;
		for(int i = 0;i < n;i++){
			int t;
			cin>>t;
			if(i == 0) ans = t;
			else ans = max(ans,t);
		}
		cout<<ans;
		return 0;
	}
	vector<ll> ans1(n,0);//记录的是当前包含i/2个数的最大和 
	vector<ll> ans2(n,0);//记录的是当前包含（i+1）/2个数的最大和
	for(int i = 0;i < n;i++){
		ll t;
		cin>>t;
		if(i < 2){
			ans2[i] = t;
		}
		else{
			if(i%2) ans2[i] = max(ans2[i-2],ans2[i-3]) + t;
			else ans2[i] = ans2[i-2]+t; 
		}
		if(i < 3){
			if(i == 2) ans1[i] = max(ans1[0],t);
			else ans1[i] = t;
		}
		else{
			if(i%2) ans1[i] = max(ans2[i-3],ans1[i-2]) + t;
			else ans1[i] = max(ans1[i-3],ans1[i-2]) + t;
		}
	}
	if(n%2) cout<<max(ans1[n-1],ans1[n-2]);
	else cout<< max(ans2[n-1],ans2[n-2]);
	return 0;
}

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

typedef long int lint;
typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<long, long> pll;

#define EACH(i, c) for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i, s, e) for (int i = (s); i < (int)(e); ++i)
#define REP(i, n) FOR(i, 0, n)
#define endl '\n'
#define mod 1000000007
#define INF 100000000
#define fk first
#define sv second

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

template<typename T>
void print(const std::vector<T>& v, char sep=' ') {
  for (int i = 0; i < (int)v.size(); i++) {
    if (i != 0) cout << sep;
    cout << v[i];
  }
  cout << endl;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a[11];
  REP(i, 10){
    cin >> a[i];
  }
  sort(a, a + 10);
  reverse(a, a + 10);
  cout << a[0] << endl << a[1] << endl << a[2] << endl;

}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]A - 9x9
            var line = ReadLine();
            int A = line[0];
            int B = line[1];

            int ans = -1;
            
            if(A<=9 && B <= 9)
            {
                ans = A * B;
            }

            Console.WriteLine(ans);
        }

        static List<int> ReadLine()
        {
            var line = Console.ReadLine();
            var arr = line.Split(' ');

            return arr.Select(x => int.Parse(x)).ToList();
        }
    }
}

Measured memory_bytes: 13268
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)

int main(void){
	while(1){
		int n, k;
		scanf("%d %d", &n, &k);
		if(n == 0 && k == 0) return 0;
		vector<string> data(n);
		set<string> num;
		rep(i, n) cin >> data[i];
		
		sort(data.begin(), data.end());

		do{
			string tmp;
			rep(i, k){
				tmp += data[i];
			}
			num.insert(tmp);
		}while(next_permutation(data.begin(), data.end()));
		printf("%lu\n", num.size());
	}
}

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

struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
using intpair = pair<int, int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((int)((a) + (b) - 1)/(int)(b))
#define int long long

int H, W;
bool is_safe(int x, int y){
    return (0 <= x && x < W)&&(0 <= y && y < H);
}

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

int ans[51][51];

signed main(){
    cin >> H >> W;
    vector<string> field(H);
    rep(i,H) cin >> field[i];
    
    rep(y,H)rep(x,W){
        if(field[y][x] == '#'){
            ans[y][x] = -1;
            continue;
        }
        rep(i,8){
            if(!is_safe(x+dx[i], y+dy[i])) continue;
            if(field[y+dy[i]][x+dx[i]] == '#'){
                ans[y][x]++;
            }
        }
    }
    
    rep(i,H){
        rep(j,W){
            if(ans[i][j] != -1)cout << ans[i][j];
            else cout << '#';
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
n = int(input())
s = input()
se = set()
for i in range(1000):
    se.add(str(i).zfill(3))

ans = 0
for i in se:
    t1=s.find(i[0])
    if t1!=-1:
        t2=s.find(i[1],t1+1,)
        if t2!=-1:
            t3=s.find(i[2],t2+1,)
            if t3!=-1:
                ans+=1
print(ans)


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

int a,b,c,d;
int main() {

  cin >> a >> b >> c >> d;

  if ((a+b) > (c+d)) {cout << "Left" << endl;}
  if ((a+b) < (c+d)) {cout << "Right" << endl;}
  if ((a+b) == (c+d)) {cout << "Balanced" << endl;}

}


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

const int N = 310;

typedef long long LL;

int dp[N][N], C[N][N], sum[N][N];

int main() {
    int n, k, mod; scanf("%d%d%d", &n, &k, &mod), n++;
    for (int i = 0; i <= n; i++) {
        C[i][0] = 1;
        for (int j = 1; j <= i; j++) C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % mod;
    }
    for (int i = 0; i <= k; i++) sum[1][i] = k - i + 1, dp[1][i] = 1;
    for (int i = 2; i <= n; i++) {
        for (int j = 0; j <= k; j++) {
            for (int t = 1; t < i; t++) 
                dp[i][j] = (dp[i][j] + (LL)dp[i - t][j] * C[i - 2][t - 1] % mod * sum[t][j + 1]) % mod;
        }
        for (int j = k; j >= 1; j--) sum[i][j] = (sum[i][j + 1] + dp[i][j]) % mod;
    }
    printf("%d\n", dp[n][0]);
    return 0;
}//

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pf push_front
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
double pi = 3.141592653589793;
ll mod = 1000000007;
ll INF = 1000000001;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
 
 
 
int main(){
  int n;
  cin>>n;
  if(n==3 || n==5 || n==7){
    cout<<"YES"<<endl;
  }
  else{
    cout<<"NO"<<endl;
  }
  
    return 0;
  
}

Measured memory_bytes: 256
# N=遊びに行った人数  K=ジェットコースターに乗れる身長
N, K = map(int, input().split())

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

reversed_list = sorted(h_list)[::-1]

num = 0
for h in reversed_list:
    if h < K:
        break
    num += 1

print(num)

Measured memory_bytes: 11908
import java.io.{PrintWriter, _}
import java.util
import java.util._

import scala.collection.mutable


object Main {
  def main(args: Array[String]): Unit = {
    val inputStream = System.in
    val outputStream = System.out
    val in = new InputReader(inputStream)
    val out = new PrintWriter(outputStream)
    val solver = new Task
    solver.solve(1, in, out)
    out.close()
  }

  def ?(item: Boolean, first: Object, second: Object): Object = if (item) first else second

  class Task {
    def solve(testNumber: Int, in: InputReader, out: PrintWriter): Unit = {
      val map = mutable.HashMap("A" -> "T", "T" -> "A", "G" -> "C", "C" -> "G")
      out.println(map(in.next))
    }
  }


  class InputReader(val stream: InputStream) extends AutoCloseable {
    //reader = new BufferedReader(new FileReader(stream), 32768);
    private val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    private var tokenizer = new StringTokenizer("")


    def next: String = {
      while ( {
        tokenizer == null || !tokenizer.hasMoreTokens
      }) try
        tokenizer = new StringTokenizer(reader.readLine)
      catch {
        case e: IOException =>
          throw new RuntimeException(e)
      }
      tokenizer.nextToken
    }

    def nextLine: String = {
      try
        return reader.readLine
      catch {
        case e: IOException =>
          e.printStackTrace()
      }
      ""
    }

    def nextInt: Int = next.toInt

    def nextLong: Long = next.toLong

    override def close(): Unit = {
    }
  }

}


Measured memory_bytes: 25416
import qualified Data.Vector.Unboxed as V
import Data.Array.IArray (listArray, accumArray, (!))
import Data.Array.MArray
import Data.Array.ST (STUArray, runSTUArray)
import Data.Array.Unboxed (UArray)
import Data.List (sortOn, sortBy, unfoldr, partition)
import Data.Char (isSpace)
import Control.Monad.ST (ST)
import Control.Monad.Trans.State (StateT(..))
import qualified Data.ByteString.Char8 as B

-- utility functions

--   Input functions
readInt = B.readInt . B.dropWhile isSpace

readInts :: Int -> B.ByteString -> [Int]
readInts n = take n . unfoldr readInt

readIntsV :: Int -> B.ByteString -> V.Vector Int
readIntsV n = V.unfoldrN n readInt

readIntsA :: Int -> B.ByteString -> UArray Int Int
readIntsA n bs = runSTUArray $ do
  arr <- newArray_ (0,n-1)
  go arr 0 bs
  return arr
  where
    go :: STUArray s Int Int -> Int -> B.ByteString -> ST s ()
    go arr i bs
      | i==n = return ()
      | otherwise = do
        let Just (x,bs') = readInt bs
        writeArray arr i x
        go arr (i+1) bs'

readTsV :: Int -> B.ByteString -> V.Vector (Int,Int)
readTsV n = V.unfoldrN n $ runStateT ((,) <$> StateT readInt <*> StateT readInt)

readTs :: Int -> B.ByteString -> [(Int,Int)]
readTs n = take n . unfoldr readT where
  readT = runStateT ((,) <$> StateT readInt <*> StateT readInt)

-- main

t 'A' = 'T'
t 'T' = 'A'
t 'G' = 'C'
t 'C' = 'G'

main = do
  map t <$> getLine >>= putStrLn


Measured memory_bytes: 380
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <algorithm>
using namespace std;
const int mod=1000000007;
int main(){
	long long n,m;
	scanf("%lld%lld",&n,&m);
	long long ans=1;
	while(m){
		if(m&1) ans=(n*ans)%mod;
		n=(n*n)%mod;
		m>>=1;
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 3252
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;

class Main{
    public static void main(String[] args){
        
        Scanner sc = new Scanner(System.in);
        
        int H = sc.nextInt();
        int W = sc.nextInt();
        int D = sc.nextInt();
        int[][] A = new int[H][W];
        HashMap<Integer, ArrayList<Integer>> map = new HashMap<>();

        for(int i=0; i<H; i++){
            for(int j=0; j<W; j++){
                A[i][j] = sc.nextInt();
                ArrayList<Integer> list = new ArrayList<Integer>();
                list.add(i);
                list.add(j);
                map.put(A[i][j], list);
            }
        }
        long[] d = new long[H * W + 1];
        for(int i=1; i<=H*W; i++){
            if(i<=D){
                d[i] = 0;
            }
            else{
                ArrayList<Integer> listx = map.get(i);
                ArrayList<Integer> listy = map.get(i - D);
                d[i] = d[i - D] + Math.abs(listx.get(0) - listy.get(0)) + Math.abs(listx.get(1) - listy.get(1));
            }
        }
        int Q = sc.nextInt();
        int[] L = new int[Q];
        int[] R = new int[Q];
        for(int i=0; i<Q; i++){
            L[i] = sc.nextInt();
            R[i] = sc.nextInt();
            System.out.println(d[R[i]] - d[L[i]]);
        }
    }
}

Measured memory_bytes: 116372
import static java.lang.System.out;
import java.util.Scanner;
import java.util.Arrays;
public class Main{
   public static void main(String[]aa){
      Scanner sc = new Scanner(System.in); 
      String S = sc.next();
      boolean result =false; 
      if(S.length()>3){result= S.substring(0,4).equals("YAKI") ? true:false;}
      if(result){
            out.println("Yes");
      }else{
            out.println("No");
      }
   }
}

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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

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

ll dp[2222][2222];
vector<ll> k;
vector<ll> s;
int n,m,l;

ll get_imos(int a, int b){
	ll ret = s[b];
	if(a > 0)ret -= s[a-1];
	return ret / l;
}

int main(){

	REP(i,2222){
		REP(j,2222){
			dp[i][j] = LLINF;
		}
	}

	cin >> n >> m >> l;
	REP(i,n){
		int tmp;cin >> tmp;tmp--;
		k.PB(tmp);
	}
	sort(ALL(k));
	ll sum = 0;
	REP(i,m){
		int tmp;cin >> tmp;
		sum += tmp;
		s.PB(sum);
	}

	dp[0][1] = get_imos(k[0], k[1]);

	REP(i,n-1){
		REP(j,n-1)if(dp[i][j] != LLINF && i < j){
			dp[i][j+1] = min(dp[i][j+1],dp[i][j] + get_imos(k[j],k[j+1]));
			dp[j][j+1] = min(dp[j][j+1],dp[i][j] + get_imos(k[i],k[j+1]));
		}
	}

	ll ans = LLINF;
	REP(i,n)if(dp[i][n-1] != LLINF){
		ans = min(ans, dp[i][n-1] + get_imos(k[i],k[n-1]));
	}

	cout << ans << endl;

	return 0;
}



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

void Main()
{
  set<int> visited;
  stack<int> s;
  int n; cin >> n;
  vector<int> stt(n+1), end(n+1), K(n+1);
  vector<vector<int> > A(n+1, vector<int>(n+1));
  for(int i = 0; i < n; i++) {
    int u; cin >> u;
    cin >> K[u];
    for (int j = 0; j < K[u]; j++) cin >> A[u][j];
  }
  s.push(1);
  int time = 1;
  bool popped = false;
  while (true) {
    //if (!popped) time++;
    //popped = false;
    if (s.size() == 0) {
      for (int i = 1; i <= n; i++) {
        if (visited.find(i) == visited.end()) {
          s.push(i);
          break;
        }
      }
      if (s.size() == 0) break;
      else {time++; continue;}
    }
    int cur = s.top();
    //cout << time << ' ' <<  cur << endl;
    if (visited.find(cur) == visited.end()) {
      visited.insert(cur);
      stt[cur] = time;
    }
    bool done = true;
    for(int i = 0; i < K[cur]; i++) {
      int nxt = A[cur][i];
      if (visited.find(nxt) == visited.end()) {
      	s.push(nxt);
        time++;
        done = false;
        break;
      }
    }
    if (done) {
      time++;
      end[cur] = time;
      s.pop();
      popped = true;
    }
  }
  for(int i = 0; i < n+1; i++) {
    if (i==0) continue;
    cout << i << ' ' << 
      stt[i] << ' ' << end[i] << endl;
  }
}

int main()
{
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}



Measured memory_bytes: 3240
#include<bits/stdc++.h>
using namespace std;
using ld=long double;
ld n,m,d;
int main(){
  cin>>n>>m>>d;
  ld ans=(2*(n-d)*(m-1))/(n*n);
  if(d==0)
    ans=(m-1)/n;
  cout<<fixed<<setprecision(10)<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3784
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
    int n, q;
    string s;

    cin >> n >> q >> s; 
    vector<int> l(n), r(n), num(n, 0); 
    for (int i = 0; i < q; ++i) {
        cin >> l[i] >> r[i];
    }
    for (int i = 0; i < n; ++i) {
        if (s[i] == 'A') {
            if (s[i+1] == 'C') {
                if (i == 0) num[i] = 1;
                else num[i] = num[i-1] + 1;
                continue;
            }
        }
        if (i == 0) continue;
        num[i] = num[i-1];
    }

    for (int i = 0; i < q; ++i)
    {
        cout << num[r[i]-2] - num[l[i]-2] << endl; 
    }
}

Measured memory_bytes: 2176
import numpy as np
N =int(input())
input_line2 =(input())
kushisashi_number = list(map(int,np.zeros(N)))

no_kushi = int(N)*2
kushi_length = list(map(int,input_line2.split()))

kushisashi=sorted(kushi_length,reverse=True)
for n in range(N):
    kushisashi_number[n] = kushisashi[2*n+1]
    
print(sum(kushisashi_number))

Measured memory_bytes: 12428
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}
int main() {
    ll n, m; cin >> n >> m;
    vector<ll> a;
    vector<ll> b;
    vector<ll> c;
    ll tmp;
    REP(i, n) {
        cin >> tmp; a.push_back(tmp);
    }
    REP(i, m) {
        cin >> tmp; b.push_back(tmp);
        cin >> tmp; c.push_back(tmp);
    }
    sort(ALL(a));

    // 書き換えるべき場面
    // 最小値がそのカードの値未満である限り
    // 書き換える部分は同じ値になるので、書き換え枚数ぶんのc + それ以外のsum
    map<ll, ll> mp;
    REP(i, m) {
        ll tmp_b = b[i];
        ll tmp_c = c[i];
        mp[tmp_c] += tmp_b;
    }

    map<ll, ll>::reverse_iterator rit = mp.rbegin();

    vector<ll> r;
    // 小さい順から、書き換えられる限り書き換える
    REP(i, n) {
        if ((rit != mp.rend()) && (a[i] < rit->first)) {
            r.push_back(rit->first);
            mp[rit->first]--;
            if (mp[rit->first] == 0) {
                rit++;
            }
        } else {
            r.push_back(a[i]);
        }
    }
    ll res = 0;
    REP(i, n) {
        res += r[i];
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 13460
N,M=map(int,input().split())
AC=[0]*N
WA=[0]*N
wa=0
for i in range(M):
  p,s=input().split()
  p=int(p)-1
  if AC[p]==0 and s=="AC":
  	AC[p]=1
  	wa+=WA[p]
  WA[p]+=1
print(sum(AC),wa) 


Measured memory_bytes: 4596
array_1 = [1,2,3,4,5,6,7,8,9]
array_2 = [1,2,3,4,5,6,7,8,9]

array_1.each{|x|
  array_2.each{|y|
  puts "#{x}x#{y}=#{x*y}"
  }
}

Measured memory_bytes: 6072
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    long long int a,b,c,ans;
    double t1,t2,t3,t4;
    cin>>a>>b>>c;
    t1=(double)sqrt(a);
    t2=(double)sqrt(b);
    t3=(double)sqrt(c);
    t4=(double)sqrt(a*b);
    if((a*a+b*b+c*c-2*a*b-2*a*c-2*b*c>0)&&c>(a+b))
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


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

void maxHeapify(vector<int>& A, int i) {
    int largest;

    int l = i*2;
    int r = i*2+1;
    if (l <= A.size()-1 && A[l] > A[i])
        largest = l;
    else
        largest = i;

    if (r <= A.size()-1 && A[r] > A[largest])
        largest = r;

    if (largest != i) {
        int tmp = A[i];
        A[i] = A[largest];
        A[largest] = tmp;
        maxHeapify(A, largest);
    }
}

void buildMaxHeap(vector<int>& A) {
    for (int i=(A.size()-1)/2; i>=1; i--)
        maxHeapify(A, i);
}

int main() {
    int h;
    cin >> h;
    vector<int> a(h+1);
    for (int i=1; i<=h; i++)
        cin >> a[i];

    buildMaxHeap(a);

    for (int i=1; i<=h; i++)
        cout << " " << a[i];
    cout << endl;

    return 0;
}



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

int main() {
	int n;
	cin >> n;
	if (n == 3) {
		cout << 2 << ' ' << 5 << ' ' << 63 << endl;
		return 0;
	}
	if (n == 4) {
		cout << 2 << ' ' << 5 << ' ' << 20 << ' ' << 63 << endl;
		return 0;
	}
	if (n == 5) {
		cout << 2 << ' ' << 5 << ' ' << 20 << ' ' << 30 << ' ' << 63 << endl;
		return 0;
	}
	vector<int> ans;
	ans.emplace_back(2);
	ans.emplace_back(3);
	int m = 5, i = 4;
	for (; i <= 30000; i++) {
		if (ans.size() == n) {
			break;
		}
		if (i % 2 == 0 || i % 3 == 0) {
			ans.emplace_back(i);
			(m += i) %= 6;
		}
	}
	if (m == 2) {
		ans.erase(ans.begin() + 4);
		for (; i <= 30000; i++) {
			if (i % 6 == 0) {
				ans.emplace_back(i);
				break;
			}
		}
	} else if (m == 3) {
		ans.erase(ans.begin() + 5);
		for (; i <= 30000; i++) {
			if (i % 6 == 0) {
				ans.emplace_back(i);
				break;
			}
		}
	} else if (m == 5) {
		ans.erase(ans.begin() + 5);
		for (; i <= 30000; i++) {
			if (i % 6 == 4) {
				ans.emplace_back(i);
				break;
			}
		}
	}
	for (auto &i : ans) {
		cout << i << ' ';
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 512
from sys import stdin
import math

def gcd(a,b):
  if (b == 0):
    return a

  return gcd(b, a % b)


def lcm(a,b):
  return int(a * b / gcd(a, b))

A, B= [int(x) for x in stdin.readline().rstrip().split()]



print(lcm(A,B))

Measured memory_bytes: 3060
#include<stdio.h>
int main()
{
    int n[5],i;
    for(i=1;i<=4;i++)
    scanf("%1d",&n[i]);//%1d就是为了输入方便（害得我用while浪费了一次~）
    if(n[1]==n[2]&&n[2]==n[3])
    {printf("Yes\n");
    return 0;}//只有这两种情况，1=2=3,2=3=4；
    if(n[2]==n[3]&&n[3]==n[4])
    {printf("Yes\n");
    return 0;}
    printf("No\n");//都不是就输出No（记住大写）
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> P3;
typedef pair<P ,P> PP;
constexpr ll MOD = ll(1e9) + 7;
constexpr int IINF = INT_MAX;
constexpr ll LLINF = LLONG_MAX;
constexpr int MAX_N = int(1e5) + 5;
constexpr double EPS = 1e-9;
constexpr int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i > 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()

int w, h, ai, aj, bi, bj;
int d[55][55], memo[55][55][55][55];
bool visited[55][55][55][55];

bool isOK(int i, int j){
    return i>=0 && i<h && j>=0 && j<w && d[i][j]==0;
}

int bfs(){
    for(int i0=0;i0<h;i0++)for(int j0=0;j0<w;j0++){
        for(int i1=0;i1<h;i1++)for(int j1=0;j1<w;j1++){
            memo[i0][j0][i1][j1] = IINF/3;
            visited[i0][j0][i1][j1] = false;
        }
    }
    queue<PP> que;
    que.push({{ai, aj}, {bi, bj}});
    visited[ai][aj][bi][bj] = true;
    memo[ai][aj][bi][bj] = 0;
    while(!que.empty()){
        P p = que.front().first, q = que.front().second;
        que.pop();
        int pi, pj, qi, qj;
        pi = p.first; pj = p.second;
        qi = q.first; qj = q.second;
        if(pi == qi && pj == qj) return memo[pi][pj][qi][qj];
        for(int k=0;k<4;k++){
            int ri = pi + di[k], rj = pj + dj[k];
            int si = qi - di[k], sj = qj - dj[k];
            if(!isOK(ri, rj)) ri = pi, rj = pj;
            if(!isOK(si, sj)) si = qi, sj = qj;
            if(visited[ri][rj][si][sj]) continue;
            visited[ri][rj][si][sj] = true;
            memo[ri][rj][si][sj] = memo[pi][pj][qi][qj] + 1;
            que.push({{ri, rj}, {si, sj}});
        }
    }

    return IINF/3;
}

int main() {
    while(cin >> w >> h, w){
        cin >> aj >> ai >> bj >> bi;
        ai--; aj--; bi--; bj--;
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++) cin >> d[i][j];
        }

        int ans = bfs();
        if(ans < 100) cout << ans << endl;
        else cout << "NA" << endl;
    }
    return 0;
}



Measured memory_bytes: 40744
unittest
{
	assert( [ "3 50", "30 20 10" ].parse.expand.solve == "Possible\n2\n1" );
	assert( [ "2 21", "10 10" ].parse.expand.solve == "Impossible" );
//	assert( [ "5 50", "10 20 30 40 50" ].parse.expand.solve == "Possible\n1\n2\n3\n4" );
	assert( [ "5 50", "10 20 30 40 50" ].parse.expand.solve == "Possible\n1\n4\n3\n2" );
	
	assert( [ "5 50", "10 20 10 30 50" ].parse.expand.solve == "Possible\n1\n2\n3\n4" );		// 追加ケース
	assert( [ "5 50", "10 20 10 30 10" ].parse.expand.solve == "Impossible" );					// 追加ケース
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nl = input.front.split.to!( long[] );
	input.popFront;
	auto as = input.front.split.to!( long[] );
	return tuple( nl[ 1 ], as );
}

auto solve( long l, long[] as )
{
	// 最後に残す結び目を判定
	auto c = -1L;
	for( auto i = 1L; i < as.length; i++ )
	{
		if( as[ i - 1 ] + as[ i ] < l ) continue;
		c = i;
		break;
	}
	if( c < 0 ) return "Impossible";
	
	// 両端から結び目を列挙
	auto anss = new long[ as.length - 1 ];
	auto ansi = 0L;
	for( auto i = 1L; i < c; i++ )
	{
		anss[ ansi ] = i;
		ansi++;
	}
	for( auto i = as.length.signed - 1; c <= i; i-- )
	{
		anss[ ansi ] = i;
		ansi++;
	}
	return "Possible\n" ~ anss.to!( string[] ).join( "\n" );
}


Measured memory_bytes: 12488
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// main.cpp

int main() {
  i64 N;
  std::cin >> N;
  std::vector<i64> a;
  tools::read(a, N);

  i64 next = 1;
  for (const i64& a_i : a) {
    if (a_i == next) {
      ++next;
    }
  }

  std::cout << (next > 1 ? N - (next - 1) : -1) << std::endl;
  return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int H,W;
    cin >> H >> W;
    int count = 0;
    vector<vector<char> > data(H, vector<char>(W));
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> data.at(i).at(j);
            if (data.at(i).at(j) == '#'){
                count++;
            }
        }
    }

    if (count != H + W - 1){
        cout << "Impossible" << endl;
        return 0;
    }
    
    int j = 0;
    int k = 0;
    for (int i = 0; i < H+W-1; i++) {
        if (j == H-1 && k == W-1){
            cout << "Possible" << endl;
            return 0;
        }
        else if (j == H-1){
            if (data.at(j).at(k+1) == '#'){
                k++;
            }
            else {
                cout << "Impossible" << endl;
                return 0;
            }
        }
        else if (k == W-1){
            if (data.at(j+1).at(k) == '#'){
                j++;
            }
            else {
                cout << "Impossible" << endl;
                return 0;
            }
        }
        else {
            if (data.at(j).at(k+1) == '#'){
                k++;
            }
            else if (data.at(j+1).at(k) == '#'){
                j++;
            }
            else {
                cout << "Impossible" << endl;
                return 0;
            }
        }
    }
}




    

Measured memory_bytes: 3596