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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP (i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back

using namespace std;

typedef long long ll;

// const int INF = 1 << 30;
const ll INF = 1LL << 60;
// const int MOD = 1000000007;

const int M = 100000 + 5;
ll dp[M];

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

  rep (i, M) dp[i] = INF;
  dp[0] = 0;

  rep (i, N) {
    int w, v;
    cin >> w >> v;

    for (int j = M - v - 1; j >= 0; j--) {
      if (dp[j] == INF) continue;
      dp[j + v] = min(dp[j + v], dp[j] + w);
    }
  }

  for (int j = M - 1; j >= 0; j--) {
    if (dp[j] <= W) {
      cout << j << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 1024
import copy
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()

n, k = na()
s = input()
ct = 0
for i in range(n-1):
    if s[i] == s[i+1]:
        ct += 1
print(min(ct + 2 * k, n - 1))


Measured memory_bytes: 3700
import java.util.*;
import static java.lang.Math.*;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int k = sc.nextInt();
		
		// 計算
		long result = 0;
		int[][] a = new int[k][k]; 
		for(int i = 1; i <= k; i++){
		    for(int j = 1; j <= k; j++){
		        a[i-1][j-1] = gcd(i, j);
		    }
		}
		for(int i = 1; i <= k; i++){
		    for(int j = 1; j <= k; j++){
		        for(int l = 1; l <= k; l++){
		            result += gcd(a[i-1][j-1], l);
		        }
		    }
		}
		
		// 出力
		System.out.println(result);
	}
	
	static int gcd(int x, int y){
		if(y == 0) return x;
		return gcd(y , x%y);
	}
	
}



Measured memory_bytes: 27268
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  string s, t;
  cin >> s >> t;
  sort(s.begin(), s.end());
  sort(t.rbegin(), t.rend());

  if (s < t)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<double,int,double> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf=sizeof(Def)==sizeof(long long)?2e18:1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	string s=">v<^";
	int n,m;
	cin>>n>>m;
	n+=2;m+=2;
	vs in(n,string(m,'#'));
	rep(i,n-2)cin>>in[i+1];
	rep(i,n-2)in[i+1]="#"+in[i+1]+"#";
	int x,y,now,gx,gy;
	rep(i,n)rep(j,m)rep(k,4)if(in[i][j]==s[k])x=i,y=j,now=k;
	rep(i,n)rep(j,m)if(in[i][j]=='G')gx=i,gy=j,in[i][j]='.';
	bool memo[55][55][4]={0};
//	rep(i,n)cout<<in[i]<<endl;
	while(1){
//		cout<<x<<" "<<y<<" "<<now<<endl;
		if(memo[x][y][now])break;
		memo[x][y][now]=true;
		if(x==gx&&y==gy){
			int out=0;
			rep(i,n)rep(j,m){
				int c=0;
				rep(k,4)if(memo[i][j][k])c=1;
				out+=c;
			}
			cout<<out<<endl;
			return 0;
		}
		int nx=x+dx[now];
		int ny=y+dy[now];
		if(in[nx][ny]=='#'){
			(now+=3)%=4;
		}else{
			int mnow=(now+1)%4;
			int mx=nx+dx[mnow];
			int my=ny+dy[mnow];
//			cout<<" "<<mx<<" "<<my<<" "<<mnow<<endl;
			if(in[mx][my]=='#'){
				x=nx,y=ny;
			}else if(nx==gx&&ny==gy)x=nx,y=ny;
			else{
				x=mx,y=my,now=mnow;
				memo[nx][ny][now]=true;
			}
		}
	}
	cout<<-1<<endl;
}

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

int main()
{
    vector<int> i_vec;
    int n;
    for (int i = 0; i < 3; i++) {
        cin >> n;
        i_vec.push_back(n);
    }
    sort(i_vec.begin(), i_vec.end());
    i_vec.erase(unique(i_vec.begin(), i_vec.end()), i_vec.end());
    cout << i_vec.size() << endl;
    return 0;
}


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

int main(){
  int n,m;

  cin >> n >>m;
  vector<vector<int> > arr;
  arr.resize(n);
  
  vector<int> vec_b;
  vec_b.resize(m);
 
  vector<int> vec_c;
  vec_c.resize(n);

  for(int i=0;i<n;i++){
    arr[i].resize(m);
    for(int j=0;j<m;j++){
      cin >> arr[i][j];
    }
  }
 
  for(int i=0;i<m;i++){
    cin >> vec_b[i];
  }

  for(int i=0;i<n;i++){
    vec_c[i] = 0;
    for(int j =0;j<m;j++){
      vec_c[i] += arr[i][j] * vec_b[j];
    }
    cout << vec_c[i] << "\n";
  }

  return 0;
}


Measured memory_bytes: 3184
n,x,y = map(int,input().split())
ans = [0] * (n - 1)
for i in range(1,n):
         for j in range(i + 1,n+1):
                  a = min(abs(j - i),abs(x - i) + abs(j - y) + 1,abs(y - i) + abs(j - x) + 1)
                  ans[a-1] += 1
for k in range(len(ans)):
         print(ans[k])


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

void swap(int*, int*);

int main()
{
  int i,n,m,min,ban;
  cin>>n>>m;

  int* a;
  a= new int [m];

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

  for(i=0;i<m;i++){
    ban=i;
    min=a[i];
    for(int j=i;j<m;j++){
      
      if(min>a[j]){
        min=a[j];
        ban=j;
      }
      
    }
    swap(&a[i],&a[ban]);

  }

  ban=0;
  for(i=0;i<m;i++){
    if(a[i]<=m) ban++;
    else break;
  }

  cout<<m-ban<<endl;

  //for(i=0;i<m;i++) cout<<a[i]<<endl;

  delete [] a;
  return 0;

}

void swap(int* a,int* b){
  int c;
  c = *a;
  *a = *b;
  *b= c;
}




Measured memory_bytes: 3108
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>

using namespace std;

int main(){
	int n, k;
	cin >> k >> n;
	if(k >= n){
		if(k%n==0){
			cout << 0;
		} else {
			cout << 1;
		}
	} else { cout << 1;}

	return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;


/**
 * AIZU ONLINE JUDGE
 * 0654
 *  2020/5/5
 */
public class Main {


    class Mnt {
        int a;
        int m; // 1山 0谷
        public Mnt(int a, int m) {
            this.a = a;
            this.m = m;
        }
    }


    boolean main() throws IOException {

        Scanner sc = new Scanner(systemin);

        int N = sc.nextInt();
        boolean up = true;
        int old = -1;
        boolean all0 = true;
        List<Mnt> list = new ArrayList<>();
        for(int i = 0;i <= N; i++) {
            int A;
            if (N == i)
                A = 0; // 最後
            else
                A = sc.nextInt();
            if (A != 0)
                all0 = false;
            if (up && A < old) {
                list.add(new Mnt(old, 1)); // 山
                up = false;
            }
            else if (!up && A > old) {
                list.add(new Mnt(old, 0)); // 谷
                up = true;
            }
            old = A;
        }
        
        list.sort((a, b) -> a.a - b.a);

        int max = 1;
        int sima = 1;
        old = -1;
        for(int i = 0; i < list.size(); i++) {
            Mnt m = list.get(i);
            if (m.a != old) {
                max = Math.max(max,  sima);
            }
            if (m.m > 0)
                sima--;
            else sima++;
            log.printf("list a = %d m = %d sima = %d max = %d\n", m.a, m.m, sima, max);
            old = m.a;
        }

        if (all0)
            max = 0;
        
        result.printf("%d\n",  max);

        sc.close();
        return false;
    }



    PrintStream log;
    PrintStream result = System.out;
    BufferedReader systemin;

    static Main instance = new Main();

    Main() {
        systemin = new BufferedReader(new InputStreamReader(System.in));
        log = new PrintStream(new OutputStream() { public void write(int b) {} } );
    }

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

        instance.main();
        instance.systemin.close();
    }


}




Measured memory_bytes: 184852
import statistics

N = int(input())
x = list(map(int, input().split()))
sx = sorted(x)
tmp = statistics.median(sx)

for i in range(N):
    if x[i] <= tmp:
        print(sx[((N - 1) // 2) + 1])
    else:
        print(sx[(N - 1) // 2])

Measured memory_bytes: 27188
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;
ll dp[ohara][3];  // i桁目まで、j=繰り上がり、

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

  cin >> s;
  rep(i, Size(s)) rep(j, 2) dp[i][j] = LINF;
  //逆から見る
  tmp = s[Size(s) - 1] - '0';
  dp[Size(s) - 1][1] = 10 - tmp;
  dp[Size(s) - 1][0] = tmp;
  rrrep(i, Size(s) - 2, 0) {
    tmp = s[i] - '0';
    rep(j, 10) {
      if (j < tmp) {
        if (j == 0) {
          dp[i][1] = min(dp[i][1], dp[i + 1][0] + 10 - tmp);
        } else {
          dp[i][1] = min({dp[i][1], dp[i + 1][0] + j + j + 10 - tmp});
        }
      } else {
        dp[i][0] = min({dp[i][0], dp[i + 1][0] + j + j - tmp});
      }
    }
    rrep(j, 1, 10) {
      if (j - 1 < tmp) {
        dp[i][1] = min({dp[i][1], dp[i + 1][1] + j + j - 1 + 10 - tmp});
      } else {
        dp[i][0] = min({dp[i][0], dp[i + 1][1] + j + j - 1 - tmp});
      }
    }
    dp[i][1] = min({dp[i][1], dp[i + 1][1] + 9 - tmp});
  }
  ans = min(dp[0][0], dp[0][1] + 1);
  Cout(ans);
  return 0;
}


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

int main(){
  int n;
  cin >> n;
  int a[105]={0},d[n];
  for(int i=0;i<n;i++){
    cin >> d[i];
    a[d[i]]++;
  }
  int cnt = 0;
  for(int i = 0;i<105;i++){
    if(a[i]>0) cnt++;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
/*#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <numeric>*/
#include<bits/stdc++.h>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll, ll> P;
typedef vector<P> vP;
const ll mod = 1e9 + 7;
ll dx[4] = {1,0,-1,0};
ll dy[4] = {0,1,0,-1};

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


Measured memory_bytes: 256
# 2019-11-25 15:34:15(JST)
import sys
def main():
    x, y = map(int, sys.stdin.readline().split())
    
    if y == 0:
        if x > 0:
            ans = x + 1
        else:
            ans = -x
    elif y > 0:
        if x > y:
            ans = x - y + 2
        elif x >= 0:
            ans = y - x
        else:
            ans = abs(y + x) + 1
    else:
        if x > 0:
            ans = abs(y + x) + 1
        elif x == 0:
            ans = -y + 1
        elif x > y:
            ans = x - y + 2
        else:
            ans = y - x
    
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
 
long int N,K,A[2100000],a[21][21],p[22];

long int dp(long int n)
{
  long int temp;
  long int s,t;
  
  if(A[n]!=-1)
  {
    return A[n];
  }  
  else
  {
    temp=0;
    t=0;
    for(s=0;s<N+1;s++)
    {
      if((n|(1<<s)) == n)
      {
        t++;
      }
    }

    for(s=0;s<N;s++)
    {
      if((n|(1<<s)) == n)
      {
        temp+=(a[t-1][s]*dp(n^(1<<s)))%1000000007;
      }
    }
  }

  temp=temp%1000000007;
  A[n]=temp;
  
  return temp;
  
}
 
int main()
{
  
  long int i,j;
  
  scanf("%ld",&N);
  

  for(i=0;i<N;i++)
  {
    for(j=0;j<N;j++)
    {
      scanf("%ld",&a[i][j]);
    }
    
  }

  for(i=0;i<(1<<N);i++)
  {
    A[i]=-1;
  }
  for(i=0;i<N;i++)
  {
    A[(1<<i)]=a[0][i];
  }



  

   printf("%ld",dp((1<<N)-1));

  
  return 0;
}


Measured memory_bytes: 16512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;

public class MainClass
{
	public const long Giri = 1000000007;
	public const long DpInf = 99999999999999;
	
	public static void Main(string[] args)
	{
		var n = Console.ReadLine().ToInt();
		var p = Input();
		var vs = new long[n];
		for(int i = 0; i < n; i++)
		{
			var t = p[i].ToLong();
			vs[i] = t;
		}
		
		Array.Sort(vs);
		if(vs[0] == 0)
		{
			Console.WriteLine(0);
			return;
		}
		
		BigInteger wa = 1;
		for(int i = 0; i < n; i++)
		{
			wa*=vs[i];
			if(wa > 1000000000000000000)
			{
				Console.WriteLine(-1);
				return;
			}
		}
		
		if(wa > 1000000000000000000 || wa < 0)
		{
				Console.WriteLine(-1);
				return;
			
		}

		Console.WriteLine(wa);
	}
	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str, int offset = 0)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt() + offset;
		return r;
	}
}

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

using namespace std;
using ll =long long;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }
void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}
const ll INF = 1LL << 60;
const int mod = 1e9+7;
//Write From this Line

int main()
{
	int n; 
	cin >> n; 
	int left = 0 ;
	int right = n ;
	cout << 0 << endl;
	string bef ;
	cin >> bef ;
	if(bef == "Vacant") {
		cout << endl;
		return 0 ;
	}
	int bef_num = 0 ;
	while(right - left > 1){
		int c = (left + right ) / 2; 
		cout << c << endl;
		string s ;
		cin >> s ;
		if(s=="Vacant"){
		cout << endl;
			return 0 ;
		}
		int diff = c;
		if(diff % 2 == 0){
			if(s==bef){
				left = c ;
			} else {
				right = c;
			}
		} else {
			if(s == bef){
				right = c;
			} else {
				left = c;
			}
		}
	}
	cout << left << endl;
	string s;
	cin >> s ;
	if(s=="Vacant"){
		cout << endl;
		return 0 ;
	}
	cout << right << endl;
	cin >> s;
	if(s=="Vacant"){
		cout << endl;
		return 0 ;
	}

}


Measured memory_bytes: 852
n = int(input())
a = list(map(int, input().split()))
d = {}

for v in a:
    try:
        d[v] += 1
    except:
        d[v] = 1

ans = 0
for i,j in d.items():
    a=j-i if j>=i else j
    ans+=a
print(ans)

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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
  gearup;
  ll n; cin >> n;
  vl x(n),y(n),h(n);
  int idx = 0;
  rep(i,n){
      cin>>x[i]>>y[i]>>h[i];
      if(h[i] > 0)idx = i;
  }
  
  rep(i,101){
      rep(j,101){
        ll res = h[idx]+abs(x[idx]-i)+abs(y[idx]-j); //高さ
        bool check = true;
        rep(k,n){
        ll nx = abs(x[k]-i);
        ll ny = abs(y[k]-j);
            if(h[k] > 0){
                if(res != (h[k]+nx+ny))check = false;
            }
            else{
                if(res - nx - ny > 0)check = false;
            }
        }
        if(check){
            cout << i << " " << j << " " << res << endl;
            return 0;
        }
       }
  }

}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

vector<pair<int,int>> G[101010];

int ans[101010];
void dfs(int cu,int pa=-1,int col=0){
    set<int> used;
    used.insert(col);
    int c=1;
    for(auto to : G[cu]){
        if(to.first==pa) continue;
        while(used.count(c)) c++;
        ans[to.second]=c;
        dfs(to.first,cu,c);
        c++;
    }
}

int main(){
    int n;
    cin>>n;
    rep(i,n-1){
        int a,b;
        cin>>a>>b;
        a--,b--;
        G[a].push_back({b,i});
        G[b].push_back({a,i});
    }

    dfs(0);

    int ma=0;
    rep(i,n) ma=max(ma,(int)G[i].size());
    cout<<ma<<endl;
    rep(i,n-1) cout<<ans[i]<<endl;
    
}


Measured memory_bytes: 18888
n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
b = ""
ans = []
for i in range(n):
  if b == "": b = a[i]
  elif b != a[i]: b = a[i]
  elif a[i] == b:
    ans.append(a[i])
    b = ""
    if len(ans) == 2: break
print(0 if len(ans) != 2 else ans[0] * ans[1])

Measured memory_bytes: 14244
n = int(input())
a = [int(x) for x in input().split()]
ans = 1
flag = False
zeros = False
over = pow(10,18)
for i in a:
    if flag == False:
        ans *= i
    if (ans > over):
        flag = True
    if i == 0:
        zeros = True

if (flag):
    ans = -1
if (zeros):
    ans = 0

print(ans)




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

int main(void){
	int m, n, h;
	string s;
	cin>>s;
	while(s!="-"){
		n=s.length();
		cin>>m;
		while(m--){ 
			cin>>h;
			s=s.substr(h, n-h)+s.substr(0, h);
		}
		cout<<s<<"\n";
		cin>>s;
	}
	return(0);
}


Measured memory_bytes: 3200
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
using namespace std;
using ll = long long;



int main() {
	string s;
	cin >> s;
	if (s == "abc" || s == "acb" || s == "bac" || s == "bca" || s == "cab" || s == "cba") cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


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

int main() {
	double x1, x2, y1, y2;
    cin>>x1>>y1>>x2>>y2;
	cout << setprecision(8) << fixed << sqrt( (x2-x1) * (x2-x1) + (y2-y1) * (y2-y1)) << "\n" ;
	return 0;
}


Measured memory_bytes: 3288
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>

using namespace std;

#define INF (int)1e9 + 7

int pow(int x, int n)
{
    int res = 1;
    while (n > 0)
    {
        if (n & 1)
        {
            res *= x;
        }
        x = x * x;
        n = (n >> 1);
    }
    return res;
}

int main()
{
    int N;
    cin >> N;
    vector<int> goal(3);
    cin >> goal[0] >> goal[1] >> goal[2];
    vector<int> take(N);
    for (int i = 0; i < N; i++)
    {
        cin >> take[i];
    }

    int ans = INF;
    for (int i = 0; i < pow(4, N); i++)
    {
        vector<vector<int>> pattern(3);
        int id = i;
        for (int j = 0; j < N; j++)
        {
            if (id % 4 != 3)
            {
                pattern[id % 4].push_back(j);
            }
            id /= 4;
        }

        if ([&]() {
                for (int j = 0; j < 3; j++)
                {
                    if (pattern[j].size() == 0)
                        return true;
                }
                return false;
            }())
        {
            continue;
        }

        int tmp_ans = 0;
        for (int j = 0; j < 3; j++)
        {
            int sum = 0;
            for (const auto &x : pattern[j])
            {
                sum += take[x];
            }
            tmp_ans += (pattern[j].size() - 1) * 10 + abs(goal[j] - sum);
            //cout << tmp_ans << endl;
        }

        ans = min(ans, tmp_ans);
    }

    //cout << m[0][{0, 1}] << endl;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
        using namespace std;
        int main()
        {
          long long int n,d, count = 0;
          cin >> n >> d;
          for (int i = 1; i <=n; i++)
          {
            long long int x,y;
            cin >> x >> y;
            if (x*x + y*y <= d*d)
              count++;
          }
          cout << count << endl;
          return 0;
        }

Measured memory_bytes: 3624
extern crate core;

use std::io::{self, Read};

fn main() {
    let mut input = String::new();
    io::stdin().read_to_string(&mut input).unwrap();
    let output = run(input.trim().to_string());
    println!("{}", output);
}

fn run(input: String) -> String {
    let list = input
        .split_whitespace()
        .map(|x| x.parse::<i32>().unwrap())
        .collect::<Vec<_>>();
    let x = list[0];
    let a = list[1];
    let b = list[2];
    ((x - a) % b).to_string()
}

#[test]
fn test() {
    let tests = vec![
        (
            "1234
150
100",
            "84",
        ),
        (
            "1000
108
108",
            "28",
        ),
        (
            "579
123
456",
            "0",
        ),
        (
            "7477
549
593",
            "405",
        ),
    ];
    for (i, (input, output)) in tests.into_iter().enumerate() {
        println!("test:{}", i);
        assert_eq!(run(input.to_string()), output.to_string());
    }
}


Measured memory_bytes: 4352
public class Main {
    private static java.util.Scanner scanner = new java.util.Scanner(System.in);

    public static void main(String[] args) {
        int a = scanner.nextInt() * 100, b = scanner.nextInt() * 100, c = scanner.nextInt(), d = scanner.nextInt(), e = scanner.nextInt(), f = scanner.nextInt();
        double water, suger, maxWater = 0, maxSuger = 0, maxConcentration = 0;

        for (int i = 0; a * i <= f; i++) {
            for (int j = 0; a * i + b * j <= f; j++) {
                water = a * i + b * j;
                for (int k = 0; k * c <= f - water; k++) {
                    for (int l = 0; k * c + l * d <= f - water; l++) {
                        suger = k * c + l * d;
                        if (water / 100 * e >= suger && maxConcentration <= suger / (water + suger)) {
                            maxWater = water;
                            maxSuger = suger;
                            maxConcentration = suger / (water + suger);
                        }
                    }
                }
            }
        }

        System.out.println((int)(maxWater + maxSuger) + " " + (int)maxSuger);
    }
}

Measured memory_bytes: 22996
import std.stdio;
import std.algorithm;
import std.string;
import std.functional;
import std.array;
import std.conv;
import std.math;
import std.typecons;
import std.regex;
import std.range;
int a;
int[] p = [1,4,10,20,35];
int[] dp,odp;


void main(){
    for(int i=6;i<300;i++){
	p ~= i * (i+1) * (i+2) / 6;
    }
    dp = new int[1000001];
    odp = new int[1000001];
    fill(dp,-1);
    fill(odp,-1);
    dp[0] = 0;
    odp[0] = 0;
    for(int i=to!int(p.length)-1;i>=0;i--){
	for(int j=p[i];j<=1e6;j++){
	    if(dp[j-p[i]] > -1){
		if(dp[j] > -1)
		    dp[j] = min(dp[j],1 + dp[j-p[i]]);
		else dp[j] = 1 + dp[j-p[i]];
	    }
	    if(odp[j-p[i]] > -1){
		if(p[i] % 2 == 1){
		    if(odp[j] > -1)
			odp[j] = min(odp[j],1 + odp[j-p[i]]);
		    else odp[j] = 1 + odp[j-p[i]];
		}
	    }
	}
    }

    while(true){
	int n = readln().chomp().to!int;
	if(n == 0) break;
	writeln(dp[n] , " " , odp[n]);
    }
}

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

int main() {
    string s;
    cin>>s;
    int ans=0;
    for (int i=1;i<s.size();i++)
        if (s[i-1]!=s[i])
            ans++;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 512
import java.util.*;

class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int a, b, c;
	String[] line = sc.nextLine().split(" ");
	a = Integer.parseInt(line[0]);
	b = Integer.parseInt(line[1]);
	c = Integer.parseInt(line[2]);

	int tmp;
	if (a > b) {
	    tmp = a;
	    a = b;
	    b = tmp;
	}
	if (b > c) {
	    tmp = b;
	    b = c;
	    c = tmp;
	}
	if (a > b) {
	    tmp = a;
	    a = b;
	    b = tmp;
	}

	System.out.println(a + " " + b + " " + c);
    }
}

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

int gcd(int a, int b) {
  int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

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

  priority_queue<int> q; int x;
  rep(i,0,N-1) {
    cin >> x;
    q.push(abs(X - x));
  }

  while (1 < q.size()) {
    int a = q.top(); q.pop();
    int b = q.top(); q.pop();
    int n = gcd(a, b);
    q.push(n);
  }

  cout << q.top() << endl;
  return 0;
}


Measured memory_bytes: 892
class Dice(object):
    """Dice Class

    """

    def __init__(self, numbers):
        """

        Args:
            numbers:
        """
        self.numbers_inverse = {numbers[0]: 1, numbers[1]: 2, numbers[2]: 3, numbers[3]: 4, numbers[4]: 5,
                                numbers[5]: 6}
        self.numbers = {1: numbers[0], 2: numbers[1], 3: numbers[2], 4: numbers[3], 5: numbers[4], 6: numbers[5]}

        self.vertical = [self.numbers[1], self.numbers[2], self.numbers[6], self.numbers[5]]
        self.horizontal = [self.numbers[4], self.numbers[1], self.numbers[3], self.numbers[6]]

    def move_dice(self, s):
        """

        Args:
            s: move direction

        Returns:

        """
        if s == 'N':
            self.move_north()
        elif s == 'S':
            self.move_south()
        elif s == 'W':
            self.move_west()
        elif s == 'E':
            self.move_east()

    def move_south(self):
        """move this dice towered north
        """
        self.vertical = (self.vertical * 2)[3:7]
        self.horizontal[1] = self.vertical[0]
        self.horizontal[3] = self.vertical[2]

    def move_north(self):
        """move this dice towered south
        """
        self.vertical = (self.vertical * 2)[1:5]
        self.horizontal[1] = self.vertical[0]
        self.horizontal[3] = self.vertical[2]

    def move_east(self):
        """move this dice towered east
        """
        self.horizontal = (self.horizontal * 2)[3:7]
        self.vertical[0] = self.horizontal[1]
        self.vertical[2] = self.horizontal[3]

    def move_west(self):
        """move this dice towered west
        """
        self.horizontal = (self.horizontal * 2)[1:5]
        self.vertical[0] = self.horizontal[1]
        self.vertical[2] = self.horizontal[3]

    def get_top(self):
        return self.vertical[0]


dice = Dice([int(x) for x in raw_input().split()])
number_of_questions = int(raw_input())
counter = 0
while counter < number_of_questions:
    [top, front] = [int(x) for x in raw_input().split()]
    decision_list = "".join([str(x) for x in [dice.numbers_inverse[top], dice.numbers_inverse[front]]])
    if decision_list in "1265" * 2:
        print(dice.numbers[3])
    elif decision_list in "5621" * 2:
        print(dice.numbers[4])
    elif decision_list in "4235" * 2:
        print(dice.numbers[1])
    elif decision_list in "5324" * 2:
        print(dice.numbers[6])
    elif decision_list in "1364" * 2:
        print(dice.numbers[5])
    elif decision_list in "4631" * 2:
        print(dice.numbers[2])
    else:
        print("aho")
    counter += 1

Measured memory_bytes: 6400
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
#define int long long
#define rep(i,N) for(int(i)=0;(i)<(N);++(i))
#define all(v) (v).begin() , (v).end()
#define rall(v) (v).rbegin() , (v).rend()
#define pb(n) push_back(n)

signed main(){
    int N;
    cin >> N;
    int ans = 0;
    vector<int> A(N);
    rep(i,N) cin >> A[i];
    sort(all(A));
    multiset<int> st;

    for(int i=N-1;i>=0;--i){
        const auto& itr = st.find(A[i]);
        if(itr != st.end()) ++ans,st.erase(itr);
        else{
            int k = -1;
            rep(j,64){k = (1 << j);if(k > A[i]) break;}
            st.insert(k-A[i]);
        }
    }

    cout << ans << endl;
}


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

int main()
{
  ll N;cin>>N;
  vector<ll> d(N);
  for (int i=0;i<N;i++)
    cin>>d[i];
  
  sort(d.begin(),d.end());
  ll ans = d[N/2]-d[N/2-1];
  cout<<ans<<endl;
}

Measured memory_bytes: 1024
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		sc.close();
		int[] Array = new int[1000];
		Arrays.fill(Array,0);
		int max = 1;
		if(X <= 3) {
			System.out.println(1);
		}
		else {
			for (int i = 2; i <= X; i++) {
				int num = i * i;
				while (num <= X) {
					max = Math.max(max, num);
					num *= i;
				}
			}
			System.out.println(max);
		}	
	}
}

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

#define endl '\n'
#define ll long long

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    
    ll n, lr = 0, rl = 0;
    cin >> n;
    vector <ll> v(n);
    for(ll i = 0; i < n; i++) {
        cin >> v[i];
    }
    for(ll i = 1; i < n; i++) {
        if(v[i] < v[i - 1]) {
            lr += v[i - 1] - v[i];
            v[i] = v[i - 1];
        }
    }
    cout << lr << endl;
}

Measured memory_bytes: 4776
#include<stdio.h>

int main(){
  int n,i,max=0,wa=0;
  scanf("%d\n",&n);
  int a[n];
  for(i=0;i<n;i++){
    scanf("%d ",&a[i]);
    wa=wa+a[i];
    if(a[i]>max){
      max=a[i];
    }
  }
  wa=wa-max;
  if(wa>max){
    printf("Yes");
  }else{
    printf("No");
  }
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <math.h>
typedef long long ll;
using namespace std;

int main()
{
	int n; cin >> n;
	string s; cin >> s;
	for (int i = 0; i < s.size(); i++)
	{
		s[i] += n;
		//cout << (int)s[i] << endl;
		if ((int)s[i] > 90)
		{
			s[i] -= 26;
			//cout << (int)s[i] << endl;
		}
	}	
	cout << s << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define min(a, b) ((a) < (b) ? (a) : (b))

int main(void)
{
    int i;
    int array[32] = {0};

    while (scanf("%d", &i), i){
        int j;
        int n = 32;

        for (j = 0; j < i; j++) scanf("%d", array + j);
        for (j = 0; n > 0; j = (j + 1) % i){
            printf("%d\n", min(n - (n - 1) % 5, n));
            n -= (n - 1) % 5;
            if (n < array[j]){
                puts("0");
                n = 0;
            }
            else {
                printf("%d\n", n - array[j]);
                n -= array[j];
            }
        }
    }

    return 0;
}

Measured memory_bytes: 612
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
	int a, b;

	cin >> a >> b;

	if(a + b <24){
		cout << a + b << endl;
	}else if(a+b==24){
		cout << "0" << endl;
	}
	else {
		cout << a + b - 24 << endl;
	}

}

Measured memory_bytes: 256
def inpl():
    return list(map(int, input().split()))


N, x = inpl()
A = inpl()

ans = 0

for i in range(1, N):
    if A[i - 1] + A[i] <= x:
        continue

    tmp = A[i - 1] + A[i] - x
    ans += tmp
    if tmp >= A[i]:
        A[i] = 0
    else:
        A[i] -= tmp
print(ans)


Measured memory_bytes: 14052
#include <bits/stdc++.h>
#define mod 1000000007
#define mod998 998244353
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;
const string nyan("(=^・ω・^=)");

string S;
int a,b;

int main() {
	cin >> S;
	for (int i = 0; i < S.size(); i += 2) {
		if (S[i] == '0') {
			++a;
		}
		else {
			++b;
		}
	}
	for (int i = 1; i < S.size(); i += 2) {
		if (S[i] == '0') {
			++b;
		}
		else {
			++a;
		}
	}
	cout << min(a, b) << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<algorithm>
#define N 100
using namespace std;
long long k;
int n;
long long a[N];
int main(){
	cin>>k;
	n=50;
	long long x=k/n;
	for (int i=1;i<=n;i++)a[i]=n-1;
	for (int i=1;i<=n;i++)a[i]+=n*x-x*(n-1);
	x=k%n;
	for (int i=1;i<=x;i++)a[i]+=n-(x-1);
	for (int i=x+1;i<=n;i++)a[i]-=x;
	printf("%d\n",n);
	for (int i=1;i<=n;i++){
		printf("%lld",a[i]);
		if (i!=n)printf(" ");
	}
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(N: int):
    def f(n):
        yield 0
        for i in range(1, N+1):
            if i % 3 == 0 or i % 5 == 0:
                continue
            yield i
    print(sum(f(N)))


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9188
use std::io;

macro_rules! read {
    ($t: ty) => {
        {
            let mut input = String::new();
            io::stdin().read_line(&mut input).expect("could not read input");
            input.trim().parse::<$t>().unwrap()
        };
    };
    ($($t: ty),*) => {
        {
            let mut input = String::new();
            io::stdin().read_line(&mut input).expect("could not read input");
            let mut iter = input.trim().split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap()), *)
        };
    }
}
macro_rules! read_vec {
    ($t: ty) => {
        {
            let mut input = String::new();
            io::stdin().read_line(&mut input).expect("could not read input");
            let iter = input.trim().split_whitespace();
            iter.map(|x| x.parse::<$t>().unwrap()).collect::<Vec<$t>>()
        };
    }
}
fn main() {

    let n = read!(String);
    let chars = n.chars().collect::<Vec<char>>();

    if chars[0] == chars[1] && chars[1] == chars[2] {
        println!("Yes");
    }
    else if chars[1] == chars[2] && chars[2] == chars[3] {
        println!("Yes");
    } else {
        println!("No");
    }
}

Measured memory_bytes: 4352
#include <set>
#include <map>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

int main() {
	string truth = "CODEFESTIVAL2016";
	string s;
	cin >> s;
	int ans = 0;
	for(int i = 0; i < 16; i++){
		if(truth[i] != s[i]){
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 764
fun main(args : Array<String>) {
    val cc = Array(3) { readLine()!!.split(" ").map { it.toInt() } }
    val ansA = mutableListOf(0, 0, 0)
    val ansB = mutableListOf(0, 0, 0)

    ansB[0] = cc[0][0]
    ansB[1] = cc[0][1]
    ansB[2] = cc[0][2]

    ansA[1] = cc[1][0] - ansB[0]
    ansA[2] = cc[2][0] - ansB[0]

    cc.forEachIndexed { idx, row ->
        repeat(3) {
            if (row[it] != ansA[idx] + ansB[it]) {
                println("No")
                return
            }
        }
    }

    println("Yes")
}

Measured memory_bytes: 37908
#include<iostream>

using namespace std;

int main()
{
  string N;
  char c[1];
  int n;
  cin >> N;
  for(int i = 0 ; i < 3 ; i++)
  {
    c[0] = N[i];
    n = atoi(c);
    if( n == 7 )
    {
        cout << "Yes";
        break;
    }
    else if( n!= 7 && i==2)
      cout <<"No";
  }
  return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>

int main(){
	int n;
	scanf("%d", &n);
	int mou[n];
	int i;
	for(i=0; i<n; i++){
		scanf("%d", &mou[i]);
	}

	int count = 0;
	int tall=mou[0];
	for(i=1; i<n; i++){
		if(mou[i]>=tall){
			count++;
			tall = mou[i];
		}
	}
	printf("%d", count+1);
	
}

Measured memory_bytes: 128
package main

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

func readQuestion() []int {

    bufio := bufio.NewReader(os.Stdin)
    l, _ := bufio.ReadString('\n')
    n, _ := strconv.Atoi(strings.Trim(l, "\n"))
    cards := make([]int, n)
    for i := 0; i < n; i++ {
        l, _ = bufio.ReadString('\n')
        n, _ := strconv.Atoi(strings.Trim(l, "\n"))
        cards[i] = n
    }
    return cards
}

func solve(vals []int) int {

    sorted := make([]int, len(vals))
    copy(sorted, vals)
    sort.Ints(sorted)

    pos := make(map[int]int)
    for i, val := range sorted {
        pos[val] = i
    }
    odds := 0
    for i, val := range vals {
        pos1 := i
        pos2 := pos[val]
        if int(math.Abs(float64(pos1)-float64(pos2)))%2 == 1 {
            odds++
        }
    }

    return odds / 2
}

func main() {
    vals := readQuestion()
    ans := solve(vals)
    fmt.Printf("%v\n", ans)
}


Measured memory_bytes: 10112
import java.util.Arrays;
import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);          //????????¶???????????\???   
        String line1 = sc.nextLine();
        int n = Integer.parseInt(line1);              //?????°????????´??????n?????£??\
        
        String line2 = sc.nextLine();                 //????????¶???????????\???   
        String[] set1 = line2.split(" ");             //????????????????????´????????¨????????§???????????????
        int[] set = new int[n];                       //array ?????£?¨?
        long sum = 0;
 
        for (int i = 0; i < n; i++) {                 //?????????????§?
            set[i] = Integer.parseInt(set1[i]);       //????????¶???????????\????????????????????°????????´??????array?????£??\
            sum += set[i];
        }
 
        Arrays.sort(set);                             //array ???sort ????????????
 
        System.out.print(set[0]);
        System.out.print(" ");
        System.out.print(set[n-1]);
        System.out.print(" ");
        System.out.println(sum);
         
    }
 
}

Measured memory_bytes: 31736
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
using namespace std;
typedef long long LL;
LL gi () {
    LL ret=0; char ch=getchar();
    while((ch<'0' || ch>'9') && ch!='-') ch=getchar();
    char c=ch=='-'?getchar():ch;
    while(c>='0' && c<='9') ret=ret*10+c-'0',c=getchar();
    return ch=='-'?-ret:ret;
}
const int mo = 1e9 + 7;
const int N = 5010;
const int inv2 = 500000004;
int n,t,f[N][N];
char s[N];
void upd (int &x,int y) {
    x += y; x -= (x >= mo ? mo : 0);
}
int main () {
    n = gi(); scanf("%s",s); t = strlen(s);
    f[0][0] = 1;
    for(int i=0;i<n;i+=1)
        for(int j=0;j<=i;j+=1) {
            int v = f[i][j]; upd(v,f[i][j]);
            if(j) upd(f[i+1][j-1],f[i][j]);
            else upd(f[i+1][j],f[i][j]);
            upd(f[i+1][j+1],v);
        }
    LL ans = f[n][t];
    for(int i=1;i<=t;i+=1) ans = ans * inv2 %mo;
    cout << ans;
    return 0;
}


Measured memory_bytes: 96512
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
using i64 = int64_t;
using namespace std;

const int64_t MOD = 1e9 + 7;

// 辺を追加することで木を作成する (setのchildrenとintのparentが必須)
template<typename T>
void CreateTree(vector<T> &tree) {
    queue<int> q;
    q.push(0);
    while(q.size()) {
        int i = q.front(); q.pop();
        for (auto x : tree[i].children) {
            tree[x].children.erase(i);
            tree[x].parent = i;
            q.push(x);
        }
    }
}

struct Node {
    int parent;
    int64_t n_fixed;
    set<int> children;
};

int main() {
    int64_t N, K;
    cin >> N >> K;
    vector<Node> tree(N, {-1, 0, set<int>()});
    tree[0].parent = 0;
    for(int i = 0; i < N - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        tree[a].children.insert(b);
        tree[b].children.insert(a);
    }
    CreateTree(tree);
    queue<int> q;
    q.push(0);
    int64_t ans = 1;
    while(q.size()) {
        int k, p;
        k = q.front(); q.pop();
        p = tree[k].parent;
        ans *= max((int64_t)0, K - tree[p].n_fixed);
        if(k != p) {
            tree[p].n_fixed++;
        }
        tree[k].n_fixed++;
        ans %= MOD;
        for (auto x : tree[k].children) {
            tree[x].n_fixed++;
            q.push(x);
        }
    }
    cout << ans << endl;
    return 0;
}

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

#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (ll i = m; i < (n); i++)

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



  
int main() {
  ll n,k;
  cin >>n>>k;
  vector<ll> v(100001,0);
  rep(i,n){
    int a,b;
    cin >>a>>b;
    v[a] += b;
  }
  ll sum = 0;
  rep(i,10000000001){
    sum += v[i];
    if(sum>=k){
      cout << i << endl;
      break;
        
    }
  }
    
    
}

Measured memory_bytes: 4048
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define cout(x) cout<<x<<endl
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using vi = vector<int>;
using Mat = vector<vector<int>>;

double cost(vi x, vi y, vi t,int i){
    return sqrt(pow(x[t[i]]-x[t[i-1]],2) + pow(y[t[i]]-y[t[i-1]],2));
}

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


    vi town(n);
    rep(i,n) town[i] = i;
    // sort(all(town));

    //順列全探索
    double len = 0;
    ll t = 0;
    do{ 
        for(int i=1; i<n; ++i){
            len += cost(x,y,town,i);
        }
        ++t;
        // for(auto i : town) cout(i<<" ");
        // cout<<endl;
    }
    while(next_permutation(all(town)));

    printf("%.10lf\n",len/t);
    return 0;
}




Measured memory_bytes: 256
import java.util.*;

public class Main {

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

		System.out.println(A==B&&B==C ? "Yes" : "No");

		sc.close();
	}
}


Measured memory_bytes: 21844