akhauriyash/Code-Regression huggingface dataset:
#!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify

import itertools, bisect
import math, fractions
import sys, copy

def L(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline().rstrip())
def S(): return list(sys.stdin.readline().rstrip())
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return [list(x) for x in sys.stdin.readline().split()]
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def LIR1(n): return [LI1() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
def LR(n): return [L() for _ in range(n)]

def perm(n, r): return math.factorial(n) // math.factorial(r)
def comb(n, r): return math.factorial(n) // (math.factorial(r) * math.factorial(n-r))

alphabets = "abcdefghijklmnopqrstuvwxyz"
ALPHABETS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

sys.setrecursionlimit(1000000)
dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
MOD = 1000000007
INF = float("inf")

class Eratosthenes:
    # https://cp-algorithms.com/algebra/prime-sieve-linear.html
    def __init__(self, n):
        primes = []
        lp = [0] * (n + 1)

        for i in range(2, n + 1):
            if lp[i] == 0:
                primes.append(i)
                lp[i] = i

            for pj in primes:
                if pj > lp[i] or i * pj > n:
                    break
                lp[i * pj] = pj
        self.primes = primes
        self.lp = lp

    def is_prime(self, x):
        return self.lp[x] == x

    def factrization(self, x):
        ret = []
        while x > 1:
            ret.append(self.lp[x])
            x //= self.lp[x]
        return ret

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

    era = Eratosthenes(K)
    count = [0] * (K + 1)

    for i in range(1, K + 1):
        count[i] = pow((K // i), N, MOD)

    for i in range(1, K + 1)[::-1]:
        divs = era.factrization(i)
        candedates = [l for l in set(reduce(lambda x, y:x * y, ll, 1) for r in range(1, len(divs) + 1) for ll in itertools.combinations(divs, r))]
        for v in candedates:
            count[i // v] -= count[i]

    ans = 0
    for i in range(1, K + 1):
        ans = (ans + i * count[i]) % MOD
    print(ans % MOD)

if __name__ == '__main__':
    main()

Measured memory_bytes: 115916
#!/usr/bin/env python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


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


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


def solve():
    A = int(input())
    B = int(input())
    for i in range(1, 4):
        if i != A and i != B:
            print(i)
            break


def main():
    solve()


if __name__ == '__main__':
    main()


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

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> votes(N);

    int sum = 0;
    for(int i = 0; i < N; i++){
        cin >> votes.at(i);
        sum += votes.at(i);
    }

    int available = 0;
    double target = 1/(4*(double)M);
    for(int i = 0; i < N; i++){
        double rate = (double)votes.at(i)/(double)sum;
        if((double)votes.at(i)/(double)sum >= target){
            available++;
        }
    }

    if(M <= available){
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<cstdio>
#include<vector>
#include<stack>
using namespace std;
typedef pair<int,int> P;

int nextPos();

int n;
vector<int>vec[105];
stack<int>st;
map<int,P>mp;

int main(){
  //ios_base::sync_with_stdio(false);
  int a,m,c;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> a >> m;
    for(int j=0;j<m;j++){
      cin >> c;
      vec[a].push_back(c);
    }
  }

  int count = 1;
  while(1){
    int next = nextPos();
    if(next == 0) break;
    st.push(next);
    mp[next].first = count;
    count++;
    while(!st.empty()){

      bool flag=false;
      for(int i=0;i<vec[next].size();i++){
	int temp = vec[next][i];
	if(mp[temp].first == 0){
	  st.push(temp);
	  next = temp;
	  mp[temp].first = count;
	  count++;
	  flag = true;
	  break;
	}
      }

      if(!flag){ //いくところが無かったら
	mp[next].second = count;
	count++;
	st.pop();

	while(!st.empty()){
	  int point = st.top();
	  
	  flag = false;
	  for(int i=0;i<vec[point].size();i++){
	    int temp2 = vec[point][i];
	    if(mp[temp2].first == 0){
	      next = temp2;
	      st.push(next);
	      mp[next].first = count;
	      count++;
	      flag = true;
	      break;
	    }
	  }

	  if(flag) break;
	  else{
	    st.pop();
	    mp[point].second = count;
	    count++;
	  }
	}
      }
    }
  }

  for(int i=1;i<=n;i++){
    cout << i << " " << mp[i].first << " " << mp[i].second << endl;
  }

  return 0;
}

int nextPos(){
  int a=0;

  for(int i=1;i<=n;i++){
    if(mp[i].first == 0){
      a = i;
      break;
    }
  }

  return(a);
}

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

int main()
{
	int N;
	cin >> N;
	bool ans = false;

	for (int i = 0; i <= N / 4; ++i) {
		for (int j = 0; j <= N / 7; ++j) {
			int total = 4*i + 7*j;
			if (total == N) ans = true;
		}
	}
	if (!ans) cout << "No" << endl;
	else cout << "Yes" << endl;
}


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

int main() {
  int n,m;
  cin>>n>>m;
  ll a[n+1],b[n+1],c[m+1],d[m+1];
  for(int i=1;i<=n;i++) cin>>a[i]>>b[i];
  for(int i=1;i<=m;i++) cin>>c[i]>>d[i];
  for(int i=1;i<=n;i++){
    int ans,temp=-1;
    for(int j=1;j<=m;j++){
      int dis=abs(a[i]-c[j])+abs(b[i]-d[j]);
      if(temp<0 || dis<temp){
        temp=dis;
        ans=j;
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cmath>
#define pb push_back
#define ld long double
#define mp make_pair
#define vl vector<ll> 
#define vd vector<double>
#define vld vector<long double>
#define ll long long int
#define pl pair<ll, ll>
#define all(a) a.begin(), a.end()
#define forr(i, n) for(ll i=0; i<n; i++) 
#define forr1(i, n) for(ll i=1; i<=n; i++)
using namespace std;
const ld PI =3.1415926535897923846;
const ll MOD = 1000000007;
const ll N=998244353;
ll power(ll x,ll n){ll res=1;while(n>0){if(n&1) res=res*x%MOD;x=x*x%MOD;n>>=1;}return res;}
ll modinverse(ll a){return power(a, MOD-2);}
void solve()
{
    double d, t, s;
    cin>>d>>t>>s;
    if(d/t<=s)
    	cout<<"Yes\n";
    else
    	cout<<"No\n";
}
int main()
{
	#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll test=1;
    //cin>>test;
    while(test--)
    {
        solve();
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 3804
fun main(args: Array<String>) {
    val list = (1..3).map { readLine()!! }
    val n = list[0].toInt()
    val s = list[1]
    val k = list[2].toInt()
    val c = list[1][k - 1]

    val result = s.map { if (it != c) "*" else it }.joinToString("")
    print(result)
}

Measured memory_bytes: 33736
N,M=map(int,input().split())
s=[list(map(int,input().split()))[1:] for m in range(M)]
p=list(map(int,input().split()))
count=0
for i in range(1<<N):
    for m in range(M):
        switch=0
        for j in range(N):
            if (i>>j)&1 and j+1 in s[m]:
                switch+=1
        if switch%2!=p[m]:
            break
    else:
        count+=1
print(count)

Measured memory_bytes: 40560
#include<cstdio>
#include<algorithm>
using namespace std;
int f[100001][2];
int main(){
  int n,a,p[2],maxf[2][2]={};
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%d",&a);
    f[a][i%2]++;
  }
  for(int i=1;i<=100000;i++){
    if(f[i][0]>maxf[0][0]){
      maxf[0][0]=f[i][0];
      p[0]=i;
    }
    if(f[i][1]>maxf[0][1]){
      maxf[0][1]=f[i][1];
      p[1]=i;
    }
  }
  for(int i=1;i<=100000;i++){
    if(f[i][0]>maxf[1][0]&&p[0]!=i){
      maxf[1][0]=f[i][0];
    }
    if(f[i][1]>maxf[1][1]&&p[1]!=i){
      maxf[1][1]=f[i][1];
    }
  }
  if(p[0]!=p[1])
    printf("%d\n",n-maxf[0][0]-maxf[0][1]);
  else
    printf("%d\n",n-max(maxf[0][0]+maxf[1][1],maxf[1][0]+maxf[0][1]));
}

Measured memory_bytes: 896
N, M, V, P = map(int, input().split())
A = list(map(int, input().split()))
A = list(reversed(sorted(A)))

def ok(x):
    if x + M < A[P-1]:
        return False
    sc = M * V
    for a in A[:P-1]:
        sc = sc - M
    for a in A[P-1:]:
        sc = sc - min(M, x + M - a)
    return sc <= 0

l, r = -1, N
while r - l > 1:
    m = l + (r - l) // 2
    if not ok(A[m]):
        r = m
    else:
        l = m
print(r)

Measured memory_bytes: 73368
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
struct UnionFind {vector<int> par; // uf(x,y)->y
    UnionFind(int NV) { par.clear(); rep(i, 0, NV) par.push_back(i); }
    void reset() { rep(i, 0, par.size()) par[i] = i; }
    int operator[](int x) { return par[x] == x ? x : par[x] = operator[](par[x]); }
    void operator()(int x, int y) {x = operator[](x); y = operator[](y);if (x != y) par[x] = y;}};
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/






int N, M, P[101010];
vector<int> idx[101010];
int f[101010];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> M;
    rep(i, 0, N) {
        cin >> P[i];
        P[i]--;
    }

    UnionFind uf(N);
    rep(i, 0, M) {
        int a, b; cin >> a >> b;
        a--; b--;
        uf(a, b);
    }

    rep(i, 0, N) idx[uf[i]].push_back(i);

    int ans = 0;
    rep(i, 0, N) {
        fore(j, idx[i]) f[j] = 1;
        fore(j, idx[i]) if (f[P[j]]) ans++;
        fore(j, idx[i]) f[j] = 0;
    }
    cout << ans << endl;
}

Measured memory_bytes: 6904
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main() {
	ll n, x;
	cin >> n >> x;
	vector<ll> v;
	rep(i, 0, n) {
		ll a;
		cin >> a;
		v.pb(a);
	}
	ll ans = 0;
	if (v[0] > x) {
		ans += v[0] - x;
		ans += v[1];
		v[0] = x;
		v[1] = 0;
	}
	else {
		if (v[0] + v[1] > x) {
			ans += v[0] + v[1] - x;
			v[1] -= v[0] + v[1] - x;
		}
	}
	rep(i, 2, v.sz) {
		if (v[i - 1] + v[i] > x) {
			ans += v[i] + v[i-1] - x;
			v[i] -= v[i] + v[i-1] - x;
		}
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 1400
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input():
    return sys.stdin.readline().rstrip()

def main():
    N,X=map(int,input().split())
    
    memo=[(0,0)]*N
    memo[0]=(1,1)
    for i in range(N-1):
        memo[i+1]=(memo[i][0]*2+3,memo[i][1]*2+1)
    def saiki(n,x):
        if n==0:
            return 1 if x>0 else 0
        if memo[n-1][0]+2<x:
            return memo[n-1][1]+saiki(n-1,x-(memo[n-1][0]+2))+1
        elif memo[n-1][0]+2==x:
            return memo[n-1][1]+1
        else:
            return saiki(n-1,x-1)
    print(saiki(N,X))
        

if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
use std::io::*;
use std::str::*;
use std::collections::*;

pub fn read_from<T: FromStr, R: Read>(s: &mut R) -> T {
    let s = s.bytes().map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    if !s.is_empty() {
        if let Ok(s) = s.parse::<T>() {
            s
        } else {
            panic!("faild to parse {}", s);
        }
    } else {
        if cfg!(local) {
            // eprintln!("reached to EOF");
        }
        std::process::exit(0)
    }
}

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let mut stdin = stdin.lock();
    read_from(&mut stdin)
}

fn main() {
    loop {
        let n = read();
        let words: Vec<Vec<char>> = (0..n).map(|_| {
            let s: String = read();
            s.chars().collect()
        }).collect();
        let ok1 = words[..].windows(2).all(|w2| {
            let a = &w2[0];
            let b = &w2[1];
            a.last().unwrap() == b.first().unwrap()
        });
        let ok2 = words.iter().collect::<BTreeSet<_>>().len() == n;
        println!("{}", if ok1 && ok2 { "Yes" } else { "No" });
        break;
    }
}


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

int main(){
  int n;
  cin >> n;
  bool ans = true;
  for(int i=0; i<n; ++i){
    int x;
    cin >> x;
    if( x%2 == 1) continue;
    else{
      if( x%3 != 0 && x%5 != 0) ans = false;
    }
  }
  if(ans == true) cout << "APPROVED" << endl;
  else cout << "DENIED" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <float.h>
#include <math.h>
int main(void)
  
{
  int a,b,h,m;
  double n,x;
  scanf("%d", &a);
  scanf("%d", &b);
  scanf("%d", &h);
  scanf("%d", &m);

  x = sqrt(a * a + b * b - 2 * a * b * cos((h * 60 + m) * 5.5 * M_PI / 180));
  printf("%.20f", x);
return 0;
}

Measured memory_bytes: 2604
/*
URL: http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_1_A&lang=jp
 */
#include <iostream>
#include <vector>
#include <unordered_set>
#include <cassert>
using namespace std;

class DisjointSet{
private:
  vector<int> P;
  vector< unordered_set<int> > Set;
public:
  DisjointSet(int n);
  void unite(int x, int y);
  bool same(int x, int y);
};

DisjointSet::DisjointSet(int n) : P(n), Set(n){
  for(int i=0;i<n;++i){
    P[i] = i;
    Set[i].insert(i);
  }
}

void DisjointSet::unite(int x, int y){
  if(P[x] == P[y])
    return;
  int big, small;
  if(Set[P[x]].size() >= Set[P[y]].size()){
    big = P[x];
    small = P[y];
  }
  else{
    big = P[y];
    small = P[x];
  }
  for(auto i=Set[small].begin();i!=Set[small].end();++i){
    P[*i] = big;
    Set[big].insert(*i);
  }
}

bool DisjointSet::same(int x, int y){
  return P[x] == P[y];
}

int main(){
  int n, q;
  cin >> n >> q;
  DisjointSet S(n);
  int command, X, Y;
  for(int i=0;i<q;++i){
    cin >> command >> X >> Y;
    if(!command)
      S.unite(X, Y);
    else{
      if(S.same(X, Y))
	cout << 1 << endl;
      else
	cout << 0 << endl;
    }
  }
}



Measured memory_bytes: 4936
#include <cstdio>
const int N = 200005;
using LL = __int128; 
LL s[N], ans; int a[N], n, x;
LL E(int a, LL x) { return a == 1 ? x * 5 : (a * 2 + 1) * x; }
void put(LL val) { if (val > 9) put(val / 10); putchar(val % 10 + 48); }
int main() {
	std::scanf("%d%d", &n, &x);
	for (int i = 1; i <= n; i++) std::scanf("%d", &a[i]), s[i] = s[i - 1] + a[i];
	for (int i = 1; i <= n; i++) {
		LL sum = static_cast<LL> (i) * x;
		for (int j = i; j <= n; j += i) sum += E(j / i, s[n - j + i] - s[n - j]);
		sum += E(n / i + 1, s[n % i]);
		if (i == 1 || ans > sum) ans = sum;
	}
	put(ans + static_cast<LL> (n) * x);
	return 0;
}

Measured memory_bytes: 4096
R,G,B,N=map(int,input().split())
cnt=0
for r in range(0,N//R+1):
    for g in range(0,(N-r*R)//G+1):
        bunshi=N-r*R-g*G
        q,m=divmod(bunshi,B)
        if q<0:continue
        if m==0:cnt+=1   
print(cnt)

Measured memory_bytes: 40812
use proconio::input;
use nalgebra::max;

#[proconio::fastout]
fn main() {
    input! {
        a: i128,
        b: i128
    }

    let a_count = count(a - 1);
    let b_count = count(b);
    let mut result = 0;
    for i in 0..64 {
        if (b_count[i] - a_count[i]) % 2 == 1 {
            result |= 1i128 << i as i128;
        }
    }
    println!("{}", result)
}

fn count(a: i128) -> [i128; 64] {
    let mut count: [i128; 64] = [0i128; 64];
    let mut divisor = 2i128;
    for i in 0..63 {
        count[i] = (a / divisor) * (divisor / 2);
        count[i] += max((a % divisor) - (divisor / 2 - 1), 0);
        divisor <<= 1;
    }
    return count;
}


Measured memory_bytes: 2140
#include <iostream>
#include <sstream>
#include <bitset>
using namespace std;

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

    X /= 50;

    int count = 0;

    for(int i = 0; i < A + 1; i++)
    {
        for(int j = 0; j < B + 1; j++)
        {
            for(int k = 0; k < C + 1; k++)
            {
                if(X - (10 * i + 2 * j + k) == 0)
                {
                    count++;
                }
            }
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.lang.*;

public class Main{
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		double a = sc.nextDouble();
		double b = sc.nextDouble();
		double x = sc.nextDouble();
		if (x >= a * a * b / 2) {
			System.out.println(Math.toDegrees(Math.atan((b - (2 * x / (a * a) - b))/ a)));
		} else {
			System.out.println(Math.toDegrees(Math.atan(b / (2 * x / (b * a)))));
		}
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	private int readByte() {
		if (hasNextByte()) {
			return buffer[ptr++];
		} else {
			return -1;
		}
	}
	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}
	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
		return hasNextByte();
	}
	public String next() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	public long nextLong() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || Integer.MAX_VALUE < nl) {
			throw new NumberFormatException();
		}
		return (int) nl;
	}
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 22484
def actual(N, S, M, T):
    points = [S.count(word) - T.count(word) for word in set(S)]

    return max(0, max(points))

N = int(input())
S = [input() for _ in range(N)]

M = int(input())
T = [input() for _ in range(M)]

print(actual(N, S, M, T))


Measured memory_bytes: 9148
#include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
#include<map>
#include<string>
#include<algorithm>
#include<functional>
#define ll long long
#define inf  1999999999
#define pa pair<int,int>
using namespace std;



int main(){
//cout<<"1"<<endl;
string s,t;
cin>>s>>t;
int ls=s.length(),lt=t.length();
//cout<<ls<<endl;
//cout<<s<<endl;


int dp[1010][1010];
for(int i=0;i<=max(ls,lt);i++){
dp[i][0]=i;
dp[0][i]=i;
}

for(int i=1;i<=ls;i++){
for(int j=1;j<=lt;j++){
if(s[i-1]==t[j-1]) dp[i][j]=min(min(dp[i-1][j]+1,dp[i][j-1]+1),dp[i-1][j-1]);
else dp[i][j]=min(min(dp[i-1][j]+1,dp[i][j-1]+1),dp[i-1][j-1]+1);
//cout<<dp[i][j]<<endl;
}
}
cout<<dp[ls][lt]<<endl;



return 0;
}

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

using namespace std;
#define MOD 1000000007
#define pi 3.1415926535897932384626433832795028841971693993751058209749445923078164062
const int INF = 1e9;
#define ll long long
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define ub upper_bound
#define lb lower_bound
#define popb pop_back()
#define popf pop_front()
#define ff first
#define ss second
#define vl vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vll vector< pair<ll,ll> >
#define vii vector< pair<int,int> >
#define viii vector< tuple <int,int,int> >
#define vlll vector< tuple <ll,ll,ll> >
#define vvl vector<vector<ll>>
#define vv vector<vector<int>>
#define all(v) v.begin(),v.end()
#define sqrt sqrtl
#define cbrt cbrtl
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mapcl map<char,ll>
#define mapci map<char,int>
#define mapll map<ll,ll>
#define mapii map<int,int>
#define seti set<int>
ifstream fin("input.txt");
ofstream fout("output.txt");
#define FOR(i, l, r) for (int i = int(l); i < int(r); ++i)
#define print(a)       for(auto x : a) cout << x << " "; cout << "\n"
#define print1(a)      for(auto x : a) cout << x.ff << " " << x.ss << "\n"
#define print2(a,x,y)  for(int i = x; i < y; i++) cout<< a[i]<< " "; cout << "\n"


ll fast_exp(ll base, ll exp) {ll res=1;while(exp>0) {if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return res%MOD;}
int gcd(int a,int b){while (a&&b)a>b?a%=b:b%=a;return a+b;}
int val(char c){if (c >= '0' && c <= '9')return (int)c - '0';else return (int)c - 'A' + 10;}
ll pows(int a , int b){ll res=1;for(int i=0; i<b; ++i){res*=a;}return res;}
ll logx(ll base, ll num){int cnt=0;while(num!=1){num/=base; ++cnt;}return cnt;}
ll divisibles(ll a, ll b, ll m){if(a%m==0)return (b/m)-(a/m)+1;else return (b/m)-(a/m);}// in [a,b]
string bitstring(int n, int size){string s;while(n){s+=(n%2)+'0';n/=2;}while(s.size()<size){s+='0';}reverse(all(s));return s;}
// dsu start

vi root(200001,0);
vi size(200001,1);
int find(int x){while(x!=root[x])x = root[x];return x;}
bool same(int a,int b){return find(a)==find(b);}
void unite(int a, int b){a = find(a);b = find(b);if(size[a]<size[b])swap(a,b);size[a] += size[b];root[b] = a;}

// dsu end
vi vis(200001,0);
vi adj[200001];

int main()
{	
    std::ios::sync_with_stdio(false);
    //string bitstring = std::bitset< 3 >( 7 ).to_string(); <bits> (num)
    //srand(time(0));
    //cin.tie(NULL);
    //cout.tie(NULL);
 	string s;
 	cin>>s;
 	int a = -1;
 	int b = -1;
 	for(int i=0; i<s.size();  ++i)
 	{
 		if(s[i]=='A')
 		{
 			a = i;
 			break;
 		}
 	}   
 	for(int i=s.size()-1; i>=0; --i)
 	{
 		if(s[i]=='Z')
 		{
 			b = i;
 			break;
 		}
 	}
 	cout<<b-a+1<<"\n";
}

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

int main() {
  int n, m, X, Y; cin >> n >> m >> X >> Y;
  int x, y;
  for(int i = 0; i < n; i++) {
    cin >> x;
    X = max(x, X);
  }
  for(int i = 0; i < m; i++) {
    cin >> y;
    Y = min(y, Y);
  }
  cout << (X < Y ? "No War" : "War") << endl;
}


Measured memory_bytes: 256
N = int(input())

for n in range(1,3501):
    for h in range(1,3501):
        if 4*h*n-N*(n+h) > 0:
            if (N*h*n)%(4*h*n-N*(n+h)) == 0:
                w = (N*h*n)//(4*h*n-N*(n+h))
                print(h,n,w)
                exit(0)

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

using namespace std;

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

vector<string> b3 = {
  "aab",
  "c.b",
  "cdd",
};

vector<string> b4 = {
  "aabd",
  "ccbd",
  "efgg",
  "efhh",
};

vector<string> b5 = {
  "aab.c",
  "f.b.c",
  "fiijj",
  "ghdd.",
  "gh.ee",
};

vector<string> b6 = {
  "aab...",
  "c.b...",
  "cdd...",
  "...aab",
  "...c.b",
  "...cdd",
};

vector<string> b7 = {
  "aabbcc.",
  "dde...c",
  "f.e...c",
  "fgg...b",
  "...ddeb",
  "...f.ea",
  "...fgga",
};

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<string> mp(n);
  string s;
  for (int i = 0; i < n; i++) s.push_back('.');
  for (int i = 0; i < n; i++) mp[i] = s;
  if (n % 3 == 0) {
    for (int i = 0; i < n; i += 3)
      for (int j = 0; j < n; j += 3) {
        mp[i][j] = mp[i][j + 1] = 'a';
        mp[i][j + 2] = mp[i + 1][j + 2] = 'b';
        mp[i + 1][j] = mp[i + 2][j] = 'c';
        mp[i + 2][j + 1] = mp[i + 2][j + 2] = 'd';
      }
    for (int i = 0; i < n; i++) cout << mp[i] << endl;
  } else if (n <= 2) {
    cout << -1 << endl;
  } else if (n == 5) {
    for (int i = 0; i < n; i++) {
      cout << b5[i] << endl;
    }
  } else if (n == 7) {
    for (int i = 0; i < n; i++) {
      cout << b7[i] << endl;
    }
  } else {
    int m = n;
    int oi = 0, oj = 0;
    while (m > 0) {
      if (m % 4 == 3) {
        for (int i = 0; i < 7; i++) {
          for (int j = 0; j < 7; j++) {
            mp[oi + i][oj + j] = b7[i][j];
          }
        }
        oi += 7;
        oj += 7;
        m -= 7;
      } else if (m % 4 == 2 || m % 4 == 1) {
        for (int i = 0; i < 5; i++) {
          for (int j = 0; j < 5; j++) {
            mp[oi + i][oj + j] = b5[i][j];
          }
        }
        oi += 5;
        oj += 5;
        m -= 5;
      } else {
        for (int i = 0; i < 4; i++) {
          for (int j = 0; j < 4; j++) {
            mp[oi + i][oj + j] = b4[i][j];
          }
        }
        oi += 4;
        oj += 4;
        m -= 4;
      }
    }
    for (int i = 0; i < n; i++) cout << mp[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

ll d;
vector<vl> s;
vl c(26);
vector<set<ll>> st(26, {-1});
ll score;

void add(ll i, ll k) {  // i日目(0-index)、テストk（0-index）
  st[k].insert(i);
  auto pi = st[k].lower_bound(i);
  pi--;
  ll prev, next;
  if(pi == st[k].begin())
    prev = -1;
  else
    prev = *pi;
  auto ni = st[k].upper_bound(i);
  if(ni == st[k].end())
    next = d;
  else
    next = *ni;
  score += c[k] * (i - prev) * (next - i) + s[i][k];
}

void rm(ll i, ll k) {
  auto pi = st[k].lower_bound(i);
  pi--;
  ll prev, next;
  if(pi == st[k].begin())
    prev = -1;
  else
    prev = *pi;
  auto ni = st[k].upper_bound(i);
  if(ni == st[k].end())
    next = d;
  else
    next = *ni;
  score -= c[k] * (i - prev) * (next - i) + s[i][k];
  st[k].erase(i);
}

void eval(vl &t) {
  rep(i, d) {
    ll k = t[i];
    add(i, k);
  }
}

int main() {
  double limit = double(clock()) / double(CLOCKS_PER_SEC) + 1.95;
  // 入力をもらう
  cin >> d;
  rep(i, 26) cin >> c[i];
  s.resize(d, vl(26));
  rep(i, d) rep(j, 26) cin >> s[i][j];

  //// 入力を作るデバッグ用
  // d = 365;
  // s.resize(d, vl(26));
  // rep(i, 26) c[i] = rand() % 101;
  // rep(i, d) rep(j, 26) s[i][j] = rand() % 20001;

  // 初期解をランダムに作って評価、scoreに反映
  score = -accumulate(all(c), 0LL) * d * (d + 1) / 2;
  vl t(d);
  rep(i, d) t[i] = max_element(all(s[i])) - s[i].begin();
  eval(t);

  while(double(clock()) / double(CLOCKS_PER_SEC) < limit) {
    ll xd = rand() % d;
    ll xt = rand() % 26;
    ll old_score = score;
    ll old_test = t[xd];
    if(xt == t[xd]) xt = (xt + 1) % 26;
    rm(xd, t[xd]);
    add(xd, xt);
    if(score < old_score) {
      rm(xd, xt);
      add(xd, old_test);
    } else
      t[xd] = xt;
  }
  rep(i, d) cout << t[i] + 1 << '\n';
}

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

static const int groups[]{
	0,
	1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1

};

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

	if (groups[a] == groups[b]) {
		std::cout << "Yes" << std::endl;
	}
	else {
		std::cout << "No" << std::endl;
	}

	return 0;
}



Measured memory_bytes: 256
N = gets.to_i
C = Array.new(101, 0)
gets.split.map(&:to_i).each do |x|
  C[x] += 1
end

ans = (1 .. 100).map do |y| 
  (1 .. 100).inject(0) do |s, x| 
    s + C[x] * (y - x) ** 2 
  end
end.min
puts ans


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

// ----------- define --------------
#define int long long
#define ii pair<int,int>
#define fi first
#define sc second
#define all(x) (x).begin(),(x).end()
// ---------------------------------

void MAIN() {
  int n; cin >> n;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] += a[i - 1];
  }
  int ans = 2e9;
  for (int i = 1; i < n; i++) {
    ans = min(ans, abs(a[n] - a[i] * 2));
  }
  cout << ans << '\n';
}

signed main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}


Measured memory_bytes: 4792
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    int n;
    cin >> n;
    vector<int> l(n);
    rep(i, n) cin >> l[i];
    sort(all(l));
    int ans = 0;
    rep(i, n) Rep(j, i + 1, n - 1)
    {
        int a = l[i], b = l[j];
        int x = b - a, y = a + b;
        int L = j + 1, R = n;
        if (x < l[L])
            R = L;
        while (R - L > 1)
        {
            int m = (R + L) / 2;
            if (x < l[m])
                R = m;
            else
                L = m;
        }
        if (l[R] <= x)
            continue;
        int p = R;
        L = j + 1, R = n;
        while (R - L > 1)
        {
            int m = (R + L) / 2;
            if (l[m] < y)
                L = m;
            else
                R = m;
        }
        int q = L;
        // cout << L << endl;
        // continue;
        if (l[L] >= y)
            continue;
        ans += (q - p + 1);
    }
    cout << ans << endl;
}

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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'
#define rep(i,n) for(int_fast32_t i = 0; i < ((int_fast32_t)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int_fast32_t i = 1; i <= ((int_fast32_t)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int_fast32_t i = ((int_fast32_t)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int_fast32_t i = ((int_fast32_t)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

using namespace std;

template<typename T>
using vec = vector<T>;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using ll = long long;
using ld = long double;
using vi = vec<int_fast32_t>;
using vl = vec<int_fast64_t>;
using vld = vec<ld>;
using vii = vec<vi>;  // 2次元配列
using PII = pair<int_fast32_t, int_fast32_t>;

template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<class T,class U> inline bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U> inline bool chmin(T &a, const U &b){if(a>b){a=b;return 1;}return 0;}

const ld Pi = std::acos(-1.0L);
constexpr ll infll = (1LL<<62)-1;
constexpr int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    int START_TIME = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
//    cout << fixed << setprecision(15);

    string s,t;
    ld n,m;
    cin >> n >> m;

    cout << i64(n*m) << '\n';


    // printf("ExecutionTime: %d /ms\n",1000*(int)((clock()-START_TIME)/CLOCKS_PER_SEC));
}


Measured memory_bytes: 3848
//written by libra9z
#include <algorithm>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <cmath>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define repit(it,a) for (__typeof(a.begin()) it=a.begin();it!=a.end();++it)
#define ITR(...) __VA_ARGS__::iterator
#define all(a) (a).begin(),(a).end()
#define reunique(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define sz(a) (int)a.size()
#define MP(...) make_pair(__VA_ARGS__)
#define X first
#define Y second
#define sqr(x) ((x)*(x))
#define fill_inf(a) memset(a,-19999873,sizeof(a))
#define fill_neginf(a) memset(a,-19999872,sizeof(a))
#define fill_0(a) memset(a,0,sizeof(a))
#define fill_neg1(a) memset(a,-1,sizeof(a))
#define pow_of_2(a) (1<<(a))
#define is_pow_of_2(a) (((a-1)&a)==0)
#define printtime cerr<<"\n\nTime elasped : "<<clock()*1.0/1000<<" seconds.\n\n"
using ll=long long;
const int inf=1e9;
const ll lnf=1e18;
const int mod=1e9+7;
int a,b,c;
long long k;
int main()
{
	ios_base::sync_with_stdio(0);cin.tie();cout.tie();
	cout<<setprecision(15);
	cin>>a>>b>>c>>k;
	cout<<(a-b)*(-1+2*((k+1)%2))<<endl;
	return 0;
}

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

#include <iostream>
#include<cstdio>

using namespace std;

int main()
{
    int n, k;

    cin >> n >> k;

    double sum = 0;
    double kaku = (double)1 / n;

    for (int i = 0; i < n; i++) {
        double kake = 1;
        int cnt = 0;
        int me = i + 1;
        while (me < k) {

            kake *= 0.500;
            cnt++;

            me *= 2;
        }

        sum += kaku * kake;
    }

    printf("%.10f", sum);

    return 0;
}



Measured memory_bytes: 3696
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
#N = int(input())
#S = str(input())
N, K = map(int, input().split())
d = [0 for _ in range(10**5+1)]
for _ in range(N) :
  a, b = map(int, input().split())
  d[a] += b

s = 0
for i in range(len(d)) :
  s += d[i]
  if s >= K :
    print (i)
    exit()



Measured memory_bytes: 6384
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef int ll;
typedef long double ld;
const ll N = 100005;
char en = '\n';
ll inf = 1e16;
ll mod = 1000000007;
ll power(ll x, ll n, ll mod) {
  ll res = 1;
  x %= mod;
  while (n) {
    if (n & 1)
      res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}

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

  ll r;
  cin >> r;
  cout << (3 * r * r) << en;

  return 0;
}

Measured memory_bytes: 256
/*
START BY THE NAME OF ALMIGHTY ALLAH
THIS WONT BE ACCEPTED
STOP_GIVING_UP
*/
#include<bits/stdc++.h>
#define l(i,a,n)for(int i=a;i<n;i++)
#define PB push_back
#define IN insert
#define MP make_pair
#define LW(v) sort(v.begin(),v.end());
#define HI(v) sort(v.begin(),v.end(),greater<long long>());
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long t,r=1,r1=0,r2=0,k=0,a,b,c=1,m,d=0,n,e,f,x=0,g,p=0,q=0,y=0,z=0;
    vector<long long>v;
    vector<long long>u;
    set<long long>s;
    std::vector<int>::iterator it;
    string  s1,s2,s3,s4;
    cin>>n;
cout<<pow(n,3)<<endl;
}

Measured memory_bytes: 512
import java.util.*;
import java.util.Map.Entry;
 
 
 class Main {
	 static int mod =  (int) (Math.pow(10,9)+7);
	 static List<ArrayList<Integer>>  list = new ArrayList<ArrayList<Integer>>();
    public static void main(String[] args) {
    
        Scanner sc = new Scanner(System.in);
    	int S = sc.nextInt();
    	int W = sc.nextInt();
    	if(S>W) {
    		System.out.println("safe");
    	} else {
    		System.out.println("unsafe");
    	}
    	 
    	
    	
    	
    	
        		
    }
}

Measured memory_bytes: 35848
#include <iostream>
#define MAX 110

using namespace std;

int n,m;
char cr;
bool a[MAX][MAX],l[MAX],c[MAX];

int main()
{
    cin>>n>>m;
    for(int i=1;i<=n;i++)
      for(int j=1;j<=m;j++){
        cin>>cr;
        if(cr!='.')a[i][j]=1;
        if(a[i][j])
          l[i]=c[j]=1;
      }
    for(int i=1;i<=n;i++){
      for(int j=1;j<=m;j++)
        if(l[i]&&c[j])
          cout<<((a[i][j])?'#':'.');
      if(l[i])
        cout<<'\n';
    }
    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();
	   
	    
	    long m = 1;
	   
	    int count_4 =0;
	    int count_2=0;
	    int count_odd=0;
	    for (int i = 0; i<N; i++){
	    	m=sc.nextLong();
	    	if (m%4==0){
	    		count_4++;
	    	}
	    	else if (m%2==0){
	    		count_2++;
	    	}
	    	else 
	    		count_odd++;
	    }
	    sc.close();
	    
	    
	    if (count_odd==0)
	    	System.out.println("Yes");
	    
	    else if (count_2==0){
	    	if (count_4+1>=count_odd)
	    		System.out.println("Yes");
	    	else
	    		System.out.println("No");
	    }
	    else if (count_2!=0){
	    	if (count_4>=count_odd)
	    		System.out.println("Yes");
	    	else
	    		System.out.println("No");
	    }

	    else
	    	System.out.println("No");
	}

}


Measured memory_bytes: 45492
#include<stdio.h>
#define N 10000
#define Q 500
int linearSearch(int);

int s[N],n;

int main(){
  int t,q[Q],count=0;;
  int i;

  scanf("%d",&n);
  for(i=0;i<n;i++) {
    scanf("%d",&s[i]);
  }
  scanf("%d",&t);
  for(i=0;i<t;i++){
    scanf("%d",&q[i]);
    if(linearSearch(q[i])==1){
      count++;
    }
  }
     printf("%d\n",count);
  return 0;
}

int linearSearch(int key){
  int i; 
  for(i=0;i<n;i++){
     if(s[i]==key) return 1;
  }
  return 0;
}

Measured memory_bytes: 636
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <numeric>
#include <unordered_map>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <memory>
#include <iomanip>
#include <type_traits>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
constexpr long long MOD = 1e9 + 7;
constexpr long long MAX = 1000000;

//long long MOD = 998244353;
constexpr ll INF = 1e17;
constexpr double PI = 3.141592653589793;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

bool isInField(int x, int y, int h, int w) {
    bool f = x >= 0 && x < w && y >= 0 && y < h;
    return f;
}

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

    ll n, m;
    cin >> n >> m;

    vector<ll> p(m);
    vector<string> s(m);

    vector<bool> isAC(n, false);
    ll acNum = 0;
    vector<ll> penaltyNums(n, 0);

    for (ll i = 0; i < m; i++)
    {
        cin >> p[i];
        p[i]--;
        cin >> s[i];
    }

    for (ll i = 0; i < m; i++)
    {
        if (s[i] == "WA" && !isAC[p[i]]) {
            penaltyNums[p[i]]++;
        }
        if (s[i] == "AC" && !isAC[p[i]]) {
            acNum++;
            isAC[p[i]] = true;
        }
    }

    ll penaltyNum = 0;
    for (ll i = 0; i < n; i++)
    {
        if (isAC[i]) {
            penaltyNum += penaltyNums[i];
        }
    }
    cout << acNum << " " << penaltyNum << "\n";
    return 0;
}



Measured memory_bytes: 7296
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((int)(x).size())
#define MSG(a) cout << #a << " " << a << endl;

int main()
{
    int N;
    cin >> N;
    double sum_reciprocal = 0.0;
    for (int i = 0; i < N; i++)
    {
        double num;
        cin >> num;
        sum_reciprocal += 1 / num;
    }
    cout << 1 / sum_reciprocal << endl;

    return 0;
}


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

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

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

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL INF = 1e9;
const LL MOD = 1e9+7;

//other
//-------------------------------------------
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define FI first
#define SE second

//memo
// setprecision()

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  
  if((b-a)==(c-b)) cout << "YES" << endl;
  else cout << "NO" << endl;
  
  return 0;
}

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    rep(i, n-1) {
        if (s[i] != s[i+1]) ++ans;
    }
    ++ans;
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main()
{
  int k,x;
  cin>>k>>x;
  int j=x-k+1;
  int s=0;
  if(j<-1000000) {j=-1000000;
        s=-1000000-j;
                 }
  for(int i=0;i<(2*k-1-s);i++)
  {
    if(j+i>1000000) return 0;
    cout<<j+i<<" ";
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, e) for (ll (i) = (s); (i) < (e); ++(i))
#define per(i, s, e) for (ll (i) = (s); (i) >= (e); --(i))
#define all(x) x.begin(),x.end()
 
int main(void) {
  ll n; cin >> n;
  vector<ll> a(n);
  rep(i, 0, n) {
    cin >> a[i];
  }

  sort(all(a));
  rep(i, 0, n-1) {
    if(a[i] == a[i+1]) {
        cout << "NO" << endl;
        return 0;
    }
  }
  cout << "YES" << endl;


}


Measured memory_bytes: 1792
N = int(input())
C0 = "AC"
C1 = "WA"
C2 = "TLE"
C3 = "RE"
list = []
for i in range(N):
    string = input()
    list.append(string)
print(f"{C0} x {list.count(C0)}")
print(f"{C1} x {list.count(C1)}")
print(f"{C2} x {list.count(C2)}")
print(f"{C3} x {list.count(C3)}")


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

int main(void){
    int a, b;
    cin >> a >> b;
    int ans[3];
    for(int i = 1; i <= 3; i++){
        if(i != a && i != b)
        cout << i << endl;
    }
    return 0;
}

Measured memory_bytes: 256
def main():
  X = int(input())
  max = X // 100
  two = X - max * 100
  count = 0
  for i in range(5 ,0, -1):
    count += two // i
    two %= i
  print(0) if count > max else print(1)


if __name__ == '__main__':
  main()


Measured memory_bytes: 2940
#include<stdio.h>
#define MAX 100000
int A[MAX],n;
int partition(int p,int r){
  int x,i,j,t;
  x=A[r];
  i=p-1;
  for(j=p;j<r;j++){
    if(A[j]<=x){
      i++;
      t=A[i];
      A[i]=A[j];
      A[j]=t;
    }
  }
  t=A[i+1];
  A[i+1]=A[r];
  A[r]=t;
  return i+1;
}

int main(){
  int i,q;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  q=partition(0,n-1);
  for(i=0;i<n;i++){
    if(i)printf(" ");
    if(i==q)printf("[");
    printf("%d",A[i]);
    if(i==q)printf("]");
  }
  printf("\n");

  return 0;
}



Measured memory_bytes: 2088