akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
 
using namespace std;

using ll = long long;
using vll = vector<ll>;
using str = string;

#define llin(x) ll (x);cin >>(x);
#define stin(x) str (x);cin >>(x);
#define sz size()
#define be begin()
#define en end()
#define FOR(i,a,b) for(ll i = a ; i <= b ; i++)
#define rFOR(i,b,a) for(ll i = a; i >= b ; i--)
#define SORT(x) sort(x.be, x.en)
#define sal(x) cout<<x<<endl

signed main(){
    stin(s);
    ll k=0;
    vll m(s.sz,0);
    rFOR(i,0,s.sz-1){
        m[i]=s.sz-1-i;
        k=0;
        FOR(j,0,i){
            if(s[j]==s[i]){
                m[i]=max(m[i],k);
                k=0;
            }else{
                k++;
            }
        }
    }
    SORT(m);
    sal(m[0]);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,M; cin>>N >>M;
  vector<pair<int,int>> road;
  for(int i = 0; i < M; i++){
    int a,b;cin >> a >>b;
    road.push_back(make_pair(a,b));
  }
  
  for(int i = 0; i < N; i++){
    int ans = 0;
    for(int j = 0; j < M; j ++){
      if(road.at(j).first == (i + 1) or road.at(j).second == (i + 1)) ans++;
    }
    cout << ans << endl;
  }
}
  
  
  

Measured memory_bytes: 3476
moji = list(str(input()))
cnt =0
if moji[0]=="0":
  for i in range(len(moji)):
    if i%2==0:
      if moji[i]!="0":
        cnt+=1
    else:
      if moji[i]!="1":
        cnt+=1
else:
  for j in range(len(moji)):
    if j%2==0:
      if moji[j]!="1":
        cnt+=1
    else:
      if moji[j]!="0":
        cnt+=1
print(cnt)

Measured memory_bytes: 3956
n = int(input())
li = [0]*n
for i in range(n):
    li[i] = int(input())
a = 0
b = 0

for i in li:
    if i > a:
        b = a
        a = i
    elif i > b:
        b = i

for i in li:
    if i == a:
        print(b)
    else:
        print(a)


Measured memory_bytes: 12508
#pragma GCC optimize(2)
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#define read(a) scanf("%d", &a)
#define readf(a) scanf("%lf", &a)
#define pb push_back
#define mk make_pair
#define _rand mt19937 RAND(time(0))
#define mem(a) memset(a, 0, sizeof(a))
#define Buff ios::sync_with_stdio(false)
typedef long long ll;
using namespace std;
const int INF = 1e9 + 7;
const int N = 3e5 + 7;
const int M = 1e6 + 7;

#define lson rt << 1
#define rson rt << 1 | 1
template<class T>
class SegTree
{
public:
    T maxv[N << 2];
    void init()
    {
        mem(maxv);
    }
    inline void pushup(int rt)
    {
        maxv[rt] = max(maxv[lson], maxv[rson]);
    }
    void update(int rt, int l, int r,int pos, T val)
    {
        if(l == r)
        {
            maxv[rt] = max(maxv[rt], val);
            return;
        }
        int mid = (l + r) >> 1;
        if(pos <= mid) update(lson, l, mid, pos, val);
        else          update(rson, mid + 1, r, pos, val);
        pushup(rt);
    }

    T query(int rt, int l, int r, int L, int R)
    {
        if(L <= l && r <= R) return maxv[rt];
        int mid = (l + r) >> 1;
        T ans = 0;
        if(L <= mid) ans = max(ans, query(lson, l, mid, L, R));
        if(R > mid)  ans = max(ans, query(rson, mid + 1, r, L, R));
        return ans;
    }
};
SegTree<int> tree;

int a[N];
signed main()
{
    Buff;
    tree.init();
    int n, k;
    cin >> n >> k;

    int ans = 0, maxx = 0;
    for(int i = 1; i <= n; i++)
    {
        cin >> a[i];
        maxx = max(maxx, a[i]);
    }
    for(int i = 1; i <= n; i++)
    {
        int l = max(0, a[i] - k);
        int r = min(maxx, a[i] + k);
        int tmp = tree.query(1, 1, maxx, l, r);
//        cout << "tmp = " << tmp << "\n";
        ans = max(ans, tmp + 1);
        tree.update(1, 1, maxx, a[i], tmp + 1);
    }
    cout << ans << "\n";
    return 0;
}
/**
**/

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

using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef unsigned long long ull;
typedef long double ld; 
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const int MOD = (1e9 + 7);
int add(int a, int b)
{
	a+=b;
	while(a>=MOD) a-=MOD;
	return a;
}
int mult(int a, int b)
{
	return (a*1LL*b)%MOD;
}

int dp[1011111];
int S[1011111];

int sum(int l, int r)
{
	int ans=0;
	if(l<0) ans=abs(l),l=0;
	if(l==0) return add(ans,S[r]);
	else return add(ans,add(S[r],MOD-S[l-1]));
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; cin>>n;
	dp[0]=1; dp[1]=n; S[0]=1; S[1]=add(n,1);
	for(int i=2;i<=n;i++)
	{
		dp[i]=dp[i-1];
		dp[i]=add(dp[i],mult(n-1,n-1));
		dp[i]=add(dp[i],sum(i-(n+1),i-3));
		S[i]=add(S[i-1],dp[i]);
		//cerr<<i<<' '<<dp[i]<<'\n';
	}
	cout<<dp[n]<<'\n';
}


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

const long long int INF = 1e17;

long long int dis[305][305], g[305][305];


int main(void) {
    long long int n, m, l;
    cin >> n >> m >> l;
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= n; j++) {
            dis[i][j] = INF;
        }
        dis[i][i] = 0;
    }
    for (int i = 0; i < m; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        dis[a][b] = dis[b][a] = c;
    }
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= n; j++) {
            for(int k = 1; k <= n; k++) {
                if (dis[j][i] + dis[i][k] < dis[j][k]) {
                    dis[j][k] = dis[j][i] + dis[i][k];
                }
            }
        }
    }
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= n; j++) {
            if(dis[i][j] <= l) {
                g[i][j] = 1;
            } else {
                g[i][j] = INF;
            }
        }
        g[i][i] = 0;
    }
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= n; j++) {
            for(int k = 1; k <= n; k++) {
                if (g[j][i] + g[i][k] < g[j][k]) {
                    g[j][k] = g[j][i] + g[i][k];
                }
            }
        }
    }
    int q;
    cin >> q;
    for(int i = 1; i <= q; i++) {
        int s, t;
        cin >> s >> t;
        if(g[t][s] < INF) cout << g[t][s] - 1 << "\n";
        else cout << -1 << "\n";
    }
    return 0;
}

Measured memory_bytes: 1920
n, k = map(int, input().split())
a = [int(i) for i in input().split()]
b = [-1] * (n+1)
now = 1
history = []

while b[now] == -1:
  b[now] = len(history)
  history.append(now)
  now = a[now-1]

c = len(history) - b[now]
l = b[now]

if k < l:
  print(history[k])
else:
  k -= l
  k %= c
  print(history[l+k])
 

Measured memory_bytes: 32332
a = sorted(map(int, input().split()))
ans = 0
diff = a[1] - a[0]
if diff > 0:
    ans += diff // 2
    a[0] += diff // 2 * 2

diff = a[2] - a[1]
if diff > 0:
    ans += diff
    a[1] += diff
    a[0] += diff
if a[0]+1 == a[1] and a[1]+1 == a[2]:
    print(ans+3)
elif a[0]+1 == a[1] and a[1] == a[2]:
    print(ans+2)
elif a[0] == a[1] and a[1]+1 == a[2]:
    print(ans+1)
else:
    print(ans)


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

#define ll  long long
#define PII pair<ll,ll>
#define VI  vector<ll>
#define VB  vector<bool>
#define VC vector<char>
#define VVI vector<vector<ll>>
#define VVC vector<vector<char>>
#define VS  vector<string>
#define VP  vector<PII>
#define lf(i,a,b) for(ll i=a;i<=b;i++)
#define lr(i,a,b) for(ll i=a;i>=b;i--)
#define lfl(i,v) for(ll i=0;i<v.size();i++)
#define lrl(i,v) for(ll i=(ll)(v.size())-1;i>=0;i--)
#define chk2(a,b) cout<<"check :  "<<a<<" "<<b<<endl
#define chk3(a,b,c) cout<<"check :  "<<a<<" "<<b<<" "<<c<<endl
#define chk4(a,b,c,d) cout<<"check :  "<<a<<" "<<b<<" "<<c<<" "<<d<<endl
#define chk5(a,b,c,d,e) cout<<"check :  "<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e<<endl
#define l_b(v,k)  lower_bound(v.begin(),v.end(),k)-v.begin()
#define u_b(v,k)  upper_bound(v.begin(),v.end(),k)-v.begin()
#define mod 1000000007
#define sort(v) sort(v.begin(),v.end())
#define p_b push_back
#define p_f push_front
#define m_p make_pair
#define fir first
#define sec second
#define sz size()


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

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

long long gcd(long long p, long long q) {
	if (q == 0)
		return p;
	else
		gcd(q, p % q);
}

int main()
{
	int t;
	long long a, b, c, d;

	cin >> t;

	for (int i = 0; i < t; i++) {
		cin >> a >> b >> c >> d;

		long long g = gcd(b, d);

		if (a >= b && b <= d && g >= b - c && a % g <= c)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}

	return 0;
}

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

int main(){
  int MOD = 1000000007;
  int n;
  cin >> n;
  vector<ll> a(n);
  vector<ll> b(n+1, 0);
  rep(i, n){
    cin >> a[i];
    b[i+1] = b[i] + a[i];
  }
  ll ans = 0;
  rep(i, n){
    ll sum = (b[n] - b[i+1]) % MOD;
    ans += a[i] * sum;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6400
import java.util.*;

public class Main {
    //Typical Stairs
    //DP?
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), m = sc.nextInt();
        int[] dp = new int[n + 1];
        dp[0] = 1;
        int mod = 1000000007;
        for (int i = 1; i <= m; i++) dp[sc.nextInt()] = -1;
        for (int i = 1; i <= n; i++) {
            if (dp[i] == -1) {
                dp[i] = 0;
            } else {
                if (i == 1) {
                    dp[i] = 1;
                } else dp[i] = (dp[i - 1] + dp[i - 2]) % mod;
            }
        }
        System.out.println(dp[n]);
        sc.close();
    }
}


Measured memory_bytes: 48348
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>
#include <cassert>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'
#define debugArrayP(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i].first<< " " << x[i].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = INT_MAX;
const ll MOD = 1e9+7;

int main(){
  int N;cin>>N;
  vll A(N);
  repeat(i,N){
    cin>>A[i];
  }
  sort(A.begin(),A.end());
  vector<pair<ll,ll> > B;
  repeat(i,N){
    int j=i;
    while(A[j]==A[i])j++;
    B.push_back({A[i],j-i});
    i=j-1;
  }
  ll ans = 0;
  for(int i=B.size()-1;i>=0;i--){
    ll p2=1;
    while(p2<=B[i].first)p2<<=1;
    int j=lower_bound(B.begin(),B.end(),pair<ll,ll>(p2-B[i].first,0))-B.begin();
    if(B[j].first+B[i].first==p2){
      ll cnt = min(B[i].second,B[j].second);
      if(i==j){
        cnt = B[i].second/2;
      }
      ans += cnt;
      B[j].second-=cnt;
    }
  }
  cout <<ans << endl;
  return 0;
}


Measured memory_bytes: 7920
#include <algorithm>
#include <bitset>
#include <complex>
#include <cstdio>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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

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

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    rep (i, 9) {
      char a;  cin >> a;
      if (i % 4 == 0) s += a;
    }

    cout << s << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  string s;cin >> s;
  map<char,int>mp;
  rep(i,s.length()) ++mp[s[i]];
  bool issat = true;
  for(const PII &p : mp) if(p.second&1)issat = false;
  YesNo(issat);
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>

//エイリアス
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    template<typename T>
    vector<T> read_vec(size_t n){
        vector<T> tmp(n);
        for(size_t i = 0; i < n; i++){
            cin >> tmp[i];
        }
        return tmp;
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};



int main(){
    Stream io;

    int X;
    io.read(X);

    if(X >= 30) cout << "Yes";
    else cout << "No";

    return 0;
}


Measured memory_bytes: 3632
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<tuple>
#include<set>
#include<utility>
#include<map>
using namespace std;
typedef long long ll;
int main() {
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	cout << min(a,b)+min(c,d);
}

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

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"
#define debug(x) cout<<#x<<" = "<<x<<endl;

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

li n;
vi BIT(3e6);

void update(li x,li v)
{
    for(;x<=n;x+=(x&(-x)))
        BIT[x]+=v;
}

li qy(li x)
{
    li ans=0;

    for(;x>0;x-=(x&(-x)))
    {
        ans+=BIT[x];
    }

    return ans;
}

struct query 
{
	li l,r,ind;
};

bool comp(query a,query b)
{
	return a.r<b.r;
}

void solve()
{
	li q;

    cin>>n>>q;

    li a[n];

    f(i,0,n-1)
    {
    	cin>>a[i];
    }

    query Q[q];

    f(i,0,q-1)
    {
    	Q[i].ind=i;

    	li tp1,tp2;

    	cin>>tp1>>tp2;

    	Q[i].l=tp1-1;
    	Q[i].r=tp2-1;
    	// >>Q[i].r;
    }

    sort(Q,Q+q,comp);

    vi ans(q);

    li cnt=0;

    vi vis(3e6,-1);

    f(i,0,n-1)
    {
    	if(vis[a[i]]!=-1)
    	{
    		update(vis[a[i]]+1,-1);
    	}

    	vis[a[i]]=i;

    	update(i+1,1);

    	while(cnt<q && Q[cnt].r==i)
    	{
    		ans[Q[cnt].ind]=qy(Q[cnt].r+1)-qy(Q[cnt].l);
    		cnt++;
    	}
    }

    f(i,0,q-1)
    {
    	cout<<ans[i]<<endl;
    }
}

int main()
{    
   

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    li t=1;

    // cin>>t;

    while(t--)
    {
        solve();
    }

    return 0;
}

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

using namespace std;

int main()
{
  long long int a,b,c,k,count = 0;
  cin >> a >> b >> c >> k;
  
  if(a+b >= k)
  {
    count += a;
    if(count > k)
    {
      cout << k;
    }
    else
    {
      cout << a;
    }
  }
  else
  {
    count += a + b;
    cout << a-(k-count);
  }
  
  return 0;
}

Measured memory_bytes: 3540
#include <iostream>

#include <vector>
#include <map>
#include <algorithm>
#include <fstream>
#include<cstdio>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
#include <cstdlib>
#include <typeinfo>

#define REP(i, n) for(int i=0;i<n;i++)
#define REP2(i, s, n) for(int i=s;i<n;i++)
#define REP_1(i, n) for(int i=1;i<n+1;i++)
#define bitSearch(bit, n) for(int bit = 0; bit < (1 << N); bit++)
using namespace std;

template<class T>
void print(const T &value) {
    std::cout << value << std::endl;
}

void yesno(bool a) { if (a)cout << "Yes" << endl; else cout << "No" << endl; }

void YESNO(bool a) { if (a)cout << "YES" << endl; else cout << "NO" << endl; }

typedef long long ll;
typedef unsigned long ul;
typedef long double ld;

template<class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

//ll INF = 10000000;
//ll mod = 1000000007;//10^9+7

//using Graph = vector<vector<pair<int, int>>>;
//Graph G(100100);

//番号ズレ注意！！
int main() {
    ll N, M;
    cin >> N >> M;
    vector<pair<ll, ll>> drinks;
    REP(i, N) {
        ll a, b;
        cin >> a >> b;
        drinks.push_back(make_pair(a, b));
    }
    sort(drinks.begin(), drinks.end());
    ll money = 0;
    REP(i, N) {
        if (drinks[i].second >= M) {
            money += drinks[i].first * M;
            break;
        }
        money += drinks[i].first * drinks[i].second;
        M -= drinks[i].second;
    }
    print(money);
}


Measured memory_bytes: 2420
Option Strict On
Module problemA

    Sub Main()
        Dim prm1() As Integer = Array.ConvertAll(Of String, Integer)(Console.ReadLine.Split(" "c), AddressOf Integer.Parse)
        Dim prm2() As Integer = Array.ConvertAll(Of String, Integer)(Console.ReadLine.Split(" "c), AddressOf Integer.Parse)

        Console.WriteLine(Convert.ToInt32(prm1(0) <> prm2(0)))
    End Sub

End Module


Measured memory_bytes: 13268
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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; }

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

int main() {
  int h;
  cin>>h;
  
  int vec[260];
  for(int i=1;i<=h;i++) cin>>vec[i];
  
  for(int i=1;i<=h;i++){
    cout<<"node "<<i<<": key = "<<vec[i]<<", ";
    if(i/2>=1 && i/2<=h) cout<<"parent key = "<<vec[i/2]<<", ";
    if(i*2>=1 && i*2<=h) cout<<"left key = "<<vec[i*2]<<", ";
    if(i*2+1>=1 && i*2+1<=h) cout<<"right key = "<<vec[i*2+1]<<", ";
    cout<<endl;
  }
      
  return 0;
}


Measured memory_bytes: 3100
#include <iostream>

using namespace std;

int main(void) {
    int N, M;
    long long x[1010], y[1010], z[1010];
    cin >> N >> M;
    for (int i=0;i<N;i++) {
        cin >> x[i] >> y[i] >> z[i];
    }

    long long dp[N+1][M+1];

    long long ans = -1LL<<60;
    for (int a=-1;a<2;a++) for (int b=-1;b<2;b++) for (int c=-1;c<2;c++) 
    if (a) if (b) if (c) {
        for (int i=0;i<=N;i++) for (int j=0;j<=M;j++) dp[i][j] = -1LL<<60;
        dp[0][0] = 0LL;
        for (int i=0;i<N;i++) for (int j=0;j<=M;j++) {
            long long d = a*x[i] + b*y[i] + c*z[i];
            dp[i+1][j] = max(dp[i+1][j], dp[i][j]);
            if (j<M) dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j]+d);
        }
        ans = max(ans,dp[N][M]);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 8064
#include<bits/stdc++.h>
#define de(x) cout<<#x<<"="<<x<<endl
#define dd(x) cout<<#x<<"="<<x<<" "
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define repd(i,a,b) for(int i=a;i>=(b);--i)
#define repp(i,a,b,t) for(int i=a;i<(b);i+=t)
#define mt(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define mp(u,v) make_pair(u,v)
#define sz(a) (int)a.size()
#define pb push_back
#define PI acos(-1.0)
#define qc std::ios::sync_with_stdio(false)
#define all(a) a.begin(),a.end()
using namespace std;
typedef vector<int> vi;
typedef long long ll;
typedef double db;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
typedef pair<int,pii> piii;

const ll mod = 1000000007;
const int N = 2e5+6;
const int M = 2e6+6;
const double eps = 1e-16;
const ll inf = 1e10;

bool eq(const db &a, const db &b) { return fabs(a - b) < eps; }
bool ls(const db &a, const db &b) { return a + eps < b; }
bool le(const db &a, const db &b) { return eq(a, b) || ls(a, b); }
ll gcd(ll a,ll b) { return a==0?b:gcd(b%a,a); };
ll lcm(ll a,ll b) { return a/gcd(a,b)*b; }
ll kpow(ll a,ll b) {ll res=1;a%=mod; if(b<0) return 1; for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll read(){
    ll x=0,f=1;char ch=getchar();
    while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
//inv[1]=1;
//for(int i=2;i<=n;i++) inv[i]=(mod-mod/i)*inv[mod%i]%mod;
int n;
db X[N], Y[N];
int D[N];
db cal(db t) {
	db mxx = -inf, mnx = inf, mxy = -inf, mny = inf;
	rep(i, 0, n) {
		db nx = X[i], ny = Y[i];
		if(D[i]==1) ny += t;
		if(D[i]==3) ny -= t;
		if(D[i]==2) nx += t;
		if(D[i]==4) nx -= t;
		mxx = max(nx, mxx);
		mnx = min(nx, mnx);
		mxy = max(ny, mxy);
		mny = min(ny, mny);
	}
	return (mxx - mnx) * (mxy - mny);
}
db three_search(db l, db r) {
	db ret = 1e18;
	int cnt = 0;
    while (r > eps + l && cnt <= 1000) {
    	// dd(left);de(right);
        // db lm = (l + r) / 2;
        // db rm = (lm + r) / 2;
        db lm=(l+(r-l)/3),rm=(l+(r-l)*2/3);
        // 如果是求最小值的话这里判<=即可
        db tmp1 = cal(lm), tmp2 = cal(rm);
        if(tmp1 <= tmp2) r = rm;
        else l = lm;
        ret = min(ret, tmp1);
        ret = min(ret, tmp2);
        cnt++;
    }
    return ret;
}
int main() {
	// dp[i][j] 表示以s[i]和t[j]结尾的相同子序列的个数
	// 到后面就是前缀和了
	while(~scanf("%d", &n)) {
		rep(i, 0, n) {
			char c;
			scanf("%lf%lf %c", X + i, Y + i, &c);
			if(c=='U') D[i] = 1;
			if(c=='R') D[i] = 2;
			if(c=='D') D[i] = 3;
			if(c=='L') D[i] = 4;
		}
		printf("%.10f\n", three_search(0, 1e12));
	}
    return 0;
}


Measured memory_bytes: 2176
#include<iostream>
#include<vector>
#include<string>
#include<string.h>
#include<algorithm>
using namespace std;

int main(){
	int a,b; cin>>a>>b;
	if(a>=13){
		cout<<b<<endl;
	}
	else if(6<=a&&a<=12){
		cout<<b/2<<endl;
	}
	else{
		cout<<0<<endl;
	}
}

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

struct interval
{
  interval() { b=0; e=0; }
  interval(int x, int y) { b = x; e = y; }
  int b;
  int e;
  bool operator==(const interval& x) const { return (b == x.b) && (e == x.e); }
  bool operator!=(const interval& x) const { return (b != x.b) || (e != x.e); }
  bool operator<(const interval& x) const { return (b < x.b) || (b==x.b) && (e < x.e); }
  bool operator>(const interval& x) const { return (b > x.b) || (b==x.b) && (e > x.e); }
};

int main()
{
  int n, start, stop;

  while (cin >> n >> start >> stop)
  {
    if (n == 0) return 0;

    int st = (start/100)*60 + (start % 100);
    int et = (stop/100)*60 + (stop % 100);

    stop = et-st;           // ????????????

    vector<interval> slots;
    for (int i=0;i<n;i++)
    {
      // ?¬¬i?????£????????????CM??????
      int k;
      cin >> k;

      interval t;
      int      s = 0;
      int      b, e;

      cin >> b >> e;

      int bt = (b/100)*60+(b%100) - st;
      int et = (e/100)*60+(e%100) - st;

      if (s != bt) { t.b = s; t.e=bt; slots.push_back(t); }

      s = et;

      for (int j  = 1;j<k;j++)
      {
        cin >> b >> e;

        bt        = (b/100)*60+(b%100) - st;
        et        = (e/100)*60+(e%100) - st;

        if (s    != bt) { t.b=s; t.e=bt; slots.push_back(t); }

        s = et;
      }

      if (s < stop) { t.b = s; t.e=stop; slots.push_back(t); }
    }                           // i?????£???????????????????????????

    sort(slots.begin(), slots.end());
    //========================================
    // cout << n << " channel(s) stop = " << stop << endl;
    // for (int p=0;p<slots.size();p++)
    // {
    //   cout << "(" << slots[p].b << "," << slots[p].e << ") ";
    // }
    // cout << endl;
    //========================================

    // slot?????????CM??\??????????????????????????\??£?????????
    int s       = 0;
    int k       = 0;            // ?????????index
    int maxlen  = 0;
    int len     = 0;
    while (k < slots.size())
    {
      if ((s >= slots[k].b) && (s <= slots[k].e))
      {
        // ?§???????
        len += slots[k].e-s;
        s = slots[k].e;
        k++;
        if (maxlen < len) maxlen = len;
      }
      else if ((s > slots[k].b) && (s > slots[k].e))
      {
        k++;
      }
      else if (s < slots[k].b)
      {
        // ?§?????????¨???????????????
        if (maxlen < len) maxlen = len;
        len = 0;
        s = slots[k].b;
      }
    }                           // ??¢?´¢??????
    cout << maxlen << endl;
  }

  return 0;
}

Measured memory_bytes: 1200
A=input()
B=input()
C=input()
X=input()
sum=0
for a in range(int(A)+1):
    for b in range(int(B)+1):
        for c in range(int(C)+1):
            if 500*a+100*b+50*c==int(X):
                sum+=1
print(sum)

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

int divide(int a, int b)
{
    int tmp=a%b;
    if(tmp==0){
        return b;
    }else{
        return divide(b, tmp);
    }
}

int main()
{
    int N;
    cin >> N;
    int numbers[N];
    for (int i=0; i<N; i++){
        cin >> numbers[i];
    }
    sort(numbers, numbers+N);
    for (int i=0; i<N-1; i++){
        numbers[i+1]=divide(numbers[i+1], numbers[i]);
    }
    cout << numbers[N-1];
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
void fast(){
cin.tie(0);
cin.sync_with_stdio(0);
}
int main()
{
    int n;double m;double c=0;
    cin>>n>>m;double a[n];
    for(int i=0;i<n;i++){cin>>a[i];c+=a[i];}
    int co=0;
    for(int i=0;i<n;i++){
         if(a[i]>=(1/(4*m))*c ){co++;}
         if(co==m){break;}
    }
    co>=m? cout<<"Yes":cout<<"No";
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

const char week[7][10] = {
    "Wednesday", "Thursday", "Friday",
    "Saturday", "Sunday", "Monday", "Tuesday"
};
const int days[13] = {
    0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};

int main(void) {
    int i, m, d;
    while(~scanf("%d %d", &m, &d), m) {
        for(i = 1; i < m; i++) {
            d += days[i];
        }
        printf("%s\n", week[d % 7]);
    }
    return 0;
}

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

int main(){
  long long a,b,c,k;
  cin >> a >> b >> c >> k;
  long long ans=0;
  if(k>=a){
    ans+=a;
    k-=a+b;
    if(k>0){
      ans-=k;
    }else{
      cout << ans <<endl;
      return 0;
    }
  }else{
    cout << k << endl;
    return 0;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define int long long
#define F first
#define S second
#define pi pair <int, int>
#define mkp make_pair
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define watch(x) cout << (#x) << " = " << (x) << "\n"
#define PI 3.14159265359
#define MOD 1000000007
#define INF 1000000000000000005

using namespace std;

signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int T = 1;
	//cin >> T;
	while(T--){
		int x, k, d;
		cin >> x >> k >> d;
		int now = x;
		int diff = abs(now);
		int moves = diff / d;
		if(diff % d){
			moves++;
		}
		if(now < 0){
			if(k <= moves){
				now += k * d;
			}
			else{
				now += moves * d;
				k -= moves;
				if(k & 1){
					now -= d;
				}
			}
			cout << abs(now) << "\n";
			continue;
		}
		if(k <= moves){
			now -= k * d;
			cout << abs(now) << "\n";
			continue;
		}
		now -= moves * d;
		k -= moves;
		if(k & 1){
			now += d;
		} 
		cout << abs(now) << "\n";
	}
	return 0;
}


Measured memory_bytes: 3644
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    // 整数の入力
    int D, N;
    int retval;
    cin >> D >> N;

    if(N == 100) {
        N = 101;
    }
    retval = pow(100, D) * N;

    cout << retval;

    return 0;
}

Measured memory_bytes: 256
def dfs(n):
    global b,check,d
    #ttfは235、chaはabc
    #2,3,5の場合それぞれ
    for ttf,cha in zip([2,3,5],b):
        #-1ずつしていく場合
        if check[0]>check[n]+n*d:
            check[0]=check[n]+n*d

        #最寄りまで-してく場合
        x1,x2=n//ttf,n%ttf
        if x1 in check:
            if check[x1]>check[n]+x2*d+cha:
                check[x1]=check[n]+x2*d+cha
                dfs(x1)
        else:
            check[x1]=check[n]+x2*d+cha
            dfs(x1)
        
        #最寄りまで+1してく場合
        x1,x2=n//ttf+1,ttf-n%ttf
        if x1 in check:
            if check[x1]>check[n]+x2*d+cha:
                check[x1]=check[n]+x2*d+cha
                dfs(x1)
        else:
            check[x1]=check[n]+x2*d+cha
            dfs(x1)

t=int(input())
for i in range(t):
    N,*b,d=map(int,input().split())
    check={N:0,0:N*d}
    dfs(N)
    print(check[0])

    

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

using namespace std;

long long n;

long long f() {
	long long base = 10, ans = 0;
	while(base <= n) {
		ans += n / base;
		base *= 5;
	}
	return ans;
}

int main() {
	cin >> n;
	if(n & 1) cout << 0 << endl;
	else cout << f();
	return 0;
}


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

int main(){
  int N, W; cin >> N >> W;
  vector<ll> w(N,0),v(N,0);
  for(int i = 0; i < N; i++){
      cin >> w.at(i) >> v.at(i);
  }
  vector<vector<ll>> dp(N+10,vector<ll>(W+10)); //0-based
  
  for(int sum_w = 0; sum_w <= W; sum_w++){
      if(sum_w - w.at(0) >= 0) dp.at(0).at(sum_w) = v.at(0); 
  }
  
  for(int i = 1; i < N; i++){
      for(int sum_w = 0; sum_w <= W; sum_w++){
          if(sum_w - w.at(i) >= 0){
              dp.at(i).at(sum_w) = max( dp.at(i-1).at(sum_w-w.at(i)) + v.at(i), dp.at(i-1).at(sum_w));
          }else{
              dp.at(i).at(sum_w) = dp.at(i-1).at(sum_w);
          }
      }
  }
  cout << dp.at(N-1).at(W) << endl;
}



Measured memory_bytes: 87296
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(ll i##_len=(n) ,i=i##_len-1;i>=0;--i)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define printd(val) std::cout<< #val" = " <<val<<"\n";
#include<bits/stdc++.h>
using ll = long long;
using pii = std::pair<ll,ll>;
using namespace std;
template<class T>T chmin(T& a,T b){if(a>b){a^=b;b^=a;a^=b;return 1;}return 0;}
template<class T>T chmax(T& b,T a){if(a>b){a^=b;b^=a;a^=b;return 1;}return 0;}
template<class T> vector<pair<T,T>> duplicator(const vector<T>& input){
    vector<pair<T,T>> out(input.size()-1);
    rep(i,input.size()-1){
        out[i].first =input[i  ];
        out[i].second=input[i+1];
    }
    return(out);
}
vector<char> String_to_vector_char(const string& input){
    vector<char> out(input.size());
    rep(i,input.size()){
        out[i]=input[i];
    }
    return out;
}

int n,L;
vector<int> t;
void input(){
    cin>>n>>L;
}
void src(){
    t.resize(n);
    rep(i,n){
        t[i]=L+i;
    }
    *min_element(t.begin(),t.end(),[](int a,int b){return(abs(a)<abs(b));}) =0;
    cout<<accumulate(t.begin(),t.end(),0);
}

int main(int argc,char* argv[]){
    ios::sync_with_stdio(false);
 //   ifstream in( argv[1] ); cin.rdbuf(in.rdbuf());
    input();
    src();    
    return 0;
}

Measured memory_bytes: 256
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
#from fractions import gcd
#from itertools import combinations # (string,3) 3回
#from collections import deque
#from collections import defaultdict
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
w = input()
for i in range(26):
    c = chr(ord('a')+i)
    if w.count(c)%2:
        print('No')
        exit()
print('Yes')


Measured memory_bytes: 3060
#include<iostream>
#include<cmath>
#include <algorithm>
using namespace std;
typedef long long ll;
int mod=1e9+7;
int q_pos(ll x,int n){
	ll res=1;
	while(n){
		if(n&1) res=(res*x)%mod; 
		n>>=1;
   		x=(x*x)%mod; 
  }
  return res;
}
int main()
{ll n; 
 cin>>n;
 cout<<((q_pos(10,n)-(2*q_pos(9,n))+q_pos(8,n))%mod+mod)%mod;
 return 0;
}



Measured memory_bytes: 3600
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    static PrintWriter out;
    static CF_Reader in;

    public static void main(String[] args) throws IOException {
        out = new PrintWriter(new OutputStreamWriter(System.out));
        in = new CF_Reader();

        int n = in.intNext(), m = in.intNext();

        out.println((m == n) ? "Yes": "No");

        out.close();
    }

    static class CF_Reader {
        BufferedReader br;
        StringTokenizer st;

        public CF_Reader() throws IOException {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine().trim());
            return st.nextToken();
        }

        long longNext() throws IOException {
            return Long.parseLong(next());
        }

        int intNext() throws IOException {
            return Integer.parseInt(next());
        }

        double doubleNext() throws IOException {
            return Double.parseDouble(next());
        }

        char charNext() throws IOException {
            return next().charAt(0);
        }

        public int[] nextIntArray(final int n) throws IOException {
            final int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = intNext();
            return a;
        }

        public long[] nextLongArray(final int n) throws IOException {
            final long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = longNext();
            return a;
        }

        String line() throws IOException {
            return br.readLine().trim();
        }
    }
}


Measured memory_bytes: 22996
#include <iostream>

using namespace std;
int bit_d(long long x){
	int k = 0;
	while(true){
		if(x%2==1){
			return k;
		}else{
			x /= 2;
			k++;
		}
	}
}

int bit_u(long long x){
	if(x==0){
		return -1;
	}
	for(int k=31;k>=0;k--){
		if((long long)1<<k & x){
			return k;
		}
	}
}

int main(){
	int i,n,b[40],ans=0;
	long long x=0,a[100010];
	cin >> n;
	for(i=0;i<40;i++){
		b[i] = 0;
	}
	for(i=0;i<n;i++){
		cin >> a[i];
		x ^= a[i];
		b[bit_d(a[i])] = 1;
	}
	int y = bit_u(x);
	while(x!=0){
		if(b[y]==0){
			cout << -1 << endl;
			return 0;
		}
		ans++;
		x = (long long)(1<<(y+1)) - 1 - x;
		y = bit_u(x);
	}
	cout << ans << endl;
}
	

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)n; i++)
#define REPR(i, n) for(int i=(int)n-1; i>=0; i--)
#define FOR(i, m, n) for(int i=(int)m; i<(int)n; i++)
#define FORR(i, m, n) for(int i=(int)m-1; i>=(int)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
typedef long long ll;
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
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 (a>b) { a = b; return 1; } return 0; }



void solve(long long A, long long B){
	ll res = 0;
	ll add = A-1;
	ll sum = 1;
	if (B==1) {
		cout<< 0 << "\n";
		return;
	}
	while (true) {
		sum += add;
		res++;
		if (sum >= B) break;
	}
	cout << res << "\n";
}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(A, B);
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
typedef long long ll;
const ll MOD=1000000007;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }

int main(void){
    // Your code here!
    int r; cin >> r ;
    cout << (int)pow(r,2) ;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

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

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

int main() {
    array<int, 300001> v;
    const int M = 300000;
    for (int i = 0; i <= M; ++i) {
        v[i] = (i%7 == 1) || (i%7 == 6);
    }
    vector<int> primes;
    for (int i = 2; i <= M; ++i) {
        if(v[i] == 1){
            for (int j = i*2; j <= M; j += i) {
                if(v[j] == 1) v[j] = i;
            }
            primes.emplace_back(i);
        }
    }
    int n;
    while(cin >> n, n != 1){
        vector<int> ans;
        for (auto &&j : primes) {
            if(n%j == 0) ans.emplace_back(j);
        }
        printf("%d:", n);
        for (auto &&i : ans) {
            printf(" %d", i);
        }
        puts("");
    }
    return 0;
}


Measured memory_bytes: 4504
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto X = readln.chomp.to!long;
    long r;
    r += X/500 * 1000;
    X -= X/500 * 500;
    r += X/5 * 5;
    writeln(r);
}

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

using namespace std;

int main() {
    int n;
    string s;
    cin >> n >> s;

    char aChar = 'A';
    for (int i = 0; i < s.length(); i++) {
        char c = 'A' + (s[i] - 'A' + n) % 26;
        cout << c;
    }

    return 0;
}


Measured memory_bytes: 256
def abs(x):
    if x < 0:
        return -x
    return x


def main():
    xkd = [int(_x) for _x in input().split()]
    x = xkd[0]
    k = xkd[1]
    d = xkd[2]
    ax = abs(x)
    if ax-k*d > 0:
        print(ax-k*d)
        return

    i = int(ax/d)
    if (k-i) % 2 == 0:
        print(ax-d*i)
        return
    else:
        print(abs(ax-d*i-d))
        return
    # N = int(input())


main()


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

int main() {
  string s;
  cin >> s;
  int cnta = 0, cntb = 0;
  rep(i, 3){
    if(s[i] == 'A'){
      cnta++;
    }else if(s[i] == 'B'){
      cntb++;
    }
  }
  if(cnta == 0 || cntb == 0){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }
  return 0;
}

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

// 2k*2kのマス目を考える
int sm[2020][2020];

int main() {
	int n,k;cin>>n>>k;
	vector<tuple<int,int,char>> dat(n);
	for(int i=0;i<n;++i){
		int x,y;char c;cin>>x>>y>>c;
		x %= 2*k;
		y %= 2*k;
		dat[i] = make_tuple(x,y,c);
	}

	vector<pair<int,int>> d(n);
	for(int i=0;i<n;++i){
		int x,y,c;
		tie(x,y,c)=dat[i];
		if(c=='B'){
			(x+=k)%=2*k;
		}
		d[i] = make_pair(x,y);
		//cerr<<x<<" "<<y<<endl;
	}

	for(int i=0;i<n;++i){
		int x,y;
		tie(x,y) = d[i];
		sm[y][x]++;
	}


	// 横を先にかぞえあげる
	// --->
	// --->
	// --->
	// たてを次にかぞえあげる
	// | | |
	// | | |
	// | | |
	// v v v

	for(int yi=0;yi<2*k;++yi){
		for(int xi=0;xi<2*k;++xi){
			if(xi>0)       sm[yi][xi] += sm[yi][xi-1];
			if(yi>0)       sm[yi][xi] += sm[yi-1][xi];
			if(xi>0&&yi>0) sm[yi][xi] -= sm[yi-1][xi-1];
			//cerr<<sm[yi][xi]<<" ";
		}
		//cerr<<endl;
	}

	auto getAns = [&](int x1,int y1,int x2,int y2){
		if(x1>x2 || y1>y2) return 0;
		int res = sm[y2][x2];
		if(y1>0)         res -= sm[y1-1][x2];
		if(x1>0)         res -= sm[y2][x1-1];
		if(y1>0 && x1>0) res += sm[y1-1][x1-1];
		return res;
	};

	// (0,0)      (xi,0)    (xi+k,0)        (2*k,0)
	//       ok          ng           ok
	// (0,yi)     (xi,yi)   (xi+k,yi)       (2*k,yi)
	//       ng          ok           ng
	// (0,yi+k)   (xi,yi+k) (xi+k,yi+k)     (2*k,yi+k)
	//       ok          ng           ok
	// (0,2*k-1)  (xi,2*k-1)  (xi+k,2*k-1)  (2*k,2*k-1)
	
	int ans = 0;
	for(int yi=0;yi<=k;++yi){
		for(int xi=0;xi<=k;++xi){
			int res = 0;
			res += getAns(0   ,0   ,xi-1  ,yi-1);
			res += getAns(xi+k,0   ,2*k-1 ,yi-1);
		 	res += getAns(xi  ,yi  ,xi+k-1,yi+k-1);
			res += getAns(0   ,yi+k,xi-1  ,2*k-1);
			res += getAns(xi+k,yi+k,2*k-1 ,2*k-1);
			ans = max(ans, res);
		  //cerr<<res<<endl;
			// 白黒逆の時も考える
			ans = max(ans, n-res);
			//cerr<<(n-res)<<endl;
		}
	}
	cout<<ans<<endl;
	
  return 0;
}


Measured memory_bytes: 17920
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
long long M,N;
long long ans = 0;
int main()
{
	cin >> N >> M;
	if( N == 1 && M == 1 ){
		cout << 1 << endl;
		return 0;
	}
	if(N == 1){
		cout << M - 2;
		return 0;
	}
	if(M == 1){
		cout << N - 2;
		return 0;
	}
	if(M == 2 || N == 2){
		cout << 0 << endl;
		return 0;
	}
	if(N >= 3 && M >= 3){
		cout <<  (M - 2) * (N - 2);
		return 0;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
    enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
    ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
    *this << "[";
    for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
    ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef long long ll;

void solve()
{
	string s,t;
	cin>>s;
	cin>>t;
	int n=s.length();
	int ans = 0;
	for (int i=0; i<n; i++) {
		if (s[i]!=t[i]) {
			ans++;
		}
	}
	cout << ans << "\n";
}

int main()
{
	fastIO;
	int t=1;
	// cin>>t;
	while (t--) {
		solve();
	}
	return 0;
}

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

int main() {
  vector<int> ans = {1, 4, 7, 9};
  vector<int> N(4);
  rep(i, 4) cin >> N[i];

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

  if(ans == N){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
s = input().split(" ")
h = int(s[0])
w = int(s[1])
a = int(s[2])
b = int(s[3])

for i in range(b):
  for j in range(w):
    if j < a:
      print(1,end="")
    else:
      print(0,end="")
  print("")

for i in range(h - b):
  for j in range(w):
    if j < a:
      print(0,end="")
    else:
      print(1,end="")
  print("")

Measured memory_bytes: 5360
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include<iostream>
using namespace std;

#define int long long int
#define all(x) (x).begin(), (x).end()
#define removeDuplicates(a) a.resize(unique(all(a))-a.begin())
#define endl '\n'

template<typename Type>
istream &operator>>(istream &in,vector<Type>&vec){
	int n=vec.size();	
	for(int i=0;i<n;i++)
		in>>vec[i];
	return in;
}
template<typename Type>
ostream &operator<<(ostream &out,vector<Type>&vec){
	for(auto val:vec)
		out<<val<<" ";
	out<<endl;
	return out;
}

void solve(){
	int n,W;
	cin>>n>>W;
	vector<vector<int>>w(n,vector<int>(2));
	cin>>w;
	vector<vector<int>>dp(n+1,vector<int>(W+1));
	for(int i=0;i<n;i++){
		if(w[i][0]<=W){
			for(int j=0;j<w[i][0];j++){
				dp[i+1][j]=dp[i][j];
			}
			for(int j=w[i][0];j<=W;j++){
				dp[i+1][j]=max(dp[i][j],dp[i][j-w[i][0]]+w[i][1]);
			}
		}
	}
	int ans=0;
	for(int i=0;i<=W;i++){
		ans=max(ans,dp[n][i]);
	}
	cout<<ans<<endl;
}

int32_t main(){

	//remove for interactive problems
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);

	solve();
	cerr<<"Time : "<<1000*((double)clock())/(double)CLOCKS_PER_SEC<<"ms\n";

	return 0;
}

Measured memory_bytes: 83172