akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
const int INF = 1001001001;
const int MOD = 1000000007;
typedef long long ll;

template<typename T> void print(const T & v);


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, M, K;
    cin >> N >> M >> K;
    vector<vector<int>> graph(N);
    vector<int> seen(N, -1);
    vector<int> groups;
    vector<pair<int, int>> friends(M), blocks(K);
    rep(i, M){
        cin >> friends[i].first >> friends[i].second;
        friends[i].first -= 1;
        friends[i].second -= 1;
    }
    rep(i, K){
        cin >> blocks[i].first >> blocks[i].second;
        blocks[i].first -= 1;
        blocks[i].second -= 1;

    }

    rep(i, M){
        int a = friends[i].first;
        int b = friends[i].second;
        graph[a].emplace_back(b);
        graph[b].emplace_back(a);
    }

    int memo = 0;

    auto not_seen_node = [&](){
        for(int i = memo; i < N; i++){
            if(seen[i] == -1){
                return i;
            }
        }
        return -1;
    };

    int start;
    int id = 0;
    while((start = not_seen_node()) != -1){
        memo = start;
        int group = 0;
        queue<int> qe;
        qe.push(start);
        while(!qe.empty()){
            int now = qe.front();
            qe.pop();
            if(seen[now] != -1) continue;
            for(auto next: graph[now]){
                if(seen[next] == -1){
                    qe.push(next);
                }
            }
            seen[now] = id;
            group++;
        }
        groups.emplace_back(group);
        id++;
    }

    vector<int> ans(N);
    for(int i = 0; i < N; i++){
        ans[i] = groups[seen[i]] - 1;
    }

    for(int i = 0; i < M; i++){
        int a = friends[i].first;
        int b = friends[i].second;
        if(seen[a] == seen[b]){
            ans[a] -= 1;
            ans[b] -= 1;
        }
    }
    for(int i = 0; i < K; i++){
        int a = blocks[i].first;
        int b = blocks[i].second;
        if(seen[a] == seen[b]){
            ans[a] -= 1;
            ans[b] -= 1;
        }
    }
    print(ans);
    return 0;
}


// Use For Debug
template <typename T>
void print(T const & v){
    for(int i = 0; i < v.size(); i++){
        if(i) cout << " ";
        cout << v[i];
    }
    cout << endl;
}


Measured memory_bytes: 9080
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define fo for(int i=0;i<n;i++)
#define clear cin.clear();cin.ignore(numeric_limits<streamsize>::max(), '\n');
#define loopSolve int t; cin>>t; while(t--){solve();}
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

//INT_MAX         2,147,483,647                       <10^10
//U_INT_MAX       4,294,967,295                       <10^10
//LONG_LONG_MAX   9,223,372,036,854,775,807           <10^18
//U_LONG_LONG_MAX 18,446,744,073,709,551,615          <10^18
//ll power(int a, int b){
//    return (ll)(pow(a,b)+0.5);
//}

vector<int> gV(int n){
    vector<int> v(n);
    fo { cin>>v[i];  }
    return v;
}

int* gA(int n){
    int* arr = new int[n];
    fo cin>>arr[i];
    return arr;
}

void solve(){
    int n; cin>>n;
    int* prices = gA(n);
    ll profit=1000,low,high;

    for(int i=0;i<n-1;i++){
        if(prices[i]<prices[i+1]){
            low=prices[i];
            while(i<n-1 && prices[i]<prices[i+1])
                i++;
            high=prices[i];
            ll bought=profit/low;
            profit-=(bought*low);
            ll sold=bought*high;
            profit+=sold;
        }
    }

    cout<<profit<<endl;
}


int main() {
	ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    std::cout.tie(NULL);

    solve();
    //loopSolve;

	return 0;
}


Measured memory_bytes: 3608
macro_rules! scan_sub {
    ( $itr:ident, $t:ty ) => {
        let mut buf = String::new();
        let $itr = {
            while buf.trim().len() == 0 {
                buf = String::new();
                std::io::stdin().read_line(&mut buf).unwrap();
            }
            buf.split_whitespace().map(|n| n.parse::<$t>().unwrap())
        };
    };
}

macro_rules! scan {
    ( $x:ident; Vec<$t:ty> ) => {
        scan_sub!(itr, $t);
        let $x = itr.collect::<Vec<_>>();
    };
    ( $( $x:ident ),*; $t:ty ) => {
        scan_sub!(itr, $t);
        let mut itr = itr;
        $(
            let $x = itr.next().unwrap();
        )*
    };
}

fn main() {
    scan!(k, _n; usize);
    scan!(array; Vec<usize>);

    let mut now = 0;
    let mut max = 0;
    // let mut sum = 0;
    let mut _intervals = array.iter().map(|&a| {
        let res = a - now;
        now = a;
        if max < res { max = res; }
        // sum += res;
        res
    }).collect::<Vec<_>>();

    let t = (k + array[0]) - now;
    if max < t { max = t; }
    // sum += t;
    _intervals.push(t);

    // println!("{:?}", intervals);
    println!("{}", k - max);
}


Measured memory_bytes: 13560
/*17D8103001E Fukushima Emi persimmon8 c++ 19.10.31*/

#include<iostream>
#include<vector>
using namespace std;

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

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

  for(int i=0;i<m;i++){
    if(a[b[i]-1]==2019){}
    else if(a[b[i]-1]+1==a[b[i]]){}
    else{
      a[b[i]-1]++;

    }
  }

  for(int x:a) cout<<x<<endl;

  return 0;
}



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

int main() {
    ll n;
    cin >> n;
    int d = 0;
    ll last_sum = 0;
    for (int i = 1; i <= 11; i++) {
        last_sum += pow(26, i);
        if (last_sum + 1 <= n) {
            d = i;
        } else {
            last_sum -= pow(26, i);
            break;
        }
    }
    ll k = n - last_sum;

    string name = "";
    ll index_sub = k - 1;
    for (int i = 0; i < d + 1; i++) {
        ll q = index_sub / 26;
        ll r = index_sub % 26;
        index_sub = q;
        name += r + 'a';
    }

    reverse(name.begin(), name.end());
    cout << name;
    return 0;
}

Measured memory_bytes: 4104
from collections import defaultdict

N = int(input())
S = input()

M = 10**9 + 7
count_dict = defaultdict(int)

for s in S:
    count_dict[s] += 1

ans = 1
for v in count_dict.values():
    ans *= (v + 1)
    ans %= M

print(ans - 1)

Measured memory_bytes: 3444
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	ll x; int p; cin>>x>>p;
	ld ans = 0;
	ll z = (x+1)/2;
	ans = z;
	ld tt = ld(100)/ld(p);
	ans = ld(z)*ld(tt);
	cout<<fixed<<setprecision(10)<<ans<<'\n';
}


Measured memory_bytes: 384
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	class Pair{
		public int V,Idx;
		public Pair(int v, int idx){
			V = v; Idx = idx;
		} 
	}
	
	public void Solve(){
		
		Pair[] P = new Pair[N-1];
		for(int i=0;i<N-1;i++){
			P[i] = new Pair(B[i], i);
		}
		
		Array.Sort(P, (p, q) => p.V.CompareTo(q.V));
		
		long[] A = new long[N];
		long Inf = (long) 1e18;
		for(int i=0;i<N;i++) A[i] = Inf;
		for(int i=0;i<N-1;i++){
			int pos = P[i].Idx;
			long v = P[i].V;
			A[pos] = Math.Min(A[pos], v);
			A[pos + 1] = Math.Min(A[pos + 1], v);
		}
		long tot = 0;
		for(int i=0;i<N;i++) tot += A[i];
		Console.WriteLine(tot);
		
		
		
	}
	int N;
	int[] B;
	public Sol(){
		N = ri();
		B = ria();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


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

int main() {
  string s; cin >> s;
  rep(i, 10){
    string t;
    rep(j,i){
      t += "hi";
    }
    if (t == s) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std; 
typedef long long ll;
typedef long double ld;
#define pb push_back
#define fi first
#define se second
const ll mod = 1e9+7;
const int N = 1e6+5;
void solve(){
	string a,b; 
	cin>>b>>a; 
	sort(a.begin(),a.end());
	reverse(a.begin(),a.end());
	sort(b.begin(),b.end());
	if(b<a){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t=1; 
//	cin>>t; 
	while(t--){
		solve();
	}
	return 0;
}


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

const ll MOD = 1000000007;
ll dp[100010][13];

int main() {
    string s; cin >> s;
    reverse(s.begin(), s.end());

    for (int i = 0; i < 100010; ++i) {
        for (int j = 0; j < 13; ++j) {
            dp[i][j] = 0;
        }
    }

    dp[0][0] = 1;
    // for (int i = 0; i <= s.size(); ++i) {
    //     for (int j = 0; j < 13; ++j) {
    //         if (s[i] == '?') {
    //             for (int k = 0; k <= 9; ++k) {
    //                 dp[i + 1][(j * 10 + k) % 13] += dp[i][j];
    //                 dp[i + 1][(j * 10 + k) % 13] %= MOD;
    //             }
    //         } else {
    //             int k = s[i] - '0';
    //             dp[i + 1][(j * 10 + k) % 13] += dp[i][j];
    //             dp[i + 1][(j * 10 + k) % 13] %= MOD;
    //         }
    //     }
    // }

    int digit = 1;
    for (int i = 0; i < s.size(); ++i) {
        if (s[i] == '?') {
            for (int j = 0; j < 13; ++j) {
                for (int k = 0; k < 10; ++k) {
                    // dp[i + 1][(j * 10 + k) % 13] += dp[i][j];
                    // dp[i + 1][(j * 10 + k) % 13] %= MOD;
                    dp[i + 1][(j + digit * k) % 13] += dp[i][j];
                    dp[i + 1][(j + digit * k) % 13] %= MOD;
                }
            }
        } else {
            for (int j = 0; j < 13; ++j) {
                int k = s[i] - '0';
                // dp[i + 1][(j * 10 + k) % 13] += dp[i][j];
                // dp[i + 1][(j * 10 + k) % 13] %= MOD;
                dp[i + 1][(j + digit * k) % 13] += dp[i][j];
                dp[i + 1][(j + digit * k) % 13] %= MOD;
            }
        }
        digit *= 10;
        digit %= 13;
    }

    cout << dp[s.size()][5] << endl;
    return 0;
}

Measured memory_bytes: 10624
#include<bits/stdc++.h>
#include <queue>
using namespace std;
int main(){
	long long int a,b,c,d;
	cin>>a;
	queue <long long int> qq;
	for(int i=1;i<=9;i++)qq.push(i);
	while(a--){
	b=qq.front();
	qq.pop();
	c=b%10;
	if(c>0)qq.push(b*10+c-1);
	qq.push(b*10+c);
	if(c<9)qq.push(b*10+c+1);
	}
	cout<<b;
	return 0;
}

Measured memory_bytes: 1792
//Created by Kira

#include<bits/stdc++.h>
using namespace std;

#define IOS cin.sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pii pair<int,int> 
#define pb push_back
#define vi vector<int> 
using ll = long long;

const int mod = 1e9 + 7;

ll pwr(ll a, ll b);
    



int main(){
   IOS

   int n; cin>>n;

   vector<ll> a(n), b(n);
   for(int i = 0; i < n; i++)cin>>a[i]>>b[i];

   sort(all(a));
   sort(all(b));

   if(n & 1){
       ll mn = a[n/2];
       ll mx = b[n/2];
       cout<<(mx-mn + 1)<<"\n";
   }else{
       ll mn = (a[(n/2) - 1] + a[n/2]);
       ll mx = (b[(n/2) - 1] + b[n/2]);
       cout<<(mx - mn + 1)<<"\n";
   }

    







}

ll pwr(ll a, ll b){
   a %= mod;	//Remove mod if not required
   ll res = 1;
   while(b > 0){
    if(b&1)
        res = res * a % mod;
        a = a * a % mod;
    b >>= 1;
    }

    return res;
}



Measured memory_bytes: 6356
array = []
del_list = []

h,w = map(int, input().split())
for i in range(h):
  x = input()
  if "#" in x:
    y = list(x)
    array.append(y)
for i in range(w):
  for j in range(len(array)):
    if array[j][i] == "#":
      break
    else:
      if j == len(array)-1:
        del_list.append(i)
final_del_list = del_list[::-1]
for i in final_del_list:
  for j in range(len(array)):
    del array[j][i]
for i in range(len(array)):
    z = "".join(array[i])
    print(z)

Measured memory_bytes: 3188
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val n = sc.nextInt()
    var ans = 1L
    for (i in 1..n) {
        ans *= i
        ans %= 1000000007
    }
    println(ans)
}

fun main(args: Array<String>) {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}


Measured memory_bytes: 29352
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <cassert>
#include <random>
using namespace std;
using ll = long long;


int main() {
	int n; cin >> n;
	vector<int> w(n);
	int s = 0;
	for (int i = 0; i < n; i++) {
		cin >> w[i];
		s += w[i];
	}
	int c = 0, ans = 1e9;
	for (int i = 0; i < n; i++) {
		c += w[i];
		ans = min(ans, abs(2 * c - s));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
using System;

class MainClass {
    static void Main() {
        Scanner cin=new Scanner();

        int N=cin.nextInt();

        Console.WriteLine(N*(N+1)/2);
    }
}

class Scanner {
    string[] buf;
    int i;
    char[] SplitChar=new char[] {' '};
    public Scanner() {
        buf = new string[0];
        i = 0;
    }
    public string next() {
        if (i < buf.Length) return buf[i++];

        string tmp=Console.ReadLine();
        while (tmp == "")
            tmp = Console.ReadLine();

        buf = tmp.Split(SplitChar, StringSplitOptions.RemoveEmptyEntries);
        i = 0;
        return buf[i++];
    }
    public int nextInt() {
        return int.Parse(next());
    }
    public long nextLong() {
        return long.Parse(next());
    }
    public double nextDouble() {
        return double.Parse(next());
    }
}


Measured memory_bytes: 2648
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @author Pavel Mavrin
 */
public class Main {

    private void solve() throws IOException {
        int n = nextInt();
        int m = nextInt();
        int[] c = new int[26];
        for (int i = 0; i < n; i++) {
            String s = next();
            for (int j = 0; j < m; j++) {
                c[s.charAt(j) - 'a']++;
            }
        }
        int[] k = new int[4];
        for (int i = 0; i < c.length; i++) {
            k[c[i] % 4]++;
        }
        if (n % 2 == 1 && m % 2 == 1) {
            if (k[1] > 0) {
                k[1]--;
                k[0]++;
            } else if (k[3] > 0) {
                k[3]--;
                k[2]++;
            } else {
                out.println("No");
                return;
            }
        }
        int kk = 0;
        if (n % 2 == 1) {
            kk += m / 2;
        }
        if (m % 2 == 1) {
            kk += n / 2;
        }
//        System.out.println(kk + " " + Arrays.toString(k));
        for (int i = 0; i < kk; i++) {
            if (k[2] > 0) {
                k[2]--;
                k[0]++;
            } else if (k[0] > 0) {
                k[0]--;
                k[2]++;
            } else {
                out.println("No");
                return;
            }
        }
        if (k[0] != 26) {
            out.println("No");
            return;
        }
        out.println("Yes");
    }

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

    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st;
    PrintWriter out = new PrintWriter(System.out);

    String next() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }

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

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    private void run() throws IOException {
        solve();
        out.close();
    }

}


Measured memory_bytes: 22612
import java.util.Scanner;

public class Main {
    private static boolean check(long a, long b, long c) {
        if (c - a - b < 0) {
            return false;
        }
        return (c - a - b) * (c - a - b) > 4 * a * b;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long a = in.nextInt();
        long b = in.nextInt();
        long c = in.nextInt();

        System.out.println(check(a,b,c) ? "Yes" : "No");
    }
}


Measured memory_bytes: 24404
import java.util.Arrays;
import java.util.Scanner;

//Finding the Top RPS Player
public class Main{

	void run(){
		Scanner sc = new Scanner(System.in);
		for(int T=1;;T++){
			int N = sc.nextInt(), M = sc.nextInt();
			if((N|M)==0)break;
			int[][] c = new int[2][M+1];
			c[0][0] = N;
			for(int x=1,t=1;;t++,x=1-x){
				Arrays.fill(c[x], 0);
				for(int i=0;i<M;i++){
					c[x][i+1]+=c[1-x][i]/2;
					c[x][0]+=c[1-x][i]/2;
					if(c[1-x][i]%2!=0)c[x][i]++;
				}
				if(c[x][M]!=0){
					System.out.println("Case "+T+": "+t); break;
				}
			}
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 12000
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
			　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <iostream>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <memory>
#include <iomanip>
#include <type_traits>

#define rep(i, n) for(Int (i) = 0; (i) < (n); ++(i))
#define all(n) std::begin(n), std::end(n)
#define debug(var) std::cout << #var << ": " << var << "\n"
using Int = int64_t;
constexpr Int INF = INT_MAX;
constexpr Int mod = 1e9 + 7;

Int N, M, Q;
std::vector<std::vector<Int>> choice;

void dfs(std::vector<Int>& A, Int cnt) {
	if (cnt + 1 == N) {
		choice.push_back(A);
		return;
	}
	rep(i, M) {
		auto tmp = A;
		if (tmp.back() <= i + 1) {
			tmp.push_back(i + 1);
			dfs(tmp, cnt + 1);
		}
	}
}


void calc() {

	std::cin >> N >> M >> Q;
	std::vector<Int> A = { 1 };
	std::vector<Int> a(Q), b(Q), c(Q), d(Q);
	rep(i, Q)std::cin >> a[i] >> b[i] >> c[i] >> d[i];
	dfs(A, 0);
	Int ans = -INF;
	rep(i, choice.size()) {
		auto& vec = choice[i];
		Int res = 0;
		rep(i, Q) {
			if (vec[b[i] - 1] - vec[a[i] - 1] == c[i])res += d[i];
		}
		ans = std::max(ans, res);
	}
	if (ans == -INF)ans = 0;
	std::cout << ans;

}


int main() {

	calc();

	return 0;
}

Measured memory_bytes: 9096
#include <bits/stdc++.h>
 
#define int long long 
#define MOD 1000000007
 
using namespace std;
 
signed main(){
 

    int a,b,c;

    cin >> a>>b>>c;

   int x = b/a;

   if(x<c){
       cout <<x <<endl;
   } 

    else{
        cout <<c<<endl;
    }

 	return 0;
 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int v,n;char f[5050],a[5050],b[5050];
char c[5050];
void init()
{
	cin>>c>>f>>a;
	cout<<c[0]<<f[1]<<a[2]<<endl;
}
int main()
{
	init();
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

#define rep(i,a,b) for(int i=a;i<b;i++)

const int inf = 1001001000;
const int mod = 1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(){
    int n,m;
    cin >> n;
    map<string,int> mp;

    while(n--){
        string s;
        cin >> s;
        if(mp.find(s) == mp.end()){
            mp.insert(make_pair(s,1));
        }else{
            mp[s] = mp[s] + 1;
        }
    }

    cin >> m;
    while(m--){
        string s;
        cin >> s;
        if(mp.find(s) != mp.end()){
            mp[s] = mp[s] -1;
        }
    }
    int ans = 0;

    for(auto e: mp){
        ans = max(ans,e.second);
    }
    cout << ans << endl;

    
}


Measured memory_bytes: 256
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    //nextLineとnextを同時に使ったら死ぬ
    val sc = new Scanner(System.in)
    val x, t = sc.nextLong()
    println(math.max(x - t, 0))
  }

  def debug(args: Any*): Unit = {
    Console.err.println(args.mkString(" "))
  }
}


Measured memory_bytes: 27072
#include <bits/stdc++.h>
using namespace std;
int n,u,v;
vector<vector<int>> t(100005);
int main(void){
    //
    cin>>n>>u>>v;u--;v--;
    for(int i=0;i<n-1;i++){
        int a,b;cin>>a>>b;a--;b--;
        t[a].push_back(b);t[b].push_back(a);
    }
    queue<int> que;
    que.push(u);
    bool jud[n];
    fill(jud,jud+n,false);
    int a[n],b[n];//aは高橋君の初期位置からの距離,bは青木君の初期位置からの距離
    a[u]=0;jud[u]=true;
    //bfs2回でそれぞれa,bを埋めていく
    while(que.size()>0){
        int x=que.front();que.pop();
        for(int i=0;i<t[x].size();i++){
            int y=t[x][i];
            if(jud[y])continue;
            que.push(y);
            jud[y]=true;
            a[y]=a[x]+1;
            //if(x==u)cout<<y<<endl;
        }
    }
    b[v]=0;
    fill(jud,jud+n,false);
    que.push(v);
    jud[v]=true;
    while(que.size()>0){
        int x=que.front();que.pop();
        for(int i=0;i<t[x].size();i++){
            int y=t[x][i];
            if(jud[y])continue;
            que.push(y);
            jud[y]=true;
            b[y]=b[x]+1;
        }
    }
    //a[i]<b[i]を満たす頂点iの中で最もb[i]が大きい頂点が答え
    int res=0;
    for(int i=0;i<n;i++){
        if(b[i]>a[i]){
            res=max(res,b[i]);
        }
    }
    if(res==2&&a[v]==2){
        res=1;
    }else{
        res--;
    }
    cout<<res<<endl;
}

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

using namespace std;

int main()
{
    int n,d,x,ans;
    cin>>n>>d>>x;
    ans = 0;
    while(n--){
        int a;
        cin>>a;
        ans += ((d-1)/a + 1);
    }
    cout<<ans+x<<endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
mod = 10**9 + 7
import collections
import numpy as np
import sys
count = collections.Counter(A)
loops = np.arange(N-1,-1,-2)

for li in list(loops):
    if li == 0 :
        if count[li] != 1:break
    else:
        if count[li] != 2:break

else:
    b = N//2
    ans = 1
    for i in range(1,b+1):
        ans *= 2
        ans %= mod
    print(ans)   
    sys.exit()

print(0)

Measured memory_bytes: 22408
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define SPEED ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define RFOR(i, b, a) for (ll i = b; i >= a; --i)
#define ALL(x) x.begin(), x.end()
#define DEBUG(args...) { string _s = #args; replace(ALL(_s), ' ', '\0');\
replace(ALL(_s), ',', ' ');\
stringstream _ss(_s); istream_iterator<string> _it(_ss); _debug(_it, args);}
#define endl "\n"
#define F first
#define S second
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y)

using namespace std;
using namespace __gnu_pbds;

template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void _debug(istream_iterator<string>) {}
template<typename T, typename... Args>
void _debug(istream_iterator<string> it, T first, Args... args) {
    cerr << ">> " << *it << " : " << first << endl; _debug(++it, args...);
}
template <typename T1, typename T2>
inline ostream& operator << (ostream& out, const pair<T1, T2>& p) {
    return out << "(" << p.F << ", " << p.S << ")";
}
template<typename T>
inline ostream& operator << (ostream& out, const vector<T>& v) {
    if (v.empty()) return out << "[]";
    else { out << '['; for (auto& e : v) { out << e << ", "; } return out << "\b\b]"; }
}
template<typename T>
inline ostream& operator << (ostream& out, const set<T>& s) {
    if (s.empty()) return out << "{}";
    else { out << '{'; for (auto& e : s) { out << e << ", "; } return out << "\b\b}"; }
}
template<typename T>
inline ostream& operator << (ostream& out, const unordered_set<T>& s) {
    return out << set<T>(ALL(s));
}
template<typename T1, typename T2>
inline ostream& operator << (ostream& out, const map<T1, T2>& m) {
    if (m.empty()) return out << "{}";
    out << '{'; for (auto& p : m) { out << p << ", "; } return out << "\b\b}";
}
template<typename T1, typename T2>
inline ostream& operator << (ostream& out, const unordered_map<T1, T2>& m) {
    return out << map<T1, T2>(ALL(m));
}
template<typename T>
inline ostream& operator << (ostream& out, const ordered_set<T>& s) {
    return out << set<T>(ALL(s));
}

typedef long long ll;
typedef long double ld;
typedef vector<long long> vll;
typedef pair<ll, ll> pll;
typedef vector<pair<ll, ll>> vpll;
typedef unordered_map<ll, ll> STll;
/************************************** MAIN PROGRAM ********************************************/

int main()
{
   // freopen("input.txt", "r", stdin);
    SPEED
    ll x;
    cin >> x;
    int big = x / 500;
    x %= 500;
    int small = x / 5;
    int ans = big * 1000 + small * 5;
    cout << ans;
}
/************************************** END OF PROGRAM ******************************************/
/** Stuff you should look for:
 * int overflow, array bounds, over-counting
 * special cases (n=1?), set/unordered_set TLE, multi-set/set error
 * do something instead of nothing and stay organized
 */


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
 
using namespace std;
 
int main() {
    int i,j;
    string t, buf;
    int count=0;
    
    cin >> t;
    //??則??????????????????????属????????????即"END_OF_TEXT"??則??蔵???????????????
    transform (t.begin(), t.end(), t.begin(), ::toupper);
    while(1){
        cin >> buf;
        //Exit conditions (???????????贈??即???????????即?属??????????end_of_text??則??蔵??????)
        if(buf == "END_OF_TEXT") break;
        
        //??則??????????????????
        transform (buf.begin(), buf.end(), buf.begin(), ::toupper);
 
        if(t == buf) count++;
    }
    
    cout << count << endl;
        
        return 0;
}

Measured memory_bytes: 1196
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
#include <cassert>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 998244353;
const ll MAX = 4000001;
const double eps = 1E-18;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

mint pw(mint a, ll b) {
	if (b == 0) { return 1; }
	mint ret = pw(a, b >> 1);
	ret *= ret;
	if (b & 1) { ret *= a; }
	return ret;
}

typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;

typedef vector<mint> vmint;
typedef vector<vector<mint>> vvmint;
typedef vector<vector<vector<mint>>> vvvmint;

//////////////////////////////////////

int main(){
	ll N;
	double d;
	cin >> N >> d;
	ll ans = 0;
	repn(i, N) {
		double x, y;
		cin >> x >> y;
		if (x * x + y * y <= d * d) { ans++; }
	}

	cout << ans << endl;
}



Measured memory_bytes: 3780
def prime(a):
    prime = []
    for p in range(2, a+1):
        if a % p == 0:
            prime.append(p)
            while a % p == 0:
                a /= p
    return prime

def keynumber(prime):
    sum = 0
    for i in range(len(prime) - 1):
        sum += prime[i]
    key = prime[-1] - sum
    return key

while 1:
    ab = raw_input().split()
    a = int(ab[0])
    b = int(ab[1])
    if a == 0 and b == 0:
        break
    pa = prime(a)
    pb = prime(b)
    ka = keynumber(pa)
    kb = keynumber(pb)
    if ka > kb:
        print('a')
    else:
        print('b')

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

typedef long long ll;
const ll InF = 1e15;

int main() {
  string S;
  cin>>S;
  ll K;
  cin>>K;
  int onelen = 0;
  int res = 1;
  for (int i = 0; i < S.size(); i++) {
    if (S[i] != '1') {
      res = S[i] - '0';
      break;
    }
    onelen++;
  }
  if (onelen >= K) cout<<1<<endl;
  else cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(read())
if n % 2 == 1:
    print(0)
    exit()
cnt = 0
n //= 2
while n:
    n //= 5
    cnt += n
print(cnt)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef long long LD;
typedef pair<int,int> PII;
const int N=5001;
const int M=2*N;
const LL MOD1=98764321261LL;
const LL MOD=998244353LL;

inline int lowbit(int x){
    return x&(-x);
}

inline LL addmod(LL x,LL y){
    x+=y;
    if(x>=MOD)x-=MOD;
    return x;
}

struct fenwick {
    LL a[N];
    int n;
    void init(int n){
        for(int i=0;i<=n;++i)
            a[i]=0;
        this->n=n;
    }
    void add(int x,LL v) {
        for(int i=x;i<=n;i+=lowbit(i))
            a[i]+=v;
    }
    LL query(int x) {
        LL ret=0;
        for(int i=x;i;i^=lowbit(i))
            ret+=a[i];
        return ret;
    }
    void rangeadd(int l,int r,LL v) {
        add(l,v);
        add(r+1,-v);
    }
    LL rangequery(int l,int r) {
        l=max(l,1);
        r=min(r,n);
        if(r<l)return 0;
        LL ret=query(r);
        ret-=query(l-1);
        return ret;
    }
};

inline LL powmod(LL x,LL y,LL MOD){
    LL ret=1;
    while(y){
        if(y&1LL)ret=ret*x%MOD;
        x=x*x%MOD;
        y=y>>1;
    }
    return ret;
}

struct graph{
    int head[N],next[M],to[M];
    int tot;
    inline void init(int n){
        for(int i=0;i<=n;++i)
            head[i]=-1;
        tot=0;
    }
    inline void addedge(int x,int y){
        to[tot]=y;
        next[tot]=head[x];
        head[x]=tot;
        ++tot;
    }
};

struct point{
    LD x,y;
    point(){}
    point(LD x,LD y):x(x),y(y){}

    void read(){
        scanf("%lld%lld",&x,&y);
    }

    point operator + (const point &rhs)const{
        return point(x+rhs.x,y+rhs.y);
    }

    point operator - (const point &rhs)const{
        return point(x-rhs.x,y-rhs.y);
    }

    LD operator ^ (const point &rhs)const{
        return x*rhs.y-y*rhs.x;
    }

    bool operator < (const point &rhs)const{
        if(y!=rhs.y)return y<rhs.y;
        return x<rhs.x;
    }
};

LL phi(LL x)
{
    LL res=x;
    for(LL i=2;i*i<=x;++i)
    {
        if(x%i==0)
        {
            res=res/i*(i-1);
            while(x%i==0) x/=i;
        }
    }
    if(x>1) res=res/x*(x-1);
    return res;
}


int n,m,k,a[N];
LL f[N];

int main(){
    int cases=1;
    //init();
    //scanf("%d",&cases);
    for(int iii=1;iii<=cases;++iii){
        scanf("%d%d",&n,&m);
        LL ans=0;
        f[0]=0;
        for(int i=0;i<n;++i){
            int x;
            scanf("%d",&x);
            if(x>m)continue;
            if(x==m){
                ans=addmod(ans,(i+1)*(n-i));
                continue;
            }
            ans=addmod(ans,f[m-x]*(n-i)%MOD);
            for(int j=m-x;j>0;--j){
                f[j+x]=addmod(f[j+x],f[j]);
            }
            f[x]=addmod(f[x],i+1);
        }
        printf("%lld\n",ans);
    }



}
/*
1
4 8
1 2 1
2 3 1
3 4 1
4 1 1
1 2 2
2 3 2
3 4 2
4 1 2
*/


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

int main() {
    int N;
    cin >> N;
    vector<int> vec(N, 0);
    rep(i, N - 1) {
        int A;
        cin >> A;
        vec[A - 1] += 1;
    }
    rep(i, N) cout << vec[i] << endl;
    return 0;
}

Measured memory_bytes: 4052
import math
a,b,h,m=map(int,input().split())

h1=h*30+0.5*m
m1=6*m

if h1 >= m1:
    c=h1-m1
    if c >=180:
        c=360-c
else:
    c=m1-h1
    if c >=180:
        c=360-c

rad=math.radians(c)

x=a**2+b**2-2*a*b*math.cos(rad)
x=math.sqrt(x)
print(x)

Measured memory_bytes: 9576
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
#define UNSOLVED -1
#define CORRECT   0
#define WRONG	    1

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

struct TEAM{
	int tid;	// チームのID
	int ac;	// 正解数
	int sum_pa;	// トータルのペナルティー
	int st[12];	// 問題の状態	UNSOLVED CORRECT WRONG
	int wa[12];	// 各問題の誤答数
	int pa[12];	// 各問題のペナルティー

	bool operator<( const TEAM & right ) const {
		return (ac != right.ac ? ac > right.ac : ( sum_pa != right.sum_pa ? sum_pa < right.sum_pa : tid < right.tid ) );
	} 
};

	
int main()
{
	ios_base::sync_with_stdio(0);
	int T, P, R;	// T: 参加チーム数 P: 問題数 R: レコード数
	while (cin >> T >> P >> R, T ){
		TEAM t[T];
		rep (i, T ){
			t[i].tid = i+1, t[i].ac = 0, t[i].sum_pa = 0;
			rep (j, P ) t[i].st[j] = UNSOLVED, t[i].wa[j] = 0, t[i].pa[j] = 0;
		} // end rep
		rep (i, R ){
			int tid, pid, tm; string mes;
			cin >> tid >> pid >> tm >> mes;
			tid--; pid--;
			if (mes == "WRONG" ){
				t[tid].wa[pid]++;
				t[tid].st[pid] = WRONG;
			}else{	// mes == "CORRECT"
				t[tid].st[pid] = CORRECT;
				t[tid].pa[pid] = t[tid].wa[pid]*1200 + tm;
			} // end if
		} // end rep
		rep (i, T ){
			rep (j, P ){
				if (t[i].st[j] == CORRECT ){
					t[i].ac++;
					t[i].sum_pa += t[i].pa[j];
				} // end if
			} // end rep
		} // end rep
		sort (t, t+T );
		rep (i, T ){
			cout << t[i].tid << ' ' << t[i].ac << ' ' << t[i].sum_pa << endl;
		} // end rep
	} // end while
	
	return 0;
}

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

int main() {
int N;
  cin >> N;
vector<int> A(N);
  for (int i=0; i<N; i++){
   cin >> A[i];
  }
  sort(A.begin(), A.end());
  
  string ans="YES";
  
  for (int i=0; i<N-1; i++){
   if (A[i]==A[i+1]) ans="NO";
  }
  
  cout << ans << endl;  
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/dynamic_bitset.hpp>
namespace adaptor = boost::adaptors;
using index_t = std::size_t;

namespace lib
{
	using graph_t = std::vector<std::set<index_t>>;
	template<class T>using weighted_graph_t = std::vector<std::map<index_t, T>>;

	struct max_t
	{
		template<class T>constexpr T operator()(T const& lhs, T const& rhs)const
		{
			return std::max(lhs, rhs);
		}
	};
	struct min_t
	{
		template<class T>constexpr T operator()(T const& lhs, T const& rhs)const
		{
			return std::min(lhs, rhs);
		}
	};

	constexpr max_t max;
	constexpr min_t min;

	template<class T>auto order_by(T func)
	{
		return [=](auto&& lhs, auto&& rhs)
		{
			return func(lhs) < func(rhs);
		};
	}

	template<class T>constexpr auto max_v = std::numeric_limits<T>::max();
	template<class T>constexpr auto min_v = std::numeric_limits<T>::min();

	template<class T>using p_queue = std::priority_queue<T, std::vector<T>, std::greater<>>;
}

int count(std::int64_t& N, std::int64_t p)
{
	std::int64_t q = p;
	for (auto i : boost::irange(100))
	{
		if (N % q != 0)
		{
			while (N % p == 0)
			{
				N /= p;
			}
			return i;
		}
		N /= q;
		q *= p;
	}
	return 100;
}

void Main()
{
	std::int64_t N;
	std::cin >> N;
	int result = count(N, 2);
	for (std::int64_t p = 3; p * p <= N; p += 2)
	{
		result += count(N, p);
	}
	if (N != 1)
	{
		++result;
	}
	std::cout << result << std::endl;

}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

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

signed main() {
	long long ans = 0;
	int r, g, b;
	int n;
	cin >> r >> g >> b >> n;
	for (int i = 0; i < 3001; ++i) {
		for (int j = 0; j < 3001; ++j) {
			int res = n - (r * i + g * j);
			if (res >= 0 && res % b == 0)++ans;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<algorithm>
#include<math.h>

using namespace std;

class Point {
public:
	double x, y;

	Point() {
		x = y = 0;
	}
};

Point Circle, Triangle[3];
double Radius, ShortestDist[3], DistanceOfPointToPoint[3];
bool isCirclePointInsideTriangleFlag;


bool isCirclePointInsideTriangle() {
	Point vecMA, vecMB, vecMC;
	double a, b, c;

	vecMA.x = Circle.x - Triangle[0].x;
	vecMA.y = Circle.y - Triangle[0].y;
	vecMB.x = Circle.x - Triangle[1].x;
	vecMB.y = Circle.y - Triangle[1].y;
	vecMC.x = Circle.x - Triangle[2].x;
	vecMC.y = Circle.y - Triangle[2].y;

	a = vecMA.x * vecMB.y - vecMA.y * vecMB.x;
	b = vecMB.x * vecMC.y - vecMB.y * vecMC.x;
	c = vecMC.x * vecMA.y - vecMC.y * vecMA.x;

	if ((a <= 0 && b <= 0 && c <= 0) || (a >= 0 && b >= 0 && c >= 0)) {
		return true;
	}	
	return false;
}

//distanceOfp1Top2
double calculationDistanceByPointToPoint(const Point& p1, const Point&p2) {
	return sqrt((p1.x - p2.x)*(p1.x - p2.x) + (p1.y - p2.y)*(p1.y - p2.y));
}

bool bothLess90Degree(const Point &a, const Point &b, const Point &c)
{
	return ((a.x - b.x)*(c.x - b.x) + (a.y - b.y)*(c.y - b.y)) > 0;
}

//distanceOfp1ToLine(p2,p3)
double calculationDistanceByPointToLine(const Point& p1, const Point&p2, const Point&p3) {
	double k, b;

	if (bothLess90Degree(p1, p2, p3) && bothLess90Degree(p1, p3, p2)) {
		if (p2.x == p3.x) {
			return fabs(p1.x - p2.x);
		}

		k = (p3.y - p2.y) / (p3.x - p2.x);
		b = p2.y - k * p2.x;

		return ((fabs(k*p1.x - p1.y + b)) / sqrt(k*k + 1));
	}

	return min(calculationDistanceByPointToPoint(p1, p2), calculationDistanceByPointToPoint(p1, p3));
}

bool isB() {
	for (int i = 0; i < 3; i++) {
		if (DistanceOfPointToPoint[i] > Radius) {
			return false;
		}
	}
	return true;
}

bool isA() {
	for (int i = 0; i < 3; i++) {
		if (ShortestDist[i] < Radius) {
			return false;
		}
	}

	if (isCirclePointInsideTriangleFlag) {
		return true;
	}
	return false;
}

bool isD() {
	for (int i = 0; i < 3; i++) {
		if (ShortestDist[i] < Radius) {
			return false;
		}
		if (fabs(ShortestDist[i] - Radius) < 1e-10) {
			return false;
		}
	}

	if (isCirclePointInsideTriangleFlag) {
		return false;
	}
	return true;
}

void solve() {

	//distanceOfCirclePointToTrianglePoint
	for (int i = 0; i < 3; i++) {
		DistanceOfPointToPoint[i] = calculationDistanceByPointToPoint(Circle,Triangle[i]);
	}
	if ( isB() ) {
		cout << "b" << endl;
		return;
	}


	for (int i = 0; i < 3; i++) {
		ShortestDist[i] = calculationDistanceByPointToLine(Circle, Triangle[i], Triangle[(i+1)%3]);
	}
	if( isA() ){
		cout << "a" << endl;
		return;
	}
	if (isD()) {
		cout << "d" << endl;
		return;
	}

	cout << "c" << endl;
}


int main() {

	while (true) {
		cin >> Triangle[0].x >> Triangle[0].y;
		if (Triangle[0].x == 0 && Triangle[0].y == 0) {
			break;
		}
		for (int i = 1; i < 3; i++) {
			cin >> Triangle[i].x >> Triangle[i].y;
		}
		cin >> Circle.x >> Circle.y >> Radius;

		isCirclePointInsideTriangleFlag = isCirclePointInsideTriangle();
		solve();
	}

	return 0;
}



Measured memory_bytes: 3152
n = int(input())

a = list(map(int,input().split()))
a_max = max(a)
a_min = min(a)
if a_max > a_min+1:
    print('No')
    exit()
k = a_max
if a_max == a_min:
    if k == n-1 or 2*k <= n:
        print('Yes')
    else:
        print('No')
else:
    uni = a.count(k-1)
    if k >= uni + 1 and k <= uni + (n-uni)//2:
        print('Yes')
    else:
        print('No')

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

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

    vector<int> A(N, 0);
    for (int i = 0; i < N; i++) {
        scanf("%d", &A.at(i));
    }
    int MIN = A.at(0);
    int MAX = A.at(0);
    for (int i = 1; i < N; i++) {
        if (A.at(i) > MAX) {
            MAX = A.at(i);
        } else if (A.at(i) < MIN) {
            MIN = A.at(i);
        }
    }
    printf("%d", MAX - MIN);
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();

		int wMax, wSum, w[] = new int[n];
		wMax = wSum = w[0] = sc.nextInt();
		for (int i = 1; i < n; i++) {
			wSum += w[i] = sc.nextInt();
			if (w[i] > wMax)
				wMax = w[i];
		}
		sc.close();

		if (k == 1) {
			System.out.println(wSum);
			return;
		}

		int pMax = max(wMax, wSum / k);
		L: for (int p = pMax; p <= wSum; p++) {
			int hold = 0, track = 1;

			for (int w_i : w) {
				if (hold + w_i > p) {
					hold = w_i;
					track++;
					if (track > k)
						continue L;
				} else {
					hold += w_i;
				}

			}

			if (track <= k) {
				System.out.println(p);
				break;
			}
		}
	}

	private static int max(int x, int y) {
		return x < y ? y : x;
	}
}


Measured memory_bytes: 70228
n=int(input())
sum2=0
if(n==1):
    sum2=1
if(n==2):
    sum2=3
if(n>=3):
    sum2=3
    for i in range(3,n+1):
        if(i%3!=0 and i%5!=0):
            sum2=sum2+i
print(sum2)
    

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

int main() {
  int N;
  cin >> N;
  int odd = 0;
  int even4 = 0;
  int a;
  for(int i = 0; i < N; ++i) {
    cin >> a;
    if(a % 2 == 1) {
      odd++;
    } else if(a % 4 == 0) {
      even4++;
    }
  }
  if(even4 + odd == N) {
    if(odd <= even4 + 1) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
    return 0;
  }
  if(odd <= even4) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

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

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

    int count=1;
    for(int i=0;i<n;i++){
        if(i==0){
            count *= k;
        }else{
            count *= k-1;
        }
    }

    cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
const ll INF = 1LL<<60;
/////////////////////////////////
int main(){
    int n;
    cin>>n;
    int a[200010];
    rep(i,n){
        cin >> a[i];
    }
    bool can = false;
    int cnt = 1,ans=0;
    rep(i,n){
        if(a[i]==cnt){
            can = true;
            cnt++;
        }
        else
            ans++;
    }
    if(can)
        cout << ans << endl;
    else
        cout << -1 << endl;

}

Measured memory_bytes: 4400
#include <bits/stdc++.h>
#define INF 2e9
using namespace std;
typedef long long llong;
typedef long double ldouble;

using Graph = vector<vector<int>>;

int main()
{
  string S;
  int Q;
  cin >> S >> Q;
  vector<int> T(Q);
  vector<int> F(Q, 0);
  vector<char> C(Q);
  for(int i=0; i<Q; ++i){
    cin >> T.at(i);
    if(T.at(i) == 2) cin >> F.at(i) >> C.at(i);
  }
  int rev = 0;
  string ini;
  string fin;
  for(int i=Q-1; i>=0; --i){
    if(T.at(i) == 1) ++rev;
    else{
      if(rev%2 == 0){
        if(F.at(i) == 1) ini += C.at(i);
        else if(F.at(i) == 2) fin += C.at(i);
      }else{
        if(F.at(i) == 1) fin += C.at(i);
        else if(F.at(i) == 2) ini += C.at(i);
      }
    }
  }
  if(rev%2 != 0) reverse(S.begin(), S.end());
  reverse(fin.begin(), fin.end());
  cout << ini + S + fin << endl;
}

Measured memory_bytes: 3140
#include "bits/stdc++.h"
#define ed cout<<"\n";
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int

using namespace std;


int main() {
	speed;
	int n, k;
	cin >> n >> k;
	int ans = 0;
	ans = n - k + 1;
	cout << ans;
	ed;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <string.h>
#include <algorithm>
#include <string>
#include <math.h>
using namespace std;

double gcd( double m, double n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
    double p=0;
	// ユークリッドの方法
	while( m > n )
	{
        m = m/2;
        p+=1;
	}
	return p;
}//gcd

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

    if(a >= 13){
        cout << b;
    }else if(a < 6){
        b = 0;
        cout << b;
    }else{
        cout << b/2;
    }

    return 0;
}

Measured memory_bytes: 256
s=list(input())
rei=0
iti=0
for i in range(len(s)):
  if i%2==0:
    if s[i]=='1':
      rei+=1
    else:
      iti+=1
  else:
    if s[i]=='0':
      rei+=1
    else:
      iti+=1
print(min(rei,iti))
      

Measured memory_bytes: 3956