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

using ll = long long;
using pii = pair<int, int>;

#define     endl               "\n"
#define     fast_io            ios::sync_with_stdio(false); cin.tie(0);
#define     file_io            freopen("input.txt", "r", stdin);   \
                               freopen("output.txt", "w", stdout);
#define     all(x)             begin(x), end(x)
#define     debug(x)           cerr <<"Line "<< __LINE__ <<" : "<< #x " = "<< x <<endl;
 
template<typename T, typename TT>
ostream& operator<<(ostream &os, const pair<T, TT> &t) { return os<<"("<<t.first<<", "<<t.second<<")"; }
template<typename T>
ostream& operator<<(ostream& os, const vector<T> &t) { for(auto& i: t) os<<i<<" "; return os; }
 



int main(int argc, char** argv) {
    fast_io
   
	
	int a, b;
	cin >> a >> b;
	
	cout << fixed << setprecision(5) <<a/b << " " << a%b << " " << 1.0*a/b << endl;
	
	

    return 0;
}























Measured memory_bytes: 3260
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <map>

using std::cin;
using std::cout;
using std::endl;
using std::terminate;
using std::map;
using std::make_pair;

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

    map<int, long> m;
    for (int i = 0; i < n; ++i) {
        map<int, long>::iterator it = m.find(a[i]);
        if (it != m.end()) {
            m[a[i]]++;
        } else {
            m.insert(make_pair(a[i], 1));
        }
    }

    long s = 0;
    for (map<int, long>::iterator it = m.begin(); it != m.end(); ++it) {
        s += (it->second * (it->second - 1)) / 2;
    }

    for (int i = 0; i < n; ++i) {
        long y = 0;
        y = s - (m[a[i]] - 1);
        cout << y << endl;
    }
}

int main() {

#ifdef DEV
    std::ifstream in("Banned K.input");
    cin.rdbuf(in.rdbuf());

    int t; cin >> t;
    for (int x = 1; x <= t; ++x) {
        solve();
    }
#else
    solve();
#endif

    return 0;
}


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

using namespace std;

#define REP(i, n) for(int i = 0; i < (n); i++)
#define RREP(i, n) for(int i = (n)-1;  i >= 0; i--)


int main()
{
  const int INF = 1000;
  int X, N; cin >> X >> N;
  X += 10;
  int ans = -1;
  int m = INF;
  vector<bool> num(111, true);
  REP(i, N)
  {
    int p; cin >> p;
    num[p+10] = false;
  }
  REP(i, 1111)
  {
    if(num[i] == false) continue;
    if(abs(X-i) < m)
    {
      m = abs(X-i);
      ans = i;
    }
  }
  cout << ans-10 << endl;
}  


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

int main(){
	int n,m,l;
	cin>>n>>m>>l;
	long int A[n][m],B[m][l],C[n][l]={};
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cin>>A[i][j];
		}
	}
	
	for(int i=0;i<m;i++){
		for(int j=0;j<l;j++){
			cin>>B[i][j];
		}
	}
		
		for(int i=0;i<n;i++){
			for(int j=0;j<m; j++){
				for(int k=0;k<l;k++){
					C[i][k]+=A[i][j]*B[j][k];
					}
				}
			}
			
			for(int i=0;i<n;i++){
				for(int j=0;j<l;j++){
					if(j!=l-1)cout<<C[i][j]<<" ";
					else cout<<C[i][j]<<endl;
				}
			}
			
	return 0;
}


Measured memory_bytes: 3332
import collections
n=int(input())
l=list(input().split())
c=collections.Counter(l)
if n%2==0:
  f=all(x==2 for x in c.values())
else:
  g=c.pop("0")==1
  f=all(x==2 for x in c.values()) and g
print(2**(n//2)%1000000007 if f==True else 0)


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

using namespace std;


int main()
{
	int n,max=0;
	pair<int,int> a[110000];
	int v[110000]={};
	
	cin >> n;
	
	
	for(int i=0;i<n;i++){
		cin >> a[i].first >> a[i].second;
	}
	
	for(int i=0;i<n;i++){
		v[a[i].first]++;
		v[a[i].second+1]--;
	}
	v[0]++;
	for(int i=1;i<n+2;i++){
		v[i] = v[i]+v[i-1];
		if(v[i] >= i)max = i;
	}
	
	cout << max-1 << endl;
	
	
	
	return 0;
}


Measured memory_bytes: 4380
macro_rules! input {
    ( $( $var:ident : $t:tt ),* ) => {
        use std::io::{stdin, Read};
        let mut bytes = stdin().bytes();
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        $(let $var = read_value!(next, $t);)*
    };

    ( $( $var:ident : $t:tt ),+ ,) => {
        input!{ $($var : $t),* }
    };
}

macro_rules! read_value {
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn gcd(a: usize, b: usize) -> usize {
    if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}

fn main() {
    input! {
        a: usize,
        b: usize
    };

    let mut a = a;
    let mut b = b;
    let max = 10_usize.pow(6);
    let mut primes = vec![true; max + 1];
    let mut ans = 1;
    (2..max+1).map(|x| {
        if primes[x] {
            if a % x == 0 && b % x == 0 {
                while a % x == 0 {
                    a /= x;
                }
                while b % x == 0 {
                    b /= x;
                }
                ans += 1;
            }
            (2..max/x+1).map(|y| {
                primes[x * y] = false;
            }).collect::<Vec<_>>();
        }
    }).collect::<Vec<_>>();
    if gcd(a, b) != 1 {
        ans += 1;
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
from pprint import pprint
from copy import deepcopy
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
from pprint import pprint


sys.setrecursionlimit(2147483647)
INF = 10 ** 15
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 998244353


n, m = LI()
G = [[] for _ in range(n)]
for _ in range(m):
    a, b = LI()
    G[a - 1] += [b - 1]
    G[b - 1] += [a - 1]

ans = [0] * n
q = I()
Q = LIR(q)
dq = deque()
depth = [-1] * n
for v, d, c in Q[::-1]:
    if depth[v - 1] >= d:
        continue
    if ans[v - 1] == 0:
        ans[v - 1] = c
    depth[v - 1] = d
    dq += [v - 1]
    while dq:
        u = dq.popleft()
        for x in G[u]:
            if depth[x] >= depth[u] - 1:
                continue
            depth[x] = depth[u] - 1
            if ans[x] == 0:
                ans[x] = c
            if depth[u] - 1 == 0:
                continue
            dq += [x]

print(*ans, sep="\n")

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

#define i64 long long int
#define ran 202202

int n;

i64 ans;

int main() {
	scanf("%d", &n);
	ans = 0;
	for(int i=1;i<=n;i++)
		ans += 1LL * i * (n-i+1);
	for(int i=1;i<n;i++) {
		int x,y;
		scanf("%d%d", &x, &y);
		if(x>y) swap(x, y);
		ans -= 1LL*x*(n-y+1);
	}
	printf("%lld\n", ans);
	
	return 0;
}

Measured memory_bytes: 3780
#include <stdio.h>
#include <math.h>
main(){
  int i;
  double a[3];
  for(i=0;i<3;i++)
    scanf("%lf",&a[i]);
  printf("%f\n",a[0]*a[1]*sin(M_PI*a[2]/180)/2);
  printf("%f\n",sqrt(pow(a[0],2)+pow(a[1],2)-2*a[0]*a[1]*cos(M_PI*a[2]/180))+a[0]+a[1]);
  printf("%f\n",a[1]*sin(M_PI*a[2]/180));
  return 0;
}

Measured memory_bytes: 696
#include <vector>
#include <cmath>
#include <string>
#include <climits>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <map>
#include <tuple>
#include <iostream>

int main() {
	int a, p; std::cin >> a >> p;
	std::cout << (a * 3 + p) / 2 << std::endl;
}



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

int main() {
  int n;
  cin >> n;
  vector<int> t(n);
  vector<int> x(n);
  vector<int> y(n);
  for (int i = 0; i < n; i ++) {
    cin >> t.at(i) >> x.at(i) >> y.at(i);
  }

  string ans = "Yes";
  int now_pointX = 0, now_pointY = 0, now_time = 0;
  for (int i = 0; i < n; i ++) {
    int time  = t.at(i) - now_time;
    int point = abs(x.at(i) - now_pointX) + abs(y.at(i) - now_pointY);
    if (time < point || time%2 != point%2) {
      ans = "No";
      break;
    }
    now_pointX = x.at(i), now_pointY = y.at(i), now_time = t.at(i);
  }

  cout << ans << endl;
}


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

int dfs(int v, vector<vector<int>> &G, vector<bool> &seen){
    // ベースケース
    // すべての点を通った
    bool end = true;
    REP(i, seen.size()){
        if (seen[i]==false && i!=v) end = false;
    }
    if(end){
        return 1;
    } 

    seen[v] = true;

    int result = 0;
    // 再帰ステップ
    for(auto nv :G[v]){
        if (seen[nv] == true) continue;
        result += dfs(nv, G, seen);
    }

    seen[v] =false;
    return result;
}

int main()
{
    int N, M;
    cin >> N >> M;

    vector<vector<int>> G(N, vector<int>());
    for(int i=0; i<M; i++){
        int a, b;
        cin >> a>>b; a--;b--;

        G[a].push_back(b);
        G[b].push_back(a);
    }
    
    vector<bool> seen(N, false);

    int cnt = dfs(0, G, seen);

    cout << cnt << endl;

   return 0;
}

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

int main() {
  int n;
  cin >> n;
  int flag = 0;
  vector<long int> a(n);
  for(int i = 0; i < n; i++){
    cin >> a.at(i);
  }
  sort(a.rbegin(), a.rend());
  long int len1 = 0;
  long int len2 = 0;
  for(int i = 0; i < n - 1; i++){
    if(a.at(i) == a.at(i + 1)){
      if(flag == 0){
        len1 = a.at(i);
        flag++;
      }else if(flag == 1){
        if(a.at(i) != len1){
          len2 = a.at(i);
          flag++;
          break;
        }else{
          flag++;
        }
      }else if(flag == 2){
        if(a.at(i) != len1){
          len2 = a.at(i);
          break;
        }else{
          flag++;
          break;
        }
      }
    }
  }
  if(flag == 3){
    cout << len1 * len1;
  }else if(flag == 2){
    cout << len1 * len2;
  }else{
    cout << 0;
  }
}


Measured memory_bytes: 1024
//cara pikir 
//pake recursive tapi gak 3 x
// C++ program for implementation of Ford Fulkerson algorithm 
#include <iostream> 
#include <limits.h> 
#include <string.h> 
#include <queue> 
#include <iostream> 
#include <set> 
#include <iterator> 
#include <algorithm>
#include <map>
using namespace std;
int main(){
  int num,disp,inner;
  cin>>num>>disp;
  if(num<10){
    inner=disp+(100*(10-num));
    cout<<inner;
  }else{
    cout<<disp;
  }
 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define FT first
#define SC second

using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef pair<int, int> pint;
const int INF = 1e9;
const double EPS = 1e-9;



int main()
{
  int n, m ;
  cin >> n >> m ;
  vector<string> stra(n) ;
  vector<string> strb(m) ;
  int count = 0 ;
  REP(i,n){
    cin >> stra.at(i) ;
  }
  REP(i,m){
    cin >> strb.at(i) ;
  }
  
  REP(i,n-m+1){
    REP(j,n-m+1){
      REP(k,m){
        REP(l,m){
          if(stra.at(i+k).at(j+l)==strb.at(k).at(l)){
            count++ ;
          }
        }
      }
      if(count==m*m){
        cout <<"Yes"<<endl ;
        return 0 ;
      }
      count = 0 ;
    }
  }
  
  cout <<"No"<<endl ;
            
      

  return 0 ;
}

Measured memory_bytes: 256
//InTheNameOfGod
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,j,k) for(int i=j;i<k;++i)
#define rrep(i,j,k) for(int i=j;i>=k;i--)
#define pb push_back
#define lb(i) i&(-i);
const int maxn = 1e2+5;
int n,f[maxn][20],p[maxn][20],re=-1e9,c[maxn];
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);
    cin>>n;
    rep(i,0,n)
    {
        rep(j,0,10)
        {
            cin>>f[i][j];
        }
    }
    rep(i,0,n)
    {
        rep(j,0,11)
        {
            cin>>p[i][j];
        }
    }
    rep(i,1,(1<<10))
    {
        int o=0;
        rep(j,0,n)c[j]=0;
        rep(j,0,10)
        {
            if(i&(1<<j))
            {
                rep(k,0,n)
                {
                    if(f[k][j])c[k]++;
                }
            }
        }
        rep(j,0,n)
        {
            o+=p[j][c[j]];
        }
        re=max(re,o);
    }
    cout<<re;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <iterator>

using namespace std;

#define MAX_V 100002

struct edge{
	int to;
	long long int cost;
};

typedef pair<long long int, int> P; // first??????????????¢???second??????????????????

long long int const LL_MAX = 10000000000000000; // 10^16

vector<edge> G[MAX_V];
long long int d[MAX_V];

// ?????????O(|E|log|V|)

void shortest_path(vector<int> s, int V){ // V???????????°
	
	priority_queue<P, vector<P>, greater<P> > que;
	
	for(int i = 0; i < V; i++){
		d[i] = LL_MAX;
	}
	for(int i = 0; i < s.size(); i++){
		d[s[i]] = 0;
		que.push(P(0, s[i]));
	}
	
	while(!que.empty()){
		
		P p = que.top();
		que.pop();
		
		int v = p.second;
		
		if(d[v] < p.first){
			continue;
		}
		
		for(int i = 0; i < G[v].size(); i++){
			edge e = G[v][i];
			if(d[e.to] > e.cost + d[v]){
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		} // ????????????????°???????????????´??°
	}
}

int main(){
	
	int N, M, K, S;
	int P, Q;
	
	cin >> N >> M >> K >> S;
	cin >> P >> Q;
	
	vector<int> zombie_town;
	
	for(int i = 0; i < K; i++){
		int num;
		cin >> num;
		zombie_town.push_back(num);
	}
	
	for(int i = 0; i < M; i++){
		int index1, index2;
		cin >> index1 >> index2;
		edge e1, e2;
		e1.to = index2;
		e2.to = index1;
		e1.cost = 1;
		e2.cost = 1;
		G[index1].push_back(e1);
		G[index2].push_back(e2);
	}
	
	shortest_path(zombie_town, N + 1);
	
	for(int i = 1; i <= N; i++){
		for(int j = 0; j < G[i].size(); j++){
			if(d[G[i][j].to] > S){
				G[i][j].cost = P;
			}else{
				G[i][j].cost = Q;
			}
		}
	}
	
	for(int i = 0; i < zombie_town.size(); i++){
		G[zombie_town[i]].erase(G[zombie_town[i]].begin(), G[zombie_town[i]].end());
	}
	
	bool flag = false;
	if(d[N] > S){
		flag = true;
	}
	
	vector<int> start_town;
	start_town.push_back(1);
	
	shortest_path(start_town, N + 1);
	/*
	for(int i = 1; i <= N; i++){
		cout << d[i] << " ";
	}
	cout << endl;
	*/
	if(flag){
		d[N] -= P;
	}else{
		d[N] -= Q;
	}
	
	cout << d[N] << endl;
	
	return 0;
}

Measured memory_bytes: 17088
#include<iostream>
#include<string>
using namespace std;
int main(){
	int a,b,c,d,p;
	cin>>a>>b>>c>>d>>p;
	int f;
	if(p<=c)
		f=b;
	else
		f=b-c*d+p*d;
	if(a*p<=f)
		cout<<a*p<<endl;
	else
		cout<<f<<endl;
	return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int K; cin >> K;
	string S; cin >> S;
	if ((int)S.size() <= K) {
		cout << S << endl;
	}
	else {
		REP(i, K)cout << S[i];
		cout << "..." << endl;
	}

	return 0;
}



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


class Main{

/**
 *  https://atcoder.jp/contests/dp/tasks/dp_b
 */

    // Bottom-up Dynamic Programming approach.
    private static int helper(int[] nums, int k){

        int[] dp = new int[nums.length];

        dp[0] = 0;

        for(int i = 1; i < dp.length; i++){
            dp[i] = Integer.MAX_VALUE;

            for(int j = 1;j <= k && j <= i; j++){
                dp[i] = Math.min(dp[i], Math.abs(nums[i] - nums[i - j]) + dp[i - j]);
            }
        }
        return dp[dp.length - 1];
    }

    public static void main(String[] args) {
        
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        if(n == 0){
            System.out.println(0);
            return;
        }
        int[] nums = new int[n];
        for(int i = 0; i < n; i++) nums[i] = in.nextInt();

        System.out.println(helper(nums, k));
    }
}

Measured memory_bytes: 51444
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cassert>

#define SIZE 100005
 
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
 
using namespace std;


int main()
{	
	ll X;
	scanf("%lld", &X);
	ll kari,answer;
	ll seikai=0;
	for(ll i=1;i<180;i++){
		kari=(360*i)%X;
		if((seikai==0)&&(kari==0)){
			seikai=1;
			answer=(360*i)/X;
			}
	}


	printf("%lld", answer);
}


Measured memory_bytes: 1732
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{
	public void Solve(){
		
		int ta = (C + B - 1) / B;
		int tb = (A + D - 1) / D;
		Console.WriteLine(ta <= tb ? "Yes" : "No");
		
	}
	int A, B, C, D;
	public Sol(){
		var d = ria();
		A = d[0]; B = d[1]; C = d[2]; D = d[3];
	}

	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: 27500
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>


using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> a(n + 1);
	for (int i = 2; i <= n; ++i) {
	  int m;
		cin >> m;
		++a[m];
	}
	for (int i = 1; i <= n; ++i) {
	  cout << a[i] << '\n';
	}
  return 0;
}


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

int main(){
  int N,M,X,Y; cin >> N >> M >> X >> Y;
  int X_max = X;
  int Y_min = Y;
  int temp;
  for(int i=0;i<N;i++){
    cin >> temp;
    if(temp>X_max){
      X_max = temp;
    }
  }
  for(int j=0;j<M;j++){
    cin >> temp;
    if(temp<Y_min){
      Y_min = temp;
    }
  }
  
  if(Y_min-X_max>0){
    cout << "No War" << endl;
  }else{
    cout << "War" << endl;
  }
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


int max_a = 0;
int max_b = 0;
double max_d = -1.0;
int A,B,C,D,E,F;
int memo[3000+1][3000+1] = {0};

double solve(int water, int suger) {
	if( water + suger > F ) {
		return 0.0;
	}
	/*if( (water / 100) * E  < suger ) {
		return 0.0;
	}*/
	if( memo[water][suger] != 0 ) {
		return 0.0;
	}
	/*
		if( (water+suger+100*A > F) || (water+suger+100*B > F) ) {
			return 0.0;
		}
	}*/
	if ( suger > 0.0 ) {
		if( (water / 100) * E  >= suger ) {
			if ( ((100.0*(double)suger) / (double)(water + suger)) > max_d ){
				max_a = water;
				max_b = suger;
				max_d = ((100.0*(double)suger) / (double)(water + suger));
			}
		}
	}
	
	
	// act1
	solve(water + 100*A, suger);
	// act2
	solve(water + 100*B, suger);
	// act3
	solve(water, suger + C);
	// act4
	solve(water, suger + D);

	memo[water][suger] = 1;

	return 0.0;
}


int main(void) {
	
	cin >> A >> B >> C >> D >> E >> F;
	solve(0,0);
	if( max_a == 0 ) {
		cout << 100 * A << " " << 0 << endl;
	}else {
		cout << max_a + max_b << " " << max_b << endl;
	}
	return 0;
}

Measured memory_bytes: 28928
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>

using namespace std;

int main()
{

	int X, Y;
	cin >> X >> Y;

	int total = 0;

	if (X == 1 && Y == 1) {
		total += 400000;
	}

	if (X == 1) {
		total += 300000;
	}
	else if (X == 2) {
		total += 200000;
	}
	else if (X == 3) {
		total += 100000;
	}

	if (Y == 1) {
		total += 300000;
	}
	else if (Y == 2) {
		total += 200000;
	}
	else if (Y == 3) {
		total += 100000;
	}

	cout << total << endl;

	
}


Measured memory_bytes: 3632
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cctype>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <memory>
#include <functional>

#define rep(i,n) REP(i,0,n)
#define REP(i,a,n) for(int i = a; i < (int)n; i++)
#define pb push_back
#define NIF le9

using namespace std;

struct Node{
  int data;
  Node *parent,*left,*right;
};

Node *root;

void insert(int a){
  Node *root_tmp = root;
  Node *elem;

  elem = (Node *)malloc(sizeof(Node));
  elem->data = a;
  elem->left = NULL;
  elem->right = NULL;

  Node *prev = NULL;

  while(root_tmp != NULL){
    prev = root_tmp;
    if(elem->data < root_tmp->data){
      root_tmp = root_tmp->left;
    }
    else {
      root_tmp = root_tmp->right;
    }
  }

  elem->parent = prev;

  if(elem->parent == NULL){
    root = elem;
  }
  else {
    if(elem->parent->data < elem->data){
      elem->parent->right = elem;
    }
    else {
      elem->parent->left = elem;
    }
  }
}

void preorder(Node *u){
  if(u == NULL) return;
  cout << " " << u->data;
  preorder(u->left);
  preorder(u->right);
}

void inorder(Node *u){
  if(u == NULL) return;
  inorder(u->left);
  cout << " " << u->data;
  inorder(u->right);
}

signed main(){
  int n;
  string command;
  int elem;

  cin >> n;
  rep(i,n){
    cin >> command;
    if(command == "insert"){
      cin >> elem;
      insert(elem);
    }
    else{
      inorder(root);
      cout << "\n";
      preorder(root);
      cout << "\n";
    }
  }
}
      
  
  



Measured memory_bytes: 26424
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int N,D;
  cin >> N >> D;
  
  vector<vector<int>> X(N, vector<int>(D));
  for(int i=0; i<N; i++){
    for(int j=0; j<D; j++){
      cin >> X.at(i).at(j);
    }
  }
  
  int ans=0;
  for(int i=0; i<N; i++){
    for(int j=i+1; j<N; j++){
      int norm = 0;
      for(int k=0; k<D; k++){
        int diff = X.at(i).at(k) - X.at(j).at(k);
        norm += diff * diff;
      }  
      
      for(int k=0; k <= norm; k++){
        if(k*k == norm){
          ans++;
        }
      }
    
    }
  }

  cout << ans << endl;
  
  
  
}

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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;
// const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}


int main() {
  int N, A, B, C;
  cin >> N >> A >> B >> C;
  vector< string > S(N);
  cin >> S;


  vector< char > ans;
  auto rec = MFP([&](auto rec, int idx) -> void {
    if(A < 0 || B < 0 || C < 0) {
      return;
    }
    if(idx == S.size()) {
      cout << "Yes\n";
      for(auto &c : ans) cout << c << "\n";
      exit(0);
    }
    if(S[idx] == "AB") {
      ++A;
      --B;
      ans.emplace_back('A');
      rec(idx + 1);
      --A;
      ++B;
      --A;
      ++B;
      ans.back() = 'B';
      rec(idx + 1);
      ans.pop_back();
      ++A;
      --B;
    } else if(S[idx] == "BC") {
      ++B;
      --C;
      ans.emplace_back('B');
      rec(idx + 1);
      --B;
      ++C;
      --B;
      ++C;
      ans.back() = 'C';
      rec(idx + 1);
      ans.pop_back();
      ++B;
      --C;
    } else {
      ++A;
      --C;
      ans.emplace_back('A');
      rec(idx + 1);
      --A;
      ++C;
      --A;
      ++C;
      ans.back() = 'C';
      rec(idx + 1);
      ans.pop_back();
      ++A;
      --C;
    }
  });
  rec(0);

  cout << "No\n";
}


Measured memory_bytes: 17920
D, G = map(int, input().split())
p_list = [list(map(int, input().split())) for i in range(D)]

# 基本的に配点の高い問題を解いていく方が効率が良いはず
# ビット全探索、D行目の問題を全部解く場合を1, そうでないものを0とする。
ans = 10**18
from itertools import product

for bit in product((0,1), repeat=D):
    point = 0
    mondai = 0
    # (0,0) (0,1)などのビット列を生成
    for i in range(D):
        point += bit[i]*p_list[i][0]*100*(i+1)
        if bit[i] == 1:
            mondai +=p_list[i][0]
            point += p_list[i][1]
    # G-point > 0ならば、配点の高い問題を順に解いていってその時の問題数をカウントする
    if G - point > 0:
        # 最後に0となっているbitを取得
        a = [i for i, x in enumerate(bit) if x == 0]
        lastbit = int(a[-1])
        for j in range(p_list[lastbit][0]):
            point += (lastbit+1) * 100
            mondai += 1
            if (G - point <= 0):
                ans = min(ans, mondai)
                break
        # まだ G - pointが正ならば解なしで次のビット探索へ
        if G - point > 0:
            mondai = 10 ** 18

    ans = min(ans, mondai)

print(ans)



Measured memory_bytes: 3064
#!/usr/bin/env python3
# n,m = map(int,sys.stdin.readline().split())
# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param
# a = tuple(sys.stdin.readline() for _ in range(n)) # multi line with single param
# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param
# s = sys.stdin.readline().rstrip()
# n = int(sys.stdin.readline())
# INF = float("inf")
import sys,collections
N,E,r = tuple(map(int,sys.stdin.readline().split())) # single line with multi param
sdd = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(E)) # multi line with multi param
#G = [[src1 dist1 d1][src1 dist1 d1]...]# vect source1 -> distance1 distances
G = [[] for i in range(N)]
for src,dist,d in sdd:
  G[src].append((dist,d))
#print(sdd,r,G)
INF = float("inf")
ALL = set(range(N))
mst = set()
#distances = [INF]*N # 蟋狗せr縺九ｉ縺ｮ霍晞屬
distances = collections.defaultdict(lambda:INF)
distances[r] = 0

import heapq

dv = []
def add(u):
  mst.add(u)
  if len(mst) == N: return
  for v,w in G[u]:
    if not v in mst and w + distances[u] < distances[v]: # u繧堤ｵ檎罰縺励◆譁ｹ縺悟ｮ峨＞
      distances[v] = distances[u]+w
      heapq.heappush(dv, (distances[v],v))
  #print(distances)
  #print(u,distances,dv)
  if not dv:
    return None
  d,v = heapq.heappop(dv)
  while dv and v in mst:
    d,v = heapq.heappop(dv)
  if v in mst:
    return None
  return v

n = add(r)
while n != None:
  n = add(n)
  #print("n:",n)

for i in range(N):
  if distances[i] == INF:
    print("INF")
  else:
    print(distances[i])


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

int main(){
    int num_of_points, D;
    int cnt = 0;
    cin >> num_of_points >> D;

    while(num_of_points--){
        double x, y;
        cin >> x >> y;

        if(sqrt(pow(x, 2) + pow(y, 2)) <= D) cnt++;
    }

    cout << cnt << endl;
    return 0;
}


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

# define All(a) (a).begin(),(a).end()

using namespace std;
using ll  = long long;
using ull = unsigned long long;
using ld  = long double;


//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

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

    string s;
    cin >> s;

    if (s[2] == s[3] && s[4] == s[5]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long solve(int n)
{
	long long sum = 0;
	for(int i=1;i<=n;++i)
		if(i%3!=0&&i%5!=0)
			sum += i*1LL;
	return sum;
}
int main()
{
	int n;
	cin>>n;
	cout<<solve(n);
	return 0;
}

Measured memory_bytes: 3584
s=input()
s1=int(s[0]+s[1])
s2=int(s[2]+s[3])
ans=['YYMM','MMYY','AMBIGUOUS','NA']
if s1==0:
  if s2==0:
    print('NA')
  elif 1<=s2<=12:
    print('YYMM')
  elif s2>=13:
    print('NA')
elif 1<=s1<=12:
  if s2==0:
    print('MMYY')
  elif 1<=s2<=12:
    print('AMBIGUOUS')
  elif s2>=13:
    print('MMYY')
elif s1>=13:
  if s2==0:
    print('NA')
  elif 1<=s2<=12:
    print('YYMM')
  elif s2>=13:
    print('NA')

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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(i = 0; i < n; i++)

const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

typedef long long ll;

int main()
{
	int memo[5] = { 105, 135, 165, 189, 195 };

	int N; cin >> N;

	for (int i = 0; i < 5; i++)
	{
		if (N >= 195)
		{
			cout << 5 << endl;
			break;
		}
		if (N >= memo[i])
		{
			
		}
		else
		{
			cout << i << endl;
			break;
		}
	}
}


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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

ll n,x;
ll l[60];
ll dp[60];

ll solve(ll a, ll b){
	//cout << a << " " << b << endl;
	if(b == 0){
		return 0;
	}
	if(a == 0){
		return 1;
	}
	if(b >= l[a]/2+1){
		if(dp[a-1] != 0) return 1+dp[a-1]+solve(a-1,min(b-(l[a]/2+1),l[a-1]));
		else { dp[a-1] = solve(a-1,l[a-1]); return 1+dp[a-1]+solve(a-1,min(b-(l[a]/2+1),l[a-1]));}
	}else{
		return solve(a-1,min(l[a-1],b-1));
	}
}

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

	cin >> n >> x;

	l[0] = 1;
	for (int i = 1;i <= n;i++){
		l[i] = l[i-1]*2+3;
	}

	cout << solve(n,x) << endl;

	return 0;

}


Measured memory_bytes: 256
# coding: utf-8
from functools import reduce


def solve(*args: str) -> str:
    n, k = map(int, args[0].split())
    A = sorted(map(int, args[1].split()))
    mod = 10**9+7

    if n == k:
        return str(reduce(lambda a, b: (a*b) % mod, A, 1))

    if k % 2 and A[-1] < 0:
        return str(reduce(lambda a, b: (a*b) % mod, A[n-k:], 1))

    l, r = 0, n-1
    count = 0
    ret = 1

    if k % 2:
        ret *= A[-1]
        r -= 1
        count += 1

    while count < k-1:
        pos = max(0, A[r]*A[r-1])
        neg = max(0, A[l]*A[l+1])
        if pos <= neg:
            ret *= neg
            l += 2
        else:
            ret *= pos
            r -= 2
        ret %= mod
        count += 2

    return str(ret % mod)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))


Measured memory_bytes: 34452
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
#include <iomanip>
#include<queue>
#include<algorithm>
#include <functional>
#include<vector>
#include <math.h>
#include <numeric>
#include <stack>
#include <map>
using namespace std;

int N;

int main() {
	cin >> N;
	if ((1<= N) && (N < 10)) cout << N << endl;
	else if ((10 <= N) && (N < 100)) cout << 9 << endl;
	else if ((100 <= N) && (N < 1000)) cout << 9 + N - 100 + 1 << endl;
	else if ((1000 <= N) && (N < 10000)) cout << 9 + 900 << endl;
	else if ((10000 <= N) && (N < 100000)) cout << 9 + 900 + N - 10000 + 1 << endl;
	else if (N == 100000) cout << 9 + 900 + 90000 << endl;
}

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

int main() {
    int N;
    cin >> N;
    vector<int> num(N);
    vector<int> input_P(N);
    vector<int> input_Q(N);
    int order_P = 0;
    int order_Q = 0;
    for(int i = 0; i < N; i++) {
        num[i] = i + 1;
    }
    for(int i = 0; i < N; i++) {
        cin >> input_P[i];
    }
    for(int i = 0; i < N; i++) {
        cin >> input_Q[i];
    }
    int count = 0;
    do {
        count++;
        for(int i = 0; i < N; i++) {
            if(num[i]  != input_P[i]) {
                break;
            }
            if(i == N - 1) {
                order_P = count;
            }
        }
        for(int i = 0; i < N; i++) {
            if(num[i]  != input_Q[i]) {
                break;
            }
            if(i == N - 1) {
                order_Q = count;
            }
        }
    } while(next_permutation(num.begin(), num.end()));
    cout << abs(order_P - order_Q) << endl;
    return 0;
}

Measured memory_bytes: 256
i = 0
data = []
buff =[]

while True:
    buff = list(map(int, input().split()))
    
    if buff == [0, 0]:
        break
    data.append(buff)
    data[i].sort()
    i += 1

for j in data:
    print("{} {}".format(j[0], j[1]))


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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int n;
    cin >> n;
    vector<vi> g(n);
    vi deg(n);
    rep(i, n) {
        int u, v;
        cin >> u >> v;
        --u; --v;
        g[u].pb(v);
        g[v].pb(u);
        deg[u]++; deg[v]++;
    }
    queue<int> que;
    vector<bool> ispushed(n, false);
    rep(i, n) if (deg[i] == 1) que.push(i);
    while (!que.empty()) {
        int p = que.front(); que.pop();
        ispushed[p] = true;
        for (int t : g[p]) {
             deg[t]--;
             if (deg[t] == 1) que.push(t);
        }
    }
    int q;
    cin >> q;
    rep(i, q) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        if (!ispushed[a] && !ispushed[b]) cout << 2 << endl;
        else cout << 1 << endl;
    }
    return 0;
}



Measured memory_bytes: 8716
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000

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

    int N, A, B;
    cin >> N >> A >> B;
    int sum = 0;
    for (int i = 1; i <= N; i++) {
        string stri = to_string(i);
        int ketasum = 0;
        rep(j, stri.size()) { ketasum += stri[j] - '0'; }

        if (ketasum >= A && ketasum <= B)
            sum += i;
    }

    cout << sum << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
  public class hello
    {
        static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            for (int i =0;i<n;i++)
            {
                string[] s = Console.ReadLine().Split(' ');
                double x1 = double.Parse(s[0]);
                double y1 = double.Parse(s[1]);
                double x2 = double.Parse(s[2]);
                double y2 = double.Parse(s[3]);
                double x3 = double.Parse(s[4]);
                double y3 = double.Parse(s[5]);

                double a1 = 2 * (x2 - x1);
                double b1 = 2 * (y2 - y1);
                double c1 = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2;

                double a2 = 2 * (x3 - x1);
                double b2 = 2 * (y3 - y1);
                double c2 = x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3;

                double x = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1);
                double y = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1);

                double r_2 = (x1 - x) * (x1 - x) + (y1 - y) * (y1 - y);
                double r = Math.Sqrt(r_2);

                Console.WriteLine("{0:F3} {1:F3} {2:F3}", x, y, r);
            }
        }
    }


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

#ifdef LOCAL 
    #include "_/debug.h"
#else 
    #define out(...) 69;
#endif

int main() { 
    ios_base::sync_with_stdio(0); 
    cin.tie(0);
    int n;
    cin >> n;
    vector<pair<int, int>> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i].first >> a[i].second;
    }
    map<pair<int, int>, int> cnt;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (i == j) continue;
            auto u = make_pair(a[i].first - a[j].first, a[i].second - a[j].second);
            ++cnt[u];
        }
    }
    int mx = 0;
    for (auto x : cnt) {
        mx = max(mx, x.second);
    }
    cout << n - mx << '\n';
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int X,Y;
  cin >> X >> Y;
  if(X*2>Y || X*4<Y || Y%2==1){
    cout << "No" << endl;
  }
  else{
    cout << "Yes" << endl;
  }

}

Measured memory_bytes: 3672
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
	int n, k;
	cin >> n >> k;
	vector<int> p(n);
	for (int i = 0; i < n; i++)
	{
		cin >> p[i];
	}
	sort(p.begin(), p.end());
	int sum = 0;
	for (int i = 0; i < k; i++)
	{
		sum += p[i];
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 3628
def ft_robot(s: str, x: int, y: int) -> int:
    # 各方向への一回に移動可能な距離のリストをもつ。
    # ds[0] が x 軸方向用。ds[1] が y軸方向用。
    ds = [[], []]
    axis = 0
    cur_dis = 0
    for c in s:
        if c == 'T':
            ds[axis].append(cur_dis)
            axis = 1 - axis
            cur_dis = 0
        else:
            cur_dis += 1

    ds[axis].append(cur_dis)

    if len(ds[0]) > 0 and ds[0][0] != x:
        # 最初だけは方向が決まっているのでスタート位置に補正を入れることで対応する。
        ds[0][0] = abs(ds[0][0] - x)
    elif x != 0:
        ds[0].append(abs(x))

    ds[1].append(abs(y))

    # 移動方向は軸は決まっているが正負は決まっていないので自由に決める。
    # また、足し算なので順番は関係ない。
    sx, sy = 0, 0
    for dx in sorted(ds[0], key=lambda i: -i):
        if 0 < sx:
            sx -= dx
        else:
            sx += dx

    if sx != 0:
        return False

    for dy in sorted(ds[1], key=lambda i: - i):
        if 0 < sy:
            sy -= dy
        else:
            sy += dy

    return sy == 0


if __name__ == "__main__":
    s = input()
    x, y = map(int, input().split())
    yes = ft_robot(s, x, y)
    print('Yes' if yes else 'No')


Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define INF 1000000007
#define loop(x) for(int i = 0; i < x; i++)
using namespace std;

long long swapCount = 0;
void swap(vector<int> &arr, int i, int j) {
    if(i == j) {
        return;
    }

    int temp = arr[i];
    arr[i] = arr[j];
    arr[j] = temp;
    swapCount++;
}

int f(vector<int> arr, int k) {
   vector<int> dp(arr.size(), 0);
   dp[0] = 0;
   dp[1] = dp[0] + abs(arr[1] - arr[0]);
   for(int i = 2; i < arr.size(); i++) {
       dp[i] = dp[i - 1] + abs(arr[i] - arr[i - 1]);
       for(int j = 2; i - j >= 0 && j <= k; j++) {
           dp[i] = min(dp[i], dp[i - j] + abs(arr[i] - arr[i - j]));
       }
   }
   return dp[arr.size() - 1];
}

int main() { 

   //code
   ios::sync_with_stdio(false);
   int t = 1;
    //cin>>t;
    //cin.ignore();
   while(t--) {
        int row, col;
        ////////////////FOR ARRAY
        // cin>>col;
        // vector<int> arr;
        // for(long long i = 0; i < col; i++) {
        //     int x;
        //     cin>>x;
        //     arr.push_back(x);
        // }
        // f(arr);

        //////////////FOR MATIX
        // vector<int> arr;
        // for(int i = 0; i < row; i++) {
        //     arr.push_back(vector<int>(col, 0));
        //     for(int j = 0; j < col; j++) {
        //         int x;
        //         cin>>x;
        //         arr[i].push_back(x);
        //     }
        // }
        // f(arr);

        ////////////FOR STRING
        // string s;
        // cin>>s;
        // cout<<f(s)<<endl;
         int k;
         cin>>col;
        cin>>k;
        vector<int> arr;
        for(long long i = 0; i < col; i++) {
            int x;
            cin>>x;
            arr.push_back(x);
        }
        cout<<f(arr, k)<<endl;
        
    }
    return 0; 
}

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

int main() {
  int N;
  cin >> N;
  rep(i, N){
    string S;
    cin >> S;
    if(S == "Y") {
      cout << "Four" << endl;
      return 0;
    }
  }
  cout << "Three" << endl;
}


Measured memory_bytes: 256
from sys import stdin
N = int(input())
A = [int(x) for x in stdin.readline().rstrip().split()]
A.sort(reverse=True)
ans = A[0]
cnt = 2
for i in range(1,N):
    ans += (A[i]*2)
    cnt += 2
    if cnt >= N:
        if cnt > N:
            ans -= A[i]
        break
if N == 2:
    ans = max(A)
print(ans)

Measured memory_bytes: 31556
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

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

func main() {
	sc.Split(bufio.ScanWords)

	n := nextInt()
	min := 1<<63-1

	for i := 1; i <= int(math.Sqrt(float64(n))); i++ {
		if n % i == 0 {
			if min > i + n/i -2 {
				min = i + n/i -2
			}
		}
	}

	fmt.Println(min)
}

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


void solve(long long N, std::vector<long long> H){
    
    ll ans = 0;
    ll i = 0;
    ll cnt = 0;
    while (i < N - 1){ 
        if(H[i] >= H[i+1])
            cnt++;
        else{
            if(cnt > ans)
                ans = cnt;
            cnt = 0;
        }
        i++;
    }
    if(cnt > ans)
        ans = cnt;
    cout << ans << endl;
}

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> H(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&H[i]);
    }
    solve(N, std::move(H));
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>

using namespace std;

const int N = (int)20;
int v[N], c[N];
int n;

int main() {
	int r = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> v[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> c[i];
		if (c[i] < v[i]) r += v[i]-c[i];
	}
	cout << r << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repl(i,x,n) for(long long i=(long long)(x);i<(long long)(n);i++)
#define rep(i,x,n) for(long i=long(x);i<long(n);i++)
int main() 
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    long long n,k,a[1009];
    cin>>n>>k;
    rep(i,0,n) cin>>a[i];
    sort(a,a+n);
    rep(i,0,n)
    {
        if(a[i]>k)
        {
            cout<<i;
            return 0;
        }
        k-=a[i];
    }
    if(k)
        cout<<n-1;
    else
        cout<<n;
}

Measured memory_bytes: 256