akhauriyash/Code-Regression huggingface dataset:
package main

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

const (
	maxBufSize = 1024 * 1024
)

var (
	sc = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, 1)
		sc.Buffer(buf, maxBufSize)
		sc.Split(bufio.ScanWords)
		return sc
	}()
	out = bufio.NewWriter(os.Stdout)
)

func solve(n int64) int64 {
	if n < 2 {
		return 0
	}
	if n % 2 == 1 {
		return 0
	}
	n /= 2
	ret := int64(0)
	for ;n >= 5; {
		ret += n / 5
		n /= 5
	}
	return ret
}

func main() {
	defer out.Flush()

	n := nextInt()
	res := solve(n)
	fmt.Fprintln(out, res)
}

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

func nextStringAsBytes() []byte {
	sc.Scan()
	return []byte(sc.Text())
}

func nextInt() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

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

func nextFloats(n int64) []float64 {
	ret := make([]float64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextFloat()
	}
	return ret
}
func nextStrings(n int64) []string {
	ret := make([]string, n)
	for i := int64(0); i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func containStr(arr []string, target string) bool {
	for _, v := range arr {
		if v == target {
			return true
		}
	}
	return false
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "orz")
	}
}

// mapからkeysとvaluesを返す
func splitKeyValue(m map[interface{}]interface{}) (keys, values []interface{}) {
	switch reflect.TypeOf(m).Kind() {
	case reflect.Map:
		s := reflect.ValueOf(m)
		for _, v := range s.MapKeys() {
			keys = append(keys, v)
			values = append(values, s.MapIndex(v))
		}
	default:
		fmt.Fprintln(out, "orz")
	}
	return
}


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

int main() {
	v(h); v(w);
	string o;
	char a = 'A';
	rep(i, h) {
		rep(j, w) {
			cin >> o;
			if (o == "snuke") {
				a += j;
				cout << a << i + 1 << endl;
			}
		}
	}
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <numeric>
#include <random>
#include <chrono>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

ll d;
vector<ll> c(26 + 1, 0);
vector<vector<ll>> s(365 + 1, vector<ll>(26 + 1, 0));

ll scoring(vector<int> t)
{
    ll ans = 0;
    vector<ll> last(26 + 1, 0);

    for (int i = 1; i <= d; i++)
    {
        ans += s[i][t[i]];
        ans -= c[t[i]] * (i - last[t[i]]) * (i - last[t[i]] - 1) / 2;
        last[t[i]] = i;
    }

    for (int i = 1; i <= 26; i++)
    {

        ans -= c[i] * (d - last[i] + 1) * (d - last[i]) / 2;
    }

    return ans;
}

int main(void)
{
    random_device seed_gen;
    mt19937 rand(seed_gen());
    cin >> d;

    for (int i = 1; i <= 26; i++)
    {
        cin >> c[i];
    }

    for (int i = 1; i <= d; i++)
    {
        for (int j = 1; j <= 26; j++)
        {
            cin >> s[i][j];
        }
    }

    vector<int> BestT(d + 1, 1);

    for (int i = 1; i <= d; i++)
    {
        BestT[i] = rand() % 26 + 1;
    }

    double BestScore = scoring(BestT);
    double score;

    auto start = chrono::system_clock::now();
    vector<int> t(d + 1, 1);

    double T0 = 1e6;
    double T1 = 5e2;
    double TL = 1980;
    double msec;

    ll count = 0;

    while (1)
    {
        if (count % 100 == 0)
        {
            msec = chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now() - start).count();
        }

        if (msec >= TL)
        {
            break;
        }

        double T = powf(T0, 1 - msec / TL) * powf(T1, msec / TL);

        t = BestT;

        t[rand() % d + 1] = rand() % 26 + 1;

        score = scoring(t);

        double p = exp((score - BestScore) / T);

        if (p > 0.5)
        {
            BestT = t;
            BestScore = score;
        }

        count++;
    }

    for (int i = 1; i <= d; i++)
    {
        printf("%d\n", BestT[i]);
    }
}


Measured memory_bytes: 4380
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <string>
#include <queue>

bool f(const std::string& s, const std::string &s0, const std::string& t0) {
  std::queue<char> st[2];

  for (char c: s0) st[0].push(c);
  for (char c: t0) st[1].push(c);

  for (size_t i=0; i<s.length(); ++i) {
    size_t j=i%2;
    while (!st[j].empty() && st[j].front() != s[i]) {
      char t=st[j].front();
      // fprintf(stderr, "pop: %c\n", t);
      st[j].pop();
    }
    if (st[j].empty()) return false;
    // fprintf(stderr, "match: %c\n", st[j].front());
    st[j].pop();
  }
  return true;
}

int main() {
  char buf[1024];
  scanf("%s", buf);
  std::string s=buf;
  scanf("%s", buf);
  std::string t=buf;

  if (f(s, s, t) || f(s, t, s)) {
    puts("Yes");
  } else {
    puts("No");
  }
}



Measured memory_bytes: 2820
/************
< 주소 >      :
*************
< 해결방안 >   :


*************
< 오답노트 >   :

*************/

#include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL_BOOKNU
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

// ........................macro.......................... //
#define FOR(i, f, n) for(int (i) = (f); (i) < (int)(n); ++(i))
#define RFOR(i, f, n) for(int (i) = (f); (i) >= (int)(n); --(i))
#define pb push_back
#define emb emplace_back
#define fi first
#define se second
#define ENDL '\n'
#define sz(A) (int)(A).size()
#define ALL(A) A.begin(), A.end()
#define UNIQUE(c) (c).resize(unique(ALL(c)) - (c).begin())
#define next next9876
#define prev prev1234
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef long long i64;
typedef unsigned long long ui64;
// inline i64 GCD(i64 a, i64 b) { if(b == 0) return a; return GCD(b, a % b); }
inline int getidx(const vi& ar, int x) { return lower_bound(ALL(ar), x) - ar.begin(); } // 좌표 압축에 사용: 정렬된 ar에서 x의 idx를 찾음
inline i64 GCD(i64 a, i64 b) { i64 n; if(a < b) swap(a, b); while(b != 0) { n = a % b; a = b; b = n; } return a; }
inline i64 LCM(i64 a, i64 b) { if(a == 0 || b == 0) return GCD(a, b); return a / GCD(a, b) * b; }
inline i64 CEIL(i64 n, i64 d) { return n / d + (i64)(n % d != 0); } // 음수일 때 이상하게 작동할 수 있음.
inline i64 ROUND(i64 n, i64 d) { return n / d + (i64)((n % d) * 2 >= d); }
inline i64 POW(i64 a, i64 n) {
	assert(0 <= n);
	i64 ret;
	for(ret = 1; n; a = a*a, n /= 2) { if(n%2) ret *= a; }
	return ret;
}
template <class T> ostream& operator<<(ostream& os, vector<T> v) {
	os << "[";
	int cnt = 0;
	for(auto vv : v) { os << vv; if(++cnt < v.size()) os << ","; }
	return os << "]";
}
template <class T> ostream& operator<<(ostream& os, set<T> v) {
	os << "[";
	int cnt = 0;
	for(auto vv : v) { os << vv; if(++cnt < v.size()) os << ","; }
	return os << "]";
}
template <class L, class R> ostream& operator<<(ostream& os, pair<L, R> p) { return os << "(" << p.fi << "," << p.se << ")"; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H, debug_out(T...); }
// ....................................................... //

double a, b;
void input() {
	cin >> a >> b;
}

int solve() {
	cout << a/b << ENDL;
	return 0;
}

// ................. main .................. //
void execute() {
	input(), solve();
}

int main(void) {
#ifdef LOCAL_BOOKNU
	freopen("input.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
#endif
	cin.tie(0), ios_base::sync_with_stdio(false);
	execute();
	return 0;
}
// ......................................... //

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
    static void Main(string[] args)
    {
        string a = Console.ReadLine();
        char ans = 'a';
        if (a[0] == 'z') ans = 'a';
        else ans = (char)(a[0] + 1);
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 11092
N = gets.to_i
height_list = gets.split.take(N).map(&:to_i)

MAX_VALUE = (10 ** 4) * (10 ** 5) + 1
dp = Array.new(N) { MAX_VALUE }
dp[0] = 0

(0..(N - 2)).each do |i|
  height = height_list[i]
  dp[i + 1] = [
    dp[i + 1],
    dp[i] + (height - height_list[i + 1]).abs
  ].min
  next if i == N - 2
  dp[i + 2] = [
    dp[i + 2],
    dp[i] + (height - height_list[i + 2]).abs
  ].min
end

puts dp[N - 1]


Measured memory_bytes: 11532
#include<stdio.h>

int main(){
  int H,W;
  int i,j;
  scanf("%d %d",&H,&W);
  char pic[W][H];
  
  for(i=0;i<H;i++){
     getchar();
    for(j=0;j<W;j++){
      pic[j][i] = getchar();
    }
  }

  for(j=0;j<W+2;j++){
    putchar('#');
  }
  putchar('\n');
  for(i=0;i<H;i++){
    putchar('#');
    for(j=0;j<W;j++){
      putchar(pic[j][i]);    
    }
    putchar('#');
    putchar('\n');
  }
  for(j=0;j<W+2;j++){
    putchar('#');
  }
  putchar('\n');
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int const maxn=1e5+10;
int n,t,c[4],a[maxn];
stack<int>s;
inline int get_num(){
	char ch;
	bool flag=false;
	int num=0;
	ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')flag=true;ch=getchar();}
	while(ch>='0'&&ch<='9'){num=(num<<3)+(num<<1)+ch-'0';ch=getchar();}
	if(flag)return -1*num;
	return num;
}
void work(){
	int sum=0,z;

	if(a[1]>=0){
		sum=-a[1];
		for(int i=2;i<=n;i++)sum+=a[i];
			cout<<sum<<endl;
		z=a[1];
		for(int i=n-1;i>1;i--){
			printf("%d %d\n",z,a[i]);
			z-=a[i];
		}
		printf("%d %d\n",a[n],z);
		return ;
	}
	sum=a[n]-a[1];
	for(int i=2;i<n;i++)sum+= a[i]>=0?a[i]:-a[i];
	cout<<sum<<endl;
	z=a[1];
	int i;
	for(i=n-1;i>1;i--){
			if(a[i]<0)break;
			printf("%d %d\n",z,a[i]);
			z-=a[i];
	}
	printf("%d %d\n",a[n],z);
	z=a[n]-z;
	for(;i>1;i--){
		printf("%d %d\n",z,a[i]);
		z-=a[i];
	}
}
int main(){
	n=get_num();
	for(int i=1;i<=n;i++)a[i]=get_num();
	sort(a+1,a+n+1);
	work();
	return 0;
}

Measured memory_bytes: 2304
//This code was made by Chinese_zjc_
#include<iostream>
#include<cstdio>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<vector>
#include<bitset>
#define int long long
#define INF 0x3fffffffffffffff
#define MOD 1000000007
using namespace std;
const double PI=acos(-1);
int k,l,r,d[4000001],p[4000001],ans;
string s;
int ksm(int a,int b)
{
	int tmp=1;
	while(b)
	{
		if(b&1)
		{
			tmp=(tmp*a)%MOD;
		}
		a=(a*a)%MOD;
		b>>=1;
	}
	return tmp;
}
int C(int a,int b)
{
	return d[b]*p[a]%MOD*p[b-a]%MOD;
}
const int _25=ksm(25,MOD-2);
signed main()
{
	ios::sync_with_stdio(false);
	cin>>k>>s;
	d[0]=p[0]=1;
	for(int i=1;i<=4000000;++i)
	{
		d[i]=(d[i-1]*i)%MOD;
		p[i]=ksm(d[i],MOD-2);
	}
	l=ksm(25,k+1);
	r=ksm(26,MOD-2);
	for(int i=0;i<=k;++i)
	{
		l=(l*_25)%MOD;
		r=(r*26)%MOD;
		ans=(ans+l*r%MOD*C(k-i,k-i+(int)s.length()-1)%MOD)%MOD;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 66796
#include<bits/stdc++.h>
#define ll long long
#define N 205
using namespace std;
inline int read(){
  int x = 0, f = 0;char ch = getchar();
  for (; ch <'0' || ch>'9'; ch = getchar()) if (ch == '-') f = 1;
  for (; ch >= '0'&& ch<='9'; ch = getchar()) x = (x<<1) + (x<<3) + ch - 48;
  return f ?-x :x;
}
int n, l[N];
int main() {
  n = read();
  for (int i = 1; i <= n*2; i++)
    l[i] = read();
  sort(l+1,l+1+n*2);
  int ans = 0;
  for (int i = 1; i <= n*2; i += 2) 
    ans += l[i];
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

using namespace std;


int main()
{
  int n;
  cin >> n;
  double hairetu[n];
  for (int i = 0; i < n; i++)
  {
      cin >> hairetu[i];
  }
  sort(hairetu, hairetu + SIZE_OF_ARRAY(hairetu));

  double temp = (hairetu[0] + hairetu[1]) / 2;
 
  for (int i = 2; i < n; i++)
  {
    temp = (temp + hairetu[i]) / 2;
  }

  cout << temp << endl;
}



Measured memory_bytes: 256
#include <stdio.h>

struct point{
	double x;
	double y;
};

double t(point p1, point p2){
	return (p1.y - p2.y)/(p1.x - p2.x);
}

int main(void){
	struct point p[4];
	int n = 0;
	scanf("%d", &n);
	for(int i=0;i<n;++i){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf",
			&(p[0].x), &(p[0].y),
			&(p[1].x), &(p[1].y),
			&(p[2].x), &(p[2].y),
			&(p[3].x), &(p[3].y));
		if(t(p[0], p[1]) == t(p[2], p[3])){
			puts("YES");
		}else{
			puts("NO");
		}
	}
	return 0;
}

Measured memory_bytes: 0
def pr(A):
    N = len(A);
    for i in range(N):
        if i :
            print (" ", end = "");
        print (A[i], end = "")
    print ("")

def insertionSort(A):
    pr(A)
    N = len(A)
    for i in range(1, N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j = j - 1
        A[j+1] = v
        pr(A)

N = int(input())
A = [int(i) for i in input().split()]

insertionSort(A)


Measured memory_bytes: 6320
#include <bits/stdc++.h>
#define mod 1000000007
#define rep(i,n) for(int i=0;(i)<(n);i++)
typedef long long ll;
using namespace std;
vector<int> f(vector<int>& a){
    int n = a.size();
    vector<int> res(n);
    rep(i,n) res[i] = a[i]^a[(i+1)%n];
    return res;
}
template<typename T>
struct MP{
    int n;
    T t;
    vector<int> a;
    MP() {}
    MP(const T& t): t(t) {
        n = t.size();
        a = vector<int>(n+1);
        a[0] = -1;
        int j = -1;
        rep(i,n){
            while(j!=-1 && t[j]!=t[i]) j=a[j];
            j++; a[i+1] = j;
        }
    }
    int operator[](int i) { return a[i];}
    vector<int> findAll(const T& s){
        vector<int> res;
        int j=0;
        rep(i,s.size()){
            while(j!=-1 && t[j]!=s[i]) j=a[j];
            j++;
            if(j==n) {
                res.push_back(i-j+1);
                j = a[j];
            }
        }
        return res;
    }
};
int main (){
    int n; cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    rep(i,n) cin >> a[i];
    rep(i,n) cin >> b[i];
    vector<int> xa = f(a);
    vector<int> xb = f(b);
    MP<vector<int>> mp(xa);
    xb.insert(xb.end(),xb.begin(),xb.end());
    vector<int> res = mp.findAll(xb);
    vector<int> ks;
    for(int p : res) ks.push_back(n-p);
    sort(ks.begin(),ks.end());
    for(int k : ks){
        if(k >= n) continue;
        int x = a[k]^b[0];
        cout << k << " "<< x << endl;
    }
}





Measured memory_bytes: 11504
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement, groupby
from math import sqrt, factorial, log
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heappushpop
import sys
stdin = sys.stdin
mod = 10**9 + 7

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

A, B, M = na()
a = na()
b = na()
ans = min(a) + min(b)
for i in range(M):
    x, y, c = na()
    x -= 1
    y -= 1
    ans = min(ans, a[x]+b[y]-c)
print(ans)


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

using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
/***********debug tools***********/
template<class T> ostream& operator<<(ostream& os, const pair<T,T>& p){os << "{" << p.first << "," << p.second << "}";return os; }
template<class T> inline void print(pair<T,T> p){cerr << p << endl;}
template<class T> inline void print(vector<T> arr) {cerr << "["; for(int i = 0; i < (int)arr.size(); i++)cerr << arr[i] << (i == (int)arr.size() - 1 ? "]" : ",");cerr << endl;}
template<class T> inline void print(vector<vector<T>> arr) {cerr << "[-------------------" << endl; for(int i = 0; i < (int)arr.size(); i++) { print(arr[i]);} cerr << "-------------------]" << endl;}
/*********************************/


int main()
{
    string s; int D; cin >> s >> D;
    for(auto &i : s)i -= '0';
    int n = s.size();
    vector<vector<vector<ll>>> dp(n + 1, vector<vector<ll>>(D, vector<ll>(2)));
    dp[0][0][0] = 1;
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < D; j++) {
            for(int k = 0; k < 2; k++) {
                for(int d = 0; d <= (k ? 9 : s[i]); d++) {
                    dp[i + 1][(j + d) % D][k || d < s[i]] += dp[i][j][k];
                    dp[i + 1][(j + d) % D][k || d < s[i]] %= mod;
                }
            }
        }
    }
    cout << ((dp[n][0][0] + dp[n][0][1] - 1) % mod + mod) % mod << endl;
}

Measured memory_bytes: 55296
#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>

using namespace std;

int main(){
long long int a,b[100010],c[100010],ans =0,ant=0;

cin >> a ;

for(int i=0;i<a;i++)
cin >> b[i];

for(int i=0;i<a;i++){
c[i] = abs(b[i]);
ans += c[i];
}

for(int i=0;i<a;i++){
 
 if(b[i]<0){
    ant ++;
    }
    
    }
    sort(c,c+a);
    
    if(ant %2 == 0){
    
    cout << ans << endl;
    }
    
    else{
    
    cout << ans - 2*c[0] << endl;
    }
    
    }
    






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

int main(){
	int N, res[200];
	std::vector<int> vs[3];

	std::cin >> N;
	for(int i=0;i<N;i++){
		for(int j=0;j<3;j++){
			int k;
			std::cin >> k;
			vs[j].push_back(k);
		}
	}

	for(int i=0;i<200;i++){
		res[i] = 0;
	}

	for(int i=0;i<3;i++){
		for(int j=0;j<N;j++){
			if(std::count(vs[i].begin(), vs[i].end(), vs[i][j]) == 1){
				res[j] += vs[i][j];
			}
		}
	}

	for(int i=0;i<N;i++){
		std::cout << res[i] << std::endl;
	}
}

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

long n, k, ans, d, f;

int main(){
    cin >> n >> k;
    for (int i = 1; i <= n; i++)ans += !(i % k),d += (k % 2 == 0 && i % (k / 2) == 0 && i % k != 0);
    cout << ans * ans * ans + d * d * d << endl;
}

Measured memory_bytes: 256
a=input().split(" ")
x1=""
x2=""

for j in range(int(a[0])):
    x1=x1+a[1]

for y in range(int(a[1])):
    x2=x2+a[0]

z1=int(x1)
z2=int(x2)

if x1<x2:
	print(x1)
elif x1>x2:
	print(x2)
else:
	print(x1)






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

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

  bool flag = true;
  for(int i=0;i<S.size();i++){
    //奇数文字目
    if((i+1)%2 == 1 && S.at(i) == 'L'){
      flag = false;
    }
    //偶数文字目
    if((i+1)%2 == 0 && S.at(i) == 'R'){
      flag = false;
    }
    if(!flag){
      break;
    }
  }
  if(flag){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    n = int(input())
    ans = pow(10, n, MOD)
    ans -= 2 * pow(9, n, MOD)
    ans += pow(8, n, MOD)
    print(ans % MOD)
resolve()

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

typedef long long int ll;
typedef long double ld;

//****************************************************                
#define lp(var,start,end) for (ll var = start; var <end ; ++var)
#define rlp(var,start,end) for(ll var = start; var>=end ; var--)
#define pb push_back
#define mp make_pair
#define pf push_front
#define ff first
#define ss second
#define vll vector<ll>
#define pll pair<ll,ll> 
#define vpll vector<pll>
#define all(X) X.begin(),X.end()
#define endl "\n" //comment it for interactive questions
#define trace1(a) cerr << #a << ": " << a << endl;
#define trace2(a,b) cerr << #a << ": " << a << " " << #b << ": " << b << endl;
#define trace3(a,b,c) cerr << #a << ": " << a << " " << #b << ": " << b << " " << #c << ": " << c << endl;
#define trace4(a,b,c,d) cerr << #a << ": " << a << " " << #b << ": " << b << " " << #c << ": " << c << #d << ": " << d << endl;
#define OC freopen("input.txt" , "r", stdin); freopen("output.txt" , "w", stdout) 
#define MOD (ll)1e9+7; //change it for other mods
#define FAST_IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
        //*******************************************************
//Some Functions

ll powmod(ll a,ll b)
{
   ll res = 1;
   while(b > 0) {
      if(b & 1) res = (res * a) % MOD;
      a = (a*a)%MOD;
      b = b >> 1; 
  }
  return res % MOD;
}

void solve()
{
    ll n, w;
    cin >> n >> w;
    // cout << n << " " << w << "\n";
    vll val(n+1), wt(n+1);
    ll vsum = 0;
    for(ll i=1;i<=n;i++) {
    	cin >> wt[i] >> val[i];
    	vsum += val[i];
    }
    ll dp[vsum + 1][101];
    for(ll i=0;i<=n;i++) {
    	for(ll j=0;j<=vsum;j++) {
    		if(j == 0) {
    			dp[j][i] = 0;
    		} else if(i == 0) {
    			dp[j][i] = (ll)1e15;
    		} else {
    			if(j >= val[i]) {
    				dp[j][i] = min(dp[j][i-1], dp[j-val[i]][i-1] + wt[i]);
    			} else {
    				dp[j][i] = min(dp[j][i-1], (ll)1e15);
    			}
    		}
    		// cout << j << " " << i << " " << dp[j][i] << s"\n";
    	}
    }
    for(ll i=vsum;i>=0;i--) {
    	if(dp[i][n] <= w) {
    		cout << i << "\n";
    		return;
    	}
    }
}

int main()
{
    FAST_IO;
    #ifndef ONLINE_JUDGE 
      // OC;
    #endif
    ll t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
}

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

#define ll long long
#define sp ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define cps CLOCKS_PER_SEC
#define mod (ll)1000000007
#define f first
#define s second
#define debug1(x) cerr<<x<<"\n"
#define debug2(x,y) cerr<<x<<" "<<y<<"\n"
#define debug3(x,y,z) cerr<<x<<" "<<y<<" "<<z<<"\n"
#define nl cerr<<"\n";
#define pq priority_queue
#define inf 0x3f3f3f3f
#define test cerr<<"abcd\n";
#define pi pair<int,int>
#define pii pair<int,pi>
#define pb push_back
#define mxn 200005


int main(){
sp;
ll n;
cin>>n;
ll a[n+1];
for(int i=0; i<n; ++i)cin>>a[i];
stack<int> s;
int l[n+1],r[n+1];
for(int i=0; i<n; ++i){
    l[i]=-1;
    r[i]=n;
}
for(int i=0; i<n; ++i){
    while(!s.empty()&&a[s.top()]>=a[i])
        s.pop();
    if(!s.empty())l[i]=s.top();
    s.push(i);
}
while(!s.empty())s.pop();
for(int i=n-1; i>-1; --i){
    while(!s.empty()&&a[s.top()]>a[i])
        s.pop();
    if(!s.empty())r[i]=s.top();
    s.push(i);
}
ll ans=0;
for(int i=0; i<n; ++i){
    ll l1=i-l[i]-1;
    ll l2=r[i]-i-1;
    ll p=1LL*l1*l2+l1+l2+1;
   // cout<<l1<<" "<<l2<<" "<<p<<"\n";
    ans+=1LL*p*a[i];
}
//nl;
cout<<ans;

return 0;}


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

using namespace std;

int main() {
   ios_base::sync_with_stdio(false);
   int H, W, h, w;
   cin >> H >> W >> h >> w;
   if (H % h == 0 && W % w == 0) {
      cout << "No\n";
      return 0;
   }
   cout << "Yes\n";
   for (int i = 0; i < H; ++i) {
      for (int j = 0; j < W; ++j) {
         if (i % h == h - 1 && j % w == w - 1) {
            cout << -2500 * (h * w - 1) - 1 << " ";
         } else {
            cout << 2500 << " ";
         }
      }
      cout << "\n";
   }
}


Measured memory_bytes: 1664
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().solve();
	}
	
	void solve(){
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		if(a+b>=10)System.out.println("error");
		else System.out.println(a+b);
	}
}


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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD =  (int)1e9 + 7;
const double EPS = 1e-9;

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

	string S;
	cin >> S;

	if (S == "ABC")cout << "ARC" << endl;
	else cout << "ABC" << endl;

	return 0;
}

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

int main() {
  string sa, sb, sc;
  char t;
  cin >> sa >> sb >> sc;
  int a = sa.size(), b = sb.size(), c = sc.size(), i = 0, j = 0, k = 0;
  t = sa[i];
  ++i;
  while (1) {
    if (t == 'a') {
      t = sa[i];
      ++i;
      if (i == a + 1) {
        break;
      }
    } else if (t == 'b') {
      t = sb[j];
      ++j;
      if (j == b + 1) {
        break;
      }
    } else {
      t = sc[k];
      k++;
      if (k == c + 1) {
        break;
      }
    }
  }
  if (i == a + 1) {
    cout << 'A' << "\n";
  } else if (j == b + 1) {
    cout << 'B' << "\n";
  } else if (k == c + 1) {
    cout << 'C' << "\n";
  } else {
    cout << "wrong"
         << "\n";
  }
  return 0;
}

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

int main() {
    string S;
    cin >> S;
    int N = S.size();
    long long res = 0;
    for (int bit = 0; bit < (1<<(N-1)); ++bit) {
        long long tmp = 0;
        for (int i = 0; i < N-1; ++i) {
            tmp *= 10;
            tmp += S[i] - '0';
            if (bit & (1<<i)) res += tmp, tmp = 0;
        }
        tmp *= 10;
        tmp += S.back() - '0';
        res += tmp;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main() {
    string S, T;
    cin >> S >> T;
    int result = 0;
    REP(i, 3) {
        if (S[i] == T[i]) {
            result++;
        }
    }
    cout << result << endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a,b) ((a<b)?a:b)
#define _max(a,b) ((a<b)?b:a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a)?1:-1)
#define SORT(v) sort(v.begin(),v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380


int main()
{
	cout << fixed << setprecision(10);

	int a, b;
	cin >> a >> b;
	cout << a * b;

	return 0;
}

Measured memory_bytes: 3624
program prob16
    implicit none
    integer :: h, w
    integer :: i, j
    integer :: k, l
    character(5), allocatable :: s(:)
    character(1) :: a
    character(20) :: b

    read(*,*) h, w
    allocate(s(w))
    do i = 1, h
        read(*,*) s
        do j = 1, w
            if(s(j) == "snuke") then
                k = i
                l = j
            end if
        end do
    end do

    !lk
    a = char(ichar('A') + l - 1)
    write(b,*) k
    write(*,'(a,a)') a, trim(adjustl(b))

    deallocate(s)
    stop
contains
end program prob16

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

#define rep(i, n) for(int i = 0; i < (n); i++)
using LL = long long;
using ULL = unsigned long long;


void solve() {
	int h, w, k; cin >> h >> w >> k;
	int ichigopy = 0;
	int ans[300][300] = {};
	int piece = 1;
	rep(y, h) {
		bool ichigo = false;
		int ichigopx = 0;
		rep(x, w) {
			char a; cin >> a;
			if (a == '#') {
				ichigo = true;
				for (int yy = ichigopy; yy <= y; yy++) {
					for (int xx = ichigopx; xx <= x; xx++) {
						ans[xx][yy] = piece;
					}
				}
				piece++;
				ichigopx = x + 1;
			}
		}
		if (ichigo) {
			for (int yy = ichigopy; yy <= y; yy++) {
				for (int xx = ichigopx; xx < w; xx++) {
					ans[xx][yy] = ans[xx - 1][yy];
				}
			}
		}
		if (ichigo) ichigopy = y + 1;
	}
	for (int yy = ichigopy; yy < h; yy++) {
		for (int xx = 0; xx < w; xx++) {
			ans[xx][yy] = ans[xx][yy - 1];
		}
	}

	rep(y, h) {
		rep(x, w) {
			if (x != 0) cout << " ";
			cout << ans[x][y];
		}
		cout << endl;
	}
}

int main() {

	solve();

	return 0;
}


Measured memory_bytes: 1152
#include <algorithm>
#include <iostream>

using namespace std;

int main() {
  int A[2][100] = {0};
  int S[2][100] = {0};

  int N;
  cin >> N;
  for (int i = 0; i < 2; ++i) {
    for (int j = 0; j < N; ++j) {
      cin >> A[i][j];
    }
  }

  S[0][0] = A[0][0];
  for (int j = 1; j < N; ++j) {
    S[0][j] = A[0][j] + S[0][j - 1];
  }
  S[1][0] = A[0][0] + A[1][0];
  for (int j = 1; j < N; ++j) {
    S[1][j] = A[1][j] + max(S[1][j - 1], S[0][j]);
  }
  cout << S[1][N - 1] << endl;

  return 0;
}


Measured memory_bytes: 256
# include <iostream>
# include <string>
# include <cctype>
# include <vector>
# include <cstdlib>
# include <cstring>
# include <algorithm>
# include <iomanip>
# include <cmath>

using namespace std ;

struct cmp
{
	bool operator()(char a)
	{
		return a=='C' ;
	} 
};

bool judge(string tmp)
{
	if (tmp[1]!='A')
	return false ;
	
	for (int i=1;i<tmp.size();i++)
	{
		if (isupper(tmp[i]))
		{
			if (tmp[i]=='A'||tmp[i]=='C')
			continue ;
			else
			return false ;
		}
	}
	
	int num ;
	num=count_if(tmp.begin()+3,tmp.end()-1,cmp()) ;
	if (num==1)
	return true ;
	else
	return false ;
}

const double pi=acos(-1.0) ;//也可以用cmath中的M_PI
int main()
{
    string tmp1 ;
    while(cin>>tmp1)
    {
    	string tmp("0") ;
    	tmp=tmp+tmp1 ;
    	if(judge(tmp)) 
    	cout << "AC" << endl ;
     	else
    	cout << "WA" << endl ;
	}
	return 0 ;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
using namespace std;
int a[250010],d[250001],mp[250001];
int dd[4];
queue<pair<int,int>> que0,que1;
void bfs(int s,int n){
    for(int i=0;i<4;i++){
        int nw = s + dd[i];
        if(nw<0 || nw>=n*n) continue;
        que0.push({d[s],nw});
    }
    while(que0.size() || que1.size()){
        while(que0.size()){
            auto p = que0.front(); que0.pop();
            int pos = p.second,dist = p.first;
            if(d[pos]<=dist) continue;
            d[pos] = dist;
            for(int i=0;i<4;i++){
                int nw = pos + dd[i];
                if(nw<0 || nw>=n*n) continue;
                if(mp[pos]==1) que1.push({dist + 1,nw});
                else que0.push({dist,nw});
            }
        }
        if(que1.size()){
            auto p = que1.front(); que1.pop();
            int pos = p.second,dist = p.first;
            if(d[pos]<=dist) continue;
            d[pos] = dist;
            for(int i=0;i<4;i++){
                int nw = pos + dd[i];
                if(nw<0 || nw>=n*n) continue;
                if(mp[pos]==1) que1.push({dist + 1,nw});
                else que0.push({dist,nw});
            }
        }
    }
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int i,j,n;
    cin >> n;
    for(i=0;i<n*n;i++){
        cin >> a[i]; a[i]--;
    }
    dd[0] = -1; dd[1] = -n; dd[2] = 1; dd[3] = n;
    for(i=0;i<n*n;i++){
        d[i] = 0; mp[i] = 1;
    }
    for(i=0;i<n;i++){
        for(j=0;j<n;j++){
            int x = min(i,n - 1 - i);
            int y = min(j,n - 1 - j);
            d[i*n + j] = min(x,y);
        }
    }
    int ans = 0;
    for(i=0;i<n*n;i++){
        ans += d[a[i]];
        mp[a[i]] = 0;
        bfs(a[i],n);
    }
    cout << ans << endl;
}

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

int main() {
  int n, r;
  cin >> n;
  r = 10000;

  // ここにプログラムを追記
  rep(i, n) {
    int a, x;
    cin >> a;
    x = 0;
    while ((a % 2) == 0) {
      x++;
      a /= 2;
    }
    if (x < r) {
      r = x;
    }
  }
  cout << r << endl;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  A.push_back(1e9);
  int ans = 0;
  for (int i = 0, cnt = 1; i < N; i++) {
    if (A.at(i) != A.at(i + 1)) ans += cnt / 2, cnt = 1;
    else cnt++;
  }
  cout << ans << "\n";
}

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

//諸機能
#pragma region MACRO 
#define putans(x)  std::cerr << "[ answer ]: " ; cout << (x) << endl
#define dputans(x) std::cerr << "[ answer ]: "; cout << setprecision(27) << (double)(x) << endl
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define RREP(i,a,n) for(int i=(int)(n-1); i>= a; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) begin((a)),end((a))
#define mp make_pair
#define exist(container, n) ((container).find((n)) != (container).end())
#define equals(a,b) (fabs((a)-(b)) < EPS)
#ifdef _DEBUG //ファイルからテストデータを読み込む
std::ifstream ifs("data.txt");
#define put ifs >>
#else //ジャッジシステムでいい感じにやる
#define put cin >>
#endif
#pragma endregion
//デバッグなどの支援
#pragma region CODING_SUPPORT
#ifdef _DEBUG
#define dbg(var0) { std::cerr << ( #var0 ) << "=" << ( var0 ) << endl; }
#define dbg2(var0, var1) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg(var1); }
#define dbg3(var0, var1, var2) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg2(var1, var2); }
#define dbgArray(a,n) {std::cerr << (#a) << "=";  rep(i,n){std::cerr <<(a[i])<<",";} cerr<<endl;} 
#else
#define dbg(var0) {}
#define dbg2(var0, var1) {}
#define dbg3(var0, var1, var2) {}
#define dbgArray(a,n) {}
#endif 
#pragma endregion 
//typedef（書き換える、書き足す可能性ある）
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii; typedef pair<string, string> pss; typedef pair<int, string>pis;
typedef vector<string> vs; typedef vector<int> vi;
#pragma endregion
//諸々の定数(書き換える可能性ある)
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-10)
#define MOD (ll)(1e9 + 7)
#define INF (ll)(2*1e9)
#pragma endregion


int main() {
	int n; put n;

	ll ans = 0;
	vi a; a.resize(n);
	rep(i, n) {put a[i];}
	ans += a[0] - 1;
	a[0] = 1;
	int minmodder = 2;
	REP(i,1, n) {
		dbg2(1, minmodder);
		if (a[i] < minmodder) continue;
		if (a[i] == minmodder) {
			minmodder++;

			continue;
		}
		if (a[i] > minmodder) {
			if (a[i] % minmodder == 0) {
				ans += a[i] / minmodder - 1;
			}
			else {
				ans += a[i] / minmodder;
			}
		}
	}
	putans(ans);
END:
	return 0;
}



Measured memory_bytes: 768
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
#include <bitset> 
#include <iterator> 
#include <map>
#include <queue>
#include <set>
#define rep(i,n) for(ll i=0;i<(n); ++i)
#define per(i,n) for(ll i=n-1;i>=0; --i)
#define all(x) (x).begin(),(x).end()
#define _GLIBCXX_DEBUG
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
typedef long long ll;
ll MOD = 1000000007;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	vector<vector<ll>>c(3, vector<ll>(3));
	rep(i, 3) {
		rep(k, 3) {
			cin >> c[i][k];
		}
	}
	rep(i, 101) {
		rep(j, 101) {
			rep(k, 101) {
				if ((c[0][0] - i == c[1][0] - j) &&(c[0][0] - i == c[2][0] - k)) {
					if ((c[0][1] - i == c[1][1] - j) && (c[0][1] - i == c[2][1] - k)) {
						if ((c[0][2] - i == c[1][2] - j) && (c[0][2] - i == c[2][2] - k)) {
							return cout << "Yes" << endl,0;
						}
					}
				}
			}
		}
	}
	return cout << "No" << endl, 0;
}


Measured memory_bytes: 256
def cnt(a):
    k=a[1]
    a.sort()
    if k==a[1]:
        return 1
    return 0

n=int(input())
p=list(map(int,input().split()))

ans=0
for i in range(n-2):
    ans+=cnt(p[i:i+3])
print(ans)

Measured memory_bytes: 3316
#include<stdio.h>
int main(void){
	int D;
	scanf("%d",&D);
	if(D==25){
		printf("Christmas");
	}else if(D==24){
		printf("Christmas Eve");
	}else if(D==23){
		printf("Christmas Eve Eve");
	}else if(D==22){
		printf("Christmas Eve Eve Eve");
	}
return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <stack>
#include <functional>
#define rep(i,j,n) for(i=j;i<(n);i++)
#define rrep(i,j,n) for(i=j;i>(n);i--)
typedef long long int lli;
#define N 1000000007

using namespace std;

//lli gcd(lli a,lli b){
//    lli x,y;
//    x=max(a,b);
//    y=min(a,b);
//    if(x%y==0){
//        return y;
//    }
//    else{
//        return gcd(y,x%y);
//    }
//}
//
//lli lcm(lli a,lli b){
//    lli x,y;
//    x=max(a,b);
//    y=min(a,b);
//    return x*y/gcd(x,y);
//}

int main(){
    lli q,t,f,a=0;
    string s,c;
    deque<string> ans;
    lli i,j;
    cin>>s>>q;
    ans.push_back(s);
    rep(i,0,q){
        cin>>t;
        a+=t;
        a%=2;
        if(t==2){
            cin>>f>>c;
            switch(f){
                case 1:
                    if(a==1){
                        ans.push_back(c);
                    }
                    else{
                        ans.push_front(c);
                    }
                    break;
                case 2:
                    if(a==1){
                        ans.push_front(c);
                    }
                    else{
                        ans.push_back(c);
                    }
                    break;
            }
        }
    }
    if(a==1){
        reverse(ans.begin(),ans.end());
    }
    for(auto x:ans){
        if(a==1){
            if(x.size()>1){
                reverse(x.begin(),x.end());
            }
        }
        cout<<x;
    }
    cout<<endl;
}


Measured memory_bytes: 11648
n=int(input())

dic={}
for i in range(n):
    s=input()
    if s in dic:
        dic[s]+=1
    else:
        dic[s]=1

m=int(input())
for i in range(m):
    s=input()
    if s in dic:
        dic[s]-=1
    else:
        dic[s]=-1
        
print(max(0,max(dic.values())))

Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main() {
	string s;
	cin >> s;
	int count = 0;
	if (s.size() % 2 == 0) {
		for (int i = 0; i < s.size() / 2; i++) {

				if (s[i] != s[s.size()-1-i]) {
					count++;
			    }
		}
		cout << count << endl;
		return 0;
	}
	
	else {
		for (int i = 0; i < s.size() / 2; i++) {
			
				if (s[i] != s[s.size()-1-i]) {
					count++;
				}
		}
		cout << count << endl;
		return 0;
	}
	return 0;
}

Measured memory_bytes: 256
import math
a,b,h,m = map(int,input().split())

a_rad=h*30+0.5*m
b_rad=m*6


ABSS=abs(a_rad-b_rad)
D=math.radians(ABSS)

#print(D)
ans=math.sqrt(a**2+b**2-2*a*b*math.cos(D))
print(ans)

Measured memory_bytes: 9564
#a,b=map(int,input().split())
n=int(input())
#m=int(input())
#r=[input() for _ in range(n)]
a=list(map(int,input().split()))
b=list(map(int,input().split()))
total=sum(a)
for i in range(n):
    if a[i]<=b[i]:
        diff=b[i]-a[i]
        a[i]=0
        if a[i+1]<diff:
            a[i+1]=0
        else:
            a[i+1]-=diff
    else:
        a[i]-=b[i]
print(total-sum(a))

Measured memory_bytes: 19116
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
mod=10**9+7

n,d,a=map(int,input().split())
# xh=[list(map(int,input().split())) for i in range(n)]
xh=[]
for i in range(n):
    xh.append(list(map(int,input().split())))
xh.sort()
r,tama=[],[0]

for i in range(n):
    x,h=xh[i]
    tmpr=bisect.bisect_left(r,x)
    h-=(tama[-1]-tama[tmpr])*a
    tmp=0
    if h>0:
        tmp=math.ceil(h/a)
    tama.append(tmp)
    tama[i+1]+=tama[i]
    r.append(x+2*d)

print(tama[-1])
# print(r)

Measured memory_bytes: 121048
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int main(){

    int n;
    cin >> n;
    if(n%2==1){
        cout << n*2 << endl;
    }else{
        cout << n << endl;
    }
    


    return 0;
}

Measured memory_bytes: 256
from sys import stdin

def main():

    input = stdin.readline

    N = int(input())
    A = list(map(int,input().split()))
    ans = [0] * N

    for i in range(N-1):
        ans[A[i]-1] += 1

    for i in ans:
        print(i)
    

if __name__ == "__main__":
    main()

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

int main() {
  int n,k;
  cin >> n >> k;
  vector<int> p(n);
  for(int i=0;i<n;i++)	cin >> p.at(i);
  sort(p.begin(),p.end());
  int s=0;
  for(int i=0;i<k;i++)	s+=p.at(i);
  cout << s;
  
  return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
typedef long long ll;
#define INF 1000000000
#define MOD 1000000007
int dx[4]={1,0,-1,0},dy[4]={0,-1,0,1};
using namespace std;
int main(void){
   int n,k;
   cin>>n>>k;
   int x[n];
   for(int i=0;i<n;i++){
      cin>>x[i];
   }
   int left=0,right=k-1;
   ll ans=INF;
   while(right<n){
      ll lval=x[left],rval=x[right];
      ll tmp=lval*rval;
      if(tmp>=0){
         ans=min(ans,max(abs(lval),abs(rval)));
      }else{
         ll s,t;
         s=abs(lval)*2+abs(rval);
         t=abs(lval)+2*abs(rval);
         ans=min(ans,min(s,t));
      }
      left++;
      right++;
   }
   cout<<ans<<endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <queue>
using namespace std;

typedef pair<int, int> P;

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

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<char>> F(H, vector<char>(W));
    queue<P> que;
    vector<vector<int>> dist(H, vector<int>(W, INF));
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> F[i][j];
            if (F[i][j] == '#') {
                que.push(P(i, j));
                dist[i][j] = 0;
            }
        }
    }

    while (!que.empty()) {
        P p = que.front(); que.pop();
        for (int i = 0; i < 4; i++) {
            int nx = p.first + dx[i];
            int ny = p.second + dy[i];
            if (nx >= 0 && nx < H && ny >= 0 && ny < W && dist[nx][ny] == INF) {
                que.push(P(nx, ny));
                dist[nx][ny] = dist[p.first][p.second] + 1;
            }
        }
    }

    int res = 0;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            res = max(res, dist[i][j]);
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 13328
#include <iostream>
 
using namespace std;
 
typedef long long ll;
 
ll MOD = 1000000007;
ll dp[100005][13];
 
int main() {
    string s; cin >> s;
    dp[0][0] = 1;
    for(ll i = 1; i<= s.size(); i++) {
        // printf("%lld桁目\n", i);
        int c;
        if(s[i-1] == '?') {
            c = -1;
        } else {
            c = s[i-1] - '0';
        }
        for(int j = 0; j < 13; j++) {
            if(c == -1) {
                for(int k = 0; k < 10; k++) {
                    // cout << j*10+k << endl;
                    dp[i][(j*10+k)%13] += dp[i-1][j];
                    dp[i][(j*10+k)%13] %= MOD;
                }
            } else {
                dp[i][(j*10+c)%13] += dp[i-1][j];
                dp[i][(j*10+c)%13] %= MOD;
            }
        }
    }
    for(int i = 0; i <= s.size(); i++) {
        for(int j = 0; j < 13; j++) {
            // printf("%3lld ", dp[i][j]);
            // cout << dp[i][j] << " ";
        }
        // cout << endl;
    }
    cout << dp[s.size()][5] << endl;
}

Measured memory_bytes: 10624
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 100000000000000 //10^14
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int main()
{
    ll N, X, T;
    cin >> N >> X >> T;
    cout << (N+X-1)/X * T << endl;
}

Measured memory_bytes: 3628
n,m=list(map(int,input().split()))
parents=[i for i in range(n)]
rank=[i for i in range(n)]
def find(a):
    if parents[a]!=a:
        return find(parents[a])
    return a
        

def union(a,b):
    xa=find(a)
    xb=find(b)
    if xa==xb:
        return
    if rank[xa]>rank[xb]:
        parents[xb]=xa
        
    elif rank[xa]<rank[xb]:
        parents[xa]=xb
    else:
        parents[xa]=xb
        rank[xb]+=1

for i in range(m):
    h,a,b=list(map(int,input().split()))
    if h==0:
        union(a,b)
    else:
        x=find(a)
        y=find(b)
        
        print(1 if x==y else 0)
    

Measured memory_bytes: 94072
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <cctype>
#include <cstdlib>
#include <set>
#include <map>
#include <sstream> 
#define  ll long long
using namespace  std;
const    ll   len=105;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		vector<int>v1;
		vector<int>v2;
		int j=0;
		int w=0,temp;
		for(int i=0;i<10;i++)
		{
			cin>>temp;
			if(i==0)
				v1.push_back(temp);
			else
			{
				if(v1[v1.size()-1]<temp)
					v1.push_back(temp);
				else
				{
					if(v2.size()==0)
						v2.push_back(temp);
					if(v2[v2.size()-1]>temp&&v2.size()!=0)
						w=1;
					else
					if(v2[v2.size()-1]<temp&&v2.size()!=0)
						v2.push_back(temp); 	
				}  
			}
		}
		if(w==1)printf("NO\n");
		else
		 printf("YES\n");
	}
	return 0;
}


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

int main() {
  int N,M;
  cin>>N>>M;
  
  vector<int>H(N);
  for(int i=0;i<N;i++){
    cin>>H.at(i);
  }
  
  vector<vector<int>>l(N);
  int a,b;
  for(int i=0;i<M;i++){
    cin>>a>>b;
    l.at(a-1).push_back(b);
    l.at(b-1).push_back(a);
  }
  
  int ans=0;
  for(int i=0;i<N;i++){
    int h=H.at(i);
    bool t=true;
    for(int x:l.at(i)){
      int y=H.at(x-1);
      if(h<=y){
        t=false;
        break;
      }
      else continue;
    }
    if(t){
      ans++;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 8696
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  n *= 2;
  vector<int> ns(n);
  for (int i = 0; i < n; i++) {
    cin >> ns[i];
  }
  sort(ns.begin(), ns.end());
  int ans = 0;
  for (int i = 0; i < n; i += 2) ans += ns[i];
  cout << ans << endl;
}


Measured memory_bytes: 256