akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using large = long long;

int main() {
    int x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;

    auto p = vector<int>(a);
    for (auto &p_i : p)
        cin >> p_i;
    auto q = vector<int>(b);
    for (auto &q_i : q)
        cin >> q_i;
    auto r = vector<int>(c);
    for (auto &r_i : r)
        cin >> r_i;

    sort(p.begin(), p.end());
    if (p.size() > x) {
        auto discard = p.size() - x;
        p.erase(p.begin(), p.begin() + discard);
    }

    sort(q.begin(), q.end());
    if (q.size() > y) {
        auto discard = q.size() - y;
        q.erase(q.begin(), q.begin() + discard);
    }

    q.insert(q.end(), p.begin(), p.end());
    sort(q.begin(), q.end());

    sort(r.begin(), r.end());
    if (r.size() > x + y) {
        auto discard = r.size() - (x + y);
        r.erase(r.begin(), r.begin() + discard);
    }

    for (int i = 0; i < q.size(); ++i) {
        if (r.empty())
            break;
        if (q[i] >= r.back())
            break;
        q[i] = r.back();
        r.pop_back();
    }

    cout << accumulate(q.begin(), q.end(), 0LL);
    return 0;
}


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

#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#define fo(i, a, b, k) for(int i = a; i <= b; i += k)
#define _fo(i, a, b, k) for(int i = a; i >= b; i -= k)
#define foa(i, a) for (auto &i : a)
#define fod(i, a) for(int i = 1; i*i <= a; i++)
#define sz(a) ((int) a.size())
#define all(a) begin(a), end(a)
#define fi first
#define se second
#define pb(x) push_back(x)
#define mk(x, y) make_pair(x, y)  
#define log2i(x) (31-__builtin_clz(x))
#define log2ll(x) (63-__builtin_clzll(x)) 
#define msz(x) __builtin_popcount(x) 
#define mszll(x) __builtin_popcountll(x) 
#define fom(i, a, b) for(int i = a; i < (1<<b); i++)
#define ifon(i, mask) if(mask&(1<<i))
#define ss(i, mask) while(i=(i-mask)&mask)
#define ifss(i, mask) if(i > (mask^i)) 

typedef int64_t ll;

const int S = 1e5+1;
const int MOD = 1e9+7;

int l;
string s;
ll total[S][13];

ll solve(int p, int re) {
	if(p == l) {
		if(re == 5) return 1;
		return 0;
	}
	
	if(total[p][re] != -1) return total[p][re];
	
	ll curr = 0;
	if(s[p] == '?') 
		fo(i, 0, 9, 1) curr = (curr+solve(p+1, (re*10+i) % 13)) % MOD;
	else {
		int temp = s[p]-'0';
		curr = solve(p+1, (re*10+temp) % 13) % MOD;	
	} 
	
	total[p][re] = curr;
	return curr;
}

signed main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	memset(total, -1, sizeof(total));
	
	cin >> s;
	l = sz(s);
	cout << solve(0, 0);
}

Measured memory_bytes: 18512
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#define endl "\n"
#define ll long long int
using namespace std;

int main()
{
    ll n;
    cin >> n;

    int minCount = 100000000;
    int i;
    for(i = 1; i <= sqrt(n); i ++)
    {
    	if(n % i == 0)
    	{
    		ll fact1 = i;
    		ll fact2 = n / i;

    		ll check = max(fact1, fact2);
    		int count = 0;
    		while(check > 0)
    		{
    			check /= 10;
    			count ++;
    		}
    		if(count < minCount)
    			minCount = count;
    	} 
    }

    cout << minCount << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    ll h, w;
    cin>>h>>w;
    vector<string> grid(h);
    cin>>grid;

    queue<tuple<ll, ll, ll>> q;
    vvl visited(h, vl(w, -1));
    rep(i, h) {
        rep(j, w) {
            if (grid[i][j] == '#') q.emplace(i, j, 0);
        }
    }
    ll ans = 0;
    while (!q.empty()) {
        auto v = q.front(); q.pop();
        ll x = get<0>(v), y = get<1>(v), d = get<2>(v);
        if (visited[x][y] != -1) continue;
        visited[x][y] = d;
        chmax(ans, d);
        if (x - 1 >= 0) q.emplace(x - 1, y, d + 1);
        if (x + 1 < h) q.emplace(x + 1, y, d + 1);
        if (y - 1 >= 0)  q.emplace(x, y - 1, d + 1);
        if (y + 1 < w) q.emplace(x, y + 1, d + 1);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 106424
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define _GLIBCXX_DEBUG
#define INF 100000010
 #define PI 3.14159265359

using namespace std;
const int mod = 1000000007;
const int tmpMod = 998244353;


int main() {
 
  int64_t N,ans=1;
  cin>>N;
  vector<int64_t> A(N);
  for(int i=0; i<N; i++){
    cin>>A[i];
    if(A[i]==0){cout<<0<<endl;return 0;}
  }
  for(int i=0; i<N; i++){
    // cout<<ceil((double)pow(10,18)/(double)ans)<<endl;
    // cout<<ans<<endl;
    // cout<<ans*A[i]<<endl;
    // cout<<pow(10,18)<<endl;
    if(ceil(1000000000000000000/ans)<A[i]){cout<<-1<<endl;return 0;}
    else ans*=A[i];
  }
  //vector<vector<int> > A(N,vector<int>(M));
  //for(int i=0; i<N; i++){for(int j=0; j<M; j++){cin>>A[i][j];}}
  //sort(A.begin(),A.end());
  //for (int i = 0; i < N; i++) { maximum = max(maximum , A[i]);}
  //for (int i = 0; i < N; i++) { minimum = min(minimum , A[i]);}
  cout << ans << endl;
}

Measured memory_bytes: 4048
// Copyright 2017 wu_qing
#include <cstdio>
#include <cstdint>
#include <algorithm>
int64_t a, b, c;
int main() {
    scanf("%lld%lld%lld", &a, &b, &c);
    if (1 & a & b & c)
        printf("%lld\n", std::min(a * b, c * std::min(a, b)));
    else
        printf("0\n");
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  rep(i, n) a[i]--;

  vector<int> idx(n);
  rep(i, n) idx[a[i]] = i;

  set<int> s;
  ll ans = 0;
  for (int x = n - 1; x >= 0; --x) {
    int i = idx[x];
    ll c = 0;
    {  // calc c
      s.insert(i);
      vector<int> l(2, -1);
      vector<int> r(2, n);
      {  // calc l
        auto it = s.find(i);
        rep(j, 2) {
          if (it == s.begin()) break;
          --it;
          l[j] = *it;
        }
      }
      {  // calc r
        auto it = s.find(i);
        rep(j, 2) {
          ++it;
          if (it == s.end()) break;
          r[j] = *it;
        }
      }
      vector<int> ls(2);
      ls[0] = i - l[0];
      ls[1] = l[0] - l[1];
      vector<int> rs(2);
      rs[0] = r[0] - i;
      rs[1] = r[1] - r[0];
      c = (ll)ls[0] * rs[1] + (ll)ls[1] * rs[0];
    }
    ans += c * (x + 1);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 8700
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <iostream>
#include <fstream>

using namespace std;

const int DIV = 1000000007;

int main(int argc, char *argv[]) {
#ifdef VLAD_LOCAL
    //FILE *f = fopen("in.txt", "r");
    ifstream f("in.txt");
#else
    //FILE *f = stdin;
    istream &f = cin;
#endif
    int a, b, h, m;
    f >> a >> b >> h >> m;
    double ha = 2.0 * M_PI * (3 * 60 - (h * 60 + m)) / 12 / 60;
    double ma = 2.0 * M_PI * (15 - m) / 60;
    double hy = sin(ha) * a;
    double hx = cos(ha) * a;
    double my = sin(ma) * b;
    double mx = cos(ma) * b;
    double x = hx - mx;
    double y = hy - my;
    double dist = sqrt(x * x + y * y);
    printf("%.15lf\n", dist);
	return 0;
}


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

int main() {
	int n;cin>>n;
	int s=0;
	int n2=n;
	while(n2){
		s+=n2%10;
		n2/=10;
	}
	if(n%s){
		cout<<"No"<<endl;
	}else{
		cout<<"Yes"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<P> v1, v2;
    int A[n + 1], W[n + 1];
    for(int i = 0; i < n; i++) cin >> A[i];
    for(int i = 0; i < n; i++) cin >> W[i];
    for(int i = 0; i < n; i++)
    {
        if(A[i] == 1) v1.push_back(P(A[i], -W[i]));
        else v1.push_back(P(A[i], W[i]));
        if(A[i] == 0) v2.push_back(P(A[i], -W[i]));
        else v2.push_back(P(A[i], W[i]));
    }
    sort(v1.begin(), v1.end());
    sort(v2.begin(), v2.end(), greater<P>());
    int ans = v1[0].second - v1.back().second; 
    int idx = -1;
    for(int i = 0; i < v2.size() - 1; i++)
    {
        if(v2[i].first != v2[i + 1].first)
        {
            idx = i;
            break;
        }
    }
    if(idx == -1) cout << 0 << endl;
    else
    {
        ans = min(ans, v2[idx].second - v2[idx + 1].second);
        cout << ans << endl;
    }
    return 0;
}




Measured memory_bytes: 3192
#include<stdio.h>
#define MAX 100005
#define NIL -1
 struct Node{
  int p;
  int l;
  int r;
};
struct Node T[MAX];
int n,D[MAX];

void pri(int u){
  int i,c;
  printf("node %d: ",u);
  printf("parent = %d, ",T[u].p);
  printf("depth = %d, ",D[u]);

  if(T[u].p==NIL)printf("root, ");
  else if(T[u].l==NIL)printf("leaf, ");
  else printf("internal node, ");

  printf("[");
  for(i=0,c=T[u].l;c!=NIL;i++,c=T[c].r){
    if(i)printf(", ");
printf("%d",c);
  }
printf("]\n");
}

void rec(int u,int p){
  D[u]=p;
  if(T[u].r != NIL)rec(T[u].r,p);
  if(T[u].l !=NIL)rec(T[u].l,p+1);
}

int main(){
  int i,j,d,v,c,l,r;
  scanf("%d",&n);
  for(i=0;i<n;i++)T[i].p=T[i].l=T[i].r=NIL;

  for(i=0;i<n;i++){
    scanf("%d%d",&v,&d);
    for(j=0;j<d;j++){
     scanf("%d",&c);
     if(j==0)T[v].l=c;
     else T[l].r=c;
     l=c;
     T[c].p=v;
    }
  }
for(i=0;i<n;i++){
  if(T[i].p==NIL)r=i;
}
rec(r,0);
for(i=0;i<n;i++)pri(i);
return 0;
}



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

typedef long long int ll;
ll powk(ll a, ll n){
    ll r = 1;
    for(ll i = 0;i < n;i++){
        r *= a;
    }

    return r;
}

int main()
{
    ll a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    if(a + b > 2 * c){
        ll t = 0;
        if(x < y){
            t = (y - x) * b;
        }
        else{
            t = (x - y) * a;
        }
        cout << min(min(x, y) * c * 2 + t, max(x, y) * c * 2);
    }
    else{
        cout << x * a + y * b;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n, a;
  cin >> n;
  cin >> a;
 
  if (n % 500 <= a) {
    cout << "Yes" << endl;
  }
  else cout << "No" << endl;
  // ここにプログラムを追記
}

Measured memory_bytes: 3608
N,K=map(int,input().split())
p=[int(x) for x in input().split()]
T=[-1]*K+[0 if x=='r' else (1 if x=='s' else 2) for x in input()]

s=0
for i in range(K,N+K):
  if T[i]==T[i-K]:
    T[i]=-1
  else:
    s+=p[(T[i]+2)%3]

print(s)


Measured memory_bytes: 6040
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a=nxt(),b=nxt();
    cout<<(a+b)%24<<endl;
    
    
    return 0;   
}




 
 


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define node first
#define weight second
#define MOD 1000000007
typedef pair <int, int> ii;

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	#ifdef LOCAL_PROJECT
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	int n, w;
	cin >> n >> w;
	int a[w+5] = {0}, b[w+5] = {0};
	int *current = a, *old = b;
	for(int i = 1; i <= n; i++)
	{
		int wi, vi;
		cin >> wi >> vi;
		int *temp = current;
		current = old;
		old = temp;
		for(int j = 0; j <= w; j++)
			if(j-wi >= 0)
				current[j] = max(old[j], old[j-wi] + vi);
			else
				current[j] = old[j];
	}
	cout << current[w];
}

Measured memory_bytes: 1792
// HEADERS //
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
#include <bits/stdc++.h>
 
// MISCELLANEOUS //
#define fast_IO() ios_base::sync_with_stdio(false),cin.tie(NULL)
#define gcd __gcd
#define cnt_1s __buitlin_popcount
#define ll long long
#define endl "\n"
#define test(t) cin>>t; while(t--)
#define mem(v,x) memset(v,x,sizeof(v))

// LOOPS //
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define irep(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define srep(i,v) for(decltype(v.begin())i=v.begin();i!=v.end();i++)
 
// CONTAINERS //
// #define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
#define ii pair<int,int>
#define ff first
#define ss second
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vi>
#define pb push_back
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define all(v) (v).begin(),(v).end()
#define present(v,x) (v).find(x)!=(v).end()
 
// DEBUGGING //
#define dbg() printf("\n**DEBUG**\n") 
#define chk(a) cerr<<endl<<#a<<":"<<a<<endl
#define chk2(a,b) cerr<<endl<<#a<<":"<<a<<"\t"<<#b<<":"<<b<<endl
 
// CONSTANTS //
#define M 1000000007
 
// MAIN //
// using namespace __gnu_pbds; 
using namespace std;
int main()
{
  fast_IO();
  string s, t; int cnt = 1;
  cin >> s >> t;
  int S = s.size(), T = t.size();
  int dp[S+1][T+1]; mem(dp, 0);
  rep(i, 1, S+1) rep(j, 1, T+1)
  {
    if(s[i-1] == t[j-1]) dp[i][j] = 1 + dp[i-1][j-1];
    else dp[i][j] = max(dp[i-1][j], dp[i][j-1]);  
  }
  int id = dp[S][T];
  string ans;
  int i = S, j = T; 
  while (i  && j ) 
  { 
    if (s[i-1] == t[j-1]) 
    { 
      ans += t[j-1]; 
      --id, --i, --j;   
    }  
    else if (dp[i-1][j] < dp[i][j-1]) --j; 
    else  --i; 
  }
  reverse(all(ans));
  cout << ans;
}

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

signed main() {
	int x,a,b;
	cin>>x>>a>>b;
	if(abs(x-a)>abs(x-b)){
		cout<<'B'<<endl;
	}
	else{
		cout<<'A'<<endl;
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	//freopen("Curtain","r",stdin);
	//freopen("Curtain","r",stdin);
	int n,i,a[50],j,b,x=0;
	cin>>n;
	for(i=1;i<=n;i++) cin>>a[i];
	for(i=1;i<n;i++)
	{
		for(j=i+1;j<=n;j++)
		{
			x+=a[i]*a[j];
		}
	}
	cout<<x;
}

Measured memory_bytes: 256
import sys

input = sys.stdin.readline
sys.setrecursionlimit(100000)
from collections import deque


def getN():
    return int(input())


def getList():
    return list(map(int, input().split()))


import math

n = getN()

match = [0 for i in range((n * (n - 1)) // 2)]
child = [[] for i in range((n * (n - 1)) // 2)]
iriji = [0 for i in range((n * (n - 1)) // 2)]


def toposo(n, iriji, child):
    order = [0 for i in range((n*(n+1))//2)]
    q = deque([])
    for i, iri in enumerate(iriji):
        if iri == 0:
            q.append(i)
            order[i] = 1
    while(q):
        start = q.popleft()
        target = child[start]
        for tgt in target:
            iriji[tgt] -= 1
            if iriji[tgt] == 0:
                q.append(tgt)
                order[tgt] = order[start] + 1

    if sum(iriji) != 0:
        return -1

    else:
        return max(order)


for idd in range(n):
    nums = getList()
    i = idd + 1
    for j, k in zip(nums, nums[1:]):
        ii, j = min(i, j), max(i, j)
        iii, k = min(i, k), max(i, k)
        idx1 = ((j - 1) * (j - 2)) // 2 + (ii - 1)
        idx2 = ((k - 1) * (k - 2)) // 2 + (iii - 1)
        iriji[idx2] += 1
        child[idx1].append(idx2)
        # print(i, j, k)
        # print(idx1, idx2)

#
# print(child)
# print(isroot)
# # sys.exit()
#
# bfs()
# # print("gg")
# ans = 1
# for m in match:
#     if m > ans:
#         ans = m
#     if m == 0:
#         print(-1)
#         sys.exit()
# print(iriji, child)

print(toposo(n, iriji, child))

Measured memory_bytes: 140404
//0:実行モード
//1:開発モード
//2:最終テストモード
const sys_debugMode : number = 0;

function chk(in_data1 : any, in_data2? : any) : void{
	if (sys_debugMode == 0 || sys_debugMode == 2){
		return;
	}
	else if (in_data2 === undefined){
		console.log(in_data1);
	}
	else{
		console.log(in_data1 + "[" + typeof(in_data2) + "] =", in_data2);
	}
}

function prt(in_data : any) : void{
	console.log(in_data);
}

class ParamManager {

	private a_s_inputLines : string[];
	private n_maxLine : number;
	private n_nowLineCnt : number;

	constructor(){
		this.a_s_inputLines = this.inputLines();
		this.n_maxLine = this.a_s_inputLines.length;
		this.descLines();
		this.n_nowLineCnt = 1;
	}
	inputLines(){
		const fs = require('fs');

		let text;
		if(sys_debugMode == 0){
			text = fs.readFileSync("/dev/stdin", 'utf8');
		}
		else{
			text = fs.readFileSync("input.txt", 'utf8');
		}

		const line:string[] = text.toString().replace(/\r/g, "").split('\n');

		return line;
	}
	descLines(){
		chk("ParamManager.a_s_inputLines", this.a_s_inputLines);
	}
	getNextLine(in_s_type?):any{
		if (this.n_nowLineCnt > this.n_maxLine){
			chk("ParamManager.getNextLine","No Next Line!");
			return;
		}
		const s_returnLine:string = this.a_s_inputLines[this.n_nowLineCnt - 1];

		this.n_nowLineCnt++;
		
		if (in_s_type == "n"){
			return parseInt(s_returnLine);
		}
		else if (in_s_type == "a"){
			return s_returnLine.split(" ");
		}
		else if (in_s_type =="an" || in_s_type =="na"){
			const a_s_temp = s_returnLine.split(" ");
			const a_n_temp = a_s_temp.map(function(str){return Number(str)});
			return a_n_temp;
		}
		else{
			return s_returnLine;
		}
	}
}
const paramManager = new ParamManager();
//==================================================
//C - gacha
//==================================================
class Param{
	kujibikiKaisu:number;
	aKeihin:string[];

	constructor(){
		chk("--------------------------------------------------");
		chk("パラメータ");
		//くじ引きをN回行い
		this.kujibikiKaisu = paramManager.getNextLine("n");
		//i回目には種類が文字列 Siで表される景品を手に入れました
		this.aKeihin = [];
		for(let loopKujibikiCnt = 1 ; loopKujibikiCnt <= this.kujibikiKaisu ; loopKujibikiCnt++){
			const keihin:string = paramManager.getNextLine();
			this.aKeihin.push(keihin);
		}

		chk(this);
	}
}
const param = new Param();
//==================================================
class Manager{

	constructor(){

		this.main();
	}

	main():void{
		chk("--------------------------------------------------");
		chk("main");

		//何種類の景品を手に入れましたか？
		const aKeihinDistinct:string[] = Array.from(new Set(param.aKeihin));
		chk("aKeihinDistinct",aKeihinDistinct);

		const resultNum:number = aKeihinDistinct.length;
		prt(resultNum);
	}

}
const manager = new Manager();
//==================================================

Measured memory_bytes: 63624
(*
ocamlfind ocamlopt -package batteries -linkpkg main.ml -o a.out
*)
open Batteries

let a, b = Scanf.sscanf (read_line ()) "%d %d" ( fun a b -> a, b)

let () = 
        (
                let ez = (a < 0) && (b > 0) in
                let nn = 
                        (
                                if a < 0 && b < 0 then
                                        (abs a) - (abs b) + 1
                                else
                                if a < 0 then
                                        (abs a)
                                else
                                        0
                        ) in
                        if ez then
                                "Zero"
                        else
                        if nn mod 2 = 0 then
                                "Positive"
                        else
                                "Negative"
        ) |> Printf.printf "%s\n"



Measured memory_bytes: 1024
w = (1..gets.to_i).to_a
n = gets.to_i
n.times do
  a,b = gets.split(",").map(&:to_i)
  c = w[a - 1]
  w[a - 1] = w[b - 1]
  w[b - 1] = c
end
w.size.times do |i|
  puts w[i]
end

Measured memory_bytes: 8560
from itertools import permutations

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

s = []
for i in permutations(sorted(a)):
    s.append(list(i))

for i in range(len(s)):
    if s[i] == a:
        if i > 0:
            print(*s[i-1])
        print(*s[i])
        if i < len(s)-1:
            print(*s[i+1])
        break


Measured memory_bytes: 78352
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
static const int MAX_N = 100;

int N;
int a[MAX_N];

int main(){
	int max_a = -100, min_a = 100;
	cin >> N;
	for(int i = 0; i < N; i++){
		cin >> a[i];
		if(a[i] > max_a) max_a = a[i];
		if(a[i] < min_a) min_a = a[i];
	}
	ll min_cost = 10000000;
	for(int j = min_a; j <= max_a; j++){
		ll cost = 0;
		for(int i = 0; i < N; i++){
			cost += (a[i] - j) * (a[i] - j);
		}
		if(cost < min_cost) min_cost = cost;
	}
	cout << min_cost << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  cin >> N;
  vector<long long> data(N + 1);
  data[0] = 2;
  data[1] = 1;
  for (int i = 2; i < N + 1; i++) {
  	data[i] = data[i - 1] + data[i - 2];
  }

  cout << data[N];
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,no-stack-protector,fast-math")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
const int N = 2e5 + 5, M = 2 * N + 5;

int main(){
#ifndef ONLINE_JUDGE
    freopen("input.in", "r", stdin);
#endif
    ll a;
    ld b;
    cin >> a >> b;

    ll B = b;
    ld dif = b - 1.0L * B;

//    cout << dif << endl;

    ll res = a * B;

    ll tmp = (dif * 1.0L * a + 1e-3);

//    cout << tmp << endl;

    cout << res + tmp << endl;
}


Measured memory_bytes: 3712
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <queue>
using namespace std;
priority_queue<int> q;
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	long long ans=0;
	for (int i=1,a;i<=n;i++) scanf("%d",&a),q.push(a),ans+=a;
	int top;
	while (m--)
	{
		top=q.top();
		ans-=(top-(top>>1));
		q.pop();
		q.push(top>>1);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const ll MOD = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;
const ld pi = 3.141592653589793;

void solve(){
    ld a,b,x;
    cin >> a >> b >> x;
    ld v = a*a*b;
    if(x>=v/2){
    ld h = (v-x)/a/a*2;
    cout << fixed <<setprecision(10)<<atan(h/a)*180/pi;}
    else {
    ld c = x/b/a*2;
    //cout << c<<endl;
    cout << fixed <<setprecision(10)<<90-atan(c/b)*180/pi;
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}


Measured memory_bytes: 3876
#include <map>
#include <set>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <cstring>
#include <cstdlib>
#include <algorithm>

using namespace std;

#define mp make_pair
#define pb push_back
#define x first
#define y second

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vpii;

int main()
{
	int a,b;scanf("%d%d",&a,&b);
	if (a%b) printf("%d\n",a); else puts("-1");
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define MOD 1e9 + 7
#define PI 3.141592653589793238
#define pb push_back
#define ALL(V) (V).begin(), (V).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long long int lint;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<int> VI;
ll gcd(ll a, ll b) { return (a % b == 0 ? b : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll char_to_ll(char c) { return (int)(c - '0'); }
ll string_to_ll(string s) { return char_to_ll(atoi(s.c_str())); }
bool is_prime(ll x){ if(x <= 1) return false; for(ll i = 2; sqrt(i) <= x; i++) if(x % i == 0) return false; return true; }

int main(){
    ll N, ans = 0;
    string X;
    cin >> N;
    vector<string> s(N);
    VL t(N);
    for (int i = 0; i < N; i++) cin >> s[i] >> t[i];
    cin >> X;

    bool start = false;
    for (int i = 0; i < N; i++){
        if(start) ans += t[i];
        if(s[i] == X) start = true;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import sys

w, a, b = map(int, sys.stdin.readline().split())

def main():
    if a + w < b:
        return b - (a + w)
    elif b + w < a:
        return a - (b + w)
    else:
        return 0

if __name__ == '__main__':
    ans = main()
    print(ans)

Measured memory_bytes: 3060
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Feb  9 06:50:02 2019

@author: shinjisu
"""


def getIntList(): return [int(x) for x in input().split()]


def getIntMat(n):
    mat = []
    for i in range(n):
        mat.append(getIntList())
    return mat


def db(x):
    global debug
    if debug:
        print(x)


def solve():
    if c[1][0] - c[0][0] != c[1][1] - c[0][1] or \
        c[1][0] - c[0][0] != c[1][2] - c[0][2]:
        return False
    if c[2][0] - c[0][0] != c[2][1] - c[0][1] or \
        c[2][0] - c[0][0] != c[2][2] - c[0][2]:
        return False
    return True


debug = False
c = getIntMat(3)
db(c)
if solve():
    print('Yes')
else:
    print('No')


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


int main(){
  string s , t , u;
  cin>>s>>t;
  u = t+s;
  cout <<u<<endl;
}


Measured memory_bytes: 256
/*https://atcoder.jp/contests/dp/tasks/dp_i*/
#include <iostream>
#include <vector>
using namespace std;
int main(){
	int n;
	cin >> n;
	vector<double> head(n);
	for (int i = 0; i < n; i++) cin >> head[i];
	vector<double> dp(n + 1, 0);
	dp[0] = 1;
	/*
	3
	0.30 0.60 0.80
	*/
	for (int i = 0; i < n; i++){
		for (int j = i + 1; j >= 0; j--){
			dp[j] = (j == 0 ? 0 : dp[j - 1] * head[i]) + dp[j] * (1 - head[i]);	
		}
	}

	double res = 0.0;
	for (int i = n; i >= 0; i--){
		int tail = n - i;
		if (i > tail) res = res + dp[i];
	}
	printf("%.9f", res);
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  string s;
  cin >> n >> s;
  
  int allr = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'R') allr++;
  }
  
  int ans = 0;
  for (int i = 0; i < allr; i++) {
    if (s[i] == 'W') ans++;
  }
  
  cout << ans << '\n';
}

Measured memory_bytes: 3740
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] ret = new int[2];
            string s1 = Console.ReadLine();
            string s2 = Console.ReadLine();

            uint N = uint.Parse(s1);
            string[] ss = s2.Split(' ');

            int[] num = new int[N];

            for (int i = 0; i < N; i++)
            {
                num[i] = int.Parse(ss[i]);
            }

            Array.Sort(num);
            int max = num[N - 1];
            int cen = max / 2;
            if (max % 2 > 0)
            {
                cen++;
            }
            int tmp = max;

            for (int i = 0; i < N; i++)
            {
                if (num[i] >= cen)
                {
                    if ((cen - tmp) <= (num[i] - cen))
                    {
                        ret[1] = tmp;
                    }
                    else
                    {
                        ret[1] = num[i];
                    }
                    break;
                }
                tmp = num[i];
            }

            ret[0] = max;
            Console.WriteLine(ret[0] + " " + ret[1]);
            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 19296
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5+5;

int main(){
	string s;
	cin >> s;
	bool f = 0,g = 0;
	for(int i = 0;i < 3;++i){
		if(s[i] == 'A') f = 1;
		if(s[i] == 'B') g = 1;
	}
	printf("%s\n",f && g ?"Yes" :"No");
	return 0;
}

Measured memory_bytes: 256
from collections import defaultdict

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

gcd_cnt = defaultdict(int)
ans = 0
k = int(input())
for a in range(1, k+1):
    for b in range(1, k+1):
        gcd_cnt[gcd(a, b)] += 1

for key in gcd_cnt:
    for c in range(1, k+1):
        ans += gcd(c, key) * gcd_cnt[key]
print(ans)

Measured memory_bytes: 9476
#include <stdio.h>

int main() {
  char s[5];
  gets(s);
  if ((s[0] == s[1] && s[2] == s[3] && s[0] != s[2]) ||
  (s[0] == s[2] && s[1] == s[3] && s[0] != s[1]) ||
  (s[0] == s[3] && s[1] == s[2] && s[0] != s[1])) {
    printf("Yes\n");
    return 0;
  }
  printf("No\n");
  return 0;
}


Measured memory_bytes: 128
N = int(input())
TXY = [list(map(int,input().split())) for _ in range(N)]
t = 0
x = 0
y = 0
for txy in TXY:
    T = txy[0]
    X = txy[1]
    Y = txy[2]
    if (T-t) - abs(X-x) - abs(Y-y) >= 0 and ((T-t) - abs(X-x) - abs(Y-y)) % 2 == 0:
        t = T
        x = X
        y = Y
    else:
        print('No')
        exit()
print('Yes')

Measured memory_bytes: 27380
N, M = map(int, input().split())
A = [0] * N
for _ in range(M):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1
    A[a] += 1
    A[b] += 1
if all([i % 2 == 0 for i in A]):
    print('YES')
else:
    print('NO')

Measured memory_bytes: 10680
#include <string>
#include <stdio.h>
#include <algorithm>
#include <iostream>

using namespace std;

int main()
{
	long long n, a, b, result;
	cin >> n >> a >> b;
    long long  q = n / (a + b);
	long long r = n % (a + b);
	result = q * a;
	if (r > a) result += a;
	else result += r;
	cout << result << endl;
}

Measured memory_bytes: 504
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
const double PI=acos(-1);

template<typename T>
istream& operator>> (istream& is, vector<T> &vec){
    for(T& x: vec) is >> x;
    return is;
}

int main(){
    ll h, w, k; cin >> h >> w >> k;
    vector<vector<char>> field(h, vector<char>(w));
    rep(i, h) rep(j, w) cin >> field[i][j];
    ll ans = 0;
    rep(i, pow(2, h)){
        rep(j, pow(2, w)){
            ll black = 0;
            vector<ll> lh, lw;
            rep(l, h) if(i & (1 << l)) lh.push_back(l);
            rep(l, w) if(j & (1 << l)) lw.push_back(l);
            rep(a, h){
                rep(b, w){
                    if(find(lh.begin(), lh.end(), a) != lh.end()) continue;
                    if(find(lw.begin(), lw.end(), b) != lw.end()) continue;
                    if(field[a][b] == '#') black++;
                }
            }
            if(black == k) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4104
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

using ul = unsigned long long;
constexpr int N = 512;
int s[2][N];
ul u[2][N], a[N][N] = {};

void prt(int n){
	REP(i, n){
		REP(j, n){
			printf("%llu ", a[i][j]);
		}
		printf("\n");
	}
}

enum Quantifier {
	ALL, EXISTS,
};
pair<Quantifier, bool> get_constraints(bool p, bool q){
	if(!p && !q) return {EXISTS, 0};
	if( p && !q) return {ALL, 0};
	if( p &&  q) return {EXISTS, 1};
	if(!p &&  q) return {ALL, 1};
	exit(1);  // unreachable
}

bool b[N][N];
bool c[N], d[N];
vector<int> f, g;
void rev(){
	REP(i, N) REP(j, i) swap(b[i][j], b[j][i]);
	swap(c, d);
	swap(f, g);
}
#define REV for(int h = 0; h < 2; rev(), h++)

int main(){
	int n; scanf("%d", &n);
	REP(h, 2) REP(i, n) scanf("%d", s[h]+i);
	REP(h, 2) REP(i, n) scanf("%llu", u[h]+i);
	REP(k, 64){
		ul m = 1uLL << k;

		REV {
			f.clear();
			REP(i, n){
				auto [q, v] = get_constraints(s[h][i], u[h][i] & m);
				if(q == ALL) REP(j, n) b[i][j] = v;
				else{
					c[i] = v;
					f.EB(i);
				}
			}
		}

		REV {
			if((int)f.size() != 1) continue;
			int ii = f[0];
			for(int j : g){
				bool ex = false;
				REP(i, n) if(i != ii) ex |= b[i][j] == d[j];
				if(ex) b[ii][j] = c[ii];
				else b[ii][j] = d[j];
			}
			f.clear();
		}

		REP(i, (int)f.size()){
			REP(j, (int)g.size()){
				b[f[i]][g[j]] = (i+j)%2;
			}
		}

		// REP(i, n){
		// 	REP(j, n) DEBUG("%d ", b[i][j]);
		// 	DEBUG("\n");
		// }
		// DEBUG("\n");

		REP(i, n) REP(j, n) if(b[i][j]) a[i][j] |= m;
	}

	REP(h, 2){
		REP(i, n){
			ul p[2] = {~0ull, 0};
			REP(j, n){
				p[0] &= a[i][j];
				p[1] |= a[i][j];
			}
			if(p[s[h][i]] != u[h][i]) {
#ifdef LOCAL_DEBUG
				DEBUG("h=%d, i=%d, p=[%llu, %llu], c=[%d, %llu]\n", h, i, p[0], p[1], s[h][i], u[h][i]);
				prt(n);
#endif
				printf("-1\n");
				return 0;
			}
		}
		REP(i, N) REP(j, i) swap(a[i][j], a[j][i]);
	}

	prt(n);
}




Measured memory_bytes: 7852
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdlib.h>
#define MOD 1000000007
void input_array(int how_data,int *data);
int get_random(int min, int max);
int factorial(int n);
int qsort_09(const int *sys1 , const int *sys2);
int qsort_90(const int *sys1 , const int *sys2);

int main(void){
    int how_kyaku;
    int bus_max;
    int angry_time;
    scanf("%d %d %d",&how_kyaku,&bus_max,&angry_time);
    int kyaku_time[how_kyaku];
    input_array(how_kyaku,kyaku_time);
    qsort(kyaku_time,how_kyaku,sizeof(int),(int (*)(const void *,const void *))qsort_09);
    int ans=0;
    int bus_count=0;
    int fast_angry=0;
    int loop1;
    for(loop1=0;loop1<how_kyaku;loop1++){
        if(bus_count==0){
            ans++;
            fast_angry=kyaku_time[loop1];
            bus_count++;
            //printf("新規\n");
        }else if(kyaku_time[loop1]<=fast_angry+angry_time && bus_count<bus_max){
            bus_count++;
            //printf("客追加\n");
        }else{
            ans++;
            bus_count=1;
            fast_angry=kyaku_time[loop1];
            //printf("バス追加\n");
        }
    }
    printf("%d\n",ans);
    
    return 0;
}





//how_data個の配列data[]に標準入力
//input_array(how_data,data);
void input_array(int how_data,int *data){
    int loop;
    for(loop=0;loop<how_data;loop++){
        scanf("%d",&data[loop]);
    }
}

int get_random(int min, int max){   //指定の範囲から乱数を1つ返すやつ
    //srand((unsigned int)time(0));   //現在時刻で疑似乱数初期化
    rand();rand();rand();rand();    //乱数を空打ち
    return (rand()%(max+1-min))+min;
}


int factorial(int n){//n!のMOD10^9+7を返すやつ
    unsigned long long int ret=1;
    for(int i=1;i<=n;i++)ret=(ret*i)%1000000007;
    return (int)ret;
}

int qsort_09(const int *sys1 , const int *sys2){ //小さいのが上にくるやつ
    //qsort(data,how_data,sizeof(int),(int (*)(const void *,const void *))qsort_09);
    if(*sys1<*sys2){
        return -1;
    }else if(*sys1==*sys2){
        return 0;
    }else{
        return 1;
    }
}

int qsort_90(const int *sys1 , const int *sys2){ //大きいのが上にくるやつ
    //qsort(data,how_data,sizeof(int),(int (*)(const void *,const void *))qsort_90);
    if(*sys1<*sys2){
        return 1;
    }else if(*sys1==*sys2){
        return 0;
    }else{
        return -1;
    }
}



Measured memory_bytes: 892
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
using namespace __gnu_pbds;  
using namespace std;



typedef tree<long long, null_type, less<long long>, rb_tree_tag, 
             tree_order_statistics_node_update> 
    new_data_set; 
    
    
    
//defines
typedef long long ll;
typedef long double ld;
ll a,b,c,n,m,k,t=1;

void solve()
{
    map<string,ll>f;
    cin>>n;
    string s;
    while(n--)
    {
        cin>>s;
        f[s]++;
    }
    cout<<"AC x "<<f["AC"]<<"\n";
    cout<<"WA x "<<f["WA"]<<"\n";
    cout<<"TLE x "<<f["TLE"]<<"\n";
    cout<<"RE x "<<f["RE"]<<"\n";
 
}

int32_t main()
{
#ifdef ONPC
    freopen("input.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

  //cin>>t;
    while(t--)
    {
        solve();
    }
  //cout<<sum;
        
    return 0;
}

Measured memory_bytes: 3664
/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby, 
C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <stdio.h>
#include <string.h>

int main()
{
    char a[100];
    int i;
    
    scanf("%s",a);
    
    for (i=0;i<strlen(a);i++)
    {
        printf("x");
    }
}


Measured memory_bytes: 128
#!/usr/bin/env python3
import sys
import math

def solve(H: int, W: int):
    if H==1 or W == 1:
        print(1)
    else:
        evenRow = math.ceil(W/2)
        oddRow = math.floor(W/2)
        r = H//2
        extra= evenRow if H %2==1 else 0
        print(r*evenRow+r*oddRow+extra)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    solve(H, W)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <time.h>
int main(){
    int n,m,i,ans=0,penal=0,pen[100010]={},flag[100010]={},p[100010]={};
    char s[100010][2]={{}};
    scanf("%d %d",&n,&m);
    for(i=0; i<m; i++){
        scanf("%d %s",&p[i],s[i]);
        if(s[i][0]=='A'){
            if(flag[p[i]]==0)ans++;
            flag[p[i]]=1;
        }
        if(flag[p[i]]==0 && s[i][0]=='W')pen[p[i]]++;
    }
    for(i=0; i<=n; i++){
        if(flag[i]==0)pen[i]=0;
        penal+=pen[i];
    }
    printf("%d %d",ans,penal);
    return 0;
}

Measured memory_bytes: 3064
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    for(int i=1;i<=1000;i++)
    {
        int a_=i*8/100,b_=i*10/100;
        if(a_==a&&b_==b)
        {
            printf("%d\n",i);
            return 0;
        }
    }
    puts("-1");
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <numeric>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef deque<ll> dll;
typedef pair<string, int> P;
#define mod 1e9 + 7;
ll gcd(ll x, ll y)
{
	ll r;
	while ((r = x % y) != 0)
	{
		x = y;
		y = r;
	}
	return y;
}
ll lcm(ll x, ll y)
{
	x /= gcd(x, y);
	y /= gcd(x, y);
	return (x * y);
}


int main()
{
	ios_base::sync_with_stdio(false);
	ll n, a, b, ans = 0;
	cin >> n;
	vi v(n);
	bool x = false;
	rep(i, n) {
		cin >> v[i];
		if (x&&v[i] > 0) {
			v[i]--;
			ans++;
		}
		ans += v[i] / 2;
		if (v[i] % 2 == 0) x = false;
		else x = true;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define all(in) in.begin(), in.end()
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
signed main(){
    int N; cin >> N;
    map<int, int> mp;
    rep(i,N){
        int t; cin >> t;
        mp[t]++;
    }
    int ans = 0;
    for(auto itr : mp)  ans += (itr.second % 2);
    cout << ans << endl;
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
 
int main() {
    int n,k;
    cin >> n >> k;
    vector<vector<int>> table = vector<vector<int>>(2*k, vector<int>(2*k, 0));
    int x,y;
    char t;
    for(int i=0;i<n;i++){
        cin >> x >> y >> t;
        if(t=='B'){
            table[x%(2*k)][y%(2*k)]++;
        }else{
            table[(x+k)%(2*k)][y%(2*k)]++;
        }
    }
 
 
    vector<vector<int>> n_table = vector<vector<int>>(3*k+1, vector<int>(3*k+1, 0));
 
    for(int i=0;i<k;i++){
        for(int j=0;j<k;j++){
            n_table[i+1][j+1] = table[i][j];
            n_table[2*k+i+1][j+1] = table[i][j];
            n_table[i+1][2*k+j+1] = table[i][j];
            n_table[2*k+i+1][2*k+j+1] = table[i][j];
            n_table[k+i+1][j+1] = table[k+i][j];
            n_table[k+i+1][2*k+j+1] = table[k+i][j];
            n_table[i+1][k+j+1] = table[i][k+j];
            n_table[2*k+i+1][k+j+1] = table[i][k+j];
            n_table[k+i+1][k+j+1] = table[k+i][k+j];
        }
    }
    vector<vector<int>> i_table = vector<vector<int>>(3*k+1, vector<int>(3*k+1, 0));
    for(int i=0;i<3*k+1;i++){
        for(int j=1;j<3*k+1;j++){
            i_table[i][j] += i_table[i][j-1] + n_table[i][j];
        }
    }
    for(int i=1;i<3*k+1;i++){
        for(int j=0;j<3*k+1;j++){
            i_table[i][j] += i_table[i-1][j];
        }
    }
    int ans = 0;
    int hope1,hope2;
    for(int i=0;i<k+1;i++){
        for(int j=0;j<k+1;j++){
            hope1 = i_table[k+i][k+j] - i_table[k+i][j] - i_table[i][k+j] + i_table[i][j];
            hope2 = i_table[2*k+i][2*k+j] - i_table[2*k+i][k+j] - i_table[k+i][2*k+j] + i_table[k+i][k+j];
           
            int hope_sum = max(hope1+hope2,n-(hope1+hope2));
            ans = max(ans,hope_sum);
        }
    }
 
    cout << ans << "\n";
}

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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

struct edge{
  ll u,v,cost;
};
bool operator<(const edge& x,const edge& y){
  return x.cost < y.cost;
}

struct UnionFind{
  vector<int> v;
  vector<bool> done;
  UnionFind(int n) : v(n, -1), done(n, false) {}
  void init(){ for(int i = 0;i < (int)v.size();i++)v[i]=-1; }
  int find(int x) { return v[x] < 0 ? x : find(v[x]); }
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (-v[x] < -v[y]) swap(x, y);
    v[x] += v[y]; v[y] = x;
    done[x]=done[x]|done[y];
    return true;
  }
  bool root(int x) { return v[x] < 0; }
  bool same(int x, int y) { return find(x) == find(y); }
  int size(int x) { return -v[find(x)]; }
};

ll n,h,w;

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

  cin>>n>>h>>w;
  vector<edge> vs;
  rep(i,n){
    ll r,c,a;
    cin>>r>>c>>a;
    r--;c--;
    vs.push_back((edge){r,c+h,a});
  }
  sort(all(vs)); reverse(all(vs));

  UnionFind uf(h+w);
  ll res=0;
  rep(i,n){
    if(!uf.same(vs[i].u,vs[i].v)){
      if(uf.done[uf.find(vs[i].u)]&&uf.done[uf.find(vs[i].v)]){
        continue;
      }
      uf.unite(vs[i].u,vs[i].v);
      res+=vs[i].cost;
    }else{
      if(!uf.done[uf.find(vs[i].u)]){
        uf.done[uf.find(vs[i].u)]=true;
        res+=vs[i].cost;
      }
    }
  }
  cout<<res<<endl;

  return 0;
}


Measured memory_bytes: 5048