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

template<class T>inline void readin(T &res) {
	static char ch;T flag = 1;
	while((ch=getchar())<'0'||ch>'9')if(ch=='-')flag=-1;
	res=ch-48;
	while((ch=getchar())>='0'&&ch<='9')res=res*10+ch-48;
	res*=flag;
}

char ss[100];
int main() {
	scanf("%s",ss);
	for( int i = 0; i < strlen(ss)-1; i++ ) if(ss[i]=='A'&&ss[i+1]=='C') {
		printf("Yes\n");
		return 0;
	}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int mod=1e9+7; 
map<int,int>d;
inline int read()
{
    char ch=getchar();
    int x=0,q=1;
    while(ch>'9' || ch<'0')q=ch==45?-1:q,ch=getchar();
    while(ch>='0' && ch<='9')x=(x<<1)+(x<<3)+(ch^'0'),ch=getchar();
    return x*q;
}
inline int solve(int x)
{
    if(d[x]!=0)
        return d[x];
    else
    return d[x]=((solve(x/2)+solve((x-1)/2)+solve((x-2)/2)))%mod;
}
signed main()
{
    d[0]=1;
    d[1]=2;  
    int n;
    n=read(); 
    int ans=solve(n);
    printf("%lld\n",ans);
    return 0;
}

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

using namespace std;

typedef long long ll;

int main(void){
    ll l, r;
    cin>>l>>r;
    if(abs(r-l)>=2019){
        cout<<0<<endl;
        return 0;
    }
    ll l2=l%2019;
    ll r2=r%2019;
    
    ll res=3*1e9;

    for(ll i=l2;i<=r2;i++){
        for(ll j=i+1;j<=r2;j++){
            //cout<<i<<" "<<j<<endl;
            res=min(res, (i*j)%2019);
        }
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i ++)
#define irep(i,n) for (int i = (int)(n) - 1;i >= 0;--i)
using namespace std;
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 10000000000000000;
constexpr long long MOD = 1000000007;// = 998244353;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;

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

    ll X,K,D; cin >> X >> K >> D;
    vector<ll> kouho(3);
    kouho[0] = -X/D;
    kouho[1] = -X/D + 1;
    kouho[2] = -X/D - 1;
    ll ans = HINF;
    bool flag = false;
    rep(i,3) {
        if (kouho[i] >= 0) {
            if ((K - kouho[i])%2 == 0 && kouho[i] <= K) {
                ans = min(ans,abs(X + kouho[i]*D));
                flag = true;
            }
        }
        if (kouho[i] < 0) {
            if ((K - kouho[i])%2 == 0 && kouho[i] >= -K) {
                ans = min(ans,abs(X + kouho[i]*D));
                flag = true;
            }
        }
    }
    if (!flag) {
        if (X >= D) ans = min(ans,abs(X - K*D));
        else ans = min(ans,abs(X + D*K));
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H, W;
    cin >> H >> W;
    vector<string> grid(H);
    for (auto& g : grid) {
        cin >> g;
    }
    int dh[4] = {-1, 0, 1, 0}, dw[4] = {0, -1, 0, 1};
    rep(i, 0, H) rep(j, 0, W) {
        if (grid[i][j] == '#') {
            bool is_ok = false;
            rep(k, 0, 4) {
                int next_h = i + dh[k];
                int next_w = j + dw[k];
                if (next_h >= 0 && next_h < H && next_w >= 0 && next_w < W && grid[next_h][next_w] == '#') {
                    is_ok = true;
                    break;
                }
            }
            if (!is_ok) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#define INF 100005
using namespace std;

int main() {
	int a[INF]{};
	int f[INF];
	int c, d;
	scanf("%d%d", &c, &d);
	for (int e = 1; e <= c; e++)scanf("%d", &f[e]);
	f[0] = f[2]; f[c + 1] = f[c - 1];
	for (int x = 1; x <= c; x++) {
		if (f[x - 1]<f[x] && f[x]>f[x + 1]) {
			int z = d - f[x];
			a[x] = z;
			for (int y = x - 1; y > 0; y--) {
				if (f[y] > f[y+1])break;
				z += d - f[y];
				a[y] = max(a[y], z);
			}
			z = d-f[x];
			for (int y = x + 1; y <= c; y++) {
				if (f[y] > f[y - 1])break;
				z += d - f[y];
				a[y] = max(a[y], z);
			}
		}
	}
	int MAX = 0;
	for (int s = 1; s <= c; s++) {
		MAX = max(MAX, a[s]);
	}
	printf("%d\n", MAX);
}

Measured memory_bytes: 3980
#include <cstdio> 
#include <cstdlib> 
#include <cmath> 
#include <cstring> 
#include <climits> 
#include <cfloat> 
#include <map> 
#include <utility> 
#include <set> 
#include <iostream> 
#include <memory> 
#include <string> 
#include <vector> 
#include <algorithm> 
#include <functional> 
#include <sstream> 
#include <complex> 
#include <stack> 
#include <queue> 
#include <numeric>
#include <cassert>

#define FOR(i, min, max) for (int i = (min); i < (max); ++i) 
#define FORE(i, min, max) for (int i = (min); i <= (max); ++i) 
#define REP(i, n) for (int i = 0; i < (n); ++i) 
#define REPV(vec, i) for (int i = 0; i < (int)(vec.size()); ++i) 
#define FOR_EACH(vec, it) for (typeof((vec).begin()) it = (vec).begin(); it != (vec).end(); ++it)

using namespace std; 
static const double EPS = 1e-12; 
typedef long long ll; 

int main(void)
{
    int N, M;
    cin >> N >> M;
    vector<int> H(N);
    REP(i, N)
        cin >> H[i];
    
    vector<bool> ok(N, true);
    int ret = N;
    REP(i, M) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        if (H[a] <= H[b]) {
            if (ok[a]) --ret;
            ok[a] = false;
        }
        if (H[b] <= H[a]) {
            if (ok[b]) --ret;
            ok[b] = false;
        }
    }
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 3760
#include<cstdio>

using namespace std;

const int N = 1e7+5;

bool vis[N];
int prime[N];

int t[N],e[N];

int main()
{
    int n;
    scanf("%d",&n);
    int cnt=0;
    t[1]=1;
    for(int i=2;i<=n;++i)
    {
        if(!vis[i])
        {
            prime[++cnt]=i;
            t[i]=2;
            e[i]=1;
        }
        for(int j=1;j<=cnt;++j)
        {
            if(i*prime[j]>n) break;
            vis[i*prime[j]]=true;
            if(i%prime[j]==0)
            {
                t[i*prime[j]]=t[i]/(e[i]+1)*(e[i]+2);
                e[i*prime[j]]=e[i]+1;
                break;
            }
            else 
            {
                t[i*prime[j]]=t[i]*2;
                e[i*prime[j]]=1;
            }
        }
    }
    long long ans=0;
    for(int i=1;i<=n;++i) ans+=1ll * i * t[i];
    printf("%lld",ans);
}

Measured memory_bytes: 92224
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#include <utility>
#include <set>
#include <stack>
#include <deque>
#include <ctime>
#include <random>
#include <cassert>
#include <cmath>
#include <climits>
#include <queue>
#include <cstring>
#include <bitset>
#include <iomanip>
#include <chrono>

/*
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("popcnt")
#pragma GCC target("avx2")
*/


#ifdef LOCAL
	#define dbg(x) cout << #x << " : " << x << endl;
#else 
	#define dbg(x)
#endif

#define int long long
#define fi(a,b) for (int i=a;i<b;i++)
#define fj(a,b) for (int j=a;j<b;j++)
#define fk(a,b) for (int k=a;k<b;k++)
#define fi1(a,b) for (int i=a-1;i>=b;i--)
#define fj1(a,b) for (int j=a-1;j>=b;j--)
#define fk1(a,b) for (int k=a-1;k>=b;k--)
#define fx(x,a) for (auto& x : a)
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define rep1(i, a, b) for (int i = a - 1; i >= b; --i)
#define siz(x) (int)x.size()
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

using namespace std;

template<typename T1, typename T2>inline void mine(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void maxe(T1 &x, T2 y) { if (x < y) x = y; }

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << ' ';
    return a;
}


typedef long long ll;
typedef unsigned long long ull;
typedef char ch;
typedef string str;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef vector<ch> vch;
typedef vector<vch> vvch;
typedef vector<str> vs;



const int MOD = 1000000007;
const int INF = 1000000050;
const long long BIG = (long long)2e18 + 50;
const int MX = 200010;
const double EPS = 1e-9;


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


int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
   
   	int a, b, c;
   	cin >> a >> b >> c;
   	if (a >= c) {
   		cout << a - c << ' ' << b << '\n';
   	} else {
   		cout << 0 << ' ' << max(0ll, b - c + a) << '\n'; 
   	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define fi first
#define se second
#define endl '\n'
#define mx 1e18
#define mod 1000000007
#define lb(v,x) lower_bound(v.begin(),v.end(),x)
#define ub(v,x) upper_bound(v.begin(),v.end(),x)
#define pb push_back
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll powe(ll x,ll n)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return powe(((x%mod)*(x%mod))%mod,n/2);
    else                             //n is odd
        return ((x%mod*(powe(((x%mod)*(x%mod))%mod,(n-1)/2))%mod)%mod);
}
int main()
{
    int n,k;cin>>n>>k;
    vector<int>a(n+1);
  for(int i=1;i<=n;i++)cin>>a[i-1];
  vector<vector<int>>dp(n+1,vector<int>(k+1,0));
  dp[0][0]=1;
  for(int i=0;i<n;i++)
  {
      for(int j=0;j<=k;j++)
      {
              dp[i+1][j]=dp[i][j];
              if(j>=1)
              dp[i+1][j]=(dp[i][j]%mod+dp[i+1][j-1]%mod)%mod;
             if(j-a[i]-1>=0)
             {
                 dp[i+1][j]=(dp[i+1][j]-dp[i][j-a[i]-1]+mod)%mod;
             }
          
          
          
      }
  }
  cout<<dp[n][k];
  
}

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

long long N,march[5];

int main(){
    cin>>N;
    string S[N];
    for(int i=0;i<N;i++){
        cin>>S[i];
        if(S[i].at(0)=='M'){
            march[0]++;
        }else if(S[i].at(0)=='A'){
            march[1]++;
        }else if(S[i].at(0)=='R'){
            march[2]++;
        }else if(S[i].at(0)=='C'){
            march[3]++;
        }else if(S[i].at(0)=='H'){
            march[4]++;
        }
    }
    
    long long ans=(march[0]*march[1]*march[2])+(march[0]*march[1]*march[3])+(march[0]*march[1]*march[4])+(march[0]*march[2]*march[3])+(march[0]*march[2]*march[4])+(march[0]*march[3]*march[4])+(march[1]*march[2]*march[3])+(march[1]*march[2]*march[4])+(march[1]*march[3]*march[4])+(march[2]*march[3]*march[4]);
    cout<<ans<<endl;
    return 0;
}

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

const int mod = 1e9 + 7;

int main() {
    int n;
    cin >> n;
    vector<ll> counter(61, 0);
    rep(i, n) {
        ll a;
        cin >> a;
        for (int i = 0; i <= 60; i++) {
            if (a & (1ll << i)) counter[i]++;
        }
    }
    ll sum = 0;
    for (int i = 0; i <= 60; i++) {
        sum += (1ll << i) % mod * counter[i] % mod * (n - counter[i]) % mod;
        sum %= mod;
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
# -*-coding: utf-8 -*-
a, b, c, d = map(int, input().split())
# (x1, y1)を原点に移動させる
c -= a
d -= b
if c > 0 and d >= 0:     # 第一象限
    e = c - d
    f = c + d
    g = -abs(d)
    h = abs(c)
elif c <= 0 and d > 0:       # 第二象限
    e = c - abs(d)
    f = d - abs(c)
    g = -abs(d)
    h = -abs(c)
elif c < 0 and d <= 0:       # 第三象限
    e = c + abs(d)
    f = d - abs(c)
    g = abs(d)
    h = -abs(c)
else:       # 第四象限
    e = c + abs(d)
    f = d + abs(c)
    g = abs(d)
    h = abs(c)

print("{} {} {} {}".format(e+a , f+b , g+a ,h+b))

Measured memory_bytes: 3064
#include <stdio.h>

int main(){
	int time_S,h,m,s;
	scanf("%d",&time_S);
	h=time_S/3600;
	m=time_S%3600/60;
	s=time_S%60;
	printf("%d:%d:%d\n",h,m,s);
	return 0;
}

Measured memory_bytes: 2752
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        
        int lgt = S.length();
        if(T.substring(0,lgt).equals(S)){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 35676
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  int n,a;
  cin>>n>>a;
  vector<int> x(n);
  REP(i,n){
    cin>>x[i];
    x[i] -= a;
  }
  sort(x.begin(),x.end());
  long long dp[51][5050]={};//i番目まで選んで和をj-2500にできる場合の数。
  dp[0][2500]=1;
  REPP(i,n){
    REP(j,5050){
      //i番目を選ばない場合。
      dp[i][j]=dp[i-1][j];
    }
    REP(j,5050){
      //i番目を選ぶ場合。
      if(0<=j-x[i-1] && j-x[i-1]<=5000){
        dp[i][j] += dp[i-1][j-x[i-1]];
      }
    }
  }
  cout<<dp[n][2500]-1<<endl;
  return 0;
}


Measured memory_bytes: 2304
from collections import defaultdict

N = int(input())
A = list(map(int, input().split()))
Q = int(input())

d = defaultdict(int)
ans = 0
for a in A:
    ans += a
    d[a] += 1

for _ in range(Q):
    b, c = map(int, input().split())
    n = d[b]
    ans -= n * b
    ans += n * c
    print(ans)

    d[b] = 0
    d[c] += n

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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef vector<vl> mt;
typedef unordered_map<ll,unordered_map<ll,ll>> graph;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<string> vs;
typedef vector<vs> table;


const ll e5 = 1 << 20;
const ll mod = 1000000007;
const ll e3 = 1 << 13;
const ll INF = 1ll << 50;

ll n;
vl a;
multiset<ll> s;

void show_s(){
  for(ll x : s){
    cerr << x << " ";
  }
  cerr << endl;
}

int main(){
  cin >> n;
  a = vl(n);
  for(ll i = 0;i < n;i++) cin >> a.at(i);
  for(ll i = 0;i < n;i++){
    auto x_iter = s.upper_bound(-a.at(i));
    if(x_iter == s.end()){
      s.insert(-a.at(i));
    }else{
      s.erase(x_iter);
      s.insert(-a.at(i));
    }
    // show_s();

  }
  cout << s.size() << endl;


}


Measured memory_bytes: 5760
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <utility>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
typedef long long int ll;

int main() {
  int N;
  cin>>N;
  
  bool can=true;
  
  vector<int> A(N);
  rep(i,N){
    cin>>A[i];
    if(A[i]%2==0){
      if(A[i]%3!=0 && A[i]%5!=0)
        can=false;
    }
  }
  
  if(can)
    cout<<"APPROVED"<<endl;
  else
    cout<<"DENIED"<<endl;
  
  
}


Measured memory_bytes: 256
memo = [[[-1] * 201 for j in range(201)] for i in range(201)]

def gcd(numbers):
    numbers.sort()
    a = numbers[1]
    b = numbers[0]
    ans = b
    while True:
        q, mod = divmod(a, b)
        if mod == 0:
            break
        a = b
        b = mod
        ans = mod
    return ans

K = int(input())
numbers = []

for i in range(K, 0, -1):
    for j in range(i, 0, -1):
        for k in range(j, 0, -1):
            numbers.append([i, j, k])

gcd_sum = 0
for number in numbers:
    dup = len(set(number))
    a, b, c = number
    if memo[a][b][c] == -1:
        if dup == 1:
            ans = gcd([gcd([a, b]), c])
        elif dup == 2:
            ans = gcd([gcd([a, b]), c]) * 3
        else:
            ans = gcd([gcd([a, b]), c]) * 6
        memo[a][b][c] = ans
    gcd_sum += memo[a][b][c]

print(gcd_sum)


Measured memory_bytes: 305284
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int A,B,num,counter;
	cin>>A>>B;
	for(A;A<=B;A++){
      	string s = to_string(A);
		if(s[0]==s[4]&&s[1]==s[3]){
		counter++;
		}
	}
	cout<<counter<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
using namespace std;
int main(void){
    int n;
    cin>>n;
    vector<long long> a(n);
    cin>>a[0];
    for(int i=1;i<n;i++){
        cin>>a[i];
        a[i]+=a[i-1];
    }
    long long ans1=0,def1=0;
    for(int i=0;i<n;i++){
        if(i%2==0&&a[i]+def1<=0){
            ans1+=1-(a[i]+def1);
            def1+=1-(a[i]+def1);
        }
        else if(i%2==1&&a[i]+def1>=0){
            ans1+=a[i]+def1+1;
            def1-=a[i]+def1+1;
        }
    }
    long long ans2=0,def2=0;
    for(int i=0;i<n;i++){
        if(i%2==1&&a[i]+def2<=0){
            ans2+=1-(a[i]+def2);
            def2+=1-(a[i]+def2);
        }
        else if(i%2==0&&a[i]+def2>=0){
            ans2+=a[i]+def2+1;
            def2-=a[i]+def2+1;
        }
    }    
    cout<<min(ans1,ans2)<<endl;
    return 0;
}


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

// ?¢?????????????DFS??§??¢???
bool dfs(int v, vector<vector<int> >& G, vector<int>& match, vector<bool>& used){
  // ??????????????¨???????????????
  used[v] = true;
  for(size_t i = 0; i < G[v].size(); i++){
    int u = G[v][i];
    int w = match[u];
    // w?????????????????¨????????? or (w???????????¨ && ?????????????°´??????????????´???)
    if(w < 0 || (!used[w] && dfs(w, G, match, used))){
      // v??¨u??????????????????
      match[v] = u;
      match[u] = v;
      return true;
    }
  }
  return false;
}

// ?????¨??°??????????????§??????????????°????±???????
// ?????????: (??????????????°??°, ??????????????°?????????)
pair<int, vector<int> > BipartiteMatching(vector<vector<int> >& G){
  int V = G.size();
  int res = 0;
  vector<int> match(V, -1);
  // ?????????????????????
  for(int v = 0; v < V; v++){
    // v???????????????????????£???????????????????????°??§??????????????? 
    if(match[v] < 0){
      vector<bool> used(V, false);
      if(dfs(v, G, match, used)){ res++; }
    }
  }
  return make_pair(res, match);
}


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


int main(void){
  while(true){
    int m, n;
    cin >> m >> n;
    if(m == 0 && n == 0){ break; }
    vector<int> b(m), r(n);
    for(int i = 0; i < m; i++){ cin >> b[i]; }
    for(int i = 0; i < n; i++){ cin >> r[i]; }

    vector<vector<int> > adjlist(m + n);
    for(int i = 0; i < m; i++){
      for(int j = 0; j < n; j++){
        if(gcd(b[i], r[j]) > 1){
          adjlist[i].push_back(m + j);
          adjlist[m + j].push_back(i);
        }        
      }
    }

    int result = BipartiteMatching(adjlist).first;
    cout << result << endl;
  }

  return 0;
}

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

int main(){
  string s;
  cin >> s;
  int n=s.size(),i,w=0;
  for(i=0;i<n;i++){
    if(s.at(i)=='o'){
      w++;
    }
  }
  
  w += 15-n;
  if(w>=8){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}

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

int main(){
    int n;
    cin >> n;
    vector<int> a(n,0), b(n,0);
    for(int i=0; i<n-1; i++){
        cin >> a[i];
        b[a[i]-1]++;
    }

    for(int i=0; i<n; i++){
        cout << b[i] << endl;
    }
}

Measured memory_bytes: 4844
#include <stdio.h>

int main(void)
{
	int x, y;
	int x2, y2;
	int i, j;
	int n;
	int gcd, lcm;
	
	while (scanf("%d %d", &x, &y) != EOF){
		x2 = x; y2 = y;
		i = 1;
		while (i != 0){
			i = x % y;
			gcd = y;
			x = y; y = i;
		}
		lcm = (x2 / gcd) * y2;
		printf("%d %d\n", gcd, lcm);
	}
	
	return (0);
}

Measured memory_bytes: 596
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
const int inf = 1012345678;
bool vis[2][52][52][52][52][2]; int dp[2][52][52][52][52][2];
int solve(int px, int py, int lx, int ly, int pass, int parity, vector<int> &play, vector<int> &opp) {
	if (pass == 2) return 0;
	if (vis[parity][px][py][lx][ly][pass]) return dp[parity][px][py][lx][ly][pass];
	int ans = -inf;
	if (px < play.size()) {
		ans = -solve(py, px + 1, (play[px] != 0 ? ly : py), lx, 0, parity ^ 1, opp, play);
	}
	if (px != lx || py != ly) {
		int delta = 0;
		for (int i = lx; i < px; ++i) delta += play[i];
		for (int i = ly; i < py; ++i) delta -= opp[i];
		int res = solve(py, px, py, px, 0, parity ^ 1, opp, play);
		ans = max(ans, delta - res);
	}
	else {
		int res = solve(py, px, py, px, pass + 1, parity ^ 1, opp, play);
		ans = max(ans, -res);
	}
	vis[parity][px][py][lx][ly][pass] = true;
	dp[parity][px][py][lx][ly][pass] = ans;
	return ans;
}
int main() {
	int N, M;
	cin >> N >> M;
	vector<int> A(N), B(M);
	for (int i = 0; i < N; ++i) cin >> A[i], A[i] = (A[i] > 0 ? A[i] : 0);
	for (int i = 0; i < M; ++i) cin >> B[i], B[i] = (B[i] > 0 ? B[i] : 0);
	int res = solve(0, 0, 0, 0, 0, 0, A, B);
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 85104
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define INF LLONG_MAX - 100
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
#define lowb lower_bound
#define upb upper_bound
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
int month[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};



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

	int h, n;
	cin >> h >> n;
	int a[n], s = 0;
	rep(i, n) {
		cin >> a[i];
		s += a[i];
	}

	yorn(s >= h);
	return 0;
}

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

using namespace std;
using ll = long long int;
constexpr ll M = 1e9 + 7;
inline ll sum_1(const ll n) { return ((n * (n + 1)) / 2) % M; }
inline ll sum_2(const ll n) { return ((n * (n + 1) * (2 * n + 1)) / 6) % M; }
inline ll sum_3(const ll n) { return (((n * (n + 1)) / 2) % M * ((n * (n + 1)) / 2) % M) % M; }
inline ll sum_1(const ll i, const ll j) { return (sum_1(j) - sum_1(i - 1) + M) % M; }
inline ll sum_2(const ll i, const ll j) { return (sum_2(j) - sum_2(i - 1) + M) % M; }
inline ll sum_3(const ll i, const ll j) { return (sum_3(j) - sum_3(i - 1) + M) % M; }

void solve() {
    ll k, n;
    cin >> k >> n;
    vector<ll> A(n);
    for (auto &i : A) {
        cin >> i;
    }
    ll max_diff = LLONG_MIN;
    for (int i = 0; i < n-1; ++i) {
        max_diff = max(max_diff, A[i+1]-A[i]);
    }
    max_diff = max(max_diff, k+A[0]-A[n-1]);
    cout << k-max_diff << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    #ifdef D_LOCAL
        freopen("in.in", "r", stdin);
        freopen("out.out", "w", stdout);
    #endif

    solve();

    return 0;
}

Measured memory_bytes: 1920
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 文字列の入力
		String s = sc.next();
      int a = 0;
      if (s.equals("SUN")){
        a = 7;
      }else if (s.equals("MON")){
        a = 6;
      }else if (s.equals("TUE")){
        a = 5;
      }else if (s.equals("WED")){
        a = 4;
      }else if (s.equals("THU")){
        a = 3;
      }else if (s.equals("FRI")){
        a = 2;
      }else{
        a = 1;
      }
		// 出力
		System.out.println(a);
	}
}

Measured memory_bytes: 20564
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

#define REP(i, init, n) for(int i = (int)(init); i < (int)(n); i++)

#define vi vector<int>
#define vl vector<long>
#define vvi vector<vector<int>>
#define vvl vector<vector<long>>
#define pint pair<int, int>
#define plong pair<long, long>

int main() {    
    int N;
    cin>>N;
    vl dist1, dist2;
    REP(i, 0, N){
        int x, y;
        cin >> x >> y;
        dist1.push_back(x + y);
        dist2.push_back(y - x);
    }
    sort(dist1.begin(), dist1.end());
    sort(dist2.begin(), dist2.end());
    cout << max(dist1[N-1] - dist1[0], dist2[N-1] - dist2[0]) << endl;
}

Measured memory_bytes: 6644
#include <iostream>
#include <vector>
#include <map>

using namespace std;

const long long d = 45;

int main()
{
    long long A, B;
    cin >> A >> B;
    if(A == B)
    {
        cout << A << endl;
        return 0;
    }
    long long s = A & 1;
    long long t = B & 1;
    long long num = (B + 1 - A) / 2 + (s & t);
    long long ans = num % 2;
    for (long long i = 1; i < d; i++)
    {
        long long i2 = 1LL << i;
        long long la = A & i2;
        long long lb = B & i2;
        long long R1 = i2 - A % i2;
        long long R2 = (B + 1) % i2;
        long long cnt = 0;
        if (la)
        {
            cnt += R1;
        }
        if (lb)
        {
            cnt += R2;
        }
        if (cnt % 2 == 1)
        {
            ans += i2;
        }
    }

    cout << ans << endl;

    return 0;
}


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

int main() {
	int n;
	cin >> n;
	int a = n % 10;
	string k = "hon";
	if(a == 3)
	{
		k = "bon";
	}
	else if(a==0||a==1||a==6||a==8)
	{
		k = "pon";
	}
	cout << k << endl;
	return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <set>
#include <utility>
#include <cstdio>
#include <cstring>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n, m) for (int i = n; i >= m; i--)



int main(){
	int n, k;
	cin >> n >> k;
	cout << (n % k);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define EPS 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<ll,ll> >seq[95];
vector<ll>cur;
vector<ll>fib;
void go(ll c){
	cur.pb(c);
	if(cur[cur.size()-1] >= fib[cur.size()-1]*2LL && cur[cur.size()-2] >= fib[cur.size()-2]*2LL) {
	    cur.pop_back(); return ;
	}
	for(ll i=1;i<=6;i++){
		if(c*i+cur[cur.size()-2] > 2000000000000000000LL){
			if(cur[cur.size()-1]+cur[cur.size()-2] > 2000000000000000000LL && !(cur[cur.size()-1] > fib[cur.size()-1]*2LL && cur[cur.size()-2] > fib[cur.size()-2]*2LL)){
				vector<ll>vi;
				for(int l=0;l+1<cur.size();l++){
					seq[l].pb(mp(cur[l],cur[l+1]));
				}
			}
			break;
		}
		go(c*i+cur[cur.size()-2]);
	}
	cur.pop_back();
}
P ans[15][15];
int rec(int a,int b){
	if(a<b) return rec(b,a);
	if(b==0) return 0;
	return rec(b,a%b)+1;
}
int main(){
    fib.pb(1); fib.pb(2);
    while(fib[fib.size()-2]+fib[fib.size()-1] <= 2000000000000000000LL){
        fib.pb(fib[fib.size()-2]+fib[fib.size()-1]);
    }
	cur.pb(1);
	go(2);
	go(3);
	go(4);
	go(5);
	rep(i,90){
		SORT(seq[i]);
		ERASE(seq[i]);
		//cout<<i<<" " <<seq[i].size()<<endl;
	}
	for(int i=1;i<=10;i++){
		for(int j=1;j<=10;j++){
			int mx=-1,num=0;
			for(int a=1;a<=i;a++){
				for(int b=1;b<=j;b++){
					if(mx == rec(a,b)){
						num++;
					}
					else if(mx < rec(a,b)){
						mx = rec(a,b); num = 1;
					}
				}
			}
			ans[i][j] = mp(mx,num);
		}
	}
	int q; cin>>q;
	rep(t,q){
		ll x,y; scanf("%lld%lld",&x,&y);
		if(x<=10 && y<=10){
			printf("%d %d\n",ans[x][y].fi,ans[x][y].sc);
			continue;
		}
		if(x>y) swap(x,y);
		if(x == 1){
			printf("1 %lld\n",y%mod);
			continue;
		}
		int mx = 0;
		for(int i=0;i<fib.size()-1;i++){
			if(fib[i]<=x && fib[i+1]<=y) mx = i+1;
		}
		assert(mx>=2);
		ll ret = 0;
		for(int i=0;i<seq[mx-2].size();i++){
			if(seq[mx-2][i].sc > x) continue;
			ll v = seq[mx-2][i].fi;
			ret += (y-v)/seq[mx-2][i].sc;
			ret %= mod;
			ret += (x-v)/seq[mx-2][i].sc;
			ret %= mod;
		}
		cout<<mx<<" "<<ret<<endl;
	}
}

Measured memory_bytes: 5376
#include<cstdio>
const static int N_MAX = 10;
const static int M_MAX = 10;

int s[M_MAX][N_MAX];

int main(){
	int N, M;
	scanf("%d %d", &N, &M);
	int l[M];
	for (int i = 0; i < M; ++i){
		scanf("%d", l + i);
		for (int j = 0; j < l[i]; ++j){
			scanf("%d", &s[i][j]);
			s[i][j]--;
		}
	}
	bool p[M];
	for (int i = 0; i < M; ++i){
		int tmp;
		scanf("%d", &tmp);
		p[i] = tmp == 1;
	}
	unsigned ans = 0;
	for (unsigned i = 0; i < 1 << N; ++i){
		bool flag = true;
		for (unsigned j = 0; j < M; ++j){
			bool status = false;
			for (unsigned k = 0; k < l[j]; ++k){
				if(i >> s[j][k] & 1) status ^= true;
			}
			if(status ^ p[j]){
				flag = false;
				break;
			}
		}
		if(flag) ans++;
	}
	printf("%u\n", ans);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define cases long long t;cin>>t;while(t--)
#define f_io ios::sync_with_stdio(false)
#define foi(a,n) for(long long i=a;i<n;i++)
#define foj(a,n) for(long long j=a;j<n;j++)
#define fok(a,n) for(long long k=a;k<n;k++)
#define ll long long
#define MOD 1000000007
using namespace std;

int main()
{
    f_io;
    ll n,k;
    cin >> n >> k;
    if(500*n>=k)
        cout <<"Yes";
    else
        cout <<"No";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
#define LL long long
#define Dev 1000000007

// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;

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

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
	string str; int n;
	multimap<string,int> ans;
	while(cin>>str>>n)
		ans.insert(pair<string,int>(str,n));
	multimap<string,int>::iterator p;
	for(p=ans.begin();p!=ans.end(); )
	{
		string tmp= p->first;
		cout << tmp << endl;
		int cnt=0;
		vector<int> v;
		do
		{
			v.push_back(p->second); p++;
		}while(p!=ans.upper_bound(tmp));
		sort(v.begin(),v.end());
		for(int i=0;i<v.size();i++)
		{
			if(i) cout << ' ' ;
			cout << v[i] ;
		}
		cout << endl;
	}
}

Measured memory_bytes: 1244
import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val s = sc.next()

  val list = mutableListOf<Char>()
  var pre = s[0]
  list.add(pre)
  for (i in 1 until s.length) {
    val now = s[i]
    if (now != pre) {
      list.add(now)
    }
    pre = now
  }

  println(list.size - 1)

}


Measured memory_bytes: 41432
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;

int main(){
    string s;
    cin>>s;
    int A[4];
    int op;

    for(int i = 0; i < 4; i++) A[i] = (int)(s[i]-'0');

    for(op = 0; op < (1<<3); op++){
        int res = A[0];
        for(int i = 1; i < 4;i++){
            if(op & (1 << (i-1))) res += A[i];
            else res -= A[i];
        }

        if(res == 7){
            cout<<A[0];
            for(int i = 1; i<4;i++){
                if(op & (1 << (i-1))) cout<<"+";
                else cout<<"-";
                cout<<A[i];
            }
            cout<<"=7\n";
            return 0;
        }

    }
   



}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 998244353;
const ll MAX = 4000001;
const double eps = 1E-18;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a % b);
}

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint operator^(const ll& t)const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

///////////////////////////



int main() {
	ll N;
	cin >> N;
	string S;
	cin >> S;

	vector<ll> a(N);
	rep(i, N) a[i] = S[i] - '0';

	vector<mint> bin(N + 1, 0);
	repn(i, N) {
		bin[i] = bin[i - 1] * 2 + a[i - 1];
	}

	vector<mint> num(N + 1, 0);

	repn(i, N) {
		if (N%i != 0) { continue; }
		if ((N / i) % 2 == 0) { continue; }

		num[i] = bin[i];

		vector<ll> sim(N);
		rep(j, N) {
			if (j < i) { sim[j] = a[j]; }
			else { sim[j] = (a[j - i] + 1) % 2; }
		}
		ll x = 1;
		rep(j, N) {
			if (a[j] < sim[j]) { x = 0; break; }
			else if(a[j]>sim[j]) { break; }
		}
		num[i] += x;
		//cout << i << num[i] << endl;
	}

	vector<mint> mnum(N + 1, 0);
	repn(i, N) mnum[i] = num[i];

	repn(i,N) {
		if (N%i != 0) { continue; }
		if ((N/i) % 2 == 0) { continue; }
		
		for (ll j = i * 2; j <= N; j += i) {
			if (N%j == 0&&(N/j)%2!=0) { mnum[j] -= mnum[i]; }
		}
	}

	//repn(i, N) cout << i << mnum[i] << endl;

	mint ans = 0;
	repn(i, N) {
		ans += mnum[i]*2 * i;
	}
	cout << ans << endl;

	system("PAUSE");
}


Measured memory_bytes: 6900
N = int(input())
P = list(map(int,input().split()))

cnt = 0
for i in range(1,N-1):
  if (P[i-1] < P[i] < P[i+1]) or (P[i+1] < P[i] < P[i-1]):
    cnt += 1
    
print(cnt)

Measured memory_bytes: 9168
#include <bits/stdc++.h>
 
#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << endl;
#else
#define DBG(X)
#endif
 
using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld  = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF  = (ll)(2e18);

const ll mod = 1e9 + 7;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for(auto el: v) cout << el << " "; return os; }

void solve()
{
	int n;
	cin >> n;

	vector<int> a(n);

	for(auto& el: a)
		cin >> el;

	vector<int> ans;

	while(!a.empty())
	{
		int j = -1;

		for(int i = 0; i < a.size(); ++i)
			if(a[i] == i + 1)
				j = i;

		if(j == -1)
		{
			cout << "-1" << endl;
			return;		
		}

		ans.push_back(j + 1);

		DBG(j);
		a.erase(a.begin() + j);
	}

	reverse(ans.begin(), ans.end());

	for(auto el: ans)
		cout << el << endl;
}

int main(int argc, char** argv)
{
	fast_io();
	solve();

	return 0;
}


Measured memory_bytes: 256
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           node(a,b,c)                 mp(mp(a,b),c)
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=100005;

 main()

{
    fast
    int x;
    cin>>x;
    cout<<1-x<<"\n";
    return 0;

}





































Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long int ll;
#define rep(i,n) for(int i=0;i<(int)n;i++)
int Min(int a, int b, int c) {
	if (a <= b) { return std::min(a, c); }
	else return std::min(b, c);
}
int main(void) {
	int a; cin >> a;
	if (a % 2 == 0)cout << a / 2 * a / 2 << endl;
	else cout << a / 2 * (a + 1) / 2 << endl;
	return 0;
}

Measured memory_bytes: 256
/*
    Don’t practice until you get it right. Practice until you can’t get it wrong.
*/

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

#define ll long long
#define ld double
#define pii pair<ll,ll>
#define vl vector<ll>
#define vb vector<bool>
#define vs vector<string>
#define vp vector<pii>
#define pb push_back
#define mp make_pair
#define sc(a) scanf("%lld",&a);
#define sd(a) scanf("%lf",&a);
#define test() ll tt;cin>>tt;for(ll testcase=1;testcase<=tt;testcase++)
#define all(v) v.begin(),v.end()
#define vivek_ghosh ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MAX 1000055
#define mod 1000000007
#define ff first
#define ss second
//const int INF=0x3f3f3f3f;
const ll int inf = LLONG_MAX;

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

ll modinv(ll a,ll m)
{
    ll g =__gcd(a, m);
    ll res=power(a, m-2, m);
    return res;
}

vb prime(MAX,true);
vl prm;
void sieve()
{
	prime[0] = prime[1] = false;
	for(ll p=2;p*p<MAX;p++)
	{
		if(prime[p])
		{
			for(ll i=p*p;i<MAX;i+=p)
				prime[i] = false;
		}
	}
	for(ll p=2;p<MAX;p++)
	{
		if(prime[p])
			prm.pb(p);
	}
}

ll n,m,t,i,j,k,q,x,y,ans=0,cnt=0,sum=0,mx=-1,mn=INT_MAX;
string s;

int main()
{
	vivek_ghosh;

	ll h,w;
	cin>>h>>w;
	vector<vl> grid(h,vl(w,0)), dp(h,vl(w,0));
	for(i=0;i<h;i++)
    {
        cin>>s;
        for(j=0;j<w;j++)
        {
            if(s[j] == '#')
                grid[i][j] = 1;
            else
                grid[i][j] = 0;
        }
    }

    if(grid[0][0])
    {
        dp[0][0] = 1;
    }
    for(i=0;i<h;i++)
    {
        for(j=0;j<w;j++)
        {
            if(i==0 && j==0)
                continue;
            else if(i==0)
            {
                dp[i][j] = dp[i][j-1];
                if(grid[i][j]==1 && grid[i][j-1]==0)
                    dp[i][j]++;
            }
            else if(j == 0)
            {
                dp[i][j] = dp[i-1][j];
                if(grid[i][j]==1 && grid[i-1][j]==0)
                    dp[i][j]++;
            }
            else
            {
                ll up = 0, left = 0;
                if(grid[i][j] == 0)
                {
                    up = dp[i-1][j];
                    left = dp[i][j-1];
                }
                else
                {
                    if(grid[i-1][j] == 1)
                    {
                        up = dp[i-1][j];
                    }
                    else
                    {
                        up = 1 + dp[i-1][j];
                    }

                    if(grid[i][j-1] == 0)
                    {
                        left = 1 + dp[i][j-1];
                    }
                    else
                    {
                        left = dp[i][j-1];
                    }
                }
                dp[i][j] = min(up,left);
            }
        }
    }

    cout<<dp[h-1][w-1]<<endl;






	return 0;
}








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

string a = "abcdefghijklmnopqrstuvwxyz";
bool f[30];

int main() {
    string s;
    cin >> s;
    rep(i, s.size()) {
        f[s[i]-'a']=1;
    }
    rep(i, a.size()) {
        if (!f[i]) {
            cout << char('a'+i) << endl;
            return 0;
        }
    }
    cout << "None" << endl;
}


Measured memory_bytes: 512
use std::io::{self, BufRead, BufWriter, Write};

fn solve<R, W>(reader: R, mut writer: W)
where
    R: BufRead,
    W: Write,
{
    let mut lines = reader.lines();
    let a_line = lines.next().unwrap().unwrap();
    let mut splited = a_line.trim().split_whitespace();
    let h: i32 = splited.next().unwrap().parse().unwrap();
    let w: i32 = splited.next().unwrap().parse().unwrap();
    let a: i32 = splited.next().unwrap().parse().unwrap();
    let b: i32 = splited.next().unwrap().parse().unwrap();

    for i in 0..h {
        for j in 0..w {
            let n = if i < b && j < a || b <= i && a <= j { 0 } else { 1 };
            write!(&mut writer, "{}", n).unwrap();
        }
        write!(&mut writer, "\n").unwrap();
    }
}

fn main() {
    let stdio = io::stdin();
    let input = stdio.lock();

    let stdout = io::stdout();
    let output = BufWriter::new(stdout.lock());

    solve(input, output);
}

#[cfg(test)]
mod tests {
    use super::*;

    const TESTS: &'static [(&'static [u8], &'static [u8])] = &[
        (
            br"3 3 1 1", br"100
010
001
",
        ),
        (
            br"1 5 2 0", br"01010
",
        ),
        (
            br"5 10 3 2", br"01010
",
        ),
    ];

    #[test]
    fn test_a() {
        for &(input, expected) in TESTS {
            let mut output = Vec::new();
            solve(input, &mut output);
            let expected_str = String::from_utf8(expected.to_vec()).unwrap();
            let output_str = String::from_utf8(output).unwrap();
            // assert_eq!(expected_str, output_str);
            println!("{}", output_str);
        }
    }
}


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

int main(void){
    char buf[128];
    bool found;
    
    while (gets(buf) != NULL){
        for(int i=0; i<26; i++){
            found = false;
            if (strstr(buf, "th")){
                found = (strstr(buf,"the") != NULL);
                found |= (strstr(buf,"this") != NULL);
                found |= (strstr(buf,"that") != NULL);
            }
            if (found) break;
            for (char *p = buf; *p != '\0'; p++){
                if (*p >= 'a' && *p <= 'z'){
                        *p = (*p - 'a' + 1) % 26 + 'a';
                }
            }
        }
        printf("%s\n",buf);
    }
    
    return 0;
}

Measured memory_bytes: 928
import bisect
n=int(input())
l=list(map(int,input().split()))
l.sort()
#print(l)
ans=0
if n==3:
  if l[0]+l[1]<=l[2]:
    ans=0
  else:
    ans=1
if n>=4:
  for lef in range(n-1):
    for ri in range(lef+1,n):
      idx=bisect.bisect_left(l,l[lef]+l[ri])
      ans+=idx-ri-1
#      print(lef,ri,idx,ans)
print(ans)


Measured memory_bytes: 42972
h, w, m = map(int, input().split())

mp = set()
hp = [0] * h
wp = [0] * w

for i in range(m):
    a, b = map(int, input().split())
    mp.add((a, b))
    l = [a, b]
    hp[l[0]-1] += 1
    wp[l[1]-1] += 1

maxhp = max(hp)
maxwp = max(wp)
hpdex = [i for i, x in enumerate(hp) if x == maxhp]
wpdex = [i for i, x in enumerate(wp) if x == maxwp]

for i in hpdex:
    for j in wpdex:
        if (i+1, j+1) not in mp:
            print(max(hp) + max(wp))
            exit()

print(max(hp) + max(wp) - 1)

Measured memory_bytes: 83456
#include <iostream>

using namespace std;

int main() {
	int sx, sy, tx, ty, i, j;
	cin >> sx >> sy >> tx >> ty;
	int a, b;
	a = tx - sx;
	b = ty - sy;
	for (i = 0; i < b; i++) {
		cout << "U";
	}
	for (i = 0; i < a; i++) {
		cout << "R";
	}
	for (i = 0; i < b; i++) {
		cout << "D";
	}
	for (i = 0; i < a; i++) {
		cout << "L";
	}
	cout << "L";
	for (i = 0; i < b+1; i++) {
		cout << "U";
	}
	for (i = 0; i < a+1; i++) {
		cout << "R";
	}
	cout << "D"<<"R";

	for (i = 0; i < b+1; i++) {
		cout << "D";
	}
	for (i = 0; i < a+1; i++) {
		cout << "L";
	}
	cout << "U" << endl;
	return 0;
}

Measured memory_bytes: 256