akhauriyash/Code-Regression huggingface dataset:
import sys
import bisect
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

n = int(read())
n_ = 5*10**5

primes = set(range(2, n_+1))
for i in range(2, int(n_**0.5+1)):
    primes.difference_update(range(i*2, n_+1, i))
primes=list(primes)

idx = bisect.bisect_left(primes, n)



print(primes[idx])


Measured memory_bytes: 43488
n = int(input())
p = list(map(int,input().split()))
cnt = 0
for i in range(n-2):
  if (p[i] < p[i+1] and p[i+1] < p[i+2]) or (p[i] > p[i+1] and p[i+1] > p[i+2]):
    cnt += 1
    
print(cnt)

Measured memory_bytes: 3064
#include <stdio.h>
int main(void){
  char s[4];
  int c = 1;
  scanf("%s", s);
  for(int i = 0; i < 3; i++){
      c *= s[i] - 'a' + 1;
  }
  printf("%s\n", (c == 6) ? "Yes" : "No");  
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
typedef pair<int,int> P;
typedef vector<int> Vi;
int const MOD = 1000000007;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { return a = b; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { return a = b; } return false; }

int main(){
  cin.tie(0); ios::sync_with_stdio(false);
    
  string s; cin>>s; int n=s.size(),key=0;Int ans=0;
  for (int i = 0; i < n-2; i++){
    if(s[i]=='A')key++;
    else key=0;
    if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C'){
      ans+=key; key--;
      s[i+1]='C'; s[i+2]='A'; i++;
    }
  }
  cout<<ans<<'\n';
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  string s, t;
  cin >> s >> t;
  int n = s.size();
  rep(i, n) {
    bool ok = true;
    rep(j, n) {
      if (s[(i + j) % n] != t[j]) ok = false;
    }
    if (ok) yes();
  }
  no();
}


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

int main(){
  int D, G;
  cin >> D >> G;
  vector<int> p,c;
  p.resize(D); c.resize(D);
  for (int i = 0; i < D; i++)  cin >> p[i] >> c[i];
  int res = 1000;

  for (int i = 0; i < (1 << D); i++) {
    int sum = 0;   int num = 0;
    for (int j = 0; j < D; j++) {
      if (i & (1 << j))
        sum += c[j] + 100 * (j + 1) * p[j],  num += p[j];
    }
    if (sum >= G) res = min(res, num);
    else {
      for (int j = D-1; j >= 0; j--) {
        if (i & (1<< j)) continue;
        for (int k = 0; k < p[j]; k++) {
          if (sum >= G) break;
          sum += 100 * (j + 1), num++;
        }
      }
    res = min(res, num);
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
int a,b,c;
  cin>>a>>b>>c;
  if(a!=b && a!=c && b!=c){
  cout<<"No";}
  else if(a==b && a!=c){
  cout<<"Yes";}
  else if(b==c && c!=a){
  cout<<"Yes";}
  else if(a==c && b!=c){
  cout<<"Yes";}
  else{
  
  cout<<"No";}
}

Measured memory_bytes: 256
#!python
# -*- coding: utf-8 -*-

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

a = 0
I = []
for b in A + [0]:
    I.append(b - a)
    a = b
S = sum(map(abs, I))

for i in range(N):
    j = i + 1
    n = S - (abs(I[i]) + abs(I[i + 1])) + abs(I[i] + I[i + 1])
    print(n)


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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(long long i=s;i<n;i++)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef long double ld;
typedef vector<ll> vll;
typedef vector<vll> vvll;
const double pi = acos(-1.0);
const ll mod = pow(10,9) + 7;
const ll INF = pow(2,31) - 1;

ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

ll lcm(ll x,ll y)
{
    x /= gcd(x,y);
    y /= gcd(x,y);
    return (x*y);
}

int main()
{
    ll n,ok=1;
    cin >> n;
    rep(i,n){
        ll a;
        cin >> a;
        if(a == ok)ok++;
    }

    if(ok-1 == 0){
        cout << -1 << endl;
        return 0;
    }

    cout << n-ok+1 << endl;

    return 0;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

ll nextLong() { ll x; scanf("%lld", &x); return x;}

struct Trie {
  int ch[26];
  int sz[26];
  int ex;
  Trie() {
    clear();
  }
  void clear() {
    REP(i, 26) ch[i] = -1;
    REP(i, 26) sz[i] = 0;
    ex = 0;
  }
};

const int MAX_N = 112345;
const int MAX_C = 812345;
Trie trie[MAX_C];
int trie_sz = 0;

void add_trie(const int id, const string &s, const int pos) {
  if (pos == (int)s.size()) {
    trie[id].ex = 1;
    return;
  }
  int c = s[pos] - 'a';
  if (trie[id].ch[c] == -1) {
    trie[id].ch[c] = trie_sz++;
  }
  trie[id].sz[c]++;
  add_trie(trie[id].ch[c], s, pos + 1);
}


int prefix[MAX_N];
int comp[MAX_N][26][26];

void ready(const int id, const string& s, const int pos, const int k) {

  if (pos == (int)s.size()) {
    return;
  }


  prefix[k] += trie[id].ex;

  int c = s[pos] - 'a';
  REP(d, 26) if (c != d) {
    comp[k][c][d] += trie[id].sz[d];
  }

  ready(trie[id].ch[c], s, pos + 1, k);
  return;
}


int main2() {

  int N = nextLong();
  CLR(prefix, 0);
  CLR(comp, 0);

  const int root = 0;
  trie_sz++;

  vector<string> S;
  REP(i, N) {
    string s; cin >> s;
    add_trie(root, s, 0);
    S.push_back(s);
  }

  for (int k = 0; k < N; k++) {
    ready(root, S[k], 0, k);
  }

  int Q = nextLong();
  while (Q--) {
    int k = nextLong() - 1;
    string p; cin >> p;

    vector<int> ord(26);
    REP(i, 26) ord[p[i] - 'a'] = i;

    int ans = 1 + prefix[k];
    REP(c, 26) REP(d, 26) if (ord[c] > ord[d]) {
      ans += comp[k][c][d];
    }
    cout << ans << '\n';
  }

  REP(i, trie_sz) trie[i].clear();
  trie_sz = 0;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}

Measured memory_bytes: 472716
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------
ll factorial[201000];
ll invfactorial[201000];
ll extGCD(ll a, ll b, ll &x, ll &y){
	if (b == 0){
		x = 1;
		y = 0;
		return a;
	}
 
	ll d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
ll modpow(ll a, ll b){
    ll res = 1;
    while(b > 0){
        if(b & 1){
            res *= a;
            res %= MOD;
        }
        a *= a;
        a %= MOD;
        b >>= 1;
    }
    return res;
}
int main(void){
    ll n, a, b;
    cin >> n >> a >> b;
 
    factorial[0] = 1;
 
    for (int i = 1; i < 201000; i++){
        factorial[i] = (factorial[i - 1] * i) % MOD;
    }
    for (int i = 0; i < 201000; i++){
        ll x, y;
        ll g = extGCD(factorial[i], MOD, x, y);
        while (x < 0) x += MOD;
        x %= MOD;
        invfactorial[i] = x;
    }

    ll facta = n;
    for(int i = n - 1; i > n - a; i--){
        facta *= i;
        facta %= MOD;
    }
    ll factb = n;
    for(int i = n - 1; i > n - b; i--){
        factb *= i;
        factb %= MOD;
    }
    ll ans = modpow(2LL, n) % MOD - 1;

    ll usea = facta * invfactorial[a];
    usea %= MOD;
    ll useb = factb * invfactorial[b];
    useb %= MOD;
    //cout << usea << " " << useb << endl;
    ans -= (usea + useb) % MOD;
    ans %= MOD;
    if(ans < 0) ans += MOD;
    cout << ans << endl;


}

Measured memory_bytes: 3328
#include <iostream>

using namespace std;

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

    int v = n % 10;

    if (v == 2 || v == 4 || v == 5 || v ==7 || v == 9)
    {
        cout << "hon";
    }
    else if (v == 0 || v == 1 || v == 6 || v == 8)
    {
        cout << "pon";
    }
    else if (v == 3)
    {
        cout << "bon";
    }

    return 0;
}


Measured memory_bytes: 3636
import java.io.*;
import java.util.HashSet;
import java.util.StringTokenizer;


public class Main {

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = sc.nextInt();
        HashSet<Integer> set = new HashSet<>();
        while (n-->0)
        {
            int x = sc.nextInt();
            if(set.contains(x)) {
                System.out.println("NO");
                return;
            }
            set.add(x);
        }
        System.out.println("YES");
        out.flush();
        out.close();
    }


    static class Scanner {

        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream system) {
            br = new BufferedReader(new InputStreamReader(system));
        }

        boolean ready() throws IOException {
            return br.ready();
        }


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

        public String nextLine() throws IOException {
            return br.readLine();
        }

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

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

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

        public Long nextLong() throws IOException {
            return Long.parseLong(next());
        }

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

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


        public Integer[] nextIntegerArray(int n) throws IOException {
            Integer[] a = new Integer[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public double[] nextDoubleArray(int n) throws IOException {
            double[] ans = new double[n];
            for (int i = 0; i < n; i++)
                ans[i] = nextDouble();
            return ans;
        }

        public short nextShort() throws IOException {
            return Short.parseShort(next());
        }

    }

}

Measured memory_bytes: 54628
n = int(input())
s = input()
mod = 10 ** 9 + 7
cnt = [0] * 26  # それぞれの文字に対してfreqを数える
for i in s:
    cnt[ord(i) - 97] += 1
ans = 1
for i in cnt:
    ans *= i + 1
    ans %= mod
print(ans - 1)


Measured memory_bytes: 9196
#include<bits/stdc++.h>
#define g (a%10)
#define s (a/10-q*100-b*10)
#define b (a/100-q*10)
#define q (a/1000)
using namespace std;
int a;
int main(){
	cin>>a;
	printf("%s\n",(g==s&&s==b||s==b&&b==q||g==s&&s==b&&b==q)?"Yes":"No");
	return 0;
}


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

using namespace std;

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

using ll = long long;

const char sp = ' ';
const char cmm = ',';
const int MOD = 1e9+7;
const int INF = 1e9;
const ll LINF = 1e18;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
	int len = v.size();
    cout << '[';
	for (int i = 0; i < len; ++i) {
		s << v[i]; if (i < len-1) s << ", ";
	}
    cout << ']';
	return s;
}

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n, k;
	cin >> n >> k;
	string s;
	cin >> s;
	s += '2';

	vector<ll> a;
	char head = s[0];
	ll num = 1;
	for(int i = 1; i <= n; ++i){
		if(s[i] == head){
			++num;
			continue;
		}
		if(s[i] != head or s[i] == '2'){

			if(head == '0'){
				a.push_back(-num);
			}
			else{
				a.push_back(num);
			}
			head = s[i];
			num = 1;
		}
	}

	ll r = 0;
	ll cnt = 0;
	ll sum = 0;
	ll ans = 0;
	for(int l = 0; l < a.size(); ++l){
		while(r < a.size() and (cnt < k or a[r] >= 0)){
			if(a[r] < 0) ++cnt;
			sum += abs(a[r]);
			++r;
		}

		ans = max(ans, sum);

		if(l == r) ++r;
		else{
			if(a[l] < 0) {
				--cnt;
			}
			sum -= abs(a[l]);
		}
	}
	ppp(ans);
    return 0;
}


Measured memory_bytes: 1528
macro_rules! get {
    (Vec<$t:ty>) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

use std::cmp;

fn main() {
    let N = get!(usize);
    let mut L = get!(Vec<usize>);

    L.sort();
    // 貪欲に、小さい串同士を組み合わせて使えばよい
    let ans = (0..N).map(|i| cmp::min(L[2 * i], L[2 * i + 1])).sum::<usize>();

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

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

using namespace std;

int main(){
  int n;
  cin >> n;
  vector<long long > a(n);

  int ans = 0;
  cin >> a[0];
  a[0]--;
  for(int i =1; i < n; i++){
    cin >> a[i];
    if(a[i]>a[i-1])a[i]--;
    if(a[i]<a[i-1]){
      ans +=1;
    }
  }
  if(ans)cout << "No" << endl;
  else cout << "Yes" << endl;
}



Measured memory_bytes: 1024
#include<iostream>

using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;
    int ans;
    if(a>b){
    	ans=2*a-1;
    }
    else if(b>a){
    	ans=2*b-1;
    }
    else{
    	ans=a+b;
    }
    cout << ans << endl;

    return 0;
}

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

int main() {
    //freopen("input.txt", "r", stdin);
    cin.tie(0);ios::sync_with_stdio(false);
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a+3);
    cout << a[2]*10 + a[1]  + a[0] << endl;
    return 0;
}






Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define wl(n) while(n--)
#define fr(i,a,b) for(i=a;i<b;i++)
#define rev(i,a,b) for(i=b-1;i>=a;i--)

#define mem(a,i) memset(a,i,sizeof(a))
typedef pair<int,int> ii;
#define mp make_pair
#define ll long long
#define MOD 1000000007
#define pb push_back
#define psh push
#define nl printf("\n")
#define fi first
#define sec second

#define si(n) scanf("%d",&n);

#define ss(s) scanf("%s",s)
#define sc(c) scanf("%c",&c)
#define sf(f) scanf("%lf",&f)

#define pi(n) printf("%d\n", n)

#define ps(s) printf("%s\n", s)
#define pc(c) printf("%c\n", c)
#define pf(f) printf("%lf\n", f)
#define INF (1LL<<52)
map<int,string>CharMap;
void num2str()
{
	
	CharMap[0]="0";
	CharMap[1]="1";
	CharMap[2]="2";
	CharMap[3]="3";
	CharMap[4]="4";
	CharMap[5]="5";
	CharMap[6]="6";
	CharMap[7]="7";
	CharMap[8]="8";
	CharMap[9]="9";
}
string to_string(ll n)
{
	string s="";
	while(n>0)
	{
	   int x=n%10;
	   n/=10;
	   s=CharMap[x]+s;	
	}
	return s;
}
ll pow1(ll x,ll y)
{
    if(y==0)
    return 1;
    ll temp= pow1(x,y/2)%MOD;
    if(y%2==0)
    return (temp*temp)%MOD;
    else
    return (((temp*temp)%MOD)*x)%MOD;
}

ll gcd(ll a,ll b)
{
	if(b==0)
		return a;
	return gcd(b,a%b);
}
map<int,int>M;
map<int,int>::iterator it;
int main()
{

	int n,i,a,s=0;
	num2str();
	cin>>n;
	fr(i,0,n)
	{
		cin>>a;
		
		M[a]++;
	}
	int ans = M.size();
	it = M.begin();
	while(it != M.end())
	{
		if(it->second > 1)
			s += it->second-1;
		it++;
	}
	if(s%2 == 0)
		cout<<ans<<endl;
	else
		cout<<ans - 1<<endl;
	return 0;
}



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

int main() {
  int N, M;
  cin >> N >> M;
  int A[50], B[50];
  for (int i = 0; i < M; ++i) cin >> A[i] >> B[i];
  int r[50] = {};

  for (int i = 0; i < M; ++i) { 
    r[A[i] - 1] += 1;
    r[B[i] - 1] += 1;
  }
  for (int i = 0; i < N; ++i) {
    cout << r[i] << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {

  int N;
  scanf("%d", &N);

  int X = N%1000;

  if(X==0){
      printf("0\n");
  }else{
      printf("%d\n", 1000-X);
  }

  return 0;
}

Measured memory_bytes: 3832
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int n,x;
  cin >> n >> x;
  vi l(n),D(n+1,0);
  rep(i,n){
    cin >> l[i];
    D[i+1] = D[i]+l[i];
  }
  int cnt = 0;
  rep(i,n+1){
    if(D[i]>x)break;
    cnt++;
  }
  cout<<cnt<<endl;
  return 0;
}

Measured memory_bytes: 3592
N, M = map(int, input().split())
L = 0
R = N
ans = 0
for i in range(M):
    l, r = map(int, input().split())
    if l > L:
        L = l
    if r < R:
        R = r
for i in range(N):
    flg = 1
    if i+1 < L or i+1 > R:
            flg = 0
    ans += flg
print(ans)

Measured memory_bytes: 45272
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

using pi = pair<int,int>;
using P = pair<pi,int>;

inline int sq(int x){
    return x*x;
}

inline int dist2(pi a, pi b){
    return sq(a.fi-b.fi) + sq(a.se-b.se);
}

inline bool in_circle(pi c, int r, pi p){
    return dist2(p,c) < r*r;
}

inline bool intersect(pi p, int rp, pi q, int rq){
    return dist2(p,q) <= sq(rp+rq);
}

// circle p includes circle q?
inline bool include(pi p, int rp, pi q, int rq){
    if(!in_circle(p,rp,q)) return false;
    return sqrt(dist2(p,q)) + rq < rp;
}

vector<vector<int>> G;
vector<int> l;
vector<bool> vis;

void dfs(int x){
    if(vis[x]) return;

    vis[x] = true;
    for(int e:G[x]) dfs(e);
    l.pb(x);
}

vector<int> calc(const vector<pi> &p, const vector<int> r){
    int n = p.size();

    G = vector<vector<int>>(n);
    rep(i,n)rep(j,n)if(i!=j){
        if(include(p[i],r[i],p[j],r[j])){
            G[j].pb(i);
        }
    }

    l.clear();
    vis = vector<bool>(n);

    rep(i,n) dfs(i);
    reverse(all(l));

    vector<int> dp(n,1);
    for(int i:l){
        for(int j:G[i]){
            dp[j] = max(dp[j],dp[i]+1);
        }
    }

    return dp;
}

int main(){
    int n;
    while(cin >>n,n){
        pi s,t;
        cin >>s.fi >>s.se;
        cin >>t.fi >>t.se;

        vector<pi> ps,pt;
        vector<int> rs,rt;

        rep(i,n){
            pi p;
            int r;

            cin >>p.fi >>p.se >>r;

            if(in_circle(p,r,s) && in_circle(p,r,t)) continue;

            if(in_circle(p,r,s)){
                ps.pb(p);
                rs.pb(r);
            }
            if(in_circle(p,r,t)){
                pt.pb(p);
                rt.pb(r);
            }
        }

        vector<int> dps = calc(ps,rs), dpt = calc(pt,rt);
        int S = dps.size(), T = dpt.size();

        int ans = 0;
        rep(i,S) ans = max(ans, dps[i]);
        rep(i,T) ans = max(ans, dpt[i]);

        rep(i,S)rep(j,T){
            if(!intersect(ps[i],rs[i],pt[j],rt[j])){
                ans = max(ans, dps[i]+dpt[j]);
            }
        }

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



Measured memory_bytes: 5744
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<iomanip>
using namespace std;

int main(){
	int a,b,t;
	cin >> a >> b >> t;
	
	int sum=0;
	for(int i=1;i<=t;i++){
		if(i%a==0){
			sum+=b;
		}
	}
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 256
A, B, C, X, Y = map(int, input().split())

ans = 1e9
for c in range(max(X, Y)+1):
    a = max(X-c, 0)
    b = max(Y-c, 0)
    ans = min((A*a + B*b + 2*C*c), ans)

print(ans)


Measured memory_bytes: 3060
using System;
using System.Linq;

class IDONTKNOWCSHARP
{
    public static void Main()
    {
        Console.WriteLine();
        int num = int.Parse(Console.ReadLine());

        ulong[] values = Convert(GetLines());
        ulong ans = 1;
        bool first = true;

        if (values.Any(x => x == 0))
        {
            Console.WriteLine("0");
            return;
        }
        foreach (ulong value in values)
        {
            if (first)
            {
                ans = value;
                first = false;
                continue;
            }
            try
            {
                checked
                {
                    ans *= value;
                }
            }
            catch
            {

                Console.WriteLine("-1");
                return;
            }

        }
        if (ans > 1000000000000000000)
        {
            Console.WriteLine("-1");
            return;
        }
        // Console.WriteLine("{0:D}", (long)Math.Pow(10, 18));

        Console.WriteLine("{0:d}", ans);
   //     Console.ReadKey();
    }

    static string[] GetLines()
    {
        return Console.ReadLine().Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
    }



    static ulong[] Convert(string[] v)
    {
        var temp = new ulong[v.Length];

        for (int i = 0; i < temp.Length; i++)
        {
            temp[i] = ulong.Parse(v[i]);
        }

        return temp;
    }

}

Measured memory_bytes: 43196
n = int(input())
six = []
for i in range(20):
    six.append(6 ** i)
nine = []
for i in range(20):
    nine.append(9 ** i)

res = 10 ** 10
for i in range(n + 1):
    j = n - i
    k = i
    # print(i,j )
    cnt = 0

    #6
    piv = 19
    while k > 0 and piv >= 0:
        cnt += k // six[piv]
        k %= six[piv]
        piv -= 1

    #9
    piv = 19
    while j > 0 and piv >= 0:
        cnt += j // nine[piv]
        j %= nine[piv]
        piv -= 1

    res = min(res,cnt)
print(res)


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<int, int>
#define debug(x) cout << #x << ": " << x << ", "
#define debugln(x) cout << #x << ": " << x << '\n'

using namespace std;
using ll = long long;

const int mod = 1e9+7;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int N, M;
  cin >> N >> M;

  deque<int> que[N];
  rep(i, N) {
    rep(j, M) {
      int a; cin >> a;
      que[i].push_back(--a);
    }
  }

  int ans = INT_MAX;
  vector<bool> used(M);
  rep(i, M) {
    //debug(i);
    unordered_map<int, int> mp;
    rep(j, N) {
      int a = que[j].at(0);
      mp[a]++;
    }
    int ma = 0;
    int remove = -1;
    for(auto e : mp) {
      if (e.second > ma) {
        ma = e.second;
        remove = e.first;
      }
    }
    ans = min(ans, ma);
    //debugln(remove);
    used.at(remove) = true;
    rep(j, N) {
      while(que[j].size() > 0 && used.at(que[j].at(0))) {
        que[j].pop_front();
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define ri(x) scanf("%d",&(x))
#define ri2(x,y) scanf("%d %d",&(x),&(y))
#define ri3(x,y,z) scanf("%d %d %d",&(x),&(y),&(z))
#define rll(x) scanf("%lld",&(x))
#define rll2(x,y) scanf("%lld %lld",&(x),&(y))
#define rll3(x,y,z) scanf("%lld %lld %lld",&(x),&(y),&(z))
#define gc(x) ((x) = getchar())
using namespace::std;

const long double PI = acos(-1);
const long long MOD = 1000000000 +7;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> tll;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<tll> vtll;
typedef vector<string> vs;
typedef set<int> si;
typedef set<ii> sii;
typedef set<iii> siii;

ll gcd(ll a, ll b){ return b==0?a:gcd(b,a%b);}

ll add(ll a, ll b, ll m = MOD){
	if(a >= m) a %= m;
	if(b >= m) b %= m;
	if(a < 0) a += m;
	if(b < 0) b += m;
	ll res = a+b;
	if(res >= m) res %= m;
	if(res < 0) res += m;
	return (a%m + b%m+2*m)%m;
}

ll mul(ll a, ll b, ll m = MOD){ return ((a%m+m)*(b%m+m))%m;}

ll pow_mod(ll a, ll b, ll m = MOD){
	ll res = 1LL;
	a = a%m;
	while(b){
		if(b&1) res = mul(res,a,m);
		b >>= 1;
		a = mul(a,a,m);
	}
	return res;
}

ll fastexp(ll a, ll b){
	ll res = 1LL;
	while(b){
		if(b&1) res = res*a;
		b >>= 1;
		a *= a;
	}
	return res;
}

int gcdExtendido(int a, int b, int *x, int *y){
	if(a == 0){
		*x = 0;
		*y = 1;
		return b;
	}
	int x1, y1;
	int gcd = gcdExtendido(b%a,a,&x1,&y1);
	
	*x = y1-(b/a)*x1;
	*y = x1;
	return gcd;
}

int modInverso(int a, int m){
	int x, y;
	int g = gcdExtendido(a,m,&x,&y);
	if(g!=1) return -1;
	else return (x%m + m)%m;
}

/****************************************
*************P*L*A*N*T*I*L*L*A************
*****************************************/

const int N = 22;

int n;
int a[N][N];
bool vis[1<<N];
int memo[1<<N];

int DP(int mask){
	int man = n - __builtin_popcount(mask);
	if(mask == 0) return 1;
	if(vis[mask]) return memo[mask];
	int ans = 0;
	for(int nxt = mask; nxt > 0; nxt &= nxt-1){
		int woman = 31 - __builtin_clz(nxt&(-nxt));
		if(a[man][woman]){
			ans = add(ans,DP(mask^(1<<woman)));
		}
	}
	vis[mask] = true;
	return memo[mask] = ans;
}

int main(){
	ri(n);
	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
			ri(a[i][j]);
		}
	}
	printf("%d\n",DP((1<<n)-1));
	return 0;
}


Measured memory_bytes: 14592
def main():
  a,b,c,d = list(map(int,input().split()))
  if b <=c or d <= a:
    print(0)
  elif a<=c and d<=b:
    print(d-c)
  elif c<=a and b<=d:
    print(b-a)
  elif b <d:
    print(b-c)
  else:
    print(d-a)
    
main()

Measured memory_bytes: 9180
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cctype>
#include <stdio.h>
using namespace std;
int main() {
    string s;
    int times, h;
    while(cin >> s){
        if(s == "-") break;
        cin >> times;
        for(int i = 0; i < times; i++){
            cin >> h;
            string right = s.substr(h);
            string left = s.substr(0, h);
            s = right + left;
        }
        cout << s << endl;
    }
     
    return 0;
}


Measured memory_bytes: 3124
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
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; }
const int64_t INF = 1LL << 60;

int main() {
 	string s;
	cin>>s;
    cout<<s.substr(0,3)<<endl;
	
	return 0;
}


Measured memory_bytes: 3624
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<set>
#include<bitset>
#include<map>

#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)

using namespace std;

typedef long long LL;
typedef double db;

int get(){
	char ch;
	while(ch=getchar(),(ch<'0'||ch>'9')&&ch!='-');
	if (ch=='-'){
		int s=0;
		while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
		return -s;
	}
	int s=ch-'0';
	while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
	return s;
}

int main(){
	int n=get(),m=get();
	if (n==1){
		if (m==1)printf("1\n");
		else printf("%d\n",m-2);
		return 0;
	}
	if (m==1)return printf("%d\n",n-2),0;
	printf("%lld\n",1ll*(n-2)*(m-2));
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main() {
  int i;
  char s[100];
  scanf("%s",s);
  int flag = 1;
  char arr[2] = {'L','R'};
  for(i=0; s[i] != '\0'; i++) {
    if(s[i] == arr[ i % 2]) {
      flag = 0;
      break;
    }
  }
  if(flag) {
    puts("Yes");
  } else {
    puts("No");
  }
}


Measured memory_bytes: 128
#include <cstdio>

int main() {
	int A, B, C, X, Y;
	long sum = 0;
	scanf("%d %d %d %d %d", &A, &B, &C, &X, &Y);
	while ((X > 0 || Y > 0) && A + B >= C*2) {
		sum += C*2;
		X--;
		Y--;
		if (!X)
			A = 0;
		if (!Y)
			B = 0;
	}
	while (X > 0) {
		sum += A;
		X--;
	}
	while (Y > 0) {
		sum += B;
		Y--;
	}
	printf("%ld\n", sum);

}


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

int freq[50][300];

int main(){

    int n; cin >> n;
    for(int i = 0; i < n; i++){
        string s; cin >> s;
        for(char c : s)
            freq[i][c]++;
    }
    string res = "";
    for(int j = 'a'; j <= 'z'; j++){
        int cnt = 1e9;
        for(int i = 0; i < n; i++)
            cnt = min(cnt, freq[i][j]);
        for(int i = 0; i < cnt; i++)
            res += char(j);
    }
    cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
if __name__ == '__main__':
    n = int(input())
    max = 0
    count = 0
    for i in range(n):
        b, c = map(int, input().split())
        if b == c:

            count+=1
            if max < count:
                max=count
        else:
            count=0
    if max>2:
        print("Yes")
    else:
        print("No")



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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

typedef long long ll;
typedef pair<int, int> p;

int main(){
  int n;
  cin >> n;
  vector<int> v(n, 0);

  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }

  int res = 0;
  while(true) {
    for (int i = 0; i < n; i++) {
      if(v[i] % 2 == 0) v[i] /= 2;
      else
      {
        cout << res << endl;
        return 0;
      }
    }
    res++;
  }
}


Measured memory_bytes: 256
program main
implicit none
integer :: i, n
character(len=4) :: s

read(*,*) s
n=0
do i = 1, 4
   if ( s(i:i) == '+' ) then
      n = n + 1
   else
      n = n - 1
   end if
end do

write(*,'(i0)') n


end program main


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

vector<vector<P>> to(100005);
vector<int> dist(100005, -1);
void dfs(int v, int d) {
	if (dist[v] != -1) return;
	dist[v] = d;
	for (P x : to[v]) {
		dfs(x.first, d + x.second);
	}
}

int main() {
	int n;
	cin >> n;
	
	rep(i, n - 1) {
		int u, v, w;
		cin >> u >> v >> w;
		u--;
		v--;
		if (w % 2 == 0) w = 2;
		else w = 1;
		
		to[u].push_back(make_pair(v, w));
		to[v].push_back(make_pair(u, w));
	}

	dfs(0, 0);
	rep(i, n) cout << dist[i] % 2 << endl;

}

Measured memory_bytes: 7552
#include<bits/stdc++.h>
#define LL long long
#define dl double
template <class T>
void rd(T &x){
  x=0;T f=1;char ch=getchar();
  while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
  while(ch<='9' && ch>='0')x=x*10+ch-'0',ch=getchar();x*=f;
}

using namespace std;

const int N=2e5+10;

int n,k,a[N];

int main(){
 // freopen("in.txt","r",stdin);
 // freopen("o.txt","w",stdout);
 rd(n);rd(k);for(int i=1;i<=n;i++)rd(a[i]);
 for(int i=k+1;i<=n;i++)if(a[i] > a[i-k])printf("Yes\n");else printf("No\n");
 return 0;
}
/**/

Measured memory_bytes: 4412
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#define MAX_N  1000000
ll a[MAX_N];
ll n;


int main(void){
    cin >> n;

    rep(i, 0, n){
        cin >> a[i];
    }

    ll x = 0, y = 0, z = 0;
    ll sum = 1;
    rep(i, 0, n){
        ll count = 0;
        ll flag = 0;
        if(a[i] == x){
            count++;
            if(flag == 0){
                x++;
                flag = 1;
            }
        }
        if(a[i] == y){
            count++;
            if(flag == 0){
                y++;
                flag = 1;
            }
        }
        if(a[i] == z){
            count++;
            if(flag == 0){
                z++;
                flag = 1;
            }
        }
        sum *= count;
        sum %= 1000000007;
    }

    cout << sum << endl;
    return 0;
}


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

#define MAX 100005
#define NIL -1

class Node{
    public:
    int p,l,r,d;
};

Node T[MAX];
int n;

void print(int u){
    cout << "node " << u << ": ";
    cout << "parent = " << T[u].p << ", ";
    cout << "depth = " << T[u].d << ", ";

    if(T[u].p == NIL) cout << "root, ";
    else if(T[u].l == NIL) cout << "leaf, ";
    else cout << "internal node, ";

    cout << "[";

    int i,c;
    for(i = 0, c = T[u].l;c != NIL;i++, c = T[c].r){
        if(i) cout << ", ";
        cout << c;
    }
    cout << "]" << endl;
}

int rec(int u,int p){
    T[u].d = p;
    if(T[u].r != NIL) rec(T[u].r,p);
    if(T[u].l != NIL) rec(T[u].l,p+1);
}

int main(int argc, char const *argv[])
{
    int v,d,l,r,c;
    cin >> n;

    for(int i = 0;i < n;i++) T[i].p = T[i].l = T[i].r = T[i].d = NIL;

    for(int i = 0;i < n;i++){
        cin >> v >> d;

        for(int j = 0;j < d;j++){
            cin >> c;
            if(j == 0) T[v].l = c;
            else T[l].r = c;
            l = c;
            T[c].p = v;
        }
    }

    for(int i = 0;i < n;i++){
        if(T[i].p == NIL) r = i;
    }

    rec(r,0);

    for(int i = 0;i < n;i++) print(i);

    return 0;
}



Measured memory_bytes: 7708
#include <bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
const int inf=0x3f3f3f3f;
typedef long long ll;

int main()
{
   int h1,m1,h2,m2,k;cin>>h1>>m1>>h2>>m2>>k;
   int t=h2-h1;
   int tt;
   if(m2-m1<0)
   {
		t--;
		tt=60-abs(m1-m2);
   }
   else
	   tt=abs(m1-m2);
   if(t<0) t+=24;
   int H=t*60+tt;
   cout<<H-k<<endl;
   return 0;
}

Measured memory_bytes: 3636
#include <cassert>
#include <cstdio>
#include <cstdlib>

int
main()
{
    int x, y;
    assert(scanf("%d %d", &x, &y) == 2);

    if (x % y == 0) {
        printf("-1\n");
        exit(0);
    }
    printf("%d\n", x);
    exit(0);
}


Measured memory_bytes: 128
import java.util.*;

public class Main {
    public static void  main (String[] args) {
        Scanner sc = new Scanner(System.in);
        
        String str = sc.nextLine();
        
        int[] check = new int[26];
        String str2 = "abcdefghijklmnopqrstuvwxyz";
        for (int i = 0; i < str.length(); i++) {
            char c = str.charAt(i);
            int j = str2.indexOf(c);
            check[j] = 1;
        }
        
        for(int i = 0; i < 26; i++) {
            if (check[i] == 0) {
                System.out.println(str2.charAt(i));
                break;
            }
            if (i == 25) {
                System.out.println("None");
            }
        }
    }
}

Measured memory_bytes: 25240
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String args[]){
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s="", t="";
        try {
            s = br.readLine();
            t = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }

        int count = 0;
        for (int i=0; i<3; i++){
            if (s.charAt(i) == t.charAt(i)){
               count++;
            }
        }

        System.out.println(count);
    }
}


Measured memory_bytes: 22612
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset
typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'
char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
//void IO(){
//	#ifndef ONLINE_JUDGE
//	    freopen("input.txt", "r", stdin);
//	    freopen("output.txt", "w", stdout);
//	#endif
//}
// end of Template

vpii l[200000],r[200000];
int p[200000],n,m;
bool valid,vis[200000];
void bfs(int x){
    queue <int> q;
    q.push(x);
    p[x] = 0;
    while(!q.empty()){
        int cur = q.front();
        q.pop();
        if(!vis[cur]){
            vis[cur] = true;
            for(int i=0;i<r[cur].size();i++){
                int righ,d;
                righ = r[cur][i].fi;
                d = r[cur][i].se;
                if(p[righ]==NULL){
                    p[righ]=p[cur]+d;
                }
                else{
                    if(p[righ]!=p[cur]+d){valid=false;break;}
                }
                q.push(righ);
            }
            for(int i=0;i<l[cur].size();i++){
                int lef,d;
                lef = l[cur][i].fi;
                d = l[cur][i].se;
                if(p[lef]==NULL){
                    p[lef]=p[cur]-d;
                }
                else{
                    if(p[lef]!=p[cur]-d){valid=false;break;}
                }
                q.push(lef);
            }

        }
    }
}
int main(){
	//IO();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n>>m;
    for(int i=1;i<=m;i++){
        int li,ri,d;
        cin>>li>>ri>>d;
        r[li].pb(mp(ri,d));
        l[ri].pb(mp(li,d));
    }
    valid = true;
    for(int i=1;i<=n;i++){
        if(p[i]==NULL){bfs(i);}
        if(!valid)break;
    }
    if(valid)cout<<"Yes\n";
    else cout<<"No\n";

}


Measured memory_bytes: 17792
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define all(a) (a).begin(), (a).end()
typedef long long ll;
#define INF 1e9


typedef pair<int, int> P;

/* 　"assert"    assert(A：条件式)で　Aが真なら処理は続行、偽ならプログラムを終了する　*/

/*　　ラムダ式　　 auto a = [キャプチャ](パラメータ){ 処理 }  */

/* string型　メンバ関数　substr()    replace()  */

int main(){
    int k, s; cin >> k >> s;
    
    
    int ans = 0;
    
    for(int x=0; x<=k; x++){
        for(int y=0; y<=k; y++){
            int z = s - (x+y);
            if(z < 0 || z > k) continue;
            
            ans++;
        }
    }

    cout << ans << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long 
#define pb push_back
#define mp make_pair
#define endl "\n"
#define pii pair<int,int> 
#define ff first
#define ss second
#define N 2005

int INF=1000000;
const int mod=1e9+7;
using namespace std;
int dp[N][N];



void need_for_speed(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}


int32_t main(){
	need_for_speed();
    int n, m, k;
    cin>>n>>m>>k;
    int a[n];
    int b[m];
    for(int i=0;i<n;i++) cin>>a[i];
    for(int i=0;i<m;i++) cin>>b[i];
    
    for(int i=1;i<n;i++) a[i]+=a[i-1];
    for(int i=1;i<m;i++) b[i]+=b[i-1];

    //ek kaam kar ab ek baar ye dekhle ki tu A ki max kitni le skta hai
    
    int ans=0;
    ///abhi pehle ye kar ki agar tu saari a ki le raha hai to kya scene ban raha hai
    int x=lower_bound(a,a+n,k)-a;
    //cout<<x<<endl;
    
    if(x<n and a[x]==k){
        x++;
    }
    ans=max(ans,x);
    //ab ek kaam kar b ki leke dekhle saari ki saari

    int y=lower_bound(b,b+m,k)-b;
    if(y<n and b[y]==k){
        y++;
    }
    ans=max(ans,y);

    //ya to bhai me eb ke karunga ki me le hi nhi raha a ki koi bhi ya to ek leunga aur phir b ki dekhunga kitni le skta hu ese hi karta rahunga


    for(int i=0;i<n;i++){
        int rem=k-a[i];
        if(rem==0){
            ans=max(ans,i+1);
            break;
        }
        if(rem<0){
            ans=max(ans,i);
            break;
        }
        else{
            int y=lower_bound(b,b+m,rem)-b;
            if(y<m and b[y]==rem){
                y++;
            }
            
            ans=max(ans,i+1+y);
        }
    }

    cout<<ans<<endl;;
        
    
    

        
        
    
    return 0;
}
    
 

Measured memory_bytes: 6752
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
typedef long long int64;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
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; }
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int A, B;
	cin >> A >> B;
	rep(i, 10000) {
		if (floor(0.08*i)==A && floor(0.1 * i) == B) {
			cout << i;
			return 0;
		}
	}
	dame;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = input()
b = input()
c = input()

answer = 0

for i in range(n):
    int_w = len(set([a[i], b[i], c[i]]))

    if int_w == 3:
        answer += 2
    elif int_w == 2:
        answer += 1
    else:
        pass


print(answer)


Measured memory_bytes: 3060
object Main extends App {
  val S = io.StdIn.readLine
  val T = io.StdIn.readLine

  var min = Integer.MAX_VALUE
  (0 to (S.length - T.length)).foreach {i => 
    var count = 0
    (0 to T.length - 1).foreach {j =>
      if (S(i + j) != T(j)) {
        count += 1
      }
    }
    min = Math.min(min, count)
  }

  println(min)

}



Measured memory_bytes: 54700