akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int w, h, n, ans;
    ans = 0;
    cin >> w >> h >> n;
    int map[w][h];
    int dots[n][3];
    int st_x, st_y, en_x, en_y;

    for (int i = 0; i < n; i++)
    {
        cin >> dots[i][0] >> dots[i][1] >> dots[i][2];
    }

    for (int i = 0; i < w; i++)
    {
        for (int j = 0; j < h; j++)
        {
            map[i][j] = 0;
        }
    }

    for (int i = 0; i < n; i++)
    {
        if (dots[i][2] == 1)
        {
            st_x = 0;
            en_x = dots[i][0];
            st_y = 0;
            en_y = h;
        }
        else if (dots[i][2] == 2)
        {
            st_x = dots[i][0];
            en_x = w;
            st_y = 0;
            en_y = h;
        }
        else if (dots[i][2] == 3)
        {
            st_x = 0;
            en_x = w;
            st_y = 0;
            en_y = dots[i][1];
        }
        else
        {
            st_x = 0;
            en_x = w;
            st_y = dots[i][1];
            en_y = h;
        }

        for (int j = st_x; j < en_x; j++)
        {
            for (int k = st_y; k < en_y; k++)
            {
                map[j][k] = 1;
            }
        }
    }

    for (int i = 0; i < w; i++)
    {
        for (int j = 0; j < h; j++)
        {
            if (map[i][j] == 0)
            {
                ans ++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 1000000002486618624LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);

  int N, P, A, e = 0, o = 0;

  std::cin >> N >> P;

  for (int i = 0; i < N; i ++) {
    std::cin >> A;

    (A % 2 == 0 ? e : o) ++;
  }

  if (o == 0) {
    std::cout << (P % 2 == 0 ? 1 : 0) * (1LL << e) << std::endl;
  }
  else {
    std::cout << (1LL << (o - 1)) * (1LL << e) << std::endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<queue>
#include<ctime>
#include<algorithm>
#include<cstdlib>
#include<stack>
#include<cstring>
#include<cmath>
using namespace std;

typedef long long LL;

const int INF = 2147483647;

int n,ans,cnt,a[10000];

inline LL getint()
{
    LL ret = 0,f = 1;
    char c = getchar();
    while (c < '0' || c > '9')
    {
        if (c == '-') f = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') ret = ret * 10 + c - '0',c = getchar();
    return ret * f;
}

int main()
{
    #ifdef AMC
        freopen("AMC1.txt","r",stdin);
    #endif
    n = getint();
    for (int i = 1; i <= n; i++) a[i] = getint();
    for (int i = 1; i <= n + 1; i++)
    {
    	if (i == 1 || a[i] != a[i - 1])
    	{
    		ans += cnt / 2;
    		cnt = 0;
    	}
    	cnt++;
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 128
/*
2020-04-26
atcoder ABC
D - Dice in Line
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
const ll mod = 1000000007;

int main() {
    int N, K;
    ll max_K_total = 0;
    ll d = 0;
    ll max_d = 0;
    double ans;
    cin >> N >> K;
    vector<int> p(N);
    for(int i; i < N; i++){
        int input_p;
        cin >> input_p;
        p[i] = input_p;
        if(i < K){
            max_K_total += input_p;
        } else {
            d += input_p - p[i - K];
            max_d = max(max_d, d);
        }
    }
    max_K_total += max_d;
    ans = (double)(max_K_total + K) / 2;
    cout << fixed << setprecision(12) << ans << endl; 
    return 0;
}


Measured memory_bytes: 1024
/**
 * DSL_5-A - Cumulative Sum - The Maximum Number of Customers
 */

#include <iostream>

using namespace std;

int main() {
    int N, T;
    cin >> N >> T;
    int A[100001] = {0};
    for (int i = 0; i < N; i++) {
        int l, r;
        cin >> l >> r;
        A[l]++;
        A[r]--;
    }
    int ans = A[0];
    for (int i = 1; i <= T; i++) {
        A[i] += A[i - 1];
        ans = max(ans, A[i]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3472
#include <iostream>
#include <math.h>

using namespace std;

int main(){
        int a,b,ans=0;
        cin>>a>>b;

        if(a>b){
                ans+=a;
                ans+=max(a-1,b);
        }else{
                ans+=b;
                ans+=max(a,b-1);
        }

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


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int n;
int cnt[10];
char s[10];

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%s", s + 1);
		if (s[1] == 'A') cnt[1]++;
		else if (s[1] == 'W') cnt[2]++;
		else if (s[1] == 'T') cnt[3]++;
		else cnt[4]++;
	}
	printf("AC x %d\n", cnt[1]);
	printf("WA x %d\n", cnt[2]);
	printf("TLE x %d\n", cnt[3]);
	printf("RE x %d\n", cnt[4]);
	return 0;
}

Measured memory_bytes: 3764
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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

  int flag = 0;
  if(a==b){
    flag++;}
  if(b==c){
  flag++;
  }
  if(c==a){flag++;}

  if(flag==1){
    cout << "Yes" << endl;
  }else{
    cout << "No" <<endl;
  }
  return 0;
}

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

int main(){
  int N,K;
  cin >> N >> K;
  vector<char> X(K);
  for(int i=0; i<K; i++)cin >> X[i];

  int i=N,signal=0;
  string S;
  while(1){
    S = to_string(i);
    for(int j=0;j<S.size();j++)
      for(int k=0;k<X.size();k++)
        if(S[j]==X[k]){
          signal++;
          break;
        }
    
    if(signal==0){
      cout << i << endl;
      break;
    }
    i++;
    signal=0;
  }
}




Measured memory_bytes: 256
#include <stdio.h>
int main(){
    int n;
    scanf("%d", &n);
    int a[n];
    for(int i = 0; i < n; i++) scanf("%d", &a[i]);
    int cnt = 0;
    for(int i = 0; i < n; i++){
        int minj = i;
        for(int  j = i; j < n; j++){
            if(a[j] < a[minj]){
                minj = j;
            }
        }
        if(minj != i){
            int temp = a[i];
            a[i] = a[minj];
            a[minj] = temp;
            cnt++;
        }
    }

    for(int  i = 0; i < n; i++){
        if(i == n-1) printf("%d\n", a[i]);
        else printf("%d ", a[i]);
    }
    printf("%d\n", cnt);
    return 0;
}


Measured memory_bytes: 2116
# coding: utf-8
# Your code here!

N, T = map(int, input().split())
a = list(map(int, input().split()))
total_t, crrnt_t, a_len = 0, 0, len(a)

for i in range(a_len - 1):
    if a[i] + T > a[i + 1]: 
        total_t += a[i + 1] - a[i]
    else: 
        total_t += T
    crrnt_t = a[i + 1]

print(total_t + T)

Measured memory_bytes: 86608
import math
N, D = map(int, input().split())
graph = []
for i in range(N):
    a, b = map(int, input().split())
    graph.append([a,b])
seen = []
count = 0

for j in range(N):
    if (graph[j] in seen):
        continue
    else:
        x = math.sqrt((graph[j][0] ** 2) + (graph[j][1] ** 2))
        if (x <= D):
            count += 1
        else:
            continue

print(count)

Measured memory_bytes: 99564
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main (String[] args) throws java.lang.Exception
	{
		BufferedReader input = new BufferedReader (new InputStreamReader (System.in));
		
		String[] matrixStr = input.readLine().split(" ");
		
		int row = Integer.parseInt(matrixStr[0]);
		
		int column = Integer.parseInt(matrixStr[1]);
		
		int[][] spreadsheet = new int[row + 1][column +1];
		
		for(int rowNum = 0; rowNum < row; rowNum++)
		{
			String[] rowStr = input.readLine().split(" ");
			
			int rowSum = 0;
			
			for(int columnNum = 0; columnNum < column; columnNum++)
			{
				spreadsheet[rowNum][columnNum] = Integer.parseInt(rowStr[columnNum]);
				
				rowSum = rowSum + spreadsheet[rowNum][columnNum];
			}
			
			spreadsheet[rowNum][column] = rowSum;
		}
		
		for(int columnNum = 0; columnNum <= column; columnNum++)
		{
			int columnSum = 0;
			
			for(int rowNum = 0; rowNum < row; rowNum++)
			{
				columnSum = columnSum + spreadsheet[rowNum][columnNum];
			}
			
			spreadsheet[row][columnNum] = columnSum;
		}
		
		for(int rowNum = 0; rowNum <= row; rowNum++)
		{
			for(int columnNum = 0; columnNum <= column; columnNum++)
			{
				System.out.print(spreadsheet[rowNum][columnNum]);
				
				if(columnNum != column)
				{
					System.out.print(" ");
				}
			}
			System.out.println();
		}
	}
}



Measured memory_bytes: 32844
<?php
// C
fscanf(STDIN, '%d', $n);
for ($i  = 0; $i < $n; $i++) fscanf(STDIN, '%d %d', $a[], $b[]);
for ($i  = 0; $i < $n; $i++) fscanf(STDIN, '%d %d', $c[], $d[]);
array_multisort($b, SORT_DESC, $a);
array_multisort($c, SORT_ASC, $d);
for ($j = 0; $j < $n; $j++) {
    $flag = false;
    foreach ($a as $i => $v) {
        if ($a[$i] < $c[$j] && $b[$i] < $d[$j]) {
            $flag = true;
            break;
        }
    }
    if ($flag) unset($a[$i]);
}
echo $n - count($a);

Measured memory_bytes: 4604
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N = 0;
  cin >> N;

  bool F = false;
  for (int i = 0; i < N; i++) {
    string S;
    cin >> S;
    if (S == "Y") {
      F = true;
      break;
    }
  }

  if (F) {
    cout << "Four" << endl;
  } else {
    cout << "Three" << endl;
  }
}

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

int main(){
    int n,a;
    cin >> n;
    int num[n];
    for(int j = 0; j < n; j++){
        cin >> a;
        num[j] = a;
    }
    for(int i = n-1; i >= 0; i--){
        if(i == 0) continue;
        cout << num[i] << " ";
    }
    cout << num[0];
    cout << endl;
    return 0;
}


Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
#define  pi  pair<int,int>
#define  pb  push_back
#define  F   first
#define  S   second
const int N=2e5+2;
int main()
{
    ft
    ll t,i,j,n,m,s=0;
    cin>>n;
    for(i=0; i<n; i++)
    {
        cin>>m;
        s+=(m-1);
    }
    cout<<s<<"\n";
    return 0;
}



Measured memory_bytes: 256
program good
 implicit none
 integer :: N, A, B, C, D
 read(*,*) N
 A = N /1000
 B = (N -A*1000) /100
 C = (N - A*1000 - B*100) /10
 D = N -A*1000 -B*100 -C*10
 if( A == B .and. A == C ) then
 	write(*,*) "Yes"
 else if( B == C .and. B == D) then
 	write(*,*) "Yes"
 else
 	write(*,*) "No"
 end if
end program good

Measured memory_bytes: 256
def readints():
    return list(map(int, input().split()))


n, l = map(int, input().split())
num = [0 for i in range(n)]
for i in range(n):
    num[i] = l+i
# print(num)
num.sort(key=lambda x: abs(x))
print(sum(num[1:]))


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

#define EPS (1e-10)
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)
#define all(a) a.begin(), a.end()

using namespace std;
using ll = long long;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvb = vector<vb>;

constexpr int MOD = 1000000007;

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

    int h, w;
    cin >> h >> w;

    vvb grid(h, vb(w, false));
    vvb tgrid(w, vb(h, false));

    rep(i, 0, h) {
        rep(j, 0, w) {
            char c;
            cin >> c;
            if (c == '#') {
                grid[i][j] = true;
                tgrid[j][i] = true;
            }
        }
    }

    vvi rows(h, vi(w, 0));
    rep(i, 0, h) {
        int s = 0, t = 0;
        while (s < w) {
            while (t < w && !grid[i][t]) { ++t; }
            int n = t - s;
            while (s < t) { rows[i][s++] = n; }
            ++s;
            ++t;
        }
    }

    vvi cols(h, vi(w, 0));
    rep(i, 0, w) {
        int s = 0, t = 0;
        while (s < h) {
            while (t < h && !grid[t][i]) { ++t; }
            int n = t - s;
            while (s < t) { cols[s++][i] = n; }
            ++s;
            ++t;
        }
    }

    int ans = 0;
    rep(i, 0, h) {
        rep(j, 0, w) { ans = max(ans, rows[i][j] + cols[i][j] - 1); }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 32896
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		if(n <= 3) {
			System.out.println("No");
		} else {
			int div = n / 4;
			boolean flag = false;
			for(int i = 0; i < n / 4 + 1; i++) {
				int tmp = n - 4 * i;
				if(tmp % 7 == 0) {
					flag = true;
					break;
				}
			}
			if(flag) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
		}

	}

}


Measured memory_bytes: 23124
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "

int main(){
    int n;cin>>n;
    int x=0,ans =0;
    string s;cin>>s;
    rep(i,s.size()){
        if(s[i]=='I'){x++;}
        else x--;
        ans = max(ans,x);
    }
    co(ans);
}

Measured memory_bytes: 256
H,W = gets.split.map(&:to_i)

if H % 3 == 0 || W % 3 == 0

    puts 0

else

    if W % 2 == 0

        answer1 = ((H- (2*H)/3)*W- (W/2)* ((2*H)/3)).abs
        answer2 = ((H - ((2*H)/3) - 1)*W- (W/2)* (((2*H)/3)+1)).abs
        answer3 = W * H
        answer4 = W * H

    else 

        answer1 = [(H- (2*H)/3)*W,(W/2)* ((2*H)/3),((W/2)+1)* ((2*H)/3)].max -  [(H- (2*H)/3)*W,(W/2)* ((2*H)/3),((W/2)+1)* ((2*H)/3)].min
        answer2 = [(H - ((2*H)/3) - 1)*W, (W/2)* (((2*H)/3)+1), ((W/2)+1)* (((2*H)/3)+1)].max- [(H - ((2*H)/3) - 1)*W, (W/2)* (((2*H)/3)+1), ((W/2)+1)* (((2*H)/3)+1)].min
        answer3 = [(H- ((2*W*H)/(3 * W+2)))*W,(W/2)* ((2*W*H)/(3 * W+2)),((W/2)+1)* ((2*W*H)/(3 * W+2))].max - [(H- ((2*W*H)/(3 * W+2)))*W,(W/2)* ((2*W*H)/(3 * W+2)),((W/2)+1)* ((2*W*H)/(3 * W+2))].min 
        answer4 = [(H- ((2*W*H)/(3 * W+2)) -1 )*W,(W/2)* (((2*W*H)/(3 * W+2))+1),((W/2)+1)* (((2*W*H)/(3 * W+2))+1)].max - [(H- ((2*W*H)/(3 * W+2)) -1 )*W,(W/2)* (((2*W*H)/(3 * W+2))+1),((W/2)+1)* (((2*W*H)/(3 * W+2))+1)].min 
    end

    if H % 2 == 0

        answer5 = ((W- (2*W)/3)*H- (H/2)* ((2*W)/3)).abs
        answer6 = ((W - ((2*W)/3) - 1)*H- (H/2)* (((2*W)/3)+1)).abs
        answer7 = W * H
        answer8 = W * H

    else

        answer5 = [(W- (2*W)/3)*H,(H/2)* ((2*W)/3),((H/2)+1)* ((2*W)/3)].max -  [(W- (2*W)/3)*H,(H/2)* ((2*W)/3),((H/2)+1)* ((2*W)/3)].min
        answer6 = [(W - ((2*W)/3) - 1)*H, (H/2)* (((2*W)/3)+ 1),((H/2)+1)* (((2*W)/3)+1)].max- [(W - ((2*W)/3) - 1)*H, (H/2)* (((2*W)/3)+1), ((H/2)+1)* (((2*W)/3)+1)].min
        answer7 = [(W- ((2*W*H)/(3 * H+2)))*H,(H/2)* ((2*W*H)/(3 * H+2)),((H/2)+1)* ((2*W*H)/(3 * H+2))].max - [(W- ((2*W*H)/(3 * H+2)))*H,(H/2)* ((2*W*H)/(3 * H+2)),((H/2)+1)* ((2*W*H)/(3 * H+2))].min 
        answer8 = [(W- ((2*W*H)/(3 * H+2)) -1 )*H,(H/2)* (((2*W*H)/(3 * H+2))+1),((H/2)+1)* (((2*W*H)/(3 * H+2))+1)].max - [(W- ((2*W*H)/(3 * H+2)) -1 )*H,(H/2)* (((2*W*H)/(3 * H+2))+1),((H/2)+1)* (((2*W*H)/(3 * H+2))+1)].min

    end

    puts [answer1,answer2,answer3,answer4,answer5,answer6,answer7,answer8,W,H].min

end

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

int main()
{
	int K,S;
	
	cin >> K >> S;
	
	int ans=0;
	for(int x=0;x<=K;x++)
	{
		for(int y=0;y<=K;y++)
		{
			int z=S-x-y;
			if(0<=z && z<=K && x+y+z==S)
				ans++;
		}
	}
	
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
  private static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
      tokenizer = null;
    }

    public String next() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public String nextLine() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          return reader.readLine();
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      return tokenizer.nextToken("\n");
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = nextInt();
      return a;
    }

    public long[] nextLongArray(int n) {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = nextLong();
      return a;
    }
  }

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    int n = sc.nextInt();
    long sum = 0L;
    for (int i = 1; i <= n; i++) {
      if (i % 5 != 0 && i % 3 != 0) sum += (long) i;
    }
    System.out.println(sum);
  }
}

Measured memory_bytes: 32772
n, k, q = map(int, input().split())

answers = []
for i in range(q):
    a = int(input())
    answers.append(a)

players = []
for i in range(n):
    players.append(0)

for i in range(q):
    players[answers[i] - 1] += 1


for i in range(n):
    if k - q + players[i] <= 0:
        print('No')
    else:
        print('Yes')



Measured memory_bytes: 8644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    map<ll, ll> cnt;
    rep(i, n) {
        cnt[a[i] - 1]++;
        cnt[a[i]]++;
        cnt[a[i] + 1]++;
    }
    ll ans = 0;
    for(auto x : cnt) {
        ans = max(ans, x.second);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 7040
fun main(args:Array<String>){
  val input = readLine()!!.toInt()
  val rank = when(input) {
    in 1800..1999 -> 1
    in 1600..1799 -> 2
    in 1400..1599 -> 3
    in 1200..1399 -> 4
    in 1000..1199 -> 5
    in 800..999 -> 6
    in 600..799 -> 7
    else -> 8
  }
  println(rank)
}

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

int main() {
    int N, K; cin >> N >> K;
    string S; cin >> S;
    int num_facing = 0;
    for (int i = 0; i < N - 1; ++i) {
        if (S[i] != S[i + 1]) ++num_facing;
    }
    num_facing = max(0, num_facing - 2 * K);
    cout << N - 1 - num_facing << endl;
    return 0;
}


Measured memory_bytes: 3708
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>

using namespace std;

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

	int count = 0;

	for (int i = 0; i < n; i++) {
		int tmp;
		cin >> tmp;
		while (1) {
			if (tmp % 2 == 1) break;
			else {
				tmp /= 2;
				count++;
			}
		}
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<string>
#include<sstream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cctype>
#include<climits>
using namespace std;
#define REP(i, j) for(int i = 0; i < j; i++)
#define FOR(i, j, k) for(int i = j; i < k; i++)
#define P pair<int, int>
const int INF = INT_MAX / 2;
const int N = 10;

int main(){
    int n;
    while(cin >>n && n){
        int ans = 0;
        while(n >= 5){
            n /= 5;
            ans += n;
        }
        cout <<ans <<endl;
    }
    return 0;
}

Measured memory_bytes: 1160
//#include <tourist>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <iomanip>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <tuple>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
//setprecision(15)有効数字15桁
//-std=c++14
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}
struct edge {
    int to, cost;
};
int n, b, c;
vector<p> a;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        ll temp, temp1;
        cin >> temp>>temp1;
        a.push_back(make_pair(temp1+temp,-temp1+temp));
    }
    sort(ALL(a));
    ll ans=1;
    ll maxa=a[0].first;
    for(int i=1;i<n;i++){
        if(maxa<=a[i].second){
            ans++;
            maxa=a[i].first;
        }
    }
    
    cout << ans << "\n";
}



Measured memory_bytes: 2420
#include <bits/stdc++.h>
#define inp(X) cin >> X
#define out(X) cout << X << endl
#define out16(X) cout << setprecision(16) << X << endl
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define MAX(A) *max_element(A.begin(),A.end())
#define MIN(A) *min_element(A.begin(),A.end())
#define SORT(A) sort(A.begin(),A.end())
#define REV(A) reverse(A.begin(),A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vd = std::vector<double>;
using vvd = std::vector<std::vector<double>>;
using vll = std::vector<ll>;
using vvll = std::vector<std::vector<ll>>;
using P = std::pair<int,int>;
#define fi first
#define se second
using namespace std;
#define MOD 1000000007
#define INF 1000000001
#define LL_INF 1001001001001001001

int main(void) {
	int n; cin >> n;
	vector<P> p(n);
	rep(i,n){
		int a; cin >> a;
		p[i].fi = a;
		p[i].se = i+1;
	}
	SORT(p);
	rep(i,n) cout << p[i].se << " ";
	cout << endl;
}




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

const int mod = 2019;

int main() {
  string s;
  cin >> s;
  vector<ll> d(s.size() + 1);
  int ten = 1;
  for (int i = s.size()-1; i >= 0; --i) {
    int a = (s[i]-'0') * ten % mod;
    d[i] = (d[i+1]+a) % mod;
    ten *= 10; ten %= mod;
  }
  vector<ll> cnt(2019);
  ll ans = 0;
  for (int i = s.size(); i >= 0; --i) {
    ans += cnt[d[i]];
    cnt[d[i]]++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 5168
#include<stdio.h>
int main(){
  int i,a,b;
  int p[5]={0,6,4,3,2};
  for(i=0;i<4;i++){
    scanf("%d %d",&a,&b);
    printf("%d\n",p[a]*b*1000);
  }
  return 0;
}

Measured memory_bytes: 600
N, K = map(int, input().split())
D = list(map(int, input().split()))

dp = [True]*10
for e in D:
	dp[e] = False

def calc(s):
	res = True
	for c in s:
		if not dp[int(c)]:
			res = False
			break
	return res

while True:
	if calc(str(N)):
		break
	else:
		N += 1

print(N)

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


#define MAX_N 100000

typedef pair<i64, i64> P;

i64 N;
vector<P> G[MAX_N + 1];
i64 color[MAX_N + 1];
bool visited[MAX_N + 1];

void dfs() {
    REPS(i, N) color[i] = 1;
    REPS(i, N) visited[i] = false;

    i64 root = 1;
    stack<P> S;
    S.push(mp(root, 0));
    color[root] = 0;
    P p;
    vector<P> edge;
    while(!S.empty()) {
        p = S.top(); S.pop();
        visited[p.F] = true;
        if (p.S % 2 == 0)  {
          color[p.F] = 0;
        }
        edge = G[p.F];
        if (SIZE(edge) == 0) continue;
        for (auto it = edge.begin(); it != edge.end(); it++) {
            if (visited[(*it).F]) continue;
            S.push(mp((*it).F, p.S + (*it).S));
        }
    }
}

int main() {
    cin >> N;
    i64 n1, n2, w;
    REP(i, N - 1) {
      cin >> n1 >> n2 >> w;
      G[n1].pb(mp(n2, w));
      G[n2].pb(mp(n1, w));
    }

    dfs();

    REPS(i, N) {
      cout << color[i] << endl;
    }

    return 0;
}

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

using namespace std;
using ll = long long;

//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

const int INF = 1e9;

int main(void){

	
	string S; cin >> S;
	ll K; cin >> K;

	ll idx = 0;
	REP(i,S.length()){
		if(S[i] == '1') idx++;
		else break;
	}

	if(K <= idx) cout << '1' << endl;
	else cout << S[idx] << endl;

	return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;

void solve(vector<string> c) { cout << c[0][0] << c[1][1] << c[2][2] << endl; }

int main() {
  vector<string> c(3);
  for (int i = 0; i < 3; i++) {
    cin >> c[i];
  }
  solve(move(c));
  return 0;
}


Measured memory_bytes: 256
function main(input) {
  input = input.split("\n");

  var min = Number.MAX_VALUE, val = -Number.MAX_VALUE;
  var N = parseInt(input[0]);
  for (var i = 1; i <= N-1; i++) {
    if (min >= parseInt(input[i])) {
      min = parseInt(input[i]);
    }
    if (parseInt(input[i+1]) - min >= val) {
      val = parseInt(input[i+1]) - min;
    }
  }
  console.log(val);
  return val;
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));

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


int main()
{
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll s1 = a, s2 = c, i=0;
    while(s1>0 && s2>0)
    {
        if(i % 2 == 0)
            s2 -= b;
        else
            s1 -= d;
        i++;
    }
    if(s1 <= 0)
        cout<<"No";
    else
        cout<<"Yes";
    return 0;
    
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define endl '\n'
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pf pop_front
#define yes cout << "YES" << '\n';
#define no cout << "NO" << '\n';
#define watch(x) cout << (#x) << " is " << (x) << endl
using namespace std;

int const MAXS = 1e5 + 5;

void solve(){
    ll n;
    double d;
    cin >> n >> d;
    ll ans = 0;
    while(n--){
        ll a,b;
        cin >> a >> b;
        if((pow(a,2)+pow(b,2)) <= d*d)
            ans++;
        // cout << (pow(a,2)+pow(b,2)) << " AND " << d*d << endl;
    }
    cout << ans << endl;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}

Measured memory_bytes: 3720
#include <stdio.h>
#include <cstdlib>

int main(void) {
  long int line;
  int num;
  int ans = 0;
  scanf("%ld", &line);
  num = line % 1000;
  ans = abs(num - 753);
  line /= 1000;
  while(line > 0) {
    num /= 10;
    num += 100 * (line % 10);
    if (abs(num - 753) < ans) {
      ans = abs(num - 753);
    }
    line /= 10;
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main(){
	int N,a[105],flag=1;
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>a[i];
		if(a[i]%2==0){
			if(a[i]%3!=0&&a[i]%5!=0){
				flag=0;
			}
		}
	}
	if(flag)
		cout<<"APPROVED";
	else
		cout<<"DENIED";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int N,M;
  cin>>N>>M;
  int ac=0,wa=0;
  int a[N];
  REP(i,N)a[i]=0;
  bool b[N];
  REP(i,N)b[i]=true;
  REP(i,M){
    int p;
    string S;
    cin>>p>>S;
    p--;
    if(b[p]){
      if(S=="AC"){
        ac++;
        wa+=a[p];
        b[p]=false;
      }else {
        a[p]++;
      }
    }
  }
  cout<<ac<<" "<<wa<<endl;
  return 0;
}


Measured memory_bytes: 768
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		
		String s = sc.next();
        if(s.length()<=a){System.out.println(s);}
        else{System.out.println(s.substring(0,a)+"...");}
		
	}
}


Measured memory_bytes: 38576
Id = Struct.new(:building, :floor, :room_number)

Room = Struct.new(:id, :people_count)

Rooms = Struct.new(:rooms) do
  def self.initial
    all = 4.times.flat_map{|building|
      3.times.flat_map{|floor|
        10.times.flat_map{|room_number|
          Room.new(Id.new(building+1, floor+1, room_number+1), 0)
        }
      }
    }.map {|r|
      [r.id, r]
    }.to_h

    new(all)
  end

  def [](id)
    rooms[id]
  end

  def values
    rooms.values
  end
end

rooms = Rooms.initial

gets.to_i.times{
  b, f, r, v = gets.split.map(&:to_i)

  id = Id.new(b, f, r)
  room = rooms[id]

  room.people_count += v
}

puts rooms.values.group_by{|r| r.id.building }.map{|_, rooms|
  rooms.group_by{|r| r.id.floor }.map{|_, rooms|
    ' ' + rooms.map(&:people_count)*' '
  }.join("\n")
}.join("\n#{?# * 20}\n")



Measured memory_bytes: 6924
H, W = [int(x) for x in input().split()]

S = []
S.append('.'*105)
for h in range(H):
    r = input()
    S.append('-' + r)

A = [[float("INF")] * 105 for _ in range(105)]
A[1][1] = (1 if S[1][1] == '#' else 0)


for h in range(1,H+1):
    for w in range(1,W+1):
        a = A[h][w]
        if S[h][w] == '#':
            if S[h][w-1] == '#':
                a = min(a, A[h][w-1])
            else:
                a = min(a, A[h][w-1] + 1)
            if S[h-1][w] == '#':
                a = min(a, A[h-1][w])
            else:
                a = min(a, A[h-1][w] + 1)
            A[h][w] = a
        else:
            A[h][w] = min(A[h][w-1], A[h-1][w], A[h][w])
            
print(A[H][W])


Measured memory_bytes: 3188
#include<iostream>
#include<vector>
#include<math.h>
#include<string>
#include<stdio.h>

#define PI 3.141592

using namespace std;

int main(){
	string stepsandrad;
	double steps, dir,rad=0.0;
	double y=0.0,x=0.0;

	while (true){

		cin >> stepsandrad;

		sscanf(stepsandrad.c_str(), "%lf,%lf", &steps, &dir);

		if (steps == 0 && dir == 0)
			break;

		y += steps*cos(rad);
		x += steps*sin(rad);

		rad += dir * PI / 180.0;

	}

	cout << (int)x << endl << (int)y << endl;

	return 0;
}

Measured memory_bytes: 1272
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod2;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}
 
const int maxn=200005;
//i_am_noob
int a,b;

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> a >> b;
	print1((a+b-1)/b);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <map>
using namespace std;
typedef long long LL;
const int maxN = 1e5 + 7;
const LL ONE = 1;
int N;
int P[maxN];     // P数组为1~N的一组排列 
int pos[maxN];     // pos[i]为i在P数组中的位置 
int leftFirstMaxPos[maxN];     // leftFirstMaxPos[i]为i位置的数左边第一个比i大的数的位置,没有则为0
int rightFirstMaxPos[maxN]; // rightFirstMaxPos[i]为i位置的数右边第一个比i大的数的位置,没有则为N+1 
LL ans = 0; 

int main(){
    //freopen("MyOutput.txt","w",stdout);
    //freopen("input.txt","r",stdin);
    //INIT();
    scanf("%d", &N);
//    For(i, 1, N) {
	for(int i=1;i<=N;i++){
        scanf("%d", &P[i]);
        pos[P[i]] = i; 
        // 后面是从1开始枚举,而1是最小的,所以1的左右最近大正好是相邻的两个数 
        leftFirstMaxPos[i] = i - 1;
        rightFirstMaxPos[i] = i + 1;
    }
    
    // 计算每个数i为第二大的时候对答案的贡献 
	for(int i=1;i<=N;i++){
        int Lpos1 = leftFirstMaxPos[pos[i]];     // i左边第一个比他大的数的位置 
        int Lpos2 = leftFirstMaxPos[Lpos1];        // i左边第二个比他大的数的位置 
        int Rpos1 = rightFirstMaxPos[pos[i]];    // i右边第一个比他大的数的位置 
        int Rpos2 = rightFirstMaxPos[Rpos1];        // i右边第二个比他大的数的位置 
        
        if(Lpos1 != 0) ans += ONE * i * (Lpos1 - Lpos2) * (Rpos1 - pos[i]);
        if(Rpos1 != N + 1) ans += ONE * i * (pos[i] - Lpos1) * (Rpos2 - Rpos1);
        
        // 更新 
        /*
            例如这个片段:
                  1 2 3 4 5 6 7 
                P 6 3 1 2 5 4 7
                此时以i = 1为例
                本来leftFirstMaxPos[4] = 3, rightFirstMaxPos[2] = 3的
                计算完i = 1的贡献之后, leftFirstMaxPos[4] = 2, rightFirstMaxPos[2] = 4
                这一步更新相当于把1给砍掉了,剩下的数中2又是最小的数,于是2的左右最近大又正好是相邻的两个数 
                没错,非常像链表删除一个值的操作 
                leftFirstMaxPos就相当于静态链表的前驱数组
                rightFirstMaxPos就相当于静态链表的后继数组 
        */ 
        leftFirstMaxPos[Rpos1] = Lpos1;
        rightFirstMaxPos[Lpos1] = Rpos1;
    }
    
    printf("%lld", ans);
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;

int main()
{
	int A, B;
	string S;
	bool ans = true;

	cin >> A >> B >> S;

	for (int i = 0; i < A; i++)
	{
		if (S[i] == '-')
		{
			ans = false;
			break;
		}
	}

	if (S[A] != '-')
		ans = false;

	for (int i = 1; i <= B; i++)
	{
		if (S[i + A] == '-')
		{
			ans = false;
			break;
		}
	}

	if (ans)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 256
#include <math.h>
#include <time.h>
#include <ctype.h>
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include<iomanip>

#define mod 1000000007
#define ll long long int
#define pb(x) push_back(x)
#define MP(x,y) make_pair(x,y)

using namespace std;

ll power(ll a, ll b, ll m)
{
	if (b == 0)
		return(1);
	ll sol = power(a, b / 2, m);
	sol = (sol * sol) % m;
	if (b % 2 == 1)
		sol = (sol * a) % m;
	return(sol);
}
ll gcd(ll a, ll b)
{
	if (b == 0)
		return a;
	else
	{
		return gcd(b, a % b);
	}
}
ll a[100005],sol[100005];
void solve()
{
	int n;
	ll sum = 0;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		sum = sum + a[i];
		if (i % 2 == 0)
		{
			sol[0] += a[i];
		}
		else
			sol[0] = sol[0] - a[i];
	}
	ll sum1 = sol[0];
	for (int i = 1; i < n - 1; i++)
	{
		sol[i] = 2 * a[i - 1] - sol[i - 1];
		sum1 = sum1 + sol[i];
	}
	sol[n - 1] = sum - sum1;
	for (int i = 0; i < n; i++)
	{
		cout << sol[i] << " ";
	}

}
int main()
{
	int t = 1;
	//cin>>t;
	while (t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 2944
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from heapq import heapify, heappop, heappush 
def main():
    N, K = map(int, readline().split())
    V = [int(i) for i in readline().split()]
    A = V[::-1]
    ans = 0
    for l in range(K+1):
        for r in range(K+1-l):
            if l+r>N:
                continue
            rest = K-(l+r)
            hp = V[:l] + A[:r]
            heapify(hp)
            for _ in range(rest):
                if len(hp)==0:
                    break
                v = heappop(hp)
                if v > 0:
                    heappush(hp, v)
            ans = max(ans, sum(hp))
    print(ans)
if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
int main()
{
	double n,total=0;
	cin>>n;
	for(int i=1;i<=n;i++){
		if(i%2==1){
			total++;
		}
	}
	cout<<fixed<<setprecision(10)<<total/n<<endl;
	return 0;
}

Measured memory_bytes: 256
import sys
from collections import defaultdict

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

class UnionFind:
    def __init__(self, n):
        self.state = [-1] * n
        self.size_table = [1] * n
        # cntはグループ数
        self.cnt = n

    def root(self, u):
        v = self.state[u]
        if v < 0: return u
        self.state[u] = res = self.root(v)
        return res

    def merge(self, u, v):
        ru = self.root(u)
        rv = self.root(v)
        if ru == rv: return
        du = self.state[ru]
        dv = self.state[rv]
        if du > dv: ru, rv = rv, ru
        if du == dv: self.state[ru] -= 1
        self.state[rv] = ru
        self.cnt -= 1
        self.size_table[ru] += self.size_table[rv]
        return

    # グループの要素数
    def size(self, u):
        return self.size_table[self.root(u)]

def main():
    n, m, k = MI()
    uf = UnionFind(n)
    ans = [-1] * n
    for _ in range(m):
        a, b = MI1()
        uf.merge(a, b)
        ans[a]-=1
        ans[b] -= 1
    for i in range(n):ans[i]+=uf.size(i)
    for _ in range(k):
        a, b = MI1()
        if uf.root(a)==uf.root(b):
            ans[a]-=1
            ans[b]-=1
    print(*ans)

main()


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

int main() {
    long long int A,B,C,K;
    long long int new_A, new_B, new_C, new_K;
    long long int a, b, c, d, e, f, g, h, i, j, k, l, m, n, s, w;

    cin >> s;
    cin >> w;

    if (s > w) {
        cout << "safe\n";
    } else {
        cout << "unsafe\n";
    }
    // long long int tmp, cnt = 0;
    // tmp = b;
    // for (;;) {
    //     tmp = tmp/10;
    //     cnt ++;
    //     if (tmp > 0) {
    //     }
    //     else {
    //         break;
    //     }
    // } 
    // long long int time = 1;
    // for (int i = 0; i < cnt; i++) {
    //     time *= 10;
    // }
    // b += a*time;
    // // cout << b<< endl;
    // bool flag = false;
    // for (long long int i = 0; i < sqrt(b)+1; i++) {
    //     if (i*i == b) {
    //         flag = true;
    //     }
    // }
    // if (flag) {
    //     cout << "Yes" << endl;
    // }
    // else {
    //     cout << "No" << endl;
    // }

    return 0;
}

Measured memory_bytes: 3640
// ProblemURL : https://atcoder.jp/contests/sumitrust2019/tasks/sumitrust2019_d
// ---------------------------------------------
package main

import (
	"fmt"
	"strconv"
)

func intToStr(i int) string { return strconv.Itoa(i) }

func main() {
	var n int
	var s string
	fmt.Scan(&n, &s)

	check := func(x int) bool {
		t := intToStr(x)
		t = fmt.Sprintf("%0*s", 3, t)
		idx := 0
		for i := range s {
			if s[i] == t[idx] {
				idx++
				if idx == 3 {
					return true
				}
			}
		}
		return false
	}

	ct := 0
	for i := 000; i <= 999; i++ {
		if check(i) {
			ct++
		}
	}
	fmt.Println(ct)
}


Measured memory_bytes: 896
N = int(input())
xs = []
ys = []
for _ in range(N):
    x,y = map(int,input().split())
    xs.append(x)
    ys.append(y)
fxys = [[], []]
for i in range(N):
    x = xs[i]
    y = ys[i]
    fxys[0].append(x-y)
    fxys[1].append(x+y)
ls = []
for d in [0, 1]:
    mx = max(fxys[d])
    mi = min(fxys[d])
    ls.append(mx-mi)
print(max(ls))

Measured memory_bytes: 40724
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,m,c,d,cnt = 0;
    int a[205];
    scanf("%d%d%d",&n,&m,&c);
    for(int i=0;i<m;i++){
        scanf("%d",&a[i]);
    }
    for(int i=0;i<n;i++){
        int ans = 0;
        for(int j=0;j<m;j++){
            scanf("%d",&d);
            ans += a[j] * d;
        }
        if((ans + c) > 0)
            cnt++;
    }
    printf("%d\n",cnt);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  int A, B;
  cin >> A >> B;
  if(A<10&&B<10)
  {
    cout << A*B << endl;
  }
  else
  {
    cout << -1 << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF ((long long)1e18)
#define MOD ((int)1e9+7)
#define endl "\n"

#define yn(f) ((f)?"Yes":"No")
#define YN(f) ((f)?"YES":"NO")

#define MAX 200

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int N, M, C;
	int count = 0;
	int B[MAX], A[MAX];
	int a;
	
	cin>>N>>M>>C;
	
	for(int i = 0; i < M; i++){
		cin>>B[i];
	}
	
	for(int i = 0; i < N; i++){
		int temp = C;
		for(int j = 0; j < M; j++){
			cin>>a;
			temp += B[j]*a;
		}
		if(temp > 0) count++;
	}
	
	
	cout<<count<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(void){
    char s[110];
    int i,len;
    scanf("%s", s);
    
    for(i = 0; i < strlen(s); i++){
        s[i] = 'x';
    }
    
    printf("%s", s);
    return 0;
}

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

int main(){
    int N;
    cin >> N;
    map<string, int> blue_card;
    for (int i = 0; i < N; i++){
        string s;
        cin >> s;
        if (blue_card.count(s)){
            blue_card.at(s)++;
        }
        else{
            blue_card[s] = 1;
        }
    }
    int M;
    cin >> M;
    map<string, int> red_card;
    for (int i = 0; i < M; i++){
        string t;
        cin >> t;
        if (red_card.count(t)){
            red_card.at(t)++;
        }
        else{
            red_card[t] = 1;
        }
    }
    int max_get_money = 0;
    for (pair<string, int> p: blue_card){
        string s = p.first;
        int i = p.second;
        int get_money = i;
        if (red_card.count(s)){
            get_money = i - red_card.at(s);
        }
        max_get_money = max(max_get_money, get_money);
    }
    cout << max_get_money << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl "\n" 
using namespace std;
#define debug(x) cout<<"The value of "<<#x<<" is "<<x<<endl;
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    cin.sync_with_stdio(0); cin.tie(0); 
    int n,l;
    cin>>n>>l;
    vector<string>vec(n);
    for(auto& i:vec)
    cin>>i;
    sort(vec.begin(),vec.end());
    for(auto i:vec)
    cout<<i;
    cout<<endl;
}


Measured memory_bytes: 3644
#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <vector>
#include <cstdio>
#include <bitset>
#include <cstring>
#include <iostream>
#include <algorithm>
#define maxn 100010
// #define int long long
using namespace std;
void write(int x){if(x<0){putchar('-');x=-x;}if(x>9) write(x/10);putchar(x%10+'0');}
int read(){int d=0,w=1;char c=getchar();for(;c<'0'||c>'9';c=getchar())if(c=='-')
w=-1;for(;c>='0'&&c<='9';c=getchar())d=(d<<1)+(d<<3)+c-48;return d*w;}
void wln(int x){write(x);putchar('\n');}
void wrs(int x){write(x);putchar(' ');}
set<int> st[maxn];
map<pair<int,int>,int> mp;
queue<pair<int,int>> q;
int n,f[maxn],ans;
int find(int x)
{
	return x==f[x]?x:f[x]=find(f[x]);
}
signed main()
{
	// freopen(".in","r",stdin);
	// freopen(".out","w",stdout);
	n=read();
	for(int i=1;i<(n<<1)-1;i++)
	{
		int x=read(),y=read();
		st[x].insert(y);
		st[y].insert(x);
		mp[make_pair(x,y)]++;
		mp[make_pair(y,x)]++;
		if(mp[make_pair(x,y)]==2) q.push(make_pair(x,y));
	}
	for(int i=1;i<=n;i++)
		f[i]=i;
	for(;!q.empty();)
	{
		pair<int,int> tmp=q.front();
		q.pop();
		int x=find(tmp.first),y=find(tmp.second);
		st[x].erase(y);
		st[y].erase(x);
		if(st[x].size()<st[y].size()) swap(x,y);
		for(auto v:st[y])
		{
			st[x].insert(v);
			st[v].insert(x);
			st[v].erase(y);
			mp[make_pair(v,y)]=mp[make_pair(y,v)]=0;
			mp[make_pair(x,v)]++;
			mp[make_pair(v,x)]++;
			if(mp[make_pair(x,v)]==2) q.push(make_pair(x,v));
		}
		f[y]=x;
		st[y].clear();
	}
	for(int i=1;i<=n;i++)
		ans+=f[i]==i;
	puts(ans>1?"NO":"YES");
	return 0;
}


Measured memory_bytes: 57216