akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
//#include <stdlib.h>
//#include <math.h>

struct Node_struct{
  int p;
  int l;
  int r;
  long int key;
};
typedef struct Node_struct Node;
Node T[500];

int main(){
  int n,i,c;
  long int a[500];
  for(i=0;i<500;i++)
    a[i] = 0;

  scanf("%d",&n);

  for(i=0;i<n;i++)
    scanf("%ld",&a[i]);

  for(i=0;i<n;i++){
    printf("node %d: key = %ld, ",i+1 ,a[i]);
    if((i+1)/2>=1){
      c = (i+1)/2;
      printf("parent key = %ld, ",a[c-1]);
    }
    c = (i+1) * 2;
    if(a[c-1]!=0){
      printf("left key = %ld, ",a[c-1]);
    }
    c = (i+1) * 2 + 1;
    if(a[c-1] !=0)printf("right key = %ld, ",a[c-1]);
    printf("\n");
  }
  
  return 0;
}



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

int main() {
  int n; cin >> n;
  int ans = 0;
  for(int i = 0; i < n; i++) {
    int a; cin >> a;
    if(i % 2 == 0 && a % 2 == 1) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3616
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<map>
typedef long long ll;
typedef double dd;
#define For(i,j,k) for (int i=j;i<=k;++i)
#define Forr(i,j,k) for (int i=j;i>=k;--i)
using namespace std;

template<typename T>bool chkmax(T& a,T b) {return a<b?a=b,1:0;}
template<typename T>bool chkmin(T& a,T b) {return a>b?a=b,1:0;}

const int maxn=200000+100;
int n,m;
map<int,int>ma;

void read(int &x)
{
	x=0;
	int p=1;
	char c=getchar();
	while (!isdigit(c)) {if (c=='-') p=-1; c=getchar();}
	while (isdigit(c)) {x=(x<<1)+(x<<3)+(c-'0'); c=getchar();}
	x*=p;
}

int main()
{
	read(n);
	For (i,1,n)
	{
		int x; read(x);
		ma[x]++;
	}
	read(m);
	For (i,1,m)
	{
		int x; read(x);
		if (!ma[x]) { printf("NO\n"); return 0; }
		ma[x]--;
	}
	printf("YES\n");
	return 0;
}

Measured memory_bytes: 9600
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
using namespace std;

int pow(int A, int P){
	int a = A, p = P;
	if(p == 0) return 1;
	if(p == 1) return a;
	int adash = a * a;
	if(p % 2) return pow(adash, p / 2) * a;
	else return pow(adash, p / 2);
}

int main(){
	int D, N;
	cin >> D >> N;
	if(N < 100) cout << pow(100,D) * N << endl;
	else cout << pow(100,D) * (N + 1) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VRSORT(v) sort(v.rbegin(), v.rend());//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define OUT(x) cout << x << endl
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int gcd(int x, int y){
  if(y == 0) return x;
  return gcd(y,x%y);
}

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  REP(i,n) cin >> a[i];
  int b = a[0];
  for(int i=1;i<n;i++){
      b= gcd(b,a[i]);
  }
  vector<int> ret;
  for(int i=1;i*i<=b;++i){
      if(b%i ==0){
          ret.push_back(i);
          if(i*i<b){
              ret.push_back(b/i);
          }
      }
  }
  VSORT(ret)
  REP(i,ret.size()) cout << ret[i] << endl;
  return 0;
}


Measured memory_bytes: 3148
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

const int mod = 1000000007;
int add(int a, int b) { return (a += b) < mod? a : a - mod; }
int sub(int a, int b) { return (a -= b) >=  0? a : a + mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }
void adds(int& a, int b) { a = add(a, b); }
void subs(int& a, int b) { a = sub(a, b); }
void muls(int& a, int b) { a = mul(a, b); }
void maxs(int& a, int b) { a = max(a, b); }
void mins(int& a, int b) { a = min(a, b); }
int pwr(int a, ll p) {
    if (p == 0) return 1;
    if (p & 1) return mul(a, pwr(a, p - 1));
    return pwr(mul(a, a), p / 2);
}
int inv(int a) { return pwr(a, mod - 2); }

int dp[10000][101];
int a[10000];
string k;
int d;
int n;

int f(int x, int s)
{
    if (x == n)
        return (s == 0 ? 1 : 0);

    int& sol = dp[x][s];
    if (sol != -1)
        return sol;

    sol = 0;
    for (int i = 0; i <= 9; ++i)
        adds(sol, f(x + 1, (s + i) % d));
    return sol;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> k >> d;
    n = k.size();
    for (int i = 0; i < n; ++i)
        a[i] = k[i] - '0';

    memset(dp, -1, sizeof dp);
    int sol = f(1, 0);
    int dsum  = 0;
    for (int j = 0; j < n; ++j)
    {
        int l = (j == 0 ? a[j] - 1 : a[j]);
        for (int i = (j != n - 1 ? 1 : 0); i <= l; ++i)
            adds(sol, f(j + 1, (dsum + a[j] - i) % d));
        dsum += a[j];
    }
    cout << sub(sol, 1);
}


Measured memory_bytes: 4736
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ld double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
/*
	vec1.size();
	str1.length();
	vec1.pop_back;
*/
typedef long long ll;
typedef unsigned long long ull;
typedef pair <ll, ll> pll;
typedef vector<pll> vplll;
#define rep(i,l,r) for (ll i = l; i < r; ++i)
#define reprev(i,l,r) for (ll i = r; i >= l; --i)
ll mod = 1e9+7;
ll expo_mod(ll x, ll y, ll p) 
{ 
	ll res = 1;
	x = x % p; 
	if (x == 0) 
		return 0; 
	while (y > 0) 
	{
		if (y%2==1) 
			res = (res*x) % p; 
		y = y>>1; // y = y/2 
		x = (x*x) % p; 
	} 
	return res; 
} 
ll gcd(ll a,ll b)
{
	if(b==0)
		return a;
	return gcd(b,a%b);
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	string s,t;
	cin>>s>>t;
	ll l1=s.size();
	ll l2=t.size();
	if(l1!=l2-1)
	{
		cout<<"No\n";
		return 0;
	}
	rep(i,0,l1)
	{
		if(s[i]!=t[i])
		{
			cout<<"No\n";
			return 0;
		}
	}
	cout<<"Yes\n";
	return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

int main() {
    string s, t;
    cin >> s >> t;

    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    reverse(t.begin(), t.end());

    cout << (s < t ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 256
N = int(input())
A = [int(n) for n in input().split()]
Q = int(input())
B = []
C = []
for q in range(Q):
    x, y = [int(i) for i in input().split()]
    B.append(x)
    C.append(y)

S = [0] * (Q + 1)
S[0] = sum(A)

AA = {}

for a in A:
    if a in AA:
        AA[a] += 1
    else:
        AA[a] = 1

def my_sum(dic):
    sum = 0
    for k, v in dic.items():
        sum += k * v
    return sum

for q in range(1, Q+1):
    if B[q-1] not in AA:
        S[q] = S[q-1]
        continue
    S[q] = S[q-1] - B[q-1] * AA[B[q-1]]

    S[q] += C[q-1] * AA[B[q-1]]

    if C[q-1] in AA:
        AA[C[q-1]] += AA[B[q-1]]
        AA[B[q-1]] = 0
    else:
        AA[C[q-1]] = AA[B[q-1]]
        AA[B[q-1]] = 0

for q in range(1, Q+1):
    print(S[q])


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

int main(void){
    //input
    int a,b,c,dis;
    cin >>a>>b>>c>>dis;
     
    //communicate a and c
    if (abs(a-c)<=dis){
        cout<<"Yes"<<endl;
    }
    else if (abs(a-b)<=dis && abs(b-c)<=dis){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}

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

#a,bの最大公約数
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

#a,bの最小公倍数
def lcm(a, b):
    return a * b // gcd (a, b)
  
Answer = lcm(A,B)
print(Answer)

Measured memory_bytes: 2940
import java.io.ByteArrayInputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    String INPUT = "";

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

    void run() {
        Scanner sc = INPUT.isEmpty() ? new Scanner(System.in) : new Scanner(new ByteArrayInputStream(INPUT.getBytes()));
        PrintWriter out = new PrintWriter(System.out);

        solve(sc, out);
        out.flush();
    }

    void solve(Scanner sc, PrintWriter out) {
        String S = sc.nextLine();
        while (!"0".equals(S)) {
            int sum = 0;
            for (int i = 0; i < S.length(); i++) {
                sum += (int)S.charAt(i)-'0';
            }
            System.out.println(sum);
            S = sc.nextLine();
        }
    }
}



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

typedef long long ll;
const ll INF = 1e9, MOD = 1e9 + 7;
const double EPS = 1e-9, PI = 3.141592653589793;
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define REPR(i,a,b) for(ll i=b;i>=a;i--)
#define repr(i,n) REPR(i,0,n)
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define fi first
#define se second
#define m_p make_pair

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

    ll n,m,mn,mind,ans;
    cin >> n >> m;
    vector<ll> a(n),b(n);
    rep(i,n) cin >> a[i] >> b[i];
    vector<ll> c(m),d(m);
    rep(i,m) cin >> c[i] >> d[i];
    rep(i,n){
        mind = INF;
        rep(j,m){
            mn = abs(a[i]-c[j]) + abs(b[i]-d[j]);
            if(mn < mind){
                mind = mn;
                ans = j + 1;
            }
        }
        cout << ans << "\n";
    }
    return 0;
}

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

double dist(double x, double y, double r) {
    return x + sqrt(pow(y + r, 2.0) - pow(y - r, 2.0));
}

int main() {
    int n;
    cin >> n;
    vector<double> v(n);
    for (auto &i : v) {cin >> i;}

    vector<double> x(n, 0.0);
    for (int i = 1; i < n; i++) {
        for (int j = 0; j < i; j++) {
            x[i] = max(x[i], dist(x[j], v[j], v[i]));
        }
    }

    double l = 0, r = 0;
    for (int i = 0; i < n; i++) {
        l = min(l, x[i] - v[i]);
        r = max(r, x[i] + v[i]);
    }

    printf("%.8f\n", (r - l));
    
    return 0;
}

Measured memory_bytes: 3292
#include <bits/stdc++.h>
using LL = long long;
const LL MOD = 1e9+9;
using namespace std;

const int beam_with = 20;




int main(){
    int N;cin >> N;
    LL _K;cin >> _K;
    bitset<50> K(_K);
    vector<bitset<50>> bits;
    vector<LL> val;
    for(int a = 0;a < N;a++){
        LL A,B;cin >> A >> B;
        bits.push_back(A);
        val.push_back(B);
    }
    LL ans = 0;
    //cout<<K<<endl;
    for(int i = -1;i < 51;i++){
        if(K[i] == 0 && i != -1)continue;
        //cout<<i<<endl;
        LL ins_ans = 0;
        for(int j = 0;j < N;j++){
            bool result = true;
            for(int k = 49;k >= max(i,0);k--){
                if(i == k){
                    if(1 == bits.at(j)[k]){
                        result = false;
                        break;
                    }
                }else{
                    if(!(bits.at(j)[k] == 0 || K[k] == 1)){
                        result = false;
                        break;
                    }
                }
            }
            if(result){
                ins_ans += val.at(j);
              //  cout<<bits[j]<<endl;
            }
            //cout<<"ans:"<<ins_ans<<endl;
        }
        ans = max(ans,ins_ans);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 2036
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //ai>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //ai>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
#define TO(x,t,f) ((x)?(t):(f))
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define FILV(x,a) fill(x.begin(),x.end(),a)
#define FILA(ar,N,a) fill(ar,ar+N,a)
#define NEXTP(x) next_permutation(x.begin(),x.end())
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;else return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define pb push_back
#define pri(aa) cout<<(aa)<<endl
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
const ll INF=1e9+7;
const ll N = 1003;
const ll M = 100003;


ll n,k,ans=0,mina=INF,a;
vector<ll> mini;




int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n>>k;
	ans++;
	n-=k;
	k--;
	ans+=n/k;
	if(n%k!=0)ans++;
	pri(ans);
	return 0;
}


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

int main(){
string n;
cin>>n;
int c=0;
for(int i=0;i<n.size();i++){
   char a=n[i];
   int b = a-'0';
   c+=b;

}

   if(c%9==0){
   cout<<"Yes"<<endl;
}
else{
   cout<<"No"<<endl;
}

return 0;

}

Measured memory_bytes: 3696
#include <iostream>
#include <stdio.h>
using namespace std;


int main(){
    int h,w;
    cin >> h >> w;
    while(h!=0 && w!=0){
        for(int i=0; i<h; i++){
            for(int j=0; j<w; j++){
                if(i%2==1){
                    if(j%2==1){
                        cout << "#";
                    }
                    else{
                        cout << ".";
                    }
                }
                else{
                    if(j%2==1){
                        cout << ".";
                    }
                    else{
                        cout << "#";
                    }
 
                }

            }
            cout << endl;
        }
        cout << endl;
        cin >> h >> w;
        
    }
}


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

class D
{
	static void Main()
	{
		Func<int[]> read = () => Console.ReadLine().Split().Select(int.Parse).ToArray();
		var h = read();
		var v = read();
		int n = h[0], k = h[1], nk = Math.Min(n, k), M = 0;

		for (int i = 1; i <= nk; i++)
		{
			var t = v.Take(i).ToArray();
			var neg = t.Count(x => x < 0);
			M = Math.Max(M, t.OrderBy(x => x).Skip(Math.Min(neg, k - i)).Sum());

			for (int j = 1; j <= i; j++)
			{
				if (t[i - j] < 0) neg--;
				if (v[n - j] < 0) neg++;
				t[i - j] = v[n - j];
				M = Math.Max(M, t.OrderBy(x => x).Skip(Math.Min(neg, k - i)).Sum());
			}
		}
		Console.WriteLine(M);
	}
}


Measured memory_bytes: 13524
while True:
    H,W = map(int,input().split())
    if H == 0 and W == 0:
        break
    for i in range(H):
        for m in range(W):
            if i == 0 or i == H-1 or m == 0 or m == W-1:
                print("#", end = "")
            else:
                print(".", end = "")
        print()
        
    print()


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

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

fn main() {
  let x = read::<i32>();
  let y = read::<i32>();

  println!("{}", x + (y / 2))
}



Measured memory_bytes: 4352
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int N;
	string S, T;
	
	cin>>N;
	
	cin>>S>>T;
	
	for(int i = 0; i < N; i++){
		cout<<S[i]<<T[i];
	}
	
	cout<<endl;
	
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {
	static int N,M;
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		 N = sc.nextInt();
		 M = sc.nextInt();

		 sc.close();

		 int ans = N+M/2;
		 System.out.println(ans);
	}
}

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m, k; cin >> n >> m >> k;
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= m; j++) {
            if (i*(m-j) + j*(n-i) == k) {
                cout << "Yes\n";
                return 0;
            }
        }
    }
    cout << "No\n";
    return 0;
}

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

int main(){
  int N, M; cin >> N >> M;
  queue<int> que;
  vector<vector<int> > g(N+1, vector<int>());
  vector<int> d(N+1, -1);
  for(int i = 0; i < M; i++){
    int a, b; cin >> a >> b;
    g[a].emplace_back(b);
    g[b].emplace_back(a);
  }
  
  que.push(1);
  d[1] = 0;
  int prv = -1;
  while(!que.empty()){
    int now = que.front(); que.pop();
    for(auto e: g[now]){
      if(d[e] == -1) {
        d[e] = d[now] + 1;
        que.push(e);
      }
    }
  }
  cout << ((d[N] == 1 || d[N] == 2)?"POSSIBLE":"IMPOSSIBLE");
}

Measured memory_bytes: 13168
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ; //何もしない文
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size()) //unsignedのサイズをint型に変換
#define pb push_back

typedef long long LL; 
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

long long int gcd(long long int a, long long int b) {
    if (a < b)swap(a, b);
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}

long long int lcm(long long int a, long long int b) {
    return a / gcd(a, b) * b;
}


int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);	
    LL N; cin >> N;
    LL ans = 1;
    REP(i,N)
    {
        LL t; cin >> t;
        ans = lcm(ans, t);
    }
    cout << ans << endl;


}


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

int main(){
	int a,b,c;
	cin >> a >> b >> c ;
	int ta,tb,tmp,r;
	ta = a;
	tb = b;

	if(ta<tb){
		tmp = ta;
		ta = tb;
		tb = tmp;
	}

	r = ta % tb;
	while(r!=0){
		ta = tb;
		tb = r;
		r = ta % tb;
	}

	int dib;
	dib = b / tb;
	bool can=false;
	for(int i=1; i<=dib; ++i){
		if(a*i%b==c) can=true;
	}

	if(can){
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
def get_input():
    while True:
        try:
            yield raw_input()
        except EOFError:
            break

num_lis = list(get_input())

train_lis = []
for num in num_lis:
    if num == '0':
        print(train_lis[0])
        del train_lis[0]
    else:
        train_lis.insert(0, num)

Measured memory_bytes: 4196
import java.io.IOException;
import java.util.HashSet;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int a;
		
		HashSet<Integer>writeNum = new HashSet<Integer>();
		
		for (int i=0; i<N; i++){
			a = sc.nextInt();
			if (writeNum.contains(a)){
				writeNum.remove(a);
			} else {
				writeNum.add(a);
			}
		}
		System.out.println(writeNum.size());
	}
}


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

int main()
{	
	ios_base::sync_with_stdio(0);
	string str;
	int len;
	while(cin>>len>>str){
		vector<int> east(len+2,0), west(len+2,0);
		for(int i=0; i<len; i++){
			west[i+1] = west[i] + (str[i]=='W');
		}
		for(int i=len-1; i>=0; i--){
			east[i+1] = east[i+2] + (str[i]=='E');
		}
		int ans = len;
		for(int i=1; i<=len; i++){
			ans = min(ans, west[i-1] + east[i+1]);
		}
		cout<<ans<<endl;
	}
}



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

#define ll long long
#define pb push

int n;
vector<int> edges[200001];

void bfs(int t,vector<int> &v){
	queue<int> q;
	vector<int> dist(n,1e9);
	dist[t]=0;
	v[t]=0;
	q.pb(t);
	while (!q.empty()){
		int x=q.front();
		q.pop();
		
		for (int j=0;j<edges[x].size();j++){
			int i=edges[x][j];
			if (dist[i]==1e9){
				q.pb(i);
				dist[i]=dist[x]+1;
				v[i]=v[x]+1;
			}
		}
	}
}

int main(){
	cin>>n;
	vector<int> f(n);
	vector<int> s(n);
	for (int i=0;i+1<n;i++){
		int a,b;
		cin>>a>>b;
		a--;
		b--;
		edges[a].push_back(b);
		edges[b].push_back(a);
	}
	bfs(0,f);
	bfs(n-1,s);
	int cnt=0;
	for (int i=0;i<n;i++)
		if (f[i]<=s[i])
			cnt++;
	cout<<(cnt>n-cnt ? "Fennec" : "Snuke")<<endl;
	return 0;
}

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

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var ab = Console.ReadLine().Split().Select(int.Parse).ToArray();

            Console.WriteLine(ab[0]>=13 ?ab[1] : ab[0]>=6? ab[1] >> 1: 0);
        }
    }
}


Measured memory_bytes: 11348
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String word=br.readLine();
		StringBuilder out=new StringBuilder();
		String w;
		for (int i=0;i<word.length();i++){
			w=word.substring(i,i+1);
			if(w.equals(w.toLowerCase())){
				w=w.toUpperCase();
			}else if(w.equals(w.toUpperCase())){
				w=w.toLowerCase();
			}
		out.append(w);
		}
		System.out.println(out);
	}
}

Measured memory_bytes: 16864
#include <bits/stdc++.h>
    using namespace std;
    int main() {
      int n;
      cin >>n;
      int a = n/100;
      int b = (n/10)%10;
      int c = n%10;
      if(a == 7 || b == 7 || c == 7){
        cout << "Yes";
      }else{
       cout << "No";
      }
      return 0;
    }

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long s,a,b;
  cin>>s;
  if(s==1000000000000000000){cout<<0<<' '<<0<<' '<<1000000000<<' '<<0<<' '<<0<<' '<<1000000000; return 0;}
  b=1000000000-s%1000000000;
  a=(s+b)/1000000000;
  cout<<0<<' '<<0<<' '<<1000000000<<' '<<1<<' '<<b<<' '<<a;
}

Measured memory_bytes: 256
n, q = map(int, input().split())
s = input()
ll = list(list(map(int, input().split())) for _ in range(q))

acl = [0] * n
cnt = 0
for i in range(1, n):
    if s[i-1:i+1] == 'AC':
        cnt += 1
    acl[i] = cnt

for i in range(q):
    l = ll[i][0]
    r = ll[i][1]
    print(acl[r-1] - acl[l-1])


Measured memory_bytes: 30640
n, m = map(int, input().split())
dic = {i: False for i in range(1,n+1)}
was = [0 for i in range(n+1)]
ac = 0
wa = 0
for i in range(m):
  p, s = input().split()
  p = int(p)
  if dic[p]==False:
    if s == 'AC':
      dic[p] = True
      ac += 1
    else:
      was[p] += 1
for i in range(1,n+1):
  if dic[i]:
    wa += was[i]
print('{} {}'.format(ac, wa))

Measured memory_bytes: 15084
/*

                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    prayer
*/

// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
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;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

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

	int n;
	cin>>n;
	double w=0;
	rep(i,n){
		double a;cin>>a;
		w+=1/a;
	}
	cout<<shosu(9)<<1/w<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
  using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define endl "\n"
  #define int long long
  #define all(v) v.begin(),v.end()
  #define f first
  #define s second
  #define PB push_back
  #define MP make_pair
  #define db long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  #define MOD 1000000007
    

  int gcd(int a,int b)
  {
    if(b==0)
    {
      return a;
    }
    return gcd(b,a%b);
  }

  bool sortbysec(const pair<int,int> &a,const pair<int,int> &b)
  {

    if(a.s==b.s)
    {
      return a.f<b.f;
    }
    return a.s<b.s;
  }
  int32_t main()
  {         
    
     
      IOS

      int x,a;
      cin>>x>>a;
      if(x<a)
      {
        cout<<0;
      }
      else
      {
        cout<<10;
      }


      return 0;
  }           

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

#define ll long long
#define endl '\n'
#ifndef _WINDOWS
// no getchar_unlocked on Windows so just call getchar
#define getchar getchar_unlocked
#endif

template <typename Func>
inline void loop(int e, Func&& f) {
    for (int i = 0; i < e; i++) {
        std::forward<Func>(f)(i);
    }
}
template <typename Func>
inline void loop(int s, int e, Func&& f) {
    for (int i = s; i < e; i++) {
        std::forward<Func>(f)(i);
    }
}
template <typename T>
inline void scanpn(T& num) {
    register int c;
    num = 0;
    c = getchar();
    // bool negative = false;
    // if (c == '-') {
    // 	negative = true;
    // 	c = getchar();
    // }
    for (; (c > 47 && c < 58); c = getchar()) num = num * 10 + c - 48;
    // if (negative)
    //     number = -number;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int r;
    cin >> r;
    cout << 2 * 3.1415926 * r << endl;
    return 0;
}

Measured memory_bytes: 3796
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.List;


public class Main {
	public static void main(String[] args) {

		Input input = new Input();
		Converter conv = new Converter();
		
		
		String a[]= conv.strArr_(input.input(), "");
		String b[] = conv.strArr_(input.input(), "");
		String c[] = conv.strArr_(input.input(), "");
		int asize = a.length;
		int bsize = b.length;
		int csize = c.length;
		int acount=0,bcount=0,ccount=0;
		String index = a[0];
		acount++ ;
		
		
		while(acount<=asize && bcount<=bsize && ccount<=csize) {
			
			switch(index) {
			case "a":
				if(acount == asize) {
					System.out.println("A");
					acount++;	
				}else{
					index = a[acount];
					acount++;
					}
				break;
			
			case "b":
				if(bcount == bsize) {
					System.out.println("B");
					bcount++;	
				}else{
					index = b[bcount];
					bcount++;
					}
				break;
			
			case "c":
				if(ccount == csize) {
					System.out.println("C");
					ccount++;	
				}else{
					index = c[ccount];
					ccount++;
					}
				break;
			}
		}
		}
	}





class Input{
	private String buf;
	BufferedReader bufferdReader = new BufferedReader(new InputStreamReader(System.in));

	public String input() {
	try{
		this.buf = bufferdReader.readLine();
	}catch(Exception e) {

	}
	return buf;
	}
}


class Converter{

	private int convInt=0;
	private String convStrArr[];
	private List<String> convStrList;



	/**
	 * String→Int変換機
	 * @return this.convInt
	 */
	public int int_(String convInt){
		this.convInt = Integer.parseInt(convInt);
		return this.convInt;
	}

	/**
	 * String→String[] 変換機
	 * @param convStrArr 変換対象文字
	 * @param breakStr 区切り文字
	 * @return this.convStrArr 文字配列
	 */
	public String[] strArr_(String convStrArr,String breakStr){

		this.convStrArr = convStrArr.split(breakStr,0);
		return this.convStrArr;
	}

	public  List<String> strList_(String[]  convStrList){
		 this.convStrList = Arrays.asList(convStrList);
		 return this.convStrList;
	}
}

Measured memory_bytes: 32972
#include<stdio.h>
void quicksort(int a[],int s,int t){
  if(s<t){
    int i=s,j=t,p=a[(s+t)/2];
    while(1){
      while(a[i]>p)i++;
      while(p>a[j])j--;
      if(i>=j)break;
      a[i]^=a[j]^=a[i]^=a[j];
      i++;j--;
    }
    quicksort(a,s,i-1);quicksort(a,j+1,t);
  }
}
int main(){
  int a[100000],n,i;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&a[i]);
  quicksort(a,0,n-1);
  for(i=1;i<n;i++)if(a[i]<a[0]/2)break;
  if(i>1&&i<n)i-=a[0]/2-a[i]<a[i-1]-a[0]/2-a[0]%2?0:1;
  i-=i==n;
  printf("%d %d",a[0],a[i]);
}


Measured memory_bytes: 2092
#include<iostream>
#include<string>
 
using namespace std;
 
int main(){
    string s,a;
    cin >> s >> a;
    s += s;
    string::size_type index = s.find(a);
    if (index == string::npos) {
        cout << "No" << endl;
    }
    else {
        cout << "Yes" << endl;
    }
 
    return 0;
}

Measured memory_bytes: 3180
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll ;
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
 const ll inf=1e9+7;
string a,b,c;


 void test_cases()
{


ll k,s;
cin>>k>>s;
ll sum=0,z=0,cnt=0;

for(ll x=0;x<=min(s,k);x++)
{
	for(ll y=0;y<=min(s,k);y++)
	{
		sum=x+y;
		z=s-sum;
		if(z>=0&&z<=k)
		cnt++;
	}
}


cout<<cnt;
}


int main()
{
    fast;
  ll t;
 // cin>>t;
 t=1;
  while(t--)
  test_cases();

  	
}

		
	
	
	
	


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

#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(obj) obj.begin(), obj.end()

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 int iINF = 1e9;
const long long llINF = 1e18;
const int MOD = 1e9 + 7;

using namespace std;

int main() { 
    long long a, b, c;
    cin >> a >> b >> c;
    if (4 * a * b < (c - a - b) * (c - a - b) && c - a - b >= 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0; 
}

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

int main(){
	int a,b,ans=0;
	cin>>a>>b;
	for(int i=1,c,d;i<=1250;++i){
		c=i*0.08,d=i*0.1;
		if(c==a&&d==b){
			ans=i;
			break;
		}
	}
	if(ans)cout<<ans<<"\n"s;
	else cout<<"-1\n"s;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rint register int 
using namespace std;
const int Maxn = 1e5 + 5;

char buf[1 << 20], *p1, *p2;
//#define getchar() ((p1 == p2) && (p2 = (p1 = buf) + fread(buf, 1, 1 << 20, stdin), p1 == p2) ? EOF : *p1++)
int read() {
	rint s = 0, f = 1; register char ch = getchar();
	while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); }
	while (isdigit(ch)) { s = s * 10 + ch - '0'; ch = getchar(); }
	return s * f;
}

int n, tot = 0, a[Maxn], b[Maxn], sum[Maxn];



int l, r;

struct Treearray {
  
  int c[Maxn << 1];
  void clear() { for (rint i = 1; i <= n * 2; ++i) c[i] = 0; }
  void add(int x, int y) { for (; x <= n * 2; x += (x & -x)) c[x] += y; }
  int query(int x) {
    rint res = 0;
    for (; x; x -= (x & -x)) res += c[x];
    return res;
  }
} t;

void input() {
  n = read();
  for (rint i = 1; i <= n; ++i) a[i] = read(), r = max(r, a[i]);
  ++r;
}

namespace Solution {

  namespace Binary_ans {
    bool check(int mid) {
      t.clear();
      sum[0] = 0;
      for (rint i = 1; i <= n; ++i) sum[i] = sum[i - 1] + (a[i] >= mid ? 1 : -1);
      long long res = 0;
      for (rint i = 0; i <= n; ++i) {
        res += t.query(sum[i] + n);
        t.add(sum[i] + n, 1);
      }
      return res >= 1LL * n * (n + 1) / 4;
    }
    void Binary() {
      while (r - l > 1) {
      	rint mid = (l + r) >> 1;
      	check(mid) ? l = mid : r = mid;
			}
    }
  } 

  void solve() {
    Binary_ans :: Binary();
    printf("%d\n", l);
  }
}

signed main() {
  input(); 
  Solution :: solve();
  return 0;
}

Measured memory_bytes: 1792
from collections import Counter


def solve(N, S):
    c = Counter(S)
    ans = 3 * 10 ** 5 + 1

    right_e = c["E"]
    left_w = 0
    for i in range(N):
        if S[i] == "E":
            right_e -= 1

        ans = min(ans, left_w + right_e)

        if S[i] == "W":
            left_w += 1
    return ans


if __name__ == "__main__":
    N = int(input())
    S = input()
    print(solve(N, S))


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

const int N = 55;
const int INF = 0x3f3f3f3f;

int n;
int a[N];

int main() {
	scanf("%d", &n);
	int cntx = 0, cnty = 0;
	for (int i = 1; i <= n; i++) {
		scanf("%d", &a[i]);
		if (a[i] < 0) cnty++;
		else if (a[i] > 0) cntx++;
	}
	if (cntx == cnty && !cntx) {
		puts("0");
		return 0;
	}
	int mx = 0, x = 0;
	for (int i = 1; i <= n; i++) {
		if (abs(a[i]) > mx) {
			mx = abs(a[i]);
			x = i;
		}
	}
	if (a[x] < 0) {
		int ans = n - 1;
		for (int i = 1; i <= n; i++) {
			if (a[i] > 0) ans++;
		}
		printf("%d\n", ans);
		for (int i = 1; i <= n; i++) {
			if (a[i] > 0) printf("%d %d\n", x, i);
		}
		for (int i = n; i > 1; i--) {
			printf("%d %d\n", i, i - 1);
		}
	} else {
		int ans = n - 1;
		for (int i = 1; i <= n; i++) {
			if (a[i] < 0) ans++;
		}
		printf("%d\n", ans);
		for (int i = 1; i <= n; i++) {
			if (a[i] < 0) printf("%d %d\n", x, i);
		}
		for (int i = 1; i < n; i++) {
			printf("%d %d\n", i, i + 1);
		}
	}
	return 0;
}


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

public class Main{
  public static void main(String[] args)throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    
    String[] words = br.readLine().split(" ");
    String[] numStr = br.readLine().split(" ");
    int[] num = new int[2];
    num[0] = Integer.parseInt(numStr[0]);
    num[1] = Integer.parseInt(numStr[1]);
    
    String took = br.readLine();
    
    if(took.equals(words[0])){
      num[0]--;
    } else{
      num[1]--;
    }
    
    System.out.println(num[0] + " " + num[1]);
  }
}

Measured memory_bytes: 21076
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
const int MAX_NUM = 999999999;
void solve() {
	int N, T; cin >> N >> T;
	vector<pair<int, int>> t(N);
	for (int i = 0; i < N; ++i) {
		int t1, t2; cin >> t1 >> t2;
		t[i] = make_pair(t2, t1);
	}
	sort(t.begin(), t.end());
	int ans = INF;
	for (int i = 0; i < N; ++i) {
		if (t[i].first <= T) {
			ans = min(ans, t[i].second);
		}
	}	
	if (ans == INF) cout << "TLE" << endl;
	else cout << ans << endl;
	return;
}
int main() {
	solve();
	return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> A(n);
    for (int i = 0; i < n; i++) {
        cin >> A.at(i);
    }

    bool flag = true;
    int i = 0;
    int count = 0;
    while (flag) {
        flag = false;
        for (int j = n - 1; j >= i + 1; j--) {
            if (A.at(j - 1) > A.at(j)) {
                swap(A.at(j - 1), A.at(j));
                count++;
                flag = true;
            }
        }
        i++;
    }

    for (int k = 0; k < n; k++) {
        cout << A.at(k);
        if (k != n - 1) {
            cout << " ";
        }
    }
    cout << endl;
    cout << count << endl;
}


Measured memory_bytes: 3104
//#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<bits/stdc++.h>
using namespace std;
function<void(void)> ____ = [](){ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);};
using LL = int_fast64_t;
LL n;
int main(){
    ____();
    cin >> n;
    LL res = 0;
    if(n&1){
        cout << 0 << endl;
        return 0;
    }
    res += n/=10;
    while(n) res += n/=5;
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
typedef long long ll;
typedef long double ld;
int main() {
	int n;
	scanf("%d", &n);
	vector<vector<int>> no(n + 1, vector<int>(n + 1));
	for (int i = 1; i <= n / 2; ++i) {
		if (n % 2 == 0) no[i][n + 1 - i] = no[n + 1 - i][i] = true;
		else no[i][n - i] = no[n - i][i] = true;
	}
	vector<pair<int, int>> ans;
	for (int i = 1; i <= n; ++i)
		for (int j = i + 1; j <= n; ++j)
			if (!no[i][j]) ans.emplace_back(i, j);
	printf("%d\n", ans.size());
	for (auto& x : ans) printf("%d %d\n", x.first, x.second);
}


Measured memory_bytes: 384
S = input()

one, one_n = None, 0
two, two_n = None, 0

for s in S:
  if not one or s == one:
    one = s
    one_n += 1
    continue

  if not two or s == two:
    two = s
    two_n += 1
    continue

if one_n == 2 and two_n == 2:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3060
#include <stdio.h>
#include <ctype.h>

int main( void )
{
	char str[1200] = { 0 };
	int i = 0;
	
	while( 1 ){
		scanf("%c", &str[i]);
		
		if(islower(str[i])){
			str[i] = toupper(str[i]);
		} else if(isupper(str[i])){
			str[i] = tolower(str[i]);
		} else {
			// DO NOTHING
		}
		
		if(str[i] == '\n') break;
		
		i++;
	}
	
	printf(str);

	return 0;
}

Measured memory_bytes: 532
#include<iostream>
 
using namespace std;
 
 
 
int main() {
	int x;
	long total=0;
	cin >> x;
	for (int i = 1; i <= x; i++) {
		if (i % 5!=0 && i % 3!=0) {
		total += i;
		}
	}
	cout<<total<<endl;
	return 0;
}

Measured memory_bytes: 3544
package main

import (
	"fmt"
)

func main() {

	var K int
	fmt.Scanf("%d", &K)

	var seven int = 0
	var count int = 1
	for {
		seven = (seven*10 + 7) % K
		if seven == 0 {
			fmt.Println(count)
			break
		} else {
			count++
		}

		if count > 10000000 {
			fmt.Println("-1")
			break
		}
	}
}


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

int main() {
  string s;
  cin>>s;
  if (s == "AAA") {
    cout<<"No"<<endl;
  } else if (s == "BBB") {
    cout<<"No"<<endl;
  } else {
    cout<<"Yes"<<endl;
  }
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc118/tasks/abc118_b
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define REP(i, n) for(size_t i = 0; i < (n); ++i)

int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> K(N);
    vector<vector<int>> A(N, vector<int>());
    REP(row, N)
    {
        cin >> K[row];
        REP(col, K[row])
        {
            int a;
            cin >> a;
            --a;
            A[row].push_back(a);
        }
    }
    vector<int> res(M, 0);
    REP(row, N)
    {
        REP(col, K[row])
        {
            ++res[A[row][col]];
        }
    }
    int ans = 0;
    REP(i, M)
    {
        if (res[i] == N) ++ans;
    }
    cout << ans << endl;
    return 0;
}


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

class Main{
    static boolean solve(int i,int m, int n, int[] array){
        boolean res;

        if(m == 0){
            return true;
        }

        if(i >= n){
            return false;
        }

        if((res = solve(i + 1, m, n, array)) == true ||
           (res = solve(i + 1, m - array[i], n, array)) == true){
            return true;
        }

        return false;
    }

    public static void main(String[] args){
        int count1;
        int count2;
        int[] array1;
        int[] array2;
        int flag = 0;

        try{
            Scanner scan = new Scanner(System.in);
            String str;

            str= scan.next();
            count1 = Integer.parseInt(str);
            array1 = new int[count1];

            for(int i = 0; i < array1.length; i++){
                str = scan.next();
                array1[i] = Integer.parseInt(str);
            }

            str = scan.next();
            count2 = Integer.parseInt(str);
            array2 = new int[count2];

            for(int i = 0; i < array2.length; i++){
                str = scan.next();
                array2[i] = Integer.parseInt(str);
            }

            for(int i = 0; i < array2.length; i++){
                if(solve(0, array2[i], array1.length, array1) == true){
                    System.out.println("yes");
                }else{
                    System.out.println("no");
                }
            }

        }catch(Exception e){
            System.out.println("ERROR");
        }

    }
}



Measured memory_bytes: 26724
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
 
int main() {
  int a; string s; cin >> a >> s;
  cout << (a >= 3200 ? s : "red") << endl;
}

Measured memory_bytes: 256
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <complex>
#include <cstdio>
#include <string>
#include <vector>
#include <bitset>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>

#define isNum(a) (a >= '0' && a <= '9')
#define SP putchar(' ')
#define EL putchar('\n')
#define File(a) freopen(a ".in", "r", stdin), freopen(a ".out", "w", stdout)

template<class T>
void read(T&);
template<class T>
void write(const T&);

typedef long long ll;
typedef const long long & cll;
typedef const int & ci;
typedef std::pair<int, int> pii;
const int iinf = 2147483647;
const ll llinf = 9223372036854775807ll;
using std::min;
using std::max;
using std::abs;
using std::sort;
const int N = 1005;

int a[N][N];
int now[N];
bool vis[N];

int main () {
  int n;
  read(n);
  for (int i = 1; i <= n; ++i) {
    now[i] = 1;
    for (int j = 1; j < n; ++j) {
      read(a[i][j]);
    }
  }
  int ans = 0;
  std::queue<int> q;
  for (int i = 1; i <= n; ++i) {
    q.push(i);
  }
  while (true) {
    bool no = true;
    for (int i = 1; i <= n; ++i) {
      no &= (now[i] == n);
    }
    if (no) {
      break;
    }
    ++ans;
    memset(vis, false, sizeof(vis));
    std::queue<int> p;
    while (!q.empty()) {
      int u = q.front();
      q.pop();
      int v = a[u][now[u]];
      if (!vis[u] && !vis[v] && a[v][now[v]] == u) {
        ++now[u], ++now[v];
        vis[u] = vis[v] = true;
        p.push(u), p.push(v);
      }
    }
    q = p;
    if (p.empty()) {
      puts("-1");
      return 0;
    }
  }
  write(ans), EL;
  return 0;
}

template<class T>
inline void read(T &Re) {
  T k = 0;
  char ch = getchar();
  int flag = 1;
  while (!isNum(ch)) {
    if (ch == '-') {
      flag = -1;
    }
    ch = getchar();
  }
  while (isNum(ch)) {
    k = (k << 1) + (k << 3) + ch - '0';
    ch = getchar();
  }
  Re = flag * k;
}
template<class T>
inline void write(const T &Wr) {
  if (Wr < 0) {
    putchar('-');
    write(-Wr);
  } else {
    if (Wr < 10) {
      putchar(Wr + '0');
    } else {
      write(Wr / 10);
      putchar((Wr % 10) + '0');
    }
  }
}


Measured memory_bytes: 4224
#include<bits/stdc++.h>
using namespace std;
#define maxn 23
#define maxm (1<<21)+5
#define mod 1000000007
int dp[maxm] = {};
int main()
{
	int n;
	int a[maxn][maxn];
	scanf("%d",&n);
	for(int i=0; i<n; i++)
		for(int j=0; j<n; j++)
			scanf("%d",&a[i][j]);
	int M = (1<<n)-1;
	dp[0] = 1;
	/*for(int i=0; i<n; i++)
		for(int j=M; j>=0; j--)
			for(int k=0; k<n; k++)
				if(j&(1<<k) && a[i][k])
					dp[j] = (dp[j] + dp[j-(1<<k)]) % mod;*/
	for(int j=0; j<=M; j++)
	{
		int i = __builtin_popcount(j)-1;
		for(int k=0; k<n ;k++)
			if(j&(1<<k) && a[i][k])
				dp[j] = (dp[j] + dp[j-(1<<k)]) % mod;
	}
	printf("%d\n",dp[M]);
	return 0;
}

Measured memory_bytes: 8448
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include<random>
#include<math.h>
#include<limits.h>
#include<iterator>
#define rep(i,a) for(int i=0;i<a;i++)
#define nrep(i,a,b) for(int i=a;i<b;i++)
#define mrep(i,a) for(int i=a;i>=0;i--)
#define ll long long
#define vl vector<ll> 
#define vvl vector<vector<ll> > 
#define vb vector<bool> 
#define vvb vector<vector<bool> > 
#define INF 1123456789012345
using namespace std;

void end(ll n){
	cout << n << endl;
	exit(0);
}

int main(){
	ll n, a, b; cin >> n >> a >> b;
	if (n == 1 && a == b) end(1);
	if (n < 2) end(0);
	if (a == b) end(1);
	if (a > b) end(0);
	ll ans = (n - 2)*(b - a) + 1;
	end(ans);
	return 0;
}

Measured memory_bytes: 256