akhauriyash/Code-Regression huggingface dataset:
/*
Sometimes I feel like I don't have a partner
Sometimes I feel like my only friend
It's the city I live in, the City of Angels
Lonely as I am, together we cry

I drive on her streets 'cause she's my companion
I walk through her hills cause she knows who I am
She sees my good deeds and she kisses me windy
I never worry, now that is a lie

I dont ever wanna feel like I did that day
Take me to the place I love, take me all the way
I dont ever wanna feel like I did that day
Take me to the place I love, take me all the way
Yeah, yeah, yeah

It's hard to believe that there's nobody out there
It's hard believe that I'm all alone
At least I have her love the city, she loves me
Lonely as I am, together we cry

And I dont ever wanna feel like I did that day
Take me to the place I love, take me all the way
And I dont ever wanna feel like I did that day
Take me to the place I love, take me all the way
Yeah, yeah, yeah, oh, no, no, no
Yeah, yeah, love me I say yeah, yeah

Under the bridge downtown is where I drew some blood
Under the bridge downtown I could not get enough
Under the bridge downtown forgot about my love
Under the bridge downtown I gave my life away
Yeah, yeah, yeah

Yeah, yeah, yeah, oh, no, no, no
Yeah, yeah, oh, no, no
I said yea yeah, Ill stay
*/

//#pragma comment(linker, "/STACK:16777216")
#define _CRT_SECURE_NO_WARNINGS

#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>
#include <memory.h>
#include <assert.h>

#define y0 sdkfaslhagaklsldk
#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd

#define eps 1e-9
#define M_PI 3.141592653589793
#define bs 1000000007
#define bsize 350

using namespace std;

const int INF = 1e9;
const int N = 500031;

string st;
int k;

int main(){
	//freopen("fabro.in","r",stdin);
	//freopen("fabro.out","w",stdout);
	//freopen("F:/in.txt", "r", stdin);
	//freopen("F:/output.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
	//cin.tie(0);
	
	cin >> st;
	cin >> k;
	for (int i = 0; i < st.size(); i++)
	{
		int need = ('z' - st[i]+1);
		if (st[i] == 'a')
			continue;

		if (need>k)
			continue;
		while (st[i] != 'a'&&k>0)
		{
			if (st[i] == 'z')
				st[i] = 'a';
			else
				st[i]++;
			--k;
		}
	}

	if (k > 0)
	{
		k %= 26;
		for (int i = 0; i < k; i++)
		{
			if (st[st.size() - 1] == 'z')
				st[st.size() - 1] = 'a';
			else
				st[st.size() - 1]++;
		}
	}
	cout << st << endl;

	cin.get(); cin.get();
	return 0;
}

Measured memory_bytes: 592
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
using namespace std;
 
int main(){
    long long X;
    cin >> X;

    long long b = 100;

    int c = 0;
    while(b < X){
        b *= 1.01;
        c++;
    }

    cout << c << endl;
    return 0;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
    ost<<"{"<<p.first<<","<<p.second<<"}";
    return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
    ost<<"{";
    for(int i=0;i<v.size();i++){
        if(i)ost<<",";
        ost<<v[i];
    }
    ost<<"}";
    return ost;
}

signed main(){
    int N,L;
    cin>>N>>L;
    int sum=L*N+N*(N-1)/2;
    if(L<=0&&L+N-1>=0){
        cout<<sum<<endl;
    }
    else if(L<0){
        cout<<sum-(L+N-1)<<endl;
    }
    else{
        cout<<sum-(L)<<endl;
    }
    return 0;
}

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

int main(){
    int n, k;
    cin >> n >> k;

    vector<double> prob(n,1);
    for(int i=0; i<n; i++){
        int product = i+1;
        while(product < k){
            prob[i] *= 0.5;
            product *= 2;
            //cout << product << " ";
        }
    }

    double total = 0;
    for(int i=0; i<n; i++){
        total += prob[i];
    }
    cout << fixed << setprecision(10) << total / (double)n << endl;
    return 0;
}

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int> > A(n, vector<int>(m, 0));

  vector<int> b(m, 0);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      cin >> A[i][j];
    }
  for (int i = 0; i < m; i++)
    cin >> b[i];
  vector<int> c(n, 0);

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      c[i] += A[i][j] * b[j];
    }
  }
  for (int i = 0; i < n; i++)
    cout << c[i] << endl;
  return 0;
}


Measured memory_bytes: 3224
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	inputN = parseInt(input[0]);
	inputD = input[1].split(" ");
	// temp = inputN * (inputN -1) / 2

	temp = 0;
	for(var i=0;i < inputD.length;i++){
		temp2 = 0;
		for(var j=i+1;j < inputD.length;j++){
			temp2 += parseInt(inputD[j]);
		}
		temp += parseInt(inputD[i]) * temp2;
	}
	console.log(temp);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX = 3050;
int r,c,k,x,y,val;
ll dp[MAX][MAX][4];
ll room[MAX][MAX];
int main() {
    cin>>r>>c>>k;
    while(k--){
        cin>>x>>y>>val;
        room[x][y]=val;
    }
    for(int i=1;i<=r;i++){
        for(int j=1;j<=c;j++){
            for(int k=1;k<=3;k++){
                dp[i][j][k]=max(max(dp[i-1][j][3],dp[i][j-1][k]),room[i][j]+max(dp[i][j-1][k-1],dp[i-1][j][3]));
            }
        }
    }
    cout<<dp[r][c][3];
    return 0;
}


Measured memory_bytes: 361008
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<climits>
#define mod 1000000007
typedef long long ll;
using namespace std;

ll gcd(ll a, ll b){
  if(b==0) return a;
  return gcd(b, a%b);
}

int main(){
  ll a,b;
  cin >> a >> b;
  cout << a / gcd(a,b) * b << endl;
  return 0;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        sa: String,
        sb: String,
        sc: String
    }
    println!("{}{}{}",&sa[..1],&sb[1..2],&sc[2..]);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const int INF = 2000000000;
using namespace std;

const int MAX_V = 100;

vector<int> g[MAX_V]; //??°??????
vector<int> tp; //????????????????????????????????????

//false?????????????????????????????????
bool visit(int v, vector<int> &color){
    color[v] = 1;
    rep(i,g[v].size()){
        int d = g[v][i];
        if(color[d] == 2) continue;
        if(color[d] == 1) return false;
        if(not visit(d, color)) return false;
    }
    tp.emplace_back(v);
    color[v] = 2;
    return true;
}

bool topologialSort(int v){
    vector<int> color(v);
    rep(i,v){
        if(not color[i] && not visit(i, color)) return false;
    }
    reverse(all(tp));
    return true;
}

int main(){
    int v, e;
    cin >> v >> e;
    rep(i,e){
        int s, t;
        cin >> s >> t;
        g[s].emplace_back(t);
    }
    if(topologialSort(v)) cout << 0 << endl;
    else cout << 1 << endl;
}

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

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define ALLTRUE(xs) all_of(ALL(xs),[](bool x){return x;})
#define AND(x,y,z) set_intersection((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define ANYTRUE(xs) any_of(ALL(xs),[](bool x){return x;})
#define CONCAT(x,y) (x).insert((x).end(),(y).begin(),(y).end())
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define DUMPP(xs) for (auto x:xs) cout<<'('<<x.first<<','<<x.second<<')';cout<<endl
#define FOR(i,a,b) for (int i=(int)(a);i<(int)(b);++i)
#define OR(x,y,z) set_union((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define OUT(x) cout<<x<<endl
#define REP(i,n) FOR(i,0,n)

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

struct edge { int to,cost; };

int main() {
  int N;cin>>N;
  vector<int> as(N);
  REP(i,N) cin>>as[i];
  int ans = INT_MAX;
  FOR(x,-100,101) {
    int tmp = 0;
    REP(i,N) tmp += pow(as[i]-x,2);
    ans = min(ans,tmp);
  }
  OUT(ans);

  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <complex>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <iterator>

using namespace std;

#define dump(n) cout<<"# "<<#n<<'='<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define iter(c) __typeof__((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
#define all(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;

const int INFTY=1<<29;
const double EPS=1e-9;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
	os<<'[';
	rep(i,a.size()) os<<(i?" ":"")<<a[i];
	return os<<']';
}

pair<int,vi> parse(string& s,vi& a,int i)
{
	if(isdigit(s[i])){
		vi res(16); res[a[s[i]-'0']]=1;
		return mp(i+1,res);
	}
	
	i++;
	pair<int,vi> p1=parse(s,a,i); i=p1.first+1;
	pair<int,vi> p2=parse(s,a,i); i=p2.first+1;
	
	vi res(16);
	rep(j,16) rep(k,16){
		res[j&k]+=p1.second[j]*p2.second[k];
		res[j|k]+=p1.second[j]*p2.second[k];
		res[j^k]+=p1.second[j]*p2.second[k];
	}
	return mp(i,res);
}

int main()
{
	for(string s;getline(cin,s),s!="END";cin.ignore()){
		int n; cin>>n;
		vi a(n);
		rep(i,n) rep(j,4){
			int x; cin>>x;
			a[i]|=x<<j;
		}
		
		rep(i,s.size()) if(isdigit(s[i])) s[i]--;
		cout<<parse(s,a,0).second[15]<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 1236
#include<stdio.h>
int main()
{
    int a,b,c,d,e,f;
    scanf("%d %d %d",&a,&b,&c);
    d=a+b;
    e=a+c;
    f=b+c;
    if(c==d|e==b|f==a)
    {
        printf("Yes");
    }
    else
        printf("No");
}


Measured memory_bytes: 128
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/multiprecision/cpp_dec_float.hpp>
//namespace mp=boost::multiprecision;
//#define mulint mp::cpp_int
//#define mulfloat mp::cpp_dec_float_100
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
//constexpr int MOD=1000000007;
constexpr int MOD=998244353;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;

int main(void){
    int N;
    cin >> N;
    int A[N],B[N];
    rep(i,N) cin >> A[i];
    rep(i,N) cin >> B[i];
    int ans=0;
    rep(i,29){
        int a[N],b[N];
        rep(j,N) a[j]=A[j]%(1<<(i+1)),b[j]=B[j]%(1<<(i+1));
        sort(b,b+N);
        lint cnt=0;
        rep(j,N){
            cnt+=upper_bound(b,b+N,(1<<(i+1))-a[j]-1)-lower_bound(b,b+N,(1<<i)-a[j]);
            cnt+=upper_bound(b,b+N,(1<<(i+2))-a[j]-1)-lower_bound(b,b+N,3*(1<<i)-a[j]);
        }
        if(cnt%2) ans+=(1<<i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 6724
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

struct Combi
{
	vector<int> fact;
	vector<int> ifact;
	vector<int> inv;
	vector<int> pow2;
	const int MOD = (1e9 + 7);
	int add(int a, int b)
	{
		a+=b;
		while(a>=MOD) a-=MOD;
		return a;
	}
	int mult(int a, int b)
	{
		return (a*1LL*b)%MOD;
	}
	int modpow(int a, int b)
	{
		int r=1;
		while(b)
		{
			if(b&1) r=mult(r,a);
			a=mult(a,a);
			b>>=1;
		}
		return r;
	}
	int choose(int a, int b)
	{
		if(a<b) return 0;
		if(b==0) return 1;
		if(a==b) return 1;
		return mult(fact[a],mult(ifact[b],ifact[a-b]));
	}
	int inverse(int a)
	{
		return modpow(a,MOD-2);
	}
	void init(int _n)
	{
		fact.clear(); ifact.clear(); inv.clear(); pow2.clear();
		fact.resize(_n+1);
		ifact.resize(_n+1);
		inv.resize(_n+1);
		pow2.resize(_n+1);
		pow2[0]=1;
		ifact[0]=1;
		fact[0]=1;
		for(int i=1;i<=_n;i++)
		{
			pow2[i]=add(pow2[i-1],pow2[i-1]);
			fact[i]=mult(fact[i-1],i);
		}
		ifact[_n] = inverse(fact[_n]);
		for(int i=_n-1;i>=1;i--)
		{
		    ifact[i] = mult(ifact[i + 1], i + 1);
		}
		for(int i=1;i<=_n;i++)
		{
		    inv[i] = mult(fact[i-1],ifact[i]);
		}
	}
};

int dp[2005][2005];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	Combi combi;
	combi.init(4001001);
	int n,k; cin>>n>>k;
	if(k==1){cout<<1<<'\n'; return 0;}
	dp[0][0]=1;
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<=i;j++)
		{
			dp[i][j]=dp[i-1][j];
			if(j>0) dp[i][j]=combi.add(dp[i][j],combi.mult(dp[i][j-1],combi.choose((n-j+1)*k-(i-j+1)-1,k-2)));
		}
	}
	cout<<combi.mult(dp[n][n],combi.fact[n])<<'\n';
}


Measured memory_bytes: 77568
#[allow(unused_imports)]
use std::cmp::Reverse;

#[allow(unused_imports)]
use proconio::{fastout, input, marker::Chars};

#[allow(unused_imports)]
use itertools::Itertools;

#[fastout]
pub fn main() {
    input! {
        n: usize,
        happinesses: [(i64, (i64, i64)); n],
    }

    let (a, happinesses): (Vec<i64>, Vec<(i64, i64)>) = happinesses.into_iter().unzip();
    let (b, c): (Vec<i64>, Vec<i64>) = happinesses.into_iter().unzip();

    let mut dp = vec![vec![0; n]; 3];
    dp[0][0] = a[0];
    dp[1][0] = b[0];
    dp[2][0] = c[0];
    for i in 1..n {
        dp[0][i] = dp[1][i - 1].max(dp[2][i - 1]) + a[i];
        dp[1][i] = dp[2][i - 1].max(dp[0][i - 1]) + b[i];
        dp[2][i] = dp[0][i - 1].max(dp[1][i - 1]) + c[i];
    }
    println!("{}", dp[0][n - 1].max(dp[1][n - 1].max(dp[2][n - 1])));
}


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

#define MAX_LEN 2000000
#define MAX_VAL 100001

void countingSort(int n,int A[],int B[], int C[]){
	int i;
	for(i=0;i<=MAX_VAL;i++){
		C[i]=0;
	}
	for(i=0;i<n;i++){
		C[A[i]]++;
	}
	for(i=1;i<=MAX_VAL;i++){
		C[i]=C[i]+C[i-1];
	}

	for(i=n-1;i>=0;i--){
		B[C[A[i]]-1]=A[i];
		C[A[i]]--;
	}
}

int main(){
	
	int n, A[MAX_LEN],B[MAX_LEN],C[MAX_VAL+1];
	
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> A[i];
	}

	countingSort(n,A,B,C);
	
	cout << B[0];
	for(int i=1;i<n;i++){
		cout << " " << B[i];
	}
	cout << endl;

	return 0;
}



Measured memory_bytes: 19120
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
template<class T> inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
//グリッド：（典型）dp,dfs,bfs,最短経路,その他
int main(){
    ll n;cin>>n;
    string s;cin>>s;
    vl num;
    ll cnt=0;
    ll cntR=0,cntL=0;
    rep(i,n){
        if(s[i]=='('){
            cntR++;
        }
        if(s[i]==')'){
            if(cntR>0) cntR--;
            else cntL++;
        }
    }
    string ans=s;
    string ansL="",ansR="";
    rep(i,cntL) ansL+='(';
    rep(i,cntR) ansR+=')';
    ans=ansL+ans+ansR;
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;

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

  int n, m;
  cin >> n >> m;

  vector<bool> y(n, true);
  vector<int> x(n, 0);
  int ac = 0, pen = 0;
  for (int i = 0; i < m; ++i) {
    int p;
    string s;
    cin >> p >> s;
    --p;
    if (y[p]) {
      if (s == "WA") {
        ++x[p];
      } else {
        ++ac;
        y[p] = false;
        pen += x[p];
      }
    }
  }

  cout << ac << " " << pen << '\n';

  return 0;
}


Measured memory_bytes: 3704
#include<bits/stdc++.h>
#define ll long long int

using namespace std;

const ll mod=1000000007;
const ll inf=1e18;

int main(){

  ll n;
  string s,t;
  cin >>n >>  s >>t;
  for(ll i=0;i<s.size();i++){
    cout << s[i] << t[i] ;
  }
  cout << endl;

}

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

const int INF = 1e+9;
typedef pair<int, int> P;
typedef pair<int, P> pp;

int N, M;
vector<pp> data;

int main() {
	while(cin >> N >> M && (N || M)){
		int t, s, d;
		bool check[20010] = {0};
		for(int i = 0; i < M; ++i){
			scanf("%d%d%d", &t, &s, &d);
			data.push_back(pp(t, P(s, d)));
		}
		sort(data.begin(), data.end());
		check[1] = true;
		for(int i = 0; i < M; ++i){
			if(check[data[i].second.first])
				check[data[i].second.second] = true;
		}
		int cnt = 0;
		for(int i = 1; i <= N; ++i){
			if(check[i])
				cnt++;
		}
		cout << cnt << endl;
		data.clear();
	}
	return 0;
}

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

bool is_printable(int num)
{
  if (num % 3 == 0)
  {
    return true;
  }
  while (num)
  {
    if (num % 10 == 3)
    {
      return true;
    }
    num /= 10;
  }
  return false;
}

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

  for (int i = 1; i <= num; i++)
  {
    if (is_printable(i))
    {
      cout << " " << i;
    }
  }
  cout << endl;
}



Measured memory_bytes: 3108
#pragma GCC optimize (3)
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/trie_policy.hpp>
#include<ext/pb_ds/priority_queue.hpp>
#define PII pair<int,int>
#define ll long long
#define ull unsigned long long
#define INFI 2147483647
#define INFL 9223372036854775807
#define INFU 18446744073709551615
#define maxn 500005
using namespace std;
using namespace __gnu_pbds;
const double PI=acos(-1.0);
const double eps=1e-6;
char s[maxn];
int n,tl[maxn],tr[maxn];
inline int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0' || ch>'9'){
        if(ch=='-') f=-1;
        ch=getchar();
    }
    while(ch>='0' && ch<='9'){
        x=x*10+ch-'0';
        ch=getchar();
    }
    return x*f;
}
int main()
{
	//ios_base::sync_with_stdio(false);
    //cin.tie(0);
    //cout.tie(0);
    scanf("%s",s+1);
    n=strlen(s+1)+1;
    for(int i=2;i<=n;i++){
        if(s[i-1]=='<') tl[i]=tl[i-1]+1;
        else tl[i]=0;
    }
    for(int i=n-1;i>=1;i--){
        if(s[i]=='>') tr[i]=tr[i+1]+1;
        else tr[i]=0;
    }
    ll ans=0;
	for(int i=1;i<=n;i++) ans+=max(tl[i],tr[i]);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 4608
#include<stdio.h>
#include<iostream>
using namespace std;

int main(){
  int j,k;
  int v[200]={0};
  int a;
  int max=0;

  while((scanf("%d",&a)!=EOF)){
    v[a-1]++;
  }

  for(k=0;k<100;k++){
    if(max < v[k])
      max = v[k];
  }
  for(k=0;k<100;k++){
    if(v[k]==max)
      printf("%d\n",k+1);
  }
  return 0;
}
    
    
  

Measured memory_bytes: 1188
#include <iostream>
#include <string>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <stdlib.h>
#include <vector>
#include <utility>
#include <map>
#define N 1e5+5;
typedef long long ll;
using namespace std;

int main() {
	ll money;
	cin >> money;
	int year=0;
	ll ans=100;
	while (ans<money) {
		year++;
		ans+=ans*0.01;
	}
	cout << year;
	return 0;
}

Measured memory_bytes: 3636
#include <algorithm>
#include <bits/stdc++.h>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0; i != n; ++i)
#define REPR(i, n) for(int i = n - 1; i != -1; --i)
#define FOR(i, a, b) for(int i = a; i != b; ++i)
#define RBF(i, n) for(auto &i : n)
#define ABS(n) (n < 0 ? -n : n)
#define MIN(a, b) (a < b ? a : b)
#define MAX(a, b) (a > b ? a : b)
#define IN(n) (cin >> n)
#define OUT(n) (cout << n << "\n")
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define PB push_back
#define MP make_pair
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define SORTR(c) sort((c).begin(),(c).end(),greater<int>())

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

using namespace std;
using ll = long long;

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


int Main() {
  int n;
  IN(n);
  if(n%2==1){
    OUT("No");
    return 0;
  }
  string S;
  IN(S);
  int cnt=0;
  FOR(i,0,n/2){
    if(S[i] == S[i + (n/2)]) cnt+=1;
  }
  if(cnt == n/2) OUT("Yes");
  else OUT("No");
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> L(N);
  int sum = 0;
  string ans = "Yes";

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

  for(int i = 0; i < N; i++){
    if(L.at(i) >= sum - L.at(i)){
      ans = "No";
    }
  }

  cout << ans << endl;

}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
from math import sqrt
x = int(input())

def prime(n):
    for i in range(2,int(sqrt(n))+1):
        if n%i==0:
            return False
    return True

for i in range(x,10**6):
    if prime(i):
        print(i)
        exit()

Measured memory_bytes: 38512
/*
　　　∫ ∫ ∫
　　　ノヽ
　　（＿　 ）
　（＿　　　 ）
（＿＿＿＿＿＿ ）
　ヽ(´･ω･)ﾉ　
　　 |　 /
　　 UU
*/
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
using P = pair<ll, ll>;
typedef vector<int> vi;
const int MOD = (int)1e9 + 7;
const ll INF = 1LL << 62;
const int inf = 1<<30;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = s; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end() //コンテナじゃないと使えない!!
#define debug(x) cerr << #x << ": " << x << "\n";
#define mp make_pair
template <typename T>
ostream& operator<<(ostream& os, vector<T> &V){
    int N = V.size();
    REP(i,N){
        os << V[i];
        if (i!=N-1) os << " ";
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, pair<T,T> const&P){
    os << P.first;
    os << " ";
    os << P.second;
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T> &S){
    auto it=S.begin();
    while(it!=S.end()){
        os << *it;
        os << " ";
        it++;
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, deque<T> &q){
    for(auto it=q.begin();it<q.end();it++){
        os<<*it;
        os<<" ";
    }
     os<<endl;
    return os;
}
vector<pair<int,int>> dxdy = {mp(0,1),mp(1,0),mp(-1,0),mp(0,-1)};
//fixed<<setprecision(10)<<ans<<endl;



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H,W;
    cin >> H >> W;
    int N=10;
    vector<vi> costs(N,vi(N));
    REP(i,N)REP(j,N){
        cin >> costs[i][j];
    }
    REP(k,N){
        REP(i,N){
            REP(j,N){
                chmin(costs[i][j],costs[i][k]+costs[k][j]);
            }
        }
    }
    int ans=0;
    int a;
    REP(i,H)REP(j,W){
        cin >> a;
        if (a!=-1)
            ans += costs[a][1];
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define DEBUG 0
#define nl          '\n'
#if     DEBUG
#define trace(var)  {cerr << "Line " << __LINE__ << ": " << #var << "=" << var << nl;}
#else
#define trace(var)	{}
#endif
#define fori(n)			for(int i = 0; i < n; ++i) 
#define forj(n)			for(int j = 0; j < n; ++j)
#define fork(n)			for(int k = 0; k < n; ++k)
#define forl(n)			for(int l = 0; l < n; ++l)

typedef long long ll;typedef pair<int,int> pii;typedef vector<bool> vbool;typedef vector<int> vint;typedef vector<ll> vll;typedef long double ld;typedef vector<vector<int>> vvi;

const ll N = 10010;
const ll INF = 0x3f3f3f3f;
const ll MOD = 1e9 + 7;

struct item {
	ll w,v;
};

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n, W; cin >> n >> W;
	vector<item> bag(n);
	fori(n) {
		cin >> bag[i].w >> bag[i].v;
	}
	//do dp
	vector<vector<ll>> dp(W+1, vll(n+1,0));
	for(int i = 1; i <= n; ++i) {
		for(ll j = 0; j <= W; ++j) {
			dp[j][i] = dp[j][i-1];
			if (j >= bag[i-1].w) 
				dp[j][i] = max(bag[i-1].v + dp[j-bag[i-1].w][i-1], dp[j][i]);
		}
	}
	
	cout << dp[W][n] << nl;
	#if DEBUG
	cerr << "Time: " << (ld)clock() / CLOCKS_PER_SEC << " s" << nl;
	#endif
	return 0;
}


Measured memory_bytes: 82304
import sys
from bisect import bisect_left



N,Q = map(int, input().split())
lines = sys.stdin.readlines()
kkk = []
for line in lines[:N]:
  s, t, x = map(int, line.split())
  kkk.append((x, s, t))
kkk.sort()
ddd = list(map(int, lines[N:]))

ans = [-1] * Q
skip = [-1] * Q
for x, s, t in kkk:
  ss = bisect_left(ddd, s - x)
  tt = bisect_left(ddd, t - x)
  while ss < tt:
    sk = skip[ss]
    if sk == -1:
      ans[ss] = x
      skip[ss] = tt
      ss += 1
    else:
      ss = sk

print('\n'.join(map(str, ans)))


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

typedef long long ll;

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define tt int t; cin>>t; while(t--)
#define nl cout<<"\n";
#define sp cout<<" ";
#define rep(i, a, b) for(long long i=a; i<b; i++)

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
double PI = 4*atan(1);

int main()
{
    optimize();

    set < char > s;
    char t;

    for(int i=0; i<4; i++)
    {
        cin>> t;
        s.insert(t);
    }




    cout << (s.size ()==2?  "Yes" : "No");

    nl;

    return 0;
}




Measured memory_bytes: 3660
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():
    H, W = in_nn()
    a = [list(map(int, readline().split())) for _ in range(H)]

    odd_count = 0
    for y in range(H):
        for x in range(W):
            if a[y][x] % 2 == 1:
                odd_count += 1

    if odd_count % 2 == 1:
        odd_count -= 1

    count = 0
    x, y = 0, 0
    px, py = -1, -1
    odd_f = False

    ans = []
    while True:

        if odd_f:
            ans.append((py + 1, px + 1, y + 1, x + 1))
            if a[y][x] % 2 == 1:
                odd_f = False
        else:
            if a[y][x] % 2 == 1:
                odd_f = True

        px, py = x, y
        if a[y][x] % 2 == 1:
            count += 1
            if count >= odd_count:
                break

        if y % 2 == 0:
            if x == W - 1:
                y += 1
            else:
                x += 1
        else:
            if x == 0:
                y += 1
            else:
                x -= 1

        if y >= H:
            break

    print(len(ans))
    for a in ans:
        print(*a)


if __name__ == '__main__':
    main()


Measured memory_bytes: 98504
while True:
    n,m =map(int, input().split())
    if n==0 and m==0:
        break
    temp=[]
    distance=0
    
    for i in range(n):
        d,p= map(int,input().split())
        distance = distance + d
        temp.append([p,d])

    temp.sort()
    temp.reverse()
    
    if distance <= m:
        print(0)
        
    else:
        money=m
        while True:
            if money<= temp[0][1]:
                temp[0][1]-=money

                break
            else:
                money-=temp[0][1]
                temp.pop(0)
        ans=0
        for i in range(0,len(temp)):
            ans+= temp[i][0]*temp[i][1]
        print(ans)


Measured memory_bytes: 6804
#include <bits/stdc++.h>
 
using namespace std;
 
#define forsn(i, s, n) for(int i=s;i<int(n);i++)
#define forn(i, n) forsn(i, 0, n)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
 
typedef long long tint;

const int INF = 1e6;
const long double PI = acos(-1);
 
int main() {
	int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
	int za = x2-x1, zb = y2-y1;
	cout << x2-zb << " " << y2+za << " " << x1-zb << " " << y1+za << endl;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
def inpl(): return list(map(int, input().split()))
N = int(input())
F = [0]*N
H = inpl()
ans = 0
while True:
    for l in range(N):
        if F[l] < H[l]:
            for r in range(l, N):
                if F[r] < H[r]:
                    continue
                break
            else:
                r += 1
            if r > N:
                r = N
            for j in range(l, r):
                F[j] += 1
            ans += 1
            break
    else:
        break
#assert F == H
print(ans)

Measured memory_bytes: 3064
import math
a,b=map(int,input().split())
xa=math.ceil(a/0.08)
xb=int(b/0.1)
if int(max(xa,xb)*0.08)==a and int(max(xa,xb)*0.1)==b:
    print(max(xa,xb))
else:
    print(-1)

Measured memory_bytes: 3060
//abc130_a.cpp
//Sun Sep  1 20:39:22 2019

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

int main(){
	int x,a;
	cin >> x >> a;
	if (x<a){
		cout << 0 << endl;
	}else {
		cout << 10 << endl;
	}
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 256
N = int(input())
P = list(map(int, input().split()))

max_lst = [2 * 10 ** 6 for i in range(N + 1)]
ctr = 0

for i in range(1, N + 1):
	max_lst[i] = min(max_lst[i - 1], P[i - 1])

for i in range(N):
	if max_lst[i] >= P[i]:
		ctr += 1
print(ctr)

Measured memory_bytes: 85456
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
//const lld MAXN = 1e9;

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

	int n = t.size();

	int al[26] = {0};

	for(int i = 0; i < n; i++)
	{
		al[t[i] - 'a']++;
	}


	int sol = 101;

	for(int i = 0; i < 26; i++)
	{
		n = t.size();

		if (al[i] != 0)
		{
			if (al[i] == n)
			{
				cout << 0 << endl;
				return 0;
			}
			int cnt = 0;
			string s = t;

			while(1)
			{

				cnt++;
				for(int j = 0; j < n-1; j++)
				{
					if (s[j+1] == 'a'+i)
					{
						s[j] = 'a'+i;
					}
				}

				n--;

				// for(int i = 0; i < n; i++)
				// {
				// 	cout << s[i];
				// }

				printf("\n");

				bool test = true;

				for(int j = 0; j < n; j++)
				{
					if (s[j] != 'a'+i)
					{
						test = false;
						break;
					}

				}

				if (test)
				{
					// cout << "n= " << n << endl;
					// cout << "ok" << endl;
					if (sol > t.size() - n)
					{
						sol = t.size() - n;
					}
					break;
				}
			}


		}
	}

	cout << sol << endl;

	return 0;
}

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

int main(){
	
	int n;
	cin>>n;
	vector<vector<int> >c(n,vector<int>(n));
	for(int i=0;i<n;i++)for(int j=0;j<n;j++)cin>>c[i][j];
	long long ans=0;
	for(int i=0;i<n;i++)for(int j=0;j<i;j++)ans+=min(c[i][j],c[j][i]);
	cout<<ans<<endl;
	
	return 0;
}


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

int main() {
  int n, m, c;
  cin >> n >> m >> c;
  int b[m];
  for (int i=0; i<m; i++) {
    cin >> b[i];
  }
  int a[n][m];
  for (int i=0; i<n; i++) {
    for (int j=0; j<m; j++) {
      cin >> a[i][j];
    }
  }
  int ans = 0;
  for (int i=0; i<n; i++) {
    int sum = c;
    for (int j=0; j<m; j++) {
      sum += a[i][j]*b[j];
    }
    if (sum > 0) {
      ans++;
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 3632
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def main():
    L, R, d = map(int, read().split())
    ans = R // d - (L-1) // d
    print(ans)
    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 9152
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}

int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> to(n); 
  rep(i,m) {
    int a, b;
    cin >> a >> b;
    to[a-1].pb(b-1);
    to[b-1].pb(a-1);
  }
  for(auto p: to[n-1]) {
    for(auto q : to[p]) {
      if(q==0) {
        cout << "POSSIBLE" << endl;
        return 0;
      }
    }
  }
  cout << "IMPOSSIBLE" << endl;
  return 0;
}

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

int64_t value[100];

int64_t L(int n){
    if(n==0){
        return 2;
        value[0]=2;
    }else if(n==1){
        return 1;
        value[0]=1;
    }else{
        if(value[n]==0){
            value[n] = (int64_t)L(n-1)+L(n-2);
        }
        return value[n];
    }
}
int main(){
    int N;
    cin >> N;
    cout << L(N) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>

inline void check_min(int a,int &b){if(a<b)b=a;}

namespace fuck
{
	const int N=50,M=N*N*2;
	int begin[N],next[M],to[M];
	int dfn[N];
	int clk,n,m,e;
	void add(int x,int y,bool k=1)
	{
		to[++e]=y;
		next[e]=begin[x];
		begin[x]=e;
		if(k)add(y,x,0);
	}
	int ans=0;
	int dfs(int p=1,int h=0)
	{
		int lowp=dfn[p]=++clk,lowq;
		for(int i=begin[p],q;i;i=next[i])
			if((q=to[i])!=h)
			{
				if(dfn[q]){check_min(dfn[q],lowp);continue;}
				check_min(lowq=dfs(q,p),lowp);
				if(lowq>dfn[p])ans++;
			}
		return lowp;
	}
	void initialize()
	{
		scanf("%d%d",&n,&m);
		for(int i=1,u,v;i<=m;i++)
			scanf("%d%d",&u,&v),add(u,v);
	}
	void solve()
	{
		initialize();
		clk=0;
		dfs();
		printf("%d\n",ans);
	}
}

int main()
{
	fuck::solve();
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void) {
	int x, a, b;
	int m = 0;
	scanf("%d %d %d", &x, &a, &b);
	m = x - a;
	while (m >= b) {
		m = m - b;
	}

	printf("%d\n", m);

	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
int main()
{
 int n;
 scanf("%d", &n);
 int a[n];
 int i;
 for(i = 0; i < n; i++)
  scanf("%d", a + i);
 int ans = 0;
 for(i = 0; i < n - 1; i++)
 {
  for(int j = i + 1; j < n; j++)
   ans += a[i] * a[j];
 }
 printf("%d\n", ans);
}

Measured memory_bytes: 128
<?php

$input = explode(' ', trim(fgets(STDIN)));
$x = (int)$input[0];
$y = (int)$input[1];
$z = (int)$input[2];
$k = (int)$input[3];

$xs = [];
$input = explode(' ', trim(fgets(STDIN)));
foreach ($input as $v) {
	$xs[] = (int)$v;
}
$ys = [];
$input = explode(' ', trim(fgets(STDIN)));
foreach ($input as $v) {
	$ys[] = (int)$v;
}
$zs = [];
$input = explode(' ', trim(fgets(STDIN)));
foreach ($input as $v) {
	$zs[] = (int)$v;
}


$xy = [];
for ($i=0; $i < $x; $i++) { 
	for ($m=0; $m < $y; $m++) { 
		$xy[] = $xs[$i] + $ys[$m];
	}
}
rsort($xy);
$xy_max = min(count($xy), $k);

$xyz = [];
for ($i=0; $i < $xy_max; $i++) { 
	for ($j=0; $j < $z; $j++) { 
		$xyz[] = $xy[$i] + $zs[$j];
	}
}
rsort($xyz);
$result = [];
for ($i=0; $i < $k; $i++) { 
	$result[] = $xyz[$i];
}
echo implode(PHP_EOL, $result);

Measured memory_bytes: 170588
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

a = na()
a.sort()
if a[0] == 5 and a[1] == 5 and a[2] == 7:
    print("YES")
else:
    print("NO")



Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	string S;
	cin >> S;
	int n = S.size();
	int flag = 0;
	S.erase(S.begin() + n  - 1);
	while(flag == 0){
		n = S.size();
		for (int i = 0; i < n/2; i++){
			if (S[i] == S[n/2 + i]){
				if (i == n/2 - 1 && n/2 + i == n - 1){//全部おっけい
					flag = 1;
				}
				else if (i == n/2 - 1 ){
					S.erase(S.begin() + n  - 1);
					break;
				}
				else{
					continue;
				}
			}
			else{
				S.erase(S.begin() + n  - 1);
				break;
			}


		}	
	}
	cout << n << endl;
	return 0;
}

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define endl "\n"

template<uint_fast64_t m>
int_fast64_t mpow(int_fast64_t x,int_fast64_t n){
  using i64=int_fast64_t;
  if(n==0)return 1;
  if(n%2)return ((x%m)*(mpow<m>(x,n-1)%m))%m;
  else {
    i64 half=mpow<m>(x,n/2)%m;
    return (half*half)%m;
  }
}

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

  int N;
  cin>>N;
  vector<int>A(N);
  for(int i=0;i<N;i++)cin>>A[i];

  //端っこ->N-1
  //2つめ->N-2-1
  
  map<int,int>m;
  for(auto it:A)m[it]++;
  bool ok=true;
  for(int i=0;i<N/2-1;i++)if(m[N-(i+1)-i]!=2)ok=false;
  if(N%2&&m[0]!=1)ok=false;
  if(ok){
    int n=m.size();
    if(N%2)n--;
    cout<<mpow<MOD>(2,n)<<endl;
  }
  else{
    cout<<0<<endl;
  }

  return 0;
}


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

//--------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

//--------------------------------------------
const double EPS = 1e-14;
const double PI  = acos(-1.0);

//--------------------------------------------

typedef pair <int, int> p;
vector <p> v;

int main(){
  int n;
  LL k;
  int a,b;

  scanf("%d %lld",&n,&k);

  REP (i, n) {
    scanf("%d %d",&a,&b);
    v.push_back(make_pair(a, b));
  }

  sort(v.begin(),v.end());

  LL sum = 0;
  int ans;
  REP (i, n + 1) {
    if (k > sum) sum += v.at(i).second;
    else {
      ans = v.at(i - 1).first;
      break;
    }
  }

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


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

ll mypow(ll x, int n){
    ll ret = 1;
    while(n > 0){
        if(n & 1){
            ret *= x;
        }
        x *= x;
        n >>= 1;
    }
    return ret;
}

int main() {

    int n, p;
    cin >> n >> p;
    int cnt_even = 0;
    rep(i, n){
        int a;
        cin >> a;
        if(a % 2 == 0){
            cnt_even++;
        }
    }

    if(cnt_even == n){  //全部偶数
        if(p == 0){
            cout << mypow(2LL, n) << endl;
        }
        else{
            cout << 0 << endl;
        }
    }
    else{
        cout << mypow(2LL, n-1) << endl;
    }

    return 0;
}

Measured memory_bytes: 256
// Frog 1

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

class Main {
	public static int frogJumpCost(int[] arr, int n) {
		int[] dp = new int[n];
		dp[n-1] = 0;
		dp[n-2] = Math.abs(arr[n-1]-arr[n-2]);
		for(int i = n-3; i >= 0; i--) {
			dp[i] = min(dp[i+1]+Math.abs(arr[i]-arr[i+1]), dp[i+2]+Math.abs(arr[i]-arr[i+2]));
		}
		return dp[0];
	}
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] s = br.readLine().split(" ");

		int[] arr = new int[n];
		for(int i = 0; i < n; i++) {
			arr[i] = Integer.parseInt(s[i]);
		}

		System.out.println(frogJumpCost(arr, n));

	}
	public static int min(int...arr) {
		int min = Integer.MAX_VALUE;
		for(int i: arr) {
			if(i < min)
				min = i;
		}
		return min;
	}
}

Measured memory_bytes: 40648
import java.util.Scanner;
class Main{
  public static void main (String[] args){
    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();
    int A[] = new int[N-1];
    int Count[] = new int[N];
    
    for(int i=0;i<N-1;i++){
      A[i] = sc.nextInt();
    }
    
    for(int i=0;i<N-1;i++){
      int x = A[i];
      Count[x-1]++;
    }
    
    for(int i=0;i<N;i++){
      System.out.println(Count[i]);
    }
    
  }
}

Measured memory_bytes: 61784
#include<stdio.h>
int main()
{
  char s[5];
  int a=0,b=0,i;
  scanf("%s",s);
  for(i=0;i<4;i++)
  {
    if(s[i]=='+')a++;
      else b++;
  }
  printf("%d\n",a-b);
  return 0;
}

Measured memory_bytes: 128
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n = INT()
if n % 2 == 0:
  print(0.5)
if n % 2 != 0:
  a = n // 2
  b = n // 2 + 1
  print(b / n)

Measured memory_bytes: 6084