akhauriyash/Code-Regression huggingface dataset:
/*input
200000
*/

// Nihesh Anderson - knandy

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; // find_by_order, order_of_key
ll MOD=1000000007;

#define endl '\n'
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
ll INF = 2000000000000000001;
long double EPS = 1e-9;
ll power(ll a, ll n, ll md){if(n==0){return 1;}else{int res=power(a,n/2,md);res=(res*res)%md;if(n%2!=0){res=(res*a)%md;}return res;}}
random_device rndm;
mt19937 grndm(rndm());
void mix(int* a, int* b){shuffle(a,b,grndm);}

ll f[10][10];

void insert(int val) {
	int lo = val % 10, hi;
	while(val > 0) {
		hi = val % 10;
		val /= 10;
	}
	f[hi][lo]++;
}

int main(){
	fast_cin();
	// freopen("input.in","r",stdin);
	// freopen("output.out","w",stdout);
	int n; cin >> n;
	for(int i = 1; i <= n; i++) {
		insert(i);
	}
	ll ans = 0;
	for(int i = 1; i < 10; i++) {
		for(int j = 1; j < 10; j++) {
			ans += f[i][j] * f[j][i];
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long a = sc.nextInt();
    long v = sc.nextInt();
    long b = sc.nextInt();
    long w = sc.nextInt();
    long t = sc.nextInt();
    //もともとの差
    long sa = Math.abs(a-b);
    //詰められる距離
    long kyori = v-w;
	//差より詰めたら捕まえられる
    if(kyori*t>=sa){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    }

  }
}

Measured memory_bytes: 35664
#include <stdio.h>

int main(void)
{
	int a[5];
	int buf;
	int i;
	int flag;
	
	for (i = 0; i < 5; i++){
		scanf("%d", &a[i]);
	}
	
	flag = 1;
	while (flag == 1){
		flag = 0;
		for (i = 0; i < 4; i++){
			if (a[i] < a[i + 1]){
				buf = a[i];
				a[i] = a[i + 1];
				a[i + 1] = buf;
				flag = 1;
			}
		}
	}
	
	for (i = 0; i < 4; i++){
		printf("%d ", a[i]);
	}
	printf("%d\n", a[4]);
	
	return (0);
}

Measured memory_bytes: 596
#include <cstdio>
#define N 505
int h, w, k=1;
char p[N], r[N][N], b[N][N];
int main() {
	int i, j;
	scanf("%d%d", &h, &w);
	for(i=0; i<h; i++) {
		k = w-k;
		for(j=0; j<k; j++) r[i][j] = '#', b[i][j] = '.';
		for(; j<w; j++) r[i][j] = '.', b[i][j] = '#';
		scanf("%s", p);
		for(j=0; j<w; j++) if(p[j]=='#') r[i][j] = b[i][j] = '#';
	}
	for(i=0; i<h; i++) puts(r[i]);
	puts("");
	for(i=0; i<h; i++) puts(b[i]);
	return 0;
}

Measured memory_bytes: 1152
#pragma GCC optimize("O3", "unroll-loops")
//#pragma GCC target("avx2")
//#pragma GCC target ("sse4")
#pragma optimize("fast-math")

#include <bits/stdc++.h>
#include <stdio.h>

using namespace std;
#define endl '\n'
#define ull unsigned long long
#define si short int
#define ll long long
#define ld long double
#define pb push_back
#define pii pair<int, int>
#define pdd pair<double, double>
#define pil pair<int, ll>
#define pli pair<ll, int>
#define pll pair<ll, ll>
#define piii pair<pair<int, int>, int>
#define all(vec) (vec).begin(), (vec).end()
#define rall(vec) (vec).rbegin(), (vec).rend()
#define piiii pair<pair<int, int>, pair<int, int>>
struct kek{
    int a,b,c,d;
};




vector<kek> arr;
int ans=0;
void gogo(int n, int m, int kolvo, vector<int> &now, int last){
    if(kolvo==n){
        int sm=0;
        for(int j=0;j<arr.size();j++){
            if(now[arr[j].b-1]-now[arr[j].a-1]==arr[j].c){
                sm+=arr[j].d;
            }
        }
        ans=max(ans, sm);
        return;
    }
    for(int i=last;i<=m;i++){
        now[kolvo]=i;
        gogo(n,m,kolvo+1, now, i);
    }

}
void solve() {
    int n;
    cin>>n;
    vector<int> arr(n);
    vector<int> prefkek(n);
    for (int i = 0; i <n ; ++i) {
        cin>>arr[i];
        if(i+arr[i]-1<n) {
            prefkek[i + arr[i] - 1]++;
        }
    }
    ll ans=0;
    for(int i=0;i<n;i++){
        if(i-arr[i]-1<0) continue;
        ans+=prefkek[i-arr[i]-1];
    }
    cout<<ans;


}

void testcases(int n) {
    n = 1 - n;
    if (!n) cin >> n;
    for (int i = 0; i < n; i++) {
        solve();
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    //freopen("C:\\Users\\Maximus\\CLionProjects\\Codeforces\\BestTeam\\output.txt", "r", stdin);
    //f=fopen("C:\\Users\\Maximus\\CLionProjects\\Codeforces\\BestTeam\\output.txt", "w");
    //freopen("C:\\Users\\Maximus\\CLionProjects\\Codeforces\\BestTeam\\output.txt", "w", stdout);

    unsigned int beg_time = clock();
    testcases(0);
    // 0 - no t, 1 - with t

    unsigned int end_time = clock();
    //cout << endl << endl << end_time - beg_time;
    return 0;
}

Measured memory_bytes: 4840
N,X,M = map(int,input().split())
ls = [X]
for i in range(M):
    Ai = ls[-1]**2 % M
    if Ai in ls:
        loop = ls[ls.index(Ai):]
        lenloop = len(loop)
        sumloop = sum(loop)
        startls = ls[:ls.index(Ai)]
        break
    ls.append(Ai)
if N <= len(startls):
    ans = sum(startls[:N])
else:
    ans = sum(startls) + ((N-len(startls))//lenloop)*sumloop + sum(loop[:(N-len(startls))%lenloop])
print(ans)


Measured memory_bytes: 68492
X = int(input())
if X >= 400 and X <= 599:
  rank = 8
elif X >= 600 and X <= 799:
  rank = 7
elif X >= 800 and X <= 999:
  rank = 6
elif X >= 1000 and X <= 1199:
  rank = 5
elif X >= 1200 and X <= 1399:
  rank = 4
elif X >= 1400 and X <= 1599:
  rank = 3
elif X >= 1600 and X <= 1799:
  rank = 2
elif X >= 1800 and X <= 1999:
  rank = 1
print(rank)

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

int main() {
  ll n;
  cin >> n;
  vector<ll> v(5);
  for (int i = 0; i < v.size(); i++) {
    cin >> v.at(i);
  }
  sort(v.begin(),v.end());

  ll ans = (n + v.at(0) - 1) / v.at(0);
  ans += v.size() - 1;
  cout << ans << endl;
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  vi32 sums(n + 1);
  rep(i, n) {
    sums[i + 1] = sums[i] + (s[i] == 'E');
  }
  int ans = n;
  rep(i, n) {
    int ee = sums[n] - sums[i + 1];
    int ww = i - sums[i];
    amin(ans, ee + ww);
  }
  cout << ans << endl;
}

Measured memory_bytes: 1812
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    int M = 1e6;
    vec<int> cnt(M+1);
    vec<int> ok(M+1,1);
    for(int i=0;i<N;i++){
        int a;
        cin >> a;
        cnt[a]++;
    }
    for(int i=1;i<=M;i++) if(cnt[i]){
        for(int j=2;i*j<=M;j++) ok[i*j] = 0;
    }
    int ans = 0;
    for(int i=1;i<=M;i++) if(cnt[i]==1 && ok[i]) ans++;
    cout << ans << "\n";
}

Measured memory_bytes: 11112
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <set>

using namespace std;

typedef long long i64;
typedef i64 int_t;
typedef vector<int_t> vi;
typedef vector<vi> vvi;

typedef pair<int_t, int_t> pi;

#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define pb push_back
#define sz(a) i64((a).size())
#define all(c) (c).begin(), (c).end()
#define REP(s, e, i) for(i=(s); i < (e); ++i)

int main(int argc, char *argv[]) {
  i64 A, B, C;
  cin >> A >> B >> C;
  if((A==B && B!=C) ||
     (B==C && C!=A) ||
     (C==A && A!=B))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define eb emplace_back
#define int long long
#define MOD 1000000007
#define PI 2*acos(0)
#define forn(i,n) for(int i = 0; i < n; i++)
using namespace std;
int32_t main() {
	ios::sync_with_stdio(0); cin.tie(0);
	int x, y; cin >> x >> y;
	for (int i = 0; i <= 100; i++) {
		int xx = pow(2, i) * x;
		if (xx > y) {
			cout << i << '\n';
			break;
		}	
	}
		
	return 0;
}


Measured memory_bytes: 256
N, A, B = map(int, input().split())
MOD = 10**9 + 7

def pow(x, y):
  if y == 0:
    return 1
  K = 1
  while y > 1:
    if y % 2 == 0:
      y = y // 2
      x = (x * x) % MOD
    else:
      K = (K * x) % MOD
      y -= 1
  return (K * (x ** y)) % MOD

def comb_mod(p, q):
  bunsi = 1
  bunbo = 1
  for i in range(q):
    bunsi = (bunsi * (p-i)) % MOD
    bunbo = (bunbo * (i+1)) % MOD
  return ((bunsi * pow(bunbo, MOD - 2)) % MOD)

print((pow(2,N) - 1 - comb_mod(N, A) - comb_mod(N, B)) % MOD)

Measured memory_bytes: 3064
def ip():return list(map(int,input().split()))

n,m,x=map(int,input().split())
c=[]
a=[]
for i in range(n):
    temp=ip()
    c.append(temp[0])
    a.append(temp[1:])

ans=12*10**5+1
for i in range(1,2**n):
    f=bin(i)[2:]
    sum=[0]*m
    while len(f)<n:f='0'+f
    s=0
    for j in range(n):
        if f[j]=='1':
            s+=c[j]
            for h in range(m):
                sum[h]+=a[j][h]
    if min(sum)>=x:ans=min(ans,s)
print(ans) if ans!=12*10**5+1 else print(-1)








Measured memory_bytes: 68892
#pragma GCC optimize("Ofast")

//インクルード
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)

int main() {
  // 高速化
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    ll  n;
    cin >> n;
    ll ans = 0;
    
    FOR(i, 1, n){
      if(i%3 !=0 && i%5!=0){
        ans += i;
      }
    }

    cout << ans << "\n"; 

    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

vector<pair<long long, long long> > prime_factorize(long long N) {
	vector<pair<long long, long long> > res;
	for (long long a = 2; a * a <= N; ++a) {
		if (N % a != 0) continue;
		long long ex = 0; // 指数

		 // 割れる限り割り続ける
		while (N % a == 0) {
			++ex;
			N /= a;
		}

		// その結果を push
		res.push_back({ a, ex });
	}

	// 最後に残った数について
	if (N != 1) res.push_back({ N, 1 });
	return res;
}

int main() {

	ll a, b; cin >> a >> b;

	vector<pair<long long, long long>> a_prime;  // a^x ならば { a, x }
	vector<pair<long long, long long>> b_prime;  // a^x ならば { a, x }
	a_prime = prime_factorize(a);
	b_prime = prime_factorize(b);

	map<int, int> mp;
	for (auto u : a_prime) {
		mp[u.first]++;
	}
	for (auto u : b_prime) {
		mp[u.first]++;
	}
	int ans = 0;
	for (auto u : mp) {
		if (2 <= u.second)ans++;
	}
	cout << ans + 1 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
using namespace std;

typedef long long ll;
typedef long double ld;

const int N = 1e6 + 1;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ll a, b, k;
	cin >> a >> b >> k;
	ll l = min(a, k);
	k -= l;
	if (k == 0) {
		cout << a - l << " " << b << endl;
		return 0;
	}
	cout << 0 << " " << b - min(b, k) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std ;
const int mod = 1e9 +7 ;
typedef long long ll ;
const int N = 2e5 + 10 ;
ll a[N] ;
ll qmi(ll a , ll b)
{
  ll res = 1 ;
  while(b)
  {
    if(b & 1) res = res * a % mod ;
    a = a * a % mod ;
    b >>= 1 ;
  }
  return res ;
}
ll c(ll n , ll m)
{
  return a[n] % mod * qmi(a[m] , mod - 2) % mod * qmi(a[n - m] , mod - 2) % mod ;
}
int main()
{
  a[0] = 1 ;
  for(int i = 1 ; i < N ;i ++ ) a[i] = a[i - 1] * i % mod ;
  ll ans = 0 ;
  ll n , k ;
  cin >> n >> k ;
  for(int i = 0 ;i <= min(k , n - 1) ;i ++)
   ans = (ans + c(n , i) * c(n - 1 , i) % mod ) % mod ; //, cout << ans << endl ;
  printf("%lld\n", ans);
  return 0 ;
}


Measured memory_bytes: 1792
inf = float('inf')

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

dp = [[0] * 2 for _ in range(n + 1)]
dp[0][1] = -inf
# dp[idx][マイナスを使う必要がある個数]

for i, aa in enumerate(a):
    if aa >= 0:
        dp[i + 1][0] = max(dp[i][0] + aa, dp[i][1] - aa)
        dp[i + 1][1] = max(dp[i][1] + aa, dp[i][0] - aa)
    else:
        dp[i + 1][0] = max(dp[i][1] - aa, dp[i][0] + aa)
        dp[i + 1][1] = max(dp[i][0] - aa, dp[i][1] + aa)

# print(dp)
print(dp[n][0])


Measured memory_bytes: 25604
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i < (int)(n); i++)
#define Sort(a) sort(a.begin(), a.end())
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;} return false;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;} return false;}

int s[1010][1010];

int main(){
    int h, w, a, b;
    cin >> h >> w >> a >> b;
    rep(i, b){
        rep(j, a){
            s[i][j] = 1;
        }
    }
    for(int i = b; i < h; i++){
        for(int j = a; j < w; j++){
            s[i][j] = 1;
        }
    }
    rep(i, h){
        rep(j, w){
            cout << s[i][j];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 5120
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	int N;

	private void solve() {
		// input
		Scanner io = new Scanner(System.in);
		N = io.nextInt();
		PriorityQueue<Point> queX = new PriorityQueue<>();
		PriorityQueue<Point> queY = new PriorityQueue<>();
		Node[] node = new Node[N];
		
		for(int i=0;i<N;i++){
			int x = io.nextInt();
			int y = io.nextInt();
			queX.add(new Point(x,i));
			queY.add(new Point(y,i));
			node[i] = new Node();
		}
		
		Point prev = queX.poll();
		Point now;
		while(!queX.isEmpty()){
			now = queX.poll();
			int far = now.dis - prev.dis;
			node[now.id].prevX = new Point (far,prev.id);
			node[prev.id].nextX = new Point (far,now.id);
			prev = now;
		}
		prev = queY.poll();
		while(!queY.isEmpty()){
			now = queY.poll();
			int far = now.dis - prev.dis;
			node[now.id].prevY = new Point (far,prev.id);
			node[prev.id].nextY = new Point (far,now.id);
			prev = now;
		}
		
		boolean[] fin = new boolean[N];
 		PriorityQueue<Point> queR = new PriorityQueue<>();
 		long ans = 0;
 		
 		fin[0] = true;
 		queR.add(node[0].nextX);
 		queR.add(node[0].prevX);
 		queR.add(node[0].nextY);
 		queR.add(node[0].prevY);
 		
 		while(!queR.isEmpty()){
 			now = queR.poll();
 			if(now.id==-1) break;
 			if(fin[now.id]) continue;
 			
 			ans += now.dis;
 			fin[now.id] = true;
 	 		queR.add(node[now.id].nextX);
 	 		queR.add(node[now.id].prevX);
 	 		queR.add(node[now.id].nextY);
 	 		queR.add(node[now.id].prevY);
  		}

		System.out.println(ans);
	}

	public static void main(String[] args) {
		new Main().solve();
	}
}
class Node{
	Point nextX;
	Point prevX;
	Point nextY;
	Point prevY;
	
	public Node(){
		nextX = new Point(Integer.MAX_VALUE,-1);
		prevX = new Point(Integer.MAX_VALUE,-1);
		nextY = new Point(Integer.MAX_VALUE,-1);
		prevY = new Point(Integer.MAX_VALUE,-1);
	}
	
}

// Node and Road
class Point implements Comparable<Point>{
	int dis; // distance
	int id; // nodeID
	
	public Point(int x,int y){
		this.dis = x;
		this.id = y;
	}

	@Override
	public boolean equals(Object o){
		return dis == ((Point)o).dis &&
			   id == ((Point)o).id;
	}
	@Override
	public int compareTo(Point o) {
		return Integer.compare(this.dis,o.dis);
	}
	@Override
	public int hashCode(){
		return Integer.hashCode(dis*id);
	}
}

Measured memory_bytes: 109144
#include<bits/stdc++.h>
#define ll long long 
using namespace std ;
 int main(){
		int n ; cin>>n ; 
		vector<int> a(n) ; 
		for(int &x:a) cin>> x ; 
		int  b[200005] = {0} ; 
		for(int i = 0 ; i < n ; ++i){
			b[a[i]]++ ; 
		}
		ll ans = 0 ; 
		for(int i = 0 ; i < 200003 ; ++i){
			ll d = b[i] ; 
			 ll m = d*(d-1)/2 ; 
			 ans+=m ; 
		 }
		// ll ans1 = ((n-1)*(n-2))/2 ;
		 for(int i = 0 ; i < n ; ++i){
			 ll d = b[a[i]] ; 
			ll ans2  =  ans - (d*(d-1))/2 + ((d - 1)*(d-2))/2 ; 
			cout<<ans2<<endl ; 
		}
	 
	 
	 
	 
 }



Measured memory_bytes: 4096
import java.util.Scanner;

class Main {

	public static void main(String[] args) {

		Scanner sc = null;

		try {

			sc = new Scanner(System.in);

			String s = null;

			while (sc.hasNext()) {

				s = sc.nextLine();

				s = s.replaceAll("apple", "ApPle");
				s = s.replaceAll("peach", "apple");
				s = s.replaceAll("ApPle", "peach");

				System.out.println(s);


			}

		} finally {
			sc.close();
		}

	}

}

Measured memory_bytes: 17136
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = (ll)(x)-1;0 <= i; i--)
#define reps(i,x) for(ll i = 1; i < (ll)(x)+1; i++)
#define rreps(i,x) for(ll i = (ll)(x); 1 <= i; i--)
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const int n_max = 1e5+10;
#define int ll

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n = 100;
    ll x; cin >> x;
    ll cnt = 0;
    while(n < x){
        double next = double(n) * 1.01;
        n = next;
        cnt++;
    }

    cout << cnt << endl;
}

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

long long mod(long long a, long long b) {
	return ((a % b) + b) % b;
}

int main(void) {
	long long N, x;
	std::cin >> N >> x;
	std::vector<long long> a;
	for(int i = 0; i < N; ++i) {
		long long t;
		std::cin >> t;
		a.push_back(t);
	}
	long long sum;
	long long result;
	std::vector<long long> dp;//dp[i] : 色iを得るための(魔法を除く)最小コスト
	for(int i = 0; i < N; ++i) {
		dp.push_back(a[i]);
	}
	result = std::accumulate(dp.begin(), dp.end(), 0L);
	for(int k = 1; k < N; ++k) {//k : 魔法を使う回数
		for(int j = 0; j < N; ++j) {
			dp[j] = std::min(dp[j], a[mod(j - k, N)]);
		}
		sum = std::accumulate(dp.begin(), dp.end(), 0L) + k * x;
		result = std::min(result, sum);
	}
	std::cout << result << '\n';
	return 0;
}



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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair <ll,ll> pii;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rept(i,x,y) for(int i=x;i<=y;i++)
#define per(i,x,y) for(int i=x;i>=y;i--)
#define all(x) x.begin(),x.end()
#define pb push_back
#define fi first
#define se second
#define mes(a,b) memset(a,b,sizeof a)
#define mp make_pair
#define dd(x) cout<<#x<<"="<<x<<" "
#define de(x) cout<<#x<<"="<<x<<"\n"
#define debug() cout<<"I love Miyamizu Mitsuha forever.\n"
const int inf=0x3f3f3f3f;
map<ll,ll> m;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin>>n;
	ll ans=0;
	rep(i,0,n)
	{
		int x;
		cin>>x;
		m[x]++;
		ans+=x;
	}
	int q;
	cin>>q;
	while(q--)
	{
		int a,b;
		cin>>a>>b;
		ans+=(b-a)*m[a];
		m[b]+=m[a];
		m[a]=0;
		cout<<ans<<"\n";
	}
	return 0;
}

Measured memory_bytes: 9496
#include <bits/stdc++.h>
#define mod 1000000007
#define mod998 998244353
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
#define lP pair<ll, ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;

string S;

int main() {
	cin >> S;
	for (int i = 0; i < S.size(); ++i) {
		if (i != S.size() - 1 && S[i] == 'R'&&S[i + 1] == 'L') {
			int r, l;
			r = l = 0;
			for (int j = i; j >= 0 && S[j] == 'R'; --j) {
				if ((i - j) % 2 == 0)++r;
				else ++l;
			}
			for (int j = i + 1; j < S.size() && S[j] == 'L'; ++j) {
				if ((j - i) % 2 == 0)++r;
				else ++l;
			}
			cout << r << sp << l;
			++i;
		}
		else {
			cout << 0;
		}
		if (i != S.size() - 1)cout << sp;
	}
	cout << endl;
}

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

int value[10];

string dfs(int left,int right,int i)
{
	if(i == 10) return "YES";
	if(left < value[i])
	{
		return dfs(value[i],right,i+1);
	}
	if(right < value[i])
	{
		return dfs(left,value[i],i+1);
	}
	return "NO";
}


int main()
{
	int n;
	cin >> n;
	
	while(n--)
	{
		for(int i=0;i<10;i++)	
		{
			cin >> value[i];	
		}
		cout << dfs(0,0,0) << endl;
	}

	return 0;
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define ll long long
#define LEFT(a) ((a)<<1)
#define RIGHT(a) (LEFT(a) + 1)
#define MID(a,b) ((a+b)>>1)
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#pragma comment(linker, "/STACK: 20000000005")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2,fma")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
using namespace std;

const ll N = 1e5 + 5, MOD = 1e10 + 7;

ll n, X;
ll a[N];
ll x[N], y[N];

pair < pair < ll, int >, pair < int, int > > mas[N];

ll ANS;

bool check (ll P){
    if (P == X * n)
        return 1;
    ll Q = P % X;
    P /= X;
    ll I = 0, pas = 0;
    ll cost, t;
    for (int i = P + 2; i <= n; i++){
        cost = x[i] * a[i];
        t = x[i];
        if (Q > a[i])
            t = y[i];
        cost += (Q - a[i]) * t;
        if (cost > pas){
            I = i;
            pas = cost;
        }
    }
    ll ans = 0;
    for (int i = 1; i <= P + 1; i++)
        ans += mas[i].F.F;
    for (int i = 1; i <= P + 1; i++){
        cost = x[i] * a[i];
        t = x[i];
        if (Q > a[i])
            t = y[i];
        cost += (Q - a[i]) * t;
        cost = max (cost, pas);
        if (ANS <= ans - mas[i].F.F + cost)
            return 1;
    }
    return 0;
}


int main()
{
    //freopen ("in.in", "r", stdin);freopen ("out.out", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin >> n >> X;
    for (int i = 1; i <= n; i++){
        cin >> a[i] >> x[i] >> y[i];
        ANS += x[i] * a[i];
        ll cost = y[i] * (X - a[i]) + a[i] * x[i];
        mas[i] = {{cost, a[i]}, {x[i], y[i]}};
    }
    sort (mas + 1, mas + n + 1);
    reverse (mas + 1, mas + n + 1);
    for (int i = 1; i <= n; i++){
        a[i] = mas[i].F.S;
        x[i] = mas[i].S.F;
        y[i] = mas[i].S.S;
    }
    ll l = 0, r = X * n;
    while (l < r){
        ll mid = l + r >> 1;
        if (check (mid))
            r = mid;
        else
            l = mid + 1;
    }
    cout << l << endl;
    return 0;
}


Measured memory_bytes: 5120
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <functional>
#include <map>
#include <queue>
#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
using namespace std;
using ll = long long;
ll MOD = 1e9+7;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    
    string S, T;
    cin >> S >> T;
    int ans = 0;
    for(int i = 0; i < 3; i++){
        if(S[i] == T[i]){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}








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

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define INF  numeric_limits<int>::max()
#define NINF numeric_limits<int>::min()

using namespace std;
using ll = long long;

int h, w, a, b;

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

    std::cin >> h >> w;
    std::cin >> a >> b;

    std::cout << h % a * w + (w % b) * (h - h % a) << std::endl;

    return 0;
}



Measured memory_bytes: 3184
#include <stdio.h>

int main(void)
{
	int N;
	int A;
	int i;
	int flag;

	scanf("%d", &N);
	flag = 1;
	i = 0;
	while (i < N)
	{
		scanf("%d", &A);
		if (A % 2 == 0 && A % 3 != 0 && A % 5 != 0)
			flag = 0;
		i++;
	}
	if (flag)
		printf("APPROVED");
	else
		printf("DENIED");
}

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

typedef complex<double> Point;
typedef vector<Point> VP;

int main(void){
    int n;
    cin >> n;
    VP ps(n);
    rep(i,n){
        double x,y;
        cin >> x >> y;
        ps[i] = Point(x,y);
    }
    double M = 500;
    double res = 0;
    rep(i,M){
        Point inf = polar(1e9, 2.0*PI*(i/M));
        VP used;
        Point p(0,0);
        rep(j,n){
            if (abs(ps[j]-inf) < 1e9) {
                p += ps[j];
            }
        }
        res = max(res, abs(p));
    }
    printf("%.20f\n", res);
    return 0;
}


Measured memory_bytes: 512
import sys
sys.setrecursionlimit(1 << 25)
readline = sys.stdin.buffer.readline
read = sys.stdin.readline  # 文字列読み込む時はこっち
ra = range
enu = enumerate


def exit(*argv, **kwarg):
    print(*argv, **kwarg)
    sys.exit()


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと


def a_int(): return int(readline())


def ints(): return list(map(int, readline().split()))


def read_col(H):
    '''H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, readline().split())))
    return tuple(map(list, zip(*ret)))


def read_tuple(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, readline().split())))
    return ret


def read_matrix(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, readline().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


class UnionFind:
    def __init__(self, N):
        self.N = N  # ノード数
        self.n_groups = N  # グループ数
        # 親ノードをしめす。負は自身が親ということ。
        self.parent = [-1] * N  # idxが各ノードに対応。

    def root(self, A):
        # print(A)
        # ノード番号を受け取って一番上の親ノードの番号を帰す
        if (self.parent[A] < 0):
            return A
        self.parent[A] = self.root(self.parent[A])  # 経由したノードすべての親を上書き
        return self.parent[A]

    def size(self, A):
        # ノード番号を受け取って、そのノードが含まれている集合のサイズを返す。
        return -self.parent[self.root(A)]

    def unite(self, A, B):
        # ノード番号を2つ受け取って、そのノード同士をつなげる処理を行う。
        # 引数のノードを直接つなぐ代わりに、親同士を連結する処理にする。
        A = self.root(A)
        B = self.root(B)

        # すでにくっついている場合
        if (A == B):
            return False

        # 大きい方に小さい方をくっつけたほうが処理が軽いので大小比較
        if (self.size(A) < self.size(B)):
            A, B = B, A

        # くっつける
        self.parent[A] += self.parent[B]  # sizeの更新
        self.parent[B] = A  # self.rootが呼び出されればBにくっついてるノードもすべて親がAだと上書きされる
        self.n_groups -= 1

        return True

    def is_in_same(self, A, B):
        return self.root(A) == self.root(B)


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter, xor, add
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right
from functools import reduce
from math import gcd


def lcm(a, b):
    # 最小公倍数
    g = gcd(a, b)
    return a // g * b


N, M = ints()
uf = UnionFind(N)
for _ in range(M):
    a, b = mina(*ints())
    uf.unite(a, b)

# あとはなるべく別々になるように
# →サイズを1ずつ引いて1グループ
# いやmaxのsizeか

print(-min(uf.parent))


Measured memory_bytes: 14840
#include <cstdio>
#include <cstring>
#include <cctype>
#include <algorithm>
#include <queue>
using namespace std;

char p[64][16];
bool visit[64][16];
int dy[] = {-1, 0, 1, 0};
int dx[] = {0, -1, 0, 1};

bool dfs(int y, int x, int &rn, int &rd){
	int n = 0, d = 0;
	int xl = 100, xr = -100;
	char ch = p[y][x];

	queue<int> q;
	q.push(y << 8 | x);
	visit[y][x] = true;
	while(!q.empty()){
		y = q.front() >> 8;
		x = q.front() & 0xff;
		q.pop();
		
		n += x;
		++d;
		
		for(int i = 0; i < 4; ++i){
			int ny = y + dy[i], nx = x + dx[i];
			if(!visit[ny][nx] && p[ny][nx] == ch){
				visit[ny][nx] = true;
				q.push(ny << 8 | nx);
			}
		}

		if(!visit[y-1][x] && isdigit(p[y-1][x])){
			if(!dfs(y - 1, x, n, d)){ return false; }
		}

		if(p[y+1][x] != ch){
			if(p[y+1][x] == '!' || isdigit(p[y+1][x])){
				xl = min(xl, x);
				xr = max(xr, x + 1);
			}
		}
	}

	rn += n;
	rd += d;

	// xl < n / d + 0.5 < xr
	return 2 * d * xl < 2 * n + d && 2 * n + d < 2 * d * xr;
}

int main(){
	int w, h;
	while(scanf("%d%d", &w, &h), w){
		memset(p, '.', sizeof p);
		memset(p[h+1], '!', sizeof p[h+1]);
		memset(visit, 0, sizeof visit);
		
		for(int i = 1; i <= h; ++i){
			scanf(" %s", p[i] + 1);
		}

		int x;
		for(x = 1; !isdigit(p[h][x]); ++x);
		int n = 0, d = 0;
		puts(dfs(h, x, n, d) ? "STABLE" : "UNSTABLE");
	}
}

Measured memory_bytes: 1048
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)  # 再帰定義

def lcm(x, y):
    return (x * y) // gcd(x, y)


N = int(input().strip())
ar = list(map(int,input().strip().split()))

koubai = 1

for i in range(0,len(ar)):
    koubai = lcm(ar[i],koubai)

res = 0
koubai -= 1
for i in range(0,len(ar)):
    res += koubai % ar[i]
print(res)

Measured memory_bytes: 3316
#include <iostream>
#include <cmath>
#include <string>
typedef long long ll;
using namespace std;

ll a;
double b;

void solve()
{
    ll ans;
    ll x, y, z;
    x = a * ll(b);
    y = a * (ll(floor(b * 10)) % 10);
    z = a * (ll(round(b * 100)) % 10);
    ans = (x * 100 + y * 10 + z) / 100;

    cout << ans << endl;
}

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

    solve();
}


Measured memory_bytes: 3840
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
 
int main(int argc, char* argv[])
{
    long n, m;
    scanf("%ld %ld", &n, &m);

    std::vector<long long> x(n);
    std::vector<long long> y(n);
    std::vector<long long> z(n);

    long i, j, k;
    for(i=0; i<n; i++) {
        scanf("%lld %lld %lld", &(x[i]), &(y[i]), &(z[i]));
    }

    long long ans = 0;
    for(i=0; i<2; i++) {
        for(j=0; j<2; j++) {
            for(k=0; k<2; k++) {
                std::vector<long long> value(n);
                long p;
                for(p=0; p<n; p++) {
                    value[p] = 0;
                    if(i==0) {
                        value[p] += x[p];
                    }
                    else {
                        value[p] -= x[p];
                    }
                    if(j==0) {
                        value[p] += y[p];
                    }
                    else {
                        value[p] -= y[p];
                    }
                    if(k==0) {
                        value[p] += z[p];
                    }
                    else {
                        value[p] -= z[p];
                    }
                }
                std::sort( value.begin(), value.end());

                long long sum = 0;
                for(p=0; p<m; p++) {
                    sum += value[n-1-p];
                }
                if ( ans < sum ) {
                    ans = sum;
                }
            }
        }
    }
    printf("%lld\n", ans);
 
    return 0;
}

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

int main(){
  int x;
  cin >> x;
  int y = x%100;
  int z = x/100;
  int a;
  
  if(y%5==0){
    a=0;
  }
  else{
    a=1;
  }
  int Y=y/5;
  if(x >= (Y+a)*100){
    cout << 1 << endl;
  }
  else{
    cout << 0 << endl;
  }
}

Measured memory_bytes: 256
import math

l = []
l = []
l2 = []
a = []

for i in range(5):
    l.append(int(input()))

for i in range(len(l)):
	a.append(math.ceil(l[i]/10)*10)

for i in range(len(l)):
	if l[i]%10 == 0 :
		l2.append(10)
	else:
		l2.append(l[i]%10)

a[l2.index(min(l2))] = l[l2.index(min(l2))]

print(sum(a))


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int c[100010];
int main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		int a;
		cin>>a;
		c[a-1]=i+1;
	}
	for(int j=0;j<n;j++)
	{
		cout<<c[j]<<" ";
	}
	return 0;
}

Measured memory_bytes: 1152
a = input().split()
a = [int(i) for i in a]
h = []
for i in range(a[0]):
	h.append(int(input()))
	
h.sort()
miner = h[-1] - h[0]
for i in range(a[0] - a[1] + 1):
	miner = min(miner, h[a[0] - 1 - i] - h[a[0] - i - a[1]])
	
print(miner)

Measured memory_bytes: 51288
#include<stdio.h>
#include<iostream>
using namespace std;
int main (){
    int a,b;
    cin >> a >> b;
    int sum=0;
    for(int i=a; i<=b; i++){
        if(i / 10000 == i % 10 && (i / 1000) % 10 == (i / 10) % 10){
            sum++;
        }
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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

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

ll lcm(ll a, ll b)
{
    return a / gcd(a, b) * b;
}

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

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


int main(){
ll n;
cin>>n;
map<ll,ll>rensou;
ll a;
for(int i=0;i<n;i++){
    cin>>a;
    rensou[a]=i;
}
for(auto f:rensou){
    cout<<f.second+1<<" ";
}
}





Measured memory_bytes: 7040
import java.util.*; 

class Main{
public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
       
		String s=sc.next();
		String[] a=s.split("");
    
 	if(a[0].equals(a[1])&&a[1].equals(a[2])){
    		System.out.println("No");
    	}else{
     		System.out.println("Yes");
   	 }

    	
    }
}

Measured memory_bytes: 21716
#include<bits/stdc++.h>
#include<math.h>
#include<queue>
#include<cstdio>
#include<set>
#include<map>
using namespace std;
using ll = long long;

int main(){
    string S,T;
    cin >> S >> T;
    ll ans=0;
    for(int i=0; i<S.size(); i++){
        if(S.at(i)!=T.at(i)) ans++;
    }

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

Measured memory_bytes: 3916
import sys
def input():
    return sys.stdin.readline()[:-1]
sys.setrecursionlimit(200000)
class uf:
    def __init__(self,n):
        self.n=n
        self.l=[-1]*n
    def ro(self,n):
        if self.l[n]<0:
            return n
        r=self.ro(self.l[n])
        self.l[n]=r
        return r
    def me(self,a,b):
        ra=self.ro(a)
        rb=self.ro(b)
        if ra!=rb:
            self.l[ra]+=self.l[rb]
            self.l[rb]=ra
    def size(self,n):
        return -self.l[self.ro(n)]
    def sa(self,a,b):
        return self.ro(a)==self.ro(b)
N,M,K=map(int,input().split())
u=uf(N)
l=[-1]*N
for i in range(M):
    A,B=map(lambda x: int(x)-1,input().split())
    u.me(A,B)
    l[A]-=1
    l[B]-=1
for i in range(N):
    l[i]+=u.size(i)
for i in range(K):
    C,D=map(lambda x: int(x)-1,input().split())
    if u.sa(C,D):
        l[C]-=1
        l[D]-=1
print(*l)


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

int main(){
    
    int m, f, r;
    
    while(cin >> m >> f >> r && !(m==-1 && f==-1 && r==-1)){
        
        if(m==-1 || f==-1){ cout << 'F' << endl;}
        else if(m+f >= 80){ cout << 'A' << endl;}
        else if(m+f >= 65){ cout << 'B' << endl;}
        else if(m+f >= 50){ cout << 'C' << endl;}
        else if(m+f >= 30 && r >= 50){ cout << 'C' << endl;}
        else if(m+f >= 30){ cout << 'D' << endl;}
        else {cout << 'F' << endl;}
        
    }
    
    return 0;
}


Measured memory_bytes: 3076
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include <sstream>
#include<map>

#include<queue>

using namespace std;

int main() {

	double T, X;
	cin >> T >> X;

	double result = T / X;

	printf("%.10f", result);

	return 0;
}




Measured memory_bytes: 256
import java.util.*;
class Main{
public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    
    
    int N = sc.nextInt();
    int[] num = new int[N];
    int suanchang=0;
    
    for (int i = 0,j; i < N; i++) {
             num[i] = sc.nextInt();
        }
    
    for(int i=0;i<num.length-1;i++){
        
        for(int j=0;j<num.length-i-1;j++){
            
            if(num[j]>num[j+1]){
                int temp = num[j];
                num[j]=num[j+1];
                num[j+1]=temp;
                suanchang++;
            }

        }
    }

    
    for(int i=0;i<num.length-1;i++){
        System.out.print(num[i] + " ");
 }
     System.out.print(num[N-1]);
     System.out.println();
     System.out.println(suanchang);
  }
 
   }


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

const int maxn=3e2+7;
char mp[maxn][maxn];

int main (){
    int ans=0,n;
    cin>>n;
    for(int i=0;i<n;i++) scanf("%s",mp[i]);
    for(int i=0;i<n;i++){
        int cnt=n;
        for(int j=0;j<n;j++){
            for(int k=0;k<n;k++)
                if(mp[(k-i+n)%n][j]!=mp[(j-i+n)%n][k]) cnt=0;
        }
        ans+=cnt;
    }
    cout<<ans<<endl;
    return 0;
}


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


int main()
{
    string s;
    cin>> s;
    for(int i = 0; i < s.size(); i += 2){
        cout << s[i];
    }
    return 0;
}

Measured memory_bytes: 512
A,B,C,D = map(int,input().split())


for c in range(205):
    if c % 2 ==0:
        C = C-B
        if C <=0:
            ans = 'Yes'
            break
    else:
        A =A-D
        if A <=0:
            ans = 'No'
            break
#     print(A,B,C,D)
print(ans)

            


Measured memory_bytes: 61640
#include<stdio.h>
int main()
{
int a,b;
scanf("%d %d",&a,&b);
if(a < b)
{
printf("a < b\n");
}
else if(a > b)
{
printf("a > b\n");
}
else
{
printf("a == b\n");
}
return 0;
}



Measured memory_bytes: 2000
import sys,bisect as bs,collections as cl
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

n = onem()

p = [0] + l() + [n+1]
ans = 0
a = [0 for i in range(n+2)]

for i in range(n+2):
    a[p[i]] = i
l1 = [max(0,i-1) for i in range(n+2)]
l2 = [max(0,i-2) for i in range(n+2)]
r1 = [min(n+1,i+1) for i in range(n+2)]
r2 = [min(n+1,i+2) for i in range(n+2)]


for i in range(n+1):
    m = a[i]
    x2,x1,y1,y2 = l2[m],l1[m],r1[m],r2[m]
    hoge= i*(abs((m-x1)*(y2-y1)) + abs((y1-m)*(x1-x2)))
    ans += hoge
    #x1
    r1[x1] = y1
    r2[x1] = y2
    #y1
    l1[y1] = x1
    l2[y1] = x2
    #x2
    r1[x2] = x1
    r2[x2] = y1
    #y2
    l1[y2] = y1
    l2[y2] = x1
print(ans)




Measured memory_bytes: 61772
(n,m),*xyzs = [list(map(int, s.split())) for s in open(0)]

from operator import mul
from itertools import product, starmap
ans = -float('inf')
for ptrns in product([-1, 1], repeat=3):
    tmp = [sum(starmap(mul, zip(xyz, ptrns))) for xyz in xyzs]
    tmp.sort(reverse=True)
    ans = max(ans, sum(tmp[:m]))

print(ans)

Measured memory_bytes: 68700
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let k: usize = itr.next().unwrap().parse().unwrap();

    let mut a = vec![0; n + 1];
    for _ in 0..k {
        let d: usize = itr.next().unwrap().parse().unwrap();
        for _ in 0..d {
            let b: usize = itr.next().unwrap().parse().unwrap();
            a[b - 1] += 1;
        }
    }

    let mut ans = 0;
    for i in 0..n {
        if a[i] == 0 {
            ans += 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 2140
N, Q = map(int, input().split())
S = input()
lr = [tuple(map(int, input().split())) for _ in range(Q)]
ac_indexes = [0]
ac = 0
for i in range(1, N):
    if S[i - 1] == "A" and S[i] == "C":
        ac += 1
    ac_indexes.append(ac)
for l, r in lr:
    print(ac_indexes[r - 1] - ac_indexes[l - 1])


Measured memory_bytes: 19804
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int count = 0;
        for (int i = 0 ; i < s.length() ; i++) {
            if (s.substring(i, i + 1).equals("p")) {
                count++;
            }
        }
        System.out.println(s.length()/2 - count);

    }

}

Measured memory_bytes: 30792
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main()
{
    string a, b;
    int x, z;
    cin >> a >> b;
    a += b;
    x = stoi(a);
    double y;
    y = sqrt(x);
    z = (int)sqrt(x);

    if (y == z)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int inf=1e9+7;
const int mod=998244353;
int main(){
    ll h,w;cin>>w>>h;
    priority_queue<ll,vector<ll>,greater<ll> >p;
    priority_queue<ll,vector<ll>,greater<ll> >q;
    rep(i,w){
        ll a;cin>>a;
        p.push(a);
    }
    rep(i,h){
        ll a;cin>>a;
        q.push(a);
    }
    ll ans=0;
    ll cntw=0;
    ll cnth=0;
    ll cnt=0;
    h++;w++;
    while(cnt<h+w-2){
        ll a=inf,b=inf;
        if(!p.empty())a=p.top();
        if(!q.empty())b=q.top();
        if(q.empty()||a<b){
            ans+=(h-cnth)*a;
            p.pop();
            cnt++;
            cntw++;
            //cout<<a<<' '<<h-cnth<<endl;
        }else if(p.empty()||a>=b){
            ans+=(w-cntw)*b;
            q.pop();
            cnt++;
            cnth++;
            //cout<<b<<' '<<w-cntw<<endl;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 2676