akhauriyash/Code-Regression huggingface dataset:
#include <cstring>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <numeric>
#include <stack>

using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);
typedef unordered_map<ll, ll> ump;
typedef pair<ll, ll> P;

ump mp;

int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
        mp = ump();
#pragma clang diagnostic pop
#endif
        string s;
        int w;
        cin >> s >> w;
        for (int i = 0; i < s.size(); i += w) {
            cout << s[i];
        }

#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 256
// #include C/C++ {
#include <bits/stdc++.h>
// }
using namespace std;
// #typedef {
typedef long long int64;
typedef pair <int, int> PII;
typedef pair <int64, int64> PLL;
// }

// #parameter{
#ifdef _DEBUG

#define TYPE decltype
#define RF(filename) {freopen((filename), "r", stdin);}
#define WF(filename) {freopen((filename), "w", stdout);}
#define DF(filename) {freopen((filename), "w", stderr);}
#define eprintf printf

#else

#define TYPE __typeof
#define RF(filename) {;}
#define WF(filename) {;}
#define DF(filename) {;}
#define eprintf(...)
#define fprintf(...)

#endif

// #define {
#define SZ(a) ((int)(a).size())
#define X first
#define Y second
#define MP make_pair
#define L(x) ((x)<<1)
#define R(x) ((x)<<1 | 1)
#define max3(x, y, z) (max(max((x), (y)), (z)))
#define min3(x, y, z) (min(min((x), (y)), (z)))
#define BIT(x, i) (((x) >> (i)) & 1)
#define ALL(it) (it).begin(), (it).end()
#define FILL(__space, __val) memset(__space, __val, sizeof(__space))
#define MOVE(__spaceTo, __spaceFrom) memmove(__spaceTo, __spaceFrom, sizeof(__spaceTo))
#define UNIQUE(__vector) sort(ALL(__vector)), __vector.resize(unique(ALL(__vector)) - __vector.begin())
#define FOR(it, c) for( TYPE((c).begin()) it = (c).begin(); it != (c).end(); it++)
/////////////////////////////////////////////////////////////
const double PI = acos(-1.0);
const double EPS = 1e-6;

#define MAX_N 100005
#define MAX_M 55
#define MOD (int)(1e9+7)
#define INF ((1 << 30) - 1)
#define BINF ((1LL << 62) - 1LL)
#define NONE -1
#define NIL 0
// }

/////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////
int main() {
	RF("input.txt");
	//  WF("output.txt");
	DF("err.txt");

	int N, M;
	scanf("%d %d", &N, &M);
	int dp[MAX_N] = { 0 };
	for (int k = 0; k < M; k++) {
		int L, R;
		scanf("%d %d", &L, &R);
		dp[L]++;
		dp[R + 1]--;
	}
	for (int i = 0; i < N; i++) dp[i + 1] += dp[i];
	int res = 0;
	for (int i = 1; i <= N; i++) if (dp[i] == M) res++;
	printf("%d\n", res);
	return 0;
}

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

int main(){
	int n;
	scanf("%d", &n);
	char str[n];
	scanf("%s", str);
	
	int count=1;
	for(int i=1; i<n; i++){
		if(str[i] != str[i-1]){
			count++;
		}
	}
	printf("%d\n", count);
	
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const ll MAX=1000000;
ll fac[MAX],finv[MAX],inv[MAX];
void COMinit(){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for(int i=2;i<MAX;i++){
    fac[i]=fac[i-1]*i%MOD;
    inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
    finv[i]=finv[i-1]*inv[i]%MOD;
  }
}
ll COM(ll n, ll k){
  if(n<0||k<0)return 0;
  if(n<k)return 0;
  return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
int main(){
ll X,Y;
cin>>X>>Y;
if((X+Y)%3!=0){
  cout<<0<<endl;
  return 0;
}
ll m=(2*X-Y)/3;
ll n=(2*Y-X)/3;
COMinit();
ll ans=COM(n+m,n)%MOD;
while(ans<0){
  ans+=MOD;
}
cout<<ans%MOD<<endl;

}

Measured memory_bytes: 23680
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

const char ch[] = {'T', 'F'};

// 入力
string s;

int eval(const string &s, int &pos) {
	if (s[pos] == 'F') {
		pos++;
		return 0;
	}
	if (s[pos] == 'T') {
		pos++;
		return 1;
	}
	if (s[pos] == '-') {
		pos++;
		int v = eval(s, pos);
		return 1 - v;
	}
	if (s[pos] == '(') {
		pos++;
		int v1 = eval(s, pos);
		if (s[pos] == '*') {
			pos++;
			int v2 = eval(s, pos);
			pos++;
			int v = min(v1, v2);
			return v;
		}
		if (s[pos] == '+') {
			pos++;
			int v2 = eval(s, pos);
			pos++;
			int v = max(v1, v2);
			return v;
		}
		if (s[pos] == '-') {
			// "->"の場合
			pos += 2; // 演算子が2文字なので，その分だけずらす
			int v2 = eval(s, pos);
			pos++;
			int v = (v1 == 1 && v2 == 0) ? 0 : 1;
			return v;
		}
	}
}

void solve() {
	for (int a = 0; a < 2; a++) {
		for (int b = 0; b < 2; b++) {
			for (int c = 0; c < 2; c++) {
				for (int d = 0; d < 2; d++) {
					for (int e = 0; e < 2; e++) {
						for (int f = 0; f < 2; f++) {
							for (int g = 0; g < 2; g++) {
								for (int h = 0; h < 2; h++) {
									for (int i = 0; i < 2; i++) {
										for (int j = 0; j < 2; j++) {
											for (int k = 0; k < 2; k++) {
												string tmp = s;
												for (int l = 0; l < (int)tmp.length(); l++) {
													if (tmp[l] == 'a') {
														tmp[l] = ch[a];
													} else if (tmp[l] == 'b') {
														tmp[l] = ch[b];
													} else if (tmp[l] == 'c') {
														tmp[l] = ch[c];
													} else if (tmp[l] == 'd') {
														tmp[l] = ch[d];
													} else if (tmp[l] == 'e') {
														tmp[l] = ch[e];
													} else if (tmp[l] == 'f') {
														tmp[l] = ch[f];
													} else if (tmp[l] == 'g') {
														tmp[l] = ch[g];
													} else if (tmp[l] == 'h') {
														tmp[l] = ch[h];
													} else if (tmp[l] == 'i') {
														tmp[l] = ch[i];
													} else if (tmp[l] == 'j') {
														tmp[l] = ch[j];
													} else if (tmp[l] == 'k') {
														tmp[l] = ch[k];
													}
												}
												
												int pos = 0;
												int f1 = eval(tmp, pos);
												pos++;
												int f2 = eval(tmp, pos);
												if (f1 != f2) {
													cout << "NO" << endl;
													return;
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
	cout << "YES" << endl;
}

int main() {
	while (true) {
		getline(cin, s);
		if (s[0] == '#') {
			break;
		}
		solve();
	}
}

Measured memory_bytes: 1180
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)n; ++i)
#define RREP(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define FOR(i, s, n) for (int i = s; i < (int)n; ++i)
#define RFOR(i, s, n) for (int i = (int)n - 1; i >= s; --i)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
template<class T>inline void out(T t){cout << t << "\n";}
template<class T,class... Ts>inline void out(T t,Ts... ts){cout << t << " ";out(ts...);}
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;}
constexpr int INF = 1e18;

signed main(){
	int X;
	cin >> X;
	int now = 100;
	int year = 0;
	while(now < X){
		now += now / 100;
		year++;
	}
	out(year);
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL);
#define INFI 1000000000000000000

ll power(ll x , ll y) {
    ll res = 1;
    while(y) {
        if(y & 1) {
            res *= x;
        }
        x *= x;
        y >>= 1ll;
    }
    return res;
}

int main() {
    string str;
    cin >> str;
    if(str == "RRR") {
        cout << 3 << endl;
    }
    else if((str[0] == 'R' && str[1] == 'R') || (str[1] == 'R' && str[2] == 'R')) {
        cout << 2 << endl;
    }
    else if(str[0] == 'R' || str[1] == 'R' || str[2] == 'R') {
        cout << 1 << endl;
    }
    else{
        cout << 0 << endl;
    }
    return 0;
}


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

void good_solving(vector<int> &p, vector<int> &c, vector<bool> &full, int D, int G, int solve, int &min_solve, long sum, int depth) {
  if (depth == D) {
    int max_num = -1;
    for (int i=D-1; i>=0; i--) {
      if (full.at(i) == false) {
        max_num = i;
        break;
      }
    }
    if (max_num == -1) {
      if (sum >= G) {
        if (min_solve == 0) min_solve = solve;
        else if (min_solve > solve) min_solve = solve;
      }
      return;
    }
    for (int i=0; i<p.at(max_num); i++) {
      if (i != 0) {
        sum += 100*(max_num+1);
        solve++;
      }
      if (sum >= G) {
        if (min_solve == 0) min_solve = solve;
        else if (min_solve > solve) min_solve = solve;
      }
    }
    return;
  }
  full.at(depth) = true;
  good_solving(p, c, full, D, G, solve + p.at(depth), min_solve, sum + p.at(depth)*100*(depth+1) + c.at(depth), depth+1);
  full.at(depth) = false;
  good_solving(p, c, full, D, G, solve, min_solve, sum, depth+1);
}

int main(){
  int D, G;
  cin >> D >> G;
  vector<int> p(D);
  vector<int> c(D);
  for (int i=0; i<D; i++)
    cin >> p.at(i) >> c.at(i);
  vector<bool> full(D, false);
  int solve = 0, min_solve = 0;
  long sum = 0;
  int depth = 0;
  good_solving(p, c, full, D, G, solve, min_solve, sum, depth);
  cout << min_solve << endl;
}

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

typedef int i32;
typedef long long i64;
typedef unsigned int u32;
typedef unsigned long long u64;

#define loop(i,n) for(i64 i = 0; i < (n); ++i)
#define pi  pair<int,int>
#define ti  tuple<int,int,int>
#define mt  make_tuple
#define mk  make_pair
#define vi  vector<int>
#define vll vector<i64>
#define fastInOut ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pr(a) for(auto x:a) cout<<x<<" ";
#define prmap(m) for(auto x:m) cout<<x.first<<" "<<x.second<<"\n";

i64 h,w,n;
int main() 
{ 
    fastInOut
    cin>>h>>w;
    if(h==w)
       cout<<"Yes";
    else 
       cout<<"No";
   return 0; 
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define INF INT_MAX;
typedef long long ll;
using namespace std;

int main(){
  string w;
  vector<int> e('z'-'a'+1,0);
  cin >> w;
  rep(i,w.size()){
    e.at(w.at(i)-'a')++;
  }

  rep(i,e.size()){
    if(e.at(i)%2!=0){
      puts("No");
      return 0;
    }
  }
  puts("Yes");

}

Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(){
	int N;
	while(cin>>N,N!=0){
		long long sum=1;
		int i;
		for(i=2;i*i<N;i++)
			if(N%i==0){
				sum+=i;
				sum+=N/i;
			}
		if(i*i==N)sum+=i;
		if(N==1)sum-=1;
		if(N>sum)
			cout<<"deficient number"<<endl;
		else if(N<sum)
			cout<<"abundant number"<<endl;
		else
			cout<<"perfect number"<<endl;
	}
	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <stack> 
#include <map>
#include <queue>
#include <unordered_map>
#include <cassert>
#include <iomanip>
#include <cmath>
#include <cstring>
using namespace std;

#define pb 					push_back

template<typename T,typename S>
ostream& operator <<(ostream& os, pair<T, S> input) {
	os<<"("<<input.first<<", "<<input.second<<")";
	return os;
}

template<typename T>
ostream& operator <<(ostream& os, vector<T> input) {
	for(auto t: input)
		os << t <<" ";

	return os;
}


double dist(pair<int,int> a ,pair<int,int> b) {
	int dx = a.first - b.first;
	int dy = a.second - b.second;
	return sqrt(dx*dx + dy*dy);
}
int main() {
    //ios_base::sync_with_stdio(false);
	//cin.tie(0);
	//cout.tie(0);
	int n;
	cin >> n;
	vector<pair<int,int>  >v;
	for(int i =1;i<=n;i++){
		int x, y;
		cin >> x >> y;
		v.push_back({x, y});
	}
	double sum = 0;
	for(auto p1: v) {
		for(auto p2: v) {
			sum+=dist(p1, p2);
		}
	}

	cout <<setprecision(15)<< sum/n<<"\n";

	return 0;
}



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

int n, l;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> l;
    
    if( l < 0 && l + n - 1 <= 0 ){
        long long sum = 0;
        for(int i = 1; i < n; i++)
            sum += l + i - 1;
        cout << sum << "\n";
        return 0;
    }
    if( l >= 0 && l + n - 1 > 0 ){
        long long sum = 0;
        for(int i = 2; i <= n; i++)
            sum += l + i - 1;
        cout << sum << "\n";
        return 0;
    }
    
    long long sum = 0;
    for(int i = 1; i <= n; i++)
        sum += l + i - 1;
    cout << sum << "\n";
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
from collections.abc import Iterable
from math import *
from itertools import *
from collections import *
from functools import *
from operator import *
try:
    from math import gcd
except Exception:
    from fractions import gcd


def solve(N: int, X: int, m: "List[int]"):
    return ((X - sum(m)) // min(m)) + len(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
    X = int(next(tokens))  # type: int
    m = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    result = solve(N, X, m)
    if isinstance(result, Iterable):
        result = '\n'.join([str(v) for v in result])
    print(result)

if __name__ == '__main__':
    main()


Measured memory_bytes: 5508
#include <algorithm>
#include <iostream>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;

int main()
{
    int X, A;
    cin >> X >> A;
    if (X < A)
    {
        cout << 0 << endl;
    }
    else
    {
        cout << 10 << endl;
    }
}


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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  ll a,b,c;
  cin>>a>>b>>c;
  
  if(a==b && b==c)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    char input[10];
    int i;
    int count = 0;
    scanf("%s", input);
    for (i = 0; i < 6; i++){
        if (input[i] == 49){
            count++;
        }
    }
    printf("%d\n", count);




    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<string>
#include<sstream>
#include<iomanip>
#include<utility>
#include<cmath>
#include<set>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<map>
#include<set>
#include<cstring>
#include<iterator>
#include<bitset>
#include<assert.h>
//#include<chrono>
//#include<time.h>
//#include<windows.h>
using namespace std;
 
//#define int ll
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef vector<int> VI;
typedef vector<long long int> VL;
//static const int MOD = 1000000007;
//static const int INF = 2147483647;
//static const long long INF = 9223372000000000000;
//static const long long INF = 9223372000000000000/2;
//static const int INF = 1000010000;
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define FI first
#define SE second
#define NP next_permutation
#define PQ priority_queue
#define UB upper_bound
#define LB lower_bound
#define SZ(a) int((a).size())
#define LEN(a) int((a).length())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REP1(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREP1(i,x) for(int i=((int)(x));i>0;i--)
#define ALL(x) (x).begin(),(x).end()
struct edge {int /*from,*/to,cost;};

main(){
    int x,a,b;
    cin >> x >> a >> b;
    x -= a;
    x -= (x/b)*b;

    printf("%d\n",x);

    return 0;
}


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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1)
    printEoln();
  if (suc == 2)
    printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U> void chmax(T &a, U b) {
  if (a < b)
    a = b;
}

template <class T, class U> void chmin(T &a, U b) {
  if (b < a)
    a = b;
}

template <class T> T Sq(const T &t) { return t * t; }

const int mod = 1e9 + 7;

int cnt[26];

signed main() {
  string S = readString();
  for (auto &c : S) {
    cnt[c - 'a']++;
  }
  REP(i, 26) {
    if (cnt[i] == 0) {
      std::cout << (char)(i + 'a') << std::endl;
      return 0;
    }
  }
  std::cout << "None" << std::endl;
}


Measured memory_bytes: 2432
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <time.h>

using namespace std;
int main(){
  clock_t start = clock();
  int d;
  cin >> d;
  vector<int> c(26),tmp(26);
  vector<vector<int>> s;
  for(int i=0;i<26;i++){
    cin >> c[i];
  }
  for(int i=0;i<d;i++){
    for(int j=0;j<26;j++){
      cin >> tmp[j];
    }
    s.push_back(tmp);
  }
  vector<int> t(d,1);
  
  vector<int> v(d+1,0),last(26,0);
  for(int i=1;i<d+1;i++){
    for(int j=1;j<=26;j++){
      int v_tmp = v[i-1] + s[i-1][j-1];
      for(int k=0;k<26;k++){
        if(k!=j-1){
          v_tmp -= c[k] * (i - last[k]);
        }
      }
      if(v[i]==0||v_tmp>v[i]){
        v[i] = v_tmp;
        t[i-1] = j;
      }
    }
    last[t[i-1]-1] = i;
  }
  
  clock_t end = clock();
  int change = d-3;
  while((double)(end-start)/CLOCKS_PER_SEC<1.5&&v[d]<=0){
    change--;
    for(int i=1;i<=26;i++){
      t[change] = i;
      vector<int> last_tmp(26,0);
      for(int j=1;j<=change;j++){
        last_tmp[t[j-1]-1] = j;
      }
      for(int ji=change+1;ji<d+1;ji++){
        for(int j=1;j<=26;j++){
          int v_tmp = v[ji-1] + s[ji-1][j-1];
          for(int k=0;k<26;k++){
            if(k!=j-1){
              v_tmp -= c[k] * (ji - last[k]);
            }
          }
          if(v[ji]==0||v_tmp>v[ji]){
            v[ji] = v_tmp;
            t[ji-1] = j;
          }
        }
        last_tmp[t[ji-1]-1] = ji;
      }
    }
    end = clock();
  }
  
  //cout << v[d] << endl;
  for(int i=0;i<d;i++){
    cout << t[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 3728
from collections import Counter

def count(a):
    c = Counter(a)
    return len(a) - c.most_common(1)[0][1]

n = int(input())
s = list(map(int, input().split()))
s1 = s[::2]
s2 = s[1::2]
if(count(s) == 0):
    print(len(s) // 2)
else:
    a = Counter(s1).most_common(2)
    b = Counter(s2).most_common(2)
    if(len(a) == 1):
        a.append((-1, 0))
    if(len(b) == 1):
        b.append((-2, 0))
    way1 = a[0][1] + b[0][1] if a[0][0] != b[0][0] else -100
    way2 = a[0][1] + b[1][1] if a[0][0] != b[1][0] else -100
    way3 = a[1][1] + b[0][1] if a[1][0] != b[0][0] else -100
    ans = n - max(way1, way2, way3)
    print(ans)

Measured memory_bytes: 71272
a,b=gets.split.map &:to_i
if a == 1
    if b == 1
        puts "Draw"
    elsif 
        puts "Alice"
    end
elsif b == 1
    puts "Bob"
else
    if a == b
        puts "Draw"
    elsif a > b
        puts "Alice"
    else
        puts "Bob"
    end
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define inf 999999999
#define loop(i, a, b) for (int i = (a), i##len = (b); i < i##len; ++i)
#define rep(i, n) loop(i, 0, n)
#define lin long long
#define lfl long double

lin n;
lin a[200001];
bool b[200001];

int main(void)
{
    cin >> n;
    rep(i,n)
    {
        cin >> a[i];
    }

    sort(a, a+n);

    lin p = 1;
    for(int i = 0; i < 33; i++)
    {
        p *= 2;
    }
    lin res = 0;

    while(p > 1)
    {
        lin r = n-1;
        lin l = 0;
        while(r > l)
        {
            if(b[l])
                l++;
            else if(b[r])
                r--;
            else
            {
                lin t = a[l] + a[r];
                if(t == p)
                {
                    b[l] = true;
                    b[r] = true;
                    res++;
                    l++;
                    r--;
                }
                else if(t > p)
                {
                    r--;
                }
                else 
                {
                    l++;
                }
            }

            //cout << p << " " << res << " " << l << " " << r << endl;
        }

        p /= 2;
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 2048
#include<iostream>
#include<algorithm>
#include<string.h>

using namespace std;

long long A,B,C=0;

int main()
{
	ios::sync_with_stdio(false);
	
	cin>>A>>B>>C;
	
	if(A%2==0||B%2==0||C%2==0)
	{
		cout<<"0"<<endl;
	}
	else{
		long long mn=A*B;//最小值
		if(B*C<mn){
			mn=B*C;
		} 
		if(A*C<mn){
			mn=A*C;
		}
		 
		cout<<mn<<endl;
		
	}
	
	return 0;
	
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		int n=scn.nextInt();
		int []arr=new int[n];
		for(int i=0;i<n;i++) {
			arr[i]=scn.nextInt();
		}
		int flag=0;
		for(int i=n-2;i>=0;) {
			if(arr[i+1]>=arr[i]) {
				i--;
			}else {
				if(arr[i]-1!=arr[i+1]) {
					flag=1;
					break;
				}else {
					arr[i]--;
					i--;
				}
			}
		}
		if(flag==1) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}
	}

}


Measured memory_bytes: 49112
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  ll n;
  cin >> n;
  vector<ll> vec(n);
  vector<ll> cul(n+1, 0);
  rep(i, n) cin >> vec[i];
  ll cur = vec[0];
  int ans = 1;
  for(int i = 1; i < n; i++) {
    if (cur >= vec[i]) {
      ans++;
      cur = min(cur, vec[i]);
    }
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 6428
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
using namespace std;

static const int INF=1e9;
typedef long long ll;

bool compare_by_second(pair<ll, ll> a,pair<ll, ll> b)
{
    if(a.second != b.second){
        return a.second > b.second;
    }else{
        return a.first > b.first;
    }    
}

int main(){
   int A,P; cin >> A >> P;
   int C=A*3+P;
   cout << C/2 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pii;
typedef pair<pii,ll> piii;
typedef pair<ll,pii> ipii;
#define MOD 1000000007
#define mod(a) ((a)%MOD)
#define pb push_back
#define ft first
#define sd second
#define mp make_pair
#define dbg(x) cerr<<#x<<" = "<<x<<"\n"
#define dbg2(x,y) cerr<<#x<<" = "<<x<<" , "<<#y<<" = "<<y<<"\n"
#define dbg3(x,y,z) cerr<<#x<<" = "<<x<<" , "<<#y<<" = "<<y<<" , "<<#z<<" = "<<z<<"\n"
#define INF (1LL<<60)
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;*/
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(v) v.begin(),v.end()
#define endl '\n'
ll gcd(ll a,ll b){if(a==0) return b; return gcd(b%a,a);}
ll powm(ll base,ll exp,ll mod=MOD) {base%=mod;ll ans=1;while(exp){if(exp&1LL) ans=(ans*base)%mod;exp>>=1LL,base=(base*base)%mod;}return ans;}
 



vector<ipii> p;
ll dp[10003][20004];

bool comp(ipii a,ipii b){
     return (a.ft+a.sd.ft)<(b.ft+b.sd.ft);
}


int main(){
      sync;
      ll n;
      cin>>n;
      int f=0;
      for(int i=0;i<n;i++){
            ll w,s,v;
            cin>>w>>s>>v;
            if(s>10000){
                  f=1;
            }
            p.pb({s,{w,v}});
      }
        if(f==1){

            while(1){
                  int b;
                  int a=2*b;
            }
        }
        sort(all(p),comp);
        ll ans=0;
        for(int i=0;i<=20000;i++){
               dp[0][i]=(p[0].sd.ft<=i?p[0].sd.sd:0);
        }
        for(int i=1;i<n;i++){
             for(int j=0;j<=20000;j++){
                  if(j==0){
                       dp[i][j]=0;continue;
                  }
                  dp[i][j]=dp[i-1][j];
                  if(p[i].sd.ft<=j){
                        dp[i][j]=max(dp[i][j],dp[i-1][min(j-p[i].sd.ft,p[i].ft)]+p[i].sd.sd);
                  }
             }
        }

        for(int i=0;i<=20000;i++) ans=max(ans,dp[n-1][i]);
        cout<<ans<<endl; 
}

Measured memory_bytes: 157952
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  // フレンドリーさでsort、最大の人は１回貢献、次点の人以降２回貢献
  int N;
  cin >> N;
  vector<int> A(N);
  rep(i, N) cin >> A[i];
  sort(A.rbegin(), A.rend());
  ll ans = A[0];
  int remain = N-2;
  int cur = 1;
  while (remain > 0) {
    if (remain == 1) {
      ans += A[cur];
      break;
    } else {
      ans += 2 * A[cur];
      cur++;
      remain -= 2;
    }
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 4060
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a.at(i);
  sort(ALL(a));
  int ans = 0;
  rep(i, n-1){
    ans += a.at(i+1) - a.at(i);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3528
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
typedef long long LL;

int main() {
	std::vector<int> vec;
	for (int i = 0; i < 3; ++i) {
		int a;
		std::cin >> a;
		vec.push_back(a);
	}
	std::sort(vec.begin(), vec.end());
	std::cout << (vec[1] - vec[0]) + (vec[2] - vec[1]) << std::endl;
	return 0;
}

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

int main(){
    int a,b,c;
    map<int,int>Map;
    cin >> a >> b >> c;
    Map[a]++;Map[b]++;Map[c]++;
    if(Map[5]==2&&Map[7]==1)cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}

Measured memory_bytes: 256
from collections import deque
N,M,K = map(int,input().split())
F = {i:set() for i in range(1,N+1)}
B = {i:set() for i in range(1,N+1)}
for _ in range(M):
    a,b = map(int,input().split())
    F[a].add(b)
    F[b].add(a)
for _ in range(K):
    c,d = map(int,input().split())
    B[c].add(d)
    B[d].add(c)
A = []
hist = [-1 for _ in range(N+1)]
cnt = -1
for i in range(1,N+1):
    if hist[i]<0:
        cnt += 1
        A1 = set()
        que = deque([i])
        hist[i] = cnt
        A1.add(i)
        while que:
            x = que.popleft()
            for y in F[x]:
                if hist[y]<0:
                    A1.add(y)
                    que.append(y)
                    hist[y]=cnt
        A.append(A1)
C = []
for i in range(1,N+1):
    cnt = hist[i]
    a = A[cnt]&B[i]
    C.append(len(A[cnt])-len(F[i])-len(a)-1)
print(*C)  

Measured memory_bytes: 124388
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;

typedef long long ll;
//typedef pair<int,int> Pint;
typedef pair<ll, ll> P;
//typedef pair<ll, pair<ll, ll>> P;
//typedef tuple<int,int,int> T;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define revrep(i, n) for(ll i = n-1; i >= 0; i--)
#define pb push_back
#define f first
#define s second
const ll INFL = 1LL << 60;//10^18 = 2^60
const int INF = 1 << 30;//10^9
const ll MOD = 1e9 + 7;

//ll MOD  = 998244353;
vector<ll> dy = {0, 0, 1, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, -1, 0, 0, 1, -1, 1, -1, 0};

ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x;
    k /= 2;
  }
  return res;
}

ll pow_mod(ll x, ll k){
  x %= MOD; x += MOD; x %= MOD;
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}
ll inverse(ll x){return pow_mod(x, MOD - 2);};


ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a % b);
}

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

ll solve(ll x, ll y){
  if(x % y == 0) return y * (x / y * 2 - 1);
  return solve(y, x % y) + y * (x / y * 2);
}

int main(void){
  ll N, X;
  cin >> N >> X;
  cout << solve(max(X, N-X), min(X, N - X)) + N << endl;

}


Measured memory_bytes: 256
#include <valarray>
#include <cstdio>
using namespace std;
typedef valarray<int>V;
int N,M,A,B,C,T;
V mul(const V &a, const V &b){
	V c(N*N);
	int i=0,j;
	for(;i<N;i++)for(j=0;j<N;j++)c[i*N+j]=(a[slice(i*N,N,1)]*b[slice(j,N,N)]).sum()%M;
	return c;
}
V exp(const V &a, const int n){
	if(n==1)return a;
	if(n&1)return mul(exp(a,n-1),a);
	V b=exp(a,n>>1);
	return mul(b,b);
}
V z(){
	V x(N*N);
	int i;
	if(T){
		x[0]=B;
		x[1]=C;
		for(i=1;i<N-1;i++){
			x[i*N+i-1]=A;
			x[i*N+i]=B;
			x[i*N+i+1]=C;
		}
		x[i*N+i-1]=A;
		x[i*N+i]=B;
		return exp(x,T);
	}else{
		for(i=0;i<N;i++)x[i*N+i]=1;
		return x;
	}
}
main(){
	int i;
	V s;
	for(;scanf("%d%d%d%d%d%d",&N,&M,&A,&B,&C,&T),N;){
		s.resize(N);
		for(i=0;i<N;i++)scanf("%d",&s[i]);
		const V r=z();
		for(i=0;i<N-1;i++)printf("%d ",(r[slice(i*N,N,1)]*s).sum()%M);
		printf("%d\n",(r[slice(i*N,N,1)]*s).sum()%M);
	}
}

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

int main(void){
    int n, i;
    int tp = 0, hp = 0;
    char tani[100];
    char hani[100];

    scanf("%d", &n);
    for(i = 0; i < n; i++){
        scanf("%s %s", tani, hani);
        if(strcmp(tani, hani) > 0){ tp += 3; }
        else if(strcmp(tani, hani) < 0){ hp += 3; }
        else { tp++; hp++; }
    }
    printf("%d %d\n", tp, hp);
    return 0;
}



Measured memory_bytes: 2028
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;

int main(){
    double x1, x2, y1, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    double x3, y3, a;
    x3 = pow(x1 - x2, 2);
    y3 = pow(y1 - y2, 2);
    a = sqrt(x3 + y3);
    printf("%lf\n", a);
    return 0;
}


Measured memory_bytes: 3264
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll mod = 1e9 + 7;
const ll MAXX = 1e18;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("INP.txt", "r", stdin);
    //freopen("OUT.txt", "w", stdout);
	ll n;
	cin >> n;
	vector<ll> hold(n);
	for (ll i = 0; i < n; i++) {
		cin >> hold[i];
	}
	ll sum = 0;
	for (ll i = 0; i < n; i++) {
		for (ll j = i + 1; j < n; j++) {
			sum += hold[i] * hold[j];
		}
	}
	cout << sum << '\n';
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int x,y;
    while(1)
    {
        cin>>x>>y;
        if ( x == 0 && y == 0 ) break; 
        else if (x<=y) cout<<x<<" "<<y<<endl;
        else cout<<y<<" "<<x<<endl;
    }    
}


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

int main() {
    int N;
    cin >> N;
    int now = 100000;
    for (int i = 0; i < N; i++) {
        now *= 1.05;
        now = (now + 999) / 1000 * 1000;
    }
    cout << now << endl;
    return 0;
}

Measured memory_bytes: 1156
S = input()

for i in range(1, len(S)+1):
    if i % 2 == 0 and S[i-1] == 'R':
        print('No')
        break
    elif i % 2 != 0 and S[i-1] == 'L':
        print('No')
        break
else:
    print('Yes')


Measured memory_bytes: 9060
#include<stdio.h>

typedef long long ll;

int L[2000];

int cmp(const void *a, const void *b){
    return *(int *)a - *(int *)b;
}

int main(void){
    int N;
    scanf("%d", &N);
    int i;
    for(i = 0; i < N; i++){
        scanf("%d", &L[i]);
    }
    qsort(L, N, sizeof(int), cmp);

    int j, k;
    ll cnt = 0;

    for(i = 0; i < N-2; i++){
        for(j = i+1; j < N-1; j++){
            for(k = j+1; k < N; k++){
                if(L[i] < L[j] + L[k] && L[k] < L[j] + L[i] && L[j] < L[i] + L[k]){
                    cnt++;
                }else{
                    break;
                }
            }

        }
    }
    printf("%d", cnt);

}

Measured memory_bytes: 252
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef bitset<705> bs;

vector<pii> conds[301]; // <index, color>
const int MOD = 1000000007;
int dp[301][301];
int ndp[301][301];

void solve() {
  int n;
  cin >> n;
  {
    int m;
    cin >> m;
    while(m--) {
      int a, b, c;
      cin >> a >> b >> c;
      conds[b].emplace_back(a, c);
    }
  }
  dp[0][0] = 1;
  for(int i = 1; i <= n; i++) {
    memset(ndp, 0, sizeof(ndp));
    for(int x = 0; x < i; x++) {
      for(int y = x; y < i; y++) {
        // RHS were x, y, i-1
        bool can;
        // color x, state is [y][i-1]
        can = true;
        for(pii out: conds[i]) {
          int amtMatch = 1;
          if(y >= out.first) amtMatch++;
          if(i-1 >= out.first) amtMatch++;
          can &= amtMatch == out.second;
        }
        if(can) {
          ndp[y][i-1] += dp[x][y];
          ndp[y][i-1] %= MOD;
        }
        // color y, state is [x][i-1]
        can = true;
        for(pii out: conds[i]) {
          int amtMatch = 1;
          if(x >= out.first) amtMatch++;
          if(i-1 >= out.first) amtMatch++;
          can &= amtMatch == out.second;
        }
        if(can) {
          ndp[x][i-1] += dp[x][y];
          ndp[x][i-1] %= MOD;
        }
        // color i-1, state is [x][y]
        can = true;
        for(pii out: conds[i]) {
          int amtMatch = 1;
          if(x >= out.first) amtMatch++;
          if(y >= out.first) amtMatch++;
          can &= amtMatch == out.second;
        }
        if(can) {
          ndp[x][y] += dp[x][y];
          ndp[x][y] %= MOD;
        }
      }
    }
    memcpy(dp, ndp, sizeof(dp));
  }
  int ret = 0;
  for(int i = 0; i <= n; i++) {
    for(int j = 0; j <= n; j++) {
      ret += dp[i][j];
      ret %= MOD;
    }
  }
  cout << ret << "\n";
}

void casesolve() {
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << ": ";
    solve();
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  solve();
  // casesolve();
}


Measured memory_bytes: 1024
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define REP(var, s, n) for (int var = (s); var < (n); ++var)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()

int main() {
  //
  int n;
  cin >> n;
  vi a(n);
  rep(i, n) cin >> a[i];
  int s = abs(a[0]);
  REP(i, 1, n) { s += abs(a[i] - a[i - 1]); }
  s += abs(a[n - 1]);
  rep(i, n) {
    if (i == 0) {
      cout << s - abs(a[0]) - abs(a[1] - a[0]) + abs(a[1]) << endl;
    } else if (i < n - 1) {
      cout << s - abs(a[i] - a[i - 1]) - abs(a[i + 1] - a[i]) +
                  abs(a[i - 1] - a[i + 1])
           << endl;
    } else {
      // i == n-1
      cout << s - abs(a[n - 1] - a[n - 2]) - abs(a[n - 1]) + abs(a[n - 2])
           << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 2296
l = [int(i) for i in input().split(" ")]
h = l[0]
w = l[1]

m = []
m_t = []
m_tt = []
# .のみの行を取り除く
for i in range(h):
    row = list(input())
    if "#" not in row:
        pass
    else:
        m.append(row)

# 転置して.のみの行を取り除く
for i in range(w):
    row = []
    for j in range(len(m)):
        row.append(m[j][i])
    if "#" not in row:
        pass
    else:
        m_t.append(row)

# 再び転置する
for i in range(len(m)):
    row = []
    for j in range(len(m_t)):
        row.append(m_t[j][i])
    m_tt.append(row)

for row in m_tt:
    print("".join(row))


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

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

int main(){

    ll N, Ma, Mb; cin >> N >> Ma >> Mb;
    /*
    if(Ma < Mb){
        swap(Ma, Mb);
    }
    */

    vector<pii > input;

    for(ll i = 0; i < N; i++){
        ll a, b, c; cin >> a >> b >> c;
        input.push_back(make_pair(make_pair(a, b), c));
    }

    ll ans = 11451451919;
    map<pi, ll> dp;
    dp[make_pair(0, 0)] = 0;

    for(ll i = 0; i < N; i++){
        vector<pii > tmp;

        auto begin = dp.begin(), end = dp.end();
        for (auto iter = begin; iter != end; iter++) {
            //使わないとき
            ll t_a = iter -> first.first;
            ll t_b = iter -> first.second;
            ll t_c = iter -> second;
            //cout <<  t_c << endl;

            tmp.push_back(make_pair(make_pair(t_a, t_b), t_c));

            t_a += input[i].first.first;
            t_b += input[i].first.second;
            t_c += input[i].second;   
            tmp.push_back(make_pair(make_pair(t_a, t_b), t_c));

            //cout <<  t_c << endl;
            
        }

        //更新
        for(ll j = 0; j < tmp.size(); j++){
            //初期化 まだ出てきていない組み合わせ
            ll t_a = tmp[j].first.first;
            ll t_b = tmp[j].first.second;
            if(dp[make_pair(t_a, t_b)] == 0){
                dp[make_pair(t_a, t_b)] = 1145141919;
            }
            
            //cout << tmp[j].first.first << "," << tmp[j].first.second << " " << tmp[j].second << " ";
            dp[tmp[j].first] = min(tmp[j].second, dp[tmp[j].first]);

            //答え更新
            if(t_a != 0 && t_b != 0 ){
                //if(t_a < t_b) swap(t_a, t_b);
                
                if(t_a / Ma == t_b / Mb && t_a % Ma == 0 && t_b % Mb == 0){
                    //cout << t_a << " " << t_b << endl;
                    ans = min(ans, dp[tmp[j].first] );
                }   
            }

        }
       // cout << endl;

    }

    /*
    auto begin = dp.begin(), end = dp.end();
    for (auto iter = begin; iter != end; iter++) {
        ll t_a = iter -> first.first;
        ll t_b = iter -> first.second;
        ll t_c = iter -> second;
        cout << "[" << t_a << "," << t_b << "] " << t_c << endl; 
    }
     */
    
    if(ans == 11451451919){
        cout << -1 << endl;
    }else{
        cout << ans << endl;
    }
    
}

Measured memory_bytes: 4024
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1e9+7
#define PI acos(-1.0)
#define ll long long
#define INF 1000000001

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

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  int r,g;cin>>r>>g;
  P(2*g-r);
  return 0;
}


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

int main(){
    using namespace std;
    unsigned long N;
    cin >> N;
    unsigned long ans{0};
    for(unsigned long i{0}, m{N + 1}, p; i < N; ++i){
        cin >> p;
        if(m >= p)++ans;
        m = min(m, p);
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

#define fi first
#define se second
#define eb emplace_back
#define mt make_tuple
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

const ll INF=LLONG_MAX;
const int mxn=1e5+5;
ii a[mxn];

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	int n; cin >> n;
	for(int i=0; i<n; i++){
		cin >> a[i].fi;
		a[i].se=i;
	}
	sort(a,a+n);
	for(int i=0; i<n; i++){
		cout << a[i].se+1 << ' ';
	}
	cout << endl;
}
	
// READ & UNDERSTAND
// ll, int overflow, array bounds, memset(0)
// special cases (n=1?), n+1 (1-index)
// do smth instead of nothing & stay organized
// WRITE STUFF DOWN


Measured memory_bytes: 4340
#include <cstring>
#include <string>
#include <iostream>
#include <algorithm>
#include <queue>
#include <functional>
#include <cstdio>
#define INF 1e7
using namespace std;

class data{
public:
	int x,y,dir,dir2,c;
	data(){}
	data(int xx,int yy,int dd,int dd2,int cc){
		x=xx;
		y=yy;
		dir=dd;
		dir2=dd2;
		c=cc;
	}
	bool operator<(const data& d1)const{
		return c>d1.c; 
	}
};

struct edge{
	int x,y,dir,dir2,c;
	edge(){}
	edge(int xx,int yy,int dd,int dd2,int cc){
		x=xx;
		y=yy;
		dir=dd;
		dir2=dd2;
		c=cc;
	}
};

const char* dir="^>v<";
int n,m;
int fie[55][55];
int dx[4]={0,1,0,-1};
int dy[4]={-1,0,1,0};
int bx[4][4]={
	{1,1,1,0},
	{0,1,1,-1},
	{-1,-1,-1,0},
	{0,-1,-1,1}
};

int by[4][4]={
	{0,-1,1,-1},
	{1,1,0,1},
	{0,-1,1,1},
	{-1,0,-1,-1}
};

int sx,sy,sdir;
vector<edge> G[55][55][4][4];
bool used[55][55][4][4];
int uses[55][55];

int dfs(int x,int y,int dir,int dir2,int c){
	used[x][y][dir][dir2]=true;
	uses[x][y]++;
	if(fie[x][y]==1)return c;
	for(int i=0;i<G[x][y][dir][dir2].size();i++){
		edge e=G[x][y][dir][dir2][i];
		if(!used[e.x][e.y][e.dir][e.dir2]){
			if(e.c==1 && uses[e.x][e.y]==0){
				//printf("%d %d %d %d %d\n",e.x,e.y,e.dir,e.dir2,c+1);
				int res=dfs(e.x,e.y,e.dir,e.dir2,c+1);
				if(res>=1)return res;
			}else{
				//printf("%d %d %d %d %d\n",e.x,e.y,e.dir,e.dir2,c+1);
				int res=dfs(e.x,e.y,e.dir,e.dir2,c);
				if(res>=1)return res;
			}
		}
	}
	uses[x][y]--;
	return -1;
}

int solve(){
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			if(fie[j][i]==-1)continue;
			for(int k=0;k<4;k++){
				for(int l=0;l<4;l++){
					int nx=j+dx[k],ny=i+dy[k];
					if(nx>=1 && nx<=m && ny>=1 && ny<=n){
						for(int b=0;b<4;b++){
							if(j+bx[k][l]==nx+bx[k][b] && i+by[k][l]==ny+by[k][b]){
								G[j][i][k][l].push_back(edge(nx,ny,k,b,1));
							}
						}
					}
					for(int b=0;b<4;b++){
						if(bx[k][l]==bx[(k+1)%4][b] && by[k][l]==by[(k+1)%4][b]){
							G[j][i][k][l].push_back(edge(j,i,(k+1)%4,b,0));
						}
						if(bx[k][l]==bx[(k+3)%4][b] && by[k][l]==by[(k+3)%4][b]){
							G[j][i][k][l].push_back(edge(j,i,(k+3)%4,b,0));
						}
					}
					for(int a=0;a<4;a++){
						if(fie[j+bx[k][a]][i+by[k][a]]==-1 && abs(bx[k][a]-bx[k][l])<=1 && abs(by[k][a]-by[k][l])<=1){
							G[j][i][k][l].push_back(edge(j,i,k,a,0));
						}
					}
				}
			}
		}
	}
	memset(used,0,sizeof(used));
	return dfs(sx,sy,sdir,0,1);
}

int main(void){
	scanf("%d %d",&n,&m);
	memset(fie,-1,sizeof(fie));
	for(int i=1;i<=n;i++){
		string str;
		cin >> str;
		for(int j=1;j<=m;j++){
			for(int k=0;k<4;k++){
				if(dir[k]==str[j-1]){
					sx=j;
					sy=i;
					sdir=k;
					fie[j][i]=0;
				}
			}
			if(str[j-1]=='#')fie[j][i]=-1;
			if(str[j-1]=='.')fie[j][i]=0;
			if(str[j-1]=='G')fie[j][i]=1;
		}
	}
	printf("%d\n",solve());
	return 0;
}

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

bool isPrime(long int n) 
{ 
	if (n <= 3) return true; 
	if (n%2 == 0 || n%3 == 0) return false; 
	for (int i=5; i*i<=n; i=i+6) 
		if (n%i == 0 || n%(i+2) == 0) 
		return false; 
	
	return true; 
} 

long int nextPrime(long int N) 
{ 
	if (N <= 2) 
		return 2; 
	long int prime = N-1; 
	bool found = false; 
	while (!found) { 
		prime++; 
		if (isPrime(prime)) 
			found = true; 
	}
	return prime; 
} 

int main() 
{ 
	long int N;
	cin >> N;
	cout << nextPrime(N) <<endl; 

	return 0; 
} 


Measured memory_bytes: 256