akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <fstream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <complex>
#include <list>

using namespace std; 

typedef long long int ll;
#define m 1000000007;


int main()
{
    ll n,i,j,k;
    ll h,w;
    cin>>h>>w;
    ll a[h][w];
    for(i=0;i<h;i++)
    {
    	for(j=0;j<w;j++)
    	{
    		char c;
    		cin>>c;
    		if(c=='.')
    		{
    			a[i][j] = 0;
    		}
    		else
    		{
    			a[i][j] = -1;
    		}
    	}
    }
    for(i=0;i<h;i++)
    {
    	if(a[i][0]==0)
    	{
    		a[i][0] =1;
    	}
    	else
    	{
    		break;
    	}
    }
    for(i=1;i<w;i++)
    {
    	if(a[0][i]==0)
    	{
    		a[0][i] =1;
    	}
    	else
    	{
    		break;
    	}
    }
    for(i=1;i<h;i++)
    {
    	for(j=1;j<w;j++)
    	{
    		if(a[i][j]==-1)
    		{
    			continue;
    		}
    		if(a[i-1][j]>0)
    		{
    			a[i][j] = (a[i][j] + a[i-1][j])%m;
    		}
    		if(a[i][j-1]>0)
    		{
    			a[i][j] = (a[i][j] + a[i][j-1])%m;
    		}
    	}
    }
    cout<<a[h-1][w-1];
    return 0;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<ll, ll>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'
#define all(a) a.begin(), a.end()
#define rev(a) reverse(all(a))
#define ld long double
const ll mod=1e9+7;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
void solve(){
    ll a,b,c,k;
    cin >> a >> b >> c >> k;
    ll ans=0;
    ans+=min(a,k);
    k-=a;
    if(k<=0){ cout << ans << endl; return; }
    k-=b;
    if(k<=0){ cout << ans << endl; return; }
    ans-=min(k,c);
    cout << ans << endl;
}
int main() {
    IOS;
    int t=1;
    //cin >> t;
    while(t--){
        solve();
    }
	return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <algorithm>

int main()
{
    int n;
    std::cin >> n;
    for(int i = 0; i < n; ++i){
        std::vector<int> set(3);
        std::cin >> set[0] >> set[1] >> set[2];
        std::sort(set.begin(), set.end());
        std::cout << (set[0]*set[0] + set[1]*set[1] == set[2]*set[2] ? "YES" : "NO") << std::endl;
    }
    return 0;
}

Measured memory_bytes: 3140
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  int n;
  cin >> n;
  int cur = 0;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (cur + 1 == a) cur = a;
  }
  cout << (cur == 0 ? -1 : n - cur) << '\n';
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int a, b, c;
	scanf("%d", &a); scanf("%d", &b); scanf("%d", &c);
	if (a < b)
	{
		if (b < c)
		{
			printf("Yes\n");
		}
		else
		{
			printf("No\n");
		}
	}
	else
	{
		printf("No\n");
	}
	return 0;
}

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

int main() {
  int a[3][3];
  int n;
  int b;
  int i,j,k;
  string ans="No"; 

  for(i=0;i<3;i++) {
    for(j=0;j<3;j++) {
      cin >> a[i][j];
      }
    }

  cin >> n;

  for(k=0;k<n;k++) {
    cin >> b;
    for(i=0;i<3;i++) {
      for(j=0;j<3;j++) {
        if(b==a[i][j]) {
          a[i][j]=0;
          }
        }
      }
    }

  for(i=0;i<3;i++) {
    if((a[i][0]+a[i][1]+a[i][2])==0) {
      ans="Yes";
      }
    }

  for(i=0;i<3;i++) {
    if(a[0][i]+a[1][i]+a[2][i]==0) {
      ans="Yes";
      }
    }

  if(a[0][0]+a[1][1]+a[2][2]==0) {
    ans="Yes";
    }

  if(a[0][2]+a[1][1]+a[2][0]==0) {
    ans="Yes";
    }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <math.h>
#include <string>
#include <algorithm>
//#include <ctype.h>
#include <vector>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <bitset>
using namespace std;

#define ll long long int
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repm(i, a, n) for (int i = a; i >= n; i--)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vs vector<string>
#define vii vector<vector<int>>
#define vll vector<ll>
#define vllll vector<vector<ll>>
#define vd vector<double>
#define ALL(a) (a).begin(), (a).end()
#define sort_v(a) sort(a.begin(), a.end())
#define reverse_v(a) reverse(a.begin(), a.end())
#define fi first
#define se second

void print(bool c)
{
    (c) ? (cout << "Yes" << endl) : (cout << "No" << endl);
}

void Print(bool c)
{
    (c) ? (cout << "YES" << endl) : (cout << "NO" << endl);
}

//最小公倍数
template <typename T>
T gcd(T a, T b)
{
    while (1)
    {
        if (a < b)
            swap(a, b);
        if (b == 0)
            break;
        a %= b;
    }
    return a;
}

//最大公約数
template <typename T>
T lcm(T a, T b)
{
    return a * b / gcd(a, b);
}
//セカンドキー->ファーストキーの順ソート
bool cmp(const pii &a, const pii &b)
{
    if (a.second != b.second)
        return a.second < b.second;
    return a.first < b.first;
}

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

int n, a, b, c, d;
string s;
bool f = true;

int move(char chr)
{
    if (chr == 'A')
    {
        if (s[a + 1] == '.' && a + 1 != b)
        {
            a++;
            return 1;
        }
        else if (s[a + 2] == '.' && a + 2 != b)
        {
            a += 2;
            return 1;
        }
    }
    else
    {
        if (s[b + 1] == '.' && b + 1 != a)
        {
            b++;
            return 1;
        }
        else if (s[b + 2] == '.' && a + 2 != a)
        {
            b += 2;
            return 1;
        }
    }
    f = false;
    return 0;
}

void Move(int x)
{
    if (x == 0)
    {
        while (a < c)
        {
            if (!move('A'))
                break;
        }
    }
    else
    {
        while (b < d)
        {
            if (!move('B'))
                break;
        }
    }
}

int main(void)
{
    cin >> n >> a >> b >> c >> d;
    a--, b--, c--, d--;
    cin >> s;

    if (c > d)
    {
        while (1)
        {
            if (s[b - 1] == '.' && s[b + 1] == '.')
                break;
            if (b == d)
            {
                f = false;
                break;
            }
            if (!move('B'))
                break;
        }
    }
    Move(c < d);
    Move(c > d);
    print(f);
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int a = N / 1000;
  int b = (N - a * 1000) / 100;
  int c = (N - a * 1000 - b * 100) / 10;
  int d = N % 10;
  if ((a == b && b == c) || (b == c && c == d)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl; 
  }
}

Measured memory_bytes: 256
object Main extends App {
  val Array(n, k) = io.StdIn.readLine().split(' ').map(_.toInt)
  val k2 = k * 2
  val squares = Array.fill(k2)(Array.fill(k2)(0))
  for (i <- 0 to n-1) {
    val Array(x, y, color) = io.StdIn.readLine().split(' ')
    squares(x.toInt % k2)((y.toInt + (if (color == "B") 0 else k)) % k2) += 1
  }
  for {
    i <- (0 to k2-1)
    j <- (1 to k2-1)
  } squares(i)(j) += squares(i)(j-1)
  for {
    j <- (0 to k2-1)
    i <- (1 to k2-1)
  } squares(i)(j) += squares(i-1)(j)
  val cnt =
    (squares(k-1)(k-1)) +
    (squares(k2-1)(k2-1) - squares(k-1)(k2-1) - squares(k2-1)(k-1) + squares(k-1)(k-1))
  var max = Math.max(cnt, n - cnt)
  for {
    i <- (0 to k-1)
    j <- (0 to k-1)
  } {
    val cnt = 
      (squares(i)(j)) +
      (squares(i+k)(j+k) - squares(i+k)(j) - squares(i)(j+k) + squares(i)(j)) +
      (squares(k2-1)(j) - squares(i+k)(j)) +
      (squares(i)(k2-1) - squares(i)(j+k)) +
      (squares(k2-1)(k2-1) - squares(k2-1)(j+k) - squares(i+k)(k2-1) + squares(i+k)(j+k))
    max = Math.max(Math.max(cnt, n - cnt), max)
  }
  print(max)
}


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

int main(){
    long long int A, B, N, ans, ansN, ansB;
    cin >> A >> B >> N;
    ansN = min(B-1, N);
    ansB = floor(A*(ansN)/B)-A*floor((ansN)/B);
    cout << ansB << endl;
}

Measured memory_bytes: 3560
a1,a2,a3 = map(int,input().split(" "))


a12 = abs(a1 - a2)
a13 = abs(a1 - a3)
a23 = abs(a2 - a3)

max_num = max(a12,a13, a23)

print(a12 + a13 + a23 - max_num)



Measured memory_bytes: 61796
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,r;
	cin>>n>>r;
	if(n>=10){
		cout<<r<<endl;
	}else{
		cout<<r+100*(10-n)<<endl;
	}
}

Measured memory_bytes: 256
import java.io.BufferedReader;
        import java.io.InputStreamReader;
        import java.util.Scanner;

public class Main {
    public static void main(String []args)
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(b%a==0)
            System.out.println(a+b);
        else
            System.out.println(b-a);


    }
}


Measured memory_bytes: 23764
import math
n=int(input())
A=list(map(int,input().split()))
t4=0
t2=0
t=0
for i in A:
  a = math.log2(i & -i)
  if a>=2:
    t4+=1
  elif a==1:
    t2+=1
  else:
    t+=1
if t4 >= t+(t2 % 2) -1:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 20392
#include<iostream>
using namespace std;
int n,n4,n2;
long long int a;
int main()
{
	cin>>n;n4=0;n2=0;
	for (int i=0;i<n;i++)
	{
		scanf("%d",&a);
		
		if(a%4==0)n4++;
		else if(a%2==0)n2++;
	}
	if(n2==0&&2*n4>=n-1)
		cout<<"Yes";
	else if(n2+2*n4>=n)cout<<"Yes";
	else cout<<"No";

}

Measured memory_bytes: 256
import re
n,m=map(int,input().split())
words=["."]*n
for s,c in [list(map(int,input().split())) for _ in range(m)]:
    if words[s-1]=="." or words[s-1]==str(c):
        words[s-1]=str(c)
    else:
        print(-1)
        exit()
if n!=1:
    for i in range(10**(n-1),10**n):
        num=str(i)
        result=re.fullmatch(r"".join(words),num)
        if result is not None:
            print(i)
            exit()
else:
    for i in range(10):
        num=str(i)
        result=re.fullmatch(r"".join(words),num)
        if result is not None:
            print(i)
            exit()

print(-1)

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

int main(){
  int w, h, n;
  cin >> w >> h >> n;
  
  int a_max = w, a_min =0, b_max = h, b_min = 0;
  
  for(int i = 0; i < n; i++){
    int a, b, c;
    cin >> a >> b >> c;
    
    if(c == 1){
      if(a_max <= a){
        a_max = a_min;
        break;
      }
      else{
        a_min = max(a, a_min);
      }
    }
    else if(c == 2){
      if(a_min >= a){
        a_max = a_min;
        break;
      }
      else{
        a_max = min(a, a_max);
      }
    }
    else if (c == 3){
      if(b_max <= b){
        b_max = b_min;
        break;
      }
      else{
        b_min = max(b, b_min);
      }
    } 
    else{
      if(b_min >= b){
        b_max = b_min;
        break;
      }
      else{
        b_max= min(b, b_max);
      }
    }
  }
  int A = a_max - a_min, B = b_max - b_min;
  cout << A * B << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ar array
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;
typedef double db;
const ll mod = 1000000007;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

int main() {
	char a, b;
	cin >> a >> b;
	if(a == 'H' && b == 'H') puts("H");
	else if(a == 'D' && b == 'H') puts("D");
	else if(a == 'H' && b == 'D') puts("D");
	else if(a == 'D' && b == 'D') puts("H");

    return 0;
}



Measured memory_bytes: 3640
import java.util.Scanner;
public class Main{
  private static boolean debug = false;
  public static void main(String... args) {
    assert debug = true;
    Scanner sc = new Scanner(System.in);
    int r = sc.nextInt();
    if (debug) System.out.println("assert");
    System.out.println(3 * r * r);
  }
}

Measured memory_bytes: 23124
import java.io.BufferedReader
import java.io.IOException
import java.io.InputStreamReader
import java.util.*
import kotlin.collections.HashSet
import kotlin.math.*
fun main(){
    var fs = CodeForces.FastReader()
    var h = fs.nextInt()
    var w = fs.nextInt()
    var k = fs.nextInt()
    var a = Array(h){CharArray(w)}
    for(i in 0 until h) a[i] = fs.next().toCharArray()
    var ans = 0
    for (R in 0 until (1 shl h) - 1) {
        for (C in 0 until (1 shl w) - 1) {
            var blacks = 0
            for (i in 0 until h) {
                for (j in 0 until w) {
                    if((R shr i) and 1 == 0 && (C shr j) and 1 ==0 && a[i][j] == '#')
                        blacks++
                }
            }
            if(blacks == k) ans++
        }
    }
    println(ans)



}

class CodeForces {
    internal class FastReader {
        private var br: BufferedReader = BufferedReader(InputStreamReader(System.`in`))
        private var st: StringTokenizer? = null

        operator fun next(): String {
            while (st == null || !st!!.hasMoreElements()) {
                try {
                    st = StringTokenizer(br.readLine())
                } catch (e: IOException) {
                    e.printStackTrace()
                }

            }
            return st!!.nextToken()
        }

        fun nextInt(): Int {
            return Integer.parseInt(next())
        }

        fun nextLong(): Long {
            return java.lang.Long.parseLong(next())
        }

        fun nextDouble(): Double {
            return java.lang.Double.parseDouble(next())
        }

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

        fun readIntArray(n: Int): IntArray {
            val a = IntArray(n)
            for (i in 0 until n) a[i] = nextInt()
            return a
        }
        fun readLongArray(n: Int): LongArray {
            val a = LongArray(n)
            for (i in 0 until n) a[i] = nextLong()
            return a
        }

        fun readDoubleArray(n: Int): DoubleArray {
            val a = DoubleArray(n)
            for (i in 0 until n) a[i] = nextDouble()
            return a
        }
    }
}


Measured memory_bytes: 34464
//Keep pluggin',this is your only outlet.
#include<bits/stdc++.h>
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MM(x,y) memset(x,y,sizeof(x))
#define MCPY(a,b) memcpy(a,b,sizeof(b))
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,b,a) for(int i=b;i>=a;i--)
#define fi head
#define se second
#define int long long
using namespace std;

inline int quickpow(int m,int n,int p){int b=1;while(n){if(n&1)b=b*m%p;n=n>>1;m=m*m%p;}return b;}
inline int getinv(int x,int p){return quickpow(x,p-2,p);}
inline int read(void){
	int x=0,f=1;char ch=getchar();
	while(!isdigit(ch)){f=ch=='-'?-1:1;ch=getchar();}
	while(isdigit(ch)){x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
	return x * f;
}
using namespace std;
int a[200001][2],n,m,to[500001],Nxt[500001],head[500001],is[200001],e1=0,k=0,v[200001];
char ch[200001];
queue<int> q;
void insert(int o,int p) {to[e1]=p;Nxt[e1]=head[o];head[o]=e1++;}
///------------------head------------------
signed main(signed argc, char *argv[]){
    memset(head,-1,sizeof(head));
    n = read(); m = read();
    scanf("%s",ch);
    for(int i=0;i<n;i++) is[i+1]=ch[i]=='A';
    memset(a,0,sizeof(a));
    rep(i,1,m){
        int x = read(),y = read();
        insert(x,y);insert(y,x);
        a[x][is[y]]++;
        a[y][is[x]]++;
    }
    memset(v,0,sizeof(v));
    rep(i,1,n) if((a[i][0]==0) || (a[i][1]==0)) q.push(i),v[i]=1,k++;
    while(!q.empty())
    {
        int ret=q.front();
        for(int i=head[ret];i!=-1;i=Nxt[i])
            if(!v[to[i]])
            {
                a[to[i]][is[ret]]--;
                if(a[to[i]][is[ret]]==0) q.push(to[i]),v[to[i]]=1,k++;
            }
        q.pop();
    }
    if(k < n) cout<<"Yes"<<endl;else cout<<"No"<<endl;
	return 0;
}

/* Examples: */
/*

*/

/*

*/


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

#define int long long

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

int N, M;
int dp[305][305][305] = {};
vector<int> kukan[305];
int seiyaku[305][305];
int mod = 1e9 + 7;

signed main() {
    cin >> N >> M;
    for (int i = 0; i < M; i++) {
        int l, r, x;
        cin >> l >> r >> x;
        kukan[r].push_back(l);
        if (seiyaku[l][r] != 0 && seiyaku[l][r] != x) {
            cout << 0 << endl;
            return 0;
        }
        seiyaku[l][r] = x;
    }
    dp[0][0][0] = 1;
    for (int i = 0; i <= N; i++) {
        for (int j = 0; j <= N; j++) {
            if (i == j && i != 0)
                continue;
            for (int k = 0; k <= N; k++) {
                if ((i == k || j == k) && k != 0)
                    continue;
                int m = max(i, j);
                m = max(m, k);
                for (int n = 0; n < kukan[m].size(); n++) {
                    int x = seiyaku[kukan[m][n]][m];
                    int cur = 0;
                    if (i >= kukan[m][n])
                        cur++;
                    if (j >= kukan[m][n])
                        cur++;
                    if (k >= kukan[m][n])
                        cur++;
                    if (x != cur) {
                        dp[i][j][k] = 0;
                        break;
                    }
                }
                (dp[m + 1][j][k] += dp[i][j][k]) %= mod;
                (dp[i][m + 1][k] += dp[i][j][k]) %= mod;
                (dp[i][j][m + 1] += dp[i][j][k]) %= mod;
            }
        }
    }
    int ans = 0;
    for (int i = 0; i <= N; i++) {
        for (int j = 0; j <= N; j++) {
            if (i == j && i != 0)
                continue;
            for (int k = 0; k <= N; k++) {
                if ((i == k || j == k) && k != 0)
                    continue;
                int m = max(i, j);
                m = max(m, k);
                if (m == N) {
                    (ans += dp[i][j][k]) %= mod;
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 221440
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;

#define ll long long
#define rep(cnt,a,n) for(ll cnt=a;cnt<n+a;cnt++) //aから始めてn回ループ


int main()
{
    ll n;
    cin >> n;
    vector<string> vec(n);
    rep(cnt, 0, n) {
        cin >> vec[cnt];
    }


    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());


        cout << vec.size() << endl;
 

    return 0;
}

Measured memory_bytes: 9600
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;a++)
#define rl(a,b,c) for(int a=b;a>=c;a--)
#define niv vector<int>
#define LL long long
#define IT iterator
#define PB(a) push_back(a)
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
vector<int> a(200001),b(200001);
int finalres=0;
int main(){
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	rb(i,1,n){
		cin>>a[i];
	}
	rb(i,1,n){
		cin>>b[i];
	}
	rb(j,1,29){
		int k=(1<<j);
		k>>=1;
		int MOD_NUM=k<<1;
		vector<int > tmpa,tmpb;
		tmpa=a;
		tmpb=b;
		rb(i,1,n){
			tmpa[i]%=MOD_NUM;
			tmpb[i]%=MOD_NUM;
		}	
		sort(tmpa.begin()+1,tmpa.begin()+1+n);
		sort(tmpb.begin()+1,tmpb.begin()+1+n);
		LL tmpres=0;
		rb(i,1,n){
			vector<int>:: IT ite=lower_bound(tmpb.begin()+1,tmpb.begin()+1+n,k-tmpa[i]);
			if(ite==tmpb.begin()+1+n) continue;
			vector<int>:: IT ite2=lower_bound(tmpb.begin()+1,tmpb.begin()+1+n,2*k-tmpa[i])-1;
			tmpres+=(ite2-ite+1);
		}
		rb(i,1,n){
			vector<int>:: IT ite=lower_bound(tmpb.begin()+1,tmpb.begin()+1+n,3*k-tmpa[i]);
			if(ite==tmpb.begin()+1+n) continue;
			vector<int>:: IT ite2=lower_bound(tmpb.begin()+1,tmpb.begin()+1+n,4*k-tmpa[i])-1;
			tmpres+=(ite2-ite+1);
		}
		if(tmpres&1){
			finalres+=k;
		}
		
	}
	cout<<finalres<<endl;
	return 0;
}

Measured memory_bytes: 3456
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;

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;
}

ll min3(ll a, ll b, ll c){
    if(a < b){
        if(b < c) return a;
        else{
            if(a < c) return a;
            else return c;
        }
    }else{
        if(b < c) return b;
        else return c;
    }
}

int main(){
    ll n,W; cin >> n >> W;
    vl w(n), v(n);
    ll V=0;
    rep(i,n) {
        cin >> w[i] >> v[i];
        V += v[i];
    }
    vvl dp(n+1, vl(V+1,INF));
    dp[0][0] = 0;
    //dp[1][v[0]] = w[0];
    for(ll i=0; i<n; i++){
        for(ll j=0; j<V+1; j++){
            //dp[i+1][v[i]] = w[i];
            if(j-v[i] >= 0) {
                chmin(dp[i+1][j], dp[i][j-v[i]] + w[i]);
            }
            chmin(dp[i+1][j], dp[i][j]);
        }
    }
    ll ans=0;
    rep(j,V+1) {
        if(dp[n][j] <= W) ans = j;
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 80256
int main(){
	int W,H,x,y,r;
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	if((x >= r && x <= W-r) && (y >= r && y <= H-r))
		printf("Yes\n");
	else{
		printf("No\n");
	}
}


Measured memory_bytes: 2124
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int x = scan.nextInt();
		int count=0;
		 while(true) {
		     count = 0;
		for(int i=1;i<=n;i++) {
			for(int j=i+1;j<=n;j++) {
				for(int h=j+1;h<=n;h++) {
					if(x ==i+j+h )count ++;
					//System.out.println(i + " " + j + " " +h);
				}
			}
		}

		System.out.println(count);
		n = scan.nextInt();
		x = scan.nextInt();
		if(n == 0 && x == 0) break;
		}
		scan.close();
	}

}



Measured memory_bytes: 26760
#include<bits/stdc++.h>
#define F first
#define S second
#define ll long long
#define MOD 1000000007

#define fast ios_base::sync_with_stdio(false)
#define itt cin.tie(0)
#define now cout.tie(0)

using namespace std;

ll n,k,ans=0;

int main()
{
	cin>>n>>k;
	for(ll i=k;i<=n;i++)
	{
		ans+=(i*(n-i+1)+1)%MOD;
	}
	ans++;
	ans%=MOD;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
#define MOD 998244353
#define MAX 1000005
#define loop(i,a,b) for(long long int i=a;i<b;i++)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
typedef long long int ll;

using namespace std;
//using namespace boost::multiprecision;

ll prime[MAX];
void sieve()
{
	prime[1] = 1;
	for(ll i=2;i<MAX;i++)
	if(prime[i]==0)
	for(ll j=i;j<MAX;j+=i)
	prime[j]=i;
}

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

//sieve();


ll t=1;
//cin>>t;

loop(k,0,t)
{
	ll n,m;
	cin>>n>>m;
	n = n%m;
	cout<<min(abs(n-m),n)<<"\n";
}



return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a;i<(int)b;++i)
int main(){
  char c;cin>>c;
  if(c=='a'||c=='i'||c=='u'||c=='e'||c=='o')cout<<"vowel"<<endl;
  else cout<<"consonant"<<endl;
    return 0;
}

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

using namespace std;

#define FOR(i,a,b)  for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n)    FOR(i,0,n)
#define ALL(a)      a.begin(),a.end()
#define vi          vector<int>
#define vvi         vector<vi>
#define P           pair<int,int>
#define vP          vector<P>
#define vvP         vector<vP>

int main(){
    string s;cin>>s;
    cout<<"2018";
    REP(i,s.length()-4){
        cout<<s[i+4];
    }
    cout<<"\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int n, a[300000];
int main(void){
    // Your code here!
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = n - 1; i >= 0; i -= 2) {
        cout << a[i] << ' ';
    }
    for (int i = n % 2; i < n; i += 2) {
        cout << a[i] << ' ';
    }
}


Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	ll t;
	t=1;
	while(t--){
		string s;
		cin>>s;
		ll len=s.length();
		ll p;
		cin>>p;
		
		if(s[0]!=s[len-1]){
			ll count=0;
			for(ll i=1;i<len;i++){
				if(s[i]==s[i-1]){
					count++;
					i++;
				}
			}
			cout<<count*p<<endl;
		}
		else{
			ll start=0,end=len-1;
			for(ll i=1;i<len;i++){
				if(s[i]==s[i-1]){
					start++;
				}
				else break;
			}
			
			for(ll i=end-1;i>=0;i--){
				if(s[i]==s[i+1]){
					end--;
				}
				else break;
			}
			
			//cout<<start<<" "<<end<<endl;
			if(end<=start){//string with same characters
				cout<<(len*p)/2<<endl;
			}
			else{
				ll ans=0;
				ans=ans+((start+1)/2);
				ans+=((len-end)/2);
				
				ll cc=0;
				for(ll i=start+2;i<=end-1;i++){
					if(s[i]==s[i-1]){
						cc++;
						i++;
					}
				}
				
				ll ppp=(start+1+len-end)/2;
				ppp*=(p-1);
				ppp+=(cc*p);
				ppp+=ans;
				cout<<ppp<<endl;
				
			}
		}
		
		
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include <algorithm>
#include<stdlib.h>
#include<string.h>

#include<math.h>

using namespace std;
int main(){
  int a,b;
  int add,sub,mul;
  vector<int> ret;
  cin >> a >> b;
  
  ret.push_back(a + b);
  ret.push_back(a - b);
  ret.push_back(a * b);
  
  sort(ret.begin(),ret.end(),greater<int>());

  cout << ret[0] << endl;
  return 0;
}


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

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	int h, w;
	cin >> h >> w;

	vector<vector<int>> a(h, vector<int>(w));
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> a[i][j];
		}
	}

	vector<pair<pair<int, int>, pair<int, int>>> ans;
	for (int i = 0; i < h - 1; i++) {
		for (int j = 0; j < w; j++) {
			if ((a[i][j] % 2) == 0) {
				continue;
			}

			ans.push_back({
				{i + 1, j + 1},
				{i + 2, j + 1}
			});
			a[i + 1][j]++;
		}
	}

	for (int j = 0; j < w - 1; j++) {
		if ((a[h - 1][j] % 2) == 0) {
			continue;
		}
		ans.push_back({
			{h, j + 1},
			{h, j + 2}
		});
		a[h - 1][j + 1]++;
	}

	cout << ans.size() << endl;
	for (auto e : ans) {
		cout << e.first.first << " " << e.first.second << " ";
		cout << e.second.first << " " << e.second.second << endl;
	}
	return 0;
}


Measured memory_bytes: 5236
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int main() {
    string s;
    cin >> s;
    int l = s.size();
    int cnt0 = 0, cnt1 = 0;
    int ans = 0;
    rep(i, l) {
        if(s[i] == '0') cnt0++;
        else cnt1++;
    }
    ans = min(cnt0, cnt1) * 2;
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
def doubling_numpy():
    import numpy as np
    N, K = map(int, input().split())
    D = K.bit_length()
    U = N + 1
    dbl = np.zeros((D, U), dtype=np.int64)
    dbl[0, 1:] = np.array(input().split(), dtype=np.int64)

    for d in range(D - 1):
        dbl[d+1] = dbl[d, dbl[d]]

    v = 1
    for i in reversed(range(D)):
        if K & (1 << i):
            v = dbl[i, v]
    print(v)


if __name__ == "__main__":
    doubling_numpy()

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

using namespace std;

typedef long long ll;

int main() {
	#ifdef HOME
	freopen("input.txt", "rt", stdin);
	#endif  //  HOME
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	vector <ll> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int ans = -228;
	ll cur = 1e18;
	for (int x = -100; x <= 100; x++) {
		ll sum = 0;
		for (int i = 0; i < n; i++) {
			sum += (a[i] - x) * (a[i] - x);
		}
		if (cur > sum) {
			cur = sum;
			ans = x;
		}
	}
	cout << cur;
	return 0;
}

Measured memory_bytes: 256
import Data.Vector hiding (map)

main = do
  [a,b] <- map read.words <$> getLine :: IO [Integer]
  print $ solve a b

solve a b = bi 0 $ inner 0
  where
  inner 40 = []
  inner 0
    | even d = (a + d`div`2`mod`2) `mod` 2 : inner 1
    | otherwise = (d`div`2`mod`2+1)`mod` 2 : inner 1
    where
    d = b - a
  inner k = (be + en) `mod` 2 : inner (k+1)
    where
    be = min (pow2 (k+1) - a `mod` pow2 (k+1)) (pow2 k)
    en = max (b `mod` pow2 (k+1) - pow2 k + 1) 0

bi _ [] = 0
bi k (x:xs) = x * pow2 k + bi (k+1) xs

pow2 = unsafeIndex ( fromListN 42 $ iterate (*2) 1 )

infixl 4 -|
a -| b
  | a-b < 0 = 0
  | otherwise = a-b

Measured memory_bytes: 508
int a[200010];
int ans[200010];
int main(){
  int n;
  scanf("%d",&n);
  for(int i=2;i<=n;i++) 
    scanf("%d",&a[i]);
  for(int i=2;i<=n;i++)
    ans[a[i]]++;
  for(int i=1;i<=n;i++)
    printf("%d\n",ans[i]);
}

Measured memory_bytes: 3224
/****************************************************
*   Template for coding contests                    *
*   Author    :    Sanjeev Sharma                   *
*   Email     :    thedevelopersanjeev@gmail.com    *
*****************************************************/
#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("no-stack-protector,fast-math")
#pragma GCC target ("sse4")
#pragma comment(linker, "/stack:200000000")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

#define deb(x) cout << #x << " is " << x << "\n";

using namespace std;
using namespace __gnu_pbds;

const double PI = 2 * acos(0.0);
const long long INF = 1e18L + 5;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	long long a, b;
	cin >>a >>b;
	for(long long i = 1; i <= 1e4; i++) {
		long long x = i * 0.08;
		long long y = i * 0.10;
		if(x == a && y == b) {
			cout <<i;
			return 0;
		}
	}
	cout <<"-1";
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>


using namespace std;

#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 REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define INF64 1999999999999999999
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007


ll n;

int main() {
	cin >> n;
	for(ll a = 1; a <= 3500; a++) {
		for (ll b = 1; b <= 3500; b++) {
			if (4 * a * b - a * n - b * n > 0) {
				if ((a * b * n) % (4 * a * b - a * n - b * n) == 0) {
					ll c = (a * b * n) / (4 * a * b - a * n - b * n);
					if (c > 0) {
						cout << a << " " << b << " " << c << endl;
						return 0;
					}
				}
			}
		}
	}
}


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

int main(){
    int time[3][6];
    int inepoch[3];
    int outepoch[3];
    int stayepoch[3];

    for(int i=0; i<3; i++){
        cin >> time[i][0] >> time[i][1] >> time[i][2] >> time[i][3] >> time[i][4] >> time[i][5];
    }

    for(int i=0; i<3; i++){
        inepoch[i] = time[i][0]*3600 + time[i][1]*60 + time[i][2];
        outepoch[i] = time[i][3]*3600 + time[i][4]*60 + time[i][5];
        stayepoch[i] = outepoch[i] - inepoch[i];
    }

    for(int i=0; i<3; i++){
        cout << stayepoch[i]/3600 << " ";
        cout << (stayepoch[i]%3600)/60 << " ";
        cout << ((stayepoch[i]%3600)%60) << endl;
    }
    return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define SIZE 10

using namespace std;
typedef long long ll;


vector<pair<ll,int>> prime_factorization(ll N){
	ll i,j;
	ll ex;
	vector<pair<ll,int>> ret;

	for(i=2;i*i<=N;i++){
		if(N%i!=0) continue;
		ex=0;

		while(N%i==0){
			ex++;
			N/=i;
		}

		ret.emplace_back(i,ex);
	}

	if(N!=1) ret.emplace_back(N,1);

	return ret;
}


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

	int i,j;
	int index;
	int power=1;
	int counter=0;

	ll N;
	ll tmp;
	vector<pair<ll,int>> pf;

	cin >> N;

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

	pf=prime_factorization(N);
	
	for(auto p:pf){
		int x=p.second;
		int b=1;
		
		while(b<=x){
			x-=b;
			b++;
			counter++;
		}
	}

	cout << counter << endl;

	return 0;
}


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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

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

    vector<double> A(N);

    double ans = 0;
    REP(i, N){
        cin >> A[i];
        ans += 1 / A[i];
    }
    cout << 1/ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
	
	int a, b;

	while (true) {
		cin >> a >> b;
		if (a == 0 && b == 0) break;

		if (a < b) cout << a << " " << b << endl;
		else cout << b << " " << a << endl;
	}
	
	return 0;
}


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

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

const int MOD = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;

int main()
{
	#ifndef ONLINE_JUDGE
	freopen(".in.txt", "r", stdin);
	freopen(".out.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n; cin >> n;
	vector<int> d1(n), d2(n);
	for(int i = 0; i < n; i++)
	{
		ll x, y; cin >> x >> y;
		d1[i] = x + y;
		d2[i] = x - y;
	}
	sort(d1.begin(), d1.end());
	sort(d2.begin(), d2.end());
	cout << max(d1[n - 1] - d1[0], d2[n - 1] - d2[0]);

	return 0;
}


Measured memory_bytes: 4768
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char **argv) {
  int N;
  cin >> N;
  vector<int> p;
  p.resize(N);
  for (int i = 0; i < N; ++i) {
    cin >> p[i];
  }
  sort(p.begin(), p.end());
  int ans = 0;
  for (int i = 0; i < N - 1; i++) {
    ans += p[i];
  }
  ans += p.back() / 2;
  cout << ans << endl;
  return 0;
}

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

int main() {
	string S;
	cin >> S;
	string T=S;
	for(int i=0; i<T.size(); ++i){
	    if(T[i]<'e'){
	        if(T[i]=='b') T[i] += 2;
	        else T[i] -= 2;
	    }else{
	        if(T[i]=='p') ++T[i];
	        else --T[i];
	    }
	}
	reverse(T.begin(), T.end());
	if(T==S) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


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

int main(){
    int a,b;
    cin >> a >> b;
    if (a == b){
        cout << "Yay!";
    }
    if (a>b){
        if (a<=8){
            cout << "Yay!";
        }
        else {
            cout << ":(";
        }
    }
    if (a<b){
        if (b<=8){
            cout << "Yay!";
        }
        else {
            cout << ":(";
        }
    }
}

Measured memory_bytes: 256
N,Y=map(int,input().split())

if Y < N*1000 or Y>N*10000:
  print(-1,-1,-1)
else:
  for i in range(N+1):
    for j in range(N-i+1):
      if 1000*i + 5000*j+ 10000*(N-i-j)==Y:
        print(N-i-j,j,i)
        exit(0)
  print(-1,-1,-1)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define pb push_back
#define ALL(v) v.begin(),v.end()
const long long INF = 1LL << 60; // 仮想的な無限大の値;
using namespace std;
using ll = long long;
using P = pair<int, int>;
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; }
using Graph = vector<vector<int>>;
//Not Divisible
int main()
{
    int MAX = -1;
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N){
       cin >> A[i]; 
       chmax(MAX, A[i]);
    }
    vector<int> is_prime(MAX, 1);
    is_prime[0] = 0, is_prime[1] = 0;
    for (int i = 2; i < MAX; ++i) {
        if (!is_prime[i]) continue;
        for (int j = i*2; j < MAX; j += i) is_prime[j] = 0;
    }

    vector<int> s(MAX+5, 0);
    rep(i, N)
    {
        for(int j = 1 ; A[i]*j <= MAX; ++j)
        {
            //if(!is_prime[j]) continue;
            s[A[i]*j]++;
        }
    }
    int ans = 0;
    rep(i, N)
    {
        if(s[A[i]] <=1)
        {
            //cout << A[i] << endl;
            ++ans;
        } 
        
    }
    cout << ans << endl;

    return 0;
}
#if 0
int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    sort(ALL(A));
    reverse(ALL(A));
    //rep(i, N) cout << A[i] << " ";
    int cnt = 0;
    rep(i, N-1)
    {
        bool b = true;
        rep2(j, i+1, N)
        {
            if(A[i]%A[j] == 0){
                b = false;
                //cout << i << "," << j << endl;
                break;
            }
        } 
        if(b) cnt++;
    }
    bool b = true;
    rep(i, N-1)
    {
        if(A[N-1]%A[i] == 0){
            b = false;break;
        }
    }
    if(b) cnt++;
    cout << cnt << endl;
    return 0;
}
#endif

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

string s;

int solve(string s){
    // cout << "\nstring s: " << s;
    if (s.empty()) return 0;
    if (*s.begin() == s[s.size()  -1]) return solve(s.substr(1, s.size()-2));
    if (*s.begin() != s[s.size() - 1]) return 1 + solve(s.substr(1, s.size()-2));
}

int main(){
    cin >> s;

    cout << solve(s) << endl;

}

Measured memory_bytes: 256
import math
a,b,r=[float(k) for k in input().split()]
S=a*b*math.sin(math.radians(r))/2
L=math.sqrt(a**2+b**2-2*math.cos(math.radians(r))*a*b)+a+b
H=S*2/a
print(S,L,H,sep='\n')



Measured memory_bytes: 5708
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
typedef unsigned int UINT;
using namespace std;


int main(void) {
    int A, B, C, D;
    int Sum = 0;
    cin >> A >> B >> C >> D;
    if (A < B)
        Sum += A;
    else
        Sum += B;
    if (C < D)
        Sum += C;
    else
        Sum += D;

    cout << Sum << endl;
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <iomanip>
using namespace std;
#define MOD int(1e9 + 7)

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

    if(N / 100 == 7 || (N % 100) / 10 == 7 || (N % 10) == 7)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long long ll;

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

#define MAX 210000
int V;
vector<int> G[MAX];
vector<ll> w;

void prop(int cur,int prev) {
  rep(i,(int)G[cur].size()) {
    int &nex = G[cur][i];
    if( nex == prev ) continue;
    w[nex] += w[cur];
    prop(nex,cur);
  }
}

int main() {
  int Q,s,t;
  cin >> V >> Q;
  rep(i,V-1) {
    cin >> s >> t;
    --s, --t;
    G[s].push_back(t);
    G[t].push_back(s);
  }
  w.resize(V);
  rep(i,V) w[i] = 0;
  int p;
  ll x;
  rep(_,Q) {
    cin >> p >> x;
    --p;
    w[p] += x;
  }
  prop(0,-1);
  rep(i,V) {
    if( i ) printf(" ");
    cout << w[i];
  } puts("");
  return 0;
}


Measured memory_bytes: 30720
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(ll i = 0; i < n; i++)
#define rep2(i,start,end) for(ll i = start; i < end; i++)
#define dwn(i,n) for(int i = n; i >= 0; i--)
#define dwn2(i,start,end) for(ll i = start; i >= end; i--)
#define pll pair<ll,ll>
#define mk(x,y) make_pair(x,y)
#define pdl pair<double, ll>
const ll N = 4e5 + 200;
const ll INF = 0x3f3f3f;
const ll mod = 1e9 + 7;


int main(){
	ll r;
	cin>>r;
	cout<<r*r<<endl;
	


	return 0;
}






Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define rep(i,a,b) for(int i=a;i<=b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
#define fastio() ios::sync_with_stdio(0);cin.tie(0);
#define nl "\n"
#define wi(x) cerr << #x << " is " << x << nl
const double eps = 1e-6;

void solve(){
	int n; cin>>n;
	int cnt = 0;
	rep(i,1,n){
		int a; cin>>a;
		if((i&1) && (a&1)) cnt++;
	}
	cout << cnt;
}

int main(){
	fastio()
	
	int T=1;
	//int T; cin>>T;
	while(T--) solve();

	return 0;
}


Measured memory_bytes: 3632
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>

using namespace std;

typedef long long ll;
const ll nmax = 1e9 + 7;
const ll mod = 998244353;
const long long INF = 1e18;
const double PI = 2 * asin(1);

int main(){
  int N, U, V; cin >> N >> U >> V;
  U--; V--;

  vector <int> graph[N];
  for (int i = 0; i < N - 1; i++){
    int A, B; cin >> A >> B;
    A--; B--;
    graph[A].push_back(B);
    graph[B].push_back(A);
  }
  
  vector <int> distU(N), distV(N);
  queue <int> que; que.push(U);
  vector <bool> visitedU(N), visitedV(N);
  visitedU[U] = true; visitedV[V] = true;
  while (!que.empty()){
    int now = que.front(); que.pop();
    for (int i = 0; i < graph[now].size(); i++){
      int next = graph[now][i];
      if (visitedU[next] == false){
        que.push(next);
        visitedU[next] = true;
        distU[next] = distU[now] + 1;
      }
    }
  }
  que.push(V);
  while (!que.empty()){
    int now = que.front(); que.pop();
    for (int i = 0; i < graph[now].size(); i++){
      int next = graph[now][i];
      if (visitedV[next] == false){
        que.push(next);
        visitedV[next] = true;
        distV[next] = distV[now] + 1;
      }
    }
  }

  vector <bool> can(N);
  for (int i = 0; i < N; i++){
    if (distV[i] >= distV[U] && distU[i] < distV[i]){
      can[i] = true;
    }
  }
  

  int ans = distU[V] / 2;
  for (int i = 0; i < N; i++){
    if (can[i] == true){
      ans = max(ans, distV[i] - 1);
    }
  }
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 6656
#include <cstdio>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <set>

#define rep(i,N) for(int (i)=0;(i)<(N);(i)++)
#define MOD 1000000007

using ll = long long;

using namespace std;

ll pow_mod(ll a, ll b, ll p) {
	if (b == 0)return 1;
	else if (b % 2 == 0)return (pow_mod(a*a, b / 2, p) % p);
	else return (pow_mod(a, b - 1, p)*a%p);
}

ll factorial_mod(ll a, ll p) {
	if (!a)return 1;
	else return a * factorial_mod(a - 1, p) % p;
}

ll sum_digit(ll N) {
	int ans = 0;
	for (; N != 0;) {
		ans += N % 10;
		N /= 10;
	}
	return ans;
}

ll gcd(ll a,ll b) {
	if (!b)return a;
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

int N,K;
ll ans = 0;

int main(){
	scanf("%d %d", &N, &K);
	ans = pow(N / K, 3);
	if(K%2==0) ans += pow((N + K / 2) / K, 3);
	printf("%lld", ans);
	return 0;
}

Measured memory_bytes: 512