akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define ld long double
#define mkp make_pair
#define sz(x) (int)x.size()
#define pi pair<long long, long long>
#define watch(x) cout << (#x) << " is " << (x) << endl; cout.flush()
#define endl '\n'
#define _ << ' '
#define FAST_LOG2(x) (sizeof(unsigned long)*8 - 1 - __builtin_clzl((unsigned long)(x)))
#define clog2(x) (((x) - (1 << FAST_LOG2(x))) ? FAST_LOG2(x) + 1 : FAST_LOG2(x))
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> idxset;
//find_by_order(i) : iterator to the value at index i, order_of_key(x) : the index of value x
const ll mod = (ll)1e9+7;
const ll INF = (ll)1e9+1;

bool p(ll x){
    for(ll i=2; i<=sqrt(x); i++){
        if(x%i==0) return 0;
    }
    return 1;
}
ll a, b, ans=0;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    #ifndef ONLINE_JUDGE
   // freopen("B.txt", "r", stdin);
    #endif
    cin >> a >> b;
    if(a>b) swap(a, b);
    for(ll i=1; i*i<=a; i++){
        if(a%i==0){
            if(b%i==0&&p(i)) ans++;
            ll c = a/i;
            if(b%c==0&&i!=c&&p(c)) ans++;
        }
    }
    cout << ans;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args)throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str1 = br.readLine();
		String str2 = br.readLine();
		String str3 = br.readLine();
		int a = Integer.parseInt(str1);
		int b = Integer.parseInt(str2);
		int h = Integer.parseInt(str3);
		
		System.out.println((a+b)*h/2);
		

	}

}


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

int main(){
  int n, x;
  cin >> n >> x;
  vector<int> m(n);
  int used = 0;
  for(int i = 0; i < n; i++){
    cin >> m[i];
    used += m[i];
  }
  int left = x - used;
  int min = 100000;
  for(int i = 0; i < n; i++){
    if(min > m[i]){
      min = m[i];
    }
  }
  cout << n + left / min << endl;
  return 0;
}

Measured memory_bytes: 3604
N = int(input())

a = input().split()

A = [int(s) for s in a]   #strのリストをintのリストに変換

counter = 0

i = 0
while i <= N-1: 
 	if A[i] % 2 == 0 and i < N-1:
 		i += 1
 		continue
 	elif A[i] % 2== 0 and i == N-1:
 	     	i  = 0
 	     	counter += 1
 	     	for j in range (N):
 	     		A[j] = A[j] // 2
 	     	else:
 	     	    continue #for分の後にelse -> continune　で初めのwhileに戻る
 	else:
 		break




print(counter)


Measured memory_bytes: 3060
#include<stdio.h>
char grade(int,int,int);
int main(){
  int mid,final,re;
  char gra;

  while(1){
    scanf("%d%d%d",&mid,&final,&re);
    if(mid==-1 && final==-1 && re==-1) break;
    
    gra=grade(mid,final,re);
    printf("%c\n",gra);
  }

  return 0;
}

char grade(int mid,int final, int re){
  if(mid==-1 || final==-1) return 'F';
  else{
    if(mid+final>=80) return 'A';
    else if(65<=mid+final && mid+final<80) return 'B';
    else if(50<=mid+final && mid+final<65) return 'C';
    else if(30<=mid+final && mid+final<50)
      if(re>=50) return 'C';
      else return 'D';
    else return 'F';
  }
}

Measured memory_bytes: 1712
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#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 mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e9;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
int main(){
	int n;
	cin>>n;
	while(n--){
		ll a,b;
		cin>>a>>b;
		int d[31]={1};
		rep(i,30)d[i+1]=d[i]*2;
		int out=0;
		while(a!=b){
			for(int i=30;i>=0;i--)if(b-a>=d[i]){
				if(a%d[i])continue;
				out++;
				a+=d[i];
				break;
			}
		}
		cout<<out<<endl;
	}
}

Measured memory_bytes: 1168
object Main{
	def main(args:Array[String]){
		val s = new java.util.Scanner(System.in)
		val n=s.nextInt
		val a=Array.tabulate(n)(i=>(s.nextInt,i+1)).sorted

		for(i<-0 to n-1)
			println(a(i)._2)
	}
}


Measured memory_bytes: 73380
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1);
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 int MAX = 100010;
ll dp[MAX];

int main() {
    int n, k; cin >> n >> k;
    vector<ll> h(n);
    rep(i, n) cin >> h[i];

    rep(i, MAX) dp[i] = LLINF;
    dp[0] = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 1; j <= k; j++) {
            if (i + j >= n) continue;
            chmin(dp[i+j], dp[i] + abs(h[i] - h[i+j]));
        }
    }
    cout << dp[n-1] << endl;
}


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

// repetition
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

// container util
#define all(x) (x).begin(), (x).end()

// typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

// const value
// const ll MOD = 1e9 + 7;
// const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
// const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

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

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

template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
  return a > b && (a = b, true);
}
//* Mod int
const int mod = 2019;
struct mint {
  ll x;
  mint() : x(0) {}
  mint(ll x) : x((x % mod + mod) % mod) {}
  // mint(ll x):x(x){}
  mint &fix() {
    x = (x % mod + mod) % mod;
    return *this;
  }
  mint operator-() const { return mint(0) - *this; }
  mint &operator+=(const mint &a) {
    if((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint &a) {
    if((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint &a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint &a) const { return mint(*this) += a; }
  mint operator-(const mint &a) const { return mint(*this) -= a; }
  mint operator*(const mint &a) const { return mint(*this) *= a; }
  bool operator<(const mint &a) const { return x < a.x; }
  bool operator==(const mint &a) const { return x == a.x; }
};
istream &operator>>(istream &i, mint &a) {
  i >> a.x;
  return i;
}
ostream &operator<<(ostream &o, const mint &a) {
  o << a.x;
  return o;
}
typedef vector<mint> vm;

//*/
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int n = s.size();
  reverse(all(s));
  vector<mint> sum(n + 1, 0);
  map<mint, ll> mp;
  mint mul = 1;
  mp[0]++;
  rep(i, n) {
    sum[i + 1] += sum[i] + mint(s[i] - '0') * mul;
    mul *= 10;
    mp[sum[i + 1]]++;
  }

  ll ans = 0;

  for(auto x : mp) {
    ll xx = x.second;
    ans += xx * (xx - 1) / 2;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 5120
#include <algorithm>
#include <complex>
#include <iostream>
#include <map>
#include <set>
#include <vector>
#define X real()
#define Y imag()
#define EPS (1e-10)
using namespace std;
typedef complex<double> P;
typedef vector<P> Poly;
typedef pair<P,P> L;

namespace std{
  bool operator<(const P& a, const P& b){
    return a.X != b.X ? a.X < b.X : a.Y < b.Y;
  }
}

double dot(P a, P b){return a.X*b.X + a.Y*b.Y;}

double cross(P a, P b){return a.X*b.Y - a.Y*b.X;}

int ccw(P a, P b, P c){
  b -= a;c -= a;
  if(cross(b, c) > EPS) return 1;
  if(cross(b, c) < -EPS) return -1;
  if(dot(b,c) < -EPS) return 2;
  if(norm(c) - norm(b) > EPS) return -2;
  return 0;
}

bool is_cross(L a, L b){
  if(ccw(a.first,a.second,b.first)*ccw(a.first,a.second,b.second) <= 0 &&
     ccw(b.first,b.second,a.first)*ccw(b.first,b.second,a.second) <= 0) return true;
  return false;
}


P intersection(L a, L b){
  //??´???a??¨??´???b?????????
  return a.first + cross(b.second-b.first,a.first-b.first)/(-cross(b.second-b.first,a.second-b.first)+cross(b.second-b.first,a.first-b.first))*(a.second-a.first);
}

int in_poly(P a, Poly p){
  int n = p.size(), c = 0;
  for(int i = 0; i < n; ++i){
    P s = p[i]-a, t = p[(i+1)%n]-a;
    if(!ccw(s,t,P(0,0))) return 1;//??????
    if(s.Y > t.Y + EPS) swap(s,t);
    if((s.Y*t.Y < 0 || (s.Y*t.Y < EPS && t.Y > EPS)) && cross(s,t) < EPS) ++c;
  }
  if(c%2) return 2;//?????¨
  return 0;//?????¨
}


int main(){
  int N;
  set<int> M_x, M_y;
  while(cin >> N, N){
    double x, y;
    Poly W;
    for(int i = 0; i < N; ++i){
      cin >> x >> y;
      W.push_back(P(x,y));
      M_x.insert(x);
      M_y.insert(y);
    }
    Poly C;
    for(int i = 0; i < 4; ++i){
      cin >> x >> y;
      C.push_back(P(x,y));
      M_x.insert(x);
      M_y.insert(y);
    }
    vector<int> V_x;
    for(auto p: M_x){
      V_x.push_back(p);
    }
    vector<int> V_y;
    for(auto p: M_y){
      V_y.push_back(p);
    }
    int n_x = V_x.size(), n_y = V_y.size();
    long long int ans = 0LL;
    for(int i = 1; i < n_x; ++i){
      for(int j = 1; j < n_y; ++j){
	P p = P((double)(V_x[i]+V_x[i-1])/2.0, (double)(V_y[j]+V_y[j-1])/2.0);
	if(in_poly(p,W) && !in_poly(p,C)) ans += (V_x[i]-V_x[i-1])*(V_y[j]-V_y[j-1]);
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3256
// 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

using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
#define REP(i,n) for(ll i=0; i<(n); i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define ALL(n) begin(n),end(n)
#define IN(a, x, b) (a<=x && x<b)
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
template<class T> inline T CHMAX(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T CHMIN(T & a, const T b) { return a = (a > b) ? b : a; }

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);
const long long MOD = 1000000007;

ll need_move[200010];

int main(void){
    ll n;
    cin >> n;
    string input;
    cin >> input;
    ll num=0;
    ll tmp_move=0;
    REP(i,n){
        if(input[i] == 'R'){
            num++;
        }else{
            tmp_move++;
        }
        need_move[i]= tmp_move;
        //cout << need_move[i] << endl;
    }
    if(num ==0){
        cout << 0 << endl;
    }else{
        cout << need_move[num-1] << endl;
    }
    return 0;
}

Measured memory_bytes: 4896
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
using namespace std;

string change1(string s){
  map<char, string> table;
  table['A'] = "00000";
  table['B'] = "00001";
  table['C'] = "00010";
  table['D'] = "00011";
  table['E'] = "00100";
  table['F'] = "00101";
  table['G'] = "00110";
  table['H'] = "00111";
  table['I'] = "01000";
  table['J'] = "01001";
  table['K'] = "01010";
  table['L'] = "01011";
  table['M'] = "01100";
  table['N'] = "01101";
  table['O'] = "01110";
  table['P'] = "01111";
  table['Q'] = "10000";
  table['R'] = "10001";
  table['S'] = "10010";
  table['T'] = "10011";
  table['U'] = "10100";
  table['V'] = "10101";
  table['W'] = "10110";
  table['X'] = "10111";  
  table['Y'] = "11000";
  table['Z'] = "11001";
  table[' '] = "11010";
  table['.'] = "11011";
  table[','] = "11100";
  table['-'] = "11101";
  table['\''] = "11110";
  table['?'] = "11111";
  
  string res = "";
  for(int i = 0 ; i < s.size() ; i++){
    res += table[s[i]];
  }
  return res;
}

string change2(string s){
  map<string, char> table;
  table["101"] = ' ';
  table["000000"] = '\'';
  table["000011"] = ',';
  table["10010001"] = '-';
  table["010001"] = '.';
  table["000001"] = '?';
  table["100101"] = 'A';
  table["10011010"] = 'B';
  table["0101"] = 'C';
  table["0001"] = 'D';
  table["110"] = 'E';
  table["01001"] = 'F';
  table["10011011"] = 'G';
  table["010000"] = 'H';
  table["0111"] = 'I';
  table["10011000"] = 'J';
  table["0110"] = 'K';
  table["00100"] = 'L';
  table["10011001"] = 'M';
  table["10011110"] = 'N';
  table["00101"] = 'O';
  table["111"] = 'P';
  table["10011111"] = 'Q';
  table["1000"] = 'R';
  table["00110"] = 'S';
  table["00111"] = 'T';
  table["10011100"] = 'U';
  table["10011101"] = 'V';
  table["000010"] = 'W';
  table["10010010"] = 'X';
  table["10010011"] = 'Y';
  table["10010000"] = 'Z';
  
  string res = "", tmp = "";
  
  for(int i = 0 ; i < s.size() ; i++){
    tmp += s[i];
    map<string, char>:: iterator it;
    it = table.find(tmp);
    if(it != table.end()){
      res += table[tmp];
      tmp = "";
    }
  }
  return res;
}
  
int main(){
  string str;
  while(getline(cin, str)){
    str = change1(str);
    str = change2(str);
    cout << str << endl;
  }
}

Measured memory_bytes: 1220
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
typedef pair<int,int> P;

int main(void){
	int i;

	cin.tie(0);
	ios_base::sync_with_stdio(false);

	string x;
	cin >> x;
	int n=x.size();
	queue<char> q;
	for(i=0;i<n;i++) q.push(x[i]);

	int s=0,t=0;
	while(!q.empty()){
		char c=q.front();
		if(c=='S'){
			s++; q.pop();
		}else{
			q.pop();
			if(s!=0){
				s--; t+=2;
			}
		}
	}

	cout << n-t << endl;



	return 0;
}


Measured memory_bytes: 720
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll maxn = 2*(1e5 + 5);

int main()
{
    ll i, j, k, n, u, v;

    float d,t;
    cin>>t;
    d = (float)t/3;

    printf("%0.7f\n",d*d*d);


    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <bitset>
#include <map>
#include <string>

#define repd(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

using namespace std;

int inputValue(){
	int a;
	cin >> a;
	return a;
}

void inputArray(int *p,int a){
	rep(i,a){
		cin >> p[i];
	}
}

void inputVector(vector<int> *p,int a){
	rep(i,a){
		int input;
		cin >> input;
		p -> push_back(input);
	}
}

template <typename T>
void output(T a,int precision){
	if(precision > 0){
		cout << setprecision(precision) << a << "\n";
	}else{
		cout << a << "\n";
	}
}

int main(){
	//source
	int n=inputValue();
	if(n==1){
		cout<< "Hello World" << endl;
		return 0;
	}else{
		int a,b;
		cin >> a >> b;
		cout << a+b << endl;
		return 0;
	}
	return 0;
}


Measured memory_bytes: 256
use proconio::*;
#[allow(unused_imports)]
use proconio::marker::*;

#[fastout]
#[allow(non_snake_case)]
fn main() {
    input! {
        N: i32,
    }
    if N % 1000 == 0 {
        println!("0");
    } else {
        println!("{}", 1000 - (N % 1000));
    }
}


Measured memory_bytes: 2196
#include<iostream>
#include<iomanip>
//#include<cstdio>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cassert>
using namespace std;
typedef long long ll;
const int Nmax = 1e5;
int N;
ll A[Nmax+1], B[Nmax];

int main(){
	cin >> N;
	for(int i=0; i<N+1; i++) cin >> A[i];
	for(int i=0; i<N; i++) cin >> B[i];

	ll ans = 0;
	ll rem = 0;
	for(int i=0; i<N; i++){
		ans += min(A[i], rem+B[i]);
		rem = max(0ll, B[i]-max(0ll, A[i]-rem));
		//cout << ans << " " << rem << endl; 
	}
	ans += min(rem, A[N]);

	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 1792
s=list(input())
n=len(s)
t=s[:int((n-1)/2)]
u=s[int((n+3)/2)-1:]
a=0
if s==s[::-1]:
  if t==t[::-1]:
    if u==u[::-1]:
      a=1
if a==0:
  print('No')
elif a==1:
  print('Yes')

Measured memory_bytes: 38256
#pragma GCC optimize ("Ofast")
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i=(a); i<(int)(b); i++)
#define FORD(i, a, b) for (int i=a; i>(int)(b); i--)
#define PPC(x) __builtin_popcount(x)
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define ft first
#define sd second
#ifdef DEBUG
#include "debug.h"
#else
#define dbg(...) 0
#endif
using namespace std;

const int maxN = 500;

struct Point
{
	long double x, y;
	Point (long double a=0, long double b=0)
	:	x(a), y(b)	{};
	
	
	Point mid(const Point& a)	const
	{
		return Point((x+a.x) / 2, (y+a.y) / 2);
	}
	
	long double dist(const Point& a)	const
	{
		long double dx = x-a.x, dy = y-a.y;
		return sqrt(dx*dx + dy*dy);
	}
}T[maxN];

struct Prosta
{
	long double A, B, C;
	
	Prosta (long double a=0, long double b=0, long double c=0)
	:	A(a), B(b), C(c)	{};
	
	Point cut(const Prosta& k)
	{
		long double a = A*k.B - k.A*B;
		long double b = B*k.C - k.B*C;
		long double c = C*k.A - k.C*A;
		if (fabs(a) < 0.2)
			return {0, 0};
		return Point(b/a, c/a);
	}
};

Prosta symetralna(const Point& a, const Point& b)
{
	Point c = a.mid(b);
	long double dx = a.x-b.x, dy = a.y-b.y;
	return Prosta(dx, dy, -dx*c.x - dy*c.y);
}

int n;

long double f(const Point& M)
{
	long double ret = 0;
	FOR(i, 0, n)
		ret = max(ret, M.dist(T[i]));
	return ret;
}

void solve()
{
	scanf ("%d", &n);
	FOR(i, 0, n)
		scanf ("%Lf%Lf", &T[i].x, &T[i].y);
	long double res = 1e10;
	FOR(i, 1, n) FOR(j, 0, i)
		res = min(res, f(T[i].mid(T[j])));
		
	FOR(i, 2, n) FOR(j, 1, i) FOR(k, 0, j)
		res = min(res, f(symetralna(T[i], T[j]).cut(symetralna(T[i], T[k]))));
		
	printf("%.9Lf\n", res);
}

int main()
{
	int t;
	t = 1;//scanf ("%d", &t);
	while (t--)
		solve();
	return 0;	
}


Measured memory_bytes: 256
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

min = N
if min > A: min = A
if min > B: min = B
if min > C: min = C
if min > D: min = D
if min > E: min = E

print(4 - (- N // min))


Measured memory_bytes: 3188
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  long long a, b, k;
  cin >> a >> b >> k;
  cout << a - min(a, k) << " " << max(0LL, b - k + min(a, k)) << '\n';
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
const int N = 200005;
int n;
vector<pair<ll, ll> > v;
ll memo[2005][2005];
int arr[2005];
ll solve( int i, int l) {
if (i==n) {
return 0LL;
}
if (memo[i][l] != -1) {
return memo[i][l];
}
ll r=n-(i-l)-1;
 return memo[i][l] = max(
    1LL * v[i].first * abs(v[i].second - l) + solve(i+1, l+1),
    1LL * v[i].first * abs(v[i].second - r) + solve(i+1, l)
  );
 
}
 
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
cin >> n;

for (int i = 0; i < n; i++)
cin >> arr[i];
for (ll i = 0; i < n; i++) {
v.push_back({arr[i], i});
}
memset(memo, -1, sizeof memo);
sort(v.begin(), v.end());
reverse(v.begin(), v.end());

ll ans= solve( 0, 0);
cout<<ans<<endl;
return 0;
 
}

Measured memory_bytes: 35268
#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>;

void Main()
{
  int N;
  cin >> N;
  vector<int> A(N);
  rep(i,N) cin >> A[i];
  int d = abs(A[0]);
  rep(i,N-1) d += abs(A[i] - A[i+1]);
  d += abs(A[N-1]);
  
  rep(i,N) {
    int di;
    if (i == 0) di = d - abs(A[0]) - abs(A[1] - A[0]) + abs(A[1]);
    else if (i < N-1) {
      di = d - abs(A[i] - A[i-1]) - abs(A[i] - A[i+1]) + abs(A[i+1] - A[i-1]);
    } else di = d - abs(A[N-1] - A[N-2]) - abs(A[N-1]) + abs(A[N-2]);
    cout << di << endl;
  }
}

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


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

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

    int N;
    cin >> N;
    ll MOD = pow(10, 9) + 7;
    vector<vector<vector<vector<ll>>>> dp(
        N + 1,
        vector<vector<vector<ll>>>(5, vector<vector<ll>>(5, vector<ll>(5, 0))));
    dp[0][0][0][0] = 1; // 0はdummy

    for (int n = 0; n < N; n++) {
        for (int i = 0; i < 5; i++) {
            for (int j = 0; j < 5; j++) {
                for (int k = 0; k < 5; k++) {
                    for (int l = 1; l < 5; l++) {
                        if (i == 1 && j == 2 && l == 3)
                            continue;
                        if (i == 1 && k == 2 && l == 3)
                            continue;
                        if (j == 1 && k == 2 && l == 3)
                            continue;
                        if (j == 2 && k == 1 && l == 3)
                            continue;
                        if (j == 1 && k == 3 && l == 2)
                            continue;
                        dp[n + 1][j][k][l] += dp[n][i][j][k];
                        dp[n + 1][j][k][l] %= MOD;
                    }
                }
            }
        }
    }

    ll res = 0;
    for (int i = 1; i < 5; i++) {
        for (int j = 1; j < 5; j++) {
            for (int k = 1; k < 5; k++) {
                res += dp[N][i][j][k];
                res %= MOD;
            }
        }
    }

    cout << res << endl;
}

Measured memory_bytes: 512
n=int(input())
tt,xx,yy=0,0,0
ans=0
for i in range(n):
  t,x,y=map(int,input().split())
  if (x-xx+y-yy)%2!=(t-tt)%2:
    ans=1
  if x-xx+y-yy>t-tt:
    ans=1
  tt,xx,yy=t,x,y
print("YNeos"[ans::2])

Measured memory_bytes: 3064
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")

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

string s;

int main()
{
	cin >> s;
	for(int i = 0; i < s.length() - 8; i++)
		cout << s[i];
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int main(){
		ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
		//freopen("input.txt","r",stdin);
		//freopen("output.txt","w",stdout);
    int N;
    cin>>N;
    vector<pair<int,int> >v,v1;
    int p=0;
    for(int i=0;i<N;i++){
      string a;
      cin>>a;
      int c=0;
      int mi=0;
      for(int j=0;j<a.size();j++){
        if(a[j]=='(')c++;
        else c--;
        mi=min(mi,c);
      }
      if(mi==0 && c>=0){
          p+=c;
          continue;
      }
      if(c>=0)v.push_back({mi,c});
      else v1.push_back({mi,c});
    }
    sort(v.begin(),v.end(),[](pair<int,int> a,pair<int,int> b){
        return a.first>b.first;
    });
    for(int i=0;i<v.size();i++){
      if((p+v[i].first)<0){
        cout<<"No";
        return 0;
      }
      p+=v[i].second;
    }
    sort(v1.begin(),v1.end(),[](pair<int,int> a,pair<int,int> b){
         return (-a.second+a.first)<(-b.second+b.first);
    });
    for(int i=0;i<v1.size();i++){
      if((p+v1[i].first)<0){
        cout<<"No";
        return 0;
      }
      p+=v1[i].second;
    }
    if(p==0)cout<<"Yes";
    else cout<<"No";
    return 0;
}

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

stack <int> s;
int k;
int ans;

int main(){
	
	while(cin >> k ){
		if( k != 0 ){
			s.push(k);
		} else {
			cout << s.top() << endl;
			s.pop();
		}
	}
}

Measured memory_bytes: 1200
n, k = gets.split.map(&:to_i)
as = gets.split.map(&:to_i)

counts = as.each.with_object(Hash.new(0)) do |a, h|
  h[a] += 1
end.values.sort

ans = 0
until counts.size <= k
  ans += counts.shift
end

puts ans


Measured memory_bytes: 30848
#include<cstdio>
#include<vector>
#include<algorithm>
#define maxn 502
using namespace std;
#if 0
int dp[maxn][maxn],h[maxn][maxn];
int main(){
	int n,m,q;
	scanf("%d%d%d",&n,&m,&q);
	for(int i=1;i<=m;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		h[x][y]++;
	}
	for(int len=1;len<=n;len++){
		for(int i=1;i+len-1<=n;i++){
			int j=i+len-1;
			if(i==j){
				dp[i][j]=h[i][j];
			}
			else if(i+1==j){
				dp[i][j]=dp[i][i]+dp[j][j]+h[i][j];
			}
			else{
				dp[i][j]=dp[i+1][j]+dp[i][j-1]-dp[i+1][j-1]+h[i][j];
			}
		}
	}
	while(q--){
		int x,y;
		scanf("%d%d",&x,&y);
		printf("%d\n",dp[x][y]);
	}
	return 0;
}
#else
vector<int> v[maxn];
int main(){
	int n,m,q;
	scanf("%d%d%d",&n,&m,&q);
	for(int i=1;i<=m;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		v[x].push_back(y);
	}
	for(int i=1;i<=n;i++)sort(v[i].begin(),v[i].end());
	while(q--){
		int x,y,ans=0;
		scanf("%d%d",&x,&y);
		for(int i=x;i<=y;i++){
			ans+=upper_bound(v[i].begin(),v[i].end(),y)-v[i].begin();
		}
		printf("%d\n",ans);
	}
	return 0;
	return 0;
}
#endif

Measured memory_bytes: 2176
#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;
    string S;
    vector<vector<int>> c(n, vector<int>(26, 0));
    rep(i, n) {
        cin >> S;
        rep(j, S.size()) {
            c[i][(int)(S[j] - 'a')]++;
        }
    }
    rep(i, 26) {
        int cmin = 50;
        rep(j, n) {
            cmin = min(cmin, c[j][i]);
        }
        rep(j, cmin) cout << (char)(i + 'a');
    }
    cout << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()
A = list2d(N, 10, 0)
for i in range(N):
    A[i] = LIST()
B = list2d(N, 11, 0)
for i in range(N):
    B[i] = LIST()

ans = -INF
# 全時間帯でビット全探索(全0以外)
for S in range(1, 1<<10):
    sm = 0
    for i in range(N):
        cnt = 0
        for j in range(10):
            if S & 1<<j and A[i][j]:
                cnt += 1
        sm += B[i][cnt]
    ans = max(ans, sm)
print(ans)


Measured memory_bytes: 3188
#include <iostream>
#include <string>

using namespace std;

int main(void)
{
  int A[3][3];
  for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
          cin >> A[i][j];
      }
  }

  int N;
  cin >> N;

  int B[10];
  for (int i = 0; i < N; i++) {
      cin >> B[i];
  }

  bool flags[3][3];
  for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
          flags[i][j] = false;
      }
  }

  for (int k = 0; k < N; k++) {
      for (int i = 0; i < 3; i++) {
          for (int j = 0; j < 3; j++) {
              if (A[i][j] == B[k]) {
                  flags[i][j] = true;
              }
          }
      }
  }

  if (flags[0][0] && flags[0][1] && flags[0][2]) {
      cout << "Yes";
      return 0;
  }
  if (flags[1][0] && flags[1][1] && flags[1][2]) {
      cout << "Yes";
      return 0;
  }
  if (flags[2][0] && flags[2][1] && flags[2][2]) {
      cout << "Yes";
      return 0;
  }
  if (flags[0][0] && flags[1][0] && flags[2][0]) {
      cout << "Yes";
      return 0;
  }
  if (flags[0][1] && flags[1][1] && flags[2][1]) {
      cout << "Yes";
      return 0;
  }
  if (flags[0][2] && flags[1][2] && flags[2][2]) {
      cout << "Yes";
      return 0;
  }
  if (flags[0][0] && flags[1][1] && flags[2][2]) {
      cout << "Yes";
      return 0;
  }
  if (flags[0][2] && flags[1][1] && flags[2][0]) {
      cout << "Yes";
      return 0;
  }

  cout << "No";

  return 0;
}


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

int main(){
    int k, a, b;
    cin>>k>>a>>b;
    int div = a/k;
    if(((div*k)<=b && (div*k)>=a) || ((div+1)*k <= b && (div+1)*k >= a)){
        cout<<"OK\n";
    }else{
        cout<<"NG\n";
    }
    return 0;
}


Measured memory_bytes: 3632
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

main()
{
	int W, H, x, y, r;
	scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
	if (r <= x && x <= (W - r) && r <= y && y <= (H - r))
		printf("Yes\n");
	else
		printf("No\n");
}


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

using namespace std;

int items[7] = {0, 100, 101, 102, 103, 104, 105};

int main() {

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

	int x;
	cin >> x;
	int first = x / 100;
	int diff = 5 * first; 
	int hundred = first * 100;
	if (x >= hundred && x <= hundred + diff) cout << 1 << '\n';
	else cout << 0 << '\n';
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>       // for next_permutation
#include <vector>
#include <cstdlib>
#define INF 998244353

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

const ll MOD = 1e9+7;

static long gcd(long a, long b) {
    if (b == 0) {
        return a;
    }
    return gcd(b, a % b);
}
/*
long long int facctorialMethod(int k){//階乗
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}*/

long long int tousasum(long long int n){//等差数列
    return n*(n+1)/2;
}

unsigned GetDigit(unsigned num){//桁数
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}

bool is_prime(const unsigned n){
    switch(n){
        case 0: // fall-through
        case 1: return false;
        case 2: // fall-through
        case 3: return true;
    } // n > 3 が保証された

    if(n%2 == 0) return false;
    if(n%3 == 0) return false;
    // 2と3の倍数でないので6の倍数ではないことが保証された

    if(n%6 != 1 && n%6 != 5) return false;
    // 6の倍数前後の数(素数かもしれない数)であることが保証された

    // 6の倍数前後の数を使って試し割りをする
    for(unsigned i=5;i*i<=n;i+=6){
        if(n%i     == 0) return false; // 6n-1
        if(n%(i+2) == 0) return false; // 6n+1
    }

    return true;
}

map< ll, ll > prime_factor(ll n) {//素因数分解
    map< ll, ll > ret;
    for(ll i = 2; i * i <= n; i++) {
        while(n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if(n != 1) ret[n] = 1;
    return ret;
}

ll calcNumOfCombination(ll n, ll r){
    ll num = 1;
    for(ll i = 1; i <= r; i++){
        num = num * (n - i + 1) / i;
    }
    return num;
}

int bubblesort(vector<int> array,int size){//バブルソート　転倒数
    int kaisu = 0;
    for(int i = 0; i < size; i++){
        for(int j = i + 1; j < size; j++){
            if(array[i] > array[j]){
                int number = array[i];
                array[i] = array[j];
                array[j] = number;
                kaisu++;
            }
        }
    }
    return kaisu;
}

ll facctorialMethod(ll k){
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum = (sum * i)%MOD;
    }
    return sum;
}

// nPnの順列に対して処理を実行する
void foreach_permutation(int n, std::function<void(int *)> f) {
    int indexes[n];
    for (int i = 0; i < n; i++) indexes[i] = i;
    do {
        f(indexes);
    } while (std::next_permutation(indexes, indexes + n));
}





int main() {
   char c;
   cin >> c;
   cout << (char)(c + 1) << endl;

}






Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define dec(i, n)  decID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define FR front()
#define BA back()
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)
#define IN(T, ...) T __VA_ARGS__; IN_(__VA_ARGS__);
void IN_() { };
template<typename T, typename ... U> void IN_(T & a, U & ... b) { cin >> a; IN_(b ...); };
template<typename T> void OUT(T && a) { cout << a << endl; }
template<typename T, typename ... U> void OUT(T && a, U && ... b) { cout << a << " "; OUT(b ...); }

// ---- ----

int main() {
	IN(LL, n, a, b);
	LL c = a + b;
	OUT((n / c) * a + min((n % c), a));
}


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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define mp(a,b) make_pair((a),(b))
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
//template<typename T> using vec=std::vector<T>;

const int INF=1<<30;
const long long int INF_=1LL<<58;
const double EPS=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
	os << "[";
	for (const auto &v : vec) {
		os << v << ",";
	}
	os << "]";
	return os;
}

void Solve(){
	int n,t,s;
	cin >> n >> t >> s;

	vector<int> a(n),b(n);
	rep(i,0,n) cin >> a[i] >> b[i];

	static int dp[3000][3001];
	int ans=0;
	rep(i,0,n){
		rep(j,0,t+1){
			if(i!=0) dp[i][j]=dp[i-1][j];
			if(j-b[i]>=0&&!(j-b[i]<s&&s<j)){
				if(i!=0) dp[i][j]=max(dp[i][j],dp[i-1][j-b[i]]+a[i]);
				else dp[i][j]=a[i];
			}
			ans=max(ans,dp[i][j]);
		}
	}

	cout << ans << endl;
}

int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	Solve();
	return 0;
}

Measured memory_bytes: 36392
//abc117_c.cpp
//Thu Feb  7 21:22:02 2019

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

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

	sort(x,x+m);

	int dist[m-1];
	for (int i=0;i<m-1;i++){
		dist[i]=x[i+1]-x[i];
	}

	sort(dist,dist+m-1);

	int ans = 0;
	for (int i=0;i<m-n;i++){
		ans += dist[i];
	}


	cout << ans << endl;
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <stack>
#include <set>
using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll>> PP;

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define fr first
#define sc second



int main() {
	int d, n;
	cin >> d >> n;
 if(d==0&&n==100)cout<<101<<endl;
  else if(d==1&&n==100)cout<<10100<<endl;
  else if(d==2&&n==100)cout<<1010000<<endl;
	else if (d == 0)cout << n << endl;
	else if (d == 1)cout << n << "00" << endl;
	else cout << n << "0000" << endl;
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# case.rb

loop{ # 無限ループをするメソッド
  
  a, op, b = STDIN.gets.split(' ')
  a = a.to_i
  b = b.to_i  

 if op == "?" then
break
else
 puts(case op
  when "+"  
     a+b
  when "-"
     a-b
  when "*"
     a*b
  when "/"
     a/b
  end)
end
}

Measured memory_bytes: 8628
#include <iostream>
#include <vector>
#include <array>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <algorithm>

using namespace std;

struct Interval {
	unsigned long start;
	unsigned long end;

	bool operator<(const Interval& rhs) const {
		return end < rhs.end;
	}
};

int main (int argc, char* argv[]) {
	int n, r;
	cin >> n >> r;
	vector<Interval> positions;
	for (int i = 0; i < r; i++) {
		unsigned long start, end;
		cin >> start >> end;
		positions.emplace_back(Interval { start, end });
	}
	sort(positions.begin(), positions.end());
	int total = 1;
	auto prev_end = positions.front().end;
	for (int i = 1; i < positions.size(); i++) {
		const auto& position = positions[i];
		if (position.start < prev_end) continue;
		total++;
		prev_end = position.end;
	}
	cout << total << endl;
}


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

using namespace std;

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

    for (int i = 0; i < n; i++) {
        if (i < k) cout << s;
        else if (s > n) cout << 1;
        else cout << s+1;
        cout << " ";
    }

    return 0;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define INF 1000000000000000000
#define N 100100
#define pb push_back
#define MOD 1000000007
#define fn(i,n) for(int i=0;i<n;i+=1)
#define rep(i,l,r) for(int i=l;i<=r;i+=1)
int a[N];int dp[N];
signed main() {
    int n,k;cin>>n>>k;
    rep(i,1,n)cin>>a[i];
    rep(i,1,k)
    {
        int flag=0;
        rep(j,1,n)
        {
            if(i-a[j]>=0)
            {
                if(dp[i-a[j]]==0)
                flag=1;
            }
            if(flag)dp[i]=1;
        }
    }
    if(dp[k])cout<<"First"<<endl;
    else cout<<"Second"<<endl;
    

    return 0;
}



Measured memory_bytes: 1024
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<queue>
#include<cstdio>
#include<string>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
struct node
{
	int x, y, h;
}a[110]; 

int main() 
{
	int n; 
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) scanf("%d%d%d", &a[i].x, &a[i].y, &a[i].h);
	int x = 1; 
	while (a[x].h == 0) x++;
	for (int i = 0; i <= 100; i++) 
	{
		for (int j = 0; j <= 100; j++)
		{
			int h = a[x].h + abs(i - a[x].x) + abs(j - a[x].y);
			bool f = 0;	
			for (int k = 1; k <= n; k++) 
			{
				int hh = max(0, h - abs(i - a[k].x) - abs(j - a[k].y)); 
				if (hh != a[k].h)
				{
					f = 1;			
					break;
				}
			}	
			if (!f)
			{
				printf("%d %d %d", i, j, h);
				return 0;
			}
		} 
	}
	return 0;
}

Measured memory_bytes: 256
def comb(n, k, MOD):
    if n < k or n < 0 or k < 0:
        return 0
    k = min(k, n - k)
    if k == 0:
        return 1
    iinv = [1] * (k + 1)
    ans = n
    for i in range(2, k + 1):
        iinv[i] = MOD - iinv[MOD % i] * (MOD // i) % MOD
        ans *= (n + 1 - i) * iinv[i] % MOD
        ans %= MOD
    return ans

mm = 10**9 + 7
x, y = (int(x) for x in input().split())
ans = 0
if (x - 2*y) % 3 == 0:
    beta = (x - 2*y) // -3
    alpha = y - 2*beta
    ans = comb(alpha+beta, beta, mm)
print(ans)

Measured memory_bytes: 16192
N = int(input())
A = list(map(int, input().split()))

cnt = 0
ans = 0
for i in range(N):
    if A[i] == cnt + 1:
        cnt += 1
    else:
        ans += 1

if cnt + ans == N and cnt != 0:
    print(ans)
else:
    print(-1)


Measured memory_bytes: 24744
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
				int a=stdIn.nextInt();
		        int b=stdIn.nextInt();
		        
		        if(a%2==0||b%2==0) {
		        	System.out.println("Even");
		        }
		        else
		        	System.out.println("Odd");


	}

}


Measured memory_bytes: 20820
#include <bits/stdc++.h>
const long long INF = LLONG_MAX/2;
#define FOR(i, r, n) for(int i=(r); i<(n); i++) 
#define REP(i, n) FOR(i, (0), n)
#define ll long long int
template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
	vector.erase(vector.begin() + index);
}

using namespace std;
ll ans=0, sum = 0, n;

ll a, c5,c7;

int main()
{
	REP(i, 3)
	{
		cin >> a;
		if (a == 5) c5++;
		else if (a == 7) c7++;
	}
	if (c5 == 2 && c7 == 1) cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){
  int N;
  string S;
  cin >> N >> S;
  string ans = "";
  int c = 0, t = 0;
  for(int i = 0; i < N; ++i){
    if(S[i] == '(') ++c;
    else --c;
    if(c < 0){
      ++t;
      ++c;
    }
  }
  for(int i = 0; i < t; ++i) ans += "(";
  ans += S;
  for(int i = 0; i < c; ++i) ans += ')';
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main() {
  int n,m,l,tmp;
  long tmp2;
  scanf("%d %d %d", &n, &m, &l);
  long arra[n][m] = {{0}};
  long arrb[m][l] = {{0}};
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      scanf("%d", &tmp);
      arra[i][j] = tmp;
    }
  }
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < l; j++) {
      scanf("%d", &tmp);
      arrb[i][j] = tmp;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < l; j++) {
      tmp2 = 0;
      for (int k = 0; k < m; k++) {
        tmp2 += arra[i][k] * arrb[k][j];
      }
      printf("%ld", tmp2);
      if (j < l-1) printf(" ");
    }
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2912
#include <iostream>
#include <cstring>
#include <set>
#include <queue>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <cmath>

using namespace std;


#include <bits/stdc++.h>
using namespace std;
#define MAXN (1000000+10)
struct node
{
    int l,r,ord,id,ans;
}Ask[MAXN];
int l,r,now,n,m;
int cnt[MAXN],a[MAXN];
bool cmp1(node a,node b){return a.id==b.id?a.r<b.r:a.id<b.id;}
bool cmp2(node a,node b){return a.ord<b.ord;}
void Del(int x)
{
    cnt[a[x]]--;//个数--
    if (!cnt[a[x]]) now--;//减为0，总数--
}
void Ins(int x)
{
    if (!cnt[a[x]]) now++;//个数为0 插入，总数++
    cnt[a[x]]++;//个数++
}
void MO(int x)
{
    int L=Ask[x].l,R=Ask[x].r;
    while (l>L) Ins(--l);//大于当前左端点，往左跑，遇到的全给我插进去
    while (l<L) Del(l++);//小于左端点，往右跑，遇到的全给我扔掉
    while (r>R) Del(r--);//大于右端点，往左跑，遇到的全部删掉
    while (r<R) Ins(++r);//小于右端点 往右跑 遇到的全部插进去
    Ask[x].ans=now;//得到当前不同的数量
}
int main()
{
    ios::sync_with_stdio(false);
    cin>>n>>m;
    int len=sqrt(n);
    for (int i=1;i<=n;++i)
        cin>>a[i];
    //cin>>m;
    for (int i=1;i<=m;++i)
    {
        cin>>Ask[i].l>>Ask[i].r;
        Ask[i].id=Ask[i].l/len;
        Ask[i].ord=i;
    }
    sort(Ask+1,Ask+m+1,cmp1);//区间排序
    for (int i=1;i<=m;++i) MO(i);
    sort(Ask+1,Ask+m+1,cmp2);//变回原来的样子
    for (int i=1;i<=m;++i)
        printf("%d\n",Ask[i].ans);
    return 0;
}



Measured memory_bytes: 17444
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cmath>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  stack<char> st;
  rep(i, n) {
    char c;
    cin >> c;
    if (st.empty() || c != st.top())
      st.push(c);
  }
  cout << st.size() << endl;
  return 0;
}

Measured memory_bytes: 384