akhauriyash/Code-Regression huggingface dataset:
import static java.lang.Integer.*;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeMap;
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());


		int N = parseInt(st.nextToken());
		int M = parseInt(st.nextToken());
		int[] P = new int[N];
		String[] ans = new String[M];

		Map<Integer, int[]> citys = new TreeMap<>();

		for(int i=0;i<M;i++) {
			st = new StringTokenizer(br.readLine());
			int n = parseInt(st.nextToken());
			int y = parseInt(st.nextToken());
			int[] info = new int[2];
			info[0] = n;
			info[1] = i;
			citys.put(y, info);
		}

		for(int key : citys.keySet()) {
			int[] c = citys.get(key);
			ans[c[1]] = String.format("%06d%06d", c[0],++P[c[0]-1]);
		}

		for(String a : ans) {
			System.out.println(a);
		}




	}
}


Measured memory_bytes: 111440
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(deprecated)]

use std::cell::{Cell, Ref, RefCell, RefMut};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::f64::consts::PI;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;
use std::usize;

const MOD_10_9_7: u64 = 1_000_000_007;
const INF: i64 = 1_000_000_000_000;
const MIN_INF: i64 = -1_000_000_000_000;

/// FYI: https://github.com/vain0x/scan-bench
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}

#[allow(unused_macros)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn a() {
    unimplemented!();
}

fn b() {
    unimplemented!();
}

fn c() {
    let n = read!(usize);
    if n == 2 {
        println!("1");
        return;
    }
    if n == 3 || n == 4 {
        println!("2");
        return;
    }
    let mut max_div = 1;
    for i in 1..((n as f64).sqrt() as usize + 1) {
        //        println!("{}", i);
        if n % i == 0 {
            max_div = i;
        }
    }
    let t = n / max_div;

    //    debugln!("{} {}", max_div, t);

    println!("{}", max_div + t - 2);
}

fn d() {
    let (a, b, x) = read!(usize, usize, usize);
    let a = a as f64;
    let b = b as f64;
    let x = x as f64;
    let theta = ((b * b * a) / (2.0 * x)).atan();

    if b * ((PI / 2.0) - theta).tan() <= a {
        println!("{}", theta * 180.0 / PI);
        return;
    }

    let theta = ((2.0 * a * a * b - 2.0 * x) / a.powi(3)).atan();
    println!("{}", theta * 180.0 / PI);
}

fn e() {
    unimplemented!();
}

fn f() {
    unimplemented!();
}

fn main() {
    d();
}


Measured memory_bytes: 4352
#include <cstdio>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <ctime>
#include <cstring>
#include <cassert>
#include <bitset>
#include <sstream>
#include <queue>

#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define sz(a) ((int) (a).size())
#define eprintf(...) fprintf(stderr, __VA_ARGS__)

using namespace std;

typedef long long int64;
typedef long double ldb;

const long double eps = 1e-9;
const int inf = (1 << 30) - 1;
const long long inf64 = ((long long)1 << 62) - 1;
const long double pi = acos(-1);

template <class T> T sqr (T x) {return x * x;}
template <class T> T abs (T x) {return x < 0 ? -x : x;}

int main () {
//  ios_base::sync_with_stdio(0);
//	freopen("input.txt", "rt", stdin);
//	freopen("output.txt", "wt", stdout);
	
	int a, b, c;
	cin >> a >> b >> c;

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

	if (a == b && a == c) {
		cout << -1 << endl;
		return 0;
	}

	int res = 0;
	while (a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
		++res;
		a /= 2;
		b /= 2;
		c /= 2;

		int s = a + b + c;
		a = s - a;
		b = s - b;
		c = s - c;
	}

	cout << res << endl;

	return 0;
}


Measured memory_bytes: 256
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define EACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
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; }
template<class Value>using vec = vector< Value >;
using ll = long long;
using P = pair< long long, long long >;
#define fi first
#define se second
#define el endl
#pragma endregion

void Main();

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


void Main(){
    int N;
    cin >> N;
    cout << N*N*N << el;
}



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

int main(){
	int a,b,c;
  	cin >> a >> b >> c;
  	bool x=false;
  	for (int i=1;i<=b;i++){
    	if((a*i)%b==c) x=true;
    }
  	if (x==true) cout << "YES"<<endl;
  	else cout <<"NO"<<endl;
}

Measured memory_bytes: 256
'use strict'

const stdin = require('fs').readFileSync('/dev/stdin', 'utf8')
const chars = Array.from(stdin.trim())
const count = {}
let flag = true

chars.forEach(char => {
  count[char] = count[char] ? count[char] + 1 : 1
})

for (let c in count) {
  if (count[c] % 2 === 1) {
    flag = false
    break
  }
}

console.log(flag ? 'Yes' : 'No')


Measured memory_bytes: 7372
#include<iostream>
#include<algorithm>
#include<stdio.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define pi 3.14159265358979
int main() {
	int n;
	cin >> n;
	int a;
	int Max = -1000000;
	int Min = 1000000;
	long long sum = 0;
	rep(i, n) {
		cin >> a;
		Max = max(a, Max);
		Min = min(a, Min);
		sum += a;
	}
	cout << Min << " " << Max << " " << sum << endl;
	return 0;
}


Measured memory_bytes: 3124
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
#include <set>
#include <cmath>
#include <limits>
#include <iostream>
using namespace std;
using ll=unsigned long long;
int main(){
   ll n;
   cin >> n;
   ll sum=0;
   vector<ll> yama(n);
   for(int i=0;i<n;i++){
       ll x;
       cin >> x;
       yama[i]=x;
      sum += x;
   }
   ll first;
   ll sin_first;
       ll count=0;
       for(ll i=1;i<n/2+1;i++){
           count+=yama[i*2-1];
       }
           cout << sum-count*2<<" ";
           first=sum-count*2;
           sin_first=sum-count*2;
           for(ll i=0;i<n-2;i++){
               cout<<yama[i]*2-first<<" ";
               first=yama[i]*2-first;
           }
           ll i=n-1;
           cout<<yama[i]*2-sin_first<<endl;
}


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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n;
    cin >> n;
    vector<int32> d(n);
    REP(i,n)cin >> d[i];
    sort(ALL(d));
    ANS(d[n/2] - d[n/2-1]);
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

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

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

signed main() {
    string s; cin >> s;
    s[5] = ' ', s[13] = ' ';
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define MAX 50
 
int N, day;
bool ok[MAX][31];
bool visited[MAX];
 
void init(){
  day = 0;
  memset(ok, false, sizeof(ok));
}
 
int solve(){
  int ans = -1;
  set<int> dp[MAX];

  for(int i = 0 ; i < N ; i++){
    dp[i].insert(i);
  }

  for(int i = 0 ; i <= day ; i++){
    for(int j = 0 ; j < N-1 ; j++){
      if(!ok[j][i]) continue;
      for(int k = j+1 ; k < N ; k++){
        if(ok[k][i]){
          dp[j].insert(k);
          dp[k].insert(j);
          set<int>::iterator it;
          for(it = dp[j].begin() ; it != dp[j].end() ; ++it){
            dp[k].insert(*it);
          }
          for(it = dp[k].begin() ; it != dp[k].end() ; ++it){
            dp[j].insert(*it);
          }
        }
      }
    }
    for(int j = 0 ; j < N ; j++){
      if(dp[j].size() == N) return i+1;
    }
  }
  return ans;
}
 
int main(){
  int K, in;
  while(cin >> N && N){
    init();
    for(int i = 0 ; i < N ; i++){
      cin >> K;
      for(int j = 0 ; j < K ; j++){
        cin >> in;
        ok[i][in-1] = true;
        day = max(day, in);
      }
    }
    cout << solve() << endl;
  }
 
  return 0;
}

Measured memory_bytes: 1312
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <climits>
#include <map>
using namespace std;

typedef vector<int>			vi;
typedef vector<vi>			vvi;
typedef vector<vvi>			vvvi;
typedef long long int 		ll;
typedef vector<ll>			vll;
typedef vector<vll>			vvll;
typedef vector<vvll>		vvvll;

typedef pair<int, int>		ii;
typedef vector<ii>			vii;
typedef set<int> 			si;


int main(){

	ios::sync_with_stdio(false);
	cin.tie(NULL);

	int n, m;
	cin >> n >> m;

	vi a(n);
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	sort(a.begin(), a.end());

	int b, c;
	map<int, int> count_map;
	set<int> count_set;
	for(int i = 0; i < m; i++){
		cin >> b >> c;
		if(count_map.find(c) == count_map.end())
			count_map[c] = 0;
		count_map[c] += b;
		count_set.insert(c);
	}

	for(int i = 0; i < n; i++){
		if(count_set.empty())
			break;
		int largest = *count_set.rbegin();
		if(a[i] < largest){
			a[i] = largest;
			count_map[largest]--;
			if(count_map[largest] <= 0){
				count_set.erase(largest);
			}
		}
	}

	ll ans = 0;
	for(int i = 0; i < n; i++)
		ans += a[i];
	cout << ans;
	return 0;
}

Measured memory_bytes: 9984
#include <iostream>
using namespace std;
int main(void){
    int W,H,x,y,r;
    cin>>W>>H>>x>>y>>r;
    if(x-r>=0&&y-r>=0&&x+r<=W&&y+r<=H){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}



Measured memory_bytes: 3088
n, m = gets.chomp.split(" ").map(&:to_i)
h = gets.chomp.split(" ").map(&:to_i)
all = Array.new(n,0)
(0..m-1).each do 
    a, b = gets.split(" ").map(&:to_i)
    if h[a-1] > h[b-1]
        all[b-1] += 1
    elsif h[a-1] == h[b-1]
        all[a-1] += 1
        all[b-1] += 1
    else 
        all[a-1] += 1
    end
end
  goukei = 0
all.each do |i|
    if i == 0
          goukei += 1
    end
end

puts goukei
     



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

int main() {
	#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    int n;
    cin>>n;
    long long int ans=0;
    for(int i=1;i<=n;++i)
    {
        for(int j=1;j<=n;++j)
        {
            for(int k=1;k<=n;++k)
            {
                ans+=__gcd(__gcd(i,j),k);
            }
        }
    }
    cout<<ans<<endl;
  	
   // cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define int long long
const int INF = 1e18L + 5;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;

signed main(){

    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, k; cin >> n >> k;
    int h, cnt = 0;
    rep(i,n) {
        cin >> h;
        if (h  >= k) cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
F = input().split()

X = int(F[0])
N = int(F[1])
k = 0
L = -1

if N == 0:
	q = [N]

else:
	p = list(map(int, input().split()))
	p.sort()
	q = list(set(p))

while k == 0:
	L += 1
	deka = X+L
	tibi = X-L
	for i in range(len(q)):
		if q[i] == deka:
			deka = 999
		if q[i] == tibi:
			tibi = 999
	if deka != 999 or tibi != 999:
		k = 1

if tibi == 999:
	print(deka)

else:
	print(tibi)


Measured memory_bytes: 9220
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
from fractions import gcd

class SegmentTree:
    def __init__(self, dat, func, I):
        N = len(dat)
        self.sz = N
        self.func = func
        self.I = I
        self.seg = [I]*N + dat
 
    def assign(self, k, x):
        self.seg[k + self.sz] = x
 
    def build(self):
        for i in range(self.sz - 1, 0, -1):
            self.seg[i] = self.func(self.seg[2 * i], self.seg[2 * i + 1])
 
    def update(self, k, x):
        k += self.sz
        self.seg[k] = x
        while k > 1:
            k //= 2
            self.seg[k] = self.func(self.seg[2 * k], self.seg[2 * k + 1])
 
    def query(self, a, b):
        R = self.I
        a += self.sz
        b += self.sz
        while a < b:
            if a % 2 == 1:
                R = self.func(R, self.seg[a])
                a += 1
            if b % 2 == 1:
                b -= 1
                R = self.func(self.seg[b], R)
            a //= 2
            b //= 2
        return R

def main():
    N = int(readline())
    dat = list(map(int,read().split()))
    seg = SegmentTree(dat , gcd , 0)
    seg.build()
    ans = 1
    for i in range(N):
        ans = max(ans,gcd(seg.query(0,i) , seg.query(i+1,N)))
    print(ans)

main()


Measured memory_bytes: 80032
#include <bits/stdc++.h>
using namespace std;
int main(){
  while (1){
    int N;
    cin >> N;
    if (N == 0){
      break;
    }
    vector<int> x(N), y(N);
    for (int i = 0; i < N; i++){
      cin >> x[i] >> y[i];
    }
    int X = 10;
    int Y = 10;
    vector<bool> used(N, false);
    int M;
    cin >> M;
    for (int i = 0; i < M; i++){
      char d;
      int l;
      cin >> d >> l;
      if (d == 'N'){
        for (int j = 0; j < l; j++){
          Y++;
          for (int k = 0; k < N; k++){
            if (X == x[k] && Y == y[k]){
              used[k] = true;
            }
          }
        }
      }
      if (d == 'E'){
        for (int j = 0; j < l; j++){
          X++;
          for (int k = 0; k < N; k++){
            if (X == x[k] && Y == y[k]){
              used[k] = true;
            }
          }
        }
      }
      if (d == 'S'){
        for (int j = 0; j < l; j++){
          Y--;
          for (int k = 0; k < N; k++){
            if (X == x[k] && Y == y[k]){
              used[k] = true;
            }
          }
        }
      }
      if (d == 'W'){
        for (int j = 0; j < l; j++){
          X--;
          for (int k = 0; k < N; k++){
            if (X == x[k] && Y == y[k]){
              used[k] = true;
            }
          }
        }
      }
    }
    bool ok = true;
    for (int i = 0; i < N; i++){
      if (!used[i]){
        ok = false;
      }
    }
    if (ok){
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}


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

using namespace std;

int main(){
  int sx, sy, tx, ty;

  cin >> sx >> sy >> tx >> ty;

  for (int i=0; i<tx-sx; i++) cout << "R";
  for (int i=0; i<ty-sy; i++) cout << "U";
  for (int i=0; i<tx-sx; i++) cout << "L";
  for (int i=0; i<ty-sy; i++) cout << "D";


  cout << "D";
  for (int i=0; i<tx-sx+1; i++) cout << "R";
  for (int i=0; i<ty-sy+1; i++) cout << "U";
  cout << "L";

  cout << "U";
  for (int i=0; i<tx-sx+1; i++) cout << "L";
  for (int i=0; i<ty-sy+1; i++) cout << "D";
  cout << "R" << endl;

  return 0;
}


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

using namespace std;

int main() {
  string s = "";
  cin >> s;
  string a = s;
  reverse(a.begin(), a.end());
  int cnt = 0;
  for (int i=0; i<s.size(); i++) {
    if (s.at(i) != a.at(i)) {
      cnt++;
    }
  }
  cout << cnt / 2 << endl;
  return 0;
}


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

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define ALL(v) v.begin(), v.end()
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) a / __gcd(a, b) * b /* 最小公倍数 */

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

void Main() {
    u64 H;
    cin >> H;
    u64 i;
    for (i = 1; i <= H; i *= 2);
    cout << i - 1 << endl;
}


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

int main() {
  int N, M, C;
  cin >> N >> M >> C;
  int A[N][M];
  int B[M];
  // vector < vector <int >> A (N , vector <int >( M ));
  // vector <int > B ( M );

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

  for (int i = 0; i < N; i++)
  {
    for (int j = 0; j < M; j++)
    {
      cin >> A[i][j];
    }
  }

  int count = 0;
  for (int i = 0; i < N; i++)
  {
    int sum = C;
    for (int j = 0; j < M; j++)
    {
      sum += A[i][j] * B[j];
    }
    if (sum > 0) { count++; }
  }

  cout << count << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;



public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		int min = -1;

		if (S.equals(T)) {
			System.out.println(0);
		}else {
			for (int i = T.length(); i <= S.length(); i++) {
				String string = S.substring(i - T.length(),i);
				int let = 0;
				for (int j = 0; j < T.length(); j++) {
					if (string.charAt(j) == T.charAt(j)) {
						let++;
					}
				}
				min = Math.max(min, let);
			}

			System.out.println(T.length() - min);
		}
	}

}

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

typedef long long int ll;
typedef long double ld;

#define nn "\n"


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string a;
  cin>>a;
  if(a[1]=='R'){
    cout<<"ABC"<<endl;}
  else{cout<<"ARC"<<endl;}
    
    //cout<<"Case "<<cn<<": "<<"good"<<endl;
    return 0;
}

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

#define INF (1LL<<60)

int main(){
	long long n;	cin>>n;
	long long p=INF, a[5];
	for(int i=0;i<5;i++){
		cin>>a[i];
		p=min(p,a[i]);
	}

	long long ans = (n+p-1)/p + 4;

	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python
# coding: utf-8

def main():
	i = 1
	values = []
	while True:
		x = int(raw_input())
		if x == 0:
			break
		values.append(x)

	for i in range(len(values)):
		print "Case %d: %d" % ((i + 1), values[i])

if __name__ == '__main__':
	main()

Measured memory_bytes: 4828
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

int main() {

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

	sort(a.begin(), a.end(), greater<long long int>());

	long long int aa, bb;

	aa = bb = 0;

	for (long long int i = 0; i < n-1; i++) {
		if (a[i] == a[i + 1]) {
			if (aa == 0) {
				aa = a[i];
				i++;
			}
			else {
				bb = a[i];
				break;
			}
		}
	}

	cout << aa * bb << endl;

	return 0;
}

Measured memory_bytes: 1024
from itertools import product
import copy


def calc_sum(sub):
    ret = 0
    cnt = 0
    for i in sub[::-1]:
        if i == "+":
            cnt = 0
        else:
            ret += int(i) * 10 ** cnt
            cnt += 1
    return ret


s = list(input())
l = len(s)

ans = 0
for i in product((0, 1), repeat=l-1):
    sub = copy.copy(s)
    indexes = [m for m, x in enumerate(i) if x == 1]
    if sum(i) != 0:
        for k, ind in enumerate(indexes):
            sub.insert(ind+1+k, "+")
    ans += calc_sum(sub)

print(ans)


Measured memory_bytes: 3440
#include <bits/stdc++.h>                                           
 
#define int long long
//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
 
 
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define all(x) x.begin(), x.end()
#define sz(s) (int)s.size()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define s second
#define f first
 
 
using namespace std;
 
 
typedef pair < long long, long long > pll;    
typedef pair < int, int > pii;
typedef unsigned long long ull;         
typedef vector < pii > vpii;
typedef vector < int > vi;
typedef long double ldb; 
typedef long long ll;  
typedef double db;                         
 
 
const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}, block = 555;
const pii base = mp(1171, 3307), Mod = mp(1e9 + 7, 1e9 + 9);
const int inf = 1e9, N = 1e5 + 48, mod = 1e9 + 7, maxn = 102;
const db eps = 1e-12, pi = 3.14159265359;
const ll INF = 1e18;


int n, m, v, u, dp[N];
bool was[N];
vi g[N], order;


void dfs (int v) {
	was[v] = 1;
	for (auto to : g[v])
		if (!was[to])
			dfs(to);

	order.pb(v);
}


main () {
	cin >> n >> m;
	while (m--) {
		cin >> v >> u;
		g[v].pb(u);
	}

	forn (i, 1, n)
		if (!was[i])
			dfs(i);

	for (auto v : order)
		for (auto to : g[v])
			dp[v] = max(dp[v], dp[to] + 1);

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

}                       

Measured memory_bytes: 9588
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>  
#include <stdbool.h>   
#define inf (INT_MAX-1)
#define INF 9223372036854775807;
#define PI 3.14159265358979323846;
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
/*
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r)
*/
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r)
#define TYPE long long
#define ll long long
#define MEMSET(a) memset(a,0,sizeof(a))
#define MEMSET_U(a) memset(a,-1,sizeof(a))
#define bool    _Bool
const int mod = (int)1e09 + 7;

//#define DEBUG1
//#define DEBUG2
//#define DEBUGF
#define DUMMY

int in(void) { int i; scanf("%d", &i); return i; }
long long llin(void) { long long i; scanf("%lld", &i); return i; }
double din(void) { double i; scanf("%lf", &i); return i; }
void chin(char s[]) { scanf("%s", s); }

void print(int a) { printf("%d\n", a); }
void llprint(long long a) { printf("%lld\n", a); }
void dprint(double a) { printf("%.10f\n", a); }
void print2(int a, int b) { printf("%d %d\n", a, b); }
int Max(int a, int b) { if (a > b) { return a; }return b; }
int Min(int a, int b) { if (a < b) { return a; }return b; }
long long llmax(long long a, long long b) { return a > b ? a : b; }
long long llmin(long long a, long long b) { return a < b ? a : b; }
double dmax(double a, double b) { return a > b ? a : b; }
double dmin(double a, double b) { return a < b ? a : b; }
//long long llmax(long long a, long long b) { return a > b ? a : b; }
//long long llmin(long long a, long long b) { return a < b ? a : b; }
//double dmax(double a, double b) { return a > b ? a : b; }
int cmp(const void *a, const void *b) { return *(TYPE *)a - *(TYPE *)b; }
int cmp_r(const void *a, const void *b) { return *(TYPE *)b - *(TYPE *)a; }
int char_cmp(const void *a, const void *b) { return strcmp((char *)a, (char *)b); }
int char_cmp_r(const void *a, const void *b) { return strcmp((char *)b, (char *)a); }
void swap(int *a, int *b) { int t = *a; *a = *b; *b = t; }



int main() {
	ll N, A, B;
	scanf("%lld%lld%lld", &N, &A, &B);
	ll ans = (N - 1) * B + A - (N - 1) * A - B + 1;
	if (ans >= 0) {
		printf("%lld\n", ans);
	}
	else {
		printf("0\n");
	}





#ifdef DEBUGF
	getch();
#endif
	return 0;
}


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

using namespace std;

int main() {
   vector<int> v = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int n ; cin >> n;
    cout << v[n-1] << endl;
}


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

int main(){
    int N;
    scanf("%d",&N);
    vector<int>A(N);
    int mod=1000000007;
    long long sum=0;

    for(int i=0;i<N;i++){
        scanf("%d",&A[i]);
        sum+=A[i];
        sum%=mod;
    }

long ans=0;

    for(int i=0;i<N;i++){
        sum-=A[i];
            if(sum<0)sum+=mod;
        ans+=sum*A[i];
        ans%=mod;
    }
    cout<<ans;

}

Measured memory_bytes: 3672
#include<stdio.h>
    #include<stdlib.h>
     
    int main(void) {
      int a,b;
      scanf("%d %d",&a,&b);
      if (a + b >= a - b && a + b >= a * b) {
        printf("%d",a + b);
      } else if(a - b >= a + b && a - b >= a * b) {
        printf("%d",a - b);
      } else if(a * b >= a + b && a * b >= a - b) {
        printf("%d",a * b);
      }
      return 0;
    }

Measured memory_bytes: 128
S=input()
if S[0] != 'A':
  print('WA')
  exit()
count=0
for i in range(2,len(S)-1):
  if S[i]=='C':
    count+=1
if count != 1:
  print('WA')
  exit()

for i in range(1,len(S)):
  if S[i] != 'C' and (ord(S[i])<97 or ord(S[i])>122):
    print('WA')
    exit()

print('AC')

Measured memory_bytes: 8796
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
ll d1[4] = {1, -1, 0, 0};
ll d2[4] = {0, 0, 1, -1};

int main(){
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n), neg, pos;
    rep(i, 0, n){
        cin >> a[i];
        if(a[i] <= 0) neg.push_back(a[i]);
        else pos.push_back(a[i]);
    }
    sort(ALL(neg));
    sort(ALL(pos));
    constexpr ll mod = 1000000000+7;
    // n == k
    if(n == k) {
        ll ans = 1;
        rep(i, 0, k) ans = (ans * a[i]) % mod;
        ans = (ans + mod) % mod;
        cout << ans << endl;
        return 0;
    }
    // all negative or zero
    if(pos.empty()) {
        ll ans = 1;
        if(k % 2 == 1) reverse(neg.begin(), neg.end());
        rep(i, 0, k) ans = (ans * neg[i]) % mod;
        ans = (ans + mod) % mod;
        cout << ans << endl;
        return 0;
    }
    if(neg.empty()) {
        ll ans = 1;   
        reverse(pos.begin(), pos.end());
        rep(i, 0, k) ans = (ans * pos[i]) % mod;
        ans = (ans + mod) % mod;
        cout << ans << endl;
        return 0;
    }
    cerr << "exp" << endl;
    // こんときは必ず正の値にすることができる気がする？
    ll pi = pos.size()-1, ni = 0;
    ll ans = 1;
    if(k % 2 == 1) {
        ans *= pos[pos.size()-1];
        ans %= mod;
        k--;
        pi -= 1;
    }
    rep(i, 0, k/2) {
        ll tp = -1, tn = -1;
        if(pi > 0) tp = pos[pi] * pos[pi-1];
        if(ni < neg.size()-1) tn = neg[ni] * neg[ni+1];
        if(tp > tn) {
            ans *= tp % mod;
            pi -= 2;
        }else{
            ans *= tn % mod;
            ni += 2;
        }
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6920
n, m = map(int, input().strip().split())
L = [list(map(int, input().split())) for _ in range(m)]

# if m>n:
#     print(-1)
#     exit()
ans=[None]*n
for l in L:
    if ans[l[0]-1] is None:
        ans[l[0]-1]=l[1]
    elif ans[l[0]-1]!=l[1]:
        print(-1)
        exit()
if n>1 and ans[0]==0:
    print(-1)
    exit()
for i,v in enumerate(ans):
    if i==0:
        if ans[0] is None:
            if n==1:
                ans[0]=0
            else:
                ans[0]=1
    elif v is None:
        ans[i]=0
print("".join(list(map(str,ans))))

Measured memory_bytes: 3064
# -*- coding: utf-8 -*-
import numpy as np
from collections import deque
import collections

mod = 10 ** 9 + 7
x, y = list(map(int, input().split()))
if ((2 * y - x) % 3 != 0 or (2 * x - y) % 3 != 0 or y > 2*x or x > 2*y):
    print(0)
    exit()

# 合計 a + b回動かす
a = (2*y-x)//3  # a回
b = (2*x-y)//3  # b回
# (a+b)!/a!b!
ans = 1
for i in range(1, a+b+1):
    ans = (ans * i) % mod
a_func = 1
for i in range(1, a+1):
    a_func = (a_func * i) % mod
inv_a_func = pow(a_func, mod-2, mod)

b_func = 1
for i in range(1, b+1):
    b_func = (b_func * i) % mod
inv_b_func = pow(b_func, mod-2, mod)

ans = (ans * inv_a_func) % mod
ans = (ans * inv_b_func) % mod
print(ans)


Measured memory_bytes: 14396
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,int> pdi;
typedef pair<double,double> pdd;
typedef pair<double,ll> pdl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<pdd> vdd;
typedef vector<pdi> vdi;
typedef vector<pdl> vdl;
typedef vector<string> vs;
#define fi first
#define se second
const ll INFLL=LLONG_MAX;
const int INF=INT_MAX;
const ll MAXLL=0x3f3f3f3f3f3f3f3f;
const int MAX=0x3f3f3f3f;
const ll MOD=1000000007;
const ll mod=998244353;
#define eb emplace_back
#define emp emplace
#define mp(a,b) make_pair(a,b)
template<class T> using min_heap=priority_queue<T,vector<T>,greater<T> >;
template<class T>
void sort(vector<T>& v){
	sort(v.begin(),v.end());
}
template <class T, class U>
void sort(vector<T>& v,U func){
	sort(v.begin(),v.end(),func);
}
template<class T>
void rsort(vector<T>& v){
	sort(v.rbegin(),v.rend());
}
template <class T>
int lb_index(vector<T>& v,T k){
	return lower_bound(v.begin(),v.end(),k)-v.begin();
}
template <class T>
int ub_index(vector<T>& v,T k){
	return upper_bound(v.begin(),v.end(),k)-v.begin();
}
template<class T>
bool is_sorted(vector<T>& v){
	return is_sorted(v.begin(),v.end());
}
template<class T>
bool sorted(vector<T>& v){
	return is_sorted(v);
}
void precompute(){

	return;
}
void solve(){
	int n,m,k;
	cin>>n>>m>>k;
	vii r(n),c(m);
	map<pii,bool>mp;
	for(int i=0;i<k;i++){
		int a,b;
		cin>>a>>b;
		r[a-1].fi++;
		c[b-1].fi++;
		mp[mp(a-1,b-1)]=1;
	}
	for(int i=0;i<n;i++){
		r[i].se=i;
	}
	for(int i=0;i<m;i++)c[i].se=i;
	rsort(r);rsort(c);
	vi a,b;
	for(int i=0;i<n;i++){
		if(r[i].fi==r[0].fi){
			a.eb(r[i].se);
		}
		else break;
	}
	for(int i=0;i<m;i++){
		if(c[i].fi==c[0].fi){
			b.eb(c[i].se);
		}
		else break;
	}
	for(int i:a){
		for(int j:b){
//			cout<<i<<' '<<j<<endl;
			if(!mp[mp(i,j)]){
				cout<<r[0].fi+c[0].fi;
				return;
			}
		}
	}
	cout<<r[0].fi+c[0].fi-1;
	return;
}

int main(){
	ios::sync_with_stdio(0);
	int numberofsubtestcases=1;
//	cin>>numberofsubtestcases;
	precompute();
	for(int looping=1;looping<=numberofsubtestcases;looping++){
//		cout<<"Case #"<<looping<<": ";
		solve();
	}
	return 0;
}

Measured memory_bytes: 30864
#include<stdio.h>
#include<string.h>
#include<math.h>

void swap (int *x, int *y) {
  int temp;    // 値を一時保存する変数

  temp = *x;
  *x = *y;
  *y = temp;
}

/***
* pivotを決め、
* 全データをpivotを境目に振り分け、
* pivotの添え字を返す
***/
int partition (int array[], int left, int right) {
  int i, j, pivot;
  i = left;
  j = right + 1;
  pivot = left;   // 先頭要素をpivotとする

  do {
    do { i++; } while (array[i] < array[pivot]);
    do { j--; } while (array[pivot] < array[j]);
    // pivotより小さいものを左へ、大きいものを右へ
    if (i < j) { swap(&array[i], &array[j]); }
  } while (i < j);

  swap(&array[pivot], &array[j]);   //pivotを更新

  return j;
}

/* クイックソート */
void quick_sort (int array[], int left, int right) {
  int pivot;

  if (left < right) {
    pivot = partition(array, left, right);
    quick_sort(array, left, pivot-1);   // pivotを境に再帰的にクイックソート
    quick_sort(array, pivot+1, right);
  }
}





int main(void){
   int N,D,X[10][10],i,k,l,cou=0;
   double rx;
   scanf("%d %d",&N,&D);
   for(i=0;i<N;i++){
      for(k=0;k<D;k++){
         scanf("%d",&X[i][k]);
      }
   }
   for(i=0;i<N;i++){
      for(k=i+1;k<N;k++){
         rx=0.0;
         for(l=0;l<D;l++){
            rx+=pow(X[i][l]-X[k][l],2.0);
         }
         rx=sqrt(rx);
         if(ceil(rx) == floor(rx)){
            cou++;
         }
      
      }
   }
   printf("%d",cou);
   return 0;
}


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

int main(){
  string s;
  cin >> s;
  int ans;
  int min = 300000;
  int max = -100;
  bool frag = false;
  for(int i = 0; i < s.size(); i++){
    if(s[i] == 'A'){
      if(i < min){
        min = i;
      }
    }
    if(s[i] == 'Z'){
      if(max < i){
        max = i;
      }
    }
  }

  ans = max - min + 1;
  cout << ans << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007
#define f(i,a,b) for(ll i=a;i<b;i++)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ii pair<ll,ll>
#define vii vector<ii>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define MAX 1e9
 
ll modpow(ll base, ll exp, ll modulus) {base %= modulus;ll result = 1;while (exp > 0) {if (exp & 1) result = (result * base) % modulus;base = (base * base) % modulus;exp >>= 1;}return result;}
const ld pi=acos(-1);

int main(){
    IOS;
    ll n;cin>>n;
    ll a[n];vector<ll>v;
    f(i,0,n-1)cin>>a[i];
    for(ll i=n-2;i>=0;i--){
        if(i==n-2)v.pb(a[i]);
        else v.pb(min(a[i],a[i+1]));
    }
    // f(i,0,v.size()){
    //     cout<<v[i]<<endl;
    // }
    ll sum=0;
    f(i,0,v.size())sum+=v[i];
    cout<<sum+a[0];
    return 0;
}   

Measured memory_bytes: 256
#include <iostream>

using namespace std;
long long a[200001] = {};

int main(){
  int n;
  cin >> n;
  for (int i=0;i<n;i++) {
    int tmp;
    cin >> tmp;
    a[i] = tmp;
  }
  long long prev = 0;
  long long tot = 0;
  long long xr = 0;
  for (int i=0;i<n;i++) {
    prev = prev > i?prev:i;
    int j = prev;
    while (j < n) {
      //    cout << "loop\t" << i << "\t" << j << "\t" << xr << endl;
    if ((xr & a[j]) != 0) {
	xr = xr ^ a[i];
	break;
      }
      xr = xr ^ a[j];
      j++;
      prev = j;
    }
    //    cout << "break\t" << i << "\t" << prev << "\t" << xr << endl;
    tot += j - i;
  }
  cout << tot << endl;
  return(0);
}


Measured memory_bytes: 1792
N, K, C = map(int, input().split())
S = input()
L = [0] *K
R = [0] *K
i = 0
cnt = 0
while K > cnt:
    if S[i] == 'o':
        L[cnt] = i
        cnt += 1
        i += C
    i += 1
i = N-1
cnt = K-1
while cnt >= 0:
    if S[i] == 'o':
        R[cnt] = i
        cnt -= 1
        i -= C
    i -= 1
ans = []
for i in range(K):
    if L[i] == R[i]:
        ans.append(L[i]+1)
for x in ans:
    print(x)

Measured memory_bytes: 57056
#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <map>
#include <functional>
#include <set>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
#define MIN(a, b) (((a) < (b)) ? (a) : (b))

using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pint;
const ll inf = (1LL << 60);
const ll mod = 1000000007;
ll max(ll a, ll b) {
	if (a < b)
		return b;
	else
		return a;

}
ll min(ll a, ll b) {
	if (a < b)
		return a;
	else
		return b;

}


int main() {
	ll N, D;
	
	cin >> N >> D;
	vector<vector<double>> X(N);

	rep(i, N) {
		rep(j, D) {
			X[i].resize(D);
			cin >> X[i][j];
		}
	}

	double sum = 0;

	ll ans = 0;
	rep(i, N) {
		for (int j = i + 1; j < N; j++) {
			double sum = 0.0;

			rep(k, D) {
				sum += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
			}
			
			if (sqrt(sum) == floor(sqrt(sum))) {
				ans += 1;
			}

			cerr << floor(sum) << endl;
			cerr << sqrt(sum) << endl;

		}

	}

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

Measured memory_bytes: 256
#include <cstdio>
#include <cassert>
#include <vector>
#include <algorithm>

std::vector <std::pair <double, double> > list;

double l, m, r;

inline std::pair <double, double> operator + (std::pair <double, double> a, std::pair <double, double> b)
{
	return std::make_pair(a.first + b.first, a.second + b.second);
}

inline std::pair <double, double> operator - (std::pair <double, double> a, std::pair <double, double> b)
{
	return std::make_pair(a.first - b.second, a.second - b.first);
}

inline std::pair <double, double> inter(std::pair <double, double> a, std::pair <double, double> b)
{
	return std::make_pair(std::max(a.first, b.first), std::min(a.second, b.second));
}

inline bool check(double x)
{
	std::pair <double, double> delta = std::make_pair(r * x, l * x);
	std::vector <std::pair <double, double> > tmp;
	bool flag = false;
	for (int i = 0; i < (int)list.size(); i ++)
	{
		std::pair <double, double> now = inter(list[i] + delta, std::make_pair(-m, m));
		if (now.first <= now.second)
		{
			flag = true;
			tmp.push_back(now);
		}
		now = inter(list[i] - delta, std::make_pair(-m, m));
		if (now.first <= now.second)
		{
			flag = true;
			tmp.push_back(now);
		}
	}
	list.clear();
	if (!flag)
		return false;
	std::sort(tmp.begin(), tmp.end());
	for (int i = 0; i < (int)tmp.size(); i ++)
	{
		double nowr = tmp[i].second;
		int r = i;
		while (r + 1 < (int)tmp.size() && tmp[r + 1].second <= nowr)
		{
			r ++;
			nowr = std::max(nowr, tmp[r].second);
		}
		list.push_back(std::make_pair(tmp[i].first, nowr));
		i = r;
	}
	return true;
}

int main()
{
	int n;
	scanf("%d%lf%lf%lf", &n, &l, &m, &r);
	l /= 2;
	list.push_back(std::make_pair(0, 0));
	bool ans = true;
	for (int i = 1; i <= n; i ++)
	{
		double x;
		scanf("%lf", &x);
		assert(x <= 1e9);
		if (ans)
			ans = check(x);
	}
	if (ans)
		puts("Yes");
	else
		puts("No");
	return 0;
}

Measured memory_bytes: 1084
#define _USE_MATH_DEFINES
#include<math.h>

//#include<cmath>

#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>



//#include "Ants.h"
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
typedef pair < int, int> P;
/****Union-Ford-Tree***/
int par[int(0x7ffffff)];//Parent
int Rank[int(0x7ffffff)];//Deep_of_the_Tree

//int a[100] = { 4,2,3,1,5 }, m[100] ={3,2,2};
//int n = 0;
//const ll mod = 1000000007;


//n要素で初期化
void init(int n) {
	for (int i = 0; i < n; i++) {
		par[i] = i;
		Rank[i] = 0;
	}
}
//木の根探し
int find(int x) {
	if (par[x] == x) {
		return x;
	}
	else {
		return par[x] = find(par[x]);
	}
}
//xとyの属する集合を併合
void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y)return;

	if (Rank[x] < Rank[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (Rank[x] == Rank[y])Rank[x]++;
	}
}

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

/************************************************************************************
//*無向グラフのBELL_MAN_FORD;*//*
struct edge { int from, to, cost; };
edge es[10000];
int d[10000];
void shortest_path(int s) {
	for (int i = 0; i < V; i++)d[i] = INF;
	d[s] = 0;
	while (true) {
		bool update = false;
		for (int i = 0; i < E*2; i++) {
			edge e = es[i];
			if (d[e.from] != INF && d[e.to] > d[e.from] + e.cost) {
				d[e.to] = d[e.from] + e.cost;
				update = true;
			}
		}
		if (!update)break;
	}

}
int main() {
	cin >> V >> E;
	for (int i = 0; i < E*2; i = i+2) {
		edge e;
		cin >> e.from >> e.to >> e.cost;
		es[i] = e;
		swap(e.to, e.from);
		es[i + 1] = e;

	}
	shortest_path(0);
	cout << d[6] << endl;
}
*////////////////////////////////////////*
int gcd(int a, int b) {//最大公約数を求める
	if (b == 0) return a;
	return gcd(b, a%b);
}
/*****************************************************************************/
//int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1};
//vector<int> G[10000];


//struct edge { int to, cost; };
//vector<edge>G[100000];


/**************/


/****
//priority_queue<int> //大きいものから順番に出てくる
//priority_queue<int,vector<int>,greater<int>>//小さいものから出てくる（順位キュー）
.top();
.pop();
.empty();
**/
//void solve();
//int V, E;
//void shortest_path(int);
typedef long double ld;
typedef unsigned long long ull;
const int MX = 3007;


int N, C[1000], V[1000];
int main()
{
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> C[i];
	}
	for (int i = 0; i < N; i++) {
		cin >> V[i];
	}
	int ans = 0;

	for (int i = 0; i < N; i++) {
		int res = C[i] - V[i];
		if (res > 0)ans += res;
	}
	cout << ans << endl;
	
	
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
import numpy as np

def solve(N: int, K: int, H: "List[int]"):
    h = np.array(sorted(H))
    k = K if N>=K else N
    if k!=0:
        print(h[:-k].sum())
    else:
        print(h.sum())

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    H = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, K, H)

if __name__ == '__main__':
    main()


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

vector<int>prime;
bool p[1000009];
int c[1000009];

void seive()
{
    long long i,j;
    p[0]=p[1]=1;
    for(i=2;i<=1000000;i++)
    {
        if(p[i]==0)
        {
            prime.push_back(i);
            for(j=i;i*j<=1000000;j++)
                p[i*j]=1;
        }
    }

    return ;
}
int main()
{
    long long n,p;
    cin >> n >> p;
    if(n==1LL) cout << p << endl;
    else if(p==1LL) cout << 1 << endl;
    else
    {
        seive();
        int i,j,sz;
        sz=prime.size();
        long long ans=1LL;
        for(i=0;i<sz;i++)
        {
            while(p%prime[i]==0)
            {
                c[prime[i]]++;
                p/=prime[i];
                if(c[prime[i]]>=n)
                {
                    ans*=(prime[i]);
                    c[prime[i]]=0;
                }
            }

            if(p==1LL) break;
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3708
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict

#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N = int(input())
	S = []
	for i in range(N):
		X, L = getlist()
		S.append([X + L, X - L])
	S = sorted(S)
	# print(S)
	ans = 1
	val = S[0][0]
	for i in range(1, N):
		if S[i][1] >= val:
			ans += 1
			val = S[i][0]
	print(ans)
	


if __name__ == '__main__':
	main()

Measured memory_bytes: 56092
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long lint;



int main(){
    int n;
    cin >> n;
    int x[n];
    REP(i,n){
        cin >> x[i];
    }
    
    int hp[101]={};
    REP(i,101){
        REP(j,n){
            hp[i] += pow(x[j]-i,2);
        }
    }
    sort(hp, hp+101);
    cout << hp[0] << endl;
    
    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7

N, M = map(int, input().split())

#  nの約数をO(root(n))で全列挙、
# sortするなら O(root(n) * root(n)log(root(n))) --> O(n * log(n))
def make_divisors(n):
    import math
    divisors = []
    for i in range(1, int(math.sqrt(n)) + 1):
        if n % i == 0: #割り切れるとき
            divisors.append(i)
            if i != n//i:
                divisors.append(n//i)
    divisors.sort(reverse = True)
    return divisors

lst = make_divisors(M)
for i in lst:
    if M // i >= N:
        print (i)
        break



Measured memory_bytes: 3064
import java.util.Scanner;
public class Main {
     public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x = scanner.nextInt();
        System.out.println(power(x,3));
     }
     public static int power(int x,int y) {
            if(y == 1){
                return x;
            }
            int answer = power(x,y-1) * x;
            return answer;
        }
    }



Measured memory_bytes: 26288
#include<bits/stdc++.h>
using namespace std;
struct edge{int u,v,w;};
vector<edge> x;
void build(int v,int r,int step,int lim)
{
	int cnt=r/step+1;
	if(cnt<=lim)
	{
		for(int i=0;i<=r;i+=step)x.push_back({1,v,i});
		return;
	}
	if(cnt&1)x.push_back({1,v,r}),r-=step,lim--;
	if(r%(2*step))r-=step;
	x.push_back({v-1,v,0});
	x.push_back({v-1,v,step});
	build(v-1,r,step<<1,lim-2);
}
int l;
int main()
{
	cin>>l;
	build(20,l-1,1,60);
	cout<<"20 "<<x.size()<<'\n';
	for(edge e:x)cout<<e.u<<' '<<e.v<<' '<<e.w<<'\n';
}


Measured memory_bytes: 256
#include <stdio.h>
int main()
{
  int box[101][101],r,c,cour,couc,sumc,sumr=0,suma=0;
  scanf("%d %d",&r,&c);
  for(cour=1;cour<r+1;cour++){
    for(couc=1;couc<c+1;couc++){
      scanf("%d",&box[cour][couc]);
    }
  }
  //printf("\n");
  for(cour=1;cour<r+1;cour++){
    sumc=0;
    for(couc=1;couc<c+2;couc++){
      if(couc<c+1){
	printf("%d ",box[cour][couc]);
	sumc=sumc+box[cour][couc];
      }
    }
    printf("%d\n",sumc);
  }
  for(couc=1;couc<c+1;couc++){
    sumr=0;
    for(cour=1;cour<r+1;cour++){
      sumr=sumr+box[cour][couc];
    }
    printf("%d ",sumr);
    suma=suma+sumr;
  }
  printf("%d\n",suma);
  return 0;
}

Measured memory_bytes: 1068