akhauriyash/Code-Regression huggingface dataset:
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

// vectorの重複削除
// std::sort(test.begin(), test.end());
// test.erase(std::unique(test.begin(), test.end()), test.end());

using namespace std;
using ll = long long;
using P = pair<int, int>; // vector<P> ba(n); みたいな感じですぐ使える ba[i] = P(a, b); make_pairをしなくてもいい
// typedef vector<int> v;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}
#define rep(i, c) for(int i = 0; i < int(c); i++)
#define ALL(x) (x).begin(), (x).end() //sort(ALL(obj))みたいな
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値
#define pb push_back //
// const int MOD = 1000000007;
// string alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
// printf("%.20f\n", ans); あれ
// const double PI = 3.141592653589793238462643383;

int main() {
  int n,m,x; cin>>n>>m>>x;
  std::vector<int> v(m);
  rep(i,m) cin>>v[i];
  int pans = 0;
  rep(j, n-x) {

    if (find(v.begin(), v.end(), x+1+j) != v.end()) {
      pans++;
    }
  }
  int mans = 0;
  rep(k, x) {
    if (find(v.begin(), v.end(), x-1-k) != v.end()) {
      mans++;
    }
  }
  cout << (pans >= mans ? mans : pans) << endl;
}


Measured memory_bytes: 3120
// In the name of Allah
// #Isart

#include<bits/stdc++.h>

#define pii pair<int, int>
#define pb push_back
#define F first
#define S second
#define ll long long
#define ld long double

using namespace std;

const int MAXN = 1e5 + 10;
ll a[MAXN], dp[MAXN];

int main(){
	ios::sync_with_stdio(false); cin.tie(0);
	int n; cin >> n;
	ll A, B; cin >> A >> B;
	for(int i = 0; i < n; i ++) cin >> a[i];
	dp[0] = 0;
	for(int i = 1; i < n; i ++)
		dp[i] = min(dp[i - 1] + B, dp[i - 1] + A * (a[i] - a[i - 1]));	
	cout << dp[n - 1] << endl;
	return 0;	
}

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

int main() {
	long long		s,a,b,c,i,j,k,n,m,x[3],y,ans = 0;
	string	str;
	
	cin >> n >> m;
	
	x[0] = x[1] = x[2] = -1;
	
	for(i=0;i<m;i++) {
		cin >> s >> c;
		s--;
		if (ans == -1) continue;
		if (x[s] == -1) {
			x[s] = c;
		} else if (x[s] != c) {
			ans = -1;
		}
	}
	

	if ((n != 1) && (x[0] == 0)) ans = -1;
	
	if (ans != -1) {
		if ((n != 1) && (x[0] == -1)) x[0] = 1;
		for(i=0;i<n;i++) {
			if (x[i] == -1) x[i] = 0;
			ans = ans * 10;
			ans = ans + x[i];
			//cout << x[i] << " ";
		}
	}

	cout << ans << endl;


}


Measured memory_bytes: 256
import numpy as np

N = int(input())
dp = np.zeros((3,N),dtype=int)

for i in range(N):
    dp[:,i] = list(int(x) for x in input().split())
    if i > 0:
        dp[0,i] += max(dp[1,i-1], dp[2,i-1])
        dp[1,i] += max(dp[2,i-1], dp[0,i-1])
        dp[2,i] += max(dp[0,i-1], dp[1,i-1])


print(max(dp[:,N-1]))


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

using namespace std;

int n;
char str[110], ttr[110];

int main() {
    int i, j;
    scanf("%d",&n);
    scanf("%s",str);
    scanf("%s",ttr);
    for (i=n;i>0;i--) {
        for (j=0;j<i;j++) if (str[n-i+j]!=ttr[j]) break;
        if (j==i) break;
    }
    printf("%d\n",2*n-i);
    return 0;
}


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

using _i64 = int64_t;
using _u64 = uint64_t;
using _f64 = double;

#define endl "\n"

#define _for(i, start, end) for(_i64 i = (_i64)start; i < (_i64)end; ++i)
#define _rep(i, number) _for(i, 0, number)
#define _foreach(e, data) for(auto& e : data)
#define _all(data) data.begin(), data.end()

template<typename type>
_i64 _size(const type& data) { return static_cast<_i64>(data.size()); }
template<typename type, size_t size>
_i64 _size(const type (&)[size]) { return static_cast<_i64>(size); }

enum _flag : bool { able = true, disable = false };

struct _time {
    _time(_flag flag) { check = flag; if(!check) { return; } gettime(start); }
    ~_time() {
        if(!check) { return; }; gettime(end);
        _i64 elapse = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cout << endl << "Time: " << elapse << " ms" << endl;
    }
    private:
    using _timer = chrono::time_point<chrono::system_clock>;
    _timer start, end; bool check;
    void gettime(_timer& time) { time = chrono::system_clock::now(); }
};

struct _ini { _ini() { ios::sync_with_stdio(false); cin.tie(nullptr); } } _ini;

int main() {
    {
        _time time(disable);
        _f64 a, t, r; cin >> a >> t >> r;
        cout << fixed << setprecision(6) << t * r / a << endl;
    }
    return 0;
}


Measured memory_bytes: 3312
/**
 * Created at 7:17 on 2019/03/07
 */

import java.io.*;
import java.util.*;

public class Main {

  static FastScanner sc = new FastScanner();

  public static void main(String[] args) {

    int N = sc.nextInt();

    System.out.println(1110 - N);

  }

  static class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
      if (ptr < buflen) {
        return true;
      } else {
        ptr = 0;
        try {
          buflen = in.read(buffer);
        } catch (IOException e) {
          e.printStackTrace();
        }
        if (buflen <= 0) {
          return false;
        }
      }
      return true;
    }

    private int readByte() {
      if (hasNextByte()) return buffer[ptr++];
      else return -1;
    }

    private static boolean isPrintableChar(int c) {
      return 33 <= c && c <= 126;
    }

    private void skipUnprintable() {
      while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
    }

    public boolean hasNext() {
      skipUnprintable();
      return hasNextByte();
    }

    public String next() {
      if (!hasNext()) throw new NoSuchElementException();
      StringBuilder sb = new StringBuilder();
      int b = readByte();
      while (isPrintableChar(b)) {
        sb.appendCodePoint(b);
        b = readByte();
      }
      return sb.toString();
    }

    public long nextLong() {
      if (!hasNext()) throw new NoSuchElementException();
      long n = 0;
      boolean minus = false;
      int b = readByte();
      if (b == '-') {
        minus = true;
        b = readByte();
      }
      if (b < '0' || '9' < b) {
        throw new NumberFormatException();
      }
      while (true) {
        if ('0' <= b && b <= '9') {
          n *= 10;
          n += b - '0';
        } else if (b == -1 || !isPrintableChar(b)) {
          return minus ? -n : n;
        } else {
          throw new NumberFormatException();
        }
        b = readByte();
      }
    }

    public int nextInt() {
      return (int) nextLong();
    }
  }

}


Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
template <class T> void cumulative_sum( T array, size_t N );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;

template <typename T, typename K> struct P {
	T a; K b;
};
typedef struct {
	vector <int> to;
	bool is_visited = false;
} node;
typedef struct {
	int to;
	int cost;
	P <int, int> change;
} edge;
int main( void ){
	int N; cin >> N;
	vector <ll> input( N ), vec( N );
	rep( i, 0, N ){
		cin >> input[ i ];
	}
	sort_asc( input );
	vec[ 0 ] = input[ 0 ];
	rep( i, 1, N ){
		vec[ i ] = vec[ i - 1 ] + input[ i ];
	}
	int cnt = 1;
	rep_d( i, N, 1 ){
		if (vec[ i - 1 ] * 2 >= input[i]){
			cnt++;
		}
		else
			break;
	}
	cout << cnt << endl;
}

int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
template <class T> void cumulative_sum( T array, size_t N ) {
	rep( i, 1, N + 1 ){
		array[ i ] += array[ i - 1 ];
	}
}
template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define chmax(a,b) ((a)=(a)>(b)?(a):(b))
#define chmin(a,b) ((a)=(a)<(b)?(a):(b))
#define abs(p) ((p)>=(0)?(p):(-(p)))
#define MOD 1000000007
ll powll(ll a,ll b){ll r=1;rep(i,b){r*=a;}return r;}
#define swap(a,b) do{ll w=(a);(a)=(b);(b)=w;}while(0)
#define swapd(a,b) do{double w=(a);(a)=(b);(b)=w}while(0)
#define in(a) scanf("%lld", &(a))
#define in2(a,b) scanf("%lld %lld",&(a),&(b))
#define in3(a,b,c) scanf("%lld %lld %lld",&(a),&(b),&(c))
#define ind(a) scanf("%lf", &(a))
#define ins(a) scanf("%s", (a))
#define inc(a) scanf("%c", &(a))
#define put(a) printf("%lld\n", (a))
#define putd(a) printf("%.15f\n", (a))
//      puts(a) printf("%s\n", a) 文字はこっち
//your code here!
int main(void){
    ll A, B, C;
    in3(A, B, C);
    if(A%2==0 || B%2==0 || C%2==0 ) puts("0");
    else put(min(min(A*B, B*C), C*A));
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <stdexcept>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define debug(a) cout << (a) << endl
namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;
template <class T>
bool chmax(T &a, const T &b)
{
	if (a < b)
	{
		a = b;
		return 1;
	}
	return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
	if (a > b)
	{
		a = b;
		return 1;
	}
	return 0;
}

ll M = 1000000007;
class UnionFind {
public:
    vector <ll> par; // 各元の親を表す配列
    vector <ll> siz; // 素集合のサイズを表す配列(1 で初期化)

    // Constructor
    UnionFind(ll sz_): par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }

    // Member Function
    // Find
    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    // Union(Unite, Merge)
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) { // 連結判定
        return root(x) == root(y);
    }

    ll size(ll x) { // 素集合のサイズ
        return siz[root(x)];
    }
};


void solve()
{
	int n,m;
	cin>>n>>m;
	UnionFind uf(n);
	vector<int>h(n);
	vector<bool>hi(n,true);
	rep(i,n){
		cin>>h[i];
	}
	rep(i,m){
		int a,b;
		cin>>a>>b;
		a--; b--;
		if(h[a]<h[b]){
			hi[a]=false;
		}else if(h[b]<h[a]){
			hi[b]=false;
		}else if(h[b]==h[a]){
			hi[a]=hi[b]=false;
		}
	}
	int cnt=0;
	rep(i,n){
		if(hi[i]){

			cnt++;
		}
	}
	cout<<cnt<<endl;

}

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


Measured memory_bytes: 5320
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

class Main{
    private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private static final PrintWriter out = new PrintWriter(System.out);
    public static void main(String[] Args) throws IOException{
        while(true){
            final String in = br.readLine();
            if(in.equals("0")) break;
            int ans = 0;
            for(int i = 0; i<in.length(); i++){
                ans += in.charAt(i)-'0';
            }
            out.println(ans);
        }
        out.flush();
    }
}

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

#define MP make_pair
#define PB push_back
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP1(i,n) for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n) for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

LL dp[51][51][2501];

int main(){
    int N, A;
    cin >> N >> A;
    VI x;
    REP(i, N){
        int tmp;
        cin >> tmp;
        x.PB(tmp);
    }

    dp[0][0][0] = 1;
    REP1(i, N+1){
        REP(j, N+1){
            REP(k, 2501){
                dp[i][j][k] = dp[i - 1][j][k];
                if(j != 0 && k >= x[i-1]){
                    dp[i][j][k] += dp[i-1][j-1][k-x[i-1]];
                }
                // if(dp[i][j][k] != 0){
                //     cout << i << "," << j << "," << k << " : " << dp[i][j][k] << endl;
                // }
            }
        }
    }

    LL ans = 0;
    REP1(i, N+1){
        ans += dp[N][i][i*A];
    }

    cout << ans << endl;
}


Measured memory_bytes: 50048
#include<stdio.h>
#include<string.h>
#include<assert.h>
 
#define MAX 1000003
#define len 12
 
char T[MAX][len];
 
int getChar(char c){
  if (c == 'A') return 1;
  else if (c == 'C') return 2;
  else if (c == 'G') return 3;
  else if (c == 'T') return 4;
}
 
int getKey(char str[]){
  int sum = 0, p = 1, i;
  for (i=0;i<strlen(str);i++){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}
int hash1(int key){
  return key%MAX;
}
int hash2(int key){
  return 1+key%(MAX-1);
}
int search(char str[]){
  int key = getKey(str);
  int i, j;
 
  for(i=0;i<MAX;i++){
    //    j=(hash1(key)+i*hash2(key))%MAX;
    j=((hash1(key)+i*hash2(key))&0x7fffffff)%MAX;
    if(strcmp(str, T[j])==0)return 1;
    if(T[j][0]=='\0') break;
 
  }
  return 0;
}
 
int insert(char str[]){
  int key = getKey(str);
  int i, j;
  for(i=0;T[j]=='\0'||i<MAX;i++){
    j=((hash1(key)+i*hash2(key))&0x7fffffff)%MAX;
    //   j=(hash1(key)+i*hash2(key))%MAX;
    if(T[j][0]=='\0'){
      strcpy(T[j], str);
      return 1;
    }
  }
  return 0;
}
 
int main(){
  int i,n;
  char com[8],str[len];
  for (i=0;i<MAX;i++) T[i][0] = '\0';
  scanf("%d",&n);
 
  for (i=0;i<n;i++){
    scanf("%s %s",com,str);
    if (com[0]=='i'){
      insert(str);
    } else {
      if (search(str)){
    printf("yes\n");
      } else {
    printf("no\n");
      }
    }
  }
  return 0;
}

Measured memory_bytes: 12324
n = int(input())

p = [0] * 101

for i in range(1, n+1):
    tmp = i
    while tmp > 1:
        j = 2
        while tmp % j != 0:
            j+=1
        tmp = tmp //j
        p[j] += 1
p = [x for x in p if x > 0]

ans = 0
lp = len(p)
for i in range(lp):
    for j in range(lp):
        for k in range(j+1, lp):
            if i != j and i != k and p[i] >= 2 and p[j] >= 4 and p[k] >= 4:
                ans += 1

for i in range(lp):
    for j in range(lp):
        if i != j and p[i] >= 14 and p[j] >= 4:
            ans += 1
for i in range(lp):
    for j in range(lp):
        if i != j and p[i] >= 24 and p[j] >= 2:
            ans += 1
for i in range(lp):
    if p[i] >= 74:
        ans += 1
print(ans)

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


int main() {
  ll a, b, k;
  cin >> a >> b >> k;
  
  if (a+b <= k){
    cout << 0 << " " << 0 << endl;
  }
  else if (a+b > k && a > k){
    cout << a-k << " " << b << endl;
  }
  else if (a+b > k && a <= k){
    cout << 0 << " " << b -(k-a) << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()


template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
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); }




void solve(void)
{
  double N,M,D;
  cin>>N>>M>>D;
  double X;
  if(D == 0)
  {
    X = 1.0/N;
  }
  else
  {
    X = 2*(N - D)/N/N;
  }
  cout<<(M-1)*X<<endl;
  return;
}
int32_t main(int32_t argc, const char *argv[])
{
std::ios::sync_with_stdio(false);
std::cin.tie(0);

std::cout << std::fixed;
std::cout << std::setprecision(9);
solve();

return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  long long int N;
  cin >> N;
  int sq = int(sqrt(N));
  long long int sum = 1000000000001;
  for(int i=1; i<=sq; i++){
    if(N%i==0){
      long long int a = N/i;
      if(sum > a+i-2) sum = a+i-2;
    }
  }
  cout << sum << endl;
  return 0;
}

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


int main() {
    int n;
    int t, a;
    cin >> n;
    cin >> t >> a;
    
    vector<int> v(n);
    for (int i=0; i<n; i++) {
        cin >> v.at(i);
    }
    
    int ans = -1;
    double minDiff = 100000;
    
    for (int i=0; i<n; i++) {
        double diff = abs(a - (t - 0.006*v.at(i)));
        if (minDiff > diff) {
            minDiff = diff;
            ans = i + 1;
        }
    }
    
    cout << ans << endl;
    
    
}


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

using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> H(N);
  for (auto&& h : H)
    cin >> h;
  
  int localmax = H[0];
  for (int i = 1; i < N; ++i){
    if (localmax - H[i] >= 2) {
      cout << "No\n";
      return 0;
    }
    localmax = max(localmax, H[i]);
  }
  cout << "Yes\n";
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;
int getN(int n,int K)
{
	if (n>K){
		return 0;
	}
	int N=0;
	int S=n;
	while (S<K){	
		N++;
		S=2*S;
	}
	return N;
}
int main(int argc, char* argv[])
{
	int N,K;
	cin>>N>>K;
	double x=0;
	for (int i=1;i<=N;i++){
		int n=getN(i,K);
		double y=(1.0/N)*pow(0.5,n);
		x+=y;
	}
	printf("%.12lf\n",x);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long n,k,m=1000000007,c=0;
  cin>>n>>k;
  for(long long i=k;i<=n;i++){
      c+=(i*(n+1-i)+1)%m;
  }
  c=(c+1)%m;
  cout<<c;
}

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

long nCr(int n, int r) {
    long ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}

int main(){
    int N, M;
    cin >> N >> M;
    cout << nCr(N,2) + nCr(M,2);
}

Measured memory_bytes: 256
#include <iostream>
// #include <cassert>
#include <vector>
#include <algorithm>
#include <climits>

#include <stack>
// #include <queue>
// #include <deque>
// #include <set>
// #include <map>
// #include <string>
// #include <unordered_set>
// #include <unordered_map>

// #include <tuple>
// #include <cmath>
// #include <numeric>

using namespace std;
typedef long long ll;
typedef pair<long,long> pll;
typedef pair<int,int> pii;
typedef pair<int,long> pil;
typedef pair<long,int> pli;
typedef vector<vector<long long>> vvll;
typedef vector<vector<long>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<long long> vll;

#define emplace_back pb
const char el = '\n';

/*
Edge cases:


*/

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

    int n; cin>>n; cin.ignore();

    stack<pair<char,string>> s;
    s.push({(char)('a'-1),""});
    while (!s.empty()) {
        auto p = s.top();
        s.pop();
        auto ch = p.first;
        auto str = p.second;
        if ((int)str.length() == n) {
            cout<<str<<el;
        } else {
            s.push({ch+1,str+(char)(ch+1)});
            for (char letter = ch; letter>='a'; --letter) {
                s.push({ch,str+letter});
            }
        }
    }






}


/*
How to tell if two strings are isomorphic?

Map each of them to a digt string;

abcda -> 12341
aabef -> 11234
aabcba -> 1123







*/

Measured memory_bytes: 1536
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>


#define int long long
#define REP(i,l,r) REPEAT(i,l,r,true) // [l, r)
#define rep(i,n) REP(i,0,n)           // [0, n)
#define REPEAT(i,l,r,condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#ifdef LOCAL
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define showlr(n,l,r) cerr<<#n<<" = ";for(int i=l;i<r;i++){cerr<<n[i]<<", ";}cerr<<endl // [l, r)
#else
#define show(...)
#define showlr(n,l,r)
#endif

#define YN(condition) puts((condition)?"YES":"NO")
#define Yn(condition) puts((condition)?"Yes":"No")
#define yn(condition) puts((condition)?"yes":"no")
#define YES puts("YES")
#define Yes puts("Yes")
#define yes puts("yes")
#define NO  puts("NO")
#define No  puts("No")
#define no  puts("no")

#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

struct io{io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}}io;

template<class T> istream& operator >>(istream &is, vector<T> &v){for(T &e:v)is>>e;return is;}
template<class T> ostream& operator <<(ostream &os, vector<T> v){os<<"{";for(T &e:v)os<<e<<(v.size()-(int)(&e-&v[0])>1?", ":"");os<<"}";return os;}

void _DEBUG(){}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<(sizeof...(b)?",":"\n");_DEBUG(b...);}

inline void in(){}
template<typename H,typename... T>void in(H &a, T&... b){cin>>a;in(b...);}
inline void out(){}
template<typename H,typename... T> void out(H a, T... b){cout<<a<<(sizeof...(b)?" ":"\n");out(b...);}

template<class T> void resz(int n,T& v){v.resize(n);}
template<class H,class... T> void resz(int n,H& a,T&... b){a.resize(n);resz(n,b...);}

template<typename V,typename H> void resize(vector<V>& v,const H a){v.resize(a);}
template<typename V,typename H,typename... T> void resize(vector<V>& v,const H& a,const T... b){v.resize(a);for(auto &v:v) resize(v,b...);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;
/*------------end of definitions------------*/

int X,A,B;

signed main(){

    in(X,A,B);
    puts(B<=A?"delicious":B<=A+X?"safe":"dangerous");

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
struct Node{
  int key;
  Node *parent,*left,*right;
};

Node *root,*NIL;

void Preorder(Node *pp){
  if(pp==NIL)return;
  cout<<" "<<pp->key;
  Preorder(pp->left);
  Preorder(pp->right);
}
void Inorder(Node *in){
  if(in==NIL)return;
  Inorder(in->left);
  cout<<" "<<in->key;
  Inorder(in->right);
}

void insert(int k){
  Node *z;
  Node *y=NIL; //x's parent
  Node *x=root; //T's root
  z=(Node *)malloc(sizeof(Node));
  z->key=k;
  z->left=NIL;
  z->right=NIL;
  while(1){
    if(x==NIL)break;
    y=x;
    if(z->key<x->key){
      x=x->left;
    }
    else{
      x=x->right;
    }
  }
  z->parent=y;
  if(y==NIL){
    root=z;
  }
  else {
    if(z->key<y->key){
      y->left=z;
    }
    else {
      y->right=z;
    }
  }
}
int treesearch(Node *x, int k){
    if(x==NIL){
      return false;
    }
    if(k==x->key)return true;
    if(k<x->key){
      return treesearch(x->left,k);
    }
    else{
      return treesearch(x->right,k);
    }
}

int main(){
  int n=0,in=0,f=0;
  int i=0;
  char cel[10];
  cin>>n;
  for(i=0;i<n;i++){
    cin>>cel;
    if(!strcmp(cel, "insert")){
      cin>>in;
      insert(in);
    }
    else if(!strcmp(cel, "print")){
      Inorder(root);
      cout<<endl;
      Preorder(root);
      cout<<endl;
    }
    else if(!strcmp(cel, "find")){
      cin>>in;
      f=treesearch(root,in);
      if(treesearch(root,in)){
	cout<<"yes"<<endl;
      }
      else {
	cout<<"no"<<endl;
      }
    }
  }
  return 0;
}



Measured memory_bytes: 21740
#include <iostream>
  #include <string>
  #include <vector>
  #include <algorithm>
  #include <map>
  using namespace std;
  typedef long long ll;
  #define rep(i,n) for (int i=0;i < (int)(n);i++)

  int main(){
    string o,e;
    cin >> o >> e;
    rep(i,o.size()){
      cout << o[i];
      if (i < e.size()) cout << e[i];
    }
    cout << endl;
    return 0;
  }
    
    

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.text.DecimalFormat;

public class Main {
	public static void main(String[] args)throws Exception{
		InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
    
    	String[] input = br.readLine().split(" ");
    	double x1 = Double.parseDouble(input[0]);
    	double y1 = Double.parseDouble(input[1]);
    	double x2 = Double.parseDouble(input[2]);
    	double y2 = Double.parseDouble(input[3]);
    	DecimalFormat df = new DecimalFormat("0.00000");
    	
    	double ans = Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));
    	System.out.println(df.format(ans));
    	
	}
}

Measured memory_bytes: 26136
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
ll mod =1000000007;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX*/                      int gcd(ll a,ll b){return b?gcd(b,a%b):a;}
/*"lcm"   MIN*/                      int lcm(ll a,ll b){return a*b/gcd(a,b);}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
int main(){
ll n;
cin >> n;
vector<ll>a(n),b(n),c(n);
for(ll i=0;i<n;i++){cin>>a.at(i);}
for(ll i=0;i<n;i++){cin>>b.at(i);}
for(ll i=0;i<n;i++){cin>>c.at(i);}
sort(a.begin(),a.end());
sort(b.begin(),b.end());
sort(c.begin(),c.end());
ll ans = 0;
for(ll i=0;i<n;i++){
ll key = b.at(i);
ll al = -1,ar=n;
    while(ar-al>1){
        ll mid = al+(ar-al)/2;
        if(a.at(mid)<key)al = mid;
        else ar =mid;
    }
    ll cl=-1,cr=n;
    while(cr-cl>1){
        ll mid = cl+(cr-cl)/2;
        if(c.at(mid)>key)cr=mid;
        else cl =mid;
    }
    al++;ar++;cl++;cr++;    
    ans+=(n-cr+1)*al;
}
cout << ans << endl;
}




Measured memory_bytes: 2560
import sys
sys.setrecursionlimit(10000000)
A,B,C,D=map(int,input().split())

def gcd(x,y):
  if x==0:
    return y
  else:
    return gcd(y%x,x)
CD=C*D//gcd(C,D)

print(B-B//C-B//D+B//(CD)-(A-1-(A-1)//C-(A-1)//D+(A-1)//(CD)))

Measured memory_bytes: 3060
N,M = map(int,input().split())

d = []
i = 1
while i**2 < M:
    if M%i == 0:
        d.append(i)
        d.append(M//i)
    i += 1
if i**2 == M:
    d.append(i)
d.sort()

ans = 1
for i in range(len(d)):
    if d[i]*N <= M:
        ans = d[i]
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
/* compress
    (X1,Y1),(X2,Y2)という二点で表されるもの（長方形や直線など）について、行か列の片方（X1とX2 or Y1とY2）を座標圧縮する（副作用）
    返り値: ソートされ重複要素を除いた値
    計算量: O(n log n)
*/
template <typename T>
vector<T> compress(vector<T> &C1, vector<T> &C2) {
    vector<T> vals;
    int N = (int)C1.size();
    for (int i = 0; i < N; i++) {
        for (T d = 0; d <= 1; d++) {  // その位置と、一つ隣を確保(隣を確保しないと空白が埋まってしまうことがある)
            T tc1 = C1[i] + d;
            T tc2 = C2[i] + d;
            vals.push_back(tc1);
            vals.push_back(tc2);
        }
    }
    // ソート
    sort(vals.begin(), vals.end());
    // 隣り合う重複を削除(unique), 末端のゴミを削除(erase)
    vals.erase(unique(vals.begin(), vals.end()), vals.end());
    for (int i = 0; i < N; i++) {
        C1[i] = lower_bound(vals.begin(), vals.end(), C1[i]) - vals.begin();
        C2[i] = lower_bound(vals.begin(), vals.end(), C2[i]) - vals.begin();
    }
    return vals;
}
 
int main() {
    // 入力
    int N;
    cin >> N;
    vector<int> X1(N), Y1(N), X2(N), Y2(N);
    for (int i = 0; i < N; i++) {
        cin >> X1.at(i) >> Y1.at(i) >> X2.at(i) >> Y2.at(i);
    }
 
    // 座標圧縮
    vector<int> X = compress(X1, X2);
    vector<int> Y = compress(Y1, Y2);
 
    // imos法で塗りつぶし
    int w = (int)X.size();
    int h = (int)Y.size();
    vector<vector<short>> G(w, vector<short>(h));
    for (int i = 0; i < N; i++) {
        G[X1[i]][Y1[i]]++;
        G[X2[i]][Y2[i]]++;
        G[X1[i]][Y2[i]]--;
        G[X2[i]][Y1[i]]--;
    }
    for (int x = 1; x < w; x++) {
        for (int y = 0; y < h; y++) {
            G[x][y] += G[x - 1][y];
        }
    }
    for (int x = 0; x < w; x++) {
        for (int y = 1; y < h; y++) {
            G[x][y] += G[x][y - 1];
        }
    }
 
    // 塗りつぶしたマスの面積を全て足し合わせる
    long long ans = 0;
    for (int x = 0; x < w - 1; x++) {
        for (int y = 0; y < h - 1; y++) {
            if (G[x][y]) {
                ans += (long long)(X[x + 1] - X[x]) * (Y[y + 1] - Y[y]);
            }
        }
    }
    cout << ans << endl;
}
 



Measured memory_bytes: 128212
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <utility>
#include <typeinfo>
using namespace std;

#define MOD 1000000007
#define INF 1e9+7
#define INF_LONG 1e18
#define rep(i, n) for(int i=0; i<n; ++i)
#define rrep(i, m, n) for(int i=m; i<n; ++i)
typedef long long ll;

#define MAX_N 200000
#define MAX_M 100000
#define MAX_V 100
#define MAX_E 100
#define MAX_Q 100000

int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};

int ddx[] = {-1, 0, 1, 0, -1, 1, -1, 1};
int ddy[] = {0, -1, 0, 1, 1, 1, -1, -1};

ll gcd(ll x, ll y) {
  if(y==0) return x;
  else return gcd(y, x%y);
}

ll lcm(ll x, ll y) {
  return (x*y)/gcd(x, y);
}

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

int main() {

  ll n, a, b;
  cin >> n >> a >> b;
  ll sum = (n/(a+b))*a;

  if(n%(a+b)>a) {
    sum += a;
  }else if(n%(a+b)<=a) {
    sum += n%(a+b);
  }

  cout << sum << endl;

  return 0;
}


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

def solve():
    A, B = list(map(int, input().split()))
    x1 = A*(100/8)
    x2 = B*(10)
    x = min(x1, x2)

    while True:
        a = math.floor(x*0.08)
        b = math.floor(x*0.1)
        if a>A and b>B:
            print(-1)
            return

        if A==a and B==b:
            break
        # print(a, b, x)
        # input()
        x += 1
    print(int(x))

if __name__ == "__main__":
    solve()


Measured memory_bytes: 3064
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>
#include <functional>

using namespace std;
#define ALL(x)              (x).begin(),(x).end()
#define REP(i, n)           for (int (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n)       for (int (i) = m ; (i) < (ll)(n) ; ++(i))
#define INF                 (int)2e9
#define MOD                 (1000 * 1000 * 1000 + 7)
#define Ceil(x, n)          (((((x))+((n)-1))/n))
#define CeilN(x, n)         (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)        ((x)-(x)%(n))
#define IsOdd(x)            (((x)&0x01UL) == 0x01UL)
#define IsEven(x)           (!IsOdd((x)))
#define M_PI                3.14159265358979323846
typedef long long           ll;
typedef pair<ll, ll>        P;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
// メイン
int main()
{
	string S;
	cin >> S;
	int maxSize = S.size();
	REP(c, 26) {
		int topIdx = 0;
		int endIdx = 0;
		for (topIdx = 0; topIdx < maxSize; topIdx++) {
			char str = c + 'a';
			int strCnt = 0;
			for (; topIdx < maxSize; topIdx++) {
				if (str == S[topIdx]) {
					strCnt++;
					break;
				}
			}

			for (endIdx = topIdx + 1; endIdx < maxSize; endIdx++) {
				if (str == S[endIdx]) {
					strCnt++;
					break;
				}
			}

			if (2 <= strCnt) {
				int strNum = endIdx - topIdx + 1;
				if (strNum <= 3) {
					cout << topIdx + 1 << " " << endIdx + 1 << endl;
					return 0;
				}
			}
		}
	}

	cout << "-1 -1" << endl;
	return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define eb emplace_back
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 2e5 + 233;
int first[maxn],a[maxn*2],last[maxn];
int f[maxn][51];
ll cost[maxn][51];
vector<int> ans;
bool vis[maxn];
int main()
{
 	ios::sync_with_stdio(false);
	int n;cin>>n;
	ll k;cin>>k;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		if(!first[a[i]])first[a[i]] = i;
		a[i+n] = a[i];
	}
	for(int i=n;i;i--){
		if(!last[a[i]]){
			if(first[a[i]]==n){
				cost[i][0] = 2;
				f[i][0] = 1;
			}
			else{
				cost[i][0] = 1;
				f[i][0] = first[a[i]] + 1;;
			}
		}
		else{
			if(last[a[i]]==n)f[i][0] = 1,cost[i][0] = 1;
			else f[i][0] = f[last[a[i]]+1][0],cost[i][0] = cost[last[a[i]]+1][0];
		}
		last[a[i]] = i;
	}
//	for(int i=1;i<=n;i++)cout<<"("<<f[i][0]<<","<<cost[i][0]<<") ";cout<<endl;
	for(int j=1;j<=50;j++)
	for(int i=1;i<=n;i++){
		cost[i][j] = cost[i][j-1] + cost[f[i][j-1]][j-1];
		f[i][j] = f[f[i][j-1]][j-1];
	}
	k--;
	int cur = 1;
	for(int j=50;j>=0;j--)
		if(k>=cost[cur][j]){
			k -= cost[cur][j];
			cur = f[cur][j];
			
		}
//	cout << "!!!!!!!" <<cur <<" "<<k<< endl;
	for(int i=cur;i<=n+k*n;i++){
		int c = a[(i-1)%n+1];
//		cout<<"->"<<i<<" "<<vis[a[i]] << endl;
		if(vis[c]){
			int last = 0;
			while(last!=c){
//				cout<<"last: " << last << endl;
				last = ans.back();
				vis[last] = 0;
				ans.pop_back();
			}
		}
		else{
			ans.pb(c);
			vis[c] = 1;
		}
	}
	for(int x:ans)cout << x <<" "; cout << endl;
}


Measured memory_bytes: 125428
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)

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

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

    int n;
    cin>>n;
    vector<int> as(n);
    rep(i, n) cin>>as[i];
    if(prev_permutation(as.begin(), as.end()))
        rep(i, n) cout<<as[i]<<(i != n - 1 ? ' ' : '\n');
    next_permutation(as.begin(), as.end());
    rep(i, n) cout<<as[i]<<(i != n - 1 ? ' ' : '\n');
    if(next_permutation(as.begin(), as.end()))
        rep(i, n) cout<<as[i]<<(i != n - 1 ? ' ' : '\n');
}


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

int main()
{
    int n, c = 0, m = 0;
    cin >> n;
    vector<int> d(n);
    for (int &x : d) {
        cin >> x;
        m = max(m, x);
    }

    vector<bool> p(m / 2 + 1, true);
    for (int i = 3, e = sqrt(m); i <= e; i += 2) {
        if (!p[i / 2])
            continue;
        for (int j = i * i / 2; j <= m / 2; j += i)
            p[j] = false;
    }

    for (int x: d)
        if (x == 2 || (x % 2 && p[x / 2]))
            c++;

    cout << c << endl;

    return 0;
}


Measured memory_bytes: 8728
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  int Y=1;
  string S;
  cin>>N>>S;
  for(int X=1;X<N;X++){
    if(S.at(X)!=S.at(X-1)){
      Y++;
    }
  }
  cout<<Y<<endl;
}

Measured memory_bytes: 3756
/*
    問題をよく読もう！
    論理的に考えよう！
    サンプルを確認しよう!
    絶対に諦めるな！
    工夫をしろ！

    Twitterは終わるまでログアウト！
    （間違えて解法をツイートしてはいけないから）

*/
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <functional>
using namespace std;
#define rep(i, n) for(int i=0; i<n; ++i)
typedef long long ll;
//必要な宣言

int main() {
  int a, b;
  cin >> a >> b;
  string s = to_string(a) + to_string(b);
  int num = stoi(s);
  int i=1;

  while(i*i <= num) {
    if(i*i == num) {
      cout << "Yes" << endl;
      return 0;
    }

    i += 1;
  }

  cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <map>
using namespace std;

long long gcd(long long a, long long b)
{
	return b ? gcd(b, a % b) : a;
}

const long long mod = 1000000007;
long long pw[200200] = { 1 };

int main()
{
	map<pair<long long, long long>, pair<int, int> > chk;

	for (int i = 1; i < 200200; i++) pw[i] = (pw[i - 1] * 2) % mod;

	long long a = mod - 1;
	int n; scanf ("%d", &n); while (n--){
		long long x, y;
		scanf ("%lld %lld", &x, &y);
		if (x == 0 && y == 0){ a++; continue; }
		if (make_pair(x, y) < make_pair(0ll, 0ll)) x = -x, y = -y;
		long long g = gcd(abs(x), abs(y));
		x /= g; y /= g;
		if (y > 0) chk[{x, y}].first++;
		else chk[{-y, x}].second++;
	}

	long long r = 1;
	for (auto& p : chk){
		r = r * (pw[p.second.first] + pw[p.second.second] - 1) % mod;
	}

	printf ("%lld\n", (a + r) % mod);

	return 0;
}


Measured memory_bytes: 17384
#include <iostream>
#include <ccomplex>
#include <vector>
#include <cassert>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>
#include <time.h>
#include <stack>
#include <locale>
#include <clocale>
#include <ctype.h>
#include <wchar.h>
#include <random>
#include <vector>

using namespace std;
typedef long long int LL;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)


int xcomp(pair<LL, LL>& a, pair<LL, LL>& b) {
	if (a.first == b.first) {
		return a.second < b.second;
	}
	return a.first < b.first;
}

#define XSORT(c) sort((c).begin(),(c).end(),xcomp)

#define ALL(x) (x).begin(),(x).end()
LL mod = 1000000007;

int main() {
	int N, A, B;
	cin >> N >> A >> B;
	if ((B - A) % 2 == 0){
		cout << "Alice" << endl;
	}
	else {
		cout << "Borys" << endl;
	}
}

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

int main(){
    int A, B;
    cin >> A >> B;

    if(A >= 13){
        cout << B << endl;
    }else if(A <= 5){
        cout << 0 << endl;
    }else{
        cout << B/2 << endl;
    }
}

Measured memory_bytes: 256
def resolve():
    N = int(input())
    a = list(map(int, input().split()))
    a.sort(reverse=True)
    Alice = []
    Bob = []
    for i, j in enumerate(a):
        if i % 2 == 0:
            Alice.append(j)
        else:
            Bob.append(j)
    print(sum(Alice) - sum(Bob))
    return

resolve()

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

int main(void){
	int n;
	scanf("%d", &n);
	int a[n];
	for(int i=0; i<n; i++) scanf("%d", &a[i]);
	std::sort(a, a+n);
	
	int ans = 0;
	for(int i=0; i<n; i++){
		for(int j=i+1; j<n; j++){
			int l=j, r=n;
			while(r-l>1){
				int mid = (l+r)/2;
				if(a[mid]<a[i]+a[j]) l = mid;
				else r = mid;
			}
			ans += l - j;
		}
	}
	printf("%d\n", ans);
	return 0;
}


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

using namespace std;

typedef long long int ll;
typedef pair<int, int> P;
#define INF 10000000000000
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
template<class T>bool chmax(T & a, const T & b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

int main()
{
	int r;

	cin >> r;

	cout << 3 * pow(r, 2) << endl;

	return 0;
}

Measured memory_bytes: 256
/**
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

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

const bool ready = [](){
    ios_base::sync_with_stdio(false); cin.tie(0);
    cout << fixed << setprecision(12);
    return true;
}();

const double PI = acos(-1);
using ll= long long;
#define int ll
#define all(v) (v).begin(), (v).end()
#define fori(n) for(int i=0; i<int(n); i++)

#define cini(i) int i; cin>>i;
#define cins(s) string s; cin>>s;
#define cind(d) double d; cin>>d;
#define cinai(a,n) vi a(n); fori(n) { cin>>a[i]; }
#define cinas(s,n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a,n) vd a(n); fori(n) { cin>>a[i]; }

using pii= pair<int, int>;
using pdd= pair<double, double>;
using vd= vector<double>;
using vb= vector<bool>;
using vi= vector<int>;
using vvi= vector<vi>;
using vs= vector<string>;

void solve() {
    cini(n);
    cini(k);
    cinai(p,n);
    sort(all(p));
    int ans=0;
    for(int i=0; i<k; i++)
        ans+=p[i];
    cout<<ans<<endl;
}

signed main() {
    solve();
}

// FIRST THINK, THEN CODE
// DO NOT JUMP BETWEEN PROBLEMS


Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using ull = unsigned long long;
//#define int ll
using vb = vector<bool>; using vvb = vector<vb>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
template<class T> using V = vector<T>;
template<class T> using VV = vector<V<T>>;
#define fi first
#define se second
#define maxs(x,y) (x=max(x,y))
#define mins(x,y) (x=min(x,y))
using pii = pair<int,int>; using pll = pair<ll,ll>;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(ll i = (ll)(b)-1;i >= a;--i)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define eb(val) emplace_back(val)
const double PI = acos(-1), EPS = 1e-10;
const ll MOD = 1e9+7;
int h,w;
ostream& operator<<(ostream &os, const vector<int> &st){
  for(int i=0;i<(int)st.size();++i){
    if(i==(int)st.size()-1) os << st[i];
    else os << st[i] << " ";
  }
  return os;
}
ostream& operator<<(ostream &os, const vector<vector<int>> &st){
  for(int i=0;i<(int)st.size();++i){
    os << st[i] << endl;
  }
  return os;
}
int dfsw(int i,int j,vvi &dp,int v){
  int res = v;
  if(j+1<w&&dp[i][j+1]) res = dfsw(i,j+1,dp,res+1);
  return dp[i][j] = res;
}
int dfsh(int i,int j,vvi &dp,int v){
  int res = v;
  if(i+1<h&&dp[i+1][j]) res = dfsh(i+1,j,dp,res+1);
  return dp[i][j] = res;
}
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> h >> w;
  vvi dpw(h,vi(w,-1));
  vvi dph(h,vi(w,-1));
  REP(i,h)REP(j,w){
    char c;
    cin >> c;
    if(c=='#') dph[i][j] = 0,dpw[i][j]=0;
  }
  int ans = 0;
  REP(i,h)REP(j,w){
    if(dpw[i][j]==0) continue;
    if(dpw[i][j]==-1) dfsw(i,j,dpw,1);
    if(dph[i][j]==-1) dfsh(i,j,dph,1);
    maxs(ans,dpw[i][j]+dph[i][j]-1);
  }
  //cout << dpw << endl <<  dph;
  cout << ans << endl;
}



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

int main(){
  int n,c;
  cin>>n>>c;
  bool p[c][100000];
  rep(i,0,c){
    rep(j,0,100000){
      p[i][j]=false;
    }
  }
  rep(i,0,n){
    int s,t,c;
    cin>>s>>t>>c;
    rep(j,s-1,t){
      p[c-1][j]=true;
    }
  }
  int ans=0;
  rep(i,0,100000){
    int cnt=0;
    rep(j,0,c){
      if(p[j][i]) cnt++;
    }
    ans=max(ans,cnt);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3200
/*
    SPFA ````
*/

#include <iostream>
#include <cstring>
#include <algorithm>
#include <queue>

using namespace std;
typedef long long ll;
const int N = 1e6+10;
int n,m,k,q,x,y;
int h[N],w[N],e[N],ne[N],idx;

ll dist[N];
bool st[N];

void add(int a,int b,int c)
{
    e[idx] = b,w[idx] = c,ne[idx] = h[a],h[a] = idx++;
}

void spfa()
{
    memset(dist,0x3f,sizeof dist);
    dist[k] = 0;
    queue<int>q;
    q.push(k);
    
    st[k] = true;
    
    while(q.size())
    {
        int t = q.front();
        q.pop();
        
        st[t] = false;
        
        for(int i = h[t];i!=-1;i=ne[i])
        {
            int j = e[i];
            if(dist[j]>dist[t] + w[i])
            {
                dist[j] = dist[t] + w[i];
                if(!st[j])
                {
                    q.push(j);
                    st[j] = true;
                }
            }

        }
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    cin >>n;
    memset(h,-1,sizeof h);
    m = n-1;
    while(m--)
    {
        int a,b,c;
        cin >>a>>b>>c;
        add(a,b,c);
        add(b,a,c);
    }
    
    cin >> q>>k;
    spfa();
    while(q--)
    {
        cin >>x >>y;
        cout << dist[x] + dist[y] << endl;
    }
    return 0;
}

Measured memory_bytes: 19200