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

#define TYPE(c)   remove_reference_t<decltype(c)>
#define REP(i, n) for(TYPE(n) i = 0; i < n; i++)
#define FOR(v, c) for(TYPE(c.begin()) v = c.begin(); v != c.end(); v++)
#define ALL(c)    c.begin(), c.end()
#define SORT(c)   sort(ALL(c))
#define RSORT(c)  sort(ALL(c), greater<TYPE(c)::value_type>())
#define UNIQUE(c) c.erase(unique(ALL(c)), c.end())

using namespace std;
using ll = long long;

constexpr int MOD  = (int)1e9 + 7;
constexpr int INF  = (int)1e9 + 1;
constexpr ll  LINF = (ll)1e18 + 1;
template<typename T> constexpr bool chmax(T& a, const T& b)
{ if(a < b) { a = b; return true; } else { return false; } }
template<typename T> constexpr bool chmin(T& a, const T& b)
{ if(b < a) { a = b; return true; } else { return false; } }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T>& p)
{ return os << "(" << p.first << "," << p.second << ")"; }
ostream& operator<<(ostream &os, const string& s)
{ FOR(v, s) os << *v; return os; }
template<typename T> auto operator<<(ostream& os, const T& t)
    -> typename conditional<true, ostream&, decltype(*t.begin())>::type
{ os << "["; FOR(v, t) { if(v != t.begin()) os << ","; os << *v; } os << "]"; return os; }

int main() {
    int N;
    std::cin >> N;

    vector<string> table(N);
    auto get = [&](auto index) -> bool {
                   std::cout << index << "\n";
                   cout.flush();
                   std::cin >> table[index];
                   return (table[index] == "Vacant") ? true : false;
               };

    auto r = 0;
    auto l = N - 1;
    if(!get(r) && !get(l)) {
        while(true) {
            auto med = (r + l) / 2;
            if(get(med)) {
                break;
            }
            else if(table[r] == table[med] && abs(r - med) % 2 == 1) {
                l = med;
            }
            else if(table[r] != table[med] && abs(r - med) % 2 == 0) {
                l = med;
            }
            else {
                r = med;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 1620
#include<bits/stdc++.h>
using namespace std;
int s[105][105];
int d[4][2]= {0,1,1,0,0,-1,-1,0};
int num[100005];
int main() {
    int h,m;
    scanf("%d%d",&h,&m);
    int n;
    scanf("%d",&n);
    for(int i=1; i<=n; i++) {
        scanf("%d",&num[i]);
    }
    int x=0,y=0,i=0,j=1;
    s[x][y]=j,num[j]--;
    while(1) {
        if(j==n&&num[j]==0)
            break;
        int xx=x+d[i][0];
        int yy=y+d[i][1];
        //cout<<xx<<" "<<yy<<" "<<j<<endl;
        if(xx>=0&&xx<h&&yy>=0&&yy<m&&s[xx][yy]==0) {
            if(num[j])
                s[xx][yy]=j,num[j]--;
            else
                j++,s[xx][yy]=j,num[j]--;
            //cout<<s[xx][yy]<<endl;
            x=xx,y=yy;
        } else
            i++,i%=4;
    }
    for(int i=0; i<h; i++) {
        for(int j=0; j<m-1; j++)
            printf("%d ",s[i][j]);
            printf("%d\n",s[i][m-1]);
    }
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include<math.h>
#include<algorithm>
using namespace std;
#define LL long long
const int maxn = 1e6 + 5;
int N;
LL A[maxn], F[maxn];
LL K, sum;
bool ifnot(LL x)
{
    LL ue=0;
    for(int i=0;i<N;i++)
    {
        if(A[i]*F[i]<=x)
            continue;
        else
        {
            LL se=x/F[i];
            ue+=A[i]-se;
        }
    }
    if(ue<=K)
        return true;
    else
        return false;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> N >> K;
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
        sum += A[i];
    }
    for (int i = 0; i < N; i++)
    {
        cin >> F[i];
    }
    sort(A,A+N);
    sort(F, F + N,greater<LL>());
    if (sum <= K)
    {
        cout << 0 << "\n";
        return 0;
    }
    else
    {
        LL l=0,r=1e12,m,result=0;
        while(l<=r){
            m=(r-l)/2+l;
            if(ifnot(m))
                r=m-1,result=m;
            else
                l=m+1;
        }
        cout<<result<<"\n";
    }
    return 0;
}


Measured memory_bytes: 5888
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
#include <numeric>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
//#define MOD 998244353
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=10050;
//↑templete
#define int long long
signed main(){

	cout<<setprecision(20)<<fixed;
	ll N, K;
	cin>>N>>K;
	vector<double> A;
	for(int i=0;i<N;i++){
		ll a;
		cin>>a;
		A.pb(1.*a*(a+1)/2./a);
	}
	double now=0, maxi=0;
	queue<double> que;
	for(int i=0;i<N;i++){
		double a=A[i];
		if(que.size()==K){
			now-=que.front();
			que.pop();
		}
		que.push(a);
		now+=a;
		if(que.size()==K){
			//cout<<now<<" "<<maxi<<endl;
			maxi=max(maxi, now);
		}
	}

	cout<<maxi<<endl;

	return 0;
}

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

using namespace std;

int main(){
  string s;
  cin >> s;
  cin.ignore();
  int n = s.length();
  

  // 回文？
  bool ans = true;
  for(int i = 0; i < n / 2; i++){
    //cout << "i = " << i << " s[i] = " << s[i] << " s[n-1-i] = " << s[n-1-i] << flush;
    if(s[i] != s[n-1-i]){
      cout << "No" << endl;
      return 0;
    }
  }
  //cout << "a" << endl;

  // 条件2？
  int c; // 相手の番号
  n /= 2;
  for(int i = 0; i < n / 2; i++){
    if(s[i] != s[n-1-i]){
      cout << "No" << endl;
      return 0;
    }
  }

  //cout << "b" << endl;
  
  /*
  for (int i = (n+3)/2 - 1; i < ((n + 3) / 2 + n) - 1; i++){
    if(s[i] != s[n-1-(i- ((n+3)/2-1))]){
      cout << "No" << endl;
      return 0;
    }
  }
  */

  cout << "Yes" << endl;
  return 0;
}


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

using namespace std;

int main(){
  string s;
  int start=0;
  cin >> s;
  for(int i=0;i<s.size();i++){
    if(s[i]=='A'){
      start=i;
      break;
    }
  }
  int ans=0;
  for(int i=start;i<s.size();i++){
    if(s[i]=='Z')ans=i-start+1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N, K;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N >> K;
  int m = INF;
  rep(S, 1<<N) {
    int s = 1;
    rep(i, N) if ((1<<i) & S) s *= 2; else s += K;
    m = min(m, s);
  }
  cout << m << "\n";
  return 0;
}


Measured memory_bytes: 256
//#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
using namespace std;
// using namespace __gnu_pbds;
// template <class c, class cmp = less<c> > using ordered_set = tree<c, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;



#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL); 

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define in insert
#define ld long double


#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
template <typename T,typename U>pair<T,U> operator+(const pair<T,U> & l,const std::pair<T,U> & r) { return {l.first+r.first,l.second+r.second};}
typedef long long int ll;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ll mod =998244353;
const ll MAX_NODES =200001;
const ll MAX_LOG =50;
const ll maxn = 3000000+10;
#define endl '\n'
#define int ll
ll power(ll x, ll n) {
	ll res = 1;
	for (; n > 0; n >>= 1) {
	if (n & 1) res = (res * x) % mod;
	x = (x * x) % mod;
	}
	return res;
}
typedef int ftype;
typedef complex<ftype> point;
#define x real
#define y imag

ftype dot(point a, point b) {
    return (conj(a) * b).x();
}

ftype cross(point a, point b) {
    return (conj(a) * b).y();
}
vector<point> hull, vecs;

void add_line(ftype k, ftype b) {
    point nw = {k, b};
    point iota = {0,1};
    while(!vecs.empty() && dot(vecs.back(), nw - hull.back()) < 0) {
        hull.pop_back();
        vecs.pop_back();
    }
    if(!hull.empty()) {
        vecs.push_back(iota * (nw - hull.back()));
    }
    hull.push_back(nw);
}

int get(ftype x) {
    point query = {x, 1};
    auto it = lower_bound(vecs.begin(), vecs.end(), query, [](point a, point b) {
        return cross(a, b) > 0;
    });
    return dot(query, hull[it - vecs.begin()]);
}

int32_t main()
{   

  
    IOS 
    int n,c;
    cin>>n>>c;
    int h[n+1],dp[n+1];
    for(int i = 1;i<=n;i++)
      cin>>h[i];
    add_line(h[1],h[1]*h[1]);
    for(int i = 2;i<=n;i++)
    {
      dp[i] = get(-2*h[i]) + c +h[i]*h[i];
      add_line(h[i],h[i]*h[i] + dp[i]);
    }
    cout<<dp[n]<<endl;
     
       
    

 
}






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

#define int long long
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define reps(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end()))
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr double PI = 3.1415926535897932384626433832795028;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int N;
int A[110000];
signed main() {
    cin >> N;
    int s = 0;
    rep(i, N) {
        cin >> A[i];
        s += A[i];
    }
    int k = N * (N + 1) / 2;
    if (s % k != 0) { fin("NO"); }
    int a = s / k, b = 0;
    rep(i, N) {
        int diff = A[(i + 1) % N] - A[i];
        if (diff > a) { fin("NO"); }
        if ((a - diff) % N != 0) { fin("NO"); }
        b += (a - diff) / N;
    }
    if (a == b) { cout << "YES" << endl; }
    else { cout << "NO" << endl; }
}


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

int length(int64_t a){
  int count = 0;
  while(a!=0){
    a = a / 10;
    count ++;
  }
  return count;
}

int main(){
  //std::ifstream in("input.txt");
  //std::cin.rdbuf(in.rdbuf());
  
  int64_t N;
  cin >> N;

  int64_t rootN = (int64_t)sqrt(N);
  int min_l = 1 << 30;
  for(int64_t i=1; i<rootN+1; i++){
    if(N % i == 0){
      int l = length(N/i);
      min_l = min(l, min_l);
    }
  }
  cout << min_l << endl;

  return 0;
}

Measured memory_bytes: 256
/*Whose woods these are I think I know.
His house is in the village though;
He will not see me stopping here
To watch his woods fill up with snow.

My little horse must think it queer
To stop without a farmhouse near
Between the woods and frozen lake
The darkest evening of the year.

He gives his harness bells a shake
To ask if there is some mistake.
The only other sound’s the sweep
Of easy wind and downy flake.

The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep.*/

#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007
const int maxn= 100010;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int p=0,q=0,r=0;
    cin>>p>>q>>r;
    cout<<min({p+q,p+r,q+r})<<endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;
ll mod = 1e9+7;
//LLONG_MIN

//AC

int main(void){
	ll a,b,n,m,ans=0,cnt=0;
	mp v[100010];
	cin>>n>>m;
	rep(i,m){
		cin>>a>>b;
		v[i]=make_pair(b,a);
	}
	sort(v,v+m);
	rep(i,m){
		a = v[i].second;
		b = v[i].first;
		// printf("%lld,%lld\n",b,a);
		if(a>=cnt && cnt<b){
			cnt=b;
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<iomanip>
#include<cassert>
#include<math.h>
#include<complex>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

ll N;
int main(){
    cin>>N;
    ll ans=1000-N%1000;
    if(ans==1000){
        cout<<0;
    }else{
        cout<<ans<<endl;
    }

    return 0;
}

Measured memory_bytes: 3592
#include <stdio.h>
 
int main(void)
{
	int x,y,w;
	
	scanf("%d %d",&x,&y);
	while(x!=0 || y!=0)
	{
		if(x > y)
		{
			w = x;
			x = y;
			y = w;
		}
		printf("%d %d\n",x,y);
		
		scanf("%d %d",&x,&y);
	}
	
	return 0;
}

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

int main() {
    char s;
    int cnt = 0;
    for (int i = 0; i < 3; i++){
        cin >> s;
        if (s == '1') {
            cnt++;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a; i<b; i++)
#define dep(i,a,b) for(int i=a; i>=b; i--)
#define sq(a) (a)*(a)
#define ms(a,v)	memset(a,v,sizeof a)
using namespace std;
const long long INF = 1e18 , MAXN =1e5, MOD = 1e9 + 7;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<vector<int> > vvi;
typedef map<int, int> mii;
typedef map<string, int> msi;
typedef map<int, string> mis;
typedef map<string, string> mss;
/*
1 2 3 4 5 6 7 8 9 10 11 12 21 22 23
10*x+(x%10)-1 if (x%10!=0)
10*x+(x%10)
10*x+(x%10)+1 if (x%10!=9)
*/
int main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n,k,c;  cin>>n>>k>>c;
  string s; cin>>s;
  vector<int>v1(k,0),v2(k,0);
  int j=0;
  rep(i,0,k){
    while (s[j]=='x') j++;
    v1[i]=j;
    j+=c+1;
  }
  j=n-1;
  dep(i,k-1,0){
    while (s[j]=='x') j--;
    v2[i]=j;
    j-=c+1;
  }
  rep(i,0,k){
    if (v1[i]==v2[i]) cout<<v1[i]+1<<"\n";
  }
    return 0;
}


Measured memory_bytes: 3348
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC087BCoins solver = new ABC087BCoins();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC087BCoins {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int c = in.nextInt();
            int x = in.nextInt();
            int ans = 0;

            for (int i = 0; i <= a; i++) {
                for (int j = 0; j <= b; j++) {
                    for (int k = 0; k <= c; k++) {
                        int total = (500 * i) + (100 * j) + (50 * k);
                        if (total == x) ans++;
                    }
                }
            }
            System.out.println(String.valueOf(ans));
        }

    }
}



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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())

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

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 29;
const ll INF64 = 1ll << 45;
const int mod = 1000000007;

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  int a, b, c, d, e, f;
  cin >> a >> b >> c >> d >> e >> f;
  P ans;
  double consen = -1;
  for(int i = 0; i <= 30; ++i) {
    for(int j = 0; j <= 30; ++j) {
      if(f-(100*a*i+100*b*j) < 0) continue;
      int lim = min((a*i+b*j)*e, f-(100*a*i+100*b*j));
      for(int s = 0; s <= 60; ++s) {
        for(int t = 0; t <= 60; ++t) {
          if(c*s+d*t > lim) continue;
          double tmp = (double)(c*s+d*t)/(100*a*i+100*b*j+c*s+d*t);
          if(consen < tmp) {
            consen = tmp;
            ans.first = 100*a*i+100*b*j+c*s+d*t;
            ans.second = c*s+d*t;
          }
        }
      }
    }
  }
  cout << ans.first << " " << ans.second << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int[] a = new int[n];
		for(int i=0; i<a.length; ++i){
			a[i] = scn.nextInt();
		}
      	double sum = 0;
      	for(int i=0; i<a.length; ++i){
			sum = sum + a[i];
		}
      	double ave = sum/n;
        double dif = ave;
      	double xxx = 0;
      	int ans = 0;
      	for(int i=0; i<a.length; ++i){
			xxx = Math.abs(ave-a[i]);
          	if(dif>xxx){
              dif=xxx;
              ans = i;
            }
		}
      System.out.println(ans);
	}
}


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

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

  int ans = 0;
  for (int i = 1; i <= N; i++) {
    int t = i;
    int n = 0;
    while (t > 0) {
      n += t % 10;
      t /= 10;
    }
    if (A <= n && n <= B)
      ans += i;
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)
def input():
    return sys.stdin.readline().rstrip()

def main():
    W,H,x,y=map(int,input().split())
    S=W*H/2
    b=1 if x==W/2 and y==H/2 else 0
    print(str(S)+' '+str(b))

if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#include <stdio.h>

int  main()
{
    int i,a,b,n,j=0;
    scanf("%d %d %d",&a,&b,&n);
    for(i=a; i<=b; i++)
    {
        if(n%i==0)
        {
            j++;
        }
    }
    printf("%d\n",j);
    return 0;
}


Measured memory_bytes: 2140
#include<stdio.h>
#define MAX 100

int n;
int list[MAX+1][MAX+1];
int c[MAX+1], d[MAX+1], f[MAX+1], time;
int u, v, k;

void dfs_visit(int u){
 int i;
 c[u] = 1;
 d[u] = ++time;
 for(i=1 ; i<=n ; i++){
   if(list[u][i] == 0){continue;}
   if(c[i] == 0){dfs_visit(i);}
 }
 c[u] = 2;
 f[u] = ++time;
}

void dfs(){
  int i;
  for(i=1 ; i<=n ; i++){
    c[i] = 0;
  }
  time = 0;

  for(i=1 ; i<=n ; i++){
    if(c[i] == 0){dfs_visit(i);}
  }
  for(i=1 ; i<=n ; i++){
    printf("%d %d %d\n", i, d[i], f[i]);
  }
}

int main(){
  int i, j;

  scanf("%d", &n);
  for(i=1 ; i<=n ; i++){
    for(j=1 ; j<=n ;j++){
      list[i][j] = 0;
    }
  }

  for(i=1 ; i<=n ; i++){
    scanf("%d %d", &u, &k);
    for(j=1 ; j<=k ; j++){
      scanf("%d", &v);
      list[u][v] = 1;
    }
  }
  dfs();

  return 0;
}



Measured memory_bytes: 2060
N, W = (int(i) for i in input().split())
bagage = [[int(i) for i in input().split()] for _ in range(N)]
weight = []
value = []
for b in bagage:
    value.append(b[0])
    weight.append(b[1])

dp = [[0]*10010 for i in range(110)]

for j in range(W):
    dp[N][j] = 0

for i in range(N-1, -1, -1):
    for j in range(0, W+1, 1):
        if j < weight[i]:
            dp[i][j] = dp[i+1][j]
        else:
            dp[i][j] = max(dp[i+1][j], dp[i+1][j-weight[i]] + value[i])

print(dp[0][W])


Measured memory_bytes: 25556
from collections import deque
S = deque(input())
Q = int(input())

p = 0

for i in range(Q):
    query = input().split()
    if query[0]=='1':
        p ^= 1
    else:
        f = int(query[1])-1
        c = query[2]
        if p:
            f ^= 1
        if f:
            S.append(c)
        else:
            S.appendleft(c)

if p:
    print(*reversed(S), sep='')
else:
    print(*S, sep='')

Measured memory_bytes: 12272
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
using ll = long long;
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using pll = pair<long long,long long>;
#define cY cout<<"Yes"<<endl
#define cN cout<<"No"<<endl
const long long INF = 1LL << 60;
const long long MOD = 1000000007;

//最大最小の入れ替え
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
//以上テンプレ
int main(){
    ll MIN=INF;
    ll MAX=-1*INF;
    ll N;
    cin>>N;
    rep(i,N){
        ll a;
        cin>>a;
        chmax(MAX,a);
        chmin(MIN,a);
    }
    cout<<MAX-MIN<<endl;
    }


Measured memory_bytes: 256
"""
author : halo2halo
date : 9, Jan, 2020
"""

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

import numpy as np

DISH = list(map(int, read().split()))

temp = 10
im = 0
for num, i in enumerate(DISH):
    if i % 10 < temp and i % 10 != 0:
        temp = i % 10
        im = num

ans = 0
for num, i in enumerate(DISH):
    if num != im:
        ans += ((i + 9) // 10) * 10
    else:
        ans += i
print(ans)


Measured memory_bytes: 12408
//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define trav(x,A) for(auto &x:A)
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef vector<int> veci;
typedef vector<long long> vecl;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);

//Required Functions

ll power(ll x,ll y) 
{ 
	if (y == 0) 
		return 1; 
	ll p = power(x, y/2) % MOD; 
	p = (p * p) % MOD; 
  
	return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

int main()
{
	#ifndef ONLINE_JUDGE
	if (fopen("INPUT.txt", "r"))
	{
		freopen ("INPUT.txt" , "r" , stdin);
		//freopen ("OUTPUT.txt" , "w" , stdout);
	}
	#endif
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	clock_t clk;
	clk = clock();
//-----------------------------------------------------------------------------------------------------------//

	READV(N);
	READV(X);
	READV(Y);
	ll ans[N]={0};
	FORI(i,1,N+1)
	{
		FORI(j,i+1,N+1)
		{
			if(j<=X)
			{
				ans[j-i]++;
			}
			else if(i>=Y)
			{
				ans[j-i]++;
			}
			else if(i<=X && j>=Y)
			{
				ans[(X-i)+(j-Y)+1]++;
			}
			else if(i<=X && j>X && j<Y)
			{
				ans[(X-i)+min(j-X,(Y-X+1)-(j-X))]++;
			}
			else if(i>X && i<Y && j>=Y)
			{
				ans[(j-Y)+min(Y-i,(Y-X+1)-(Y-i))]++;
			}
			else
			{
				ans[min(j-i,(Y-X+1)-(j-i))]++;
			}
			
			
		}
	}
	FORI(i,1,N)
	{
		cout<<ans[i]<<endl;
	}

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


	clk = clock() - clk;
	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << endl;

	return 0;
}

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


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

	if (a == b) {
		c = 0;
	}
	else {
		if (a < b) {
			c = b - (a + W);
		}
		else {
			c = a - (b + W);
		}

	}

	if (c < 0) c = 0;


	cout << c << endl;
	return 0;

}

Measured memory_bytes: 256
N,K=map(int,input().split())
ans=0
for b in range(K,N+1):
    if b==0:
        continue
    ans += (b-K)*int(N//b)
    if N%b>=K and K>0:
        ans+=N%b-K+1
    elif N%b>=K:
        ans+=N%b - K
print(ans)



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

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int h,w; cin>>h>>w;
	rep(i,h){
		string s; cin>>s;
		cout<<s<<endl<<s<<endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
 
int main ()
{
    int i,j,a,ara[10];
    for (i=0;i<10;i++)
    {
        scanf ("%d",&ara[i]);
    }
    for(i=0;i<10;i++)
    {
        for (j=i+1;j<10;j++)
        {
            if (ara[i] < ara[j])
            {
                a=ara[i];
                ara[i] = ara[j];
                ara[j] = a;
            }
        }
    }
 
    for (i=0;i<3;i++)
    {
        printf ("%d\n",ara[i]);
    }
    return 0;
}
 

Measured memory_bytes: 600
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def main():
  N, Y = map(int, input().split())
  for i in range(0, N+1):
    for j in range(0, N+1):
      k = N - i - j
      if k < 0:
        continue
      if Y == 10000 * i + 5000 * j + 1000 * k:
        print(i, j, k)
        return
  print("-1 -1 -1")


if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
bool isprime(ll a){
  if(a==2)return 1;
  if(!(a&1))return 0;
  for(ll i=3;i*i<=a;i+=2)
    if(a%i==0)return 0;
  return 1;
}
ll mpow(ll base,ll exponent,ll modulus){
  if(modulus==1)return 0;
  long long result = 1;
  base=base%modulus;
  while(exponent){
    if(exponent%2 == 1)
	  result=(result*base)%modulus;
	  exponent=exponent>>1;
	  base=(base*base)%modulus;
  }
  return result;
}
ll minv(ll a,ll mod){
  ll _gcd=gcd(a,mod);
  assert(_gcd==1);
  return mpow(a,mod-2,mod);
}
 
 
/*
ll ncr(ll N,ll K){
	if(N<K)return 0;
	if(K==0)return 1;
	if(N==0)return 0;
 
	ll den=1;
	for(ll i=1;i<=K;i++)den*=i;
	ll num=1;
	while(K--){
		num*=N;
		if(num%den==0){
			num/=den;
			den=1;
		}
		N--;
	}
 
	return num;
}
*/
ll a,b;
int main(){FAST;
cin>>a>>b;
if(a>b)swap(a,b);
ll t = (a+b)>>1;
if(t-a == b-t){
	cout<<t;
}
else cout<<"IMPOSSIBLE";
return 0;
}

Measured memory_bytes: 256
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで
#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};
int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
 
    ll a,b,c,d,m,n,maxi=0,f=0,mini=INF,sum=0;
    string str;
    ll k;
    ll w,x;
    cin>>n;
    n++;
    rep(i,n){
        a=0;
        x=i;
        while(x>0){
            a++;
            x/=10;
        }
        if(a%2) sum++;
    }
    cout<<sum<<endl;

    return 0;
}


Measured memory_bytes: 3572
#include<stdio.h>

int main( ){

  long long n,x,y,min,max,sum;
  sum=0;
  min=1000000;
  max=-1000000;
  scanf("%lld",&n);
    for(x=0;x<n;x++){scanf("%lld",&y);
      sum=sum+y;
      if(min>y){min=y;}
      if(max<y){max=y;}
}
    printf("%lld %lld %lld\n",min,max,sum);
return 0;
}

Measured memory_bytes: 600
#include <iostream>
using namespace std;
int data[2097155][2];
void update(int n){
	if(data[n*2][1]<data[n*2+1][1]){
		data[n][0]=data[n*2+1][0];
		data[n][1]=data[n*2+1][1];
	}else{
		data[n][0]=data[n*2][0];
		data[n][1]=data[n*2][1];
	}
	if(n!=1)update(n/2);
}
int main(){
	int n,q,a,v;
	cin>>n>>q;
	for(int i=1;i<=n;i++)data[i+1048575][0]=i;
	for(int i=0;i<q;i++){
		cin>>a>>v;
		data[1048575+a][1]+=v;
		update((1048575+a)/2);
		cout<<data[1][0]<<" "<<data[1][1]<<endl;
	}
	return 0;
}


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

typedef long long ll;

const ll INTEG = pow(10,9) + 7;

int main(){
  int n;
  cin >> n;
  vector<int> p(n);
  for(int &i:p){
    cin >> i;
  }

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

  cout << p[n/2] - p[n/2-1] << endl;
}

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

using namespace std;

#define all(a) a.begin(), a.end()
#define pi acos(-1)
#define eps 1e-6
#define inf 1e14

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<vi> vvi;

const int dx[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
const int dy[8] = {-1, 0, 1, -1, 1, 0, 1, -1};
const int maxn = 301;
const int mod = 1e9 + 7;
const int maxa = 2 * 1e5;

int maxs(int &a, int b) { return a = max(a, b);}
int mins(int &a, int b) { return a = min(a, b);}
int mul(int a, int b) { return a * 1LL * b % mod;}
int add(int a, int b) { return a + b >= mod ? a + b - mod : a + b;}
int sub(int a, int b) { return a >= b ? a - b : a - b + mod;}
int pow(int a, int k)
{
    int res = 1;
    while (k)
    {
        if (k % 2) res = mul(res, a);
        a = mul(a, a);
        k /= 2;
    }

    return res;
}

int inv(int a)
{
    return pow(a, mod - 2);
}

int n, cnt[3];
double p, dp[maxn][maxn][maxn], E[maxn][maxn][maxn];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    for (int i = 0, x; i < n &&  cin >> x; ++i)
        cnt[x - 1]++;

    dp[cnt[0]][cnt[1]][cnt[2]] = 1;
    for (int i = n; i >= 0; --i)
    {
        for (int j = n; j >= 0; --j)
        {
            for (int k = n; k >= 0; --k)
            {
                int m = i + j + k;
                if (m == 0 || m > n) continue;
                double e = (n - m) * 1.0 / n;
                e = e / (1 - e);
                E[k][j][i] += e * dp[k][j][i];
                if (k)
                {
                    dp[k - 1][j][i] += dp[k][j][i] * k * 1.0 / m;
                    E[k - 1][j][i] += E[k][j][i] * k * 1.0 / m;
                }
                
                if (j)
                {
                    dp[k + 1][j - 1][i] += dp[k][j][i] * j * 1.0 / m;
                    E[k + 1][j - 1][i] += E[k][j][i] * j * 1.0 / m;
                }

                if (i)
                {
                    dp[k][j + 1][i - 1] += dp[k][j][i] * i * 1.0 / m;
                    E[k][j + 1][i - 1] += E[k][j][i] * i * 1.0 / m;
                }
            }
        }
    }

    cout << fixed << setprecision(14) << E[0][0][0] + cnt[0] + 2 * cnt[1] + 3 * cnt[2] << '\n';
}


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

using namespace std;

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

	int l, r, d, cnt=0;
	cin >> l >> r >> d;
	for(int i=l; i<=r; i++)
        if(i%d==0)
            cnt++;
    cout << cnt << endl;

	return 0;
}


Measured memory_bytes: 3644
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(deprecated)]

use std::cell::{Cell, Ref, RefCell, RefMut};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;
use std::usize;

const MOD_10_9_7: u64 = 1_000_000_007;
const INF: i64 = 1_000_000_000_000;
const MIN_INF: i64 = -1_000_000_000_000;

/// FYI: https://github.com/vain0x/scan-bench
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    let (n, m) = read!(usize, usize);
    let mut x: Vec<i32> = read![[i32]];

    x.sort();

    // 最初に置くのはxのいずれかの座標である
    // どの座標に置けばいちばん効率が良いかを考える
    // いったりきたり（ex. 12 -> 10 -> 14）するのは非効率なので、移動は一方向に行う

    // diff[i] := x[i+1] - x[i]
    let mut diff = vec![0; m - 1];
    for i in 0..(m - 1) {
        diff[i] = x[i + 1] - x[i];
    }

    diff.sort();
    diff.reverse();

    let ans = x[m - 1] - x[0] - diff.into_iter().take(n - 1).sum::<i32>();
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<iostream>
#include<cmath>
#include<cmath>

using namespace std;

int main()
{
    int N;
    cin >> N ;
    int i;
    for( i=0;i<N;i++)
    {
        if(pow(2,i)>N) break;
    }
    cout << pow(2,i-1) ;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
	 	Scanner scanner = new Scanner(System.in);
	 	int N = scanner.nextInt();
	 	int a = 0;
	 	int b = 0;
	 	int c = 0;
	 	int d = 0;

	 	a = N / 100;
	 	d = N % 100;
	 	b = d / 10;
	 	c = d % 10;
//	 	System.out.println(a);
//	 	System.out.println(b);
//	 	System.out.println(c);

	 	if (a == 7 || b == 7 || c == 7) {
	 		System.out.println("Yes");
	 	} else {
	 		System.out.println("No");
	 	}
 	}
}


Measured memory_bytes: 35772
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <stdio.h>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional> //operator[]
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define Rep(i,n) for(int i=1;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define Rrep(i,n) for(int i=n-1;i>0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
#define P pair<int,int>
#define Pll pair<ll,ll>
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main(){
    string s[3];
    rep(i,3) cin >> s[i];
    rep(i,3) cout << s[i][i];
}


Measured memory_bytes: 256
D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for i in range(D)]
t = [int(input()) for i in range(D)]
cnt = [0]*26
ans = 0
for i in range(D):
  ans += s[i][t[i]-1]
  cnt[t[i]-1] = i+1
  for j in range(26):
     ans -= c[j] * (i+1-cnt[j])
  print(ans)

Measured memory_bytes: 9400
def main():
    import sys
    input = sys.stdin.buffer.readline
    N, M = (int(i) for i in input().split())
    AB = [[int(i) for i in input().split()] for j in range(N)]
    CD = [[int(i) for i in input().split()] for j in range(M)]
    for a, b in AB:
        ansD = 10**9
        ans = 0
        for j, cd in enumerate(CD):
            curD = abs(a - cd[0]) + abs(b - cd[1])
            if curD < ansD:
                ansD = curD
                ans = j+1
        print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 39408
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;
using ll = long long;

int main(void)
{
    int N;
    cin >> N;

    ll ans = 0;

    for (int i = 1; i <= N; i++)
    {
        if ((i % 3 != 0) && (i % 5 != 0))
        {
            ans += i;
        }
    }

    cout << ans << endl;

    return 0;
}


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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    ll n;
    cin >> n;
    vector<pair<ll, int>> fact;
    for (ll i=2; i*i<=n; ++i) {
        int cnt = 0;
        while (n%i==0) {
            n /= i;
            ++cnt;
        }
        if (cnt > 0) fact.emplace_back(i, cnt);
    }
    if (n > 1) fact.emplace_back(n, 1);
    int ans = 0;
    for (auto p : fact) {
        int x = 1;
        while (x <= p.second) {
            p.second -= x;
            ++x;
            ++ans;
        }
    }
    cout << ans << endl;
    return 0;
}


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

#include <fstream>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(20) << fixed;
  /*
  ifstream in("input.txt");
  cin.rdbuf(in.rdbuf());
  //*/
  string S, T;
  cin >> S >> T;
  for(int i = 0; i < S.size(); i++){
    if(S == T){
      cout << "Yes" <<endl;
      return 0;
    } else{
      char s = S[S.size()-1];
      S.insert(S.begin(), s);
      S.erase(S.size()-1);
    }
  }
  cout << "No" <<endl;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int64_t W, H, x, y;
  cin >> W >> H >> x >> y;
  int64_t S;
  S = W * H;
  string p;
  if (S % 2 == 0){
    p = "";
  } else {
    p = ".5";
  }
  cout << S / 2 << p << " ";
  if (W / 2.0 == x && H / 2.0 == y){
    cout << "1" << endl;
  } else {
    cout << "0" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define FOR(a, c) for (int(a) = 0; (a) < (c); (a)++)
#define FORL(a, b, c) for (int(a) = (b); (a) <= (c); (a)++)
#define FORR(a, b, c) for (int(a) = (b); (a) >= (c); (a)--)
#define INF 1000000000000000003
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define F first
#define S second
#define pb push_back 
#define pob pop_back
#define mp make_pair
#define N 10000000

int vis[N];

int main(){

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int k; cin>>k;
    ll c =0;
    FORL(i,1,1e9){
    	c = (c*10+7)%k;
    	if(c==0){
    		cout<<i; 
    	    break;
    	}
    	if(vis[c]){
    		cout<<"-1";
    		break;
    	}
    	vis[c]=1;		
    }

    return 0;
}

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

int N;
int main(){
	cin >> N;
	vector<int> v(N);
	for(int i=0;i<N;i++){
		cin >> v[i];
	}
	sort(v.begin(),v.end());
	reverse(v.begin(),v.end());
	int	al = 0,bob = 0;
	for(int i=0;i<N;i++){
		if(i%2==0) al += v[i];
		else bob += v[i];
	}
	cout << al-bob << endl;
}

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

using namespace std;

int read()
{
    char x;
    while((x = getchar()) > '9' || x < '0') ;
    int u = x - '0';
    while((x = getchar()) <= '9' && x >= '0') u = (u << 3) + (u << 1) + x - '0';
    return u;
}
int buf[105];  
inline void write(int i) {  
    int p = 0;  
    if(i == 0) p++;  
    else while(i) {  
        buf[p++] = i % 10;  
        i /= 10;  
    }  
    for(int j = p-1; j >= 0; j--) putchar('0' + buf[j]);  
} 

#define il inline
#define re register

int block,ans=0,cnt[1000001];
int n,m,a[500010],Ans[500010];

struct node {
    int l,r,id;
}q[500010];

il bool cmp(node a,node b){
    return (a.l/block)^(b.l/block)?a.l<b.l:(((a.l/block)&1)?a.r<b.r:a.r>b.r);
}

il void add(int x){
    if(!cnt[a[x]])ans++;
    cnt[a[x]]++;
}

il void del(int x){
    cnt[a[x]]--;
    if(!cnt[a[x]])ans--;
}
int i;

int main(){
    n=read();m=read();
    for(i=1;i<=n;++i)a[i]=read();
    block=n/sqrt(m*2/3);
    for(i=1;i<=m;++i){
        q[i].l=read();
        q[i].r=read();
        q[i].id=i;
    }
    sort(q+1,q+m+1,cmp);
    int l=0,r=0;
    for(i=1;i<=m;++i){
        int ql=q[i].l,qr=q[i].r;
        while(l<ql)del(l++);
        while(l>ql)add(--l);
        while(r<qr)add(++r);
        while(r>qr)del(r--);
        Ans[q[i].id]=ans;
    }
    for(i=1;i<=m;++i)write(Ans[i]),printf("\n");
    return 0;
}

Measured memory_bytes: 15444
#include "bits/stdc++.h"
using namespace std;


int main() {
	int X;
	cin >> X;
	vector<int>Set;
	Set.push_back(1);
	for (int i = 2;i*i<=X;++i) {
		int tmp = i;
		while (tmp *i <=X) {
			tmp *= i;
			Set.push_back(tmp);
		}
	}
	sort(Set.rbegin(),Set.rend());
	cout << Set[0] << endl;
}


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

using namespace std;


 
int ctoi(const char c){
  switch(c){
    case '0': return 0;
    case '1': return 1;
    case '2': return 2;
    case '3': return 3;
    case '4': return 4;
    case '5': return 5;
    case '6': return 6;
    case '7': return 7;
    case '8': return 8;
    case '9': return 9;
    default : return -1;
  }
}

//5
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){

ios::sync_with_stdio(false);
cin.tie(0);
int k,a,b;
cin>>k;
cin>>a>>b;

int f=0;
for(int i=a;i<=b;i++){
if(i%k==0)f=1;
}
if(f==1)
cout<<"OK"<<endl;
else
cout<<"NG"<<endl;

}



//cout << fixed << setprecision(5) <<(n*2)*M_PI << endl;


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
long long i,j,n,m,p,k,l,Max,ans,t,ans2,B,r,b,d,ind,x,y,dp[200001],a[200001];
int main () {
    cin>>n;
    for (i=1;i<=n;i++) {
        cin>>a[i];
        dp[i]=1000000000000;
    }
    dp[1]=0;
    dp[2]=abs(a[1]-a[2]);
    for (i=3;i<=n;i++) {
        dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
    }
    cout<<dp[n]<<endl;
    return 0;
}

Measured memory_bytes: 1792