akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <map>
#include <cmath>
#include <iomanip> 
#include <bits/stdc++.h>
using namespace std;
int arr3[51];
long long culc(long long k){
	long long fr=1;
	long long ls=50;
	long long mid;
	while(ls>=fr){
		mid=(fr+ls)/2;
		if (arr3[mid]>k)ls=mid-1; else if(arr3[mid]<k)fr=mid+1; else return mid;
	}
	return mid;
}
 
 
 
int main() {
	long long n;
	cin>>n;
	long long ans=0;
	int arr[1000005];
	arr[0]=2;
	int ind=0;
	for(int i=3;i<=10000;i+=2){
		bool ok=false;
		for(int j=0;j<=ind;j++){
			if(i%arr[j]==0)ok=true;
		}
		if(!ok)arr[++ind]=i;
      	
	}
  	
	int arr2[1000005];
	int ind2=-1;
	
	arr3[0]=0;
	for(int i=1;i<51;i++)arr3[i]=i+arr3[i-1];
  	
	for(int i=0;i<=ind;i++){
		if(n%arr[i]==0){
			arr2[++ind2]=1;
			n/=arr[i];
		}
		else continue;
		while(n%arr[i]==0){
			arr2[ind2]++;
			n/=arr[i];
		}
		int cur=culc(arr2[ind2]);
		if(arr2[ind2]>=arr3[cur+1]){
			ans+=cur+1;
			continue;
		}
		if(arr2[ind2]>=arr3[cur]){
			ans+=cur;
			continue;
		}
		ans+=cur-1;
	}
  	for(int i=10001;i<=1000000;i++){
      if(n%i==0){
        ans++;
        n/=i;
      }
    }
  	if(n>1000000)ans++;
	cout<<ans<<endl;
		
	
  return 0;
}


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

public class Main {

	public static void main(String[] args) throws IOException{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str = br.readLine();
		String strArray[] = str.split(" ", 0);
		int num[] = new int[strArray.length];

		for(int i=0; i<strArray.length; i++){
			num[i] = Integer.parseInt(strArray[i]);
		}

		int W = num[0];
		int H = num[1];
		int x = num[2];
		int y = num[3];
		int r = num[4];
		
		if(x+r <= W && x-r >= 0 && y+r <= H && y-r >= 0)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
}

Measured memory_bytes: 17088
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main() {
    string s;
    cin >> s;
    int n = s.length();
    int sum = 0;
    rep(i, n) sum += (int)(s[i]-'0');
    yns(sum%9==0);
    return 0;
}

Measured memory_bytes: 3736
#include<stdio.h>
#include<stdlib.h>

typedef struct{
  int p;
  int y;
  int i;
  int n;
} city_t;

int sort1(const void *a, const void *b){
  if(((city_t*)a)->p!=((city_t*)b)->p){
    return ((city_t*)a)->p - ((city_t*)b)->p;
  }else{
    return ((city_t*)a)->y - ((city_t*)b)->y;
  }
}

int sort2(const void *a, const void *b){
  return ((city_t*)a)->i - ((city_t*)b)->i;
}

int main(void){
  int n,m;
  
  scanf("%d%d",&n,&m);
  city_t city[m];
  for(int i=0;i<m;i++){
    scanf("%d %d",&city[i].p,&city[i].y);
    city[i].i=i;
  }
  
  qsort(city,m,sizeof(city_t),sort1);
  
  city[0].n=1;
  for(int i=1;i<m;i++){
    if(city[i].p==city[i-1].p) city[i].n=city[i-1].n+1;
    else city[i].n=1;
  }
  
  qsort(city,m,sizeof(city_t),sort2);
  for (int i=0; i<m; i++){
    printf("%06d",city[i].p);
    printf("%06d\n",city[i].n);
  }
  return 0;
}

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

#define int long long
struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
//const int MOD = 1e9 + 7;
using intpair = pair<int, int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((int)((a) + (b) - 1)/(int)(b))

int solve(int n, int x){
    int ans = 0;
    reps(a,1,n)reps(b,a+1,n)reps(c,b+1,n){
        if(a + b + c == x) ans++;
    }
    return ans;
}

signed main(){
    while(true){
        int n, x;
        cin >> n >> x;
        if(n == 0 && x == 0) break;
        cout << solve(n,x) << endl;
    }
}


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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main() {
  intll h , w ;
  cin >> h >> w ;
  
  intll ans = ((h+1)/2) * ((w+1)/2);
 
  ans+= (h/2) * (w/2) ;
  
  if(h==1 || w==1)
    ans =  1 ;
  
  
  cout << ans ;


}


Measured memory_bytes: 256
#include <iostream>


using namespace std;

int main(){
	int a, b;

	cin >> a >> b;

	if (a < b){
		cout << "a < b" << endl;

	} else if(a > b){
		cout << "a > b" << endl;
	}
	else {
		cout << "a == b" << endl;
	}

	return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;


int main(){
    int n;
    cin >> n;
    long double a[n], ave = 0, mn = INF;
    rep(i, n) cin >> a[i], ave += a[i];
    ave /= n;

    rep(i, n) mn = min(abs(a[i] - ave), mn);


    rep(i, n) {
        if (abs(a[i]-ave) == mn){
            cout << i << endl;
            return 0;
        }
    }


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define cans cout << ans << endl
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
typedef long long ll;

struct UnionFind{
    vector<int> d;
    UnionFind(int n) : d(n,-1) {}
    int find(int x){
        if(d[x] < 0) return x;
        return d[x] = find(d[x]);
    }
    bool merge(int x, int y){
        x = find(x); y=find(y);
        if(x == y) return false;
        if(d[x] > d[y]) swap(x,y);
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    bool issame(int x, int y){
        return find(x) == find(y);
    }
    int size(int x){
        return -d[find(x)];
    }
};

int deg[100005];
vector<int> to[100005];

int main(){
    int n,m,k;
    cin >> n >> m >> k;
    UnionFind uf(n);
    rep(i,m){
        int a,b;
        cin >> a >> b;
        --a; --b;
        deg[a]++;
        deg[b]++;
        uf.merge(a,b);
    }
    rep(i,k){
        int a,b;
        cin >> a >> b;
        --a; --b;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    rep(i,n){
        int ans = uf.size(i)-1-deg[i];
        for(int u : to[i]){
            if(uf.issame(i,u)) --ans;
        }
        printf("%d%c",ans, i==n-1?'\n':' ');
    }
    return 0;
}

Measured memory_bytes: 9208
import math

a,b,x=list(map(int,input().split()))

if a**2*b>=2*x:
    ans =math.degrees(math.atan((a*b**2)/(2*x)))
    
else:
    x =a**2*b -x
    ans =math.degrees(math.atan((2*x)/(a**3)))
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, a) for(int i = 0; i < a; i++)
#define all(v) v.begin(), v.end()
#define dcout cout << fixed << setprecision(15)
#define arep(i, a) for(auto i : a)
#define F first
#define S second
#define VE vector<int>
#define pb(x) push_back(x)
#define MOD 1000000007
#define INF 10000000000
#define int long long
#define KETA(n) floor(log10(n) + 1)
using namespace std;
signed main() {
    int a, v, b, w, t;
    cin >> a >> v >> b >> w >> t;
    if(a < b) {
        if(a + t * v >= b + t * w)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    } else {
        if(b - t * w >= a - t * v)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 3620
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef vector<pii> vii;
#define sz(c) (int)(c).size()
#define ALL(c) (c).begin(), (c).end()

const int mod = (int)1e9 + 7;

int mult (int a, int b)
{
    return (ll)a * b % mod;
}

void solve (int n)
{
    int ans = 1;
    for (int i = 2; i <= n; i++)
    {
        bool ok = true;
        for (int j = 2; j * j <= i && ok; j++)
            ok &= (i % j != 0);

        if (ok)
        {
            int cur = 0;
            int cn = n / i;
            while (cn > 0)
            {
                cur += cn;
                cn /= i;
            }
            ans = mult(ans, cur + 1);
        }
    }

    cout << ans << '\n';
}

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

    int n;
    while (cin >> n)
        solve(n);
}


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

string s;
int cnt = 0;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin>>s;
	for(int i=0;i<3;i++){
		if(s[i] == '1')
			cnt++;
	}
	cout<<cnt;
	return 0;
}

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

int main(){
    int A, B;  cin >> A >> B;
    if(A > B) swap(A, B);
    if(A==1 && B == 2){
        cout << 3 << endl;
    }else if(A==1 && B == 3){
        cout << 2 << endl;
    }else{
        cout << 1 << endl;
    }
}

Measured memory_bytes: 256
from bisect import bisect

N =int(input())
A = sorted(list(map(int,input().split())))

ans = []

if len(A) == 2 :
    ans.append(A[::-1])
    calc = A[1] - A[0]

else :
    ind = bisect(A,0)

    X = A[:ind]
    Y = A[ind:]
    
    if len(X) == 0 :
        ans.append([Y[0],Y[1]])
        X.append(Y[0]-Y[1])
        Y.pop(0)
        Y.pop(0)
    elif len(Y) == 0 :
        ans.append([X[-1],X[-2]])
        Y.append(X[-1]-X[-2])
        X.pop(-1)
        X.pop(-1)
    
    while True :
        if len(X) >= 2 :
            ans.append([Y[0],X[-1]])
            Y[0] -= X.pop(-1)
        elif len(Y) >= 2 :
            ans.append([X[-1],Y[0]])
            X[-1] -= Y.pop(0)
        else :
            ans.append([Y[0],X[0]])
            calc = Y.pop(0) - X.pop(0)
            break
    
print(calc)
for i in range(len(ans)) :
    print(*ans[i])


Measured memory_bytes: 22968
answers = Array.new

while true
	exp = gets.split(" ")
	break if exp[1] == "?"
	answer = exp[0].to_i + exp[2].to_i if exp[1] == "+"
	answer = exp[0].to_i - exp[2].to_i if exp[1] == "-"
	answer = exp[0].to_i * exp[2].to_i if exp[1] == "*"
	answer = exp[0].to_i / exp[2].to_i if exp[1] == "/"
	answers.push answer
end

answers.each{|ans|
	puts ans
}

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

const int e=100000007;


int main() {
	string s, t; cin>> s>> t;
	int a[s.size()+1][t.size()+1];
	for(int i=0; i<=s.size(); i++){
        for(int j=0; j<=t.size(); j++){
            if(s[i-1]==t[j-1] && i && j) a[i][j]=1;
            else a[i][j]=0;
            if(i && j){
                a[i][j]=a[i-1][j-1]+a[i][j];
                if(max(a[i-1][j],a[i][j-1])>a[i][j]){
                    (a[i-1][j]>a[i][j-1])? a[i][j]=a[i-1][j] : a[i][j]=a[i][j-1];
                }
            }
        }
	}
	string h="";
	int i=s.size(), j=t.size();
	while(i && j){
        //cout<< i<< " - "<< j<< endl;
        if(a[i-1][j]==a[i][j]) i--;
        else if(a[i][j-1]==a[i][j]) j--;
        else{ i--; j--;}
        if(i<s.size() && j<t.size() && a[i][j]!=a[i+1][j+1]) h=s[i]+h;
	}
	cout<< h<< endl;
}


Measured memory_bytes: 35456
#include <stdio.h>

int main(){
  long N, K = 0;
  scanf("%ld%ld", &N, &K);
  long mod = N % K;
  if (N < K){
    if (K - N > mod){
    printf("%ld\n", mod);
    }else{
      printf("%ld\n", K - N);
    }
  }else if (mod != 0){
    printf("%ld\n", K - mod);
  }else{
    printf("0");
  }
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int i = 1;
		do {
			int x = i;
			if (x % 3 == 0) {
				System.out.print(" " + i);
			} else {
				do {
					if (x % 10 == 3) {
						System.out.print(" " + i);
						break;
					}
					x /= 10;
					if (x != 0)
						continue;
					else
						break;
				} while (x != 0);
			}
		} while (++i <= n);
		System.out.println();
	}
}

Measured memory_bytes: 28732
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long int ll;
int main()
{
    fastio;
    ll n,k;cin>>n>>k;
    if(n%k==0)
    cout<<0;
    else
    {
        n=n%k;
        if(n>k/2)
        cout<<k-n;
        else 
        cout<<n;
    }
    return 0;
}

Measured memory_bytes: 256
using System;

namespace A___Train
{
    class Program
    {
        static void Main(string[] args)
        {
            var input=Console.ReadLine().Split(' ');
            var n = int.Parse(input[0]);
            var i = int.Parse(input[1]);
            Console.WriteLine(n - i + 1);
        }
    }
}

Measured memory_bytes: 11092
'use strict';
(function(stdin) {
  var lines  = stdin.toString().split('\n');
  var result = (function(data) {
  	return [
  		Math.min.apply(0,data)
  		,Math.max.apply(0,data)
  		,data.reduce(function(a,b){return a + b;})
  	].join(' ');
  }(lines[1].split(' ').slice(0,lines[0]).map(Number)
  ));
  console.log(result);
}(require('fs').readFileSync('/dev/stdin', 'utf8')));

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

typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int main(){
  int N, M;
  map<int, pair<int, int>> list;
  cin >> N >> M;
  rep(i, M){
    int p;
    string S;
    cin >> p >> S;
    if(list.count(p)){
      if(S == "WA" && list[p].second == 0){
        list.at(p).first++;
      }else{
        list.at(p).second++;
      }
    }else{
      if(S == "WA"){
        list[p].first = 1;
        list[p].second = 0;
      }else{
        list[p].first = 0;
        list[p].second = 1;
      }
    }
  }
  int correct = 0, incorrect = 0;
  rep(p, N + 1){
    if(list.count(p) && list.at(p).second >= 1){
      correct++;
      incorrect = incorrect + list.at(p).first;
    }
  }
  cout << correct << " " <<incorrect <<endl;
}

Measured memory_bytes: 6528
A = []
ans = "No"

for _ in range(3):
    row = list(map(int, input().split()))
    A.append(row)

N = int(input())
for _ in range(N):
    bi = int(input())
    for i in range(3):
        for j in range(3):
            if A[i][j] == bi:
                A[i][j] = 0
                break

for i in range(3):
    if A[i][0] == A[i][1] == A[i][2]:
        ans = "Yes"
        break
    if A[0][i] == A[1][i] == A[2][i]:
        ans = "Yes"
        break

if A[0][0] == A[1][1] == A[2][2]:
    ans = "Yes"

if A[2][0] == A[1][1] == A[0][2]:
    ans = "Yes"
print(ans)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<vector>
#include<algorithm>
#define vi vector<int>
#define all(v) v.begin(), v.end()
#define ll long long int
using namespace std;
int main()
{
    int n,m,k,a,b;
    cin>>a>>b;
    if(a<=b){
      cout<<"unsafe";
    }
  else{
    cout<<"safe";
  }
 }


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

int main() {
    string n;
    cin >> n;
    REP(i,3){
        if(n[i] == '1')cout << 9;
        else cout << 1;
    }
    cout << endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <cmath>
#include <cstdlib>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define MA(i,j) make_pair(i,j)
#define PA pair<int,int>
#define PB push_back
#define PQ priority_queue<int>
#define PGQ priority_queue<int,vector<int>,greater<int> >
#define VE vector<int>
#define VP vector<PA>
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define MOD 1000000007
#define INF 1000000007
#define PI 3.14159265358979323846
using namespace std;
//
int N;
int P[168]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193
,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401
,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619
,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,
881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997};
int PP[168];
long long mul=1;
int main(){
  scanf("%d",&N);
  FOR(i,2,N+1){
    int k=i;
    FOR(j,0,168){
      while(k%P[j]==0){
        k/=P[j];
        PP[j]++;
      }
      if(k==1){
        break;
      }
    }
  }
  FOR(i,0,168){
    (mul*=(PP[i]+1))%=MOD;
  }
  printf("%lld\n",mul);
  return 0;
}


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

int main(){
	ll q, h, s, d, n;
	cin >> q >> h >> s >> d >> n;

	ll m5 = min(h, 2 * q);
	ll m1 = min(s, 2 * m5);
	ll m2 = min(d, 2 * m1);
	ll ans = 0;
	ans += n / 2 * m2;
	n %= 2;
	ans += n * m1;
	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

long long MOD = 1e9+7;
int MAX_INT = 1e9;

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

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

  long long N;
  cin >> N;
  vector<long long> X(N), Y(N);
  for(int i = 0; i < N; i++) {
    cin >> X[i];
    Y[i] = X[i];
  }
  sort(Y.begin(), Y.end());
  for(int i = 0; i < N; i++) {
        if(X[i] < Y[N/2]) {
            cout << Y[N/2] << endl;
        }
        else {
            cout << Y[N/2-1] << endl;
        }
    }

  return 0;
}


Measured memory_bytes: 6364
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>
#include<time.h>
typedef long long int ll;
//#include<bits/stdc++.h>


using namespace std;



int main()
{
    int x, y, z;
    cin >> x >> y >> z;
    cout << z << " " << x << " " << y << endl;

    return 0;

}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> V;

int main() {
  int n;
  cin >> n;
  V t(n);
  for (int i = 0; i < n; i++) cin >> t[i];
  int m;
  cin >> m;
  V p(m), x(m);
  for (int i = 0; i < m; i++) cin >> p[i] >> x[i];
  for (int i = 0; i < m; i++) {
    int sum = 0;
    for (int j = 0; j < n; j++) {
      if (p[i]-1 == j) sum += x[i];
      else {
	sum += t[j];
      }
    }
    dump(sum);
  }		       
  return 0;
}


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

using namespace std;

int main() {
    
    int n,k;
    cin >> n >> k;
    swap(n,k);
    
    for (int i = n - k + 1; i <= n + k - 1; ++i)
        cout << i << " ";
    cout << "\n";
    return 0;
}


Measured memory_bytes: 256
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
int main()
{
	int n,a,out=0;
	cin>>n;
	rep(i,n){
		cin>>a;
		if(a%2>0 && i%2==0) out++;
	}
	cout<<out<<endl;
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
#define lld long long
#define pb push_back
#define mk make_pair
#define MAX (lld)1e5+7
#define lim (lld)1e9+7
#define MAX2 (int)1e6+9
#define ff first
#define ss second
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;

const lld mod=lim;

lld power(lld x, lld y, lld p)  
{   lld res = 1;     x = x % p; if (x == 0) return 0;  
  
    while (y > 0)  
    { if (y & 1) res = (res*x) % p;  y = y>>1; x = (x*x) % p;   }  
    return res;  } 


int extend_gcd(int a, int b, int& x, int& y) {
    if (b == 0) { x = 1;y = 0;return a;}
    int x1, y1;
    int d = extend_gcd(b, a % b, x1, y1);
    x = y1; y = x1 - y1 * (a / b);return d;	}

int rowNum[]={-1,0,0,1};
int colNum[]={0,-1,1,0};
std::vector<int> vis(MAX2);

int main()
{
	fastio
    int n,ans=0;
    cin>>n;

    std::vector<int> v(n);

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

    sort(v.begin(), v.end());

    for(int i=0;i<n;i++)
    {
        for(int j=v[i];j<=v[n-1];j+=v[i])
        {
            vis[j]++;
        }
    }

    for(int i=0;i<n;i++)
    {
        if(vis[v[i]]==1)
            ans++;
    }

    cout<<ans<<endl;

}

Measured memory_bytes: 7900
#include<cstdio>
int main()
{
	int m,f,b,a;
	a=0;
	scanf("%d %d %d",&m,&f,&b);
	// printf("%d %d %d",m,f,b);
	if(m+f>=b){
		if(m>=b)a=0;
		else a=b-m;
		printf("%d\n",a);
	}
	else printf("NA\n");
	return 0;
}



Measured memory_bytes: 2756
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Math;
using static System.Console;

namespace msolutions2020
{
    class SolverB
    {
        static void Main()
        {
            Solve();
        }

        public static void Solve()
        {
            int[] cards = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            var k = int.Parse(ReadLine());
            for(int i=0; i<k; i++)
            {
                if (cards[1] <= cards[0])
                {
                    cards[1] *= 2;
                    continue;
                }else if( cards[2] <= cards[1])
                {
                    cards[2] *= 2;
                    continue;
                }else
                {
                    break;
                }
                
            }
            WriteLine(cards[0] < cards[1] && cards[1] < cards[2] ? "Yes" : "No");
        }
    }
}

Measured memory_bytes: 28292
#include <bits/stdc++.h>
#include <unistd.h>
#define ll long long
#define inf 1000000007
#define inf16 0x3f3f3f3f
#define INF 1000000000000000007LL
#define VI vector<int>
#define VPII vector<pair<int, int> >
#define VLL vector<ll>
#define PII pair<int, int>
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define endl '\n'
#define ALL(c) (c).begin(), (c).end()
using namespace std;

#define int ll

int h, w, n, k, ans;

int pot[50*50];

int query(int y1, int y2, int x1, int x2)
{
	cout << "? " << y1 << " " << x1 << " " << y2 << " " << x2 << endl;
	int ans;
	cin >> ans;
	return ans;
}

void solve(int y1, int y2, int x1, int x2, int cnt, int split)
{
	if(cnt==0)
		return;

	if(cnt==(y2-y1+1)*(x2-x1+1))
	{
		for(int i = y1; i <= y2; ++i)
		{
			for(int j = x1; j <= x2; ++j)
			{
				ans += pot[i*w+j];
				ans %= k;
			}
		}

		return;
	}

	if(y1!=y2)//split)
	{
		int m = (y1+y2)/2;
		int h = query(y1, m, x1, x2);
		solve(y1, m, x1, x2, h, split^1);
		solve(m+1, y2, x1, x2, cnt-h, split^1);
	}
	else
	{
		int m = (x1+x2)/2;
		int h = query(y1, y2, x1, m);
		solve(y1, y2, x1, m, h, split^1);
		solve(y1, y2, m+1, x2, cnt-h, split^1);
	}
}

int32_t main()
{
	cin >> h >> w >> n >> k;

	pot[0] = 1;

	for(int i = 1; i < 50*50; ++i)
	{
		pot[i] = pot[i-1]*2%k;
	}

	for(int j = 0; j < w; j += 2)
	{
		solve(0, h-1, j, j+1, query(0, w-1, j, j+1), 1);
	}

	/*for(int i = 0; i < h; i += 5)
	{
		for(int j = 0; j < w; j += 5)
		{
			solve(i, i+4, j, j+4, query(i, i+4, j, j+4), 1);
		}
	}*/

	//solve(0, h-1, 0, w-1, n, 1);

	cout << "! " << ans << endl;
}

Measured memory_bytes: 720
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <map>

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

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

using namespace std;

const ll BIG = 1000000007LL;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

template<typename T>
void inputArray(T* p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

template<typename T>
void inputVector(vector<T> * p, int a){
    rep(i, a){
        T input;
        cin >> input;
        p -> push_back(input);
    }
}

template <typename T>
void output(T a, int precision = 0) {
    if(precision > 0){
        cout << setprecision(precision)  << a << "\n";
    }
    else{
        cout << a << "\n";
    }
}

string S;

int main(int argc, const char * argv[]) {
    cin >> S;

    int maxlen = 0;
    rep(i, S.length()) {
        int len = 0;
        repd(j, i, S.length()) {
            if (S[j] == 'A' || S[j] == 'C' || S[j] == 'G' || S[j] == 'T') {
                ++len;
            } else {
                break;
            }
        }
        if (len > maxlen) {
            maxlen = len;
        }
    }

    output(maxlen);

    return 0;
}

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

int main() {
    char c;
    cin >> c;

    if (c=='a'||c=='i'||c=='u'||c=='e'||c=='o') {
        cout << "vowel" << endl;
    } else {
        cout << "consonant" << endl;
    }
}


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

int main(){
	char c;
	cin >> c;
	cout << ++c << endl;
    return 0;
}

Measured memory_bytes: 256
# https://atcoder.jp/contests/arc093/tasks/arc093_a
from copy import deepcopy
n = int(input())

nums = [int(i) for i in input().split()]

diff = []
for i in range(n):
    if i == 0:
        diff.append(abs(nums[i]))
    else:
        diff.append(abs(nums[i] - nums[i - 1]))
total = sum(diff) + abs(nums[-1])
for i in range(n):
    if i == n - 1:
        t = total - (diff[-1] + abs(nums[-1])) + abs(nums[-2])
    else:
        if i == 0:
            t = total - abs(nums[i]) - diff[i + 1] + abs(nums[i + 1])
        else:
            t = total - (diff[i] + diff[i + 1]) + abs(nums[i - 1] - nums[i + 1])
    print(t)

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

using namespace std;

int main(){
    int n;
    cin>>n;
    int cord[n];
    int sum = 0;
    for (int i=0; i<n; i++){
        cin>>cord[i];
        sum += cord[i];
    }
    int avg1 = sum/n;
    int avg2 = avg1+1;
    int min_energy1 = 0;
    int min_energy2 = 0;
    
    for (int i=0; i<n; i++){
        min_energy1+=pow(abs(cord[i]-avg1),2);
        min_energy2+=pow(abs(cord[i]-avg2),2);
    }
    cout<<min(min_energy1,min_energy2);
    return 0;
}

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

int main(){
	int n, i;
	int c[10000];
	long t;
	while(true){
		t=0;
		cin>>n; if(n==0)break;
		for(i=0;i<n;i++){
			cin>>c[i];
		}
		sort(c, c+n);
		for(i=n;i>0;i--){
			t += c[n-i] * (i-1);
		}
		cout<<t<<endl;
	}
	return 0;
}

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

typedef long long ll;

ll nCk(int n,int k){
  if(n<k)return 0;
  ll res = 1;
  for(int i=n-k+1;i<=n;i++)res*=i;
  for(int i=1;i<=k;i++)res/=i;
  return res;
}

int N,M,L;
vector<string> in;
int a[10],b[10],c[10];
void start_init(){
  N=M=L=0;
  in.clear();
  for(int i=0;i<10;i++){
    a[i]=b[i]=c[i]=0;
  }
}

int input(){
  cin>>N>>M>>L;
  if(N==0&&M==0&&L==0)return false;
  in.clear();in.resize(L);
  for(int i=0;i<L;i++){
    cin>>in[i];
  }
  return true;
}

bool over(vector<int>& n,vector<int>& h){
  for(int i=0;i<n.size();i++){
    if(n[i]>h[i]){
      return true;
    }
  }
  return false;
}
bool match(vector<int>& hand,vector<int>& h){
  //cerr<<" h[0]::"<<h[0];
  for(int i=0;i<h.size();i++){
    if(h[i]>N){
      return false;
    }
  }
  for(int i=0;i<hand.size();i++){
    for(int j=0;j<hand.size();j++){
      for(int k=0;k<hand.size();k++){
        vector<int> n(20,0);
        for(int l=0;l<10;l++){
          n[hand[i]+l] += a[l];
          n[hand[j]+l] += b[l];
          n[hand[k]+l] += c[l];
        }
        if(!over(n,h))return true;
      }
    }
  }
  return false;
}
ll count(vector<int>& hands,vector<int>& h,int s){
  ll res = 1;
  for(int i=0;i<h.size();i++){
    res *= nCk(N,h[i]);
  }
  const int c = M - (hands[hands.size()-1] + 1) + s;
  res *= nCk(c,s);
  ////cerr<<"count::"<<res<<endl;
  return res;
}

void print(vector<int> h){
  for(auto i:h){
    //cerr<<i<<" ";
  }
}

ll ans = 0;
vector<int> hands;
void init(){
  ans = 0;
  hands = vector<int>(L,0);
  for(int i=0;i<10;i++){
    a[i]=b[i]=c[i]=0;
  }
  sort(in.begin(),in.end());
  for(auto i:in){
    switch(i[0]){
      case 'a':
        a[i.size()-1]++;
        break;
      case 'b':
        b[i.size()-1]++;
        break;
      case 'c':
        c[i.size()-1]++;
        break;
    }
  }
}

void solve(int n,int startings){
  if(!(hands[n-1]<M)){
    //cerr<<"number err "<<n<<"::";print(hands);//cerr<<endl;
    return;
  }
  if(n==L){
    vector<int> h(20,0);
    for(int i=0;i<hands.size();i++){
      h[hands[i]]++;
    }
    //cerr<<"match    ::"<<n<<"::";print(hands);
    if(match(hands,h)){
      //cerr<<" true::";
      ll tmp = count(hands,h,startings);
      //cerr<<tmp;
      ans += tmp;
    }
    //cerr<<endl;
    return;
  }
  //cerr<<"pass     ::"<<n<<"::";print(hands);//cerr<<endl;
  hands[n] = hands[n-1];
  solve(n+1,startings);
  hands[n] = hands[n-1]+1;
  solve(n+1,startings);
  hands[n] = hands[n-1]+2;
  solve(n+1,startings+1);
}

void printabc(){
  //cerr<<"a:";
  for(int i=0;i<7;i++){
    //cerr<<a[i]<<" ";
  }//cerr<<endl;
  //cerr<<"b:";
  for(int i=0;i<7;i++){
    //cerr<<b[i]<<" ";
  }//cerr<<endl;
  //cerr<<"c:";
  for(int i=0;i<7;i++){
    //cerr<<c[i]<<" ";
  }//cerr<<endl;
}

int main(){
  while(start_init(),input()){
    init();
    solve(1,1);
    /*
    cout<<N<<" "<<M<<" "<<L<<endl;
    for(auto i:in){
      cout<<i<<" ";
    }cout<<endl;
    */
    printabc();
    cout<<fixed<<setprecision(10)<<(double(ans))/(nCk(N*M,L))<<endl;
  }
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define repp(i,l,r)for(long long i=(l);i<(r);i++)
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define per(i,n) for (long long i = (n); i >= 0; --i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//ミョ(-ω- ?)
int main() {
    string s[3];
    cin >> s[0] >> s[1] >> s[2];
    map<char,queue<char>> m;
    for(char c = 'a';c <= 'c';c++){
        rep(i,(int)s[c-'a'].length()){
            m[c].push(s[c-'a'][i]);
        }
    }

    
    char turn = 'a';
    while(1){
        if(m[turn].empty()){
            cout << char(turn-32) << endl;
            return 0;
        }
        char next = m[turn].front();
        m[turn].pop();
        turn = next;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (ll i=0; i<n; ++i)
#define all(obj) (obj).begin(),(obj).end()
using namespace std;
typedef long long ll;
long long GCD(long long x, long long y) { return y ? GCD(y, x%y) : x; }

int main(){
    ll N, M;
    cin >> N >> M;
    ll goukei = N*M;
    cout << abs(goukei-(N*2)-(M-2)*2) << endl;
    return 0;
}


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

using ll = long long;

vector<string> solve(vector<string> board, int n) {
    if (n == 8) return board;
    int i = 0, j = 0;
    while (board[i][j] != ' ') {
        j++;
        if (j == 8) {
            i++;
            j = 0;
        }
        if (i == 8) break;
    }
    if (i == 8) {
        board[0][0] = 'x';
        return board;
    }
    rep(k, 8) {
        if (board[i][k] != ' ') continue;
        vector<string> b(8);
        rep(l, 8) b[l] = board[l];
        int di[8] = {-1, -1, 0, 1, 1, 1, 0, -1}, dj[8] = {0, 1, 1, 1, 0, -1, -1, -1};
        for (int r = 1; r < 8; r++) {
            rep(t, 8) {
                int ni = i + di[t] * r, nj = k + dj[t] * r;
                if (ni < 0 || ni > 7 || nj < 0 || nj > 7) continue;
                if (b[ni][nj] != 'Q') b[ni][nj] = '.';
            }
        }
        b[i][k] = 'Q';
        auto ret = solve(b, n + 1);
        if (ret[0][0] != 'x') return ret;
    }
    board[0][0] = 'x';
    return board;
}

int main() {
    vector<string> board(8);
    rep(i, 8) board[i] = "        ";
    int k, di[8] = {-1, -1, 0, 1, 1, 1, 0, -1}, dj[8] = {0, 1, 1, 1, 0, -1, -1, -1};
    cin >> k;
    rep(i, k) {
        int r, c;
        cin >> r >> c;
        for (int j = 1; j < 8; j++) {
            rep(k, 8) {
                int ni = r + di[k] * j, nj = c + dj[k] * j;
                if (ni < 0 || ni > 7 || nj < 0 || nj > 7) continue;
                if (board[ni][nj] != 'Q') board[ni][nj] = '.';
            }
        }
        board[r][c] = 'Q';
    }
    auto ans = solve(board, k);
    rep(i, 8) cout << ans[i] << "\n";
}


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

int main()
{
        long long N;
        cin >> N;
        set<long long> key;
        map<long long, long long> m;

        for (int i = 0; i < N; ++i) {
                long long tmp;
                cin >> tmp;
                key.insert(tmp);
                m[tmp] += 1;
        }


        long long ans = 0;
        for (auto k : key) {
                if (m[k] == k) {
                }
                else if (m[k] > k) {
                        ans += (m[k] - k);
                }
                else {
                        ans += m[k];
                }
        }
        cout << ans << endl;

}


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

int main(){
	int pa,pb,pc,ja,jb,ans=0;
	
	cin >> pa >> pb >> pc >> ja >> jb;
	
	if(pa < pb){
		ans += (pa < pc) ? pa : pc;
	}else{
		ans += (pb < pc) ? pb : pc;
	}
	
	ans += (ja < jb) ? ja : jb;
	
	cout << ans-50 << endl;
	
	return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>

int main(void){
  int a,b,c,i,j = 0;
  scanf("%d",&a);
  scanf("%d",&b);
  scanf("%d",&c);

  for(i = a;i <= b; i++){
    if(c % i == 0){
      j++;
    }
  }
  printf("%d\n",j);
  return 0;
}


Measured memory_bytes: 2104
n = int(input())
p = [int(i) for i in input().split()]
count = 0
for i in range(1,n-1):
    if((p[i] > p[i-1] and p[i] < p[i+1]) or (p[i] < p[i-1] and p[i] > p[i+1])):
        count += 1
print(count)

Measured memory_bytes: 3060
N,K = list(map(int,input().split()))
S = input()

beforeChar = S[0]
sectionList = []
count = 0
for i in range(N):
    if S[i] == beforeChar:
        count += 1
    else:
        sectionList.append([beforeChar, count])
        count = 1
        beforeChar = S[i]
sectionList.append([beforeChar, count])

sectionNumber = len(sectionList)
zeroSectionNumber = 0
oneSectionNumber = 0
if sectionNumber % 2 == 0:
    zeroSectionNumber = sectionNumber // 2
    oneSectionNumber = sectionNumber // 2
else:
    if sectionList[0][0] == '0':
        zeroSectionNumber = sectionNumber // 2 + 1
        oneSectionNumber = sectionNumber // 2
    else:
        zeroSectionNumber = sectionNumber // 2
        oneSectionNumber = sectionNumber // 2 + 1

if zeroSectionNumber <= K:
    print(N)
    exit()

sumLengthList = []
sumLength = 0
for i in range(sectionNumber):
    sumLength += sectionList[i][1]
    sumLengthList.append(sumLength)

def sumLengthByRange(rangeStartSection, rangeEndSection):
    if rangeStartSection == 0:
        return sumLengthList[rangeEndSection]
    else:
        return sumLengthList[rangeEndSection] - sumLengthList[rangeStartSection - 1]

startSection = 0
endSection = 0
lengthList = []
if sectionList[0][0] == '1':
    endSection = K * 2
else:
    endSection = K * 2 - 1
    lengthList.append(sumLengthByRange(startSection, endSection))
    startSection = 1
    endSection += 2
while endSection < sectionNumber:
    lengthList.append(sumLengthByRange(startSection, endSection))
    startSection += 2
    endSection += 2
if sectionList[-1][0] == '0':
    endSection -= 1
    lengthList.append(sumLengthByRange(startSection, endSection))

print(max(lengthList))

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


int main() {
    long A, B, K;
    cin >> A >> B >> K;
    if (A-K > 0) {
        A = A - K;
    } else {
        K = K - A;
        A = 0;
        if (B - K > 0) {
            B = B - K;
        } else {
            B = 0;
        }
        
    }
    cout << A << " " << B << endl;

    }




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

int min3(int i,int j, int X, int Y)
{
  int m;
  m = min(abs(j-i),abs(i-Y)+1+abs(X-j));
  m = min(m,abs(i-X)+1+abs(Y-j));
  return (m);
}

int main()
{
  int N,X,Y;cin>>N>>X>>Y;
  X--,Y--;
  
  map<int,int> m;
  for (int i=0;i<N-1;i++)
  {
    for (int j=i+1;j<N;j++)
    {
      int d;
      d=min3(i,j,X,Y);
      m[d]++;
      //cout<<"("<<i<<","<<j<<")="<<d<<endl;
    }
  }
  for (int i=1;i<N;i++)
    cout<<m[i]<<endl;
}

Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int e[100][100];
int main()
{
	int n;
	while(cin>>n,n)
	{
		int m;
		int ans=0;
		cin>>m;
		for(int i = 0; i < n; ++i)
		{
			for(int j = 0; j < n; ++j)
			{
				e[i][j]=-1;
			}
		}
		while(m--) 
		{
			int l,r,c;
			scanf("%d,%d,%d",&l,&r,&c);
			e[l][r]=e[r][l]=c;
		}

		bool f[n];
		fill(f,f+n,0);

		int cnt=1;
		f[0]=true;
		while(cnt<n)
		{
			int mn=1000000,num;
			for(int i = 0; i < n; ++i)
			{
				if (f[i])
				{
					for(int j = 0; j < n; ++j)
					{
						if(!f[j]&&e[i][j]!=-1&&e[i][j]<mn)
						{
							mn=e[i][j];
							num=j;
						}
					}
				}
			}
			cnt++;
			ans+=mn-100;
			f[num]=true;
		}
		cout<<ans/100<<endl;
	}
  return 0;
}

Measured memory_bytes: 1284
A,B,Q = map(int,input().split())
S = [int(input()) for _ in range(A)]

T = [int(input()) for _ in range(B)]

from bisect import bisect_left

for _ in range(Q):
    ans = 10**12
    x = int(input())
    idxs = bisect_left(S,x)
    idxt = bisect_left(T,x)

    if idxs < A and idxt < B:
        ans = min(ans, max(S[idxs],T[idxt])-x)
    if 0 <= idxs-1 and 0 <= idxt-1:
        ans = min(ans, x-min(S[idxs-1],T[idxt-1]))
    if idxs < A and 0 <= idxt-1:
        ans = min(ans, S[idxs]-T[idxt-1] + min(S[idxs]-x, x-T[idxt-1]))
    if idxt < B and 0 <= idxs-1:
        ans = min(ans, T[idxt]-S[idxs-1] + min(T[idxt]-x, x-S[idxs-1]))
    print(ans)


Measured memory_bytes: 13152
#include <cstdio>
#include <vector>
#include <algorithm>

#define all(v) (v).begin(), (v).end()
using namespace std;

struct Point
{
    int x, y;
};

int main()
{
    int no_of_points, minimum_points;
    scanf("%d %d", &no_of_points, &minimum_points);

    vector <Point> P(no_of_points);
    vector <int> x(no_of_points);
    vector <int> y(no_of_points);

    for(int i = 0; i < no_of_points; i++)
    {
        scanf("%d %d", &P[i].x, &P[i].y);

        x[i] = P[i].x;
        y[i] = P[i].y;
    }

    sort(all(x));
    sort(all(y));

    long long minimum_area = (x[no_of_points - 1] - x[0])*1LL*(y[no_of_points - 1] - y[0]);

    for(int x_i = 0; x_i < no_of_points; x_i++)
    {
        for(int x_j = x_i + 1; x_j < no_of_points; x_j++)
        {
            for(int y_i = 0; y_i < no_of_points; y_i++)
            {
                for(int y_j = y_i + 1; y_j < no_of_points; y_j++)
                {
                    int x_beginning = x[x_i], x_end = x[x_j], y_beginning = y[y_i], y_end = y[y_j];

                    int inside_points = 0;

                    for(int i = 0; i < no_of_points; i++)
                    {
                        inside_points += (x_beginning <= P[i].x && P[i].x <= x_end && y_beginning <= P[i].y && P[i].y <= y_end);
                    }

                    if(inside_points >= minimum_points)
                        minimum_area = min(minimum_area, (x_end - x_beginning)*1LL*(y_end - y_beginning));
                }
            }
        }
    }

    printf("%lld\n", minimum_area);
    return 0;
}


Measured memory_bytes: 384
n,k=map(int,input().split())
d=[int(i) for i in input().split()]
d=set(d)
i=0
while True:
    s=str(n)
    c=0
    for i in s:
        if int(i) in d:
            break
        else:
            c+=1
    if c==len(s):
        print(n)
        exit()
    n+=1

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

int main(){

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

    if(sum>=h) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;



    return 0;
}

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

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << (x) << endl;
#define printv(x) for(int i = 0; i < x.size(); i++){ cout << (x[i]) << " "; } cout << endl; 
#define printa(x) for(int i = 0; i < (sizeof(x)/sizeof(x[0])); i++){ cout << (x[i]) << " ";} cout << endl;
#define printaa(x) for(int i = 0; i < (sizeof(x)/sizeof(x[0])); i++){ for(int j = 0; j < (sizeof(x[0])/sizeof(x[0][0])); j++){ cout << x[i][j] << " ";} cout << endl;}
#define INF (1e9)
typedef long long ll;
typedef struct{
    int x;
    int y;
} P;

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    if(N % 2 == 0){
        print(N);
    }else{
        print(2*N);
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define P pair<ll, ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second
constexpr ll mod = 1000000007;
constexpr ll INF = (1ll << 60);
constexpr double pi = 3.14159265358979323846;
template <typename T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}

int main() {
    string s;
    cin >> s;
    if (s.size() == 2) {
        cout << s << "\n";
    } else {
        reverse(s.begin(), s.end());
        cout << s << "\n";
    }
    return 0;
}

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

using namespace std;

int getside(char c){
	int n = c - '0';
	if(n == 8 || n ==2){
		return 0;
	}
	else if(n % 3 == 0){
		return 1;
	}
	else{
		return -1;
	}
}

int count(string &str, bool preside = true){
	int ans = 0;
	int lastside = getside(str[0]);
	bool rside = preside;
	for(int i = 1; i < str.size(); ++i){
		int nowside = getside(str[i]);
		if(rside && nowside > lastside){
			ans++;
		}
		else if(!rside && nowside < lastside){
			ans++;
		}
		else{
			rside = !rside;
		}
		lastside = nowside;
	}
	//cout << " " << ans << endl;
	return ans;
}


int main(){
	while(true){
		string str; cin >> str;
		if(str == "#")break;
		int ans = min(count(str,true), count(str,false));
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3268
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int sx = Integer.parseInt(sc.next());
        int sy = Integer.parseInt(sc.next());
        int tx = Integer.parseInt(sc.next());
        int ty = Integer.parseInt(sc.next());
        StringBuilder builder = new StringBuilder();
        int dx = tx-sx;
        int dy = ty-sy;
        char xdir = (dx>0)? 'R' : 'L';
        char ydir = (dy>0)? 'U' : 'D';
        char[] xway = new char[Math.abs(dx)];
        char[] yway = new char[Math.abs(dy)];
        Arrays.fill(xway, xdir);
        Arrays.fill(yway, ydir);
        builder.append(xway);
        builder.append(yway);
        Arrays.fill(xway, rev(xdir));
        Arrays.fill(yway, rev(ydir));
        builder.append(xway);
        builder.append(yway);
        
        xway = new char[Math.abs(dx)+1];
        yway = new char[Math.abs(dy)+1];
        Arrays.fill(xway, xdir);
        Arrays.fill(yway, ydir);
        builder.append(rev(ydir));
        builder.append(xway);
        builder.append(yway);
        builder.append(rev(xdir));

        Arrays.fill(xway, rev(xdir));
        Arrays.fill(yway, rev(ydir));
        builder.append(ydir);
        builder.append(xway);
        builder.append(yway);
        builder.append(xdir);
        
        System.out.println(builder.toString());

    }

    public static char rev(char dir){
        char result;
        if(dir=='U'){result= 'D';}
        else if(dir=='D'){result='U';}
        else if(dir=='R'){result='L';}
        else{result='R';}
        return result;
    } 
}

Measured memory_bytes: 25172
#include <iostream>

using namespace std;

int main(){
    string c0;
    string c1;

    cin >> c0 >> c1;

    bool ans =
        (c0[0] == c1[2]) && (c0[1] == c1[1]) && (c0[2] == c1[0]) &&
        (c1[0] == c0[2]) && (c1[1] == c0[1]) && (c1[2] == c0[0]) ;

    cout << (ans ? "YES" : "NO") << endl;

    return 0;
}


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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    int d;
    vector<int> a(n);
    int b;
    int cnt = n;
    for (int i = 0; i < k; i++) {
        cin >> d;
        for (int j = 0; j < d; j++) {
            cin >> b;
            if (a.at(b - 1) == 0) {
                a.at(b - 1) = 1;
                --cnt;
            }
        }
    }
    cout << cnt << '\n';
    return 0;
}

Measured memory_bytes: 3660