akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

struct cell {
    ll point = 0;
    ll num = 0;
};
bool v_cmp(const struct cell &p, const struct cell &q) { return p.num > q.num; }
// sort(v.begin(), v.end(), v_cmp); // small to large

int main() {
    ll H, W, M;
    cin >> H >> W >> M;

    map<ll, ll> field;
    vector<ll> f_h(H, 0);
    vector<ll> f_w(W, 0);
    for (int i = 0; i < M; i++) {
        ll h, w;
        cin >> h >> w;
        field[W * (h - 1) + w - 1] = 1;
        f_h[h - 1]++;
        f_w[w - 1]++;
    }

    vector<cell> h_cell(H);
    for (int i = 0; i < H; i++) {
        struct cell tmp;
        tmp.point = (ll)i + 1;
        tmp.num = f_h[i];
        h_cell[i] = tmp;
    }
    sort(h_cell.begin(), h_cell.end(), v_cmp);

    vector<cell> w_cell(W);
    for (int i = 0; i < W; i++) {
        struct cell tmp;
        tmp.point = (ll)i + 1;
        tmp.num = f_w[i];
        w_cell[i] = tmp;
    }
    sort(w_cell.begin(), w_cell.end(), v_cmp);

    // for (int i = 0; i < H; i++) {
    // cout << i << " " << h_cell[i].num << " " << h_cell[i].point << endl;
    // }

    // int h = 0;
    // int w = 0;
    ll max = 0;

    for (int h = 0; h < H; h++) {
        for (int w = 0; w < W; w++) {
            if (h_cell[h].num + w_cell[w].num < h_cell[0].num + w_cell[0].num) {
                break;
            }
            ll exp;
            if (field[W * (h_cell[h].point - 1) + w_cell[w].point - 1] != 1) {
                exp = h_cell[h].num + w_cell[w].num;
                if (exp > max) {
                    max = exp;
                }
                break;
            } else {
                exp = h_cell[h].num + w_cell[w].num - 1;
            }
            if (exp > max) {
                max = exp;
            }
        }
        if (h_cell[h].num + 1 < h_cell[0].num) break;
    }

    // while (h_cell[h].num + w_cell[w].num + 1 >= h_cell[0].num +
    // w_cell[0].num) { ll exp; if (field[W * (h_cell[h].point - 1) +
    // w_cell[w].point - 1] != 1) { exp = h_cell[h].num + w_cell[w].num;
    // } else {
    // exp = h_cell[h].num + w_cell[w].num - 1;
    // }
    // if (exp > max) {
    // max = exp;
    // }
    // if (h > w) {
    // w++;
    // } else {
    // h++;
    // }
    // if (h >= H) {
    // h--;
    // w++;
    // }
    // if (w >= W) {
    // w--;
    // h++;
    // }
    // if (h >= H || w >= W || M == H * W) {
    // break;
    // }
    // }

    cout << max << endl;

    return 0;
}


Measured memory_bytes: 54752
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);
#define FO cout.tie(NULL);
#define FI cin.tie(NULL);
#define IN cin>>
#define OUT cout<<
#define loop(i,a,n) for(ll i=a; i<n; i++)
#define rloop(i,a,n) for(int i=a; i>=n; i--)
#define endl "\n";
#define pb push_back
#define mp make_pair
#define set_bits(a) __builtin_popcountll(a)
#define ll long long int
#define ld long double
#define vll vector<long long int>
#define pll pair<long long int, long long int>
#define mod 1000000007
#define M 998244353
ll gcd(ll a, ll b)
{
    return (b?gcd(b,a%b):a);
}
ll P(ll B, ll power, ll modulo)
{
    ll ans=1LL;
    while(power>0LL)
    {
        if(power%2LL==1LL)
        {
            ans=(ans*B)%modulo;
        }
        B=(B*B)%modulo;
        power/=2LL;
    }
    return ans;
}
bool isPrime(ll n)
{
    if(n<=1LL)
    {
        return false;
    }
    if(n<=3LL)
    {
        return true;
    }
    if(n%2==0LL || n%3==0LL)
    {
        return false;
    }
    for(ll i=5LL; (i*i)<=n; i+=6LL)
    {
        if(n%i==0LL || n%(i+2LL)==0LL)
        {
            return false;
        }
    }
    return true;
}
using namespace std;
bool sortbysec(const pair<pair<int,int>,int> &a, const pair<pair<int,int>,int> &b)
{
    return (a.first.second<b.first.second);
}
bool sortbysecll(const pll &a, const pll &b)
{
    return (a.second>b.second);
}
ll modinv(ll x, ll y, ll modulo)
{
    return ((x%modulo)*(P(y,modulo-2LL,modulo)%modulo))%modulo;
}
void vok()
{
    FAST
    FO
    FI
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt","r",stdin);
    //     freopen("output.txt","w",stdout);
    // #endif
}
int main()
{
    vok();
    ll x;
    IN x;
    pll ans;
    map<ll,bool> powers;
    map<ll,ll> m;
    loop(i,0,4000)
    {
        m[i*i*i*i*i]=i;
        powers[i*i*i*i*i]=1;
    }
    loop(j,0,3500)
    {
        if(powers[x+(j*j*j*j*j)])
        {
            ans={m[x+(j*j*j*j*j)],j};
            break;
        }
        if(powers[x-(j*j*j*j*j)])
        {
            ans={m[x-(j*j*j*j*j)],-j};
            break;
        }
    }
    OUT ans.first<<" "<<ans.second<<endl
    return 0;
}

Measured memory_bytes: 4172
n = int(input())
red = [tuple(map(int, input().split())) for _ in range(n)]
blue = [tuple(map(int, input().split())) for _ in range(n)]
red.sort()
blue.sort()
#greedy
ret = 0
used = set()
for x, y in blue:
    koho = -1
    mostright = -1
    for i in range(len(red)):
        if i not in used:
            if red[i][0] >= x:
                break
            elif y > red[i][1] > mostright:
                koho = i
                mostright = red[i][1]
    if koho != -1:
        ret += 1
        used.add(koho)
print(ret)

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

int main() {
  string s;
  cin >> s;
  int r = 0;
  string a, b;
  for (auto e : s) {
    b.push_back(e);
    if (a != b) {
      r++;
      a = b;
      b.clear();
    }
  }
  cout << r << endl;
}


Measured memory_bytes: 640
n,x = map(int,input().split())
a = list(map(int,input().split()))

a = sorted(a)

count = 0
for i in range(n):
    if x-a[i] >= 0 :
        count+=1
        x = x-a[i]
    elif x-a[i] < 0:
        print(count)
        exit()
    
if not x == 0 :
    print(count-1)    
    exit()
print(count)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
using namespace std;
int main() {
  int k, ans = 0;std::cin >> k;
  vector<int> num(k+1, 0);
  for(int i=k;i>0;i--){
    num[i] += (k/i)*(k/i)*(k/i);
    for(int j=2;j*j<=i;j++){
      if(i%j!=0) continue;
      num[j] -= num[i];
      if(j*j!=i) num[i/j] -= num[i];
    }
    if(i!=1) num[1] -= num[i];
    ans += num[i] * i;
  }
  std::cout << ans << '\n';
}


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

typedef long long int lli;
typedef long double lld;
typedef long long ll;
//Datatype
#define vi vector<int>
#define vlli vector<long long int>
#define vvi vector<vector<int>>
#define vvlli vector<vector<long long int>>
#define ppi pair<int, int>
#define rppi pair<int, pair<int, int>>
#define lppi pair<pair<int, int>, int>
#define vppi vector<pair<int, int>>
#define sppi stack<pair<int int>>
#define qppi queue<pair<int, int>>
//function
#define f first
#define s second
#define pb(x) push_back(x)
#define mkp(i, j) make_pair(i, j)
#define lmkp(i,j,k) make_pair(make_pair(i,j),k)
#define rmkp(i,j,k) make_pair(i,make_pair(j,k))
//loop
#define loop(i,n) for (i = 0; i < n; ++i)
#define loops(i,k,n) for (i = k; i <= n; ++i)
#define looprev(i,k,n) for (i = k; i >= n; --i)
//Const
#define inf (int)1e9
#define eps 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
//Print
#define prd(n) printf("%d", n)
#define prl(n) printf("%lld", n)
#define prdn(n) printf("%d\n", n)
#define prln(n) printf("%lld\n", n)
#define prf(n) printf("%f", n)
//Scan
#define scd(n) scanf("%d", &n)
#define scd2(a, b) scanf("%d %d", &a, &b)
#define scd3(a, b, c) scanf("%d %d %d", &a, &b, &c)
#define scl(n) scanf("%lld", &n)
#define scl2(a, b) scanf("%lld %lld", &a, &b)
#define scl3(a, b, c) scanf("%lld %lld %lld", &a, &b, &c)
#define scf(n) scanf("%f", &n)

using namespace std;
int dp[110000][3];
int vacation(int N, vector<int> A, vector<int> B, vector<int> C){
    int i, j, k, res = 0;
    loop(i, N){
        loop(j, 3){
            if(i == 0){
                if(j == 0) dp[i][j] = A[i];
                else if(j == 1) dp[i][j] = B[i];
                else dp[i][j] = C[i];
            }
            else{
                loop(k, 3){
                    if(j == k) continue;
                    if(j == 0) dp[i][j] = max(dp[i][j], dp[i-1][k]+A[i]);
                    else if(j == 1) dp[i][j] = max(dp[i][j], dp[i-1][k]+B[i]);
                    else dp[i][j] = max(dp[i][j], dp[i-1][k]+C[i]);

                }
            }
        }
    }
    res = max(dp[N-1][0], max(dp[N-1][1], dp[N-1][2]));
    return res;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli i, j, N;
    cin>>N;
    vector<int> a(N, 0), b(N, 0), c(N, 0);
    loop(i, N){
        cin>>a[i]>>b[i]>>c[i];
    }
    int res = vacation(N, a, b, c);
    cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 6800
#include<iostream>
#include<iomanip>
#include<queue>
#include<string>
#include<stack>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cassert>
#include<ctime>
#include<algorithm>
#include<utility>
#include<map>
#include<set>
#include<vector>
#include<functional>

using namespace std;

typedef  long long           ll;
typedef  unsigned            ui;
typedef  unsigned long long  ull;
typedef  pair<int,int>       i_i;
typedef  pair<ll,int>        ll_i;
typedef  pair<ll,ll>         ll_ll;
typedef  pair<double,int>    d_i;
typedef  pair<double,double> d_d;

#ifdef DEBUG
#define dprintf      printf
#define dputs        puts
#define dout(x)      cout<<#x" = "<<(x)<<endl
#define darray(x,n)  {int i;rep(i,n)cout<<#x"["<<i<<"] = "<<*((x)+i)<<endl;}
#define dloop(i,s,g) for(int (i)=(s);(i)<(g);(i)++)
#define drep(i,n)    for(int (i)=0;(i)<(n);(i)++)
#define dstop()      scanf("%*c")
#else
#define dprintf      (1)?0:printf
#define dputs        (1)?0:puts
#define dout(x)
#define darray(x,n)
#define dloop(i,s,g) if(int i=0){}else
#define drep(i,n)    if(int i=0){}else
#define dstop()
#endif

#define F    first
#define S    second
#define pb   push_back
#define mp   make_pair

#define loop(i,s,g) for((i)=(s);(i)<(g);(i)++)
#define rep(i,n)    for((i)=0;(i)<(n);(i)++)
#define all(x)      (x.begin(),x.end())
#define in(T,...) T __VA_ARGS__; impl(__VA_ARGS__)
#define array(T,id,n) T id[(n)]; for(int i=0;i<(n);i++)cin>>id[i]
#define putv(n)     cout<<(n)<<endl

//#define int long long
#ifndef int
#define INF __INT32_MAX__
#else
#define INF __INT64_MAX__
#endif

void impl(){};
template <typename T,typename... TS >
void impl(T &head,TS &... tail)
{
  cin>>head;
  impl(tail ...);
}

signed main(void)
{
  in(int,a,b,h);
  cout<<(a+b)*h/2<<endl;
  return 0;
}


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

int main(){

    int n ,i ;
    cin >> n;

    int v[n];
    int c[n];
    int ans = 0;

    for( i = 0; i < n; i++)
    {
        cin >> v[i];
    }
    
    for( i = 0; i < n; i++)
    {
        cin >> c[i];
    }

    for( i = 0; i < n; i++)
    {
        if (v[i] - c[i] > 0) {
            ans += (v[i] - c[i]);
        }
        
    }
    
    cout << ans <<endl;

    return 0;

}




Measured memory_bytes: 256
void main() {
	// ((A, B) => A > B ? "GREATER" : A < B ? "LESS" : "EQUAL")(BigInt(rs), BigInt(rs)).writeln;
	auto A = rs, B = rs;
	if(A.length == B.length) {
		if(A[0] > B[0]) writeln("GREATER");
		else if(A[0] == B[0]) writeln("EQUAL");
		else writeln("LESS");
	} else {
		if(A.length > B.length) writeln("GREATER");
		else writeln("LESS");
	}
}

// ===================================

import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


Measured memory_bytes: 256
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class Main {
	
	
	
	public static void main(String[] args) {
		
		Scanner s = new Scanner(System.in);
		long r = s.nextInt();
		long g = s.nextInt();
		long b = s.nextInt();
		long k = s.nextInt();
		
		int flag=0;
		for(int i=0;i<=k;i++) {
			for(int j=0;j<=k;j++) {
				for(int l=0;l<=k;l++) {
					if(i+j+l==k) {
						long r1 = r*(int)Math.pow(2, i);
						long g1 = g*(int)Math.pow(2, j);
						long b1 = b*(int)Math.pow(2, l);
						
						if(r1<g1 && g1<b1) {
							//System.out.println(r1+" "+g1+" "+b1);
							System.out.println("Yes");
							flag=1;
							break;
						}
					}
					
				}
				if(flag==1) {
					break;
				}
			}
			if(flag==1)
				break;
		}
		
		if(flag==0) {
			System.out.println("No");
		}
		
	}

}

Measured memory_bytes: 35796
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
class Solve{
    public Solve(){}
    StringBuilder sb;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        string S = Console.ReadLine();
        int N = S.Length;
        int[,] D = new int[N+1,26];
        int[] DM = new int[N+1];
        for(int i=0;i<26;i++){
            D[N,i] = N;
        }
        DM[N] = N;
        for(int i=N-1;i>=0;i--){
            int max = 0;
            for(int j=0;j<26;j++){
                if((S[i] - 'a') == j){
                    D[i,j] = i;
                }
                else{
                    D[i,j] = D[i+1,j];
                }
                max = Math.Max(max,D[i,j]);
            }
            DM[i] = max;
        }
        int[] A = new int[N+2];
        for(int i=N-1;i>=0;i--){
            if(DM[i] == N){
                A[i] = 1;
            }
            else if(DM[i] == N-1){
                A[i] = 2;
            }
            else{
                A[i] = A[DM[i]+1]+1;
            }
        }
        A[N] = -1;
        int L = A[0];
        int count = L;
        int p = 0;
        for(int i=0;i<L;i++){
            for(int j=0;j<26;j++){
                bool b = false;
                if(D[p,j] == N){
                    b = true;
                }
                else if(D[p,j] == N-1 && count == 2){
                    b = true;
                }
                else if(A[D[p,j]+1]+1 == count){
                    b = true;
                }
                if(b){
                    p = D[p,j]+1;
                    sb.Append((char)('a'+j));
                    count--;
                    break;
                }
            }
        }
        sb.Append("\n");
    }
}

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

double noudo(int a , int b){
  return (double)(100*b)/(a+b);
}


int main(){
  int a,b,c,d,e,f;
  double best = -1;
  double thr;
  int total,sug;
  cin >> a >> b >> c >> d >> e >> f;
  thr = noudo(100,e);
  // O(2N)
  int vol = f;
  for(int i = 1; vol-a*100*i>=0; i++){
    int res = vol - 100 * a * i;
    for(int j = 0; res - c*j >=0 && thr >= noudo(a*100*i,c*j); j++){
      int res_c = res - c*j;
      for(int k = 0; res_c - d*k >=0 && thr >= noudo(a*100*i,d*k+c*j); k++){
        double rel = noudo(100*a*i,c*j+d*k);
        if(rel > best){
          best = rel;
          total = 100*a*i+d*k+c*j;
          sug = d*k+c*j;
        }
      }
    }
  }
  for(int i = 1; vol-b*100*i>=0; i++){
    int res = vol - 100 * b * i;
    for(int j = 0; res - c*j >=0 && thr >= noudo(b*100*i,c*j); j++){
      int res_c = res - c*j;
      for(int k = 0; res_c - d*k >=0 && thr >= noudo(b*100*i,d*k+c*j); k++){
        double rel = noudo(100*b*i,c*j+d*k);
        if(rel > best){
          best = rel;
          total = 100*b*i+d*k+c*j;
          sug = d*k+c*j;
        }
      }
    }
  }
  cout << total << " " << sug << endl;
}


Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cstdio>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <cctype>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define fr first
#define sc second
#define mp make_pair

#define PREV(c, d) ((c - d + 4) % 4)
#define NEXT(c, d) ((c + d) % 4)

typedef long long int64;
typedef pair< int, int > iP;
typedef pair< iP, iP > iiP;

const int INF = 2 << 28;
const double EPS = 1e-10;

int h, w, mas[31][31], cost[4];
// > v < ^
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};

int dijkstra() {
    priority_queue< iiP, vector< iiP >, greater< iiP > > que;
    int costed[31][31][4];
    que.push(iiP(iP(0, 0),iP(0, 0)));
    costed[0][0][0] = 0;
    fill_n(**costed, 31 * 31 * 4, INF);
    while(!que.empty()) {
        iiP p = que.top(); que.pop();
        int x = p.sc.fr, y = p.sc.sc, dir = p.fr.sc, c = p.fr.fr;
        if(x == w - 1 && y == h - 1) return c;
        for(int i = 0; i < 4; i++) {
            int nd = NEXT(dir, i);
            int nc = (i == mas[y][x] ? c : cost[i] + c);
            int nx = x + dx[nd], ny = y + dy[nd];
            if(0 <= nx && nx < w && 0 <= ny && ny < h && nc < costed[nx][ny][nd]) {
                que.push(iiP(iP(nc, nd), iP(nx, ny)));
                costed[nx][ny][nd] = nc;
            }
        }
    }
    return -1;
}

int main() {

    while(cin >> w >> h, w) {
        for(int i = 0; i < h; i++)
            for(int j = 0; j < w; j++)
                cin >> mas[i][j];

        for(int i = 0; i < 4; i++)
            cin >> cost[i];

        cout << dijkstra() << endl;
    }
}

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

int main() {
int a,b,c,k,ans;
  cin>>a>>b>>c>>k;
  ans=0;
  while(a>=b){
  b=b*2;
    ans++;
  }
  while(b>=c){
  c=c*2;
    ans++;
  }
  if(ans>k){cout<<"No"<<endl;}
  else{cout<<"Yes"<<endl;}
}

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

int main() {
    string A, B, C;
    cin >> A >> B >> C;
    if (A[A.size()-1] == B[0] && B[B.size()-1] == C[0]) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  
  int ans = 0;
  
  if(S.at(0) == S.at(1)){
  	if(S.at(2) == S.at(3) && S.at(0) == S.at(2)){
    	ans = 0;
    }else if(S.at(2) == S.at(3)){
    	ans = 1;
    }
  }else if(S.at(0) == S.at(2)){
  	if(S.at(1) == S.at(3)){
    	ans = 1;
    }
  }else if(S.at(0) == S.at(3)){
  	if(S.at(1) == S.at(2)){
      	ans = 1;
    }
  }
  
  if(ans == 1){
  	cout << "Yes" << endl;
  }else if(ans == 0){
  	cout << "No" << endl;
  }
}

Measured memory_bytes: 256
/*
    Ujjawal Pabreja [cuber_coder]
*/
#include <bits/stdc++.h> 
#include <functional> 
using namespace std;
#define speed_cubing    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll              long long
#define ld              long double
#define rep(i,a)        for(ll i = 0 ; i < a ; i++)
#define repe(i,a,b)     for(ll i = a ; i < b ; i++)
#define bac(i,a)        for(ll i = a ; i >= 0 ; i--)
#define bace(i,a,b)     for(ll i = a ; i >= b ; i--)
#define pb              push_back
#define in              insert
#define ff              first
#define ss              second
#define setbit(x)       __builtin_popcountll(x)
#define init(c,a)       memset(c,a,sizeof(c))
#define all(c)          c.begin(),c.end()
#define sz(c)           (ll)c.size()
#define lb              lower_bound
#define ub              upper_bound
#define maxe            *max_element
#define mine            *min_element
#define rev             reverse
#define Y				"YES"
#define N 				"NO"
#define endl            "\n"
#define debug(x)        cout << #x << " : " << x << endl;
const ll inf = 1e18;  
const ll mod = 1e9 + 7;
const ll MOD = 998244353;
const ll MAX = 2e5 + 1;

// ====== BigInt begins ======
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
// ====== BigInt ends ======

// ====== PBDS begins ======
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, 
//         tree_order_statistics_node_update> 
//         pbds; 
// ====== PBDS ends ======

// ====== Useful functions begin ======
inline ll add(ll a,ll b) {return ((a % mod) + (b % mod)) % mod;}
inline ll sub(ll a,ll b) {return ((a % mod) - (b % mod) + mod) % mod;}
inline ll mul(ll a,ll b) {return ((a % mod) * (b % mod)) % mod;}
ll pwr(ll x,ll n){
    if(n == 0){
        return 1;
    }
    if(n&1){
        return mul(x, pwr(mul(x, x), (n - 1) / 2));
    } else {
        return pwr(mul(x, x), n / 2);
    }
}
ll modInv(ll n){ 
    return pwr(n, mod - 2); 
}
ll gcd(ll a,ll b) {
    if(b == 0) {
        return a;
    }
    return gcd(b, a % b);
}
// ====== Useful functions end ======
 
// ====== Variables begin ======

// ====== Variables end ======
void speed_solve(){
    ll x;
    cin >> x;
    if(400 <= x and x <= 599) cout << 8;
    if(600 <= x and x <= 799) cout << 7;
    if(800 <= x and x <= 999) cout << 6;
    if(1000 <= x and x <= 1199) cout << 5;
    if(1200 <= x and x <= 1399) cout << 4;
    if(1400 <= x and x <= 1599) cout << 3;
    if(1600 <= x and x <= 1799) cout << 2;
    if(1800 <= x and x <= 1999) cout << 1;
}

int main(){
	// #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif
    speed_cubing;
    ll test_cases = 1;
    // cin >> test_cases;
    rep(i,test_cases){
        // cout << "Case #" << i + 1 << ": ";
        speed_solve();
    }
    return 0;
}

Measured memory_bytes: 3648
def Mul(data,start = 0 ,end = None):
    if end == None:
        end = len(data)-1
    if start == end:
        return data[start]
    else:
        mid = (start+end)//2
        A = Mul(data,start,mid)
        B = Mul(data,mid+1,end)
        return A*B
n = int(input())
data = list(map(int,input().split()))
X = Mul(data)
if X>10**18:
  print(-1)
else:
  print(X)

Measured memory_bytes: 21572
// ===================================
//   author: M_sea
//   website: http://m-sea-blog.com/
// ===================================
#include <bits/stdc++.h>
#define re register
using namespace std;

inline int read() {
    int X=0,w=1; char c=getchar();
    while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
    while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
    return X*w;
}

const int N=1000000+10;

struct Tree {
    struct edge { int v,nxt; } e[N<<1];
    int head[N];
    inline void addEdge(int u,int v) {
        static int cnt=0;
        e[++cnt]=(edge){v,head[u]},head[u]=cnt;
    }

    int dep[N],sz[N],fa[N],hson[N],top[N];
    inline void dfs1(int u,int f) {
        dep[u]=dep[fa[u]=f]+1,sz[u]=1;
        for (re int i=head[u];i;i=e[i].nxt) {
            int v=e[i].v; if (v==f) continue;
            dfs1(v,u),sz[u]+=sz[v];
            if (sz[v]>sz[hson[u]]) hson[u]=v;
        }
    }
    inline void dfs2(int u,int anc) {
        top[u]=anc;
        if (hson[u]) dfs2(hson[u],anc);
        for (re int i=head[u];i;i=e[i].nxt)
            if (e[i].v!=fa[u]&&e[i].v!=hson[u]) dfs2(e[i].v,e[i].v);
    }
    
    inline int getlca(int u,int v) {
        while (top[u]!=top[v]) {
            if (dep[top[u]]<dep[top[v]]) swap(u,v);
            u=fa[top[u]];
        }
        return dep[u]<dep[v]?u:v;
    }
    inline int getdis(int u,int v) {
        int t=getlca(u,v);
        return dep[u]+dep[v]-(dep[t]<<1);
    }
} A,B;

int n,x,y,vis[N];

inline void bfs() {
    queue<int> Q; vis[x]=1,Q.push(x);
    while (!Q.empty()) {
        int u=Q.front(); Q.pop();
        for (re int i=A.head[u];i;i=A.e[i].nxt) {
            int v=A.e[i].v; if (vis[v]) continue;
            if (A.dep[v]<B.dep[v]) vis[v]=1,Q.push(v);
        }
    }
}

int main() {
    n=read(),x=read(),y=read();
    for (re int i=1;i<n;++i) {
        int u=read(),v=read();
        A.addEdge(u,v),A.addEdge(v,u);
    }
    for (re int i=1;i<n;++i) {
        int u=read(),v=read();
        B.addEdge(u,v),B.addEdge(v,u);
    }
    A.dfs1(x,0),A.dfs2(x,x); B.dfs1(y,0),B.dfs2(y,y);
    bfs(); int ans=0;
    for (re int u=1;u<=n;++u) {
        if (!vis[u]) continue;
        for (re int i=A.head[u];i;i=A.e[i].nxt) {
            int v=A.e[i].v;
            if (B.getdis(u,v)>2) { puts("-1"); return 0; }
        }
        ans=max(ans,B.dep[u]-1);
    }
    printf("%d\n",ans<<1);
    return 0;
}


Measured memory_bytes: 68864
#include<bits/stdc++.h>
constexpr long long INFL = 1LL << 60;
constexpr int INF = 1e9;

using namespace std;

using ll = long long;

int main()
{
    int n,a;
    cin >> n >> a;
    cout << n*n-a << endl;
    return 0;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc155/tasks/abc155_d

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

void solve() {
  ll N, K;
  cin >> N >> K;

  VL as(N);
  rep(i, N) cin >> as[i];

  sort(all(as));

  // X 以下の個数が K 個以上となる最小の X が答え
  ll ok = INF + 1;
  ll ng = -ok;

  // X 以下の個数が K 個以上であるか
  auto satisfied = [&](ll X) -> ll {
    ll ct = 0;

    rep(i, N) {
      ll a = as[i];

      // かけて X 以下となる数は a が正の場合左端から、 a
      // が負の場合右端から連続している その境界を二分探索で求める
      if (a < 0) {
        ll ok = N;
        ll ng = -1;

        while (ok - ng > 1) {
          ll mid = (ok + ng) / 2;
          if (a * as[mid] <= X) {
            ok = mid;
          } else {
            ng = mid;
          }
        }

        ct += N - ok;
      } else {
        ll ok = -1;
        ll ng = N;

        while (ng - ok > 1) {
          ll mid = (ok + ng) / 2;
          if (a * as[mid] <= X) {
            ok = mid;
          } else {
            ng = mid;
          }
        }

        ct += ok + 1;
      }

      // 同じ要素は選べないがカウントされているためその分減らす
      if (a * a <= X) ct--;
    }

    // 一つのペアがそれぞれの要素のカウントで二重にカウントされているため減らす
    ct /= 2;

    return ct >= K;
  };

  while (ok - ng > 1) {
    ll mid = (ok + ng) / 2;

    if (satisfied(mid)) {
      ok = mid;
    } else {
      ng = mid;
    }
  }

  cout << ok << endl;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;

const int inf = 1e9;
const ll linf = 1LL<<60;
const ll mod = 1e9 + 7;
const double eps = 1e-9;

/*{
}*/

signed main()
{
  int n, m;
  cin >> n >> m;

  map<int, int> cnt;
  rep(i, m){
    int x, y;
    cin >> x >> y;
    cnt[x]++;
    cnt[y]++;
  }
  
  for(auto p : cnt){
    if(p.second%2 == 1){
      cout << "NO" << endl;
      return 0;
    }
  }

  cout << "YES" << endl;

  return 0;
}


Measured memory_bytes: 4352
x=input().split()
longestWord= ""
mostWord=0
currentCount=0
THEmostWord=""


for r in range (len(x)):
    if len(x[r])> len(longestWord):
        longestWord=x[r]

for j in range (len(x)):
    thing= x[j]
    currentCount=x.count(thing)
    if currentCount > mostWord:
        mostWord= currentCount
        THEmostWord=thing
        


print(THEmostWord, longestWord)

Measured memory_bytes: 7340
#include <cstdio>

bool judge(int year)
{
	if (year % 4 == 0) {
		if (year % 100 != 0) {
			return true;
		} else if(year % 400 == 0){
			return true;
		} else {
			return false;
		}
	} else {
		return false;
	}
}

int main(void){
	int s_year, e_year, n_data;
	bool flag;//うるう年があるかどうか
	n_data=0;//いくつ目のデータセットか

	while (1) {
		scanf("%d%d", &s_year, &e_year);
		if (s_year == 0 && e_year == 0) {
			break;
		}

		if (n_data != 0) {//もし最初のデータセットでなければ
			printf("\n");
		}

		flag = false;
		for (int i=s_year; i <= e_year; i++) {
			if (judge(i)) {
				printf("%d\n", i);
				flag = true;
			}
		}
		if (!flag) {//もしうるう年がなければ
			printf("NA\n");
		}

		n_data++;
	}

	return 0;
}

Measured memory_bytes: 1044
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int lli;
#define optimize ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define forab(i,a,b) for(int i = a; i<b; i++)
#define forll(i,a,b) for(lli i = a; i<b; i++)
#define mp make_pair
#define pb push_back
#define sortv(v) sort(v.begin(), v.end())
#define mod1 1000000007
#define mod2 998244353
#define debug(x) cout<<#x<<" : "<<x<<endl

int main()
{
	optimize

	int a,b;
	cin>>a>>b;
	cout<<a*b<<endl;
	return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned int uint;
vector<pair<uint, uint>> d;
// vector<pair<ll, ll>> d;
 
int main(int, char**)
{
	unsigned int n;
	ll t = 0;
	cin >> n;
	d.resize(n);
 
	for (unsigned int i = 0; i < n; i++) {
		ll a, b;
		cin >> a >> b;
		d[i].first = a + b;
		d[i].second = a;
	}
 
	sort(d.begin(), d.end(), greater<>());
 
	for (unsigned int i = 0; i < n; i++) {
		if (i % 2 == 0) t += d[i].second;
		else t -= (d[i].first - d[i].second);
	}
 
    cout << t << endl;
	return 0;
}

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

struct node{
  struct node *right;
  struct node *left;
  struct node *p;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeSearch(Node u, int k){
  if(u == NIL || k == u->key)
    return u;
  if(k < u->key)
    return treeSearch(u->left,k);
  else
    return treeSearch(u->right,k);
}

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

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y = x;
    if(z->key < x->key)
      x = x->left;
    else x = x->right;
  }
  z->p = y;
    
    if(y == NIL)
      root = z;
    else if(z->key < y->key)
      y->left = z;
    else
      y->right = z;
}

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


int main(){
  int n, i, x;
  char com[20];
  Node t;
  scanf("%d", &n);
  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    }
    else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    }
    else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  
  return 0;
}



Measured memory_bytes: 20452
#include <iostream>
#include <vector>
#define rep(i,n) for(int (i)=0;(i)<(n);++(i))
#define all(x) (x).begin(),(x).end()
#define dump(x) cout << #x << " = " << (x) << endl

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

const int INF = 1001001001;
vector<int> di = {1, 0};
vector<int> dj = {0, 1};


int main() {
    int h, w; cin >> h >> w;
    vector<vector<int>> a(h, vector<int>(w, 0));
    rep(i, h)rep(j, w) cin >> a[i][j];

    int cnt = 0;
    vector<P> mae, ato;
    rep(i, h) rep(j, w) {
        rep(dir, 2) {
            if (a[i][j] % 2 == 0) continue;
            int ni = i + di[dir], nj = j + dj[dir];

            if (ni < 0 || ni >= h || nj < 0 || nj >= w) continue;
            cnt++;
            a[i][j]--;
            a[ni][nj]++;
            mae.emplace_back(i, j);
            ato.emplace_back(ni, nj);
            break;
        }
    }
    cout << cnt << endl;
    rep(i, mae.size()) {
        cout << mae[i].first + 1 << " " << mae[i].second + 1 << " " << ato[i].first + 1 << " " << ato[i].second + 1 << endl;
    }
}

Measured memory_bytes: 5228
Problem = Struct.new(:cup_count, :swap_limit, :trays) do
  def solve
    steps = dive(0, trays)[0]
    p steps > swap_limit ? -1 : steps
  end
  
  private
  
  def dive(swap_count, trays)
    # p [:dive, swap_count, trays]
    
    if swap_count > swap_limit
      return swap_count, trays
    end
  
    lesser, max = lesser_and_max(trays)
    lesser == max and raise "assertion failed: lesser != max"
    max.nil? and raise "assertion failed: !max.nil?"
    
    if lesser.nil?
      if max == 1
        count, moved = move(max, 0, trays)
        return count + swap_count, trays
      else
        return swap_count, trays
      end
    end
  
    other = ([0, 1, 2] - [max, lesser])[0]
    
    if max == 1
      c1, t1 = move(max, other, trays)
      c2, t2 = move(lesser, max, t1)
      way1 = dive swap_count + c1 + c2, t2
      
      c3, t3 = move(max, lesser, trays)
      way2 = dive swap_count + c3, t3
      
      if way1[0] < way2[0]
        way1
      else
        way2
      end
    else
      c1, t1 = move1(lesser, other, trays)
      c2, t2 = move(max, other, t1)
      way1 = dive swap_count + c1 + c2, t2
      
      c3, t3 = move(max, lesser, trays)
      way2 = dive swap_count + c3, t3
      
      if way1[0] < way2[0]
        way1
      else
        way2
      end
    end
  end
  
  def lesser_and_max(trays)
    trays.each_with_index.
      sort_by {|t,i| t.last || -1 }[1..-1].
      map {|x,i| i unless x.empty? }
  end
  
  def move1(from, to, trays)
    # p [:move1, from, to, trays]
    from != to or raise "source and trays must differ"
    
    trays = trays.dup
    trays[to] = trays[to].dup.push trays[from].last
    trays[from] = trays[from][0..-2]
    
    steps = to == 1 || from == 1 ? 1 : 2
    
    return steps, trays
  end
  
  def move(from, to, trays)
    # p [:move, from, to, trays]
    from != to or raise "source and trays must differ"
    
    from_tray = trays[from]
    
    from_tray.empty? and raise "The source tray must not be empty"
    
    if from_tray.size == 1
      return *move1(from, to, trays)
    end
    
    i = from_tray.size - 1
    while from_tray[i - 1] == from_tray[i] - 1
      i -= 1
    end
  
    trays = trays.dup
    trays[to] = trays[to] + from_tray[i..-1]
    trays[from] = trays[from][0...i]
    
    steps = 3 ** (from_tray.size - i) - 1
    steps /= 2 if to == 1 || from == 1
    
    return steps, trays
  end
end

def input
  STDIN.gets.split.map &:to_i
end

while true
  n, m = input
  break if n == 0 && m == 0
  trays = Array.new(3) { input[1..-1] }
  Problem.new(n, m, trays).solve
end

Measured memory_bytes: 6140
#include<stdio.h>
#include<iostream>
using namespace std;

string s;
int main (){
    cin >> s;
    int l = s.length();
    for(int i=0; i<l; i++){
        if(i % 2 == 0) cout << s[i] ;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 512
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;



int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, m;
    long long c;
    cin >> n >> m >> c;

    vector<long long> B(m);
    for (int i = 0; i < m; ++i) {
        cin >> B[i];
    }

    int res = 0;
    for (int i = 0; i < n; ++i) {
        long long ans = 0;
        for (int j = 0; j < m; ++j) {
            long long x;
            cin >> x;
            ans += x * B[j];
        }
        ans += c;
        if (ans > 0) {
            ++res;
        }
    }

    cout << res << "\n";

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <functional>
using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define mk make_pair

template <class key, class cmp = std::less<key>>
using ordered_set = tree<key, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
const ll mod = 1e9 + 7;

/*
    if you have any question about any part of my code,
    please don't shy to ask anytime :)
*/

ll n,k;
ll x[200005];

bool get(ll mid)
{
    ll cnt=0;
    for(int i=0;i<n;i++)
    {
        cnt+=(x[i]-1)/mid;
    }

    return cnt<=k;
}

void solve()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>x[i];
    }

    ll st=1, en=1e9;
    ll ans=0;
    while(st<=en)
    {
        ll mid = (st+en)>>1;
        if(get(mid))
        {
            ans = mid;
            en = mid-1;
        }
        else
        {
            st = mid+1;
        }
    }

    cout<<ans<<endl;
}

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

    // ll t;
    // cin >> t;
    // while (t--)
    // {
    //     solve();
    // }
    solve();
    return 0;
}

Measured memory_bytes: 5092
<?php
  fscanf(STDIN, "%d%d", $n, $k);
  $A = array_map("intval", explode(" ", trim(fgets(STDIN))));
  sort($A);
  $sum = 0;
  for($i = 0; $i < $k; $i++){
    $sum+=$A[$i];
  }
echo $sum;

Measured memory_bytes: 16276
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
using namespace std;
int main() {
	int a,b,k;
    cin>>a>>b>>k;
    for(int i=min(a,b);i>=1;--i){
        if(a%i==0&&b%i==0){
            --k;
            if(k==0){
                cout<<i<<endl;
            }
        }
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		final Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		System.out.println(c >= a && c <= b ? "Yes" : "No");
	}
}

Measured memory_bytes: 22996
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
import numpy as np

K, S = MAP()

count = 0

for X in range(0, K+1):
	for Y in range(0, K+1):
		Z = S - X - Y
		if 0 <= Z <= K:
			count += 1
print(count)

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

typedef uint32_t u32;
typedef uint64_t u64;

class Solver {
public:
  Solver();
  void solve(int N, int P);
private:
  bool isprime[200000];
};

Solver::Solver() {
  for(int i = 0; i < 200000; ++i) {
    isprime[i] = true;
  }
  isprime[0] = isprime[1] = false;
  for(int i = 2; i < 2000; ++i) {
    if( isprime[i] ) {
      for(int j = i * 2; j < 200000; j+=i) {
        isprime[j] = false;
      }
    }
  }
}

void Solver::solve(int N, int P) {
  std::vector<int> can;
  for(int i = N + 1; i < std::min(N + P * 4 + 1000, 200000); ++i) {
    if( not isprime[i] ) continue;
    for(int j = i; j < std::min(N + P * 4 + 1000, 200000); ++j) {
      if( not isprime[j] ) continue;
      can.push_back(i + j);
    }
  }
  std::sort(std::begin(can), std::end(can));
  std::cout << can[P-1] << std::endl;
}


int main() {

  Solver solver;
  
  for(;;) {
    int N, P;
    std::cin >> N >> P;
    if( N == -1 and P == -1 ) break;
    
    solver.solve(N, P);
  }  
  
  return 0;
}

Measured memory_bytes: 3396
while True:
    H,W = (int(x) for x in input().split())
    
    if H == 0 and W == 0:
        break

    for i in range(H):
        for j in range(W):
            if (j == 0 or j == W-1) or (i == 0 or i == H-1):
                print ('#', end='')
            else:
                print ('.', end='')
        print ('')
    print ('')



Measured memory_bytes: 7020
package main

import (
	"fmt"
)

func gcd(a,b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a,b int) int {
	return a*b/gcd(a,b)
}

func main() {
	var a int
	var b int
	var c int
	var d int
	fmt.Scan(&a, &b, &c, &d)
	
	acnt := a-1 - (a-1)/c - (a-1)/d + (a-1)/lcm(c,d)
	bcnt := b - b/c - b/d + b/lcm(c,d)
	fmt.Println(bcnt-acnt)
}

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

typedef struct Word{
	char	word[31];
	int		page;
}	WORD;
WORD wordArray[100];

typedef int		BOOL;
#define TRUE	1;
#define FALSE	0;
BOOL is_smaller(WORD, int);

int main()
{
	int 	cnt1, cnt2;
	WORD	tempWORD;
	int		output_cnt = 0;
	char	last_print_word[31] = "";
	
	/*Input with order*/
	while(scanf("%s %d", tempWORD.word, &tempWORD.page) != EOF)
		for(cnt1 = 0; cnt1 < 100; cnt1++){
			if(wordArray[cnt1].page == 0){
				strcpy(wordArray[cnt1].word, tempWORD.word);
				wordArray[cnt1].page = tempWORD.page;
				break;
			}
			else if(is_smaller(tempWORD, cnt1)){
				for(cnt2 = 98; cnt2 >= cnt1; cnt2--){
					strcpy(wordArray[cnt2 + 1].word, wordArray[cnt2].word);
					wordArray[cnt2 + 1].page = wordArray[cnt2].page;
				}
				strcpy(wordArray[cnt1].word, tempWORD.word);
				wordArray[cnt1].page = tempWORD.page;
				break;
			}
		}
	
	/*Output*/
	while(wordArray[output_cnt].page != 0){
		if(strcmp(last_print_word, "") == 0){
			printf("%s\n", wordArray[output_cnt].word);
			strcpy(last_print_word, wordArray[output_cnt].word);
		}
		else if(strcmp(wordArray[output_cnt].word, last_print_word) != 0){
			printf("\n%s\n", wordArray[output_cnt].word);
			strcpy(last_print_word, wordArray[output_cnt].word);
		}
		else{
			printf(" ");
		}
		printf("%d", wordArray[output_cnt].page);
		output_cnt++;
	}
	printf("\n");
	
	return 0;
}

BOOL is_smaller(WORD tempWORD, int cnt)
{
	if(strcmp(tempWORD.word, wordArray[cnt].word) < 0){
		return TRUE;
	}
	else if(strcmp(tempWORD.word, wordArray[cnt].word) == 0){
		if(tempWORD.page < wordArray[cnt].page){
			return TRUE;
		}
		else{
			return FALSE;
		}
	}
	else{
		return FALSE;
	}
}

Measured memory_bytes: 640
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	n,h,w = readline() |> split |> parseMap
	s = 0
	for i in 1:n
		a,b = readline() |> split |> parseMap
		if h<=a && w<=b
			s += 1
		end
	end
	println(s)
end

main()

Measured memory_bytes: 168576
use std::io;
use std::str::FromStr;

fn input<T:FromStr>() -> T {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.trim().parse().ok().unwrap()
}

fn input_vec() -> Vec<u64> {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.split_whitespace().map(|s| s.parse().unwrap()).collect()
}

fn main() {
    let n: usize = input();
    let a_vec = input_vec();
    let mut results = vec![0u64; n];
    let mut ans: Vec<usize> = Vec::new();
    for i in (0..n).rev() {
        let mut sum = 0;
        for j in 2..n/(i+1)+1 {
            sum += results[(i+1) * j - 1];
        }
        // println!("sum = {}", sum);
        // println!("{}", a_vec[i]);
        if sum % 2 != a_vec[i] {
            results[i] = 1;
            ans.push(i+1);
        }        
    }
    println!("{}", ans.len());
    for a in ans {
        print!("{} ", a);
    }
}


Measured memory_bytes: 11132
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define ALL(a) (a).begin(),(a).end()
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

using namespace std;

int main(){
  int n;
  while(cin>>n,n){
    vector<int> four;
    for(int i=1;i*(i+1)*(i+2)/6<=n;i++){
      four.push_back(i*(i+1)*(i+2)/6);
    }
    vector<int> dp(n+1,1000000);
    dp[0]=0;
    for(int i=0;i<four.size();i++){
      for(int j=four[i];j<=n;j++){
	dp[j] = min(dp[j-four[i]] + 1,dp[j]);
      }
      /*      REP(i,n+1)cout << dp[i] << " ";
	      cout << endl;*/
	}
    cout << dp[n] << " ";
    dp.clear();
    dp.resize(n+1,10000000);
    dp[0]=0;
    for(int i=0;i<four.size();i++){
      if(four[i]%2){
	for(int j=four[i];j<=n;j++){
	  dp[j] = min(dp[j-four[i]] + 1,dp[j]);
	}
      }
      /*            REP(i,n+1)cout << dp[i] << " ";
		    cout << endl;*/
    }
 
    cout << dp[n] << endl;
  }
    return 0;
}

Measured memory_bytes: 6864
n = int(input())
for i in range(n):
    x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split())
    print('YES' if abs((x2 - x1)*(y4 - y3) - (x4 - x3)*(y2 - y1)) < 1e-10 else 'NO')

Measured memory_bytes: 6744