akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeSet;

import javax.xml.bind.ParseConversionEvent;

public class Main {

	public static int dfs(int cur, final int N, int[] powers, boolean[][] adj, long block, ArrayList<HashMap<Long, Integer>> memo){
		//System.out.println(Long.toBinaryString(block >> cur) + " " + cur);
		if(memo.get(cur).containsKey(block >> cur)){
			return memo.get(cur).get(block >> cur);
		}
		//System.out.println("=> " + Long.toBinaryString(block >> cur) + " " + cur);
		
		
		long next_block = block;
		
		int ret = 0;
		for(int i = 0; i < N; i++){
			if((block & (1L << i)) == 0 && (cur == i || adj[cur][i])){
				next_block |= (1L << i);
			}
		}
		
		for(int pos = cur + 1; pos < N; pos++){
			if((next_block & (1L << pos)) == 0){
				ret = Math.max(ret, dfs(pos, N, powers, adj, next_block, memo));
			}
		}
		
		memo.get(cur).put(block >> cur, ret + powers[cur]);
		return ret + powers[cur];
	}
	
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);

		while(true){
			final int N = sc.nextInt();
			
			if(N == 0){
				break;
			}
			
			System.gc();
			
			String[] names = new String[N];
			int[] powers = new int[N];
			int[] adjusts = new int[N];
			String[][] ad_names = new String[N][];
			
			Map<String, Integer> map = new HashMap<String, Integer>();
			
			for(int i = 0; i < N; i++){
				names[i] = sc.next();
				map.put(names[i], i);
				powers[i] = sc.nextInt();
				adjusts[i] = sc.nextInt();
				ad_names[i] = new String[adjusts[i]];
				for(int j = 0; j < adjusts[i]; j++){
					ad_names[i][j] = sc.next();
				}
			}
			
			boolean[][] adj = new boolean[N][N];
			for(int i = 0; i < N; i++){
				for(int j = 0; j < adjusts[i]; j++){
					adj[i][map.get(ad_names[i][j])] = true;
				}
			}
			
			ArrayList<HashMap<Long, Integer>> maps = new ArrayList<HashMap<Long,Integer>>();
			for(int i = 0; i < N; i++){
				maps.add(new HashMap<Long, Integer>());
			}
			
			System.out.println(dfs(0, N, powers, adj, 0L, maps));
		}

	}

}

Measured memory_bytes: 76780
#include <bits/stdc++.h>
using namespace std;
const int maxn=100007;
int gcd(int a,int b){
    return b==0?a:gcd(b,a%b);
}
typedef  long long ll;
int sum1[maxn],sum2[maxn],a[maxn];
int main(){
    int ans=0;
    int n;cin>>n;for(int i=1;i<=n;i++) cin>>a[i];
    for(int i=1;i<=n;i++) if(a[i]<0) ans++;
    if(ans%2==0){
        ll tot=0;
        for(int i=1;i<=n;i++) tot+=abs(a[i]);cout<<tot;
    }
    else{
        ll mn=-(1LL<<60),tot=0;
        for(int i=1;i<=n;i++) {tot+=abs(a[i]);mn=max(mn,-1LL*abs(a[i]));}
        tot+=2*mn;cout<<tot;
    }

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int dp[3001][3001]={0};

int main(){
    string s,t;
    int a,b,i,j;
    cin >> s >> t;
    a = s.length();
    b = t.length();

    for(i=1;i<=a;i++){
        for(j=1;j<=b;j++){
            if(s[i-1]==t[j-1]){
                dp[i][j] = 1 + dp[i-1][j-1];
            }
            else{
                dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
            }
        }
    }
    
    string ans = "";
    i = a;j = b;

    while(i > 0 && j > 0){
        if(dp[i][j]==dp[i-1][j]){
            i--;
        }
        else if(dp[i][j]==dp[i][j-1]){
            j--;
        }
        else{
            ans = s[i-1] + ans;
            i--;
            j--;
        }
    }

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

Measured memory_bytes: 35456
#define _LIBCPP_DEBUG 0
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1e9 + 7;

int main() {

    string S; cin>>S;
    int cnt=0;
    for (int i = 0; i < S.length()/2; ++i) {
        if(S[i]!=S[S.length()-1-i]) cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef pair<ll,ll> pll;
vector<ll> a,b,x,y;
const int L = 29;
int n;
ll f(ll val)
{
	int i,j=n-1;
	ll res=0ll;
	for(i=0;i<n;i++)
	{
		ll left = val - x[i];
	//	int id = lower_bound(y.begin(),y.end(),left) - y.begin() - 1;
	//	if(id>=0)	res+=(ll)(id+1ll);
		while(j>=0&&x[i]+y[j]>=val)	j--;
		if(j>=0)	res += (ll)(j+1);	
	}
	return res;	
}
ll cnt(int L,int R)
{
	ll res = 0ll;
	int i,l=0,r=0;
	for(i=n-1;i>=0;i--)
	{
		while(r<n&&x[i]+y[r]<R)	r++;
		while(l<n&&x[i]+y[l]<L)	l++;
		res += (r-l);
	}
	return res;
}
bool solve(int t)
{
	ll b = 1ll<<t;
	return (cnt(b,b<<1)+cnt(3*b,b<<2))&1;
}
int main()
{
	int i,j;
	scanf("%d",&n);
	a.resize(n);b.resize(n);x.resize(n);y.resize(n);
	ll ans = 0ll,res;
	for(i=0;i<n;i++)	scanf("%lld",&a[i]);
	for(i=0;i<n;i++)	scanf("%lld",&b[i]);
	for(i=0;i<L;i++)
	{
		for(j=0;j<n;j++)
		{
			x[j] = a[j] % (1ll<<(i+1));
			y[j] = b[j] % (1ll<<(i+1));	
		}
		sort(x.begin(),x.end());sort(y.begin(),y.end());
		ans += solve(i)<<i;
	//	res = f(4ll*(1ll<<i)) - f(3ll*(1ll<<i)) + f(2ll*(1ll<<i)) - f(1ll<<i);
	//	if(res%2ll==1ll)	ans += (1ll<<i);
	}
	printf("%lld",ans);
}


Measured memory_bytes: 9480
<?php


[$S] = fscanf(STDIN, "%s");
[$T] = fscanf(STDIN, "%s");
$Slen = strlen($S);
$Tlen = strlen($T);
$S = str_split($S);
$T = str_split($T);

$max = PHP_INT_MAX;
for($i=0;$i<=$Slen - $Tlen;$i++){
    $now = 0;
    for($j=0;$j<$Tlen;$j++){
        if($S[$i+$j] !== $T[$j]){
            $now++;
        }
    }
    $max = min($max, $now);
}
echo $max;

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

int n, m, x, y;
vector <int> V[100010];
int dp[100010];
int indegree[100010];

void dfs(int poz)
{
    for (auto e : V[poz]) {
        dp[e]=max(dp[e], dp[poz] + 1);
        indegree[e]--;
        if (indegree[e] == 0) dfs(e);
    }
}

int main()
{
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        cin >> x >> y;
        V[x].push_back(y);
        indegree[y]++;
    }

    for (int i = 1; i <= n; i++){
        if (indegree[i] == 0 && dp[i] == 0) {dp[i] = 1; dfs(i);}
    }

    cout << *max_element(dp,dp+n+1)-1;
}


Measured memory_bytes: 14584
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
constexpr ll mod = 1e9+7;
int main(){
    ll N;
    cin >> N;
    vector<ll> A(N), num(N+1, 0);
    rep(i, 0, N) cin >> A[i];
    ll ans = 1;
    num[0] = 3;
    rep(i, 0, N){
        ans *= num[A[i]];
        num[A[i]]--;
        num[A[i]+1]++;
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
/*
 * ABC100_B.cpp
 *
 *  Created on: Jun 21, 2018
 *      Author: 13743
 */

#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<cstring>
using namespace std;
typedef long long lng;
typedef unsigned long long ulng;

#define pb push_back
#define SZ(a) int((a).size())
#define ALL(a) (a).begin(), (a).end()
#define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
#define FORD(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) FOR(i,0,n-1)
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())

lng power(lng b, lng e) {lng sol=1; while(e>0) {if(e&1) {sol=sol*b;} e>>=1; b*= b;} return sol;}



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

	int d, n;
	cin >> d >> n;

	if(d == 0) {
		if(n == 100) {
					cout << 101 << endl;
				}
				else {
				cout << n << endl;
				}
	}
	else if(d == 1) {
		if(n == 100) {
			cout << 10100 << endl;
		}
		else {
		cout << 100 * n  << endl;
		}
	}
	else {
		if(n == 100) {
			cout << 1010000 << endl;
		}
		else {
			cout << 10000 * n << endl;
		}
	}
}





Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#define all(c) (c).begin(),(c).end()
using namespace std;

int count(int bits){
  bits=(bits&0x55555555)+(bits>>1&0x55555555);
  bits=(bits&0x33333333)+(bits>>2&0x33333333);
  bits=(((bits>>4)+bits)&0x0f0f0f0f);
  bits+=bits>>8;
  return (bits+(bits>>16))&0xff;
}

int dp[32][(1<<16)];

int main(void){

  int n,c,in;
  while(cin >> n >> c,n|c){
    vector<int>l(n),p(c);
    fill(all(l),0);
    fill(all(p),0);
    for(int i=0;i<n;i++){
      for(int j=0;j<16;j++){
	cin >> in;
	l[i]|=in<<j;
      }
    }
    
    for(int i=0;i<c;i++){
      for(int j=0;j<16;j++){
	cin >> in;
	p[i]|=in<<j;
      }
    }
    
    fill(dp[0],dp[32],-1);
    dp[0][0]=0;
    for(int i=0;i<n;i++){
      for(int S=0;S<(1<<16);S++){
	if(dp[i][S]<0)continue;
	int now=l[i]|S;
	for(int j=0;j<c;j++){
	  int nx=now&~p[j];
	  dp[i+1][nx]=max(dp[i+1][nx],dp[i][S]+count(now&p[j]));
	}
      }
    }
    int ans=0;
    for(int i=0;i<(1<<16);i++)ans=max(ans,dp[n][i]);
    cout << ans << endl;
  }
  return 0;
}

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

typedef ostringstream OSS; typedef istringstream ISS;
typedef long long LL;
typedef pair<int, int> PII;  typedef pair<LL, LL> PLL;
typedef vector<int>    VI;   typedef vector<VI>   VVI;   typedef vector<VVI>   VVVI;
typedef vector<LL>     VLL;  typedef vector<VLL>  VVLL;  typedef vector<VVLL>  VVVLL;
typedef vector<double> VD;   typedef vector<VD>   VVD;   typedef vector<VVD>   VVVD;
typedef vector<string> VS;   typedef vector<VS>   VVS;   typedef vector<VVS>   VVVS;
typedef vector<bool>   VB;   typedef vector<VB>   VVB;   typedef vector<VVB>   VVVB;
typedef vector<PII>    VPII; typedef vector<VPII> VVPII; typedef vector<VVPII> VVVPII;
typedef vector<PLL>    VPLL; typedef vector<VPLL> VVPLL; typedef vector<VVPLL> VVVPLL;

typedef unsigned int  UI;
typedef vector<UI>    VUI;
typedef vector<VUI>   VVUI;

#define fst first
#define snd second
// #define Y first
// #define X second
#define MP make_pair
#define PB push_back
#define EB emplace_back 
#define ALL(x)  (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define RANGEBOX(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
#define RANGE(x, l, r) ((l) <= (x) && (x) <= (r))
#define rep(i, N)  for (int i = 0; i < (int)(N); i++)
#define rrep(i, N) for (int i = N - 1; i >= 0; i--)
#define REP(i, init, N)  for (int i = (init); i < (int)(N); i++)
#define RREP(i, N, last) for (int i = (init - 1); i >= last; i--)
#define MAXUD(orig, target) orig = max(orig, target)
#define MINUD(orig, target) orig = min(orig, target)
#define DUMP(x) cerr << #x << " = " << (x) << endl

template < typename T > inline T fromString(const string &s) { T res; ISS iss(s); iss >> res; return res; };
template < typename T > inline string toString(const T &a)   { OSS oss; oss << a; return oss.str(); };

template<typename T=int> inline void dump(vector<T> vs, bool ent=false) { rep(i, vs.size()) cout << vs[i] << (i+1==vs.size() ? '\n' : ' '); if (ent) cout << endl; }
template<typename T = int> inline void dump(vector<vector<T>> vs, bool ent=false) { rep(i, vs.size()) dump<T>(vs[i]); if (ent) cout << endl; }

const int    INF  = 0x3f3f3f3f;
const LL     INFL = 0x3f3f3f3f3f3f3f3fLL;
const double DINF = 0x3f3f3f3f;
const int    DX[] = {1,  0, -1, 0};
const int    DY[] = {0, -1,  0, 1};
const double EPS  = 1e-12;
// const double PI   = acos(-1.0);

template<typename T = int> inline T in() { T x; cin >> x; return x; }
template<typename T = int> inline vector<T> in(int n) { vector<T> xs(n); rep(i, n) cin >> xs[i]; return xs; }
template<typename T = int> inline vector<vector<T>> in(int n, int m) { vector<vector<T>> xs(n, vector<T>(m)); rep(i, n) rep(j, m) cin >> xs[i][j]; return xs; }

const LL AMAX = 1000 * 1000 * 1000 + 10;

int main(void) {
    int N = in();
    VI as = in(N);

    VI bs(as);
    sort(ALL(bs));

    int cnt = 0;
    rep(i, N) {
        int a = as[i];
        int j = lower_bound(ALL(bs), a) - bs.begin();
        cnt += abs(i - j) % 2;
    }

    cout << cnt / 2 << endl;

    

    return 0;
}



Measured memory_bytes: 1152
#include<bits/stdc++.h>
    using namespace std;
    #define mod 1000000007
    int main()
    {
        ios_base::sync_with_stdio(false); 
        cin.tie(NULL); 
        
        long long int n;
        cin >> n;
        long long int   a=1;
        long long int  b=1;
        long long int c=1;
        for(long long int  i=1;i<=n;i++)
        {
            a=  (a   * 10 )%mod;
            b= (b * 9)%mod;
            c= (c* 8)%mod;
        }
      int x=2*b;
       cout<<(a+ (c-(x)%mod +mod) +mod)%mod;
    }

Measured memory_bytes: 3644
package main

import (
	"fmt"
	"sort"
)

func main() {
	var s string
	var k int
	fmt.Scan(&s, &k)

	l := make([]string, 0)
	m := make(map[string]bool)
	for i := 0; i < len(s); i++ {
		for j := i + 1; j <= len(s); j++ {
			if str := s[i:j]; j-i <= 5 && !m[str] {
				l = append(l, str)
				m[str] = true
			}
		}
	}
	sort.Strings(l)
	fmt.Println(l[k-1])
}

/*
func main() {
	var s string
	var k int
	fmt.Scan(&s, &k)

	prev_min_char := byte('Z')
	for {
		min_char := byte('z')

		for i := 0; i < len(s); i++ {
			if s[i] < min_char && s[i] > prev_min_char {
				min_char = s[i]
			}
		}

		m := make(map[string]bool)
		l := make([]string, 0)
		for i := 0; i < len(s); i++ {
			if s[i] == min_char {
				for j := i + 1; j <= len(s); j++ {
					str := s[i:j]
					if m[str] == false {
						l = append(l, str)
						m[str] = true
					}
				}
			}
		}

		if len(l) >= k {
			sort.Strings(l)
			fmt.Println(l[k-1])
			break
		} else {
			k -= len(l)
			prev_min_char = min_char
		}
	}
}
*/


Measured memory_bytes: 3072
///******* In the name of Allah *******///

#include <bits/stdc++.h>
using namespace std;

//long int ar[90013],br[100013];
//long int gcd(long int a, long int b)
//{
//    if(b==0)
//        return a;
//    return gcd(b,a%b);
//}
//long int sieve(long long int a)
//{
//    //long long int i,j,k = 0;
//    memset(ar,0,sizeof(ar));
//    ar[1] = 1;
//    for(i=2; i<=90013; i++)
//    {
//        if(ar[i]==0)
//        {
//            k++;
//            br[k] = i;
//            for(j=i+i; j<=90013; j+=i)
//            {
//                ar[j] = 1;
//            }
//        }
//    }
//    return br[a];
//}

void Ok()
{
    long int a,b,c,d,h,t,i,j,k,l,m,n;
    //long int ans_1,ans_2,ans_3,cnt = 0,Max,Min,flag = 1,temp,sum = 0;
    double aa,bb,cc,dd,ee,ff,gg;
    //char aaa[10013],bbb[10013],ccc[113],ddd;
    string spc,in;

    scanf("%ld",&a);
    aa = a;
    bb = 2 * 3.1416 * aa;
    printf("%0.2lf",bb);

    return;
}

int main()
{
    Ok();

    return 0;
}


Measured memory_bytes: 3812
#include<stdio.h>

int a[100000],n;

int binarySearch(int key){
    int left,right,mid;

    left=0;
    right=n;

    while(right>left){
        mid=(left+right)/2;
        if(a[mid]==key)return 1;
        else if(a[mid]>key)right=mid;
        else left=mid+1;
    }
    return 0;
}

int main(){
    int q,key,sum=0;
    scanf("%d",&n);

    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
    }

    scanf("%d",&q);

    for(int i=0;i<q;i++){
        scanf("%d",&key);
        if(binarySearch(key))sum++;
    }
    printf("%d\n",sum);
    return 0;
}


Measured memory_bytes: 3092
using System;

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(' ');
        var num1 = Convert.ToInt32(input[0]);
        var num2 = Convert.ToInt32(input[1]);

        if ((num1 * num2) % 2 == 0) Console.WriteLine("Even");
        else Console.WriteLine("Odd");
    }
}

Measured memory_bytes: 11220
n,p = [int(x) for x in input().split()]

ans = 1
for i in range(2, int(p**0.5) + 1):
    x = 0
    while p % i == 0:
        p //= i
        x += 1
    ans *= i ** (x//n)
if n == 1:
    ans *= p
print(ans)

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

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<double, double> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<string> &o) {
    string a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;


int main() {
    ll a, b, c;
    cin >> a >> b >> c;

    if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) {
        cout << 0 << endl;
        ret();
    }

    vector<ll> abc = {a, b, c};
    sort(abc.begin(), abc.end());
    ll k = abc[0] * abc[1] * (abc[2] / 2);
    ll l = a * b * c - k;

    ll now = abs(l - k);
    cout << now << endl;

}


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

int main() {
  long double N;
  cin >> N;
  vector<long double> V(N);
  for (int i = 0; i < N; i++)
    cin >> V.at(i);
  
  long double k = 0;
  for (int j = 0; j < N; j++)
    k += 1/V.at(j);
  
  cout << fixed << setprecision(16);
  cout << 1/k << endl;
}
  


Measured memory_bytes: 3800
def prime_list(num):
    list = [0]*2 + [1]*(num - 1)
    prime_list = []
    for i in range(2,num + 1):
        if list[i] == 1:
            for j in range(2, num//i + 1):
                list[i*j] = 0
    for i in range(num + 1):
        if list[i] == 1:
            prime_list.append(i)
    return prime_list

x = int(input())
prime = prime_list(100003)

while x not in prime:
    x += 1

print(x)

Measured memory_bytes: 87636
/*jai_ganeshdeva*/

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pu push  //  adds the value to the last of the queue 
#define lld long long int
#define ins insert /// used in set to insert the values 
#define adv advance  /// used to increment the iterator
#define mp make_pair
#define fi first
#define se second
#define all(c) c.begin(),c.end()
#define PI 3.1415926
#define INF (lld)1e18
#define vl  vector<long long int >
#define vpll vector< pair<lld ,lld> >
#define vvl vector<vector<lld> > 
#define pll pair <lld,lld>
#define modA(cccc,bbbb ,p) (((cccc+bbbb)%p+p)%p)
#define modS(cccc,bbbb ,p) (((cccc-bbbb)%p+p)%p)
#define modM(cccc,bbbb ,p) ((((cccc%p)*(bbbb%p))%p+p)%p)

long long int modp(lld a,lld p,lld n)
{
    lld d[100];
    lld i,j,k,l;
    if(n==0) return 1;
    for(i=0;n>=1;i++)
    {
        d[i]=n%2;
        n/=2;
    }
    l=i;
    long long int e=1;
    if(d[0]==1) e*=(a%p);
    for(i=1;i<l;i++)
    {
        a*=a;
        a=a%p;
        if(d[i]==1) 
        {
            e*=a;
            e=e%p;
        }
    }
    return e%p;
}
lld modInverse(lld n, lld p) 
{ 
    return modp(n, p, p-2); 
}

/*lld fac[100001]; 

void getfac(lld p)
{
    fac[0] = 1; 
    for (lld i=1 ; i<=100000; i++) 
        fac[i] = fac[i-1]*i%p; 
}    

long long int nCrmodp(lld n, lld r,lld p) 
{ 
   // Base case 
   if (r==0) 
      return 1; 
     
    return (fac[n]* modInverse(fac[r], p) % p * 
            modInverse(fac[n-r], p) % p) % p; 
}*/


lld gcd(lld a,lld b)
{
    if(a>b) return gcd(b,a);
    if(b%a==0) return a;
    else return gcd(b%a,a);
}

lld p1=1e9 + 7,p2=998244353;
lld l,r,mid,ans;
lld n,i,j,k,g,m;
lld x,y,n1,n2,h,z,c;
lld aa=1;



void solve()
{
    cin>>n>>m;
    n/= __gcd(n,m);
    cout<<n*m;
    
    
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lld t=1;
    
    //cin>>t;
    //cout<<t;
   //  getfac(p2);
    //check the value by which modulo is to be taken
    lld ans=0;
    for(int i=0;i<t;i++)
    {
   //     cout<<"Case #"<<i+1<<": ";
                  solve();
        cout<<"\n";
    }
    return 0;
}


Measured memory_bytes: 3612
A = []
ans = 0
for _ in range(5):
  a = int(input())
  if a % 10 == 0: ans += a
  else: A.append(a)
if len(A) > 0:
  A.sort(key = lambda x:x%10)
  ans += A[0]
  for a in A[1:]:
    ans += a + 10 - a%10
print(ans)

Measured memory_bytes: 3060
dice = list(map(int, input().split()))
command = str(input())

for c in command:
    if (c == 'S'): ##2651 --> 1265
        dice[1],dice[5],dice[4],dice[0] = dice[0],dice[1],dice[5],dice[4]
    elif(c == 'N'):
        dice[0],dice[1],dice[5],dice[4] = dice[1],dice[5],dice[4],dice[0]
    elif (c == 'W'): ##4631 -- > 1463
        dice[3], dice[5], dice[2],dice[0] = dice[0], dice[3], dice[5], dice[2]
    else:
        dice[0], dice[3], dice[5], dice[2] = dice[3], dice[5], dice[2],dice[0] 
print(dice[0])


Measured memory_bytes: 5600
from collections import defaultdict

N = int(input())

dd = defaultdict(lambda: dict())

for i in range(N):
  k,v = input().split()
  dd[k][i] = (int(v))

sorted_dct = sorted(dict(dd).items(), key=lambda x:x[0])

for k,v in sorted_dct:
  a = sorted(v.items(), key=lambda x: -x[1])
  for k1 in a:
    print(int(k1[0]) + 1)

Measured memory_bytes: 3316
// ~/Remember,remember the 6th of March

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const double PI = acos(-1.0);
const double  EPS = 1e-8;
const ll MOD = 1000000007;
const int N = 100000 + 7;

int n;
ll k;
vector<int>coff,diff;
priority_queue<int>c,d;
ll calc(ll val)
{
    ll temp=k;
    priority_queue<int>cpq=c,dpq=d;
    ll ans=-1;
    while(!cpq.empty())
    {
        ll t1=cpq.top();
        ll t2=dpq.top();
        cpq.pop();
        dpq.pop();
        t2*=-1;
        if(1LL*t1*(1LL*t2)>val)
        {
            ll t3=val/(t2*1LL);
            t3=t1-t3;
            if(t3<=temp)
            {
                temp-=t3;
                t1-=t3;
            }
            else
                return -1;
        }
        ans=max(ans,1LL*t1*(1LL*t2));
    }
    return ans;
}
int main()
{
    scanf("%d%lld",&n,&k);
    coff.resize(n);
    diff.resize(n);
    for(int i=0;i<n;i++)
        scanf("%d",&coff[i]),c.push(coff[i]);
    for(int i=0;i<n;i++)
        scanf("%d",&diff[i]),d.push(diff[i]*-1);
    ll low=0,hi=1e12,mid;
    ll ans=1e13;
    while(low<=hi)
    {
        mid=(low+hi)/2;
        ll temp=calc(mid);
        if(temp!=-1)
        {
            ans=min(ans,temp);
            hi=temp-1;
        }
        else
            low=mid+1;
    }
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 5108
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <ctime>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define fs first
#define sc second
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001

int main() {
    int N; cin >> N;
    vector<int> A(N);
    for(int &a:A)
        cin >> a;

    set<int> S;
    for(int i=0; i<2; i++){
        for(int j=1; j*j<=A[i]; j++){
            if(A[i]%j==0){
                S.insert(j);
                S.insert(A[i]/j);
            }
        }
    }
    
    map<int, int> M;
    for(int s:S){
        for(int j=0; j<N; j++){
            if(A[j]%s==0) M[s]++;
        }
    }
    
    int ans = 0;
    for(auto m:M){
        if(m.sc >= N-1) ans = max(ans, m.fs);
    }
        
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
# AOJ 0087 Strange Mathematical Expression
# Python3 2018.6.14 bal4u

class Stack:
	def __init__(self):
		self.items = []
	def push(self, item):
		self.items.append(item)
	def pop(self):
		return self.items.pop()
	def size(self):
		return len(self.items)

s = Stack()
while True:
	try:
		a = list(input().split())
	except EOFError:
		break

	for token in a:
		if token in ['+','-','*','/']:
			v1, v2 = s.pop(), s.pop()
			if token == '+':
				v2 += v1
			elif token == '-':
				v2 -= v1
			elif token == '*':
				v2 *= v1
			else:
				v2 /= v1
			s.push(v2)
		else:
			s.push(int(token))
	print(s.pop())



Measured memory_bytes: 5608
#include "bits/stdc++.h"
#define rep(i,a,n) for(int i=(a);i<(int)(n);i++)
using namespace std;
typedef long long ll;
struct start { start() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(10);
}; }start;
void in() {}
template <class Head , class... Tail>
void in(Head&& head, Tail&&... tail) {
  cin >> head;
  in(move(tail)...);
}
template <class T>
  void out(T& t) {
  cout << t << '\n';
}
template <class Head , class... Tail>
void out(Head& head , Tail&... tail) {
  cout << head << ' ';
  out(move(tail)...);
}
int main(void) {
  int ans=0;
  string s;
  in(s);
  rep(i,0,s.size()){
    if(s[i]=='+')ans++;
    if(s[i]=='-')ans--;
  }
  out(ans);
  return 0;
}


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

#define mod 1000000007
using ll=long long;

ll modpow(ll n,ll m=mod-2){
  ll r=1;
  while(m){
    r=r*((m%2)?n:1)%mod,n=n*n%mod,m>>=1;
  }
  return r;
}

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

	//これだとオーバーフローする
	ll ans = modpow(10,n)+modpow(8,n)-modpow(9,n)-modpow(9,n);
    ans=ans%mod;
	ans=(ans+mod)%mod;
	cout << ans << endl;
}


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

int main() {

    int a, b, c, x, y;

    cin >> a >> b >> c >> x >> y;

    if(a + b <= c * 2) {
        cout << x * a + y * b << endl;
    } else {
        int ans = c * 2 * min(x, y);
        if(x > y) {
            if((x - y) * a <= c * 2 * (x - y)) ans = c * 2 * y + (x - y) * a;
            else ans = c * 2 * y + c * 2 * (x - y);
        } else {
            if((y - x) * b <= c * 2 * (y - x)) ans = c * 2 * x + (y - x) * b;
            else ans = c * 2 * x + c * 2 * (y - x);
        }
        cout << ans << endl;
    }
}


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

num = [int(i) for i in input().split()]

distance = [0] * N
remain = []

# １つしか訪れないとき
if(N ==1):
    distance[0] = abs(X - num[0])
    print(distance[0])
    exit()

#2つ以上訪れるとき
for i in range(N):
    # 各距離を測る
    distance[i] = abs(X - num[i])

    if(i == 0):
        continue

    #各距離の最大公約数を求める
    a = distance[i-1]
    b = distance[i]
    if(distance[i-1] < distance[i]):
        temp = a
        a = b
        b = temp

    r = a % b
    while(r != 0):
        a = b
        b = r
        r = a % b

    remain.append(b)

print(min(remain))



Measured memory_bytes: 15332
/*
	*	Created By: 'Present_Sir'
	*	Created On: Saturday 29 August 2020 05:40:55 PM IST
*/

#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL)
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define sz(v) ((int)v.size())
#define lgt(s) ((int)s.length())
#define int long long
using namespace std;

const int mod = (int)1e9+7;

const int Mod = 1e9+7;

template <int mod>
struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(long long x_) {
        if ((x = x_ % mod + mod) >= mod) x -= mod;
    }
    ModInt& operator+=(ModInt rhs) {
        if ((x += rhs.x) >= mod) x -= mod;
        return *this;
    }
    ModInt& operator-=(ModInt rhs) {
        if ((x -= rhs.x) < 0) x += mod;
        return *this;
    }
    ModInt& operator*=(ModInt rhs) {
        x = (unsigned long long)x * rhs.x % mod;
        return *this;
    }
    ModInt& operator/=(ModInt rhs) {
        x = (unsigned long long)x * rhs.inv().x % mod;
        return *this;
    }
 
    ModInt operator-() const { return -x < 0 ? mod - x : -x; }
    ModInt operator+(ModInt rhs) const { return ModInt(*this) += rhs; }
    ModInt operator-(ModInt rhs) const { return ModInt(*this) -= rhs; }
    ModInt operator*(ModInt rhs) const { return ModInt(*this) *= rhs; }
    ModInt operator/(ModInt rhs) const { return ModInt(*this) /= rhs; }
    bool operator==(ModInt rhs) const { return x == rhs.x; }
    bool operator!=(ModInt rhs) const { return x != rhs.x; }
    ModInt inv() const { return pow(*this, mod - 2); }
 
    friend ostream& operator<<(ostream& s, ModInt<mod> a) {
        s << a.x;
        return s;
    }
    friend istream& operator>>(istream& s, ModInt<mod>& a) {
        s >> a.x;
        return s;
    }
};
 
using mint = ModInt<Mod>;
int expo(int a, int k){
    if(k == 0){
        return 1;
    }
    int ans = expo( (a*a)%mod, k/2);
    if(k%2 == 1){
        return (ans*a)%mod;
    }
    return ans%mod;
}

class Solver{
    public:
        void test(){
            //int t; cin>>t; for(int i=1; i<=t; ++i)
            {
                //cout<<"Case #"<<i<<": ";
                this->solve();
            }
        }
        void solve(){
            int n;
            cin>>n;
            vector < int > v(n);
            mint sum = 0;
            for(int i=0; i<n; ++i){
                cin>>v[i];
                sum += v[i];
            }
            
            mint ans = 0;
            for(int i=0; i<n; ++i){
                sum -= v[i];
                ans += (sum)*v[i];
            }
            cout<<ans<<endl;
        
        }
};


int32_t main(){
    IOS;
    Solver S;
    S.test();
    return 0;
}



Measured memory_bytes: 4784
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int k,a,b;
  cin >> k >> a >> b;
  int kk = k;
  while(1){
    if(a<=k && k<=b){
      cout << "OK" << "\n";
      return 0;
    }
    else if(k>b) {
      cout << "NG" << "\n";
      return 0;
    }
    else  k += kk;
  }
  return 0;
}


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

int main() {
    long long X, amount_of_500, amount_of_5;
    cin >> X;
    amount_of_500 = X/500*1000;
    amount_of_5 = X%500;
    amount_of_5 = amount_of_5/5*5;
    cout << amount_of_500+amount_of_5;

}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <unordered_map>
using namespace std;
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr start, itr goal){ for(auto i = start; i != goal; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
#define mod long(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl(long(n))
#define fcout cout << fixed << setprecision(10)
#define highest(x) (63 - __builtin_clzl(x))

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    long M;
    cin >> N >> M;
    unordered_map<long, long> sum_mod_M;
    long sum = 0;
    sum_mod_M[0]++;
    for(int i = 0; i < N; i++){
        long A;
        cin >> A;
        sum += A;
        sum %= M;
        sum_mod_M[sum]++;
    }
    long ans = 0;
    for(auto i: sum_mod_M){
        ans += i.second * (i.second - 1) / 2;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3724
#include <stdio.h>
#include<vector>
#include<iostream>
#include<string>
#include<deque>
#include<list>
using namespace std;


int main() {
	vector<int> v[1000];
	int n;
	int q;
	int t, x;
	int query;
	cin >> n;
	cin >> q;

	for (int i = 0; i < q; i++)
	{
		cin >> query;
		switch (query)
		{
		case 0:
			cin >> t >> x;
			v[t].push_back(x);
			break;
		case 1:
			cin >> t;
			
			for (int i = 0; i < v[t].size(); i++)
			{
				if (i != 0)cout << " ";
				cout << v[t][i];
			}
			cout << endl;
			break;
		case 2:
			cin >> t;
			v[t].clear();
			break;

		}
	}


	return 0;
}



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

int main(){
  int N;
  cin >> N;
  vector<string> S(N+1);
  for(int i=0; i<N; i++) cin >> S.at(i);
  S.at(N)="zzzzzzzzzzzz";
  vector<int> num(N);
  vector<string> pop(N);
  sort(S.begin(), S.end());
  int cnt=0;
  int maxc=0;
  int temp=0;
  for(int i=0; i<N; i++){
    if(S.at(i)==S.at(i+1)) cnt++;
    if(S.at(i)!=S.at(i+1)){
      num.at(temp)=cnt;
      pop.at(temp)=S.at(i);
      temp++;
      maxc=max(maxc, cnt);
      cnt=0;
    }
  }
  for(int i=0; i<N; i++){
    if(num.at(i)==maxc) cout << pop.at(i) << endl;
  }
  
}

Measured memory_bytes: 16640
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    set<int> st;
    vP p(N);
    rep(i,N){
        cin >> p[i].first;
        p[i].second=i+1;
    }
    sort(p.begin(),p.end());
    st.insert(0);
    st.insert(N+1);
    ll ans=0;
    rep(i,N){
        auto itr=st.lower_bound(p[i].second);
        ll MX=*itr;
        itr--;
        ll MN=*itr;
        ans+=(MX-p[i].second)*(p[i].second-MN)*(p[i].first);
        st.insert(p[i].second);
        //cerr << ans << endl;
    }
    cout << ans << endl;
}
/*
overflow checked?
corner case checked?
boundary checked?
not TLE in worst case checked?
*/

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

int f(int x){
	int res=0;
	while(x>0){
		res = res + x%10;
		x/=10;
	}
	return res;
}

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

	int ans = INT_MAX;
	for(int i=1;i<n;i++){
		ans = min(ans,f(i)+f(n-i));
	}
	cout<<ans<<endl;
}

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

using namespace std;

int main()
{
    int M, N, a, b;
    int flag_b[200000];
    int flag_e[200000];
    int it_b, it_e;
    int b_size, e_size;
    it_b = it_e = 0;

    cin >> N >> M;

    for (int i = 0; i < M; i++) {
        cin >> a >> b;
        if (a == 1) {
            flag_b[it_b] = b;
            it_b++;
        } else if (b == N) {
            flag_e[it_e] = a;
            it_e++;
        }
    }

    b_size = it_b;
    e_size = it_e;

    sort(flag_b, flag_b + b_size);
    sort(flag_e, flag_e + e_size);

    it_b = 0;
    it_e = 0;
    while (true) {
        //cout << flag_b[it_b] << ' ' << flag_e[it_e] << '\n';
        if (it_b >= b_size || it_e >= e_size) {
            break;
        }

        if ( flag_b[it_b] == flag_e[it_e]) {
            cout << "POSSIBLE\n";
            return 0;
        } else if (flag_b[it_b] < flag_e[it_e]) {
            it_b++;
        } else {
            it_e++;
        }
    }

    cout << "IMPOSSIBLE\n";
    return 0;
}

Measured memory_bytes: 1024
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
import pprint
sys.setrecursionlimit(10 ** 9)


INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007




r1, c1, r2, c2 = LI()

n = r2 + c2 + 2
fac = [1] * (n + 1)
inv = [1] * (n + 1)
for j in range(1, n + 1):
    fac[j] = fac[j-1] * j % mod


inv[n] = pow(fac[n], mod-2, mod)
for j in range(n-1, -1, -1):
    inv[j] = inv[j+1] * (j+1) % mod


def comb(n, r):
    if r > n or n < 0 or r < 0:
        return 0
    return fac[n] * inv[n - r] * inv[r] % mod


print((comb(r2 + c2 + 2, r2 + 1) - comb(c1 + r2 + 1, c1) -
       comb(r1 + c2 + 1, r1) + comb(c1 + r1, r1)) % mod)





Measured memory_bytes: 71916
w = gets.chomp
w_hash = {}

(0..w.size-1).each do |i|
  w_hash.key?(w[i]) ? (w_hash[w[i]] += 1) : (w_hash[w[i]] = 1)
end

w_hash.select{|key,val| val % 2 == 1}.size == 0 ? (puts "Yes") : (puts "No")

Measured memory_bytes: 1788
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) int((a).size())
#define out(a) cout<<(a)<<endl;
const int INF=INT_MAX;
const int MAX = 510000;
const ll MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];


int main(){
  ll h,w,k,cnt=0;cin>>h>>w>>k;
  vector<string> g(h);
  rep(i,0,h){
    cin>>g[i];
  }
  rep(i,0,1<<h){
    rep(j,0,1<<w){
      ll tmp=0;
      rep(a,0,h){
        rep(b,0,w){
          if((i>>a&1)&&(j>>b&1)&&(g[a][b]=='#')){
            tmp++;
          }
        }
      }
      if(tmp==k){cnt++;}
    }
  }
  cout<<cnt<<endl;
}







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

int main(){
 long long N,Money=1000,stock=0;
 cin >> N;
 int i,A[81];
 for(i=1;i<=N;i++) cin >> A[i];
 for(i=1;i<=N;i++){
  Money += stock*A[i];
  stock=0;
  if(i<N && A[i]<A[i+1]){
   stock=Money/A[i];
   Money -= stock*A[i];
  }
 }
 cout << Money << endl;
 return 0;
}

Measured memory_bytes: 3604
N = int(input())
h_l = list(map(int,input().split()))

continious = 0
ans = 0
for i in range(N-1):
    if(h_l[i+1]<=h_l[i]):
        continious += 1
    else:
        ans = max([ans,continious])
        continious = 0

ans = max([ans,continious])
print(ans)




Measured memory_bytes: 14224
use std::io;
use std::cmp;
use std::collections::VecDeque;
use std::collections::HashSet;

fn read_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    buf
}

fn main() {
    let n:usize = read_line().trim().parse().unwrap();
    let mut memo = HashSet::new();

    for i in 0..n {
        let tar:usize = read_line().trim().parse().unwrap();
        if memo.contains(&tar) {
            memo.remove(&tar);
        } else {
            memo.insert(tar);
        }
    }
    println!("{}", memo.len());
}


Measured memory_bytes: 8444
#!/usr/bin/env python
import sys
from collections import Counter
from itertools import permutations, combinations
from fractions import gcd
#from math import gcd
from math import ceil, floor
import bisect
sys.setrecursionlimit(10 ** 6)
inf = float("inf")

def input():
    return sys.stdin.readline()[:-1]

def main():
    S = input()
    print("x" * len(S))

if __name__ == '__main__':
    main()



Measured memory_bytes: 5056
def dfs(v, cnt):
    D[v] = cnt
    cnt += 1
    for c in edge[v]:
        if D[c] == -1:
            cnt = dfs(c, cnt)
    F[v] = cnt
    cnt += 1
    return cnt

V = int(input())
edge = [[] for _ in range(V)]
for _ in range(V):
    u, _, *v = map(lambda x: int(x)-1, input().split())
    edge[u] = sorted(v)
D, F = [-1] * V, [-1] * V
c = 1
for i in range(V):
    if D[i] == -1:
        c = dfs(i, c)
for i, (d, f) in enumerate(zip(D, F)):
    print(i+1, d, f)


Measured memory_bytes: 5664
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n+1];
		int[] b = new int[n+1];
		int count = 0;
		int ans = 0;
		a[0] = 0;
		for (int i = 1; i <= n; i++) a[i] = sc.nextInt();
		for (int i = n; i >= 1; i--) {
			for (int j = 2; j*i <= n; j++) {
				if(b[i*j]==1) count++;
			}
			if(count%2!=a[i]) {
				b[i] = 1;
				ans++;
			}else {
				b[i] = 0;
			}
			count = 0;
		}
		System.out.println(ans);
		for (int i = 1; i <= n; i++) {
			if(b[i] == 1) System.out.printf("%d ",i);
		}
		sc.close();
	}
}

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

int main() {
  int N;
  cin >> N;
  int x[N], y[N], ans = N;
  for ( int i = 0; i < N; i++ ) cin >> x[i] >> y[i];
  int k = 0, dx, dy;
  for ( int j = 0; j < N; j++ ) {
    for ( int i = 0; i < N; i++ ) {
      if ( i == j ) continue;
      dx = x[i] - x[j];
      dy = y[i] - y[j];
      int cnt = 0;
      for ( int l = 0; l < N; l++ ) {
        for ( int m = 0; m < N; m++ ) {
          if ( dx == x[m] - x[l] && dy == y[m] - y[l] ) cnt++; // same vector
        }
      }
      ans = min(ans, N - cnt);
    }
  }

  cout << ans << endl;

}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

int main() {
	int H, W; cin >> H >> W;
	int N; cin >> N;
	vector<vector<int>> res(H, vector<int>(W));
	int ptr_y = 0, ptr_x = 0;
	for (int i = 1; i <= N; ++i) {
		int a; cin >> a;
		while (a--) {
			res[ptr_y][ptr_x] = i;
			if (ptr_y & 1) {
				--ptr_x;
				if (ptr_x == -1) {
					++ptr_x;
					++ptr_y;
				}
			}
			else {
				++ptr_x;
				if (ptr_x == W) {
					--ptr_x;
					++ptr_y;
				}
			}
		}
	}
	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j)
			cout << res[i][j] << " ";
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int n,m,t;
    int c[21],T[21][50001];
    cin>>n>>m;
    for(int i=0;i<m;++i){
        cin>>t;
        c[i]=t;
        for(int j=1;j<=n;++j){
            T[i][0]=0;
            T[0][j]=100000;
        }
    }
    for(int i=1;i<=m;++i){
        for(int j=1;j<=n;++j){
            if(c[i-1]>j){
                T[i][j]=T[i-1][j];
            }
            else{
                T[i][j]=min(T[i-1][j],T[i][j-c[i-1]]+1);
            }
        }
    }
    cout<<T[m][n]<<endl;
}

Measured memory_bytes: 7192
#include<iostream>
#include<cstdio>
#include<iomanip>
using namespace std;

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

	double am, sum=0.0;

	string k;
	for(int i=0; i<N; i++){
      	cin >> am >> k;
		if(k == "JPY")
			sum += am;
		else
			sum += am * 380000.0;
	}
	
  	cout << sum << endl;


	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
int main()
{
int a;
  scanf("%d",&a); 
for(int i=1; i<=9; i++)
  if(a%i==0)
    if((int)((a/i)/10)==0){
      printf("Yes\n");
	  return 0;
    }
  printf("No\n");
return 0;
}

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

namespace AtCoder {
    class Program {
        static void Main() {
            int[] nk = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int[] sunuke = new int[nk[0]];
            for(int i = 0; i < nk[1]; i++) {
                _ = Console.ReadLine();
                int[] a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
                foreach (int ai in a) {
                    sunuke[ai - 1]++;
                }
            }
            Console.WriteLine(sunuke.Count(x => x == 0));
        }
    }
}

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

int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n);
    vector<ll> b(n);
    rep(i, n) cin >> a[i] >> b[i];
    ll ans = 0;
    for(ll i = n - 1; i >= 0; i--) {
        a[i] += ans;
        ll amari = a[i] % b[i];
        if(amari == 0) continue;
        ll tasu = b[i] - amari;
        ans += tasu;
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
	int a, b;
	cin >> a >> b;
	
	if (a < b){
		cout << "a < b" << endl;
	}else if(a > b){
		cout << "a > b" << endl;
	}else{
		cout << "a == b" << endl;
	}
	
	return 0;
}

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

typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=1e18;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)


int main() {
  ll n;
  cin>>n;
  vector<P> v1;
  vector<P> v2;

  rep(i,n){
    string s;
    cin>>s;
    ll m2=0; ll m1=INF;
    ll now=0;
  //  cout<<i<<endl;
    rep(j,s.size()){
      if (s[j]=='('){
        now+=1;
      }
      if (s[j]==')'){
        now-=1;
      }
  //    cout<<now<<' '<<j<<endl;
    //s  m2=max(m2,now);
      m1=min(m1,now);

    }
    if(now>0)v1.push_back(make_pair(m1,now));
    else v2.push_back(make_pair(m1-now,-now));


  //  cout<<m1<<' '<<now<<endl;

  }
//cout<<v1.size()<<endl;
//cout<<v2.size()<<endl;


  sort(v1.begin(),v1.end());
  sort(v2.begin(),v2.end());
  reverse(v1.begin(),v1.end());
  reverse(v2.begin(),v2.end());


  string ans="Yes";
  ll now=0;

 //cout<<v2[0].first;

  rep(i,v1.size()){

    if(now+v1[i].first<0) {
      ans="No";break;
    }

    now+=v1[i].second;
  }
//cout<<now<<endl;
  ll now1=0;
  rep(i,v2.size()){
      if(now1+v2[i].first<0) {
        ans="No";
        break;
      }
      now1+=v2[i].second;
    }

      //cout<<i<<'i'<<now<<endl;

    if (now1!=now)ans="No";
    cout<<ans;

  }


Measured memory_bytes: 18980
n = int(input())
p = list(map(float, input().split()))

dp = [[0] * (n+1) for _ in range(n+1)]
dp[0][0] = 1

for i in range(1,n+1):
    dp[i][0] = dp[i-1][0] * (1- p[i-1])
    for j in range(1,n+1):
        dp[i][j] = (dp[i-1][j] * (1- p[i-1]) +
                    dp[i-1][j-1] * p[i-1])

ans = 0
for i in range((n//2 + 1) , n+1):
    ans += dp[n][i]

print(ans)

Measured memory_bytes: 259976
#include <stdio.h>
#include <stdint.h>
#include <assert.h>
#include <math.h>

static int32_t isPrime(int32_t n) {
    int i;
    double sq = sqrt(n);

    for ( i = 2; i <= (int)sq; i += 1 ) {
        if ( (n % i) == 0 ) {
            return 0;
        }
    }

    return 1;
}

int main(int argc, char* argv[]) {
    int ret;
    int n, i, given;
    int c = 0;

    ret = fscanf(stdin, "%d\n", &n);
    assert( ret == 1 );
    assert( (1 <= n) && (n <= 10000) );

    for ( i = 0; i < n; i++ ) {
        ret = fscanf(stdin, "%d\n", &given);
        assert( ret == 1 );
        c += isPrime(given);
    }

    printf("%d\n", c);

    return 0;
}



Measured memory_bytes: 2044
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;

int main(){
	ios::sync_with_stdio(false);
	int a,b,k;
	cin>>a>>b>>k;
	for(int i=0;i<k;i++){
		if(i%2==0){
			if(a%2==1) a--;
			a/=2;
			b+=a;
		}else{
			if(b%2==1) b--;
			b/=2;
			a+=b;
		}
	}
	cout<<a<<" "<<b;
	return 0;
}


Measured memory_bytes: 256