akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define DIM 103
long long n,ans,c;
char a[DIM];
set <char> s1,s2;
int main ()
{
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    for (int i = 1; i <= n; i++) {
        for (int j = i + 1; j <= n; j++) {
            for (int k = 1; k <= i; k++)
                s1.insert(a[k]);
            for (int k = j; k <= n; k++)
                s2.insert(a[k]);
            for (auto it : s1) {
                if (s2.count((char)it) == 1)
                    c++;
            }
            s1.clear();
            s2.clear();
            ans = max(ans, c);
            c = 0;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();

        if(a>=13){
            System.out.println(b);
        }else if(a>=6 && a<=12){
            System.out.println(b/2);
        }else{
            System.out.println(0);
        }



    }

}


Measured memory_bytes: 21588
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int A, B;
	cin >> A >> B;
	int res;
	for (int i = 0; i < 1000000; i++) {
		if (1 + (A - 1) * i >= B) {
			res = i;
			break;
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 892
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var stdInScanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	stdInScanner.Scan()
	i, _ := strconv.Atoi(stdInScanner.Text())
	return i
}

func main() {
	stdInScanner.Split(bufio.ScanWords)

	K := nextInt()
	A := nextInt()
	B := nextInt()

	found := false
	for i := A; i <= B && !found; i++ {
		if (i % K) == 0 {
			found = true
		}
	}
	if found {
		fmt.Println("OK")
	} else {
		fmt.Println("NG")
	}
}


Measured memory_bytes: 1756
#include <stdio.h>
struct trump{
  char moji;
  int num;
};

void bubble(struct trump *,int);
void insertion(struct trump *,int);
int judge(struct trump *,struct trump *,int);

void bubble(struct trump k1[],int n){
  int i,j;
  struct trump tmp;
  for(i=0;i<n;i++){
    for(j=n-1;j>i;j--){
      if(k1[j].num < k1[j-1].num) {
	tmp = k1[j];
	k1[j] = k1[j-1];
	k1[j-1] = tmp;
      }
    }
  }
}

void insertion(struct trump k2[],int n){
  int i,j;
  struct trump tmp;
  int minj;
  for(i=0;i<n;i++){
    minj = i;
    for(j=i;j<n;j++){
      if(k2[minj].num > k2[j].num)minj = j;
    }
    tmp = k2[minj];
    k2[minj]=k2[i];
    k2[i] = tmp;
  }
}

int judge(struct trump k1[],struct trump k2[],int n){
  int i;
  for(i=0;i<n;i++){
    if(k1[i].moji != k2[i].moji) return 0;
  }
  return 1;
}

int main(){
  struct trump k[36], k2[36];
  int i,j,n;
  char ik;
  scanf("%d%c",&n,&ik);
  for(i=0;i<n;i++){
    scanf("%c%d%c",&k[i].moji,&k[i].num,&ik);
  }
  for(i=0;i<n;i++){
    k2[i]=k[i];
  }
  bubble(k,n);
  insertion(k2,n);
  for(i=0;i<n-1;i++){
    printf("%c%d ",k[i].moji,k[i].num);
  }
  
  printf("%c%d\nStable\n",k[i].moji,k[i].num);
  for(i=0;i<n-1;i++){
    printf("%c%d ",k2[i].moji,k2[i].num);
  }
  printf("%c%d\n",k2[i].moji,k2[i].num);
  if(judge(k,k2,n)) printf("Stable\n");
  else printf("Not stable\n");
  
  return 0;
}

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

#define forsn(i, s, n)	for (int i = s; i < n; i++)
#define forn(i, n)		for (int i = 0; i < n; i++)

using namespace std;

typedef long long ll;
typedef unsigned int ui;

int main() {
	int n;
	cin >> n;
	if (n%10 == 7 || n/10%10 == 7 || n/100%10 == 7)
		cout << "Yes\n";
	else
		cout << "No\n";
	return 0;
}


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

int main(){

int k;
string x;

cin >> k >> x;

if (x.size() <= k) cout << x << endl;
else {
    for ( int i = 0 ; i < k ; i++ ){
        cout << x.at(i);
    }
    cout << "..." << endl;
}
}

Measured memory_bytes: 3632
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
using ull=unsigned long long;
constexpr auto inf=static_cast<ll>(1e18);
template<typename T=ll>inline T in(){T ret;cin>>ret;return ret;}
template<typename T=ll>inline auto vec2(size_t h,size_t w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}
inline void setp(int n){cout<<fixed<<setprecision(n);}
inline void delnl(){cin.ignore(numeric_limits<streamsize>::max(),'\n');}

void get_divs(ll n,vector<ll>&v)
{
    for(ll i=1;i*i<=n;++i){
        if(n%i==0){
            v.push_back(i);
            if(i*i!=n)v.push_back(n/i);
        }
    }
}
ll gcd(ll x,ll y)
{
    return y==0?x:gcd(y,x%y);
}
int main()
{
    ll a=in(),b=in();
    vector<ll>diva,divb;
    get_divs(a,diva);sort(diva.begin(),diva.end());
    get_divs(b,divb);sort(divb.begin(),divb.end());
    vector<ll>divs;
    set_intersection(
        diva.begin(),diva.end(),
        divb.begin(),divb.end(),
        inserter(divs,divs.end())
    );
    ll foo=1,ans=0;
    for(auto d:divs){
        if(gcd(foo,d)==1)++ans;
        foo=foo/gcd(foo,d)*d;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int((v).size())
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) 
#define rep2(i, n, m) for (ll i = n; i <= (ll)(m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (ll)(m); --i)

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

using ll = long long;
using ld = long double;
using namespace std;

constexpr ll MOD = 1000000007;

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n; cin >> n;
  map<int,int> m;

  rep(i, n-1) {
    int a; cin >> a;
    ++m[a];
  }

  rep2(i, 1, n) cout << m[i] << endl;

  return (0);
}


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

int main()
{
    map<string,int>mp;
    int n; cin >> n;
    int cnt = 0;
    for( int i = 0; i < n; i++ ){
        string s; cin >> s;
        mp[s]++;
        cnt = max(cnt , mp[s] );
    }
    for( auto x : mp ){
        if( x.second == cnt ){
            cout << x.first << "\n";
        }
    }
}


Measured memory_bytes: 25216
#include <stdio.h>
int main(void){
    int i,n,q,a,v,aaa=0,vvv=0,f[1000000],vv[9000];
    scanf("%d %d",&n,&q);
    for(i=n;i>0;i--)f[i-1]=0;
	for(i=0;i<5000;i++)vv[i]=0;
    for(;q>0;q--){
        scanf("%d %d",&a,&v);
		if(vv[f[a-1]]==a){
			for(i=a;f[i]!=f[a-1]&&i<n;i++);
			if(i==n)vv[f[a-1]]=0;
			else vv[f[a-1]]=i+1;
		}
        f[a-1]+=v;
		if(a<vv[f[a-1]] || vv[f[a-1]]==0)vv[f[a-1]]=a;
		if(v>0){if(f[a-1]>vvv || (f[a-1]==vvv && a<aaa)){vvv=f[a-1];aaa=a;}}
        else{
            if(a==aaa){
				for(i=vvv;vv[i]<1;i--);
				vvv=i;aaa=vv[i];
            }
        }
        printf("%d %d\n",aaa,vvv);
    }
}

Measured memory_bytes: 4528
#include<bits/stdc++.h>
using namespace std;
int main(){
  long n,ans1,ans2,b1,b2;
  ans1=0;ans2=0;
  cin>>n;
  vector<int> a(n);
  vector<int> b(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
    b[i]=a[i]-(i+1);
  }
  sort(b.begin(),b.end());
  b1=b[n/2];
  b2=b[(n+1)/2];
  for(int i=0;i<n;i++){
    ans1+=abs(b[i]-b1);
  }
  for(int i=0;i<n;i++){
    ans2+=abs(b[i]-b2);
  }
  cout<<min(ans1,ans2);
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
const long long INF = 1LL << 60;
const long long MOD = 1000000007;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep1(i, n) for (ll i = 1; i <= (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define perm(c) sort(ALL(c));for(bool c##p=1;c##p;c##p=next_permutation(ALL(c)))
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
#define to_s to_string
#define len(v) (ll)v.size()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define print(x) cout << (x) << '\n'
#define drop(x) cout << (x) << '\n', exit(0)
#define debug(x) cout << #x << ": " << (x) << '\n'
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;
typedef vector<ll> vec;
typedef vector<vector<ll>> vec2;
typedef vector<vector<vector<ll>>> vec3;
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; }
ll devc(ll x, ll y) { return 1 + (x - 1) / y; }

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);

    ll H, W;
    cin >> H >> W;
    vec2 c(10, vec(10));
    rep(i, 10) rep(j, 10) cin >> c[i][j];
    for(int k = 0; k < c.size(); k++) {
        for(int i = 0; i < c.size(); i++) {
            for(int j = 0; j < c.size(); j++) {
                if(c[i][k] == INF || c[k][j] == INF) continue;
                c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
            }
        }
    }
    ll ans = 0;
    rep(i, H * W){
        ll x;
        cin >> x;
        if(x == -1) continue;
        ans += c[x][1];
    }
    print(ans);

    return 0;
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 29;
const ll INF64 = 1ll << 62;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll 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++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= 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;
  }
};

int main()
{
  int n;
  cin >> n;
  vector<vector<int>> a(2,vector<int>(n+1, 0));
  rep(i, 2) rep(j, n) cin >> a[i][j+1];
  rep(i, n) {
    a[0][i+1] += a[0][i];
    a[1][i+1] += a[1][i];
  }
  int ans = 0;
  for(int i = 1; i <= n; ++i) {
    chmax(ans, a[0][i]+a[1][n]-a[1][i-1]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import numpy as np

N, M = map(int, input().split())

D = []
dic = dict()

for m in range(M):
    a, b = map(int, input().split())
    D.append((b, a))
    if b in dic.keys() and (dic[b] > a):
        continue
    else:
        dic[b] = a
    
# print(dic)

dp = np.zeros(N+1, dtype=int)

dp[0] = 0
for i in range(1, N+1):
    dp[i] = dp[i-1]
    if i in dic.keys():
        a = dic[i]
        if dp[a] == dp[i]:
            dp[i] = dp[i] + 1

# print(dp)
print(dp[N])    


Measured memory_bytes: 29376
n,k=map(int,input().split())
ans=0
mod=10**9+7
l=[i for i in range(n+1)]
mi=sum(l[:k])
ma=sum(l[n+1-k:])
ans=(ans+ma-mi+1)%mod
for i in range(k+1,n+2):
    mi+=l[i-1]
    ma+=l[-i]
    ans=(ans+ma-mi+1)%mod
print(ans)

Measured memory_bytes: 80976
#include <bits/stdc++.h>
	using namespace std;
	#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__) << "] "
	#define deb debug()
	#define lel(...) deb << " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
	#define ll long long
	#define all(x) (x).begin(), (x).end()
	// 
using namespace std;
 
const int N = 200010;
ll mod = 1e9 + 7;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;} 
int n;
vector<vector<int>> tab(N);
vector<ll> sil(N);
vector<ll> ile(N), dp(N), met(N);

void dfs(int w, int par, ll dppar, ll ilepar) {
	if (par == -1) {
		met[w] = 1;
		ile[w] = 1;
		dp[w] = 1;

		for (int v : tab[w]) {
			if (!met[v]) {
				dfs(v, -1, -1, -1);
				ile[w] += ile[v];
				dp[w] *= dp[v];
				dp[w] %= mod;
				dp[w] *= powmod(sil[ile[v]], mod - 2);
				dp[w] %= mod;
			}
		}

		dp[w] *= sil[ile[w] - 1];
		dp[w] %= mod;
	}

	if (par != -1 || w == 1) {
		dp[w] *= powmod(sil[ile[w] - 1], mod - 2);
		dp[w] %= mod;
		dp[w] *= sil[n - 1];
		dp[w] %= mod;

		if (par != -1) {
			dp[w] *= dppar;
			dp[w] %= mod;
			dp[w] *= powmod(sil[n - ile[w]], mod - 2);
			dp[w] %= mod;
		}

		for (int v : tab[w]) {
			if (v == par) continue;
			ll passdp = dp[w] * sil[ile[v]];
			passdp %= mod;
			passdp *= powmod(dp[v], mod - 2);
			passdp %= mod;
			passdp *= powmod(sil[n - 1], mod - 2);
			passdp %= mod;
			passdp *= sil[n - ile[v] - 1];
			passdp %= mod;
			dfs(v, w, passdp, n - ile[w]);
		}
	}

}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	sil[0] = 1;
	for (ll a = 1; a <= n; a++) sil[a] = (sil[a - 1] * a) % mod;
	for (int a = 1; a < n; a++) {
		int x, y;
		cin >> x >> y;
		tab[x].push_back(y);
		tab[y].push_back(x);
	}
	dfs(1, -1, -1, -1);
	for (int a = 1; a <= n; a++) {
		cout << dp[a] << endl;
	}


	
	
	return 0;
}

Measured memory_bytes: 20992
inputs = gets.chomp.split(" ").map(&:to_i).sort
ans = 0
is_all = inputs[0]

until inputs.all?{|v| v == is_all} do
    if inputs[0] + 2 <= inputs[2]
        inputs[0] += 2
    else
        inputs[0] += 1
        inputs[1] += 1
    end
    inputs.sort!
    is_all = inputs[0]
    ans += 1
end

puts ans

Measured memory_bytes: 1916
#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn=100005;
int a[maxn*2];
int main(){
  // freopen("simple.in","r",stdin);
  // freopen("simple.out","w",stdout);
  int n;scanf("%d",&n);
  for(int i=1;i<=n*2;++i)scanf("%d",a+i);
  sort(a+1,a+2*n+1);
  long long ans=0;
  for(int i=1;i<=n;++i)ans=ans+a[2*i-1];
  printf("%lld\n",ans);
  // fclose(stdin);fclose(stdout);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << "Line(" << __LINE__ << ") -> " << #x << " is " << x << endl
#define int ll

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

const int INF = 1e9 + 7, N = 2e5 + 7;

struct BIT{
	int bit[N];
	BIT() {
		for(int i = 0; i < N; i++) bit[i] = 2e9 + 7;
	}
	void add(int pos, int val) {
		for(;pos<N;pos+=pos&-pos)
			bit[pos] = min(bit[pos], val);
	}
	int qry(int pos) {
		int ret = 2e9 + 7;
		for(;pos;pos-=pos&-pos)
			ret = min(ret, bit[pos]);
		return ret;
	}
} b1, b2;

signed main()
{
	IO_OP;
	
	int n;
	cin >> n;
	vi ys;
	V<pi> v;
	for(int i = 0; i < n; i++) {
		int x, y;
		cin >> x >> y;
		v.EB(x, y);
		ys.PB(y);
	}
	sort(ALL(v));
	sort(ALL(ys));
	ys.resize(unique(ALL(ys))-ys.begin());
	int ans = -(2e9 + 7);
	for(int i = 0; i < n; i++) {
		int yy = lower_bound(ALL(ys), v[i].S) - ys.begin() + 1, yyy = (int)ys.size()-yy+1;
		int sa = v[i].F + v[i].S, na = v[i].F - v[i].S;
		if(i) {
			ans = max(ans, sa - b1.qry(yy));
			ans = max(ans, na - b2.qry(yyy));
		}
		b1.add(yy, sa);
		b2.add(yyy, na);
	}
	cout << ans << endl;

}



Measured memory_bytes: 13228
function Main(input) {
  const inputArr = input.split(" ");
  const N = Number(inputArr[0]);
  const M = Number(inputArr[1]);
  if (N === M) {
    console.log('Yes')
  }
  else {
    console.log('No')
  }
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
#include <numeric> //lcm
#include <iomanip> //double精度 setprecision

using namespace std;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = n-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define rrep1(i,n) for(int i = (n); i >= 1; --i)
#define REP(i,n,m) for(int i = (n); i < (m); ++i)
#define all(vec) (vec).begin(),(vec).end()

#define debug(vec) for(auto v : vec) cerr << v << " "; cerr << endl;
#define debug2D(vec2D, w) for(auto vec : vec2D) { for (auto v : vec) cerr << setw(w) << v << " "; cerr << endl; } 
#define debugP(vec) for(auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl;
#define debug2DP(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl; } 

const char en = '\n';

typedef long long ll;

constexpr ll INF = 1000000000; //10^10
//const ll MOD = 998244353;
constexpr ll MOD = 1000000007;

typedef ll Weight;
typedef vector<vector<Weight>> Graph;
void add_edge(vector<vector<Weight>>& g, Weight from, Weight to, bool isDirected) {
	g[from].push_back(to);
	if (!isDirected) g[to].push_back(from);
}

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

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

	ll k;
  cin >> k;
	vector<ll> c(k);
	int rCnt = 0;
	rep(i, k) {
		char a; cin >> a;
		if (a == 'R') { rCnt++; c[i] = 0;}
		else c[i] = 1;
	}

	int rCntL = 0;
	rep(i, rCnt) {
		if (c[i] == 0) rCntL++;
	}

	cout << rCnt - rCntL << endl;
	
}


Measured memory_bytes: 4752
#!/usr/bin/env python
import sys
import re
from collections import deque, defaultdict
from itertools import combinations, combinations_with_replacement
import bisect
from math import factorial, sqrt, log, ceil, floor
sys.setrecursionlimit(1000000)


def solve(S, N, K, LR):
    happy = 0
    one = 0
    two = 0
    prev = None
    for i in range(N+1):
        s = S[i]
        if prev is None:
            prev = (s, i)
            continue

        if prev[0] == s:
            continue

        happy += (i - 1) - prev[1]
        if prev[0] == LR:
            if prev[1] == 0 and i - 1 == N - 1:
                pass
            elif prev[1] == 0 or i - 1 == N - 1:
                one += 1
            else:
                two += 1
        prev = (s, i)

    spans = [2] * two + [1] * one
    if spans:
        happy += sum(spans[:min(K, len(spans))])

    return happy


def main():
    input = sys.stdin.readline
    #N, M = map(int, input().split())
    #N, K = map(int, input().split())
    #ps = list(map(int, input().split()))

    N, K = map(int, input().split())
    S = input().strip()

    S += 'D'  # dummy

    happy = max([solve(S, N, K, 'L'), solve(S, N, K, 'R')])
    print(happy)


if __name__ == '__main__':
    main()


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

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

typedef pair<int, int> pii;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<long long int> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<long long int>> vvll;

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

  vvc G(h+2, vc(w+2));
  rep(i, w+2) {
    G[0][i] = '#';
    G[h+1][i] = '#';
  }
  for(int i=1;i<=h;i++) {
    G[i][0] = '#';
    for(int j=1;j<=w;j++) {
      cin >> G[i][j];
    }
    G[i][w+1] = '#';
  }

  vvi L(h+2, vi(w+2));
  vvi R(h+2, vi(w+2));
  vvi D(h+2, vi(w+2));
  vvi U(h+2, vi(w+2));

  for(int i=1;i<=h;i++) {
    for(int j=1;j<=w;j++) {
      if(G[i][j] == '.') {
        L[i][j] = L[i][j-1] + 1;
        U[i][j] = U[i-1][j] + 1;
      }
      if(G[h+1-i][w+1-j] == '.') {
        D[h+1-i][w+1-j] = D[h+2-i][w+1-j] + 1;
        R[h+1-i][w+1-j] = R[h+1-i][w+2-j] + 1;
      }
    }
  }

  int max = 0;

  for(int i=1;i<=h;i++) {
    for(int j=1;j<=w;j++) {
      int a = L[i][j]+U[i][j]+D[i][j]+R[i][j] - 3;
      if(a > max) max = a;
    }
  }

  cout << max << endl;
}

Measured memory_bytes: 67072
#include <iostream>

using namespace std;

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


Measured memory_bytes: 256
use std::io::stdin;
 
macro_rules! read {
    ($t: ty) => {{
        let mut line = String::new();
        stdin().read_line(&mut line);
        line.trim().parse::<$t>().unwrap()
    }};
    ($($t: ty), *) => {{
        let mut line = String::new();
        stdin().read_line(&mut line);
        let mut iter = line.split_whitespace();
        (
            $(iter.next().unwrap().parse::<$t>().unwrap(), )*
        )
    }}
}
macro_rules! reads {
    ($e:expr, $t:ty) => {{
        let mut v = vec![];
        for _ in 0..$e {
            let mut line = String::new();
            stdin().read_line(&mut line);
            v.push(line.trim().parse::<$t>().unwrap());
        }
        v
    }};
}
 
fn main() {
    let (n, k) = read!(usize, usize);
    let s = read!(String);
 
    let mut s = s.chars().map(|x| x.to_string()).collect::<Vec<_>>();
    s[k - 1] = s[k - 1].to_lowercase();
    let s = s.iter().map(|x| x.to_string()).collect::<String>();
    println!("{}", s);
}

Measured memory_bytes: 4352
package main
import "fmt"
func main(){
    // Your code here!
    var n int
    fmt.Scan(&n)
    var tall, ans int
    for i := 0; i < n; i++{
        var mountain int
        fmt.Scan(&mountain)
        if(tall <= mountain){
            tall = mountain
            ans ++
        }
    }
    fmt.Println(ans)
}

Measured memory_bytes: 512
import sys,math
from collections import deque,defaultdict
import operator as op
from functools import reduce

I=sys.stdin.readline

def ii():
	return int(I().strip())
def li():
	return list(map(int,I().strip().split()))
def mi():
	return map(int,I().strip().split())
def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer // denom


def main():
	n=ii()
	if n>=30:
		print("Yes")
	else:
		print("No")





		










		


		










		






if __name__ == '__main__':
	main()

Measured memory_bytes: 9568
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define MAX 1000000007
using namespace std;


int main(void){
	int n;
	cin>>n;
	ll a[n],ans[n];
	rep(i,n)cin>>a[i];
	rep(i,n-1){
		if(i%2==0)a[n-1]-=a[i];
		else a[n-1]+=a[i];
	}
	ans[n-1]=a[n-1];
	for(int i=n-2;i>-1;i--){
		ans[i] = 2*a[i]-ans[i+1];
	}
	rep(i,n)cout<<ans[i]<<endl;
	return 0;
}


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

using namespace std;

long long p[200005];

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	long long n, m, br = 1;
	cin >> n;
	for(long long i = 0; i < n; ++i) cin >> p[i];
	m = p[0];
	for(long long i = 1; i < n; ++i){
		m = min(m, p[i - 1]);
		if(p[i] < m) ++br;
	}
	cout << br;

	return 0;
}



Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		System.out.println(c + " " + a + " " + b);

	}
}


Measured memory_bytes: 20948
N, M, C = map(int, input().split())
B = [int(i) for i in input().split()]
inputs = [[int(i) for i in input().split()] for _ in range(N)]

ans = 0
for i in range(N):
    if C + sum([a * b for a, b in zip(inputs[i], B)]) > 0:
        ans += 1

print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;

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

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}



signed main(){
  int n; cin>>n;
  int a[n]; rep(i,n) cin>>a[i];
  ll b[n+1], sum=0;
  b[0] = 0;
  rep(i,n){
    sum += a[i]; b[i+1] = sum;
  }
  sort(b,b+n+1);
  ll cnt = 1; ll ans = 0;
  rep(i,n+1){
    if(b[i]==b[i+1]) cnt++;
    else if(cnt>1) ans += cnt*(cnt-1)/2, cnt = 1;
  }
  // ans += cnt;s
  rep(i,n+1) cerr << b[i] << ' ';
  cerr << endl;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 2560
n = int(input())
s = [input()[0] for _ in range(n)]

march = [0] * 5
for c in s:
    if c in 'MARCH':
        march['MARCH'.index(c)] += 1

print(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])

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

char key[12], ring[100][12];
int n, len;

bool match(int x, int y){
    for(int i = 0; i < len; i++){
        if(key[i] != ring[x][(y+i)%10]) return false;
    }
    return true;
}


int main(){
    scanf("%s", key);
    len = strlen(key);
    scanf("%d", &n);
    for(int x = 0; x < n; x++){
        scanf(" %s", ring[x]);
    }
    int ans = 0;
    for(int x = 0; x < n; x++){
        for(int y = 0; y < 10; y++){
            if(match(x, y)){
               ++ans;
               break;
            }
        }
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 1196
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <ctime>
#include<complex>
#include<unordered_set>
using namespace std;

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

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

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

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

const int MOD = 1000 * 1000 * 1000 + 7;

const int MAX = 1000 * 1000 + 47;

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	//ios::sync_with_stdio(false); cin.tie(0);
	string s;
	cin >> s;
	s = s.substr(0, 4);
	FOR(i, 0, SZ(s)) s[i] = toupper(s[i]);
	if (s == "YAKI")
	{
		cout << "Yes" << endl;
		return 0;
	}

	cout << "No" << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

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

// const
// 円周率
const double pi = M_PI;
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
ll n;
vector<map<ll, ll>> g;
vector<bool> isvisited;
vector<bool> res;
void dfs(int v, int d, int bef) {
  isvisited[v] = true;
  res[v] = d % 2;
  debug("now", v, res[v]);
  for (pair<ll, ll> i : g[v]) {
    if (!isvisited[i.first]) {
      dfs(i.first, (d + i.second) % 2, v);
    }
  }
}

int main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  cin >> n;
  g = vector<map<ll, ll>>(n, map<ll, ll>());
  res = vector<bool>(n, false);
  isvisited = vector<bool>(n);
  rep(i, n - 1) {
    ll u, v, w;
    cin >> u >> v >> w;
    u--;
    v--;
    g[u][v] = w % 2;
    g[v][u] = w % 2;
  }
  res[0] = 0;
  isvisited[0] = true;
  dfs(0, 0, 0);
  rep(i, n) { cout << res[i] << endl; }

  return 0;
}



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

int main(){
	/*input*/
	int n, m;	cin >> n >> m;
	int ans[m] = {0};
	/*calculation*/
	int o = 0;
	for(int i = 0; i < n; i++){
		int k; 
		cin >> k;
		for(int i = 0; i < k; i++){
			int a;
			cin >> a;
			ans[a-1]++;
		}
	}
	for(int i = 0; i < m; i++){
		if(ans[i] == n)o++;
	}
	/*output*/
	cout << o << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

struct place{
  int id,val;
};

int main()
{
  int i,j,n,m;
  struct place score[100];

  while(1){
    scanf("%d %d",&n,&m);

    if(n==0&&m==0) break;

    for(i=0; i<100; i++){
      score[i].id = i+1;
      score[i].val = 0;
    }
      
    for (i=0; i<n; i++)
      for (j=0; j<m; j++){
	int tmp;
	scanf("%d",&tmp);
	score[j].val += tmp;
      }

    while(1){
      struct place tmp;
      int cmp=1;
      for(i=0; i<m-1; i++)
	if(score[i].val<score[i+1].val){
	  tmp = score[i];
	  score[i] = score[i+1];
	  score[i+1] = tmp;
	  cmp = 0;
	}
      if(cmp) break;
    }

    for(i=0;;i++){
      printf("%d",score[i].id);
      if(i==m-1) break;
      printf(" ");
    }
    printf("\n");
  }

  return 0;
}

Measured memory_bytes: 416
function main(input) {
    var args = input.trim().split(/\r\n|\n/);
    var N = Number(args[0].trim());
    var Ai = args[1].trim().split(" ").map(v => Number(v.trim()));
    var Bi = args[2].trim().split(" ").map(v => Number(v.trim()));

    var rest = 0;
    var wins = 0;
    for(var i = 0; Ai.length > i; i++) {
        if ((!!Bi[i] && Bi[i] + rest >= (Ai[i])) || rest >= (Ai[i])) {
            wins += Ai[i];
        } else {
            wins += !!Bi[i] ? Bi[i] + rest : rest;
        }

        var tempRest = 0;
        if (!!Bi[i]) {
            tempRest = Bi[i] - (Ai[i] - rest > 0 ? Ai[i] - rest : 0);
        }
        rest = tempRest > 0 ? tempRest : 0;
    }

    console.log(wins);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

//00:15

int main(){
	int n,w,d;
	while(cin >> n >> w >> d && w ){
		vector< array<int,4> > pie;
		pie.push_back(array<int,4>{0,w*d,w,d});
		for(int i = 1 ; i <= n ; i++){
			int id,s;
			cin >> id >> s;
			id--;
			int W = pie[id][2];
			int H = pie[id][3];
			int len = s % (2*(W+H));
			vector< array<int,4> > nex;
			
			for(int j = 0 ; j < pie.size() ; j++)
				if( j != id ) nex.push_back(pie[j]);
			
			if( len < W ){
				nex.push_back(array<int,4>{i,len*H,len,H});
				nex.push_back(array<int,4>{i,(W-len)*H,W-len,H});
			}else if( len < W+H ){
				len -= W;
				nex.push_back(array<int,4>{i,W*len,W,len});
				nex.push_back(array<int,4>{i,W*(H-len),W,(H-len)});
			}else if( len < W+H+W ){
				len -= W+H;
				nex.push_back(array<int,4>{i,len*H,len,H});
				nex.push_back(array<int,4>{i,(W-len)*H,W-len,H});
			}else{
				len -= W+H+W;
				nex.push_back(array<int,4>{i,W*len,W,len});
				nex.push_back(array<int,4>{i,W*(H-len),W,(H-len)});
			}
			pie = nex;
			sort(pie.begin(),pie.end());
		}
		for(int i = 0 ; i < pie.size() ; i++)
			pie[i][0] = 0;
		sort(pie.begin(),pie.end());
		for(int i = 0 ; i < pie.size() ; i++)
			cout << pie[i][1] << (i+1==pie.size()?"\n":" ");
		
		
		
	}
	
}

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

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

    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, 0, n) cin >> a[i];

    reverse(a.begin(), a.end());
    vector<int> x;
    x.push_back(1e9 + 100);

    rep(i, 0, n) {
        int j = upper_bound(x.begin(), x.end(), a[i]) - x.begin();
        if (x[j] > 1e9) {
            x[j] = a[i];
            x.push_back(1e9 + 100);
        } else {
            x[j] = a[i];
        }
    }
    cout << x.size() - 1 << endl;

    return 0;
}


Measured memory_bytes: 1276
#include<bits/stdc++.h>
#define fo(i,w,n) for(int i=(int) w;i<(int) n;i++)
#define qi queue<int>
#define vi vector<int>
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define fi first
#define se second
#define prq priority_queue
#define foreach(it,c) for(__typeof((c).begin()) it=c.begin();it!=c.end();it++)
using namespace std;
inline ll read(){
	ll x=0;
	int f=1;
	char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-')f=-f;
	for(;isdigit(c);c=getchar())x=x*10+(c-'0');
	return x*f;
}
int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	string s;
	cin>>s;
	sort(all(s));
	if(s[0]==s[1]&&s[2]==s[3]&&s[1]!=s[2])cout<<"Yes\n";
	else cout<<"No\n";
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include<complex>
#include <cassert>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repd(i, n) for (int i = n; i > 0; i--)
#define mod 1000000007
#define MOD 998244353
#define inf 1e20
typedef long long int ll;
typedef pair<ll, ll> pr;
typedef complex<double> com;


int main(){
	int a, b, c;
	cin >> a >> b >> c;
	if (a == b + c || b == c + a || c == a + b) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
	return 0;
}
//Ctrl+Aを使わない

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int n;
    cin >> n;
    int nmax=0,nmin=0;
    bool flags[8];
    for (int i=0;i<8;i++){
        flags[i]=false;
    }
    int experts=0;
    for (int i=0;i<n;i++){
        int a;
        cin >> a;
        if (a>=3200){
            experts++;
        }else{
            flags[a/400]=true;
        }
    }
    for (int i=0;i<8;i++){
        if(flags[i]){
            nmax++;
            nmin++;
        }
    }
    nmax+=experts;
    if (nmin==0 && experts>0){
        nmin=1;
    }
   
    cout << nmin << " " << nmax << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Linq.Enumerable;
using static System.Math;

class Program
{
    static void Main()
    {
        var x = int.Parse(ReadLine());

        var ans = x == 0 ? 1 : 0;

        WriteLine(ans);
    }
}

static class ArrayDeconstructExtensions
{
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2) => (i1, i2) = (a[0], a[1]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3) => (i1, i2, i3) = (a[0], a[1], a[2]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3, out T i4) => (i1, i2, i3, i4) = (a[0], a[1], a[2], a[3]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3, out T i4, out T i5) => (i1, i2, i3, i4, i5) = (a[0], a[1], a[2], a[3], a[4]);
}


Measured memory_bytes: 27536
a = []
for i in range(3):
    a.append(list(map(int,input().split())))
N=int(input())
b = [int(input()) for i in range(N)]
c=[[0,0,0],[0,0,0],[0,0,0]]
if a[0][0] in b:
    c[0][0]=1
if a[0][1] in b:
    c[0][1]=1
if a[0][2] in b:
    c[0][2]=1
if a[1][0] in b:
    c[1][0]=1
if a[1][1] in b:
    c[1][1]=1
if a[1][2] in b:
    c[1][2]=1
if a[2][0] in b:
    c[2][0]=1
if a[2][1] in b:
    c[2][1]=1
if a[2][2] in b:
    c[2][2]=1

if c[0][0]+c[0][1]+c[0][2]==3 or c[1][0]+c[1][1]+c[1][2]==3 or c[2][0]+c[2][1]+c[2][2]==3:
    print("Yes")
elif  c[0][0]+c[1][0]+c[2][0]==3 or c[0][1]+c[1][1]+c[2][1]==3 or c[0][2]+c[1][2]+c[2][2]==3:
    print("Yes")
elif c[0][0]+c[1][1]+c[2][2]==3 or c[0][2]+c[1][1]+c[2][0]==3:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3192
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC optimize(3)
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC target("sse3","sse2","sse")
#pragma GCC target("avx","sse4","sse4.1","sse4.2","ssse3")
#pragma GCC target("f16c")
#pragma GCC optimize("inline","fast-math","unroll-loops","no-stack-protector")
#pragma GCC diagnostic error "-fwhole-program"
#pragma GCC diagnostic error "-fcse-skip-blocks"
#pragma GCC diagnostic error "-funsafe-loop-optimizations"
#pragma GCC diagnostic error "-std=c++14"
#include "bits/stdc++.h"
//#include "ext/pb_ds/tree_policy.hpp"
//#include "ext/pb_ds/assoc_container.hpp"
#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fr(x) freopen(x,"r",stdin)
#define fw(x) freopen(x,"w",stdout)
#define iout(x) printf("%d\n",x)
#define lout(x) printf("%lld\n",x)
#define REP(x,l,u) for(ll x = l;x<u;x++)
#define RREP(x,l,u) for(ll x = l;x>=u;x--)
#define complete_unique(a) a.erase(unique(a.begin(),a.end()),a.end())
#define mst(x,a) memset(x,a,sizeof(x))
#define all(a) a.begin(),a.end()
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MP make_pair
#define sqr(x) ((x)*(x))
#define lowbit(x) (x&(-x))
#define lson (ind<<1)
#define rson (ind<<1|1)
#define se second
#define fi first
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl;
#define sz(x) ((int)x.size())
#define EX0 exit(0);

typedef  long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
using namespace std;
typedef vector<ll> VLL;
typedef vector<int> VI;
const int block_size = 320;
typedef complex<ll> point;
const ll mod = 1e9+7;
const ll inf = 1e9+7;
const ld eps = 1e-9;
const db PI = atan(1)*4;
template<typename T>
inline int sign(const T&a) {
    if(a<0)return -1;
    if(a>0)return 1;
    return 0;
}

template<typename T,typename S>inline bool upmin(T&a,const S&b){return a>b?a=b,1:0;}
template<typename T,typename S>inline bool upmax(T&a,const S&b){return a<b?a=b,1:0;}

template<typename T> inline void in(T &x) {
    x = 0;
    T f = 1;
    char ch = getchar();
    while (!isdigit(ch)) {
        if (ch == '-') f = -1;
        ch = getchar();
    }
    while (isdigit(ch))  {
        x = x * 10 + ch - '0';
        ch = getchar();
    }
    x *= f;
}

ll twop(int x) {
    return 1LL<<x;
}

template<typename A,typename B > inline void in(A&x,B&y) {
    in(x);
    in(y);
}
template<typename A,typename B,typename C>inline void in(A&x,B&y,C&z) {
    in(x);
    in(y);
    in(z);
}
template<typename A,typename B,typename C,typename D> inline void in(A&x,B&y,C&z,D&d) {
    in(x);
    in(y);
    in(z);
    in(d);
}

namespace SOLVE {
    void main(){
    }
}


int main() {

    
    
    
    
    
    
    
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    upmin(b, a*2);
    upmin(c, b*2);
    upmin(d, c*2);
    ll ans = 0;
    cin>>a;
    ans += a/2*d;
    a%=2;
    ans+=a*c;
    cout<<ans;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main() {
	int n;
	while (cin >> n&&n) {
		string f[100];
		int cnt = 0;
		int left = 0, right = 0;
		for (int i = 0; i < n; i++) cin >> f[i];
		int pastl, pastr;
		for (int i = 0; i < n; i++) {
			//cout << '('<<i<<')' << endl;
			if (i % 2 == 0) { pastl = left; pastr = right; }
			if (f[i] == "lu") {
				left++;
				//cout <<"left is "<< left << endl;
			}
			if (f[i] == "ld") {
				left--;
				//cout <<"left is "<< left << endl;
			}
			if (f[i] == "ru") {
				right++;
				//cout <<"right is "<< right << endl;
			}
			if (f[i] == "rd") {
				right--;
				//cout <<"right is "<< right << endl;
			}
			//cout << "check" << endl << "right:" << right << " " << "left:" << left << endl << "pastr:" << pastr << " " << "pastl:" << pastl << endl;
			if (right == left&&right != pastr&&left != pastl&&i % 2 == 1)cnt++;
			//cout << "cnt:" << cnt << endl;
		}
		cout << cnt << endl;
	}
	return 0;
}

Measured memory_bytes: 3132
#include <iostream>

using namespace std;

int main(){
  int N;
  cin >> N;
  int a[N+1];
  for(int i=0; i<N; i++)
    cin >> a[i+1];
  //

  bool pushed[N+1];
  for(int i=0; i<N+1; i++)
    pushed[i] = false;

  int count = 0;
  int now = 1;
  pushed[now] = true;
  while(1){
    if(a[now] == 2){
      cout << count+1 << endl;
      return 0;
    }
    if(pushed[a[now] ] == false){
      pushed[a[now] ] = true;
      now = a[now];
      count++;
    }
    else{
      cout << -1 << endl;
      return 0;
    }
  }

  
  
  return 0;
}


Measured memory_bytes: 4124
#include<stdio.h>

int main(){
    while(1){
        int n,r;
        int table[50];
        scanf("%d%d", &n, &r);
        if(n == 0 && r==0){
            return 0;
        }
        for (int i=0; i<n ; i++) {
            table[i]=n-i;
        }
        for(int i=0; i<r; i++){
            int p,c;
            int work[50];
            scanf("%d%d", &p,&c );
            for(int j=0; j<c; j++){
                work[j]=table[p-1+j];
            }
            for(int j=0; j<p-1; j++){
                work[c+j]=table[j];
            }
            for(int j=p-1+c; j<n; j++){
                work[j]=table[j];
            }
            for(int j=0; j<n; j++){
                table[j]=work[j];
            }
        }
        printf("%d\n", table[0] );
    }
}



Measured memory_bytes: 2696
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    if(a+b==15)cout<<'+'<<endl;
    else if(a*b==15)cout<<'*'<<endl;
    else cout<<'x'<<endl;
    return 0;
}


Measured memory_bytes: 256
<?php
$input = explode(' ', trim(fgets(STDIN)));
$n = (int)$input[0];
$k = (int)$input[1];

$input = explode(' ', trim(fgets(STDIN)));
$cnt = [];
foreach ($input as $val) {
	$tmp = (int)$val;
	if (isset($cnt[$tmp])) {
		$cnt[$tmp]+=1;
	}else{
		$cnt[$tmp]=1;
	}
}
$variety = count($cnt);
$diff = $variety - $k;
if ($diff<=0) {
	echo 0;
	exit();
}else{
	sort($cnt);
	$sum = 0;
	$count = 0;
	foreach ($cnt as $value) {
		$sum += $value;
		++$count;
		if ($count === $diff) {
			break;
		}
	}
	echo $sum;
}


Measured memory_bytes: 35312
// https://atcoder.jp/contests/abc125/tasks/abc125_a
#include <bits/stdc++.h>
using namespace std;

int main(void)
{
  int A, B, T;
  cin >> A >> B >> T;
  float timelimit =  T + 0.5;
  int Biscuits = 0;

  for (int i = 1; i < timelimit; i++){
    if (i % A == 0)
      Biscuits += B;
  }
  cout << Biscuits << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args)throws Exception {
		Scanner stdIn=new Scanner(System.in);
		int N=stdIn.nextInt();
		int a[][]=new int[1000][1000];
		int z=1,y=0,x=1,w=1;
		int key=0;
		while(true) {
			if((z*(z+1))/2==N) {
				key=z;
				break;
			}
			if((z*(z+1))/2>N)
				break;
			z++;
		}z=0;
		if(key==0)
			System.out.println("No");
		else {
			while(z<key) {
				while(y<key) {
					a[z][y]=x;
					a[y+1][z]=x;
					x++;y++;
				}
				z++;
				y=w;
				w++;
			}z=0;y=0;x=0;
			System.out.println("Yes");
			System.out.println(key+1);
			while(z<key+1) {
				System.out.print(key);
				while(y<key) {
					System.out.print(" ");
					System.out.print(a[z][y]);
					y++;
				}y=0;
				System.out.println();
				z++;
			}
		}
	}
}

Measured memory_bytes: 46916