akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-11;
const ll mod=1e9+7;
//const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
const int dx[8]={-1,0,1,0,-1,-1,1,1},dy[8]={0,-1,0,1,1,-1,1,-1};

const int n=8;
int a[n][n];

int main(){
	for(int i=0;i<n;i++) for(int j=0;j<n;j++){
		char c;
		cin>>c;
		if(c=='o') a[i][j]=1;
		if(c=='x') a[i][j]=-1;
	}
	int B=1;
	bool flag=0;
	while(1){
		int mx=0,I,J;
		for(int i=0;i<n;i++) for(int j=0;j<n;j++) if(a[i][j]==0){
			int cnt=0;
			for(int k=0;k<8;k++){
				int x=i+dx[k],y=j+dy[k],tmp=0;
				while(x>=0&&x<n&&y>=0&&y<n&&a[x][y]==-B){
					tmp++;
					x+=dx[k],y+=dy[k];
				}
				if(x>=0&&x<n&&y>=0&&y<n&&a[x][y]==B) cnt+=tmp;
			}
			if(cnt>=mx){
				if(B==1){
					if(cnt>mx) I=i,J=j;
				}
				else{
					I=i,J=j;
				}
				mx=cnt;
			}
		}
		if(mx>0){
			flag=0;
			for(int k=0;k<8;k++){
				int x=I+dx[k],y=J+dy[k];
				while(x>=0&&x<n&&y>=0&&y<n&&a[x][y]==-B){
					x+=dx[k],y+=dy[k];
				}
				if(x>=0&&x<n&&y>=0&&y<n&&a[x][y]==B){
					x-=dx[k],y-=dy[k];
					while(x>=0&&x<n&&y>=0&&y<n&&a[x][y]==-B){
						a[x][y]=B;
						x-=dx[k],y-=dy[k];
					}
					a[x][y]=B;
				}
			}
		}
		else{
			if(flag) break;
			flag=1;
		}
		B*=-1;
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(a[i][j]==1) cout<<'o';
			if(a[i][j]==-1) cout<<'x';
			if(a[i][j]==0) cout<<'.';
		}
		cout<<endl;
	}
}


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

int main() {
  int N;
  cin>>N;
  for(int i=0;i<N; i++){
    string S;
    cin>>S;
    if(S=="Y"){
      cout<<"Four"<<endl;
      return 0;
    }
  }
  cout<<"Three"<<endl;
}


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

int main()
{
  i64 n;
  string s;
  cin >> n >> s;
  for (i64 i = 0; i < s.size(); i++)
    s[i] = ((s[i] - 'A') + n) % 26 + 'A';
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
S = input()

zero_list = []
for i in range(N):
    if S[i] == '0':
        if i > 0 and S[i - 1] == '0':
            zero_list[-1][0] += 1
            zero_list[-1][2] += 1
        else:
            zero_list.append([1, i, i])
            
if len(zero_list) <= K:
    ans = N
else:
    zero_c_max = zero_list[K][1]
    l = 0
    r = zero_list[K][1] - 1
    for j in range(1, len(zero_list) - K + 1):
        l = zero_list[j - 1][2] + 1
        if j + K < len(zero_list): 
            r = zero_list[j + K][1] - 1
        else:
            r = N - 1
        if (r - l) + 1 > zero_c_max:
            zero_c_max = (r - l) + 1
    
    ans = zero_c_max
    
print(ans)

Measured memory_bytes: 9716
#include<stdio.h>
int main()
{
	int x,sum=0;
	scanf("%d",&x);
	int y;
	y=x;
	while(x>0)
	{
		sum=sum*10+x%10;
		x=x/10;
	}
	if(sum==y)
	printf("Yes\n");
	else
	printf("No\n");
	
	
	return 0;
}

Measured memory_bytes: 128
use std::io::Read;

fn main() {
    let mut buf = String::new();

    // 標準入力から全部bufに読み込む
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let length: usize = iter.next().unwrap().parse().unwrap();
    let s: String = iter.next().unwrap().parse().unwrap();

    let mut easts: Vec<usize> = (0..length).map(|_| 0).collect();
    let mut wests: Vec<usize> = (0..length).map(|_| 0).collect();

    let chars = s.chars().collect::<Vec<char>>();
    for i in (0..length - 1).rev() {
        let c = chars[i + 1];
        if c == 'E' {
            easts[i] = easts[i + 1] + 1;
        } else {
            easts[i] = easts[i + 1];
        }
    }
    for i in 1..length {
        let c = chars[i - 1];
        if c == 'W' {
            wests[i] = wests[i - 1] + 1;
        } else {
            wests[i] = wests[i - 1];
        }
    }

    let results: Vec<usize> = easts.iter().zip(wests.iter()).map(|x| x.0 + x.1).collect();

    println!("{}", results.iter().min().unwrap());
}

Measured memory_bytes: 18684
#include<iostream>
#include<string>

using namespace std;

int main() {
  string S;
  int base = 700;
  int topping = 100;
  int count = 0;
  
  cin >> S;
  
  for (int i = 0; i < S.size(); ++i) {
    if (S[i] == 'o') ++count;
  }
  
  cout << base + topping * count << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define io ios_base::sync_with_stdio(false);cin.tie(NULL)
#define MOD 1000000007
ll bigpow(ll base,ll pw,ll M)
{
	if(pw==0) return 1;
	if(pw%2==0)
	{
		ll ret=bigpow(base,pw/2,M);
		return ((ret%M)*(ret%M))%M;
	}
	else return ((base%M)*(bigpow(base,pw-1,M)))%M;

}
ll maxi(ll a,ll b)
{
    if(a>b)return a;
    return b;
}
ll mini(ll a,ll b)
{
    if(a<b)return a;
    return b;
}
ll abse(ll a)
{
    if(a<0)return -a;
    return a;
}
ll ceili(ll a,ll div)
{
    return (a+div-1)/div;
}
int h,w;
ll dp[1002][1002];
char v[1002][1002];
ll f(int i,int j)
{
    if(i>h||j>w) return 0;
    if(v[i][j]=='#')return 0;
    if(dp[i][j]!=-1)return dp[i][j];
    if(i==h&&j==w) return 1;
    return dp[i][j]=(f(i+1,j)+f(i,j+1))%MOD;
}
int main(void)
{
   // io;
    int T=1,cas=0,i,j;
    char c;
    //cin>>T;
    while(T--)
    {
        cin>>h>>w;
        for(i=0;i<h;i++)
        {
            scanf(" %s",v[i]);
        }

       memset(dp,-1,sizeof dp);
        h--;w--;
        dp[h][w]=1;
    cout<<f(0,0);

    }
}



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

int main(void){
    char s[100];
    int len = 0;
    int yes = 1;

    scanf("%s", s);

    //回文チェック
    for(int i = 0; i < strlen(s)/2; i++){
        if(s[i] != s[strlen(s) - 1 - i]){
            yes = 0;
        }
    }

    //前半回文チェック
    for(int i = 0; i < strlen(s)/2/2; i++){
        if(s[i] != s[strlen(s)/2 - 1 - i]){
            yes = 0;
        }
    }
    //後半回文チェック
    for(int i = 0; i < strlen(s)/2/2; i++){
        if(s[strlen(s)/2 + 1 + i] != s[strlen(s) - 1 - i]){
            yes = 0;
        }
    }

    if(yes == 1){
        printf("Yes\n");
    }else{
        printf("No\n");
    }

    return 0;

} 


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+10;
char s[maxn];
char w[maxn];
int vis[maxn];
int n,a,b,c,d;
int main()
{


    scanf("%s",s+1);
    strcpy(w+1,s+1);
   // cout<<w+1<<endl;
    int len=strlen(s+1);
    int couts=0;
    ll ans=0;
    int pos=1;
    if(len<3)
        puts("0");
    else
    {
        for(int i=1; i<=len-2; i++)
        {
            if(s[i]=='A')
            {
                couts++;
                if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')
                {
                    ans++;
                    swap(s[i],s[i+1]);
                    swap(s[i+1],s[i+2]);
                    ans+=(couts-1);
                    couts--;
                    i++;

                }
            }
            else
                couts=0;
        }

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


    return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<stdio.h>
#include<vector>
#include<functional>
#include<queue>
#include<algorithm>
#include<math.h>

using namespace std;

int main(void){

    int n;
    cin >> n;

    double value;

    value = n * (100.0/108.0);

    if(ceil(value) != floor(value)) {
        if(floor(ceil(value)*1.08) == n) cout << ceil(value) << endl;
        else cout << ":(" << endl;
    } else cout << value << endl;

    return 0;
}

Measured memory_bytes: 384
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h1,w1,h2,w2;
    cin >> h1 >> w1;
    cin >> h2 >> w2;
    cout << (h1-h2)*(w1-w2) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int           long long
#define pb            push_back
#define mp            make_pair
#define PI            3.14159265
#define M             1000000007
#define MM            998244353
#define fr            first
#define sc            second
#define all(v)        (v).begin(),(v).end()
#define rall(v)       (v).rbegin(),v.rend()
#define vc            vector
#define vi            vector<int>
#define pii           pair<int,int>
#define psi           pair<string,int>
#define pis           pair<int,string>
#define mii           map<int,int>
#define msi           map<string,int>

int ans;
int solve() {
    int n,m; cin>>n>>m;
    map<int,vi> m1;
    for (int i = 0; i < n; ++i)
    {
        int a,b; cin>>a>>b;
        m1[a].pb(b);
    }
    priority_queue<int> q;
    for (int i = 1; i <= m; ++i)
    {
        for(auto j:m1[i]){
            q.push(j);
        }
        if(!q.empty()){
            ans+=q.top();
            q.pop();
        }
    }
    cout<<ans;
}

signed main() {
    ios::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    //cin>>t;
    while(t--) solve();
    return 0;
}

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

int main() {
  int n, t;
  cin >> n >> t;
  int a, benefit = 0, cheap, ans = 0;
  cin >> cheap;
  for (int i = 1; i < n; i++) {
    cin >> a;
    if (a < cheap) cheap = a;
    else if (a - cheap > benefit) {
      benefit = a - cheap;
      ans = 1;
    }
    else if (a - cheap == benefit) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define rep(i,a)  for(ll i=0; i< a; i++)
#define rep1(i,a)   for(ll i = 1; i< a; i++)
#define foi(i, a, b)    for(ll i = a; i<b ; i++)
#define fod(i, a, b)    for(ll i = a; i>=b ; i--)
#define max3(a, b, c)   max(max(a, b), c)
#define min3(a, b, c)   min(min(a, b), c)
#define MAX 1000005
#define MOD 1000000007

ll findgcd(ll n,ll m){
    return __gcd(n,m);
}
ll findlcm(ll n,ll m){
    return (n*m)/findgcd(n,m);
}

ll nodig(ll n){
    int ans =0;
    while(n!=0){
        ans+=1;
        n=n/10;
    }
    return ans;
}


int main(){
    ll n,temp=0,cnt=0,ans=0;
    string s;
    cin>>s;
    temp =s.size();
    //cout<<s[temp-1]<<endl;
    if(s[temp-1]=='s'){
        cout<<s<<"es";
    }
    else cout<<s<<"s";
    

return 0;
}

Measured memory_bytes: 3624
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cctype>
#include <iostream>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <iterator>
#include <cmath>

using namespace std;

int arr[100010];

long long a[200010];
long long b[200010];
long long res[100010];

int main()
{
    //freopen("in", "r", stdin);
    //freopen("out", "w", stdout);

    int n, m, i;
    scanf("%d%d", &n, &m);
    for(i = 0; i < n; i++)
        scanf("%d", &arr[i]);

    long long r = 0;
    for(i = 0; i < n - 1; i++)
    {
        int x = arr[i];
        int y = arr[i + 1];
        x--;
        y--;

        if(y < x)
            y += m;

        r += y - x;

        a[x + 1] += 1;
        b[x + 1] += -(x + 1);

        a[y + 1] -= 1;
        b[y + 1] -= -(x + 1);
    }

    long long p = 0, q = 0;
    for(i = 0; i < 2 * m; i++)
    {
        p += a[i];
        q += b[i];
        res[i % m] += p * i + q;
    }

    r -= *max_element(res, res + m);

    printf("%lld\n", r);
    return 0;
}

Measured memory_bytes: 4480
/*----------- 解説を見た. ---------------*/
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  ll n;
  cin >> n;
  ll a[50]={};
  rep(i,50)a[i]=i+n/50;
  for(int i=0;i<n%50;i++){
    for(int j=0;j<50;j++){
      if(j!=i)a[j]--;
      else a[j]+=50;
    }
  }
  cout << 50 << endl;
  rep(i,50)cout << a[i] << ' ' ;
  cout << endl;
return 0;}

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

int main(int argc, char const *argv[])
{
	int n,k,q;
	cin>>n>>k>>q;
	int memo[n]={},a;
	for (int i = 0; i < q; ++i)
	{
		cin>>a;
		--a;
		++memo[a];
	}
	for (int i = 0; i < n; ++i)
	{
		if (k-q+memo[i]<=0)
		{
			cout<<"No\n";
		}
		else
		{
			cout<<"Yes\n";
		}
	}
	return 0;
}


Measured memory_bytes: 1024
#include<cstdint>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<iterator>
#include<stack>
#include<cctype>
#include<climits>
#include<string>
#include<bitset>
#include<cfloat>
#include<iomanip>
#include<numeric>
#include<utility>
#include<initializer_list>


#define repi(i,start,end)for(int64_t (i)=(start);(i)<(end);++(i))
#define rep(i,end) repi((i),0,(end))
#define rfor(x, v) for(auto& (x) : (v))
#define iterate(itr, v) for(auto (itr)=(v).begin();(itr)!=(v).end();++(itr))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define vin(v) rep(i,(v).size()) cin >> (v)[i];
#define vpin(v) rep(i,(v).size()) cin >> (v)[i].first >> (v)[i].second

using namespace std;
using Int = int64_t;
using pint = pair<Int, Int>;
using vint = vector<Int>;
using vvint = vector<vint>;
using vpint = vector<pint>;
using vstr = vector<string>;

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;  }
template<class T>void put_double(T a){cout<<setprecision(15);cout<<a<<"\n";}
template<class T>void println(T a){cout << a << "\n";}
template<class T>void put_line(T &v){iterate(itr,v){cout<<*itr<<((itr==--v.end())?"\n":" ");}}
// auto [x, y] = make_tuple(3, 4); => let (x, y) = (3, 4);

int main(void) {
    int n; cin >> n;
    vpint v(n);
    rep(i, n) {
        int x, l; cin >> x >> l;
        v[i].first = x - l;
        v[i].second = x + l;
    }
    sort(all(v),
        [](pint x, pint y) {
            if(x.second == y.second) return x.first < y.first;
            else return x.second < y.second;
        }
    );
    int ans = 1;
    int pos = v[0].second;
    repi(i, 1, n) {
        if(v[i].first < pos) continue;
        ans++;
        pos = v[i].second;
    }
    println(ans);


    return 0;
}


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

int main(void){
    long double a,b,h,m;
    cin >> a >> b >> h >> m;
    long double x = 2*acosl(-1)*((m/60.0+h)/12.0-(m/60.0));
    long double sum = (a*a+b*b)-(2*a*b)*(cosl(x));
    cout << fixed << setprecision(12) << sqrtl(sum) << endl;
}


Measured memory_bytes: 4164
N = int(input())
money = 1000
A = list(map(int, input().split()))
A.append(0)
kabu = 0
for i in range(N):
    if A[i] <= A[i+1]:
        buy = money//A[i]
        money -= buy*A[i]
        kabu += buy
    if A[i] >= A[i+1]:
        money += kabu*A[i]
        kabu = 0
print(money)

Measured memory_bytes: 9196
#include <bits/stdc++.h>
using namespace std;
#define all(V) V.begin(),V.end()
#define FINISH cout<<"NO"<<endl;return 0
using ll = long long;
const ll MOD = 998244353;

vector<int> G[200010];
ll fact[200010];
ll inv[200010];
pair<ll, int> rec[200010];

ll modpow(ll x, ll y) {
	ll ans = 1;
	while (y) {
		if (y & 1)ans *= x;
		x *= x;
		ans %= MOD;
		x %= MOD;
		y /= 2;
	}
	return ans;
}

ll nck(ll x, ll y) {
	return fact[x] * inv[y] % MOD * inv[x - y] % MOD;
}

ll dfs(int x) {
	if (G[x].size() == 0) {
		return 2;
	}
	ll ans = 1;
	for (int c : G[x]) {
		ans *= dfs(c);
		ans %= MOD;
	}
	return ans + 1;
}

int main() {
	fact[0] = 1;
	inv[0] = 1;
	for (ll i = 1;i < 200010;i++) {
		fact[i] = fact[i - 1] * i % MOD;
		inv[i] = modpow(fact[i], MOD - 2);
	}
	ll N, X, D;
	cin >> N;
	vector<pair<ll, ll>> V(N);
	for (int i = 0;i < N;i++) {
		cin >> X >> D;
		V[i] = { X,D };
	}
	sort(all(V));

	pair<ll, ll> ser;
	stack<pair<ll, int>> st;
	vector<int> R(N);
	st.push({ LLONG_MAX, 200005 });
	for (int i = 0;i < N;i++) {
		while (st.top().first <= V[i].first)
			st.pop();

		R[i] = st.top().second;
		st.push({ V[i].first + V[i].second,i });
	}
	
	for (int i = 0;i < N;i++) {
		G[R[i]].push_back(i);
	}
	cout << dfs(200005) - 1 << endl;
}

Measured memory_bytes: 32000
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; 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 maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#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("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  int H,W;
  cin >> H >> W;
  rep(h,H) {
    rep(w,W) {
      string s;
      cin >> s;
      if(s == "snuke") {
        cout << (char)(w+'A') << (h+1) << endl;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int count = 0;
		for(int i=1; i<=N; i++) {
			int a=Integer.parseInt(sc.next());
			if(a%2 !=0 && i %2 !=0) count++;
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 26996
_n = gets.to_i
results = readlines.map(&:chomp)
ac = 0
wa = 0
tle = 0
re = 0

results.each do |r|
  if r == 'AC'
    ac += 1
  elsif r == 'WA'
    wa += 1
  elsif r == 'TLE'
    tle += 1
  elsif r == 'RE'
    re += 1
  end
end

puts "AC x #{ac}"
puts "WA x #{wa}"
puts "TLE x #{tle}"
puts "RE x #{re}"


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

#define int long long
#define double long double
#define ff first
#define ss second
#define endl '\n'
#define ii pair<int, int>
#define mp make_pair
#define mt make_tuple
#define DESYNC                      \
  ios_base::sync_with_stdio(false); \
  cin.tie(0);                       \
  cout.tie(0)
#define pb push_back
#define vi vector<int>
#define vii vector<ii>
#define all(x) x.begin(), x.end()
#define EPS 1e-9
#define INF 1e18
#define ROOT 1
#define M 1000000007
const double PI = acos(-1);

using namespace std;

inline int mod(int n, int m) {
  int ret = n % m;
  if (ret < 0) ret += m;
  return ret;
}

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

void solution() {
  int a, b, n;
  cin >> a >> b >> n;
  int x = min(n, b - 1);
  cout << (a * x) / b - (a * (x / b)) << endl;
}

int32_t main() {
  DESYNC;
  solution();
}


Measured memory_bytes: 3652
use std::io::{self, BufRead, Write};

fn solve<R, W>(reader: R, mut writer: W)
where
    R: BufRead,
    W: Write,
{
    let mut lines = reader.lines();
    let a_line = lines.next().unwrap().unwrap();
    let chars: Vec<char> = a_line.chars().collect();

    let odd = (0..chars.len())
        .filter(|i| i % 2 == 0)
        .all(|i| chars[i] == 'R' || chars[i] == 'U' || chars[i] == 'D');

    let even = (0..chars.len())
        .filter(|i| i % 2 == 1)
        .all(|i| chars[i] == 'L' || chars[i] == 'U' || chars[i] == 'D');

    let ans = if odd && even { "Yes" } else { "No" };

    writeln!(&mut writer, "{}", ans).unwrap();
}

fn main() {
    let stdio = io::stdin();
    let input = stdio.lock();

    let output = io::stdout();

    solve(input, output);
}

#[cfg(test)]
mod tests {
    use super::*;

    const TESTS: &'static [(&'static [u8], &'static [u8])] = &[
        (
            br"RUDLUDR", br"Yes
",
        ),
        (
            br"DULL", br"No
",
        ),
        (
            br"UUUUUUUUUUUUUUU", br"Yes
",
        ),
        (
            br"ULURU", br"No
",
        ),
    ];

    #[test]
    fn test_b() {
        for &(input, expected) in TESTS {
            let mut output = Vec::new();
            solve(input, &mut output);
            let expected_str = String::from_utf8(expected.to_vec()).unwrap();
            let output_str = String::from_utf8(output).unwrap();
            assert_eq!(expected_str, output_str);
        }
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define ll long long
#define INF 0x7fffffff
#define inf 0x7fffffffffffffff
#define ms(a,val) memset(a,val,sizeof(a))
#define all(x) (x).begin(),(x).end()
#define sqr(x) ((x)*(x))
#define lowbit(x) ((x)&(-x))
ll quickpow(ll a,ll b,ll MOD){ll ans=1;while(b){if(b&1)ans=(ans*a)%MOD;a=a*a%MOD,b>>=1;}return ans;}
ll gcd(ll a,ll b){return a%b==0?b:gcd(b,a%b);}
using namespace std;
//head
//#define LOCAL

const int MAXN=150;
double X1[MAXN],Y1[MAXN];
double X2[MAXN],Z2[MAXN];

double getMin(double *a,int n){
    double mins=1e12;
    for(int i=0;i<n;i++)mins=min(mins,a[i]);
    return mins;
}
double getMax(double *a,int n){
    double maxs=-1e12;
    for(int i=0;i<n;i++)maxs=max(maxs,a[i]);
    return maxs;
}
//Remember the problem makes sure that it's a convex plogyen
double width(double *X,double *Y,int n,double x){
    double down=1e12,up=-1e12;
    for(int i=0;i<n;i++){
        double x1=X[i],y1=Y[i],x2=X[(i+1)%n],y2=Y[(i+1)%n];
        if(x1!=x2&&(x1-x)*(x2-x)<=0){
            double y=y1+(y2-y1)*(x-x1)/(x2-x1);
            down=min(down,y);
            up=max(up,y);
        }
    }
    return max(0.0,up-down);
}

int main(){
    #ifdef LOCAL
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif // LOCAL
    int m,n;
    while(~scanf("%d%d",&m,&n)){
        if(!m&&!n)break;
        double res=0;
        for(int i=0;i<m;i++)scanf("%lf%lf",&X1[i],&Y1[i]);
        for(int i=0;i<n;i++)scanf("%lf%lf",&X2[i],&Z2[i]);
        int min1=getMin(X1,m),max1=getMax(X1,m),min2=getMin(X2,n),max2=getMax(X2,n);
        vector<int> xs;
        for(int i=0;i<m;i++)xs.push_back(X1[i]);
        for(int i=0;i<n;i++)xs.push_back(X2[i]);
        sort(all(xs));
        for(int i=0;i<xs.size()-1;i++){
            double a=xs[i],b=xs[i+1],c=(a+b)/2;
            if(min1<=c&&c<=max1&&min2<=c&&c<=max2){
                double functiona=width(X1,Y1,m,a)*width(X2,Z2,n,a);
                double functionb=width(X1,Y1,m,b)*width(X2,Z2,n,b);
                double functionc=width(X1,Y1,m,c)*width(X2,Z2,n,c);
                res+=(b-a)/6.0*(functiona+4*functionc+functionb);
            }
        }
        printf("%.10f\n",res);
    }
    return 0;
}



Measured memory_bytes: 3236
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll x;
	cin >> x;
	ll ans = x / 11;
	ans *= 2;
	x %= 11;
	if(x == 0);
	else if(x <= 6) ans++;
	else ans += 2;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
buildings = [
    [[0] * 10, [0] * 10, [0] * 10],
    [[0] * 10, [0] * 10, [0] * 10],
    [[0] * 10, [0] * 10, [0] * 10],
    [[0] * 10, [0] * 10, [0] * 10]
]
n = int(input())
for _ in range(n):
    b,f,r,v = map(int, input().split())
    buildings[b-1][f-1][r-1] += v

for i, building in enumerate(buildings):
    for floor in building:
        print(" ",end='')
        print(" ".join(map(str,floor)))
    if i != 3:
        print("#"*20)


Measured memory_bytes: 5604
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<long double, int>;

long double f(int x1, int x2, int y1, int y2){
  long double ans;
  ans = sqrt(abs((ll)x1-x2)*abs((ll)x1-x2) + abs((ll)y1-y2) *abs((ll)y1-y2));
  return ans;
}

int main(){
  int xs, ys, xg, yg, n;
  cin >> xs >> ys >> xg >> yg >> n;
  vector<int> xn2(n+2), yn2(n+2), rn2(n+2);
  xn2[0] = xs; yn2[0] = ys; rn2[0] = 0;
  xn2[n+1] = xg; yn2[n+1] = yg; rn2[0] = 0;
  for(int i=1; i<n+1; ++i) cin >> xn2[i] >> yn2[i] >> rn2[i];
  long double ans;
  priority_queue<P, vector<P>, greater<P>> que;
  vector<bool> ok(n+2,true);
  que.push(P(0,0));
  while(1){
    long double dis = que.top().first;
    int pos = que.top().second;
    que.pop();
    if(!ok[pos]) continue;
    ok[pos] = false;
    if(pos == n+1){
      ans = dis;
      break;
    }
    for(int i=1; i<n+2; ++i){
      if(!ok[i]) continue;
      long double ndis = f(xn2[i],xn2[pos],yn2[i],yn2[pos]);
      ndis = max((long double)0, ndis -rn2[i] -rn2[pos]);
      //cout << "now:" << pos << " i:" << i << " dis:" << ndis << endl;
      que.push(P(ndis +dis,i));
    }
  }
  printf("%.10llf\n",ans);
}

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

using namespace std;

const int MAX_N = 100000, INDEX = 1;

struct Point {
    int id, x, y;

    Point() {
        this->id = 0;
        this->x = 0;
        this->y = 0;
    }

    Point(int id, int x, int y) {
        this->id = id;
        this->x = x;
        this->y = y;
    }
};

struct Edge {
    int id;

    Point p1, p2;

    Edge() {
        this->id = id;
        this->p1 = Point();
        this->p2 = Point();
    }

    Edge(int id, Point p1, Point p2) {
        this->id = id;
        this->p1 = p1;
        this->p2 = p2;
    }

    int getLength() {
        return min(abs(p1.x - p2.x), abs(p1.y - p2.y));
    }

    friend bool operator < (Edge e1, Edge e2) {
        if (e1.getLength() < e2.getLength()) {
            return true;
        }

        if (e1.getLength() > e2.getLength()) {
            return false;
        }

        return e1.id < e2.id;
    }
};

int n, dsu[MAX_N + INDEX], h[MAX_N + INDEX];

Point points[MAX_N + INDEX];

vector<Edge> edges;

bool compX(Point p1, Point p2) {
    if (p1.x < p2.x) {
        return true;
    }

    if (p1.x > p2.x) {
        return false;
    }

    return p1.id < p2.id;
}

bool compY(Point p1, Point p2) {
    if (p1.y < p2.y) {
        return true;
    }

    if (p1.y > p2.y) {
        return false;
    }

    return p1.id < p2.id;
}

bool compId(Point p1, Point p2) {
    return p1.id < p2.id;
}

int get(int i) {
    if (dsu[i] != i) {
        dsu[i] = get(dsu[i]);
    }

    return dsu[i];
}

void join(int a, int b) {
    a = get(a);
    b = get(b);

    if (a == b) {
        return ;
    }

    if (h[a] > h[b]) {
        dsu[b] = a;

        h[a] = max(h[a], h[b] + 1);
    } else {
        dsu[a] = b;

        h[b] = max(h[b], h[a] + 1);
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie();
    cout.tie();

    cin >> n;

    for (int i = 1; i <= n; i++) {
        int x, y;

        cin >> x >> y;

        points[i] = Point(i, x, y);
    }

    sort(points + INDEX, points + INDEX + n, compX);

    for (int i = 1; i < n; i++) {
        edges.push_back(Edge(i, points[i], points[i + 1]));
    }

    sort(points + INDEX, points + INDEX + n, compY);

    for (int i = 1; i < n; i++) {
        edges.push_back(Edge(n + i - 1, points[i], points[i + 1]));
    }

    sort(edges.begin(), edges.end(), less<Edge>());

    for (int i = 1; i <= n; i++) {
        dsu[i] = i;
        h[i] = 1;
    }

    int ans = 0;
    for (Edge e: edges) {
        if (get(e.p1.id) == get(e.p2.id)) {
            continue;
        }

        join(e.p1.id, e.p2.id);

        ans += e.getLength();
    }

    cout << ans << endl;

    return 0;
}


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

long long q(int a){
    long long r =1,p=1000000007;
    
    for(int i=0;i<a;i++){
        r= (r*2)%p;
    }
    return r;
}

int main(void){
    int n;
    cin>>n;
    int b = 0;
    long long e;

    if(n%2==0){
        b=1;
        e=q(n/2);
    }else{
        b=0;
        e=q((n-1)/2);
    }
    int d[100000]={0};
    
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        if(a%2==b){
            if(b==1){
                d[(a-1)/2]+=1;
                if(d[(a-1)/2]>2){
                    //out
                    i=n;
                    e=0;
                }
            }else{
                d[a/2]+=1;
                if(d[a/2]>2||d[0]>1){
                    //out
                    i=n;
                    e=0;
                }
            }
        }else{
            //out
            i=n;
            e=0;
        }
    }
    
    cout<<e<<endl;
    
}


Measured memory_bytes: 640
#include <iostream>
#include <fstream>
#include <utility>
#include <queue>
#include <vector>
#include <array>
#include <stack>
#include <list>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <set>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstdint>
#include <cstring>
#include <cmath>

using namespace std;

typedef long long ll;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define bs(n) (1ul<<(n))
int n, m, a[1000], b, c[1000];

template<class node_t,class cost_t>
class djikstra {
private:
	map<node_t, map<node_t, cost_t>> g;
	priority_queue<pair<cost_t, node_t>, deque<pair<cost_t, node_t>>, greater<>> q;
	map<node_t, cost_t> d;
	set<node_t> v;
	node_t s = -1;
	void compute(node_t start) {
		s = start;
		v.clear();
		d.clear();
		d[s] = 0;
		q.push(make_pair(0,s));
		while (!q.empty()) {
			node_t c = q.top().second;
			q.pop();
			if (v.find(c) != v.end()) continue;
			v.insert(c);
			for (auto& e : g[c]) {
				if (d.find(e.first) == d.end()) d[e.first] = d[c] + e.second;
				else d[e.first] = min(d[e.first], d[c] + e.second);
				q.push(make_pair(d[e.first], e.first));
			}
		}
	}
public:
	cost_t get_dist(node_t start, node_t end) {
		if (start != s) compute(start);
		if (d.find(end) != d.end()) return d[end];
		else return cost_t(-1);
	}
	void add_path(node_t src, node_t dst,cost_t cost) {
		if (g[src].find(dst) == g[src].end()) g[src][dst] = cost;
		else g[src][dst] = min(g[src][dst], cost);
	}
};


int main() {
	cin >> n >> m;
	djikstra<int, int> w;
	rep(i, m) {
		cin >> a[i] >> b;
		rep(j, b) {
			int k;
			cin >> k;
			c[i] |= bs(k-1);
		}
		rep(j, bs(n)) {
			if((j & c[i]) != c[i]) w.add_path(j, j | c[i], a[i]);
		}
	}
	cout << w.get_dist(0, bs(n) - 1) << endl;
	return 0;
}


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

ll gcd(ll x, ll y) {
    if (x < y) swap(x, y);
    while(y > 0) {
        ll tmp = x % y;
        x = y;
        y = tmp;
    }
    return x;
}

int main() {
    ll a, b;
    cin >> a >> b;
    ll n = gcd(a, b);

    vector<ll> divisor;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            divisor.push_back(i);
            if (i * i != n) divisor.push_back(n / i);
        }
    }
    sort(all(divisor));

    vector<ll> ans;
    for (ll i : divisor) {
        if (ans.size() == 0) ans.push_back(i);
        else {
            bool flag = true;
            for (ll j : ans) {
                if (j == 1) continue;
                if (i % j == 0) flag = false;
            }
            if (flag) ans.push_back(i);
        }
    }
    cout << ans.size() << endl;
    return 0;
}


Measured memory_bytes: 384
mod = int(1e9) + 7

def main():
    n, k = map(int, input().split())

    small = 0
    large = 0
    ans = 0
    for i in range(0, n+1):
        small += i
        large += n-i
        if i+1 >= k:
            ans = (ans + (large - small + 1)) % mod

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9124
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
#include <iomanip>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

int main()
{
	double q;
	while(cin >> q && q + 1)
	{
		double x = abs(q / 2);
		while(abs(x * x * x - q) >= 0.00001 * q)
			x = x - (x * x * x - q) / (3 * x * x);
		printf("%f\n", x);
	}
}

Measured memory_bytes: 0
n, m = map(int, input().split())
cnt = {}

py = [list(map(int, input().split())) + [i] for i in range(m)]
py.sort(key=lambda x: x[1])

results = []
for p, y, i in py:
    x = cnt.get(p, 0) + 1
    results.append(("{:06d}{:06d}".format(p, x), i))
    cnt[p] = x
results.sort(key=lambda x: x[1])
for ans, _ in results:
    print(ans)


Measured memory_bytes: 45536
#include <iostream>
#include <string.h>
#include <algorithm>
#define ll long long
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    string s1;
    while(getline(cin, s1))
    {
        for(int i=0;i<s1.length();i++)
            if(isalpha(s1[i])) s1[i] = s1[i] - 'a' + 'A';
        for(int i=0;i<s1.length();i++)
            cout << s1[i];
        cout << "\n";
    }
    return 0 ;
}



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

long long n, a, b, q = 0, m = 1;
long long w[200001];
const long long M = 1e9 + 7;
typedef pair<long long, long long> P;
map < P, P > Mp;

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

int main()
{
	cin >> n;

	w[0] = 1;

	for (int i = 1; i <= n; i++)
		w[i] = w[i - 1] * 2 % M;

	for (int i = 0; i < n; i++) {
		cin >> a >> b;

		if (a == 0 && b == 0)
			q++;
		else {
			long long g = gcd(abs(a), abs(b));
			a /= g;
			b /= g;

			if (b == 0)
				a = 1;
			else if (b < 0) {
				a = -a;
				b = -b;
			}

			if (a <= 0)
				Mp[{b, -a}].second++;
			else
				Mp[{a, b}].first++;
		}
	}

	for (auto it : Mp) {
		long long x = it.second.first, y = it.second.second;
		m = m * (w[x] + w[y] - 1) % M;
	}

	cout << (M + m + q - 1) % M << endl;
}


Measured memory_bytes: 20584
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

const int MOD = 1000000007;
struct mint {
    int64 x;
    mint(const int64 x1=0) { x = x1%MOD; };

    mint& operator++(int n) { x+=1; return *this; };
    mint& operator--(int n) { x-=1; return *this; };
    mint& operator=(int64 n) { x=n%MOD; return *this; };
    mint& operator--() {x-=1; return *this; };
    mint& operator+=(const mint a) { if ( (x+=a.x) >= MOD) x-=MOD; return *this; }
    mint& operator-=(const mint a) { if ( (x+= MOD-a.x) >= MOD) x-= MOD; return *this; }
    mint& operator*=(const mint a) { (x*=a.x) %= MOD; return *this; }
    mint& operator/=(const mint a) { return (*this) *= a.inv();}
    mint operator+(const mint a) const { mint res(*this); return res+=a; }
    mint operator-(const mint a) const { mint res(*this); return res-=a; }
    mint operator*(const mint a) const { mint res(*this); return res*=a; }
    mint operator/(const mint a) const { mint res(*this); return res/=a; }
    mint inv() const { return pow(MOD-2);}
    friend ostream& operator<<(ostream &os, const mint a) noexcept { return os << a.x; }
    constexpr bool operator == (const mint& r) const noexcept { return this->x == r.x; }
    constexpr bool operator != (const mint& r) const noexcept { return this->x != r.x; }
    mint pow(long long t) const {
        if (!t) return mint(1);
        mint a = pow(t>>1);
        a*=a;
        if(t&1) a*= *this;
        return a;
    }
};

int main() {
    int n,k;
    cin >> n >> k;
    mint nmint = n;
    mint ans = 0;
    for (int i=k; i<=n+1; i++) {
        mint imint = i;
        ans += imint*(nmint+(nmint-imint+1))/2 - imint*(imint-1)/2 + 1;
    }
    cout << ans << endl;
}

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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;

int gcd(int x, int y) {  return y == 0 ? x : gcd(abs(y), abs(x) % abs(y)); }

int main()
{
  int A, B, C; scanf("%d %d %d", &A, &B, &C);
  string ans = "YES";
  if (C % gcd(A, B) != 0) { ans = "NO"; }
  printf("%s\n", ans.c_str());
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fo(i,l,r) for(int i=l;i<=r;i++)
#define of(i,l,r) for(int i=l;i>=r;i--)
#define fe(i,u) for(int i=head[u];i;i=e[i].next)
#define el putchar('\n')
#define ta putchar('	')
using namespace std;
typedef long long ll;
typedef vector<int> vi;
inline void open(const char *s)
{
	#ifndef ONLINE_JUDGE
	char str[20];
	sprintf(str,"%s.in",s);
	freopen(str,"r",stdin);
//	sprintf(str,"%s.out",s);
//	freopen(str,"w",stdout);
	#endif
}
inline int rd()
{
	static int x,f;
	x=0;f=1;
	char ch=getchar();
	for(;ch<'0'||ch>'9';ch=getchar())if(ch=='-')f=-1;
	for(;ch>='0'&&ch<='9';ch=getchar())x=x*10+ch-'0';
	return f>0?x:-x;
}
const int N=100010;
int n,K;
vi a[7],p,q,A,ans;

inline vi inv(vi a)
{static vi res(n+1);
	fo(i,1,n)res[a[i]]=i;
	return res;
}
inline vi mul(vi a,vi b)
{static vi res(n+1);
	fo(i,1,n)res[i]=a[b[i]];
	return res;
}
inline vi pwr(vi x,int k)
{static vi res(n+1);
	fo(i,1,n)res[i]=i;
	for(;k;k>>=1,x=mul(x,x))if(k&1)res=mul(res,x);
	return res;
}

int main()
{
	n=rd();K=rd();
	p.resize(n+1);q.resize(n+1);
	fo(i,1,n)p[i]=rd();
	fo(i,1,n)q[i]=rd();
	a[1]=p;a[2]=q;a[0].resize(n+1);fo(i,1,n)a[0][i]=i;
	A=mul(mul(mul(q,inv(p)),inv(q)),p);
	fo(i,3,6)a[i]=mul(a[i-1],inv(a[i-2]));
	if(K<=6){
		fo(i,1,n)printf("%d ",a[K][i]);
		return 0;
	}
	ans.resize(n+1);A=pwr(A,(K-1)/6);
	ans=mul(mul(A,a[(K-1)%6+1]),inv(A));
	fo(i,1,n)printf("%d ",ans[i]);
	return 0;
}


Measured memory_bytes: 8632
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
typedef pair<int, int> pii;

int main() {
  int N, M;
  cin >> N >> M;
  if (N == M) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 384
#ifdef DEBUG_IS_VALID
#define DEB 1 
#define _LIBCPP_DEBUG 0
#else
#define DEB 0
#define NDEBUG
#endif

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

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
#define fi first
#define se second
#pragma GCC optimize ("-O3")

using namespace std;

#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T1,typename T2>ostream& operator << (ostream& os, pair<T1,T2> p){cout << "(" << p.first << ", " << p.second << ")"; return os;}
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
template<typename T>ostream& operator << (ostream& os, set<T>& st){cout << "{"; for(auto itr = st.begin(); itr != st.end(); itr++) cout << *itr << (next(itr)!=st.end() ? ", " : ""); cout << "}"; return os;}
template<typename T1,typename T2>ostream& operator << (ostream& os, map<T1,T2> mp){cout << "{"; for(auto itr = mp.begin(); itr != mp.end(); itr++) cout << "(" << (itr->first) << ", " << (itr->second) << ")" << (next(itr)!=mp.end() ? "," : ""); cout << "}"; return os; }

void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline bool chmax(T& a,T const& b){if(a>=b) return false; a=b; return true;}
template<class T> inline bool chmin(T& a,T const& b){if(a<=b) return false; a=b; return true;}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vp = vector<Pl>;
using vvp = vector<vp>;

const int INF = 1<<29;
const long long LINF=1LL<<59;


void solve(long long N, std::vector<long long> A, std::vector<long long> B){
  ll ans = 0;
  rep(i,N){
    ll now = min(B[i],A[i]);
    B[i] -= now;
    A[i] -= now;
    ans += now;
    if(B[i]==0) continue;
    now = min(B[i],A[i+1]);
    A[i+1] -= now;
    ans += now;
  }
  cout << ans << endl;
}

int main(){
  std::cout << std::fixed << std::setprecision(15);
  long long N;
  scanf("%lld",&N);
  std::vector<long long> A(N+1);
  for(int i = 0 ; i < N+1 ; i++){
    scanf("%lld",&A[i]);
  }
  std::vector<long long> B(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&B[i]);
  }
  solve(N, std::move(A), std::move(B));
  return 0;
}


Measured memory_bytes: 1792
from collections import defaultdict

dd = defaultdict(int)

N = int(input())
A = list(map(int,input().split()))

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

print(ans)

Measured memory_bytes: 127168
#include <iostream> 
#include <sstream> 
#include <iomanip> 
#include <algorithm> 
#include <cmath> 
#include <string> 
#include <vector> 
#include <list> 
#include <queue> 
#include <stack> 
#include <set> 
#include <map> 
#include <bitset> 
#include <numeric> 
#include <climits> 
#include <cfloat> 
using namespace std;

int main()
{
    for(;;){
        int n, s;
        cin >> n >> s;
        if(n == 0)
            return 0;

        vector<int> r(n);
        for(int i=0; i<n; ++i)
            cin >> r[i];
        sort(r.begin(), r.end());

        int j = n - 1;
        int ret = 0;
        for(int i=0; i<n; ++i){
            while(j >= 0 && r[i] + r[j] > s)
                -- j;
            ret += n - 1 - j;
            if(r[i] + r[i] > s)
                -- ret;
        }
        ret /= 2;

        cout << ret << endl;
    }
}

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

using namespace std;

struct edge
{
  int to, cost;
};

vector< edge > g[100000];
long long dist[100000];


void dfs1(int idx, int par)
{
  for(edge &e : g[idx]) {
    if(e.to == par) continue;
    dfs1(e.to, idx);
    dist[idx] = max(dist[idx], dist[e.to] + e.cost);
  }
}

int dfs2(int idx, int d_par, int par)
{
  vector< pair< int, int > > d_child;
  d_child.emplace_back(0, -1);
  for(edge &e : g[idx]) {
    if(e.to == par) d_child.emplace_back(d_par + e.cost, e.to);
    else d_child.emplace_back(e.cost + dist[e.to], e.to);
  }
  sort(d_child.rbegin(), d_child.rend());
  int ret = d_child[0].first + d_child[1].first;
  for(edge &e : g[idx]) {
    if(e.to == par) continue;
    ret = max(ret, dfs2(e.to, d_child[d_child[0].second == e.to].first, idx));
  }
  return (ret);
}

int main()
{
  int N;
  cin >> N;
  for(int i = 0; i < N - 1; i++) {
    int a, b, w;
    cin >> a >> b >> w;
    g[a].push_back((edge) {b, w});
    g[b].push_back((edge) {a, w});
  }

  dfs1(N / 2, -1);
  cout << dfs2(N / 2, 0, -1) << endl;
}

Measured memory_bytes: 20184
S=input();ans=0;
for b in range(2**(len(S)-1)):
  x=int(S[0]);
  for i in range(1,len(S)):
    if(b%2):
      ans+=x;
      x=0;
    else:
      x*=10;
    x+=int(S[i])
    b//=2;
  ans+=x;
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for(int i= 0; i < (n); i++)
using ll= long long int;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll mod= 1e9 + 7;


int main(){
  int ac=0,wa=0,tle=0,re=0;
  int n;
  cin >> n;
  rep(i,n){
    string s;
    cin >> s;
    if(s=="AC")ac++;
    if(s=="WA")wa++;
    if(s=="TLE")tle++;
    if(s=="RE")re++;
  }
  cout << "AC x " << ac << endl;
  cout << "WA x " << wa << endl;
  cout << "TLE x " << tle << endl;
  cout << "RE x " << re << endl;

}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>

using namespace std;

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

  int sum = 0;
  for(int i = 1; i < b-a; i++)
    sum += i;

  cout << sum-a << endl;
}

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

#define INF 1e9
const double EPS = 1e-4;
typedef long long ll;
typedef complex<double> Point;
typedef vector<Point> VP;
#define X real()
#define Y imag()
#define EQ(n,m) (abs((n)-(m)) < EPS)
#define LE(n,m) ((n) < (m) + EPS)

double dot(Point a, Point b) {
  return a.X*b.X + a.Y*b.Y;
}

double cross(Point a, Point b) {
  return a.X*b.Y - a.Y*b.X;
}

// ????§???¢????????¨??????
// ?????????????????¨??????2????¢?????????????1????????¨??????0?????????
int inPolygon(const VP& ps, Point p) {
  int n = ps.size();
  bool in = false;
  rep (i, n) {
    Point a = ps[i] - p;
    Point b = ps[(i + 1) % n] - p;
    if (EQ(cross(a,b), 0) && LE(dot(a,b), 0)) return 1;
    if (a.Y > b.Y) swap(a,b);
    if ((a.Y*b.Y < 0 || (a.Y*b.Y < EPS && b.Y > EPS)) && LE(cross(a, b), 0)) in = !in;
  }
  return (in ? 2 : 0);
}

int main(void){
    int n,q;
    double x,y;
    cin>>n;
    VP g(n);
    rep(i,n){
        cin>>x>>y;
        g[i] = {x,y};
    }
    cin>>q;
    rep(i,q){
    	cin>>x>>y;
    	cout<<inPolygon(g,Point(x,y))<<endl;
    }
    return 0;
}

Measured memory_bytes: 3232
#include<iostream>
#include<cstdio>
#include<utility>
#include<algorithm>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;
typedef pair<double,int> p;

int main(){
	p ath[3][8];
	rep(i,3)rep(j,8)cin>>ath[i][j].second>>ath[i][j].first;
	rep(i,3)sort(ath[i],ath[i]+8);
	rep(i,3)rep(j,2)printf("%d %.2f\n",ath[i][j].second,ath[i][j].first);
	p hoge[18];
	int cnt=0;
	rep(i,3)loop(j,2,8){hoge[cnt]=ath[i][j];cnt++;}
	sort(hoge,hoge+18);
	rep(i,2)printf("%d %.2f\n",hoge[i].second,hoge[i].first);
	return 0;
}

Measured memory_bytes: 1248