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

using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define SORT(v) sort(ALL(v))
//#define scanf scanf_s
typedef pair<int, int> P;

char sym[] = { ' ','.', ',', '!','?' };
char alp[] = { '*', '*', 'a', 'd', 'g', 'j', 'm', 'p', 't' };

int main()
{
	int n;
	cin >> n;
	REP(k, n)
	{
		vector<char> v;
		string s;
		cin >> s;
		int cnt = 0;
		char buf = '0';
		REP(i, s.size())
		{
			if (s[i] == '0')
			{
				if (buf == '0') continue;
				else if (buf == '1') v.push_back(sym[cnt % 5]);
				else if (buf == '7')
				{
					if (cnt % 4 == 0) v.push_back('s');
					else v.push_back('p' + cnt % 4 - 1);
				}
				else if (buf == '9')
				{
					if (cnt % 4 == 0) v.push_back('z');
					else v.push_back('w' + cnt % 4 - 1);
				}
				else
				{
					if (cnt % 3 == 0) v.push_back(alp[buf - '0'] + 2);
					else v.push_back(alp[buf - '0'] + cnt % 3 - 1);
				}
				cnt = 0;
				buf = '0';
			}
			else
			{
				buf = s[i];
				cnt++;
			}
		}
		REP(i, v.size()) cout << v[i];
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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; }

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    int x,y,z; cin>>x>>y>>z;
    swap(x,y); swap(x,z);
    cout << x << ' ' << y << ' ' << z << '\n';
    return 0;
}

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

#define NDEBUG
#ifdef DEBUG
#include "../cout11.h"
#undef NDEBUG
#endif
#include <cassert>

#ifdef DEBUG
#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
#define debug(...)
#endif

typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define eb  emplace_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair

#define PQ(T) priority_queue<T>
#define RPQ(T) priority_queue<T,vector<T>,greater<T>>

template<class T> inline void amin(T & a, T const & b) { a = min(a, b); }
template<class T> inline void amax(T & a, T const & b) { a = max(a, b); }

inline ll square(ll x) { return x * x; }
// ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }
inline ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }
template <typename T>
inline T mod(T a, T b) { return ((a % b) + b) % b; }



bool issq(vi& a, vi& b){
    int d=a.size();
    ll s=0;
    rep(i,d){
        s += square(a[i] - b[i]);
    }
    ll sq = sqrt(s);
    return (sq * sq == s);
}


int solve(int N,int D,vvi& x) {
    int cnt = 0;
    repC2(i,j,N){
        if (issq(x[i], x[j])) ++cnt;
    }
    return cnt;
}

int main() {
    int n,d; cin>>n>>d;
    vvi x(n, vi(d));
    rep(i,n){
        rep(j,d) cin >> x[i][j];
    }
    cout << solve(n,d,x) << endl;
    return 0;
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func gcd(a, b int) int {
	var rem int
	if a < b {
		a, b = b, a
	}
	for {
		rem = a % b
		if rem == 0 {
			break
		}
		a = b
		b = rem
	}
	return b
}

func main() {
	sc.Split(bufio.ScanWords)
	k := nextInt()
	sum, temp := 0, 0
	for l := 1; l <= k; l++ {
		for m := 1; m <= k; m++ {
			temp = gcd(l, m)
			for n := 1; n <= k; n++ {
				sum += gcd(temp, n)
			}
		}
	}
	fmt.Println(sum)
}


Measured memory_bytes: 1776
#include<bits/stdc++.h>
using namespace std;
long long n;
long long k;
long long a[2000006];
long long b[2000006];
long long count1 = 0;
int main()
{
	cin >> n;
    for(int i=0;i <= n; i++)
    {
        cin >> a[i];
    }
    for(int i = 0; i < n;i++)
    {
        cin >> b[i];
    }
    for(int i = 0; i < n;i++)
    {
        if(a[i] >= b[i]) {
            count1 += b[i];
        } else {
            count1 += a[i];
            b[i] -= a[i];
            if(a[i+1] >= b[i]) {
                a[i+1] -= b[i];
                count1 += b[i];
            } else {
                count1 += a[i+1];
                a[i+1] = 0;
            }
        }
    }
    cout << count1;
}


Measured memory_bytes: 5120
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
  /* your code */
}

void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
  t->prev->next = t->next;
  t->next->prev = t->prev;
  free(t);
}

void deleteFirst(){
  NodePointer t = nil->next;//ここ逆？
  if ( t == nil ) return;
  deleteNode(t);
  return;
}

void deleteLast(){
  NodePointer t = nil->prev;//ここ逆？
  if( t == nil ) return;
  deleteNode(t);
}

void delete(int key){
  NodePointer t = nil->next;
  while(1){
    if(t == nil) break;
    if(t->key == key){
      deleteNode(t);
      break;
    }
    t = t->next;
  }
}


void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;

  x->next = nil->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;

}

int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) {
      insert(key);
      np++;
      size++;
    }
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
	if ( com[6] == 'F' ) deleteFirst();
	else if ( com[6] == 'L' ) deleteLast();
      } else {
	delete(key); nd++; 
      }
      size--;
    }
  }
  
  printList();
  return 0;
}



Measured memory_bytes: 32944
#include <bits/stdc++.h>
using namespace std;
struct T{
	int x,y;
};
int main(){
	int a,b;
	cin>>a>>b;
	char ar[a][b];
	int arr[a][b];
	long long cnt=0;
	for(int i=0;i<a;i++){
		for(int j=0;j<b;j++){
			cin>>ar[i][j];
			arr[i][j]=INT_MAX;
			if(ar[i][j]=='#'){
				cnt++;
			}
		}
	}
	queue<T>q;
	q.push({0,0});
	arr[0][0]=1;
	while(q.size()){
		auto it=q.front();
		q.pop();
		if(it.y+1<b&&ar[it.x][it.y+1]!='#'){
			if(arr[it.x][it.y+1]>arr[it.x][it.y]+1){
				arr[it.x][it.y+1]=arr[it.x][it.y]+1;
				q.push({it.x,it.y+1});
			}
		}
		if(it.y-1>=0&&ar[it.x][it.y-1]!='#'){
			if(arr[it.x][it.y-1]>arr[it.x][it.y]+1){
				arr[it.x][it.y-1]=arr[it.x][it.y]+1;
				q.push({it.x,it.y-1});
			}
		}
		if(it.x+1<a&&ar[it.x+1][it.y]!='#'){
			if(arr[it.x+1][it.y]>arr[it.x][it.y]+1){
				arr[it.x+1][it.y]=arr[it.x][it.y]+1;
				q.push({it.x+1,it.y});
			}
		}
		if(it.x-1>=0&&ar[it.x-1][it.y]!='#'){
			if(arr[it.x-1][it.y]>arr[it.x][it.y]+1){
				arr[it.x-1][it.y]=arr[it.x][it.y]+1;
				q.push({it.x-1,it.y});
			}
		}
	}
	if(arr[a-1][b-1]==INT_MAX){
		cout<<-1<<endl;
	}
	else{
		cout<<abs(arr[a-1][b-1]+cnt-(a*b));
	}
}	

Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define P pair<int, int>
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define Int long long int
const int N = 1001;
const int N4 = 4001;

int main() {
  int n;
  while(cin >>n){
    int fir[N4];
    memset(fir, 0, sizeof(fir));
    REP(i, N) REP(j, N) ++fir[i + j];

    int ans = 0;
    REP(i, N){
      REP(j, N){
        int cd_sum = i + j;
        if(n - cd_sum >= 0) ans += fir[n - cd_sum];
      }
    }
    cout <<ans <<endl;
  }
  return 0;
}

Measured memory_bytes: 1184
n, k, q = map(int, input().split())
a = []
sc = [ k for _ in range(n) ]

for _ in range(q):
    a_ = int(input())
    a.append(a_)

for i in range(q):
    sc[ a[i]-1 ] = sc[ a[i]-1 ] + 1

for i in range(n):
    print("Yes") if sc[i]>q else print("No")

Measured memory_bytes: 10500
fn main() {
    proconio::input! {
        d: usize,
        cs: [i64; 26],
        sss: [[i64; 26]; d],
    }
    let mut lastd = vec![vec![]; 26];
    fn lastdi(d: usize, i: usize, lastd: &Vec<Vec<usize>>) -> usize {
        let v = &lastd[i];
        *v.iter().filter(|x| **x <= d).last().or(Some(&0)).unwrap()
    }
    let mut score = 0i64;
    for d in 1..=d {
        let (max, t) = (0..26)
            .map(|t| {
                let mut score = score;
                score += sss[d - 1][t];
                lastd[t].push(d);
                let decline = (0..26)
                    .map(|j| cs[j] * (d as i64 - lastdi(d, j, &lastd) as i64))
                    .sum::<i64>();
                score -= decline;
                lastd[t].pop();
                (score, t)
            })
            .max()
            .unwrap();
        score = max;
        lastd[t].push(d);
        println!("{}", t + 1);
    }
}


Measured memory_bytes: 2344
#include<bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f
#define ll long long
const int N=200005;
const int mod=1e9+7;
const double eps=1e-8;
const double PI = acos(-1.0);
#define lowbit(x) (x&(-x))
ll gcd(ll a,ll b)
{
    return b==0?a:gcd(b,a%b);
}
ll qpow(ll a,ll b)
{
    ll res=1;
    while(b)
    {
        if(b&1) res=res*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return res;
}
ll inv(ll a,ll p)
{
    return qpow(a,p-2);
}
int main()
{
    std::ios::sync_with_stdio(false);
    string s[3];
    cin>>s[0]>>s[1]>>s[2];
    int i=0;
    while(1)
    {
   //     cout<<i<<" "<<s[i]<<endl;
        int l=s[i].length();
        if(l<=0)
        {
            if(i==0)
                cout<<"A"<<endl;
            else if(i==1)
                cout<<"B"<<endl;
            else
                cout<<"C"<<endl;
            break;
        }
        l--;
        int tmp=i;
        if(s[i][0]=='a')
            i=0;
        else if(s[i][0]=='b')
            i=1;
        else
            i=2;
        s[tmp].erase(s[tmp].begin());
    }

    return 0;
}

Measured memory_bytes: 256
A,B,C=map(int,input().split())
if (A==B)and(B==C)and(A%2==0):
    print("-1")
else:
    count=0
    while True:
        if (A%2==0)and(B%2==0)and(C%2==0):
            a=(B+C)/2
            b=(A+C)/2
            c=(A+B)/2
            A=a
            B=b
            C=c
            count=count+1
        else:
            break
    print(count)

Measured memory_bytes: 38384
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**6
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    SI = lambda : sys.stdin.readline().rstrip()

    N,u,v = LI()
    root = [[] for _ in range(N)]
    for _ in range(N-1):
        a,b = LI()
        root[a-1].append(b-1)
        root[b-1].append(a-1)
    T = [INF for _ in range(N)]
    A = [INF for _ in range(N)]

    def calc_d(m,x):
        q = collections.deque()
        q.append((x,0))
        while q:
            a,d = q.popleft()
            m[a] = d
            for b in root[a]:
                if m[b] > d+1:
                    q.append((b,d+1))

    calc_d(T,u-1)
    calc_d(A,v-1)
    ans = 0
    for i in range(N):
        if T[i] < A[i]:
            ans = max(ans,A[i] - 1)
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 61340
from math import sqrt
from itertools import permutations

N = int(input())
xy = [tuple(map(int, input().split())) for _ in range(N)]


def get_dist(ax,ay, bx, by):
    return sqrt((ax-bx)**2 + (ay-by)**2)

dist_matrix = [[0]*N for _ in range(N)]
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        dist_matrix[i][j] = get_dist(xy[i][0], xy[i][1], xy[j][0], xy[j][1])

perm = permutations(list(range(N)), N)
n = 0
paths = []
for v in perm:
    n += 1
    one_path = []
    for k in range(len(v)-1):
        one_path.append([v[k], v[k+1]])
    paths.append(one_path)

d_sum = 0
for p in paths:
    for q in p:
        d_sum += dist_matrix[q[0]][q[1]]

print(d_sum/n)

Measured memory_bytes: 35828
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    string s;
    cin >> s;
    cout << s[0] << s.length()-2 << s[s.length()-1]<<endl;
    return 0;
}

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

int main()
{
	int N;cin>>N;
	for(int i=0;i<N; i++)
	{
		double xa,ya,ra,xb,yb,rb;
		cin>>xa>>ya>>ra>>xb>>yb>>rb;
		double d=sqrt(pow(xa-xb,2)+pow(ya-yb,2));
		if ( d+rb<ra )
			cout<<2<<endl;
		else if ( d+ra<rb)
			cout<<-2<<endl;
		else if ( d<=ra+rb)
			cout<<1<<endl;
		else
			cout<<0<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;

int main() {
  int64_t n, y;
  cin >> n >> y;

  for (int64_t i10000 = 0; i10000 * 10000 <= y && i10000 <= n; ++i10000) {
    for (int64_t i5000 = 0;
         (i10000 * 10000 + i5000 * 5000) <= y && i10000 + i5000 <= n; ++i5000) {
      int64_t i1000 = n - i10000 - i5000;
      if (i10000 * 10000 + i5000 * 5000 + i1000 * 1000 == y) {
        cout << i10000 << " " << i5000 << " " << i1000 << endl;
        return 0;
      }
    }
  }

  cout << "-1 -1 -1" << endl;
}


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

using namespace std;

int main() {
  int n;
  int count = 0;
  string s;
  cin >> n;
  cin >> s;
    for (int i = 0; i < s.size() - 2; ++i) {
        if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C'){
            count++;
        }
    }
    cout << count << endl;
}


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

int main() {
	string s;
	cin >> s;
	vector<int>a(3,0);
	for (int i = 0; i < s.length(); i++) {
		if (s.at(i) == 'a')a.at(0)++;
		else if (s.at(i) == 'b')a.at(1)++;
		else a.at(2)++;
	}
	bool ans = false;
	sort(a.begin(), a.end());
	a.at(2) -= a.at(0);
	a.at(1) -= a.at(0);
	a.at(0) = 0;
	ans = (max(a.at(2), a.at(1)) <= 1);
	if (ans)cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 512
/**********************************************************************
File    .cpp
Author  Takahiro Yamazaki
**********************************************************************/
/**********************************************************************
Include Libraries
**********************************************************************/
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for (int i = a; i < b; i++)
/**********************************************************************
Declare variables
**********************************************************************/
/**********************************************************************
Declare instance
**********************************************************************/
/**********************************************************************
Proto_type_Declare functions
**********************************************************************/

/**********************************************************************
Main
**********************************************************************/
int main() {
  int a,b,c,d;
  cin >> a>> b >> c>> d;

  for (;;) {
    c -= b;
    if (c <= 0){
      printf("Yes\n");
      break;
    }
    a -= d;
    if (a <= 0){
      printf("No\n");
      break;
    }
    // printf("a=%d,c=%d\n",a,c);
  }
}
/**********************************************************************
Functions
**********************************************************************/


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

long long v[100000];
 
int main() {
	
	long long n,k;
	
	cin >> n >> k;
	
	for(int i = 0;i < n;i++){
		
		long long a,b;
		
		cin >> a >> b;
		
		v[a - 1] += b;
		
	}
	
	for(int i = 0;i < 100000;i++){
		
		if(v[i] >= k){
			cout << i + 1 << endl;
			return 0;
		}
		
		k -= v[i];
		
	}
	
	return 0;
}

Measured memory_bytes: 1024
package main

import "fmt"

func gcd(x, y int64) int64 {
	if y == 0 {
		return x
	} else {
		return gcd(y, x%y)
	}
}

func prime_factor(n int64) map[int64]int {
	ret := map[int64]int{}

	for i := int64(2); i*i <= n; i++ {
		for n%i == 0 {
			ret[i]++
			n /= i
		}
	}
	if n != 1 {
		ret[n]++
	}
	return ret
}

func main() {
	var a, b int64

	fmt.Scan(&a, &b)
	g := gcd(a, b)

	fmt.Println(len(prime_factor(g)) + 1)
}

Measured memory_bytes: 512
from collections import defaultdict, deque

# ここにいたるまで結構かかる
# https://note.nkmk.me/python-union-find/
class UnionFind:
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
    
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return
        
        # 根のparentsはそのグループの要素数 * (-1) がはいる
        if self.parents[x] > self.parents[y]:
            x, y = y, x

        # 要素数の大きい方に小さい方をくっつける        
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

N, M, K = list(map(int, input().split()))

dame = [set() for _ in range(N)]
uf = UnionFind(N)

for _ in range(M):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    uf.union(a, b)
    dame[a].add(b)
    dame[b].add(a)

for _ in range(K):
    c, d = list(map(int, input().split()))
    c -= 1
    d -= 1
    if uf.find(c) == uf.find(d):
        dame[c].add(d)
        dame[d].add(c)

ans = []
for i in range(N):
    ans.append(uf.size(i) - len(dame[i]) -1 )

for val in ans:
    print(val, end=" ")
print("\n")

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

typedef long long ll;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define ANS(n) cout << (n) << endl

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(a);i>=(b);i--)

#define ALL(obj) (obj).begin(),(obj).end()

#define pii pair<int,int>

#define pb(a) push_back(a)
#define mp make_pair

int main()
{
	int n,l;
	cin >> n >> l;
	vector<string> s(n);
	FOR(i,0,n)
		cin >> s[i];
	sort(ALL(s));
	FOR(i,0,n)
		cout << s[i];
	cout << endl;
	return 0;
}


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

int main()
{
    std::string s,t;
    std::cin >> s;
    std::cin >> t;
    if(t.size() - s.size() != 1)
        std::cout << "No";
    else if(t.compare(0,s.size(),s) == 0)
        std::cout << "Yes";
    else
        std::cout << "No";
}


Measured memory_bytes: 3600
// 754

#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int abs(int n) {
    if (n >= 0) {
        return n;
    }
    return -n;
}

int calc(string s) {
    int i = stoi(s);
    return abs(i - 753);
}

int main() {
    int res = 1000;
    string input;
    cin >> input;
    for (int i = 0; i < input.size() - 2; i++) {
        int n = calc(input.substr(i, 3));
        if (n < res) {
            res = n;
        }
    }
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
from collections import Counter

N = int(input())
S = [input() for _ in range(N)]

c = Counter(S).most_common()

l = list(filter(lambda v: v[1] == c[0][1], c))
l.sort()

a = l[0][1]
for s in l:
    if s[1] != a: break
    print(s[0])


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

using ll = long long;
using ull = unsigned long long;

const double PI = acos(-1);
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;

#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second

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


int main(){
  int H,W;
  cin>>H>>W;
  vector<string> a(H);
  for (int i=0;i<H;i++) {
    cin>>a[i];
  }
  string line(W+2,'#');
  cout<<line<<endl;
  for (int i=0;i<H;i++) {
    cout<<'#'<<a[i]<<'#'<<endl;
  }
  cout<<line<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;
    
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>
#define pq priority_queue<ll>
#define rpq priority_queue<ll,vector<ll>,greater<ll>>
#define p_b push_back
    
ll n,cnt,ans,a[ohara],b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k,q,p;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
ll dp[55][50*100+100];
    
//------ Believe yourself as a genius!!!!!! ------
    
int main(void){
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>n>>p;
    dp[0][0]=1;
    rep(i,n)cin>>a[i];
    rrep(i,1,n+1){
        rep(j,50*100+100){
            if(j-a[i-1]>=0){
                dp[i][j]+=dp[i-1][j]+dp[i-1][j-a[i-1]];
            }
            else{
                dp[i][j]+=dp[i-1][j];
            }
        }
    }
    rep(i,50*100+100){
        if(i%2==p){
            ans+=dp[n][i];
        }
    }
    Cout(ans);
    return 0;
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
 
using namespace std;
 
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define pvec(v) rep(i,v.size()){cout << v[i] << " ";};cout<<endl;
#define pb push_back
#define pf push_front
#define mod 1e9+7
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;

const double pi = acos(-1.0);
 
ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

int main()
{
	int n,m,c,x,ans=0;
	cin >> n >> m >> c;
	int b[m];
	rep(i,m) cin >> b[i];
	rep(i,n){
		int sum=0;
		rep(j,m){
			cin >> x;
			sum+=x*b[j];
		}
		if(sum+c>0) ans++;
	}
	cout << ans << endl;
	return 0;
}


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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"

using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;

template<typename T> auto compare = [](T x, T y) -> bool{return (x < y);};
const int MOD = 1000000007;

signed main(){
    int N, D[51];
    vector<int> T;
    bool visited[51];
    cin >> N;
    REP(i, N){
        cin >> D[i];
    }
    D[N] = 0;
    sort(D, D + N + 1);
    for(int s = 24; s >= 0; s--){
        vector<int> T;
        T.push_back(D[0]);
        int p = 0;
        FOR(i, 1, N + 1){
            if(D[i] - p < s){
                T.push_back((24 - D[i]) % 24);
            }else{
                T.push_back(D[i]);
                p = D[i];
            }
        }
        sort(ALL(T));
        int m = (24 - T[N]) % 24;
        FOR(i, 1, N + 1) m = min(m, T[i] - T[i - 1]);
        if(m >= s){
            PRINT(m);
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

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

    int N, W;
    cin >> N >> W;

    int w[N];
    long long v[N];
    for (int i = 0; i < N; i++) {
        cin >> w[i] >> v[i];
    }

    long long dp[N + 1][W + 1];
    for (int i = 0; i < N + 1; i++) {
        for (int j = 0; j < W + 1; j++) {
            dp[i][j] = 0;
        }
    }

    // 縦軸に品物の個数，横軸に重さをとる二次元の表を全部埋める感じ
    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= W; j++) {
            // i 番目の品物を選ぶ場合
            if (j - w[i] >= 0) {
                change_max(dp[i + 1][j], dp[i][j - w[i]] + v[i]);
            }
            // i 番目の品物を選ばない場合
            change_max(dp[i + 1][j], dp[i][j]);
        }
    }

    cout << dp[N][W] << '\n';
    return 0;
}

Measured memory_bytes: 79232
# -*- coding: utf-8 -*-
 
n, k = map(int, input().split())
p = list(map(int, input().split()))

summation = 0
exp_val = []
for i in range(n):
    summation += (p[i]+1)/2
    exp_val.append(summation)
exp_val.insert(0, 0)
#print(exp_val)

ans = 0
for i in range(n-k+1):
    m = exp_val[k+i] - exp_val[i]
    ans = max(ans, m)

print(ans)

Measured memory_bytes: 25060
#include<iostream>
#include<set>

#define ll long long
#define rep(i,n) for(int i=0; i<(n); ++i)

int main(){
    int a,b,c; std::cin >> a >> b >> c;
    std::set<int> st;
    st.insert(a); st.insert(b); st.insert(c);
    if(st.size() == 2)
        std::cout << "Yes" << std::endl;
    else
        std::cout << "No" << std::endl;
    return 0;
}

Measured memory_bytes: 3608
#include <cstdio>
#include <string>
#include <cmath>
#include <string>
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
#include <iomanip>
#include <tuple>
#include <queue>
using namespace std;
typedef long long ll;
#define rep(i, a, n) for (int i=a;i<n;++i)
#define repeq(i, a, n) for(int i=a;i<=n;++i)
#define repi(m, itr) for (auto itr = m.begin();itr != m.end();++itr)
#define per(i, a, n) for (int i=n-1; i>=a;--i)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()

// 
string S;
string ans = "AC";

int main(){
    cin >> S;

    if(S[0] != 'A') ans = "WA";

        bool tmp = false;
    repeq(i, 2, S.length()-2){
        if(S[i] == 'C'){
            if(!tmp){
                tmp = true;
            }else{
                cout << "WA" << endl;
                return 0;
            }
        }
    }

    if(!tmp) ans = "WA";
        if((S[1] < 'a' || S[1] > 'z')){
            ans = "WA";
        }

        if((S[S.length()-1] < 'a' || S[S.length()-1] > 'z')){
            ans = "WA";
        }
    cout << ans << endl;
    return 0;
}




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

int64_t myadd(int64_t a, int64_t b) {
  int64_t a_ = a % 1000000007;
  int64_t b_ = b % 1000000007;
  return ( a_ + b_ ) % 1000000007;
}

int64_t myprod(int64_t a, int64_t b) {
  int64_t a_ = a % 1000000007;
  int64_t b_ = b % 1000000007;
  return ( a_ * b_ ) % 1000000007;
}

int64_t myfact(int64_t n) {
  if ( n == 1 ) {
    return 1;
  }
  return myprod(n, myfact(n-1));
}

int main() {
  //input
  int64_t N;
  string S;
  cin >> N >> S;
  //calc
  int64_t answer;
  
  if ( S.at(0) == 'W' ) {
    answer = 0;
  }
  else {
    int64_t base = 1;
    int64_t l = 0;
    int64_t r = 0;
    bool is_left = true;
    char pre_c = '_';
    char c;
    rep(i,2*N) {
      c = S.at(i);
      if ( c == pre_c ) {
        is_left = !is_left;
      }
      if ( is_left ) {
        l++;
      }
      else {
        base = myprod(base, l-r);
        r++;
      }
  //    cout << "(" << l << "," << r << ")" << endl;
      pre_c = c;
    }
    if ( l == r ) {
      answer = myprod(base, myfact(N));
    }
    else {
      answer = 0;
    }
  }
  //output
  cout << answer << endl;
}

Measured memory_bytes: 2180
import java.io.*;
import java.util.*;
public class Main {
    
    public static void main(String args[]) {
        int n = 0, k = 0;
        int[][] arr = null;
        try (Scanner scanner = new Scanner(System.in)) {
            n = scanner.nextInt();
            
            arr = new int[n][3];
            for (int i=0; i < n; i++) {
                for(int j = 0; j < 3 ; j++) {
                    arr[i][j] = scanner.nextInt();
                }
            }
        }
        int[][] dp = new int[n + 1][3];
        //dp[i][j] = max happiness for day i and j activity;
        int ret = 0;
        for(int i = 1; i <= n; i++) {
            for(int j = 0; j < 3; j++) {
                dp[i][j] = 0;
                for(int a = 0; a < 3; a++) {
                    if(j != a) {
                        dp[i][j] = Math.max(dp[i][j], dp[i-1][a] + arr[i-1][j]);
                    }
                }
                ret = Math.max(ret, dp[i][j]);
            }
        }
        // for(int[] ar : dp)
        //     System.out.println(Arrays.toString(ar));
        System.out.println(ret);
        
    }
}

Measured memory_bytes: 98052
def solve():
    mod = 1000000007
    N = int(input())
    A = list(map(int, input().split()))

    x = 0
    y = 0
    z = 0
    ans = 1
    for n in A:
        T = 0
        found = False
        for m in [x, y, z]:
            if n == m:
                T += 1
        ans *= T
        ans %= mod

        if x == n:
            x += 1
            continue
        if y == n:
            y += 1
            continue
        if z == n:
            z += 1
            continue
    
    print(ans % mod)


if __name__ == '__main__':
    solve()

Measured memory_bytes: 53040
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int A, B, C, D ;
  	cin >> A >> B >> C >> D ;
  if (A + B == C + D) {
    cout << "Balanced" ;
  }
  else if (A + B >= C + D) {
    cout << "Left" ;
  }
	else {
      cout << "Right" ;
    }
}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;
const int mod = 1e9 + 7;

int main(){
    int x, n;
    cin >> x >> n;
    bool checked[110] = {};
    int p;
    for (int i = 0; i < n; ++i) {
        cin >> p;
        checked[p] = true;
    }

    int res;
    for (int i = 0; i < 100; ++i) {
        if (x - i < 1){
            res = x - i;
            break;
        }
        if (!checked[x-i]){
            res = x - i;
            break;
        }
        if (x + i > 100){
            res = x + i;
            break;
        }
        if (!checked[x+i]){
            res = x + i;
            break;
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 3604
def breadth_first_search(G):
  n = len(G)
  d = [-1] * (n + 1)
  d[1] = 0
  queue = [1]

  while len(queue) > 0:
    v = queue.pop(0)
    for c in G[v]:
      if d[c] < 0:
        d[c] = d[v] + 1
        queue.append(c)

  for i in range(1, n + 1):
    print(i, d[i])

G = {}
for i in range(int(input())):
  x = list(map(int, input().split()))
  G[x[0]] = x[2:]

breadth_first_search(G)

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

int main() {
  int n; cin >> n;
  vector<int> t(n+1,0),x(n+1,0),y(n+1,0);
  for(int i=1; i<n+1; i++) {
    cin >> t[i] >> x[i] >> y[i];
    int dt=t[i]-t[i-1];
    int dx=abs(x[i]-x[i-1]);
    int dy=abs(y[i]-y[i-1]);
    if(dt%2==(dx+dy)%2 && dt>=(dx+dy)) continue;
    else {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 4108
#include<iostream>
#include<cstdlib>
const double pi =3.141592653589793238;
using namespace std;
int main()
{
	double area, r, circumference;
	cin >> r;
	area = pi * r*r;
	circumference = 2 * pi*r;
	cout.setf(ios::fixed);
	cout.setf(ios::showpoint);
	cout.precision(6);
	cout << area << " " << circumference << endl;
	return 0;
}


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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

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

  int n;
  cin >> n;
  vector<int> xs(n);
  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> xs[i];
    sum += xs[i];
  }
  int a = static_cast<int>(round(static_cast<double>(sum) / n));
  int c = 0;
  for (int i = 0; i < n; i++) {
    c += (xs[i] - a) * (xs[i] - a);
  }
  cout << c << endl;
}

Measured memory_bytes: 384
package main

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

var sc = bufio.NewScanner(os.Stdin)

func newInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	n := newInt()
	d := newInt()

	count := 0

	for i := 0; i < n; i++ {
		x := newInt()
		y := newInt()

		if x*x+y*y <= d*d {
			count++
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 4908
import java.io.File;
import java.io.FileNotFoundException;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main(String[] args) throws FileNotFoundException {
        Scanner s = new Scanner(System.in);
        int N = s.nextInt();
        int K = s.nextInt();

        Set set = new HashSet();
        for (int i = 1; i <= N; i++) {
            set.add(i);
        }

        for (int i = 0; i < K; i++) {
            if(set.size()<=0){break;}
            int di = s.nextInt();
            for (int j = 0; j < di; j++) {
                int num = s.nextInt();
                if(set.contains(num)) {
                    set.remove(num);
                }
            }
        }
        System.out.println(set.size());

    }
}


Measured memory_bytes: 39548
#include<stdio.h>
#define EXIST 1
#define LOST  0

int main(void)
{
    int i, j, n, rank;
    char suit;
    int cards[4][13];
    char s[4] = { 'S', 'H', 'C', 'D'};
    
    /* 初期化 */
    for ( i=0; i<4; ++i)
        for ( j=0; j<13; ++j)
            cards[i][j] = LOST;
    
    scanf("%d\n", &n);
    for ( i=0; i<n; ++i){
        scanf("%c %d\n", &suit, &rank);
        switch (suit) {
            case 'S':
                cards[0][rank-1] = 1;
                break;
            case 'H':
                cards[1][rank-1] = 1;
                break;
            case 'C':
                cards[2][rank-1] = 1;
                break;
            case 'D':
                cards[3][rank-1] = 1;
                break;
        }
    }
    
    /* 書き出し */
    for ( i=0; i<4; ++i)
        for ( j=0; j<13; ++j)
            if ( cards[i][j] == LOST)
                printf("%c %d\n", s[i], j+1);
    return 0;
}



Measured memory_bytes: 2056
#include <iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<list>
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long

using namespace std;
int num[100005];
int ev[100005];
int od[100005];
int main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>num[i];

	for(int i=0;i<n;i++)
	{
		if(i&1) od[num[i]]++;
		else ev[num[i]]++;
	}
	int anse = 0,anso = 0;
	int ae = 0 , ao = 0;
	int sume = 0,sumo = 0;
	for(int i=0;i<100005;i++)
	{
		if(anse <= ev[i])
		{
			ae = anse;
			anse = ev[i];
			sume = i;
		}
		else if(ae < ev[i])
		{
			ae = ev[i];
		}
		if(anso <= od[i])
		{
			ao = anso;
			anso = od[i];
			sumo = i;
		}
		else if(ao < od[i])
		{
			ao = od[i];
		}
	}
	if(sumo != sume)
	{
		cout<<n-anse-anso<<endl;
	}
	else cout<<min(n-anse-ao,n-anso-ae)<<endl;
	
	return 0;
}


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

#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int main()
{
    int N;
    cin >> N;
    vector<ll> A(N+1);
    vector<ll> B(N+1);
    rep(i,N+1) cin >> A[i];
    rep(i,N) cin >> B[i];

    ll ans = 0;
    rep(i,N)
    {
        if(A[i] + A[i+1] <= B[i])
        {
            ans += A[i] + A[i+1];
            A[i+1] = 0;
        }
        else if(A[i] <= B[i])
        {
            ans += B[i];
            A[i+1] -= B[i] - A[i];
        }
        else
        {
            ans += B[i];
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
N,_=gets.chomp.split(" ").map{|n| n.to_i}
A=gets.chomp.split(' ').map{|n| n.to_i}
total = A.inject{|sum,a| sum+a}
unit = N*(N+1)/2
if(total % unit != 0)
	puts "NO"
	exit(0)
end
times = total / unit
B=Array.new(N)
cnt = 0
for i in 0..(N-1)
	B[i] = -(A[i] - A[i-1] - times)
	if(B[i] < 0 || B[i] % N != 0)
		puts "NO"
		exit(0)
	end
	cnt += B[i] / N
end
if(cnt != times)
	puts "NO"
	exit(0)
end
puts "YES"

Measured memory_bytes: 10252
#[allow(unused_macros)]
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().split_whitespace().map(|s| s.to_string()).collect::<Vec<String>>()
        }
    };
    (;;$n:expr) => {
        {
            (0..$n).map(|_| scan!()).collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let (a, b, c) = scan!(i64, i64, i64);
    if a == b + c || b == a + c || c == a + b {
        println!("Yes")
    } else {
        println!("No")
    }
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
const int N=200010,INF=0x3f3f3f3f;
const double PI=acos(-1);
inline char nc(){
    static char buf[1000000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,1000000,stdin),p1==p2)?EOF:*p1++;
}
inline int rd(){
    char ch=nc();int sum=0;
    while(!(ch>='0'&&ch<='9'))ch=nc();
    while(ch>='0'&&ch<='9')sum=sum*10+ch-48,ch=nc();
    return sum;
} 
int g[N],d[N];
int x[N],y[N],x2[N],y2[N];
struct data{
	int x,y;
}q[N],t[N];
int mnx,mxy;
void rot(int &x,int &y){
	int t=x;
	x=mxy-y;
	y=t-mnx;
}

bool cmp(data&x,data&y){
	return x.x<y.x;
}

int main(){
	int sx,sy,tx,ty;
	sx=rd(),sy=rd(),tx=rd(),ty=rd();
	if(tx<sx) swap(sx,tx),swap(sy,ty);
	int n;
	n=rd();
	mnx=sx,mxy=sy;
	for(int i=1;i<=n;i++){
		x[i]=rd(),y[i]=rd();
		mnx=min(mnx,x[i]),mxy=max(mxy,y[i]);
	}	
	if(ty<sy){
		for(int i=1;i<=n;i++)
			rot(x[i],y[i]);	
		rot(sx,sy),rot(tx,ty);
	}	
	int n2=0;
	for(int i=1;i<=n;i++) if(x[i]>=sx&&x[i]<=tx&&y[i]>=sy&&y[i]<=ty){
		n2++;
		q[n2].x=x[i],q[n2].y=y[i];
		x2[i]=x[i],y2[i]=y[i];
	}
	double tmp;
	const int D=20;
	sort(q+1,q+1+n2,cmp);
	for(int i=1;i<=n2;i++) g[i]=INF;
	g[0]=-1,q[0].y=0;
	for(int i=1;i<=n2;i++){
		int k=lower_bound(g,g+n2+1,q[i].y)-g;
		d[i]=k;
		g[k]=q[i].y;
	}
	int mxc=0;
	for(int i=1;i<=n2;i++) mxc=max(mxc,d[i]);
	if(mxc==tx-sx+1||mxc==ty-sy+1) tmp=-(1-0.5*PI)*D+(1-0.25*PI)*D;
	else tmp=0;
	printf("%.13f\n",1.0*(ty-sy)*100+1.0*(tx-sx)*100-(1-0.25*PI)*mxc*D+tmp);
	return 0;
}


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

const char* possible = "POSSIBLE";
const char* impossible = "IMPOSSIBLE";

int n;
int p[252521];
vector<int> children[252521];

int cycle[252521];
int m = 0;
bool cycled[252521];

int calcorder[252521];
int calcorderhead = 0;
int calcordertail = 0;

int it = 0;

#define MAX_DEG 19
int val[252521];
bool deg[MAX_DEG+2];
int tmp[252521];
int tmptail = 0;
void calc(int x){
    REP(i,children[x].size()){
        int v = val[children[x][i]];
        deg[v]=true;
        tmp[tmptail++] = v;
    }
    REP(d,MAX_DEG+1)if(!deg[d]){
        val[x] = d;
        break;
    }
    if(tmptail > MAX_DEG+2){
        REP(i,MAX_DEG+2)deg[i]=false;
        tmptail = 0;
    }else{
        while(tmptail--){
            deg[tmp[tmptail]]=false;
        }
        tmptail = 0;
    }
}

int main(void){
    scanf("%d",&n);
    REP(i,n){
        scanf("%d",p+i);
        p[i]--;
        children[p[i]].push_back(i);
    }
    REP(i,n)it = p[it];
    do{
        cycle[m++] = it;
        cycled[it] = true;
        it = p[it];
    }while(cycle[0]!=it);
    REP(i,m){
        int x = cycle[i];
        REP(j,children[x].size()){
            int y = children[x][j];
            if(cycled[y])continue;
            calcorder[calcordertail++] = y;
        }
    }
    while(calcorderhead != calcordertail){
        int x = calcorder[calcorderhead++];
        REP(j,children[x].size()){
            calcorder[calcordertail++] = children[x][j];
        }
    }
    REP(i,n)val[i] = MAX_DEG+1;
    while(calcordertail--){
        int x = calcorder[calcordertail];
        calc(x);
    }
    REP(d,MAX_DEG+1){
        val[cycle[0]] = d;
        REP(i,m)calc(cycle[i]);
        int tst = val[cycle[0]];
        calc(cycle[0]);
        if(tst == val[cycle[0]]){
            puts(possible);
            return 0;
        }
    }
    puts(impossible);
    return 0;
}


Measured memory_bytes: 15232
#include <stdio.h>

int main()
{
  int d, n, result;

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

  switch (d)
  {
  case 0:
    result = n + (n / 100);
    break;
  case 1:
    result = 100 * n + (n / 100 * 100);
    break;
  case 2:
    result = 100 * 100 * n + (n / 100 * 100 * 100);
    break;
  }

  printf("%d\n", result);

  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//  A以上B以下の～の個数....B以下の個数 - A-1以下の個数

ll gcd(ll a, ll b){
    if(b == 0)return a;
    return gcd(b,a%b);
}
ll num(ll n, ll c, ll d){
    ll g = gcd(c,d);
    ll l = c/g*d;//最小公倍数
    return n - n/c - n/d + n / l;
}
int main(){
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    cout << num(b,c,d) - num(a-1,c,d) << endl;
    return 0;
}


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

int main(){
    int n,cnt=0;
    cin>>n;
    vector<int> p(n);
    for(int i=0;i<n;i++) cin>>p[i];
    if( is_sorted(p.begin(), p.end()) ){
        cout<<"YES\n";
        return 0;
    }
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            if(p[i]>p[j]){
                int tmp=p[i];
                p[i]=p[j];
                p[j]=tmp;
                if( is_sorted(p.begin(), p.end()) ){
                    cout<<"YES\n";
                    return 0;
                }
                tmp=p[i];
                p[i]=p[j];
                p[j]=tmp;
            }
        }
    }
    cout<<"NO\n";
    return 0;
}


Measured memory_bytes: 384
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
#define IO ios::sync_with_stdio(false); cin.tie(0);
#define all(v) (v).begin(), (v).end()
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const int nmax = 2e5 + 10;
int n;
int a[nmax];
int f[21][nmax];
int main() {
    IO;
  
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int k = 0; k < 21; k++) 
        f[k][0] = 0;
    for (int i = 1; i <= n; i++) {
        for (int k = 0; k < 21; k++)
            f[k][i] = f[k][i - 1];
        for (int k = 0; k < 21; k++)
            if ((a[i] >> k) & 1) f[k][i]++;
    }
    ll res = 0;
    for (int i = 1; i <= n; i++) {
        int cnt = n + 1;
        for (int k = 0; k < 21; k++) {
            int cnt1;
            if ((a[i] >> k) & 1) 
                cnt1 = (int) (lower_bound(f[k] + 1 + i, f[k] + 1 + n, f[k][i] + 1) - (f[k] + 1 + i));
            else 
                cnt1 = (int) (lower_bound(f[k] + 1 + i, f[k] + 1 + n, f[k][i] + 2) - (f[k] + 1 + i));
            cnt = min(cnt, cnt1);
            //cout << cnt1 << "\n";
        }
        res += cnt;
    }
    cout << res + (ll) n;
    return 0;
}


Measured memory_bytes: 17408