akhauriyash/Code-Regression huggingface dataset:
import sys
readline = sys.stdin.buffer.readline
EPS = 1e-7
class Circle:
    def __init__(self, cx, cy, r):
        self.center = (cx, cy)
        self.radius = r
    def cross(self, C2):
        x1, y1 = self.center
        x2, y2 = C2.center
        R1 = self.radius
        R2 = C2.radius
        
        if (R2-R1)**2 + EPS <= (x2-x1)**2 + (y2-y1)**2 <= (R2+R1)**2 - EPS:
            dx, dy = x2-x1, y2-y1
            a = (R2**2 - R1**2 + x1**2 - x2**2 + y1**2 - y2**2)/2
            if abs(dy) > EPS:     
                #交点はdx*X + dy*Y + a = 0 上
                D = dx**2 + dy**2
                bx = a*dx+dx*dy*y1-x1*dy**2
                cx = dy**2*(x1**2-R1**2) + (a+dy*y1)**2
                cx1 = (-bx + (bx**2-D*cx)**0.5)/D
                cx2 = (-bx - (bx**2-D*cx)**0.5)/D
                cy1 = -(dx*cx1+a)/dy
                cy2 = -(dx*cx2+a)/dy
            else:
                k = (R1**2-R2**2+dx**2)/2/dx
                cx1 = cx2 = x1+k
                cy1 = y1 + (R1**2-k**2)**0.5
                cy2 = y1 - (R1**2-k**2)**0.5
                
                
                
                
            return [(cx1, cy1), (cx2, cy2)]
        else:
            return []
    
    def isinside(self, x, y):
        x1, y1 = self.center
        return (x1-x)**2 + (y1-y)**2 - EPS < self.radius**2

            
N, K = map(int, readline().split())
Points = [tuple(map(int, readline().split())) for _ in range(N)]

ok = 1e6
ng = 0
candidate = [(x, y) for x, y, _ in Points]
for _ in range(40):
    med = (ok+ng)/2
    Cs = [Circle(x, y, med/c) for x, y, c in Points]
    candidate2 = candidate[:]
    for i in range(N):
        for j in range(i):
            candidate2.extend(Cs[i].cross(Cs[j]))
    for px, py in candidate2:
        res = 0
        for C in Cs:
            if C.isinside(px, py):
                res += 1
        if res >= K:
            ok = med
            break
    else:
        ng = med


print(ok)

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

#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 ll long long
static const int MAX = 10000;
static const ll INFTY = 1e12;

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

const ll MRINF = 5000000000000000;

int main() {

    string S, T;
    cin >> S >> T;
    REP(i, S.length()){
        if(S==T){
            cout << "Yes" << endl;
            return 0;
        }
        S = S.substr(S.length()-1, 1) + S.substr(0, S.length()-1);
    }
    cout << "No" << endl;
    
  
}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/

Measured memory_bytes: 3600
from sys import stdin
input = stdin.readline
from collections import deque
def BFS(K,path,N):
  """リストのリスト道順path,頂点の個数Nが与えられたとき, 頂点Kから各頂点までの距離をlistで返す"""
  dist=[-1]*N
  dist[K]=0
  que=deque()
  que.append(K)
  while que:
    label=que.popleft()
    for i,c in path[label]:
      if dist[i]==-1:
        dist[i]=dist[label]+c
        que+=[i]
  return dist
 
N=int(input())
path=[ [] for i in range(N)]
for i in range(N-1):
  a,b,c=map(int,input().split())
  path[a-1]+=[[b-1,c]]
  path[b-1]+=[[a-1,c]]
Q,K=map(int,input().split())
xy=[list(map(int,input().split())) for i in range(Q)]
distance=BFS(K-1,path,N)
for i in range(Q):
  print(distance[xy[i][0]-1]+distance[xy[i][1]-1])

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

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cout << #x << " = " << (x) << endl
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

template<class T, class U> void chmin(T& t, const U& u) { if (t > u) t = u; }
template<class T, class U> void chmax(T& t, const U& u) { if (t < u) t = u; }

template<class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	os<<"{";
	rep(i, v.size()) {
		if (i) os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

const ll MOD = 998244353;
const int MX = 100010;
const int maxn = 410;

ll powmod(ll x, ll k) {
	ll res = 1;
	for (; k; k /= 2, x = x * x % MOD) {
		if (k & 1) {
			res = res * x % MOD;
		}
	}
	return res;
}

ll inv[MX], fact[MX], ifact[MX];
ll pw[maxn][maxn];

void init() {
    inv[1] = 1;
    for (int i = 2; i < MX; ++i) {
        inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;
    }
    fact[0] = ifact[0] = 1;
    for (int i = 1; i < MX; ++i) {
        fact[i] = fact[i-1] * i % MOD;
        ifact[i] = ifact[i-1] * inv[i] % MOD;
    }

    rep(i, maxn) {
    	pw[i][0] = 1;
    	rep(j, maxn-1) {
    		pw[i][j+1] = pw[i][j] * i % MOD;
    	}
    }
}

ll comb(int n, int r) {
    if (n < 0 || r < 0 || r > n) return 0;
    return fact[n] * ifact[r] % MOD * ifact[n - r] % MOD;
}

inline void add(ll &x, ll y) { x += y; if (x >= MOD) x -= MOD; }

ll dp[maxn][maxn][maxn];
int A[maxn], B[maxn];

int main() {
	init();

	int N; cin >> N;
	rep(i, N) cin >> A[i] >> B[i];

	int as = 0;
	rep(i, N) as += A[i];

	dp[0][0][0] = 1;

	rep(i, N) {
		rep(j, maxn) rep(k, maxn) if (dp[i][j][k] != 0) {
			add(dp[i+1][j][k], dp[i][j][k]);

			rep(l, B[i]) {
				ll t = -dp[i][j][k] * ifact[l] % MOD * pw[A[i]][l] % MOD;
				if (t < 0) t += MOD;
				add(dp[i+1][j+A[i]][k+l], t);
			}
		}
	}

	ll ans = 0;
	rep(j, maxn) rep(k, maxn) if (j > 0 && dp[N][j][k] != 0) {
		ll t = dp[N][j][k] * fact[k] % MOD * as % MOD * inv[j] % MOD * powmod(inv[j], k) % MOD;
		add(ans, t);
	}
	ans = -ans;

	ans %= MOD;
	if (ans < 0) ans += MOD;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 532096
n, m = map(int, input().split())
a = [[0 for j in range(m)] for i in range(n)]
b = [0 for i in range(m)]
c = [0 for i in range(n)]
for i in range(n):
  a[i] = list(map(int, input().split()))
for i in range(m):
  b[i] = int(input())
for i in range(n):
  sum = 0
  for j in range(m):
    sum += a[i][j] * b[j]
  c[i] = sum
  print(c[i])


Measured memory_bytes: 5972
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <map>
#include <vector>
#include <set>
#include <algorithm>
#include <sstream>
#include <queue>
#include <cctype>
#include <cmath>
#include <fstream>

using namespace std;

typedef long long ll;
#define REP(i,k) for(int (i)=0;(i)<(k);(i)++)
#define INF ~(1<<31)
#define CLR(a) memset((a),0,sizeof((a)))
#define EPS 1e-9
#define DBG 1
#define D(s,v) if(DBG) cout<<(s)<<": "<<(v)<<endl;
#define DVEC(s,v) if(DBG) {cout<<(s)<<": "; for(int i=0;i<(v).size();i++) cout<<(v)[i]<<" "; cout<<endl;}
#define DARR(s,v,n) if(DBG) {cout<<(s)<<": "; for(int i=0;i<n;i++) cout<<(v)[i]<<" "; cout<<endl;}

int main(){
    ios_base::sync_with_stdio(0);

    int N,Y;

    while(cin>>N>>Y){
        bool found = 0;

        for(int b=0;b<=2000;b++){
            int c9 = (Y/1000 - N - 4*b);
            if(c9%9==0 && c9/9>=0){
                int c = c9/9;
                int a = N - b - c;
                if(a>=0){
                    found = 1;
                    cout<<c<<" "<<b<<" "<<a<<endl;
                    break;
                }
            }
        }

        if(!found)
            cout<<-1<<" "<<-1<<" "<<-1<<endl;
    }
}

Measured memory_bytes: 256
import math
A,B,H,M = map(int,input().split())

sita = min(360-abs((30*H+30*(M/60) )-6*M),abs((30*H+30*(M/60) )-6*M))
D2 =A**2+B**2-2*A*B*math.cos(math.radians(sita)) 
print(D2**(1/2))

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

using namespace std;

int DP[100010][4];
int arr[100010][3];

int solve (int pos,int k) {
    if (DP[pos][k]!=0) {
        return DP[pos][k];
    }
    DP[pos][k]=INT_MIN;
    for (int i=0;i<3;i++) {
        if (i!=k) {
            DP[pos][k]=max(DP[pos][k],solve(pos-1,i)+arr[pos][k]);
        }
    }
    return DP[pos][k];
}

int main () {
    int N;
    scanf("%d",&N);
    for (int i=0;i<N;i++) {
        scanf("%d%d%d",&arr[i][0],&arr[i][1],&arr[i][2]);
    }
    DP[0][0]=arr[0][0];
    DP[0][1]=arr[0][1];
    DP[0][2]=arr[0][2];
    cout << max(solve(N-1,0),max(solve(N-1,1),solve(N-1,2)));
    return 0;
}



Measured memory_bytes: 9216
import java.util.Scanner;
public class Main {
    public static void main (String[] args) {
	Scanner scan = new Scanner (System.in);
	int weight, index;
	boolean[] isBinaryNum = new boolean[10];
	int[] binaryNum = new int[10];
	binaryNum[0] = 1;
	for (int i = 1; i < 10; i++) {
	    binaryNum[i] = binaryNum[i-1] * 2;
	}
	StringBuilder sb = new StringBuilder();
	while (scan.hasNext()) {
	    weight = Integer.parseInt(scan.nextLine());
	    index = 0;
	    sb.setLength(0);
	    for (int i = 0; i < 10; i++) {
		isBinaryNum[i] = false;
	    }
	    while (weight != 0) {
		if (weight % 2 == 1) {
		    isBinaryNum[index] = true;
		}
		weight /= 2;
		index++;
	    }
	    for (int i = 0; i < 10; i++) {
		if (isBinaryNum[i]) {
		    sb.append(binaryNum[i] + " ");
		}
	    }
	    System.out.println(sb.toString().trim());
	}
    }
}

Measured memory_bytes: 25996
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.C_Challenge
{
    class ABC_066
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            int[] array = ReadInts();
            int cnt = 0;
            int index = n - 1;
            bool reverse = false;
            while (cnt < n)
            {
                Console.Write(array[index]);
                Console.Write(" ");
                cnt++;
                if (reverse)
                {
                    index += 2;
                }
                else
                {
                    index -= 2;
                    if (index < 0)
                    {
                        index *= -1;
                        index--;
                        reverse = true;
                    }
                }
            }
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 35512
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H1, M1, H2, M2, K;
    cin >> H1 >> M1 >> H2 >> M2 >> K;
    cout << max(0, H2 * 60 + M2 - H1 * 60 - M1 - K) << endl;

    return 0;
}


Measured memory_bytes: 3648
import java.util.*

fun main(args:Array<String>){
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map{it.toInt()}
    var cnt = 0
    for(i in 0 until n){
        if(a[i] < 0) cnt++
    }
    val ans = a.map{Math.abs(it.toLong())}.sum()
    var mi = 1000000000
    for(i in 0 until n){
        mi = Math.min(mi, Math.abs(a[i]))
    }
    println(if(cnt % 2 == 1) ans - mi * 2 else ans)
}


Measured memory_bytes: 61824
#include <iostream>
#include <string>
#include <cmath>
#include <set>
#include <utility>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cstdio>
#include <cstring>

using namespace std;

constexpr long long mod = 1000000007;
constexpr double eps = 0.0000000001;

typedef long long ll;

int main() {
    int n;
    cin >> n;
    vector<int> l(n);
    for(auto& e: l) {
        cin >> e;
    }
    sort(l.begin(), l.end());
    ll c = 0;
    for (auto i = l.begin(); l.end() - i > 2; i++)
        for (auto j = i + 1; l.end() - j > 1; j++) {
            auto len_max = *i + *j;
            auto len_min = abs(*i - *j);
            auto a = upper_bound(j + 1, l.end(), len_min);
            auto b = lower_bound(j + 1, l.end(), len_max);
            c += b - a;
        }
    cout << c << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, count, isp;
  isp = 0;
  string s;
  cin >> s;
  n = s.size();
  count = 0;
  for(int i = 0; i < n; i++){

    if(s[i]!='P'){
      s[i] = 'D';
    }else{
    }
  }
  cout << s  << endl;
}

Measured memory_bytes: 3752
import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int W = sc.nextInt();
        int[][] a = new int[H+1][W+1];
        int[][] b = new int[H+1][W+1];
        boolean[][][] dp = new boolean[H+1][W+1][((H+W)*80)+1];
        for(int i = 1; i<H+1; i++) {
            for(int j = 1; j<W+1; j++) {
                a[i][j] = sc.nextInt();
            }
        }
        for(int i = 1; i<H+1; i++) {
            for(int j = 1; j<W+1; j++) {
                b[i][j] = sc.nextInt();
            }
        }
        for(int i = 1; i<H+1; i++) {
            for(int j = 1; j<W+1; j++) {
                if(i==1 && j ==1) {
                    int ini = Math.abs(a[i][j] - b[i][j]);
                    dp[i][j][ini] = true;
                }
                for(int k = 0; k<((H+W)*80); k++) {
                    if(i==1 && j ==1) {
                        continue;
                    }
                    if(dp[i][j-1][k] == true) {
                        int plus = k + Math.abs(a[i][j] - b[i][j]);
                        int minus = Math.abs(k - Math.abs(a[i][j] - b[i][j]));
                        dp[i][j][plus] = true;
                        dp[i][j][minus] = true;
                    }
                    if(dp[i-1][j][k] == true) {
                        int plus = k + Math.abs(a[i][j] - b[i][j]);
                        int minus = Math.abs(k - Math.abs(a[i][j] - b[i][j]));
                        dp[i][j][plus] = true;
                        dp[i][j][minus] = true;
                    }
                }
            }
        }
        for(int k = 0; k<((H+W)*80); k++) {
            if(dp[H][W][k]) {
                System.out.println(k);
                break;
            }
        }
    }
}

Measured memory_bytes: 158636
#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9;

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

vector<Edge> adj[100005];
vector<long long> dist;

void bfs(int s) {
    queue<int> q; q.push(s);
    while(!q.empty()) {
        int u = q.front(); q.pop();
        for(int i = 0; i < adj[u].size(); i++) {
            int to = adj[u][i].to, cost = adj[u][i].cost;
            if(dist[to] == INF) {
                dist[to] = dist[u] + cost;
                q.push(to);
            }
        }
    }
}

int main ()
{
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    dist = vector<long long> (n + 1, INF);
    for(int i = 0; i < n - 1; i++) {
        int a, b;
        long long cost;
        cin >> a >> b >> cost;
        adj[a].push_back({b, cost});
        adj[b].push_back({a, cost});
    }
    int q, k;
    cin >> q >> k;
    dist[k] = 0; bfs(k);
    for(int i = 0; i < q; i++) {
        int a, b;
        cin >> a >> b;
        cout << dist[a] + dist[b] << '\n';
    }
}


Measured memory_bytes: 9984
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	int n; cin >> n;
	vector<int> q(n);
	rep(i, n)
	{
		int p; cin >> p;
		q[p - 1] = i;
	}
	int res = 1;
	for (int i = 0; i < n - 1; ++i)
	{
		int cnt = 1;
		int tmp = q[i];
		while (i+1 < n&&tmp < q[i+1])
		{
			++cnt;
			tmp = q[i + 1];
			++i;
		}
		res = max(res, cnt);
	}
	cout << n - res << endl;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (a < b) {
    ll tmp = a;
    a = b;
    b = tmp;
  }
  ll r = a%b;
  while(r != 0) {
    a = b;
    b = r;
    r = a%b;
  }
  return b;
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool prime(ll n) {
  if (n == 1) {
    return false;
  } else {
    for (ll i = 2; i <= (ll)pow(n, 0.5); i++) {
      if (n%i == 0) return false;
    }
  }
  return true;
}
ll RepeatSquaring(ll n, ll p, ll m) {
  if (p == 0) return 1;
  if (p%2 == 0) {
    ll t = RepeatSquaring(n, p/2, m);
    return (t*t)%m;
  }
  return (n*RepeatSquaring(n, p-1, m))%m;
}

int main() {
  ll n, m;
  cin >> n >> m;
  priority_queue <ll> pq;
  rep(i, n) {
    ll a;
    cin >> a;
    pq.push(a);
  }
  rep(i, m) {
    ll a = pq.top();
    pq.pop();
    pq.push(a/2);
  }
  ll ans = 0;
  while (!pq.empty()) {
    ll a = pq.top();
    pq.pop();
    ans += a;
  }
  cout << ans << endl;
}

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

int main() {
  int N, S,H,T,I,a,b,c;
  cin >> N;
  S = N/1000;   //1    or 8---
  H = N/100;    //11   or 81--
  T = N/10;     //111  or 811-
  I = N;        //1118 or 8111
  
  a = I-S*1000;          //111     8111-8*1000
  b = T-S*100;           // 11
  c = H-S*10;            //  1
  
  
  if((H-S == S*10 && T-H == S*100)||(a == b*10+c && b == c*10+c )){
    cout << "Yes" << endl;
    }else{cout << "No" << endl;
   }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long
#define Test(tt) cout << "Case #" << tt << ": "

using namespace std;



int main() {
#ifdef HOME
    ifstream cin("B.in");
    ofstream cout("B.out");
#endif
   	int	i, n, k;
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    cin >> n >> k;
    vector<int> arr(n + 1);
    for(i = 1; i <= n; i++) {
    	cin >> arr[i];
    }

    vector<int> sp(n + 2);

    while(k--) {
    	int cnt = 0;
    	for(i = 1; i <= n; i++) {
    		sp[i] = 0;
    		if(arr[i] == n) {
    			cnt++;
    		}
    	}
    	if(cnt == n) {
    		break;
    	}
    	for(i = 1; i <= n; i++) {
    		int l = max(1, i - arr[i]);
    		int r = min(n + 1, i + arr[i] + 1);
    		sp[l]++;
    		sp[r]--;
    	}
    	for(i = 1; i <= n; i++) {
    		sp[i] += sp[i - 1];
    		arr[i] = sp[i];
    	}
    }

    for(i = 1; i <= n; i++) {
    	cout << arr[i] << " ";
    }
	
    return 0;
}

Measured memory_bytes: 4772
N = int(input())
A = list(map(int, input().split()))
def gcd(m,n):
    m,n = max(m,n), min(m,n)
    while n > 0:
        m, n = n, m%n
    return(m)

g = A[0]
for i in range(N):
    if g == 1:
        break
    else:
        g = gcd(g,A[i])

print(g)


Measured memory_bytes: 14252
#include<iostream>

using namespace std;

int main(){
  int m,f,r,S[50][3],x=0;
  // インプット
  for(int i=0;i<50;i++){
    cin>>m>>f>>r;
    if(m==-1&&f==-1&&r==-1)break;
    if(m==-1)f=0;
    if(f==-1)m=0;
    S[i][0]=m;
    S[i][1]=f;
    S[i][2]=r;
    x++;
  }
  // アウトプット
  for(int i=0;i<x;i++){
    if((S[i][0]+S[i][1])>=80)cout<<"A"<<endl;
    if((S[i][0]+S[i][1])>=65&&(S[i][0]+S[i][1])<80)cout<<"B"<<endl;
    if((S[i][0]+S[i][1])>=50&&(S[i][0]+S[i][1])<65)cout<<"C"<<endl;
    if((S[i][0]+S[i][1])>=30&&(S[i][0]+S[i][1])<50){
      if(S[i][2]>=50)cout<<"C"<<endl;
      if(S[i][2]<50)cout<<"D"<<endl;
    }
    if((S[i][0]+S[i][1])<30)cout<<"F"<<endl;
  }
  return 0;
}



Measured memory_bytes: 3092
using System;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            MainStream();
        }
        static void MainStream()
        {
            Scan sc = new Scan();
            write wr = new write();

            int n = sc.intarr[0];
            int[] array = sc.intarr;

            Array.Sort(array);

            int output = array[array.Length - 1] - array[0];

            Console.WriteLine(output);
        }
    }

    class Scan
    {
        public string str => Console.ReadLine();

        public string[] strarr => str.Split(' ');

        public long[] longarr => strarr.Select(long.Parse).ToArray();
        public int[] intarr => strarr.Select(int.Parse).ToArray();
        public char[] chararr => str.ToArray();


    }



    class write
    {
        public void wri<Type>(Type x)
        {
            Console.WriteLine(x);
        }
    }
}


Measured memory_bytes: 11348
#include <bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define lp(i,a,n) for(int i=(a);i<=(int)(n);++i)
#define lpd(i,a,n) for(int i=(a);i>=(int)(n);--i)
#define mem(a,b) memset(a,b,sizeof a)
#define all(v) v.begin(),v.end()
#define println(a) cout <<(a) <<endl
#define sz(x) ((int)(x).size())
#define readi(x) scanf("%d",&x)
#define read2i(x,y) scanf("%d%d",&x,&y)
#define read3i(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define mod 1000000007
#define eps 1e-8
#define infi 1000000000
#define infll 1000000000000000000ll
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef set<int> si;
typedef map<int,int> mii;

const int N = 100002;
int n,k,a[N];
map<int,bool> f;

int main(){
    read2i(n,k);
    lp(i,1,n) readi(a[i]), f[a[i]] = true;;

    if(f.count(k)) return cout <<"POSSIBLE", 0;
    if((*f.rbegin()).f < k) return cout <<"IMPOSSIBLE", 0;

    lp(i,1,n) if(f[k - a[i]]) return cout <<"POSSIBLE", 0;
    cout <<"IMPOSSIBLE";
}

/*
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
*/


Measured memory_bytes: 5888
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define INF 99999999999
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using llong = long long;
using namespace std;

int main(){
    int n;
    double x,sum=0.0;
    cin >> n;
    rep(i,n){
        cin >> x;
        sum += 1/x;
    }
    cout << fixed << setprecision(10) << 1/sum << endl;
}

Measured memory_bytes: 256
N, M = gets.split.map(&:to_i)
arr = []
NPY = M.times.map { |i| 
    [i] + gets.split.map(&:to_i) + [''] 
}.group_by { |v| 
    v[1] 
}.map { |k, v| 
    [k, v.sort_by { |a| a[2] }] 
}.each{|v|
    cnt = 1
    v[1].each{|u| 
        u[3] = sprintf("%06d%06d", v[0], cnt)
        cnt += 1
        arr << u
    }
}
arr.sort{|a, b| a[0] <=> b[0]}.map{|v| v[3]}.each{|v| puts v}


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

int main() {
	string s ; 
	cin >> s;
	
	if (s == "AAA" || s == "BBB") {
		cout << "No" << endl;
	} else {
		cout << "Yes" << endl ;
	}
		
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
/* winners never quit and quitters never win.
      #swap                                 */
      
#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;
#pragma GCC optimize ("-O3")
using ll = long long;
using ld = long double;
const ll mod = 1000000007;
const ll inf = 1000000000000000000;
const ll rk = 256;
const ld PI = 3.141592653589793;

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

template <typename T>
void make_unique(vector<T>& vec) {
  sort(all(vec));
  vec.erase(unique(all(vec)), vec.end());
}

#define endl '\n'
#define pb push_back
#define mp make_pair
#define vc vector
#define fs first
#define sec second
#define pq priority_queue
#define lb lower_bound
#define ub upper_bound
#define pll pair<ll,ll> 
#define pls pair<ll,string>
#define psl pair<string,ll>
#define plc pair<ll,char>
#define pcl pair<char,ll>
#define pss pair<string,string>
#define all(x) (x).begin(), (x).end()
#define tol(s) transform(s.begin(),s.end(),s.begin(),::tolower);
#define tou(s) transform(s.begin(),s.end(),s.begin(),::toupper);
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define T ll t=0;cin>>t;for(ll test=0;test<t;test++)

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


ll nxt() {
    ll TemporaryVariable;
    cin >> TemporaryVariable;
    return TemporaryVariable;
}

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

 
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
	//isprime();
	//coeff();
	/*freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);*/
    ll ans=inf;
    string s,s1;
    cin>>s>>s1;
    ll n=(ll)s.length(),m=(ll)s1.length();
    for(ll a=0;a<n-m+1;a++)
    {
        ll cnt=0;
        for(ll b=0;b<m;b++)
        {
            if(s1[b]!=s[a+b])
            {
                cnt++;
            }
        }
        ans=min(ans,cnt);
    }
    cout<<ans<<endl;
	printclock;
	return 0;
}

Measured memory_bytes: 3852
#include <bits/stdc++.h>
#define pb push_back
#define s(a, x, y) sort(a.begin()+x, a.begin()+y);
#define mp make_pair
#define F first
#define S second
#define ll long long
using namespace std;
ll n, k, sum;
vector<int> a(1002);
int main() {
	cin>>n>>k;
	for(int i=0; i<n; i++){
	    cin>>a[i];
	}
	sort(a.begin(), a.begin()+n);
	for(int i=0; i<k; i++) sum+=a[i];
	cout<<sum;
	return 0;
}

Measured memory_bytes: 3556
N = gets.chomp.to_i
H = gets.chomp.split(" ").map(&:to_i)

dp = {}
dp[0] = 0

1.upto(N-1) do |i|
  h1 = dp[i-1] + (H[i] - H[i-1]).abs
  h2 = i > 1 ? dp[i-2] + (H[i] - H[i-2]).abs : nil
  dp[i] = [h1, h2].compact.min
end

puts dp[N-1]


Measured memory_bytes: 17540
#include <stdio.h>
#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
  	char weather[6];
  	scanf("%s", weather);
  	NSString *weatherString = [[NSString alloc] initWithUTF8String:weather];
  
  	NSMutableDictionary *weathers = [[NSMutableDictionary alloc] init];
    [weathers setValue:@"Rainy" forKey:@"Cloudy"];
    [weathers setValue:@"Sunny" forKey:@"Rainy"];
    [weathers setValue:@"Cloudy" forKey:@"Sunny"];
  	
  	
  	printf("%s", [(NSString *) [weathers valueForKey: weatherString] UTF8String]);
  	return 0;
}

Measured memory_bytes: 9504
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define pb push_back
#define ifr(a, value) insert(a.begin(), value)
#define pf push_front
#define eb emplace_back
#define ef emplace_front
#define all(x) (x).begin(),(x).end()
#define ff first
#define ss second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define szz(v) ((int)(v).size())  
#define vi vector<int>
#define vll vector<ll>
#define str string
#define fr(i, j, k) for(i = j; i < k; i++)
#define bk(i, j, k) for(i = j; i >= k; i--)
#define frit(a, it) for(__typeof((a).begin()) it = a.begin(); it != a.end(); ++it)
#define mem(ptr)  memset(ptr, 0, sizeof ptr)        // use fill() for value other than 0 //
#define rtn return 
#define clk fprintf(stderr, "\nTIME = %lf\n", 1.0 * clock()/CLOCKS_PER_SEC)
#define nl "\n"
#define inf 1LL<<61
#define dbg(x) (cerr << #x << ": " << x << "\n")
const long long mod = 1e9+7;

ll gcd(ll a,ll b) { return b==0 ? a : gcd(b, a%b); }   // no need to swap a, b, it auto. happens after first call //
ll expo(ll x, ll y){ ll res = 1; x = x % mod;  while (y > 0) { if (y & 1)res = (res*x) % mod; y = y>>1;x = (x*x) % mod;}return res;}
void matmul(ll a[][2], ll b[][2]) { ll tmp[2][2]; for(int i=0; i<2; i++) { for(int j=0; j<2; j++) { tmp[i][j] = 0; for(int k=0; k<2; k++) tmp[i][j] = (tmp[i][j] + a[i][k]*b[k][j]) % mod; }} for(int i=0; i<2; i++) for(int j=0; j<2; j++) a[i][j] = tmp[i][j]; }
ll fibo(int n)    // returns nth fibonacci number, also S(n) = f(n+2)-1
{ if(n == 0) return 0; else if(n == 1) return 1; ll T[2][2] = { {0, 1} , {1, 1} }; ll res[2][2] = { {1, 0}, {0,1} }; n--; while(n) { if(n & 1) matmul(res, T); n >>= 1; matmul(T, T); } return res[1][1]; }

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int n, i;
    cin >> n;
    str s;
    cin >> s;
    int eb[n], wb[n], ea[n], wa[n], ce = 0, cw = 0;
    mem(eb);
    mem(wb); 
    mem(ea);
    mem(wa);
    
    fr(i, 0, n)
    {
        if(! i)
        {
            if(s[i] == 'E')
                eb[i] = 1;
            else wb[i] = 1;
        }
        else
        {
            if(s[i] == 'E')
            {
                eb[i] = eb[i-1]+1;
                wb[i] += wb[i-1];
            }
            else 
            {
                wb[i] = wb[i-1] + 1;
                eb[i] += eb[i-1];
            }
        }
        s[i]=='E' ? ce++ : cw++;
    }
    fr(i, 0, n)
    {
        ea[i] = ce - eb[i];
        wa[i] = cw - wb[i];
    }
    
    int tmp, mn = 1e6;
    fr(i, 0, n)
    {
        tmp = 0;
        if(s[i] == 'E')
        {
                tmp += wb[i];
                tmp += ea[i];
        }
        else
        {
            tmp += wb[i]-1;
            tmp += ea[i];
        }
        mn = min(mn, tmp);
    //    dbg(i); dbg(tmp);
    }
    cout << mn;
    return 0;
}

Measured memory_bytes: 5396
i=gets.split(' ').map(&:to_f)
a=i[0]
b=i[1]
C=i[2]
pi=Math.atan2(1,1)*4
h=b*Math.sin(C*pi/180)
S=a*h/2
c2=a*a+b*b-2*a*b*Math.cos(C*pi/180)
L=a+b+Math.sqrt(c2)
printf("%f\n",S)
printf("%f\n",L)
printf("%f\n",h)

Measured memory_bytes: 9020
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <list>


using namespace std;

const int MODULE = 1e9 + 7;

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

    vector<int> T(N);
    vector<int> R(N, 1);

    for (int i = 0; i < N; ++i) {
        cin >> T.at(i);
        if (i == 0 || T.at(i) > T.at(i - 1)) {
            R.at(i) = 0;
        } else {
            R.at(i) = T.at(i);
        }
    }

    int pre = -1;
    int cur = -1;

    for (int i = 0; i < N; ++i) {
        pre = cur;
        cin >> cur;
        if (i == 0) {
            continue;
        }
        if (cur < pre) {
            if ( (R.at(i - 1) == 0 && pre != T.at(i - 1))
                || (R.at(i - 1) > 0 && pre > T.at(i - 1)) ) {
                cout << 0 << endl;
                return 0;
            }
            R.at(i - 1) = 1;
        } else {
            if (R.at(i - 1) == 0) {
                if (T.at(i - 1) > pre) {
                    cout << 0 << endl;
                    return 0;
                }
                R.at(i - 1) = 1;
            } else {
                R.at(i - 1) = min(pre, T.at(i - 1));
            }
        }
    }

    if ( (R.at(N - 1) == 0 && T.at(N - 1) != cur)
         || (R.at(N - 1) > 0 && T.at(N - 1) < cur) ) {
        cout << 0 << endl;
        return 0;
    }

    R.at(N - 1) = R.at(0) = 1;

    long long sum = 1;

    for (int i = 0; i < N; ++i) {
        sum = (sum * R.at(i)) % MODULE;
    }

    cout << sum << endl;

    return 0;
}



Measured memory_bytes: 1152
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
#include <bitset>
#include <functional>
#include <cassert>
using namespace std;
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define MOD (long long int)(1e9+7)
#define INF (int)(1e9)
#define LINF (long long int)(1e18)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  if(n <= 1e7){
    ret *= kaijo(n); ret %= MOD;
    ret *= gyaku_kaijo(r); ret %= MOD;
    ret *= gyaku_kaijo(n-r); ret %= MOD;
  }else{
    rep(i,r){
      ret *= n-i; ret %= MOD;
      ret *= mpow(r-i, MOD-2); ret %= MOD;
    }
  }
  return ret;
}

/*
std::mt19937 mt{ std::random_device{}() };

std::uniform_int_distribution<int> dist(1, 6);
dist(mt);

while(1){
	val;
	cout << val << endl;
	sol1 = solver1();
	sol2 = solver2();
	if(sol1==sol2){
	cout << "OK" << endl;
	}else{
	cout << "NG" << endl;
	cout << sol1 << endl;
	cout << sol2 << endl;
	break;
	}
}
*/

int main(void){
  fast_io
  cout<<fixed<<setprecision(15);
  int x;
  cin >> x;
  cout << 1-x << endl;
  return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

const int MOD_TYPE = 1;
const ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const ld DINF = 1e12;
const ld PI = acos(-1.0);
const ld EPS = 1e-11;

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define possible(n) cout << ((n) ? "possible" : "impossible") << endl
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << endl;

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);

  ll n, a, b;
  cin >> n >> a >> b;
  ll ans = 0;
  ans += (n / (a + b)) * a;
  n %= a + b;
  ans += min(n, a);
  cout << ans << endl;
  return 0;
}

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

#define ld long double
#define ll long long int
#define ull unsigned long long int
#define vi vector<int>
#define vl vector<ll>
#define vvi vector< vector<int> >
#define vvl vector< vector<ll> >
#define repd(i, a, b) for (int i=(a);i<(b);i++)
#define rep(i, n) repd(i,0,n)
#define ALL(v) v.begin(), v.end()
#define INF 1e9

using namespace std;

/**
 * calculate GCD(greatest common divisor)
 * @param a
 * @param b
 * @return
 */
unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

/**
 * change minimum
 * @tparam T
 * @param a
 * @param b
 * @return bool
 */
template<class T>
inline bool changeMinimum(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

/**
 * change maximum
 * @tparam T
 * @param a
 * @param b
 * @return bool
 */
template<class T>
inline bool changeMaximum(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

/**
 * output answer
 * @tparam T
 * @param answer
 * @return
 */
template<typename T>
T output(T answer) {
    cout << answer << endl;
    return 0;
}

/** ----from here ---------------------------------------------------------- */

int main() {
    vi x(4);
    vi y(4);
    rep(i, 2) { cin >> x[i] >> y[i]; }

    int c = x[1]-x[0];
    int d = y[1]-y[0];

    cout<<x[1]-d<<" ";
    cout<<y[1]+c<<" ";
    cout<<x[0]-d<<" ";
    cout<<y[0]+c<<endl;

}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <complex>

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

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n;
	cin >> n;
	if (n % 2) cout << 0;
	else {
		ll answer = 0;
		for (ll i = 5; n / i != 0; i *= 5) {
			answer += (n / i / 2);
		}
		cout << answer;
	}

	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <set>
#include <string>
#include <vector>
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) sort((a).rbegin(), (a).rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define FORSTEP(i, start, end, step) for (int i = start; i < end; i += step)
#define ALL(a) a.begin(), a.end()
typedef long long ll;
using namespace std;

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

    int a, b, c;
    cin >> a >> b >> c;

    if (a + b >= c && a <= c) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long int
using namespace std;
const int N = 1e6 + 5;
const ll inf = -1e18;
const int MOD = 1e9 + 7;



int main(){
   fast;
   ll n;
   cin >> n;
   for(int i = 0; i < 100; i++){
   	for(int j = 0; j < 100; j++){
   		if(i * 4 + j * 7 == n)
   			return cout << "Yes", 0;
   	}
   }
   cout << "No";




   return 0;
} 

Measured memory_bytes: 256
def ifTriangle(a, b, c):
    if (a**2) + (b**2) == c**2: print("YES")
    else: print("NO")

n=int(input())
for i in range(n):
    lines=list(map(int, input().split()))
    lines.sort()
    ifTriangle(lines[0], lines[1], lines[2])

Measured memory_bytes: 5600
#include <iostream>
#include <climits>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
int Max(int(a), int(b), int(c)) {
	return max(max(a, b), c);
}
int Min(int(a), int(b), int(c)) {
	return min(min(a, b), c);
}





int main() {

	string S,T,an="Yes";
	cin >> S>>T;
	rep(i, S.size()) {
		if (S.at(i) != T.at(i)) {
			an = "No";
		}
	}
	cout << an << endl;


}


Measured memory_bytes: 3632
(n,q),*abpx = [list(map(int, s.split())) for s in open(0)]
ab,px = abpx[:n-1],abpx[n-1:]

from collections import defaultdict, deque
add = defaultdict(int)

for p,x in px:
    add[p] += x

links = defaultdict(set)

for a,b in ab:
    links[a].add(b)
    links[b].add(a)

passed = set()

dq = deque()
dq.append((0,1))

ans = {}

while dq:
    to_add, cur = dq.popleft()
    tmp = to_add + add[cur]
    ans[cur] = tmp
    for nx in links[cur]:
        links[nx].remove(cur)
        dq.append((tmp, nx))

print(*(ans[i] for i in range(1,n+1)))

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

int main() {
  int N;
  double p = 0;
  cin >> N;
  vector<double> A(N);
  vector<double> B(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  for (int i = 0; i < N; i++) {
    p += 1 / A.at(i);
  }
  cout << 1/p << endl;
}

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

using namespace std;
#include <vector>
#define rep(i,n) for (int i = 0; i < (n) ; i++)
#define INF 1e9
#define llINF 1e18
#define base10_4 10000      //1e4
#define base10_5 100000     //1e5
#define base10_6 1000000    //1e6
#define base10_7 10000000   //1e7
#define base10_8 100000000  //1e8
#define base10_9 1000000000 //1e9

#define MOD 1000000007
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vint vector<int>
#define vll vector<ll>

//#include <stack>
//#include <queue>

string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 

ll A;
ll B;
ll C;
ll N;
ll M;
ll X;

ll ltmp;
string stmp;
double dtmp;

/*
max 448,000,000
map<string,ll> count_map;
count_map['0']=0;
for(auto x : count_map) {
    string key = x.first;
    ll value = x.second;
}
*/

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin >> X;
    cin >> N;
    map<ll,ll> count_map;

    rep(ni,N){
        cin >> ltmp;
        count_map[ltmp]=1;
    }
    ll ansv = 1000000;
    ll ansi = 0;
    rep(ni,110){
        if(count_map.count(ni)==0){
            ltmp = (ni-X)*(ni-X);
            if(ansv>ltmp){
                ansv = ltmp;
                ansi = ni;
            }
        }

    }
    cout << ansi << endl;
    

}

Measured memory_bytes: 3656
#include<iostream>
#include<algorithm>
#include<complex>
#include<cmath>

using namespace std;
typedef double R;
typedef complex<R> P;
#define EPS (1e-10)
struct C{P c;R r;};

double n, x, y, l;
C c[108];
C tc[108];
pair<P, P> cross_circles(C a, C b){
  R d = abs(a.c - b.c);
  R l = ((a.r*a.r - b.r*b.r) / d + d) / 2.0;
  R h = sqrt(a.r*a.r - l*l);
  P e = a.c + (b.c-a.c) * l / d;
  P p = (b.c-a.c) * h / d * P(0, -1);
  return make_pair(e + p, e - p);
}

bool able(R h){
  for(int i = 0;i < n;i++){
    tc[i] = c[i];
    if(c[i].r < h)return false;
    tc[i].r = sqrt(tc[i].r*tc[i].r - h*h);
  }
  
  vector<P> points;

  for(int i = 0;i < n;i++){
    for(int j = i + 1;j < n;j++){
      if(abs(tc[i].c - tc[j].c) > tc[i].r + tc[j].r  - EPS)continue;
      if(abs(tc[i].c - tc[j].c) < abs(tc[i].r - tc[j].r) + EPS)continue;
      pair<P, P> tmp = cross_circles(tc[i], tc[j]);
      points.push_back(tmp.first);
      points.push_back(tmp.second);
    }
    points.push_back(tc[i].c);
  }

  for(int i = 0;i < points.size();i++){
    bool tmp = true;
    P p = points[i];
    for(int j = 0;j < n;j++){
      if(abs(p - tc[j].c) > tc[j].r + EPS)tmp = false;
    }
    if(tmp == true){
      return true;
      
    }
  }
  return false;  
}

bool solve(){
  cin >> n;
  if(n == 0)return false;
  double bottom = 0.5, top = 300;
  for(int i = 0;i < n;i++){
    cin >> x >> y >> l;
    c[i].c = P(x, y);
    c[i].r = l;
    top = min(top, l);
  }
  for(int i = 0;i < 1000;i++){
    double mid = (bottom + top) / 2;
    if(able(mid))bottom = mid;
    else top = mid;
  }
  printf("%.10lf\n", bottom);
  return true;
}

int main(){
  while(solve());return 0;
}

Measured memory_bytes: 1264
import sys
input = sys.stdin.buffer.readline
a,b=map(int,input().split())
if a>0:
    print("Positive")
    exit(0)
elif a<=0 and 0<=b:
    print("Zero")
    exit(0)
elif a<0 and b<0:
    num=b-a+1
    if num%2==0:
        print("Positive")
        exit(0)
    else:
        print("Negative")
        exit(0)

Measured memory_bytes: 3064