akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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 mod=1e9+7;

int main(){
    ll n,m;
    cin >> n >> m;
    ll ans=min(m/2,n);
    if(m-2*n>0){
        ans+=(m-2*n)/4;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
void pre(){}
void solve(){
    long double n;cin>>n;
    cout<<2.0*3.14*n<<"\n";
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    pre();
    long long int num = 1;
    //cin>>num;
    for(long long int i=0;i<num;i++){
       	solve();
    }   
}


Measured memory_bytes: 3804
#include <stdio.h>
int abs(int x) {
	return (x > 0) ? x : (-x);
}
int main() {
	int n, dis;
	int t, x, y;
	int tt, xx, yy;
	scanf("%d", &n);
	tt = 0; xx = 0; yy = 0;
	for (int i = 0; i < n; i++)
	{
		scanf("%d%d%d", &t, &x, &y);
		dis = abs(x - xx) + abs(y - yy);
		if (dis > (t-tt) || ((t - tt) - dis) % 2 != 0)
		{
			printf("No");
			return 0;
		}
		tt = t; xx = x; yy = y;
	}
	printf("Yes");
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++) 
#define rep(i,n); for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b); 
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={0,1,0,-1,1,-1,-1,1};
int dy[]={1,0,-1,0,1,1,-1,-1};
const int MOD = 1e9+7;
const int INF = 1e18+10;

/*----------------------------------------------*/

signed main(){
  int n;
  cin>>n;
  vi a(n);
  rep(i,n) cin>>a[i];
  rep(i,n-1) a[i+1]+=a[i];
  int ans=INF;
  rep(i,n-1){
    int snk,ari;
    snk=a[i];
    ari=a[n-1]-a[i];
    chmin(ans,abs(snk-ari));
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1920
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        int x=sc.nextInt();
        int a=sc.nextInt();
        if(x<a)
            System.out.println("0");
        else
            System.out.println("10");
    }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
const double EPS =  1e-10;
#define equals(a, b) (fabs((a) - (b)) < EPS)

class Point{
    public:
    double x, y;

    Point(double x = 0, double y = 0): x(x), y(y){}

    Point operator + (Point p){
        return Point(x + p.x, y + p.y);
    }
    Point operator - (Point p){
        return Point(x - p.x, y - p.y);
    }
    Point operator * (Point p){
        return Point(x * p.x, y * p.y);
    }
    Point operator * (double r){
        return Point(x * r, y * r);
    }
    Point operator / (Point p){
        return Point(x / p.x, y / p.y);
    }

    double abs(){
        return sqrt(norm());
    }
    double norm(){
        return x * x + y * y;
    }

    bool operator < (const Point &p) const {
        return x != p.x ? x < p.x : y < p.y;
    }
    bool operator == (const Point &p) const {
        return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
    }
    
    
};

typedef Point Vector;

class Segment : public Point{
    public:
    Point p1, p2;
    Segment(Point p1_, Point p2_){
        p1 = p1_;
        p2 = p2_;
    }
    Segment(double a, double b, double c, double d){
        Point(a, b);
        Point(c, d);
    }
    
};

typedef Segment Line;

double dot(Point a, Point b){
    return a.x * b.x + a.y * b.y;
}
double cross(Point a, Point b){
    return a.x * b.y - a.y * b.x;
}
bool isOrthogonal(Point a, Point b){
    return equals(dot(a, b), 0.0);
}
bool isParallel(Point a, Point b){
    return equals(cross(a, b), 0.0);
}
bool isOrthogonal(Segment s1, Segment s2){
    return equals(dot(s1.p2 - s1.p1, s2.p2 - s1.p1), 0.0);
}
bool isParallel(Segment s1, Segment s2){
    return equals(cross(s1.p2 - s1.p1, s2.p2 - s1.p1), 0.0);
}

Point project(Segment s, Point p){
    Vector base = s.p2 - s.p1;
    double r = dot(p - s.p1, base) / base.norm();
    //Vector tmp = s.p1 + base * r;
    Vector tmp = base * r;
    return s.p1 + base * r;
}

Point reflect(Segment s, Point p){
    return p + (project(s, p) - p) * 2;
}

int main(void){
    Point p0, p1, p2;
    
    std::cin >> p0.x >> p0.y >> p1.x >> p1.y;
    Vector a = p1 - p0;
    int q;
    std::cin >> q;

    for(int i = 0; i < q; i++){
        std::cin >> p2.x >> p2.y;
        Vector b = p2 - p0;
        if( cross(a, b) > EPS ) std::cout << "COUNTER_CLOCKWISE" << std::endl;
        else if( cross(a, b) < -EPS ) std::cout << "CLOCKWISE" << std::endl;
        else if( dot(a, b) < -EPS ) std::cout << "ONLINE_BACK" << std::endl;
        else if( a.norm() < b.norm() ) std::cout << "ONLINE_FRONT" << std::endl;
        //std::cout << std::fixed << std::setprecision(10) << ans.x << " " << ans.y << std::endl;
        else std::cout << "ON_SEGMENT" << std::endl;
    }

    return 0;
}



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

int main() {
  int n;
  cin >> n;
  vector<int> h(n);
  rep(i, n) cin >> h[i];
  vector<ll> dp(n, 1e12);
  dp[0] = 0;
  rep(i, n) {
    if (i+1 < n) dp[i+1] = min(dp[i+1], dp[i] + abs(h[i] - h[i+1]));
    if (i+2 < n) dp[i+2] = min(dp[i+2], dp[i] + abs(h[i] - h[i+2]));
  }
  cout << dp[n-1] << endl;
  return 0;
}

Measured memory_bytes: 4244
#include<stdio.h>
#include<math.h>
#include<string.h>
int main()
{
  int N,X,T,ans;
  scanf("%d%d%d",&N,&X,&T);
  ans=((N-1)/X+1)*T;
  printf("%d\n",ans);
  return 0;
}


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

int kakuketanowa (int x) {
  int t=0;
  while (x>0) {
    t+=x%10;
    x/=10;
  }
  return t;
}
int main() {
  int N;
  cin>>N;
  
  int p = kakuketanowa (N);
  if (N % p == 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }
 
using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;
 
//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};
 
const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod


#include <bits/stdc++.h>
using namespace std;
signed main(){
    string a,b;
    cin>>a>>b;
    int c = stoi(a+b);
    bool ans = false;
    for(int i=0; i*i<=c; i++){
        if(i*i ==c){
            ans = true;
        }
    }
    if(ans) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

using namespace std;

typedef long long int ll;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl "\n"

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    ll N, M;
    cin >> N >> M;

    if(M <= 2*N)
    {
        cout << M/2 << endl;
    }

    else
    {
        cout << N + (M-2*N)/4 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
n,m = map(int, input().split())
t = [[n] for i in range(n)]
for i in range(m):
  a,b = map(int, input().split())
  t[a-1].append(b-1)
g = []
for i in t:
  g.append(sorted(i))
k = 0
ans=0
while k <=n-1:
  e = n
  for i in g[k:]:
    e = min(e,i[0])
  if e==n:
    break
  ans+=1
  k = e
print(ans)

Measured memory_bytes: 222220
#include<iostream>

using namespace std;

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


Measured memory_bytes: 3012
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
using namespace std;
#define INF 0x3f3f3f3f
//#define INF 1100000000000000000LL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=100050;
//ここまでテンプレ
//↓座標圧縮：vectorを入れると対応関係をmap[旧座標]=新座標で返す
map<int,int> comp(vector<int> v){
	map<int,int> pam;
	int sz=v.size();
	for(int i=0;i<sz;i++){
		pam[v[i]]=0;
	}
	//新座標が1からほしいときはnc=1にする
	int nc=0;
	for(pair<int,int> i:pam){
		pam[i.first]=nc;
		nc++;
	}
	return pam;
}
//↑座標圧縮
int main() {
	vint v;
	set<int> tes;
	int N;
	cin>>N;
	for(int i=0;i<N;i++){
		int c;
		cin>>c;
		v.pb(c);
		tes.insert(c);
	}
	map<int,int> pam=comp(v);
	int a[SIZE]={};
	for(int i=0;i<N;i++){
		a[pam[v[i]]]++;
	}
	int ans=0;
	for(int i:tes){
		if(a[pam[i]]>i)
			ans+=a[pam[i]]-i;
		if(a[pam[i]]<i)
			ans+=a[pam[i]];
	}
	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 9980
import numpy as np
import itertools

N = input()
flag = int(N[-1])

hon = [2, 4, 5, 7, 9]
pon = [0, 1, 6, 8]
bon = 3

if flag in hon:
  print("hon")
elif flag in pon:
  print("pon")
else:
  print("bon")

Measured memory_bytes: 26964
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main(){
    ll x;
    cin >> x;
    ll ans = ( x / 11LL ) * 2LL;
    ll rest = x % 11LL;
    if ( rest == 0 ) {
        cout << ans << endl;
    }
    else if ( rest <= 6LL ) {
        cout << ans + 1LL << endl;
    }
    else {
        cout << ans + 2LL << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import sys
def input():
    return sys.stdin.readline()[:-1]

from itertools import count
def test():
    x, n = map(int, input().split())
    p = [int(i) for i in input().split()]
    for i in count():
        if x - i not in p:
            print(x - i)
            break
        if x + i not in p:
            print(x + i)
            break

test()

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define ALL(name) name.begin(),name.end()
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 8000

int H, W;
vector< vector<int> > A, B, AB;
int dp[81][81][MAX_N];

// 今 [i][j] にいて、現在の偏りが n のときの最小の偏り
int dfs(int i, int j, int n) {
    if(i == H-1 && j == W-1) {
        int cand1 = n + AB[i][j];
        int cand2 = abs(n - AB[i][j]);
        dp[i][j][n] = min(cand1, cand2);
        return dp[i][j][n];
    }

    // 考慮しない
    if(n >= MAX_N) { return LLINF; }

    int& ret = dp[i][j][n];
    if(~ret) { return ret; }
    ret = LLINF;

    // n に対して足すパターン
    int n1 = abs(n + AB[i][j]);
    if(j < W-1) { ret = min(ret, dfs(i, j + 1, n1)); }
    if(i < H-1) { ret = min(ret, dfs(i + 1, j, n1)); }

    // n に対して引くパターン
    int n2 = abs(n - AB[i][j]);
    if(j < W-1) { ret = min(ret, dfs(i, j + 1, n2)); }
    if(i < H-1) { ret = min(ret, dfs(i + 1, j, n2)); }

    return ret;
}

int solve() {
    MINUS(dp);
    return dfs(0, 0, 0);
}

signed main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cin >> H >> W;

    A.assign(H, vector<int>(W, 0));
    B.assign(H, vector<int>(W, 0));
    AB.assign(H, vector<int>(W, 0));
    REP(i, H) {
        REP(j, W) {
            cin >> A[i][j];
        }
    }
    REP(i, H) {
        REP(j, W) {
            cin >> B[i][j];
            AB[i][j] = abs(A[i][j] - B[i][j]);
        }
    }

    int ans = solve();
    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 410496
n=int(input())
import numpy as np
while True:
  r=True
  #print(n)

  for ii in np.arange(2,n//2):
    #print(n//(ii+1),n/(ii+1))
    if n//(ii+1)==n/(ii+1):
      r=False
      break

  #exit()
  if r:
    print(n)
    exit()
  n+=1


Measured memory_bytes: 12792
def action_handler(a_array, b_array, c_array)
  result = 0
  current_number = 0
  for i in 0..a_array.size - 1
    row = a_array[i] - 1
    result += b_array[row]
    if current_number != 0 && (a_array[i] - current_number) == 1
      result += c_array[current_number - 1]
    end
    current_number = a_array[i]
  end
  return result
end

n = gets.to_i
a_array = gets.chop.split.map(&:to_i)
b_array = gets.chop.split.map(&:to_i)
c_array = gets.chop.split.map(&:to_i)

print action_handler(a_array, b_array, c_array)


Measured memory_bytes: 1788
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s =  sc.next();
    String t =  sc.next();
    String s1[] = s.split("",0);
    String t1[] = t.split("",0);
    Arrays.sort(s1);
    Arrays.sort(t1,Comparator.reverseOrder());
    s = String.join("",s1);
    t = String.join("",t1);
    if(s.compareTo(t)<0){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}


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


Measured memory_bytes: 640
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("faild to read char") as char)
        .take_while(|c| !c.is_whitespace())
        .collect();
    token
        .parse()
        .ok()
        .expect("faild to parse token")
}

fn main(){
    let n: u64 = read();
    let mut ret = 0;
    for i in 1..=n {
        let cnt = n / i;
        ret += (cnt + 1) * cnt / 2 * i;
    }

    println!("{}", ret);
}


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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

string S;
int K;
ll DP1[105][105], DP2[105][105];

int main(){
  cin >> S >> K;

  int N = S.length();
  DP1[0][0] = 1; DP1[0][1] = S[0] - '1';
  DP2[0][1] = 1;

  for (int i = 1; i < N; i++){
    ll now = S[i] - '0';
    if (now == 0){
      for (int j = 0; j <= K; j++){
        DP2[i][j] = DP2[i-1][j];
        DP1[i][j] += DP1[i-1][j];
        DP1[i][j+1] += DP1[i-1][j] * 9;
      }
      continue;
    }

    for (int j = 0; j <= K; j++){
      DP2[i][j+1] = DP2[i-1][j];
      DP1[i][j] += DP1[i-1][j];
      DP1[i][j+1] += DP1[i-1][j] * 9;
      DP1[i][j] += DP2[i-1][j];
      DP1[i][j+1] += DP2[i-1][j] * (now - 1); 
    }
  }

  cout << DP1[N-1][K] + DP2[N-1][K] << endl;
  return 0;
}


Measured memory_bytes: 3772
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	/* ??¶?´??????????????????? */
	public static int judge(ArrayList<Integer> parse, int len) {
		int result = 0;
		int t = 0; //????????????????????°
		while (t < len) {
			if (parse.get(t) < 0 || parse.get(t) > 100) {
				result = 1;
				break;
			} else {
				result = 0;
			}
			++t; //???????????????
		}
		return result;
	}

	public static void main(String[] args) throws IOException {
		int a, b, c;
		int temp = 0;
		String str;

		/* ???????????£?¨? */
		ArrayList<String> st = new ArrayList<String>();
		ArrayList<Integer> parse = new ArrayList<Integer>(); // int??????

		Scanner scan = new Scanner(System.in);
		for (int i = 0; i < 3; i++) {
			st.add(scan.next());
		}

		int len = st.size(); // ?????????????´???°

		/**
		 * String???int????????¨int????????????????´?
		 */

		for (int p = 0; p < len; p++) {
			str = st.get(p);
			temp = Integer.parseInt(str);
			parse.add(temp);
		}

		a = parse.get(0);
		b = parse.get(1);
		c = parse.get(2);


		/* ????????¨???????????? */
		if (judge(parse, len) == 0) { // judge???????????????????????????0??????,????????????.
			if (a < b && b < c) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
		} else if (judge(parse, len) == 1) { // judge???????????????????????????1???????????\?????????????????°???????????§??????
			System.out.println("??\?????°??????0~100??\?????§???.???????????????.");
		}

	}

}

Measured memory_bytes: 26068
D, G = map(int, input().split())
p = [list(map(int, input().split())) for _ in range(D)]
plst = [0] * D
ans = 0
for i in range(D):
    ans += p[i][0]

def dfs(n):
    global ans
    if n == D:
        cnt = 0
        total = 0
        for i in range(D):
            if plst[i] == 0:
                continue
            elif plst[i] == 1:
                cnt += p[i][0]
                total += (100 * (i + 1) * p[i][0]) + p[i][1]
        for j in range(D):
            if plst[j] == 2:
                for k in range(p[j][0] - 1):
                    total += (100 * (j + 1))
                    cnt += 1
                    if total >= G:
                        break
        if total >= G:
            ans = min(ans, cnt)
        return

    for i in range(3):
        plst[n] = i
        dfs(n + 1)
    return

dfs(0)
print(ans)

Measured memory_bytes: 56284
use std::str::FromStr;
struct Input {
    line: Vec<String>,
    position: usize
}
impl Input {
    fn new() -> Input {
        Input{line:vec![], position: 0}
    }
    fn read_word(&mut self) -> &String {
        if self.position == self.line.len() {
            let mut line= String::new();
            std::io::stdin().read_line(&mut line);
            self.line = line.split_whitespace().map(|x|x.to_string()).collect();
            self.position = 0
        }
        let result = &self.line[self.position];
        self.position += 1;
        result
    }
    fn read<T: FromStr>(&mut self, result: &mut T) -> &mut Input {
        *result = self.read_word().parse().ok().unwrap();
        self
    }
    fn get<T: FromStr>(&mut self) -> Result<T, T::Err> {
        self.read_word().parse()
    }
}
fn main() {
    let mut input = Input::new();
    let x: i32 = input.get().unwrap();
    println!("{}", x * x * x);
}



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

#define pb push_back
#define loop(i,l,r) for(int i = (l); i < (r); i++)
#define rloop(i,r,l) for(int i = (r-1); i >= (l); i--)
#define refloop(x, v) for(auto& x : (v))
#define exists(m,e) if((m).find(e) != (m).end())
#define nexists(m,e) if((m).find(e) == (m).end())
#define sortaka(v) sort((v).begin(), (v).end())
#define rsort(v) sort((v).rbegin(), (v).rend())
#define lower_bound_index(v, x) (lower_bound((v).begin(), (v).end(), x)-(v).begin()) // returns minimum i s.t v[i] >= x
#define upper_bound_index(v, x) (upper_bound((v).begin(), (v).end(), x)-(v).begin()) // returns minimum i s.t v[i] > x
#define scanint(x) scanf("%d", &(x))
#define scanfloat(x) scanf("%f", &(x))
#define scanll(x) scanf("%lld", &(x))
#define scanchar(x) scanf("%c", &(x))
#define scanstring(x) scanf("%s", &(x))
#define printint(x) printf("%d", x)
#define printfloat(x) printf("%.9f", x)
#define printll(x) printf("%lld", x)
#define printchar(x) printf("%c", x)
#define printstring(x) printf("%s", x)
#define printintnewline(x) printf("%d\n", x)
#define printfloatnewline(x) printf("%.9f\n", x)
#define printllnewline(x) printf("%lld\n", x)
#define printcharnewline(x) printf("%c\n", x)
#define printstringnewline(x) printf("%s\n", x)
#define square(x) ((x)*(x))
#define cube(x) ((x)*(x)*(x))

typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<pair<int, int>> vpii;
typedef vector<pair<long long, long long>> vpll;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long>> vvl;
typedef vector<string> vs;
typedef vector<vector<pair<int, int>>> vvpii;
typedef vector<vector<pair<long long, long long>>> vvpll;
typedef map<int,int> mii;
typedef map<string,int> msi;
typedef long long ll;

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

    ll a, b, c, d; cin >> a >> b >> c >> d;
    cout<<max({a*c,a*d,b*c,b*d})<<endl;
}

Measured memory_bytes: 3608
import sys
input = sys.stdin.readline
from heapq import heapify, heappop, heappush
def main():
    N, K = map( int, input().split())
    P = list( map( int, input().split()))
    ans = 0
    now = -1
    cnt = 1
    CNT = [0]*N
    for i in range(N-1,-1,-1):
        p = P[i]
        if p < now:
            cnt += 1
        else:
            cnt = 1
        now = p
        if cnt >= K:
            CNT[i] = 1
    if sum(CNT) > 0:
        ans = 1
            
    for i in range(K-1):
        if P[i] > P[i+1]:
            ans += 1
            break
    Max = [ -P[i] for i in range(K)]
    Min = [ P[i] for i in range(K)]
    heapify(Max)
    heapify(Min)
    C = [0]*N
    for i in range(K, N):
        while C[Min[0]] == 1:
            heappop(Min)
        while C[-Max[0]] == 1 or Max[0] == -P[i-K]:
            heappop(Max)
        # print(C, Max)
        # print(P[i+1-K])
        # print(P[i-K], Min[0], P[i] , -Max[0])
        if CNT[i+1-K] == 1:
            pass
        elif P[i-K] == Min[0] and P[i] > -Max[0]:
            pass
        else:
            ans += 1
        C[P[i-K]] = 1
        heappush(Min, P[i])
        heappush(Max, -P[i])
    print(ans)
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 26084
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int w = scan.nextInt();
		int h = scan.nextInt();
		int n = scan.nextInt();
		int i = 0;
		int j = 0;
		int k = 0;
		int[][] c = new int[w][h];
		for(i = 0; i < w; i++) {
			for(j = 0; j < h; j++) {
				c[i][j] = 1;
			}
		}
		for(i = 0; i < n; i++) {
			int x = scan.nextInt();
			int y = scan.nextInt();
			int a = scan.nextInt();
			if(a == 1) {
				for(j = 0; j < x; j++) {
					for(k = 0; k < h; k++) {
						c[j][k] = 0;
					}
				}
			} else if(a == 2) {
				for(j = x; j < w; j++) {
					for(k = 0; k < h; k++) {
						c[j][k] = 0;
					}
				}
			} else if(a == 3) {
				for(j = 0; j < w; j++) {
					for(k = 0; k < y; k++) {
						c[j][k] = 0;
					}
				}
			} else if(a == 4) {
				for(j = 0; j < w; j++) {
					for(k = y; k < h; k++) {
						c[j][k] = 0;
					}
				}
			}
		}
		int count = 0;
		for(i = 0; i < w; i++) {
			for(j = 0; j < h; j++) {
				count = count + c[i][j];
			}
		}
		System.out.println(count);
	}
}

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


long long C[51][51];  // nCk = C[n][k]
void combinationTable( int N )
{
    for( int i = 0; i <= N; ++i ){
        for( int j = 0; j <= i; ++j ){
            if( j == 0 || j == i ) C[i][j] = 1LL;
            else C[i][j] = C[i-1][j-1] + C[i-1][j];
        }
    } 
}


int main()
{
    int N, A, B;
    cin >> N >> A >> B;
    vector<long long> v(N);
    for( int i = 0; i < N; ++i ) cin >> v[i];


    sort( v.begin(), v.end(), greater<long long>() );
    long long sum = 0;
    for( int i = 0; i < A; ++i ) sum += v[i];

    double ave = 1. * sum / A;
    cout << fixed << setprecision(10) << ave << endl;


    int numL = 0, numR = 0;
    for( int i = 0; i < A; ++i ) if( v[i] == v[A-1] ) ++numL;
    for( int i = A; i < N; ++i ) if( v[i] == v[A-1] ) ++numR;
    
    combinationTable( N );
    
    int total = numL + numR;
    long long ans = C[total][numL];;
    if( numL == A ){
        for( int i = A+1; i <= B; ++i ) ans += C[total][i];
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

#define MOD 1000000007

int dp[4001][4001][2], n, a[200000], b[200000];

int main() {
	scanf("%d", &n);
	for(int i = 0; i < n; i++) {
		scanf("%d%d", &a[i], &b[i]);
		dp[ 2000 - a[i] ][ 2000 - b[i] ][0]++;
	}
	
	dp[0][0][1] = 1;
	
	for(int i = 0; i < 4001; i++) {
	for(int j = 0; j < 4001; j++) {
	for(int k = 0; k <    2; k++) {
		int ii = (i == 0 ? 0 : dp[i - 1][j][k]);
		int jj = (j == 0 ? 0 : dp[i][j - 1][k]);
		
		dp[i][j][k] += (ii + jj) % MOD;
	}
	}
	}
	
	int ans = 0, div = 0;
	for(int i = 0; i < n; i++) {
		ans += dp[ 2000 + a[i] ][ 2000 + b[i] ][0];
		ans %= MOD;
		
		ans += MOD - dp[a[i] * 2][b[i] * 2][1];
		ans %= MOD;
	}
	
	printf("%d\n", ans % 2 == 0 ? ans / 2 : (ans + MOD) / 2 );
	
	return 0;
}


Measured memory_bytes: 126848
#include <iostream>
#include <string>
#include <fstream>
#include<vector>
#include<utility>
#include<algorithm>


using namespace std;







int main()
{

	pair<int, int> wkpair;

	int n;
	vector<pair<int, int>> vec;

	cin >> n;
	
	int wkint;

	for (int i = 0; i < n; i++) {
		cin >> wkint;

		wkpair = make_pair(wkint, i + 1);

		vec.push_back(wkpair);
	}

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


	cout << vec[0].second;
	for (int i = 1; i < n; i++) {
		cout << " " << vec[i].second;
	}
	cout << endl;

	return 0;
	
}



Measured memory_bytes: 1780
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <stack>
#include <math.h>
#include <string.h>
#include <map>
#include <bitset>

#define Z class
#define ln cout<<'\n'
#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (n); ++i)
//ASCII a=97, A=65
// int H[N]; rep(i,N) scanf("%d", &H[i]);
// int max_x = *std::max_element(x.begin(), x.end());
// int min_y = *std::min_element(y.begin(), y.end());
// sort(vec.begin(), vec.end()); std::greater<>()
// reverse(vec.begin(), vec.end());
// scanf("%s",s);
// printf("%d\n",end-start+1);
// ceil (a + (b - 1)) / b

//===== グラフ受け取り =====//
/*
    int N, M; cin >> N >> M;
    Graph G(N);
    for (int i = 0; i < M; ++i) {
        int a, b;
        cin >> a >> b;
        G[a].push_back(b);

        // 無向グラフの場合は以下を追加
        // G[b].push_back(a);
    }
    
    // == 重み付きグラフ == //
    
    struct Edge {
        int to; 
        int weight; 
        Edge(int t, int w) : to(t), weight(w) { }
    };
    using Graph = vector<vector<Edge>>;
    int main() {
        int N, M; cin >> N >> M;
        Graph G(N);
        for (int i = 0; i < M; ++i) {
            int from, to, weight;
            cin >> from >> to >> weight;
            G[from].push_back(Edge(to, weight));
        }
    }
*/    

using namespace std;
// using Edge = pair<int, int>;
// using Graph = vector<vector<Edge>>;
// using pll = pair<long long, long long>;

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;}
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
const long long INF = 1LL << 60;
bool sortbysec(const pair<int,int> &a, const pair<int,int> &b) { 
    return (a.second < b.second); 
} 

// しゃくとり
int main() {
    string s1, s2; cin >> s1 >> s2;
    
    sort(s1.begin(), s1.end());
    sort(s2.begin(), s2.end());
    reverse(s2.begin(), s2.end());
    
    if(s1 < s2) cout << "Yes" << endl;
    else cout << "No" << endl;
}






Measured memory_bytes: 256
#include <iostream>
using namespace std;
int num[100000];
int main() {
	while(true){
	int n,k;
	cin >> n >> k;
	
	if(n==0 && k==0)
		break;
	for(int i=0;i<n;i++){
		cin >> num[i];
	}
	int now=0,maxer=0;
	for(int i=0;i<k;i++){
		now+=num[i];
	}
	maxer=now;
	for(int i=k;i<n;i++){
		now+=num[i]-num[i-k];
		maxer=max(maxer,now);
	}
	cout << maxer << endl;
	}
	return 0;
}

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

const ll saidai = 1e18;

int main() {
    int N; cin >> N;
    vector<ll> A(N); for (int i = 0; i < N; i++) cin >> A[i];
    for (int i = 0; i < N; i++) {
        if (A[i] == 0) {
            cout << 0 << endl;
            return 0;
        }
    }
    ll ans = 1;
    for (int i = 0; i < N; i++) {
        ll a = A[i];
        if (saidai / a < ans) {
            cout << -1 << endl;
            return 0;
        }
        ans *= a;
    }
    cout << ans << endl;
}

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

int main(){
  int a[3];
  for (int i=0;i<3;i++){
    cin >>a[i];
  }
  sort (a,a+3);
  int cnt=0;
  if((a[0]==a[1])&&(a[0]==a[2])){
    cout<<cnt<<endl;
    return 0;
  }
  while(!(a[1]==a[2])){
      a[0]++;
      a[1]++;
      cnt++;
  }
  if(a[1]==a[2]){
    if((a[1]-a[0])%2==0){
        cnt=cnt+(a[1]-a[0])/2;
        cout<<cnt<<endl;
        return 0;
    }
    else {
        cnt=cnt+(a[1]-a[0])/2+2;
        cout<<cnt<<endl;
        return 0;
    }
  }
}

 

Measured memory_bytes: 256
import java.util.*
import java.math.*

fun main(args: Array<String>) {
    var (P,Q,R) = readLine()!!.split(" ").map { it.toInt() }
//    var N = readLine()!!.toInt()
//    val S = readLine()!!
//    val D = readLine()!!.split(" ").map { it.toLong() }
    val list = intArrayOf(P+Q,Q+R,R+P)
    println(list.min())
}


Measured memory_bytes: 37564
//#i#include "pch.h"
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <limits.h>
#include <string>
#include <stack>
#include <deque>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <time.h>
#include <stdio.h>

typedef long long ll;
typedef std::pair<int, int> Pii;
typedef std::pair<long long, long long> Pll;
typedef std::pair<double, double> Pdd;

#define rip(i, n, s) for (int i = (s);i < (int)( n ); i++)
#define mapa make_pair
#define all(a) a.begin(), a.end()
#define MM << " " <<

template<typename T>
using MaxHeap = std::priority_queue<T>;
template<typename T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<typename T>
inline bool chmax(T &a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
template<typename T>
inline bool chmin(T &a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<typename T>
std::vector<T> vec(int len, T elem) { return std::vector<T>(len, elem); }
template<typename T>
void vdeb(std::vector<T> &da) {
	for (int i = 0;i < da.size();i++) {
		if (i == da.size() - 1) std::cout << da[i];
		else std::cout << da[i] << ' ';
	}
	std::cout << std::endl;
}
template<typename T>
void vdeb(std::vector<std::vector<T>> &da) {
	for (int i = 0;i < da.size();i++) vdeb(da[i]);
	std::cout << std::endl;
}
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<ll> da(n);
	rip(i,n,0) cin >> da[i];
	ll ji = LLONG_MAX/2;
	int ans = -1;
	rip(i,101,1){
		ll gg = 0;
		rip(j,n,0){
			gg += (ll)(i-da[j])*(i-da[j]);
		}
		if(chmin(ji, gg)) ans = i;
	}
	cout << ji << endl;
}

Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int N = Integer.parseInt(sc.next());
		int T = Integer.parseInt(sc.next());
		if(N-T>0){
			out.println(N-T);
		}else{
			out.println(0);
		}
		out.flush();	
	}
}

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

const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
const int MOD=1000000007;

int p[300000];
double sum[300000];

int main(){
	int n,K;cin>>n>>K;
	rep(i,n){
		scanf("%d",&p[i]);
		sum[i]=(1+p[i])*p[i]/2/(double)p[i];
		if(i)sum[i]+=sum[i-1];
	}
	double Max=0;
	rep(i,n){
		if(i==K-1)Max=max(Max,sum[i]);
		else if(i>=K)Max=max(Max,sum[i]-sum[i-K]);
	}
	printf("%.12lf\n",Max);
}

Measured memory_bytes: 2560
//C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

//Hang in there!

using namespace std;


int main() {
	int N;
	cin >> N;
	vector<int>data(N);
	for (int i = 0; i < N; i++) {
		cin >> data[i];
	}
	int m;
	int ans = 0;
	m = data[0];
	for (int i = 0; i < N; i++) {
		if (data[i] <= m) {
			ans++;
			m = min(m, data[i]);
		}
		else {
			m = min(m, data[i]);
		}
	}
	cout << ans << endl;
}



Measured memory_bytes: 1024
from sys import stdout
printn = lambda x: stdout.write(str(x))
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

def f(x):
    if x==1:
        return 1
    elif x%2 == 0:
        return 1+2*f(x//2)
    else:
        return 1+2*f((x-1)//2)

h = inn()
print(f(h))


Measured memory_bytes: 38384
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
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 S(): return input()
def LS(): return input().split()


INF = float('inf')


n = I()
w = LI()
t = float('inf')
s_1 = 0
s_2 = sum(w)
for i in range(n):
    s_1 += w[i]
    s_2 -= w[i]
    t = min(t, abs(s_1 - s_2))
print(t)


Measured memory_bytes: 9144
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const int INF=100000000;

int main(){
	int n,ans=0;
	cin>>n;
	for(int i=1;i<=n;i++){
		int count=0;
		for(int j=1;j<=i;j++){
			if(i%j==0){
				count++;
			}
		}
		if(count==8&&i%2!=0){
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
from collections import deque
n = int(input())
q = deque()
for i in range(n):
    cmd = input().split()
    if cmd[0] == "insert":
        q.appendleft(cmd[1])
    elif cmd[0] == "delete":
        try:
            q.remove(cmd[1])
        except ValueError:
            pass
    elif cmd[0] == "deleteFirst":
        q.popleft()
    elif cmd[0] == "deleteLast":
        q.pop()

print(" ".join(q))


Measured memory_bytes: 69736
#Pythonのままだときびしい？
#100*100*200*100
n=int(input())
x=[-1]*n
y=[-1]*n
h=[-1]*n
for i in range(n):
  x[i],y[i],h[i]=map(int,input().split())

mh=max(h)
for cx in range(0,101):
  for cy in range(0,101):
    for H in range(mh,mh+216):
      if all(h[j]==max(H-abs(cx-x[j])-abs(cy-y[j]),0) for j in range(n)):
        print(cx,cy,H)
        exit()


Measured memory_bytes: 76076
#include <bits/stdc++.h>
using namespace std;
int main(){
int N, M;
  cin >> N >> M;
  vector<int> d(N, -1);
  for (int i = 0; i < M; i++){
    int s, c;
    cin >> s >> c;
    s--;
    if (d[s] != -1 && d[s] != c || s == 0 && c == 0 && N > 1){
      cout << -1;
      return 0;
    }
    d[s] = c;
  }
  if (d[0] == -1){
    if (N > 1){
      d[0] = 1;
    } else {
      d[0] = 0;
    }
  }
  for (int i = 1; i < N; i++){
    if (d[i] == -1){
      d[i] = 0;
    }
  }
  if (N == 1){
    cout << d[0];
  } else if (N == 2){
    cout << d[0] * 10 + d[1];
  } else {
    cout << d[0] * 100 + d[1] * 10 + d[2];
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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

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

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

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

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


int main(){
    std::cout << std::fixed << std::setprecision(10);
ll n;
cin>>n;
ll a[n];
for(int i=0;i<n;i++){
    cin>>a[i];
}
sort(a,a+n);
double sum=a[0];
for(int i=1;i<n;i++){
    sum=(sum+a[i])/2;
}
cout<<sum<<endl;
}





Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#define REP(i,a,b) for(i=a;i<=b;i++)
#define Rep(i,a,b) for(i=a;i>=b;i--)
using namespace std;
const int maxn=400+10,maxm=100000+10;
int a[maxm], b[maxm];
bool bz[maxn][maxn], p[maxn], lzx;
int i, j, k, l, r, t, x, y, n, m, ans;
int main(){
    //qwq
    scanf("%d%d",&n,&m);
    REP(i,1,m) scanf("%d%d",&a[i],&b[i]);
    REP(i,1,n){
        p[i]=1;
        bz[i][i]=1;
        Rep(j,m,1){
            x=a[j];y=b[j];
            if (!bz[i][x]&&!bz[i][y]) continue;
            if (bz[i][x]&&bz[i][y]){
                p[i]=0;
                break;
            }
            bz[i][x]=bz[i][y]=1;
        }
    }
    REP(i,1,n-1)
        REP(j,i+1,n)
        if (p[i]&&p[j]){
            lzx=1;
            REP(k,1,n)
                if (bz[i][k]&&bz[j][k]){
                    lzx=0;
                    break;
                }
            if (lzx) ans++;
        }
    printf("%d",ans);
}

Measured memory_bytes: 1152
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iso646.h>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>

#ifndef M_PI
#define M_PI 3.14159265358979
#endif
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

using namespace std;

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

const ll INF = 1e15;
const ll MOD = 1e9 + 7;

int main() {
    ll N;
    string S;
    cin >> N >> S;
    ll i, j;
    vector<vll> ne(3);
    for(i = 0; i < 3; i++) {
        ne[i] = vll(N);
    }
    vector<vll> pr(3);
    for(i = 0; i < 3; i++) {
        pr[i] = vll(N);
    }
    ll r = 0;
    ll g = 0;
    ll b = 0;
    for(i = 0; i < N; i++) {
        if(S[i] == 'R') {
            r++;
        }
        if(S[i] == 'G') {
            g++;
        }
        if(S[i] == 'B') {
            b++;
        }
        pr[0][i] = r;
        pr[1][i] = g;
        pr[2][i] = b;
    }
    r = 0;
    g = 0;
    b = 0;
    for(i = N - 1; i >= 0; i--) {
        if(S[i] == 'R') {
            r++;
        }
        if(S[i] == 'G') {
            g++;
        }
        if(S[i] == 'B') {
            b++;
        }
        ne[0][i] = r;
        ne[1][i] = g;
        ne[2][i] = b;
    }
    ll ans = 0;
    ll fc, sc, tc;
    for(i = 0; i < N; i++) {
        if(S[i] == 'R')
            fc = 0;
        if(S[i] == 'G')
            fc = 1;
        if(S[i] == 'B')
            fc = 2;
        for(j = i + 1; j < N; j++) {
            if(S[j] == 'R')
                sc = 0;
            if(S[j] == 'G')
                sc = 1;
            if(S[j] == 'B')
                sc = 2;
            if(S[i] == S[j]) {
                continue;
            }
            tc = 3 - fc - sc;
            ll q = j - i;
            ll sub = 0;
            if(q > 1 && j < N - 1) {
                sub += pr[tc][min(j + q - 1, N - 1)] - pr[tc][j];
            }
            if(j + q + 1 < N) {
                sub += ne[tc][j + q + 1];
            }
            ans += sub;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3220
#include<iostream>
using namespace std;
int main()
{
	long long int a,b,c=0,e;
	cin>>a>>b;
	long long int t=b-1;
	for(int i=1;c<a;i++)
	{
		for(int j=1;j<=i-1;j++)
			t=b*t;
		c=t+c;
		t=b-1;
		e=i;
	}
	cout<<e;
 } 

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 2000000000
#define MOD 1000000007
#define EPS (1e-10)

using namespace std;

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

	int cnt = 0;
	int ans = 0;
	for (int i = 0; i < 3; i++) {
		if (s[i] == 'R') {
			ans++;	
			cnt = max(cnt,ans);	
		}if (s[i] == 'S' and ans > 0) {
			cnt = max(cnt,ans);	
			ans = 0;
		}
	}
	cout << cnt << endl;

	return 0;
}


Measured memory_bytes: 3624