akhauriyash/Code-Regression huggingface dataset:
# 1 "b.cpp"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "b.cpp"
# 1 "/home/tysm/dev/cpplib/bin/../include/cpplib/stdinc.hpp" 1
       
# 12 "/home/tysm/dev/cpplib/bin/../include/cpplib/stdinc.hpp"
# 1 "/home/tysm/dev/cpplib/bin/../stdlib/bits/stdc++.h" 1
 #include <bits/stdc++.h>
# 13 "/home/tysm/dev/cpplib/bin/../include/cpplib/stdinc.hpp" 2
# 1 "/home/tysm/dev/cpplib/bin/../stdlib/ext/pb_ds/assoc_container.hpp" 1
 #include <ext/pb_ds/assoc_container.hpp>
# 14 "/home/tysm/dev/cpplib/bin/../include/cpplib/stdinc.hpp" 2
# 1 "/home/tysm/dev/cpplib/bin/../stdlib/ext/pb_ds/tree_policy.hpp" 1
 #include <ext/pb_ds/tree_policy.hpp>
# 15 "/home/tysm/dev/cpplib/bin/../include/cpplib/stdinc.hpp" 2







using namespace std;
using namespace __gnu_pbds;

using ii = pair<long long, long long>;
using vi = vector<long long>;
using vd = vector<long double>;
using vb = vector<bool>;
using vii = vector<ii>;
using vvi = vector<vi>;
using vvd = vector<vd>;
using vvb = vector<vb>;
using vvii = vector<vii>;
# 50 "/home/tysm/dev/cpplib/bin/../include/cpplib/stdinc.hpp"
inline long long mod(const long long n, const long long m = ((long long)1e9+7)){
    return (n%m + m)%m;
}

/**
 * Euclidean GCD.
 *
 * Time Complexity: O(log(min(a, b))).
 * Space Complexity: O(log(min(a, b))).
 */
long long gcd(const long long a, const long long b){
    if(a < 0 or b < 0)
        return gcd(abs(a), abs(b));
    if(a == 0)
        return b;
    return gcd(b%a, a);
}

/**
 * Euclidean derivated LCM.
 *
 * Time Complexity: O(log(min(a, b))).
 * Space Complexity: O(log(min(a, b))).
 */
long long lcm(const long long a, const long long b){
    // same as a*b/gcd(a, b) but avoiding overflow.
    return a/gcd(a, b)*b;
}
# 2 "b.cpp" 2

int32_t main(){
    (ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL));
    long long x, y;
    cin >> x >> y;
    bool valid = false;
    for(long long i=0; i<=x; ++i){
        if(i*2 + (x-i)*4 == y)
            valid = true;
    }
    if(valid)
        cout << "Yes" << "\n";
    else
        cout << "No" << "\n";
    return 0;
}


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

using namespace std;

using ll = long long;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

int main () {
  cin.tie(0);
  cout << fixed << setprecision(10);

  int n, k; cin >> n >> k;
  string s; cin >> s;
  vector<int> v;
  vector<int> su;
  char now = '1';
  int cnt = 0;
  int tmp = 0;
  for(int i=0;i<n;++i) {
    if(s[i] != now) {
      v.push_back(cnt);
      tmp += cnt;
      su.push_back(tmp);
      cnt = 0;
      now = s[i];
      i--;
    } else {
      cnt++;
    }
  }
  v.push_back(cnt);
  su.push_back(tmp + cnt);
  if(now == '0') {
    v.push_back(0);
    su.push_back(tmp + cnt);
  }
  reverse(su.begin(), su.end());
  su.push_back(0);
  reverse(su.begin(), su.end());
  // printv(v);
  // printv(su);

  if(k * 2 + 1 >= (int)v.size()) cout << n << endl;
  else {
    int sz = v.size();
    int ma = 0;
    for(int i= 0;i + 2 * k < sz;i += 2) {
      // cout << i << endl;
      ma = max(ma, su[i+2*k+1] - su[i]);
    }
    cout << ma << endl;
  }


}


Measured memory_bytes: 1404
package main

import (
	"fmt"
	"math"
)

var A, B, C, D, ans int

func main() {
	fmt.Scan(&A, &B, &C, &D)
	fmt.Println(min(A, B) + min(C, D))
}

/*  ----------------------------------------  */

func combination(x, y int) int {
	return permutation(x, y) / permutation(y, y)
}

func permutation(x, y int) int {
	var ans int = 1
	for i := x - y; 0 < i; i-- {
		ans *= i
	}
	return ans
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}
func pow(x, y int) int { return int(math.Pow(float64(x), float64(y))) }
func abs(x int) int    { return int(math.Abs(float64(x))) }
func floor(x int) int  { return int(math.Floor(float64(x))) }

type XY struct {
	x int
	y int
}
type SortBy []XY

func (a SortBy) Len() int      { return len(a) }
func (a SortBy) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool {
	if a[i].x == a[j].x {
		return a[i].y > a[j].y
	}
	return a[i].x > a[j].x
}


Measured memory_bytes: 512
#include <stdio.h>


int main(){
	int x;
	scanf("%d", &x);

	int h = x / 3600;
	int m = (x - h*3600) / 60;
	int s = x - h*3600 - m*60;

	printf("%d:%d:%d\n", h, m, s);

	return 0;
}


Measured memory_bytes: 2096
def mcd(m,n):
    if n==0:
        return(m)
    else:
        r = m % n
    return(mcd(n,r))

def lcd(m,n):
    return(m * n // mcd(m, n))

class Fry:
    def __init__(self,a1,m1,a2,m2,a3,m3):
        self.a1 = a1
        self.m1 = m1
        self.a2 = a2
        self.m2 = m2
        self.a3 = a3
        self.m3 = m3


    def test(self,a,m):
        n = 0
        x = 1
        while True:
            x1 = (a * x) % m
            n += 1
            if x1 == 1:
                break
            else:
                x = x1
        return(n)

    def mv(self):
        n1 = self.test(self.a1,self.m1)
        n2 = self.test(self.a2,self.m2)
        n3 = self.test(self.a3,self.m3)
        m1 = lcd(n1,n2)
        m2 = lcd(m1,n3)

        return(m2)

while True:
    a1,m1,a2,m2,a3,m3 = list(map(int, input().strip().split()))
    if a1==m1==a2==m2==a3==m3==0:
        break
    fry = Fry(a1,m1,a2,m2,a3,m3)
    print(fry.mv())

Measured memory_bytes: 7580
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define ios ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0)
#define so sizeof
#define pb push_back
#define cl clear() ;
#define vl vector<ll>
#define sz size()
#define len length()
#define el endl;cout.flush()
#define be begin()
#define fi first
#define se second
#define br break
#define en end()
#define ro return 0
#define br break
#define eb emplace_back
#define con continue
#define ms(x) memset(x , 0, so x)
#define all(x) (x).be , (x).en
#define acc(x) accumulate((x).be , (x).en , 0ll)
#define forn(i,a,b) for(ll i=a;i<=b;++i)
#define rng_58 mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define plll pair<ll,pair<ll,ll>>
#define plvl pair<pair<ll,ll> ,ll>
#define mp make_pair
#define trace3(a,b,c) cerr <<"a is " << a << " b is " << b << " c is " << c << el;
#define trace4(a,b,c,d) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << el ;
#define trace5(a,b,c,d,e) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << " e is " << e << el;
#define trace6(a,b,c,d,e,f) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << " e is " << e << " f is " << f << el ;
ll h , w , n ;
bool safe(ll x , ll y)
{
    if(x >= 1 and x <= h){
        if(y>=1 and y <= w) {
            if(x+2<=h){
                if(y+2<=w){
                    return true;
                }
            }
        }
    }
    return false;
}
int main()
{
    ios;
    cin >> h >> w >> n ;
    map<pair<ll,ll> , ll > mpp ;
    while(n--){
        ll x , y;
        cin >> x >> y;
        forn(i , x-2 , x) {
           forn(j , y-2 , y){
              if(safe(i , j ) == true){
                pll foo = {i ,j } ;
                if(mpp[foo] >= 9){
                    mpp[foo] = 9 ;
                }
                else {
                    mpp[foo]++;
                }
              }
           }
        }
    }
    ll ans[10] ;
    ms(ans) ;
    ll sum = 0 ;
    for(auto &x : mpp){
        ll foo = x.se ;
        ans[foo]++;
    }
    forn(i , 1 , 9 ) sum = sum + ans[i] ;
    ll tot = (w-2) * (h-2) ;
  ///  cout << "tot is " << tot << " sum is " << sum << el ;
    ans[0] = tot - sum ;
    forn(i , 0 , 9){
      cout << ans[i] << el ;
    }

}


Measured memory_bytes: 56576
#include <iostream>
using namespace std;
int count(int x, int c){
   if(x >= 500){
       return count(x-500, c+1);
   }
   if(x >= 100){
       return count(x-100, c+1);
   }
   if(x >= 50){
       return count(x-50, c+1);
   }
   if(x >= 10){
       return count(x-10, c+1);
   }
   if(x >= 5){
       return count(x-5, c+1);
   }
   if(x == 0){
       return c;
   }
   else {
       return count(x-1,c+1);
   }
}

int main (void){
   int x;
   while (true){
       cin >> x;
       if(x == 0) {
           break;
       }
       cout << count(1000 - x, 0) << endl;
   }
}


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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

using namespace std;

int main() {
  in(int, n, k);
  vector<int> p(n);
  rep(i, n) cin >> p[i];
  sort(all(p));
  int sum = 0;
  rep(i, min(n, k)) sum += p[i];
  out(sum);
}


Measured memory_bytes: 3624
n = int(input())
a = list(map(int,input().split()))
cnt = []
cnt_r = 0
for i in range(n):
    for j in range(1, 9):
        if a[i] < 400*j:
            if j not in cnt:
                cnt.append(j)
            break
    else:
        cnt_r += 1
if len(cnt) == 0:
    print(1, cnt_r)
else:
    print(len(cnt), len(cnt)+cnt_r)


Measured memory_bytes: 3060
//Author : Sukarna Paul

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
#include<ext/pb_ds/detail/standard_policies.hpp>
#define pi acos(-1)
#define pb push_back
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define MAX 300005
#define INF 0x3f3f3f3f
template <class T> inline T bigmod(T p,T e,T M){ll ret = 1LL;for(; e > 0LL; e >>= 1LL){if(e & 1LL) ret = (ret * p) % M;p = (p * p) % M;}return (T)ret;}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}   // M is prime}

using namespace std;
using namespace __gnu_pbds;

typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update>pref_trie;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;




int main(){
    IOS
    //freopen("output.txt","w",stdout);
    string s;
    cin>>s;
    int last [26];
    for(int i=0;i<26;i++)last[i]=-11;
    for(int i=0;i<s.length();i++){
        if(i-last[s[i]-'a']<3){
            cout<<last[s[i]-'a']+1<<" "<<i+1<<"\n";
            return 0;
        }
        last[s[i]-'a']=i;

    }
    cout<<"-1 -1\n";
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int n, q, c, e, d[111111]; long long t, x[111111], y[111111];
int main() {
	scanf("%d%lld%d", &n, &t, &q);
	for (int i = 0; i < n; i++) scanf("%lld%d", x + i, d + i);
	for (int i = 1; i < n; i++) if (d[i] - d[i - 1] == 1) y[c++] = (x[i - 1] + x[i]) / 2;
	for (int i = 0; i < q; i++) {
		scanf("%d", &e); e--;
		int ptr = lower_bound(y, y + c, x[e]) - y;
		long long ret = x[e] + t * (d[e] * -2 + 3);
		if (d[e] == 1) { if (ptr != c) ret = min(ret, y[ptr]); }
		else if (--ptr != -1) ret = max(ret, y[ptr]);
		printf("%lld\n", ret);
	}
	return 0;
}

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

int main()
{
	int i,j,k,l,m[101][101],p[101],n;
	
	cin >> n;
	
	for(i=1;i<=n;i++) cin >> p[i-1] >> p[i];
	for(i=1;i<=n;i++) m[i][i]=0;
	for(l=2;l<=n;l++)
	{
		for(i=1;i<=n-l+1;i++)
		{
			j=i+l-1;
			m[i][j]= (1 << 21);
			for(k=i;k<=j-1;k++)
			{
				m[i][j]=min(m[i][j],m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]);
			}
		}
	}
	cout << m[1][n] << endl;
	return 0;
}

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

#define MOD 1000000007
#define MAX_N 100000
#define MAX_P 5114514
Int fact[MAX_P],inv[MAX_P],finv[MAX_P];
Int extgcd(Int a,Int b,Int& x,Int& y){
  Int d=a;
  if(b!=0){
    d=extgcd(b,a%b,y,x);
    y-=(a/b)*x;
  }else{
    x=1;y=0;
  }
  return d;
}
Int mod_inverse(Int a,Int mod){
  Int x,y;
  extgcd(a,mod,x,y);
  return (mod+x%mod)%mod;
}
Int euler_phi(Int n){
  Int res=n;
  for(Int i=2;i*i<=n;i++){
    if(n%i==0){
      res=res/i*(i-1);
      for(;n%i==0;n/=i);
    }
  }
  if(n!=1) res=res/n*(n-1);
  return res;
}

Int euler[MAX_N];

void euler_phi2(){
  for(Int i=0;i<MAX_N;i++) euler[i]=i;
  for(Int i=2;i<MAX_N;i++){
    if(euler[i]==i){
      for(Int j=i;j<MAX_N;j+=i) euler[j]=euler[j]/i*(i-1);
    }
  }
}

Int mod_pow(Int x,Int n,Int mod){
  Int res=1;
  while(n){
    if(n&1) (res*=x)%=mod;
    (x*=x)%=mod;
    n>>=1;
  }
  return res;
}

Int mod_inverse2(Int a,Int mod){
  return mod_pow(a,mod-2,mod);
}

void init(Int mod){
  fact[0]=1;
  for(Int i=1;i<MAX_P;i++)
    fact[i]=(fact[i-1]*i)%mod;

  inv[1]=1;
  for(Int i=2;i<MAX_P;i++)
    inv[i]=inv[mod%i]*(mod-mod/i)%mod;

  finv[0]=1;
  for(Int i=1;i<MAX_P;i++)
    finv[i]=(finv[i-1]*inv[i])%mod;
}

Int mod_fact(Int n,Int mod,Int& e){
  e=0;
  if(n==0) return 1;
  Int res=mod_fact(n/mod,mod,e);
  e+=n/mod;
  if(n/mod%2!=0)return res*(mod-fact[n%mod]) %mod;
  return res*fact[n%mod]%mod;
}

Int mod_comb(Int n,Int k,Int mod){
  if(n==k||k==0) return 1;
  Int e1,e2,e3;
  Int a1=mod_fact(n,mod,e1),a2=mod_fact(k,mod,e2),a3=mod_fact(n-k,mod,e3);
  if(e1>e2+e3) return 0;
  return a1*mod_inverse(a2*a3%mod,mod)%mod;
}

Int mod_comb2(Int n,Int k,Int mod){
  Int res=1;
  for(Int i=0;i<k;i++){
    res*=(n-i)%mod;
    res%=mod;
    res*=mod_inverse(i+1,mod);
    res%=mod;
  }
  return res;
}

Int mod_comb3(Int n,Int k,Int mod){
  if(n==k||k==0) return 1;
  if(n<0||k<0||n<k) return 0;
  return (((fact[n]*finv[k])%mod)*finv[n-k])%mod;
}

Int montmort(Int n,Int mod){
  Int res=0,inv=1;
  for(Int k=2;k<=n;k++){
    (inv*=mod_inverse(k,mod))%=mod;
    if(k%2) (res+=mod-inv)%=mod;
    else (res+=inv)%=mod;
  }
  for(Int i=1;i<=n;i++)
    (res*=i)%=mod;
  return res;
}

signed main(){
  init(MOD);
  Int a,b,c,x,y;
  while(cin>>a>>b>>c>>x>>y,a+b+c){
    Int ans=0;
    x-=a;y-=b;
    if(x<0||y<0){
      cout<<ans<<endl;
      continue;
    }
    
    for(Int i=0;i<=min(x,y);i++){
      Int tmp=mod_comb(a+b+c+i-1,i,MOD);
      (tmp*=mod_comb(a+(x-i)-1,x-i,MOD))%=MOD;
      (tmp*=mod_comb(b+(y-i)-1,y-i,MOD))%=MOD;
      (ans+=tmp)%=MOD;
    }
    
    (ans*=fact[a+b+c])%=MOD;
    (ans*=finv[a])%=MOD;
    (ans*=finv[b])%=MOD;
    (ans*=finv[c])%=MOD;
    cout<<ans<<endl;
  }
  return 0;
}



Measured memory_bytes: 122868
import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int x = scan.nextInt();
    int y = scan.nextInt();
    int z = scan.nextInt();
    int temp = x;
    x = y;
    y = temp;
    temp = x;
    x = z;
    z = temp;
    System.out.println(x + " " + y + " "+z);
  }
}
    

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#include<math.h>
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

int main() {
  long N;
  cin>>N; 
  int mod=1000000007;
  vector<bool>a(N-1);
  for (int i = 0; i < N-1; i++) {
    a.at(i)=true;
    for (int j = 2; j <= sqrt(i+2); j++) {
      if((i+2)%j==0){
        a.at(i)=false;
        break;
      }  
    }
  }
  long ans=1;
  for (int i = 0; i < N-1; i++) {
    if(a.at(i)){
      int yo=N/(i+2);
      int di=yo;
      while(di>1){
        di/=(i+2);
        yo+=di;
      }
      ans=ans*(yo+1)%mod;
    }
  }
  
      cout<<ans<<endl;
 
}

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

int main() {
  int T;
  cin >> T;
  for (int i = 0; i < T; i++) {
    long long int A, B, C, D;
    cin >> A >> B >> C >> D;
    if (B > A || B > D)
      cout << "No" << endl;
    else {
      long long int g = __gcd(B, D);
      if (A % B + (B - A % B - 1) / g * g <= C) {
        cout << "Yes" << endl;
      } else {
        cout << "No" << endl;
      }
    }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mod 1000000007
#define ff first
#define ss second
using namespace std;
/*ll power(ll x,ll y)
{
    ll res=1;
    while(y>0)
    {
        if(y%2==1)
            res=(res*x)%mod;
        x=(x*x)%mod;
        y=y/2;
    }
    return res;
}*/
int main()
{
 ll n,i;
 cin>>n;
 ll arr[n+1],v[n];
 for(i=1;i<=n-1;i++)
    cin>>v[i];
 arr[1]=100000000;
 for(i=1;i<=n-1;i++)
 {
     arr[i]=min(arr[i],v[i]);
     arr[i+1]=v[i];
 }
 ll s=0;
 for(i=1;i<=n;i++)
    s=s+arr[i];
 cout<<s<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define p(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
//#define int long long


using namespace std;


int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };




ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}

ll myPow(ll x, ll n, ll m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}

ll pow2(ll a, ll n) {//aのn乗を計算します。
	ll x = 1;
	while (n > 0) {//全てのbitが捨てられるまで。
		if (n & 1) {//1番右のbitが1のとき。
			x = x * a;
		}
		a = a * a;
		n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
	}
	return x;
}

long long nCr(int n, int r) {
	if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
	long long ans = 1;
	int i;

	for (i = 1; i <= r; i++) {
		ans *= n - r + i;
		ans /= i;
	}

	return ans;
}


const int MOD = 1000000007;

bool arr[1050000];
int sosuu[100010];
void Eratosthenes() {
	ll N = 1050000;
	int c = 0;
	for (int i = 0; i < N; i++) {
		arr[i] = 1;
	}
	for (int i = 2; i < sqrt(N); i++) {
		if (arr[i]) {
			for (int j = 0; i * (j + 2) < N; j++) {
				arr[i *(j + 2)] = 0;
			}
		}
	}

	for (int i = 2; i < N; i++) {
		if (arr[i]) {
			sosuu[c] = i;
			//cout << sosuu[c] << " ";
			c++;
		}
	}
	//cout << endl;
	//cout << c << endl;
}


map<ll, int>mp;
int main() {
	ll N, A, B; cin >> N >> A >> B;
	if (A > B || (N < 2 && A!=B)) {
		cout << 0 << endl;
		return 0;
	}
	ll ans = (B - A)*(N - 2) + 1;
	p(ans);
}

Measured memory_bytes: 256
#include <iostream>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;

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

    int n;
    cin >> n;

    int mini = 300000;
    int count = 0;
    REP(i, n) {
        int tmp; cin >> tmp;
        if (tmp < mini) {
            mini = tmp;
            count++;
        }
    }

    cout << count << '\n';
    return 0;
}


Measured memory_bytes: 256
def main():
    n=int(input())
    nowt, nowx, nowy = (0, 0, 0)
    is_ok = True
    for _ in range(n):
        t,x,y = map(int,input().split())
        if is_ok:
            dt = t - nowt
            d = abs(x-nowx) + abs(y-nowy)
            nowx, nowy, nowt = x, y, t
            if dt < d:
                is_ok = False
            elif (dt - d) % 2 != 0:
                is_ok = False
    if is_ok:
        print("Yes")
    else:
        print("No")
    
if __name__ == "__main__":
    main()

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

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
typedef long long int ll;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T>
bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false;}
template<typename T>
bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false;}
// clang-format on

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll H;
    cin >> H;
    ll ans = 0;
    ll cnt = 1;
    while (H > 0) {
        ans += cnt;
        H /= 2;
        cnt *= 2;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[1001],d[1001];
int main()
{
	int n,x,c=0,i;
	cin>>n>>x;
	for (i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	d[1]=0;
	for (i=2;i<=n+1;i++)
	{
		d[i]=d[i-1]+a[i-1];
	}
	for (i=1;i<=n+1;i++)
	{
		if (d[i]<=x) c++;
	}
	cout<<c;
}


Measured memory_bytes: 256
import sys

input = sys.stdin.readline
N, M = map(int, input().split())
H = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(M)]
g = [[] for _ in range(N)]
for a, b in AB:
    a -= 1
    b -= 1
    g[a].append(b)
    g[b].append(a)

ans = 0
for i in range(N):
    flg = True
    for j in g[i]:
        flg = flg & (H[i] > H[j])
    ans += flg
print(ans)


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

int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> A(N);
    int total = 0;
    for (int i = 0; i < N; i++)
    {
        int A_i;
        cin >> A_i;
        A.at(i) = A_i;
        total += A_i;
    }
    int count = 0;
    for (int i = 0; i < N; i++)
    {
        if (A.at(i) * 4 * M >= total)
        {
            count++;
        }
    }
    if (count >= M)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define trav(x,A) for(auto &x:A)
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef vector<int> veci;
typedef vector<long long> vecl;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);

//Required Functions

ll power(ll x,ll y) 
{ 
	if (y == 0) 
		return 1; 
	ll p = power(x, y/2) % MOD; 
	p = (p * p) % MOD; 
  
	return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

int main()
{
	#ifndef ONLINE_JUDGE
	if (fopen("INPUT.txt", "r"))
	{
		freopen ("INPUT.txt" , "r" , stdin);
		//freopen ("OUTPUT.txt" , "w" , stdout);
	}
	#endif
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	clock_t clk;
	clk = clock();
//-----------------------------------------------------------------------------------------------------------//

	string S;
	cin>>S;
	if(S=="AAA" || S=="BBB")
	{
		cout<<"No"<<endl;
	}
	else
	{
		cout<<"Yes"<<endl;
	}
	

//-----------------------------------------------------------------------------------------------------------//


	clk = clock() - clk;
	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << endl;

	return 0;
}

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

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  vector<int> c(n);
  for (int i = 0; i < n; i++) {
    cin >> v.at(i);
  }
  for (int i = 0; i < n; i++) {
    cin >> c.at(i);
  }

  int totalCost = 0;
  int totalValue = 0;
  for (int i = 0; i < n; i++) {
    int cost = c.at(i);
    int value = v.at(i);
    if (cost < value) {
      totalCost += cost;
      totalValue += value;
    }
  }

  cout << (totalValue - totalCost) << endl;
  return 0;
}


Measured memory_bytes: 256
//package AtCoder_163;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static void main(String[] args)throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int r=Integer.parseInt(br.readLine());
        System.out.println(2*Math.PI*r);
    }
}


Measured memory_bytes: 33288
N, M = map(int,input().split())

s_list = []
c_list = []

flag = True
for i in range(M):
    s,c= map(int,input().split())

    if s > N:
        flag = False
        break
    try:
        double = s_list.index(s)
        if double >= 0:
            if c != c_list[double]:
                flag = False
                break
        else:
            continue
    except ValueError:
        s_list.append(s)
        c_list.append(c)
   

#print(s_list)
#print(c_list)

sum = 0

for j in range(1,N+1):
    #if len(s_list) <= j:
    #    continue
    

    tt = N - j
    keta = 10**tt
    if keta == 0:
        keta = 1
    

    try:
        h = s_list.index(j)
        if j == 1 and N != 1:
            if c_list[h] == 0:
                flag = False
                break
        sum += c_list[h] * keta
    except ValueError:
        if keta == 1:
            sum += 0
        elif j == 1:
            sum += 1 * keta
        else:
            sum += 0


        

if flag:
    print(sum)
else:
    print(-1)

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define N 100010
#define ll long long
using namespace std;
int n,m;
ll dta[N],f[N];
ll v[N];
int cnt;
void work(ll x,ll y)
{
    if(!x) return;
    int p=upper_bound(v+1,v+1+cnt,x)-v-1;
    if(!p) dta[1]+=y,dta[x+1]-=y;
    else
	{
		f[p]+=x/v[p]*y;
		work(x%v[p],y);
	}
}
int main()
{
	scanf("%d%d",&n,&m);
	v[++cnt]=n;
	for(int i=1;i<=m;i++)
	{
		ll a;
		scanf("%lld",&a);
		while(a<=v[cnt]) cnt--;
		v[++cnt]=a;
	}
	f[cnt]=1;
	for(int i=cnt-1;i>=1;i--)
	{
		
		f[i]+=v[i+1]/v[i]*f[i+1];
		work(v[i+1]%v[i],f[i+1]);
	}
	dta[1]+=f[1];
	dta[v[1]+1]-=f[1];
	ll ans=0;
	for(int i=1;i<=n;i++)
	{
		ans+=dta[i];
		printf("%lld\n",ans);
	}
	return 0;
}

Measured memory_bytes: 5588
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
static const int mod = 1e9 + 7;
int main() {
    int N;
    cin >> N;
    vector<int> prime;
    for (int i = 2; i <= 1000; i++) {
        bool isPrime = true;
        for (int p : prime) {
            if (i % p == 0) {
                isPrime = false;
                break;
            }
        }
        if (isPrime) prime.push_back(i);
    }
    ll ans = 1;
    for (int p : prime) {
        ll i = p, t = 0;
        while (i <= N) {
            t += N / i;
            i *= p;
        }
        ans *= t + 1;
        ans %= mod;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;
using ll = long long;

int main() {
  int n;
  cin >> n;
  vector<ll> X(n), Y(n);
  int st = 0;
  for (int i = 0; i < n; i++) {
    ll x, y;
    cin >> x >> y;
    X[i] = x - y;
    Y[i] = x + y;
    st |= 1 << (abs(x + y) % 2);
  }
  if (st == 3) {
    cout << "-1\n";
    return 0;
  }
  vector<ll> d;
  if (st == 1) d.push_back(1);
  for (int i = 0; i < 38; i++) {
    d.push_back(1LL << 38 - i);
  }
  d.push_back(1);
  cout << d.size() << '\n';
  for (ll x : d) cout << x << ' ';
  cout << '\n';
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < d.size(); j++) {
      int dx = 0;
      int dy = 0;
      if (X[i] > 0) {
        dx = 1;
        X[i] -= d[j];
      } else {
        dx = -1;
        X[i] += d[j];
      }
      if (Y[i] > 0) {
        dy = 1;
        Y[i] -= d[j];
      } else {
        dy = -1;
        Y[i] += d[j];
      }
      if (dx > 0 && dy > 0) cout << 'R';
      if (dx < 0 && dy > 0) cout << 'U';
      if (dx < 0 && dy < 0) cout << 'L';
      if (dx > 0 && dy < 0) cout << 'D';
    }
    cout << '\n';
  }
}


Measured memory_bytes: 256
def mod(x):
    return int(x % (1e+9 + 7))


def power(x, n):
    ans = 1
    for _ in range(n):
        ans = mod(ans) * mod(x)
    return mod(ans)


def combination(n):
    return mod(power(10, n) - 2 * power(9, n) + power(8, n))


if __name__ == '__main__':
    N = int(input())
    print(combination(N))


Measured memory_bytes: 9184
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ld long double
#define fi first
#define se second
#define all(uiet) uiet.begin(),uiet.end()
#define read(UIET) for(int i = 0; i < n; ++i) cin >> UIET[i]
#define out(UIET) for(int i = 0; i < n; ++i) cout << UIET[i]
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vpp vector<pair< int, int > >
#define pll pair<int , int >
#define ppll pair < pll , pll >
#define debug(n1) cout << n1 << endl
#define len(a) ((int) (a).size())
#define endl "\n"
#define mod 1000000007
const int INF=(1LL<<60)-1;
const int MAXN = 1000001;
vector<int> adj[MAXN];
int power(int x, int y, int p = mod){ 
    int res = 1; 
    x = x % p; 
    if (x == 0) return 0; 
    while (y > 0) {  
        if (y & 1) res = (res*x) % p; 
        y = y >> 1;
        x = (x * x) % p;   
    } 
    return res; 
} 
int modFact(int n, int p = mod) 
{ 
    if (n >= p) 
        return 0; 
  
    int result = 1; 
    for (int i = 1; i <= n; i++) 
        result = (result * i) % p; 
  
    return result; 
} 
int32_t main(){
    SPEED;
    int a, b, k;
    cin >> a >> b >> k;
    int num = abs(a - b) + 1;
    if(k >= num){
        for(int i = a; i <= b; ++i){
            cout << i << endl;
        }
        return 0;
    }
    int cntu = k, cntd = k - 1;
    set<int> s;
    for(int i = a; i <= b; ++i){
        cntu--;
        s.insert(i);
        if(cntu == 0) break;
    }
    for(int i = b - cntd; i <= b; ++i){
        s.insert(i);
    }
    for(int x: s) cout << x << endl;
}
// check indices of loop
// check for overflow


Measured memory_bytes: 27084
def resolve():
    S = "0" + input()
    N = len(S)

    dp = [[1<<60]*2 for _ in range(N+1)]
    dp[0][0] = 0
    for i in range(N):
        now = int(S[i])
        dp[i+1][0] = min(dp[i][0]+now, dp[i][1]+(10- now))
        dp[i + 1][1] = min(dp[i][0] + now + 1, dp[i][1] + (10 - now - 1))
    print(dp[N][0])


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 162312
#include <iostream>
#include <algorithm>
#include <stdio.h>

using namespace std;

int main()
{
	int n, x;
	cin >> n >> x;

	int i,j,k, count;
	while (n != 0 || x != 0) {
		i = 0;
		count = 0;

		for (i = 1; i <= n; i++) {
			for (j = 1; j <= n ; j++) {
				if(j!=i){
					for (k = 1; k <= n ; k++) {
						if (k != i && k != j) {
							if (i + j + k == x) {
//								cout << i << j << k << endl;
								count++;
							}
						}
					}
				}
			}
		}
		count /= 6;
		cout << count << endl;

		cin >> n >> x;
	}

	return 0;
}



Measured memory_bytes: 3084
from collections import deque

INF = float('inf')

H,W=map(int,input().split())
grid = [input() for i in range(H)]

# 初期の黒('#')の位置からの距離
dist = [[-1]*W for _ in range(H)]

## '#'の位置をキューに追加（＝今回はこれが複数あるので、複数スタートとなる）
black_cells = deque()
for i in range(H):
    for j in range(W):
        if grid[i][j]=="#":
            dist[i][j]=0
            black_cells.append((i,j))

d = 0
while black_cells:
    # キューとして使うのでpop()ではなくpopleft()
    h, w = black_cells.popleft()
    d = dist[h][w]
    for dy, dx in ((1, 0), (0, 1), (-1, 0), (0, -1)):
        new_h = h + dy
        new_w = w + dx
        if new_h < 0 or H <= new_h or new_w < 0 or W <= new_w:
            continue
        if dist[new_h][new_w] == -1:  # セルが白('.')であるのと同義
            dist[new_h][new_w] = d+1
            black_cells.append((new_h, new_w))
print(d)


Measured memory_bytes: 87900
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int[] A = new int[N];
            for (int i = 0; i < N; i++) {
                A[i] = in.nextInt();
            }

            int numColors = 1;
            int[] colorToA = new int[N];
            Arrays.fill(colorToA, -100000);
            colorToA[N - 1 - 0] = A[0];
            for (int i = 1; i < N; i++) {
                int maxAColor = upper_bound(colorToA, A[i] - 1) - 1;
                colorToA[maxAColor] = A[i];
                numColors = Math.max(numColors, Math.abs(N - maxAColor));
            }
            System.out.println(numColors);
        }
    }

    public static final int upper_bound(int[] vs, int v) {
        int n = vs.length;
        if (vs[n - 1] <= v) {
            return n;
        }
        if (vs[0] > v) {
            return 0;
        }
        int l = 0;
        int r = n - 1;
        assert vs[l] <= v;
        assert vs[r] > v;
        for (; l + 1 < r;) {
            int c = (l + r) >>> 1;
            if (vs[c] <= v) {
                l = c;
            } else {
                r = c;
            }
        }
        return r;
    }
}


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

int main(){
  int n, a[100];
  cin >> n;
  for(int i = 0;i < n;i++) cin >> a[i];
  for(int i = n-1;i >= 1;i--) cout << a[i] << " ";
  cout << a[0] << "\n";
  return 0;
}



Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store")  
#pragma GCC optimize ("-fno-defer-pop") 
#define all(a) a.begin(),a.end()
#define bs binary_search
#define ll long long int
#define ps push_back
#define fs first
#define sc second
#define mkp make_pair
#define mod 1000000007
ll ar[22][22];
ll dp[22][2097152];
ll maxval(ll i,ll n,ll mask){
	if(i==n){
		return 1;
	}

	if(dp[i][mask]!=-1){
		return dp[i][mask]%mod;
	}

	ll j,k=0;
	for(j=0;j<n;j++){
		if(ar[i][j]==1&&!(mask&(1<<j))){
			k=(k%mod+maxval(i+1,n,(mask|(1<<j)))%mod)%mod;
		}
	}
	return dp[i][mask]=k%mod;
}
int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l,n;
	cin>>n;

	memset(dp,-1,sizeof(dp));

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

	ll mask=0;
	
	ll g=maxval(0,n,mask)%mod;
	cout<<g;
	return 0;
}
//ctrl H replace

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;


int main() {
    ll M; cin >> M;
    ll sum = 0;
    ll digits = 0;
    REP(i,M){
        ll c,d; cin >> c >> d;
        sum += c*d;
        digits += d;
    }
    cout << (digits-1) + (sum-1)/9 << endl;
    return 0;
}

Measured memory_bytes: 3576
n = int(input())
h_s = list(map(int, input().split()))

water = 0
pre = 0
for now in h_s:
  if now > pre:
    #もしもpreよりもnowの方が大きい場合 pre はnowに内包される
    water += now - pre
  pre = now
print(water)
    

Measured memory_bytes: 2940
#include<cstdio>
#include<cstdlib>
#include<algorithm>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

typedef long long ll;

ll xgcd(ll a,ll b,ll &x,ll &y){
	if(b==0){ x=1; y=0; return a; }
	ll g=xgcd(b,a%b,y,x); y-=a/b*x;
	return g;
}

ll modinv(ll a,ll m){
	ll x,y;
	if(xgcd(a,m,x,y)==1) return (x+m)%m;
	return -1;
}

const int N_MAX=200;
int moddet(int n,int A[N_MAX][N_MAX],int M){
	rep(i,n) rep(j,n) {
		A[i][j]%=M;
		if(A[i][j]<0) A[i][j]+=M;
	}

	int res=1;
	rep(i,n){
		int pivot=-1;
		for(int k=i;k<n;k++) if(A[k][i]!=0) pivot=k;
		if(pivot==-1) return 0;

		if(pivot!=i){
			rep(j,n) swap(A[i][j],A[pivot][j]);
			res=(ll)res*(M-1)%M;
		}

		for(int k=i+1;k<n;k++) {
			ll c=A[k][i]*modinv(A[i][i],M)%M;
			for(int j=i;j<n;j++){
				A[k][j]-=c*A[i][j]%M;
				if(A[k][j]<0) A[k][j]+=M;
			}
		}
	}
	rep(i,n) res=(ll)res*A[i][i]%M;

	return res;
}

int main(){
	int n,m; scanf("%d%d",&n,&m);

	const int M=1000000007;
	int A[200][200]={};
	rep(i,m){
		int u,v; scanf("%d%d",&u,&v); u--; v--;
		if(u==0 || v==0){
			int x=rand(),y=rand();
			A[u][v]=x;
			A[v][u]=y;
		}
		else{
			int x=rand();
			A[u][v]= x;
			A[v][u]=-x;
		}
	}

	puts(moddet(n,A,M)!=0?"Yes":"No");

	return 0;
}

Measured memory_bytes: 1176
//c++ テンプレ
#include<bits/stdc++.h>
using namespace std;

typedef long long llint;
typedef long double ld;

#define inf 1e18
#define mod 1000000007
priority_queue<llint,vector<llint>,greater<llint> > que;
priority_queue<llint> Que;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


void solve(){
    vector<char>v;
    string s;
    cin >> s;
    for(char c:s){
        if(c=='0')v.push_back('0');
        if(c=='1')v.push_back('1');
        if(c=='B'){
            if(v.size())v.pop_back();
        }
    }
    for(char c:v)cout << c;
    cout << endl;
}

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


Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int table[256] = {0};
	char c;

	while((c = getchar()) != EOF){
		table[c]++;
	}

	for(int i = 97; i <= 122; i++)
	{
		printf("%c : %d\n", i, table[i] + table[i - 32]);
	}

	return 0;
}


Measured memory_bytes: 2700
#include<cstdio>
#include<vector>
#include<algorithm>
#define FOR(i, a, b) for (i = a; i < b; ++i)
#define FOR_I(i, a, b) for (int i = a; i < b; ++i)

using namespace std;

int main()
{
  int a,b,c,d;
  scanf("%d\n%d\n%d\n%d", &a, &b, &c, &d);
  int m,n;
  m = a > b ? b : a;
  n = c > d ? d : c;
  printf("%d\n", m + n);
}

Measured memory_bytes: 128
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <bitset>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()

#pragma region UnionFind
struct UnionFind
{
	vector<int> par;

	UnionFind(int n) : par(n, -1) {}
	void init(int n) { par.assign(n, -1); }

	int root(int x)
	{
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool issame(int x, int y)
	{
		return root(x) == root(y);
	}

	bool merge(int x, int y)
	{
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x)
	{
		return -par[root(x)];
	}
};
#pragma endregion
#pragma region GCD
int gcd(int a, int b)
{
	if (a%b == 0)return b;
	return gcd(b, a%b);
}
#pragma endregion
#pragma region chmin
template<class T> inline bool chmin(T& a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma region chmax
template<class T> inline bool chmax(T& a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma endregion


int main()
{
	string s; cin >> s;
	int n = s.size();
	vector<vector<int>> dp(n + 1, vector<int>(13));
	dp[0][0] = 1;
	int MOD = 1e9 + 7;
	reverse(all(s));
	int d = 1;
	rep(i, n)
	{
		rep(j, 13)
		{
			if (s[i] == '?')
			{
				rep(k, 10)
				{
					int m = d * k + j;
					m %= 13;
					dp[i + 1][m] += dp[i][j];
					dp[i + 1][m] %= MOD;
				}
			}
			else
			{
				int m = d * (s[i] - '0') + j;
				m %= 13;
				dp[i + 1][m] += dp[i][j];
				dp[i + 1][m] %= MOD;
			}
		}
		d *= 10;
		d %= 13;
	}
	cout << dp[n][5] << endl;
}

Measured memory_bytes: 8960
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "YES"; }
  string_type do_falsename() const { return "NO"; }
};

void solve(ll N, vector<ll> p) {
  int res = 0;
  REP(i,N) {
    if (p[i] == i + 1) { ++i; ++res; }
  }
  cout << res << endl;
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	ll N;
	scanf("%lld", &N);
	vector<ll> p(N-1+1);
	for (int i = 0 ; i <= N-1 ; i++) {
	  scanf("%lld", &p[i]);
	}
	solve(N, p);
	return 0;
}


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


/*
int wee(int x){
  int ans=0;
  if(x==1){
    return 1;
  }
  
  else {
    int b=0;
    for(int i=1; i<x+1; i++){
      for(int j=1; j<x+1; j++){
        b += gcd(gcd(i,j),x);
      }
    }
    return wee(x-1)+b;
  }
}

int main(){
  //cout << gcd(4,6) << endl;
  int n;
  cin >> n;
  cout << wee(n) << endl;
}
*/
int main(){
  int x;
  cin >> x;
  int b=0;
  for(int i=1; i<x+1; i++){
    for(int j=1; j<x+1; j++){
      for(int k=1; k<x+1; k++){
        b += gcd(gcd(i,j),k);
      }
    }
  }
  cout << b << endl;
}


Measured memory_bytes: 3636
#include <stdio.h>
#define N 100000

struct comb {
    int n;
    int x;
    int ans;
};

int main(void) {

    int i, j, k, l;
    int num;
    struct comb X[N];

    for (i = 0; i < N; i++) {
        X[i].n = 0;
        X[i].x = 0;
        X[i].ans = 0;
    }

    i = 0;
    while (1) {
        scanf("%d%d", &X[i].n, &X[i].x);
        if ((X[i].n == 0) && (X[i].x == 0)) {
            break;
        } else {
            i++;
        }
    }
    num = i;

    for (i = 0; i < num; i++) {
        for (j = 1; j <= X[i].n; j++) {
            for (k = j + 1; k <= X[i].n; k++) {
                for (l = k + 1; l <= X[i].n; l++) {
                    if ((j + k + l) == X[i].x) {
                        X[i].ans++;
                    }
                }
            }
        }
        printf("%d\n", X[i].ans);
    }

    return 0;

}

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


int main(void) {
    string s;
    cin >> s;
    vector<int> count(4);
    vector<int> count_ref = {2,2,2,2};
    bool flag = false;
    for(int i = 0;i < 4;i++){
        for(int j=0;j<4;j++){
            if(s.at(i) == s.at(j))count.at(i) ++;
        }
    }

    if(count == count_ref)flag = true;
    if(flag)cout << "Yes" <<endl;
    else cout << "No" << endl;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define TRACE(x) x
#define WATCH(x) TRACE( cout << #x" = " << x << endl)
#define PRINT(x) TRACE(printf(x))
#define WATCHR(a, b) TRACE( for(auto c = a; c != b;) cout << *(c++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end()); } )
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define mp make_pair
#define st first
#define nd second

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

void buff() { ios::sync_with_stdio( false ); cin.tie( nullptr ); }

constexpr ll MOD = 1e9 + 7;

inline ll pow_mod( ll a, ll b, ll mod = MOD) {
    ll res = 1; a %= mod; assert(b >= 0);
    for(;b;b>>=1) {
        if(b&1) res = (res * a) % mod;
        a = (a * a) % mod;
    }
    return res;
}

int n, u, v, a, b;
vector< vector<int> > g;
// End of template code!
void explore(int root, vector<int>& dist, int parent) {
    //dist[root] has already been set
    for(const auto& viz : g[root]) {
        if(dist[viz] == -1 && viz != parent) {
            dist[viz] = dist[root] + 1;
            explore(viz, dist, root);
        }
    }
}

int main() 
{
    buff();
    // quero saber qual é o caminho mais longo que não passa pelo inimigo
    cin >> n;
    g.resize(n); 
    cin >> u >> v;
    --u; --v;
    // qual o maior caminho que u pode percorrer sem passar por V?
    for(int i = 0; i < n - 1; ++i)
    {
        cin >> a >> b; --a; --b;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    vector<int> dist_u(n, -1);
    dist_u[u] = 0;
    explore(u, dist_u, -1);

    vector<int> dist_v(n, -1);
    dist_v[v] = 0;
    explore(v, dist_v, -1);

    int st_dist = dist_u[v];
    
    // agora quero saber por quantas rodadas U consegue fugir
    int large_delay = 0;
    for(int i = 0; i < n; ++i)
    {
        if(dist_v[i] - dist_u[i] == st_dist) {
            large_delay = max(large_delay, dist_u[i]); // a resposta final vai ser garantidamente uma folha do grafo
        }
    }

    // agora tenho que calcular como fica a resposta dependendo da distância atual entre u e v
    vector<int> memo(n + 1);
    memo[0] = 0;
    memo[1] = 0;
    memo[2] = 1;
    for(int i = 3; i <= n; ++i) memo[i] = 2 + memo[i - 2];
   
    int best = memo[st_dist];
    for(int i = 0; i < n; ++i)
    {
        if(dist_u[i] < dist_v[i]) {
            int cur = dist_u[i];
            best = max(best, cur + memo[dist_v[i] - dist_u[i]]);
        }
    }
    
    cout << best << '\n';

    
    return 0;
}



Measured memory_bytes: 14868