akhauriyash/Code-Regression huggingface dataset:
use proconio::input;

fn main() {
    input! {
        n: usize
    };
    let mut cnt = vec![0; n+1];
    let mut res = 0;
    for i in 1..=n {
        let mut idx = i;
        while idx <= n {
            cnt[idx] += 1;
            idx += i;
        }
        res += cnt[i] * i as i64;
    }
    println!("{}", res);
}


Measured memory_bytes: 80132
fun main(){
    val k = readLine()!!.split(" ").map { it.toInt() }[0]
    val (a,b) = readLine()!!.split(" ").map { it.toInt() }
    var flag = 0
    for (i in 1 until 1000000){
        if (k * i <= b && k * i >= a){
            println("OK")
            flag = 0
            break
        } else {
            flag = 1
        }
    }
    if (flag == 1) println("NG")
}

Measured memory_bytes: 36728
#include <stdio.h>
int gcd(int a,int b){
	if(a%b!=0){
		return gcd(b,a%b);
	}else{ 
		return b;
	}
}
int main(void){
	int x,y;
	scanf("%d %d",&x,&y);
	printf("%d\n",gcd(x,y));
}

Measured memory_bytes: 2748
N = int(input())
XX = [int(i) for i in input().split()]
X = XX.copy()
X.sort()
ans = {}
value = N//2 - 1
for i in range(N):
    if i <= value:
        ans[X[i]] = X[value+1]
    else:
        ans[X[i]] = X[value]

for i in XX:
    print(ans[i])


Measured memory_bytes: 34180
def cmb(n,r,mod):
    p,q=1,1
    if r>n/2:
        r=n-r
    for i in range(r):
        p*=n-i
        p%=mod
        q*=i+1
        q%=mod
    return (p*pow(q,mod-2,mod))%mod
    
n,a,b=map(int,input().split())
mod=10**9+7
v=pow(2,n,mod)-1
print((v-cmb(n,a,mod)-cmb(n,b,mod))%mod)

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

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pf printf
#define sc scanf
#define sf(n) scanf("%d",&n)
#define sff(n1,n2) scanf("%d %d",&n1,&n2)
#define sfff(n1,n2,n3) scanf("%d %d %d",&n1,&n2,&n3)
#define sl(n) scanf("%lld",&n)
#define sll(n1,n2) scanf("%lld %lld",&n1,&n2)
#define slll(n1,n2,n3) scanf("%lld %lld %lld",&n1,&n2,&n3)
#define rep0(i,n) for(i=0;i<n;i++)
#define rep(i,n) for(i=1;i<=n;i++)
#define reps(i,a,n) for(i=a;i<=n;i++)
#define nl puts("");
#define pb push_back
#define MOD 1000000007
#define fi first
#define se second
#define N 100005
#define mem(ara,n) memset(ara,n,sizeof(ara))
#define memb(ara) memset(ara,false,sizeof(ara))
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define sz(x) x.size()
#define pi pair<int,int>
#define pii pair<pair<int,int>,pair<int,int> >
#define line puts("-------");
#define db(x) cout<<#x<<" :: "<<x<<"\n";
#define dbb(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define fr freopen("input.txt","r",stdin);
#define fw freopen("output.txt","w",stdout);
typedef long long int ll;
using namespace std;
int main()
{
    ll l,r;
    sll(l,r);
    ll p=min(r,l+3000);
    ll i,j,ans=1e18;
    for(i=l;i<p;i++)
    {
        for(j=i+1;j<=p;j++)
        {
            ll x=((i%2019)*(j%2019))%2019;
            ans=min(ans,x);
        }
    }
    pf("%lld",ans);
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <climits>
#define ll long long
#define MAX 25 * 1e13
#define N  200010

#define SIZE(A) ((int)A.size())
#define LEN(A) ((int)A.length())
#define MP(A,B) make_pair(A,B)
#define PB(X) push_back(X)
#define EB(X) emplace_back(X)
#define REP(i,a) for(int i=0;i<(a);++i)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()
#define VI vector<int>;

using namespace std;
int MOD = 1000000007;


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,m;
  ll sum = 0;
  cin >> n >> m;
  vector<ll> a(n);
  REP(i,n) {
    cin >> a[i];
    sum += a[i];
  }

  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());

  int cnt = 0;
  REP(i,n){
    if( a[i] * 4 * m < sum ) break;
    else {
      cnt++;
    }
  }

  if( cnt >= m ) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <cstdint>
#include <iostream>

int main() {
  int n;
  std::int64_t ans = 0;
  std::int64_t a[100000], b[100000];
  std::cin >> n;
  for (int ni = 0; ni < n; ++ni) std::cin >> a[ni] >> b[ni];
  for (int ni = n - 1; ni >= 0; --ni) {
    ans += (a[ni] + b[ni] - 1 + ans) / b[ni] * b[ni] - (a[ni] + ans);
  }
  std::cout << ans << std::endl;
}

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

using namespace std;

void solve(vector<vector<int> >& C, int cur_x, int cur_y) {
  C[cur_y][cur_x] = 0;
  for (int i = -1; i < 2; ++i) {
    for (int j = -1; j < 2; ++j) {
      int next_x = cur_x + j;
      int next_y = cur_y + i;
      if (next_x >= 0 && next_x < C[0].size() && next_y >= 0 && next_y < C.size()) {
        if (C[next_y][next_x] == 1)
          solve(C, next_x, next_y);
      }
    }
  }
}


int main(int argc, char* argv[]) {
  vector<int> rets;
  while (true) {
    int w, h;
    cin >> w >> h;

    if (w == 0 && h == 0)
      break;

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

    int ret = 0;
    for (int i = 0; i < h; ++i) {
      for (int j = 0; j < w; ++j) {
        if (C[i][j] == 1) {
          ++ret;
          solve(C, j, i);
        }
      }
    }

    rets.push_back(ret);
  }

  for (int i = 0; i < rets.size(); ++i)
    cout << rets[i] << endl;

  return 0;
}


Measured memory_bytes: 3324
#include <iostream>
#include <cstdio>
#include <cmath>
#define double long double
using namespace std;

double marume( double x ){
	long long t = x * 1000 + ((x > 0) ? 1 : -1) * 0.5;
	return t/1000.0;
}

int main(){
	int n;
	double tx, ty, x1, y1, x2, y2;
	
	cin >> n;
	while(n--){
		cin >> tx >> ty >> x1 >> y1 >> x2 >> y2;
		x1 -= tx; y1 -= ty;
		x2 -= tx; y2 -= ty;
		
		double dist1 = x1 * x1 + y1 * y1;
		double dist2 = x2 * x2 + y2 * y2;
		x1 *= 2; y1 *= 2;
		x2 *= 2; y2 *= 2;
		
		double detA = x1 * y2 - y1 * x2;
		double detX = dist1 * y2 - y1 * dist2;
		double detY = x1 * dist2 - dist1 * x2;
		double x = detX / detA; //if(x < 0){ x -= 1e-5; } else { x += 1e-5; }
		double y = detY / detA; //if(y < 0){ y -= 1e-5; } else { y += 1e-5; }
		double r = hypot(x, y) + 1e-7;
		
		x += tx;
		y += ty;
		
		//x = marume(x);
		//y = marume(y);
		//r = marume(r);
		printf("%.3Lf %.3Lf %.3Lf\n", x, y, r);
	}
	return 0;
}

Measured memory_bytes: 1256
import java.util.*;


public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int n= sc.nextInt();
        String[] w = new String[n];
        w[0] = sc.next();
        String ans = "No";
        
        for(int i=1; i<n; i++){
            w[i] = sc.next();
            for(int j=0; j<i; j++){
                if(w[i].equals(w[j])){
                    System.out.println(ans);
                    return;
                }
            }
            if(w[i].charAt(0)!=w[i-1].charAt(w[i-1].length()-1)){
                System.out.println(ans);
                return;
            }
        }
        
        System.out.println("Yes");
        
	}
}

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

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

int main(){
  int x,n;
  cin>>x>>n;
  if(n==0){
    cout<<x<<endl;
    return 0;
  }
  int vec[n];
  map<int,int> ma;
  for(int i=0;i<n;i++){
    cin>>vec[i];
    ma[vec[i]]++;
  }
  int ans=x;
  for(int i=0;i<500;i++){
    if(ma[ans-i]==0){
      cout<<ans-i<<endl;
      return 0;
    }
    if(ma[ans+i]==0){
      cout<<ans+i<<endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3636
N,M=map(int,input().split())
A=[[] for i in range(N)]
B=[[] for j in range(M)]

for i in range(N):
  s=input().strip()
  A[i]=list(s)
for i in range(M):
  s=input().strip()
  B[i]=list(s)

def check(a,b):
  for i in range(M):
    for j in range(M):
      if A[i+a][j+b] != B[i][j]:
        return False
  return True

ch=False
for i in range(N-M+1):
  if ch:
    break
  for j in range(N-M+1):
    ch=check(i,j)
    if ch:
      break
if ch:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
template <class T>
inline bool chmax(T &a, T b)
{
	if (a < b)
	{
		a = b;
		return 1;
	}
	return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
	if (a > b)
	{
		a = b;
		return 1;
	}
	return 0;
}
const long long INFLL = 1LL << 60;
const int INF = 1 << 28;
const long long MOD = 1000000000 + 7;

int main()
{
	int n,m;
	cin >> n>>m;
	vector<pair<int,int>>data(n+1,pair<int,int>(1,0));
	//value chance
	int ans=0;
	data[0].second=1;
	int ob,oa;
	for(int i=0;i<m;i++){
		cin >>ob>>oa;
		data[ob-1].first--;
		data[oa-1].first++;
		if(data[ob-1].second!=0){
			data[oa-1].second=1;
		}
		if(data[ob-1].first==0){
			data[ob-1].second=0;
		}
	}
	for(int i=0;i<n;i++){
		if(data[i].second!=0){
			ans++;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 1024
/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=1e9+5;
const ll INF=1e18+5;
using P=pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int a,b,c,d,e,x,y,cnt;
  cin >> a >> b >> c >> d >> e;
  x=a*60+b;
  y=c*60+d;
  cnt=y-x-e;
  cout << cnt << endl;
}

Measured memory_bytes: 3652
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<utility>
#include<tuple>
#include<algorithm>
#include<cmath>
using namespace std;

#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;

int main(){
  int A, B;
  char op;
  cin >> A >> op >> B;
  if(op=='+')
    cout << A+B << endl;
  else
    cout << A-B << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;  // vi <=> vl
using P = pair<int, int>;  // int <=> ll
const int MOD = 1e9+7;
const double EPS = 1e-9;

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

  vi number(1001);
  map<int, int> prime;
  rep(i,1001) number[i] = i;
  
  for (int i=2; i<=n; ++i) {
    if (number[i] != 1) {
      prime[number[i]] += n/i;
      for (int j=i*2; j<=n; j+=i) number[j] /= number[i];
    }
  }
  
  ll ans = 1;
  for (auto p : prime) (ans *= p.second + 1) %= MOD;
  cout << ans << endl;
  return 0;
}


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

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// int INF = 1000000007;
		int n = sc.nextInt();

		Integer[] a = new Integer[n];

		LinkedList<Integer> plus = new LinkedList<>();
		LinkedList<Integer> minus = new LinkedList<>();

		for (int i = 0; i < n; i++) {
			int num = sc.nextInt();
			a[i] = num;
			if (num > 0) {
				plus.add(num);
			} else {
				minus.add(num);
			}
		}

		Collections.sort(plus);
		Collections.sort(minus);

		if (minus.size() == 0) {
			minus.addLast(plus.removeFirst());
		}
		if (plus.size() == 0) {
			plus.add(minus.removeLast());
		}

		List<Integer> x = new ArrayList<>();
		List<Integer> y = new ArrayList<>();

		while (minus.size() >= 2) {
			int minusTop = minus.pop();
			int plusTop = plus.removeLast();

			int pl = plusTop - minusTop;

			x.add(plusTop);
			y.add(minusTop);

			plus.addLast(pl);

//			System.out.println(minusTop);
//			System.out.println(plusTop);
		}

		while (plus.size() >= 2) {
			int minusTop = minus.removeLast();
			int plusTop = plus.pop();

			int mi = minusTop - plusTop;
			x.add(minusTop);
			y.add(plusTop);
			minus.addLast(mi);
//			System.out.println(minusTop);
//			System.out.println(plusTop);
		}

//		System.out.println(plus);
//		System.out.println(minus);

		int p = plus.removeFirst();
		int m = minus.removeLast();

		int ans = p - m;
		System.out.println(ans);
		for (int i = 0; i < x.size(); i++) {

			System.out.println(x.get(i) + " " + y.get(i));

		}
		System.out.println(p + " " + m);

	}

}


Measured memory_bytes: 81936
import math
from functools import reduce
 
 
def gcd(*numbers):
    return reduce(math.gcd, numbers)
 
 
K = int(input()) + 1
res = 0
for i in range(1, K):
    for j in range(1, K):
        for k in range(1, K):
            res += gcd(i, j, k)
 
print(res)

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

using namespace std;

int main()
{
    set<int> A = {1,3,5,7,8,10,12};
    set<int> B = {4,6,9,11};
    set<int> C = {2};

    int x, y;
    cin >> x >> y;

    if ((A.count(x) && A.count(y)) || (B.count(x) && B.count(y)) || (C.count(x) && C.count(y))) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#define yorn(f) cout<<((f)?"Yes":"No")<<endl
#define YORN(f) cout<<((f)?"YES":"NO")<<endl
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main()
{
    int a, b, c;
    cin >> a >> b >> c;

    int o = 3;
    if (a == b && b == c) {
        o = 1;
    }
    else if (a == b || b == c || c == a) {
        o = 2;
    }

    cout << o << endl;

    return 0;
}

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

int main()
{
  int n,m;
  cin >> n >> m;
  
  int a[m];
  for(int i = 0; i < m; i++){
    cin >> a[i];
  }
  
  int ans = 0;
  for(int i = 0; i < m; i++){
    ans += a[i];
  }
  
  if(ans > n){
    cout << -1 << endl;
  }else{
    cout << n - ans << endl;
  }
}


Measured memory_bytes: 3624
function main(input) {
	console.log(Math.pow(input[0], 3));
}

var input = '';

process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
  input += chunk;
});
process.stdin.on('end', function() {
  input = input.split(' ');
  main(input);
});

Measured memory_bytes: 7644
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
import std.container;

alias sread = () => readln.chomp();
long bignum = 1_000_000_007;

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

long manhattan(long x1, long y1, long x2, long y2)
{
    return abs(x2 - x1) + abs(y2 - y1);
}

void main()
{
    auto s = sread();
    if(s[0] == s[1] || s[1] == s[2] || s[2] == s[3])
        writeln("Bad");
    else
        writeln("Good");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(void){
  char s[100];
  ll k;
  cin>>s>>k;
  for(int i=0;i<k;i++){
    if(s[i]!='1'){
      printf("%c\n",s[i]);
      return 0;
    }
  }
  cout<<1<<endl;
  return 0;
}

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

A_tmp = sorted(A, key=abs, reverse=True,)
total = 0
for i,v in enumerate(A_tmp):
    if (v <= 0) and (i < len(A_tmp)-1):
        v *= (-1)
        A_tmp[i+1] = (-1) * A_tmp[i+1]
    total += v
print(total)

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

int main() {
    int N,K;
    cin >> N >> K;
    string V;
    
    cin >> V;
    
    if(V[K-1]=='A'){
        V[K-1]='a';
    }else if(V[K-1]=='B'){
        V[K-1]='b';
    }else{
        V[K-1]='c';
    }


    cout << V <<endl;
} 

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

#define step(i, s, n, d) for(int i=s; i<n; i+=d)
#define FOR(i,s,n) step(i,s,n,1)
#define rep(i,n) FOR(i,0,n)
#define list_input(x, n) x[n]; rep(i,n){ cin >> x[i];}
#define ll long long

int main(){
  string S;
  char op[2] = {'+', '-'};
  int AB, CD, ans;
  cin >> S;
  rep(i, 2){
    rep(j, 2){
      rep(k, 2){
        if (i == 0){
          AB = (S[0]-'0') + (S[1]-'0');
        }else{
          AB = (S[0]-'0') - (S[1]-'0');
        }

        if (k == 0) {
          CD = AB + (S[2]-'0');
        }else{
          CD = AB - (S[2]-'0');
        }

        if (j == 0) {
          ans = CD + (S[3]-'0');
        }else{
          ans = CD - (S[3]-'0');
        }

        if (ans == 7) {
          cout << S[0] << op[i] << S[1] << op[k] << S[2] << op[j] << S[3] << "=7" << '\n';
          exit(0);
        }
      }
    }
  }
}

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

/*============================ DEBUGGING =============================*/

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

/*============================= DEFINES ==============================*/

#define eps 1e-9
#define mod  998244353
#define pi 2*acos(0)
#define pb push_back
#define mp make_pair
#define B begin()
#define E end()
#define F first
#define S second
#define tostr(x) to_string(x)
#define SZ(x) ((int)x.size())
#define ins insert
#define rep(i,x,y) for(int i=x;i<y;i++)
#define per(i,x,y) for(int i=x;i>y;i--)
#define repi(i,x,y) for(int i=x;i<=y;i++)
#define peri(i,x,y) for(int i=x;i>=y;i--)
#define inf (ll)LLONG_MAX
#define ds1(i,x) for(auto i=x.begin();i!=x.end();i++)
#define ds2(i,x) for(auto i:x)
#define fib(n) ceil(pow((1+sqrt(5),n)-pow((1-sqrt(5),n)/(float)(pow(2,n)*sqrt(5)
#define FIO {ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);}
#define dig(n) (int)(log10(n)+1)
#define ss(x,k) substr(x,k)  // x is the start pos and k is the length of substr.
#define set(x,k) memset(x,k,sizeof x)

/*============================== TYPEDEFS ============================*/

typedef long long ll;
typedef long double ld;
typedef long l;
typedef string str;
typedef vector<int> vi;
typedef vector<ll> vlli;
typedef vector<bool> vb;
typedef queue<int> qi;
typedef vector<pair<int,int> > vpii;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;

/*============================ START FROM HERE =======================*/

int main(){
	FIO
	
	int n;cin>>n;
	str s;cin>>s;
	if(n%2)cout<<"No";
	else{
		str t1,t2;
		rep(i,0,SZ(s)/2)t1+=s[i];
		rep(i,SZ(s)/2,SZ(s))t2+=s[i];
		if(t1==t2)cout<<"Yes";
		else cout<<"No";
	}
	return 0;
}


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

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 main() {
    int a, b;
    cin >> a >> b;
    cout << lcm(a,b) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
bool f[200],s[200];
int main()
{
	int n,h;
	int m=0;
	scanf("%d",&n);
	char a[200];
	scanf("%s",a);
	memset(f,false,sizeof(f));
	for(int i=0;i<n;i++)
	{
		f[a[i]-'a']=true;
		memset(s,false,sizeof(s));
		for(int j=i+1;j<n;j++)
		{
			s[a[j]-'a']=true;
		}
		h=0;
		for(int j=0;j<26;j++)
		{
			if(f[j]==true&&s[j]==true)
			{
				h++;
			}
		}
		m=max(m,h);
	}
	printf("%d\n",m);
	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##formin=(b);i>=i##formin;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(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o<<endl;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}

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 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){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
//V<ll>F,R;void setF(int n,int mod){F=R=V<ll>(++n);F[0]=1;FOR(i,1,n)F[i]=F[i-1]*i%mod;R[n-1]=modInv(F[n-1],mod);FORR(i,n-1,1)R[i-1]=R[i]*i%mod;}
//ll comb(int a,int b,int m){return a<b||b<0?0:F[a]*R[b]%m*R[a-b]%m;}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7; //998244353;
const int N = 10;
int n, mi=IINF;

main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  int ans = 0;
  FOR(i, 0, n){
    int p;
    cin >> p;
    if(p<mi) ans++;
    mins(mi, p);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long int
#define pb push_back
#define MAX 1000005
#define mod 1000000007
#define sp fixed<<setprecision(12)
using namespace std;
/*
vector<int> primes;
int sumprime[MAX];
bool is_prime[MAX];
void sieve(){
    is_prime[0]=is_prime[1]=true;
    for(int i=4;i<MAX;i+=2){
        is_prime[i]=true;
    }
    for(int i=3;i*i<MAX;i+=2){
        if(!is_prime[i]){
            for(int j=i*i;j<MAX;j+=i){
                is_prime[j]=true;
            }
        }
    }
    for(int i=1;i<MAX;i++){
        if(!is_prime[i]){
            sumprime[i]=sumprime[i-1]+i;
        }else{
            sumprime[i]=sumprime[i-1];
        }
    }
}
*/
/*
void lcs(char s1[],char s2[]){
    int n=strlen(s1);
    int m=strlen(s2);
    vector<vector<int>> dp(n+1,vector<int>(m+1,0));
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            int sum=0;
            if(s1[i-1]==s2[j-1]){
                sum=1+dp[i-1][j-1];
            }
            else{
                sum=max(dp[i-1][j],dp[i][j-1]);
            }
            dp[i][j]=sum;
        }
    }
    
    int index=dp[n][m];
    //cout<<index<<endl;
    char ans[index+1];
    ans[index]='\0';
    index--;
    int x=n;
    int y=m;
    while(x>0 and y>0){
        if(dp[x-1][y]==dp[x][y-1] and dp[x-1][y]!=dp[x][y]){
            ans[index]=s1[x-1];
            index--;
            x--;
            y--;
        }else if(dp[x-1][y]>dp[x][y-1]){
            x--;
        }else{
            y--;
        }

    }
    //reverse(ans.begin(),ans.end());

    cout<<ans;
    return;
}
*/

int dp[100005];

int32_t main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    //double    pi=3.14159265358979323846;
    //sieve();
    int t=1;
    //sieve();
   // cin>>t;
    
    for(int tc=1;tc<=t;tc++){
        int n,k;
        cin>>n>>k;
        vector<int> v(n);
        for(int& x:v){
            cin>>x;
        }
        dp[0]=0;
        for(int i=1;i<=k;i++){
            dp[i]=0;
            for(int x:v){
                if(i>=x and dp[i-x]==0){
                    dp[i]=1;
                    break;
                }
            }
        }
        if(dp[k]==1){
            cout<<"First\n";
        }else{
            cout<<"Second\n";
        }

    }
    
    return 0;
    
}

Measured memory_bytes: 4440
import collections
n=int(input())
S=[]

for i in range(n):
    s=list(str(input()))
    cc=collections.Counter(s)
    S.append(cc)
alphabet=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

ans=[]
for lets in alphabet:
    nin=10**10
    for i in range(n):
        nin=min(nin,S[i][lets])
    for j in range(nin):
        ans.append(lets)
print("".join(ans))


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

S = {X : 1}

path = [X]

cnt = 1
ans = X
a = X
for i in range(2, N + 1):
    a = a * a % M
    if a in S:
        cnt = i - S[a]
        break
    S[a] = i

    ans += a
    path.append(a)

pre_len = S[a] - 1

Q, R = divmod(N - pre_len - 1, len(path) - pre_len)

pre = sum(path[:pre_len])
cycle = sum(path) - pre

ans = a
for _ in range(R):
    a = a * a % M
    ans += a

print(pre + Q * cycle + ans)


Measured memory_bytes: 15704
n = int(input())
x = [[i,int(item)] for i,item in enumerate(input().split())]

x.sort(key= lambda x:x[1])

for i in range(n):
    ans = x[n//2][1] if i < n//2 else x[n//2-1][1]
    x[i].append(ans)

x.sort(key= lambda x:x[0])

for i in range(n):
    print(x[i][2])

Measured memory_bytes: 51392
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <queue>
#include <vector>

using namespace std;

int main() {
  long long n, k;
  cin>>n>>k;
  vector<long long> a(n+1),visit(n+1,-1);
  for(int i=1;i<=n;i++){
      cin>>a[i];
  }
  visit[1]=0;
  long long cnt=0,loop=-1,town=1;
  for(long long i=1;i<=k;i++){
      town=a[town];
     // cout<<town<< "   town"<<endl;
      if(visit[town]==-1){
          visit[town]=i;
      }
      else{
          loop=i-visit[town];
          cnt=i;
          break;
      }
  }
 // cout<<loop<<"  "<<town<<endl;
  if(loop!=-1){
      long long res=(k-cnt)%loop;
      for(long long i=0;i<res;i++){
          town=a[town];
      }
  }
  cout<<town<<endl;
  return 0;
}


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

int main() {
    long n;
    cin >> n;
    bool found = false;
    for (long i=0; i<=120; i++) {
        if (found) break;
        for (long j=0; j<=120; j++) {
            if (pow(i,5)-pow(j,5)==n) {
                cout << i << ' ' << j;
                found = true;
                break;
            }
            if (pow(i,5)+pow(j,5)==n) {
                cout << i << " -" << j;
                found = true;
                break;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 4048
from collections import Counter
n=int(input())
s=list(input())
C=Counter(s)
r,g,b=C["R"],C["G"],C["B"]
ans=r*g*b

for i in range(n-2):
    for j in range(i+1,n-1):
        k=2*j-i
        if k<=n-1 and s[i]!=s[j] and s[j]!=s[k] and s[k]!=s[i]:
                ans-=1

print(ans)

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

int main(void)
{
    double a, b; cin >> a >> b;
    int ans = 1;
    double p1, p2;
    bool flag = false;
    while (ans <= 2000)
    {
        p1 = (double) ans * 0.08;
        p2 = (double) ans * 0.10;
        if (a <= p1 && p1 < a + 1 && b <= p2 && p2 < b + 1)
        {
            flag = true;
            break;
        }
        ans++;
    }
    if (flag) cout << ans << endl;
    else  cout << -1 << endl;
}

Measured memory_bytes: 3696
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
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;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod * mod;
constexpr int MAX = 200010;

lint dfs(lint a, lint K){
    if(a < K || a % K == 0) return a / K;
    lint t = div_ceil(a-a/K*K, a/K+1);
    return dfs(a-t*(a/K+1), K);
}

int main(){
    int n;
    scanf("%d", &n);
    lint X = 0;
    rep(_, n){
        lint a, K;
        scanf("%lld%lld", &a, &K);
        X ^= dfs(a, K);
    }
    puts(X ? "Takahashi" : "Aoki");
}

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



using namespace std;

int main() {

    int H[100],W[100];
    int count = 0;


    while (1) {
        cin >> H[count] >> W[count];
        if (H[count] == 0 && W[count] == 0) {
            break;
        }
        count++;
    }


     
    for (int k = 0; k < count; k++) {
        for (int i = 0; i < W[k]; i++) {
            cout << '#';
        }
        cout << endl;
        for (int j = 1; j < H[k] - 1; j++) {
            cout << '#';
            for (int i = 1; i < W[k] - 1; i++) {
                cout << '.';
            }
            cout << '#' << endl;
        }
        for (int i = 0; i < W[k]; i++) {
            cout << '#';
        }
        cout << endl;
        cout <<endl;
    }
        
    

    
}


Measured memory_bytes: 3100
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

S = input()

now = ""
count = 0

for stone in S:
	if stone != now:
		count += 1
	now = stone
print(count-1)

Measured memory_bytes: 3956
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        int a,b,d,r;
        double f;
    	//?¨??????\??????????????????????????§????????????
		Scanner scanner = new Scanner(System.in);

		a = scanner.nextInt();
    	b = scanner.nextInt();

    	d = a/b;
    	r = a%b;
    	//?????°????¨?????????????int???????????£??????
    	f = (double)a/b;

    	System.out.printf("%d %d %5f",d,r,f);
    	scanner.close();
    }
}

Measured memory_bytes: 26340
from bisect import bisect_left
from itertools import accumulate
N, M = map(int, input().split())
A = sorted(list(map(int, input().split())))

# にぶたん: Ai + Aj が X以上となるようなものがM通り以上あるか？
ok, ng = 0, 2 * 10 ** 5 + 1
while abs(ok - ng) > 1:
    X = (ok + ng) // 2
    cnt = 0
    for a in A:
        cnt += N - bisect_left(A, X - a)
        if cnt >= M:
            ok = X
            break
    else:
        ng = X

# 規定値以上のものを全てとる（ギリギリK個を超える）
ans = 0
cnt = 0
A_acc = [0] + list(accumulate(A[::-1]))[::-1]

for a in A:
    i = N - bisect_left(A, ok - a)
    cnt += i
    ans += a * i + A_acc[-i]

# 取りすぎた分を削る
ans -= max(0, cnt - M) * ok
print(ans)


Measured memory_bytes: 63052
#include <cstdio>
#include <algorithm>
using namespace std;

const int N = 200000;
int a[2][N];

int main() 
{
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) scanf("%d%d", a[0] + i, a[1] + i);
	sort(a[0], a[0] + n);
	sort(a[1], a[1] + n);
	if (n & 1) printf("%d\n", a[1][n / 2] - a[0][n / 2] + 1);
	else printf("%d\n", a[1][n / 2] + a[1][n / 2 - 1] - a[0][n / 2] - a[0][n / 2 - 1] + 1);
	return 0;
}


Measured memory_bytes: 3292
import sys

c = int(input())

a = []
for line in sys.stdin :
    a.append(line)
    c -= 1
    if c == 0 :
        break

for i in range(0, len(a)) :
    a[i] = a[i].strip().split(" ")
    a[i][1] = int(a[i][1])

for i in ["S", "H", "C", "D"] :
    for j in range(1, 13+1) :
        if a.count([i, j]) == 0 :
            print(str(i) + " " + str(j))


Measured memory_bytes: 5600
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const auto INF = (ll)1e9+7;  
using  p = pair<int,int>;
using  v = vector<int>;
auto c = vector<ll>(9,0);

void color(ll i){
   if(i<3200){
   		c[i/400]++;
	}else{
		c[8]++;
	}
}


int main(){
  int n;
  cin >> n;
  auto a = vector<ll>(n,0);
  for (int i = 0; i < n; i++)
  {
     cin >> a[i];
     color(a[i]);
  }

  ll _min = count_if(c.begin(),c.end()-1,[](int i){return i!=0;});
  ll _max =0;
  if(_min!=0){
  	_max = _min+c[8];
  }else{
    _min = 1;
  	_max = c[8];
  }
  cout << _min << " "<<_max;
}
  

Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as C
import Data.IntSet hiding (foldl')
import Data.List hiding (delete, insert)

main = C.interact $ put . sol . tail . get
get = unfoldr (C.readInt . C.dropWhile (<'0'))
put = C.pack . show

sol = size . foldl' f empty

f s x = if x `member` s 
  then delete x s 
  else insert x s

Measured memory_bytes: 18224
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
/*using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()*/


int main() {
  long long int n, ans = 0;
 
  scanf("%lld", &n);
 
  vector<long long int> a(3 * n);
 
  for (int i = 0; i < 3 * n; i++)
  {
    scanf("%lld", &a[i]);
}
    sort(a.begin(), a.end(), greater<int>());
 
  for (int i = 0; i < n; i++)
  {
    ans += a[2 * i + 1];
  }
 
  printf("%lld", ans);
}



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

const int mxN=1e5+1;

void solve(){
    string s;
    cin>>s;
    if(s.back()=='s')
    {
        s.push_back('e');
        s.push_back('s');
    }
    else
        s.push_back('s');
    cout<<s<<endl;
}

signed main(){
    int t;
//    cin>>t;
//    while(t--){
        solve();
//    }
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

ll binomialCoeff(ll n, ll k) 
{ 
    ll C[k+1]; 
    memset(C, 0, sizeof(C)); 
  
    C[0] = 1;  // nC0 is 1 
  
    for (ll i = 1; i <= n; i++) 
    { 
        // Compute next row of pascal triangle using 
        // the previous row 
        for (ll j = min(i, k); j > 0; j--) 
            C[j] = C[j] + C[j-1]; 
    } 
    return C[k]; 
} 

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n=nxt();
    vector <int> v(n);
    generate(all(v),nxt);
    vector <int> front,rear;
    bool reverse=0;
    for(int i=0;i<n;i++)
    {
        if(reverse)
        {
            front.push_back(v[i]);
            reverse=0;
        }
        else
        {
            rear.push_back(v[i]);
            reverse=1;
        }
    }
    if(!reverse)
    {
        for(int i=front.size()-1;i>=0;i--)
        cout<<front[i]<<" ";
    for(int i=0;i<rear.size();i++)
        cout<<rear[i]<<" ";
    cout<<endl;
    }  
    else
    {
        for(int i=rear.size()-1;i>=0;i--)
        cout<<rear[i]<<" ";
    for(int i=0;i<front.size();i++)
        cout<<front[i]<<" ";
    cout<<endl;
    } 
    

    
    return 0;   
}




 
 


Measured memory_bytes: 3956
n = int(input())
A = []
B = []
for i in range(n):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

A.sort()
B.sort(reverse=True)

# print(A)
# print(B)
if n % 2 == 1:
    a = (n+1)//2-1
    print(B[a]-A[a]+1)
else:
    a = n//2-1
    b = n//2
    print(B[a]+B[b]-(A[a]+A[b])+1)

# print(a)


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

#define rep(i, n) for (ll i = -100; i < (ll)(n); i++)
#define ll long long
using namespace std;

int main() {
  int x;
  cin >> x;
  rep (i, 1000) {
    rep (j, 1000) {
      if (pow (i, 5) - pow (j, 5) == x) {
        cout << i << " " << j << endl;;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 4096
N, c = map(int, input().split())
time = [0 for i in range(100001)]
time_c = [[0 for i in range(100001)] for j in range(c)]
          
for i in range(N):
    S, T, C = map(int, input().split())
    time_c[C - 1][S] += 1
    time_c[C - 1][T] -= 1
    
for i in range(100001):
    for j in range(c):
        if time_c[j][i] > 0:
            time[i - 1] += time_c[j][i]
        if time_c[j][i] < 0:
            time[i] += time_c[j][i]

for i in range(1, 100001):
    time[i] += time[i - 1]

print(max(time))


Measured memory_bytes: 27824
#include <stdio.h>

int N; long long M;
int I[3030][3030]; long long inv[3030]={0,1},fact[3030]={1,1},ifact[3030]={1,1};

long long comb(int n, int k)
{
	return fact[n] * ifact[k] % M * ifact[n-k] % M;
}

void add(int &a, int b)
{
	a += b;
	if (a >= M)
		a -= M;
}

long long fpow(long long a, long long p, long long m = M)
{
	long long r = 1;
	while (p){
		if (p & 1) r = r * a % m;
		a = a * a % m;
		p /= 2;
	}
	return r;
}

long long tpow(int p)
{
	return fpow(2,fpow(2,p,M-1),M);
}

int main()
{
	scanf ("%d %lld",&N,&M);

	for (int i=2;i<=N;i++){
		inv[i] = (M - M / i) * inv[M % i] % M;
		fact[i] = fact[i-1] * i %  M;
		ifact[i] = ifact[i-1] * inv[i] % M;
	}

	I[0][0] = 1;
	for (int i=0;i<N;i++){
		for (int j=0;j<N;j++) if (I[i][j]){
			add(I[i+1][j+1],I[i][j]);
			add(I[i+1][j],I[i][j]*(j+1ll)%M);
		}
	}

	int ans = 0;
	for (int i=0;i<=N;i++){
		long long rem = fpow(2,N-i), mul = 1; int sum = 0;
		for (int j=0;j<=N;j++){
			add(sum, I[i][j] * mul % M);
			mul = mul * rem % M;
		}

		long long coeff = tpow(N-i) * comb(N,i) % M;
		if (i % 2) coeff = M - coeff;
		add(ans, coeff * sum % M);
	}

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

	return 0;
}

Measured memory_bytes: 34432
inputs = Array.new
while line = $stdin.gets
  inputs << line.chomp
end

N, M = inputs[0].split(" ").map(&:to_i)

arrL = []
arrR = []

inputs[1..-1].each_with_index do |line, index|
  li, ri = line.split(" ").map(&:to_i)
  arrL << li
  arrR << ri
end

maxL = arrL.max
minR = arrR.min

res = minR - maxL + 1
res = 0 if res < 0

puts res

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

using namespace std;

int main()
{
	string s; cin >> s;
  	bool ans = false;
  	for (int i = 0; i < s.size()-1; i++){
		if (s[i] == s[i+1]){
			ans = true;
        }
    }
	
  	cout << (ans ? "Bad" : "Good") << endl;

}

Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;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()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}

int main() {
    int n, m;
    int arr[51]; INITA(arr, 0, 50, 0);
    cin >> n >> m;

    int a, b;
    REP(i, m) {
        cin >> a >> b;
        arr[a]++;
        arr[b]++;
    }
    FOR(i, 1, n) {
        cout << arr[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] a = new int[n];
		for(int i=0;i<n;i++) {
			a[i] = in.nextInt();
		}
		if(n==2) {
			System.out.println(Math.max(a[0], a[1]));
		}else {
			int[] array = new int[3];
			array[0] = gcd(a[0],a[1]);
			array[1] = gcd(a[0],a[2]);
			array[2] = gcd(a[1],a[2]);
			Arrays.sort(array);
			int highest = array[2];
			int highest2 = array[1];
			int unRemoved = gcd(array[0],a[2]);
			for(int i=3;i<n;i++) {
				array[0] = gcd(highest,a[i]);
				array[1] = gcd(highest2,a[i]);
				array[2] = unRemoved;
				Arrays.sort(array);
				highest = array[2];
				highest2 = array[1];
				unRemoved = gcd(unRemoved,a[i]);
			}
			System.out.println(highest);
		}
		in.close();
		
		

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

}


Measured memory_bytes: 50380
package main

import (
	"fmt"
	"log"
)

func solution(n, m int) int {
	var ans int

	// n: 偶数
	even := make([]int, n)
	for i := range even {
		even[i] = 2
	}
	// m: 奇数
	odd := make([]int, m)
	for i := range odd {
		odd[i] = 1
	}

	log.Print(odd)
	log.Print(even)
	number := append(odd, even...)

	for i := 0; i < n+m; i++ {
		for j := 0; j < n+m; j++ {
			if i != j && (number[i]+number[j])&1 != 1 {
				ans++
			}
		}
	}
	return ans / 2
}

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	fmt.Println(solution(n, m))
}


Measured memory_bytes: 512
n, y = list(map(lambda x: int(x), input().split(" ")))

flag = False
for i in range(0, n+1):
    for j in range(0, n-i+1):
        k = n-i-j
        yen = i * 10000 + j * 5000 + k * 1000
        if y == yen:
            print(str(i)+" "+str(j)+" "+str(k))
            flag = True
            break
    if flag:
        break
if flag == False:
    print("-1 -1 -1")

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

class Main {
    void run() throws IOException{
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        while(true){
            String num = in.readLine();
            String[] tmp = num.split(" ", 0);
            int player = Integer.parseInt(tmp[0]);
            int stone = Integer.parseInt(tmp[1]);
            if(player == 0 && stone == 0) {
                break;
            }
            int[] plist = new int[player];
            int ans = stone;
            for(int i = 0;; i++) {

                if(i == player) {
                    i = 0;
                }
               
                if(stone != 0) {
                    plist[i] += 1;
                    stone -= 1;
                    if(plist[i] == ans) {
                        System.out.println(i);
                        break;
                    }
                }
                else if(plist[i]!=0){
                    stone += plist[i];
                    plist[i] = 0;
                }
            
            }
        }
    }
    public static void main(String[] args) throws IOException{
        Main ma = new Main();
        ma.run();
    }
}

Measured memory_bytes: 25240
#include<cstdio>
int main(){
	int a;
	scanf("%d",&a);
	if(a<2) printf("1\n");
	if(2<=a&&a<4) printf("2\n");
	if(4<=a&&a<8) printf("4\n");
	if(8<=a&&a<16) printf("8\n");
	if(16<=a&&a<32) printf("16\n");
	if(32<=a&&a<64) printf("32\n");
	if(64<=a&&a<=100) printf("64\n");
	return 0;
}

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

int main(){
  char pas[100];
  int k = 0;
  int n;
  scanf("%s", pas);
  n = strlen(pas);

  for(int i = 0; i < n; ++i){
    if(i%2 == 0){
      if (!(pas[i] == 'R' || pas[i] == 'U' || pas[i] == 'D')){
        k = 1;
      }
    }
    else{
      if (!(pas[i] == 'L' || pas[i] == 'U' || pas[i] == 'D')){
        k = 1;
      }
    }
  }
  if(k == 0){
    printf("Yes\n");
  }
  else{
    printf("No\n");
  }
  return 0;

}


Measured memory_bytes: 128
while True:
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        break
    if a < b:
        a, b = b, a
        
    X = a
    Y = b
    i = 0
    
    while True:
        X %= Y
        X, Y = Y, X
        i += 1
        if Y == 0:
            break
            
    print(X,i)


Measured memory_bytes: 5604
#include<stdio.h>
#include<stdlib.h>
int MAX_BASH = 1000;

int main(){
  int bash[MAX_BASH];
  int i, j, temp, top, second, third;
  for(i=0; i<10; i++){
    scanf("%d",&bash[i]);
  }
  for(i=0; i<10; i++){
    for(j=i+1; j<10; j++){
      if(bash[i]<=bash[j]){
        temp = bash[i];
        bash[i] = bash[j];
        bash[j] = temp;
      }
    }
  }
  top = bash[0];
  second = bash[1];
  third = bash[2];
  printf("%d\n",top);
  printf("%d\n",second);
  printf("%d\n",third);
  return 0;
}

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

int main() {
  
  int n, m;
  cin >> n >> m;
  
  vector<vector<int>> X(n, vector<int>(m));
  
  for (int i=0; i<n; i++) {
	for (int j=0; j<m; j++) {
	  cin >> X.at(i).at(j);
    }
  }
  
  vector<int> Y(m);
  for (int j=0; j<m; j++) {
    cin >> Y.at(j);
  }
  
  vector<int> Z(n, 0);
  
  for (int i=0; i<n; i++) {
	for (int j=0; j<m; j++) {
	  Z.at(i) += X.at(i).at(j)*Y.at(j);
    }
    cout << Z.at(i) << endl;
  }
  
  return 0;
}



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

int main(){
  ll w,h,x,y;
  cin >> w >> h >> x >> y;
  cout << w*h/2;
  if((w*h)%2==1){
    cout << ".5";
  }
  
  cout << " ";
  if(x*2==w&&y*2==h){
    cout << 1 << endl;
  }else{
    cout << 0 << endl;
  }
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
#define ll long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) // rep(i, 1, 5) --> {1,2,3,4} // rep(i, 5, 1) --> {4,3,2,1} // rep(it, end(v), begin(v)) --> *it

using namespace std;

int main()
{
    int a,b,c;
    cin >> a >> b >> c;
    cout << min({a+b,a+c,b+c});
    return 0;
}

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

int main() {
	string s,t;
	cin>>s;
	cin>>t;
	int m=s.length();
	int n=t.length();
	int k=0;
	if(n==m+1)
	{
	for(int i=0;i<m;i++)
	{
	    if(t[i]==s[i])
	     k++;
	     
	    
	      
	      
	}
	    if(k==m)
	     cout<<"Yes"<<"\n";
	    else
	       cout<<"No"<<"\n";
	}
	
}

Measured memory_bytes: 3628
#include<stdio.h>
int main()
{
	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);
	if (a < b && b < c)
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 2576