akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
using namespace std;
const int D_MAX_V=400;
const int D_v_size=400;
struct D_wolf{
	int t,c,r;
	D_wolf(){t=c=r=0;}
	D_wolf(int t1,int c1,int r1){
		t=t1;c=c1;r=r1;
	}
};
vector<D_wolf>D_G[D_MAX_V];
int D_level[D_MAX_V];
int D_iter[D_MAX_V];

void add_edge(int from,int to,int cap){
	D_G[from].push_back(D_wolf(to,cap,D_G[to].size()));
	D_G[to].push_back(D_wolf(from,cap,D_G[from].size()-1));
}
void D_bfs(int s){
	for(int i=0;i<D_v_size;i++)D_level[i]=-1;
	queue<int> Q;
	D_level[s]=0;
	Q.push(s);
	while(Q.size()){
		int v=Q.front();
		Q.pop();
		for(int i=0;i<D_G[v].size();i++){
			if(D_G[v][i].c>0&&D_level[D_G[v][i].t]<0){
				D_level[D_G[v][i].t]=D_level[v]+1;
				Q.push(D_G[v][i].t);
			}
		}
	}
}
int D_dfs(int v,int t,int f){
	if(v==t)return f;
	for(;D_iter[v]<D_G[v].size();D_iter[v]++){
		int i=D_iter[v];
		if(D_G[v][i].c>0&&D_level[v]<D_level[D_G[v][i].t]){
			int d=D_dfs(D_G[v][i].t,t,min(f,D_G[v][i].c));
			if(d>0){
				D_G[v][i].c-=d;
				D_G[D_G[v][i].t][D_G[v][i].r].c+=d;
				return d;
			}
		}
	}
	return 0;
}
int max_flow(int s,int t){
	int flow=0;
	for(;;){
		D_bfs(s);
		if(D_level[t]<0)return flow;
		for(int i=0;i<D_v_size;i++)D_iter[i]=0;
		int f;
		while((f=D_dfs(s,t,99999999))>0){flow+=f;}
	}
	return 0;
}
map<pair<int,int>,int>m;
int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	for(int i=0;i<b;i++){
		int p,q;scanf("%d%d",&p,&q);
		p--;q--;
		add_edge(p,q,1);
	//	add_edge(q,p,1);
		m[make_pair(q,p)]=i;
	}
	int s,t;scanf("%d%d",&s,&t);s--;t--;
	printf("%d\n",max_flow(s,t));
	int ret=0;
	vector<int>v;
	for(int i=0;i<a;i++){
		for(int j=0;j<D_G[i].size();j++){
			if(m.count(make_pair(i,D_G[i][j].t))){
				if(D_G[i][j].c==0)v.push_back(m[make_pair(i,D_G[i][j].t)]);
			}
		}
	}
	printf("%d\n",v.size());
	for(int i=0;i<v.size();i++){
		printf("%d\n",v[i]+1);
	}
}

Measured memory_bytes: 1172
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
  int i,j;
  int n,a=0;
  string s;
  cin>>n>>s;
  if(n%2==1){
    cout<<"No"<<endl;
    return 0;
  }
    n/=2;
    for(i=0;i<n;++i){
      if(s.at(i)==s.at(i+n))a+=1;
    }
    if(a!=n)cout<<"No"<<endl;
    else if(a==n)cout<<"Yes"<<endl;
}

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

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

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

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

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

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

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

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

int func(long long N, vector<long long> A, vector<long long> B,
         vector<long long> C) {
    // cout << fixed << setprecision(8);

    // ll ans = 0;
    ll sum = 0;
    rep(i, N) { sum += B[i]; }
    // cout << sum << endl;

    for (int i = 0; i < N - 1; i++) {
        if (A[i] == A[i + 1] - 1) {
            // cout << A[i] << endl;

            sum += C[A[i] - 1];
        }
    }

    cout << sum << endl;

    return 0;
}

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

    long long N;
    scanf("%lld", &N);
    vector<long long> A(N);
    for (int i = 0; i < N; i++) {
        scanf("%lld", &A[i]);
    }
    vector<long long> B(N);
    for (int i = 0; i < N; i++) {
        scanf("%lld", &B[i]);
    }
    vector<long long> C(N - 1);
    for (int i = 0; i < N - 1; i++) {
        scanf("%lld", &C[i]);
    }

    func(N, std::move(A), std::move(B), std::move(C));

    return 0;
}


Measured memory_bytes: 256
import collections

s = input()
c = collections.Counter(s)

ok1 = (c['N'] == 0 and c['S'] == 0) or (c['N'] > 0 and c['S'] > 0)
ok2 = (c['E'] == 0 and c['W'] == 0) or (c['E'] > 0 and c['W'] > 0)
if ok1 and ok2:
    print('Yes')
else:
    print('No')

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

int main(){
        int X;
        scanf("%d", &X);
    if (X == 3 || X == 5 || X == 7){
        printf("%s\n", "YES");
    }else{
        printf("%s\n", "NO");
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void) {
	char str[1005];
	int n;
	char instruct[30];
	char reverse[1005];
	int a,b;
	char p[1005];
	scanf("%s",str);
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		int k=0;
		scanf("%s %d %d",instruct,&a,&b);
		if(instruct[2] == 'i'){
			for(int j=a;j<=b;j++)printf("%c",str[j]);
			printf("\n");
		}else if(instruct[2] == 'v'){
			for(int j=b;j>=a;j--)reverse[k++] = str[j];
			for(int j=a,k=0;j<=b;j++){
				str[j] = reverse[k++];
			}//printf("%s\n",str);
		}else if(instruct[2] == 'p'){
			scanf("%s",p);
			for(int j=a;j<=b;j++){
				str[j] = p[k++];
			}//printf("%s\n",str);
		}
	}
	return 0;
}


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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
//#define int ll
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;
typedef complex<double> base;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define mp(a,b) make_pair(a,b)
#define modsum(a, b) ((a) + (b) >= M ? (a) + (b) - M : (a) + (b))
#define modsubtract(a, b) ((a) - (b) < 0 ? (a) - (b) + M : (a) - (b))
#define modmultiply(a, b) (((a) * (b)) % M)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define cint const int &
#define SZ(a) ((int)((a).size()))
#define watch(x) cout << (#x) << " = " << (x) << endl;

const double PI = 2 * acos(0.0);

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";


inline void transpose(vector<string> &a) {

    int n = a.size();
    if (n == 0) return;
    int m = a[0].size();
    vector<string> b(m, string(n, ' '));
    fori (i, n) fori (j, m) b[j][i] = a[i][j];
    a = b;
}


template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "{";
    fori (i, SZ(a))
        out << a[i] << vector<string>{", ", "}"}[i + 1 == SZ(a)];
    return out;
}

void smain();

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


#ifdef MAX_HOME
    freopen("input.txt", "r", stdin);
    clock_t start = clock();
#define cerr cout
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef MAX_HOME
    cout << "\n\n\n\n";
    cout << "TOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
}


const int N = 3009;
ld dp[N][N];

ld p[N];

void smain() {

    int n;
    cin >> n;
    fori (i, n) cin >> p[i + 1];
    dp[0][0] = 1;
    for (int i = 1; i <= n; ++i) {
        for (int j = 0; j <= n; ++j) {
            if (j) dp[i][j] = p[i] * dp[i - 1][j - 1];
            dp[i][j] = dp[i][j] + (1.0 - p[i]) * dp[i - 1][j];
        }
    }
    cout << accumulate(dp[n] + n / 2 + 1, dp[n] + n + 1, (ld) 0);
}

Measured memory_bytes: 141568
import java.util.ArrayDeque;
import java.util.Queue;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {

	public static final int BIG_NUM = 2000000000;
	public static final int MOD = 1000000007;
	public static final long HUGE_NUM = 99999999999999999L;
	public static final double EPS = 0.000000001;

	public static int H,W;

	@SuppressWarnings("unchecked")
	public static void main(String[] args) {

		//BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		Scanner scanner = new Scanner(System.in);

		int diff_row[] = {-1,0,0,1},diff_col[] = {0,-1,1,0};
		StringBuffer ANS = new StringBuffer();

		while(true){

			H = scanner.nextInt();
			W = scanner.nextInt();

			if(H == 0 && W == 0)break;

			int table[][] = new int[H][W];

			for(int row = 0; row < H; row++){
				for(int col = 0; col < W; col++){

					table[row][col] = -1;
				}
			}

			char base_map[][] = new char[H][W];

			for(int row = 0; row < H; row++){

				String tmp_str = scanner.next();
				for(int col = 0; col < W; col++){

					base_map[row][col] = tmp_str.charAt(col);
				}
			}

			int ans = 0;
			Queue<Info> Q = new ArrayDeque<Info>();

			for(int row = 0; row < H; row++){
				for(int col = 0; col < W; col++){
					if(table[row][col] != -1)continue;

					table[row][col] = ++ans;

					Q.add(new Info(row,col));

					while(!Q.isEmpty()){

						for(int i = 0; i < 4; i++){

							int adj_row = Q.peek().row+diff_row[i];
							int adj_col = Q.peek().col+diff_col[i];

							if(rangeCheck(adj_row,adj_col) == false || base_map[adj_row][adj_col] != base_map[row][col] ||
									table[adj_row][adj_col] != -1)continue;

							table[adj_row][adj_col] = ans;
							Q.add(new Info(adj_row,adj_col));
						}

						Q.poll();
					}
				}
			}
			ANS.append(ans).append("\n");
		}

		System.out.print(ANS.toString());
    }

	public static boolean rangeCheck(int row,int col){

		return row >= 0 && row <= H-1 && col >= 0 && col <= W-1;
	}
}

class Info{

	public int row;
	public int col;

	Info(int arg_row,int arg_col){
		this.row = arg_row;
		this.col = arg_col;
	}
}

class UTIL{

	//最大公約数
	public static long gcd(long x,long y){

		x = Math.abs(x);
		y = Math.abs(y);

		if(x < y){

			long tmp = y;
			y = x;
			x = tmp;
		}

		if(y == 0){

			return x;
		}else{

			return gcd(y,x%y);
		}
	}

	//最小公倍数
	public static long lcm(long x,long y){

		return (x*y)/gcd(x,y);
	}

	//String→intへ変換
    public static int getNUM(String tmp_str){

        return Integer.parseInt(tmp_str);
    }

    //文字が半角数字か判定する関数
    public static boolean isNumber(String tmp_str){

        if(tmp_str == null || tmp_str.length() == 0){

            return false;
        }

        Pattern pattern = Pattern.compile("\\A[0-9]+\\z");
        Matcher matcher = pattern.matcher(tmp_str);
        return matcher.matches();
    }
}


Measured memory_bytes: 30252
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int n;
  cin >> n;
  map<string,int> m;
  rep(i,n){
    string s;
    cin >> s;
    m[s]++;
  }
  cout << "AC x " << m["AC"] << endl;
  cout << "WA x " << m["WA"] << endl;
  cout << "TLE x " << m["TLE"] << endl;
  cout << "RE x " << m["RE"] << endl;
}


Measured memory_bytes: 3600
package main

import "fmt"

func main() {
  var a, b, c int
  fmt.Scanf("%d %d %d", &a, &b, &c)

  ans := "NO"
  for i := a; i < (a * b); i++ {
    if (a*i)%b == c {
      ans = "YES"
    }
  }
  fmt.Println(ans)
}

Measured memory_bytes: 1836
k=int(input())
q=[1,2,3,4,5,6,7,8,9]
for i in range(k):
    l=q.pop(0)
    if l%10!=0:
        q.append(10*l+l%10-1)
    q.append(10*l+l%10)
    if l%10!=9:
        q.append(10*l+l%10+1)
print(l)

Measured memory_bytes: 18768
/*    Isn't it lovely, all alone?              */
/*    Heart made of glass, my mind of stone    */
/*    Tear me to pieces, skin to bone          */
/*    Hello, welcome home                      */

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long int ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,
             tree_order_statistics_node_update>
    indexed_set;
ll mod=1000000007;


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

ll t=1;
//cin>>t;
while(t--)
{


ll n,k;
cin>>n>>k;
ll a[n],i;
for(i=0;i<n;i++)
cin>>a[i];

sort(a,a+n);
ll sum=0;
for(i=0;i<k;i++)
sum+=a[i];

cout<<sum<<endl;
}
return 0;
}









Measured memory_bytes: 3656
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <numeric>
#include <set>
#include <queue>
using namespace std;
typedef long long ll;

void solve() {
	int h1, m1, h2, m2, k; cin >> h1 >> m1 >> h2 >> m2 >> k;
	int time = (h2 - h1) * 60 + (m2 - m1);
	cout << max(0, time - k);
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	// int t; cin >> t;
	// while (t--)
	solve();


}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ll mod2 = 998244353;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s; cin >> s;
  int n = s.size();
  if(s[0] == s[n-1]) {
    cout << (n%2==0 ? "First" : "Second") << endk;
  } else {
    cout << (n%2==1 ? "First" : "Second") << endk;
  }
  return 0;
}


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

template <class Abel>
struct UnionFind {
  vector<int> par;
  vector<int> rank;
  vector<Abel> diff_weight;

  UnionFind(int n = 1, Abel SUM_UNITY = 0) { init(n, SUM_UNITY); }

  void init(int n = 1, Abel SUM_UNITY = 0) {
    par.resize(n);
    rank.resize(n);
    diff_weight.resize(n);
    rep(i, n) par[i] = i, rank[i] = 0, diff_weight[i] = SUM_UNITY;
  }

  int root(int x) {
    if (par[x] == x) {
      return x;
    } else {
      int r = root(par[x]);
      diff_weight[x] += diff_weight[par[x]];
      return par[x] = r;
    }
  }

  Abel weight(int x) {
    root(x);
    return diff_weight[x];
  }

  bool issame(int x, int y) { return root(x) == root(y); }

  bool merge(int x, int y, Abel w) {
    w += weight(x);
    w -= weight(y);
    x = root(x);
    y = root(y);
    if (x == y) return false;
    if (rank[x] < rank[y]) swap(x, y), w = -w;
    if (rank[x] == rank[y]) ++rank[x];
    par[y] = x;
    diff_weight[y] = w;
    return true;
  }

  Abel diff(int x, int y) { return weight(y) - weight(x); }
};

int main() {
  int n, m;
  cin >> n >> m;
  UnionFind<int> uf(n);
  rep(i, m) {
    int l, r, d;
    cin >> l >> r >> d;
    --l, --r;
    if (uf.issame(l, r)) {
      int diff = uf.diff(l, r);
      if (diff != d) {
        cout << "No" << endl;
        return 0;
      }
    } else {
      uf.merge(l, r, d);
    }
  }
  cout << "Yes" << endl;
}

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

int main()
{
    string day[]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
    int Mon[12]={31,29,31,30,31,30,31,31,30,31,30,31};
    int m,d;
    while(cin>>m>>d,m*d){
        int allDay=d;
        for(int i=0;i<m-1;i++){
            allDay += Mon[i];
        }
        cout<<day[allDay%7]<<endl;
    }
}

Measured memory_bytes: 1192
// ABC169D - Div Game

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

typedef unsigned long long int ull;
typedef long long int ll;

int main() {
	ull N;
	cin >> N;

	if (N == 1) {
		cout << 0 << endl;
		return 0;
	}

	ull t = N;
	map<ull, ull> a;
	for (ull i = 2; i < (int)sqrt(N); i++) {
		while (1) {
			if (t % i == 0) {
				++a[i];
				t = t / i;
			} else {
				break;
			}
		}
	}
	if (t != 1) {
		++a[t];
	}

//	map<ull, ull>::iterator it;
//	for (it = a.begin(); it != a.end(); it++) {
//		pair<int, int> p = *it;
//		cout << p.first << "^" << p.second << " ";
//	}
//	cout << endl;

	int ans = 0;
	map<ull, ull>::iterator it;
	for (it = a.begin(); it != a.end(); it++) {
		pair<int, int> p = *it;
		ull t = 0;
		for(ull i = 1;  ; i++) {
			if (t + i > p.second) {
				ans += (i - 1);
				break;
			}
			t = t + i;
		}
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3724
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

int main() {
  int a, b, x;
  scanf("%d%d%d", &a, &b, &x);
  double theta;
  if (2 * x >= a * a * b) {
    double d = 2.0 * (a * a * b - x) / (a * a);
    theta = atan2(d, a);
  } else {
    double d = 2.0 * x / a / b;
    theta = atan2(d, b);
    theta = M_PI / 2 - theta;
  }
  double ret = theta / M_PI * 180;
  printf("%.10f\n", ret);
  return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
int Solve(int,int);


int n,A[2000],q,M[2000];

int main(int argc , char *argv[]){
    int i;
    int tsk=1;
    
    
    
    scanf("%d",&n);
    if(n>20)return 0;
    
    
    
    for(i=0;i<n;i++){
        scanf("%d",&A[i]);
    }
    
    
    scanf("%d",&q);
    if(q>200)return 0;
    
    for(i=0;i<q;i++){
        scanf("%d",&M[i]);
    }
    
    for(i=0;i<q;i++){
        
        if(Solve(0,M[i])){
            printf("yes\n");
        }
        else {
           printf("no\n");
        }
    }

    return 0;
}//ENDmain





int Solve(int p,int N){
    
    if(N==0)return 1;
    if(N<0)return 0;
    if(p>n)return 0;
    
    if(Solve(p+1,N-A[p])==1){
        return 1;
    }
    if(Solve(p+1,N)==1){
        return 1;
    }
    else return 0;
    
}

Measured memory_bytes: 588
<?php

$converter = array(
    'A' => 0,
    'B' => 1,
    'AB' => 2,
    '0' => 3,
);
$type_cnt = array(0, 0, 0, 0);
while (fscanf(STDIN, '%d,%s', $i, $type)) {
    $type_cnt[$converter[$type]]++;
};

foreach ($type_cnt as $cnt) {
    echo $cnt . PHP_EOL;
};


Measured memory_bytes: 9244
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const int INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const int MOD = 1000000007;
const int MAX = 510000;
const double pi = acos(-1);
const double eps = 1e-9;


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll h,w;
    cin>>h>>w;
    string s[30][30];
    rep(i,h)rep(j,w) cin>>s[i][j];
    rep(i,h)rep(j,w){
        if(s[i][j]=="snuke"){
            cout<<(char)('A'+j)<<i+1<<endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
bool cmp(LL a,LL b)
{
	return a>b;
}
int main()
{
	 int n,k;
	 cin>>n>>k;
	 LL sum[1005]={0};
	 for(int i=1;i<=n;i++)
	 {
	 	 cin>>sum[i];
		 sum[i]+=sum[i-1]; 
	 } 
	 vector<LL>v;
	 for(int i=1;i<=n;i++)
	 {
	 	 for(int j=i;j<=n;j++)
	 	 {
	 	 	v.push_back(sum[j]-sum[i-1]);
		  }
	 }
	 
	  LL ans=0;
	  for(int i=40;i>=0;i--)
	  {
	  	
	  	int count=0;
	  	LL t=1LL<<i;
	  	vector<LL>v2;
	  	for(int j=0;j<v.size();j++)
	  	{
	  		if(v[j]&t)
	  		{
	  		v2.push_back(v[j]);
	  			count++;
			  }
		  }
		  if(count>=k)
		  {
		  	v=v2;
		  	ans+=t;
		  }
	  }
	 cout<<ans<<"\n";
 } 

Measured memory_bytes: 6384
#include<stdio.h>
#include<iostream>
#include<string>
#include<math.h>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<time.h>
#include<ctime>
#include<functional>
#define int long long
#define INT INT_MAX
#define LONG LLONG_MAX
#define f(i,n) for(int i=0;i<(n);i++)
#define P pair<int,int>
typedef long long ll;
using namespace std;

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

ll LCM(ll a, ll b) {
	return a / GCD(a, b)*b;
}

ll mypow(ll a, ll b, ll c) {
	if (b == 0)return 1;
	if (b % 2)return mypow(a, b - 1, c)*a%c;
	else return mypow(a, b / 2, c)*mypow(a, b / 2, c) % c;
}

signed main() {
	string s;
	cin >> s;
	int x = 0, xx = 0, y = 0, yy = 0;
	f(i, s.size()) {
		if (s[i] == 'T') x++;
		else x--;
		xx = max(x, xx);
	}
	cout << xx * 2 << endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#define INF 1e+8
using namespace std;

int main(){
	int n,m,s,g1,g2;
	while(1){
		cin >> n >> m >> s >> g1 >> g2; s--;g1--;g2--;
		if(!n) break;
		int cost[100][100];
		for(int i = 0;i < n;i++){
			for(int j = 0;j < n;j++) cost[i][j] = INF;
			cost[i][i] = 0;
		}
		for(int i = 0;i < m;i++){
			int a,b,c;
			cin >> a >> b >> c;
			cost[a - 1][b - 1] = c;
		}
		for(int k = 0;k < n;k++){
			for(int i = 0;i < n;i++){
				for(int j = 0;j < n;j++){
					cost[i][j] = min(cost[i][j],cost[i][k] + cost[k][j]);
				}
			}
		}
		int mi = INF;
		for(int i = 0;i < n;i++){
			mi = min(mi,cost[s][i] + cost[i][g1] + cost[i][g2]);
		}
		cout << mi << endl;
	}
	return 0;
}

Measured memory_bytes: 3040
N = int(input())
strs = []
for i in range(N):
  str = list(input())
  str.sort()
  strs.append("".join(str))

strs.sort()
# print(strs)

cnts = []
pre = strs[0]
cnt = 1
for str in strs[1:]:
  if str == pre:
    cnt += 1
  else:
    cnts += [cnt]
    pre = str
    cnt = 1
cnts += [cnt]

# print(cnts)

ans = 0
for cnt in cnts:
  if cnt == 1:
    continue
  ans += cnt * (cnt - 1) / 2
  
print(int(ans))

Measured memory_bytes: 12020
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main(){
	int n, m;
	vector<string> U;
	string T;
	int Lock = 1;

	cin >> n;
	for (int i = 0; i < n; i++){
		string u;
		cin >> u;
		U.push_back(u);
	}
	cin >> m;
	for (int i = 0; i < m; i++){
		cin >> T;
		int flg = 0;
		for (int j = 0; j < U.size(); j++){
			if (T == U[j]){
				if (Lock == 0){
					cout << "Closed by " << T << endl;
					Lock = 1;
				}
				else{
					cout << "Opened by " << T << endl;
					Lock = 0;
				}
				flg = 1;
				break;
			}
		}
		if (flg == 0) cout << "Unknown " << T << endl;
	}
	return 0;
}

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

int manh(pair<int,int>t, pair<int,int> t2){
	return abs(t.first-t2.first)+abs(t.second-t2.second);
}

int main(){
	int n,m;
	cin>>n>>m;
	pair<int,int> ar[n];
	pair<int,int> ar2[m];
	
	for(int i=0;i<n;i++)
		cin>>ar[i].first>>ar[i].second;
	for(int i=0;i<m;i++)
		cin>>ar2[i].first>>ar2[i].second;
		
	for(int i=0;i<n;i++){
		vector<int> v;
		int minn=1e9;
		for(int j=0;j<m;j++)
			if(manh(ar2[j],ar[i])<=minn){
				if(manh(ar2[j],ar[i])<minn) v.clear(),minn=manh(ar2[j],ar[i]);
				v.push_back(j+1);
			}
		sort(v.begin(),v.end());
		cout<<v[0]<<'\n';
	}
}

Measured memory_bytes: 256
import std.stdio;
import std.algorithm;
import std.range;
import std.string;
import std.conv;

// 素因数分解
uint[] prime_factor(uint n) {
  uint[] res = [];
  for(uint i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      do {
        res ~= i;
        n = n / i;
      } while (n % i == 0);
    }
  }
  if (n > 1) res ~= n;
  return res;
}

void main() {
  // 5 と 2 の約数を調べる
  while(true) {
    uint n = readln.chomp.to!(uint);
    uint a = 0, b = 0;
    if (n == 0) break;
    foreach(numbers; iota(0, n + 1).map!(prime_factor)) {
      foreach(number; numbers) {
        if (number == 2) a++;
        else if (number == 5) b++;
      }
    }
    min(a, b).writeln;
  }
}

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

using namespace std;
const int N=1e5+5;
int n,f[N][3],a,b,c;
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a>>b>>c;
        f[i][0]=max(f[i-1][1],f[i-1][2])+a;
        f[i][1]=max(f[i-1][0],f[i-1][2])+b;
        f[i][2]=max(f[i-1][0],f[i-1][1])+c;
    }
    cout<<max(f[n][0],max(f[n][1],f[n][2]));
    return 0;
}


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

int main() {
  string s;
  cin >> s;
  switch (s.back() - '0') {
    case 2:
    case 4:
    case 5:
    case 7:
    case 9:
      cout << "hon" << endl;
      break;
    case 0:
    case 1:
    case 6:
    case 8:
      cout << "pon" << endl;
      break;
    case 3:
      cout << "bon" << endl;
      break;
  }
}


Measured memory_bytes: 3628
K = int(input())
S = str(input())
# = map(int, input().split())
# = list(map(int, input().split()))
# = [int(input()) for i in range(N)]
# = [list(map(int, input().split())) for i in range(N)]
s = list(S)

if len(s)<= K:
    print(S)

else:
    print(S[:K]+"...")


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

int main(){ 
  int k;
  cin >> k;
  int a, b;
  cin >> a >> b;
  for (int i = a; i <= b; i++) {
    if (i % k == 0) {
      cout << "OK" << endl;
      return 0;
    }
  }
  cout << "NG" << endl;
  return 0;
} 

Measured memory_bytes: 3592
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define forE(i,x) for(int i=head[x];i!=-1;i=ne[i])
using namespace std;
typedef long long i64;
typedef unsigned long long u64;
typedef unsigned u32;
typedef pair<int,int> pin;
#define mk(a,b) make_pair(a,b)
#define lowbit(x) ((x)&(-(x)))
#define sqr(a) ((a)*(a))
#define clr(a) (memset((a),0,sizeof(a)))
#define ls ((x)<<1)
#define rs (((x)<<1)|1)
#define mid (((l)+(r))>>1)
#define pb push_back
#define w1 first
#define w2 second
inline void read(int &x){
	x=0;int 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();}
	x*=f;
}
inline void judge(){
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
}
/*******************************head*******************************/
const int maxn=3005,mod=1e9+7;;
int f[maxn][maxn],C[maxn][maxn];
inline void prprpr(){
	rep(i,0,3000){
		C[i][0]=1;
		rep(j,1,3000)C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
	}
}
inline int powmod(int a,int b){
	int res=1;for(;b;b>>=1){
		if(b&1)res=1ll*res*a%mod;a=1ll*a*a%mod;
	}return res;
}
int n;char s[maxn];
int sum[maxn];
int lpos[maxn],rpos[maxn],tot;
int main(){
	// judge();
	prprpr();
	read(n);read(tot);
	scanf("%s",s+1);
	rep(i,1,n)sum[i]=sum[i-1]+(s[i]=='1');
	rep(i,1,tot){
		read(lpos[i]),read(rpos[i]);
		if(rpos[i]<=rpos[i-1])
			i--,tot--;
		else if (lpos[i]==lpos[i-1]){
			rpos[i-1]=rpos[i];
			i--;tot--;
		}
	}
	lpos[tot+1]=n+1;
	f[0][0]=1;int lq=0,rq=0;
	rep(i,1,tot){
		int nl=min(lpos[i+1],rpos[i]+1);
		int num=sum[rpos[i]]-sum[max(lpos[i]-1,rpos[i-1])];
		int len1=nl-lpos[i],len2=rpos[i]-nl+1;
		int nlq=max(lq+num-len1,0),nrq=min(rq+num,len2);
		rep(j,nlq,nrq){
			int tmp=0;
			rep(k,max(lq,j-num),min(rq,len1+j-num)){
				tmp=(tmp+1ll*f[i-1][k]*C[len1][k+num-j])%mod;
			}
			f[i][j]=tmp;
		}lq=nlq;rq=nrq;
	}
	printf("%d\n",f[tot][0]);
	return 0;
}


Measured memory_bytes: 51456
#include<stdio.h>
int main(void)
{ char S[11];
  int count[10]={0};
 int life;
 int i=0;
 int j=0;
  scanf("%s",&S);
  while(S[i]!='\0')
  { if((S[i]=='A' || S[i]=='T')||(S[i]=='C' || S[i]=='G'))
     count[j]++;
    if((S[i]!='A' && S[i]!='T')&&(S[i]!='C' && S[i]!='G'))
    if(count[j]!=0)j++;
    i++;
  }
 i=0;
 for(j=0;j<10;j++)
 if(i<count[j])i=count[j];
 printf("%d",i);
 return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {
  // 入力
  int N, L;
  cin >> N >> L;
  vector<string> s(N);
  for (int i=0; i<N; i++) {
    cin >> s[i];
  }

  string tmp;
  for (int i=0; i<N; i++) {
    for (int j=0; j<N; j++) {
      if (s[i] < s[j]) {
        // s[i]とs[j]を交換
        tmp = s[i];
        s[i] = s[j];
        s[j] = tmp;
      }
    }
  }

  string ans="";
  for (int i=0; i<N; i++) {
    for (int j=0; j<L; j++) {
      ans.push_back(s[i][j]);
    }
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits//stdc++.h>
using namespace std;
#define int long long
#define rep(i,n,k) for(int i=n;i<k;i++)
#define P make_pair
#define F first
#define S second
#define M LLONG_MAX
signed main(void){
    int n,m,ans,p,q,r,c;
    ans=0;
    string s,s1,s2;
    vector<int> v,v1;
    cin>>n;
    int a[n];
    rep(i,0,n){
        cin>>a[i];
    }
    p=a[0];
    rep(i,1,n){
        if(p<a[i])
        p=a[i];
        else
        ans+=p-a[i];
    }
    
    
    cout<<ans<<endl;
    
    
    
}


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

void shuffle_cards(string cards)
{
  int shuffle_num;
  cin >> shuffle_num;
  for (int i = 0; i < shuffle_num; i++)
  {
    int shuffle;
    cin >> shuffle;
    cards = cards.substr(shuffle) + cards.substr(0, shuffle);
  }
  cout << cards << endl;
}

int main()
{
  string cards;
  while (true)
  {
    cin >> cards;
    if (cards == "-"s)
    {
      break;
    }
    shuffle_cards(cards);
  }
}



Measured memory_bytes: 3220
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
#define M 1000000007
int main(){
  ll n,m;
  cin>>n>>m;
  vector<ll> a(n),b(m),c(m);
  vector<P> p(m);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  for(int i=0;i<m;i++){
    cin>>b[i]>>c[i];
    p[i]=P(c[i],b[i]);
  }
  sort(p.begin(),p.end(),greater<P>());
  ll d=0,e=0;
  bool f=true;
  for(int i=0;i<n;i++){
    if(f){
      if(p[d].first>a[i]){
        e+=p[d].first;
        p[d].second--;
        if(p[d].second==0) d++;
        if(d==m)f=false;
      }else{
        f=false;
        e+=a[i];
      }
    }else{
      e+=a[i];
    }
  }
  cout<<e;
}

Measured memory_bytes: 4096
y, x = map(int, input().split())
box = []
y_sum = [[]]

for i in range(y):
	box.append(list(map(int, input().split())))
	box[i].append(sum(box[i]))

box_replace = list(map(list, zip(*box)))
[y_sum[0].append(sum(box_replace[i])) for i in range(x+1)]
box += y_sum

[print( " ".join(map(str, box[i])) ) for i in range(y+1)]

Measured memory_bytes: 7924
using System;

class Program
{
    static void Main(string[] args) {

        while (true) {
            int n = int.Parse(Console.ReadLine());
            if (n == 0) { break; }

            string[] v = Console.ReadLine().Split(' ');

            double[] s = new double[n];

            double m = 0;
            for (int i = 0; i < n; i++) {
                s[i] = double.Parse(v[i]);
                m += s[i];
            }
            m = m / n;

            double z = 0;
            for (int i = 0; i < n; i++) {
                z += (s[i] - m) * (s[i] - m);
            }

            double a2 = z / n;
            double a = Math.Sqrt(a2);

            Console.WriteLine(a);
        }

    }
}


Measured memory_bytes: 15908
import sys
sys.setrecursionlimit(10 ** 7)

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

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

c = A + B

if A == 0:
    print(0)
    exit()

ans = 0
cnt = N // c
ans += cnt * A
N -= cnt * c

ans += min(N, A)

print(ans)


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

using ll=long long;
const int LOGN=20;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    vector<ll> x(n);
    for(int i=0;i<n;i++) cin>>x[i];

    ll l; int q;
    cin>>l>>q;
    vector<vector<int>> dp(LOGN,vector<int>(n,0));
    for(int i=0;i<n;i++){
        auto it=prev(upper_bound(x.begin(),x.end(),x[i]+l));
        int j=it-x.begin();
        dp[0][i]=j;
    }
    for(int i=0;i+1<LOGN;i++){
        for(int j=0;j<n;j++){
            dp[i+1][j]=dp[i][dp[i][j]];
        }
    }
    while(q--){
        int a,b;
        cin>>a>>b;
        a--,b--;
        if(a>b) swap(a,b);
        int res=0;
        for(int i=LOGN-1;i>=0;i--){
            if(dp[i][a]<b){
                res+=(1<<i);
                a=dp[i][a];
            }
        }
        res++;
        cout<<res<<"\n";
    }

    return 0;
}

Measured memory_bytes: 9464
#include<bits/stdc++.h>
const int N=1e5+5;
typedef long long ll;
int n,q,a[N],b[N],c[N],i,g[N],sz[N],C,CC;
ll m;
int gfa(int x){return g[x]==x?x:g[x]=gfa(g[x]);}
int main(){
	scanf("%d%lld%d",&n,&m,&q);
	for(i=1;i<=n;++i)g[i]=i;
	for(i=1;i<=q;++i)scanf("%d%d%d",a+i,b+i,c+i),++a[i],++b[i],c[i]==0?g[gfa(a[i])]=gfa(b[i]):0;
	for(i=1;i<=q;++i)if(c[i]==1){if(gfa(a[i])==gfa(b[i]))return puts("No"),0;C=1;}
	for(i=1;i<=n;++i)++sz[gfa(i)];
	for(i=1;i<=n;++i)if(gfa(i)==i)++CC;
	puts(n-1+C<=m && m<=1ll*CC*(CC-1)/2+n-CC && (!C || CC>2)?"Yes":"No");
	return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
int main()
{

    int n;
    cin >> n;
    vector <int> a(n);
    for(int i = 0; i < n;i++){
        cin >> a.at(i);
    }
    sort(a.begin(), a.end());

    int ans = 0;

    for(int i = 0;i < n-1;i++){
        if(a.at(i) == a.at(i+1)){
            ans++;
            break;
        }
    }

    if(ans == 0){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

    //cout << ans << endl;
    return 0;
}

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

long long dp[310][310],dpc[310][310];
long long ncr[310][310];
int N,K,M;

int main(){
	cin>>N>>K>>M;
	ncr[1][0] = ncr[1][1] = ncr[0][0] = 1;
	for(int i=2;i<310;i++){
		ncr[i][0] = 1;
		for(int j=1;j<=i;j++) ncr[i][j] = (ncr[i-1][j] + ncr[i-1][j-1])%M;
	}

	for(int i=0;i<=K;i++) dp[1][i] = 1;
	for(int i=K;i>=0;i--) dpc[1][i] = dp[1][i] + dpc[1][i+1];
	for(int i=2;i<=N+1;i++) for(int j=K;j>=0;j--){
		for(int k=1;k<i;k++) dp[i][j] += (dp[i-k][j]*dpc[k][j+1]%M)*ncr[i-2][k-1]%M;
		dp[i][j] %= M;
		dpc[i][j] = (dp[i][j] + dpc[i][j+1])%M;
	}
	
	cout<<dp[N+1][0]<<endl;
	return 0;
}

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define MP make_pair
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define fst first
#define snd second

string b[32];
int H, W, n;

bool can_clear(int h, int w) {
  int cnt_h = 1;
  int hi = h+1;
  while (hi < H && b[hi][w] == b[h][w]) hi++, cnt_h++;
  hi = h-1;
  while (0 <= hi && b[hi][w] == b[h][w]) hi--, cnt_h++;
  if (cnt_h >= n) return true;

  int cnt_w = 1;
  int wi = w+1;
  while (wi < W && b[h][wi] == b[h][w]) wi++, cnt_w++;
  wi = w-1;
  while (0 <= wi && b[h][wi] == b[h][w]) wi--, cnt_w++;

  return cnt_w >= n;
}

void drop() {
  for (int j = W-1; j >= 0; j--) {
    for (int i = H-1, bottom = H-1; i >= 0; i--) {
      if (b[i][j] != '.') {
	swap(b[i][j], b[bottom][j]);
	bottom--;
      }
    }
  }
}

bool can_all_clear() {
  drop();  
  bool do_clear[32][32];
  bool flag = true;
  while (flag) {
    flag = false;
    REP(i, H) REP(j, W)
      do_clear[i][j] = b[i][j] != '.' && can_clear(i, j);
    REP(i, H) REP(j, W) {
      if (do_clear[i][j]) {
	b[i][j] = '.';
	flag = true;
      }
    }
    drop();
  }
  REP(i, H) REP(j, W) {
    if (b[i][j] != '.') return false;
  }
  return true;
}

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

  cin >> H >> W >> n;
  string board[32];
  REP(i, H) cin >> board[i];
  REP(i, H) REP(j, W-1) {
    REP(l, H) b[l] = board[l];
    swap(b[i][j], b[i][j+1]);
    if (can_all_clear()) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 1212
import java.io.*;
import java.util.*;

class Main {

	public static void main(String[] args) throws Exception {
		final Scanner sc = new Scanner(System.in);
		long A = sc.nextLong();
		long B = sc.nextLong();
		long K = sc.nextLong();
		if (A > K) {
			System.out.println((A - K) + " " + B);
		} else {
			System.out.println("0 " + (Math.max(0, (B - (K - A)))));
		}
	}
}


Measured memory_bytes: 23892
#include <stdio.h>


int main(void){
  int odd = 0;
  int four = 0;


  int n,i;
  scanf("%d",&n);

  

  for(i = 0; i < n; i++){
    int tmp;
    scanf("%d",&tmp);
    if(tmp % 4 == 0)
      four++;
    else if(tmp % 2 != 0)
      odd++;
  }

  if(n == 1){
    if(four > 0)
      printf("Yes\n");
    else
     printf("No\n");
    return 0;
  }

  if(n % 2 == 1){
    if(four == n / 2){
     printf("Yes\n");
     return 0;
   }
  }
  
  if(n == 3 && four > 0){
    printf("Yes\n");
    return 0;
  }

  if(odd   > four){
    printf("No\n");

  }else{
    printf("Yes\n");
  }

  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, to) for (int i = 0; i < (to); ++i)
#define repf(i, from, to) for (int i = (from); i < (to); ++i)
#define unless(cond) if (!(cond))
using namespace std;
using ll = long long;
template <typename T>
using V = vector<T>;
template <typename T, typename U>
using P = pair<T, U>;

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

  int ans = k;
  repf(i, 1, n) {
    ans *= k - 1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3512
#include <bits/stdc++.h>
#define MAXN 1000100
#define pii pair<int, int>
#define pb push_back
#define inf 1e18
#define fi first
#define se second
#define mt make_tuple
typedef long long ll;

using namespace std;

string s;int ans;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> s;
    int n = s.size();
    for(int i = 0; i < n / 2; i++){
    	if(s[i] != s[n - i - 1]) ans++;
    }
    cout << ans;
}

Measured memory_bytes: 256
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN = 200000;
const int MAXS = 4 * MAXN;

int n;
int a[MAXN];
int b[MAXN], nb;

int sidx[MAXS], sval[MAXS], slazy[MAXS];
void sapply(int x, int val) {
	sval[x] += val, slazy[x] += val;
}
void spush(int x) {
	if (slazy[x] != 0) sapply(2 * x + 1, slazy[x]), sapply(2 * x + 2, slazy[x]), slazy[x] = 0;
}
void spull(int x) {
	sidx[x] = sidx[2 * x + 1], sval[x] = sval[2 * x + 1];
	if (sval[2 * x + 2] < sval[x]) sidx[x] = sidx[2 * x + 2], sval[x] = sval[2 * x + 2];
}
void sinit(int x, int l, int r) {
	slazy[x] = 0;
	if (l == r) {
		sidx[x] = l; sval[x] = b[l];
	} else {
		int m = l + (r - l) / 2;
		sinit(2 * x + 1, l, m); sinit(2 * x + 2, m + 1, r);
		spull(x);
	}
}
pair<int, int> sget(int x, int l, int r, int L, int R) {
	if (L <= l&&r <= R) {
		return MP(sidx[x], sval[x]);
	} else {
		spush(x);
		int m = l + (r - l) / 2;
		pair<int, int> ret = MP(-1, INT_MAX);
		if (L <= m) { pair<int, int> cur = sget(2 * x + 1, l, m, L, R); if (cur.second < ret.second) ret = cur; }
		if (m + 1 <= R) { pair<int, int> cur = sget(2 * x + 2, m + 1, r, L, R); if (cur.second < ret.second) ret = cur; }
		return ret;
	}
}
void smod(int x, int l, int r, int L, int R, int VAL) {
	if (L <= l&&r <= R) {
		sapply(x, VAL);
	} else {
		spush(x);
		int m = l + (r - l) / 2;
		if (L <= m) smod(2 * x + 1, l, m, L, R, VAL);
		if (m + 1 <= R) smod(2 * x + 2, m + 1, r, L, R, VAL);
		spull(x);
	}
}


void run() {
	scanf("%d", &n); REP(i, n) scanf("%d", &a[i]);

	nb = 0; REP(i, n) b[nb++] = a[i]; sort(b, b + nb); nb = unique(b, b + nb) - b;
	sinit(0, 0, nb - 1);

	ll ret = 0;
	REP(i, n) {
		int idx = lower_bound(b, b + nb, a[i]) - b;
		pair<int, int> val = sget(0, 0, nb - 1, idx, nb - 1);
		ret += val.second - b[idx];
		if (val.first != 0) smod(0, 0, nb - 1, 0, val.first - 1, 1);
	}
	printf("%lld\n", ret);
}

int main() {
	run();
	return 0;
}


Measured memory_bytes: 11136
#include <iostream>

using namespace std;

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

  int value = 700; //定価

  for(int i=0; i<3; i++)
    if(S[i] == 'o') //トッピング追加
      value += 100;

  cout << value << endl;

    

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
#include <ctime>
#include <assert.h>
#include <chrono>
#include <random>
#include <numeric>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
    return (ull)rng() % B;
}

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	while(1){
		string s; cin >> s;
		if(s=="#")break;
		if(s.size()<=2){
			printf("0\n");
			continue;
		}
		int res=1e9;
		// Left
		{
			int l=s[0]-'1';
			int r;
			bool p=1;
			int cost=0;
			for(int i=1;i<s.size();i++){
				if(p){
					int num=s[i]-'1';
					if(num%3>=l%3){
						r=num;
						p=0;
					}
					else{
						l=num;
						cost++;
					}
				}
				else{
					int num=s[i]-'1';
					if(num%3<=r%3){
						l=num;
						p=1;
					}
					else{
						cost++;
						r=num;
					}
				}
			}
			res=min(res,cost);
		}
		// Right
		{
			int r=s[0]-'1';
			int l;
			bool p=0;
			int cost=0;
			for(int i=1;i<s.size();i++){
				if(p){
					int num=s[i]-'1';
					if(num%3>=l%3){
						r=num;
						p=0;
					}
					else{
						l=num;
						cost++;
					}
				}
				else{
					int num=s[i]-'1';
					if(num%3<=r%3){
						l=num;
						p=1;
					}
					else{
						cost++;
						r=num;
					}
				}
			}
			res=min(res,cost);
		}
		printf("%d\n",res);
	}
}



Measured memory_bytes: 3440
#include <stdio.h>

int main()
{
  char s[4], t[4];
  int i;
  scanf("%s", s);
  scanf("%s", t);
  int ans=0;
  for(i=0;i<3;i++) if(s[i]==t[i]) ans++;
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main(void){
    long long l, r, ans;
    cin >> l >> r;
    if(r - l >= 2018){
        ans = 0;
    }else{
        ans = 2019;
        for(long long i = l; i < r; i++){
            for(long long j = i+1; j <= r; j++){
                ans = min(ans, (i*j) % 2019);
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define int long long
using namespace std;


signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);  
// #ifndef ONLINE_JUDGE
//    freopen ("INPUT.txt" , "r" , stdin);
//    freopen ("OUTPUT.txt" , "w" , stdout);
// #endif

    clock_t clk;
	clk = clock();

// --------------Code s0tarts here---------------------------------------------------------------------

    int n;
    cin>>n;
    int mn=1e17;
    for(int i=1;i*i<=n;i++)
    {
        if(n%i==0)
        {
            int z=n/i;
            mn=min(mn,i-1+n/i-1);
        }
    }
    cout<<mn;
// -------------------------------------Code ends here------------------------------------------------------

    clk = clock() - clk;
	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int n;
    cin>>n;
     int a[100000][4];
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<3;j++)
        {
            cin>>a[i][j];
        }
    }
     int dp[100000][4];
    dp[0][0]=a[0][0];
    dp[0][1]=a[0][1];
    dp[0][2]=a[0][2];
    for(int i=1;i<n;i++)
    {
        for(int j=0;j<=2;j++)
        {
            if(j==0)
            {
                dp[i][j]=a[i][j]+max(dp[i-1][j+1],dp[i-1][j+2]);
            }
            else if(j==1)
            {
                dp[i][j]=a[i][j]+max(dp[i-1][j-1],dp[i-1][j+1]);
            }
            else
            {
                 dp[i][j]=a[i][j]+max(dp[i-1][j-1],dp[i-1][j-2]);
            }
        }
    }
   
   
         int y=max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
        cout<<y;
}

Measured memory_bytes: 6228
#include<stdio.h>
#include<string.h>
typedef struct {
	char direction[100];
	int num1,num2,num3,num4,num5,num6;
}DICE_t;
int main(){
	DICE_t a;
	DICE_t b;
	scanf("%d %d %d %d %d %d",&b.num1,&b.num2,&b.num3,&b.num4,&b.num5,&b.num6);
	scanf("%d %d %d %d %d %d",&a.num1,&a.num2,&a.num3,&a.num4,&a.num5,&a.num6);
	int dummy,turn=0;
	    while(turn<24){
		    if(turn%4==0&&turn!=0){
		    	strcpy(a.direction,(turn%8==4 ?"SSEN":"ESEN"));
	    	}
    		else{
    			strcpy(a.direction,"SEN");
    		}
    	    for(int i=0;a.direction[i]!=0;i++){
    	        if(a.direction[i]=='N'){
		            dummy=a.num5;
	            	a.num5=a.num1;
	            	a.num1=a.num2;
	            	a.num2=a.num6;
	        	    a.num6=dummy;
	            }
	            else if(a.direction[i]=='S'){
		             dummy=a.num6;
	            	a.num6=a.num2;
	            	a.num2=a.num1;
	            	a.num1=a.num5;
	            	a.num5=dummy;
	            }
    	        else if(a.direction[i]=='E'){
		            dummy=a.num4;
	        	    a.num4=a.num6;
	        	    a.num6=a.num3;
	        	    a.num3=a.num1;
	        	    a.num1=dummy;
	            }
	            else if(a.direction[i]=='W'){
	                dummy=a.num1;
	            	a.num1=a.num3;
	            	a.num3=a.num6;
	            	a.num6=a.num4;
	            	a.num4=dummy;
	            }	
    	    }
	    	if(a.num1==b.num1&&a.num2==b.num2&&a.num3==b.num3&&a.num4==b.num4&&a.num5==b.num5&&a.num6==b.num6)break;
	    	turn++;
	    }
	if(a.num1==b.num1&&a.num2==b.num2&&a.num3==b.num3&&a.num4==b.num4&&a.num5==b.num5&&a.num6==b.num6){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	
	return 0;
}

Measured memory_bytes: 2668