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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int32 n;
  cin >> n;
  set<int32> st;
  REP(i,n){
    int32 a;
    cin >> a;
    if(st.count(a)){
      YES(false);
      return 0;
    }
    st.insert(a);
  }
  YES(true);
  return 0;
}

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

int main(){
  int H, W;
  cin >> H >> W;
  string A, B, C;
  for(int i = 0; i < W + 2; i++){
    A.push_back('#');
  }
  cout << A << endl;
  for(int j = 0; j < H; j++){
    cin >> B;
    cout << "#" << B << "#" << endl;
  }
  cout << A << endl;
}
  

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

#define rep(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define repn(i, m, n) for (int (i) = (m) ; (i) < (int)(n) ; ++(i))
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define repn_rev(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= (m) ; --(i))

#define INF 2e9
#define ll long long
#define MOD 1e9+7

int main(){
    string s;
    cin >> s;
    int n = s.size();

    for(int i=0; i<n; i++){
        if(i%2 == 1){
            if(s[i] == 'L' || s[i] == 'U' || s[i] == 'D'){
            }
            else{
                cout<<"No"<<endl;
                return 0;
            }
        }
        else{
            if(s[i] == 'R' || s[i] == 'U' || s[i] == 'D'){
            }
            else{
                cout<<"No"<<endl;
                return 0;
            }            
        }
    }

    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 256
n = gets.to_i
arr = gets.split.map(&:to_i)
b = []
arr.each_with_index do |ar,i|
  if i.even?
    b.push(ar)
  else
    b.unshift(ar)
  end
end
if arr.size.odd?
  b.reverse!
end
puts b.join(' ')


Measured memory_bytes: 27488
a = [list(map(int, input().split())) for i in range(3)]
n = int(input())
b = list(map(int, [input() for i in range(n)]))

d = a

for k1, i in enumerate(a):
    for k2, j in enumerate(a[k1]):
        if a[k1][k2] in b:
            d[k1][k2]=0
l = 0
for i in range(3):
    if d[i][0] == 0 and d[i][1] == 0 and d[i][2] == 0:
        l += 1
    if d[0][i] == 0 and d[1][i]==0 and d[2][i]==0:
        l += 1
    if d[0][0] == 0 and d[1][1] == 0 and d[2][2] == 0:
        l += 1
    if d[0][2] == 0 and d[1][1] == 0 and d[2][0] == 0:
        l += 1
if l != 0:
    print("Yes")
else:
    print("No")

    

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int n,m,a[100010];
int main(){
	cin>>n>>m>>a[0];
	int pnt=-1;
	for(int i=1;i<n;i++){
		cin>>a[i];
		if(a[i-1]+a[i]>=m)pnt=i;
	}
	if(pnt==-1)cout<<"Impossible"<<endl;
	else{
		cout<<"Possible"<<endl;
	for(int i=1;i<pnt;i++)cout<<i<<endl;
	for(int i=n-1;i>=pnt;i--)cout<<i<<endl;
	}
	return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define ull unsigned long long
#define mem 26
using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin>>s;
  int c=0;
  char t[2] = {'1','0'};
  for(int i=0;s[i];i++) {
    if(s[i]!=t[i&1])
      c++;
  }
  int mc = c;
  t[0] = '0';t[1] = '1';
  c = 0;
  for(int i=0;s[i];i++) {
    if(s[i]!=t[i&1])
      c++;
  }
  mc = min(mc,c);
  cout<<mc;
  cout<<"\n";
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> P;
map <int,int> mp;
vector<int> V;
#define INF (1<<30)
#define INFLL (1ll<<60)
#define EPS (1e-10)
static const int MAX=1e5;
static const int MOD=1e9+7;
static const int NMAX=50;
static const int MMAX=50;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};
int N;
int main(){
    cin.tie(0);  ios::sync_with_stdio(false);
    
    cin>>N;
    int p;
    vector<int> cunt;
    for(int i=1;i<=N;i++){
        cin>>p;
        if(p==i)cunt.push_back(i);
    }
    int ans=cunt.size();
    if(ans==0){
        cout<<ans<<"\n";
        return 0;
    }
    for(int i=0;i<cunt.size()-1;i++){
        if(cunt[i]+1==cunt[i+1]){
            ans--; i++;
        }
    }
    cout<<ans<<"\n";
    return 0;
}


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

typedef long long ll;
typedef unsigned long long int llu;
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define mem(a, v) memset(a, v, sizeof(a))
#define PI acos(-1)
#define S(a) scanf("%d",&a)
#define SL(a) scanf("%lld",&a)
#define S2(a, b) scanf("%d%d",&a,&b)
#define nl printf("\n")
#define deb(x) cout<<#x<<" : "<<x<<endl;
#define deb2(x, y) cout<<#x<<" : "<<x<<" | "<<#y<<" : "<<y<<endl;
#define deb3(x, y, z) cout<<#x<<" : "<<x<<" | "<<#y<<" : "<<y<<" | "<<#z<<" : "<<z<<endl;
#define debv(x) {cout<<#x<<" : "<<endl; for(int ii =0; ii < x.size(); ii++) cout<<x[ii]<<" "; cout<<endl; }
#define debarr(x, xs) {cout<<#x<<" : "<<endl; for(int ii =0; ii < xs; ii++) cout<<x[ii]<<" "; cout<<endl; }
//auto T=clock(); 
//cout<<double(clock()-T)/CLOCKS_PER_SEC<<'\n';
//cout << fixed << setprecision(10) << f(0, 0, 0) << "\n";
const ll mod = 1000000007LL;
const int lmt = 1000005;

vector<int> v;

int main(){
    int n;
    S(n);
    for(int i = 0; i < n; i++) {
        int x;
        S(x);
        v.pb(x);
    }
    sort(v.begin(), v.end());

    int ans = v[n-1] - v[0];

    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 256
//package MSolutions;
import java.io.*;
import java.math.*;
import java.util.*;
public class Main {  
 
	public static void main(String[] args) { 
		FastScanner I = new FastScanner(); //Input
		OutPut O = new OutPut(); //Output
		int N = I.nextInt();
		int lo = 400;
		int ans = 8;
		while (lo<2000) {
			if (N>=lo&&N<lo+200) break;
			lo+=200;
			ans--;
		}
		O.pln(ans);
	}
	public static long ceil(long num, long den) {long ans = num/den; if (num%den!=0) 
	ans++; return ans;}
	public static long GCD(long a, long b) {
		if (a==0||b==0) return Math.max(a,b);
		return GCD(Math.min(a, b),Math.max(a, b)%Math.min(a, b));
	}
	public static long FastExp(long base, long exp, long mod) {
		long ans=1;
		while (exp>0) {
			if (exp%2==1) ans*=base;
			exp/=2;
			base*=base;
			base%=mod;
			ans%=mod;
		}
		return ans;
	}
	public static long ModInv(long num,long mod) {return FastExp(num,mod-2,mod);}
	public static int pop(long x) { //Returns number of bits within a number
		int cnt = 0;
		while (x>0) {
			if (x%2==1) cnt++;
			x/=2;
		}
		return cnt;
	}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());};
		double nextDouble() {return Double.parseDouble(next());}
	}
	static class OutPut{
		PrintWriter w = new PrintWriter(System.out);
		void pln(double x) {w.println(x);w.flush();}
		void pln(boolean x) {w.println(x);w.flush();}
		void pln(int x) {w.println(x);w.flush();}
		void pln(long x) {w.println(x);w.flush();}
		void pln(String x) {w.println(x);w.flush();}
		void pln(char x) {w.println(x);w.flush();}
		void pln(StringBuilder x) {w.println(x);w.flush();}
		void pln(BigInteger x) {w.println(x);w.flush();}
		void p(int x) {w.print(x);w.flush();}
		void p(long x) {w.print(x);w.flush();}
		void p(String x) {w.print(x);w.flush();}
		void p(char x) {w.print(x);w.flush();}
		void p(StringBuilder x) {w.print(x);w.flush();}
		void p(BigInteger x) {w.print(x);w.flush();}
		void p(double x) {w.print(x);w.flush();}
		void p(boolean x) {w.print(x);w.flush();}
	}
}




Measured memory_bytes: 25592
#include <bits/stdc++.h>
 
int main() {
    unsigned long long a, b;
    char s[6];
 
    scanf("%lld%s", &a, s);
    b = (s[0]-'0')*100 + (s[2]-'0')*10 + (s[3]-'0'); 
    printf("%llu\n", a*b/100);
    return 0;//
}

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

int main(){
    int n,m;
    cin>>n>>m;
    vector<bool>A(n+1,false);
    vector<bool>B(n+1,false);
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        if(a==1)A[b]=true;
        if(b==1)A[a]=true;
        if(a==n)B[b]=true;
        if(b==n)B[a]=true;
    }
    //Array A represent where can we reach from position intial
    //Array B represent where can we reach from last position
    //if both are true than we can reach last in 2 voyage
    int f=0;
    for(int i=2;i<=n;i++){
        if(A[i]&&B[i])f=1;
    }
    if(f==1)cout<<"POSSIBLE";
    else cout<<"IMPOSSIBLE";
}


Measured memory_bytes: 256
/* -> Written by <-
   -----------
  |K_A_Z_A_M_A|
  |___________|
  |    _    |
  |   (^_^)   |
  |  /( | )\  |
  |____|_|____|
    H O A N G
*/

#define Task ""
#define F first
#define S second
#define push_back pb
#define bit(x, i) (x >> i) & 1
#define inf 1e9 + 7
#define INF 1e18 + 7

#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <string>
#include <sstream>
#include <cstdio>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <unordered_map>
#include <stack>

using namespace std;

typedef long long ll;

const int MOD = 1e9 + 7;
const int maxn = 1e5 + 5;

int s, t, d;

void Solve()
{
    cin >> d >> t >> s;
    if (t * s >= d)
        cout << "Yes";
    else cout << "No";
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    if(fopen(Task".inp", "r"))
    {
        freopen(Task".inp","r",stdin);
        freopen(Task".out","w",stdout);
    }
    int test_case = 1;
//    cin >> test_case;
    while (test_case --)
        Solve();
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = 1; i <= n; i++)
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); }
using P = pair <int, int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

ll MOD = 1000000007;
ll INF =1<<29;

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

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

int main()
{
    int H, W, K;
    cin>>H>>W>>K;
    vector<string> s(H);
    for (string &t: s)
        cin>>t;

    vector<vector<int>> ans(H, vector<int>(W));
    int c = 0;
    for (int y=0; y<H; y++)
    for (int x=0; x<W; x++)
        if (s[y][x]=='#')
            ans[y][x] = ++c;

    for (int y=0; y<H; y++)
    for (int x=1; x<W; x++)
        if (ans[y][x]==0 && ans[y][x-1]>0)
            ans[y][x] = ans[y][x-1];
    for (int y=0; y<H; y++)
    for (int x=W-2; x>=0; x--)
        if (ans[y][x]==0 && ans[y][x+1]>0)
            ans[y][x] = ans[y][x+1];
    for (int y=1; y<H; y++)
    for (int x=0; x<W; x++)
        if (ans[y][x]==0 && ans[y-1][x]>0)
            ans[y][x] = ans[y-1][x];
    for (int y=H-2; y>=0; y--)
    for (int x=0; x<W; x++)
        if (ans[y][x]==0 && ans[y+1][x]>0)
            ans[y][x] = ans[y+1][x];

    for (int y=0; y<H; y++)
    {
        for (int x=0; x<W; x++)
            cout<<(x==0?"":" ")<<ans[y][x];
        cout<<endl;
    }
}


Measured memory_bytes: 1280
N = int(input())
A = list(map(int, input().split()))

counter = [-1 for _ in range(20)]
ret = 0
prv = 0
for i in range(N):
    ai = A[i]
    diff = prv + 1
    ai_b = format(ai, '020b')
    for j in range(20):
        bit = ai_b[j]
        if bit == '1':
            if counter[j] != -1:
                diff = min(diff, i - counter[j])
            counter[j] = i
    prv = diff
    ret += diff
print(ret)

Measured memory_bytes: 24584
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
constexpr ll mod = 1e9 + 7;
#define endl '\n'


template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char c) {
  return string(1,c);
}

string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (int i = int(N)-1; i >= 0; --i) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef COMPETITIVE_PROGRAMMING_LOCAL
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define dbg(...) if(0){}
#endif

 
int main() {
  ios::sync_with_stdio(0); cin.tie(0);
 
  ll n;
  cin >> n;
  vector<ll> P(n), Q(n);
  for (auto& _a : P) cin >> _a;
  for (auto& _a : Q) cin >> _a;
  vector<ll> A(n);
  iota(A.begin(), A.end(), 1);
  int i = 1, a = -1, b = -1;
  // dbg(P);
  // dbg(Q);
  do {
    if (a==-1 && A==P) {
      a = i;
      // dbg(a);
      if (b != -1) break;
    }
    if (b==-1 && A==Q) {
      b = i;
      // dbg(b);
      if (a != -1) break;
    }
    ++i;
    // dbg(A);
  } while (next_permutation(A.begin(), A.end()));
  cout << abs(a-b) << endl;
}


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

#define int long long
#define double long double
#define ff first
#define ss second
#define endl '\n'
#define ii pair<int, int>
#define mp make_pair
#define mt make_tuple
#define DESYNC                      \
  ios_base::sync_with_stdio(false); \
  cin.tie(0);                       \
  cout.tie(0)
#define pb push_back
#define vi vector<int>
#define vii vector<ii>
#define all(x) x.begin(), x.end()
#define EPS 1e-9
#define INF 1e18
#define ROOT 1
#define M 1000000007
#define curtime chrono::steady_clock::now().time_since_epoch().count
#define rep(i, beg, n, s) for (int i = beg; i < n; i += s)
const double PI = acos(-1);

using namespace std;

inline int mod(int n, int m = M)
{
  int ret = n % m;
  if (ret < 0)
    ret += m;
  return ret;
}

int exp(int n, int k)
{
  if (k == 0)
    return 1;
  if (k == 1)
    return n;
  int ax = exp(n, k / 2);
  ax = mod(ax * ax);
  if (k % 2)
    ax = mod(ax * n);
  return ax;
}

int gcd(int a, int b)
{
  if (a == 0)
    return b;
  else
    return gcd(b % a, a);
}
//#define MULTIPLE_TEST_CASE
void solution()
{
  int n, x, t;
  cin >> n >> x >> t;
  cout << t * ((n + x - 1) / x) << endl;
}

int32_t main()
{
  DESYNC;
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  int t = 1;
#ifdef MULTIPLE_TEST_CASE
  cin >> t;
#endif
  while (t--)
    solution();
}


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

using namespace std;

#define endl "\n"
#define lln long long int
#define IOS ios::sync_with_stdio(0);cin.tie(0);

int main(){
    IOS;
    int x,y,n,d,c=0;
    cin >> n >> d;
    for(int i=0;i<n;i++){
        cin >> x >> y;
        x = abs(x);y = abs(y);
        int dis = ceil(sqrt(pow(y,2) + pow(x,2)));
        if(dis <= d) 
            c++;
    }
    cout << c << endl;
    return 0;
}

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

typedef long long ll;
const ll MOD=1e9+7;

//factorial&inverse factorial
ll fc[200010];
ll ifc[200010];

ll add(ll x, ll y){return (x+y)%MOD;}
ll mlt(ll x, ll y){return (x*y)%MOD;}

ll power(int x, int n){
  ll ans=1;
  while(n>0){
    if(n%2!=0){ans=mlt(ans, x);}
    x=mlt(x,x);
    n/=2;
  }
  return ans;
}

ll inv(ll x){
  return power(x, MOD-2);
}

void fct(){
  fc[0]=1;
  for (int i=0;i<200009;++i){
    fc[i+1]=mlt(fc[i], i+1);
  }
}

void ifct(){
  ifc[200009]=inv(fc[200009]);
  for (int i=200009;i>=1;--i){
    ifc[i-1]=mlt(ifc[i], i);
  }
}

ll comb(int n, int k){
  if(n<0||k<0|| k>n)return 0;
  return mlt(fc[n], mlt(ifc[k], ifc[n-k]));
}

int main(){
  int N, A, B, C, D;cin>>N>>A>>B>>C>>D;

  ll dp[1010][1010]={};
  dp[N][B+1]=1;
  fct();ifct();

  for (int j=B;j>=A;--j){
    for (int i=0;i<=N;++i){
      dp[i][j]=dp[i][j+1];
      ll factor=1;
      for (int k=0;k++<C-1;){
        factor=mlt(factor, comb(i+k*j, j));
      }

      for (int k=C;k<=D;++k){
        if(i+k*j>N) break;
        factor=mlt(factor, comb(i+k*j, j));
        dp[i][j]=add(dp[i][j], mlt(dp[i+k*j][j+1], mlt(factor, ifc[k])));
      }
    }
  }

  cout << dp[0][A]<< endl;
  return 0;
}


Measured memory_bytes: 11392
import java.io.*;
import java.util.StringTokenizer;

import static java.lang.Math.*;

public class Main {
  public static void main(String[] args) {
    new Main().solve();
  }

  private void solve() {
    try(InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out)) {

      final int n = in.nextInt();
      final int x = in.nextInt();

      int[] dp = new int[n+1];
      int cnt = 1;
      for (int i = 0; i < n; i++) {
        dp[i+1] = dp[i] + in.nextInt();
        if(dp[i+1] <= x) cnt++;
      }

      out.println(cnt);
    }
    catch(IOException e) {
      System.err.println(e);
    }
  }

  int atoi(String s) { return Integer.parseInt(s); }
  long atol(String s) { return Long.parseLong(s); }

  static class InputReader implements AutoCloseable {
    public BufferedReader br;
    public StringTokenizer st;

    public InputReader(InputStream stream) {
      br = new BufferedReader(new InputStreamReader(stream), 32768);
      st = null;
    }
    public String next() {
      if (st == null || !st.hasMoreTokens()) {
        try { st = new StringTokenizer(br.readLine());
        } catch (IOException e) {
          throw new UncheckedIOException(e);
        }
      }
      return st.nextToken();
    }
    public int nextInt() { return Integer.parseInt(next()); }
    public long nextLong() { return Long.parseLong(next()); }
    int[] mapInt(int len) {
      int[] ret = new int[len];
      for (int i = 0; i < len; i++) ret[i] = Integer.parseInt(next());
      return ret;
    }
    long[] mapLong(int len) {
      long[] ret = new long[len];
      for (int i = 0; i < len; i++) ret[i] = Long.parseLong(next());
      return ret;
    }
    @Override public void close() throws IOException { br.close(); }
  }
}

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

int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		int cnt = 0;
		for (char c = 'a'; c <= 'z'; c++) {
			bool left = false, right = false;
			for (int j = 0; j < i; j++) {
				if (s[j] == c)left = true;
			}
			for (int j = i; j < n; j++) {
				if (s[j] == c)right = true;
			}
			if (left&&right)cnt++;
		}
		if (ans < cnt)ans = cnt;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define mp make_pair
using namespace std;

ll dist[int(1e5)+2];
void dfs(vector<ar<ll,2>> *v, int parent,int vertex, ll c)
{
	dist[vertex] = c;
	for(auto it:v[vertex])
		if(it[0]!=parent)
			dfs(v,vertex,it[0],dist[vertex]+it[1]);
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	memset(dist,0x3f, sizeof(dist));
	int n;
	cin>>n;
	vector<ar<ll,2> > v[n];
	for(int i = 0,j,k,c; i<n-1; i++)
	{
		cin>>j>>k>>c, --j, --k;
		v[j].push_back({k,c});
		v[k].push_back({j,c});
	}
	int q,k;
	cin>>q>>k, --k;
	dist[k] = 0;
	dfs(v,-1,k,0);
	while(q--)
	{
		int x,y;
		cin>>x>>y, --x, --y;
		cout<<dist[x]+dist[y]<<endl;
	}
	return 0;
}

Measured memory_bytes: 15872
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <map>
#include <queue>
 
using namespace std;

long long gcd(long long x,long long y)
{
	return y==0 ? x : gcd(y,x%y);
}

int main()
{

	vector<long> prime;
	long num=6;
	for(long i=0;num<=300000;i++){
		bool ok=true;
		for(int j=0;j<prime.size()&&prime[j]*prime[j]<=num && ok;j++){
			if(num%prime[j]==0) ok=false;
		}
		if(ok) prime.push_back(num);
	
		if(i%2==0) num+=2;
		else num+=5;
	}


	long n;
	while(cin>>n,n!=1){
		cout<<n<<":";
		for(int i=0;i<prime.size();i++)
			if(n%prime[i]==0) cout<<" "<<prime[i];
		cout<<endl;
	}

	return 0;
}

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

using namespace std;

#define ff first
#define ss second

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;

const int MOD = 1e9 + 7;
const ll INF = 1e18;
const double EPS = 1e-6;
const int MAX_N = 105;
const int MAX_K = 1e5 + 5;

int N, K;
int A[MAX_N];
bool dp[MAX_K];

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin >> N >> K;
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
	}	

	dp[0] = false;
	for (int i = 1; i <= K; ++i) {
		for (int j = 0; j < N; ++j) {
			if (i - A[j] >= 0) dp[i] |= !dp[i - A[j]];
		}
	}

	if (dp[K]) cout << "First\n";
	else cout << "Second\n";

	return 0;
}

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

int main(){
	int n,i;
	cin >> n;
	vector<int> h(n);
	
	for(i=0;i<n;i++){
		cin >> h[i];
	}
	
	for (i=0;i<n;i++){
		cout << "node " << i+1 <<": key = " << h[i] <<", ";
		if(i!=0){
			cout << "parent key = " << h[((i+1)/2)-1] <<", ";
		}
		if((2*(i+1))-1<n){
			cout << "left key = " << h[2*(i+1)-1] <<", ";
		}
		if((2*(i+1))<n){
			cout << "right key = " << h[2*(i+1)] <<", ";
		}
		cout << endl;
	}
}

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

int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> hyo(H, vector<char>(W));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> hyo.at(i).at(j);
    }
  }
  int count = 0;
  for (int i = 0; i < W; i++) {
    bool tate_check =  true;
    for (int j = 0; j < H; j++) {
      if (hyo.at(j).at(i - count) != '.') {
        tate_check = false;
        break;
      }
    }
    if(tate_check == true){
      for (int k = 0; k < H; k++){
        for (int l = i - count; l < W - 1; l++){
          hyo.at(k).at(l) = hyo.at(k).at(l + 1); 
        }
      }
      count++;
    }
  }
  for (int i = 0; i < H; i++) {
    bool yoko_check =  false;
    for (int j = 0; j < W; j++) {
      if (hyo.at(i).at(j) != '.') {
        yoko_check = true;
        break;
      }
    }
    if (yoko_check == true){
      for (int j = 0; j < W - count; j++){
        cout << hyo.at(i).at(j);
      }
      cout << endl;
    }
  }
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 100100100100;


ll combination(ll n, ll r){
    if(n < r) return 0;
    if(r == 0||r == n) return 1;
    else if(r == 1) return n;
    return (combination(n - 1, r - 1) + combination(n - 1, r));
}

bool checkKaibun(string str){
    string checkStr = str;
    reverse(checkStr.begin(), checkStr.end());
    if(str == checkStr) return true;
    else return false;
}

int keta(ll num){
    int digits = 0;
    while(num > 0){
        num /= 10;
        digits++;
    }
    return digits;
}


int main(){
    int A,B;
    cin >> A >> B;
    cout << (A + B) % 24 << endl;
}

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

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define FORr(i, j, k) for(int i = j; i >= k; --i)
#define repr(i, j) FOR(i, j, 0)
#define INF (1 << 30)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> Pi;

const int MOD = 1e9 + 7;
const int dy[]={0, 0, 1, -1};
const int dx[]={1, -1, 0, 0};

template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

int a[10000];
int c[100][100];
int tmp[100];

int main() {
	int H, W, N;
	scanf("%d %d %d", &H, &W, &N);
	rep(i, N) scanf("%d", &a[i]);
	int now = 0;
	rep(i, H) {
		if(i % 2 == 0) {
			rep(j, W) {
				printf("%d", now + 1);
				--a[now];
				if(a[now] == 0) ++now;
				if(j != W - 1) printf(" ");
			}
		}
		else {
			rep(j, W) {
				tmp[j] = now + 1;
				--a[now];
				if(a[now] == 0) ++now;
			}
			reverse(tmp, tmp + W);
			rep(j, W){
				printf("%d", tmp[j]);
				if(j != W - 1) printf(" ");
			}
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,M=0,W=0;cin>>N;int A[N];
  for(int i=0;i<N;i++){
    cin>>A[i];
    if(A[M]<A[i])M=i;
  }
  if(M==0)W++;
  for(int i=0;i<N;i++){
    if(i!=M&&A[i]>A[W])W=i;
  }
  for(int i=0;i<N;i++){
    if(i==M)cout<<A[W]<<endl;
    else cout<<A[M]<<endl;
  }
}

Measured memory_bytes: 2432
from bisect import bisect
s = list(input())
t = list(input())
lenT = len(t)
lenS = len(s)
alp = []

for i in range(26):
  array = []
  now = chr(ord('a') + i)
  for j in range(lenS):
    if s[j] == now:
      array.append(j+1)
  alp.append(array)

count,now = 0,0

for i in range(lenT):
  j = ord(t[i])-ord('a')
  if alp[j]:
    next = bisect(alp[j],now)
    if next == len(alp[j]):
      count += 1
      now = alp[j][0]
    else:
      now = alp[j][next]
  else:
    print(-1)
    exit()

ans = count*lenS+now

print(ans)

Measured memory_bytes: 87152
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <limits.h>
#include <cinttypes>
#include <string.h>
#include <bits/stdc++.h>

#define countof(a) (sizeof(a)/sizeof(*a))

#define vi vector<int>
#define vvi vector<vector<int> >
#define pi pair<int,int>
#define fi first
#define se second

#define FOR(var, to)          for (register s64 var = 0; var < (s64)to; var++)
#define FROMTO(var, from, to) for (register s64 var = from; var <= (s64)to; var++)

#define INIT(var) FOR(i,countof(var)) var[i] = 0
#define INPUT(var) FOR(i,countof(var)) var[i] = ri()

#define SORT(v) qsort(v,countof(v),sizeof(*v),int_less)
#define SORTT(v) qsort(v,countof(v),sizeof(*v),int_greater)

#define MOD 1000000007
#define INF (1 << 30)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

using namespace std;

static inline int ri() {
  int a;
  scanf("%d", &a);
  return a;
}

static inline s64 rs64() {
  s64 a;
  scanf("%" SCNd64, &a);
  return a;
}

static inline void wi(int a) {
  printf("%d", a);
}

static inline void wu64(u64 a) {
  printf("%" PRIu64, a);
}

static inline void ws64(s64 a) {
  printf("%" PRId64, a);
}

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

int main() {
    int n = ri();
    int a[n];
    INPUT(a);
    SORTT(a);
    int aa = 0;
    int bb = 0;
    FOR(i,n) {
        if (i%2) bb += a[i];
        else aa += a[i];
    }
    cout << aa-bb << endl;
 return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int arr[51][26];

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        string s;
        cin>>s;
        for(int j=0;j<s.length();j++){
            char c=s[j];
            int k=c-'a';
            arr[i][k]+=1;
        }
    }
    for(int j=0;j<26;j++){
        int count=51;
        for(int i=0;i<n;i++){
            if(arr[i][j]<count)
                count=arr[i][j];
        }
        for(int i=0;i<count;i++){
            char c='a'+j;
            cout<<c;
        }
    }
    cout<<endl;
    return 0;
}


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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    ll n,k; cin >> n >> k;
    set<int> s;
    rep(i,k){
        int d;cin>>d;
        rep(j,d){
            int a;cin >> a;
            s.insert(a);
        }
    }
    out(n-s.size());
}


Measured memory_bytes: 3652
//Chandigarh University
//author:- shivamkr21 (pseduo coders)
#include<bits/stdc++.h>
#define lli long long int
#define endl "\n"
#define mod 1000000007
using namespace std;
int main()
{
	lli n,m;
	cin>>n>>m;
	lli ar[2][n+1];
	memset(ar[0],-1,sizeof(ar[0]));
	memset(ar[1], 0,sizeof(ar[1]));

	lli p,cor=0,def=0;
	string s;
	for(lli i=0;i<m;i++)
	{
		cin>>p>>s;
		if(s=="WA")
		{
			if(ar[0][p]==-1 || ar[0][p]==0)
			{
				ar[0][p]=0;
				ar[1][p]++;
			}
		}
		else if(s=="AC")
		{
			ar[0][p]=1;
		}
	}
	for(lli i=1;i<=n;i++)
	{
		if(ar[0][i]==1)
		{
			cor++;
			def=def+ar[1][i];
		}
		
	}
	cout<<cor%mod<<" "<<def%mod;
	return 0;
}


Measured memory_bytes: 1792
import Data.List

f a [] = a
f a ([_,x,y]:ls) = if a == x
                   then y
                   else if a == y
                        then x
                        else f a ls

ans a [] = a
ans a l =
  let h = head $ head l
      b = f a $ filter (\e -> h == (e!!0)) l
      r = filter (\e -> h /= (e!!0)) l
  in
    ans b r

ans' ([0,0,0]:_) = []
ans' ([n,m,a]:ls) =
  let d = sortBy (\a b -> compare (head b) (head a)) $ take m ls
      r = drop m ls
  in
    (ans a d):(ans' r)

main = do
  c <- getContents
  let i = map (map read) $ map words $ lines c :: [[Int]]
      o = ans' i
  mapM_ print o



Measured memory_bytes: 25632
import numpy as np
n = int(input())
a = np.array([i for i in input().split()]).astype('int64')

for i in range(n-1):
    if a[i] < 0:
        a[i] = -a[i]
        a[i+1] = -a[i+1]
if a[n-1] < 0 :
    i = a[:n-1].argmin()
    if a[i] < -a[n-1]:
        a[i] = -a[i]
        a[n-1] = -a[n-1]
print(np.sum(a))

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

int main()
{
    int N, D;
    cin >> N >> D;
    vector<vector<int>> X(N, vector<int>(D));
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < D; j++)
        {
            cin >> X[i][j];
        }
    }
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        for (int j = i+1; j < N; j++)
        {
            int norm = 0;
            for (int k = 0; k < D; k++)
            {
                int diff = abs(X[i][k] - X[j][k]);
                norm += diff * diff;
            }
            bool flag = false;
            for (int k = 0; k <= norm; k++)
            {
                if (k * k == norm)
                {
                    flag = true;
                }
            }
            if (flag)
                ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n,k = map(int,input().split())
x = [0]*n
for i in range(k):
    a=int(input())
    li = list(map(int,input().split()))
    for j in li:
        x[j-1]+=1
cnt=0
for i in x:
    if i == 0:
        cnt+=1
print(cnt)

Measured memory_bytes: 9196
#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <vector>
#include <tuple>
#include <queue>
#include <stack>
#include <set>
#include <map>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
typedef long long ll;

int N,M,H,W,K,A,B;
string S;
string alpha = "abcdefghijklmnopqrstuvwxyz";
const int mod = 1000000007;


int main() {
    cin>>N>>S;
    ll ans = 1;
    vector<int> vec(26,0);
    rep(i,N) {
        rep(j,26){
            if(S.at(i) == alpha.at(j)) {
                vec.at(j)++; 
                break;
            }
        }
    }

    rep(i,26) {
        ans *= vec.at(i)+1;
        ans = (ans + mod) % mod;
    }
    ans--;
    cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#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 h, w, in;
    cin >> h >> w;
    vector<vector<int>> a(0, vector<int>(2));
    vector<vector<int>> map(h, vector<int>(w));
    int sum2 = 0;
    rep(i, h){
        rep(j, w){
            cin >> map.at(i).at(j);
            if(map.at(i).at(j)%2 == 1) sum2++;
        }
    }
    int sum = 0;
    int p = 0;
    rep(i, h){
        if(i%2 == 0){
            for(int j=0; j<w; j++){
                if(map.at(i).at(j)%2 == 1){
                    p++;
                }
                if(p%2 == 1 && p != sum2){
                    sum++;
                }
            }
        }else{
            for(int j=w-1; j>=0; j--){
                if(map.at(i).at(j)%2 == 1){
                    p++;
                }
                if(p%2 == 1 && p != sum2){
                    sum++;
                }
            }
        }
    }
    cout << sum << endl;
    int cou = 0;
    int p0 = 0;
    rep(i, h){
        if(i%2 == 0){
            for(int j=0; j<w; j++){
                if(map.at(i).at(j)%2 == 1){
                    p0++;
                }
                if(p0%2 == 1 && p0 != p){
                    if(j != w-1){
                        cout << i+1 << ' ' << j+1 << ' ' << i+1 << ' ' << j+1+1 << endl;
                    }else{
                        cout << i+1 << ' ' << j+1 << ' ' << i+1+1 << ' ' << j+1 << endl;
                    }
                }
            }
        }else{
            for(int j=w-1; j>=0; j--){
                if(map.at(i).at(j)%2 == 1){
                    p0++;
                }
                if(p0%2 == 1 && p0 != p){
                    if(j != 0){
                        cout << i+1 << ' ' << j+1 << ' ' << i+1 << ' ' << j-1+1 << endl;
                    }else{
                        cout << i+1 << ' ' << j+1 << ' ' << i+1+1 << ' ' << j+1 << endl;
                    }
                }
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3072
#include<stdio.h>
#include<stdlib.h>

int main()
{
  int i,j,c,a,b;;
  char number[100];

  i = 0;
  while((c = getchar()) != EOF) {
    if(c == ' ') {
      a = atoi(number);
      for(j = 0; j < i; j++) {
	number[j] = '\0';
      }
      i = 0;
    }
    number[i] = c;
    i++;
  }
  b = atoi(number);

  printf("%d %d\n", a * b, 2 * (a + b));

  return 0;
}

Measured memory_bytes: 524
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int n;
  cin >> n;
  for (int i = 0, t = 1;; i++, t *= 3) {
    if (t >= n) {
      cout << i << endl;
      return;
    }
  }
}

Measured memory_bytes: 3092
using System;

class Program
{
    static void Main(string[] args)
    {
        var ab = Console.ReadLine().Split(' ');
        var a = int.Parse(ab[0]);
        var b = int.Parse(ab[1]);

        var s = Console.ReadLine();
        for (int i = 0; i <= a + b; i++)
        {
            if (i == a)
            {
                if (s[i] != '-')
                {
                    Console.WriteLine("No");
                    return;
                }
            }
            else
            {
                if ('0' > s[i] || s[i] > '9')
                {
                    Console.WriteLine("No");
                    return;
                }
            }
        }

        Console.WriteLine("Yes");
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;
 
int a, b, c;
 
int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> a >> b >> c;
	cout << (c-b == b-a ? "YES" : "NO") << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

def main(): 
    s = SI()
    from  collections import Counter
    co = Counter(s)
    if len(co) == 2:
        for i in co:
            if co[i] != 2:
                print('No')
                return
            print('Yes')
            return
    else:
        print('No')
        return
main()

Measured memory_bytes: 3316
#include <cmath>
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
//Constant
const int N=2000;
const int M=N-1;
const int E=M*2;
//Quick Read
int Read(){
	int x=0;
	bool neg=false;
	char c=getchar();
	while(isdigit(c)==false)neg^=c=='-',c=getchar();
	while(isdigit(c)==true)x=x*10+c-'0',c=getchar();
	return neg==true?-x:x;
}
inline void Read(int &x){x=Read();}
//Edge Directory
struct Edge_Directory{
	int len,head[N+1],to[E+1],next[E+1];
	inline void Insert(int x,int y){to[++len]=y,next[len]=head[x],head[x]=len;}
}ed;
//DFS
int dis[N+1];
bool del[N+1];
int limit,num;
void DFS(int x,int fa){
	if(dis[x]>limit)++num;
	for(int e=ed.head[x];e!=0;e=ed.next[e])
		if(ed.to[e]!=fa)dis[ed.to[e]]=dis[x]+1,DFS(ed.to[e],x);
}
//Main
int xx[N+1],yy[N+1];
int main(){
	// freopen("AGC001C.in","r",stdin);
	// freopen("AGC001C.out","w",stdout);
	int n=Read(),k=Read();
	for(int i=1;i<n;++i)Read(xx[i]),Read(yy[i]),ed.Insert(xx[i],yy[i]),ed.Insert(yy[i],xx[i]);
	limit=k/2;
	int ans=INT_MAX;
	if(k%2==0)for(int i=1;i<=n;++i)num=0,dis[i]=0,DFS(i,0),ans=std::min(ans,num);
	else for(int i=1;i<n;++i)
	num=0,dis[xx[i]]=dis[yy[i]]=0,DFS(xx[i],yy[i]),DFS(yy[i],xx[i]),ans=std::min(ans,num);
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int f[100000];
int cx[100][100][100];
int main()
{
    int L,R,d,n;
    cin>>L>>R>>d;
    n=0;
    for(int i=L; i<=R; i++)
        if(i%d==0)
            n++;
    printf("%d\n",n);
}


Measured memory_bytes: 3652
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
#from fractions import gcd
#from itertools import combinations # (string,3) 3回
#from collections import deque
#from collections import defaultdict
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
e = n//11
cnt = e*2
amari = n - 11 * e
if 6 < amari:
    cnt += 2
elif 0 < amari:
    cnt += 1
print(cnt)


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

using namespace std;

int n, MOD, a[100][100], ans[5000000], m, b[5000000];

int getbit(int x, int j){
    return (x >> j) & 1;
}

int changebit(int x, int j){
    return x ^ (1 << j);
}

int main() {
    MOD = 1e9 + 7;
    cin >> n;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= n; j++)
            cin >> a[i][j];
    m = (1 << n);
    for (int i = 1; i < m; i++)
        for (int j = 0; j <= 21; j++)
            if (getbit(i, j) == 1){
                b[i]++;
            }
    ans[0] = 1;
    for (int i = 1; i < m; i++){
        for (int j = 0; j <= 21; j++){
            if (getbit(i, j) == 1 && a[b[i]][j + 1] == 1){
                int x = changebit(i, j);
                ans[i] = (ans[i] + ans[x]) % MOD;
            }
        }
    }
    cout << ans[m - 1];
}

Measured memory_bytes: 20736
#include<iostream>
 
using namespace std;
 
int main(){
  string s;
  cin>>s;
  cin.ignore();
  
  if(s[2]==s[3] && s[4]==s[5]){
    cout<<"Yes"<<endl;
  }
  else{cout<<"No"<<endl;}
  
  return 0;
}

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

int n;

int main()
{
  cin >> n;
  long long ans = 0;
  //for(int i=1; i<=20; i++) cout << uoc_so(i) << '\n';
  for(int a=1; a < n; a++)
  {
    int b = (n-1)/a;
    ans += b;
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 3644
N, X, Y = map(int,input().split())
k_list = [0]*N

for p in range(1, N):
    for q in range(p, N+1):
        p2X = abs(p - X)
        p2Y = abs(p - Y)
        q2X = abs(q - X)
        q2Y = abs(q - Y)

        distance = min(q-p, p2X+1+q2Y)
        k_list[distance] += 1

for k in range(1, N):
    print(k_list[k])

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

using namespace std;

int main() {
	int n;
	cin >> n;
	auto r = 0.;
	for (int i = 0; i < n; i++) {
		double x;
		string u;
		cin >> x >> u;
		r += x * (u[0] == 'B' ? 38e4 : 1);
	}
	cout << r << endl;
	return 0;
}


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

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

	vector<int> count(10001);

	for (int x=1;x<=100;++x)
	{
		for (int y=1;y<=100;++y)
		{
			for (int z=1;z<=100;++z)
			{
				int index=x*x+y*y+z*z+x*y+y*z+z*x;
				if (index<=10000)
				{
					++count[index];
				}
			}
		}
	}

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

}







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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
    ost<<"{"<<p.first<<","<<p.second<<"}";
    return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
    ost<<"{";
    for(int i=0;i<v.size();i++){
        if(i)ost<<",";
        ost<<v[i];
    }
    ost<<"}";
    return ost;
}

inline int topbit(unsigned long long x){
    return x?63-__builtin_clzll(x):-1;
}

inline int popcount(unsigned long long x){
    return __builtin_popcountll(x);
}

inline int parity(unsigned long long x){
    return __builtin_parity(x);
}

signed main(){
	int A;
	string s;
	cin>>A>>s;
	s=s.substr(0,1)+s.substr(2,2);
	int b=stoi(s);

	cout<<A*b/100<<endl;
    return 0;
}


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

int main(int argc, char const *argv[])
{
    stack<int> S1;
    stack< pair<int, int> > S2;
    char ch;
    int sum = 0;

    for (int i=0; cin >> ch; i++) {
        if (ch == '\\') {
            S1.push(i);
        }
        else if (ch == '/' && S1.size() > 0) {
            int j = S1.top(); S1.pop();
            sum += i - j;
            int a = i - j;
            while (S2.size() > 0 && S2.top().first > j) {
                a += S2.top().second; 
                S2.pop();
            }
            S2.push(make_pair(j, a)); 
        }
    }


    vector<int> ans;

    while (S2.size() > 0) {
        ans.push_back(S2.top().second);
        S2.pop();
    }


    cout << sum << endl;

    cout << ans.size();

    for (int i=ans.size()-1; i>=0; i--) {
        cout << " " << ans[i];
    }
    cout << endl;

    return 0;
}



Measured memory_bytes: 3240