akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<functional>
#include <string>
#include<cstdio>
#include<math.h>
#include<stack>
#include<queue>
#include<cstring>
#include<vector>
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define EREP(i,n) for(int i=(n-1);i>=0;--i)
#define D(n,retu) REP(i,n){cin>>retu[i];}
#define mod 1000000007
#define MIN -93193111451418101
#define INF 931931114518101
using namespace std;
typedef long long int ll;
template<typename T>
void fill_all(T& arr, const T& v) {
	arr = v;
}
template<typename T, typename ARR>
void fill_all(ARR& arr, const T& v) {
	for (auto& i : arr) { fill_all(i, v); }
}
ll combination(ll n) {
	ll nck[100][100];
	nck[0][0] = 1;
	for (int i = 1; i < 1 + n; i++) {
		nck[i][0] = nck[i][i] = 1;
		for (int j = 1; j < i; j++) {
			nck[i][j] = nck[i - 1][j - 1] + nck[i - 1][j];
		}
	}
	return 0;
}
//------------------変数-----------------------//
ll n, m, a, b, k, d, c, h, w;;
typedef pair<ll, ll> P;
vector<vector<ll>> way(2001), money(2001);
ll maxa = 0, moto = 0;
ll retu[11451] = {};
ll grid[111][111] = {};
queue <ll>q;
ll bitmax = 0;
//-------------------関数----------------------//

int main() {
	cin >> h >> w >> n;
	REP(i, n) { cin >> retu[i]; }
	ll now = 0, takasa = 0;
	bool righ = true;
	bool fir = true;

	bool two = false, one = false, kaigyou = false;;
	REP(i, n) {
		ll col = i + 1;
		ll num = retu[i];
		REP(j, num) {
			if (now == w - 1) {
				if (two == false) { two = true; kaigyou = true; }
				else {
					two = false;		takasa++; righ = false;
				}
			}
			if (now == 0 && !fir) {
				if (one == false) { one = true; kaigyou = true; }
				else {
					one = false;		takasa++; righ = true;
				}
			}
			fir = false;
			grid[takasa][now] = col;
			if (kaigyou == true) { kaigyou = false; continue; }
			if (righ == true) { now++; }
			else { now--; }
		}
	}
	REP(i, h) {
		REP(j, w) {
			if (j) { cout << " "; }
			cout << grid[i][j];
		}cout << endl;
	}
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <numeric>
#include <queue>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define srep(i,s,t) for (int i = s; i < t; i++)
#define drep(i,n) for(int i = (n)-1; i >= 0; i--)
using namespace std;
typedef long long ll;
typedef vector<vector<char>> field_t;
typedef unsigned long long ull;
typedef pair<ll, ll> point_t;

int main()
{
    int X,N;
    bool T=false;
    cin >> X >> N;
    vector<int> p(N);
    vector<int> v(101,0),u(101,0);
    rep(i,N){
        cin >> p[i];
        if(X>p[i]){
            v[X-p[i]]++;
        }
        if(X<p[i]){
            u[-X+p[i]]++;
        }
        if(X==p[i]){
            T=true;
        }
    }
    
    if(!T){
        cout << X <<endl;
        return 0;
    }
    int k=1;
    int ans=X;
    srep(j,1,101){
        if(v[j]!=0){
            if(u[j]!=0){
                continue;
            }else{
                ans+=j;
                break;
            }
        }else{
            ans-=j;
            break;
        }
    }
    cout << ans <<endl;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define fi first
#define se second
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define forn(i, n) for(int i = 0; i < int(n); ++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi; typedef vector<pair<int, int>> vpi; typedef vector<vi> vvi;
typedef vector<ll> vll; typedef vector<pair<ll, ll>> vpll; typedef vector<vll> vvll;

unordered_map<string,int> u;

int32_t main(){
    ios::sync_with_stdio(false); cin.tie(nullptr);
    cout.precision(10); cout << fixed;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "rt", stdin);
#endif

    
    int n,ans=0;
    cin>>n;
    while(n--){
        string s;
        cin>>s;
        if(u[s]==0) u[s]++,ans++;
    }
    cout<<ans<<endl;

    
    return 0;
}


Measured memory_bytes: 17748
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> VI;
typedef pair <int,int> ii;
typedef long long LL;
#define pb push_back
const int INF = 2147483647;
const int N = 3005;
const int MOD = 998244353;

int n, s, i, j, k, r[N], tab[N], res;

void loop() {
	
}

int main() {
scanf("%d %d", &n, &s);
for (i=1;i<=n;i++) scanf("%d", &tab[i]);
r[tab[1]] = 1;
if (tab[1] == s) res = n; else res = 0;
for (i=2;i<=n;i++) {
	if (tab[i] > s) continue;
	res = ((n - i + 1) * 1LL * r[s - tab[i]] + res) % MOD;
	if (tab[i] == s) res = ((n - i + 1) * 1LL * i + res) % MOD;
	for	(k=s - tab[i];k>=0;k--) r[k + tab[i]] = (r[k + tab[i]] + r[k]) % MOD;
	r[tab[i]] = (r[tab[i]] + i) % MOD;	
	//printf("%d %d\n", i, res);
}
printf("%d\n", res);
return 0;
}

Measured memory_bytes: 256
<?php
$s=trim(fgets(STDIN));
$n=strlen($s);
$i=0;
$p=0;
while($i<$n){
if($s[$i]=="B"){
$p=max(0,$p-1);
$ans[$p]="";
}else{
$ans[$p]=$s[$i];
++$p;
}
++$i;
}
echo join("",$ans);

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

using namespace std;

int main(){
    string st;
    cin>>st;
    for(int i=0;i<st.length();i++){
        if(i%2==0){
            if(st[i]=='L'){
                cout<<"No";
                exit(0);
            }
        }
        else{
            if(st[i]=='R'){
                cout<<"No";
                exit(0);
            }
        }
    }
    cout<<"Yes";
} 

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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#define INFILE freopen("input.txt", "r", stdin)
#else
#define debug(x)
#define INFILE
#endif

#define ALL(s) begin(s), end(s)
#define RALL(s) rbegin(s), rend(s)
#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define RREP(i, a, b) for (int i = (a); i >= (b); i--)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;

static constexpr ll INF = 1LL << 60;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();
static constexpr ll MOD = 1000000007;

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);

ll dp[21 + 1][1 << 21];

int main(int argc, char* argv[]) {
  long long N;
  scanf("%lld", &N);
  std::vector<std::vector<long long>> a(N, std::vector<long long>(N));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      scanf("%lld", &a[i][j]);
    }
  }

  dp[0][0] = 1;

  REP(i, 0, N) {
    REP(j, 0, 1 << N) {
      if (i != __builtin_popcount(j)) continue;
      REP(k, 0, N) {
        int mask = 1 << k;
        if (mask & j || !a[i][k]) continue;
        dp[i + 1][j | mask] = (dp[i + 1][j | mask] + dp[i][j]) % MOD;
      }
    }
  }

  cout << dp[N][(1 << N) - 1] << endl;
  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

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

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

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


Measured memory_bytes: 309504
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;

#define all(a) (a).begin(), (a).end()

int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

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

    vector<int> a(4);
    for(int i=0; i<4; i++) cin>>a[i];
    sort(all(a));

    cout << (abs(a[0] + a[3] - a[1] - a[2])) << endl;

    return 0;
}


Measured memory_bytes: 3220
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())





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

	int a, b;
	cin >> a >> b;

	cout << (a < 10 && b < 10 ? a * b : -1) << endl;




	return 0;
}

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const ll INF = 1e9+7;


vector<int> edge[100005];
bool used[100005];
ll dfs(int n){
	used[n] = true;
	ll ret = 1;
	for(auto t: edge[n]) if(!used[t]){
		ret += dfs(t);
	}
	return ret;
}

int main(){
	//ios_base::sync_with_stdio(false);
	ll N, M, ans=0;

	cin >> N >> M;
	rep(i,M){
		int a, b;
		cin >> a >> b;
		edge[a].push_back(b);
		edge[b].push_back(a);
	}

	int c1 = dfs(1);
	int c2 = dfs(2);

	ll c = min(c1, c2);
	ll d = N-c;
	ans = (c*(c-1ll) + d*(d-1ll))/2ll - M;

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 8960
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define all(v) v.begin(),v.end()
#define PI acos(-1)
#define EPS 1e-15

struct cmp {
	bool operator()(const pair<int, int>& a, const pair<int, int>& b){
		return a.second < b.second;
	}
};

int main() {
	int n, k;
	cin >> n >> k;
	map<int, int> a;
	for(int i = 0; i < n; i++){
		int x;
		cin >> x;
		a[x]++;
	}
	multiset<pair<int, int>, cmp> s(a.begin(), a.end());
	int cnt = 0;
	while((int)s.size() > k){
		pair<int, int> p = *s.begin();
		cnt += p.second;
		s.erase(s.begin());
	}
	cout << cnt << endl;
	return 0;
}






Measured memory_bytes: 18944
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element {
        return self.maxElement()!
    }
    func min() -> Element {
        return self.minElement()!
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/



/*************** メインプログラム ***************/

let input = readIntSplit(by: " ")
let (A, B, C, D) = (input[0], input[1], input[2], input[3])
let start = max(A, C)
let end = min(B, D)
print(max(end - start, 0))


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

int main()
{
    int W, H, x, y, r;
    cin >> W >> H >> x >> y >> r;

    if(x+r<=W && x-r>=0 && y+r<=H && y-r>=0)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout <<  "No" << endl;
    }
    
    return 0;
}


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

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rept(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(int)(n);(i)++)
#define repst(i,s,n) for(int (i)=(s);(i)<=(int)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) c.begin(),c.end()
#define pb push_back
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln << "\n"
#define show(x) cout << #x << " = " << x ln
#define dbg(x) cout<<#x"="<<x ln

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

// ⊂ニニニニニニニニニニニニニ( ^ω^)ニニニニニニニニニニニニニ⊃

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	
	int n, a, b;
	cin >> n >> a >> b;
	cout << min(a*n, b) ln;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <queue>
#define ll long long
#define space putchar(' ')
#define endl putchar('\n')
#define debug puts("------------------------")
#define F(i,x,n) for(int i=x;i<=n;++i)
#define F_(i,x,n) for(int i=x;i>=n;--i)
using namespace std;
inline void read(int &a) {a=0;int c=getchar(),b=1; while(c>'9'||c<'0') {if(c=='-')b=-1;c=getchar();} while(c>='0'&&c<='9') a=(a<<3)+(a<<1)+c-48,c=getchar();a*=b; }
inline int  Rem() {int a=0,c=getchar(),b=1; while(c>'9'||c<'0') {if(c=='-')b=-1;c=getchar();} while(c>='0'&&c<='9') a=(a<<3)+(a<<1)+c-48,c=getchar();return a*=b; }
inline void write(int x) {if(x>9)write(x/10);putchar('0'+x%10);}
inline void W(int x) {if(x<0){putchar('-'),x=-x;}write(x);}
/**/
int a,b;
/**/
int main()
{
    // freopen("test.in","r",stdin);
    // freopen("test.out","w",stdout);
    read(a);read(b);
    if(a>=1&&a<=9&&b>=1&&b<=9) cout<<a*b;
    else cout<<-1;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
  public static void main(String[] args) {
    Main main = new Main();
    try {
      main.run(args);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }

  private void run(String[] arguments) throws Exception{
    MyScanner sc = new MyScanner();
    PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));

    String s = sc.next();
    char[] letters = s.toCharArray();
    int ans = 999;

    for (int i = 0; i < letters.length-2; i++) {
      char[] targetLetters = Arrays.copyOfRange(letters, i, i+3);
      String string = new String(targetLetters);
      int num = Integer.parseInt(string);
      int absResult = Math.abs(753-num);
      if (absResult<ans){
        ans=absResult;
      }
    }
    out.println(ans);
    out.close();
  }

  /*
   * Form: http://codeforces.com/blog/entry/7018
   */
  private class MyScanner {
    BufferedReader br;
    StringTokenizer st;

    MyScanner() {
      br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
      while (st == null || !st.hasMoreElements()) {
        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());
    }

    String nextLine() {
      String str = "";
      try {
        str = br.readLine();
      } catch (IOException e) {
        e.printStackTrace();
      }
      return str;
    }
  }
}


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

using namespace std;

int main() {
  string input;
  long long buf = 0;
  cin >> input;
  for (char c : input) {
    buf += (int)(c - '0');
  }
  if (buf % 9 == 0) {
    cout << "Yes" << "\n";
  } else {
    cout << "No" << "\n";
  }
}

Measured memory_bytes: 3720
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws NumberFormatException,
			IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));
		StringBuilder builder = new StringBuilder();
		String data;
		while ((data = reader.readLine()) != null) {
			StringTokenizer tokenizer = new StringTokenizer(data);
			StringTokenizer tokenizer2 = new StringTokenizer(reader.readLine());
			int[] nums = new int[4];
			int[] nums2 = new int[4];
			for (int i = 0; i < 4; i++) {
				nums[i] = Integer.parseInt(tokenizer.nextToken());
				nums2[i] = Integer.parseInt(tokenizer2.nextToken());
			}
			int hit = 0;
			int blow = 0;
			for (int i = 0; i < 4; i++) {
				for (int j = 0; j < 4; j++) {
					if (nums[i] == nums2[j])
						if (i == j)
							hit++;
						else
							blow++;
				}
			}
			builder.append(hit).append(' ').append(blow).append('\n');
		}
		System.out.print(builder);
	}
}

Measured memory_bytes: 16868
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

int n;
vector<ll> a, b;

bool isOK(int i){
    return b[(i-1+n)%n]+b[(i+1)%n] < b[i];
}

int main() {
    cin >> n;
    a.resize(n);
    b.resize(n);
    for(int i=0;i<n;i++) cin >> a[i];
    for(int i=0;i<n;i++) cin >> b[i];
    priority_queue<P> que;
    for(int i=0;i<n;i++){
        if(isOK(i)){
            que.push({b[i],i});
        }
    }
    ll ans = 0;
    while(!que.empty()){
        P p = que.top();
        que.pop();
        int id = p.second, l = (id-1+n)%n, r = (id+1)%n;
        ll sum = b[l]+b[r];
        if(b[id]-sum < a[id]) continue;
        ans += (b[id]-a[id])/sum;
        b[id] -= (b[id]-a[id])/sum*sum;
        if(isOK(l)) que.push({b[l],l});
        if(isOK(r)) que.push({b[r],r});
    }
    bool ok = true;
    for(int i=0;i<n;i++) ok &= a[i]==b[i];
    cout << (ok ? ans : -1) << endl;
    return 0;
}


Measured memory_bytes: 5492
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
typedef long long int ll;
using namespace std;

#define MOD 1000000007
ll extgcd(ll a, ll b, ll &x, ll &y) {
  ll g = a; x = 1; y = 0;
  if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x;
  return g;
}
ll gcd(ll a, ll b) { ll x, y; return extgcd(a, b, x, y);}

class llm{
	ll n;
public:
	llm(){n = 0;}
	llm(ll n){this->n = (n >= 0) ? (n % MOD) : (MOD - 1 - (-n-1 % MOD));}
	operator ll() const {return n;}
	llm operator+(const llm &y) const{ return llm((ll)*this + (ll)y);}
	llm operator+=(const llm &y) { *this = *this + y; return *this;}
	llm operator-(const llm &y) const{ return llm((ll)*this - (ll)y);}
	llm operator-=(const llm &y) { *this = *this - y; return *this;}
	llm operator-() const{ return llm(0) - *this;}
	llm operator*(const llm &y) const{ return llm((ll)*this * (ll)y);}
	llm operator*=(const llm &y) { *this = *this * y; return *this;}
	llm operator/(const llm &y) const{ return *this * y.inv();}
	llm operator/=(const llm &y) { *this = *this / y; return *this;}
	llm inv() const{
		ll x, y;
		if (extgcd(n, MOD, x, y) == 1) return llm(x);
  		return llm(0); // unsolvable
	}
	friend istream& operator >> (istream& os, llm& x);
	friend ostream& operator << (ostream& os, const llm& x);
};
istream& operator >> (istream& is, llm& x){ll n; is >> n; x = llm(n); return is;}
ostream& operator << (ostream& os, const llm& x){os << (ll)x; return os;}

template<typename T> T comb(ll n, ll k){
	T ret = 1;
	for(ll i=1;i<=k;i++) ret = ret * T(n - k + i) / T(i);
	return ret;
}
ll n; string s;

class RollingHash{
  /*
    // 事前に class llm の定義が必要． 
  	auto rh = RollingHash("abcdedede");
    assert(rh.hash(3, 5) == rh.hash(5, 7));
  */
public:
  llm base; // 文字コードの最大値より大きいべき．
  string s = "";
  ll n = 0;
  vector<llm> power, invPower, cumsum;
  RollingHash(){}
  RollingHash(string s, llm base){
    this->s = s;
    this->n = s.size();
    this->base = base;
    power = vector<llm>(n);
    power[0] = llm(1);
    for(int i=1;i<n;i++){
      power[i] = power[i-1] * base;
    }
    invPower = vector<llm>(n);
    invPower[0] = llm(1);
    llm invBase = llm(1) / base;
    for(int i=1;i<n;i++){
      invPower[i] = invPower[i-1] * invBase;
    }
    cumsum = vector<llm>(n + 1);
    for(int i=0;i<n;i++){
      cumsum[i+1] = cumsum[i] + power[i] * llm((ll)s[i]);
    }
  }
  llm hash(ll st, ll ed){
    st = min(max(st, 0LL), n-1);
    ed = max(min(ed, (ll)s.size()), st);
    return (cumsum[ed] - cumsum[st]) * invPower[st];
  }
};

RollingHash rh1, rh2;

bool isOK(ll len){
  for(int i=0;i+len<=n;i++){
    for(int j=i+len;j+len<=n;j++){
      if (rh1.hash(i, i+len) == rh1.hash(j, j+len) && rh2.hash(i, i+len) == rh2.hash(j, j+len)) return true;
    }
  }
  return false;
}

ll binarySearch() {
    ll ok = 0;
    ll ng = n / 2 + 1;
    while (llabs(ok - ng) > 1) {
        ll mid = (ok + ng) / 2;
        if (isOK(mid)) ok = mid;
        else ng = mid;
    }
    return ok; // Returns most extreme ok index
}

int main(){
  cin >> n; cin >> s;
  rh1 = RollingHash(s, 256);
  rh2 = RollingHash(s, 257);
  
  cout << binarySearch() << endl;
  
  return 0;
}
  

Measured memory_bytes: 512
list = [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]
K = int(input())
print(list[K-1])

Measured memory_bytes: 3060
from collections import Counter


def main():
    N = int(input())
    S = [input() for _ in range(N)]
    d = Counter(S)
    for status in ['AC', 'WA', 'TLE', 'RE']:
        print('{} x {}'.format(status, d[status]))



if __name__ == '__main__':
    main()

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

int main(void){
    int n;
    int x=0;
    double ans=0.0;
    cin >> n;
    while((n-4*x)>=0){ //y= (1/7)(11-4x)
        ans = (n-4.0*x)/7.0; //※.0
        //cout<< ans;
        x+=1;
        if (floor(ans)== ans){ //整数判定
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
}

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

int main(){
  int A, B, y = 0;
  string x;
  cin >> A >> B;
  while(A <= B){
    x = to_string(A);
    if(x[0] == x[4] && x[1] == x[3]){
      y++;
    }
    A++;
  }
  cout << y << endl;
}


Measured memory_bytes: 3696
#include <iostream>

using namespace std;

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	
	if(a != b && a != c && b != c)
	{
		cout << 3 << endl;
	}
	else if(a == b && b == c)
	{
		cout << 1 << endl;
	}
	else
	{
		cout << 2 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import sys
from math import sqrt
from collections import Counter

input = sys.stdin.readline


def I():
    return int(input())


def MI():
    return map(int, input().split())


def LI():
    return list(MI())


def LIN(n: int):
    return [I() for _ in range(n)]


inf = float("inf")
mod = 10 ** 9 + 7


def main():
    c = input().rstrip()

    if c == "a" or c == "e" or c == "i" or c == "o" or c == "u":
        print("vowel")
    else:
        print("consonant")

    pass


if __name__ == "__main__":
    main()


Measured memory_bytes: 38384
(x,y) = map(int,input().split())
point=0
if x == 1: 
    point = point + 300000
elif x == 2:
    point = point + 200000
elif x == 3:
    point = point + 100000
if y == 1: 
    point = point + 300000
    if x == 1:
        point = point + 400000
elif y == 2:
    point = point + 200000
elif y == 3:
    point = point + 100000
print(point)
    



Measured memory_bytes: 3060
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>

std::string S, T, U;
int A, B;

int main() {
	std::cin >> S;
	for (int i = 0; i < S.length(); i++)
		putchar('x');
	return 0;
}

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

using namespace std;

#define loop(i, n) for(int i = 0;i < int(n);i++)
#define rloop(i, n) for(int i = int(n);i >= 0;i--)
#define range(i, a, b) for(int i = int(a);i <= int(b);i++)
#define SZ(c) int(c.size())
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1, v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1, v2, v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1, v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1, v2, v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'

typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
typedef long long ll;
typedef pair<int, int> pii;


int main() {

#ifndef ONLINE_JUDGE
    //freopen("in.in", "r", stdin);
    //freopen("out.in", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin >> n;
    vi v(n);
    for (int &x : v)cin >> x;
    sort(ALL(v));
    int h = n / 2 - 1;
    cout << v[h + 1] - v[h] << endl;
    return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>

using namespace std;

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

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

const long long INF = 1LL << 60;

int main(void){
  int N;
  cin >> N;
  long long a[N+10][3];
  long long DP[N+10][3];
  
  for(int i = 0; i <= N; i++){
    for(int j = 0; j < 3; j++){
      DP[i][j] = 0;
      if(i == N) continue;
      cin >> a[i][j];
    }
  }
  
  for(int i = 0; i < N; i++){
    for(int j = 0; j < 3; j++){
      for(int k = 0; k < 3; k++){
        if(j == k) continue;
        chmax(DP[i+1][k], DP[i][j] + a[i][k]);
        
      }
    }
    
  }
  
  long long res = 0;
  for(int s = 0; s < 3; s++) chmax(res, DP[N][s]);
  cout << res << endl;
  
    
  return 0;
}



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

int
main()
{
  int a, b;
  cin >> a >> b;
  int n = 0;
  
  if(b == 1)
  { cout << "0" << endl; return 0; }
  else if(b <= a)
  { cout << "1" << endl; return 0; }
  else
  {
    for(int i = 2; ; i++)
    {
      if(i * a - (i -1) >= b)
      { cout << i << endl; return 0; }
    }
  }
 
  return 0;
}

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

const ll MAXN = 200000;
const ll INF = 1001001001;
const ll MOD = 1000000007;

ll N, ans=0, tmp=0;
vector<vector<ll>> A;
string S;

signed main(){
    cin >> S;
    A.resize(26);
    for(int i=0;i<S.size();i++) {
        ll abc = S[i]-'a';
        //cout << abc << endl;
        A[abc].push_back(i);
    }
    for(int i=0;i<26;i++) {
        for(int j=0;j<A[i].size();j++) {
            tmp = S.size()-A[i][j]-A[i].size()+j;
            ans += max(tmp, 0LL);
            //cout << ans << endl;
        }
    }
    cout << ans+1 << endl;
    return 0;
}

Measured memory_bytes: 6528
nums = list(map(int, input().rstrip().split()))

#-----
N = nums[0]
Y = nums[1]

count=[-1,-1,-1]
break_flag=False
for a in range(0,N+1):
    for b in range(0,N+1-a):
        c = N - (a+b)
        total = a*10000 + b*5000 + c*1000
        
        if total == Y:
            count = [a,b,c]
            break_flag=True
            break
            
    if break_flag:
        break

print(" ".join(str(i) for i in count))


Measured memory_bytes: 3064
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, u, v, AB):
    ans = 0
    g = defaultdict(set)
    for a, b in AB:
        g[a].add(b)
        g[b].add(a)


    def f(start):
        s = [(start, 0)]
        d = {}
        d[start] = 0
        while s:
            c, l = s.pop()
            for n in g[c]:
                if n not in d:
                    s.append((n, l+1))
                    d[n] = l+1
        return d

    vd = f(v)
    t = u
    a = v
    s = [(t, 0)]
    d = {}
    d[t] = 0
    while s:
        u, l = s.pop()
        for v in g[u]:
            if v not in d and l + 1 < vd[v]:
                s.append((v, l+1))
                tmp = vd[v] - (l+1)
                tmp = (tmp//2) * 2
                d[v] = tmp + (l+1)

    d[t] = (vd[t] // 2) * 2
    dest = (0, -1)
    for k, v in d.items():
        dest = max(dest, (v, k))

    ans = dest[0]
    # error_print(dest)
    # error_print(d)
    # error_print(vd)
    if vd[dest[1]] == dest[0]:
        ans -= 1
    return ans


def main():
    N, u, v = read_int_n()
    AB = [read_int_n() for _ in range(N-1)]
    print(slv(N, u, v, AB))


if __name__ == '__main__':
    main()


Measured memory_bytes: 119768
#include <bits/stdc++.h>
using namespace std;
int a[2000005];
int main()
{
    int n;cin>>n;
    int k=0;
    int mina=0xfffff;
    for (int i = 0; i < n; ++i) {
        cin>>a[i];
        if(a[i]<=mina) {
            k++;
            mina=a[i];
        }
    }
    cout<<k<<endl;
}

Measured memory_bytes: 1024
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {

    // input
    static int a;
    static int b;
    static int t;

    /**
     * input
     */
    static void input(){
        Scanner sc = new Scanner(System.in);
        a = sc.nextInt();
        b = sc.nextInt();
        t = sc.nextInt();
        sc.close();
    }
 
    /**
     * solver
     */
    static void solve(){
        int ans;

        if (a <= 0) {
            ans = 0;
        } else {
            ans = (int)(Math.floor(t/a)) * b;
        }
        
        System.out.println(ans);
    }

    public static void main(String args[]) {

        input();

        solve();
    }
}


Measured memory_bytes: 21844
fun main(args: Array<String>) {
    val (n,k) = readLine()!!.split(" ").map { it.toDouble() }
    var ans = 0.0
    for (i in 1..n.toInt()) {
        var times = 0.0
        var base = i
        while (base < k) {
            base *= 2
            times += 1.0
        }
        ans += Math.pow(0.5, times) / n
    }
    println(ans)
}


Measured memory_bytes: 35960
#include <iostream>
#include <cmath>
#include <string>
#include <utility>
using namespace std;
typedef long long int ll;

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

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

const ll INF = 1LL << 60;

int main() {
  int H, N, A[10010], B[10010];
  ll dp[10010];
  cin >> H >> N;
  for (int i = 0; i < N; i++) cin >> A[i] >> B[i];
  for (int i = 0; i <= H; i++) dp[i] = INF;
  dp[0] = 0;
  for (int i = 0; i <= H; i++) {
    for (int j = 0; j < N; j++) {
      chmin(dp[i], dp[max(i-A[j], 0)] + B[j]);
    }
  }
  cout << dp[H] << endl;
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>

using namespace std;
typedef long long ll;

struct UnionFind {
  vector<int> par;

  UnionFind(int n) : par(n, -1) { }
  void init(int n) { par.assign(n, -1); }

  int root(int x) {
    if (par[x] < 0) return x;
    else return par[x] = root(par[x]);
  }

  bool issame(int x, int y) {
    return root(x) == root(y);
  }

  bool merge(int x, int y) {
    x = root(x); y = root(y);
    if (x == y) return false;
    if (par[x] > par[y]) swap(x, y);
    par[x] += par[y];
    par[y] = x;
    return true;
  }

  int size(int x) {
    return -par[root(x)];
  }
};

int main() {
  int N,M;
  cin>>N>>M;
  UnionFind uf(N);
  for(int i=0;i<M;i++){
    int x,y,z;
    cin>>x>>y>>z;
    x--;y--;
    uf.merge(x,y);
  }
  int ans=0;
  for(int i=0;i<N;i++){
    if(i==uf.root(i)){
      ans++;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int N; cin >> N;
    vec a(N); cin >> a;

    map<int, int> m;
    REP(i, N) m[a[i]] += 1;

    bool f = false;
    pairs v;
    for(auto p: m) v.pb(p);
    if(SZ(v) == 1){
        if(v[0].f == 0) f = true;
    }else if(SZ(v) == 2){
        if(v[0].f == 0 && v[1].s == v[0].s * 2) f = true;
        if(v[1].f == 0 && v[0].s == v[1].s * 2) f = true;
    }else if(SZ(v) == 3){
        if(((v[0].f ^ v[1].f) == v[2].f) && v[0].s == v[1].s && v[1].s == v[2].s) f = true;
    }
    
    Ans(f, "Yes", "No");

    return 0;
}


Measured memory_bytes: 7924
#include<bits/stdc++.h>
using namespace std;
int f(int a){
	if(a==2) return 1;
	else if ((a==4)||(a==6)||(a==9)||(a==11)) return 2;
	else return 3;
	}
int main(){
	int x;
	int y;
	scanf("%d %d",&x,&y);
	if(f(x)==f(y)){
		printf("Yes");
	}else printf("No");
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
int main() {
	long long S,A=1;
	std::cin >> S;
	for (int i = 1; i <= S; i++){
		A=A*i;
		A=A % 1000000007;
	}
	std::cout << A%1000000007 << std::endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
bool vis[maxn];
int cnt[maxn];

void init() {
    int m = sqrt(maxn);
    vis[0] = vis[1] = 1;
    for(int i = 2; i <= m; ++i) {
        if(vis[i]) continue;
        for(int j = i * i; j <= maxn; j += i) vis[j] = 1;
    }
}

int main(void) {
    std::ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    init();
    for(int i = 3; i < maxn; ++i) {
        if(!vis[i] && !vis[(i + 1) >> 1]) cnt[i]++;
        cnt[i] += cnt[i - 1];
    }
    int n, l, r;
    cin >> n;
    while(n--) {
        cin >> l >> r;
        cout << cnt[r] - cnt[l - 1] << endl;
    }
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                              \
  ifstream in("atcoder-problems/agc019_a.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v)                        \
  rep(l, v.size()) { cout << v[l] << " "; } \
  cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  ll Q, H, S, D;
  int N;
  cin >> Q >> H >> S >> D;
  cin >> N;

  ll Ql = Q * 8;
  ll Hl = H * 4;
  ll Sl = S * 2;
  ll Dl = D;
  vector<pair<ll, ll>> c = {{Ql, 8}, {Hl, 4}, {Sl, 2}, {Dl, 1}};
  sort(c.begin(), c.end());

  ll rest = N;
  ll ans = 0;
  while (rest != 0) {
    for (auto p : c) {
      ll n = rest * p.second / 2;
      if (n > 0) {
        ans += n * (p.first / p.second);
        rest -= n * 2 / p.second;
      }
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <map>
#include <sstream>
#include <utility>
#include <stack>
#include <queue>
#include <stdio.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(vecto) vecto.begin(), vecto.end()
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
using ll = long long;

const int MOD = 1000000007;

template <class T>
T GCD(T a, T b)
{
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}

template <class T>
T LCM(T a, T b)
{
    return (a * b) / GCD(a, b);
}

void ans(bool t_or_f)
{
    if (t_or_f == true)
        std::cout << "Yes" << std::endl;
    else
        std::cout << "No" << std::endl;
}

void Ans(bool t_or_f)
{
    if (t_or_f == true)
        std::cout << "YES" << std::endl;
    else
        std::cout << "NO" << std::endl;
}

using namespace std;

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

int main(){
    int n;
    cin >> n;
    int s[n];
    rep(i, n) cin >> s[i];
    int q, k;
    int sum = 0;
    cin >> q;
    rep(i,q){
        cin >> k;
        bool an = *lower_bound(s,s+n,k)==k;
        if(an)
            sum++;
    }
    cout << sum << endl;
}


Measured memory_bytes: 3460
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll mod = 998244353;
ll dp[301][300 * 300 + 1];
int N, a[301], sum;
ll ans = 1;
int main(){
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> a[i];
        sum += a[i];
        ans *= 3;
        ans %= mod;
    }
    dp[0][0] = 1;
    for(int i = 0; i < N; i++){
        for(int l = 0; l <= sum; l++){
            dp[i + 1][l + a[i]] += dp[i][l];
            dp[i + 1][l + a[i]] %= mod;
            dp[i + 1][l] += dp[i][l] * 2;
            dp[i + 1][l] %= mod;
        }
    }
    for(int l = (sum + 1) / 2; l <= sum; l++){
        ans -= dp[N][l] * 3;
        if(ans < 0) ans += mod;
        ans %= mod;
    }

    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1;
    for(int i = 0; i < N; i++){
        for(int l = 0; l <= sum; l++){
            dp[i + 1][l + a[i]] += dp[i][l];
            dp[i + 1][l + a[i]] %= mod;
            dp[i + 1][l] += dp[i][l];
            dp[i + 1][l] %= mod;
        }
    }
    if((sum & 1) == 0) ans += dp[N][sum / 2] * 3;
    cout << ans % mod << endl;
    return 0;
}

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

int main() {
  int s,s1,s2,s3;
  cin >> s;
  
  s3 = s % 100 % 10;
  s2 = (s % 100 - s3) / 10;
  s1 = (s - s2 * 10 - s3) / 100;
  
  
  cout << s1 + s2 + s3 << endl;
}

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

int main(){
	string str;
	int lenOfStr;
	

	long sum;
	while(1){
		getline(cin, str);
		if(str[0] == '0') break;
		lenOfStr = str.length();
		sum = 0;
		for(int i = 0; i < lenOfStr; i++){
			sum += str[i] - '0';
		}
		cout << sum << endl;
	}
	return 0;
}


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

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

    int n, m;
    cin >> n >> m;
    vector<int> p(m);
    vector<string> s(m);
    for (int i = 0; i < m; i++)
    {
        cin >> p[i] >> s[i];
    }
    unordered_set<int> ac_problem;
    unordered_map<int, int> wa_count;

    for (int i = 0; i < m; i++)
    {
        // ACのとき
        if (s[i] == "AC")
        {
            ac_problem.emplace(p[i]);
        }
        // WAのとき
        else
        {
            // もうこの問題正解してる
            if (ac_problem.count(p[i]) > 0)
                ;
            else
            {
                if (wa_count.count(p[i]) == 0)
                {
                    wa_count[p[i]] = 0;
                }
                wa_count[p[i]]++;
            }
        }
    }

    int ac = ac_problem.size();
    int wa = 0;
    for (auto &&x : ac_problem)
    {
        wa += wa_count[x];
    }
    cout << ac << " " << wa << endl;
}


Measured memory_bytes: 14756
#include "bits/stdc++.h"
using namespace std;

#define all(x) (x).begin(),(x).end()
#define fastio ios_base::sync_with_stdio(false)

typedef double db;
typedef long long ll;
typedef unsigned long long ull;

typedef long double ldb;
typedef pair <int,int> pii;
typedef pair <ll, ll> pll;

int main() {
	fastio;
	string s, t; cin >> s >> t;
	cout << t + s << endl;	
	return 0;
}

Measured memory_bytes: 384
fun main(args: Array<String>) {
    val (n, k) = readLine()!!.split(' ').map { it.toInt() }
    val list = readLine()!!.split(' ').map { it.toInt() }.map { (1 + it) / 2.0 }

    var sum = list.take(k).sum()
    var max = sum
    for (i in 0 until n - k) {
        sum += list[i + k] - list[i]
        if (max < sum) {
            max = sum
        }
    }

    println(max)
}

Measured memory_bytes: 62016
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int n,x;
  cin >> n >> x;
  int m = 1e9;
  rep(i,n){
    int mi;
    cin >> mi;
    x-=mi;
    m = min(m,mi);
  }
  int ans = n+x/m;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int num = 0;
  int i = 0;
  int j = 0;
  int flag = 0;
  scanf("%d",&num);
  for(i = 1;i <= 9;i++)
    for(j = 1;j <= 9;j++){
      if(num == i*j){
        flag = 1;
      }
    }
  
  if(flag){
    printf("Yes");
  }else{
    printf("No");
  }
  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 a,b,sum;

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

             sum = 0;

             if((a == 1 || a == 2) && (b == 1 || b == 2)) {
                               sum  = 3;
                             System.out.println(sum);
                      }  else if ((a == 1 || a == 3) &&( b == 1 || b == 3)) {
                              sum  = 2;
                                  System.out.println(sum);
                    } else {
                              sum  = 1;
                               System.out.println(sum);
                   } 

            
}

}

Measured memory_bytes: 23764