akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef long double LD;
typedef pair<LD, int> PLDI;
typedef pair<LD, LD> PLDLD;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define CLR(a) memset((a), 0 ,sizeof(a))
#define ALL(a) a.begin(),a.end()
const LL MOD = 1e9+7;
const LL INF = (1e18);
const double EPS=1.0e-9;
const double PI=atan2(0,-1);



int main()
{
    int w,h;
    cin>>w>>h;
    vector<LL> p(w),q(h);
    LL cnt=0,cnt2=0;
    REP(i,w)
    {
        cin>>p[i];
        cnt+=p[i];
    }
    REP(i,h)
    {
        cin>>q[i];
        cnt+=q[i];
    }
        
    sort(ALL(p));
    sort(ALL(q));
    REP(i,w)
    {
        LL tmp=q.end()-lower_bound(ALL(q), p[i]+1);
        LL tmp2=lower_bound(ALL(q), p[i]+1)-lower_bound(ALL(q), p[i]);
        cnt+=p[i]*tmp;
        cnt2+=p[i]*tmp2;
    }
    REP(i,h)
    {
        LL tmp=p.end()-lower_bound(ALL(p), q[i]+1);
        LL tmp2=lower_bound(ALL(p), q[i]+1)-lower_bound(ALL(p), q[i]);
        cnt+=q[i]*tmp;
        cnt2+=q[i]*tmp2;
    }
    cout<<cnt+cnt2/2<<endl;
}


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

int main() {
  int n,b;
  cin>>n;
  string a;
  vector <tuple<string, int, int>> score;
  rep(i,n){
    cin>>a>>b;
    score.push_back(make_tuple(a,100-b,i+1));
  }
  sort(score.begin(),score.end());
  
  for(tuple<string, int, int>t :score){
    string d;
    int e,f;
    tie(d,e,f)=t;
    cout<<f<<endl;
  }
    
  
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
const ll INF = 1e9;
  
int main() {
    int n,c; cin >> n >> c;
    vector<vector<int>> time(1e5 + 1,vector<int>(c,0));

    for (int i = 0; i < n; i ++) {
        int s,t,c1; cin >> s >> t >> c1;
        c1 --;
        time[s][c1] ++;
        time[t][c1] --;
    }

    for (int i = 0; i < 1e5 ; i ++) {
        for (int j = 0; j < c; j ++) {
            if (time[i][j] == 0 && time[i + 1][j] == 1) {
                time[i][j] = 1;
                time[i + 1][j] = 0;
            }
        }
    }

    int ans = 0;
    int tmp = 0;
    for (int i = 0; i < 1e5 + 1; i ++ ) {
        for (int j = 0; j < c ; j ++) {
            tmp += time[i][j];
        }
        ans = max(ans,tmp);
    }

    cout << ans << endl;
}

Measured memory_bytes: 15104
#include<stdio.h>

int main()
{
    int x1, y1, x2, y2, x3, y3, x4, y4, difx, dify;
    scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
    difx=x2-x1;
    dify=y1-y2;
    x3=x2+dify;
    y3=y2+difx;
    x4=x1+dify;
    y4=y1+difx;
    printf("%d %d %d %d\n", x3, y3, x4, y4);
    return 0;
}




Measured memory_bytes: 128
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var (
	in  = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

func main() {
	//coffee := "coffee"
	s := readString()
	if s[2] == s[3] && s[4] == s[5]{
		fmt.Printf("Yes")
	} else{
		fmt.Printf("No")
	}
}

func readInt64Slice() []int64 {
	line := readStringSlice()
	slice := make([]int64, 0, len(line))
	for _, tmp := range line {
		val, err := strconv.ParseInt(tmp, 10, 64)
		if err != nil {
			fmt.Println(err)
			os.Exit(1)
		}
		slice = append(slice, val)
	}
	return slice
}
func readFloat64Slice() []float64 {
	line := readStringSlice()
	slice := make([]float64, 0, len(line))
	for _, tmp := range line {
		val, err := strconv.ParseFloat(tmp, 64)
		if err != nil {
			fmt.Println(err)
			os.Exit(1)
		}
		slice = append(slice, val)

	}
	return slice
}
func readString() string {
	s, _, _ := in.ReadLine()
	return string(s)
}
func readStringSlice() []string {
	line := readString()
	s := strings.Split(line, " ")
	return s
}
func dump(value ...interface{}) {
	for _, v := range value {
		fmt.Printf("%#v\n", v)
	}
}

Measured memory_bytes: 640
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>

#define rep(inc, bgn, end) for (int inc = bgn; inc < end; ++inc)
#define repe(inc, bgn, end) for (int inc = bgn; inc <= end; ++inc)

using ll = long long;
using namespace std;

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

    map<string, int> vote;
    int mx = 0;
    rep(i, 0, n) {
        string str;
        cin >> str;
        vote[str]++;
        mx = max(mx, vote[str]);
    }

    // cout << "--" << mx << "--" << endl;

    for (map<string, int>::iterator mapit = vote.begin(); mapit != vote.end(); mapit++) {
        if (mapit->second == mx) {
            cout << mapit->first << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 19104
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,ans=0,multiple=1;
  cin>>N;
  for(int i=0;i<3;i++){
    if(N%10==1){
      ans +=multiple*9;
      N/=10;
      multiple*=10;
    }
    else{
      ans +=multiple*1;
      N/=10;
      multiple*=10;
    }
  }
  cout <<ans;  
}

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

using namespace std;

typedef long long ll;

ll N, M, Q, A, B, C, arr[200005];
string s, p;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> A >> B >> N;
	cout << (N/A)*B << '\n';

}

Measured memory_bytes: 256
n = int(input())
ll = []
for i in range(n):
    ll.append(int(input()))
ll.sort()
ans = sum(ll)
if ans%10 == 0:
    for l in ll:
        if l%10 != 0:
            print(ans-l)
            exit()
    print(0)
else:
    print(ans)

Measured memory_bytes: 9188
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			
			int N = scan.nextInt();
			int[]A = new int[N];
			int[]B = new int[N-1];
			
			int souwa=0;
			
			for(int i = 0;i<N-1;i++) {
				B[i] = scan.nextInt();
			}
			
			
			for(int i =N-1;i>=0;i--) {
				if(i == N-1) {
					A[i] = B[i-1];
					souwa+=A[i];
				}else if(i==0) {
					A[i] = B[i];
					souwa+=A[i];
				}else {
					A[i] = Math.min(B[i], B[i-1]);
					souwa+=A[i];
				}
			}
			
			
			
			System.out.println(souwa);
			
			
			
			
		}
		
		
	}
		

}


Measured memory_bytes: 23124
from collections import defaultdict

S = input()
T = input()

first_appear_s = dict()
first_appear_t = dict()

for i in range(len(S)) :
    s = S[i]
    t = T[i]
    if not s in first_appear_s :
        first_appear_s[s] = i
    if not t in first_appear_t :
        first_appear_t[t] = i
        
    if first_appear_s[s] != first_appear_t[t] :
        print('No')
        break
else :
    print('Yes')

Measured memory_bytes: 41932
// ÐÐµ Ñ‚Ð¾Ñ‚ Ð²ÐµÐ»Ð¸Ðº, ÐºÑ‚Ð¾ Ð½Ð¸ÐºÐ¾Ð³Ð´Ð° Ð½Ðµ Ð¿Ð°Ð´Ð°Ð», Ð° Ñ‚Ð¾Ñ‚ Ð²ÐµÐ»Ð¸Ðº â€” ÐºÑ‚Ð¾ Ð¿Ð°Ð´Ð°Ð» Ð¸ Ð²ÑÑ‚Ð°Ð²Ð°Ð»!
// 0 <--> 100
#include <algorithm>
#include <iostream>
#include <cstring>
#include <string>
#include <bitset> 
#include <vector>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
                
#define int long long
#define ll long long 
bool FLAG = 0;
#define debug(x) if (FLAG) {cerr << #x << " = " << x << endl;}
#define debug_vec(x) if (FLAG) {cerr << #x << " = {"; for (auto to x) cout << to << ", "; cout << "}" << endl}
#define F first
#define S second
#define sqr(x) ((x) * (x))
#define make make_pair
#define pb push_back
#define sz(x) (int)(x.size()) 
#define all(x) x.begin (), x.end ()

using namespace std;
                        
typedef unsigned long long ull;
typedef long double ld;

const int MOD = (int)1e9 + 7, N = (int)2e6+ 222;
const ll INF = (ll)1e18;

int n, m, red[N], col[N];

void solve () {
	cin >> n >> m;
	for (int i = 1; i <= n; ++i) {
    	red[1] = 1;
    	col[i] = 1;
    }
    for (int i = 1; i <= m; ++i) {
    	int l, r;
    	cin >> l >> r;
    	if (col[l] == 0) continue;
    	red[r] |= red[l];
    	col[r]++;
    	col[l]--;
    	if (col[l] == 0) red[l] = 0;
    }
    int ans = 0;
    for (int i = 1; i <= n; ++i) {
    	if (red[i] == 1) {
    		ans ++;
    	}
    }
    cout << ans;

}

signed main () {
	#ifdef Maga
		freopen("input", "r", stdin);
	#endif  
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);                                              
	int t = 1;
	while (t --) {
		solve ();
	}
	return 0;
}




Measured memory_bytes: 5120
def bubblesort(a, n):
    n_exchange = 0
    flag = True
    while flag:
        flag = False
        for j in range(n-1, 0, -1):
            if a[j] < a[j-1]:
                a[j], a[j-1] = a[j-1], a[j]
                n_exchange += 1
                flag = True

    return a, n_exchange

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

a_sort, n_exchange = bubblesort(a, n)

print(' '.join([str(x) for x in a_sort]))
print(n_exchange)



Measured memory_bytes: 5608
#include<cstdio>
#include<map>
using std::map;
#define int long long
map<int,int> m;int a[(int)2*(int)1e6+1],n,ans;
signed main(){
    scanf("%lld",&n);
    for(int i=1;i<=n;i++)scanf("%lld",a+i);
    m[a[1]+1]++;
    for(int i=2;i<=n;i++){
        ans+=m[i-a[i]],m[a[i]+i]++;
    }
    printf("%lld\n",ans);
}

Measured memory_bytes: 27532
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int a[4],b[4],i,j,hit=0,blow=0;
    while(scanf("%d %d %d %d %d %d %d %d",&a[0],&a[1],&a[2],&a[3],&b[0],&b[1],&b[2],&b[3])!=EOF){
        for(i=0;i<4;i++){
            for(j=0;j<4;j++){
                if(a[i]==b[j]){
                    if(i==j)
                        hit++;
                    else
                        blow++;
                }
            }
        }
        printf("%d %d\n",hit,blow);
        hit=0;
        blow=0;
    }
    return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
constexpr lint MOD = 1000000007;


// i人目まででj個配り終えた時点での部分うれしさの和をdpでやってく

int N, C;
vector<int> A, B;
vector<vector<lint>> h;

lint power(lint x, lint n, lint mod)
{
    lint ans = 1;
    while (n > 0)
    {
        if (n & 1)
            ans = ans * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return ans;
}

void prepare()
{
    lint N = 400, C = 400;
    h = vector<vector<lint>>(N + 1, vector<lint>(C + 1));
    for (int c = 0; c <= C; c++)
    {
        h[0][c] = 0;
        for (int n = 1; n <= N; n++)
        {
            h[n][c] = (h[n-1][c] + power(n, c, MOD)) % MOD;
        }
    }
}

int main()
{
    cin >> N >> C;
    prepare();
    A.resize(N);
    B.resize(N);
    for (auto &v : A) cin >> v;
    for (auto &v : B) cin >> v;

    vector<vector<lint>> dp(N + 1, vector<lint>(C + 1));
    dp[0][0] = 1;
    for (int i = 1; i <= N; i++)
    {
        for (int j = 0; j <= C; j++)
        {
            for (int k = 0; k <= j; k++)
            {
                dp[i][j] += dp[i - 1][j - k] * (h[B[i - 1]][k] - h[A[i - 1] - 1][k] + MOD);
                dp[i][j] %= MOD;
            }
        }
    }
    cout << dp[N][C] << endl;
}


Measured memory_bytes: 2816
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;
using vi = vector<int>;

#define in(v) v; cin >> v;
void ins() {}
template<class T,class... Rest>void ins(T& v,Rest&... rest){cin>>v;ins(rest...);}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define all(f,c,...) (([&](decltype((c)) cccc) { return (f)(begin(cccc), end(cccc), ## __VA_ARGS__); })(c))

// debug
template<class T>ostream& operator<<(ostream& os,const vector<T>& vec){os<<"{";for(size_t i=0;i<vec.size();++i)os<<(i?", ":"")<<vec[i];os<<"}";return os;}
ostream& operator<<(ostream& os,const vector<char>&v){for(size_t i=0;i<v.size();++i)os<<v[i];return os;}
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>& rhs){os<<"("<<rhs.first<<", "<<rhs.second<<")";return os;}

#ifdef LOCAL
void debug() {cerr << "\n";}
template<class First> void debug(const First& first) {cerr<<first<<"\n";}
template<class First, class... Rest> void debug(const First& first, const Rest&... rest) {cerr<<first<<",";debug(rest...);}
void debug2() {cerr << "\n";}
template<class First> void debug2(const First& first) {cerr<<first<<" ";}
template<class First, class... Rest> void debug2(const First& first, const Rest&... rest) {cerr<<first<<" ";debug2(rest...);}
#else
#define debug(...) 42
#define debug2(...) 42
#endif

template<class T>using vv = vector<vector<T>>;

char s[100][100];
int H, W;

int dp[100][100];
int dfs(int i, int j) {
  if (i == H-1 && j == W-1)
    return s[i][j] == '#';

  if (dp[i][j] != -1)
    return dp[i][j];

  int ans = 10000;
  if (i < H-1)
    ans = min(ans, dfs(i+1, j) + (s[i][j] != s[i+1][j]));
  if (j < W-1)
    ans = min(ans, dfs(i, j+1) + (s[i][j] != s[i][j+1]));
  return dp[i][j] = ans;
}

int main() {
  ins(H, W);

  rep(i, H) rep(j, W) {
    cin >> s[i][j];
    dp[i][j] = -1;
  }

  cout << dfs(0, 0)/2 + (s[0][0] == '#')<< endl;

  return 0;
}


Measured memory_bytes: 256
/**
 * Title: D - Brick Break
 * Url: https://atcoder.jp/contests/abc148/tasks/abc148_d
 */
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<numeric>
#include<functional>
#include<sstream>
#include<iomanip>

using namespace std;

#define ll long long

int main() {
    int N; cin >> N;
    vector<int> a(N);
    for(int i=0; i<N; i++) cin >> a[i];
    int ptr = 0;
    int count = 0;
    for(int i=0; i<N; i++) {
        if(a[i]==ptr+1) {
            ptr++;
        }
    }
    if(ptr==0) {
        cout << -1 << endl;
    } else {
        cout << N-ptr << endl;
    }
    return 0;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
using ll = long long;

template <typename T>
void print_vec(const vector<T>& v, bool is_reverse=false, int num=0){
  if(num == 0) num = (int)v.size();
  if(is_reverse) for(int i=num-1; i>=0; i--){ cout<<v[i]; if(i!=0) cout<<" ";}
  else for(int i=0; i<num; i++){ cout<<v[i]; if(i!=num-1) cout<<" ";}
  cout << endl;
}

template <typename T>
void print_pairvec(const vector<T> &v, int num=0){
  if(num == 0) num = (int)v.size();
  cout << endl;
  for(int i=0; i<num; i++){ cout << v[i].first << " " << v[i].second << endl;}
}

template <typename T>
void print_vec2(const vector<vector<T>>& v){
  cout << endl; cout << "       ";
  for(int i=0; i<v[0].size(); i++) cout << i << "   "; 
  cout << endl;
	for(int i=0; i<v.size(); i++){
		cout << "i=" << i << ":   ";
		for(int j=0; j<v[i].size(); j++){
			if(v[i][j] == 0) cout << "\x1B[0m" << v[i][j] << "   ";
      else cout << "\x1B[31m" << v[i][j] << "   ";//https://stackoverrun.com/ja/q/12618775
		}
		cout << "\x1B[0m" << endl;
	}
}


int main(){
  int n, x, t;
  cin >> n >> x >> t;
  int ans = (n+x-1)/ x * t;
  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 3616
# import bisect
# import heapq
# from copy import deepcopy
# from collections import deque
# from collections import Counter
# from itertools import accumulate
# from itertools import permutations
# import numpy as np
# import math
# mod = 10**9 + 7

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

print(n**2)

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

int main() {
  int K;
  string S;
  cin >> K >> S;
  if (S.size() <= K) {
    cout << S << endl;
  }
  else {
    string A;
    A = S.erase(K);
    cout << A << "..." << endl;
  }
}

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

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<pii> stu(n);
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    stu[i] = pii(i, a);
  }
  sort(stu.begin(), stu.end(),
       [](pii a, pii b) { return a.second < b.second; });

  for (auto& e : stu) {
    cout << e.first + 1 << " ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
long long a,b[200005],c[200005],Can,Can_t;
int main()
{
	cin>>a; 
	for(int s=0;s<a;s++)
	{
		cin>>b[s];
		c[s]=b[s];
	}
	sort(c,c+a);
	Can=c[a/2-1];
	Can_t=c[a/2];
	for(int s=0;s<a;s++)
	{
		if(b[s]<=Can)cout<<Can_t<<endl;
		else cout<<Can<<endl;
	}
}

Measured memory_bytes: 5376
N,A=list(map(int,input().split()))
x = list(map(int,input().split()))
sx = sum(x)
dp=[[0]*(N+1) for i in range(sx+1)]
dp[0][0]=1
for i in range(N):
  dp_sub=[[0]*(N+1) for j in range(sx+1)]#k枚のカードでsxを表す場合が何通りあるかを記録しておく
  for j in range(sx+1):
    for k in range(N+1):
      if dp[j][k]!=0:
        dp_sub[j+x[i]][k+1]=dp[j][k]
  for j in range(sx+1):
    for k in range(N+1):
      dp[j][k]+=dp_sub[j][k]#dp_subの結果をdpに反映

cnt=0

for i in range(min(sx//A,N)):
  cnt+=dp[A*(i+1)][i+1]
print(cnt)

Measured memory_bytes: 12808
# 公式解説を見てからやった
# 複数サイクルでき、1-K回移動可能
# N < 5000?多分、O(N * 2N)くらいで行けそうに見えるが。。。

def main(N,K,P,C):


	# 一度計算したサイクル情報を一応キャッシュしておく。。。
	# あんまり意味なさそう
	cycleIDs = [ -1 for _ in range(N) ]
	cycleInfs = []


	# print(P)

	ans = -1e10
	cycleID = 0

	for n in range(N):

		v = n
		currentCycleItemCnt = 0
		currentCycleTotal = 0

		if cycleIDs[v] != -1:
			currentCycleItemCnt, currentCycleTotal = cycleInfs[ cycleIDs[v] ]
			# print(currentCycleItemCnt, currentCycleTotal)
		else:
			while True:
				# 全頂点について、属するサイクルを計算する
				currentCycleItemCnt += 1
				currentCycleTotal += C[v]

				v = P[v]
				if v == n:
					# サイクル発見
					cycleInfs.append( (currentCycleItemCnt, currentCycleTotal) )
					cycleID += 1
					break

				# 一応、一度サイクルを計算した頂点については、
				# その頂点の属するサイクルの情報をメモっておく。。。
				cycleIDs[v] = cycleID

		procCnt = 0
		currentCycleSumTmp = 0

		while True:

			# 頂点vにコマが置かれた時の最高スコアを計算し、
			# これまでの最高スコアを上回ったら、これまでの最高スコアを更新する
			procCnt += 1
			currentCycleSumTmp += C[v]
			if K < procCnt:
				break

			cycleLoopCnt = 0
			if procCnt < K and 0 < currentCycleTotal:
				cycleLoopCnt = ( K - procCnt ) // currentCycleItemCnt

			# print("v=", v, "currentCycleSumTmp=", currentCycleSumTmp, procCnt)
			tmp = currentCycleSumTmp + cycleLoopCnt * currentCycleTotal
			ans = max( ans, tmp )

			v = P[v]
			if v == n:
				# サイクル終了
				break

	return ans
	# print(ans)



if __name__ == "__main__":
	N,K = map(int,input().split())
	P = [ int(p)-1 for p in input().split() ]
	C = list(map(int,input().split()))

	ans=main(N,K,P,C)
	print(ans)




Measured memory_bytes: 69044
import sys
sys.setrecursionlimit(1<<30)
N,Q = map(int,input().split())
def dfs(x, score):
    for y in Tree[x]:
        if Parent[x] != y:
            Parent[y] = x
            score[y] += score[x]
            dfs(y, score)
Tree = [[] for i in range(N+1)]
Parent = [0]*(N+1)
for i in range(N-1):
    a,b = map(int,input().split())
    Tree[a].append(b)
    Tree[b].append(a)
score = [0]*(N+1)
for j in range(Q):
    p,x = map(int,input().split())
    score[p] += x
dfs(1,score)
print(*score[1:],end="\t")

Measured memory_bytes: 236028
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007; // 998244353
using ll = long long;
using namespace std;

vector<int> eT;
vector<ll> uF;
ll ans = 0;
 
void es( int n ){
	for( int i = 0; i < n; ++i ){
		eT.push_back(i);
		uF.push_back(1ll);
	}
}
 
int wurzel( int x ){
	if( eT.at(x) == x ){
		return x;
	} else {
		return eT.at(x) = wurzel( eT.at(x) );
	}
}
 
void verbinden( int x, int y ){
	x = wurzel(x);
	y = wurzel(y);
	if( x == y ) return;
	eT.at(x) = y;
	uF[x] = uF[y] = uF[x] + uF[y];
}
 
bool gleich( int x, int y ){
	return wurzel(x) == wurzel(y);
}

vector<int> graph[100010];
vector<int> block[100010];

int main(){
	int n, m, k; cin >> n >> m >> k;
	es(n);
	while( m-- ){
		int a, b; cin >> a >> b;
		--a; --b;
		verbinden(a, b);
		graph[a].push_back(b);
		graph[b].push_back(a);
	}
	while( k-- ){
		int c, d; cin >> c >> d;
		--c; --d;
		block[c].push_back(d);
		block[d].push_back(c);
	}
	for( int i = 0; i < n; ++i ){
		sort( graph[i].begin(), graph[i].end() );
		int ans = uF[wurzel(i)] - graph[i].size() - 1;
		for( auto next : block[i] ){
			if( gleich(next, i) && !binary_search( graph[i].begin(), graph[i].end(), next ) ){
				--ans;
			}
		}
		cout << ans << ' ';
	}
}

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

#define ll long long
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ld long double
#define vll vector<long long>
#define pll pair<long long,long long>

const ll N = 2e5 + 10;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
vll adj[N];
ll dis[N];
bool vis[N];
queue<ll> q;
int main(){
	
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	
	ll n,m;
	cin >> n >> m;
	
	for(int i =1;i<=m;i++){
		ll u,v;
		cin >> u >> v;
		adj[u].pb(v);
		adj[v].pb(u);
	}
	
	q.push(1);
	dis[1] = 0;
	while(!q.empty()){
		ll p = q.front();
		q.pop();
		for(auto v:adj[p])
		{
			if(vis[v] == false){
				vis[v] = true;
				q.push(v);
				dis[v] = dis[p] + 1;
			}
		}
	}
	if(dis[n] == 2) cout << "POSSIBLE\n";
	else cout << "IMPOSSIBLE\n";
	
	
	
}

Measured memory_bytes: 15336
N,S=map(int,input().split())
A=list(map(int,input().split()))
m=998244353
import numpy as np
dp=np.zeros((N+1,S+1),dtype=np.int64)
dp[:,0]=[1]*(N+1)
for i,a in enumerate(A):
    dp[i+1]+=dp[i]
    dp[i+1,a:]=(dp[i+1,a:]+dp[i,:-a])%m
print(np.sum(dp[:,-1])%m)

Measured memory_bytes: 82760
#include <cstdio>

int main()
{
    int A,B,N;
    scanf("%d%d%d",&N,&A,&B);
    if(N==1)
    {
        if(A==B)
            printf("1\n");
        else
            printf("0\n");
    }
    else
    {
        if(A>B)
            printf("0\n");
        else
            printf("%lld\n",(long long )(B-A)*(N-2)+1);
    }
    return 0;
}


Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())





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


	int a, b, c;
	cin >> a >> b >> c;


	cout << max(0, c - (a - b)) << endl;


	return 0;
}

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

int main(){
	char s[4];
	scanf("%s", s);
	for(int i=0; i < 4; i++) {
		if(s[i] == '7') {
			printf("Yes\n");
			return 0;
		}
	}
	printf("No\n");
}


Measured memory_bytes: 3660
fun main(args : Array<String>) {
    val (k, a, b) = readLine()!!.split(" ").map { it.toLong() }

    if (a + 2 >= b) {
        println(k+1)
        return
    }

    var cnt = if (k < a-1) k else a-1
    var bCnt = if (k < a-1) k+1 else a

    while (cnt <= k-2) {
        bCnt += (b-a)
        cnt += 2
    }

    while (cnt < k) {
        cnt++
        bCnt++
    }

    println(bCnt)
}

Measured memory_bytes: 36004
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <climits>

using namespace std;

int main(void) {
  int n, k;
  cin >> n >> k;
  int h[100000];
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }

  sort(h, h + n, greater<int>());
  int res = INT_MAX;
  for (int i = 0; i + k - 1 < n; i++) {
    res = min(res, h[i] - h[i + k - 1]);
  }
  cout << res << endl;
  return EXIT_SUCCESS;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  double t,x;
  cin>>t>>x;
  cout<<t/x<<endl;

  return 0;

}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
int n, h, w;
int a, b;
int c=0;
scanf("%d %d %d", &n, &h, &w);
for ( int i = 0; i < n; i++ ) {
scanf("%d %d", &a, &b);
if ( (a / h) < (b / w) ) {
c += a / h;
} else{
c += b / w;
}
}
printf("%d\n", c);
return 0;
}

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

int main(){
	int a[5];
	for(int i=0;i<5;i++)scanf("%d",&a[i]);
	sort(a,a+5);
	for(int i=4;i>0;i--)printf("%d ",a[i]);
	printf("%d\n",a[0]);
}

Measured memory_bytes: 1188
import sys
from operator import itemgetter


def solve(n, m, ddd, links):
    ddi = list(enumerate(ddd))
    ddi.sort(key=itemgetter(1))
    LIMIT = 10 ** 9 + 1
    costs = [LIMIT] * m
    for v, dv in ddi:
        du, li, u = min(links[v])
        if du > dv:
            print(-1)
            return
        costs[li] = dv

    colors = [-1] * n
    for i in range(n):
        q = [(i, 0)]
        while q:
            v, color = q.pop()
            if colors[v] != -1:
                continue
            colors[v] = color
            for du, li, u in links[v]:
                if costs[li] == LIMIT:
                    continue
                q.append((u, color ^ 1))

    MAX = 10 ** 9
    costs = [MAX if cost == LIMIT else cost for cost in costs]

    print(''.join('BW'[c] for c in colors))
    print('\n'.join(map(str, costs)))


n, m = map(int, input().split())
ddd = list(map(int, input().split()))
links = [[] for _ in range(n)]
for li, line in enumerate(sys.stdin):
    u, v = map(int, line.split())
    u -= 1
    v -= 1
    links[u].append((ddd[v], li, v))
    links[v].append((ddd[u], li, u))
solve(n, m, ddd, links)


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

const ll MOD = 1000000007;

int main(){
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    ll sum = 0;
    if(k - a > 0){
        sum = a;
        k -= a;
    }else{
        sum = k;
        k -= a;
    }
    if(k > 0){
        k -= b;
        if(k > 0){
            sum -= k;
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 3636
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
typedef long long ll;

#define INF INT_MAX
#define LLINF LLONG_MAX
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007
#define MODB  998244353 

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

int main() {
	ll ans = 0;
	ll tmp;
	int n; cin >> n;
	int m; cin >> m;
	vector<string> s(n);
	cin >> s;
	mf_graph<ll> graph(n*m+2);
	REP(i, n){
		REP(j, m){
			if(s[i][j] == '.'){
				if((i+j) % 2 == 0){
					graph.add_edge(n*m, i*m+j, 1);
					if(j < m-1 && s[i][j+1] == '.') graph.add_edge(i*m+j, i*m+j+1, 1);
					if(j > 0 && s[i][j-1] == '.') graph.add_edge(i*m+j, i*m+j-1, 1);
					if(i < n-1 && s[i+1][j] == '.') graph.add_edge(i*m+j, i*m+j+m, 1);
					if(i > 0 && s[i-1][j] == '.') graph.add_edge(i*m+j, i*m+j-m, 1);
				}
				else{
					graph.add_edge(i*m+j,n*m+1, 1);
				}
				
			}
		}
	}
	cout << graph.flow(n*m, n*m+1) << endl; 
	vector<mf_graph<ll>::edge> v = graph.edges();
	//cout << v.size() << endl;
	REP(i,v.size()){
		if(v[i].from != n*m && v[i].to != n*m+1 && v[i].flow > 0){
			int x = v[i].to; int y = v[i].from;
			if(x - y == -m){s[y/m][y%m] = '^'; s[x/m][x%m] = 'v';}
			else if(x - y == m){s[y/m][y%m] = 'v'; s[x/m][x%m] = '^';}
			else if(x - y == -1){s[y/m][y%m] = '<'; s[x/m][x%m] = '>';}
			else if(x - y == 1){s[y/m][y%m] = '>'; s[x/m][x%m] = '<';}

		}
	}
	REP(i, n){
		cout << s[i] << endl;
	}
	//cout << ans << endl;
}

Measured memory_bytes: 6308
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
  String s = sc.next();
  char[] c = s.toCharArray();
  char[] d = new char[(s.length() + 1)/2];
  for(int i = 0;i < (s.length() + 1)/2;i++){
    d[i] = c[2*i];
  }
  String t = String.valueOf(d);
  System.out.println(t);
}}

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

int main()
{
    int n;
    int i, j = 0, min = 0, total = 0;
    
    cin >> n;
    
    int s[n];
    
    for(i = 0; i < n; i++) {
        cin >> s[i];
        total += s[i];
        
    }
    
    sort(s, s+n);
    
    while((min == 0) && (j < n)) {
        if((s[j] % 10 != 0) && (min == 0)) {
            min = s[j];
        }
        j++;
    }
    
    if(total % 10 != 0) {
        cout << total << endl;
    } else if(min != 0) {
        cout << total - min << endl;
    } else {
        cout << "0" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<functional>
#include<map>
#include<set>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)

map<string, int> mp;

int main() {
    int h, w;
    char a[100][100];
    cin >> h >> w;
    rep(i, h) {
        rep(j, w) {
            cin >> a[i][j];
        }
    }
    rep(i, w + 2) {
        cout << '#';
    }
    cout << endl;
    rep(i, h) {
        cout << '#';
        rep(j, w) {
            cout << a[i][j];
        }
        cout << '#' << endl;
    }
    rep(i, w + 2) {
        cout << '#';
    }
    cout << endl;
}

Measured memory_bytes: 256
// #include <stdio.h>
// #include <stdlib.h>
// include <math.h>
// #include <typeinfo>
#include <iostream>
#include <algorithm>
// #include <list>
// #include <map>
// #include <string>
// #include <vector>
// #include <set>
// #include <cstdlib>

using namespace std;

class block{
    private:
        long int a,b,c;
    public:
        void set();
        void sub();
};

void block::set(){
    cin >> a >> b >> c;
}

void block::sub(){
    long int m=0;
    if(a%2!=0 && b%2!=0 && c%2!=0) m = min({a*b,b*c,c*a});
    cout << m << endl;
}

int main(){
    block b;
    b.set();
    b.sub();
    return 0;
}

Measured memory_bytes: 256
#define Y(V,N)V+D[d][N]*z[j]
#define X(V,N)(0<=Y(V,N)&&Y(V,N)<n)
D[13][3]={{1,0,0},{0,1,0},{0,0,1},{1,1,0},{1,0,1},{0,1,1},{1,-1,0},{1,0,-1},{0,1,-1},{1,1,1},{-1,1,1},{1,-1,1},{1,1,-1}};
M[9][9][9],z[2];main(n,m,p,I,x,y,i,j,c,d){for(;scanf("%d%d%d",&n,&m,&p),n;){
	for(memset(M,0,sizeof(M)),c=1,I=0;I<p;c*=-1){
		scanf("%d%d",&x,&y),I++;
		for(i=1;;i++)if(!M[x][y][i]){M[x][y][i]=c;break;}
		for(d=0;d<13;d++){
			for(j=0;j<2;j++)for(z[j]=0;z[j]<m;z[j]+=2*j-1)if(M[Y(x,0)][Y(y,1)][Y(i,2)]!=c)break;
			if(z[1]-z[0]-1>=m){printf("%s %d\n",c==1?"Black":"White",I);goto next;}
		}
	}
	puts("Draw");
next:
	for(;I<p;I++)scanf("%d%d",&x,&y);
}exit(0);}

Measured memory_bytes: 612
#include <limits>
#include <initializer_list>
#include <utility>
#include <bitset>
#include <tuple>
#include <type_traits>
#include <functional>
#include <string>
#include <array>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iterator>
#include <algorithm>
#include <complex>
#include <random>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <regex>
#include <cassert>
#include <cstddef>
#ifdef CPP17
#include <variant>
#endif

#define endl codeforces

#define ALL(v) std::begin(v), std::end(v)
#define ALLR(v) std::rbegin(v), std::rend(v)

using ll = std::int64_t;
using ull = std::uint64_t;
using pii = std::pair<int, int>;
using tii = std::tuple<int, int, int>;
using pll = std::pair<ll, ll>;
using tll = std::tuple<ll, ll, ll>;
using size_type = ssize_t;
template <typename T> using vec = std::vector<T>;
template <typename T> using vvec = vec<vec<T>>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }

template <typename T, std::size_t Head, std::size_t... Tail> 
struct multi_dim_array { using type = std::array<typename multi_dim_array<T, Tail...>::type, Head>; };

template <typename T, std::size_t Head> 
struct multi_dim_array<T, Head> { using type = std::array<T, Head>; };

template <typename T, std::size_t... Args> using mdarray = typename multi_dim_array<T, Args...>::type;

#ifdef CPP17
template <typename T, typename F, typename... Args> 
void fill_seq(T &t, F f, Args... args) { 
    if constexpr (std::is_invocable<F, Args...>::value) { 
        t = f(args...); 
    } else { 
        for (size_type i = 0; i < t.size(); i++) fill_seq(t[i], f, args..., i); 
    } 
}
#endif

template <typename T> vec<T> make_v(size_type sz) { return vec<T>(sz); }

template <typename T, typename... Tail> 
auto make_v(size_type hs, Tail&&... ts) { 
    auto v = std::move(make_v<T>(std::forward<Tail>(ts)...)); 
    return vec<decltype(v)>(hs, v); 
}

namespace init__ { 
struct InitIO { 
    InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } 
} init_io; 
}


int main() {
    ll a;
    std::cin >> a;
    ll cur = 1, sum = 0;
    for (ll i = 0; i < 3; i++) {
        cur *= a;
        sum += cur;
    }
    std::cout << sum << "\n";
    return 0;
}


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

using namespace std;
int n,k;
int a[100005];
int dp[100005];
int solve(int pos)
{
        if(pos==n)
        return 0;
       int &ret=dp[pos];
    if(ret!=-1)
        return ret;
    ret =1e9;
    for(int i=1;i<=k;i++)
    {
        if(pos+i<=n)
       {
           ret=min(ret,solve(pos+i)+abs(a[pos]-a[pos+i]));
      }
    }
    return ret;
}

int main()
{
    cin>>n>>k;
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
    }
    memset(dp,-1,sizeof(dp));
    int ans=solve(1);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define per(i, a, b) for(int i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef pair<ll,ll> pll;
typedef vector<string> vs;
typedef vector<pll> vpl;
typedef vector<int> vi;
inline int mod(int n, int m){ int ret = n%m; if(ret < 0) ret += m; return ret; }
ll gcd(ll a, ll b){return (b == 0 ? a : gcd(b, a%b));}
ll exp(ll a,ll b,ll m){
    if(b==0LL) return 1LL;
    if(b==1LL) return mod(a,m);
    ll k = mod(exp(a,b/2,m),m);
    if(b&1LL){
        return mod(a*mod(k*k,m),m);
    }
    else return mod(k*k,m);
 
}


int32_t main(){
  fastio;
  int n;
  cin>>n;
  set<int> S;

  vector<int> d;
  for(int i=1;i*i<=n;i++){
    if(n%i==0){
      d.pb(i);
      if(n/i!=i)d.pb(n/i);
    }
  }
  for(int x : d){
    int k = n;
    if(x==1)continue;
    
    while(k>=x && k%x==0 ){
      k/=x;
     
    }
  
    if(k%x==1)S.insert(x);
  }

  d.clear();
  n--;
  for(int i=1;i*i<=n;i++){
    if(n%i==0){
      d.pb(i);
      if(n/i!=i)d.pb(n/i);
    }
  }
  for(int x : d)S.insert(x);

    n++;

  if(S.find(1)!=S.end())S.erase(1);
  
  
  cout<<S.size()<<endl;
  // Math -> gcd it all // chack MAXN // check ll
  //did you check N=1? Did you mix up N,M?
}

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

#define reps(v, f, l) for (int v = (f), v##_ = (l); v < v##_; ++v)
#define rep(v, n) reps(v, 0, n)
#define lep(v, n) reps(v, 1, n + 1)

using namespace std;

typedef long long int lint;

static inline int in(){ int x; scanf("%d", &x); return x; }
static inline lint inl(){ lint x; scanf("%lld", &x); return x; }
template<typename T> void show(T& a, char del='\n', char last='\n'){ rep(i, a.size() - 1) cout << a[i] << del; cout << a[a.size() - 1] << last; }

struct Sieve {
  const int size;
  vector<bool> sieve;
  Sieve(int size) : size(size), sieve(size + 1, true) {}
  void build(){
    for (int i = 2; i * i <= size; ++i){
      for (int j = i * i; j <= size; j += i){
        sieve[j] = false;
      }
    }
    sieve[0] = false;
    sieve[1] = false;
  }
  bool isPrime(int n){
    return sieve[n];
  }
};

int main()
{
  Sieve s(10000);
  s.build();
  int n;
  while (~scanf("%d", &n)){
    int count = 0;
    lep(i, n){
      if (s.isPrime(i) && s.isPrime(n - i + 1)){
        count++;
      }
    }
    cout << count << endl;
  }
  return 0;
}

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

const int nax = 1e5 + 5;

bool flag[nax] = {false};
int wa_cnt[nax] = {0};

int main() {
	int n, m, p;
	string s;
	cin >> n >> m;

	int ac = 0, wa = 0;

	for (int i = 0; i < m; i++) {
		cin >> p >> s;

		if (s[0] == 'A' && !flag[p]) {
			flag[p] = true;
			wa += wa_cnt[p];
			ac++;
		} else if (s[0] == 'W' && !flag[p]) {
			wa_cnt[p]++;
		}
	}

	cout << ac << " " << wa;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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

const long long INF = 1LL << 60;

int main(){
  int n; cin >> n;
  
  int cnt = 0;
  rep(i, n){
    int a; cin >> a;
    while(a%2 == 0){
      a /= 2;
      cnt++;
    }
  }

  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 256
program accepted
  implicit none
  character(10) :: s
  integer :: n, i
  logical :: ac = .false., ok = .false.
  read(*,*) s
  if (s(1:1) == 'A') then
    n = len_trim(s)
    do i = 2, n
      if (s(i:i) == 'C') then
        if (ok) goto 100
        if (i < 3 .or. i > n-1) goto 100
        ok = .true.
        cycle
      end if
      if ('a' <= s(i:i) .and. s(i:i) <= 'z') cycle
      goto 100
    end do
    ac = ok
  end if
  100 write(*,'(a)') merge("AC","WA",ac)
end program accepted

Measured memory_bytes: 256
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
long long rmax(long long a,long long b){
  if(a>b){
    return a;
  }
  else return b;
}

long long rmin(long long a,long long b){
  if(a>b){
    return b;
  }
  else return a;
}

using namespace std;
int main(void){
  int x,x1,y1,y;
  int n,h;
  h=n;
  cin >> n;
  x=n/1.08;
//  cout <<"x=="<< x << "\n";
//cout << "x*1.08="<<(x+1)*1.08<<"\n";
  if(x*1.08==n){
    cout << x;
    return 0;
  }
  else if((x1=(x+1)*1.08)==n){
    cout << x+1;
    return 0;
  }



  else {
    cout << ":(";
  }

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset> //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip> //do setprecision
#include <ctime>
#include <complex>
using namespace std;

int main(void){
	int N,card[100],sum=0,i;
	scanf("%d",&N);
	for(i=0;i<N;i++){
		scanf("%d",&card[i]);
	}
	sort(card,card+N);
	reverse(card,card+N);
	for (int i = 0; i < N; ++i){
		if((i%2)==0){
			sum=sum+card[i];
		}else{
			sum=sum-card[i];
		}
	}
	printf("%d\n",sum);
}

Measured memory_bytes: 256
fn main() {
    let mut n = String::new();
    std::io::stdin().read_line(& mut n).unwrap();
    let mut a = String::new();
    std::io::stdin().read_line(& mut a).unwrap();
    let n: i32 = n.trim().parse().unwrap();
    let a: i32 = a.trim().parse().unwrap();

    let ans = if n % 500 - a <= 0 { "Yes" } else { "No" };
    println!("{}", ans);
}

Measured memory_bytes: 4352
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[allow(unused_macros)]
macro_rules! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> { fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering { self.0.partial_cmp(&other.0).unwrap() }}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;


fn main() {
    input!{s:chars};
    let mut s = s;
    s[3] = '8';

    println!("{}", s.iter().cloned().collect::<String>());


}

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

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF             2e9
#define INF_LL          1LL<<60
#define ll              long long
#define Ceil(x, n)      (((((x))+((n)-1))/n))
#define CeilN(x, n)     (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)    ((x)-(x)%(n))
#define ALL(x)          (x).begin(),(x).end()

int main(){
    int k;
    cin >> k;
    vector<ll> lunlun;
    REPN(i, 1, 10) lunlun.push_back(i);

    /* while一周する間にlunlunが一桁ずつ増えてく */
    while(1) {
        if(k <= lunlun.size()) {
            cout << lunlun[k-1] << endl;
            return 0;
        }
        k -= lunlun.size();
        vector<ll> old;
        swap(old, lunlun); /* lunlunにoldから一桁増えたやつを詰めていく */
        for(ll x: old) {
            for(int i = -1; i <= 1; i++) {
                int d = x % 10 + i;
                if(d < 0 || d > 9) continue;
                ll nx = x * 10 + d;
                lunlun.push_back(nx);
            }
        }
    }
    return 0;
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int K;
bool visited[int(1e6+5)];

int main(){
  cin >> K;
  ll now = 0, cnt = 0;
  while (true){
    cnt++;
    now = now * 10 + 7; now %= K;
    if (visited[now]){
      cout << -1 << endl;
      return 0;
    }
    
    visited[now] = true;
    if (now == 0){
      cout << cnt << endl;
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 4516
#include <bits/stdc++.h>
#define boost_io ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define num(a) a-'0'
#define charr(a) a - 'a'
#define rep(i,a,b) for(int i=a;i<b;i++)
#define maxs(a,b) if(b>a)a=b
#define mins(a,b) if(b<a)a=b
#define debug(x) cerr<<"["<<#x<<":"<<x<<"] "
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/(__gcd(a,b))
#define print(arr) for(auto it = arr.begin();it < arr.end();it ++){cout << *it << " ";}cout << ln;
#define all(a) (a).begin(), (a).end()
#define vi vector<int>
#define vl vector<long long int>
#define v vector
#define p pair
#define pb push_back
#define mk make_pair
#define f first
#define s second
#define ln "\n"
typedef long long int ll;
typedef long double ld;
typedef double d;
using namespace std;
ll modF=1e9+7;
ll INF=1e11;

void solve(){
	int n,x,t;
	cin>>n>>x>>t;
	int ans=(n/x) * t;
	if(n%x != 0)
		ans+=t;
	cout<<ans<<ln;
}	

int main(){
	boost_io;
	solve();
	return 0;
}


Measured memory_bytes: 3636
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {

	public static void main (String [] a){

		int numMountain = 10;
		int minConst = 0;
		int maxConst = 10000;
		int[] mountainList = new int[numMountain];
		int topOne = 0;
		int topTwo = 0;
		int topThree = 0;
		
		BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
		String line;
		int i = 0;
		
		try {
			while (i < numMountain && (line = stdin.readLine()) != null && 
					line.length()!= 0 ) {
					
					try {
						int tempHeight = Integer.parseInt(line);
						if (tempHeight < minConst || tempHeight > maxConst) {
						} else {
							mountainList[i] = tempHeight;
							i++;
						}
					} catch (NumberFormatException e){
						// TODO Auto-generated catch block
						//e.printStackTrace();
					}
					
			}
			
			for (int j=0; j<numMountain; j++){
				if (mountainList[j] >= topOne){
					topThree = topTwo;
					topTwo = topOne;
					topOne = mountainList[j];
				} else if (mountainList[j] >= topTwo){
					topThree = topTwo;
					topTwo = mountainList[j];
				} else if (mountainList[j] >= topThree){
					topThree = mountainList[j];
				}
			}
			
			System.out.println(topOne +"\n"+ topTwo +"\n"+ topThree);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			//e.printStackTrace();
		}
	}
}

Measured memory_bytes: 24232
#include <iostream>
#include <cassert>
#include <limits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <array>
#include <map>
#include <set>
#include <deque>
#include <list>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cstring>
#include <bitset>
#include <stack>
#include <queue>

#define MOD (1e9 + 7);
#define PI (3.14159265358979323846)

using ll = int64_t;
using ull = uint64_t;

using namespace std;

[[maybe_unused]] static auto __x = [](){ios_base::sync_with_stdio(0); cin.tie(0);};

int main() {
    int x, y, z;
    cin >> x >> y >> z;

    swap(x, y);
    swap(x, z);

    cout << x << ' ' << y << ' ' << z;

    return 0;
}


Measured memory_bytes: 3624