akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define mod 1000000007
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { cerr << (itr) << " "; }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

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

  ll n,m;
  cin >> n >> m;
  vector<ll> s(n),t(m);
  repr(i, n, 0) cin >> s[i];
  repr(i, m, 0) cin >> t[i];

  vector<vector<ll>> sum(n+1, vector<ll>(m+1, 0));
  vector<vector<ll>> dp(n+1, vector<ll>(m+1, 0));

  // 空集合
  dp[0][0] = 0;
  sum[0][0] = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (s[i] == t[j]) {
        dp[i+1][j+1] = sum[i][j] + 1;
        dp[i+1][j+1] %= mod;
      } else {
        dp[i+1][j+1] = 0;
      }

      sum[i+1][j+1] = (sum[i+1][j] + sum[i][j+1] + dp[i+1][j+1]) % mod;
      sum[i+1][j+1] = (sum[i+1][j+1] + mod - sum[i][j]) % mod;
      sum[i+1][j+1] %= mod;
    }
  }

  ll ans = 1;
  for (int i = 0; i < n+1; ++i) {
    for (int j = 0; j < m+1; ++j) {
      ans += dp[i][j];
      ans %= mod;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 65972
S = input()
n = len(S)
result = "Yes"
if n%2 :
    result = "No"
else:
    for i in range(n):
        if i % 2 == 0 and S[i] == "h":
            i = i +1
        elif i % 2 and S[i] == "i":
            i = i + 1
        else:
            result = "No"
            break
print(result)


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

long long int gcd(long long int l, long long int r) {
	assert(l > 0 && r > 0);
	if (l > r)return gcd(r, l);
	else {
		const long long int num = r%l;
		if (num) {
			return gcd(l, num);
		}
		else {
			return l;
		}
	}
}
long long int lca(long long int l, long long int r) {
	return l / gcd(l, r)*r;
}
int getans(const int num, const int rest) {
	if (rest) {
		int ans = 0;
		for (int i = 0; i <= 9; ++i) {
			if (num >= i) {
				ans += getans(num - i, rest - 1);
			}
		}
		return ans;
	}
	else {
		return num == 0;
	}
}
int main() {
	int N;
	while (cin >> N) {
		cout << getans(N, 4) << endl;
	}
	return 0;
}

Measured memory_bytes: 3008
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(ll i=0;i<n;i++)
#define ll long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
#define inf 1000000007
#define double long double
using namespace std;
typedef pair<ll, ll>P;
bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
ll lcm(ll x, ll y) {
	return x * y / gcd(x, y);
}
ll n;
ll a[2222];
ll memo[2222][2222];
signed main() {
	ll ans = 0;
	cin >> n;
	rep(i, n)cin >> a[i];
	sort(a, a + n);
	rep(i, n-1) {
		for (int j = i + 1; j < n; j++) {
			memo[i][j] = a[i] + a[j];
		}
	}
	rep(i, n-1) {
		for (ll j = i + 1; j < n; j++) {
			ans += max((ll)0, (lower_bound(a, a + n, memo[i][j]) - a) - j - 1);
		}
	}
	cout << ans << endl;
	ggr
}

Measured memory_bytes: 35072
program main
  implicit none
  
  integer :: i,j,n,tt,c(100),t(100),chk=0,big = 100000,best
  
  read(*,*)n,tt
  do i = 1, n
    read(*,*)c(i),t(i)
    if (t(i) <= tt) then
      chk = 1
    end if
  end do
  if (chk == 0) then
    write(*,*)'TLE'
    stop
  end if
  
  do i = 1, n
    if (t(i) > tt) then
      cycle
    end if
    if (c(i) < big) then
      big = c(i)
      best = i
    end if
  end do
  write(*,*)big
end program main

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<queue>
#include<list>
#include<stack>
#include<algorithm>
#include<cmath>
#include<memory>
#include<array>
 
using namespace std;
 
int main()
{
  array<double, 10> l;
  double v1, v2;
  char c;
 
  while ( cin >> l[0] )
    {
      double al = l[0];
 
      for ( auto i = 1; i < 10; ++i )
        {
          cin >> c >> l[i];
          al += l[i];
        }
   
      cin >> c >> v1 >> c >> v2;
 
      double p = al * v1 / (v1 + v2);
 
      double cl = 0;
 
      for ( auto i = 0; i < 10; ++i )
        {
          cl += l[i];
          if ( cl >= p )
            {
              cout << i + 1 << endl;
              break;
            }
        }
    }
   
  return 0;
}

Measured memory_bytes: 3136
N = int(input())
c = 0
for i in range(1, N + 1):
    list = []
    if i % 2 == 1:
        for j in range(1, int(i ** 0.5) // 1 + 1):
            if i % j == 0:
                list.append(j)
                if not j == i // j:
                    list.append(i // j)
        if len(list) == 8:
            c += 1
print(c)

Measured memory_bytes: 2940
package main

import (
	"fmt"
)

func main() {
	var b string
	fmt.Scan(&b)
	switch b {
	case "A":
		fmt.Println("T")
	case "C":
		fmt.Println("G")
	case "G":
		fmt.Println("C")
	case "T":
		fmt.Println("A")
	}
}


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

#define ll long long
#define ff first
#define ss second
#define mp make_pair
#define pb push_back

const int N = 2e5 + 11;



int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    string s,t;
   int x,y,z,a,max=0;
   cin>>x>>y>>z>>a;
   if (a<=x)
   {
       cout<<a;
       goto end;
   }
   else if (a>x&&x+y>=a)
   {
       cout<<x;
      // max=x;
       goto end;
   }
   max=x;
   a=a-(x+y);
   cout<<max-a;
    end:
    ;
    
}


Measured memory_bytes: 3620
A, B, C = map(int, input().split())
L = [A, B, C]
even = []
odd = []
ans = 0

for i in L:
    if i % 2 == 0:
        even.append(i)
    else:
        odd.append(i)

if len(even) == 2:
    even[0] += 1
    even[1] += 1
    ans += 1
    num = even + odd
elif len(odd) == 2:
    odd[0] += 1
    odd[1] += 1
    ans += 1
    num = even + odd
else:
    num = L

num.sort()
ans_1 = (num[1] - num[0]) // 2
ans_2 = num[2] - num[1]
ans += ans_1 + ans_2
print(ans)

Measured memory_bytes: 3064
h, w = map(int, input().split())
s = []
s0 = []
for i in range(h):
    s.append(input())

for i in range(h):
    if s[i].count('#') != 0:
        s0.append(s[i])

s1 = [list(a) for a in s0]
# print(s1)
for i in range(len(s1[0])):
    for j in range(len(s1)):
        if s1[j][i] == '#':
            break
        elif j == len(s1) - 1:
            for k in range(len(s1)):
                s1[k][i] = 0
        else:
            continue
for r in s1:
    for c in r:
        if c != 0:
            print(c, end='')
    print()

Measured memory_bytes: 4596
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
using namespace std;

int main(){
	int n, t, a;
	pair<int, int> ans;
	ans.first=1;
	cin >> n >> t >> a >> ans.second;
	for(int i = 2; i <= n; i++){
		int h;
		cin >> h;
		if(abs(a-(t-h*0.006)) < abs(a-(t-ans.second*0.006)))
		ans = make_pair(i, h);
	}
	cout << ans.first << '\n';
	return 0;
}

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

bool a(char c){
  if(c == 'A' || c == 'T' || c == 'G' || c == 'C') return true;
  return false;
}

int main(){
  string S;
  cin >> S;
  int ssize = S.size();
  int result = 0;
  int counter = 0;
  for(int i = 0; i < ssize; i++){
    if(a(S.at(i))) counter++;
    else counter = 0;
    result = max(result, counter);
  }
  cout << result << endl;
}

Measured memory_bytes: 256
#include <utility>
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
using namespace std;

int A[1000000], n;

int main(int argc, char const *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  std::cin >> n;
  for (size_t i = 0; i < n; i++) {
    std::cin >> A[i];
  }

  int q,k, sum=0;
  std::cin >> q;

  for (size_t i = 0; i < q; i++) {
    std::cin >> k;
    if (*lower_bound(A, A+n, k)==k) sum++;
  }

  std::cout << sum << '\n';

  return 0;
}



Measured memory_bytes: 3520
#include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 #include<functional>
 #include<utility>
 
 using namespace std;
 
 double abs(double m)
 {
   if(m<0) return -m;
   else return m;       
 }
 
 int main()
 {
   double x[100+2],y[100+2];
   int n;
   double d1,d2,d3,di;
   d1=d2=d3=di=0;
   cin>>n;
   for(int i=0;i<n;i++) cin>>x[i];      
   for(int i=0;i<n;i++) cin>>y[i];
   for(int i=0;i<n;i++)
   {
     d1+=abs(x[i]-y[i]);
     d2+=pow(abs(x[i]-y[i]),2);
     d3+=pow(abs(x[i]-y[i]),3);
     if(abs(x[i]-y[i])>di) di=abs(x[i]-y[i]);        
   }   
   d2=sqrt(d2);
   d3=pow(d3,1.0/3);
   printf("%.6lf\n%.6lf\n%.6lf\n%.6lf\n",d1,d2,d3,di);
   //while(1);
   return 0;
 }

Measured memory_bytes: 3380
#include <iostream>

using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	if (a > b) {
		cout << "a > b\n";
	}
	else if (a < b) {
		cout << "a < b\n";
	}
	else {
		cout << "a == b\n";
	}
}



Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,k;
    scanf("%d %d",&n,&k);
    int s[n]={0};
    int d[k];
    int q;
    for(int i=0;i<k;i++){
        scanf("%d",&d[i]);
        for(int j=0;j<d[i];j++){
            scanf("%d",&q);
            s[q-1]=1;
        }
    }
    int e=0;
    for(int i=0;i<n;i++){
        if(s[i]==0)e++;
    }
    printf("%d",e);
    return 0;
}

Measured memory_bytes: 3812
#include <stdio.h>
#define MAX 100000

int A[MAX],n;

int partition(int p,int r)
{
  int x,i,j,t;
  x=A[r];
  i=p-1;
  for(j=p;j<r;j++){
    if(A[j]<=x){
      i++;
      t=A[i];A[i]=A[j];A[j]=t;
    }
  }
  t=A[i+1];A[i+1]=A[r];A[r]=t;
  return i+1;
}

int main()
{
  int i,q;
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&A[i]);

  q=partition(0,n-1);

  for(i=0;i<n;i++){
    if(i)printf(" ");
    if(i==q) printf("[");
    printf("%d",A[i]);
    if(i==q)printf("]");
  }
  printf("\n");

  return 0;
}



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

int main()
{
    int r, g, b, sum;
    cin >> r >> g >> b;

    sum = r * 100 + g * 10 + b;

    if (sum % 4 == 0)
    {
        cout << "YES" << endl;
        return 0;
    }
    else
    {
        cout << "NO" << endl;
        return 0;
    }
}

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


int main()
{
    ll n, m, k;
    
    cin >> n >> m>> k;
    vector<ll> a(n + 2), b(m + 2);
    a[0] = 0;
    b[0] = 0;
    for (ll i = 1; i <= n;i++){
        cin >> a[i];
        a[i] += a[i - 1];
        //cout << a[i] << endl;
        ;
    }
    a[n+1] = 1e+10;
    for (ll i = 1; i <= m; i++)
    {
        cin >> b[i];
        b[i] += b[i - 1];
        //cout << b[i] << endl;
    }
    b[m+1] = 1e+10;
    
    ll ans = 0;
    for (ll i = 0; (a[i]<= k);i++){
        auto it = upper_bound(b.begin(),b.end(), k - a[i]);
        auto d = it - b.begin();
        //cout << "i=" << i <<" a[i]="<<a[i]<< " d=" << d << " ans=" << i + d-1 << endl;
        if(i+d-1>ans){
            ans = i + d - 1;
        }
    }
    cout << ans;
}

Measured memory_bytes: 6388
from fractions import gcd


def solve(n, m, aaa):
    lcm = 1
    for a in aaa:
        a //= 2
        lcm *= a // gcd(lcm, a)
        if lcm > m:
            return 0
    for a in aaa:
        if int(lcm / a) == lcm / a:
            return 0
    return (m // lcm + 1) // 2


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

print(solve(n, m, aaa))


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

struct node{
  int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;


NodePointer listSearch(int key){
  NodePointer z;
  for(z=nil;z->next!=nil;z=z->next){
  if(z->next->key==key)return z->next;
  }
  return NULL;
}

void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0) printf(" ");
    printf("%d", cur->key);
    cur = cur->next; isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
    
  t->next->prev=t->prev;
  t->prev->next=t->next;
  free(t);
}

void deleteFirst(){
    
  NodePointer t = nil->next;
  if ( t == nil )return;
  deleteNode(t);
}

void deleteLast(){
  NodePointer z;
  z=nil->prev;
  deleteNode(z);
}

void delete(int key){

  NodePointer z;
  z=listSearch(key);
  if(z != NULL ){deleteNode(z);}
}

void insert(int key){

  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;

  x->next=nil->next;
  nil->next->prev=x;
  nil->next=x;
  x->prev=nil;
}

int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) {
      insert(key);
      np++;
      size++;
    }
    
    else if ( com[0] == 'd' ) {
    if (strlen(com) > 6){
	if ( com[6] == 'F' ) deleteFirst();
	else if ( com[6] == 'L' ) deleteLast();
    }
    else { delete(key); nd++; } size--; }
  }
  
  
  printList();
  return 0;
}



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

int main()
{
	while (1)
	{
		int a;
		cin >> a;
		if (a == 0)break;
		int m, s;
		m = s = 1000000;
		for (int b = 0; b <=a / 200; b++) {
			for (int c = 0; (b * 200 + c * 300) <= a; c++) {
				if ((a - (b * 200 + c * 300)) % 500 != 0)continue;
				m =  (b / 5) * 1520;
				m += (b % 5) * 380;
				m += (c / 4) * 1870;
				m += (c % 4) * 550;
				m += (((a - b * 200 - c * 300) / 500)/3) * 2244;
				m += (((a - b * 200 - c * 300) / 500) % 3) * 850;
				if (m < s)s = m;
			}
		}
		cout << s << endl;
	}
}

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

ll INF = 1e12;
 
int main(void){
    int n;
    cin>>n;
    vector<ll> v(n);
    rep(i, n) cin>>v[i];
    int minus = 0;
    ll maxminus = INF;
    bool ok = false;
    rep(i, n) {
        maxminus = min(maxminus, abs(v[i]));
        if(v[i]<0) {
            minus++;
        }
        else if(v[i] == 0) ok = true;
    }
    ll ans = 0;
    if(minus%2 == 0 || ok) {
        rep(i, n) ans+=abs(v[i]);
    } 
    else{
        rep(i, n) ans += abs(v[i]);
        ans -= 2*abs(maxminus);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4060
#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
const int N=1e5+10;
int a[N];
int main()
{
    int n;
    while(~scanf("%d",&n))
    {
       int od=0,ev=0;
       int x;
       for(int i=0;i<n;i++)
       {
           scanf("%d",&x);
           if(x%2) od++;
           else ev++;
       }
       if(od%2&&n!=1) puts("NO");
       else puts("YES");
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
double distance(double x,double y){
  double r=sqrt(x*x+y*y);
  return r;
}
int main(void){
int n,d;
  scanf("%d%d",&n,&d);
  double x[n],y[n];
    int c=0;
  for(int i=0;i<n;i++){
		scanf("%lf%lf",&x[i],&y[i]);
    //printf("%lf\n",distance(x[i],y[i]));
    if(distance(x[i],y[i])<=d)c++;
  }
  printf("%d",c);
  return 0;
}


Measured memory_bytes: 5252
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int cnt = 0;
            String input = sc.next();
            int halfLength = input.length() / 2;
            for (int i = 0; i < halfLength; i++) {
                char c1 = input.charAt(i);
                char c2 = input.charAt(input.length() - 1 - i);
                if (c1 != c2)
                    cnt++;
            }
            System.out.println(cnt);
        }
    }
}

Measured memory_bytes: 23252
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
typedef long long ll;

int main(){
    double d; cin >> d;
    if(d <= 25)cout << "Christmas";
    if(d <= 24)cout << " Eve";
    if(d <= 23)cout << " Eve";
    if(d <= 22)cout << " Eve";
}


Measured memory_bytes: 256
class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n)]
        self.rank = [0] * n

    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def unit(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        elif self.rank[x] < self.rank[y]:
            self.par[x] = y
            return
        elif self.rank[y] < self.rank[x]:
            self.par[y] = x
        else:
            self.par[y] = x
            self.rank[x] += 1

    def same(self, x, y):
        return self.find(x) == self.find(y)


n, m = map(int, input().split())
s = list(map(int, input().split()))
u = UnionFind(n)

for _ in range(m):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1
    u.unit(a, b)

ans = 0
for i, p in enumerate(s):
    if u.same(i, p - 1):
        ans += 1
print(ans)


Measured memory_bytes: 13812
import math
A,B = (int(x) for x in input().split())
A1 = math.ceil(A/0.08)
A2 = math.ceil((A+1)/0.08)

"""if float((A+1)/0.08).is_integer() == True:
    A2 = math.floor((A+1)/0.08)
else:
    A2 = math.floor((A+1)/0.08) + 1
"""
B1 = math.ceil(B/0.1)
B2 = math.ceil((B+1)/0.1)

"""if float((B+1)/0.1).is_integer() == True:
    B2 = math.floor((B+1)/0.1)
else:
    B2 = math.floor((B+1)/0.1) + 1
"""
a = range(A1, A2)
b = range(B1, B2)
c = set(a) & set(b)
if len(c) == 0:
          print(-1)
else:
          print(min(c))

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

int main()
{
	int n, k;
	cin >> n >> k;
	int cnt = 0;
	for (int i = 1; i <= n; i += 2)
		cnt += 1;
	if (cnt >= k)cout << "YES";
	else cout << "NO";
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

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

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}

const int MOD = INF+7;
const int MAX = 510000;

ll fact[MAX],fact_inv[MAX];

ll modpow(ll a,ll b,ll MOD){
    ll res = 1;
    while(b>0){
        if(b&1)res = res*a%MOD;
        a = a*a%MOD;
        b>>=1;
    }
    return res;
}//繰り返し二乗法:O(log2_b)

ll invp(ll a,ll p){return modpow(a,p-2,p);} //フェルマーの小定理よりa^(-1)==a^(p-2)(mod p)
ll comb(ll n,ll r){
    ll res = 1;
    rep(i,r){
        res = ((res*(n-i))%MOD*invp(i+1,MOD))%MOD;
    }
    return res;
}

int main(){
    ll n,a,b;cin>>n>>a>>b;
    ll res = modpow(2,n,MOD)-1;

    ll temp = 1;
    REP(i,1,a)temp = temp*(n+1-i)%MOD*invp(i,MOD)%MOD;
	res -= temp;
  REP(i,a+1,b)temp = temp*(n+1-i)%MOD*invp(i,MOD)%MOD;
  res -= temp;
  res %= MOD;
  if(res<0)res += MOD;
  cout<<res;
}



Measured memory_bytes: 384
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main(){
    ll n, a, b;
    cin >> n >> a >> b;
    if ( n == 1 ) {
        cout << ((a==b)?1:0) << endl;
        return 0;
    }
    if ( n == 2 ) {
        cout << 1 << endl;
        return 0;
    }
    cout << max(0LL, ( b * ( n - 1 ) + a  ) -  ( b + a * ( n - 1 ) ) + 1 ) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007
#define eps 1e-13
#define PI 3.141592653589793238L
#define inf 1000000011
#define INFLL 1000000000000000011LL
#define vi vector<int>
#define vll vector<long long>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define mp make_pair
#define FF first
#define SS second
#define pb(x) push_back(x)
#define fo(i,a,n) for(i = (a); i < (n); i++)
#define gtl(x) getline(cin, (x))
#define flsh fflush(stdout)
#define sws ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define gcd __gcd
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)((a).size())
#define io_file freopen("input.in", "r", stdin); freopen("output.out", "w", stdout)
const int N =200006;
int vis[N]; ll a[N],b[N];
vector< pair<ll ,int> >v;
int main()
{
//	io_file;
	int n;
	cin>>n;
	ll s1=0,s2=0;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i]>>b[i];
		s1+=1LL*a[i];
		v.pb(mp(a[i],i));
		s2+=1LL*b[i];
		v.pb(mp(b[i],i));
	}

	sort(v.begin(),v.end());
	ll sum=0;int cnt=0;
	set<pii>s;
	for(int i=0;i<n;i++)
	{
		int ind=v[i].SS;
		if(vis[ind]==0)
		{
			cnt++;
			vis[ind]=1;
		}

		sum+=1LL*v[i].FF;
		s.insert(mp(-v[i].FF,v[i].SS));
	}

	if(sum==s1||sum==s2){cout<<sum<<endl;return 0;}

	if(cnt<n){cout<<sum<<endl;return 0;}
	ll ans=INFLL;

	for(int i=1;i<=n;i++)
	{
		ll w=min(a[i],b[i]);
		s.erase(mp(-w,i));
		ll z=-s.begin()->FF;
		ans=min(ans,sum+max(a[i],b[i])-z);
		s.insert(mp(-w,i));
	}
	cout<<ans<<endl;
}

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

int main()
{
  int a = 0;
  int b = 0;
  int c = 0;
  int space = 0;
  
  cin >> a >> b >> c;
 
  if(c < b)
  {
    space = b;
    b = c;
    c = space;
  }
   if(b < a)
  {
   	space = a;
    a = b;
    b = space;
  }
   if(c < b)
  {
    space = b;
    b = c;
    c = space;
  }
  cout << a<< ' ' << b << ' ' << c << endl;
}


Measured memory_bytes: 3096
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<map>
#include<queue>
#include<set>
#include<bitset>
#include<stdio.h>
#include<deque>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long ll;
 
int main()
{
    int a, b, t;
    cin >> a >> b >> t;
    int i = 1, ans = 0;
    while(a*i <= t+0.5){
        ans += b;
        i++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#!/usr/bin/python
# -*- coding: utf-8 -*-

# def
def int_mtx(N):
    x = []
    for _ in range(N):
        x.append(list(map(int,input().split())))
    return np.array(x)

def str_mtx(N):
    x = []
    for _ in range(N):
        x.append(list(input()))
    return np.array(x)

def int_map():
    return map(int,input().split())

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

def print_space(l):
    return print(" ".join([str(x) for x in l]))

# import
import numpy as np
import collections as col

# main code
N = int(input())
A = int_list()

sumlist = []
sumlist.append(A[0])

for i in range(1,N):
    sumlist.append((sumlist[i-1]+A[i])%(10**9+7))

a = 0

for i in range(0,N-1):
    a += (A[i]*(sumlist[N-1]-sumlist[i]))%(10**9+7)

print(a%(10**9+7))

Measured memory_bytes: 49920
n = int(input())
l = list(map(int, input().split()))
ans = 0
for i in range(n-2):
    if l[i+1]!= max(l[i], l[i+1], l[i+2]) and l[i+1]!= min(l[i], l[i+1], l[i+2]):
        ans += 1
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(kbrni,n)cout<<" "<<a[kbrni];cout<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define svecp(v) cout<<#v<<":";each(kbrni,v)cout<<" {"<<kbrni.first<<":"<<kbrni.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout<<" "<<kbrni;cout<<endl
#define smap(m) cout<<#m<<":";each(kbrni,m)cout<<" {"<<kbrni.first<<":"<<kbrni.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 100005;
const int m = 18;

ll dp[41][(1 << m)];

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vi a(3);
    rep(i,3){
        cin >> a[i];
    }
    a[1] += a[2],a[0] += a[1];
    int z = 0;
    rep(i,3){
        z |= (1 << (m-1-a[i]));
    }
    ll ans = 1;
    rep(i,n){
        ans = (ans*10) % MOD;
    }
    dp[0][(1 << (m-1))] = 1;
    rep(i,n){
        rep(j,(1 << m)){
            srep(k,1,11){
                int nj = ((j >> k)|(1 << (m-1)));
                if((nj&z) != z){
                    dp[i+1][nj] = (dp[i+1][nj] + dp[i][j]) % MOD;
                }
            }
        }
    }
    rep(i,(1 << m)){
        ans = (ans+MOD-dp[n][i]) % MOD;
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 82176
macro_rules! get {
      ($t:ty) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.trim().parse::<$t>().unwrap()
          }
      };
      ($($t:ty),*) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              let mut iter = line.split_whitespace();
              (
                  $(iter.next().unwrap().parse::<$t>().unwrap(),)*
              )
          }
      };
      ($t:ty; $n:expr) => {
          (0..$n).map(|_|
              get!($t)
          ).collect::<Vec<_>>()
      };
      ($($t:ty),*; $n:expr) => {
          (0..$n).map(|_|
              get!($($t),*)
          ).collect::<Vec<_>>()
      };
      ($t:ty ;;) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.split_whitespace()
                  .map(|t| t.parse::<$t>().unwrap())
                  .collect::<Vec<_>>()
          }
      };
      ($t:ty ;; $n:expr) => {
          (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
      };
}

#[test]
fn test_1(){
   let expect = solve(3, 5, 4);   
   assert_eq!(true, expect);
}

#[test]
fn test_2(){
   let expect = solve(2, 2, 6);   
   assert_eq!(false, expect);
}

#[test]
fn test_3(){
   let expect = solve(5, 3, 2);   
   assert_eq!(false, expect);
}

#[test]
fn test_4(){
   let expect = solve(100, 100, 200);   
   assert_eq!(true, expect);
}

fn solve(a: u32, b:u32, x:u32) -> bool{
   if (a + b) >= x  &&  a <= x{
        return true; 
    }

    false 
}

fn main() {

    let (a, b, x) = get!(u32, u32, u32);
    let ans = solve(a, b, x);

    println!("{}", if ans {"YES"} else {"NO"});

}


Measured memory_bytes: 4352
#include <iostream>
#include <fstream>
#include <string>
#include <queue>
using namespace std;

int main(){
	int N, Q;
	while(cin >> N >> Q, N|Q){
		int p_max = 0;
		vector<int> date(110);
 		for(int i=0; i<N; i++){
 			int M; cin >> M;
 			for(int j=0; j<M; j++){
 				int d; cin >> d;
 				date[d]++;
 				p_max = max(p_max, date[d]);
 			}
		}
		if(p_max < Q){
			cout << 0 << endl;
		}else{
			for(int i=0; i<110; i++){
				if(date[i]==p_max){
					cout << i << endl;
					break;
				}
			}
		}
	}
	return 0;
}

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

using namespace std;

void fuckit(){
	cout << "NO\n";
	exit(0);
}

int main(){
	string str;
	cin >> str;
	int a = 0;
	int b = 0;
	int c = 0;
	for(auto u : str){
		if(u == 'a') ++a;
		if(u == 'b') ++b;
		if(u == 'c') ++c;
	}
	if(max({a, b, c}) - min({a, b, c}) <= 1) cout << "YES\n";
	else cout << "NO\n";
	return 0;
}


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

void solve(std::istream &in, std::ostream &out);

int main() {
#ifdef LOCAL
  freopen("../IO/a.in", "r", stdin);
//  freopen("../IO/a.in", "w", stdout);
#else
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
#endif
  solve(std::cin, std::cout);
  return 0;
}

constexpr int N = 1e5 + 5;
int dp[N][3];
int c[N][3];

void solve(std::istream &in, std::ostream &out) {
  int n;
  in >> n;
  for (int i = 0; i < n; ++i) {
    in >> c[i][0] >> c[i][1] >> c[i][2];
  }
  dp[0][0] = c[0][0];
  dp[0][1] = c[0][1];
  dp[0][2] = c[0][2];
  for (int i = 1; i < n; ++i) {
    dp[i][0] = numeric_limits<int>::min();
    dp[i][1] = numeric_limits<int>::min();
    dp[i][2] = numeric_limits<int>::min();
    for (int u = 0; u < 3; ++u) {
      for (int v = 0; v < 3; ++v) {
        if (u != v) {
          dp[i][u] = max(dp[i][u], dp[i - 1][v] + c[i][u]);
        }
      }
    }
  }
  int mx = numeric_limits<int>::min();
  for (int i = 0; i < 3; ++i) {
    mx = max(mx, dp[n - 1][i]);
  }
  out << mx << '\n';
}


Measured memory_bytes: 2560
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
template<typename T, typename U> static void amin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> static void amax(T &x, U y) { if (x < y) x = y; }
#define each(it,o) for(auto it = (o).begin(); it != (o).end(); ++ it)

int bipartiteMatching(const vector<vector<int> > &g) {
	int nleft = g.size(), nright = 0;
	each(es, g) if (!es->empty()) nright = max(nright, *max_element(es->begin(), es->end()) + 1);
	vi matchL(nleft, -1), matchR(nright, -1), prev(nleft), seen(nleft, -1);
	rep(i, nleft) {
		vi stk; stk.push_back(i);
		seen[i] = i; prev[i] = -1;
		while (!stk.empty()) {
			int v = stk.back(); stk.pop_back();
			each(ui, g[v]) {
				int u = *ui;
				int j = matchR[u];
				if (j == -1) {
					while (v != -1) {
						matchR[u] = v;
						swap(u, matchL[v]);
						v = prev[v];
					}
					goto break_;
				} else if (seen[j] < i) {
					seen[j] = i; prev[j] = v;
					stk.push_back(j);
				}
			}
		}
	break_:;
	}
	return (int)matchL.size() - count(matchL.begin(), matchL.end(), -1);
}

vector<bool> isprime;
vector<int> primes;
void sieve(int n) {
	if ((int)isprime.size() >= n + 1) return;
	isprime.assign(n + 1, true);
	isprime[0] = isprime[1] = false;
	int sqrtn = (int)(sqrt(n * 1.) + .5);
	for (int i = 2; i <= sqrtn; i ++) if (isprime[i]) {
		for (int j = i * i; j <= n; j += i)
			isprime[j] = false;
	}
	primes.clear();
	for (int i = 2; i <= n; i ++) if (isprime[i])
		primes.push_back(i);
}


int main() {
	sieve(10000002);
	int N;
	while (~scanf("%d", &N)) {
		vector<int> xs(N);
		for (int i = 0; i < N; ++ i)
			scanf("%d", &xs[i]);
		vector<int> diffs;
		rep(i, N) {
			if (i == 0 || xs[i - 1] != xs[i] - 1)
				diffs.push_back(xs[i]);
			if (i == N - 1 || xs[i + 1] != xs[i] + 1)
				diffs.push_back(xs[i] + 1);
		}
		vector<int> vertices[2];
		for (int x : diffs)
			vertices[x % 2].push_back(x);
		vector<vi> g(vertices[0].size());
		rep(i, vertices[0].size()) rep(j, vertices[1].size()) {
			int x = vertices[0][i], y = vertices[1][j];
			if (isprime[abs(x - y)])
				g[i].push_back(j);
		}
		int match = bipartiteMatching(g);
		int ans = match;
		int rems = 0;
		rep(k, 2) {
			int rem = (int)vertices[k].size() - match;
			ans += rem / 2 * 2;
			rems += rem % 2;
		}
		ans += rems / 2 * 3;
		printf("%d\n", ans);
	}
	return 0;
}


Measured memory_bytes: 7664
from math import ceil
N,K=map(int, input().split())
A=list(map(int, input().split()))
F=list(map(int, input().split()))
A=sorted(A)
F=sorted(F, reverse=True)

left=0
right=10**12+1
ans=float("INF")
while True:
    mid=(left+right)//2

    now=0
    for i in range(N):
        if F[i]*A[i]>mid:
            now+=ceil(((F[i]*A[i])-mid)/F[i])
    #print(now, mid)
    if now==K:
        ans=min(ans, mid)
        if right==mid:
            break
        right=mid
    elif now>K:
        if left==mid:
            break
        left=mid
    else:
        if right==mid:
            break
        right=mid
        ans=min(ans, mid)

print(ans)

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

int main()
{
    ll N;
    string S;
    cin >> N;
    cin >> S;
    ll r,g,b;
    r=g=b=0;
    for(ll i=0;i<N;i++){
        if(S[i]=='R')r++;
        else if(S[i]=='G')g++;
        else if(S[i]=='B')b++;
    }

    ll ans=r*g*b;
    
    for(ll i=0;i<N-2;i++){
        for(ll j=i+1;j<N-1;j++){
            if(S[i]!=S[j]&&S[i]!=S[2*j-i]&&S[j]!=S[2*j-i]&&2*j-i<N){
                ans--;
            }
        }
    }
    cout << ans << endl;
}

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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); --i)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = 1LL * INF * INF;

const int MAX = 300005;
int n;
int a[MAX];
int main()
{
	//freopen("in.txt", "r", stdin);
	ios::sync_with_stdio(false); cin.tie(0);

	cin>>n;
	FOR(i,0,3*n)
	{
		cin>>a[i];
	}

	sort(a,a+3*n);
	LL ans = 0;
	FOR(i,0,n)
	{
	//	cerr<<a[3*n-2-i*2]<<" ";
		ans += a[3*n-2-i*2];
	}

	cout<<ans;
}


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


int main() {
  int N, result;
  cin >> N;
  vector<int> A(N, 0), alice(N, 0), bob(N, 0);
  
  repeat(i, N) {
    int a;
    cin >> a;
    A[i] = a;
  }
  
  repeat(i, N) {
    auto itr = max_element(A.begin(), A.end());
    int idx = distance(A.begin(), itr);
    if (i % 2 == 0) {
      alice[i] = A[idx];
    } else {
      bob[i] = A[idx];
    }
    A.erase(A.begin() + idx);
  }
  result = accumulate(alice.begin(), alice.end(), 0) - accumulate(bob.begin(), bob.end(), 0);
  cout << result << endl;

  return 0;
}


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

typedef long long LL;
typedef unsigned long long LONG;
const int N = 1e5 + 5;
const int INF = 0x3f3f3f3f;
const int MAXINT = 2147483647;
const int mod = 1000000007;
const long long MAXLONG = 9223372036854775807;
using namespace std;
typedef pair<int, int> PII;
#define ft fisrt
#define sd second
#define eb emplace_back
#define END '\n'

template <class T>
inline bool Read(T &ret)
{
	char c;
	int sgn;
	if (static_cast<void>(c = getchar()), c == EOF)
		return 0;
	while (c != '-' && (c < '0' || c > '9'))
		c = getchar();
	sgn = (c == '-') ? -1 : 1;
	ret = (c == '-') ? 0 : (c - '0');
	while (static_cast<void>(c = getchar()), c >= '0' && c <= '9')
		ret = ret * 10 + (c - '0');
	ret *= sgn;
	return 1;
}

template <class T>
inline void Write(T x)
{
	if (x < 0)
		putchar('-'), Write(x);
	if (x > 9)
		Write(x / 10);
	putchar(x % 10 + '0');
}

void solve(int question_num)
{
	while(question_num--){
		int n;cin>>n;
		cout<<n*2*3.1415926;
	}
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int t = 1;
	// cin >> t;
	solve(t);
	return 0;
}


Measured memory_bytes: 3804
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int x = Integer.parseInt(sc.next());
    int a = Integer.parseInt(sc.next());
    
    if (x < a) {
	  System.out.println("0");
    } else {
      System.out.println("10");
    }
    
    return;
  }
}


Measured memory_bytes: 22228
from functools import reduce

def judge(S):
    if int(S) < 100:
        print(0)
        return

    kingaku = [int(x) for x in list(S)]
    maxkosuul = kingaku[:-2]
    keta = kingaku[-2:]
    maxkosuu = int(reduce(lambda x, y: x + y, [str(x) for x in maxkosuul]))
    simo = int(reduce(lambda x, y: x + y, [str(x) for x in keta]))
    simo1 = simo - simo//5*5
    simo2 = simo1 - simo1//4*4
    simo3 = simo2 - simo2//3*3
    simo4 = simo3 - simo3//2*2
    if simo//5+simo1//4+simo2//3+simo3//2+simo4 <= maxkosuu :
        print(1)
    else:
        print(0)

S = input()
judge(S)

Measured memory_bytes: 3700
//### In The Name Of GOD ###

//%% Remember; (((He))) is The (((Accepter))) %%

// GOD IS GREATER ...

#include <bits/stdc++.h>

using namespace std;

typedef long long ll ;
typedef long double ld ;

//#define int ll
#define pb push_back
#define bp pop_back
#define pf push_front
#define fp pop_front
#define X first
#define Y second
#define sz(a) (int)(a.size())
#define sg(a, b) (a + b - 1) / b

const int MOD = 1000 * 1000 * 1000 + 7;
const int INF = 1000 * 1000 * 1000 + 10 ;
const int MAXN = 10000 + 10;
const int MLOG = 17;
const int NMAX = 20;

signed main() {
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	int m, n;
	cin >> n >> m;
	int A[MAXN], B[MAXN];
	for(int i = 0; i < n; i++) cin >> A[i];
	for(int i = 0; i < m; i++) cin >> B[i];
	sort(A, A + n, greater<int>());
	sort(B, B + m, greater<int>());
	int x = 0, y = 0, ans = 1;
	for(int i = n * m; i >= 1; i--) {
		if(A[x] == i && B[y] == i) {
			x++;
		   	y++;
		}else if(A[x] == i) {
			x++;
			ans = (ll)ans * y % MOD;
		}else if(B[y] == i) {
			y++;
			ans = (ll)ans * x % MOD;
		}else {
			ans = (ll)ans * max(0, x * y - n * m + i) % MOD;
		}
	}
	ans *= (x == n);
	ans *= (y == m);
	cout << ans;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iterator>
#include<sstream>
#include<iomanip>
#include<map>
#include<queue>
#include<deque>
#include<fstream>
#include<random>
 
#define rep(i, n) for (ll i = 0; i < n; i++) 
#define rrep(i, n) for(ll i = n-1; i>=0; i--)
#define range(i, n, m) for (ll i = n; i < m; i++) 
#define rrange(i, n, m) for (ll i = n - 1; i => m; i--) 
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vp vector<pair<ll, ll> >
#define vvp vector<vector<pair<ll, ll> > >
#define First first
#define Second second.first
#define Third second.second
#define Sort(X) sort(X.begin(), X.end())
#define RSort(X, T) sort(X.begin(), X.end(), greater<T>())
//#define MOD 998244353
#define MAX 100000
 
typedef long long int ll;
typedef unsigned long long int ull;
 
using namespace std;
 
template<class T> inline bool chmax(T & a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T & a, T b) { if (a > b) { a = b; return true; } return false; }
 
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	ll N;
	cin >> N;

	cout << pow(N, 3) << endl;

	return 0;
}

Measured memory_bytes: 888
import sys
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math
import copy
# from fractions import gcd

MOD = 10 ** 9 + 7
# MOD = 998244353
# sys.setrecursionlimit(10**8)


n = int(input())
ans = [0]*(n+1)

for a in range(1, 100):
    for b in range(1, 100):
        for c in range(1, 100):
            num = a*a + b*b + c*c + a*b + b*c + c*a
            if num <= n:
                ans[num] += 1

for i in range(1, n+1):
    print(ans[i])



Measured memory_bytes: 75156
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll solve(ll index,ll k,vector<ll> &h,vector<ll> &dp)
{
    if(dp[index]!=(-1))
        return(dp[index]);
    ll cost=LONG_LONG_MAX;
    for(ll i=1;i<=k;i++)
    {
        if(index<(h.size()-i))
            cost=min(cost,abs(h[index+i]-h[index])+solve(index+i,k,h,dp));
    }
    /*if(index<(h.size()-1))
    cost=abs(h[index+1]-h[index])+solve(index+1,h,dp);
    if(index<(h.size()-2))
    cost=min(cost,abs(h[index+2]-h[index])+solve(index+2,h,dp));*/
    dp[index]=cost;
    return(dp[index]);
}
int main()
{
    ll n;cin>>n;ll k;cin>>k;
    vector<ll> h(n);
    for(ll i=0;i<n;i++)
        cin>>h[i];
    vector<ll> dp(n,-1);
    dp[n-1]=0;
    dp[n-2]=abs(h[n-1]-h[n-2]);
    cout<<solve(0,k,h,dp);
    //cout<<abs(-30);
}


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

int main () {
  int a, b;
  cin >> a >> b;
  int A;
  if (b < 10) A = 10*a + b;
  else if (b == 100) A = 1000*a + 100;
  else A = 100*a + b;
  
  bool ans = false;
  for (int i = 0; i < 317; i++) {
    if (A == i*i) {
      ans = true;
      break;
    }
  }
  if (ans) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


def main():
    H, W, K = NMI()
    choco = [SI() for _ in range(H)]
    ans = 100000
    for case in range(2**(H-1)):
        groups = [[0]]
        for i in range(H-1):
            if (case >> i) & 1:
                groups[-1].append(i+1)
            else:
                groups.append([i+1])
        white = [0] * len(groups)

        is_badcase = False
        cut = len(groups) - 1
        for w in range(W):
            diff = [0] * len(groups)
            for gi, group in enumerate(groups):
                for h in group:
                    if choco[h][w] == "1":
                        white[gi] += 1
                        diff[gi] += 1

            if max(white) <= K:
                is_cont = True
                continue

            if max(diff) > K:
                is_badcase = True
                break

            cut += 1
            white = diff[:]
            continue

        if not is_badcase:
            ans = min(ans, cut)

    print(ans)



if __name__ == "__main__":
    main()

Measured memory_bytes: 9412
#include<iostream>
using namespace std;
int main()
{
	int n;
	while (1)
	{
		cin >> n;
		if (n == 0)
			break;
		int as = 0, bs = 0;
		int ac, bc;
		for (int i = 0; i != n; ++i)
		{
			cin >> ac >> bc;
			if (ac == bc)
				as += ac, bs += bc;
			else if (ac > bc)
				as += ac + bc;
			else
				bs += ac + bc;
		}
		cout << as << " " << bs << endl;
	}
	return 0;
}

Measured memory_bytes: 1156
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const int INF = 100000000;
using namespace std;


string toStr(int n){
    string str;
    int len = static_cast<int>(log10(n));
    int K = 1;
    rep(i,len) K*=10;
    rep(i,len + 1){
        if(n / K == 0) str+= '0';
        else str+= ('0' + n / K);
        n%=K; K/=10;
    }
    return str;
}


int main(){
    int h, w;
    cin >> h >> w;

    string ans = "";
    rep(i,h){
        rep(j,w){
            string s;
            cin >> s;
            if(s == "snuke"){
                ans+=('A' + j);
                ans+=toStr(i + 1);
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 512
///***Bismillahir Rahmanir Rahim***///

///*********************************///
///******Ashraful Haque Toni********///
///********Dept. of CSE,JnU*********///
///email:ashrafulhaquetoni@gmail.com///
///*******contact:01640690531*******///
///*********************************///


#include<bits/stdc++.h>

using namespace std;

#define         ash ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define         pb push_back
#define         mp make_pair
#define         sc(n) scanf("%d",&n);
#define         scl(n) scanf("%I64d",&n);
#define         sc2(m,n) scanf("%d%d",&m,&n);
#define         sc2l(m,n) scanf("%I64d%I64d",&m,&n);
#define         pf printf
#define         Big(x,y) max(x,y);
#define         Small(x,y) min(x,y);
#define         input(array,size) for(int i=0;i<size;i++)cin>>array[i];
#define         newline pf("\n");
#define         f(s,l,in) for(ll i=s;i<l;i+=in)
#define         Max INT_MAX
#define         Min INT_MIN
#define         pi acos(-1.0)
#define         Memset(a,val) memset(a,val,sizeof(a));

const int mod =1e9+7;
const int N =5e6+5;
typedef long long ll;



int main()
{

    ash;
    int n,l,cnt=0,sum=0,small=INT_MIN;
    cin>>n>>l;
    vector<int>v;
    for(int i=1;i<=n;i++)
    {
        int m=l+i-1;
        if(m==0)cnt=1;
        if(m<0&&small<m)small=m;
        v.pb(m);
        sum+=m;
    }
    if(cnt==1)
    {
        cout<<sum<<endl;
        exit(0);
    }
    sort(v.begin(),v.end());
    if(small==INT_MIN)
    {
    sum-=v[0];
    cout<<sum<<endl;
    }
    else
        cout<<sum-small<<endl;



    return 0;
}




Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] nums=new int[100];
        for(int i=0;i<6;i++){
            nums['A'+i]=i;
        }
        String s=sc.nextLine();
        if(nums[s.charAt(0)]>nums[s.charAt(2)])System.out.println(">");
        else if(nums[s.charAt(0)]<nums[s.charAt(2)])System.out.println("<");
        else System.out.println("=");

    }
}


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

int N;
string S[1111];
vector<int> G[1111];
bool used[1111];

void view(int id,string cnt){
  for(int i=0;i<(int)G[id].size();i++){
    cout << cnt + S[G[id][i]] << endl;
    view(G[id][i],cnt+".");
  }
}

int main(){
  cin >> N;
  for(int i=0;i<N;i++){
    int k; cin >> k;
    cin >> S[i+1];
    G[k].push_back( i+1 );
  }
  view(0,"");
}

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



int main(){
    ll x;
    cin >> x;

    if(x>=2100){
        cout << 1 << endl;
        return 0;
    }else{
        int sx = x/100;
        int ax = x%100;
        if(ax>5*sx){
            cout << 0 << endl;
        }else{
            cout << 1 << endl;
        }
    }

    return 0;
    
}


Measured memory_bytes: 256
N, M = map(int, input().split())
Ls = []
Rs = []
for _ in range(M):
    L, R = map(int, input().split())
    Ls.append(L)
    Rs.append(R+1)
L_max = max(Ls)
R_min = min(Rs)
print(max(R_min - L_max, 0))

Measured memory_bytes: 11024