akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;

namespace Aizu
{
    class OnlineJudge
    {
        public static void Main()
        {
            Console.WriteLine(Enumerable.Range(0, 5).Select(p => int.Parse(Console.ReadLine())).Select(p => p < 40 ? 40 : p).Average());
        }
    }
}

Measured memory_bytes: 5836
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define FOR(i, n, m) for (int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

typedef long long ll;

/**
 * 不安なら ll を使う.
 * 小数は double を忘れない.
 * nC2の求め方 (1/2)*n*(n-1)
 * vector<型> 変数名(要素数, 初期値)
 * pair<型, 型> 変数名
 * map<型, 型> 変数名  // 連想配列
 * priority_queue<型> 変数名  // 最大値から出てくるヒープ
 * 比較するときは型まで注意
 * 区間の計算は累積和
 * 整数同士の割り算は整数に丸められるのでdoubleでキャストする
*/

/* ===== コーナーケースに気をつけろ ===== */

int main()
{
    string N;
    cin >> N;
    if (N.at(0) == '7' || N.at(1) == '7' || N.at(2) == '7' ) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3528
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	ll n,a,b; cin>>n>>a>>b;
	if(a>b) swap(a,b);
	if(a%2==b%2)
	{
		cout<<min(b-1,min(n-a,abs(a-b)/2))<<'\n';
	}
	else
	{
		ll ans = min(b-1,n-a);
		ll L = a; ll R = b;
		R+=n-b; L+=n-b+1;
		ans=min(ans,abs(L-R)/2 + n-b+1);
		L=a;R=b;
		L-=a-1; R-=a;
		ans=min(ans,abs(L-R)/2 + a);
		cout<<ans<<'\n';
	}
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

struct edge {
    int from, to;
    ll cost;
};

class BellmanFord {
    int V;
    int E;
    vector<edge> edges;
    vector<ll> dist;
    vector<bool> negative;

public:
    BellmanFord(int v, int e) : V(v), E(e), negative(v) {
        dist.resize(V, INF);
    }

    void add_edge(int from, int to, ll cost) {
        edges.push_back({from, to, cost});
    }

    ll get_total_cost(int v) {
        return dist[v];
    }

    // v に到達するまでに負ループがあるかを検出する
    bool is_negative(int v) {
        return negative[v];
    }

    // ベルマンフォード法の実行・全辺の負閉路を検出 trueを返す時に負閉路を含む
    bool exec() {
        bool updated = false;
        dist[0] = 0;
        for (int i = 0; i < V; ++i) {
            for (int j = 0; j < E; ++j) {
                edge edge = edges[j];
                if (dist[edge.from] != INF && dist[edge.to] > dist[edge.from] + edge.cost) {
                    dist[edge.to] = dist[edge.from] + edge.cost;
                    if (i == V - 1) updated = true;
                }
            }
        }

        for (int i = 0; i < V; ++i) {
            for (int j = 0; j < E; ++j) {
                edge edge = edges[j];
                if (dist[edge.from] != INF && dist[edge.to] > dist[edge.from] + edge.cost) {
                    negative[edge.to] = true;
                }
                if (negative[edge.from]) {
                    negative[edge.to] = true;
                }
            }
        }
        return updated;
    }
};

void Main() {
    int N, M, P;
    cin >> N >> M >> P;
    BellmanFord bellmanFord(N, M);
    rep(i, M) {
        int a, b;
        ll c;
        cin >> a >> b >> c;
        a--;
        b--;
        bellmanFord.add_edge(a, b, -c + P);
    }
    bellmanFord.exec();

    if (bellmanFord.is_negative(N - 1)) {
        cout << -1 << '\n';
    } else {
        cout << max(0LL, -bellmanFord.get_total_cost(N - 1)) << '\n';
    }
}

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


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n;
	vector<string> s(3);
	cin >> n;
	REP(i,3) cin >> s[i];

	int ans = 0;
	REP(i,n){
		map<char, int> mp;
		REP(j,3) mp[s[j][i]]++;
		int cnt_m = 0;
		for(auto p: mp){
			cnt_m = max(cnt_m, p.second);
		}
		ans += 3 - cnt_m;
	}
	cout << ans << '\n';
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	ll a, b; cin >> a >> b;
	cout << (abs(a - b) > 1 ? "Alice" : "Brown") << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

typedef long long int int64;

int64 calc(const char *s,const int n,const int k){
  int64 res=0;
  int64 cntD=0;
  int64 cntM=0;
  int64 cntDM=0;
  int64 cntLDM=0;
  int i;
  for(i=0;i<n;i++){
    if(i>=k){
      if(s[i-k]=='D'){
	cntLDM+=cntM;
	cntD--;
      } else if(s[i-k]=='M'){
	cntM--;
      }
    }
    if(s[i]=='D'){
      cntD++;
    } else if(s[i]=='M'){
      cntM++;
      cntDM+=cntD;
    } else if(s[i]=='C'){
      res+=cntDM-cntLDM;
    }
  }
  return res;
}

void run(void){
  int n;
  scanf("%d",&n);
  char *s=(char *)calloc(n+1,sizeof(char));
  scanf("%s",s);
  int q;
  scanf("%d",&q);
  while(q--){
    int k;
    scanf("%d",&k);
    int64 ans=calc(s,n,k);
    printf("%lld\n",ans);
  }
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <climits>

using namespace std;

int main(int argc, char const* argv[])
{
    int maxprof = INT_MIN, min, x, n;
    cin >> n;
    cin >> min;

    for (int i = 0; i < n - 1; i++) {
        cin >> x;
        int p = x - min;
        if(p > maxprof) maxprof = p;
        if(x < min) min = x;
    }

    cout << maxprof << endl;

    return 0;
}

Measured memory_bytes: 3096
#include <cstdio>
#include <cstdlib>
#include <cmath>

using namespace std;

#define PI 3.1415

int main()
{
	int a, b;	//rectangle
	int x , y, radius;	//(x,y) = The coordinate of the center of the circle
	scanf("%d %d %d %d %d", &a, &b, &x, &y, &radius);

	double enshu[2] = {0, 0};	//The point on the enshu of the circle
	double h = 0.0001;

	int i, j = 0;

	for (i = 0; i*h < 2*PI; i++){
		enshu[0] = x + radius*cos(i*h);
		enshu[1] = y + radius*sin(i*h);
		if (enshu[0] < 0 || enshu[1] < 0 || enshu[0] > a || enshu[1] > b) {
			j = 1;
			break;
		}
	}

	if(j == 0) printf("Yes\n");
	else printf("No\n");

	return 0;
}

Measured memory_bytes: 1012
n = int(input())
r = []
for i in range(n):
  S, praw = input().split()
  p = int(praw)
  r.append((i, S, 100-p))
  
r_sorted = sorted(r, key=lambda x:(x[1], x[2]))

for i in range(n):
  print(r_sorted[i][0]+1)

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

using namespace std;
using ll=long long;
using vi=vector<int>;
using vl=vector<ll>;
using vs=vector<string>;

#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define rep(i, a, n) for (int i = (n); i < (a); ++i)
#define repr(i, a, n) for (int i = (n); i >= (a); --i)

template<typename T,typename U>
void Inparray(T &f,U n){
  for(int i=0;i<n;i++) cin>>f[i];
}

template<typename T,typename U>
void Printarray(T f,U n){
  for(int i=0;i<n;i++) i!=n ? cout<<f[i]<<" " : cout<<f[i];
}

void flagfunc(bool flag,string A,string B){
  flag ? cout<<A<<endl : cout<<B<<endl;
}

void flag2func(bool flag){
  flag ? cout<<"Yes"<<endl : cout<<"No"<<endl;
}

void flag3func(bool flag){
  flag ? cout<<"YES"<<endl : cout<<"NO"<<endl;
}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int n;cin>>n;cout<<"ABC"<<n<<endl;
}


Measured memory_bytes: 256
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>  
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000000000000000000000001
#define LONG_INF 10000000000000000LL
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD  998244353
#define REP(i,n) for(long long i = 0;i < n;++i)
vector<pair<int,int>> vertexs[200000];
int coloring[200000] = {};
int gogo(int a, int b) {
	for (int q = 0; q < vertexs[a].size(); ++q) {
		if (vertexs[a][q].first != b) {
			coloring[vertexs[a][q].first] = (coloring[a] + vertexs[a][q].second) % 2;
			gogo(vertexs[a][q].first, a);
		}
	}
	return 0;
}
int main() {
	int n;
	cin >> n;
	REP(i, n - 1) {
		int a, b, c;
		cin >> a >> b >> c;
		vertexs[a].push_back(make_pair(b, c%2));
		vertexs[b].push_back(make_pair(a, c % 2));
	}
	gogo(1, -1);
	for (int i = 1; i <= n; ++i) {
		cout << coloring[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 10752
<?php
  list($x1,$y1,$x2,$y2) = explode(" ", trim(fgets(STDIN)));

  $x3=$x2-($y2-$y1);
  $y3=$y2+($x2-$x1);
  $x4=$x3-($y3-$y2);
  $y4=$y3+($x3-$x2);

  echo $x3." ".$y3." ".$x4." ".$y4;

Measured memory_bytes: 15980
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <climits>
using namespace std;

#define MOD1097 1000000007

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mpair make_pair
#define pm(first, second) pb(mpair(first, second))
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(X) (X).begin(), (X).end()
#define reall(X) (X).rbegin(), (X).rend()
#define divcel(a, b) (((a) + ((b) - 1)) / (b))

int main(){

	string S;
	cin >> S;
	for(int i = 0; i < S.size(); i++){
		if(S[i] == '7'){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 3572
#借金を作る
i = 100000

#ループ回数を標準入力する
for _ in range(int(input())):
    
    #利息を加える
    i *= 1.05
    
    #切り上げがないとき以外1000より下を切り捨て1000を加える
    if i % 1000 != 0:
        i = i - (i % 1000) + 1000
        
#借金を出力する
print(int(i))


Measured memory_bytes: 5600
#include<stdio.h>
#include<math.h>
#include<stdlib.h>

int main()
{
    int x,i,red;
    float num;

    scanf("%d",&x);

    while(1)
    {
        if(x==2)
            break;
        else
        {
            red = 0;
        num = ceil(sqrt(x));

        for(i=2;i<=num;i++)
        {
            if(x%i==0)
            {
                red++;
                break;
            }
        }

        if(red!=0)
            x++;
        else
            break;
        }
    }

    printf("%d",x);

    return 0;
}


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

int main() {
  int a, b;
  cin >> a >> b;

  if (a <= b)
    cout << a << endl;
  else
    cout << a - 1 << endl;
  return 0;
}

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

struct Node{
  int key;
  Node *right, *left, *parent;
};

Node *root = nullptr, *NIL = nullptr;

void insert(int k) {
  Node *y = NIL;
  Node *x = root;
  Node *z;

  z = (Node *)malloc(sizeof(Node));
  z -> key = k;
  z -> left = NIL;
  z -> right = NIL;
  //アロー演算子::ポインタからメンバにアクセスする際に使う

  while ( x != NIL ) {
    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;
    }
  }
}

void inorder(Node *u) {
  if (u == NIL) return;
  inorder(u->left);
  printf(" %d", u->key);
  inorder(u->right);
}

void preorder(Node *u) {
  if (u == NIL) return;
  printf(" %d", u->key);
  preorder(u->left);
  preorder(u->right);
}

int main() {
  int n, x;

  string com;
  scanf("%d", &n);

  for (int i = 0; i < n; i++) {
    cin >> com;
    if (com == "insert") {
      scanf("%d", &x);
      insert(x);
    }
    else if ( com == "print"){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  return 0;
}



Measured memory_bytes: 26640
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define uniq(v) v.erase(unique(v.begin(),v.end()),v.end())
#define lb(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define ub(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
using Pair = pair<ll,pair<int,int>>;
#define pq priority_queue<Pair, vector<Pair>, greater<Pair>> 
const ll mod=1000000007;
//const ll mod=998244353;
const ld pi=acos(-1.0);
const ll INF = 1LL<<61;
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; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる




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

  int n;
  cin>>n;
  
    vector<pair<ll,ll>> p(n);
    rep(i,n){
        int a; cin >> a;
        p[i] = {a,i};
    }
    sort(all(p));
    reverse(all(p));
    
    multiset<int> d;
    d.insert(n);
    d.insert(n);
    d.insert(-1);
    d.insert(-1);
    ll ans = 0;
    rep(i,n){
        ll now = p[i].second;
        ll right, nright, left, nleft;
        auto itr = d.lower_bound(now);
        itr++;
        nright = *itr;
        itr--;
        right = *itr;
        itr--;
        left = *itr;
        itr--;
        nleft = *itr;
      	ans += ((right-now) * (left-nleft) + (now-left) * (nright-right)) * p[i].first;
        d.insert(now);
    }
    cout << ans << endl;
}

Measured memory_bytes: 9412
#include <stdio.h>
#include <string.h>

int main(void) {
  int a,b,i,j,m,q,z,length;
  char str[1001],command[8],rep[1001],rev[1001];
  scanf("%s",str);
  scanf("%d",&m);

  for(i = 0; i < m; i++){
    scanf("%s",command);

    switch(command[2]){
      case 'i' : //print
      scanf("%d %d",&a,&b);
      for(j = a; j <= b; j++){
        printf("%c",str[j]);
      }
      printf("\n");
      break;

      case 'p' : //replace
      scanf("%d %d",&a,&b);
      scanf("%s",rep);
      for(j = a; j <= b; j++){
        str[j] = rep[j - a];
      }
      break;

      case 'v' : //reverse
      scanf("%d %d",&a,&b); // 3 7
      for(j = 0; j < strlen(str); j++){
        rev[j] = str[j];
      }
      for(j = a; j <= b; j++){
        str[j] = rev[b - j + a]; //3,4 4,3 5,2 6,1 7,0
      }
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 2104
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define vec vector
#define fi first
#define se second
#define eb emplace_back
#define ef emplace_front
#define pof pop_front()
#define pob pop_back()
#define Rep(i,n) for(li i=0,nn=(li)(n);i!=nn;++i)
#define Rep1(i,n) for(li i=1,nn=(li)(n)+1;i!=nn;++i)
#define Size(v) (li)(v.size())
#define SortA(v) sort(v.begin(),v.end())
#define SortD(v) sort(v.rbegin(),v.rend())
#define All(a) (a).begin(),(a).end()
#define Input(a) for(li ii=0,nn=(li)(a.size());ii!=nn;++ii){cin>>(a).at(ii);}
#define Input2(a,b) for(li ii=0,nn=(li)(a.size());ii!=nn;++ii){cin>>(a).at(ii)>>(b).at(ii);}
#define mp make_pair
using li = int64_t;
using intl = int64_t;
using vi = vec<li>;
using vb = vec<bool>;
using vvi = vec<vi>;
using qi = deque<li>;
using pi = pair<li,li>;
using vpi = vec<pi>;
using si = set<li>;
using vsi = vec<si>;
using mii = map<li,li>;
using vmii = vec<mii>;
vec<li> dx = {0, 1, 0, -1, 1, 1, -1, -1};
vec<li> dy = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr li INF = 9223372036854775807;

void Yes(li b){
  if(b)cout<<"Yes";
  else cout<<"No";
}
void yes(li b){
  if(b)cout<<"yes";
  else cout<<"no";
}

int main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  cout.precision(16);
  
  li H,W,K;

  cin >>H>>W>>K;

  if(H==1&&W==1){cout<<0;return 0;}

  vvi S(H,vi(W));
  vvi temp(H,vi(W));
  
  char b;

  Rep(i,H){
  	Rep(j,W){
  		cin >> b;
      S[i][j]=b-'0';
  	}
  }
  
  /* Rep(j,H){
  		Rep(k,W){
  			cout<<S[j][k];
  		}
  		cout<<'\n';
  	}
  
  cout<<endl;
  */
  li minans=INF;

  for(int i = 0; i < (1<<(H-1));++i ){
  	bitset<10> ho(i<<1);
  	ho[0]=1;

  	vb ve(W-1,0);

  	Rep(j,H){
  		if(ho[j]){
  			temp[j][0]=S[j][0];
  		}
  		else{
  			temp[j][0]=S[j][0]+temp[j-1][0];
  			if(temp[j][0]>K){
  				goto loop_out;
  			}
  		}

  	}

  	Rep1(k,W-1){
  		loop_continue:
  		Rep(j,H){
  			if(ho[j]){
  				temp[j][k]=S[j][k];
  			}
  			else{
  				temp[j][k]=S[j][k]+temp[j-1][k];
  			}

  			if( (j==H-1||ho[j+1]) && !ve[k-1] ){
  				temp[j][k]+=temp[j][k-1];
  			}

  			if(temp[j][k]>K){
  				if(!ve[k-1]){
  					ve[k-1]=1;
  					goto loop_continue;
  				}
  				else{
  					goto loop_out;
  				}
  			}
 	 	}

  	}
  	minans =min(minans, li(ho.count()+accumulate(All(ve),0))-1 );

  	loop_out:;
  	/*Rep(j,H){
  		Rep(k,W){
  			cout<<temp[j][k];
  		}
  		cout<<endl;
  	}
    cout<<endl;
    */

 }

 cout <<minans;

}

Measured memory_bytes: 3780
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;

int main()
{
	string a, b, c;
	cin >> a >> b >> c;
	if (a.substr(a.length()-1,1) == b.substr(0,1) && b.substr(b.length()-1, 1) == c.substr(0, 1)) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return 0;
}

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

int main() {
  int a, b, k, c;
  cin >> a >> b >> k;
  c = 0;
  for (int i=100; i > -1; i--){
    if (a%i == 0 && b%i == 0){
      c++;
      if (c == k){
        cout << i << endl;
        return 0;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int ans,n,x[50],y[50];
int solve(int a,int b){
  int cnt=0;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(i==j) continue;
      if(x[i]-x[j]==a&&y[i]-y[j]==b) cnt++;
    }
  }
  return cnt;
}
int main(){
  cin>>n;
  for(int i=0;i<n;i++) cin>>x[i]>>y[i];
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(i==j) continue;
      ans=max(ans,solve(x[i]-x[j],y[i]-y[j]));
    }
  }
  cout<<n-ans<<endl;
}

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

int main()
{
	int a[3];
	for(int i=0;i<3;i++)
	{
		cin>>a[i];
	}
	sort(a,a+3);
	int d=1;
	for(int i=0;i<2;i++)
	{
		if(a[i]==a[i+1])
		d++;
	}
	if(d==2)
	cout<<"Yes"<<endl;
	else
	cout<<"No"<<endl;	
	
	return 0;
 } 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define pp pair<ll,ll>
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=998244353;
int inf=1000001000;
ll INF=1e18+5;
ll mod=INF;


int main() {
    int n;
    cin >> n;
    vector<int> a(n+1),b(2000000,0);
    rep(i,n){
        cin >> a[i];
    }
    a[n]=inf;
    sort(all(a));
    int ans=0;
    rep(i,n){
        if (b[a[i]]==0 && a[i]!=a[i+1]) ans++;
        if (b[a[i]]==1) continue;
        int c=a[i];
        while(true){
            if (c>2000000) break;
            b[c]=1;
            c+=a[i];
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 11964
#include "bits/stdc++.h"

using namespace std;

void solve()
{
	long N, P;
	cin >> N >> P;
	if (N == 1)
	{
		cout << P << endl;
		return;
	}
	long ans = 1;
	for (long i = 2; i * i <= P; i++)
	{
		long cnt = 0;
		while (P % i == 0)
		{
			cnt++;
			P /= i;
		}
		ans *= pow(i, cnt / N);
	}

	cout << ans << endl;
}

int main()
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int h, w;
    while(cin >> h >> w){
        if(h==0&w==0)
            break;
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                if(i==0||i==h-1||j==0||j==w-1)
                    cout << "#";
                else
                    cout << ".";
            }
            cout << endl;
        }
        cout << endl;
    }
}


Measured memory_bytes: 3008
import sys
from itertools import islice
from collections import deque
read = map(int, sys.stdin.read().split())

N = next(read)
A = [deque()] + [deque(islice(read, N - 1)) for _ in range(N)]
days = 1
available_players = deque(range(1, N + 1))
next_opponent = [0] * (N + 1)
played = set()

while available_players:
    player = available_players.popleft()
    if not A[player]:
        continue

    opponent = A[player].popleft()
    if next_opponent[opponent] == player:
        available_players.append(player)
        available_players.append(opponent)
        next_opponent[player] = 0
        next_opponent[opponent] = 0
        if player in played:
            days += 1
            played.clear()
        played.add(player)
        played.add(opponent)
    else:
        next_opponent[player] = opponent

for i in A:
    if len(i) > 0:
        print(-1)
        exit()
else:
    print(days)

Measured memory_bytes: 100672
N = int(input())
xy = [map(int, input().split()) for _ in range(N)]
x, y = [list(i) for i in zip(*xy)]
count = 0
for i in range(N):
    if (x[i] == y[i]):
        count += 1
    else:
        count = 0
    
    if count == 3:
        break
if count == 3:
    print('Yes')
else:
    print('No')

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

const int INF = 1000000010;

typedef vector<int> vi;
struct MaxFlow {
	int n, src, snk;
	struct edge {
		int c; int f; int u; int v;
		edge(int u, int v, int c, int f): u (u), v (v), c (c), f (f) {}
	};	
	vector <vi> G;
	vector <edge> e;
	MaxFlow(int n=0, int src=0, int snk=0): n (n), src (src), snk (snk) { e.clear(); G.assign(n + 1, vi()); }
	void add(int u, int v, int c) {
		G[u].push_back(e.size()); e.push_back(edge(u, v, c, 0)); 
		G[v].push_back(e.size()); e.push_back(edge(v, u, 0, 0)); 
	}
	vector <int> d, head;
	bool bfs() {
		d.assign(n + 1, 0); head.assign(n + 1, 0); d[src] = INF;
		queue <int> q; q.push(src); 
		while(!q.empty()) {
			int u = q.front(); q.pop();
			for (int id: G[u]) if (!d[e[id].v] && e[id].c > e[id].f) head[e[id].v] = id, d[e[id].v] = u, q.push(e[id].v);
		}
		return (d[snk] != 0);
	}
	void mxm() {
		int delta = INF, v = 0;
		for (int u = snk; u != src; u = d[u]) {
			int id = head[u];
			delta = min(delta, e[id].c - e[id].f);
		}
		for (int u = snk; u != src; u = d[u]) {
			int id = head[u];
			e[id].f += delta; e[id^1].f -= delta;
		}
	}
	long long maxFlow() {
		long long r = 0;
		while(bfs()) mxm();
		for (int id: G[src]) r += e[id].f;
		return r;
	}
} mf;
//--------------------------------------------

const int N = 105;
const int dx[] = {0, 0, -1, +1};
const int dy[] = {-1, +1, 0, 0};

int n, m;
char a[N][N];

int in(int i, int j) { return 2 * ((i - 1) * m + j) - 1; }
int out(int i, int j) { return 2 * ((i - 1) * m + j); }

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

	cin >> n >> m;
	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= m; ++j) {
			cin >> a[i][j];
		}
	}

	auto inside = [&](int x, int y) {
		return x >= 1 && x <= n && y >= 1 && y <= m;
	};

	int tot = 2 * n * m;
	int s = ++tot;
	int t = ++tot;
	mf = MaxFlow(tot, s, t);
	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= m; ++j) {
			if (a[i][j] == 'X') {
				mf.add(s, in(i, j), INF);
			}
			if (i == 1 || i == n || j == 1 || j == m) { // in borders
				mf.add(out(i, j), t, INF);
			}
			for (int dir = 0; dir < 4; ++dir) {
				int x = i + dx[dir], y = j + dy[dir];
				if (inside(x, y)) {
					mf.add(out(i, j), in(x, y), INF); 
				}
			}
			mf.add(in(i, j), out(i, j), (a[i][j] == '.' ? 1 : INF));
		}
	}

	long long mincut = mf.maxFlow();
	if (mincut > n * m) return cout << -1 << '\n', 0;
	cout << mincut << '\n';
}

Measured memory_bytes: 3824
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int T = scan.nextInt();
        int result = b * (int) ((T + 0.5) / a);
        System.out.println("" + result);
    }

}


Measured memory_bytes: 23124
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
using namespace std;
using LL = long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1000000000;
const double PI = acos(-1);

int main() {
	int n;
	cin >> n;
	if (n % 7 == 0)cout << "thu" << endl;
	if (n % 7 == 1)cout << "fri" << endl;
	if (n % 7 == 2)cout << "sat" << endl;
	if (n % 7 == 3)cout << "sun" << endl;
	if (n % 7 == 4)cout << "mon" << endl;
	if (n % 7 == 5)cout << "tue" << endl;
	if (n % 7 == 6)cout << "wed" << endl;
}

Measured memory_bytes: 3108
<?php
list ($N, $T) = array_map(intval, explode(" ", trim(fgets(STDIN))));

$a = array();
for($i=0; $i<$N; $i++)
    $arr[$i] = array_map(intval, explode(" ", trim(fgets(STDIN))));

$arr = array_filter($arr, function($v) use ($T) { return $v[1] <= $T; });

if (count($arr) == 0) {
    echo "TLE\n";
    return 0;
}

$ans = array_reduce($arr, function ($carry, $item) {
    if ($carry == NULL || $item[0] <= $carry[0]) {
        return $item;
    } else {
        return $carry;
    }
});

echo "$ans[0]\n";
?>


Measured memory_bytes: 4856
N=int(input())
S = []
for j in range(N):
    S.append(input())
import collections
S2=collections.Counter(S)
S1=S2.most_common()

S3=[]
S3.append(S1[0][0])
for i in range(1,len(S1)):
    if S1[i][1]==S1[0][1]:
        S3.append(S1[i][0])
    else:
        break
S3=sorted(S3)
for i in range(0, len(S3)):
    print(S3[i])

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

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

    if (S[0] == S[1] && S[2] == S[3] && S[0] != S[2]) cout << "Yes" << endl;
    else if (S[0] == S[2] && S[1] == S[3] && S[0] != S[1]) cout << "Yes" << endl;
    else if (S[0] == S[3] && S[1] == S[2] && S[0] != S[1]) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
//解説あり
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()


using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;

int ans;

int main(void) {
    ll a, b, c;
    cin >> a >> b >> c;
    if (c-a-b>0 && 4*a*b < (c-a-b)*(c-a-b)) puts("Yes");
    else puts("No");


	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define RI(a) scanf("%d",&a)
#define RII(a,b) scanf("%d%d",&a,&b)
#define RIII(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define F first
#define S second
#define REP(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
//}}}
const ll maxn=105;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=2000000000;

int n,k;

ll x[maxn],y[maxn];

int main()
{
	cin>>n>>k;
	
	REP(i,n) cin>>x[i]>>y[i];
	
	ll ans=INF64;
	
	REP(a,n) REP(b,n) REP(c,n) REP(d,n){
		int cnt=0;
		
		REP(i,n){
			if(x[i]>=x[a]&&x[i]<=x[b]&&y[i]<=y[d]&&y[i]>=y[c]) cnt++;
		}
		if(cnt>=k) ans=min(ans,(x[b]-x[a])*(y[d]-y[c]));
	}
	cout<<ans;
	return 0;
}












Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define REP(i,b) FOR(i,0,b)
using namespace std;

int main(void) {
	double a, b;
	cin >> a >> b;
	if (a > b) {
		cout << "GREATER" << endl;
	}
	else if (a < b) {
		cout << "LESS" << endl;
	}
	else {
		cout << "EQUAL" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import math
a, b, c = map(float, input().split())
s = a*b*math.sin(math.radians(c))/2
h = 2*s/a
l = a + b + (a**2+b**2 - 2*a*b*math.cos(math.radians(c)))**0.5
print("{0:.5f} {1:.5f} {2:.5f}".format(s,l,h))

Measured memory_bytes: 7848
n, m, X = map(int, input().split())
c = [ 0 for i in range(n)]

x = [ [0 for i in range(m)] for j in range(n)]

for i in range(n):
    s = input().split()
    c[i] = int(s[0])
    x[i] = list(map(int, s[1:]))

# print(c)
# print(x)
ans = 1e9
for mask in range(2**n):
    tans = 0
    skill = [0 for i in range(m)]
    for i in range(n):
        if (mask >> i) & 1 > 0:
            tans += c[i]
            for j in range(m):
                skill[j] += x[i][j]
    suc = True
    for i in range(m):
        if skill[i] < X:
            suc = False
            break

    if suc:
        ans = min(ans, tans)

if ans > 1e8:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 68768
#!/usr/bin/env python3
import sys
try:
    from typing import List
except ImportError:
    pass


def solve(N: int, K: int, t: "List[int]", d: "List[int]"):
    ss = sorted(zip(d, t), reverse=True)
    gs = []
    mst = set()
    for di, ti in ss[:K]:
        if ti in mst:
            gs.append((di, ti))
        else:
            mst.add(ti)
    dm = {}
    for di, ti in ss[K:]:
        if ti in dm or ti in mst:
            continue
        dm[ti] = di
    hs = sorted(((di, ti) for ti, di in dm.items()), reverse=True)
    cd = sum(di for di, ti in ss[:K])
    ct = len(mst)
    m = cd + ct * ct
    for (gdi, gti), (hdi, hti) in zip(reversed(gs), hs):
        cd += hdi - gdi
        ct += 1
        m = max(m, cd + ct * ct)
    print(m)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    t = [int()] * (N)  # type: "List[int]"
    d = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        t[i] = int(next(tokens))
        d[i] = int(next(tokens))
    solve(N, K, t, d)


if __name__ == '__main__':
    main()


Measured memory_bytes: 27488
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;
  
int main()
{
  ll N;
  cin >> N;
  vector<ll> A(N);
  vector<ll> B(N+1);
  B[0]=0;
  ll sum = 0;
  REP(i, N){
    cin >> A[i];
    sum+=A[i];
    B[i+1]=sum;
  }
  
  map<ll,ll> mp;
  REP(i,N+1){
    mp[B[i]]++;
  }

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

  cout << ans << endl;
}

Measured memory_bytes: 15872
//
//  main.c
//  Guidebook
//
//  Created by yuta on 2019/05/26.
//  Copyright © 2019 501Software. All rights reserved.
//

#include <stdio.h>
#include<string.h>
#include <stdlib.h>

typedef struct {
	int  number;
	char s[11];
	int p;
} RES;


int comp_op(const void *a, const void *b) {
	RES op1 = *(const RES*)a;
	RES op2 = *(const RES*)b;
	
	int ans = strcmp(op1.s, op2.s);

	if (ans == 0) {
		if (op1.p < op2.p) return 1;
		if (op1.p > op2.p) return -1;
		return 0;
	}
	else {
		return ans;
	}
}

int main(int argc, const char * argv[]) {
	int n;
	
	scanf("%d",&n);

	RES res[n];
	for(int i = 0; i < n ;i++) {
		scanf("%s %d", res[i].s, &res[i].p);
		res[i].number = i+1;
	}
	
	// カード配列ソート
	qsort(res, n, sizeof(RES), comp_op);

	
	
	for(int i = 0; i < n ;i++) {
		printf("%d\n",res[i].number);
	}

	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define maxn 300010
int a[maxn];
set <int> s;
vector <int> v;
#define pii pair<int,int>
#define mp make_pair
#define F first
#define S second
pii p[maxn];
int ans[maxn];
vector <int> st[maxn];
#define mid (L+R)/2
struct node{
	int val;
	node *lt;
	node *rt;
	node(){
		val= 0;
		lt= NULL;
		rt= NULL;
	}
};

node* N[maxn];
/*
void update (node* prev, int L, int R, int ind){
	if (L>R or ind>R or L>ind) return;
	if (!n) n= new node();
	n->val++;
	if (L==R) return;
	if (ind<=mid){
		update (n->lt, L, mid, ind);
	}
	else{
		update (n->rt, mid+1, R, ind);
	}
 }

node* upd (node* prev, int L, int R, int ind, int v){
	if (L>R or L>ind or ind>R) return prev;
	node* cur= new node();
	if (prev!=NULL) *cur= *prev;
	cur->val+=v;
	if (L==R) return cur;
	if (ind<=mid){
		if (prev==NULL)	cur->lt= upd(NULL, L, mid, ind, v);
		else cur->lt= upd(prev->lt, L, mid, ind, v);
	}
	else{
		if (prev==NULL) cur->rt= upd(NULL, mid+1, R, ind, v);
		else cur->rt= upd(prev->rt, mid+1, R, ind, v);
	}
	return cur;
}

int query (node* N, int L, int R, int S, int E){
	if (!N or L>R or L>E or S>R) return 0;
	if (L>=S and R<=E) return N->val;
	return query(N->lt, L, mid, S, E) + query(N->rt, mid+1, R, S, E);
}*/

int bit[maxn];

void upd (int ind, int val){
	while (ind<maxn){
		bit[ind]+=val;
		ind+=ind&(-ind);
	}
}

int query (int ind){
	int ans= 0;
	while (ind){
		ans+=bit[ind];
		ind-=ind&(-ind);
	}
	return ans;
}


map <int, int> M[maxn]; 
vector <int> queries[maxn]; 


void add (int l1, int l2, int r, int n){

	queries[l1-1].push_back(r-1);	
	queries[l2].push_back(r-1);
	queries[l1-1].push_back(n);
	queries[l2].push_back(n);
}

int find (int l1, int l2, int r, int n){
	return M[l2][n]-M[l2][r-1] - (M[l1-1][n]-M[l1-1][r-1]);
}
vector <int> en[maxn];

int main(){
	int n, m;
	scanf("%d %d", &n, &m);
	for (int i=1; i<=n; i++) {
		//cin>>p[i].F>>p[i].S;

		scanf("%d %d", &p[i].F, &p[i].S);
		st[p[i].F].push_back(p[i].S);
		en[p[i].S].push_back(p[i].F); 
	}
	for (int d=1; d<=m; d++){
		for (int j=1; d*j<=m; j++){
			add((j-1)*d+1, d*j, d*j, m);
		}
	}
	for (int i=1; i<=m; i++){
		for (int j=0; j<st[i].size(); j++) upd (st[i][j], 1);
		for (int j=0; j<queries[i].size(); j++){
			int nt= queries[i][j];
			M[i][nt]= query(nt);
		}	
	}
	for (int d=1; d<=m; d++){
		for (int j=1; d*j<=m; j++){
			ans[d]+=find((j-1)*d+1, d*j, d*j, m);
		}
	}
	for (int i=1; i<=m; i++) printf("%d \n", ans[i]);

}


Measured memory_bytes: 133620
#include <iostream>
#include <vector>

#ifdef _VSCODE_DEBUG
    #include <fstream>
#endif
static const int INF = 1e9;

void warshall_floyd(int n, std::vector<std::vector<int>>& vec) {
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            for (int k = 0; k < n; ++k) {
                vec[j][k] = std::min(vec[j][k], vec[j][i] + vec[i][k]);
            }
        }
    }
}

int main(){
    #ifdef _VSCODE_DEBUG
        std::ifstream in("input.txt");
        std::cin.rdbuf(in.rdbuf());
    #endif
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    // input data
    int H, W;
    std::cin >> H >> W;
    std::vector<std::vector<int>> c(10, std::vector<int>(10,0));
    for (int i=0; i<10; ++i) {
        for (int j=0; j<10; ++j) std::cin >> c[i][j];
    }
    std::vector<std::vector<int>> A(H, std::vector<int>(W,0));
    for (int i=0; i<H; ++i) {
        for (int j=0; j<W; ++j) std::cin >> A[i][j];
    }

    warshall_floyd(10, c);
    int ans = 0;
    for (int i=0; i<H; ++i) {
        for (int j=0; j<W; ++j) {
            if (A[i][j]== -1 || A[i][j]== 1) continue;
            else ans += c[A[i][j]][1];
        }
    }
    std::cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define PER(i,n) for(int i=n-1;i>=0;--i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define PII pair<int,int>
#define PLI pair<long long, int>
#define PLL pair<long long, long long>
#define PAIR pair<double, double>
#define ALL(x) (x).begin(),(x).end()
#define BIT(x) (1LL << (x))
#define PI acos(-1)
const LL MOD = (LL)1e9+7;
const LL INF = (LL)1e9+7;
const LL INFLL = (LL)1e18;
using namespace std;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}

LL modpow(LL x, LL b){
	LL res = 1;
	while(b){
		if(b&1)res = res * x % MOD;
		x = x * x % MOD;
		b>>=1;
	}
	return res;
}

LL modinv(LL x){
	return modpow(x, MOD-2);
}

int main(){
	int n, m;
	cin >> n >> m;
	priority_queue<LL> que;
	REP(i, n){
		LL d;
		cin >> d;
		que.push(d);
	}

	REP(i, m){
		LL d = que.top();
		que.pop();
		d >>= 1;
		que.push(d);
	}

	LL ans = 0;

	while(que.size()){
		ans += que.top();
		que.pop();
	}
	cout << ans << endl;
	return 0;

}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl ("\n")
#define pi (3.141592653589)
#define mod 1000000007
#define INF 1000000009
#define float double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define so sizeof 
#define pii pair<ll,ll>
#define all(c) c.begin(), c.end()
#define min3(a, b, c) min(c, min(a, b))
#define min4(a, b, c, d) min(d, min(c, min(a, b)))
#define max3(a, b, c) max(c, max(a, b))
#define max4(a, b, c, d) max(d, max(c, max(a, b)))
#define repe(i,a) for(auto i:a)
#define st string
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define rrep(i,a,b) for(ll i=b;i>=a;i--)
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr); 
void solve(){
   string s;
   cin>>s;
   if(s[s.size()-1]=='s'){
      cout<<s+"es"<<endl;
   }
   else{
    cout<<s+"s"<<endl;
   }
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt","r", stdin);
    freopen("output.txt","w", stdout);
#endif
    fast
    // ll t;
    // cin>>t;
    // while(t--)
    solve();
    return 0;
}

Measured memory_bytes: 3652
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		@SuppressWarnings("resource")
		Scanner cd = new Scanner(System.in);
		int d = cd.nextInt();
		long n = cd.nextInt();
		long ans=0;
		if(d==0) {
			if(n==100) {
				ans=101;
			}
			else{
				ans=n;
			}
		}
		else if(d==1) {
			if(n==100) {
				ans = 10100;
			}
			else{
				ans=100*n;
			}
		}
		else if(d==2) {
			if(n==100) {
				ans = 1010000;
			}
			else{
				ans= 10000*n;
			}
		}

		System.out.println(ans);
	}

}


Measured memory_bytes: 21844
#include<iostream>

using namespace std;

int main()
{
    int n,q,a[100000];
    int mini,maxn;
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>a[i];
    cin>>q;
    int judge,low,high;
    for(int i=1;i<=q;i++)
       {
           cin>>judge>>low>>high;
           mini=maxn=a[low];
           if(judge==0)
               {
                   for(int i=low;i<=high-1;i++)
                     if(a[i]<mini)
                        mini=a[i];
                   cout<<mini<<endl;
               }
           else
           {
               for(int i=low;i<=high-1;i++)
                  if(a[i]>maxn)
                    maxn=a[i];
              cout<<maxn<<endl;
           }

       }
    return 0;
}



Measured memory_bytes: 3116
#include <algorithm>
#include <cstdio>
#include <cstring>
using namespace std;

typedef long long ll;

const int MAX_N = 1000;
const int MOD = 1000003;

// input
int n, k;

int dp_a[MAX_N + 1][MAX_N + 1];
int dp_b[MAX_N + 1][MAX_N + 1];
int dp[MAX_N + 1];
ll inv[MAX_N + 1];

void init_inv()
{
  inv[1] = 1;
  for (int i = 2; i <= MAX_N; i++)
    inv[i] = (MOD - (MOD / i) * inv[MOD % i] % MOD) % MOD;
}

int gcd(int a, int b)
{
  if (b > a)
    swap(a, b);

  return b == 0 ? a : gcd(b, a % b);
}

void solve()
{
  ll ans = 0, all = 0;

  memset(dp_a, 0, sizeof dp_a);
  memset(dp_b, 0, sizeof dp_b);
  memset(dp, 0, sizeof dp);

  int a_sum = 1, b_sum = 0;

  if (k >= n)
  {
    k = n - 1;
    all = 2;
  }
  dp_a[1][1] = 1;
  dp_b[1][1] = 0;

  for (int i = 2; i <= n; i++)
  {
    dp_a[i][1] = b_sum;
    dp_b[i][1] = a_sum;
    swap(a_sum, b_sum);
    for (int j = 2; j <= k; j++)
    {
      dp_a[i][j] = dp_a[i - 1][j - 1];
      a_sum = (a_sum + dp_a[i][j]) % MOD;

      dp_b[i][j] = dp_b[i - 1][j - 1];
      b_sum = (b_sum + dp_b[i][j]) % MOD;
    }
  }

  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= k; j++)
      dp[i] = (dp[i] + dp_b[i][j]) % MOD;

  for (int i = 1; i <= n; i++)
    for (int j = 1; j < k; j++)
      dp_b[i][j + 1] = (dp_b[i][j + 1] + dp_b[i][j]) % MOD;

  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= min(i, k); j++)
      dp[i] = (dp[i] + dp_b[i - j][k - j]) % MOD;

  for (int i = 0; i < n; i++)
    ans = (ans + 2 * dp[gcd(i, n)]) % MOD;

  ans = (ans * inv[n]) % MOD;

  printf("%lld\n", (ans + all) % MOD);
}

int main()
{
  init_inv();
  
  while (scanf("%d%d", &n, &k) != EOF)
  {
    if (n == 0 && k == 0)
      break;

    solve();
  }
  return 0;
}



Measured memory_bytes: 10520
#include <iostream>
using namespace std;
int main(){
    int a=1,b=0,c=0;
    int tmp=0;
    char x,q,y;
    while(cin>>x>>q>>y){
        if(x=='A'&&y=='B'||x=='B'&&y=='A'){
            tmp=a;
            a=b;
            b=tmp;
        }
        if(x=='A'&&y=='C'||x=='C'&&y=='A'){
            tmp=a;
            a=c;
            c=tmp;
        }
        if(x=='B'&&y=='C'||x=='C'&&y=='B'){
            tmp=c;
            c=b;
            b=tmp;
        }
    }
    if(a==1)cout<<"A"<<endl;
    if(b==1)cout<<"B"<<endl;
    if(c==1)cout<<"C"<<endl;
}

Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,a;
  cin >> N;
    vector<int> vec(N);
      for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
    sort(vec.begin(), vec.end());
 cout << vec[N-1] - vec[0] << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int isPrime(int);//judge whether the integer is prime or not
int main(void)
{
  int i,n,x,ans=0;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      scanf("%d",&x);
      ans+=isPrime(x);
    }
  printf("%d\n",ans);
  return 0;
}
int isPrime(int x)
{
  int i;
  if(x==2) return 1;//2 is a prime number, so the return number is 1
  if(x%2==0) return 0;//if x is an even number, x is not a prime number. So the return number is 0
  for(i=3;i<=sqrt(x);i+=2)
    {
      if(x%i==0) return 0;//now x is not a prime number
    }
  return 1;//now x is a prime number
}




Measured memory_bytes: 2072
// failed to generate code

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;
vector<char> c1, c2;

int main(){	
	string S;
	ll Q;
	cin >> S;
	scanf("%lld",&Q);
	vector<ll> Query1(Q), Query2(Q);
	vector<char> Query3(Q);
	rep(i, Q) {
		scanf("%lld",&Query1[i]);
		if (Query1[i] == 2) {
			char c;
			scanf("%lld",&Query2[i]);
			scanf("%c",&c);
			scanf("%c",&Query3[i]);
		}
	}
	bool flg = false;
	
	rep(i, Q) {
		if (Query1[i] == 1) {
			flg = !flg;
		} else {
			if (Query2[i] == 1) {
				if (!flg) c1.emplace_back(Query3[i]); else c2.emplace_back(Query3[i]);
			} else {
				if (!flg) c2.emplace_back(Query3[i]); else c1.emplace_back(Query3[i]);
			}
		}
	}
	
	if (flg) {
		reverse(S.begin(), S.end());
		for (int i = (int)c2.size()-1; i >= 0; i--) printf("%c", c2[i]);
		printf("%s", S.c_str());
		rep(i, (int)c1.size()) printf("%c", c1[i]);
	} else {
		for (int i = (int)c1.size()-1; i >= 0; i--) printf("%c", c1[i]);
		printf("%s", S.c_str());
		rep(i, (int)c2.size()) printf("%c", c2[i]);
	}
	
	
	printf("\n");
}


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

int vector_finder(std::vector<int> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}
 
int main() {
  int N,L,sum=0;
  cin>>N>>L;
  vector<int> A;
  for(int i=0;i<N;i++){
    A.push_back(L+i);
    sum+=L+i;
  }
  if(vector_finder(A,0)==1){
    cout<<sum;
    exit(0);
  }
  if(sum<0){
    reverse(A.begin(), A.end());
  }
  cout<<sum-A.at(0);
}

Measured memory_bytes: 256