akhauriyash/Code-Regression huggingface dataset:
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
use std::collections::HashMap;
use std::cmp::{max,min};
fn main(){
    input!{
        n:usize,
        an:[usize;n],
    }
    let mut sub:Vec<(usize,&usize)> = an.iter().enumerate().collect();
    sub.sort_by_key(|k| k.1);
    for i in 0..sub.len()-1 {
        print!("{} ",sub[i].0+1);
    }
    println!("{}",sub[n-1].0+1);
}


fn is_prime(x:i64) -> bool {
    if x == 2 {return true;}
    if x < 2 || x % 2 == 0 {return false;}
    let mut j = 3;
    while j <= (x as f64).sqrt() as i64 {
        if x % j == 0 {
            return false;
        }
        j += 2;
    }
    true
}


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

int main(){
	int N;
	int maxii=-1;
	int sum=0;
	scanf("%d",&N);
	while(N--){
		int temp;
		scanf("%d",&temp);
		sum+=temp;
		maxii=max(maxii,temp);
	}
	sum-=maxii;
	if(maxii<sum){
		printf("Yes");
	}else{
		printf("No");
	}
	return 0;
}

Measured memory_bytes: 128
($H,$W,$d)=glob<>;
if($d%2){
	for(1..$H/2){
		print'RG'x($W/2),'R'x($W%2),$/;
		print'GR'x($W/2),'G'x($W%2),$/;
	}
	for(1..$H%2){
		print'RG'x($W/2),'R'x($W%2),$/;
	}
}else{
	$x=$d;
	for(0..$H-1){
		if($f==0){
			print substr+('Y'x(($d-$x)/2).'R'x$x.'B'x($d-$x).'G'x$x.'Y'x(($d-$x)/2))x($W/$d+1),0,$W;
			print$/;
			$x-=2;
			if($x==0){++$f}
		}elsif($f==1){
			print substr+('Y'x(($d-$x)/2).'G'x$x.'B'x($d-$x).'R'x$x.'Y'x(($d-$x)/2))x($W/$d+1),0,$W;
			print$/;
			$x+=2;
			if($x==$d){++$f}
		}elsif($f==2){
			print substr+('B'x(($d-$x)/2).'G'x$x.'Y'x($d-$x).'R'x$x.'B'x(($d-$x)/2))x($W/$d+1),0,$W;
			print$/;
			$x-=2;
			if($x==0){++$f}
		}elsif($f==3){
			print substr+('B'x(($d-$x)/2).'R'x$x.'Y'x($d-$x).'G'x$x.'B'x(($d-$x)/2))x($W/$d+1),0,$W;
			print$/;
			$x+=2;
			if($x==$d){$f=0}
		}
	}
}


Measured memory_bytes: 1024
# import time
# p0 = time.time()

N = int(input())
A = list(map(int,input().split()))
# print(A)
A = [[A[i],i] for i in range(N)]
A.sort(reverse=True)
# print("A :",A)
dp = [[0]*(N+1) for _ in range(N+1)]
# print(dp)

#dp[x][y] : x人は Ai*(i-pi),y人は Ai*(pi-i)
#           piは 0,1,2...   piはN-1,N-2,N-3,,
# p1 = time.time()-p0

dp[0][0] = 0
# y = 0
for x in range(1,N+1):
    dp[x][0] = dp[x-1][0]+A[x-1][0]*(A[x-1][1]-x+1)
    # print(x,dp)
# x = 0
for y in range(1,N+1):
    dp[0][y] = dp[0][y-1]+A[y-1][0]*(N-y - A[y-1][1])
    # print(x,dp)

# p2 = time.time()-p0
for x in range(1,N):
    for y in range(1,N+1-x):
        A0 = A[x+y-1][0]
        A1 = A[x+y-1][1]
        dp[x][y] = max(dp[x-1][y] + A0*(A1+1 - x), dp[x][y-1] + A0*(N-y - A1))
# print(dp)

# p3 = time.time()-p0

c = 0
for i in range(N):
    if c < dp[i][N-i]:
        c = dp[i][N-i]
print(c)

# print(p1,p2,p3)

Measured memory_bytes: 124736
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
using namespace std;
#define EPS 1e-10

struct Point{
    double x,y;
    Point(){}
    Point(double _x,double _y){
        x=_x; y=_y;
    }
    Point operator +(const Point p)const{
        return Point(x+p.x,y+p.y);
    }
    Point operator -(const Point p)const{
        return Point(x-p.x,y-p.y);
    }
    Point operator *(const double d)const{
        return Point(x*d,y*d);
    }
    bool operator <(const Point &p)const{
        if(x==p.x) return y<p.y;
        return x<p.x;
    }
    double norm(){
        return x*x+y*y;
    }
};

struct Line{
    Point a,b;
    Line(){}
    Line(Point _a,Point _b){
        a=_a; b=_b;
    }
};

struct Circle{
    Point c;
    double r;
    Circle(){}
    Circle(Point _c,double _r){
        c=_c; r=_r;
    }
};

double dot(Point p,Point q){
    return p.x*q.x+p.y*q.y;
}

double cross(Point p,Point q){
    return p.x*q.y-q.x*p.y;
}

int ccw(Point a,Point b,Point c){
    if(cross(b-a,c-b)>0) return +1;
    if(cross(b-a,c-b)<0) return -1;
    return 0;
}

bool intersect_ss(Line l,Line m) {
    return ccw(l.a,m.a,l.b)*ccw(l.a,m.b,l.b)<=0 && ccw(m.a,l.a,m.b)*ccw(m.a,l.b,m.b)<=0;
}

bool crosspoint_ll(Line l,Line m,Point &p){
    Point a1,a2,b1,b2;
    a1 = l.b-l.a; a2 = m.b-m.a;
    b1 = m.a-l.a; b2 = m.b-l.a;
    double s1,s2;
    s1 = abs(cross(a1,b1)/2); s2 = abs(cross(a1,b2)/2);
    if(s1<EPS && s2<EPS) return false;
    p = Point(m.a.x+a2.x*s1/(s1+s2),m.a.y+a2.y*s1/(s1+s2));
    return true;
}

bool crosspoint_ss(Line l,Line m,Point &p){
    if(intersect_ss(l,m)==false) return false;
    return crosspoint_ll(l,m,p);
}

int crosspoint_cc(Circle c1,Circle c2,Point &p1,Point &p2){
    double d,a,t;
    d = sqrt((c2.c-c1.c).norm());
    if(d<abs(c1.r-c2.r) || c1.r+c2.r<d) return 0;
    a = acos((c1.r*c1.r+d*d-c2.r*c2.r)/(2*c1.r*d));
    t = atan2(c2.c.y-c1.c.y,c2.c.x-c1.c.x);
    p1 = Point(c1.c.x+c1.r*cos(t+a),c1.c.y+c1.r*sin(t+a));
    p2 = Point(c1.c.x+c1.r*cos(t-a),c1.c.y+c1.r*sin(t-a));
    if(abs(p1.x-p2.x)<EPS && abs(p1.y-p2.y)<EPS) return 1;
    return 2;
}

int main(){
    Circle c[2];
    for(int i=0;i<2;i++) cin>>c[i].c.x>>c[i].c.y>>c[i].r;
    Point cp[2];
    crosspoint_cc(c[0],c[1],cp[0],cp[1]);
    sort(cp,cp+2);
    printf("%.8lf %.8lf %.8lf %.8lf\n",cp[0].x,cp[0].y,cp[1].x,cp[1].y);
}

Measured memory_bytes: 1296
import java.io.*;

public class Main {
	public static void main(String args[]) throws IOException{
		String str;
		String[] dataSet;
		int dataSet_Number;
		double a,b,c,i;
		BufferedReader input =
				new BufferedReader(new InputStreamReader(System.in));
		dataSet_Number = Integer.parseInt(input.readLine());
		
		for(i = 0; i < dataSet_Number; i++){
			str = input.readLine();
			dataSet = str.split(" ");
			a = Math.pow(Double.parseDouble(dataSet[0]),2);
			b = Math.pow(Double.parseDouble(dataSet[1]),2);
			c = Math.pow(Double.parseDouble(dataSet[2]),2);
			
			if((a + b) == c || (b + c) == a || (a + c) == b){
				System.out.println("YES");
			}else{
				System.out.println("NO");
			}
		}
	}
}

Measured memory_bytes: 22368
let f = function
    4 -> 5
  | 5 -> 7
  | 6 -> 8
  | 7 -> 9
  | i -> i
;;

let () =
  let rec read () =
    let n = read_int () in
    if n = 0 then ()
    else
      begin
        let rec loop n b p =
          let m = n / 8 and
              r = n mod 8 in
          if m = 0 then
            b + (f r)*p
          else
            loop m (b + (f r)*p) (p*10)
        in
        Printf.printf "%d\n" (loop n 0 1);
        read ()
      end
  in read ()
;;

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

int main(){
  int n,min=100000;

  cin >> n;

  for (int i = 0; i < n; i++){
    int temp, count=0;
    cin >> temp;
    while(temp%2 == 0){
      ++count;
      temp /=2;
    }
    if(count < min)
    min = count ;
  }
  cout << min << endl;
}


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

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
using namespace std;

int main() {
  long long N,M,h=0,cost =0;
  cin >> N >> M;
  long long a,b;
  vector<pair<long long , long long> > v(N);
  for (long long i = 0; i < N; i++) {
    cin >> a >> b;
    v[i].first = a;
    v[i].second = b;
  }
  VSORT(v);
  for (long long i = 0; i < N; i++) {
    h += v[i].second;
    cost += v[i].first * v[i].second;
    if(h > M) {
      cost -= (h-M) * v[i].first;
      break;
    }
  }
  cout << cost << endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#define INF (long)1e9
const int MOD = 1e9 + 7;
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, 1, -1};
using namespace std;
typedef long long ll;
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a, b, c;
	cin >> a >> b >> c;
	int cnt = 0;
	int tmp = a;
	while(1)
	{
		if(a % b == c)
		{
			cout << "YES" << endl;
			return 0;
		}
		a += tmp;
		if(cnt >= 1000000)
			break;
		cnt++;
	}
	cout << "NO" << endl;
	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
int main (void)
{
	int z,i,j,k,n,count, y;
	scanf("%d",&n);
	int x[n];
	count=0;
	for(i=0;i<n;i++)
	{
		scanf("%d",&x[i]);
	}
	for(i=0;i<n;i++)
	{
		z=i;
		for(j=i;j<n;j++)
		{
			if(x[j]<x[z])
			{
				z=j;
			}
		}
		if(x[i]!=x[z])
		{
		y=x[i];
		x[i]=x[z];
		x[z]=y;
		count++;
		}
	}
	for(k=0;k<n;k++)
			{
				printf("%d",x[k]);
				if(k==n-1)
				{
					break;
				}
				printf(" ");
			}
			printf("\n");
		printf("%d",count);
		printf("\n");

}


Measured memory_bytes: 2088
num_deck, num_path = map(int, input().split())
deck_heights = list(map(int, input().split()))

ng_deck_dict = {}

for i in range(num_path):
    a_deck_id, b_deck_id = list(map(lambda x: int(x) - 1, input().split()))

    a_deck_height = deck_heights[a_deck_id]
    b_deck_height = deck_heights[b_deck_id]

    if a_deck_height < b_deck_height:
        ng_deck_dict[a_deck_id] = ''
    elif b_deck_height < a_deck_height:
        ng_deck_dict[b_deck_id] = ''
    else:
        ng_deck_dict[a_deck_id] = ''
        ng_deck_dict[b_deck_id] = ''

print(num_deck - len(ng_deck_dict))


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

using namespace std;
using ll = long long;

template <typename K,typename V>
using umap = unordered_map<K,V>;
template <typename V>
using uset = unordered_set<V>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define REP(i,n) for(int i=0;i<n;i++)
#define REPD(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define ALL(v) v.begin(),v.end()

#define INF 1'000'000'000'000 //10^12
#define MOD 1'000'000'007

int main(){

    string s;

    cin >> s;

    int n = (int)s.length();
    if(n == 1){
        cout << "YES" << endl;
        return 0;
    }

    int count[3] = {0};

    REP(i,n){
        count[s[i]-'a']++;
    }

    int zero = 0;

    REP(i,3){
        if(count[i] == 0){
            zero++;
        }
    }
    if(zero == 2){
        cout << "NO" << endl;
    }else if(zero == 1){
        if(n == 2){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }else{
        int mx = max(count[0],count[1]);
        mx = max(mx,count[2]);
        int mn = min(count[0],count[1]);
        mn = min(mn,count[2]);
        if(mx - mn <=1){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }




    return 0;
}


Measured memory_bytes: 3724
#include <bits/stdc++.h>
#include <numeric>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep1(i,n) for (int i = 1; i <= n; ++i)
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
const long long MOD = 1e9+7;
#define precout(val) cout << std::fixed << std::setprecision(20) << val;
const string alphabet = "abcdefghijklmnopqrstuvwxyz";
const int dy[4] = { 0, 1, 0, -1 };
const int dx[4] = { 1, 0, -1, 0 };

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

  string s; cin >> s;
  int n = s.size();
  int t[3];
  t[0] = 0, t[1] = 0, t[2] = 0;
  rep(i, n) {
    ++t[s[i] - 'a'];
  }

  if(abs(t[0] - t[1]) <= 1 && abs(t[1] - t[2]) <= 1 && abs(t[2] - t[0]) <= 1) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}


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


/********************************************************************/
#define M1 1000000007	//Standard primes used in modulo operations
#define M2 998244353
#define PI 3.1415926536
const int INF = INT_MAX;
#define ll long long
#define pll pair<ll,ll>
#define REP(i, a, b) for(ll i=a;i<b;i++)
#define REPR(i, a, b) for(ll i=b-1;i>=a;i--)
#define forr(i, n) for(ll i=0;i<n;i++)
#define ff first
#define ss second
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define MT make_tuple
#define V(a) vector<a>
#define vi vector<ll>
#define endl '\n'
#define ce(ele) cout<<ele<<' '
#define cs(ele) cout<<ele<<'\n'
#define CASE(t) ll t; cin>>t; while(t--)
#define space ' '
#define yes cout<<"Yes"<<endl
#define no cout<<"No"<<endl

void FAST() {	//FAST Input Output, DONT use both scnaf,printf / cin,cout , Use any ONE system
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
ll gcd(ll x, ll y) {	//returns gcd of two long long ints
	if (x == 0) return y;
	return gcd(y % x, x);
}

ll powM(ll x, ll y, ll m) {	//returns (a^b)%m ( ^ is exponent )
	ll ans = 1, r = 1;
	x %= m;
	while (r > 0 && r <= y)
	{
		if (r & y)
		{
			ans *= x;
			ans %= m;
		}
		r <<= 1;
		x *= x;
		x %= m;
	}
	return ans;
}

map<long long, long long> factorize(long long n) {	//returns map containing factor and multiplicity, Eg: 60 = {{2,2},{3,1},{5,1}}
	map<long long, long long> ans;
	for (long long i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ans[i]++;
			n /= i;
		}
	}
	if (n > 1) {
		ans[n]++;
		n = 1;
	}
	return ans;
}
/* **********END OF TEMPLATE*********** */

int main() {
	/*  Codeforces #595 Div.3 :)*/
	FAST();
	long long int  a,b,c,d;
	cin>>a>>b>>c>>d;
	long long int  ans[4];
	ans[0] = a*c;
	ans[1] =a*d;
	ans[2] = b*c;
	ans[3] =b*d;
	sort(ans,ans+4);
	cout<<ans[3]<<endl;
	
	
	}


		


Measured memory_bytes: 3652
import java.util.Scanner;

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

    int x = scanner.nextInt();
    int y = scanner.nextInt();
    int min = 2_000_000_010;
    for (int i = -1; i < 2; i += 2) {
      for (int j = -1; j < 2; j += 2) {
        int r = i * y - j * x;
        if (r < 0) continue;
        if (i < 0) r++;
        if (j < 0) r++;
        min = Math.min(min, r);
      }
    }
    System.out.println(min);
  }
}


Measured memory_bytes: 23764
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

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

		dataSentence(str);
		sc.close();

	}

	private static void dataSentence(String str) {
		String[] wds = str.split(" ");
		Map<String, Integer> wd_nums = new HashMap<String, Integer>();
		String most_freq_word = "";
		int most_freq_val = 0;

		String longest_word = "";
		int longest_word_val = 0;


		for (int i = 0; i < wds.length; i++) {

			if( wd_nums.get(wds[i]) == null) {
				wd_nums.put(wds[i], 1);
			} else {
				wd_nums.put(wds[i], wd_nums.get(wds[i]) + 1);
			}
		}

		for (int i = 0; i < wd_nums.size(); i++) {

			if (wd_nums.get(wds[i]) > most_freq_val) {
				most_freq_val = wd_nums.get(wds[i]);
				most_freq_word = wds[i];
			}

		}

		for (int i = 0; i < wds.length; i++) {

			if (wds[i].length()  > longest_word_val) {
				longest_word_val = wds[i].length();
				longest_word = wds[i];
			}

		}

		System.out.printf("%s %s\n", most_freq_word, longest_word);



	}

}


Measured memory_bytes: 25996
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn argmax<T>(u: &[T]) -> (usize)
where
    T: Copy + PartialOrd,
{
    assert!(u.len() != 0);

    let mut max_index = 0;
    let mut max = u[max_index];

    for (i, v) in u.iter().enumerate().skip(1) {
        if max < *v {
            max_index = i;
            max = *v;
        }
    }
    max_index
}

fn main() {
    let a: Vec<i64> = read_vec();
    let (n, c) = (a[0], a[1]);
    let n = n as usize;
    let mut xs: Vec<i64> = Vec::new();
    let mut vs: Vec<i64> = Vec::new();
    for i in 0..n {
        let a: Vec<i64> = read_vec();
        xs.push(a[0]);
        vs.push(a[1]);
    }
    let mut xsum_cw: Vec<i64> = vec![-1; n + 1];
    let mut vsum_cw: Vec<i64> = vec![-1; n + 1];
    xsum_cw[0] = 0;
    vsum_cw[0] = 0;
    for i in 0..n {
        xsum_cw[i + 1] = xs[i];
        vsum_cw[i + 1] = vsum_cw[i] + vs[i];
    }

    let mut xsum_ccw: Vec<i64> = vec![-1; n + 1];
    let mut vsum_ccw: Vec<i64> = vec![-1; n + 1];
    xsum_ccw[0] = 0;
    vsum_ccw[0] = 0;
    for i in 0..n {
        xsum_ccw[i + 1] = c - xs[n - i - 1];
        vsum_ccw[i + 1] = vsum_ccw[i] + vs[n - i - 1];
    }

    let mut a_cw: Vec<i64> = vec![-1; n + 1];
    let mut a2_cw: Vec<i64> = vec![-1; n + 1];
    for i in 0..n + 1 {
        a_cw[i] = vsum_cw[i] - xsum_cw[i];
        a2_cw[i] = vsum_cw[i] - 2 * xsum_cw[i];
    }
    for i in 1..n + 1 {
        a2_cw[i] = std::cmp::max(a2_cw[i], a2_cw[i - 1])
    }

    let mut a_ccw: Vec<i64> = vec![-1; n + 1];
    let mut a2_ccw: Vec<i64> = vec![-1; n + 1];
    for i in 0..n + 1 {
        a_ccw[i] = vsum_ccw[i] - xsum_ccw[i];
        a2_ccw[i] = vsum_ccw[i] - 2 * xsum_ccw[i];
    }
    for i in 1..n + 1 {
        a2_ccw[i] = std::cmp::max(a2_ccw[i], a2_ccw[i - 1])
    }

    let mut score = 0;
    for i in 0..n + 1 {
        score = std::cmp::max(score, a2_ccw[n - i] + a_cw[i]);
    }
    for i in 0..n + 1 {
        score = std::cmp::max(score, a2_cw[n - i] + a_ccw[i]);
    }
    println!("{0}", score);
}


Measured memory_bytes: 14588
#include<bits/stdc++.h>
using namespace std;
int main(){
	char arr[100002];
	scanf("%s",&arr);
	int a0=0,a1=0,arrs=strlen(arr);
	for(int i=0;i<arrs;i++){
		if(i%2==0 && arr[i]=='0') a1++;
		if(i%2==0 && arr[i]=='1') a0++;
		if(i%2==1 && arr[i]=='1') a1++;
		if(i%2==1 && arr[i]=='0') a0++;

	}
	printf("%d",min(a0,a1));
}

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

#define int long long
#define fr(i,n) for(int i=0;i<n;i++)
#define frr(i,n) for(int i=n;i>=0;i--)
#define fra(i,a,n) for(int i=a;i<n;i++)
#define frra(i,a,n) for(int i=a;i>=n;i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define ff first
#define ss second
#define endl '\n'

typedef pair<int,int> ii;
typedef map<int,int> mii;
typedef set<int> si;
typedef unordered_map<int,int> uii;
typedef unordered_set<int> usi;
typedef vector<int> vi;
typedef vector<ii> vii;

const int mod = 1e9+7;
const int inf = 1e9;
const int MAXN = 2e5+5;
const double eps = 1e-6;

void solve(){
    //CODE BEGINS
    int x;
    cin>>x;
    for(int i=-6208;i<=6208;i++){
		if(x+i*i*i*i*i<0)continue;
		int t = pow(x+i*i*i*i*i,0.2);
		if(x==t*t*t*t*t-i*i*i*i*i){
			cout<<t<<" "<<i<<endl;
			return;
		}
	}
}

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    //~ cin>>t;
    while(t--)solve();
    return 0;
}


Measured memory_bytes: 4044
#include <cstdio>
#include <utility>
#include <cctype>
#include <vector>
#include <algorithm>
using namespace std;

#ifdef __linux
#define _U(s) s##_unlocked
#else
#define _U(s) _##s##_nolock
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
#define gcu _U(getchar)
#define pcu _U(putchar)
#define _DEF(r, n, ...) inline r n(__VA_ARGS__) noexcept
#define _T template <typename T>
#define _HT template <typename H,typename... T>
#define _OP(t) inline operator t()
struct _in {
#ifdef _GLIBCXX_STRING
	_OP(string){string s;char c;while(isspace(c = gcu()));do{s+=c;}while(c=gcu(),c!=' '&&c!='\n'&&c!=EOF);return s;}
#define _S
#endif
	_OP(char){char c=gcu();gcu();return c;}
	_OP(double){double d; scanf("%lf",&d); gcu();return d;}
	_T _OP(T){T n{},m{1},c;while(isspace(c = gcu()));if(c=='-')m=-1,c=gcu();do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m*n;}
} in;
#define _SCAN(...) _DEF(bool,scan,__VA_ARGS__)
#ifdef _S
_SCAN(string &o) {int c{gcu()};if(c==EOF)return false;else{ungetc(c,stdin);string t=move(in);o=t;return true;}}
#endif
_T _SCAN(T &o) {int c{gcu()};return c==EOF?false:(ungetc(c,stdin),o=in,true);}
_HT _SCAN(H &h,T&&... t){return scan(h)&&scan(t...);}
#define _OUT(...) _DEF(void,out,__VA_ARGS__)
#define _OUTL(...) _DEF(void,outl,__VA_ARGS__)
_OUT(bool b){pcu('0'+b);}
_OUT(const char *s){while(*s)pcu(*s++);}
_OUT(char c){pcu(c);}
#ifdef _S
_OUT(string &s){for(char c:s)pcu(c);}
#endif
_T _OUT(T n){static char b[20];char *p=b;T m=n<0?pcu('-'),-1:1;
	if(!n)*p++='0';else while(n)*p++=(char)(n%10*m+'0'),n/=10;while(p!=b)pcu(*--p);}
_OUTL(){out('\n');}
#ifdef _GLIBCXX_VECTOR
	_T _OUT(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);}
#endif
	_HT _OUT(H &&h, T... t){out(h);out(t...);}
	template <typename... T> _OUTL(T... t){out(t...);outl();}
	struct range{
		int e,b=0,s=1;range(int _b,int _e,int _s):e(_e),b(_b),s(_s){} range(int _b,int _e): e(_e), b(_b){} range(int _e):e(_e){}
		struct it{int v,s; it(int _v,int _s):v(_v),s(_s){} operator int()const{return v;} operator int&(){return v;}int operator*()const{return v;}
			it& operator++(){v+=s;return *this;} }; it begin(){return {b,s};} it end(){return {e,s};}};
#define times(i,n) for(int i=n;i;i--)

struct P {
	int t, s, d;
};

int main() {
	for (int N, M; N = in, M = in, M || N;) {
		vector<P> p(M);
		vector<bool> c(N);
		c[0] = true;
		for (P &i: p)
			i = {in, (int) in - 1, (int) in - 1};
		sort(begin(p), end(p), [](P a, P b){return a.t < b.t;});
		for (P &i: p)
			c[i.d] = c[i.d] | c[i.s];
		outl(count(begin(c), end(c), true));
	}
}



Measured memory_bytes: 2744
import sys
input = sys.stdin.readline


def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = [0]*60
    for a in A:
        for i in range(len(B)):
            if (a >> i) & 1:
                B[i] += 1
    ans = 0
    for i, b in enumerate(B):
        ans += 2**i * b * (N-b)
        ans %= 10**9+7
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 123132
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<ctime>
#include<bitset>
#include<string>
#include<vector>
#include<cctype>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;
const int maxn = 1e5 + 11;

int main(){

	int a,b,k; cin >> a >> b >> k;
	int x =1;
	while(x <= k){
		if(x&1){
			b += a/2;
			a-=(a/2)+(a&1?1:0);
		}else{
			a+=(b/2);
			b -= (b/2) + (b&1?1:0);
		}
		x++;
	}
	cout << a << " " << b << endl;


	return 0;
}












Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,n) (int i=a;i<n;i++)
#define per(i,a,n,s) (int i=n-1;i>=a;i--)
#define range(...) _overload3(__VA_ARGS__,per,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define vecin(x) for(auto&youso_: (x) ) cin >>  youso_
#define vecout(x) for(auto&youso_: (x) ) cout << youso_ << " " ; cout << endl
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int inf = 1e9+10;
const int mod = 1e9+7;
const long long llinf = 1e18;
#define _GLIBCXX_DEBUG
long long gcd(long long a, long long b) { return b ? gcd(b, a%b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a,b) * b; }
// head

int main(){
    int n;
    long long t, gen=1;
    cin >> n;
    for range(i,n){
        cin >> t;
        gen = lcm(gen,t);
    }
    cout << gen << endl;

}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

'''

'''
def solve(l, r, d):
    count=0
    for i in range(l, r+1):
        #print(i)
        if i % d == 0:
            count += 1
    return count

l, r, d = map(int, input().split())
print(solve(l, r, d))

Measured memory_bytes: 61632
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

int main()
{
    int n, d;
    cin >> n >> d;
    vector<vector<int> > v(n, vector<int>(d));
    for(int i=0; i<n; ++i){
        for(int j=0; j<d; ++j){
            cin >> v[i][j];
        }
    }

    int ans = 0;
    for(int i=0; i<n; ++i){
        for(int j=i+1; j<n; ++j){
            int sum = 0;
            for(int k=0; k<d; ++k){
                int diff = v[i][k] - v[j][k];
                sum += diff * diff;
            }
            int x = 0;
            while(x * x < sum)
                ++ x;
            if(x * x == sum)
                ++ ans;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
# ARC074C - Chocolate Bar (ABC062C)
from itertools import accumulate


def divide_bar(A: int, B: int) -> int:
    # x: one of partial rectangles
    # y: another one -> (y1, y2), (y2, y3): divide to updown, left-right
    ret = set()
    area = A * B
    for i, x in enumerate(accumulate([A] * (B // 2)), 1):
        y = area - x
        y1 = y * (A // 2) // A
        y2 = y - y1
        y3 = y * ((B - i) // 2) // (B - i)
        y4 = y - y3
        ret |= {max(x, y1, y2) - min(x, y1, y2)}
        ret |= {max(x, y3, y4) - min(x, y3, y4)}
    return min(ret)


def main():
    H, W = tuple(map(int, input().rstrip().split()))
    ans = min(divide_bar(H, W), divide_bar(W, H))
    print(ans)


if __name__ == "__main__":
    main()

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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<bool>> vvb;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

template <typename T>
void fin(T a)
{
  cout << a << endl;
  exit(0);
}

//実行部
void Main()
{
  ll n; cin >> n;
  vll a(n), b(n); rep(i, n) cin >> a[i] >> b[i];
  vpll ans(n); rep(i, n) ans[i] = mp(a[i], b[i]);
  sort(all(ans));
  fin(ans[n - 1].first + ans[n - 1].second);
}

//前処理
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}

/*
//test時
  g++ test.cpp -o test;./test
*/


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

using namespace std;
typedef long long ll;
#define pb push_back
#define mp make_pair 
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)

int main(){
	//input
	ll N,M,Q; cin>>N>>M>>Q;

	//fieldと初期化
	ll f[501][501];
	rep(i,501)rep(j,501) f[i][j]=0;

	rep(i,M){
		ll L,R; cin>>L>>R;
		f[L][R]++;
	}

	//2次元累積和の構築
	ll s[502][502];
	rep(i,502)rep(j,502) s[i][j]=0;
	rep1(i,501){
		rep1(j,501){
			s[i][j]=s[i-1][j]+s[i][j-1]-s[i-1][j-1]+f[i-1][j-1];
		}
	}

	//solve
	rep(i,Q){
		ll p,q; cin>>p>>q;
		//[p,q+1)~[p,q+1)
		cout<<s[q+1][q+1]-s[q+1][p]-s[p][q+1]+s[p][p]<<endl;
	}
}

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

int main(){
  int n;
  
  cin >> n;
  
  if(n < 10){
    cout << n;
  }
  else if(n < 100){
    cout << 9;
  }
  else if(n < 1000){
    cout << 9 + (n - 99);
  }
  else if(n < 10000){
    cout << 9 + 900;
  }
  else if(n < 100000){
    cout << 9 + 900 + (n - 9999);
  }
  else{
    cout << 9 + 900 + 90000;
  }
}

Measured memory_bytes: 256
import sys

def main():
    N = int(input())
    A = list(map(int, input().split()))

    sum_A = sum(A)
    cum_A = [sum_A]
    for a in A[:N-1]:
        cum_A.append(cum_A[-1] - a)

    res = 0
    mod = 1000000007
    for i, a in enumerate(cum_A[1:]):
        res += A[i] * a
        res %= mod

    print(res)

if __name__ == "__main__":
    main()

Measured memory_bytes: 105640
#include<stdio.h>
#include <math.h>
int main(void){
char s[3];
int Ans=0;
scanf("%s",s);
if(s[0]=='1') {Ans=Ans+1;}
if(s[1]=='1') {Ans=Ans+1;}
if(s[2]=='1') {Ans=Ans+1;}
printf("%d\n",Ans);
return 0;
}


Measured memory_bytes: 128
#include<stdio.h>

int main(void)
{
  int n,buf[100001],i,j,frag=0;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      scanf("%d",&buf[i]);
      if(buf[i] == 2)
	{
	  frag = 1;
	}
    }
  if(frag == 0) //不可能な場合
    {
      printf("-1\n");
      return 0;
    }
  i=0;
  for(j=0;j<n;j++)
    {
      if(buf[i] != 2)
	{
	  i = buf[i] - 1;
	}
      else
	{
	  j++;
	  frag = 0;
	  break;
	}
    }
  if(frag == 0)
    {
      printf("%d\n",j);
    }
  else
    {
      printf("-1\n");
    }
  return 0;
}

Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	
	long mod = 1_000_000_007;

	public static void main(String[] args) throws IOException {
		Main mainObj = new Main();
		mainObj.solve();
	}

	public void solve() throws IOException {
		FastScanner fs = new FastScanner();
		int n = fs.nextInt();
		int k = fs.nextInt();
		
		long ans = 0;
		long minK=0;
		long maxK=0;
		
		for(int i = 0; i < k; i++) {
			minK += i;
		}
		
		for(int i = 0; i < k; i++) {
			maxK += (n-i);
		}
		
		ans = (ans +(maxK-minK+1))%mod;
		
		for(int i = k; i <= n; i++) {
			minK += i;
			maxK += (n-i);
			ans = (ans +(maxK-minK+1))%mod;
		}
		
		System.out.println(ans);
	}

	

	public class FastScanner {

		BufferedReader reader;
		private StringTokenizer st;

		public FastScanner() {
			st = null;
			reader = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() throws IOException {
			if (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(reader.readLine());
			}
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			st = null;
			String readLine = null;
			readLine = reader.readLine();
			return readLine;
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArr(int n) throws NumberFormatException, IOException {
			int[] retArr = new int[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextInt();
			}
			return retArr;
		}

		public long[] nextLongArr(int n) throws NumberFormatException, IOException {
			long[] retArr = new long[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextLong();
			}
			return retArr;
		}

		public void close() throws IOException {
			reader.close();
		}
	}

}


Measured memory_bytes: 32768
n = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(n-2):
    if p[i] < p[i+1] < p[i+2]:
        count += 1
    elif p[i] > p[i+1] > p[i+2]:
        count += 1
print(count)

Measured memory_bytes: 38256
#include <stdio.h>

int main(int argc, const char * argv[]) {
    
    int a,b,c;
    scanf("%d %d %d",&a, &b, &c);
    
    if (a < b && b < c) {
        printf("Yes\n");
    }else{//else：ほか
        printf("No\n");
    }
    
    return 0;
}



Measured memory_bytes: 2100
#include <cstdio>
using namespace std;
int main(){
  int A,B,C;
  scanf("%d %d %d",&A,&B,&C);
  if(A==7){
    if(B==5&&C==5) printf("YES\n");
    else printf("NO\n");
  } else if(B==7){
    if(A==5&&C==5) printf("YES\n");
    else printf("NO\n");
  } else {
    if(A==5&&B==5) printf("YES\n");
    else printf("NO\n");
  }
  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

using namespace std;

int main(){
	int n,m,l;
	scanf("%d %d %d",&n,&m,&l);
	int A[n][m],B[m][l];
	long long int C[n][l];
	for(int i = 0; i < n; i++){
		for(int j = 0; j < l; j++){
			C[i][j] = 0;
		}
	}

	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			scanf("%d",&A[i][j]);
		}
	}
	for(int i = 0; i < m; i++){
		for(int j = 0; j < l; j++){
			scanf("%d",&B[i][j]);
		}
	}

	for(int i = 0; i < n; i++){
		for(int k = 0; k < l; k++){
			for(int j = 0; j < m; j++){
				C[i][k] += A[i][j]*B[j][k];
			}
		}
	}

	for(int i = 0; i < n; i++){
		for(int j = 0; j < l-1; j++){
			printf("%lld ",C[i][j]);
		}
		printf("%lld\n",C[i][l-1]);
	}
}



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

int main(){
    int n;
    cin >> n;
    vector<int> p(n);
    rep(i,n) cin >> p[i];
    vector<int> q(n);
    int k = 0;
    rep(i,n){
        if(p[i] != i + 1) k++;
    }
    if(k <= 2) cout << "YES" << endl;
    else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

// cl /EHsc xxxx.c
int main(int arc, char *argv[])
{
	int n, i;
	long a;
	long min, max, sum;
	
	min = 0;
	max = 0;
	sum = 0;
	
	scanf("%d", &n);
	
	for (i = n; i > 0; i--)
	{
		scanf("%ld", &a);
		if (i == n || a < min)
		{
			min = a;
		}
		if (i == n || a > max)
		{
			max = a;
		}
		sum += a;
	}
	printf("%ld %ld %ld\n", min, max, sum);
	
	return 0;
}

Measured memory_bytes: 600
import java.util.*;
import java.io.*;
import java.lang.*;

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

        String a = sc.next();
        String b = sc.next();

        if (a.equals(b.substring(0,b.length()-1)))
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}


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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define REPV(iter, v) for(auto (iter)=(v).begin(); (iter)!=(v).end();++(iter))
#define ALL(v) (v).begin(),(v).end()

#define MOD 1000000007

using namespace std;

typedef long long ll;

int main()
{
    string S;
    cin >> S;
    string ans;
    if (S.size() != 26)
    {
        set<char> setC;
        REP(i, S.size())
        {
            setC.insert(S[i]);
        }
        for (char c = 'a'; c <= 'z'; ++c)
        {
            if (setC.find(c) == setC.end())
            {
                ans = S;
                ans.push_back(c);
                break;
            }
        }
    }
    else
    {
        bool flag = false;
        set<char> setC;
        REP(i, 26)
        {   
            setC.insert(S[25 - i]);
            REPV(it, setC)
            {
                char c = *it;
                if (c > S[25 - i])
                {
                    ans = S.substr(0, 25 - i);
                    ans.push_back(c);
                    flag = true;
                    break;
                }
            }
            if (flag)
            {
                break;
            }
        }
        if (!flag)
        {
            ans = "-1";
        }
    }

    cout << ans << endl;
}


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

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

int main() {
    int a;
    int result=0;

  cin >> a;
 
  for(int i=1; i<=a; i++){
    for(int j=1; j<=a; j++){
        for(int k=1; k<=a; k++){
            result +=  gcd( gcd(i,j) ,k);
        }

    }
  }
  cout << result << endl;
       return 0;
}

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

using namespace std;

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

    for(int i=a.size()-1;0<=i;i -= 2){
        cout << a[i] << " ";
    }

    if(n%2==1){
        for(int i=1;i<n;i += 2){
        cout << a[i] << " ";
        }
    }else{
        for(int i=0;i<n;i += 2){
        cout << a[i] << " ";
        }
    }
}

Measured memory_bytes: 2944
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define range(i, a, b, s) for (int i = (a), __##i = (b); i < __##i; i += (s))
#define down(i, a, b, s) for (int i = (a), __##i = (b); __##i < i; i += (s))

const int maxn = 102;

int n, x, l[maxn];

int main(int argc, char const *argv[]) {
  // freopen("B.txt", "r", stdin);

  while (cin >> n >> x) {
    range(i, 0, n, 1) cin >> l[i];
    range(i, 1, n, 1) l[i] += l[i - 1];
    cout << upper_bound(l, l + n, x) - l + 1 << endl;
  }
  return 0;
}

Measured memory_bytes: 888
#include<iostream>
#include<cstring>
#include<cmath>
using namespace std;

const double pi = acos(-1.0);
int main()
{
    int a,b,h,m; scanf("%d%d%d%d",&a,&b,&h,&m);
    double alpha=pi/180*abs(30*h+0.5*m-6*m);
    printf("%.10f\n",sqrt(a*a+b*b-2*a*b*cos(alpha)));
}

Measured memory_bytes: 4212
#include<stdio.h>
#include<stdlib.h>
int main()
{
  int x,y,z;
  int rem=1;
  
  scanf("%d %d",&x,&y);
  if( x < 0 || y > 10e9 )
    {
      printf("Error./n");
      exit(1);
    }
  if( x < y )
    {
      z = x;
      x = y;
      y = z;
    }
  while( rem != 0 )
    { 
      rem = x % y;
      x = y; y = rem;
    }
  printf("%d\n",x);

  return 0;
}
      



Measured memory_bytes: 2140
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
int main() {
	cin.tie(0);
    ios::sync_with_stdio(false);
 
 
    string S, T;
    cin >> S >> T;

    map<char, char> x;
 
    for(int i = 0; i < S.length(); i++) {
        if(x[S[i]]) {
            if(x[S[i]] != T[i]) {
                cout << "No" << endl;
                return 0;
            }
        } else {
            x[S[i]] = T[i];
        }
    }


    map<char, char> y;
 
    for(int i = 0; i < S.length(); i++) {
        if(y[T[i]]) {
            if(y[T[i]] != S[i]) {
                cout << "No" << endl;
                return 0;
            }
        } else {
            y[T[i]] = S[i];
        }
    }
 
    cout << "Yes" << endl;
}

Measured memory_bytes: 916
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <cassert>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
ll a,b,ret=1e18;
int main(){
	cin >> a >> b;
	if(a==b) ret=a+1;
	for(ll i=2;i<=1000000;i++){
		ll c = a;
		ll d = 0;
		while(c){
			d += c%i;
			c /= i;
		}
		if(d == b) ret = min(ret,i);
	}
	for(ll i=1;i<=1000000;i++){
		if(i > b) continue;
		// i*x + (b-i) == a && x > b-i
		ll c = b-i;
		if(a-c > 0 && (a-c)%i==0 && (a-c)/i > c && i<(a-c)/i) ret = min(ret,(a-c)/i);
	}
	if(ret > 1e17) puts("-1");
	else cout << ret << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const int dx[4] = { 0, -1, 1, 0 };
const int dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}

template<class T1, class T2> void chmin(T1 &a, T2 b) { if (a>b)a = b; }

template<class T1, class T2> void chmax(T1 &a, T2 b) { if (a<b)a = b; }
template<class T>
void Add(T &a, const T &b, const T &mod = 1000000007) {
	int val = ((a % mod) + (b % mod)) % mod;
	if (val < 0) { val += mod; }
	a = val;
}
////////////////////////////////////////
int main() {
	int N;
	cin >> N;
	vector<int>b(N);
	for (int i = 0; i < N; ++i) {
		int x;
		cin >> x;
		b[i] = x;
	}
	int count = 0;
	vector<int>key;
	for(int j=0;j<N;++j){
		int er = -1;
		for (int i = 0; i < b.size(); ++i) {
			if ((i + 1) == b[i]) {
				er = max(er, i+1);
			}
		}
		if (er != -1) {
			count++;
			key.push_back(er);
			b.erase(b.begin() + er-1);
		}
	}
	if (count != N)cout << -1 << endl;
	else {
		for (int i = N-1; i >=0; --i) {
			cout << key[i] << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#ifndef TEMPLATE_HPP
#define TEMPLATE_HPP
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())
using namespace std;
using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> void amax(T &x, T y) { x = max(x, y); }
template <typename T> void amin(T &x, T y) { x = min(x, y); }
template <typename T> T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename U> vector<U> make_vector(T&& n, U&& val) { return vector<U>(forward<T>(n), forward<U>(val)); }
template <typename T, typename... Args> decltype(auto) make_vector(T&& n, Args&&... args) { return vector<decltype(make_vector(forward<Args>(args)...))>(forward<T>(n), make_vector(forward<Args>(args)...)); }
const int INF = 1001001001;
const i64 LINF = 1001001001001001001ll;
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
#endif

template <typename T>
struct FenwickTree {
  vector<T> v;
  int n;
  FenwickTree(int n) : n(n) {
    v = vector<T>(n);
  }
  void update(int i, T x) {
    for (i++; i <= n; i += i & -i) v[i - 1] += x;
  }
  T query(int i) {
    T r = 0;
    for (; i >= 1; i -= i & -i) r += v[i - 1];
    return r;
  }
};

void solve() {
  int n, q;
  cin >> n >> q;
  vi32 c(n);
  cin >> c;
  rep(i, n) c[i]--;
  FenwickTree<int> ft(n);
  map<int, int> indices;
  vi32 next(n, n);
  rep(i, n) {
    if (indices.count(c[i])) {
      int x = indices[c[i]];
      next[x] = i;
    } else {
      ft.update(i, 1);
    }
    indices[c[i]] = i;
  }
  using T = int;
  vector<vector<T>> events(n);
  vi32 l(q), r(q);
  rep(i, q) {
    cin >> l[i] >> r[i];
    l[i]--;
    events[l[i]].emplace_back(i);
  }
  vi32 ans(q);
  rep(i, n) {
    for (auto x : events[i]) {
      ans[x] = ft.query(r[x]) - ft.query(l[x]);
    }
    ft.update(i, -1);
    if (next[i] < n) ft.update(next[i], 1);
  }
  rep(i, q) {
    cout << ans[i] << endl;
  }
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(16);
  cerr << fixed << setprecision(16);
  solve();
  return 0;
}

Measured memory_bytes: 59644
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
template<class T>bool chmax(T &a, const T &b) { 
  if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) {
  if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる




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

  vector<ll> p(n);
  ll sum=0;
  rep(i,n){
    cin>>p[i];
    p[i]-=i+1;
    sum+=p[i];
  }

  sort(all(p));

    ll a=p[n/2-1];
    ll b=p[n/2];
    ll aa=0;
    rep(i,n){
      aa+=abs(p[i]-a);
    }
    ll bb=0;
    rep(i,n){
      bb+=abs(p[i]-b);
    }
    ll ans=min(aa,bb);


  cout << ans << endl;
}

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

typedef long long ll;
const ll mod = 1000000007;

int main() {
    ll N, K;
    cin >> N >> K;
    vector<pair<ll, ll>> m(N);
    ll total = 0;
    ll ans;
    bool check = true;

    for (int i = 0; i < N; i++) {
        cin >> m[i].first >> m[i].second;
    }
    sort(m.begin(), m.end());
    
    for (int i = 0; i < N; i++) {
        total += m[i].second;
        if (check && total >= K) {
            ans = m[i].first;
            check = false;
        }
    }
    cout << ans << endl;

}


Measured memory_bytes: 1792