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

using namespace std;

#define fRead(x)        freopen(x,"r",stdin)
#define fWrite(x)       freopen (x,"w",stdout)

#define LL              long long
#define ULL             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define PI              acos(-1.0)
#define mk              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#pragma GCC target ("avx2")
#pragma GCC optimization ("O2")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define FastRead        ios_base::sync_with_stdio(0);cin.tie(nullptr);


int32_t main()
{
    int l , r , d;
    cin >> l >> r >> d;
    int ans = 0;
    for(int i = l;i <= r;i++){
        if(i % d == 0)ans++;
    }
    cout << ans << "\n";
}


Measured memory_bytes: 3676
#include <iostream>
#include <queue>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>
#include <numeric>

using namespace std;
using ll = long long;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;

vector<int> adj[51];
int as[51];
int bs[51];
int N, M;
bool visited[51];

bool search(int f, int rm1, int rm2) {
    for (auto p : adj[f]) {
        if ((f == rm1 && p == rm2) || (f == rm2 && p == rm1)) continue;
        if (visited[p]) continue;
        visited[p] = true;
        search(p, rm1, rm2);
    }
}

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

    for (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        as[i] = a;
        bs[i] = b;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }

    int ans = 0;
    for (int i = 0; i < M; i++) {
        for (int e = 0; e < N; e++) visited[e] = false;
        search(0, as[i], bs[i]);
        for (int i = 0; i < N; i++) {
            if (!visited[i]) {
                ans++; break;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline


def main():
    n, k = map(int, input().split())
    r = n
    u = []
    while(r >= k):
        s = r // k
        t = r % k
        u.append(t)
        r = s
    u.append(r)
    print(len(u))


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <cmath>
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll inf = 1000000007;
int main() {
	ll l, r;
	cin >> l >> r;
	r = min(r, l + 4038);
	ll ans = 2018;
	for (ll i = l; i <= r; i++) {
		for (ll j = i + 1; j <= r; j++) {
			ll x = i * j % 2019;
			ans = min(ans, x);
		}
	}
	cout << ans << endl;
	return 0;
}

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

bool check(const int i, const int s[], const int c[], const int n, const int m){
    string num = to_string(i);
    if(num.size() != n) return false;
    rep(i, m){
        if((num[s[i]-1] - '0') != c[i]) return false;
    }
    return true;
}

int main(){
    int n, m; cin >> n >> m;
    int s[m], c[m];
    rep(i, m) cin >> s[i] >> c[i];

    
    rep(i, 1000){
        if(check(i, s, c, n, m)) {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    set< int > a;
    for (int i = 1; i <= 9; i++) {
        for (int j = 1; j <= 9; j++) {
            a.insert(i * j);
        }
    }
    cout << (a.find(n) == a.end() ? "No" : "Yes") << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(x) begin(x),end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << " " <<
using namespace std;

const int MXN=100005;

int n,m,vis[MXN],dp[MXN];
vector<int>ord;
vector<int>adj[MXN];

void topsort(int x){
  if(vis[x])return;
  vis[x]=1;
  for(int y:adj[x])topsort(y);
  ord.push_back(x);
}

int main(){
  scanf("%d%d",&n,&m);
  for(int i=1;i<=m;++i){
    int x,y;
    scanf("%d%d",&x,&y);
    adj[x].push_back(y);
  }
  for(int i=1;i<=n;++i)topsort(i);
  for(int x:ord)for(int y:adj[x])dp[x]=max(dp[x],dp[y]+1);
  printf("%d\n",*max_element(dp,dp+n+1));
}


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

int main() {
  
  int n; 
  cin >> n;
  
  vector<int> vec(n);
  for(int i=0; i<n; i++){
    int a;
    cin >> a;
    vec.at(i) = a;
  }
  
  sort(vec.begin(), vec.end()); 
  reverse(vec.begin(), vec.end());
  
  int a = 0;
  int b = 0;
  for(int i=0; i<n; i++){
    if (i%2 == 0) a += vec.at(i);
    if (i%2 == 1) b += vec.at(i);
  }
  
  cout << a-b << endl;
  
}

Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))
ans = True
minv = 0

for i in range(len(h)-1):
    down = False
    
    if h[i] > h[i+1]:
        if h[i] - h[i+1] > 1:
            ans = False
            break
        else:
            if h[i]-1 >= minv:
                h[i] -= 1
                minv = h[i]
                down = True
            else:
                ans = False
                break
    if not down and  i!=0 and h[i-1] < h[i]:
        h[i] -= 1
        minv = h[i]


print("Yes") if ans else print("No")


Measured memory_bytes: 14396
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int n;
    cin >> n;
    vector<ll> v(n);
    for (auto &&i : v) scanf("%lld", &i);
    ll ans = 0;
    while(true){
        ll sum = 0;
        for (int i = 0; i < n; ++i) {
            sum += v[i]/n;
        }
        if(sum == 0) break;
        for (int i = 0; i < n; ++i) {
            v[i] = sum - v[i]/n + v[i]%n;
        }
        ans += sum;
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(200000)
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def fi(): return float(input())
def mfi(): return map(float, input().rstrip().split())
def lmfi(): return list(map(float, input().rstrip().split()))
def li(): return list(input().rstrip())
def debug(*args, sep=" ", end="\n"): print("debug:", *args, file=sys.stderr, sep=sep, end=end) if not __debug__ else None
def exit(*arg): print(*arg); sys.exit()
# template


def main():
    N = ii()
    n = int(N // 1.08)
    for i in range(n - 100, n + 100):
        if int(i * 1.08) == N:
            exit(i)
    print(":(")
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
var n,i,ans:longint;
var r:boolean;
var a:array[0..100020] of longint;
begin
  r:=false;
  read(n);for i:=1 to n do
  begin
    read(a[i]);
    if r then r:=false
    else if a[i]=i then begin inc(ans);r:=true;end;
  end;
  writeln(ans);
end.


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


int operation(int x, int y, const string& op) {
    if (op == "+") {
        return x + y;
    }
    else if (op == "-"){
        return x - y;
    }
    else if (op == "*"){
        return x * y;
    }
    else {
        return x / y;
    }
}

bool isOperator(const string& c) {
    if (c == "+") {
        return true;
    }
    if (c == "-") {
        return true;
    }
    if (c == "*") {
        return true;
    }
    if (c == "/") {
        return true;
    }
    return false;
}

int main() {
    string porland;
    getline(cin, porland);
    vector<string> vec;
    string tmp;
    for (auto it = porland.begin(); it != porland.end(); ++it) {
        if (*it == ' ') {
            vec.push_back(tmp);
            tmp = "";
        }
        else {
            tmp += *it;
        }
    }
    vec.push_back(tmp);

    stack<int> stack;
    for (const auto& s : vec) {
        porland.erase(porland.begin());
        if (isOperator(s)) {
            const int y = stack.top();
            stack.pop();
            const int x = stack.top();
            stack.pop();
            const int z = operation(x, y, s);
            stack.push(z);
        }
        else {
            const int z = atoi(s.c_str());
            stack.push(z);
        }
    }
    assert(stack.size()==1);
    cout << stack.top() << endl;

}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
#define rep(i, n) for(int i= 0; i < (n); i++)
using ll= long long int;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll mod= 1e9 + 7;




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

Measured memory_bytes: 3644
#include<iostream>
#include<string>

using namespace std;

string s;

int main(){
  cin >> s;
  int cnt = 0;
  while(cnt != s.length()){
    string result1 = s.substr(cnt, 7);
    //cout << result1 << endl;
    string result2 = s.substr(cnt, 6);
    string result3 = s.substr(cnt, 5);
    if(result1 == "dreamer" && s.substr(cnt, 8) != "dreamera"){
      cnt += 7;
    }else if(result2 == "eraser" && s.substr(cnt, 7) != "erasera"){
      cnt += 6;
    }else if(result3 == "dream" || result3 == "erase"){
      cnt += 5;
    }else{
      break;
    }
  }
  if(cnt == s.length()){
    cout <<  "YES" << endl;
    //cout << cnt << endl;
  }else{
    cout << "NO" << endl;
    //cout << cnt << endl;
  }
  
}

Measured memory_bytes: 512
#include <iostream>

int main(){
  int n;
  while(std::cin >> n, n){
    int dice[6] = {1, 2, 3, 6, 5, 4};
    int result = 0;
    for(; n > 0; --n){
      std::string sosa;
      std::cin >> sosa;
      int tmp;
      switch(sosa.at(0)){
        case 'N':
          tmp = dice[0];
          dice[0] = dice[1];
          dice[1] = dice[3];
          dice[3] = dice[4];
          dice[4] = tmp;
          break;
        case 'E':
          tmp = dice[0];
          dice[0] = dice[5];
          dice[5] = dice[3];
          dice[3] = dice[2];
          dice[2] = tmp;
          break;
        case 'W':
          tmp = dice[0];
          dice[0] = dice[2];
          dice[2] = dice[3];
          dice[3] = dice[5];
          dice[5] = tmp;
          break;
        case 'S':
          tmp = dice[0];
          dice[0] = dice[4];
          dice[4] = dice[3];
          dice[3] = dice[1];
          dice[1] = tmp;
          break;
        case 'R':
          tmp = dice[1];
          dice[1] = dice[2];
          dice[2] = dice[4];
          dice[4] = dice[5];
          dice[5] = tmp;
          break;
        case 'L':
          tmp = dice[1];
          dice[1] = dice[5];
          dice[5] = dice[4];
          dice[4] = dice[2];
          dice[2] = tmp;
      }
      result += dice[0];
    }
    std::cout << result + 1 << std::endl;
  }
}

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

int n;
char cry[4] = {"mew"};

int dfs(char s[],int p){
	int res = 1, i;
	for(i = 0;i < 3;i++){
		if(cry[i] == s[p])
			p++;
		else if(s[p] == 'm'){
			res = dfs(s,p);
			if(!res)
				return 0;
			i--;
		}
		else
			return 0;
	}
	for(i = p;i <= n;i++)
		s[i - 3] = s[i];
	n -= 3;
	return 1;
}

int main(void){
	char s[501], c;
	int i = 0;
	while((c = getchar()) != '\n')
		s[i++] = c;
	s[i] = '\0';
	n = strlen(s);
	if(dfs(s,0) && !n)
		printf("Cat\n");
	else
		printf("Rabbit\n");
	return 0;
}

Measured memory_bytes: 916
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String S = sc.next();
		String T = sc.next();
		
		int A = sc.nextInt();
		int B = sc.nextInt();
		
		String U = sc.next();
		
		if(U.equals(S)) {
			A--;
		}else {
			B--;
		}
		System.out.println(A+" "+B);
	}
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long n,a,b,ans=0;
  cin>>n>>a>>b;
  vector<long long> x(n);
  cin>>x[0];
  for(int i=1;i<n;i++){
    cin>>x[i];
    int d=x[i]-x[i-1];
    if(d*a<b){
      ans+=d*a;
    }else{
      ans+=b;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3984
n,m = map(int,input().split())

start_set = set()
goal_set = set()
for i in range(m):
  s,g = map(int,input().split())
  if s == 1:
    start_set.add(g)
  if g == n:
    goal_set.add(s)    

ans = "POSSIBLE" if (start_set & goal_set) else "IMPOSSIBLE"
print(ans)

Measured memory_bytes: 24220
/*
  author: ruruvuvu
  GitHub account: colon-ku

  created at: 2020-02-22 18:59:41
*/

#include <bits/stdc++.h>
using namespace std;

#define all(x) (x).begin(),(x).end()
#define rep(x, y) for (int x = 0; x < y; x++)
#define MOD 1000000007

typedef long long LL;
typedef long double LD;

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

ostringstream oss_global;
string s_global = oss_global.str();

int main()
{
    int n;
    cin >> n;
    vector<int> a(n, 0);
    for (int i = 0; i < n; i++)
        cin >> a[i];
    
    sort(all(a));

    int ok = 1;
    for (int i = 0; i < n-1; i++) {
        if (a[i] == a[i+1]) {
            ok = 0;
        }
    }

    if (ok) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define takeline cin.ignore();
#define iactive cout.flush();
#define N 3000005
#define endl "\n"
#define mod 1000000007
#define PI 3.141592653589793
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main(){

	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l,n,m;
	cin>>n>>m;
	vector<ll> vc[n+1];
	for(i=1;i<=m;i++){
		cin>>k>>l;
		vc[k].ps(l);
		vc[l].ps(k);
	}

	queue<ll> qe;
	qe.push(1); ll par[n+1]={0},fl[n+1]={0};
	par[1]=1; fl[1]=1;
	while(qe.size()>0){
		k=qe.front();
		qe.pop();
		for(auto it:vc[k]){
			if(fl[it]==0){
				fl[it]=1; par[it]=k;
				qe.push(it);
			}
		}
	}
	for(i=1;i<=n;i++){
		if(fl[i]==0){
			cout<<"No";return 0;
		}
	}

	cout<<"Yes"<<endl;
	for(i=2;i<=n;i++){
		cout<<par[i]<<endl;
	}
	return 0;	
}

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

int main(){
    int N;
    cin >> N;
    int W[N],S[N];
    for(int i=0; i<N; i++){
        cin >> W[i];
        if(i==0){
            S[i]=W[i];
        }else{
            S[i]=S[i-1]+W[i];
        }
    }
    int S1, S2, tmp;
    int ans;
    for(int i=0; i<N; i++){
        S1=S[i];
        S2=S[N-1]-S1;
        tmp = abs(S1-S2);
        if(i==0){
            ans=tmp;
        }else if(tmp < ans){
            ans = tmp;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
n, d = map(int, input().split())

import numpy as np
xs = [np.array(list(map(int, input().split()))) for i in range(n)]

def is_integer(n):
    try:
        float(n)
    except ValueError:
        return False
    else:
        return float(n).is_integer()

counter = 0
for i in range(len(xs)):
    for j in range(i + 1, len(xs)):
        if is_integer(np.linalg.norm(xs[i] - xs[j])):
            counter += 1

print(counter)

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



int main(){
	int q;
	cin>>q;

	multiset<int> st1;
	multiset<int> st2;
	ll mx_sum = 0;
	ll mn_sum = 0;
	ll cnt = 0;

	while(q--){
		int t;cin>>t;

		if(t==1){
			int a,b;
			cin>>a>>b;
			cnt+=b;

			if(st1.empty() || a < *(--st1.end())){
				st1.insert(a);
				mn_sum+=a;		
			} else {
				st2.insert(a);
				mx_sum+=a;
			}

			while(st1.size() > st2.size()+1){
				ll x = *(--st1.end());
				st1.erase(--st1.end());
				mn_sum-=x;
				mx_sum+=x;
				st2.insert(x);
			}

			while(st2.size() > st1.size()){
				ll x = *(st2.begin());
				st2.erase(st2.begin());
				st1.insert(x);
				mn_sum+=x;
				mx_sum-=x;
			}
		} else {
			ll md = *(--st1.end());
			ll lmed = (ll)st1.size();
			ll rmed = (ll)st2.size();
			ll res = ((ll)md*lmed - mn_sum) + (mx_sum - (ll)md*rmed)+cnt;
			cout<<md<<" "<<res<<"\n";
		}
	}
	
}

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

int main(void)
{
    int x, y;

    while(1)
    {
        scanf("%d %d", &x, &y);
        if(x == 0 && y == 0)
        {
            break;
        }
        if(x > y)
        {
            int temp;
            temp = x;
            x = y;
            y = temp;
        }
        printf("%d %d\n", x, y);
    }
    
    return 0;
}


Measured memory_bytes: 2128
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ll long long
using namespace std;
bool comp(pair<int,int> a, pair<int,int> b) {
	if(a.second == b.second) {
		return a.first<b.first;
	}
	return a.second<b.second;
}
int main() {
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	ll x = b/c+b/d-b/((c*d)/__gcd(c,d));
	ll y = (a-1)/c+(a-1)/d-(a-1)/((c*d)/__gcd(c,d));
	cout<<b-a+1-x+y;
	return 0;
}

Measured memory_bytes: 256
from heapq import heapify, heappush, heappop

X, Y, A, B, C = map(int, input().split())
Ps = list(map(int, input().split()))
Qs = list(map(int, input().split()))
Rs = list(map(int, input().split()))

Ps.sort(reverse=True)
Qs.sort(reverse=True)
Rs.sort(reverse=True)

PQRed = Ps[:X]
PQGreen = Qs[:Y]
sumRed = sum(PQRed)
sumGreen = sum(PQGreen)
heapify(PQRed)
heapify(PQGreen)
#print('PQRed:', PQRed)
#print('PQGreen:', PQGreen)
ans = sumNow = sumRed + sumGreen
#print('sumNow:', sumNow)
for R in Rs:
#    print('\n##### R:', R)
    r = PQRed[0]
    g = PQGreen[0]
#    print('r:', r, '/ g:', g)
    if r <= g:
        d = heappop(PQRed)
        heappush(PQRed, R)
    else:
        d = heappop(PQGreen)
        heappush(PQGreen, R)
    if R <= d:
        break
    sumNow += R-d
#    print('sumNow:', sumNow, '/ d:', d)
    if sumNow > ans:
        ans = sumNow

print(ans)


Measured memory_bytes: 112336
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <int,int> P;

int main() {
  int n;
  cin>>n;
  int ans,d=1e9;
  for (int i=1; i<=9; i++) {
    int n2=i*100+i*10+i;
    if (n2<n) continue;
    if (d>n2-n) {
      ans=n2;
      d=n2-n;
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
using namespace std;

const long long int INF=99999999999999,inf=199999;
const long long int mod=1000000007;


long long int n,m,a,b,c;
int main() {
    int count=0;
    string str,str2;
    map<long long int,long long int>mp;
	cout << fixed << setprecision(10);
    cin>>a>>b>>c;
    cout<<max(0LL,c-a+b)<<endl;
    
    
} 


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;
typedef int64_t ll;


int main() {
    int N, M, K;
    cin >> N >> M >> K;
    for (int i = 0; i <= M; i++){
        for (int j = 0; j <= N; j++){
            if (N * i + M * j - 2 * i * j == K){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
#define INF 1e9

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef vector < pair<int, int> > vii;
typedef long double ld;
typedef tree<pair<int,int>, null_type, less<pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;


ll h, w, cnt;
string s;

int main()
{
	cin >> h >> w;
	for(int i = 0; i < h; i++){
		cin >> s;
		for(int j = 0; j < w; j++){
			if(s[j]=='#'){
				cnt++;
			}
		}
	}
	if(cnt==h+w-1){
		cout << "Possible";
	}
	else{
		cout << "Impossible";
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define uniq(x) (x).erase(unique(all(x)),(x).end())

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef std::priority_queue<int> IntPrioQueue; //Z->A
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue; //A->Z

const int MAX = 60000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<31-1;
const int MOD = 1000000007;

bool prime[MAX];

void solve(void){
    int N;
    cin >> N;
    memset(prime, true, sizeof(prime));
    prime[0] = prime[1] = false;
    rep(MAX, i) {
        if (!prime[i]) continue;
        for (int j = 2; j * i < MAX; j++) {
            prime[i*j] = false;
        }
    }
    vector <int> ns;
    rep(MAX, i) {
        if (prime[i] && (i%5 == 1)) {
            ns.pb(i);
            N--;
        }
        if (N == 0) break;
    }
    for (int p : ns) {
        printf("%d ", p);
    }
    printf("\n");
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define usecppio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(x) ((x).begin()),((x).end())
#define int ll
using pii = pair <int, int>;
#define INF 0x7f7f7f7f7f7f7f7f
const bool debug = 0;
const int mod = 998244353;
 
priority_queue<int, vector <int>, greater<int>> pq;
int x, y, a, b, c;
vector <int> red, green, colorless;
int32_t main()
{
    usecppio
    cin >> x >> y >> a >> b >> c;
    for (int i = 0; i<a; i++)
    {
        int u; cin >> u; red.push_back(u);
    }
    for (int i = 0; i<b; i++)
    {
        int u; cin >> u; green.push_back(u);
    }
    for (int i = 0; i<c; i++)
    {
        int u; cin >> u; colorless.push_back(u);
    }
    sort(all(red),greater<int>());
    sort(all(green),greater<int>());
    sort(all(colorless),greater<int>());
    for (int i = 0; i<x; i++)
        pq.push(red[i]);
    for (int i = 0; i<y; i++)
        pq.push(green[i]);
    for (auto it:colorless)
    {
        if (pq.top() < it)
        {
            pq.pop();
            pq.push(it);
        }else break;
    }
    int ans = 0;
    while(!pq.empty())
    {
        ans += pq.top();
        pq.pop();
    }
    cout << ans << '\n';
}

Measured memory_bytes: 4852
#include <iostream>
#include <string>
using namespace std;
int main() {
	int H, W, i;
	string topAndBottom, middleRow, middle;
	while (true) {
		topAndBottom = "";
		middleRow = "";
		middle = "";
		cin >> H >> W;
		if (H == 0 && W == 0)break;
		for (i = 0; i < W; i++)topAndBottom += '#';
		topAndBottom += '\n';
		middleRow += '#';
		for (i = 1; i < W - 1; i++)middleRow += '.';
		middleRow += "#\n";
		for (i = 1; i < H - 1; i++)middle += middleRow;
		cout << topAndBottom << middle << topAndBottom << endl;
	}
}

Measured memory_bytes: 1264
# greedy is all you need
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def exit(*argv, **kwarg):
    print(*argv, **kwarg)
    sys.exit()


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと


def a_int(): return int(read())


def ints(): return list(map(int, read().split()))


def read_col(H):
    '''H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_tuple(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_matrix(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right


def score(D, C, S, T):
    last = [-1] * 26
    # scores = [0]
    score = 0
    for d in range(D):
        # scores.append(scores[-1] + S[d][T[d]])
        score += S[d][T[d]]
        last[T[d]] = d
        for i in range(26):
            # scores[-1] -= C[i] * (d - last[i])
            score -= C[i] * (d - last[i])
    return score


from random import choices

D = a_int()
C = ints()
S = read_tuple(D)

candi = list(range(26))

# T = choices(candi, k=D)
# print(score(D, C, S, T))
T = []
for s in S:
    T.append(s.index(max(s)))

print(*mina(*T, sub=-1), sep='\n')


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

flg = False
cnt = 0
while(True):
    for i, num in enumerate(a):
        if num%2 == 0:
            a[i] = int(num/2)
        else:
            flg = True
    if flg:
        break
    cnt += 1

print(cnt)
    

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

int n;
const int MAX = 2000000;

void maxHeapify(int *A,int i){
    int l = 2 * i, r = 2 * i + 1, largest;
    if(l <= n && A[l-1] > A[i-1]) largest = l;
    else largest = i;
    if(r <= n && A[r-1] > A[largest-1]) largest = r;
    if(largest != i){
        swap(A[i-1], A[largest-1]);
        maxHeapify(A, largest);
    }
}

void heapIncreaseKey(int *A, int i, int key){
    if(key < A[i-1]){
        cout << "Exception: the new key is smaller than the present key." << endl;
        return;
    }
    A[i-1] = key;
    while(i > 1 && A[i/2-1] < A[i-1]){
        swap(A[i/2-1], A[i-1]);
        i = i/2;
    }
}

void maxHeapInsert(int *A, int key){
    A[n++] = -1;
    heapIncreaseKey(A, n, key);
}

int heapExtractMax(int *A){
    if(n < 1){
        cout << "Exception: Heap Under Flow" << endl;
    } else {
        int max = A[0];
        A[0] = A[--n];
        maxHeapify(A, 1);
        return max;
    }
}

int main(){
    static int A[MAX];
    n = 0;
    char str[10];
    while(scanf("%s",str)){
        if(str[0] == 'e' && str[1] == 'n') break;
        else if(str[0] == 'i'){
            int a;
            cin >> a;
            maxHeapInsert(A, a);
        } else printf("%d\n",heapExtractMax(A));
    }
}

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

int main() {
  int N;
  cin >> N;
  vector<vector<int>> pos(N+1,vector<int>(3));
  pos[0][0]=0;
  pos[0][1]=0;
  pos[0][2]=0;
  bool ans=true;
  for (int i=0;i<N;i++){
    cin >> pos[i+1][0] >> pos[i+1][1] >> pos[i+1][2];
    int time=(pos[i+1][0]-pos[i][0])-abs(pos[i+1][1]-pos[i][1])-abs(pos[i+1][2]-pos[i][2]);
    if (time<0||time%2==1){
      ans=false;
    }
  }
  if (ans){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 5760
from fractions import gcd
from functools import reduce


def lcm(a, b):
    return a * b // gcd(a, b)


def solve(string):
    n, m, *a = map(int, string.split())
    l = reduce(lcm, a)
    c = 1
    while a[0] % (2 * c) == 0:
        c *= 2
    for _a in a:
        if _a % c > 0 or not (_a // c) % 2:
            return "0"
    return str(max((m - l // 2) // l + 1, 0))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))


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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = (int)(n); i >= 0; i--)
#define repm(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define repmr(i, m, n) for(int i = (int)(n); i >= (int)(m); i--)
#define all(x) (x).begin(),(x).end()
#define inf 2e9

using namespace std;
typedef long long int lli;
typedef long long ll;

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

    cout << max(a+b,max(a-b,a*b)) << endl;
}


Measured memory_bytes: 256
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b?gcd(b,a%b):a;} //最小公倍数

// デフォルト変数定義
double n,m,a,b,c,d,x,y,z;
string s,t;
//

signed main() {
  RAPID;
  IN(n);
  OUT(floor(n/3));
}


Measured memory_bytes: 256
xy=input().split()
x1=int(xy[0]);y1=int(xy[1]);x2=int(xy[2]);y2=int(xy[3])
y3=y2+(x2-x1);x3=x2-(y2-y1)
y4=y3-(x2-x3);x4=x3-(y3-y2)
print(str(x3)+" "+str(y3)+" "+str(x4)+" "+str(y4))



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

int dp[300][300][301];

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s;
	int k;
	cin>>s>>k;
	int n = s.size();
	for(int i=0;i<n;i++)
		for(int m=0;m<=k;m++)
			dp[i][i][m]=1;
	for(int l=2;l<=n;l++)
		for(int i=0;i+l<=n;i++){
			int j=i+l-1;
			for(int m=0;m<=k;m++){
				dp[i][j][m]=max(dp[i+1][j][m],dp[i][j-1][m]);
				if(s[i]==s[j])
					dp[i][j][m]=max(dp[i+1][j-1][m]+2,dp[i][j][m]);
				if(m){
					dp[i][j][m]=max(dp[i][j][m],dp[i][j][m-1]);
					dp[i][j][m]=max(dp[i][j][m],dp[i+1][j-1][m-1]+2);
				}
			}
		}
	cout<<dp[0][n-1][k]<<endl;
}


Measured memory_bytes: 104704
n=int(input())

d1=[0]*n
d2=[0]*n

for i in range(n):
    d1[i],d2[i]=map(int,input().split())

cnt=0
ans="No"

for i in range(n):
    if d1[i]==d2[i]:
        cnt+=1

    if cnt==3:
        ans="Yes"
        break

    if d1[i]!=d2[i]:
        cnt=0
    

print(ans)

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

unsigned long long gcd(unsigned long long m, unsigned long long n) {
    if(m<n) {
        swap(m,n);
    }
    
    unsigned long long r;
    while((r = m % n) != 0) {
        m = n;
        n = r;
    }
    
    return n;
}

int main(void){

    int k;
    cin >> k;
    
    unsigned long long sum = 0;
    for(int a=1; a<=k; a++) {
        for(int b=1; b<=k; b++) {
            for(int c=1; c<=k; c++) {
                sum += gcd(gcd(a, b), c);
            }
        }
    }
    
    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>

using namespace std;

int main() {
	int data[5][5][5][5];

	for (int i = 0; i < 9; i++) {
		string a;
		if (i % 2 == 0) {
			int k = i/2;
			cin >> a;
			data[k][0][k][1] = data[k][1][k][0] = a[0]-'0';
			data[k][1][k][2] = data[k][2][k][1] = a[1]-'0';
			data[k][2][k][3] = data[k][3][k][2] = a[2]-'0';
			data[k][3][k][4] = data[k][4][k][3] = a[3]-'0';
		} else {
			int k = i/2;
			cin >> a;
			data[k][0][k+1][0] = data[k+1][0][k][0] = a[0]-'0';
			data[k][1][k+1][1] = data[k+1][1][k][1] = a[1]-'0';
			data[k][2][k+1][2] = data[k+1][2][k][2] = a[2]-'0';
			data[k][3][k+1][3] = data[k+1][3][k][3] = a[3]-'0';
			data[k][4][k+1][4] = data[k+1][4][k][4] = a[4]-'0';
		}
	}
	cout << 'R';
	int p[4] = {0};
	p[3] = 1;
	int pp = 0;
	while (p[2] != 0 || p[3] != 0) {
		if (pp == 0) {
			if (p[2] != 0 && data[p[2]][p[3]][p[2]-1][p[3]] == 1) {
				cout << 'U';
				p[0] = p[2];
				p[1] = p[3];
				p[2]--;
				pp = 3;
			} else if (p[3] != 4 && data[p[2]][p[3]][p[2]][p[3]+1] == 1) {
				cout << 'R';
				p[0] = p[2];
				p[1] = p[3];
				p[3]++;
				pp = 0;
			} else if (p[2] != 4 && data[p[2]][p[3]][p[2]+1][p[3]] == 1) {
				cout << 'D';
				p[0] = p[2];
				p[1] = p[3];
				p[2]++;
				pp = 1;
			} else {
				cout << 'L';
				p[0] = p[2];
				p[1] = p[3];
				p[3]--;
				pp = 2;
			}
		} else if (pp == 1) {
			if (p[3] != 4 && data[p[2]][p[3]][p[2]][p[3]+1] == 1) {
				cout << 'R';
				p[0] = p[2];
				p[1] = p[3];
				p[3]++;
				pp = 0;
			} else if (p[2] != 4 && data[p[2]][p[3]][p[2]+1][p[3]] == 1) {
				cout << 'D';
				p[0] = p[2];
				p[1] = p[3];
				p[2]++;
				pp = 1;
			} else if (p[3] != 0 && data[p[2]][p[3]][p[2]][p[3]-1] == 1){
				cout << 'L';
				p[0] = p[2];
				p[1] = p[3];
				p[3]--;
				pp = 2;
			} else {
				cout << 'U';
				p[0] = p[2];
				p[1] = p[3];
				p[2]--;
				pp = 3;
			}
		} else if (pp == 2) {
			if (p[2] != 4 && data[p[2]][p[3]][p[2]+1][p[3]] == 1) {
				cout << 'D';
				p[0] = p[2];
				p[1] = p[3];
				p[2]++;
				pp = 1;
			} else if (p[3] != 0 && data[p[2]][p[3]][p[2]][p[3]-1] == 1){
				cout << 'L';
				p[0] = p[2];
				p[1] = p[3];
				p[3]--;
				pp = 2;
			} else if (p[2] != 0 && data[p[2]][p[3]][p[2]-1][p[3]] == 1) {
				cout << 'U';
				p[0] = p[2];
				p[1] = p[3];
				p[2]--;
				pp = 3;
			} else {
				cout << 'R';
				p[0] = p[2];
				p[1] = p[3];
				p[3]++;
				pp = 0;
			}
		} else {
			if (p[3] != 0 && data[p[2]][p[3]][p[2]][p[3]-1] == 1){
				cout << 'L';
				p[0] = p[2];
				p[1] = p[3];
				p[3]--;
				pp = 2;
			} else if (p[2] != 0 && data[p[2]][p[3]][p[2]-1][p[3]] == 1) {
				cout << 'U';
				p[0] = p[2];
				p[1] = p[3];
				p[2]--;
				pp = 3;
			} else if (p[3] != 4 && data[p[2]][p[3]][p[2]][p[3]+1] == 1) {
				cout << 'R';
				p[0] = p[2];
				p[1] = p[3];
				p[3]++;
				pp = 0;
			} else {
				cout << 'D';
				p[0] = p[2];
				p[1] = p[3];
				p[2]++;
				pp = 1;
			}
		}
	}
	cout << endl;
	return 0;
}

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

int dp[3000][3000];
int choice[3000][3000];

int main(){
	string s , t;
	cin >> s >> t;

	int n = s.size() , m = t.size();

	dp[0][0] = 0;
	if (s[0] == t[0]){
		dp[0][0] = 1;
		choice[0][0] = 2;
	}

	for(int i = 0 ; i < n ; i++){
		for(int j = 0 ; j < m ; j++){
			if (i){
				dp[i][j] = dp[i-1][j];
				choice[i][j] = 0;
			}
			if (j){
				if (dp[i][j-1] > dp[i][j]){
					dp[i][j] = dp[i][j-1];
					choice[i][j] = 1;
				}
			}

			if (s[i] == t[j]){
				int ans = 1;
				if (i && j){
					ans = 1 + dp[i-1][j-1];
				}
				if(ans > dp[i][j]){
					dp[i][j] = ans;
					choice[i][j] = 2;
				}
			}
		}
	}

	int i = n-1 , j = m-1;
	string subsequence;

	while(i >= 0 && j >= 0){
		if (choice[i][j] == 0){
			i--;
		} else if (choice[i][j] == 1){
			j--;
		} else {
			subsequence.push_back(s[i]);
			i--;
			j--;
		}
	}

	reverse(subsequence.begin() , subsequence.end());
	cout << subsequence << endl;

	return 0;
}


Measured memory_bytes: 73952
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <string.h>
using namespace std;

#define ISEQ(c) (c).begin(), (c).end()
typedef long long ll;

int main() {
  vector<char> list;
  for (char c = 'a'; c <= 'z'; c++) {
    list.push_back(c);
  }
  for (char c = 'A'; c <= 'Z'; c++) {
    list.push_back(c);
  }
  int num = list.size();
  while (true) {
    int n;
    cin >> n;
    if (n == 0) break;
    vector<int> key(n);
    for (int i = 0; i < n; i++)
      cin >> key[i];
    string s;
    cin >> s;
    int len = s.size();
    int index = 0;
    for (int i = 0; i < len; i++) {
      int k = 0;
      for (int j = 0; j < num; j++) {
	if (list[j] == s[i]) {
	  k = j;
	  break;
	}
      }
      s[i] = list[(k-key[index]+num)%num];
      index = (index + 1) % n;
    }
    cout << s << endl;
  }
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  int X;
  cin>>X;
  
  if(X>=30){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 3592
import heapq

n, m = map(int, input().split())

shops = []
for i in range(n):
    a, b = map(int, input().split())
    heapq.heappush(shops, (a, b))

cnt = 0
ans = 0
while True:
    a, b = heapq.heappop(shops)
    if cnt + b >= m:
        ans += a * (m - cnt)
        cnt += m - cnt
        break
    else:
        ans += a * b
        cnt += b

print(ans)


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

int main(){
	int a, b;
	while(std::cin >> a >> b){
		//a及びbが0ならば終了
		if(a == 0 && b == 0){
			return 0;
		}
		//範囲外の参照によるエラーを回避するため，1だけ容量を多く確保し，(1,1)を開始地点にする
		std::vector<std::vector<int>> path(a+1);
		for(int i = 0; i < a+1; ++i){
			path[i].resize(b+1, 1);
		}
		
		int n;
		std::cin >> n;
		for(int i = 0; i < n; ++i){
			int x, y;
			std::cin >> x >> y;
			//工事中の交差点は0で表現
			path[x][y] = 0;
		}
		
		//範囲外の交差点は0で表現
		for(int i = 0; i <= a; ++i) path[i][0] = 0;
		for(int i = 0; i <= b; ++i) path[0][i] = 0;
		
		for(int x = 1; x <= a; ++x){
			for(int y = 1; y <= b; ++y){
				//工事中か開始地点は経路数を変更しない
				if( path[x][y] != 0 && (x != 1 || y != 1) ){
					path[x][y] = path[x-1][y] + path[x][y-1];
				}
			}
		}
		
		std::cout << path[a][b] << std::endl;
		
	}
	return 0;
}

Measured memory_bytes: 1200
#include<iostream>
#include<vector>
#include<algorithm>
#define f first
#define s second
#define INF (1<<29)
using namespace std;

typedef pair<int,int> P;

int h,w,s,u[34][34];
P memo[34][34][34][34];

P rec(int x1,int y1,int x2,int y2){
	
	P a,b,res;
	
	if(memo[x1][y1][x2][y2]!=P(0,INF))return memo[x1][y1][x2][y2];
	
	if(u[h-1][w-1]-(u[y2-1][x2-1]-u[y2-1][x1-1]-u[y1-1][x2-1]+u[y1-1][x1-1])>s)return P(0,INF);
	
	res=P(1,s-(u[h-1][w-1]-(u[y2-1][x2-1]-u[y2-1][x1-1]-u[y1-1][x2-1]+u[y1-1][x1-1])));
	
	for(int i=y1+1;i<y2;i++){
		a=rec(x1,y1,x2,i);
		b=rec(x1,i,x2,y2);
		res=max(res,P(a.f+b.f,min(a.s,b.s)));
	}
	
	for(int i=x1+1;i<x2;i++){
		a=rec(x1,y1,i,y2);
		b=rec(i,y1,x2,y2);
		res=max(res,P(a.f+b.f,min(a.s,b.s)));
	}
	
	return memo[x1][y1][x2][y2]=res;
}

int main(void){
	
	while(cin >> h >> w >> s,h++|w++|s){
		
		fill(u[0],u[33],0);
		
		for(int i=0;i<34;i++)
			for(int j=0;j<34;j++)
				for(int k=0;k<34;k++)
					for(int l=0;l<34;l++)memo[i][j][k][l]=P(0,INF);
		
		for(int i=1;i<h;i++)
			for(int j=1;j<w;j++)cin >> u[i][j];
		
		for(int i=1;i<h;i++)
			for(int j=1;j<w;j++)
				u[i][j]+=u[i-1][j]+u[i][j-1]-u[i-1][j-1];
		
		P ans=rec(1,1,w,h);
		cout << ans.f << " " << ans.s << endl;
	}
	return 0;
}

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

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

//cout << ans?"Yes":"No" << endl;

Measured memory_bytes: 256
# coding: utf-8
N, M = map(int, input().split())
dp = [-1] * (N+1)
#0段目と1段目に行く方法は1通り
dp[0] = 1
dp[1] = 1

for i in range(M):
    tmp = int(input())
    dp[tmp] = 0
    
for i in range(2, N+1, 1):
    if dp[i] != 0:
        dp[i] = dp[i-1] + dp[i-2]
        dp[i] %= 1000000007
print(dp[N])

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

int main(){
    int n;
    int F[50];
    cin >> n;
    F[0] = F[1] = 1;
    for(int i=2;i<=n;i++)F[i] = F[i-1] + F[i-2];

    cout << F[n] << endl;
    return 0;
}


Measured memory_bytes: 3092
class Dice:
    """????????????????????????"""
    def __init__(self, s):
        self.s1 = s[0]
        self.s2 = s[1]
        self.s3 = s[2]
        self.s4 = s[3]
        self.s5 = s[4]
        self.s6 = s[5]

    def roll(self, direction):          # ???????????????????§??????¢????????¢
        temp = self.s1
        if direction == "E":
            self.s1 = self.s4
            self.s4 = self.s6
            self.s6 = self.s3
            self.s3 = temp
        elif direction == "N":
            self.s1 = self.s2
            self.s2 = self.s6
            self.s6 = self.s5
            self.s5 = temp
        elif direction == "S":
            self.s1 = self.s5
            self.s5 = self.s6
            self.s6 = self.s2
            self.s2 = temp
        elif direction == "W":
            self.s1 = self.s3
            self.s3 = self.s6
            self.s6 = self.s4
            self.s4 = temp

s = list(map(int, input().split()))
dice1 = Dice(s)
command = input()

for i in range(len(command)):
    dice1.roll(command[i])

print(dice1.s1)

Measured memory_bytes: 7792
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
using namespace std;
int main(){
  int a,b,c;
  cin >> a >> b >> c;
  int k;
  cin >> k;
  int tmp = a;
  rep(i,k) a *= 2;
  int sum1 = a+b+c;
  a = tmp;
  tmp = b;
  rep(i,k) b *= 2;
  int sum2 = a+b+c;
  b = tmp;
  rep(i,k) c *= 2;
  int sum3 = a+b+c;
  int ans = max(sum1,max(sum2,sum3));
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N;
    cin >> N;

    bool b = false;

    for (int i = 1; i < 10; i++) {
        for (int j = 1; j < 10; j++) {
            if (i * j == N) {
                b = true;
            }
        }
    }

    cout << (b ? "Yes" : "No") << endl;

}

Measured memory_bytes: 256
($N,$X)=glob<>;@_=map$x+=$_,0,glob<>;$z=inf;for$t(1..$N){$y=($N+$t)*$X;$y+=(2*($_||1)+3)*($_[$N-$t*$_]-$_[$-=$N-$t*++$_])for 0..$N/$t;$y>$z or$z=$y}print$z

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

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


Measured memory_bytes: 3084
#include "stdio.h"
#include <math.h>
int main()
{
	int n,R,Min;
	int diff = (int)pow(10, 9)*-1-1;

	scanf("%d %d",&n,&Min);
	for (int i = 0; i < n-1; i++) {
		scanf("%d", &R);
		if (diff < R - Min) {
			diff = R - Min;
		}
		if (Min > R) {
			Min = R;
		}
	}
	printf("%d\n", diff);
    return 0;
}


Measured memory_bytes: 2748
#include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#define pb(in,tmp) in.push_back(tmp)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
using namespace std;
 
void bom(int x,int y,vector<string>&in){
in[x][y]='0';
loop(i,-3,4)
loop(j,-3,4){
if(i&&j)continue;
if(x+i>=0&&x+i<8&&y+j>=0&&y+j<8&&in[x+i][y+j]=='1')bom(x+i,y+j,in);
}
}
 
int main(){
int n;
cin>>n;
rep(i,n){
vector<string> in(8);
rep(j,8)cin>>in[j];
int x,y;
cin>>x>>y;
if(in[y-1][x-1]=='1')bom(y-1,x-1,in);
cout<<"Data "<<i+1<<':'<<endl;
rep(j,8)cout<<in[j]<<endl;
}
}

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

main() {
    int A,B; char c; cin >> A >> c >> B;
    if(c=='+')cout << A+B << endl;
    else cout << A-B << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s, t;
    cin >> s >> t;
    int n = s.size();
    for (int i = 0; i < n; ++i)
    {
        bool bad = false;
        for (int j = 0; j < n; ++j)
            if (s[j] != t[(i + j) % n])
                bad = true;
        if (!bad)
            return cout << "Yes", 0;
    }
    cout << "No";
}


Measured memory_bytes: 256
using System;
using System.Linq;

public class Program
{
	public static void Main(string []aksjdsk)
	{

		//code goes here
while(true){

int n=int.Parse(Console.ReadLine());if(n==0){break;}
for(int i=0;i<n;i++){
	int []a=Console.ReadLine().Split().Select(int.Parse).ToArray();
	if((a[0]==100||a[1]==100||a[2]==100)||(a[0]+a[1]>=180)||(a[0]+a[1]+a[2]>=240)){Console.WriteLine("A");continue;}
if(a[0]+a[1]+a[2]>=210){Console.WriteLine("B");continue;}
if(a[0]+a[1]+a[2]>=150&&(a[0]>=80||a[1]>=80)){Console.WriteLine("B");}
else{Console.WriteLine("C");}
	
}
}
	}
}

Measured memory_bytes: 9392
n = sorted(list(map(int, input().split())))

evenodd = []
if n[0] % 2 == 0:
    evenodd.append(0)
else:
    evenodd.append(1)
if n[1] % 2 == 0:
    evenodd.append(0)
else:
    evenodd.append(1)
if n[2] % 2 == 0:
    evenodd.append(0)
else:
    evenodd.append(1)

if evenodd.count(0) == 3 or evenodd.count(1) == 3:
    print(int((n[2] - n[0]) / 2 + (n[2] - n[1]) / 2))
elif evenodd.count(0) == 1:
    if evenodd[2] == 0:
        print(int(n[2] - (n[1] + n[0]) / 2))
    else:
        print(int(n[2] - (n[1] + n[0] - 3) / 2))
elif evenodd.count(0) == 2:
    if evenodd[2] == 1:
        print(int(n[2] - (n[1] + n[0]) / 2))
    else:
        print(int(n[2] - (n[1] + n[0] - 3) / 2))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define mem(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define int long long
const int inf = 0x3f3f3f3f;
const int maxn = 201110;
const int M = 1e9+7;

signed main()
{
    double n;
    cin>>n;
    double ans = (n/3.0)*(n/3.0)*(n/3.0);
    printf("%.8f\n",ans);
    return 0;
}

Measured memory_bytes: 256