akhauriyash/Code-Regression huggingface dataset:
using System;

namespace ABC046B
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var N = int.Parse(input[0]);
            var K = int.Parse(input[1]);

            var A = K * Math.Pow(K - 1, N - 1);
            Console.WriteLine(A);
        }
    }
}


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

int main ()
{
    int a,n;
    cin >> n;
    while (n!= 0)
    {
        a= n%10;
        n = n/10;
        if (a==7)
            {
                cout <<"Yes\n";
                return 0;
            }
    }
    cout <<"No\n";
    return 0;
}


Measured memory_bytes: 3632
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
const int maxn = 300000 + 10;

int n, m;
struct anode{
  int l, r, ln;
  anode() {}
  anode(int _l, int _r):l(_l), r(_r) { ln = r - l + 1; }
  
  friend bool operator < (anode a, anode b) { return a.ln < b.ln; }
}a[maxn];

int c[maxn];

inline int lowbit(int x) { return x & -x; }

inline void add(int x, int k) {
  for(int i = x;i <= m;i += lowbit(i)) c[i] += k;
}

inline int query(int x) {
  int tmp = 0;
  for(int i = x;i;i -= lowbit(i)) tmp += c[i];
  return tmp;
}

int main() {
  scanf("%d%d", &n, &m);
  for(int i = 1;i <= n;i ++) {
    int x, y;
    scanf("%d%d", &x, &y);
    a[i] = anode(x,y);
  }
  sort(a + 1,a + n + 1);
  for(int d = 1, k = 1;d <= m;d ++) {
    while(k <= n && a[k].ln < d) {
      add(a[k].l,1);
      add(a[k].r + 1,-1);
      k ++;
	}
	int tmp = n - k + 1;
	for(int i = d;i <= m;i += d) {
	  tmp += query(i);
	}
	printf("%d\n", tmp);
  }
  return 0;
}

Measured memory_bytes: 4864
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect
#from operator import itemgetter
#from heapq import heappush, heappop
import numpy as np
from scipy.sparse.csgraph import breadth_first_order, depth_first_order, shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix
#from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
import sys

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
nf = lambda: float(ns())
na = lambda: list(map(int, stdin.readline().split()))
nb = lambda: list(map(float, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

N, M = na()
edge = np.array([na() + [1] for _ in range(M)], dtype=np.int64).T
g = csr_matrix((edge[2], (edge[:2] - 1)), (N, N))
d, root = breadth_first_order(g, directed=False, return_predecessors=True, i_start = 0)
if -9999 not in d[1:]:
    print('Yes')
    for i in range(1, N):
        print(root[i] + 1)
else:
    print('No')

Measured memory_bytes: 75200
def main():
	s = input()
	
	for i in range(len(s)):
		if i%2 == 0:
			if s[i] == 'L':
				return 'No'
		else:
			if s[i] == 'R':
				return 'No'
	return 'Yes'
	
	
if __name__ == '__main__':
	print(main())

Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstring>
#include <cmath>
#include <cstdio>
#define MAXV 100010
#define F(a,b) for(int a = 0; a < b; ++ a)
#define FF(a,b) for(int a = 1; a <= b; ++ a)
const int INF = 0x3fffffff;
using namespace std;
int dp[MAXV];
int num[MAXV];
int cal(int a, int b){
	return a >= b ? a - b : b - a;
}
int main(){
	int N, K;
	scanf("%d%d", &N, &K);
	FF(i,N){
		scanf("%d", &num[i]);
		dp[i] = INF;
	}
	dp[1] = 0;
	dp[2] = (int)(fabs(num[2] - num[1]));
	for(int i = 3; i <= N; ++ i){
		for(int k = 1; k <= K && i - k >= 1; ++ k){
			dp[i] = min(dp[i], dp[i - k] + cal(num[i], num[i - k]));
		}
	}
	printf("%d\n", dp[N]);
	return 0;
}

Measured memory_bytes: 1024
N, K = map(int, input().split())
MOD = 998244353

lr = []
for _ in range(K):
    l, r = map(int, input().split())
    lr.append((l, r))
lr.sort()

dp = [0]*(N+1)
dpsum = [0]*(N+1)
dp[1] = 1
dpsum[1] = 1

# 区間の合計を複数回求める＝累積和
# 累積和を作りながらDPをする
for i in range(2, N+1):
    # マスiに移動できる数を求める
    for l, r in lr:
        # iの左側からiへ移動できる区間を求めるので、
        # lとrは逆になる
        li = max(i-r, 1)
        ri = i-l

        # 右のマスが0以下なら移動できないので次へ
        if li < 1:
            continue

        dp[i] += dpsum[ri]-dpsum[li-1]
        dp[i] %= MOD
    dpsum[i] = dpsum[i-1]+dp[i]
print(dp[N])


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

const double PI = 3.14159265358979323846;
//using namespace boost::multiprecision;
using namespace std;
typedef long long ll;
//typedef unsigned long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<int, int> P;
//typedef pair<ll, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX / 100;
//const ll INF = (1ll << 31) - 1;
//const ll INF = 1e15;
//const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;
#define ret() return 0;

bool contain(set<char> &s, char a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
//const ll mod = 1e10;
typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;

int main() {
    ll n;
    cin >> n;
    if (n % 2 == 1) {
        cout << 0 << endl;
        ret();
    }


    ll b = 5;
    ll t = 0;
    while (b <= n) {
        ll nt10 = n / b / 2;
        t += nt10;
        b *= 5;
    }

    cout << t << endl;

}




Measured memory_bytes: 256
from heapq import heappop, heappush

def dijkstra(s):
    used = [1] * n
    dp = [INF] * n
    dp[s] = 0
    hq = []
    used[s] = 0
    for i in cost[s]:
        heappush(hq, i)

    while hq:
        minv = heappop(hq)
        if used[minv[1]] == 0:
            continue
        v = minv[1]
        dp[v] = minv[0]
        used[v] = 0
        for i in cost[v]:
            if used[i[1]]:
                heappush(hq, [i[0] + dp[v], i[1]])
    return dp

INF = 10 ** 18
n, x, y = map(int, input().split())
cost = [[] for _ in range(n)]

for i in range(n - 1):
    a = i
    b = i + 1
    cost[a].append([1, b])
    cost[b].append([1, a])
cost[x - 1].append([1, y - 1])
cost[y - 1].append([1, x - 1])
ans = [0] * n
for i in range(n - 1):
    dp1 = dijkstra(i)
    for j in dp1[i:]:
        ans[j] += 1

for i in ans[1:]:
    print(i)

Measured memory_bytes: 71772
MOD = 10 ** 9 + 7
N = int(input())
memo = [{} for _ in range(N + 1)]


def isOK(last4):
    for i in range(4):
        t = list(last4)
        if i >= 1:
            t[i], t[i - 1] = t[i - 1], t[i]
        if ''.join(t).count('AGC'):
            return False
    return True


def dfs(cur, last3):
    if last3 in memo[cur]:
        return memo[cur][last3]
    if cur == N:
        return 1
    ret = 0
    for c in 'ACGT':
        if isOK(last3 + c):
            ret = (ret + dfs(cur + 1, last3[1:] + c)) % MOD
    memo[cur][last3] = ret
    return ret


print(dfs(0, 'TTT'))


Measured memory_bytes: 48220
//============================================================================
// 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>

//============================================================================
#define PI 3.14159265359
#define succ(x) ((x)+1)
#define pred(x) ((x)-1)
//============================================================================
void enter()
{
    int n,i,*ary;

    scanf("%d", &n);
    ary=malloc(n*sizeof(int));
    for (i=0; i<n; i++)
        scanf("%d", &ary[i]);
    for (i=n; 0<i; i--){
        if (i!=n) printf(" ");
        printf("%d", ary[pred(i)]);
    }
    printf("\n");
    free(ary);
}
//============================================================================
int main(void)
{
    enter();
    return 0;
}
//============================================================================

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(ll i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
typedef tuple<ll,ll,ll> Tu;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int mdx[8]={0,1,0,-1,1,1,-1,-1},mdy[8]={-1,0,1,0,1,-1,1,-1};


template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

ll N;

int main(){
	cin>>N;
	for(int h=1;h<=3500;h++){
		for(int n=1;n<=3500;n++){
			ll den=4*h*n-N*n-N*h;
			ll num=N*h*n;
			if(den<=0)continue;
			if(num%den==0){
				cout<<h<<" "<<n<<" "<<num/den<<endl;
				return 0;
			}
		}
	}
	return 0;
}

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

using namespace std;

int main() {
    bool ans = true;
    string s;
    cin >> s;
    if (s.size()<2 || s.size()%2) ans = false;
    for (int i=0; i<s.size()/2; i++)
        if (s[i*2] != 'h' || s[i*2+1] != 'i')
            ans = false;

    cout << (ans?"Yes":"No") << endl;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)

int N;

int main(){
  cin >> N;
  int result = N;
  for(int n = 0;n <= N;n++){
    int nn = n;
    int m = N - n;

    int ans = 0;
    int nine = 1;
    while(nine * 9 <= nn) nine *= 9;
    while(nine != 1){
      ans += nn / nine;
      nn %= nine;
      nine /= 9;
    }
    ans += nn;
    nn = m;
    nine = 1;
    while(nine * 6 <= nn) nine *= 6;
    while(nine != 1){
      ans += nn / nine;
      nn %= nine;
      nine /= 6;
    }
    ans += nn;
    result = min(ans , result);
  }

  cout << result << endl;
}


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

using namespace std;

int main()
{
    vector<int> i(3, 0);
    cin >> i[0] >> i[1] >> i[2];
    sort(i.begin(), i.end());
    cout << i[0] << " " << i[2] << endl;
}



Measured memory_bytes: 3144
#include <stdio.h>

int main(void) {

  long n;
  scanf("%ld", &n);
  long ans = 0;
  for (long i = 1; i <= n; i++) {
    ans += n/i;
    if (n%i == 0) {
      ans--;
    }
  }
  printf("%ld\n", ans);

  return 0;
}

Measured memory_bytes: 1712
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")
#include <bits/stdc++.h>

using namespace std;

#define PB push_back
#define MP make_pair
#define EB emplace_back
#define f first
#define s second
#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 FILL(a, b) memset(a, b, sizeof a)
#define ALL(a) a.begin(), a.end()
#define SZ(a) ((int)a.size())
#define bitc(n) __builtin_popcount(n)
#define MAGIC0 mt19937 rnd(time(0)); //rnd()

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

const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = 1LL * INF*INF;
const int MAX = 1e6 + 7;
const double PI = acos(-1.);
const double EPS = 1e-7;
const int MAXN = 100005;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

set<int> x[100005];
int cnt[100005];

int main()
{
	ios_base::sync_with_stdio(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	VI a(n);
	FOR(i, 0, n)
	{
		cin >> a[i];
	}
	sort(ALL(a));
	
	if (n % 3 != 0)
	{
		if (a[0] == a[n - 1])
		{
			cout << "Yes\n";
		}
		else
		{
			cout << "No\n";
		}
	}
	else
	if (a[0] == a[n / 3 - 1] && a[n / 3] == a[2 * n / 3 - 1] && a[2 * n / 3] == a[n - 1] && ((a[0] ^ a[n / 3] ^ a[2*n/3]) == 0))
	{
		cout << "Yes\n";
	}
	else
	{
		cout << "No\n";
	}
	
	return 0;
}









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

int main( int argc, char *argv[] )
{
char a;
char b;

	ios::sync_with_stdio( false );
	cin.tie( 0 );

	cin >> a;
	cin >> b;
	if( a == b )
		cout << "H" << endl;
	else
		cout << "D" << endl;

	return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
typedef   long long int ll;
typedef unsigned long long int sll;
typedef  double ld;
#define A 1000000007ll
#define B 998244353ll
#define C 1000000000000000001ll
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define oset tree<pair<ll,ll>, null_type,less<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update> 
#define pb push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define br break
#define PI 3.14159265358979323

int main() 
{
    FAST;
    ll n,k;
    cin>>n;
    ve<pair<ll,ll>> v;
    ll x;
    for(int i=0;i<n;i++)
    {
    	cin>>x;
    	v.pb({x,i});
    }
    sort(v.begin(),v.end());
    for(int i=0;i<n;i++)
    	cout<<v[i].second+1<<' ';
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
    return 0;
}

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

int cnt=0;
void ms(int *a, int left, int right, int *t) {
	if(right-left>1) {
		int m=left+(right-left)/2;
		int p=left, i=left, q=m;
		ms(a, left, m, t);
		ms(a, m, right, t);
		while(p<m || q<right) {
			cnt++;
			if(q>=right || (p<m && a[p]<a[q])) t[i++]=a[p++];
			else t[i++]=a[q++];
		}
		for(int i=left; i<right; i++) a[i]=t[i];
	}
}
const int LIM=1e6;
int a[LIM+10], tmp[LIM+10];
int main() {
	int n;
	cin>>n;
	for(int i=1; i<=n; i++) cin>>a[i];
	ms(a, 1, n+1, tmp);
	for(int i=1; i<=n; i++) {
		if(i>1) cout<<' ';
		cout<<a[i];
	}
	cout<<'\n'<<cnt<<'\n';
	return 0;
}


Measured memory_bytes: 6904
#include <iostream>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
using namespace std;


int main(void) {
  int a,b,c,x,y;
  cin >> a >> b >> c >> x >> y;
  int dbl = min(x,y);
  int cost1 = a*dbl + b*dbl;
  int cost2 = c*2*dbl;
  int cost = min(cost1,cost2);
  x-=dbl;
  y-=dbl;
  cost += (a*x + b*y < c*2*max(x,y))?(a*x + b*y):c*2*max(x,y);
  cout << cost << endl;
}


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


int main(){
  int h,w; cin>>h>>w;
  vector<string> s(h);
  rep(i,h) cin>>s[i];

  vector<vector<P>> p(h,vector<P>(w));
  rep(j,w){
    int t=0;
    int b;
    while(t<h){
      for(b=t;b<h;b++){
        if(s[b][j]=='#')
        break;
      }
      for(int i=t;i<b;i++)
      p[i][j].first=b-t;
      t=b+1;
      // cout<<t<<endl;
    }
  }
  rep(j,h){
    int t=0;
    int b;
    while(t<w){
      for(b=t;b<w;b++){
        if(s[j][b]=='#')
        break;
      }
      for(int i=t;i<b;i++)
      p[j][i].second=b-t;
      t=b+1;
      // cout<<t<<endl;
    }
  }
  int ans=0;
   rep(i,h){
     rep(j,w){
       ans=max(ans,p[i][j].first+p[i][j].second);
     }
   }
   cout<<ans-1<<endl;

}


Measured memory_bytes: 35712
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
typedef long long ll;

int main(){
    int n;
    int a[100010];
    cin>>n;
    REP(i,n) cin>>a[i];
    sort(a,a+n);
    vector<ll>v;
    ll sum=0;
    v.push_back(0);
    REP(i,n){
        sum+=a[i];
        v.push_back(sum);
    }
    int cnt=0;
    //v.push_back(0);
    for(int i=n-1;i>=0;i--){
        if(a[i]<=2*v[i]) cnt++;
        else break;
    }
    cout<<cnt+1<<endl;
    
    return 0;
}

Measured memory_bytes: 1912
#include <iostream>
#include <vector>
#include <math.h>

using namespace std;

int main(void) {
    int N, D, count=0;

    double div = 1.0;
    double res = 0.0;
    cin >> N >> D;
    vector<vector<int>> X(N, vector<int>(D));
    for(int n=0; n<N; n++) {
        for(int d=0; d<D; d++) {
            cin >> X[n][d];
        }
    }

    for(int yn=0; yn<N; yn++) {
        for(int zn=yn+1; zn<N; zn++) {
            for(int d=0; d<D; d++) {
                res += pow(X[yn][d]-X[zn][d], 2);
            }
            res = sqrt(res);
            if((res-(int)res)==0) count++;
            res = 0.0;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <ctime>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <memory.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
using namespace std;
typedef long double LD;
typedef long long LL;
typedef pair<LL, LL> pll;
typedef pair<int, int> pii;
typedef vector<int> vi;
#ifdef LOCAL
#define DEBUG(x) { cerr << "# " << #x << ": " << x << endl;}
#else
#define DEBUG(x)
#endif
mt19937_64 mt(time(0));
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/






int main() {
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  cout.precision(10); cout << fixed;
#ifdef LOCAL
  freopen("../test.txt", "r", stdin);
    // freopen("../output.txt", "w", stdout);
#endif
  int d, t, s; cin >> d >> t >> s;
  if (s * t >= d) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }





/*---------------------------------------Coding Space End------------------------------------------*/
#ifdef LOCAL
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s." << endl;
#endif
  return 0;
}
/* author:  txingml */
/* picture is from hamayanhamayan(CF handle) */


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

int main()
{
    int a, b;
    cin >> a >> b;
    cout << "a ";
    if (a < b)
    {
        cout << "<";
    }
    else if (a > b)
    {
        cout << ">";
    }
    else
        cout << "==";
    cout << " b" << endl;
    return 0;
}



Measured memory_bytes: 3016
# coding: utf-8
# Here your code !
import math
r=math.radians(60)
cos_60=math.cos(r)
sin_60=math.sin(r)

n=int(input())
start_point=(0.00000000,0.00000000)
end_point=(100.00000000,0.00000000)

def koch_curve(num,p1,p2):
    if num==0:
        return 
    sx=(2*p1[0]+p2[0])/3
    sy=(2*p1[1]+p2[1])/3
    
    tx=(p1[0]+2*p2[0])/3
    ty=(p1[1]+2*p2[1])/3
    
    ux=(tx-sx)*cos_60 - (ty-sy)*sin_60 + sx
    uy=(tx-sx)*sin_60 + (ty-sy)*cos_60 + sy
    
    
    koch_curve(num-1, p1, (sx,sy))
    print("{:.8f} {:.8f}".format(sx,sy))
    koch_curve(num-1, (sx,sy), (ux,uy))
    print("{:.8f} {:.8f}".format(ux,uy))
    koch_curve(num-1, (ux,uy), (tx,ty))
    print("{:.8f} {:.8f}".format(tx,ty))
    koch_curve(num-1, (tx,ty), p2)
  

print(*start_point)
koch_curve(n, start_point, end_point)
print(*end_point)  
            

Measured memory_bytes: 8068
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
//ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
int f[4][5];
int main() {
	int n, c = 0, s = 0;
	cin >> n;
	vector<int> a(n);
	vector<int> num;
	rep(i, 0, n)cin >> a[i];
	sort(all(a));
	auto it = a.begin(), it2 = it;
	while (it != a.end()) {
		it2 = it;
		it = upper_bound(it, a.end(), *it);
		num.push_back(it - it2);
	}
	for (auto v : num) {
		if (v % 2) s++;
		else s += 2, c++;
	}
	s -= (c + 1) / 2 * 2;
	printf("%d\n", s);
	return 0;
}


Measured memory_bytes: 1276
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define llinf (1ll<<62)
#define BG(x) ((x).begin())
#define ED(x) ((x).end())
#define rBG(x) ((x).rbegin())
#define rED(x) ((x).rend())
#define mp(a, b) make_pair((a), (b))

ll t;

ll n, m;
vector<ll> edge[100005];
ll p[100005];
bitset<100005> visited;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
//    cin >> t;
    t = 1;
    
	
	
    for(int _ = 1; _ <= t; _++) {
    //    cout << "Case #" << _ << ": ";
        
		cin >> n >> m;
		for(int i = 0; i < m; i++) {
			ll a, b;
			cin >> a >> b;
			edge[a].push_back(b);
			edge[b].push_back(a);
		//	cout << a << ' ' << b  << ' ' << '\n';
		}
		
		deque<pair<ll, ll>> bfs;
		bfs.push_back(mp(1, -1));
		while(bfs.size()) {
			auto now = bfs.front();
		//	cout << now.first << ' ' << now.second << ' ' << edge[now.first].size() << '\n';
			bfs.pop_front();
			if(visited[now.first])
				continue;
			visited[now.first] = 1;
			p[now.first] = now.second;
			for(auto x : edge[now.first]) {
				bfs.push_back(mp(x, now.first));
			}
		}
		cout << "Yes\n";
		for(int i = 2; i <= n; i++)
			cout << p[i] << '\n';
		
    }
    
    return 0;
}

Measured memory_bytes: 17192
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
using namespace std;
typedef long long int ll;
const int INF = 1001001001;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
/*bit全探索
for (int bit = 0; bit < (1<<N); ++bit) {
}
if (bit & (1 << i)) {
}
*/

bool isPrime(int x){
    if(x==1)return 0;
    if(x==2)return 1;
    if(x%2==0)return 0;
    for(int i=3;i*i<=x;i++)if(x%i==0)return 0;
    return 1;
}

ll f(string s){
    string a = "";
    ll sum = 0;
    int n = s.size();
    rep(i,n){
        if(s[i]=='+'){
            sum += stoll(a);
            a = "";
        }else{
            a += s[i];
        }
    }
    sum += stoll(a);
    return sum;
} 

int main(){
    string s;
    cin >> s;
    ll sum = 0;
    int n = s.length()-1; 
    rep(bit,1<<n){
        string tmp = "";
        tmp += s[0];
        rep(i,n){
            if(bit&(1<<i)){
                tmp+="+";
            }
            tmp+=s[i+1];
        }
        sum+=f(tmp);
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <queue>

using namespace std;

int main(void) {
    int N;
    cin >> N;
    deque<int> dq;
    for(int i=0; i<N; i++) {
        int a;
        cin >> a;
        if(i%2) {
            dq.push_front(a);
        } else {
            dq.push_back(a);
        }
    }

    if(N%2) {
        reverse(dq.begin(), dq.end());
    }

    for(auto e: dq) {
        cout << e << ' ';
    }
    return 0;
}


Measured memory_bytes: 2944
//
// ABC093C
//

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


void solve(long long A, long long B, long long C){
    long long nmax = max(A,max(B,C));
    for(long long i=0; i< 1000 ; i++) {
        long long sum = A + B + C + 2*i;
        if( (sum % 3 == 0) && (sum / 3 >= nmax)) {
            cout << i << endl;
            break;
        }
    }

    return;
}

// Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    solve(A, B, C);
    return 0;
}


Measured memory_bytes: 256
<?PHP
$first_line = fgets(STDIN);
// 取得した入力値を半角スペースで分解します
$first_line_array = explode(" ", $first_line);
//複数の変数に値を一括代入する
list($item_num, $weight_upper) = $first_line_array;

for ($i = 0; $i < $item_num; ++$i) {
    fscanf(STDIN, "%d %d ", $x, $y);
    $weight[$i] = $x;
    $value[$i] = $y;
}

$dp = [];
// 使うアイテムが０個だった場合から一つずつアイテムを増やして検討していく
foreach (range(0, $item_num - 1) as $item_index) {
    $i_value = $value[$item_index];
    $i_weight = $weight[$item_index];
    // リュックが許容する重さが０だった場合から検討していき増やして検討していく
    foreach (range(1, $weight_upper) as $weight_index) {
        $current_value = $dp[$item_index - 1][$weight_index] ?? 0;
        if ($weight[$item_index] <= $weight_index) {
            $new_value = (($dp[$item_index - 1][$weight_index - $weight[$item_index]] ?? 0) + $i_value);
            $dp[$item_index][$weight_index] = $current_value >= $new_value ? $current_value : $new_value;
        } else {
            $dp[$item_index][$weight_index] = $current_value;
        };
    }
}
echo $dp[(int)$item_num - 1][(int)$weight_upper];

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

typedef long long ll;
#define rep(i,x) for(int i=0;i<x;i++)
#define put(ans)    cout << ans << endl;

int enum_divisors(int N)
{
    vector<int> res;
    for (int i = 1; i * i <= N; ++i)
    {
        if (N % i == 0)
        {
            res.push_back(i);
            // 重複しないならば i の相方である N/i も push
            if (N / i != i)
                res.push_back(N / i);
        }
    }
    return res.size();
}

int main(){
    int n;
    cin >> n;
    ll x(1);
    for(int i=1;i<=n;i++){
        x = (i*x) % 1000000007;
    }

    cout << x << endl;

    return 0;
}

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

#define MAXNUM 1000001
bool prime[MAXNUM];

void eratosthenes()
{
	prime[0]=prime[1]=false;

	for(int i=2; i<MAXNUM; i++)
	{
		prime[i]=true;
	}
	
	for(int i=2; i*i<MAXNUM; i++)
	{
		if(prime[i])
		{
			for(int j=i*i; j<MAXNUM; j+=i)
			{
				prime[j]=false;
			}
		}
	}
}

int getkey(int a)
{
	int t;
	for(int i=a; i>=2; i--)
	{
		if(a%i!=0) continue;
		if(prime[i])
		{
			t=i;
			break;
		}
	}
	int ret=t;
	for(int i=t-1; i>=2; i--)
	{
		if(a%i!=0) continue;
		if(prime[i]) ret-=i;
	}
	
	return ret;
}

int main()
{
	eratosthenes();
	int a,b;
	while(scanf("%d%d", &a, &b), (a||b))
	{
		if(getkey(a) > getkey(b)) puts("a");
		else puts("b");
	}
}

Measured memory_bytes: 1704
#include<bits/stdc++.h>
using namespace std;
int gcd(int x,int y){
if(x==0 || y==0)
  return max(x,y);
  else{
  if(x<y){
  return gcd(x,y%x);
  }else if(y<x){
   return gcd(y,x%y);
  }else
    return x;
  }
}

int main(){
int A,B,C;
  cin>>A>>B>>C;
  int x=gcd(A,B);
  if(C%x==0)
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
  
 return 0;
}

Measured memory_bytes: 256
#include<string>
#include<iostream>
using namespace std;
int main() {
	long long n, m, l, a[100][100], b[100][100], c[100][100];

	cin >> n >> m >> l;
	for (int i = 0; i < n; i = i + 1) {
		for (int j = 0; j < m; j = j + 1) {
			cin >> a[i][j];
		}
	}
	for (int i = 0; i < m; i = i + 1) {
		for (int j = 0; j < l; j = j + 1) {
			cin >> b[i][j];
		}
	}
	for (int i = 0; i < n; i = i + 1) {
		for (int j = 0; j < l; j = j + 1) {
			c[i][j] = 0;
			for (int k = 0; k < m; k = k + 1) {
				c[i][j] = c[i][j] + a[i][k] * b[k][j];
			}
			cout << c[i][j];
			if (j != l - 1) {
				cout << " ";
			}
		}
		cout << endl;
	}
}


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

int proibido[105];

int main() {
	int x, n, right, left;
	bool ok = false;

	cin >> x >> n;

	for (int i=0; i<n; i++) {
		cin >> proibido[i];
		if (proibido[i] == x) {
			ok = true;
		}
	}
	if (ok == false) {
		cout << x << endl;
	} else {
		right = left = 0;
		while(ok) {
			bool temr = false, teml = false;

	 		for (int i=0;i<n;i++) {
				if (x+right == proibido[i]) {
					temr = true;
				}
				if (x-left == proibido[i]) {
					teml = true;
				} 
			}
			if (temr) {
				right++;		
			}
			if (teml) {
				left++;
			}
			if (temr == false && teml == false) {
				ok = false;
			}
		}

		right = abs((x+right)-x);
		left = abs((x-left)-x);

		if (right == left) {
			cout << x-left << endl;
		} else if (right > left) {
			cout << x-left << endl;
		} else {
			cout << x+right << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3560
import java.io.*;

public class Main
{
	public static void main(String[] args)throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));	
		int num  = Integer.parseInt(br.readLine());
		String[] arr = br.readLine().split(" ");
		for(int i = num-1; i>=0; i--)
		{
			System.out.print(arr[i]);
			if(i==0)	break;
			System.out.print(" ");	
		}
		System.out.println("");
	}
}

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

static const int ALPHABETS = 26;

int main(void) {
    int alp[ALPHABETS] = {0};
    int c;

    while((c = getchar()) != EOF) {
        if('a' <= c && c <= 'z') alp[c-'a']++;
        if('A' <= c && c <= 'Z') alp[c-'A']++;
    }

    for(int i=0; i < ALPHABETS; i++)
        cout << (char)('a'+i) << " : " << alp[i] << endl;

    return 0;
}

Measured memory_bytes: 3104
#include <stdio.h>
int main()
{
    char a[100];
    char b[100];
    char c[100];
    scanf("%s",a);
    scanf("%s",b);
    scanf("%s",c);
    char x,y,z;
    x=toupper(a[0]);
    y=toupper(b[0]);
    z=toupper(c[0]);
    printf("%c%c%c\n", x,y,z);
    return 0;
}


Measured memory_bytes: 128
from fractions import gcd

n, x = map(int, input().split())
x_lis = [abs(int(i)-x) for i in input().split()]

ans = x_lis[0]
for i in range(n):
	ans = gcd(ans, x_lis[i])
	if ans == 1:
		break
print(ans)

Measured memory_bytes: 16280
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt(), q = sc.nextInt();
		int d[] = new int[k];
		for (int i = 0; i < k; ++i) {
			d[i] = sc.nextInt();
		}
		for (int i = 0; i < q; ++i) {
			int n = sc.nextInt();
			int x = sc.nextInt();
			int m = sc.nextInt();
			long tmp = 0;
			long a = (long) x;
			for (int j = 0; j < k; ++j) {
				int num = (n - j + k - 2) / k;
				int tmpd = d[j] % m;
				if (tmpd == 0)
					tmp += (long) num;
				a += ((long) tmpd * (long) num);
			}
			long ans = (long) n - 1 - ((a / (long) m) - ((long) x / (long) m)) - tmp;
			System.out.println(ans);
		}
		sc.close();
	}
}


Measured memory_bytes: 46316
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl
 
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef deque<bool> db;
template<class T> using vv=vector<vector< T > >;

int main() {
  int n;
  scanf("%d", &n);
  vi a(n);
  rep (i, n) {
    scanf("%d", &a[i]);
  }
  int ans = 0;
  rep (i, n) {
    while (a[i] % 2 == 0) {
      ans += 1;
      a[i] /= 2;
    }
  }
  printf("%d\n", ans);

  return 0;
}


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

int main(){
    int n,k;
    cin >> n >> k;
    int res = 0 ;
    rep(i, n){
        int x;
        cin >> x;
        res += min(x, k-x)*2;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3592
from math import *
from copy import *
from string import *				# alpha = ascii_lowercase
from random import *
from sys import stdin
from sys import maxsize
from operator import *				# d = sorted(d.items(), key=itemgetter(1))
from itertools import *
from collections import Counter		# d = dict(Counter(l))
import math

def bin1(l,r,k,t,b,val,ans):
	if(l>r):
		return ans
	else:
		mid=(l+r)//2
		v=k**mid
		if(v==val):
			return v
		elif(v>val):
			ans=mid
			return bin1(mid+1,r,k,t,b,val,ans)
		else:
			return bin1(l,mid-1,k,t,b,val,ans)
		
def bin2(l,r,k,t,b,val,ans):
	if(l>r):
		return ans
	else:
		mid=(l+r)//2
		v=t*(k**mid)+b*(mid)
		if(v==val):
			return v
		elif(v>val):
			ans=mid
			return bin2(l,mid-1,k,t,b,val,ans)
		else:
			return bin2(mid+1,r,k,t,b,val,ans)

def SieveOfEratosthenes(n): 
      
    # Create a boolean array "prime[0..n]" and initialize 
    #  all entries it as true. A value in prime[i] will 
    # finally be false if i is Not a prime, else true. 
    prime = [True for i in range(n+1)] 
    p = 2
    while (p * p <= n): 
          
        # If prime[p] is not changed, then it is a prime 
        if (prime[p] == True): 
              
            # Update all multiples of p 
            for i in range(p * p, n+1, p): 
                prime[i] = False
        p += 1
    return prime
def bin(l,r,ll,val):
	if(l>r):
		return -1
	else:
		mid=(l+r)//2
		if(val>=ll[mid][0] and val<=ll[mid][1]):
			return mid
		elif(val<ll[mid][0]):
			return bin(l,mid-1,ll,val)
		else:
			return bin(mid+1,r,ll,val)
def deci(n):
	s=""
	while(n!=0):
		if(n%2==0):
			n=n//2
			s="0"+s
		else:
			n=n//2
			s="1"+s
	return s
def diff(s1,s2):
	if(len(s1)<len(s2)):
		v=len(s1)
		while(v!=len(s2)):
			s1="0"+s1
			v=v+1
	else:
		v=len(s2)
		while(v!=len(s1)):
			s2="0"+s2
			v=v+1
	c=0
	for i in range(len(s1)):
		if(s1[i:i+1]!=s2[i:i+1]):
			c=c+1
	return c
from sys import stdin, stdout 
if __name__ == '__main__':
	n=int(stdin.readline())
	stdout.write(str(2*pi*n)+"\n")

Measured memory_bytes: 10516
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<class T>bool even(T n) { return ! (n & 1); }
template<class T>bool odd(T n) { return n & 1; }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
ll intpow(ll a,ll n){ll p=1;while(n){if(n&1)p*=a;a*=a;n>>=1;}return p;}
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        ll N, P;
        cin >> N >> P;
        vll A(N);
        rep(i, 0, N) cin >> A[i];
        ll evens = 0;
        ll odds = 0;
        rep(i, 0, N) {
                if (even(A[i])) evens++;
                else odds++;
        } 

        ll ans = 0;
        if (odds == 0) {
                if (P == 0) ans = intpow(2, N);
                else ans = 0;
        } else {
                ans = intpow(2, N-1);
        }
        cout << ans << endl;
}


Measured memory_bytes: 3616
#include<iostream>
#include<vector>
#include<math.h>
#include<climits>
 
using namespace std;
 
int main() {
        int count, k;
        cin >> count;
 		cin >> k;
  
        if(count <= 0)
                return 0;
 
        vector<int> heights(count);
 
        for(int& cur : heights)
                cin >> cur;
 
        vector<int> table (count, INT_MAX);
        table[0] = 0; 
        table[1] = abs(heights[0] - heights[1]);
 
        for(int i = 2; i < count; i++)
        {
   			for(int j = 1; j <= k; j++)
              	if(i - j >= 0)
              		table[i] = min(table[i], table[i - j] + abs(heights[i] - heights[i - j]));
        }
 
  		cout << table[count - 1];
  
        return 0;
}

Measured memory_bytes: 1024
from collections import deque
n, m = map(int, input().split())
li = [list(map(int, input().split())) for _ in range(m)]

ans = [deque([]) for _ in range(m+10)]
ans2 = [[] for _ in range(m+10)]
for i in range(m):
    s = li[i][0]
    t = li[i][1]

    ans[s].append(t)
    ans[t].append(s)

stack = deque([1])
while stack:
    v = stack[0]

    if ans[v]:
        w = ans[v].popleft()
        if True:
            ans2[w].append(v)
        stack.append(w)
    else:
        stack.popleft()

print('Yes')
for i in range(2, n+1):
    print(ans2[i][0])

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

using namespace std;

template<typename T> class SegmentTree {
private:
  const T INF;
  int n;
  vector<T> d;
  
  T query(int a, int b, int k, int l, int r) {
    if (r <= a || b <= l) return INF;
    if (a <= l && r <= b) return d[k];
    int vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
    int vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
    return function(vl, vr);
  }

protected:
  virtual T function(int l, int r) = 0;
  
public:
  SegmentTree(int m) : INF(numeric_limits<T>::max()) {
    n = 1 << (32 - __builtin_clz(m - 1));
    d.resize(2 * n - 1, INF);
  }

  void update(int k, T a) {
    k += n - 1;
    d[k] = a;
    while (k > 0) {
      k = (k - 1) / 2;
      d[k] = function(d[k * 2 + 1], d[k * 2 + 2]);
    }
  }

  // [a,b)
  T query(int a, int b) {
    return query(a, b, 0, 0, n);
  }
};

template<typename T> class RMQ : public SegmentTree<T> {
protected:
  T function(int l, int r) {
    return min(l, r);
  }
  
public:
  RMQ(int n) : SegmentTree<T>(n) {}
};

int main() {
  int n, q;
  cin >> n >> q;
  RMQ<int> rmq(n);
  for (int i = 0; i < q; ++i) {
    int com, x, y;
    cin >> com >> x >> y;
    if (com == 0) rmq.update(x, y);
    else cout << rmq.query(x, y + 1) << endl;
  }
}

Measured memory_bytes: 2052
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)

	ans := ""
	for _,v := range s{
		switch {
		case v == 'B':
			if ans == "" {
				continue
			}
			ans = ans[:len(ans)-1]
		default:
			ans += string(v)
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
p = 2019
s = list(map(int, list(input())))[::-1]

sum = 0
cnt = [0] * p
cnt[0] = 1
n = len(s)
for i in range(n):
    d = s[i] * pow(10, i, p)
    sum = (sum + d) % p
    cnt[sum] += 1

ans = 0
for i in range(p):
    ans += cnt[i] * (cnt[i]-1) // 2


print(ans)


Measured memory_bytes: 12000
#include<bits/stdc++.h>
#include"atcoder/all"
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
using namespace atcoder;
int op(int a,int b){
  return max(a,b);
}
int e(){
  return 0;
}
int main(){
  int N,K,i,j,a;scanf("%d%d",&N,&K);
  segtree<int,op,e> S(500000);
  for(i=0;i<N;i++){
    scanf("%d",&a);
    S.set(a,S.prod(max(0,a-K),min(300001,a+K+1))+1);
  }
  printf("%d\n",S.all_prod());
}

Measured memory_bytes: 9356
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn = new Scanner(System.in);
		int[] in = new int[4];
		
		for (int i = 0; i < 4; i++) in[i] = scn.nextInt();
		int n = in[3];
		
		int comb = 0;
		for (int r = 0; r*in[0] <= n; r++) {
			for (int g = 0; g*in[1] <= n-r*in[0]; g++) {
				if ( (n - r*in[0] - g*in[1])%in[2] == 0)
					comb++;
			}
		}
		
		System.out.println(comb);
		
	}

}


Measured memory_bytes: 23892
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <queue>

using ll = long long int;
using ul = unsigned long long int;

// GCD: a > b
ul gcd(ul a,ul b) { return (!b) ? a : gcd(b,a%b); }

int main(int argc,char *argv[])
{
	std::string s,t;
	std::cin >> s;
	std::cin >> t;

	if (s == t.erase(t.size()-1)) { std::cout << "Yes" << std::endl; }
	else { std::cout << "No" << std::endl; }

	return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>

int a[20][20];
int w,h,i,j,o,p;
char str[20];
char kara;
int count;

void go(int x, int y) {
  //  printf("start go\n");
  //  printf("a[%d][%d] = %d\n",x,y,a[x][y]);

  a[x][y] = 2;

  // printf("a[%d][%d] = %d\n",x,y,a[x][y]);
  
  if(a[x+1][y] == 1 && w -1 > x) {
    count++;
    go(x+1,y);
  }
  if(a[x-1][y] == 1 && 0 < x) {
    count++;
    go(x-1,y);
  } if(a[x][y+1] == 1 && h-1 > y) {
    count++;
    go(x,y+1);
  }  if(a[x][y-1] == 1 && 0 < y) {
    //printf("start y-1\n");
    count++;
      go(x,y-1);
  }

}



int main() {



  while(1) {
  scanf("%d %d",&w,&h);
  
  if(w == 0 && h == 0) break;


  // @ = 0  . = 1 # = 2
    for(j=0;j<h;j++) {
      scanf("%s",str);
      for(i=0;i<w;i++) {
      
      if(str[i] == '.') {
	a[i][j] = 1;
      }else if(str[i] == '@') {
	a[i][j] = 0;
	o = i;
	p  = j;
      }else if(str[i] == '#') {
	  a[i][j] = 2;
	}
      }
    }

    /*    for(i=0;i<h;i++) {
      for(j=0;j<w;j++){
	printf("%d ",a[j][i]);
      }
      printf("\n");
    }
    */

    //  printf("o = %d\np = %d\n",o,p);
    count = 0;
    go(o,p);


    /*   printf("\n");
  for(i=0;i<h;i++) {
      for(j=0;j<w;j++){
	printf("%d ",a[j][i]);
      }
      printf("\n");
    }
    */

    printf("%d\n",count+1);


  }

  return 0;

}

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

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

  vector<string> vec;
  for (int i = 0; i < N; i++) {
    string input;
    cin >> input;
    vec.push_back(input);
  }

  sort(vec.begin(), vec.end());

  int maxNum = 0;
  vector<string> maxStrings;

  string currentString = vec[0];
  int currentNum = 0;

  for (string str : vec) {
    if (str == currentString) {
      currentNum++;
    } else {
      if (currentNum == maxNum) {
        maxStrings.push_back(currentString);
      } else if (currentNum > maxNum) {
        maxNum = currentNum;
        maxStrings.clear();
        maxStrings.push_back(currentString);
      }
        currentString = str;
        currentNum = 1;
    }
  }

  // 泣きの1回
  if (currentNum == maxNum) {
    maxStrings.push_back(currentString);
  } else if (currentNum > maxNum) {
    maxNum = currentNum;
    maxStrings.clear();
    maxStrings.push_back(currentString);
  }

  sort(maxStrings.begin(), maxStrings.end());
  for (string str : maxStrings) {
    cout << str << endl;
  }
}


Measured memory_bytes: 15984
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;

//A
//BABA
int main(void){
	int n,d,x,i,j,k,q;
	vector<vector<int>>p;
	scanf("%d %d %d",&n,&d,&x);
	p.resize(d);
	for(i=0;i<d;i++){
		p[i].resize(n);
	}
	for(i=0;i<d;i++){
		for(j=0;j<n;j++){
			scanf("%d",&q);p[i][j]=q;
		}
	}
	for(i=0;i<d-1;i++){
		vector<vector<int>> dp;
		dp.resize(n+1);
		for(j=0;j<=n;j++){
			dp[j].resize(x+1);
		}
		for(k=0;k<=x;k++){
				dp[0][k]=k;
		}
		for(j=0;j<n;j++){
			for(k=0;k<=x;k++){
				if(k-p[i][j]>=0){ dp[j+1][k]=max(dp[j][k],dp[j+1][k-p[i][j]]+p[i+1][j]); }
				else{dp[j+1][k]=dp[j][k];}
			}
		}
		x=dp[n][x];
	}
	printf("%d\n",x);
	return 0;
}

Measured memory_bytes: 4048
N = int(input())
H = [int(c) for c in input().split()]

prv1 = prv2 = cur = 0
for i in range(1, N):
    j1 = abs(H[i] - H[i-1])
    cur = min(j1 + prv1, abs(H[i] - H[i-2]) + prv2) if i > 1 else j1
    prv2 = prv1
    prv1 = cur

print(cur)


Measured memory_bytes: 13980
#!/usr/bin/env python3
#ABC136 B

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7

n = int(input())
ans = 0
for i in range(1,n+1):
    s = str(i)
    if len(s) % 2:
        ans += 1
print(ans)


Measured memory_bytes: 39920
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
// nCk を取得
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
 
int main() {
ll n;
cin>>n;
ll x[n]={},y[n]={},h[n]={};
ll ha=0;
ll b=0;
ll e=-1;
for(ll i=0; i<n; i++){
cin>>x[i]>>y[i]>>h[i];}
for(ll i=0; i<n; i++){
if(h[i]!=0){
e=i;
break;}}
for(ll i=0; i<=100; i++){
for(ll k=0; k<=100; k++){
ha=abs(i-x[e])+abs(k-y[e])+h[e];
for(ll q=0; q<n; q++){
if(q==e) continue;
if(!(ha-abs(i-x[q])-abs(k-y[q])==h[q]||(ha-abs(i-x[q])-abs(k-y[q])<=0&&h[q]==0))){
b++;	
break;}}
if(b==0){
cout<<i<<" "<<k<<" "<<ha;
goto end;}
b=0;}}
end:
cout<<endl;}


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

using namespace std;

int main(){
  	int A1, A2, A3;
  	cin >> A1 >> A2 >> A3;
  
 	if(A1 + A2 + A3 >= 22)cout << "bust" << endl;
  	else cout << "win" << endl;
	return 0;
}

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

const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit()
{
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++)
	{
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k)
{
	if (n < k)
		return 0;
	if (n < 0 || k < 0)
		return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
	int k, n;
	cin >> n >> k;
	COMinit();
	//赤玉に青の仕切りを入れる。
	//青ボールのグループ分割方法 i個のグループ
	for (int i = 1; i <= k;++i){
		if(i>n-k+1){
			cout << 0 << endl;
		}
		else
		{
			cout << COM(n - k + 1, i) * COM(k - 1, i - 1) % MOD << endl;
		}
	}
	return 0;
}


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

long long INF = 1e18;

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

        int h[n + 100];
        int s[n + 100];
        for (int i = 1; i <= n;i++){
                cin >> h[i];
                s[i] = 0;
        }
        for (int i = 0; i < m;i++){
                int a, b;
                cin >> a >> b;
                
                if( h[a] == h[b] ){
                        s[a] = 1;
                        s[b] = 1;
                }else if(h[a]> h[b]){
                        s[b] = 1;
                }else{
                        s[a] = 1;
                }
        }
        int cnt = 0;
        for (int i = 1; i <= n;i++){
                if(s[i] == 0){
                        cnt++;
                }
        }
        cout << cnt << endl;

        return 0;
}


Measured memory_bytes: 4420