akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
    int n, k; cin>>n>>k;
    ll v[51];
    for(int i=0; i<n; i++) cin>>v[i];
    ll ans=0;
    for(int l=0; l<n; l++){
        for(int r=l-1; r<n; r++){
            ll s=0;
            int k0=k;
            vector<ll> w;
            for(int i=0; i<n; i++){
                if(i<l || i>r){
                    if(v[i]<0) w.push_back(-v[i]);
                    s+=v[i];
                    k0--;
                }
            }
            if(k0<0) continue;
            sort(w.begin(), w.end(), greater<ll>());
            for(int i=0; i<w.size(); i++){
                if(k0==0) break;
                s+=w[i];
                k0--;
            }
            ans=max(ans, s);
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int64_t INF=9999999999999999;

int main() {
 int N;
 cin>>N;
 vector<int>p(N);
 vector<int>k(N);
 for(int i=0;i<N;i++){
   cin>>p[i];
   k[i]=p[i];
 }
 sort(k.begin(),k.end());
 int count=0;
 for(int i=0;i<N;i++){
   if(k[i]!=p[i]){count++;}
 }
 if(count>2){cout<<"NO"<<endl;}
 else{cout<<"YES"<<endl;}
   return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//clock_t _t=clock();
namespace my_std{
    using namespace std;
    #define pii pair<int,int>
    #define fir first
    #define sec second
    #define MP make_pair
    #define rep(i,x,y) for (int i=(x);i<=(y);i++)
    #define drep(i,x,y) for (int i=(x);i>=(y);i--)
    #define go(x) for (int i=head[x];i;i=edge[i].nxt)
    #define templ template<typename T>
    #define sz 1010100
    typedef long long ll;
    typedef double db;
//	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//	templ inline T rnd(T l,T r) {return uniform_int_distribution<T>(l,r)(rng);}
    templ inline bool chkmax(T &x,T y){return x<y?x=y,1:0;}
    templ inline bool chkmin(T &x,T y){return x>y?x=y,1:0;}
    templ inline void read(T& t)
    {
        t=0;char f=0,ch=getchar();double d=0.1;
        while(ch>'9'||ch<'0') f|=(ch=='-'),ch=getchar();
        while(ch<='9'&&ch>='0') t=t*10+ch-48,ch=getchar();
        if(ch=='.'){ch=getchar();while(ch<='9'&&ch>='0') t+=d*(ch^48),d*=0.1,ch=getchar();}
        t=(f?-t:t);
    }
    template<typename T,typename... Args>inline void read(T& t,Args&... args){read(t); read(args...);}
    char __sr[1<<21],__z[20];int __C=-1,__zz=0;
    inline void Ot(){fwrite(__sr,1,__C+1,stdout),__C=-1;}
    inline void print(register int x)
    {
        if(__C>1<<20)Ot();if(x<0)__sr[++__C]='-',x=-x;
        while(__z[++__zz]=x%10+48,x/=10);
        while(__sr[++__C]=__z[__zz],--__zz);__sr[++__C]='\n';
    }
//	void file()
//	{
//		#ifdef NTFOrz
//		freopen("a.in","r",stdin);
//		#endif
//	}
//	inline void chktime()
//	{
//		#ifndef ONLINE_JUDGE
//		cout<<(clock()-_t)/1000.0<<'\n';
//		#endif
//	}
    #ifdef mod
    ll ksm(ll x,int y){ll ret=1;for (;y;y>>=1,x=x*x%mod) if (y&1) ret=ret*x%mod;return ret;}
    ll inv(ll x){return ksm(x,mod-2);}
    #else
    ll ksm(ll x,int y){ll ret=1;for (;y;y>>=1,x=x*x) if (y&1) ret=ret*x;return ret;}
    #endif
//	inline ll mul(ll a,ll b){ll d=(ll)(a*(double)b/mod+0.5);ll ret=a*b-d*mod;if (ret<0) ret+=mod;return ret;}
}
using namespace my_std;

int n;
char s[sz],t[sz];
int q[sz],l=1,r;

int main()
{
//	file();
    read(n);
    cin>>(s+1)>>(t+1);
    if (!strcmp(s+1,t+1)) return puts("0"),0;
    int ans=0,pos=n;
    drep(i,n,1)
    {
        if (t[i]==t[i-1]) continue;
        chkmin(pos,i);
        int cur=i;while (t[cur+1]==t[i]) ++cur;
        while (l<=r)
        {
            int x=q[l]-(r-l);
            if (cur>=x) break;
            ++l;
        } 
        while (pos&&s[pos]!=t[i]) --pos;
        if (!pos) return puts("-1"),0;
        q[++r]=pos;
        chkmax(ans,r-l+1);
    }
    printf("%d\n",ans);
    return 0;
}

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

int main()
{
	std::string a, b;
	std::cin >> a >> b;
	
	int c = std::stoi(a + b);
	int i;
	for (i = 1; i * i < c; i++);
	
	std::cout << (i * i == c ? "Yes" : "No") << std::endl;
	
	return 0;
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    vector<ll>a(3);
    bool ok=false;
    rep(i,3){
        cin>>a[i];
        if(a[i]%2==0)ok=true;
    }
    sort(a.rbegin(),a.rend());
    if(ok==true){cout<<0<<endl;}
    else{cout<<ll(a[1]*a[2])<<endl;}
}


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

using namespace std;

typedef long long          ll;
typedef unsigned long long ull;
typedef vector<int>	       vi;
typedef vector<bool>       vb;
typedef map<int, int>      mii;
typedef pair<int, int>     ii;

#define INF                0x3f3f3f3f
#define INFLL              0x3f3f3f3f3f3f3f3f
#define each(x, s)         for(auto& x : s)
#define loop(x)	           for(int i = 0;i < x;i++)
#define vloop(v, x)        for(int v = 0;v < x;v++)
#define avg(l, r)          l + (r - l) / 2
#define iter(a)            a.begin(), a.end()
#define riter(a)           a.rbegin(), a.rend()
#define endl               "\n"

const ll mod = 1000000007;

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

	int n;
	cin >> n;
	vi a(n);
	loop(n) cin >> a[i];
	sort(iter(a));
	int ans = INF;
	for (int i = a[0];i <= a[n - 1];i++) {
		int sum = 0;
		vloop(j, n) {
			int x = a[j] - i;
			sum += x * x;
		}
		ans = min(ans, sum);
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;
int n,a[100010];
int main(){
  cin>>n;
  int ans=0;
  lol(i,100010)a[i]=0;
  lol(i,n){
    int x;cin>>x;
    if(x>=100010)ans++;
    else a[x]++;
  }
  lol(i,100010){
    if(a[i]<i)ans+=a[i];
    else ans+=a[i]-i;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <functional>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define EB emplace_back
#define GREATER(T) T, VT<T> greater<T>
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

int main(void) {
    int A, B;
    cin >> A >> B;

    FOR(i, 1, 1e7) {
        if ((int)(i * 1.08) == i + A && (int)(i * 1.1) == i + B) {
            cout << i << endl;
            return 0;
        }
    }

    cout << -1 << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {

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

	a=sc.nextInt();
	b=sc.nextInt();

	c=a*b;
	if(c%2==0) {
		System.out.println("Even");}
	else {
		System.out.println("Odd");
	}

}}


Measured memory_bytes: 21588
#!/usr/bin/env python3
import sys


def solve(S: str, T: str, A: int, B: int, U: str):
    if S==U:
        print(A-1, B)
    else:
        print(A, B-1)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    T = next(tokens)  # type: str
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    U = next(tokens)  # type: str
    solve(S, T, A, B, U)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>

#define rep(i,a,b) for(int (i) = (a) ; (i) < (b) ; (i) ++)
#define scin(a) scanf("%d",&a);
#define scdo(a) scanf("%lf",&a);
#define scch(a) scanf("%s",a);
#define anin(a) printf("%d\n",a);
#define ando(a) printf("%lf\n",a);
#define anch(a) printf("%s\n",a);

int asc(const void *a, const void *b) {
  return *(int *)a - *(int *)b;
}

int main(void){
	int N,L,min(300);
	long int ans(0);
	scin(N)
	scin(L)
	rep(i,0,N){
		if(abs(min) > abs(L + i)) min = L + i;
		ans += L + i;
	}
	printf("%ld\n",ans - min);
	return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n;
        int pm,pe,pj;

        while((n = sc.nextInt())!=0){
            for(int i=0;i<n;i++){
                pm = sc.nextInt();
                pe = sc.nextInt();
                pj = sc.nextInt();

                if((pm==100 || pe==100 || pj==100) || (pm+pe)/2>=90 || (pm+pe+pj)/3>=80){
                    System.out.println("A");
                }else if((pm+pe+pj)/3>=70 || ((pm+pe+pj)/3>=50 && (pm>=80 || pe>=80))){
                    System.out.println("B");
                }else{
                    System.out.println("C");
                }
            }
        }
    }
}


Measured memory_bytes: 37172
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N, K;
    cin >> N >> K;
    int countv = 0;
    int h;
    for(int i = 0;i < N;i++) {
        cin >> h;
        if(h >= K) countv++;
    }
    cout << countv << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <string>
#include <math.h>
#include <map>
#include <numeric>
#include <stack>
#include <queue>
#include <functional>
#include <stdio.h>
#define ll long long
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vvvl vector<vector<vector<ll> > >
#define vd vector<double>
#define vvd vector<vector<double> >
#define vvvd vector<vector<vector<double> > >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define vvvb vector<vector<vector<bool> > >
#define rep(i,a) for(ll i = 0;i<a;++i)
#define rrep(i,a) for(ll i = a;i>=0;--i)
#define mod 1000000007
#define inf 10010010010
using namespace std;

int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	ll n; cin >> n;
	vl a(n);
	rep(i, n) cin >> a[i];
	vl ans(n, -1);
	for (ll i = n; i > 0; i--){
		ll count = 0;
		for (ll j = i+i; j <= n; j += i){
			if (ans[j-1]) count++;
		}if (count%2){
			ans[i-1] = !a[i-1];
		}
		else{
			ans[i-1] = a[i-1];
		}
	}
	ll count = 0;
	rep(i, n) if (ans[i]) count++;
	cout << count << endl;
	rep(i, n) if (ans[i]) cout << i + 1 << " " << endl;

	return 0;
}

Measured memory_bytes: 4096
#include<bits/stdc++.h>
#define int unsigned long long
#define ld long double
#define ri register int
#define il inline
#define mk make_pair
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define vi vector<int>
#define all(x) x.begin(),x.end() 
#define rep(i,a,b) for(ri i=(a);i<=(b);++i)
#define per(i,a,b) for(ri i=(a);i>=(b);--i)
#define ls (x<<1)
#define rs (x<<1|1)
#define mid (l+r>>1)
#define db(x) cout << "#x:" << x << endl
#define dd() cout << "Out put!\n"
const int mod=1e9+7,eps=1e-6,pi=acos(-1.0),maxn=1000010;
const int inf=0x7f7f7f7f7f7f7f7f;
using namespace std;
int a[maxn],b[maxn],c[maxn];
char s[maxn]; 
signed main()
{
	cin >> s;
	int l = strlen(s);
	rep(i,0,l-1)
	{
		if(s[i] == '?')
		{
			s[i] = 'D';
		/*	if(i<l-1&&s[i+1]=='D')
				s[i] = 'D';
			else if(i>0&&s[i-1] == 'P')
				s[i ] = 'D';
			else if(i>0&&s[i-1] == 'D')
				s[i] = 'D';
			else if(i<l-1&&s[i+1] == 'P')
				s[i] = 'D';*/
		}
	}
	cout << s;
	return 0;
}

Measured memory_bytes: 3804
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N;
vector<int> G[100011];
vector<int> G2[100011];

bool used[100011];
bool used2[100011];

LL a=0;
LL b=0;

void dfs2(int x);

void dfs(int x){
	used[x]=true;
	a++;
	REP(i,G[x].size()){
		if(used2[G[x][i]]==false){
			dfs2(G[x][i]);
		}
	}
}

void dfs2(int x){
	used2[x]=true;
	b++;
	REP(i,G2[x].size()){
		if(used[G2[x][i]]==false){
			dfs(G2[x][i]);
		}
	}
}

int main(){
	REP(i,100011){
		used[i]=false;
		used2[i]=false;
	}
	cin>>N;
	vector<int>v;
	vector<int>v2;
	REP(i,N){
		int x,y;
		cin>>x>>y;
		G[x].push_back(y);
		G2[y].push_back(x);
		v.push_back(x);
		v2.push_back(y);
	}
	LL ans=0;
	REP(i,v.size()){
		if(used[v[i]]==false){
			a=0;
			b=0;
			dfs(v[i]);
			ans+=a*b;
			//cout<<a<<b<<endl;
		}
	}
	REP(i,v2.size()){
		if(used2[v2[i]]=false){
			a=0;
			b=0;
			dfs2(v2[i]);
			ans+=a*b;
		}
	}
	cout<<ans-N<<endl;
	return 0;
}

Measured memory_bytes: 12144
#include <cstdio>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cctype>
#include <cfloat>

#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <list>

#include <iostream>
#include <sstream>
#include <fstream>

#include <algorithm>
using namespace std;
#ifdef ONLINE_JUDGE
    #define debug
    #define log(message)
#else
    #define debug printf("passing [%s] in line %d\n", __FUNCTION__, __LINE__)
    #define log(message) puts(message)
#endif
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
void closeSync() {ios :: sync_with_stdio(0), cin.tie(0), cout.tie(0);}
template<class T> inline void read(T &x) {
    x = 0; int f = 1; char ch = getchar();
    while(ch < '0' || ch > '9') f &= (ch ^ '-'), ch = getchar();
    while('0' <= ch && ch <= '9') x = (x << 1) + (x << 3) + (ch ^ '0'), ch = getchar();
    x = f ? x : -x;
}

typedef long long ll;
typedef long double ld;

int n, w[5];

int main() {
	read(n);
	for(int i = 4 ; i >= 1 ; -- i) w[i] = n % 10, n /= 10;
	for(int i = 1 ; i <= 3 ; ++ i) {
		if(w[i] == w[i + 1] && w[i] == w[i + 2]) {
			puts("Yes");
			return 0;
		}
	}
	puts("No");
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<math.h>
using namespace std;
int main() {
	int N, Q;
	cin >> N >> Q;
	string S;
	cin >> S;
	vector<int> l(Q), r(Q),num(N),ans(Q);
	num[0] = 0;
	for (int i = 0; i < Q; i++) {
		cin >> l[i] >> r[i];
	}
	for (int i = 1; i <= N; i++) {
		if (S[i - 1] == 'A' && S[i] == 'C') {
			num[i] = num[i - 1] + 1;
		}
		else {
			num[i] = num[i - 1];
		}
	}

	
	for (int i = 0; i < Q; i++) {
		ans[i] = num[r[i]-1] - num[l[i]-1];
	
	}
	for (int i = 0; i < Q; i++) {
		cout << ans[i] << endl;
	}
	
	return 0;
}

Measured memory_bytes: 2688
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <cassert>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
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;}
// head

int n,m;
char s[10][10];
int main() {
	scanf("%d%d",&n,&m);
	rep(i,1,n+1) {
		scanf("%s",s[i]+1);
	}
	rep(i,1,n+1) rep(j,1,m+1) if (s[i][j]=='#') {
		if (i==1&&j==1) continue;
		int c=(s[i-1][j]=='#')+(s[i][j-1]=='#');
		if (c!=1) {
			puts("Impossible");
			return 0;
		}
	}
	rep(i,1,n+1) rep(j,1,m+1) if (s[i][j]=='#') {
		if (i==n&&j==m) continue;
		int c=(s[i+1][j]=='#')+(s[i][j+1]=='#');
		if (c!=1) {
			puts("Impossible");
			return 0;
		}
	}
	puts("Possible");
}


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

#define nl '\n'

using namespace std;

typedef long long ll;

void solve() {
  int N;
  cin >> N;
  int A[N];
  for (int& i: A) cin >> i;

  ll ans = 0;
  const int mod = 1e9 + 7;
  int suff[N] = {0};
  suff[N - 1] = A[N - 1];
  for (int i = N - 2; i >= 0; i--) 
    suff[i] = (A[i] + suff[i + 1]) % mod;
  for (int i = 0; i < N - 1; i++) ans = (ans + (1ll * A[i] * suff[i + 1]) % mod) % mod;

  cout << ans;
}

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

  // int t;
  // cin >> t;
  // while (t--) {
  solve();
  // cout << nl;
  // }

  return 0;
}

Measured memory_bytes: 5196
import java.io.*;
import java.util.*;

public class Main {
	FastScanner in;
	PrintWriter out;
	boolean systemIO = true;

	public static void quickSort(int[] a, int from, int to) {
		if (to - from <= 1) {
			return;
		}
		int i = from;
		int j = to - 1;
		int x = a[from + (new Random()).nextInt(to - from)];
		while (i <= j) {
			while (a[i] < x) {
				i++;
			}
			while (a[j] > x) {
				j--;
			}
			if (i <= j) {
				int t = a[i];
				a[i] = a[j];
				a[j] = t;
				i++;
				j--;
			}
		}
		quickSort(a, from, j + 1);
		quickSort(a, j + 1, to);
	}
	
	

	public void solve() {
		int n = in.nextInt();
		int x = in.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < a.length; i++) {
			a[i] = in.nextInt();
		}
		Arrays.sort(a);
		int ans = 0;
		int i = 0;
		while (i < n) {
			if (x >= a[i]) {
				ans++;
				x -= a[i];
				i++;
			} else {
				break;
			}
		}
		if (i == n && x > 0) {
			ans--;
		}
		out.println(ans);
	}

	public void run() {
		try {
			if (systemIO) {
				in = new FastScanner(System.in);
				out = new PrintWriter(System.out);
			} else {
				in = new FastScanner(new File("input.txt"));
				out = new PrintWriter(new File("output.txt"));
			}
			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		FastScanner(InputStream f) {
			br = new BufferedReader(new InputStreamReader(f));
		}

		String nextLine() {
			try {
				return br.readLine();
			} catch (IOException e) {
				return null;
			}
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

	}

	public static void main(String[] arg) {
		new Main().run();
	}
}

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

int main(){
  char tempo[20];
  scanf("%s", tempo);
  char s[15] = "Sunny";
  char c[15] = "Cloudy";
  char r[15] = "Rainy";

  if(strcmp(tempo,s) == 0){
  printf("Cloudy\n");
  }
  else if(strcmp(tempo,c) == 0){
  printf("Rainy\n");
  }
  else  {
  printf("Sunny\n");
  }

  return 0;

}


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

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

int main(void){
  int L, R, D;
  cin >> L >> R >> D;
  int answer = 0;
  for(int i = L; i <= R; i++){
    if(i % D == 0 ){
      answer++;
    }
  }
  cout << answer;
}

Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<queue>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>
#include<vector>

using namespace std;
const int maxn = 1e5 + 7;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const double pi = acos(-1.0);
typedef long long ll;

int k;
int a, b;

int main(){
	scanf("%d", &k);
	scanf("%d %d", &a, &b);
	int n = k;
	bool ok = 0;
	for(int i = 1; n <= b; i++){
		n = k * i;
		if(n >= a && n <= b) {
			printf("OK\n");
			return 0;
		}
	}
	printf("NG\n");
}

Measured memory_bytes: 3760
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
#include <unordered_map>
#include <fstream>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef pair<int,int> pii;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(int i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,-1,0,1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    rep(i,a.size()) cout << a[i] << " ";
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const ll mod = 1e9 + 7;
//const int mod = 998244353;

int main(){
    while(1){
        int n,m,K; cin >> n >> m >> K;
        if(n+m+K == 0) break;
        double ans = 0.0;
        vector<vd> dp(n+1,vd(n*m+1,0.0));
        dp[0][0] = 1.0;
        rep(i,n){
            rep(j,n*m){
                REP(k,1,m+1){
                    if(j+k <= n*m) dp[i+1][j+k] += dp[i][j] / (double)m;
                }
            }
        }
        rep(i,n*m+1){
            double t = i-K;
            ans += max(t,1.0) * dp[n][i];
        }
        printf("%.10f\n",ans);
    }
}


Measured memory_bytes: 3304
#include<cstdio>
#include<iostream>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<deque>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<limits>
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
using namespace std;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define rep(I,N) up(I,0,N-1)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<"\n";}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<"\n";}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<"\n";}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<"\n";}
inline void                                              out(ld p){printf("%.12Lf\n",p);}
template<class T>inline void outml(T p){for_each(all(p),out<decltype(p[0])>);}//ml=multi line
template<class T>inline void outol(T V){auto n=V.size();rep(i,n)cout<<V[i]<<" \n"[i==n-1];}//ol=one line
template<class T>inline T calc_gcd(T a,T b){if(b==0)return a;return calc_gcd(b,a%b);}
template<class T>inline T calc_lcm(T a,T b){return a*b/calc_gcd(a,b);}
inline void solve(void){
  ll N;
  in(N);
  vector<ll>A(N);
  ins(A);
  vector<ll>L(N+1),R(N+1);
  L[0]=0;
  L[1]=A[0];
  up(i,1,N-1)L[i+1]=calc_gcd(L[i],A[i]);
  R[N]=0;
  R[N-1]=A[N-1];
  dw(i,N-2,0)R[i]=calc_gcd(R[i+1],A[i]);
  ll ans=-1;
  rep(i,N)chmax(ans,calc_gcd(L[i],R[i+1]));
  out(ans);
}
int main(void){
  BEGIN;
  solve();
  END;
}


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

const int N = 100005;

int n, s;
int par[N];
int x[N];
long long p[N];
long long res[N];

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

	cin >> n >> s;
	for (int i = 1; i <= n; ++i) {
		cin >> x[i] >> p[i];
	}

	stack <int> q;
	int l = 1, r = n;
	while(l < r && x[l] < s && x[r] > s) {
		if (p[l] >= p[r]) {
			res[r] += x[r] - x[l];
			p[l] += p[r];
			q.push(r); par[r] = l;
			--r;
		} else {
			res[l] += x[r] - x[l];
			p[r] += p[l];
			q.push(l); par[l] = r;
			++l;
		}
	}

	for (int i = l; i <= r; ++i) res[i] = abs(s - x[i]);

	while(!q.empty()) {
		int u = q.top(); q.pop();
		res[u] += res[par[u]];
	}

	cout << *max_element(res + 1, res + n + 1) << '\n';
}

Measured memory_bytes: 2944
import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons;

void main() {
    const tmp = readln.split.to!(long[]);
    const N = tmp[0], K = tmp[1];

    writeln(2 * K - 1 <= N ? "YES" : "NO");
}


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

using namespace std;

int bt(int n)
{
    if(n == 1){
        return 1;
    }
    return bt(n - 1) + n;
}

int main(void)
{
    int a,b;
    cin >>a >>b;

    int diff = b - a;

    int realA = bt(diff - 1);

    printf("%d\n", realA - a);
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <queue>
#include <cassert>
#include <math.h>
#include <complex>
#include <string.h>

#define forn(i, n) for (int i = 0; i < int(n); i++)
#define fore(i, l, r) for (ll i = int(l); i < int(r); i++)
#define all(a) a.begin(), a.end()
#define mp make_pair
#define pb(a) push_back(a)
#define sz(a) int((a).size())
#define ft first
#define sc second
#define l_b lower_bound
#define u_b upper_bound
#define min_el min_element
#define max_el max_element

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef pair<ld, ld> pld;

const int INF = 1e9;
const ll INF64 = 1e18;
const int logN = 17;
const int N = 100005;
const int M = 20;
const ll MOD = 1000000007;
const ld Pi = 3.1415926535897932384626433832795;
const ld EPS = 1e-9;

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int n;
	cin >> n;
	vector<int> a(n);
	forn(i, n)
		scanf("%d", &a[i]);
	sort(all(a), greater<int>());

	int i = 0;
	while (i + 1 < n && a[i + 1] > i + 1)
		i++;

	int h = a[i] - i;
	int w = 0;
	while (i + w < n && a[i + w] > i)
		w++;

	if (h % 2 && w % 2)
		printf("Second\n");
	else
		printf("First\n");
}

Measured memory_bytes: 640
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <boost/multiprecision/cpp_dec_float.hpp>
using namespace std;
namespace mp = boost::multiprecision;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};

int main(void){
  mp::cpp_dec_float_100 A,B,C;
  cin >> A >> B >> C;
  mp::cpp_dec_float_100 left=sqrt(A)+sqrt(B);
  mp::cpp_dec_float_100 right=sqrt(C);
  if(left<right) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int[] num = new int[2];
		num[0] = scn.nextInt();
		num[1] = scn.nextInt();
		System.out.printf("%d %d %f", num[0]/num[1], num[0]%num[1], (double)num[0]/(double)num[1]);
	}
}



Measured memory_bytes: 26408
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vct vector<ll>
#define umap unordered_map<ll,ll>
#define mpp map<ll,ll>
#define stt set<ll>
#define pir pair<ll,ll>
#define vpp vector<pair<ll,ll> >
#define pb push_back
ll poww(ll a, ll b, ll m) {
    a %= m;
    ll res = 1;
    while (b > 0) {
        if (b & 1)res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
void prt(vector<ll> v)
{
    for(ll i=0;i<v.size();i++)cout<<v[i]<<" ";
    cout<<"\n";
}
vct siev(ll n)
{
    vct ans;ll ar[n+1];
    memset(ar,-1,sizeof(ar));ar[0]=0;ar[1]=0;
    for(ll i=2;i<=n;i++)
    {if(ar[i]==-1){ans.push_back(i);ar[i]=1;for(ll j=2*i;j<=n;j=j+i)ar[j]=0;}}
    return ans;
}
ll isprime(ll n)
{
    if(n==1||n==0)return 0;
    for(ll i=2;i<=sqrt(n);i++)if(n%i==0)return 0;
    return 1;
}
ll etf(ll n) 
{
    ll result = n;
    for (ll i = 2; i * i <= n; i++) {
        if(n % i == 0) {
            while(n % i == 0)n /= i;
            result -= result / i;
        }
    }
    if(n > 1)result -= result / n;
    return result;
}
vct divsors(ll n)
{
    vct ans;//ans.push_back(1);
    for(ll i=2;i<=sqrt(n);i++)
    {if(n%i==0){ans.push_back(i);if(i!=(n/i))ans.push_back(n/i);}}
    sort(ans.begin(),ans.end());
    return ans;
}
ll cnd(ll n){ll cnt=0;while(n){cnt++;n=n/10;}return cnt;}
ll fc(ll n){ll rs=1;for(ll i=2;i<=n;i++)rs*=i;return rs;}
void prn(ll n){cout<<n<<"\n";}
void pr(ll n){cout<<n<<" ";}
void prs(string n){cout<<n<<"\n";}
ll t,m,n,d,q,p,k;
ll t1,t2;
ll mod=1000000007;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n;ll ans;
    if(n%2==0)
    {
        ans=n/2;
        ans--;
    }
    else
    {
        ans=n/2;
    }
    prn(ans);
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

pub fn read_n<T: FromStr>(n: usize) -> Vec<T> {
  read_n_logic::<T>(n, vec![])
}

pub fn read_n_logic<T: FromStr>(n: usize, mut a: Vec<T>) -> Vec<T> {
  match n {
    0 => a,
    _ => {
      a.push(read::<T>());
      read_n_logic(n - 1, a)
    }
  }
}

use std::cmp::{max, min};

fn main() {
  let n: usize = read();
  let b: Vec<i64> = read_n(n-1);

  let mut ans = b[0];
  for i in 0..b.len()-1 {
      ans += min(b[i], b[i+1])
  }

  ans += b[b.len()-1];


  println!("{}", ans);
}


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

ll f(ll a, ll b) { return 1 + (a - 1) + (b - 1); }

int main() {
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  ll g;
  if (a == c) {
    g = 1;
  } else if (b == d) {
    g = 1;
  } else {
    g = __gcd(abs(c - a), abs(d - b));
  }
  cout << g * f(abs(c - a) / g, abs(d - b) / g) << endl;

  return 0;
}

Measured memory_bytes: 256
include Math
a,b,c = gets.split.map(&:to_i)
deg = PI / 180.0 * c
s = a * b * sin(deg) / 2.0
l = a + b + sqrt(a**2 + b**2 - 2 * a * b * cos(deg))
h = 2 * s / a

puts s
puts l
puts h

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

 
int main() {
 string s,t;
 int ans=0;
 cin >> s;
 cin >> t;
 for(int i=0;i<s.size();i++){
     if(s[i]!=t[i]){
         ans++;
     }
 }


 cout << ans << endl;
 
return 0;
}

Measured memory_bytes: 3916
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(l[int(input())-1])

Measured memory_bytes: 3060
h, w, k = map(int, input().split())
s = [list(input()) for _ in range(h)]

a = [[0] * w for _ in range(h)]
cnt = 0
for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            cnt += 1 
            a[i][j] = cnt
        elif j >= 1 and a[i][j-1] > 0:
            a[i][j] = a[i][j-1]
    if a[i][0] == 0:
        for j in range(w-2, -1, -1):
            if a[i][j] == 0:
                a[i][j] = a[i][j+1]

for i in range(h-2, -1, -1):
    if a[i][0] == 0:
        for j, v in enumerate(a[i+1]):
            a[i][j] = v
for i in range(h):
    if a[i][j] == 0:
        for j, v in enumerate(a[i-1]):
            a[i][j] = v

for i in range(h):
    print(*a[i])


Measured memory_bytes: 8272
n,m=map(int,input().split())
dp=[[0]*2 for i in range(n)]
ans,x=0,0
for i in range(n):
  a,b=map(int,input().split())
  dp[i][0]=a
  dp[i][1]=b
dp.sort()
while m>0:
  dp[x][1]-=1
  ans+=dp[x][0]
  m-=1
  if dp[x][1]==0:
    x+=1
print(ans)


Measured memory_bytes: 86724
#include <stdio.h>

int main( void )
{
	int x,y;
	
	while(1)
	{
		scanf( "%d %d", &x, &y );
		
		if( x == 0 && y== 0 )
		{
			break;
		}
		else
		{
			if( x > y )
			{
				printf( "%d %d\n", y, x );
			}
			else
			{
				printf( "%d %d\n", x, y );
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 600
/*{{{*/
#include<bits/stdc++.h>

typedef long long ll;

#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define FORR(i,a,b) for(ll i=b-1;i>=a;i--)

#define vl vector<ll>
#define pll pair<ll,ll>

#define DEBUG(x) cout<<#x<<": "<<x<<endl

using namespace std;
/*}}}*/

int main() {
  ll n;
  cin >> n;
  vl a(n);
  REP(i,n) cin >> a[i];
  double tmp = 1;
  ll ans = 1;
  REP(i,n){
    if(a[i]==0){
      cout << 0 << endl;
      return 0;
    }
  }
  REP(i,n){
    tmp *= a[i];
    if(tmp>1000000000000000000){
      cout << -1 << endl;
      return 0;
    }
  }
  REP(i,n){
    ans *= a[i];
  }
  if(ans>1000000000000000000){
    cout << -1 << endl;
    return 0;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4052
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>

#define ABS(x) ( (x)>0 ? x : -(x) )
#define MIN(x,y) ( (x) < (y) ? (x) : (y) )
#define MAX(x,y) ( (x) > (y) ? (x) : (y) )

#define INF 1000000000

void swap(int* x, int *y)
{
	int t;

	t = *x;
	*x = *y;
	*y = t;
}

int binary_search(int p[], int n, int key)
{
	int left, right, middle;

	left = 0;
	right = n-1;


	while (left <= right)
	{
		middle = (left + right) / 2;

		if (p[middle] == key)
			return middle;
		else if (p[middle] > key)
		{
			right = middle - 1;
		}
		else if (p[middle] < key)
		{
			left = middle + 1;
		}
	}

	return -1;

}

void bubble_sort(int p[], int n)
{
	int i, j;

	for (i = 0; i < n-1; i++)
	{
		for (j = 0; j < n - i - 1; j++)
		{
			if (p[j] > p[j + 1])
				swap(&p[i], &p[i + 1]);
		}
	}
}

int main()
{
	int a[20000], b[20000];
	char sgn[20001];

	int i, j, count = 0;

	for (i = 0;; i++)
	{
		scanf("%d%s%d", &a[i], &sgn[i], &b[i]);

		if (sgn[i] == '?')
			break;

		count++;
	}

	for (i = 0; i < count; i++)
	{
		switch (sgn[i])
		{
		case '+':
			printf("%d\n", a[i] + b[i]);
			break;
		case '-':
			printf("%d\n", a[i] - b[i]);
			break;
		case '*':
			printf("%d\n", a[i] * b[i]);
			break;
		case '/':
			printf("%d\n", a[i] / b[i]);
			break;
		}
	}
}


Measured memory_bytes: 2148
/*
　　　∫ ∫ ∫
　　　ノヽ
　　（＿　 ）
　（＿　　　 ）
（＿＿＿＿＿＿ ）
　ヽ(´･ω･)ﾉ　
　　 |　 /
　　 UU
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = (int)1e9 + 7;
const ll INF = 1LL << 60;
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; }
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = s; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end() //コンテナじゃないと使えない!!
#define debug(x) cerr << #x << ": " << x << "\n";
#define mp make_pair
template <typename T>
ostream& operator<<(ostream& os, vector<T> &V){
    int N = V.size();
    REP(i,N){
        os << V[i];
        if (i!=N-1) os << " ";
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, pair<T,T> &P){
os << P.first;
os << " ";
os << P.second;
os << "\n";
return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T> &S){
    auto it=S.begin();
    while(it!=S.end()){
        os << *it;
        os << " ";
        it++;
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, deque<T> &q){
    for(auto it=q.begin();it<q.end();it++){
        os<<*it;
        os<<" ";
    }
     os<<endl;
    return os;
}
//fixed<<setprecision(10)<<ans<<endl;
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,Q;
    cin >> N;
    int a;
    unordered_set<int> S;
    REP(i,N){
        cin >> a;
        S.insert(a);
    }

    int ans=0;
    cin >> Q;
    REP(i,Q){
        cin >> a;
        if(S.find(a)!=S.end()) ans++;
    }

    cout << ans << endl;
}


Measured memory_bytes: 6796
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
typedef long long ll;

void Main()
{
	ll N, A, B;
	cin >> N >> A >> B;
  	if((B-A)%2==0) cout << (B-A)/2 << endl;
  	else{
    	// A -> 1, B -> B-A+1 : (A-1)回
		// A -> 1, B -> B-A : 1回
      	// (B-A-1)/2回
      	// 計 (B+A-1)/2
      
      	// A -> A+N-B, B -> N : (N-B)回
 		// A -> A+N-B+1, B -> N : 1回
      	// (B-A-1)/2回
      	// 計 N + (-A-B+1)/2
      	ll temp = (B+A-1)/2;
      	cout << min(temp, N-temp) << endl;
    }
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 256
#define ll long long
#define pb push_back
#define make_pair mp
#define first f
#define second s
#define upper_bound ub
#define lower_bound lb
#define MOD 1000000007
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;


#define ordered_set tree<pair<ll,ll> , null_type,less<pair<ll,ll> >, rb_tree_tag,tree_order_statistics_node_update>ll fn



void solve(){
    double d,t,s;cin>>d>>t>>s;
    if(t>=(d/s)){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
}

int main ()
{
  ios_base::sync_with_stdio (false);
  cin.tie (NULL);
  ll t;
  //cin>>t;
  t = 1;
  while (t)
    {
      solve();t--;
      //cout<<"end of test case"<<endl;
    }
  return 0;
}


Measured memory_bytes: 3736
#include <bits/stdc++.h>
#include <string>
using namespace std;
#define ll long long
#define endl "\n"
#define print_array(name,n) for(ll o=0;o<n;o++) cout<<name[o]<<" "
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 2e18
#define pll pair<ll,ll>
#define pii pair<int,int>
bool sortbysecond(const pair<int,int> &a,const pair<int,int> &b){
	return (a.ss>b.ss);
}
 
ll gcd(ll a,ll b){ if(b==0) return a; return gcd(b,a%b) ;} 

template <typename T>
string NumberTostring(T Number )
{
	ostringstream ss;
	ss<<Number;
	return ss.str();
}
 

 
int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int a;
    cin>>a;
    int ans = a+ a*a+ a*a*a;
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long int l,r;
  cin>>l>>r;
  if(r-l>2018){
    cout <<0<<endl;
    return 0;
  }
  l=l%2019;
  r=r%2019;
  if(r<=l){
    cout<<0<<endl;
    return 0;
  }
  long long int mod=900000000000;
  for(long long int i=l;i<r;i++){
    for(long long int j=i+1;j<r+1;j++){
        mod=min((i%2019*j%2019)%2019,mod);
    }
  }
  cout<<mod<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		
		while(stdIn.hasNext()){
			String str = stdIn.nextLine();
			if(str==null){
				break;
			}
			double v = Double.parseDouble(str);
			int i = 1;
			
			while(true){
				double t = Math.sqrt((5*i-5)/4.9);
				double v1 = 9.8*t;
				if(v1>=v){
					System.out.println(i);
					break;
				}
				i++;
			}
			
		}
	}
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define fst first
#define snd second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define EPS (1e-9)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

const string YES = "";
const string NO  = "";

typedef long long ll;

int a[10101];
int n;
bool check() {
  rep(i,n) if( a[i] % 2 == 0 ) {
    if( a[i] % 3 == 0 || a[i] % 5 == 0 ) {}
    else return false;
  }
  return true;
}

int main() {
  cin >> n;
  rep(i,n) cin >> a[i];
  puts(check()?"APPROVED":"DENIED");
  return 0;
}


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

using namespace std;
/*
int find(int x, vector<int> &p) {
if (p[x] == x)return x;
return p[x] = find(p[x], p);
}

void uni(int x, int y, vector<int> &p) {
x = find(x, p);
y = find(y, p);
p[x] = y;
}

int same(int x, int y, vector<int> p) {
if (find(x, p) == find(y, p))return 1;
return 0;
}
*/

int main() {
	long long N, K, cnt = 0, tmp, ans = 0;
	cin >> N >> K;
	vector<long long> V(N);
	for (auto &x : V) {
		cin >> x;
	}
	/*
	long long Max = (int)-10E10;
	for (int i = 0; i < K+1; i++) {//get i times
		for (int j = 0; j < i+1; j++) {//get left j times
			vector<long long> hu;
			long long sc = 0;
			//get
			for (int k = 0; k < j;k++) {
				if (k > N - 1) break;
				sc += V[k];
				if (V[k] < 0) hu.push_back(V[k]);
			}
			for (int k = 0; k < i-j; k++) {
				if (N - 1 - k < 0) break;
				sc += V[N - 1 - k];
				if (V[N - 1 - k] < 0) hu.push_back(V[k]);
			}
			//back
			sort(hu.begin(), hu.end());
			for (int m = 0; m < K - i; m++) {
				int y = hu.size() - 1;
				if (m > y) break;
				sc = sc - hu[m];
			}
			Max = max(Max, sc);
		}
	}
	*/

	long long Max = (int)-10E10;
	for (int i = 0; i < min(K + 1, N + 1); i++) {//get i times
		for (int j = 0; j < min((long long) K - i + 1, N - i + 1); j++) {//get left j times
			vector<long long> hu;
			long long sc = 0;
			//get
			for (int k = 0; k < j; k++) {
				sc += V[k];
				if (V[k] < 0) hu.push_back(V[k]);
			}
			for (int k = 0; k < i; k++) {
				sc += V[N - 1 - k];
				if (V[N - 1 - k] < 0) hu.push_back(V[N - 1 - k]);
			}
			//back
			sort(hu.begin(), hu.end());
			int y = hu.size() - 1;
			for (int m = 0; m < K - i - j; m++) {
				if (m > y) break;
				sc = sc - hu[m];
			}
			Max = max(Max, sc);
		}
	}

	cout << Max;

	char qq;
	cin >> qq;
	return 0;
}

Measured memory_bytes: 256
using System;

 class Program
    {
        static void Main(string[] args)
        {
            //?????°??????
            string[] get_data;
            int sum=0, max=0, formula_count=0, num_ans = 0;

            while (true)
            {
                //???????????£??\
                get_data = Console.ReadLine().Split();
                max = int.Parse(get_data[0]);
                sum = int.Parse(get_data[1]);

                //??????
                if (max == 0 && sum == 0)
                {
                    break;
                }

                else
                {
                    //formula??¢?´¢
                    for (int num_one = 1; num_one <= max; num_one++)
                    {
                        for (int num_two = 1; num_two <= max; num_two++)
                        {
                            for (int num_three = 1; num_three <= max; num_three++)
                            {
                                num_ans = num_one + num_two + num_three;
                                if (sum == num_ans && num_one < num_two && num_two< num_three)
                                {
                                    formula_count++;
                                }
                            }
                        }
                    }
                    //formula??¢?´¢??????
                }
                Console.WriteLine(formula_count);
                formula_count = 0;
            }

        }
    }

Measured memory_bytes: 9168
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
using namespace std;
int a[1005],n;
int main(){
	scanf("%d",&n);
	int k=min(n,500);
	For(i,1,k) a[i]=i,a[i+k]=(i+k>n?i:i+k);
	printf("%d\n",k);
	For(i,1,k) For(j,1,k)
		printf("%d%c",a[(i+j)%k+1+i%2*k],j==k?'\n':' ');
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define ll long long
#define ld long double 
#define vl vector
#define pb push_back
#define ff first
#define ss second
using namespace std;
int main()
{
    ll a,b,i,j,n,t;
    cin>>n;
    n--;
    ll arr[n];
    for(i=0;i<n;i++) cin>>arr[i];
    ll sum=arr[0]+arr[n-1];
    for(i=0;i<n-1;i++)
    {
        if(arr[i]<=arr[i+1]) sum+=arr[i];
        else sum+=arr[i+1];
    }
    cout<<sum;
}

Measured memory_bytes: 3604