akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define TRAV(i, n) for(auto &i : n)
#define SZ(x) (int)(x).size()
#define PR std::pair
#define MP std::make_pair
#define X first
#define Y second
typedef long long ll;

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans = 0;
    for (int i = 0; i < n; i++){
        if (s[i] == s[i + 1]){
            s[i] = '0';
        }
    }
    for (int i = 0; i < n; i++){
        if (s[i] != '0') ans++;
    }
    cout << ans;
    return 0;
}


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

#define endl '\n'

using namespace std;

int main(){

  cin.tie(0);     // cout と cin の同期を切る
  ios::sync_with_stdio(false);  /* cの stdioストリーム (printfとか)と*/

  int N,H,W;

  cin>>N>>H>>W;

  cout<<((N-H)+1)*((N-W)+1)<<endl;
  
  return 0;

}


Measured memory_bytes: 256
#include <cstdio>

int main() {
  int v[3];
  for(int i = 0; i < 3; i++)
    scanf("%d", &v[i]);
  if(v[0] == v[1] && v[0] != v[2] || v[1] == v[2] && v[1] != v[0] ||
     v[2] == v[0] && v[2] != v[1])
    printf("Yes\n");
  else
    printf("No\n");
}

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

int main() {
	int N, A[100];
	cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> A[N - i];
	}
	for (int i = 0; i < N; i++) {
		if (i != 0) cout << " ";
		cout << A[i];
	}
	cout << endl;
}


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

typedef long long ll;
typedef long double ld;
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353
#define Graph vector<vector<int>>

int main() {
    string S; cin >> S;
    int ans = 700;
    for (int i = 0; i < 3; i++) {
        if (S.at(i) == 'o') ans += 100;
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 2108
#include<iostream>
#include<string>
#include<stack>/*** LIFO *** stack<type> var;
push(), top():to get data, pop():to remove, size(), empty() ***/
using namespace std;

#define Fp(I, STAT, END) for(int I = STAT; I < END; I++)
#define Fm(I, STAT, END) for(int I = STAT; I > END; I--)

int main(){
    unsigned int L, R;
    cin >> L >> R;
    if(R - L + 1 > 2019){
        cout << 0 << endl;
        return 0;
    }
    int min = 2020, temp;
    //int num[2];
    Fp(i, L, R){
        Fp(j, i + 1, R + 1){
            temp = (i % 2019) * (j % 2019) % 2019; 
            if(temp < min){
                min = temp;
                //num[0] = i;
                //num[1] = j;
            }
        }
    }
    cout << min << endl;
    //cout << num[0] << "," << num[1] << endl;
}

Measured memory_bytes: 256
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextInt4() (int, int, int, int) {
	return nextInt(), nextInt(), nextInt(), nextInt()
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func min(nums ...int) int {
	ret := nums[0]
	for _, v := range nums {
		if v < ret {
			ret = v
		}
	}
	return ret
}

func divFloor(a, b int) int {
	return (a + (b - 1)) / b
}

func cost(n, a, b, c, d int) int {
	dp := map[int]int{}
	dp[0], dp[1] = 0, d
	var rec func(x int) int
	rec = func(x int) int {
		if v, ok := dp[x]; ok {
			return v
		}
		res := 1 << 60
		if x < res/d {
			res = d * x
		}
		res = min(
			res,
			d*(x-(x/2)*2)+a+rec(x/2),
			d*(divFloor(x, 2)*2-x)+a+rec(divFloor(x, 2)),
			d*(x-(x/3)*3)+b+rec(x/3),
			d*(divFloor(x, 3)*3-x)+b+rec(divFloor(x, 3)),
			d*(x-(x/5)*5)+c+rec(x/5),
			d*(divFloor(x, 5)*5-x)+c+rec(divFloor(x, 5)),
		)
		dp[x] = res
		return res
	}
	return rec(n)
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	t := nextInt()

	for i := 0; i < t; i++ {
		n := nextInt()
		a, b, c, d := nextInt4()
		ans := cost(n, a, b, c, d)
		puts(ans)
	}
}


Measured memory_bytes: 6308
t=input()
s1=[]
s2=[]
pond=[]
totalsum=0

for i in range(len(t)):
    if t[i]=="\\" :
        s1.append(i)
    elif t[i]=="/" and len(s1)!=0:
        p1=s1.pop()
        sum=i-p1
        totalsum+=sum
        while len(s2)>0:
            if s2[-1]>p1:
                s2.pop()
                sum+=pond.pop()
            else:
                break
        pond.append(sum)
        s2.append(i)


print(totalsum)
print(len(pond),*pond)




Measured memory_bytes: 6376
#include <iostream>
#include <string>
#include <tuple>
#include <vector>
#include <utility>
#include <algorithm>
#include <cassert>
typedef long long int ll;
using namespace std;
#define cinf(n,x,y,z) for(int i=0;i<(n);i++) cin >> x[i]>>y[i]>>z[i];
pair<ll,int> p[100005];
int main(){
	ll n,x; cin >> n>> x;
	vector<ll> b(n),l(n),u(n);
	cinf(n,b,l,u);
	ll sum=0;
	for(int i=0;i<n;i++){
		p[i]=pair<ll,int>((x-b[i])*u[i]+b[i]*l[i],i);
		sum-=b[i]*l[i];
	}
	sort(p,p+n);
	ll ret=0;
	int last=0;
	for(int i=n-1;i>=0;i--){
		if(sum+p[i].first>=0){
			ret+=(ll) (n-i-1)*(ll)x;
			last=i+1;
			break;
		}
		sum+=p[i].first;
	}
	ll Min=x;
	sum=-sum;
	for(int i=0;i<last;i++){
		int v=p[i].second;
		Min=min(Min,(sum+l[v]-1)/l[v]);
		ll nsum=sum+b[v]*(u[v]-l[v]);
		Min=min(Min,(nsum+u[v]-1)/u[v]);
	}
	for(int i=last;i<n;i++){
		int v=p[i].second;
		ll nsum=sum+p[i].first-p[last-1].first;
		Min=min(Min,(nsum+l[v]-1)/l[v]);
		ll nsum2=nsum+b[v]*(u[v]-l[v]);
		Min=min(Min,(nsum2+u[v]-1)/u[v]);
	}
	cout << ret+Min << endl;
}

Measured memory_bytes: 4096
a,b,c = (int(x) for x in input().split())

res = "No"
if a==b:
    if a!=c:
        res = "Yes"
    else:
        res = "No"
if c==b:
    if a!=c:
        res = "Yes"
    else:
        res = "No"
if a==c:
    if a!=b:
        res = "Yes"
    else:
        res = "No"
        
print(res)

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

#define pfin(a) printf("%d\n",a);
#define pfln(a) printf("%lld\n",a);
#define pfis(a) printf("%d ",a);
#define pfls(a) printf("%lld ",a);
#define sfi(a) scanf("%d",&a);
#define sfl(a) scanf("%lld",&a);
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define f(i,a,b) for(int i=a;i<b;i++)
#define mem(dp,a) memset(dp,a,sizeof(dp));
#define pb(a) push_back(a);
#define mp(a,b) make_pair(a,b)
#define ll long long

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

    int l1=s.length();
    int l2=t.length();

    int dp[l1+1][l2+1];

    f(i,0,l1+1)
        dp[i][0]=0;
    f(i,0,l2+1)
        dp[0][i]=0;

    f(i,1,l1+1)
    {
        f(j,1,l2+1)
        {
            dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            if(s[i-1]==t[j-1])
            {
                dp[i][j]=dp[i-1][j-1]+1;
            }
        }
    }

    vector<char>ans;

    int i=l1,j=l2;

    while(i>0&&j>0)
    {
        if(s[i-1]==t[j-1])
        {
            ans.pb(s[i-1])
            i--;
            j--;
        }
        else
        {
            if(dp[i-1][j]>dp[i][j-1])
                i--;
            else
                j--;
        }
    }

    for(auto itr=ans.rbegin();itr!=ans.rend();itr++)
        cout<<*itr;

    return 0;
}

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

int n,m;

int memo[101][101];
bool chr[101]={};

typedef struct{
  int x;
  int y;
  char co;
}box;

vector<box>v;

box b[202];
int cmp(const void *a,const void *b){
 box s1 = *(box*)a;
 box  s2 = *(box*)b;
  if(s1.x > s2.x)return 1;
  else if (s1.x == s2.x){
    if(s1.y > s2.y)return 1;
    else return -1;
  }
  else return -1;
}
bool asc(const box& l, const box& r){
  if(l.y - r.y >0)return 1;
  else return 0;
}

bool solve(box blue,int num){
  int i =0;
  box com;
  sort(v.begin(),v.end(),asc);

  while(num>i){
    com = v.at(i);
    //  printf("now: %d %d %c& %d %d %c\n",com.x,com.y,com.co,blue.x,blue.y,blue.co);
      if(blue.y > com.y&& blue.x > com.x){
	v.erase(v.begin()+i);
	return 0;
      }
    i++;
  }
  return 1;
}
	
	


int main(){
  int i,j,ans=0,num=0;
  bool fch=0;
  scanf("%d",&n);
  for(i=1;i<=2*n;i++){
    if(i<=n)b[i].co = 'r';
    else b[i].co = 'b';
  }
  for(i=1;i<=2*n;i++)scanf("%d%d",&b[i].x,&b[i].y);

  qsort(&b[1],2*n,sizeof(box),cmp);

  /* for(i=1;i<=2*n;i++){
    printf("%d %d %c\n",b[i].x,b[i].y,b[i].co);
    }*/

  for(i=1;i<=2*n;i++){
    if(b[i].co == 'r'){
      v.push_back(b[i]);
      num++;
    }
    else {
      fch = solve(b[i],num);
      if(fch == 0){
	ans++;
	num--;
      }
      else fch =0;
    }

    //   printf("ans:%d\n",ans);
  }


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


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int n,m;
    cin >> n >> m;
    int a[n][m];
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin >> a[i][j];
        }
    }
    int q[n],w[m];
    for(int i=0;i<n;i++)
        q[i]=0;
    for(int i=0;i<m;i++)
        w[i]=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            q[i]+=a[i][j];
        }
    }
    for(int i=0;i<m;i++){
        for(int j=0;j<n;j++){
            w[i]+=a[j][i];
        }
    }
    int sum=0;
    for(int i=0;i<n;i++){
        sum+=q[i];
    }

     for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cout << a[i][j] << " " ;
        }
        cout << q[i] << endl;
    }
    for(int i=0;i<m;i++)
        cout << w[i] << " ";
    cout << sum << endl;

    return 0;
}



Measured memory_bytes: 3128
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >>s;
  int cnt=0,n=s.size();
  for(int i=0;i<n;i++){
    if(s[i-1]==s[i] && s[i]==s[i+1]){
      cnt++;
      if(s[i]=='0')s[i+1]='1';
      else s[i+1]='0';
    }else if(s[i]==s[i+1]){
      cnt++;
      if(s[i]=='0')s[i+1]='1';
      else s[i+1]='0';
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 3724
def examD():
    N = I()
    AB = [LI() for _ in range(N-1)]
    V = [[] for _ in range(N)]
    for a,b in AB:
        V[a-1].append(b-1)
        V[b-1].append(a-1)
    ans = []
    root = 0
    #親とdfsの順序記録
    parent = [0] * (N)
    order = []
    stack = [root]
    while stack:
        x = stack.pop()
        order.append(x)
        for y in V[x]:
            if y == parent[x]:
                continue
            parent[y] = x
            stack.append(y)
#    print(parent); print(order)
    #辺の色...子の色
    color = [-1]*(N)

    for i in order:
        NG = color[i]
        cur = 1
        for j in V[i]:
            if j == parent[i]:
                continue
            if cur==NG:
                cur +=1
            color[j] = cur
            cur +=1
#    print(color)
    append = ans.append
    for a,b in AB:
        if parent[a-1]==b-1:
            #子の色を塗る
            append(color[a-1])
        else:
            append(color[b-1])
    print(max(ans))
    for v in ans:
        print(v)

def examE():
    N, K = LI()

    return

def examF():
    return

import sys,copy,bisect,itertools,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examD()

Measured memory_bytes: 83036
no = gets.to_i
arr = Array.new(no){
    gets.to_i
}
min = arr[0]
max = -10**9
(no-1).times { |i|
    if max < arr[i+1]-min
        max = arr[i+1]-min
    end

    if arr[i+1] < min
        min = arr[i+1]
    end
}
puts max

Measured memory_bytes: 7668
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <algorithm>
#include <vector>
#include <math.h>
#include <bitset>
#include <cmath>
#include <set>

#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)
#define rep_r(i,s,n)for(int i = n-1;i>=s;i--)
#define rep_re(i,s,n)for(int i = n;i>=s;i--)
using namespace std;
typedef long long ll;
static const ll MOD = 1e9 + 7;
static const ll INF = 1e25;
static const ll MAX_N = 100001;

ll V;
ll d[MAX_N];
struct edge { ll to, cost; };
typedef pair<ll, ll> P;
vector<edge> G[MAX_N];
priority_queue <P, vector<P>, greater<P>> que;
void dijkstra(ll s) {
	fill(d + 1, d + V + 1, INF);
	d[s] = 0;

	que.push(P(0, s));
	while (!que.empty()) {
		P p = que.top(); que.pop();
		ll v = p.second;
		if (d[v] < p.first)continue;
		rep(i, 0, G[v].size()) {
			edge e = G[v][i];
			if (d[e.to] > d[v] + e.cost) {
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}
}
ll root;
ll parent[MAX_N];
ll depth[MAX_N];

void dfs(ll v, ll p, ll d) {
	parent[v] = p;
	depth[v] = d;
	for (int i = 0; i < G[v].size(); i++) {
		if (G[v][i].to != p) dfs(G[v][i].to, v, d + 1);
	}
}
int lca(int u, int v) {
	while (depth[u] > depth[v])u = parent[u];
	while (depth[v] > depth[u])v = parent[v];
	while (u != v) {
		v = parent[v];
		u = parent[u];
	}
	return u;
}
int main() {
	cin >> V;
	rep(i, 1, V) {
		ll s, t, d; cin >> s >> t >> d;
		G[s].push_back(*(new edge{ t,d }));
		G[t].push_back(*(new edge{ s,d }));
	}

	//dfs(1, -1, 0);
	dijkstra(1);

	repe(i, 1, V) {
		//ll w = lca(1, i);
		ll distance = d[1] + d[i];// -2 * d[w];

		cout << ((distance & 1) ? 1 : 0) << endl;
	}

	return 0;
}

Measured memory_bytes: 14976
from collections import Counter
from collections import deque
from functools import reduce
from operator import mul
from pprint import pprint
import bisect
import copy
import fractions
import itertools
import math
import queue
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))
def COMBINATION(n, r):
    if n < 0 or r < 0 or n < r:
        return 0
    r = min(n-r, r)
    if r == 0:
        return 1
    o = reduce(mul, range(n, n - r, -1))
    u = reduce(mul, range(1, r + 1))
    return o // u
class UnionFind():

    def __init__(self, n):
        self.n = n
        self.node = [i for i in range(n)]
        self.size = [1 for _ in range(n)]

    def same(self, x, y):
        return bool(self.root(x) == self.root(y))

    def root(self, x):
        if self.node[x] == x:
            return x
        else:
            self.node[x] = self.root(self.node[x])  # 経路圧縮
            return self.node[x]

    def unite(self, x, y):
        x, y = self.root(x), self.root(y)
        if x == y:
            return  # 結合不要
        if self.size[x] < self.size[y]:
            x, y = y, x
        self.node[y] = x
        self.size[x] += self.size[y]

    def return_size(self, x):
        return self.size[self.root(x)]


s = [IS(), IS(), IS()]
flag = [0, 0, 0]
turn = 0
while flag[turn] < len(s[turn]):
    now = turn
    if s[turn][flag[turn]] == 'a':
        turn = 0
    elif s[turn][flag[turn]] == 'b':
        turn = 1
    else:
        turn = 2
    flag[now] += 1

if turn == 0:
    print('A')
elif turn == 1:
    print('B')
else:
    print('C')

Measured memory_bytes: 68332
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <algorithm>
#include <climits>
using namespace std;
typedef long long int ll;
#define all(x) x.begin(),x.end()
int main()
{
  int n;
  ll ans=0;
  cin >> n;
  n++;
  vector<ll> Ints(n);
  for (int i = 0; i < n; ++i) {
    Ints[i] = i;
  }
  vector<ll> Factors(n);
  for (int i = 0; i < n; ++i) {
    Factors[i] = 1;
  }

  for (int i = 2; i < n; ++i) {
    if (Ints[i] == 1){
      continue;
      }
    for (int j = 1; j < n; ++j) {
      if (i*j < n) {
        ll t = 1;
        while (Ints[i*j]%i == 0) {
          Ints[i*j] = Ints[i*j]/i;
          t += 1;
        }
        Factors[i*j] = Factors[i*j]*t;
      }
      else{
        break;
      }
    }
  }
  // for (int i = 0; i < n; ++i) {
  //   cout << "F" <<i << Factors[i] << "\n";
  // }

  for (int i = 1; i < n; ++i) {
    ans = ans + i*Factors[i];
  }
  cout << ans << "\n";

  return 0;
}


Measured memory_bytes: 159536
#include<bits/stdc++.h>
using namespace std;
long long x[100010],y[100010];
#define int long long 
signed main(){
    int n,k,q;
    cin>>n>>k>>q;
    for(int i=1; i<=q; i++){
        cin>>x[i];
        y[x[i]]++;
    }
    for(int i=1; i<=n; i++){
        if(y[i]>=(q-k)+1){
            cout<<"Yes"<<'\n';
        }else{
            cout<<"No"<<'\n';
        }
    }
}

Measured memory_bytes: 2176
#include<iostream>
#include<iomanip>

using namespace std;

double r[2], pre = 0, ans = 0;

int main(){
	cin >> r[0] >> r[1];

	pre = 1 / r[0] + 1 / r[1];
	ans = 1 / pre;

	cout << setprecision(12) << ans << "\n";

	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		boolean plus = sc.next().equals("+");
		long b = sc.nextLong();
		System.out.println(plus ? a + b : a - b);
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
	int n;
	ll	d;
	ll dj;
	int ans=0;
	ll dis;
	cin >> n >> d;
	dj = d * d;
	// n行2列の行列
	vector<vector<ll>> coor(n, vector<ll>(2));
	rep(i, n) {
		rep(j, 2) {
			cin >> coor.at(i).at(j);
		}
	}
	// 原点からの距離計算
	rep(i, n) {
		dis = coor.at(i).at(0)* coor.at(i).at(0) + coor.at(i).at(1) * coor.at(i).at(1);
		if (dj >= dis) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
	string s;
	cin >> s;
	if(s[0] == 'Y' && s[1] == 'A'&& s[2] == 'K' && s[3] == 'I'){
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
const int man=1e5+5;
const int mod=1000000007;
int vis[man]={0};
int dp[man]={0};
int main(void)
{
    int n,m;
    scanf("%d %d",&n,&m);
    for(int i=0;i<m;i++)
    {
        int a;
        scanf("%d",&a);
        vis[a]=1;
    }
    dp[0]=1;
    dp[1]=1;
    for(int i=2;i<=n;i++)
    {
        if(!vis[i-1])
        {
            dp[i]+=dp[i-1];
            dp[i]%=mod;
        }
        if(!vis[i-2])
        {
            dp[i]+=dp[i-2];
            dp[i]%=mod;
        }
    }
    cout<<dp[n]<<endl;
    return 0;
}


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

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
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;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}

template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];

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

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

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

int main() {
    int A, B;
    cin >> A >> B;

    cout << max(max(A+B,A-B),A*B) << endl;

    return 0;
}


Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d%d", $N, $K);
$A = array_map("intval", explode(" ", trim(fgets(STDIN))));
$F = array_map("intval", explode(" ", trim(fgets(STDIN))));
rsort($A);
sort($F);

$ng = -1;
$ok = 10**12;
while($ok > $ng+1){
    $mid = floor(($ok+$ng)/2);
    if(isOK($mid)){
        $ok = $mid;
    }else{
        $ng = $mid;
    }
}
echo $ok;

function isOK($t){
    global $A, $F, $N, $K;
    $needed = 0;
    for($i = 0; $i < $N; ++$i){
        $needed += max(0,$A[$i] - intdiv($t, $F[$i]));
    }
    return $needed <= $K;
}

Measured memory_bytes: 37360
n, m = list(map(int, input().split()))
h_list = list(map(int, input().split()))

ab_list = []
is_good_observatory = [True for _ in range(n)]
for i in range(m):
    a, b = list(map(int, input().split()))

    if h_list[a-1] >= h_list[b-1]:
        is_good_observatory[b-1] = False
    if h_list[a-1] <= h_list[b-1]:
        is_good_observatory[a-1] = False

print(is_good_observatory.count(True))

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

int main()
{
  // 入力受け取り
  int N;
  cin >> N;
  int L[N];
  for (int i = 0; i<N; i++) cin >> L[i];
  sort(L,L+N);

  int ans =0;
  for (int i = 0; i < N-2; i++) {
    for (int j = i+1; j < N-1; j++) {
        int upper = L[i] + L[j];
        int lower = abs(L[i] - L[j]);
        for (int k = j+1; k < N; k++) {
            if (L[k] >= upper) break;
            if (L[k] > lower) ans++;
        }
    }
  }

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


Measured memory_bytes: 256
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <locale>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
#include <map>

using namespace std;

int solve(int nmin, int nmax, vector<int> &score){
    vector<int> gp;
    for(int i = nmin-1; i < nmax; i++){
       gp.push_back(score[i] - score[i+1]);
    }
    int maxGp = gp[0];
    int index = 0;
    for(int i =1; i < gp.size(); i++){
        // cout<< gp[i] <<endl;
        if(maxGp <= gp[i] ){
            maxGp = gp[i];
            index = i;
        }
    }
    // cout<<index<<endl;
    return nmin + index;
}

int main(){
    int M,nmin,nmax;
    vector<int>ans;
    while(1){
        cin>>M>>nmin>>nmax;
        if(!M && !nmin && !nmax)break;
        vector<int> P;
        for(int i=0;i<M;i++){
            int keep;cin>>keep;
            P.push_back(keep);
        }
       ans.push_back(solve(nmin, nmax, P));
    }

    for(int i: ans)cout<<i<<endl;
}


Measured memory_bytes: 3136
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E12;//10^12
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
const double EPS=1E-8;
////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false);cin.tie(0);
    
    int n;cin>>n;
    i_i a[100005];rep(i,0,100004)a[i]=i_i(0,i);
    i_i b[100005];rep(i,0,100004)b[i]=i_i(0,i);
    rep(i,0,n-1){
        int k;cin>>k;
        if(i%2==0){
            a[k].first++;
        }else{
            b[k].first++;
        }
    }
    sort(a,a+100004);
    sort(b,b+100004);
    reverse(a,a+100004);
    reverse(b,b+100004);
    int ans;
    if(a[0].second!=b[0].second)ans=a[0].first+b[0].first;
    else ans=max(a[0].first+b[1].first,a[1].first+b[0].first);
    cout<<n-ans<<endl;
    
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a=0,b,c,d,e=0,f;
  cin >>a>>b;
  a--,b--;
  cout <<a*b<<'\n';
  return(0);
}


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

typedef long long ll;
const int MAXN = 200100;

int N, M;
pair <int, int> arr[MAXN];
set <int> rem;
vector <int> v[MAXN];

multiset <int> rr;

void gogo (int x)
{
    if (rem.lower_bound(x) == rem.end()) return;
    rem.erase(rem.lower_bound(x));
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin >> N >> M;
    for (int i = 0; i < N; i++)
    {
        cin >> arr[i].first >> arr[i].second;
        v[arr[i].first].push_back(arr[i].second);
    }

    for (int i = 1; i <= M; i++)
    {
        rem.insert(i);
    }
    for (int i = 0; i <= M; i++)
    {
        for (int j : v[i])
        {
            rr.insert(j);
        }
        while ((int) rr.size() > i)
        {
            auto it = rr.begin();
            int x = *it;
            gogo (x);
            rr.erase(it);
        }
    }

    int ans = 0;
    for (int i = M; i >= 0; i--)
    {
        if ((int) rr.size() > i)
        {
            auto it = rr.begin();
            int x = *it;
            gogo (x);
            rr.erase(it);
        }

        ans = max (ans, (int) rr.size() + min (M - i, M - (int) rem.size()));
    }
    cout << N - ans << "\n";
  
    return 0;
}

Measured memory_bytes: 26100
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
 
public class Hello{
    public static void Main(){
//        string[] input = ReadLine().Split(' ');
//        int n = int.Parse(input[0]);
//        int m = int.Parse(input[1]);
//        int a = int.Parse(input[2]);
//        int b = int.Parse(input[3]);*/
//        string temp = ReadLine();
        int a = int.Parse(ReadLine());
//        int b = int.Parse(ReadLine());
//        int c = int.Parse(ReadLine());
//        int d = int.Parse(ReadLine());
//        string a = ReadLine();
//        string b = ReadLine();
//        string c = ReadLine();
        if(a<1200){
            WriteLine("ABC");
        }else if(a<2800){
            WriteLine("ARC");
        }else{
            WriteLine("AGC");
        }
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;

typedef long long ll;

int N; vector<ll> L;
void input()
{
    cin >> N;
    L.resize(N);
    for(int i=0; i<N; ++i) cin >> L[i];
}

void solve()
{
    sort(L.begin(),L.end());
    int ans = 0;
    for(int i=0; i<N; ++i){
        for(int j=i+1; j<N; ++j){
            for(int k=j+1; k<N; ++k){
                if(L[i] < L[j] && L[j] < L[k] && L[i] + L[j] > L[k]) ++ans;
            }
        }
    }
    cout << ans << endl;
}

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

Measured memory_bytes: 3700
#include<bits/stdc++.h>
using namespace std;
inline int_fast64_t read(){int_fast64_t x=0,f=1;char c=getchar();while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return x*f;}
void Main(){
    int ans, p1, p2;
    p1 = p2 = 0;
    vector<int> V;
    char c = getchar();
    while(c != '0' && c != '1'){
        c = getchar();
    }
    while(c == '0' || c == '1'){
        V.push_back(c-'0');
        c = getchar();
    }
    for(int i = 0;i<V.end()-V.begin();i++) {
        if (V[i] == i%2) p1++;
        else p2++;
    }
    ans = min(p1, p2);
    printf("%d\n", ans);
}
int main(){cin.tie(nullptr);ios::sync_with_stdio(false);Main();return 0;}

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

vector<int> inv(vector<int> A){
    int N = A.size();
    vector<int> ret(N);
    for(int i=0; i<N; i++) ret[A[i]] = i;
    return ret;
}

vector<int> mul(vector<int> A, vector<int> B){
    int N = A.size();
    vector<int> ret(N);
    for(int i=0; i<N; i++) ret[i] = A[B[i]];
    return ret;
}

int main(){
    int N, K;
    cin >> N >> K;
    K--;
    vector<int> P(N), Q(N);
    for(int i=0; i<N; i++){
        cin >> P[i];
        P[i]--;
    }
    for(int i=0; i<N; i++){
        cin >> Q[i];
        Q[i]--;
    }
    auto PI = inv(P);
    auto QI = inv(Q);

    auto X = mul(Q, mul(PI, mul(QI, P)));
    int q = K/6, r = K%6;
    vector<int> A(N);
    for(int i=0; i<N; i++) A[i] = i;
    while(q > 0){
        if(q%2){
            A = mul(A, X);
        }
        q /= 2;
        X = mul(X, X);
    }
    if(r >= 3) A = mul(A, Q);
    if(r >= 4) A = mul(A, PI);

    vector<int> B;
    if(r == 0) B = P;
    if(r == 1) B = Q;
    if(r == 2) B = mul(Q, PI);
    if(r == 3) B = PI;
    if(r == 4) B = QI;
    if(r == 5) B = mul(QI, P);

    vector<int> ans = mul(A, mul(B, inv(A)));
    for(int i=0; i<N; i++) cout << ans[i]+1 << " \n"[i==N-1]; 
    return 0;
}


Measured memory_bytes: 5852
//大文字->小文字 tolower(),逆はtoupper()
//int a = stoi(c); 文字列をintへ
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//等価なものに変換する思考
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//配列はvector<>を使う：意味わからないエラーがなくなる。
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//nC2の計算
ll C(ll N) {
	return N * (N - 1) / 2;
}

//円周率
const double PI = 3.14159265358979323846;

int main() {
	ll H, W; cin >> H >> W;
	char s[H + 2][W + 2];
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			cin >> s[i][j];
		}
	}

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

	int cnt[H + 2][W + 2] = {};
	for(int  i= 0; i < H+2;i++){
		for (int j = 0; j < W + 2; j++) cnt[i][j] = 0;
	}

	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			if (s[i][j] == '#')continue;
			for (int k = 0; k < 8; k++) {
				if (s[i + dx[k]][j + dy[k]] == '#') {
					cnt[i][j]++;
				}
			}
		}
	}

	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
				if (s[i][j] == '#') {
					cout << '#';
				}
				else cout << cnt[i][j];
		}
		cout << endl;
	}
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	private static int cnt;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		boolean checkTime = false;
		long stime = 0;

		int n = sc.nextInt();

		if (checkTime) {
			stime = System.currentTimeMillis();
			System.out.println("Time: " + (System.currentTimeMillis() - stime));
		}

		int[] data = new int[n];
		
    	for (int i = 0; i < n; i++) {
    		data[i] = sc.nextInt();
    	}
    	
		if (checkTime) {
			System.out.println("Time: " + (System.currentTimeMillis() - stime));
		}
    	// Shell Sort
    	cnt = 0;
    	int[] g;

//    	int m = (n - 1) / 3 + 1;
//    	if (m > 100) {
//    		m = 100;
//    	}
//    	g = new int[m];
//    	for (int i = m - 1; i >= 0; i --) {
//    		g[i] = 3 * i + 1;
//    	}
    	
    	int m = (int)Math.pow(n, 1.25);
    	if (m > 100) {
    		m = 100;
    	}
		g = new int[m];
		int ii = 0;
		g[ii] = 1;
		for (ii = 1; ii < m; ii++) {
			int next = g[ii - 1] * 3 + 1;
			if (next > n) {
				break;
			}
			g[ii] = next;
		}
		m = ii;
    	
    	for (int i = 0; i < m; i++) {
    		insertionSort(data, n, g[m - 1 - i]);
    	}

		if (checkTime) {
			System.out.println("Time: " + (System.currentTimeMillis() - stime));
		}

		// m
    	System.out.println(m);
    	// g
		StringBuffer printData = new StringBuffer();
		for (int i = 0; i < m; i++) {
			printData.append(g[m - 1 - i]);
			printData.append(" ");
		}
		printData.delete(printData.length() - 1, printData.length());
		System.out.println(printData);
    	// cnt
    	System.out.println(cnt);

		if (checkTime) {
			System.out.println("Time: " + (System.currentTimeMillis() - stime));
		}

    	// data
    	StringBuffer output = new StringBuffer();
		String cr = System.getProperty("line.separator");
		for (int i = 0; i < data.length; ) {
			for (int j = 0; j < 1000 && i < data.length; j++) {
				output.append(data[i]);
				output.append(cr);
				i++;
			}
	    	System.out.print(output);
	    	output.setLength(0);
		}

    	sc.close();

    	if (checkTime) {
			System.out.println("Time: " + (System.currentTimeMillis() - stime));
		}
	}
	
	private static void insertionSort(int[] data, int n, int g) {
		for (int i = g; i < n; i++) {
			int v = data[i];
			int j = i - g;
			int tmp;
//			for (; j >= 0 && data[j] > v;) {
//			    data[j + g] = data[j];
			for (; j >= 0 && (tmp = data[j]) > v;) {
				data[j + g] = tmp;
				j -= g;
				cnt++;
			}
			data[j + g] = v;
		}
		return;
	}
}

Measured memory_bytes: 296972
#include <cstdio>
#include <cmath>
#include <complex>
#include <iostream>

#define REP(i,n) for(int i=0; i<(int)(n); i++)

using namespace std;

typedef complex<double> P;

const double PI = 3.1415926535;
P pos[40];
int n, m;
int fst;

double memo[41][41];

inline double outp(const P &a, const P &b){
  return (conj(a)*b).imag();
}

double solve(int p, int rest){
  if(p == n) return 0.0;
  if(rest == 0) return 0.0;
  if(memo[p][rest] > -1.0)
    return memo[p][rest];
  double ret = 0.0;

  for(int i = p + 1; i < n; i++){
    double tmp = 0.0;

    if(rest != m - 1){
      P p1 = pos[fst];
      P p2 = pos[p];
      P p3 = pos[i];
      tmp += std::abs(outp(p2 - p1, p3 - p1) / 2.0);
      // printf("tmp: %f\n", tmp);
    }

    ret = max(ret, tmp + solve(i, rest - 1));
  }

  // printf("%d %d %d: %f\n", fst, p, rest, ret);
  return memo[p][rest] = ret;
}

int main(){
  while(scanf("%d%d", &n, &m), n + m){
    REP(i,n){
      double ang;
      scanf("%lf", &ang);
      pos[i] = P(cos(2 * PI * ang), sin(2 * PI * ang));
      // cout << "pos[" << i << "]=" << pos[i] << endl;
    }

    double ans = 0.0;
    REP(i,n){
      REP(j,n) REP(k,m) memo[j][k] = -2.0;
      fst = i;
      ans = max(ans, solve(i, m - 1));
    }

    printf("%.6f\n", ans);
  }
  return 0;
}

Measured memory_bytes: 952
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    ll a, b, k;
    cin >> a >> b >> k;
    if (k <= a) {
        cout << a - k << " " << b << endl;
    } else if (k <= b + a) {
        cout << 0 << " " << b - (k - a) << endl;
    } else {
        cout << 0 << " " << 0 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
# B - Bingo

import numpy as np

A = np.zeros((3,3), dtype=np.int64)

for i in range(3):
    A[i] = [int(x) for x in input().split()]

N = int(input())

for _ in range(N):
    b = int(input())
    A = np.where(A==b, 0, A)

if sum(A[0])==0 or sum(A[1])==0 or sum(A[2])==0 or \
    sum(A[:,0])==0 or sum(A[:,1])==0 or sum(A[:,2])==0 or \
    A[0,0]+A[1,1]+A[2,2]==0 or \
    A[2,0]+A[1,1]+A[0,2]==0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 21720
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll gcd(ll a,ll b)
{
    return b==0 ? a : gcd(b,a%b);
}
int main()
{
     ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll k=0;
    ll sum=0;
    cin>>k;
    for(int i=1;i<=k;i++)
        for(int j=1;j<=k;j++)
           for(int e=1;e<=k;e++)
           {
              ll a= gcd(i,j);
              sum+=gcd(a,e);
           }
           cout<<sum<<"\n";
    return 0;
}



Measured memory_bytes: 3660
#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 a, b;
  cin >> a >> b;
  for (int x = 1; x <= 100000; ++x) {
    int c = x * 0.08;
    int d = x * 0.10;
    if (c == a && d == b) {
      cout << x << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}

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

#define INF 1 << 29
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)

using namespace std;

typedef pair<int,int> pii;
typedef long long int ll;

void gen_sosuu(int sosuu[]){
  REP(i,100010){
    sosuu[i] = true;
  }
  sosuu[0] = false;
  sosuu[1] = false;
  sosuu[2] = true;
  FOR(i,2,sqrt(100000)+1){
    if(sosuu[i] == false) continue;
    for(int j = 2; i*j<=100000;j++){
      //printf("%d %d %d\n",i*j,i,j);
      sosuu[i*j] =false;
    }
  }
}

int x,y;
set<int> s;
set<int> s2;
int main(){
  scanf("%d %d",&x,&y);
  s.insert(4);
  s.insert(6);
  s.insert(9);
  s.insert(11);
  if(x==2&&y==2){
    printf("Yes\n");
    return 0;
  }
  if(s.find(x)!=s.end()&&s.find(y)!=s.end()){
    printf("Yes\n");
    return 0;
  }
  FOR(i,1,13){
    if(s.find(i)!=s.end()) continue;
    if(i==2) continue;
    s2.insert(i);
  }
  if(s2.find(x)!=s2.end()&&s2.find(y)!=s2.end()){
    printf("Yes\n");
    return 0;
  }
  printf("No\n");
}


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

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

	vector<vector<int>> problem(N, vector<int>(2, 0));
	rep(i, M) {
		int p;
		string S;
		cin >> p >> S;
		if (problem[p - 1][0] != 1) {
			if (S == "AC") {
				problem[p - 1][0] = 1;
			}
			else {
				problem[p - 1][1]++;
			}
		}
	}

	int ac = 0;
	int pe = 0;
	rep(i, N) {
		if (problem[i][0]) {
			ac += problem[i][0];
			pe += problem[i][1];
		}
	}

	cout << ac << " " << pe << endl;
}

Measured memory_bytes: 5760
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/

#include <cstdio>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
#include <iomanip>
#include <set>
#include <stack>
#include <bitset>
/*
多倍長整数, cpp_intで宣言
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
*/

//#pragma gcc target ("avx2")
//#pragma gcc optimization ("o3")
//#pragma gcc optimization ("unroll-loops")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printim(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a) //少数出力
#define printLdb(a) printf("%.50Lf\n", a) //少数出力
#define printdbd(a) printf("%.16lf\n", a) //少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str()) //string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2LL) //等差数列の和、初項,末項,項数
#define pb push_back
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0L)*2.0L*PI)
#define rad_to_deg(rad) (((rad)/2.0L/PI)*360.0L)
#define Please return
#define AC 0
#define manhattan_dist(a, b, c, d) (abs(a - c) + abs(b - d)) /*(a, b) から (c, d) のマンハッタン距離 */
#define inf numeric_limits<double>::infinity();
#define linf numeric_limits<long double>::infinity()


using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
constexpr long double eps = 1e-9;
const long double PI = acosl(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);
	while (c != '\n' && c != -1 && c != ' ') {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

ll LSB(ll n) { return (n & (-n)); }

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	long double a, b, h, m, rad;
	scanf("%Lf%Lf%Lf%Lf", &a, &b, &h, &m);
	rad = abs(2.0 * PI * (((h + m / 60.0) / 12.0) - (m / 60.0)));
	if (rad >= PI)rad = 2.0 * PI - rad;
	printLdb(sqrtl(powl(a, 2) + powl(b, 2) - 2 * a * b * cos(rad)));

	Please AC;
}


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

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

    // vector<long long> A(N);
    // vector<long long> B(N);
    vector<pair<long long, long long>> items(N);
    long long A, B;
    for (int i = 0; i < N; i++)
    {
        // cin >> A[i] >> B[i];
        cin >> A >> B;
        items[i] = make_pair(B, A);
    }
    sort(items.begin(), items.end());
    long long sum = 0;
    for (int i = 0; i < N; i++)
    {
        sum += items[i].second;
        if (sum > items[i].first)
        {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define int long long
#define inf 1000000007
#define LINF 1000000000000000007LL
#define ll long long
using namespace std;
signed main(){
	int n;
	cin>>n;
	vector< pair<int,int> > jobs;
	for(int i=0;i<n;i++){
		int a,b;
		cin>>a>>b;
		jobs.pb( mp(b,a) );
	}
	sort( jobs.begin(), jobs.end() );
	int su = 0;
	for(int i=0;i<n;i++){
		su += jobs[i].second;
		if( su > jobs[i].first ){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 6384
#include<stdio.h>
int main()
{
	int n,r;
	while(1){
		scanf("%d",&n);
		if(n==-1){
			break;
		}else if(n<10){
			r=1150;
		}else if(n<20){
			r=1150+125*(n-10);
		}else if(n<30){
			r=2400+140*(n-20);
		}else{
			r=3800+160*(n-30);
		}
		printf("%d\n",4280-r);
	}
	return 0;
}

Measured memory_bytes: 2556
using System;//外
using System.Linq;//Linq
public class ABC{

    public static void Main(){
        var line = Console.ReadLine();
        var l = line.Split(' ').Select(s => int.Parse(s)).ToArray();//Select,λ型
        int a = l[0];
        int b = l[1];
        if ( b > a ){
          var t = a;
          a =  b;
          b =  t;
        }
        if ((a-b)%2==1){//%の定義がa-(a/b)*b
            Console.WriteLine("IMPOSSIBLE");
        }
        else{
            Console.WriteLine((a+b)/2);
        }
    }
}


Measured memory_bytes: 13396
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
#include <random>

using namespace std;
typedef long long LL;
typedef pair<int,int> P;

const int L=1e5+1;
int N;
vector<int> ed[L];
int es[L];
int ls[L];
int hs[L];
int vs[L];
#if 0
bool f(int i, int p, int l,int h,int e){
	if(vs[i]!=-1){
		l=max(l,vs[i]);
		h=min(h,vs[i]);
		if(vs[i]%2){
			vs[i]|=1;
		}
		else{
			vs[i]|=2;
		}
	}
	for(int c:ed[i]){
		if(c!=p){
			if(h<l||e==3){
				return false;
			}
			if(!f(c,i,l-1,h+1,e*2+e/2)){
				return false;
			}
			l=max(l,ls[c]-1);
			h=min(h,hs[c]+1);
			if(es[c]==1){
				e|=2;
			}
			else if(es[c]==2){
				e|=1;
			}
		}
	}
	if(e==1){
		if(l%2==0){
			l++;
		}
		if(h%2==0){
			h--;
		}
	}
	else if(e==2){
		if(l%2){
			l++;
		}
		if(h%2){
			h--;
		}
	}
	if(h<l||e==3){
		return false;
	}
	es[i]=e;
	ls[i]=l;
	hs[i]=h;
	return true;
}
#else
bool f(int i,int p){
	int e=0;
	int l=-1e8;
	int h=1e8;
	for(int c:ed[i]){
		if(c==p)continue;
		if(!f(c,i)){
			return false;
		}
		if(es[c]==0){
			continue;
		}
		if(es[c]==1){
			e|=2;
		}
		else
		{
			e|=1;
		}
		l=max(l,ls[c]-1);
		h=min(h,hs[c]+1);
	}
	if(vs[i]!=-1){
		l=max(l,vs[i]);
		h=min(h,vs[i]);
		if(vs[i]%2==0){
			e|=2;
		}
		else{
			e|=1;
		}
	}
	if(h<l||e==3){
		return false;
	}
	es[i]=e;
	ls[i]=l;
	hs[i]=h;
	return true;
}
#endif
void g(int i,int p,int v){
	vs[i]=v;
	for(int c:ed[i]){
		if(c==p)continue;
		if(vs[c]!=-1){
			//assert(abs(vs[c]-v)==1);
			g(c,i,vs[c]);
		}
		else if(ls[c]<=v-1){
			g(c,i,v-1);
		}
		else{
			g(c,i,v+1);
		}
	}
}
int main() {
	cin >> N;
	for(int i=0;i<N-1;i++){
		int a,b;
		cin >> a >> b;
		ed[a].push_back(b);
		ed[b].push_back(a);
	}
	for(int i=1;i<=N;i++){
		vs[i]=-1;
	}
	int K;
	cin >> K;
	for(int i=0;i<K;i++){
		int v,p;
		cin >> v >> p;
		vs[v]=p;
	}
	if(!f(1, 0)){
		cout << "No" << endl;
		return 0;
	}
	//cerr << es[1] << ", " << ls[1] << ", " << hs[1] << endl;
	cout << "Yes" << endl;
	g(1,0,ls[1]);
	for(int i=1;i<=N;i++){
		cout << vs[i] << endl;
	}


	return 0;
}



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

int main() {
	pair<string,int>a,b;
	string u;
	cin>>a.first>>b.first>>a.second>>b.second>>u;
	if(u==a.first){
		cout<<a.second-1<<" "<<b.second<<endl;
	}else{
		cout<<a.second<<" "<<b.second-1<<endl;
	}
}


Measured memory_bytes: 256