akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Console {
    static Console instance;
    final BufferedReader reader;

    public static Console getInstance() {
        if (instance == null) {
            instance = new Console();
        }
        return instance;
    }
    
    public Console() {
        reader = new BufferedReader(new InputStreamReader(System.in));
    }

    public int readInt() throws IOException {
        return Integer.parseInt(reader.readLine());
    }

    public int[] readLineNumbers(int n) throws IOException {
        String[] numStrings = reader.readLine().split(" ");
        int[] result = new int[n];
        for (int i = 0;i < n;i++) {
            result[i] = Integer.parseInt(numStrings[i]);
        }
        return result;
    }
    
    public void output(int n) {
        System.out.println(n);
    }
}

public class Main {
    public static void main(String[] args) throws Exception {
        int n = Console.getInstance().readInt();
        int[] S = Console.getInstance().readLineNumbers(n);
        int q = Console.getInstance().readInt();
        int[] T = Console.getInstance().readLineNumbers(q);
        
        int count = 0;
        for (int i = 0;i < q;i++) {
            for (int k = 0;k < n;k++) {
                if (S[k] == T[i]) {
                    count++;
                    break;
                }
            }
        }

        Console.getInstance().output(count);
    }
}

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

int main(){
    long long n;
    cin >> n;
    long long ans = 0;
    for (int i = 1; i <= sqrt(n); i++){
        if (n % i == 0 && n/i > i + 1) ans += n/i - 1;
    }
    cout << ans << endl;
}





Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define REP(i,s,n) for(int i=s; i<(n); ++i)
#define ALL(n) begin(n),end(n)
using ll = long long;
const ll INF = 1e18;
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; }

int main(){
    int A, B;
    cin >> A >> B;
    cout << A * B << endl;

    return 0;
}


Measured memory_bytes: 3632
use proconio::{
    fastout, input,
    marker::{Bytes, Chars, Isize1, Usize1},
};

#[fastout]
fn main() {
    input! {
        mut n:usize,mut x:usize,m:usize,
    }
    let mut v = vec![];
    let mut cycle = 0;
    let mut flag = vec![999999999; m];
    let mut t = 0;
    for i in 0.. {
        if flag[x] != 999999999 {
            t = flag[x];
            break;
        }
        flag[x] = i;
        cycle += x;
        v.push(x);
        x = (x * x) % m;
    }

    dbg!(cycle, v.len());
    let mut cv = vec![];
    for i in t..v.len() {
        cv.push(v[i]);
    }

    let mut ans = 0;

    let mut cv_sum = cv.iter().sum::<usize>();
    let mut ans = 0;

    if v.len() <= n {
        ans += cycle;
        n -= v.len();
    } else {
        println!("{}", v.iter().take(n).sum::<usize>());
        return;
    }

    if *v.last().unwrap() == 0 && n / v.len() >= 1 {
        ans += cv_sum;
    } else {
        ans += cv_sum * (n / cv.len());
    }

    n %= cv.len();
    dbg!(n);
    if *v.last().unwrap() != 0 {
        for i in cv.iter().take(n) {
            ans += *i;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 3636
n=int(input())
nums=list(map(int,input().split()))
#print(nums)
cnt=0
for i in range(1,n-1):
    if nums[i-1]<nums[i] and nums[i]<nums[i+1]:
        cnt+=1

    elif nums[i-1]>nums[i] and nums[i]>nums[i+1]:
        cnt+=1
print(cnt)


Measured memory_bytes: 3060
#include <stdio.h>

int main(void)
{
	int j,i,min=0,N,M,C[12],A[12][12],X,d[12]={0,0,0,0,0,0,0,0,0,0,0,0},z=1,s[12],total=0;
	scanf("%d",&N);
	scanf("%d",&M);
	scanf("%d",&X);
	for(i=0;i<N;i++){
		scanf("%d",&C[i]);
		for(j=0;j<M;j++){
			scanf("%d",&A[i][j]);
			d[j]+=A[i][j];
		}
		min+=C[i];
		z*=2;
	}
	for(j=0;j<M;j++){
		if(d[j]<X){
			printf("-1");
			return 0;
		}
	}
	for(s[0]=0;s[0]<2;s[0]++){
		for(s[1]=0;s[1]<2;s[1]++){
			for(s[2]=0;s[2]<2;s[2]++){
				for(s[3]=0;s[3]<2;s[3]++){
					for(s[4]=0;s[4]<2;s[4]++){
						for(s[5]=0;s[5]<2;s[5]++){
							for(s[6]=0;s[6]<2;s[6]++){
								for(s[7]=0;s[7]<2;s[7]++){
									for(s[8]=0;s[8]<2;s[8]++){
										for(s[9]=0;s[9]<2;s[9]++){
											for(s[10]=0;s[10]<2;s[10]++){
												for(s[11]=0;s[11]<2;s[11]++){
													for(j=0;j<M;j++){
														d[j]=0;
														for(i=0;i<N;i++){
															d[j]+=s[i]*A[i][j];
														}
													}
													for(j=0;j<M;j++){
														if(d[j]<X){
															break;
														}
													}
													if(j==M){
														total=0;
														for(i=0;i<N;i++){
															total+=s[i]*C[i];
														}
														if(total<min)min=total;
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
	printf("%d",min);
	return 0;
}

Measured memory_bytes: 1736
#include <bits/stdc++.h>
using namespace std;
int main() {
  char s[20];
  cin >> s;
  int max = 0;
  int cnt = 0;
  for(int i=0; i<20; i++) {
    if(s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T'){
      cnt++;
    }
    if(s[i] != 'A' && s[i] != 'C' && s[i] != 'G' && s[i] != 'T'){
      cnt = 0;
    }
    if(cnt > max){
      max = cnt;
    }
  }
  cout << max << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

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

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

Measured memory_bytes: 3696
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.lang.Math;
import java.math.*;

public class Main {
    public static void main(String[] args) {
        FS reader = new FS();
        // write reader
        int N = reader.nextInt();
        int X = reader.nextInt();
        int[] L = new int[N];
        for (int i=0; i<N; i++) {
            L[i] = reader.nextInt();
        }
        int cur = 0;
        int ans = 1;
        for (int i=0; i<N; i++) {
            cur += L[i];
            if (cur <= X) ans++;
        }
        System.out.println(ans);
    }

    // Read Class
    static class FS {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
    
        private int readByte() { return hasNextByte() ? buffer[ptr++] : -1;}
        private boolean isPrintableChar(int c) {return 33 <= c && c <= 126;}
        private void skipUnprintable() {while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
    
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public int nextInt() {
            return (int)nextLong();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while(true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if(b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }
    }
}



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

int GCD(int a,int b){
  if(max(a,b)%min(a,b)==0){
  return(min(a,b));
  }
  else{
  return(GCD(min(a,b),max(a,b)%min(a,b)));
  }
}

int main(){
  int x;
  cin>>x;
  int sum=0;
  for(int i=1;i<=x;i++){
    for(int j=1;j<=x;j++){
      for(int k=1;k<=x;k++){
      int a=GCD(i,j);
      int b=GCD(j,k);
      sum+=GCD(a,b);
      }
    }
  }
  cout<<sum<<endl;
}

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;
#pragma endregion

void solve() {
    int n, m, p;
    cin >> n >> m >> p;
    WGraph G(n);
    for (int i=0; i<m; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        G.at(a-1).push_back({b-1, -c+p});
    }

    // bellman-ford
    vector<ll> dis(n, LINF);
    dis.at(0) = 0;
    for (int i=0; i<2*n; i++) {
        for (int j=0; j<n; j++) {
            for (auto pa : G.at(j)) {
                if (dis.at(pa.first) > dis.at(j) + pa.second && dis.at(j) != LINF) {
                    if (i < n-1) {
                        dis.at(pa.first) = dis.at(j) + pa.second;
                    } else {
                        dis.at(pa.first) = -LINF;
                    }
                }
            }
        }
    }

    if (dis.at(n-1) == -LINF) cout << -1 << '\n';
    else cout << max(0LL, -dis.at(n-1)) << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

int main() {
	string s;
	cin >> s;
	ll ans = 0;
	int n = s.size();
	if (n == 1) {
		cout << s[0] - '0' << endl;
		return 0;
	}
	for (int bit = 0; bit < (1 << n - 1); bit++) {
		ll ansi = 0;
		ll cnt = (ll)(s[0] - '0');
		rep(i, n - 1) {
			if (bit & (1 << i)) {
				ansi += cnt;
				cnt = (ll)(s[i + 1]-'0');
			}
			else {
				cnt = cnt * 10 + (ll)(s[i + 1] - '0');
			}
		}
        ansi+=cnt;
        ans+=ansi;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define res register int
#define ll long long
//#define cccgift
//#define getchar()(p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
//char buf[1<<21],*p1=buf,*p2=buf;
template<typename T>
inline void read(T &x)
{
    static char ch;bool f=1;
    for(x=0,ch=getchar();!isdigit(ch);ch=getchar()) if(ch=='-') f=0;
    for(;isdigit(ch);x=(x<<1)+(x<<3)+(ch^48),ch=getchar());x=f?x:-x;
}
template<typename T>
void print(T x)
{
    if (x<0) x=-x,putchar('-');
    if (x>9) print(x/10);
    putchar(x%10+48);
}
template<typename T>
inline void print(T x,char ap) {print(x);if (ap) putchar(ap);}
template<typename T>
inline void chkmax(T &x,const T &y) {x=x<y?y:x;}
template<typename T>
inline void chkmin(T &x,const T &y) {x=x<y?x:y;}

int main()
{
	ios::sync_with_stdio(false);
	int a,b;
	cin>>a>>b,cout<<max(0,a-2*b)<<'\n';
	cout<<flush;
	return 0;
}
/* stuff you should look for
    * int overflow, array bounds
    * special cases (n=1?), set tle
    * do something instead of nothing and stay organized
*/ 

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

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

int main(){
    
    ll D, G;
    cin >> D >> G;

    //vector<vector<ll > > D * (D + 1) / 2, vector<ll >(n_c, value));
    vector<pair<ll, ll > > input;
    
    for(ll i = 0; i < D; i++){
        ll p, c; cin >> p >> c;
        input.push_back(make_pair(p, c));
    }
    //cout << input.size() << endl;
    ll ans = INFINITY;
    
    for(ll i = 0; i <= (1<<D); i++){
        ll sum = 0;
        ll t_ans = 0;
        //ボーナスポイント込でもらえる組み合わせ
        for(ll j = 0; j < D; j++){
            if((i >> j) & 1 == 1){
                //ll a = i >> j;
                //cout <<  a;
                sum += input[j].first * 100 * (j + 1) + input[j].second;
                t_ans += input[j].first;
            }
        }
        cout << endl;
        //ボーナスポイント込でもらえた組み合わせでGを超えると幸せ
        //cout << i << " " << t_ans << endl; 
        if(sum >= G){
            ans = min(ans, t_ans);
            continue;
        }
        //微調整 単体のポイントを大きい順から割り振っていく
        //大きい順のほうが最小の手数になる
        for(ll j = D-1; j >= 0; j--){
            //ボーナスポイント込のところ以外のところから
            if(i >> j & 1 == 1) continue;
            for(ll k = 0; k < input[j].first; k++){
                if(sum >= G){
                    break;
                }
                sum += 100 * (j + 1);
                t_ans++;
            }
        }

        ans = min(ans, t_ans);

    }

    
    cout << ans << endl;

}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int checked[4];

int main(void){
  
  for(int i=0; i<2; i++)
  {
    	int temp;
    	cin>>temp;
    	checked[temp]++;
  }
  
  for(int i=1; i<=3; i++)
  {
    	if(checked[i]==0)
        {
          	cout << i << "\n";
          	break;
        }
  }
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

typedef long long ll;
typedef long double R;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

int main() {
  int n; cin >> n;
  int o = 1;
  int a[n]; for(int i = 0; i < n; i++) {
    cin >> a[i];
    if(a[i] % 2 == 0) o*=2;
  }
  cout << (ll)pow(3, n) - (ll)o << endl;

  return 0;
}

Measured memory_bytes: 256
n,m=gets.split.map(&:to_i)
ab=(1..n).map{gets.split.map(&:to_i)}
cd=(1..m).map{gets.split.map(&:to_i)}

puts ab.map{|a,b|
  cd.map.with_index(1){|(c,d),i|
    [(a-c).abs+(b-d).abs,i]
  }.min[1]
}


Measured memory_bytes: 1788
import java.util.*;
public class Main{
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		String[] s = new String[n];
		int min = 51;
		int k = 51;
		StringBuffer sb = new StringBuffer();
		for(int i=0; i<n; i++){
			s[i] = scan.next();
			if(s[i].length()<min){
				min = s[i].length();
				k = i;
			}
		}
		String[] o = s[k].split("",0);
		for(int i=0; i<min; i++){
			int count = 0;
			for(int j=0; j<n; j++){
				if(j==k){continue;}
				if(s[j].contains(o[i])){
					s[j] = s[j].replaceFirst(o[i],".");
					count++;
				}
			}
			if(count==n-1){
				sb.append(o[i]);
			}
		}
		String ans = sb.toString();
		String[] answer = ans.split("",0);
		Arrays.sort(answer);
		for(int i=0; i<ans.length()-1; i++){
			System.out.print(answer[i]);
		}
		if(ans.length()==0){String t = ""; System.out.println(t);}
		else {System.out.println(answer[ans.length()-1]);}
	}
}

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

using namespace std;

int main(){
	int n, k;
	cin >> n >> k;
	set<int> s;
	for(int i = 0; i < k; i++){
		int sz;
		cin >> sz;
		for(int j = 0; j < sz; j++){
			int x;
			cin >> x;
			s.insert(x);
		}
	}
	cout << n - s.size() << endl;
	return 0;
}


Measured memory_bytes: 3620
def try(a, n, ox)
  i = 1
  loop do
    a[i + 1] = if a[i]
                 if ox[i]
                   a[i - 1]
                 else
                   !a[i - 1]
                 end
               else
                 if ox[i]
                   !a[i - 1]
                 else
                   a[i - 1]
                 end
               end
    i += 1
    break if i == n + 1
  end

  (a[0] == a[n]) && (a[1] == a[n + 1])
end

def convert(a)
  a[0..-3].map { |v|
    if v then
      'S'
    else
      'W'
    end }.join
end

def Menagerie(n, ox)
  return -1 if n < 3

  # puts n, ox
  ox = ox.split('').map { |v| v == 'o' }

  return -1 if ox.size != n

  ox.push(ox[0])

  a = Array.new

  a[0, 2] = [true, true] # assume that the 1st and 2nd animal are Sheep
  return convert(a) if try(a, n, ox)

  a[0, 2] = [true, false]
  return convert(a) if try(a, n, ox)

  a[0, 2] = [false, true]
  return convert(a) if try(a, n, ox)

  a[0, 2] = [false, false]
  return convert(a) if try(a, n, ox)

  return -1
end

if __FILE__ == $PROGRAM_NAME
  n = STDIN.gets.to_i
  ox = STDIN.gets.chomp
  puts Menagerie(n, ox)
end


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll A, B, N; cin >> A >> B >> N;
    // xをBで割ったときのあまりの最大yを得られればそれをxに代入するだけ
    ll y;
    if (N / B >= 1){
        y = B - 1;
    } else {
        y = N % B;
    }
    ll ans = (ll) (floor(A * y / (double)(B)) - A * floor(y / (double)(B)));
    cout << ans << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3596
//おまじない
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define INF 1e9+7
#define roop(i,m,n) for(int i=m;i<n;i++)
#define mroop(i,m,n) for(int i=m;i<n;i--)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
using namespace std;
typedef long long int ll;

//(int)'a'は97 (int)'A'は65
//おまじない



int main() {

	ll ans = 0;
	int n, k;

	cin >> n >> k;

	roop(i, 0, n) {
		if (i == 0) {
			ans = k;
		}
		else {
			ans = ans * (k - 1);
		}
	}

	cout << ans << endl;

	return 0;
}


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


int main(){
  int e[4];

  for(int i=0;i < 4; ++i)
    cin >> e[i];

  bool f = false;

  if(pow(e[0],2)+pow(e[1],2) == pow(e[2],2)+pow(e[3],2)){
    f = true;
  }
  if(pow(e[0],2)+pow(e[2],2) == pow(e[1],2)+pow(e[3],2)){
    f = true;
  }
  if(pow(e[0],2)+pow(e[3],2) == pow(e[1],2)+pow(e[2],2)){
    f = true;
  }
  if(pow(e[1],2)+pow(e[2],2) == pow(e[3],2)+pow(e[0],2)){
    f = true;
  }
  if(pow(e[1],2)+pow(e[3],2) == pow(e[0],2)+pow(e[2],2)){
    f = true;
  }
  if(pow(e[2],2)+pow(e[3],2) == pow(e[0],2)+pow(e[1],2)){
    f = true;
  }

  if(f){
    cout << "yes" << endl;
  }else{
    cout << "no" << endl;
  }
  return 0;
}



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

string s;
int n, ans;

int main() {
    cin >> n >> s;
    for(int i = 0; i < n - 2; i++) {
        if(s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C') ans++;
    }    

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
//Author: Fuadul Hasan(fuadul202@gmail.com)
//BSMRSTU,Gopalganj
#include<bits/stdc++.h>
using namespace std;int tc = 1;
#define happy ios::sync_with_stdio(false);
#define coding  cin.tie(0);
#define F first
#define S second
#define mp make_pair
#define ll long long
#define Pi atan(1)*4
#define pb  push_back
#define vpr vector<pr> 
#define pr pair<int, int> 
#define vi std::vector<int>
#define vll std::vector<ll>
#define YES printf("YES\n");
#define NO printf("NO\n");
#define Yes printf("Yes\n");
#define No printf("No\n");
#define all(n) n.begin(),n.end()
#define point(x) setprecision(x)
#define Test printf("Case %d: ",tc++);
#define Unique(c) (c).resize(unique(all(c))-(c).begin())
#define vout(v) for (auto z: v) cout << z << " "; cout << endl;

#define error(args...) {vector<string>_v=split(#args,',');err(_v.begin(),args);cout<<endl;}
vector<string> split(const string &s, char c) {vector<string>v; stringstream ss(s); string x;
while (getline(ss, x, c))v.emplace_back(x); return move(v);} void err(vector<string>::iterator it) {}
template<typename T, typename... Args>void err(vector<string>::iterator it, T a, Args...args) {
cout << it->substr((*it)[0] == ' ', it->length()) << " = " << a << " "; err(++it, args...);}

const int M = 1e9 + 7;
const ll  Inf = (ll)2e18 + 5;
const int N   = 2e5 + 5;
ll vis[N],res[N];

int solve() 
{
	//happy coding

	int n,k;
	cin>>n>>k;
	int a[n];

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

	for(int i=k;i<n;i++){
		if(a[i-k]<a[i]){
			cout<<"Yes"<<endl;
		}else{
			cout<<"No"<<endl;
		}
	}


	
	return 0;
}
int main(){
	int test = 1;
  	//scanf("%d", &test);
  	while (test--)solve();return 0;
}

Measured memory_bytes: 4416
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;

int n;
int x[110];

int calcDist(int a, int b)
{
	int dist = (a - b) * (a - b);
	return dist;
}

int main()
{
	scanf("%d", &n);
	for (int i = 0 ; i < n ; i++)
		scanf("%d", &(x[i]));
	
	sort(x, x + n);
	
	int minDist = -1;
	for (int dx = x[0] ; dx <= x[n - 1] ; dx++) {
		int curDist = 0;
		for (int i = 0 ; i < n ; i++) {
			curDist = curDist + calcDist(x[i], dx);
		}
		
		if ((minDist == -1) || (minDist > curDist))
			minDist = curDist;
	}
	
	printf("%d\n", minDist);
	
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

struct CumulativeSum{
    vector<int> data;
    CumulativeSum(int sz) : data(sz, 0) {};
    void add(int k, int x){
        data[k] += x;
    }
    void build(){
        for(int i = 1; i < data.size(); i++){
            data[i] += data[i - 1];
        }
    }
    int query(int k){
        if(k < 0) return 0;
        return (data[min(k, (int)data.size() - 1)]);
    }
    int query(int l, int r){
        return query(r - 1) - query(l - 1);
    }
};

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, a, b, c;
    cin >> n >> a >> b >> c;
    vector<int> d(n);
    rep(i, 0, n){
        cin >> d[i];
    }
    int ans = INF;
    for(int i = 0; i < (1 << n); i++){
        for(int j = 0; j < (1 << n); j++){
            for(int k = 0; k < (1 << n); k++){
                bool f = true;
                int x = 0, y = 0, z = 0;
                int cx = 0, cy = 0, cz = 0;
                rep(l, 0, n){
                    int cnt = 0;
                    if(i & (1 << l)){
                        cnt++; x += d[l]; cx++;
                    }
                    if(j & (1 << l)){
                        cnt++; cy++;
                        y += d[l];
                    }
                    if(k & (1 << l)){
                        cnt++; cz++;
                        z += d[l];
                    }
                    if(cnt > 1){
                        f = false;
                        break;
                    }
                }
                if(!f) continue;
                if(cx == 0 || cy == 0 || cz == 0) continue;
                int tmp = (cx + cy + cz - 3) * 10;
                tmp += abs(a - x) + abs(b - y) + abs(c - z);
                ans = min(ans, tmp);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
class UnionFind:
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x, y):
        return - self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}


N, M = map(int, input().split())
P = list(map(lambda x: int(x) - 1, input().split()))
union_find = UnionFind(N)
for _ in range(M):
    x, y = map(int, input().split())
    union_find.union(x-1, y-1)
d = {}
for i in range(N):
    d[P[i]] = i
ans = 0
for i in range(N):
    if union_find.same(i, d[i]):
        ans += 1
print(ans)


Measured memory_bytes: 97272
#include<bits/stdc++.h>
#define rep(i,N) for(ll i=0; i<N; i++)
using namespace std;
using ll = long long;
int main(){
    ll N; cin >> N;
    ll A[N]; rep(i,N) cin >> A[i]; rep(i,N) A[i]--;
    ll B[N]; rep(i,N) cin >> B[i];
    ll C[N-1]; rep(i,N-1) cin >> C[i];

    ll sum = 0; ll tmp = -10;
    rep(i,N){
        sum += B[A[i]];
        if(A[i] - tmp == 1) sum += C[tmp];
        tmp = A[i];
    }
    cout << sum << endl;
}


Measured memory_bytes: 256
# coding: utf-8

def reader(N):
    for n in range(N):
        yield input()

def main():
    N, K, Q = input().split()
    N, K, Q = int(N), int(K), int(Q)
    participants = [K-Q for _ in range(N)]
    for a in reader(Q):
        participants[int(a)-1] += 1
    
    for p in participants:
        if p > 0:
            print('Yes')
        else:
            print('No')

main()


Measured memory_bytes: 7840
#include<bits/stdc++.h>
#define rint register int
using namespace std;
inline int read(){
	char ch;
	while(!isdigit(ch=getchar()));
	int s=ch-'0';
	while (isdigit(ch=getchar()))s=s*10+ch-'0';
	return s;
}
const int N=4e6+5;
int n,ans;
bitset<N>s1,s2;
int main(){
	n=read();s1=1;
	for (rint i=1;i<=n;i++){
		int x=read();
		ans+=x;
		s2=s1;
		s1<<=x;
		s1|=s2;
	}
	for (rint i=ans/2+ans%2;i<=ans;i++)
		if (s1[i]){cout<<i;return 0;}
	return 0;
}




Measured memory_bytes: 1664
#include <cstdio>
using namespace std;
typedef long long ll;
const int b = 1000000000;
int x,y; ll s;
int main() {
    scanf("%lld",&s); y = s/b; x = s%b;
    if (x) y++,x = b-x;
    printf("0 0 %d 1 %d %d\n",b,x,y);
}


Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <climits>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef pair<int,int> pii;
const int INF = 1<<29;
const double PI = acos(-1);
const double EPS = 1e-8;


void getpos(int &y,int &x) {
  char c;
  scanf(" %c-%d", &c, &x);
  y=c-'a';
  x--;
}

int g[30][30][4];
int signal[30][30];

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

int visited[21][21][4][101];
struct P {
  int y, x, d, t;
};

int main() {
  int M,N;
  while(cin>>M>>N,M||N) {
    memset(g,0,sizeof(g));
    memset(signal,0,sizeof(signal));
    int D; cin >> D;
    int ns; cin >> ns;
    REP(i,ns) {
      int y, x;
      getpos(y,x);
      int k; cin >> k;
      signal[y][x] = k;
    }
    int nc; cin >> nc;
    REP(i,nc) {
      int y1,x1,y2,x2;
      getpos(y1,x1);
      getpos(y2,x2);
      if (y1==y2) {
        for (int x=min(x1,x2); x<max(x1,x2); ++x) {
          g[y1][x][1] = g[y1][x+1][3] = INF;
        }
      } else {
        for (int y=min(y1,y2); y<max(y1,y2); ++y) {
          g[y][x1][2] = g[y+1][x1][0] = INF;
        }
      }
    }
    int nj; cin >> nj;
    REP(i,nj) {
      int y1,x1,y2,x2;
      getpos(y1,x1);
      getpos(y2,x2);
      int d; cin >> d;
      if (y1==y2) {
        for (int x=min(x1,x2); x<max(x1,x2); ++x) {
          g[y1][x][1] = g[y1][x+1][3] = max(g[y1][x][1], d);
        }
      } else {
        for (int y=min(y1,y2); y<max(y1,y2); ++y) {
          g[y][x1][2] = g[y+1][x1][0] = max(g[y][x1][2], d);
        }
      }      
    }
    int sy,sx,gy,gx;
    getpos(sy,sx); getpos(gy,gx);
    memset(visited,0,sizeof(visited));
    queue<P> Q;
    Q.push((P){sy,sx,1,0});
    visited[sy][sx][1][0] = 1;
    
    while(!Q.empty()) {
      P p = Q.front(); Q.pop();
      // if (p.t <= 5) {
      //   cout << p.y << " "<<p.x << " " <<p.d << " " << p.t << endl;
      // }
      REP(d,4) {
        if (d == (p.d+2)%4) continue;
        int yy=p.y+dy[d];
        int xx=p.x+dx[d];
        if (yy<0||yy>=M||xx<0||xx>=N) continue;
        int tt = p.t + D + g[p.y][p.x][d];
        if (tt > 100) continue;
        if (signal[yy][xx]) {
          if ((tt / signal[yy][xx]) % 2 == 0) { // 南北
            if (d % 2 == 1) continue;
          } else {
            if (d % 2 == 0) continue;
          }
        }
        if (visited[yy][xx][d][tt]) continue;
        visited[yy][xx][d][tt] = 1;
        Q.push((P){yy,xx,d,tt});
      }
    }
    REP(t,101) {
      REP(d,4) {
        if (visited[gy][gx][d][t]) {
          cout << t << endl;
          goto nx;
        }
      }
    }
    cout << "!" << endl;
  nx:;
  }
}

Measured memory_bytes: 2000
#include <stdio.h>
#include <string.h>

int ascSort(const void* v1, const void* v2) {
    const int _v1 = *((const int*)v1);
    const int _v2 = *((const int*)v2);
 
    if ( _v1 > _v2 ) {
        return 1;
    } else if ( _v1 < _v2 ) {
        return -1;
    } else {
        return 0;
    }
}

int main(){
  int n,i,ans,count=0,look=0;
  scanf("%d",&n);
  int a[1000000],b[100000];
  for(i=0;i<1000000;i++){
    a[i]= -1;
    b[i]= 0;
  }
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  qsort(a,n,sizeof(a[0]),ascSort);
  for(i=0;i<n;i++){
    if(a[i]==a[i+1]){
      count += 1;
    }else{
      b[look] = count + 1;
      look += 1;
      count = 0;
    }
  }
  for(i=0;i<look;i++){
    ans += b[i]%2;
  }
  printf("%d",ans);
  return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef pair<ll,P>  PP;
typedef vector<ll> Vector;
typedef vector<Vector> DVector;
typedef priority_queue<PP, vector<PP>, greater<PP>> PPQueue;

#define fi          first
#define se          second
#define sfi         se.fi
#define sse         se.se
#define pb          push_back
#define INF         INT_MAX
#define MOD         1000000007
#define bcnt        __builtin_popcount
#define all(x)      (x).begin(),(x).end()
#define uni(x)      x.erase(unique(all(x)),x.end())
#define ub(x,y)     (upper_bound(all(x),y)-x.begin())
#define lb(x,y)     (lower_bound(all(x),y)-x.begin())
#define rep(i,n)    repl(i,0,n-1)
#define usort(x)    sort(all(x))
#define dsort(x)    sort(all(x),greater<ll>())
#define mkp(x,y)    make_pair(x,y)
#define mmax(x,y)   (x>y?x:y)
#define mmin(x,y)   (x<y?x:y)
#define maxch(x,y)  x=mmax(x,y)
#define minch(x,y)  x=mmin(x,y)
#define exist(x,y)  (find(all(x),y)!=x.end())
#define each(itr,v) for(auto itr:v)
#define repl(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);i++)

int main(){
  cin.sync_with_stdio(false);
  string s;
  cin >> s;
  cout << ((s.size() % 2 == 0) != (s[0] == s[s.size()-1]) ? "Second" : "First") << endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstdlib>
#include <stack>
#include <vector>
#define INF 0x3f3f3f3f
typedef long long ll;

using namespace std;
vector<int> v[100005];
int vis[1000005];
queue<int> q;
bool bfs()
{
    vis[1] = 1;
    q.push(1);
    while(!q.empty())
    {
        int k = q.front();
        q.pop();
        for(int i = 0; i < v[k].size(); i++)
        {
            int p = v[k][i];
            int x = (vis[k] == 1)?2:1;
            if(vis[p] == 0)
            {
                vis[p] = x;
                q.push(p);
            }
            else if(vis[p] != x)
            {
                return false;
            }

        }
    }
    return true;
}
int main()
{
    ll n, m;
    cin >> n >> m;
    for(int i = 0; i < m; i++)
    {
        int x, y;
        cin >> x >> y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    memset(vis, 0, sizeof(vis));
    if(bfs())
    {
        ll c1 = 0, c2 = 0;
        for(int i = 1; i <= n; i++)
        {
            if(vis[i] == 1)c1++;
            if(vis[i] == 2)c2++;
        }
        cout << c1*c2 - m << endl;
    }
    else
        cout << n*(n-1)/2 - m << endl;
    return 0;
}


Measured memory_bytes: 9856
#include<bits/stdc++.h>
#define Tp template<typename Ty>
#define Ts template<typename Ty,typename... Ar>
#define Reg register
#define RI Reg int
#define Con const
#define CI Con int&
#define I inline
#define W while
#define N 1000
#define LL long long
using namespace std;
int n;class Dinic
{
	private:
		#define E(x) ((((x)-1)^1)+1)
		#define add(x,y,f,c) (e[++ee].nxt=lnk[x],e[lnk[x]=ee].to=y,e[ee].F=f,e[ee].C=c)
		int ee,lnk[2*N+10];struct edge {int to,nxt,F,C;}e[20*N+5];
		int IQ[2*N+10],p[2*N+10],F[2*N+10];LL C[2*N+10];queue<int> q;I bool SPFA(CI s,CI t)
		{
			RI i,y,k;for(i=1;i<=2*n+6;++i) C[i]=-1e18;F[s]=1e9,C[s]=0,q.push(s);W(!q.empty())
				for(i=lnk[k=q.front()],q.pop(),IQ[k]=0;i;i=e[i].nxt) C[y=e[i].to]<C[k]+e[i].C&&
					e[i].F&&(C[y]=C[k]+e[p[y]=i].C,F[y]=min(F[k],e[i].F),!IQ[y]&&(q.push(y),IQ[y]=1));
			return C[t]!=-1e18;
		}
	public:
		I void Add(CI x,CI y,CI f,CI c) {add(x,y,f,c),add(y,x,0,-c);}
		I void MCMF()
		{
			RI x,s=2*n+1,t=2*n+2;LL y=0;W(SPFA(s,t))
			{
				y+=C[x=t]*F[t];W(x^s) e[p[x]].F-=F[t],e[E(p[x])].F+=F[t],x=e[E(p[x])].to;
			}printf("%lld\n",y);
		}
}D;
int main()
{
	RI i,x,y,z;for(scanf("%d",&n),i=1;i<=n;++i) scanf("%d%d%d",&x,&y,&z),D.Add(2*n+1,i,z,0),
		D.Add(i,2*n+3,z,x+y),D.Add(i,2*n+4,z,x-y),D.Add(i,2*n+5,z,-x+y),D.Add(i,2*n+6,z,-x-y);
	for(i=1;i<=n;++i) scanf("%d%d%d",&x,&y,&z),D.Add(n+i,2*n+2,z,0),
		D.Add(2*n+3,n+i,z,-x-y),D.Add(2*n+4,n+i,z,-x+y),D.Add(2*n+5,n+i,z,x-y),D.Add(2*n+6,n+i,z,x+y);
	return D.MCMF(),0;
}

Measured memory_bytes: 4084
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
 	int a,b;
  	cin>>n>>a>>b;
  	for(int i=a;i<=b;i++){
    	if(i%n == 0){
        	cout<<"OK"<<'\n';
          	return 0;
        }
    }
  cout<<"NG"<<'\n';
}

Measured memory_bytes: 3608
import java.util.Scanner;
 
public class Main{
    public static void main(String[] args){
        int a=0,b,ans;
        String d;
        char c;
        Scanner sc = new Scanner(System.in);
    while(true){  a = sc.nextInt();
        d = sc.next();
        b = sc.nextInt();
        c = d.charAt(0);
        if(c=='+')ans = a+b;
        else if(c=='-')ans = a-b;
        else if(c=='*')ans = a*b;
        else if(c=='/')ans = a/b;
        else break;
     
        System.out.println(ans);
 
    }
    }
}


Measured memory_bytes: 26484
[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reads f = stdin.ReadLine().Split() |> Array.map f

[<EntryPoint>]
let main _ =
    let A = read int
    let B = read int
    List.filter (fun x -> x <> A && x <> B) [1..3]
    |> List.head
    |> printfn "%i"
    0

Measured memory_bytes: 12112
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		try {
			final BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
			final String[] line = in.readLine().split(" ");
			in.close();
			
			final int x = Integer.parseInt(line[0]);
			final int y = Integer.parseInt(line[1]);
			
			System.out.println(String.valueOf(euclidean(x, y)));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public static int euclidean(final int x, final int y) {
		int a = x<y ? y : x;
		int b = x<y ? x : y;
		int r = a % b;
		
		while (r != 0) {
			a = b;
			b = r;
			r = a % b;
		}
		
		return b;
	}
}

Measured memory_bytes: 17096
import java.util.*;

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

    int D = sc.nextInt();
    int N = sc.nextInt();
    int ans;

    if (N < 100) {
      ans = (int)(N * Math.pow(100, D));
    } else {
      ans = (int)((N+1) * Math.pow(100, D));
    }

    System.out.println(ans);
  }
}


Measured memory_bytes: 21716
#include <algorithm>
#include <climits>
#include <deque>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <string.h>
#include <utility>
#include <vector>
using namespace std;

// デバッグ用
#define _DEBUG
#ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
// ここまで
#define INF 999999999
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define REPR(i, n) for(int i = n - 1; 0 <= i; i--)
#define FOR(i, s, e) for(int i = s; i <= e; i++)
#define FORR(i, s, e) for(int i = s; e <= i; i--)
#define LLI long long int
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
// int 2.14E±9    lli 9.2E±18    double 1.7E±380

int main() {
    string s;
    int l;
    cin >> s;
    l = s.length();
    int c0 = 0, c1 = 0;
    REP(i, l) {
        if(s[i] == '0')
            c0++;
        if(s[i] == '1')
            c1++;
    }

    cout << min(c0, c1) * 2;

    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>

#define CH(N,A,B) (A<=N&&N<B)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define RREP(i,a,b) for(int i=(b-1);a<=i;i--)

using namespace std;

int n, m;
long long x[100005], y[100005], MOD = 1000000007;

int main() {

  cin>>n>>m;
  REP(i,0,n) cin>>x[i];
  REP(i,0,m) cin>>y[i];

  long long sumx=0, sumy=0;

  REP(i,0,n) sumx = ( sumx - (n-i-1)*x[i] + (i)*x[i] ) % MOD;
  REP(i,0,m) sumy = ( sumy - (m-i-1)*y[i] + (i)*y[i] ) % MOD;

  cout<<sumx*sumy%MOD<<endl;

  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
using P=pair<long long,long long>;
typedef unsigned long long ull;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);  
  
  ll n;
  cin >> n;
  map<ll,ll>mp;
  rep(i,n){
    ll a;
    cin >> a;
    if(mp[a]>0)mp[a]=0;
    else mp[a]=1;
  }
  ll sum=0;
  for(auto p:mp){
    if(p.second>0)sum++;
  }
  cout << sum << endl;
 
}


Measured memory_bytes: 6528
A = []
for i in range(5):
  A.append(int(input()))
k = int(input())
ans = True
for i in range(4):
  for j in range(i, 5):
    if abs(A[i] - A[j]) > k:
      ans = False
      break
if ans:
  print("Yay!")
else:
  print(":(")

Measured memory_bytes: 3060
import heapq

n_vertex, n_edge, start = [int(i) for i in input().split()]
min_costs = [float("inf")] * n_vertex
min_costs[start] = 0
adj_list = {i: set() for i in range(n_vertex)}
for _ in range(n_edge):
    f, t, c = [int(i) for i in input().split()]
    # to, cost
    adj_list[f].add((t, c))

# cost, pos
heap = [(0, start)]
while heap:
    cost, pos = heapq.heappop(heap)
    for next_pos, weight in adj_list[pos]:
        if cost + weight >= min_costs[next_pos]:
            continue
        min_costs[next_pos] = cost + weight
        heapq.heappush(heap, (min_costs[next_pos], next_pos))

for cost in min_costs:
    print(cost if cost < float("inf") else "INF")



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

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    map<int, int> mp;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        mp[a[i]]++;
    }
    vector<int> v;
    for (auto e : mp) v.push_back(e.second);
    sort(v.begin(), v.end());
    int ans = 0;
    for (int i = 0; i < (int)mp.size() - k; i++) ans += v[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 11516
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
	public class Program
	{
		public static void Main(string[] args)
		{
			string[] str = Console.ReadLine().Split(' ');
			int クッキーA = int.Parse(str[0]);
			int クッキーB = int.Parse(str[1]);
			int クッキーAとB = クッキーA + クッキーB;

			if (クッキーA % 3 == 0)
			{
				Console.WriteLine("Possible");
				return;
			}

			if (クッキーB % 3 == 0)
			{
				Console.WriteLine("Possible");
				return;
			}

			if (クッキーAとB % 3 == 0)
			{
				Console.WriteLine("Possible");
				return;
			}

			Console.WriteLine("Impossible");
		}
	}
}

Measured memory_bytes: 13140
import sys

def dec_num(x):
    for i in range(len(x)):
        if x[i] == 2:
            x[i] = 5
        elif x[i] == 3:
            x[i] = 10
        elif x[i] == 4:
            x[i] = 50
        elif x[i] == 5:
            x[i] = 100
        elif x[i] == 6:
            x[i] = 500
        elif x[i] == 7:
            x[i] = 1000

def to_index(x):
    if x == 1:
        return 1
    elif x == 5:
        return 2
    elif x == 10:
        return 3
    elif x == 50:
        return 4
    elif x == 100:
        return 5
    elif x == 500:
        return 6
    elif x == 1000:
        return 7


def toNum(x):
    result = 0
    tmp = x[0]
    for i in range(len(x)):
        if tmp < x[i]:
            result += x[i]-tmp
        elif i < len(x)-1 and x[i] < x[i+1]:
            result += 0
        else:
            result += x[i]
        tmp = x[i] 

    return result

for line in sys.stdin.readlines():
    line = line.translate(str.maketrans('IVXLCDM', '1234567'))
    num = list(map(int, (' '.join(line)).split()))
    dec_num(num)
    print(toNum(num))

Measured memory_bytes: 7680
#include <iostream>
#include <vector>
#include <queue>

#ifdef _XCODE_DEBUG
    #include <fstream>
#endif

int main() {
    #ifdef _XCODE_DEBUG
        std::ifstream in("input.txt");
        std::cin.rdbuf(in.rdbuf());
    #endif
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    // input data
    int N, u, v, w;
    std::cin >> N;
    std::vector<std::vector<int>> n_vec(N);
    std::vector<std::vector<int>> w_vec(N);
    for (int i=0; i<N; ++i) {
        std::cin >> u >> v >> w;
        n_vec[u-1].push_back(v-1);
        n_vec[v-1].push_back(u-1);
        w_vec[u-1].push_back(w);
        w_vec[v-1].push_back(w);
    }
    
    // bfs
    std::vector<int> color_vec(N, -1);
    std::queue<int> que;
    que.push(0);
    color_vec[0] = 0;
    while (!que.empty()) {
        int v = que.front(); que.pop();
        for (int j=0; j<(int)n_vec[v].size(); ++j) {
            int nv = n_vec[v][j];
            if (color_vec[nv]!=-1) continue;
            if (w_vec[v][j] % 2 == 0) color_vec[nv] = color_vec[v];
            else {
                if (color_vec[v]) color_vec[nv] = 0;
                else color_vec[nv] = 1;
            }
            que.push(nv);
        }
    }
    
    // show ans
    for (int i=0; i<N; ++i) std::cout << color_vec[i] << "\n";
    return 0;
}

Measured memory_bytes: 11904
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
const ll inf  = 1e9+5;
typedef pair<int, bool> pib;

int main() {
  int n; cin >> n;
  vector<int> heights (n);
  for (int i = 0; i < n; i++){
      cin >> heights[i];
  }
  vector<int> dp (n, inf);
  dp[0] = 0;
  for (int i = 0; i < n; i++){
        for (int j : {i +1, i +2}){
            if (j < n){
                dp[j] = min(dp [j], dp [i] + abs(heights[j] - heights[i]));
            }
        }
  }
  cout << dp[n-1];
}



Measured memory_bytes: 1024
#include <stdio.h>

int main(void)
{
    int N;
    
    scanf("%d", &N);
    
    if (N % 2 == 0) {
        printf("%d\n", N / 2);
    } else {
        printf("%d\n", (N / 2) + 1);
    }
    
    return 0;
}

Measured memory_bytes: 128
var input = [];
process.stdin.resume();
process.stdin.setEncoding("utf8");
process.stdin.on('data', function(chunk){
   input = chunk.toString("utf8").trim().split("\n");
});
process.stdin.on('end', function(){
    for (var i = 0; i < input.length; i++) {
    var data = input[i].split(" ").map(Number);
    var a = data[0],
        b = data[1],
        c = data[2],
        d = data[3],
        e = data[4],
        f = data[5];
        
    var x = ((c * e - b * f) / (a * e - b * d)).toFixed(3);
    var y = ((f * a - c * d) / (a * e - d * b)).toFixed(3);
    console.log(x + " " + y);
    }
    
});

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

#define rep(a,b) for(int a = 0;a < b;a++)
#define REP(i, x, n) for(int i = x; i < n; i++)
#define P(a) cout << a << endl
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define ssort(v) sort(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())
#define vP(v) for(int i = 0;i < v.size();i++){cout << v[i];if(i != v.size()-1)cout << endl;}
#define vcin(v,n) rep(i,n){int a;cin >> a;v.pb(a);}

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = { 1, -1 , 0 , 0 };
int dy[] = { 0,  0,  1, -1 };
ll MOD = 1000000007;

void solve(){
	int n,k;
	cin >> n >> k;
	int num = 1;
	while(num <= k and n > 0){
		num *= 2;
		n--;
	}
	rep(i,n){
		num += k;
	}
	P(num);
}

int main() {
	solve();
	return 0;
}


Measured memory_bytes: 256