akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define X first
#define Y second
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define ini(x, y) memset(x, y, sizeof(x))
#define endl '\n'
#define fastio cin.sync_with_stdio(false); cin.tie(nullptr)
using namespace std;

using ll = long long;
using pii = pair<int, int>;
const int dx[] = { -1, 0, 1, 0, -1, 1, 1, -1 };
const int dy[] = { 0, 1, 0, -1, 1, 1, -1, -1 };

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

	if (A <= C && C <= B) cout << "Yes";
	else cout << "No";

	return 0;
}

Measured memory_bytes: 256
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
 
using ull = unsigned long long int;
using ll = long long int;
using du = double;
using ld = long du;
using vi = vector<int>;
using vll = vector<ll>;
using vld = vector<ld>;
using vdu = vector<du>;
using vs = vector<string>;
using vc = vector<char>;
using si = set<int>;
using sll = set<ll>;
using sdu = set<du>;
using sld = set<ld>;
using pii = pair<int, int>;
using pll = pair<ll,ll>;
using pdu = pair<du,du>;
using pld = pair<ld,ld>;
using pis = pair<int,string>;
 
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define sp(x) setprecision(x)<<fixed
#define loop(i,n) for(int i=0;i<n;i++)
#define ff first
#define ss second
#define pi acos(-1)
#define meme(a,x) memset(a,x,sizeof(a))
 
//debugger
 
#ifdef KAIZER
#include "debug.h"
#else
#define debug(x...)
#endif
//debugger
 
//functions
bool check_pow(ll a)
{
    if((a&(a-1))==0) return true;
    else return false;
}
ld my_pow(ld a,int b)
{
    ld ans=1;
    for(int i=0;i<b;i++) ans*=a;
    return ans;
}
ll digits(ll a)
{
    string line=to_string(a);
    return line.size();
}
bool prime_check(ll a)
{
    bool flag=true;
    for(ll i=2;i<=sqrt(a);i++)
    {
        if(a%i==0) {flag=false; break;}
    }
    return flag;
}
bool comp(const ll &a , const ll &b)
{
    return a>b;
}
const ll xyz=2e5+10;
ll fact[xyz];
void mod_fact(ll m=1)
{
    fact[0]=1;
    loop(i,(2e5)) 
    {
        ll p=i+1;
        //if(p%2==0) p/=2;
        fact[i+1]=(((fact[i])%m)*(p%m))%m;
    }
}

//functions


int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    FASTIO;
    int a,b;
    cin>>a>>b;
    ll n=1;
    ll ans=0;
    while(n<b)
    {
        n+=(a-1);
        ans++;
    }
    cout<<ans<<endl;
}
 

Measured memory_bytes: 3620
from math import sin, cos, radians

a, b, C = (float(x) for x in input().split())
s = a * b * sin(radians(C)) * 0.5
l = (a **2 + b**2 - 2 * a * b * cos(radians(C))) ** 0.5 + a + b
h = s * 2 / a
print(s)
print(l)
print(h)

Measured memory_bytes: 7816
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;

struct Node{
  struct{
    int next;
    int cost;
  } edge[2];
};


int main(){
  int n;
  while(scanf("%d",&n), n){
    Node v[n];
    bool f[n];
    int ans = 1;
    memset(f, 0, n);
    REP(i,n){
      int a,b,c,d;
      scanf("%d%d%d%d",&a,&b,&c,&d);
      v[i].edge[0].next = a;
      v[i].edge[0].cost = b;
      v[i].edge[1].next = c;
      v[i].edge[1].cost = d;
    }
    REP(i,n){
      if(!f[i]){
	int j    = i;
	int cnt  = 1;
	int m    = -1;
	int prev = -1;
	while(!f[j]){
	  f[j] = true;
	  REP(k,2){
	    if(v[j].edge[k].next != prev){
	      int cost = v[j].edge[k].cost;
	      prev = j;
	      j = v[j].edge[k].next;
	      if(cost > m){
		m = cost;
		cnt = 1;
	      }else if(cost == m){
		cnt++;
	      }
	      break;
	    }
	  }
	}
	ans = (int)(((long long)ans * cnt) % 10007);
      }
    }
    printf("%d\n",ans);
  }
  return 0;
}

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

#define int long long

signed main(){
	int a,b;
    cin >> a >> b;
    int power = 1,cnt = 0;
    
    while(power<b){
    	power+= a-1;
        cnt++;
        }
        cout << cnt << endl;
        
        return 0;
        }


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define all(x) x.begin(),x.end()
#define endl '\n'
#define pb push_back
#define ff first
#define ss second
#define PI 3.1415926535897932384626
#define mod 1000000007
#define modd 998244353

void io() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
}

int main() {
	io();
	
	int n;
	cin>>n;
	cout<<(1000-n%1000)%1000;
	return 0;
}


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

int main(){
    int a,b,c,d;
    int Answer = 0;
    std::cin >> a >> b;
    std::cin >> c >> d;
    Answer = ( a*b ) - ( a*d ) - ( b*c ) + ( c*d );

    std::cout << Answer << std::endl; 
}

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

using namespace std;

typedef long long ll;

void FASTIO() {
	ios::sync_with_stdio(false);
	cin.tie(NULL), cout.tie(NULL);
}

char ss[104];

bool palin(int s, int e) {
	for (int i=s; i<=e; i++) {
		if (ss[i]!=ss[(s+e)-i]) return 0;
	}
	return 1;
}

int main() {
	FASTIO();
	cin >> ss;
	if (palin(0, strlen(ss)-1) && palin(0, (strlen(ss)-1)/2-1) && palin((strlen(ss)+3)/2-1, strlen(ss)-1)) {
		cout << "Yes";
	}
	else cout << "No";
	return 0;
}

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

int summ(int n){
  /* 各桁の数字 */
  int dig;
  /* 和 */
  int sum = 0;
 
  /* 自然数の各桁の数字の和を計算 */
  while(n!=0){
    dig = n % 10;
    sum += dig;
    n = n / 10;
  }
  return sum;
}

int main(){
  int count = 0, A, B, N, d;
  cin >> N >> A >> B;
  for(int i=1; i<=N; i++){
    d = summ(i);
  if(A<= d && d<= B) count += i;
  }
  cout << count;
  return 0;
}

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

int main(){
	while(1){
		int n,m;
		cin >> n >> m;
		if(n == 0) break;

		vector<bitset<500> > r(n);
		for(int i=0; i<n; i++){
			cin >> r[i];
		}
		int ans = 0;
		if(n <= 23){
			for(int i=0; i<(1<<n); i++){
				int cnt = __builtin_popcount(i);
				if(cnt <= ans) continue;
				bitset<500> bxor;
				for(int j=0; j<n; j++){
					if(i>>j & 1){
						bxor ^= r[j];
					}
				}
				if(bxor.none()){
					ans = cnt;
				}
			}
		}else{
			vector<int> rr(n);
			for(int i=0; i<n; i++){
				rr[i] = r[i].to_ulong();
			}
			vector<int> maxnum(1<<m, -1);
			maxnum[0] = 0;
			for(int i=0; i<n; i++){
				vector<int> next = maxnum;
				for(int j=0; j<(1<<m); j++){
					if(maxnum[j] == -1) continue;
					next[j^rr[i]] = max(next[j^rr[i]], maxnum[j]+1);
				}
				maxnum = next;
			}
			ans = maxnum[0];
		}
		cout << ans << endl;
	}
	return 0;
}


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

typedef long long ll;

int nextp(bool *a,int n)
{
    for(int i=n-1; i>=0; i--)
    {
        if(a[i])
        {
            a[i]=0;
        }
        else
        {
            a[i]=1;
            return 1;
        }
    }
    return 0;
}

int min3(int a,int b,int c)
{
    if(a>b) a=b;
    if(a>c) a=c;
    return a;
}
int main()
{
    int n=0;
    int temp=0;
    int c[3][3];
    for(int i=0;i<3;i++)
    {
        for(int j=0;j<3;j++)
        {
            cin>>c[i][j];
            n+=c[i][j];
        }
    }
    int a[3];
    int b[3];

    if(n%3==0)
    {
        a[0]=0;
        b[0]=c[0][0]-a[0];
        b[1]=c[0][1]-a[0];
        b[2]=c[0][2]-a[0];
        a[1]=c[1][1]-b[1];
        a[2]=c[2][1]-b[1];
        int ans=1;
        for(int i=0;i<3;i++)
        {
            for(int j=0;j<3;j++)
            {
                if(c[i][j]!=a[i]+b[j])
                    ans=0;
            }
        }
        if(ans)
        {
            cout<<"Yes"<<endl;
        }
        else
        {
            cout<<"No"<<endl;
        }
    }
    else
    {
        cout<<"No"<<endl;
    }
    return 0;
}


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

int findSumOfDigits(int n){
    int sum = 0;
    while(n > 0){
        sum += n % 10;
        n /= 10;
    }
    return sum;
}

int main(){
    int N,A ,B;
    cin >> N >> A >> B;
    int total = 0;
    for(int i = 1; i <= N; ++i){
        int sum = findSumOfDigits(i);
        if(sum >= A && sum <= B){
            total += i;
        }
    }
    cout << total << endl;
}

Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

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

int main() {
    fastio();

    int k;
    cin >> k;
    ll ans = 0;
    forn1(a, k) {
        forn1(b, k) {
            ll g = gcd(a, b);
            forn1(c, k) {
                ans += gcd(g, c);
            }
        }
    }

    cout << ans << endl;

    return 0;
}

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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);++i)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
int n;
int d[200000];
int cp[200000];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n;
  REP(i, n) {
    cin >> d[i];
    cp[i] = d[i];
  }

  sort(cp, cp + n, greater<int>());

  REP(i, n) {
    if(d[i] == cp[0]) cout << cp[1] << endl;
    else cout << cp[0] << endl;
  }
}


Measured memory_bytes: 3200
import sys
from math import factorial
from fractions import Fraction
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
MOD = 10**9 + 7

n = INT()
if int(n*100/108) < int((n+1)*100/108) and (n+1)*100 %108 != 0:
    print(math.ceil(n*100/108))
elif n*100 % 108 == 0:
    print(n*100//108)
else:
    print(':(')

Measured memory_bytes: 66156
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input,
  "index" : 0,
  "max" : input.length,
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  },
  "hasNext" : function(){return (this.index < this.max);}
}
Main();
function next(){return obj.next();}
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var one = nextIntArray();
  var N = one[0];
  var K = one[1];
  var mae = Math.ceil(N / K);
  var ato = Math.floor(N / K);
  myout(mae - ato);
}

Measured memory_bytes: 7500
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
template<typename T> bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool mmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;
#define FI first
#define SE second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))


int main()
{
    lint N;
    cin >> N;
    lint K;
    cin >> K;
    cout << N - K + 1 << endl;
    return 0;
}


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

const int INF=100000;
typedef pair<int,int> P;

int main() {
    int H,W;
    int u[2][4]={-1,0,0,1,0,1,-1,0};
    cin >> H >>W;
    char maze[H][W];
    int d[H][W];
    for (int i=0;i<H;i++)
        for (int j=0;j<W;j++) cin >> maze[i][j];
    for (int i=0;i<H;i++)
        for (int j=0;j<W;j++) d[i][j]=INF;
    
    queue<P> que;
    que.push(P(0,0));
    d[0][0]=0;
    while(que.size()){
        P p=que.front();
        que.pop();
        for (int i=0;i<4;i++){
            int nx=p.first+u[0][i],ny=p.second+u[1][i];
            if(0<=nx && nx<H && 0<=ny && ny<W && maze[nx][ny]!='#' && d[nx][ny]==INF){
                que.push(P(nx,ny));
                d[nx][ny]=d[p.first][p.second]+1;
            }
        }
    }
    int w=0;
    for (int i=0;i<H;i++){
        for (int j=0;j<W;j++){
            if (maze[i][j]=='.') w++;
        }
    }
    if (w>=d[H-1][W-1]) printf("%d\n", w-d[H-1][W-1]-1);
    else printf("%d\n", -1);
}

Measured memory_bytes: 256
n=int(input())
k=3
l=[]
for _ in range(n):
    l.append(list(map(int,input().split())))
dp=[l[0]]
for i,s in enumerate(l):
    if not i:continue
    t=[t for t in dp[-1]]
    d=[]
    for i in range(k):
        d.append(max(t[j]for j in range(k)if i!=j)+s[i])
    dp.append(d)
print(max(dp[-1]))

Measured memory_bytes: 47360
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
	int a, b;
	cin >> a >> b;
	if(a <= 0 && 0 <= b) cout << "Zero" << endl;
	else if(a > 0) cout << "Positive" << endl;
	else{
		if((b - a + 1) % 2 == 0) cout << "Positive" << endl;
		else cout << "Negative" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#define N 310
#define R register
char dlb[N][N<<1];
int main()
{
	int n,ans=0,pd;
	scanf("%d",&n);
	for (R int i=1;i<=n;++i) scanf("%s",dlb[i]+1);
	for (R int i=1;i<=n;++i)
		for (R int j=1;j<=n;++j)
			dlb[i][n+j]=dlb[i][j];
	for (R int i=0;i<n;++i)
	{
		pd=0;
		for (R int j=1;j<=n;++j)
			for (R int c=j;c<=n;++c)
				if (dlb[j][c+i]==dlb[c][j+i]) pd++;
		if (pd==n*(n+1)/2) ans++;
	}
	printf("%d",ans*n);
	return 0;
}

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


int main(void) {
    int a,b;
    cin >> a >> b;
    if(a == 1)a = 100;
    if(b == 1)b = 100;
    if(a > b)puts("Alice");
    else if(a == b)puts("Draw");
    else puts("Bob");
}


Measured memory_bytes: 256
// Remeber Choose Compiler: GCC9
#include <bits/stdc++.h>

using namespace std;

// Debug Output Utility
#ifdef LOCAL
#define dbg(args...)             \
    do {                         \
        cout << #args << " -> "; \
        err(args);               \
    } while (0)
void err() { std::cout << std::endl; }
template <typename T, typename... Args>
void err(T a, Args... args) {
    std::cout << a << ' ';
    err(args...);
}
template <template <typename...> class T, typename t, typename... A>
void err(const T<t> &arg, const A &... args) {
    for (auto &v : arg)
        std::cout << v << ' ';
    err(args...);
}
#else
#define dbg(...)
#endif

// Macro Definitions:
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()

// Type Alias:
using int64 = long long;
using PII   = pair<int, int>;

// Global Const Variable
const int64 INF = 0x3f3f3f3f3f3f3f3f;
const int MOD   = 1000000007;
const int MAXN  = 200005;


void run() {
    string s,t;
    cin >> s >> t;
    int ans = 0;
    for(int i=0;i<sz(s);i++) {
        if(s[i]!=t[i]) ans++;
    }
    cout << ans << endl;
}

// Debug Input Redirection
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
#endif
    run();
}


Measured memory_bytes: 3804
n = input()
a = map(int, raw_input().split())
times = 0
for i in xrange(n):
	mini = i
	for j in range(i+1, n):
		if a[j] < a[mini]:
			mini = j
	if mini != i:
		a[i], a[mini] = a[mini], a[i]
		times += 1
print ' '.join(map(str, a))
print times

Measured memory_bytes: 4224
#include <iostream>
#include <vector>
#include <deque>
#include <cmath>
using namespace std;

const double PI = acos(-1);
using ll = long long;
using ull = unsigned long long;
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;
typedef pair<int,int> P;

#define REP(i,n) for (int i = 0; i < (n); i++)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second

int a[100010];
bool used[100010];

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

  int k;
  cin >> k;

  deque<int> dq;
  dq.push_back(1);
  a[1] = 1;
  while (!dq.empty()) {
    int tp = dq.front();
    dq.pop_front();

    if (tp == 0) {
        cout << a[tp] << endl;
        return 0;
    }
    
    if (used[tp]) continue;
    used[tp] = 1;
    int x = (tp+1)%k;
    int y = (tp*10)%k;
    if (!used[x]) {
      a[x] = a[tp]+1;
      dq.push_back(x);
    }
    if (!used[y]) {
      a[y] = a[tp];
      dq.push_front(y);
    }
    /*
    if (x == 0) {
      cout << a[x] << endl;
      return 0;
    }
    if (y == 0) {
      cout << a[y] << endl;
      return 0;
    }
    */
  }
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;
#define show2(a, n, m) rep(i, n) { rep(j, m) {cout << a[i][j] << ' ';} cout << endl;} 

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<long long, long long> pll;
typedef long double ld;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100010;

int main() {
//	cout << fixed << setprecision(15);
	int n;
	cin >> n;
	vi a(n);
	rep(i, n) cin >> a[i];
	vi dp(1, a[0]);	// store the last number of each sequences
	for(int i = 1; i < n; i++) {
		int j = lower_bound(dp.begin(), dp.end(), a[i]) - dp.begin();
		if(j == 0) dp.insert(dp.begin(), a[i]);	// can't add a[i] to existed sequence, so add a sequence
		else dp[j - 1] = a[i];	// update the last number of the sequence where a[i] is added
	}
	cout << dp.size() << endl;
}


Measured memory_bytes: 1276
def trush_and_next(s):
  if s[0] == 'a':
    next = 0
  elif s[0] == 'b':
    next = 1
  else:
    next = 2
  return s[1:],next

l = []
ans = 'ABC'
for i in range(3):
  l.append(str(input()))

next = 0
while True:
  if len(l[next]) == 0:
    print(ans[next])
    break
  else:
    l[next],next = trush_and_next(l[next])

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

r = []
l = []
for i in range(N):
  ri, li = input().split()
  r.append(int(ri))
  l.append(int(li))
  
ans=0
for i in range(N):
  #print(r[i],l[i])
  ans=ans-r[i]+l[i]+1
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define endl '\n'
#define all(v) (v).begin(),(v).end()
#define int long long
#define P pair<int,int>

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);

    double n;
    cin >> n;

    double x = n / 3.0;
    cout << fixed << setprecision(10) << pow(x, 3) << endl;
}

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

int a[200];

int main(){
    int n;
    cin>>n;
    int ans=0;
    for(int i=1; i<=n; ++i){
        cin>>a[i];
        if(i%2==1&&a[i]%2==1)ans++;
    }
    cout<<ans<<endl;
}

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

int main(){
	int n;
	cin >> n;
	vector<int> a(n);
  	for(int i = 0; i < n; i++) {
  		cin >> a[i];
    }
	int count = 0;
  	for (int i = 0; i < n-2; i++){
     	if ((a[i] < a[i+1] && a[i+1] < a[i+2]) || (a[i] > a[i+1] && a[i+1] > a[i+2]))  
      		count++;
    }
  	cout << count << endl;
}


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

int main(){

    string S, T;
    cin >> S >> T;

    int ans = 0;
    if(S.at(0) == T.at(0)){
        ans += 1;
    }

    if(S.at(1) == T.at(1)){
        ans += 1;
    }

    if(S.at(2) == T.at(2)){
        ans += 1;
    }

    cout << ans << endl;

    return 0;
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int64 n,a,b,c,d,e;
    cin >> n >> a >> b >> c >> d >> e;
    int64 f = min({a,b,c,d,e});
    f = (n + f - 1) / f;
    ANS(f + 4);
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = Integer.parseInt(scan.next());
		int T = Integer.parseInt(scan.next());
		int[] c = new int[N];
		int[] t = new int[N];
		for (int i = 0; i < N; i++) {
			c[i] = Integer.parseInt(scan.next());
			t[i] = Integer.parseInt(scan.next());
		}
		int min = 0;
		for (int i = 0; i < N; i++) {
			if (t[i] <= T) {
				if (min == 0) {
					min = c[i];
				} else {
					if (c[i] < min) {
						min = c[i];
					}
				}
			}
		}
		if (min == 0) {
			System.out.println("TLE");
		} else {
			System.out.println(min);
		}
	}
}


Measured memory_bytes: 21844
#input number
n = raw_input()

if n < 1 and n > 100:
	exit()

# input elements
l = raw_input()

elements = [int(e) for e in l.split()]

print ' '.join(str(e) for e in elements)

for i in range(1, int(n)):
	key = elements[i]
	j = i - 1
	while j >= 0 and elements[j] > key:
		elements[j + 1] = elements[j]
		j -= 1
	elements[j + 1] = key
	# output
	print ' '.join(str(e) for e in elements)

Measured memory_bytes: 6440
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1000000007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define REP(i, n) for(ll i=0; i<(ll)(n); i++)
#define REPD(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=a; (ll)(b)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main(){
    int n;  cin >> n;
    vector<vector<ll>> original(n, vector<ll>(n, LINF));
    REP(i, n) REP(j, n) cin >> original[i][j];
    vector<vector<ll>> copy = original;
    REP(k, n){
        REP(i, n){
            REP(j, n){
                copy[i][j] = min(copy[i][j], copy[i][k]+copy[k][j]);
            }
        }
    }
    if(copy!=original){
        cout << -1 << endl;
        return 0;
    }
    ll res=0;
    
    REP(i, n){
        REP(j, i+1){
            bool flag=false;
            REP(k, n)
                if(k!=i && k!=j &&copy[i][j]==copy[i][k]+copy[k][j]) flag =true; 
            if(!flag) res += copy[i][j];
        }
        
    }
    
    cout << res << endl;
}

Measured memory_bytes: 1664
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>

using namespace std;

using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;

void debug_out() { std::cout << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#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 Rep(i, n) for (long long i = 0; i< (long long)(n); i++)
#define RRep(i,n) for (long long i = ((long long)(n)-1); i>=0; i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    int weight;
    edge(int f,int t,int w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

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;
}

template <class T>
T gcd(T a, T b){
    if( b==0 ) return a;
    return gcd(b, a%b);
}

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

bool isPalindrome(string s){
    string t = s;
    reverse(all(t));
    return s==t;
}

constexpr ll INF = 1e9+7;

vector<int> dx = {-1,0,1,0};
vector<int> dy = {0,-1,0,1};

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int x,y,z; cin >> x >> y >> z;
    swap(x,y);
    swap(x,z);
    cout << x << " "<< y << " " << z << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
int Max(int(a), int(b), int(c)) {
	return max(max(a, b), c);
}
int Min(int(a), int(b), int(c)) {
	return min(min(a, b), c);
}





int main() {
	ll N,X=1,Y=1;
	cin >> N;
	rep(i, N) {
		ll t, a;
		cin >> t >> a;
		X = (max((X-1) / t, (Y-1) / a)+1) * t;
		Y =( max((X-1) / t, (Y-1) / a)+1) * a;
		
			
	}
	cout << X + Y << endl;
}


Measured memory_bytes: 256
import sys

input = sys.stdin.readline

def LIST():
    return list(map(int, input().split()))

N=int(input())
H=LIST()

p=H[0]
cnt = 0
max_cnt = 0
for h in H[1:]:
    if p >= h:
        cnt += 1
        max_cnt = max(max_cnt, cnt)
    else:
        cnt = 0
    p = h

print(max_cnt)

Measured memory_bytes: 14172
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;


int main()
{
	ll s, c;
	cin >> s >> c;
	ll total = min(c / 2, s);
	c -= total * 2;
	s -= total;
	ll dif = c / 4 - s;
	s += dif;
	c -= dif;
	total += s;
	cout << total << endl;
	return 0;
}



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

long long L, A, B, mod, mod2, ans[19], num[19];
map<long long, long long> Map1, Map2;

void init() {
	vector<long long> E; long long r = mod;
	for (int i = 2; i * i <= r; i++) {
		if (r%i != 0) continue;
		E.push_back(i);
		while (r%i == 0) r /= i;
	}
	if (r >= 2) E.push_back(r);

	mod2 = mod;
	for (int i = 0; i < E.size(); i++) {
		mod2 = mod2 * (E[i] - 1LL) / E[i];
	}
}

long long modpow(long long a, long long b, long long m) {
	long long p = 1, q = a % m;
	for (int i = 0; i < 63; i++) {
		if ((b / (1LL << i)) % 2 == 1) { p *= q; p %= m; }
		q *= q; q %= m;
	}
	return p;
}

long long solve_1(long long G, long long K) {
	// 係数が [1, 1, 1, 1, 1, ..., 1] のとき
	if (K == 1) return 1;
	if (Map1[K] >= 1) return Map1[K] - 1;
	
	long long c1 = K / 2, c2 = K - c1;
	long long d1 = solve_1(G, c1); d1 *= modpow(G, c2, mod);
	long long d2 = solve_1(G, c2);
	long long d = (d1 + d2) % mod;
	Map1[K] = d + 1;
	return d;
}

long long solve_2(long long G, long long K) {
	// 係数が [0, 1, 2, 3, 4, ..., K - 1] のとき
	if (K == 1) return 0;
	if (Map2[K] >= 1) return Map2[K] - 1;

	long long c1 = K / 2, c2 = K - c1;
	long long d1 = solve_2(G, c1); d1 *= modpow(G, c2, mod);
	long long d2 = solve_2(G, c2); d2 += solve_1(G, c2) * (c1 % mod);
	long long d = (d1 + d2) % mod;
	Map2[K] = d + 1;
	return d;
}

long long hosei(long long r) {
	if (r >= 10000000LL * mod2) r = 10000000LL * mod2 + (r % mod2);
	return r;
}

int main() {
	cin >> L >> A >> B >> mod;
	init();

	long long val = 1, LA = A, LB = B * (L - 1LL) + A;
	for (int t = 1; t <= 18; t++) {
		long long val1 = val * 1LL;
		long long cl = 0; if (LA <= val1 && val1 <= LB) { cl = (val1 - A + B - 1) / B; }
		long long val2 = val * 10LL - 1LL;
		long long cr = L - 1; if (LA <= val2 && val2 <= LB) { cr = (val2 - A) / B; }

		if (cl <= cr && !(val2 < LA || LB < val1)) {
			Map1.clear(); Map2.clear();
			long long V1 = solve_1(val * 10LL, cr - cl + 1);
			long long V2 = solve_2(val * 10LL, cr - cl + 1);
			long long U = cl * B + A;
			long long C1 = V1 * (U % mod) % mod;
			long long C2 = V2 * (B % mod) % mod;
			ans[t] = (C1 + C2) % mod;
			num[t] = (cr - cl + 1);
		}
		val = val * 10LL;
	}

	long long rem = 0, dig = 0;
	for (int i = 18; i >= 1; i--) {
		rem += ans[i] * modpow(10LL, dig, mod);
		rem %= mod;
		dig += 1LL * i * hosei(num[i]);
		dig = hosei(dig);
	}
	cout << rem << endl;
	return 0;
}

Measured memory_bytes: 256
import collections
n = int(input())
a = list(map(int, input().split()))

rec_hen = 0
#a_set = sorted(set(a), reverse=True)
acc = collections.Counter(a)
ssa = sorted(acc.items(), key=lambda x: x, reverse=True)
for i, c in ssa:
  if c >= 4:
    if rec_hen != 0:
      print(rec_hen * i)
      exit(0)
    print(i * i)
    exit(0)
  if c >= 2:
    if rec_hen != 0:
      print(rec_hen * i)
      exit(0)
    rec_hen = i

print(0)

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

int pow(int a, int n, int mod){
	if (a == 0 && n != 0) return 0;
	if (n == 0) return 1;
	else if (n % 2 == 0){
		int t = pow(a, n/2, mod);
		return (t*t) % mod;
	}
	else return (a*pow(a, n-1, mod)) % mod;
}

int div(int n, int d, int mod){
	return (n*pow(d, mod-2, mod)) % mod;
}

int p, p1, s, b;
vector<int> a, f, c;

int main(){
	cin >> p;
	a.resize(p);
	f.resize(p);
	c.resize(p);
	for (int i = 0; i < p; ++i) cin >> a[i];
	f[0] = 1;
	for (int i = 1; i < p; ++i) f[i] = div(f[i-1], i, p);
	p1 = pow(f[p-1], p-2, p);
	for (int i = 0; i <= p/2; ++i) c[i] = c[p-i-1] = div(div(p1, f[i], p), f[p-i-1], p);
	printf("%d ", a[0]);
	for (int i = 1; i < p; ++i){
		b = 0; s = 1 - 2*((p-i) % 2);
		for (int j = 0; j < p; ++j){
			if (a[j]) b = (b + pow(j, p-i-1, p)) % p;
		}
		b = s*((b*c[i]) % p);
		printf("%d ", (b + p) % p);
	}
}

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

using namespace std;

#define endl '\n'

typedef long long int64;
typedef pair<int,int> pii;
typedef vector<int> vi;

const int oo = 0x3f3f3f3f;
const double eps = 1e-9;
const int maxn = 100000 + 10;

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

#ifdef MARX
	freopen("data.in", "r", stdin);
	// freopen("data.out", "w", stdout);
#endif

	int n; cin >> n;
	vector<int64> val(2 * n);
	for (int i = 0; i < 2 * n; ++i)
		cin >> val[i];
	sort(val.begin(), val.end());
	int64 answer = 0;
	for (int i = 0; i < n; ++i)
		answer += val[ 2 * i ];
	cout << answer << endl;

	return 0;
}

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

public class Main {
    public static void main(String[] args) {
        FastScanner fs = new FastScanner(System.in);
        int N = fs.nextInt(), M = fs.nextInt(), C = fs.nextInt(), answer = 0, tmp;
        int[] B = new int[M];
        for(int i = 0; i < M; i++) B[i] = fs.nextInt();
        for(int i = 0; i < N; i++) {
            tmp = 0;
            for(int j = 0; j < M; j++) tmp += fs.nextInt() * B[j];
            if(tmp + C > 0) answer++;
        }
        System.out.println(answer);
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }
    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                    throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) a[i] = nextLong();
        return a;
    }

}

Measured memory_bytes: 21204
#include <stdio.h>
 int main(){ 
   int a,b;scanf("%d%d",&a,&b); 
   if(a<b){ 
     for(int i=0;i<b;i++)printf("%d",a); 
   }else{ 
     for(int i=0;i<a;i++)printf("%d",b); 
   } 
   printf("\n"); 
 }


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,a,max=-1;
    cin>>n;
    std::deque<int> num;
    for (int i=0;i<n;i++) {
        cin>>a;
        num.emplace_back(a);
    }
    for (int j=0;j<n-1;j++) {
        for (int k=j+1;k<n;k++) {
            int tmp=num[j]*num[k];
            string s=to_string(tmp);
            int flag=0;
            for (int l=0;l<s.size()-1;l++) {
                if (s.at(l)+1!=s.at(l+1)+0) {
                    flag=1;
                    break;
                }
            }
            if (flag==0) {
                if (max<tmp) {
                    max=tmp;
                }
            }
        }
    }
    cout<<max<<endl;
}



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

int N, M;
vector<int> P;

int main(void) {
	cin >> N >> M;
	P.resize(N + 1, 0);

	bool f_ans = false;
	for (int i = 0; i < M; ++i) {
		int a, b;
		cin >> a >> b;
		if (a == 1) {
			++P[b];
			if (P[b] == 2)
				f_ans = true;
		}
		if (b == N) {
			++P[a];
			if (P[a] == 2)
				f_ans = true;
		}
	}

	if (f_ans)
		cout << "POSSIBLE\n";
	else
		cout << "IMPOSSIBLE\n";
	return 0;
}


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

using namespace std;

#define ll long long 
#define Coming ios_base :: sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

int  arr[100005];

int main()
{
	Coming 
	
	int n, m, a, b;
	
	cin >> n >> m;
	
	for(int i = 1; i <= m; i++)
	{
		cin >> a >> b;
		
		arr[a]++;
		arr[b+1]--;
	}
	
	arr[0] = 0;
	int coun = 0;
	
	for(int i = 1; i <= n; i++)
	{
		arr[i] += arr[i-1];
		if(arr[i] == m) coun++;
	}
	
	cout << coun << endl;
	
	
	return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
int main(void) {
	int m, d;
	scanf("%d %d", &m, &d);
	if (d < 10) {
		printf("0\n");
		return 0;
	}
	else {
		int cnt = 0;
		int d10 ;
		int d1;
		for (int j = 1; j <= m; j++) {
			for (int i = 10; i <= d; i++) {
				d10 = i / 10;
				d1 = i % 10;
				//printf("%d %d\n", d10, d1);
				if (d10 >= 2 && d1 >= 2 && d10 * d1 == j) {
					cnt++;
				}
			}
		}
		printf("%d\n", cnt);
		return 0;
	}
	
}

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

using namespace std;

int main(){
    // int and long long
    int n;
    cin>>n;
    vector<int> h(n);
    for(int i=0;i<n;i++)
        cin>>h[i];
    vector<int> dp(n);
    dp[0]=0;
    dp[1]=abs(h[0]-h[1]);
    for(int i=2;i<n;i++){
        dp[i] = min(dp[i-1] + abs(h[i-1] - h[i]),
                dp[i-2] + abs(h[i-2] - h[i]));
    }
    cout<<dp[n-1]<<"\n";
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  vector<int> x1(n), y1(n), x2(n), y2(n);
  vector<int> X,Y;
  rep(i,n) {
    cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
    X.push_back(x1[i]);
    X.push_back(x2[i]);
    Y.push_back(y1[i]);
    Y.push_back(y2[i]);
  }
  sort(X.begin(), X.end());
  sort(Y.begin(), Y.end());
  X.erase(unique(X.begin(),X.end()),X.end());
  Y.erase(unique(Y.begin(),Y.end()),Y.end());

  int xs = X.size();
  int ys = Y.size();

  vector< vector<int> > imos(xs, vector<int>(ys));
  rep(i,n) {
    x1[i] = lower_bound(X.begin(), X.end(), x1[i]) - X.begin();
    x2[i] = lower_bound(X.begin(), X.end(), x2[i]) - X.begin();
    y1[i] = lower_bound(Y.begin(), Y.end(), y1[i]) - Y.begin();
    y2[i] = lower_bound(Y.begin(), Y.end(), y2[i]) - Y.begin();
    imos[x1[i]][y1[i]]++;
    imos[x1[i]][y2[i]]--;
    imos[x2[i]][y1[i]]--;
    imos[x2[i]][y2[i]]++;
  }
  rep(i,xs) rep(j,ys-1) imos[i][j+1] += imos[i][j];
  rep(i,xs-1) rep(j,ys) imos[i+1][j] += imos[i][j];

  ll ans = 0;
  rep(i,xs-1) rep(j,ys-1) {
    if (imos[i][j]==0) continue;
    ans += (ll)(X[i+1]-X[i])*(Y[j+1]-Y[j]);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 65664
#include <bits/stdc++.h>
#define LLI long long int
#define FOR(v, a, b) for(LLI v = (a); v < (b); ++v)
#define FORE(v, a, b) for(LLI v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(LLI v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define popcount __builtin_popcount
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(...) ((void)0)
#endif

#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}

struct Init{
  Init(){
    cin.tie(0);
    ios::sync_with_stdio(false);
  }
}init;

int main(){
  int n;
  while(cin >> n){
    vector<int> a(n); cin >> a;

    vector<int> ord(n);
    iota(ALL(ord), 0);

    sort(ALL(ord), [&](int i, int j){return a[i] < a[j];});

    REP(i,n){
      cout << ord[i]+1 << " "; 
    }
    cout << endl;
  }


  return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <cstdio>
#define N 100005
using namespace std;

int n, k, ans, sc[150];
bool v[N];
string a;
int main()
{
	int i;
	cin >> n >> k >> sc['s'] >> sc['p'] >> sc['r'] >> a;
	for (i = 0; i < n; i++) {
		if (i >= k && !v[i - k] && a[i] == a[i - k]) v[i] = 1;
		else ans += sc[a[i]];
	}
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
  int i,n,k,cnt;
  while(cin>>n){
    if(n==0) break;
    int chk=0,cnt=0;
    for(i=0;i<n;++i){
      cin>>k;
      if(k!=0&&k!=1) chk=1;
      if(k!=0) cnt++;
    }
    if(n==1) cout<<2<<endl;
    else if(chk==0) cout<<"NA\n";
    else cout<<cnt+1<<endl;
  }
  return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<vector<int>> nn(10, vector<int>(10, 0));
  for (int i = 1; i <= N; i++) {
    int tmp1 = i;
    while (tmp1 >= 10) {
      tmp1 /= 10;
    }
    int tmp2 = i%10;
    nn[tmp1][tmp2]++;
  }
  int res = 0;
  for (int i = 1; i < 10; i++) {
    for (int j = 1; j < 10; j++) {
      res += nn[i][j]*nn[j][i];
    }
  }
  cout << res << endl;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using static System.Console;
using System.Numerics;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {
            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }


        public static long Gcd(long x,long y)
        {
            if (x < y) Gcd(y, x);
            while (y > 0)
            {
                var z = x;
                x = y;
                y = z % y;
            }
            return x;
        }

        public static long Lcm(long x,long y)
        {
            return x * y / Lcm(x, y);
        }


        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var n = Read();
            var h = Reads();
            var f = true;
            long ans = 0;
            while (f)
            {
                var c = 0;
                var g = 0;
                for (int i = 0; i < n; i++)
                {
                    if (h[i] != 0) c++;
                    else if (c != 0)
                    {
                        g = i;
                        break;
                    }
                    else if (i == n - 1) f = false;
                    g = i+1;
                }
                
                for (int i = g-c; i < g; i++)
                {
                    h[i]--;
                }
                if (f) ans++;
            }
            WriteLine(ans);



            Console.Out.Flush();
        }
    }
}



Measured memory_bytes: 18980
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007

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

int n,m;
int c[25];
vector<vector<int>> dp(25,vector<int>(50005,INF));

int main(){
  cin >> n >> m;
  rep(i,1,m+1) cin >> c[i];
  sort(c,c+m+1);
  rep(i,0,n+1){
    dp[1][i] = i;
  }
  rep(i,2,m+1) rep(j,0,n+1){
    int u=INF;
    if(j-c[i] >= 0) u = min(u,dp[i][j-c[i]]+1);
    dp[i][j] = min(dp[i-1][j],u);
  }
  cout << dp[m][n] << endl;
  return 0;
}



Measured memory_bytes: 7736