akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                   \
  ifstream in("atcoder-problems/abc139_c.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v) \
rep(l, v.size()) { cout << v[l] << " "; } \
cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18+100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N;
  cin >> N;
  
  vector<int> c(N);
  rep(i, N) { cin >> c[i]; }


  ll ans = 0;
  ll tmp = 0;
  rep(i, N - 1) {
    if (c[i] >= c[i + 1]) tmp++;
    else {
      ans = max(tmp, ans);
      tmp = 0;
    }
  }
  ans = max(tmp, ans);

  cout << ans << endl;
}

Measured memory_bytes: 640
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();

        for (int a=0; a<=N; a++) {
            for (int b=0; b<=N-a; b++) {
                int c = N - a - b;
                int total = a * 10000 + b * 5000 + c * 1000;
                if (total == Y) {
                    System.out.println(a + " " + b + " " + c);
                    return;
                }
            }
        }
        System.out.println("-1 -1 -1");
    }
}


Measured memory_bytes: 21972
from math import gcd

def prime_factorize(n):
    a = set()
    while n % 2 == 0:
        a.add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.add(n)
    return a

n = int(input())
A = list(map(int, input().split()))

# すべてのi,jについてgcd(ai, aj) = 1 の判定 
# anygcd1
# 素因数分解してsetで管理、最後まで存在しなければTrue

# gcd(a1,,,an) = 1 の判定
# allgcd1
# やるだけ？

anygcd1 = True

pset = set()
for a in A:
  pf = prime_factorize(a)
  if any(p in pset for p in pf):
    anygcd1 = False
    break
  pset |= pf

allgcd = A[0]
for a in A[1:]:
  allgcd = gcd(allgcd, a)

if anygcd1:
  print("pairwise coprime")
else:
  if allgcd == 1:
    print("setwise coprime")
  else:
    print("not coprime")

Measured memory_bytes: 205156
#include <stdio.h>

int main(int argc, char *argv[])
{
  int x, y, tmp;
  int d;

  scanf("%d %d", &x, &y);

  if (x < y) {
    tmp = x;
    x = y;
    y = tmp;
  }

  while((tmp = x % y) != 0) {
    x = y;
    y = tmp;
  }

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

  return 0;
}

Measured memory_bytes: 592
import math
from collections import Counter

K = int(input())

memo = {frozenset((i, j)): math.gcd(i, j) 
        for i in range(1, K+1) for j in range(i, K+1)}

counter = Counter([memo[frozenset((i, j))] 
                   for i in range(1, K+1) for j in range(1, K+1)])

total = 0
for i in range(1, K+1):
  for value, count in counter.items():
    total += memo[frozenset((i, value))] * count
    
print(total)

Measured memory_bytes: 14524
#include <math.h>

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define PI 3.14159265358979323846264338327950L
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))

int main() {
  int R, G;

  cin >> R >> G;

  cout << R + (G - R) * 2 << endl;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

/**
 *
 * @author Owner
 *
 */
public class Main {
	/**
	 *
	 * @param args
	 */
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		//String s = sc.nextLine();
		//拠点数
		int N = sc.nextInt();
		//平均気温
		double T = sc.nextDouble();
		//希望気温
		double A = sc.nextDouble();

		List<Double> Hi = new ArrayList<>();

		for (int i = 1; i <= N; i++) {
			double H = sc.nextInt();
			Hi.add(H);
		}
		List<Double> X = new ArrayList<Double>();
		List<Double> XX = new ArrayList<Double>();
		for (Double d : Hi) {
			Double dd = Math.abs(A - (T - d * 0.006));
			X.add(dd);
			XX.add(dd);
		}
		Collections.sort(X);

		int ii = 1;
		for (Double d : XX) {
			if (d == X.get(0)) {
				break;
			}
			ii++;
		}
		System.out.print(ii);
	}
}

Measured memory_bytes: 25812
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>a
#define pb push_back
#define sz(x) int(x.size())

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

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

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

class UnionFind{
  public:
  vi Parent;
  UnionFind(int n){
    Parent = vi(n,-1);
  }

  int root(int a){
    if(Parent[a] < 0) return a;
    else return Parent[a] = root(Parent[a]);
  }

  int size(int a){
    return -Parent[root(a)];
  }

  bool merge(int a, int b){
    a = root(a);
    b = root(b);
    if(a == b) return false;

    if(size(a) < size(b)) swap(a,b);
    Parent[a] += Parent[b];
    Parent[b] = a;

    return true;
  }
};

class Factrial{
  public:
  vl Fac;
  Factrial(int MAX){
    Fac = vl(MAX+1);
    rep(i,MAX) {
      if(i == 0) Fac[i+1] = 1;
      else Fac[i+1] = ((i+1)*Fac[i])%MOD;
    }
  }
};


int main(){
  string L; cin >> L;
  int n = L.size();
  reverse(all(L));

  vvl dp(n+1,vl(2));
  dp[0][1] = 1;

  rep(i,n) {
    if(L[i] == '1'){
      dp[i+1][0] = 2*dp[i][0];
      dp[i+1][1] = dp[i][0] + 3*dp[i][1];
    }
    else{
      dp[i+1][0] = 3*dp[i][0] + 2*dp[i][1];
      dp[i+1][1] = dp[i][1];
    }
    dp[i+1][0] %= MOD;
    dp[i+1][1] %= MOD;
  }

  cout << dp[n][1] << endl;
}

Measured memory_bytes: 5760
#include <stdio.h>

int main(void) {
	int i, j;
	char s[11];
	int len;
	long sum;

	scanf("%s%n", s, &len);

	sum = 0;
	for (i = 0; i < 1 << len - 1; i++) {
		long cur = 0;
		for (j = 0; j < len; j++) {
			cur = cur * 10 + s[j] - '0';
			if (~i >> j & 1) {
				sum += cur;
				cur = 0;
			}
		}
	}

	printf("%ld\n", sum);

	return 0;
}


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

int min(int x, int y) {
    return (x > y ? y : x);
}

int main() {
    int n, a[1001];
    int ans;

    while (1) {
        scanf("%d", &n);
        if (n == 0) { break; }

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

        ans = 1e8;

        for (int i = 0; i < n-1; i++) {
            for (int j = i+1; j < n; j++) {
                ans = min(ans, abs(a[i] - a[j]));
            }
        }
        printf("%d\n", ans);
    }
    return 0;
}


Measured memory_bytes: 2040
#include <bits/stdc++.h>
#define rep(i,n)    for(long long i = 0; i < (n) ; ++i)
#define orep(i,n)   for(long long i = 1; i <= (n); ++i)   // one rep
#define drep(i,n)   for(long long i = (n)-1; i >= 0; --i) // down rep
#define srep(i,s,t) for(long long i = (s); i < (t); ++i)  // set rep
#define rng(x)  (x).begin(),(x).end()

  // range
#define rrng(a) (a).rbegin(),(a).rend() // reverse range
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define ru(x,y) (((x)+(y)-1)/(y)) // round up
#define fi first
#define se second
#define eb emplace_back
#define fcout cout << fixed << setprecision(15)


using namespace std;
using ll  = long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vvi = vector<vi>;
using vp  = vector<P>;
using vl  = vector<ll>;

template<typename T> void Yes(T flag) {
  cout << (flag ? "Yes" : "No") << endl;
}

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

template<typename T> void pv2(vector<vector<T>> vec) {
  for(auto& v : vec) pv(v);
}

// 条件をみたす数が何個あるか知りたいときの桁dp

const int keta = 101;
const int miflag = 2;
const int arsum = keta;
//桁 未満フラグ 条件達成数
ll dp[keta][miflag][arsum];

// 条件達成フラグ
bool archieve(int x,int k) {
    if(x!=0) return true;
    return false;
}

int archieveNum(int x,int k) {
  if(archieve(x,k)) return k+1;
  else return k;
}

void dpInit() {
    rep(i,keta) rep(j,miflag) rep(k,arsum) dp[i][j][k] = 0;
}

// v:上限 n:桁数 self:自分自身を含むか
ll ketaDP(vi &v,int n,int anum,bool self = true) {
  dpInit();
  dp[0][0][0] = 1;

  rep(i,n) rep(j,2) rep(k,n) rep(x,j ? 10 : v.at(i) + 1) {
    dp[i+1][j or x < v.at(i)][archieveNum(x,k)] += dp[i][j][k];
  }
  // anum = 条件達成数
  if(self) return dp[n][1][anum] + dp[n][0][anum];
  else return dp[n][1][anum];
}


int main() {
  string s;cin >> s;
  int n = s.size();
  vi v(n,0);
  rep(i,n) v.at(i) = s.at(i) - '0';
  int k;cin >> k;
  cout << ketaDP(v,n,k) << endl;

  return 0;
}


Measured memory_bytes: 3736
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list=new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//int[] array = new int[1000000000*2];
		int n = sc.nextInt();
		if(n%2==0) {
			System.out.println(n/2);
		}
		else {
			int a = n/2;
			System.out.println(a+1);
		}
	}
}

Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

void print_vec(vector<int> vec)
{
  cout << "[";
  for (int i = 0; i < vec.size(); i++)
  {
    cout << vec.at(i) << ", ";
  }
  cout << "]" << endl;
}

int main()
{
  int a, b;
  cin >> a >> b;
  cout << a * b << ' ' << (a + b) * 2 << endl;
}



Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define ss second
#define ff first
#define all(x) x.begin(), x.end()

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

const int oo = 1e9 + 7;
const int mod = 1e9 + 7, maxn = 100100;
const double PI = acos(-1);


int main (){
    ll a, b, d;
    cin >> a >> b;
    d = __gcd(a, b);
    // a/=d;
    // b/=d;
    cout << (a*b)/d << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>

int main(void){
int H,W,i,j;
do {
scanf("%d%d",&H,&W);
if(H!=0||W!=0){
for(i=1;i<=H;i++){
for(j=1;j<=W;j++){
printf("#");}
printf("\n");}
printf("\n");}
}while(H!=0||W!=0);
return 0;
}

Measured memory_bytes: 2584
#include<bits/stdc++.h>
using namespace std;
int w,h,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
string a[51];
bool used[51][51];
int dfs(int y,int x){
  if(y==-1||y==h||x==-1||x==w)return 0;
  if(a[y][x]=='B')return 1;
  if(a[y][x]=='W')return 2;
  if(used[y][x])return 0;
  used[y][x]=1;
  int pr=0;
  for(int t,i=0;i<4;i++){
    t=dfs(y+dy[i],x+dx[i]);
    if(!pr)pr=t;
    else if(t&&pr!=t)pr=3;
  }
  return pr;
}

int main(){
  while(cin>>w>>h,w){
    for(int i=0;i<h;i++)cin>>a[i];
    int usedd[51][51]={};
    for(int i=0;i<h;i++)
      for(int j=0;j<w;j++){	
	memset(used,0,sizeof(used));
	if(a[i][j]=='.')usedd[i][j]=dfs(i,j);
      }
    int ans[5]={};
    for(int i=0;i<h;i++)
      for(int j=0;j<w;j++)
	ans[usedd[i][j]]++;
    cout<<ans[1]<<" "<<ans[2]<<endl;
  }
  return 0;
}

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

#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = ((n)-1); i >= 0; --i)

using namespace std;

using i32 = int;
using i64 = long long;
using u32 = unsigned;
using u64 = unsigned long long;

const i32 MAX_W = 2000;
const i32 MAX_H = 2000;

i32 L[MAX_H][MAX_W];
i32 R[MAX_H][MAX_W];
i32 U[MAX_H][MAX_W];
i32 D[MAX_H][MAX_W];

int main()
{
	int H, W;
	cin >> H >> W;

	vector<vector<int>> S(H, vector<int>(W));
	REP(i, H) {
		string s;
		cin >> s;
		REP(j, W) {
			S[i][j] = (s[j] == '#');
		}
	}

	REP(y, H) {
		REP(x, W) {
			if (S[y][x]) continue;
			U[y][x] = (y == 0) ? 1 : (U[y - 1][x] + 1);
			L[y][x] = (x == 0) ? 1 : (L[y][x - 1] + 1);
		}
	}
	REPR(x, W) {
		REPR(y, H) {
			if (S[y][x]) continue;
			D[y][x] = (y == H-1) ? 1 : (D[y + 1][x] + 1);
			R[y][x] = (x == W-1) ? 1 : (R[y][x + 1] + 1);
		}
	}

	int max_lighted = 0;
	REP(y, H) {
		REP(x, W) {
			const int num_lighted = L[y][x] + R[y][x] + U[y][x] + D[y][x] - 3;
			max_lighted = max(max_lighted, num_lighted);
		}
	}
	printf("%d\n", max_lighted);
	return 0;
}


Measured memory_bytes: 78464
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<string.h>
#include<queue>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
char a;
int main ()
{
    ll n,t;
    scanf("%c",&a);
    printf("%c\n",a+1);

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define int long long 
using namespace std;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MAX(x) *max_element(ALL(x)) //最小値を求める
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 10000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
#define PB push_back //vectorヘの挿入

// int see( vector<pair<string,int>> &a,string f){
//     auto res = find(ALL(a),f);
//     if(res == a.end()){
//         return 0 ;
//     }
//     return *res ;
// }

signed main(){
    ll N ;
    cin >> N ;
    // vector<vector<int>> S(N,vector<char>(20)) ;
    char S[N][20];
    // vector<pair<string,int>> a ;
    map<string,int> a ;

    REP(i,N){
       cin >>  S[i] ; 
        auto itr = a.find(S[i]);        // "xyz" が設定されているか？
        if( itr != a.end() ) {
            a[S[i]]++ ;
        } else {
            a[S[i]] = 1 ;
        }
    }

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






    return 0;
}

Measured memory_bytes: 23032
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main(string[] args)
    {
        int K = int.Parse(Console.ReadLine());
        Console.WriteLine(K % 2 == 0 ? (K / 2) * (K / 2) : (K / 2) * (K + 1) / 2);
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
#define SQR(x) ((x) * (x))

struct Bipartite_Matching
{
  vector< vector< int > > graph;
  int *match;
  bool *used;
 
  Bipartite_Matching(int n)
  {
    graph.resize(n);
  }
  void add_edge(int u, int v)
  {
    graph[u].push_back(v);
    graph[v].push_back(u);
  }
  bool dfs(int v)
  {
    used[v] = true;
    for(int i = 0; i < graph[v].size(); i++) {
      int u = graph[v][i], w = match[u];
      if(w == -1 || (!used[w] && dfs(w))) {
        match[v] = u;
        match[u] = v;
        return(true);
      }
    }
    return(false);
  }
  int bipartite_matching()
  {
    int ret = 0;
    match = new int[graph.size()];
    used = new bool[graph.size()];
    memset(match, -1, sizeof(int) * graph.size());
    for(int i = 0; i < graph.size(); i++) {
      if(match[i] == -1) {
        memset(used, 0, sizeof(bool) * graph.size());
        ret += dfs(i);
      }
    }
    return(ret);
  }
};
int main()
{
  long long N, M, X[100], Y[100], V[100];
  long long x[100], y[100];
  
  while(cin >> N >> M, N) {
    for(int i = 0; i < N; i++) {
      cin >> X[i] >> Y[i] >> V[i];
    }
    for(int i = 0; i < M; i++) {
      cin >> x[i] >> y[i];
    }

    double low = 0, high = 1e9;
    for(int i = 0; i < 100; i++) {
      double mid = (low + high) / 2.0;
      Bipartite_Matching graph(N + M);
      for(int j = 0; j < N; j++) {
        for(int k = 0; k < M; k++) {
          if(sqrt(SQR(X[j] - x[k]) + SQR(Y[j] - y[k])) <= mid * V[j]) {
            graph.add_edge(j, N + k);
          }
        }
      }
      if(graph.bipartite_matching() == M) high = mid;
      else low = mid;
    }
    cout << fixed << setprecision(10) << low << endl;
  }
}

Measured memory_bytes: 2444
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
using P = pair<ll, ll>;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using Graph = VV;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int Inf = (1 << 30);
ll inf = (1LL << 60);
const int MOD = 1e9 + 7;
int main(){
	int n;
	cin >> n;
	ll ans = 0;
	ans += (n / 500) * 1000;
	n %= 500;
	ans += (n / 5) * 5;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b;
  cin >> a >> b;
  if(a==1 && b==2)cout << 3 << endl; 
  if(a==2 && b==1)cout << 3 << endl;
  if (a==1 && b==3)cout << 2 <<endl;
  if(a==3 && b==1)cout << 2 <<endl;
  if(a==2 && b==3)cout << 1 <<endl;
  if(a==3 && b==2)cout << 1 << endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>

using namespace std;

vector<vector<int> > p(8);
int ret = 0,n;
int ch = 0;
int visited[8] = {};

void dfs(int s){
  visited[s]=1;
  ch++;
  if(ch==n){
    ret++;
    visited[s]=0;
    ch--;
    return;
  }
  for(int i=0;i<(int)p[s].size();i++){
    if(visited[p[s][i]]==0)dfs(p[s][i]);
  }
  visited[s]=0;
  ch--;
  return;
}

int main(){
  int m,a,b;
  cin >> n >> m;
  for(int i=0;i<m;i++){
    cin >> a >> b;
    a--; b--;
    p[a].push_back(b);
    p[b].push_back(a);
  }
  dfs(0);
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <limits>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <numeric> // 最大公約数が使える
#define rep(i, s, g) for (i = s; i < g; i++)
using namespace std;
using ll = long long;
const int inf = 1000000000; //10^9


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

    ll ans=0;

    for (int i = 1; i <=K; i++)
    {
        for (int j  = 1; j <=K; j++)
        {
            for (int k = 1; k <=K; k++)
            {
                ans += gcd(gcd(i,j),k);
            }
            
        }
        
    }
    
    cout << ans << endl;

    
}

Measured memory_bytes: 3644
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};


int main() {
  int N;
  cin >> N;
  vector<ll> A(N), B(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < N; i++) {
    cin >> B[i];
  }
  ll ans = 0;
  for(int k = 0; k < 30; k++) {
    ll T = 1 << k;
    vector<ll> A_(N), B_(N);
    for (int i = 0; i < N; i++) {
      A_[i] = A[i] % (2 * T);
      B_[i] = B[i] % (2 * T);
    }
    sort(B_.begin(), B_.end());
    ll sum = 0;
    for (int i = 0; i < N; i++) {
      ll a = A_[i];
      ll k1 = lower_bound(B_.begin(), B_.end(), 2LL * T - a) - lower_bound(B_.begin(), B_.end(), 1LL * T - a);
      ll k2 = lower_bound(B_.begin(), B_.end(), 4LL * T - a) - lower_bound(B_.begin(), B_.end(), 3LL * T - a);
      sum += k1 + k2;
    }
    if (sum & 1 == 1) {
      ans |= T;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 6552
#include"bits/stdc++.h"
using namespace std;
const int maxn=2e5+7;
long long ans,ans1,ans2;
int a[maxn],l[maxn],n,now,o;
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
    }
    o=0;
    for(int i=n;i>=1;i--){
        if(a[i]==0&&!o){
            l[i]=i,now=i,o=1;
        }
        else if(a[i]==0&&o){
            l[i]=now;
        }
        else{
            o=0;
        }
    }
    ans=0;
    for(int i=1;i<=n;i++){
        ans1=0,ans2=0;
        for(int j=i;j<=n;j++){
            ans1+=a[j];
            ans2=(ans2^a[j]);
            if(ans1==ans2){
                ans++;
                if(a[j]==0){
                    ans+=l[j]-j;
                    j=l[j];
                }
            }
            else break;
        }
    }
    cout<<ans<<endl;
}


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

#define FastRead        ios_base::sync_with_stdio(0);cin.tie(NULL);
#define endl            "\n"
#define NUM             100005
typedef long long ll;


int main()
{
    FastRead

    long long n,w;

    cin>>n>>w;

    vector<ll>weight(n),value(n);

    for(ll i=0;i<n;i++)
    {
        cin>>weight[i]>>value[i];
    }

    vector<ll>dp(w+1,0);

    for(ll i=0;i<n;i++)
    {
        for(ll j=w;j>=weight[i];j--)
        {
            dp[j] = max(dp[j],dp[j-weight[i]]+value[i]);
        }
    }

    cout<<dp[w]<<endl;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main(){
  int X,Y,Z;
  scanf("%d %d %d",&X,&Y,&Z);
  int T;
  T=Z;
  Z=Y;
  Y=X;
  X=T;
  printf("%d %d %d\n",X,Y,Z);
  return 0;
}

Measured memory_bytes: 1708
#include<iostream>
#include<vector>

using namespace std;

class DisjointSet{
public:
  vector<int>rank,p;

  DisjointSet();
  DisjointSet(int size){
    rank.resize(size,0);
    p.resize(size,0);
    for(int i=0;i<size;++i) makeSet(i);
  }

  void makeSet(int x){
    p[x]=x;
    rank[x]=0;
  }

  bool same(int x,int y){
    return findSet(x)==findSet(y);
  }

  void unite(int x,int y){
    link(findSet(x),findSet(y));
  }

  void link(int x,int y){
    if( rank[x]>rank[y]){
      p[y]=x;
    }else{
      p[x]=y;
      if(rank[x]==rank[y]) rank[y]++;
    }
  }
  
  int findSet(int x){
    if(x!=p[x]) p[x]=findSet(p[x]);
    return p[x];
  }
};

int main(){
  int n,a,b,q;
  int t;
  
  cin>>n>>q;
  DisjointSet ds=DisjointSet(n);
  
  for(int i=0;i<q;++i){
    cin>>t>>a>>b;
    if(t==0) ds.unite(a,b);
    else if(t==1){
      if(ds.same(a,b)) cout<<1<<endl;
      else cout<<0<<endl;
    }
  }
  return 0;
}

  
	
    



Measured memory_bytes: 3192
n=int(input())

from collections import deque

option=deque()
option.append("a")
ans=[]

while option:
    s=option.pop()
    if len(s)==n:
        ans.append(s)
        continue
    maxi=0
    for i in s:
        maxi=max(maxi,ord(i))
        
    for i in range(97,maxi+2):
        new_s=s+chr(i)
        if new_s not in option and len(new_s)<=n:
            option.append(new_s)

ans=sorted(ans)
for i in ans:
    print(i)

Measured memory_bytes: 12904
import java.util.*;
import static java.lang.Integer.*;
//import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j,k;
		Scanner sc = new Scanner(System.in);
		int n = parseInt(sc.next());
		int d = parseInt(sc.next());
		sc.close();
		out.println((int)ceil((double)n/(2*d+1)));
	}
}


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

typedef long long ll;
ll MOD = 1000000007;

int main()
{
    int n, cnt = 0;
    cin >> n;
    vector <float> a(n, 0);
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(), a.end());

    for (int i = 0; i < n-1; i++) {
        a[i+1] = (a[i]+ a[i+1]) / 2.0;
    }
    cout << a[n-1] << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=1e3+10;
int l[N],r[N];
int ans[N],n,c;
string s;
int main()
{
    cin>>n;c=0;
    for(int i=1;i<=n;i++){
        cin>>l[i]>>r[i];
        if((l[i]+r[i])%2==0)c--;
        else c++;
    }
    if(abs(c)!=n){
        puts("-1");return 0;
    }
    int m=31+(c<0);
    for(int i=0;i<=30;i++){
        ans[i]=(1<<i);
    }
    if(c<0){
        ans[31]=1;
    }
    cout<<m<<endl;
    for(int i=0;i<m;i++){
        cout<<ans[i];
        if(i!=m-1)cout<<" ";else cout<<endl;
    }
    for(int i=1;i<=n;i++){
        int x=l[i],y=r[i];s.clear();
        if(c<0)x++,s[31]='L';int f=0;
        for(int j=30;j>=0;j--){
            if(abs(x)<abs(y))swap(x,y),f^=1;
            if(x<0)x+=(1<<j),s[j]=(f?'D':'L');
            else x-=(1<<j),s[j]=(f?'U':'R');
        }
        for(int j=0;s[j];j++)cout<<s[j];
        cout<<endl;
    }
}


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

int main() {
  int n;
  cin >> n;
  vector<int> x(n);
  int i;
  for (i = 0; i < n; i++) {
    cin >> x[i];
  }
  sort(x.begin(), x.end());
  cout << (x[n - 1] - x[0] + 1) / 2 << endl;
  return 0;
}



Measured memory_bytes: 3172
#include<iostream>
#include<algorithm>

using namespace std;

int main(void)
{
	int n;
	cin >> n;
	int a[n];
	for(int i=1;i<=n;i++)
		cin >> a[i-1];
	
	sort(a,a+n);

	bool can=true;
	
	if(n%2==1)
		for(int i=1;i<=n;i++)
		{
			if(a[i-1]!=(i/2)*2)
			{
				can=false;
				break;
			}
		}
	else
		for(int i=1;i<=n;i++)
		{
			if(a[i-1]!=((i+1)/2)*2-1)
			{
				can=false;
				break;
			}
		}

	int ans=0;

	if(can==true)
	{
		ans=1;
		for(int i=1;i<=n/2;i++)
			ans=ans*2%1000000007;
	}

	cout << ans << endl;
}

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

fn main() {
    let n:u64 = read();

    let mut p = 1;
    for i in 0..n {
        p = (i + 1) * p  % (10u64.pow(9) + 7);
    }

    println!("{}", p);
}

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


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, ans = 1,push;
  cin >> N;
  vector<int> a(N);

  for(int i = 0;i<N;i++){
	cin >> a.at(i);
  }

  for(int i = 0;i<N;i++){
    if(a.at(ans-1) == 2){
    push = i+1;
    break;
    }
    else {
    ans = a.at(ans-1);
	push = -1;
    }
  }
  cout << push << endl;
  return 0; 
}

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

using namespace std;

#define REP(i,n)	for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPS(i,s,n)	for(int i=(s), i##_len=(n); i<i##_len; ++i)

#define ALL(obj)	(obj).begin(),(obj).end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int 			ll;

typedef pair<int,int>			P;
typedef vector<int>				V;
typedef vector<V>				VV;

template<typename T>string join(const v(T)&v)
{stringstream s;REP(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define MAX 		100010

const ll LINF = (ll)1e18+7;		//
const int INF = 1e9+7;			//2,147,483,647 (Max int)
const ll MOD = 1e9+7;
// テンプレ終了
//====================================================================//

// int DP[MAX];
//12345678901234578901
//あいうえおかきくけこ
//
int main(){
	int H,W;cin>>H>>W;
	int A,B;cin>>A>>B;

	if((H==1&&B>0) || (W==1&&A>0)){puts("No");return 0;}

	REPS(i,1,H+1){
		REPS(j,1,W+1){
			cout << ( i<=B ^ j<=A ) ;
		}
		cout << endl;
	}

	return 0;
}




Measured memory_bytes: 1280
/*
[abc138] A - Red or Not
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
#define ALL(c) (c).begin(), (c).end()

int a;
string s;

string solve() { return a >= 3200 ? s : "red"; }

int main() {
    cin >> a;
    cin >> s;

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int a = scanner.nextInt(), b = scanner.nextInt();
			System.out.println(((a & 1) == 0) || ((b & 1) == 0) ? "Even" : "Odd");
		}
	}
}


Measured memory_bytes: 35704
import math
A, B, H, M = map(int, input().split())
sA = (60*H+M)/360*math.pi
sB = M/30*math.pi
Ax = A*math.cos(sA)
Bx = B*math.cos(sB)
Ay = A*math.sin(sA)
By = B*math.sin(sB)
res = math.sqrt((Ax-Bx)**2+(Ay-By)**2)
print(res)

Measured memory_bytes: 9504
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int ans=0;
  for(int i=1;i<=n;i+=2){
    int yaku=0;
    for(int j=1;j<=i;j++){
      if(i%j==0){
        yaku++;
      }
    }
    if(yaku==8){
      ans++;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3636
n,m,l = map(int,input().split())
A = [list(map(int,input().split())) for i in range(m)]
q = int(input())
S = [list(map(int,input().split())) for i in range(q)]

from scipy.sparse.csgraph import floyd_warshall

for i in range(m):  # ノード番号が1始まりで与えられている場合
    for j in range(2):
        A[i][j] -= 1

for i in range(q):  # ノード番号が1始まりで与えられている場合
    for j in range(2):
        S[i][j] -= 1

M = [[float("inf")] * n for i in range(n)]

for i in range(n):
    M[i][i] = 0

for i in range(m):
    M[A[i][0]][A[i][1]] = A[i][2]
    M[A[i][1]][A[i][0]] = A[i][2]

# for k in range(n):
#     for i in range(n):
#         for j in range(n):
#             M[i][j] = min(M[i][j], M[i][k] + M[k][j])

M = floyd_warshall(M)

for i in range(n):
    for j in range(n):
        M[i][j] = 1 if M[i][j] <= l else float("inf")

for i in range(n):
    M[i][i] = 0

# for k in range(n):
#     for i in range(n):
#         for j in range(n):
#             M[i][j] = min(M[i][j], M[i][k] + M[k][j])

M = floyd_warshall(M)

for i in range(q):
    ans = M[S[i][0]][S[i][1]]-1
    if ans == float("inf"):
        ans = -1
    print(int(ans))

Measured memory_bytes: 43932
#include<cstdio>

int main(){
    long a, b;
    while(scanf("%li %li", &a, &b)!=EOF){
        long x=a, y=b, memo;
        while(y){
            memo=y;
            y=x%y;
            x=memo;
        }
        printf("%li %li\n", x, a*b/x);
    }
    return 0;
}


Measured memory_bytes: 2612
a,b,h,m = map(int,input().split())

import math
x = ((30*h)+30*(m/60))%360
y = (6*m)%360
s = abs(x-y) if abs(x-y) < 180 else 360 - abs(x-y)
#print(s,math.cos(math.radians(s)))

k = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians(s)))

print(k)

Measured memory_bytes: 79916
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#include <bits/stdc++.h>
#define SIZE 300005
#define MOD 1000000007LL
#define EPS 1e-10
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
typedef int_fast64_t ll;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
typedef complex<double> dcomplex;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cerr<<a[i]<<((i==a.size()-1)?"\n":" ");}}
inline void fastio(){cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15);}
ll gcd(ll a,ll b){ll c=max(a,b);ll d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}

template<int N, typename T, T M>
struct ModFact {
    T fact[N+1];
    T ifact[N+1];
    constexpr ModFact() : fact(), ifact() {
        fact[0] = 1;
        for (int i=0; i<N; ++i)
            fact[i+1] = (fact[i]*(i+1))%M;
        ifact[N] = power(fact[N], M-2);
        for (int i=N-1; i >= 0; --i)
            ifact[i] = (ifact[i+1]*(i+1))%M;
    }
    constexpr T power(T a, T b) {
        T r = 1;
        while (b>0) {
            if((b&1)!=0) r = (r*a)%M;
            a = (a*a)%M;
            b >>= 1;
        }
        return r;
    }
    constexpr T comb(T n, T r) {
        return (((fact[n]*ifact[r])%M)*ifact[n-r])%M;
    }
};
 
ModFact<200000, ll, MOD> fact;

int main() {
    fastio();
    ll n, k;
    cin >> n >> k;
    ll ans = 0, tmp;
    ll s = min(n - 1, k);
    FOR(i, 0, s) {
        tmp = (fact.comb(n, i) * fact.comb(n - 1, i)) % MOD;
        ans = (ans + tmp) % MOD;
    }
    cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
using PP = pair<int,pair<int,int>>;
using T = tuple<string,int,int>;
const string EMP = " ";
const ll INF = 1LL<<60;
const ll MOD = 1000000007;

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

  int ans = 0;
  for(int i = 0; i < s.size(); i++){
    if(s[i] != t[i]) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3916
import java.util.*;

public class Main {
  public static void main(String[] args) throws Exception {
    
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    String S = sc.next();
    if (S.length() != A + B + 1){
      System.out.println("No");
    }
    String case1 = S.substring(0, A);
    char case2 = S.charAt(A);
    String case3 = S.substring(A+1);
 
    if (!case1.matches("[0-9]*")) {
      System.out.println("No");
      return;
    }
    if (case2 != '-') {
      System.out.println("No");
      return;
    }
    if (case3.matches("[0-9]*")) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}
    

Measured memory_bytes: 35528
import java.io.InputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;

class MyScanner{
    InputStream stream;
    public MyScanner(){
        stream = System.in;
    }
    
    public int nextInt(){
        int ret = 0;
        try{
            while(true){
                char readed = (char)stream.read();
                if(readed < '0' || readed > '9'){
                    break;
                }
                ret = ret * 10 + (readed - '0');
            }
        }catch(IOException e){
            e.printStackTrace();
        }finally{
            return ret;
        }
    }
}

class Main {
    public static void main(String args[]) {
        try{
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            MyScanner sc = new MyScanner();
            int h = sc.nextInt(), w = sc.nextInt();
            int sum = 0;
            for(int i = 0; i < h; ++i){
                char[] a = br.readLine().toCharArray();
                for(int j = 0; j < w; ++j){
                    if(a[j] == '#'){
                        ++sum;
                    }
                }
            }
            if(sum == h + w - 1){
                System.out.println("Possible");
            }else{
                System.out.println("Impossible");
            }
        }catch(IOException e){
            e.printStackTrace();
        }
    }
}


Measured memory_bytes: 22612
#include<iostream>
#include<cstdio>
#include<cstring>
#include<map>
#include<cstdlib>
#include<stack>
#include<queue>
#include<algorithm>
#include<set>
#include<vector>
#include<cmath>
#include<string>
#include<deque>
#define lmid l,mid,rt<<1
#define rmid mid+1,r,rt<<1|1
using namespace std;
char s[105],t[105];
int main()
{
     scanf("%s",s);
     scanf("%s",t);
     int n=strlen(s),m=strlen(t);
     sort(s,s+n);
     sort(t,t+m);
     bool flag=false;
     int i=0,j=m-1;
     while(i<n||j>=0)
     {
          if(s[i] < t[j]) {
               flag = true;
               break;
          }
          if(s[i]>t[j])
          {
               break;
          }
          i++,j--;
          if(i>=n&&j>=0)
          {
               flag=true;
               break;
          }
          if(i<n&&j<0)
          {
               break;
          }
     }
     if(flag) printf("Yes\n");
     else printf("No\n");
}


Measured memory_bytes: 256
#include <cstdio>

int main()
{
    int x, a, b;
    scanf("%d %d %d", &x, &a, &b);

    int da = x-a;
    int db = x-b;

    if (da < 0)
        da = -da;
    if (db < 0)
        db = -db;

    if (da < db)
        printf("A");
    else
        printf("B");

    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formax=(b);i>=i##formax;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define bitComb(a,n,k) for(int a##x,a##y,a=(1<<k)-1;a<(1<<n);a##x=a&-a,a##y=a+a##x,a=(((a&~a##y)/a##x)>>1)|a##y)
#define uniq(v) sort(all(v));v.erase(unique(all(v)), v.end())
#define bit(n) (1LL<<(n))
#define randInt(l,r) (uniform_int_distribution<ll>(l,r)(rnd))
#define randDouble(l,r) (uniform_real_distribution<double>(l,r)(rnd))
#define dout(d) printf("%.12f\n",d)

typedef long long ll;
typedef __int128_t lll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>ostream& operator<<(ostream& o,const pair<T,Y>& p){return o<<"("<<p.fi<<", "<<p.se<<")";}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return (x%m+m)%m;}
ll modPow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const double PI = acos(-1);
const double EPS = 1e-10;
static random_device rd;
static mt19937 rnd(rd());

const int N = 1e5;
int r, g;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> r >> g;
  cout << g*2-r << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int X = Integer.parseInt(sc.next());
    int Y = Integer.parseInt(sc.next());
    for(int i = 0; i<=X;i++){
      if(2*i + (X - i)*4==Y){
        System.out.println("Yes");
        return;
      }
    }
    System.out.println("No");
  }
}

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

int main(void){
    int A,B;
    cin>>A>>B;
    if(A%2==0||B%2==0){
        cout<<"No"<<endl;
    }else{
        cout<<"Yes"<<endl;
    }
    return 0;
}

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

int main(){
  	int K, A, B;
  	cin >> K >> A >> B;
  	for(int i=A; i<=B; i++){
    	if(i%K == 0){
        	cout << "OK" << endl;
          	return 0;
        }
    }
  	cout << "NG" << endl;
	return 0;
}

Measured memory_bytes: 3540
#include <iostream>
#include <cmath>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)

int solve(const int x, const int y, const int z)
{
  int c = x / (y + z);
  int sum = x - c * (y + z) - z;
  if (sum >= 0) return c;
  else return --c;
}

int main()
{
  int x, y, z;
  cin >> x >> y >> z;
  cout << solve(x, y, z) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;cin>>s;
  ll ans = 0;
  for(auto c:s){
    ans += c-'0';
  }
  cout<<ans<<endl;
  return 0;
}


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

int main() {
string s,t;
int count=0;
cin>>s;
cin>>t;
for(int i=0;i<=s.size();i++){
    if(s[i]==t[i]){
        count++;
    }
}
if(count==s.size()){
    cout<<"Yes"<<endl;
}
else
cout<<"No"<<endl;

return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
#define REP(i,st,ed) for(register int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(register int i=st,i##end=ed;i>=i##end;--i)
typedef long long ll;
template<typename T>inline bool chkmin(T &x,T y){return (y<x)?(x=y,1):0;}
template<typename T>inline bool chkmax(T &x,T y){return (y>x)?(x=y,1):0;}
inline int read(){
	int x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
	return x*f;
}
inline ll readll(){
	ll x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1ll)+(x<<3ll)+(c^'0');
	return x*f;
}
const int maxn=3000+10,mod=1e9+7,inv=(mod+1)/2;
int a[maxn],f[maxn][maxn],g[maxn][maxn];
inline int ksm(int x,int y){
	int res=1;
	while(y){
		if(y&1) res=(ll)res*x%mod;
		x=(ll)x*x%mod;
		y>>=1;
	}
	return res;
}
int main(){
	int n=read(),q=read();
	REP(i,1,n) a[i]=read();
	REP(i,1,n) REP(j,1,n) if(a[i]>a[j]) f[i][j]=1;
	REP(_,1,q){
		int x=read(),y=read();
		REP(i,1,n) g[i][x]=f[i][x],g[i][y]=f[i][y],g[x][i]=f[x][i],g[y][i]=f[y][i];
		REP(i,1,n) if(i!=y && i!=x){
			f[i][x]=(ll)inv*(f[i][x]+g[i][y])%mod;
			f[i][y]=(ll)inv*(f[i][y]+g[i][x])%mod;
			f[x][i]=(ll)inv*(f[x][i]+g[y][i])%mod;
			f[y][i]=(ll)inv*(f[y][i]+g[x][i])%mod;
		}
		f[x][y]=(ll)inv*(f[x][y]+g[y][x])%mod;
		f[y][x]=(ll)inv*(f[y][x]+g[x][y])%mod;
	}
	int ans=0;
	REP(i,1,n) REP(j,1,n) if(i<j) ans=(ans+f[i][j])%mod;
	printf("%lld\n",(ll)ans*ksm(2,q)%mod);
	return 0;
}


Measured memory_bytes: 70912
n,k,q = list(map(int,input().split()))
a = [0 for i in range(n)]
 
for i in range(q):
    b = int(input())
    a[b-1] += 1
for i in range(n):
    if k - (q - a[i]) > 0:
        print("Yes")
    else:
        print("No") 

Measured memory_bytes: 51104
N,*X=map(int,input().split())
S=[input() for i in range(N)]
f=1
d={'AB':(0,1),'AC':(0,2),'BC':(1,2)}
x='ABC'
a=[]
for i in range(N):
    if X[d[S[i]][0]]==1 and X[d[S[i]][1]]==1 and X.count(0)==1 and i<N-1:
        if S[i][0] in S[i+1]:
            X[d[S[i]][0]]+=1
            X[d[S[i]][1]]-=1
            a.append(x[d[S[i]][0]])
        else:
            X[d[S[i]][0]]-=1
            X[d[S[i]][1]]+=1
            a.append(x[d[S[i]][1]])
    elif X[d[S[i]][0]]<X[d[S[i]][1]]:
        X[d[S[i]][0]]+=1
        X[d[S[i]][1]]-=1
        a.append(x[d[S[i]][0]])
    else:
        X[d[S[i]][0]]-=1
        X[d[S[i]][1]]+=1
        a.append(x[d[S[i]][1]])
    if -1 in X:
        f=0;break
print(['No','Yes'][f])
if f:print(*a,sep='\n')

Measured memory_bytes: 18556
#include <stdio.h>

int IsPrime(int);

int main(){
  int n,A[10000],i,x=0,count=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }

 
for(i=0;i<n;i++){
  x=IsPrime(A[i]);
  if(x==1)count++;
  }

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

 return 0;
}



int IsPrime(int k){
 int i;
 
if(k<2)
  return 0;
 else if(k==2)
   return 1;

if(k%2==0)
  return 0;

 for(i=3;i<=k/i;i+=2){
  if(k%i==0)
    return 0;
 }
return 1;
}

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

int main() {
	int n;
	cin >> n;
	string s;
	int ans[4] = {};
	string cs[4] = {"AC", "WA", "TLE", "RE"};
	for (int i = 0; i < n;  i++) {
		cin >> s;
		if (s == "AC") {
			ans[0]++;
		} else if (s == "WA") {
			ans[1]++;
		} else if (s == "TLE") {
			ans[2]++;
		} else if (s == "RE") {
			ans[3]++;
		}
	}

	for (int i = 0; i < 4; i++) {
		cout << cs[i] << " x " << ans[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define upperlimit 1000100
#define INF 1000000100
#define INFL 1000000000000000100
#define eps 1e-8
#define endl '\n'
#define sd(n) scanf("%d",&n)
#define slld(n) scanf("%lld",&n)
#define pd(n) printf("%d",n)
#define plld(n) printf("%lld",n)
#define pds(n) printf("%d ",n)
#define pllds(n) printf("%lld ",n)
#define pdn(n) printf("%d\n",n)
#define plldn(n) printf("%lld\n",n)
#define REP(i,a,b) for(i=a;i<=b;i++)
#define mp make_pair
#define pb push_back
#define pcc pair<char,char>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define tr(container,it) for(typeof(container.begin()) it=container.begin();it!=container.end();it++)
#define F first
#define S second

using namespace std;

ll gcd(ll n1,ll n2){
	if(!n1)return n2;
	if(!n2)return n1;
	if(n1%n2==0)return n2;
	return gcd(n2,n1%n2);
}
ll powmod(ll base,ll exponent)
{
	ll ans=1;
	while(exponent){
		if(exponent&1)ans=(ans*base)%mod;
		base=(base*base)%mod;
		exponent/=2;
	}
	return ans;
}
int arr[upperlimit+1];
int main()
{
	int n,i,j;
	sd(n);
	n*=2;
	for(i=1;i<=n;i++)sd(arr[i]);
	sort(arr+1,arr+n+1);
	int answer=0;
	for(i=1;i<=n;i+=2)answer+=arr[i];
	pdn(answer);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define drep(i,n) for(int i = (n)-1; i >= 0; i--)
#define srep(i,s,t) for (int i = s; i < t; i++)
#define rng(a) a.begin(),a.end()
typedef long long ll;

using namespace std;



int main() {
    int n;
    cin>>n;
    vector<int>d(n);
    rep(i,n)cin>>d[i];
    sort(rng(d));
    int ans;
    ans = d[n/2]-d[n/2-1];
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 3780
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];
        Arrays.setAll(array, i -> sc.nextInt());
        int ans = 0;
        for (int i = 0; i < n; i++) {
            if (i % 2 == 0 && array[i] % 2 == 1) {
                ans++;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 35876
import java.io.PrintWriter
val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val nums = listOfInt()
    var a = nums[0]
    var b = nums[1]

    if (a == 1) {
        a = 14
    }
    if (b == 1) {
        b = 14
    }

    if (a == b) {
        println("Draw")
    } else if (a > b) {
        println("Alice")
    } else {
        println("Bob")
    }
}

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { it.toInt() }

fun println(value : Any) {
    pw.println(value)
}

Measured memory_bytes: 36040