akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
using ll=long long;

int main(){
    int n;
    cin>>n;
    vector<int> x(n),y(n);
    for(int i=0;i<n;i++)cin>>x[i]>>y[i];
    auto dist=[&](int i,int j){
        double dx=x[i]-x[j];
        double dy=y[i]-y[j];
        return sqrt(dx*dx+dy*dy);
    };
    vector<int> p(n);
    for(int i=0;i<n;i++)p[i]=i;
    double len=0;
    int cnt=0;
    do{
        for(int i=0;i<n-1;i++){
            len+=dist(p[i],p[i+1]);
        }
        cnt++;
    }while(next_permutation(p.begin(),p.end()));
    double ans=len/cnt;
    printf("%.10f\n",ans);
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main (void){
    int N,A,B;
    scanf ("%d %d %d", &N, &A, &B);

    if( 1<=N && N<=20,
        1<=A && A<=50,
        1<=B && B<=50){
    }else{ 
        printf("error");
    }

    int NA = N*A;
    if(NA<B){
        printf( "%d", NA);
    }else if(NA>B){
        printf( "%d", B);
    }else{
        printf( "%d", NA);
    }

}

Measured memory_bytes: 128
n,m = map(int,input().split())
x = list(map(int,input().split()))
x.sort()
dis = []
ans = 0
if n>m:
  print(0)
  exit()
for i in range(m-1):
    dis.append(x[i+1]-x[i])
    ans += x[i+1]-x[i]
dis.sort(reverse = True)
for j in range(n-1):
    ans -= dis[j]
print(ans)

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


int main() {
	int N;
  	char c;
  	cin >>N;
  	bool flag=false;
	for(int i=0;i<N;i++){
    	cin >> c;
      	if(c=='Y')flag=true;
    }
  	if(flag) cout << "Four" <<endl;
  	else cout << "Three" << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(void){
 int x,y,z;
 char A[100],B[100],C[100];
 scanf("%s%s%s",A,B,C);
 x=strlen(A);
 y=strlen(B);
 z=strlen(C);
 if(A[x-1]==B[0] && B[y-1]==C[0])
  printf("YES\n");
  else
   printf("NO\n");
return 0;
}


Measured memory_bytes: 128
int main()
{
  int k, a, b;
  scanf("%d", &k);
  scanf("%d %d", &a, &b);
  int tmp = 0;
  for (int i = 0; tmp < a ; i++)
    tmp = i * k;
  if (tmp <= b)
    printf("OK");
  else
    printf("NG");
}


Measured memory_bytes: 1724
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <string.h>
#include <memory.h>
#include <math.h>

int main(int argc, char *argv[])
{
    int n;
    int a[100000];
    int i;
    int absmin_pos;
    int absmin = INT_MAX;
    long long sum;

    scanf("%d", &n);

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

    for (i = 0; i < absmin_pos; i++) {
        if (a[i] < 0 && (i < n - 1)) {
            // DO
            a[i    ] *= -1;
            a[i + 1] *= -1; 
        }
    }

    for (i = n - 1; i > absmin_pos; i--) {
        if (a[i] < 0 && (i > 0)) {
            // DO
            a[i - 1] *= -1;
            a[i    ] *= -1; 
        }
    }

    sum = 0;
    for (i = 0; i < n; i++) {
        sum += a[i];
    }
    printf("%lld\n", sum);

    return 0;
}


Measured memory_bytes: 512
#include <iostream>
using namespace std;
int H,W,K;
string s[6];
int main() {
	cin>>H>>W>>K;
	for (int i=0;i<H;i++) cin>>s[i];
	int ans=0;
	for (int i=0;i<1<<H;i++) {
        for (int j=0;j<1<<W;j++) {
		    int cnt=0;
		    for (int I=0;I<H;I++)
                for (int J=0;J<W;J++)
                    if (!(i>>I&1) && !(j>>J&1))
                        cnt += s[I][J] == '#';
		    ans += cnt == K;
	    }
    }
	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3612
n = int(input())
a = list(map(int, input().split()))
b = [0] * n
s = 0
for i in range(1, n, 2):
    s += a[i]
b[0] = sum(a) - s * 2
for i in range(1, n):
    b[i] = (a[i-1] - b[i-1] // 2) * 2
print(*b)

Measured memory_bytes: 14028
s=input()
k=int(input())
moji=sorted(list(set(s)))
ans=[moji[0]]
mojinum=0
if k==1:
    print(ans[0])
    import sys
    sys.exit()
while(True):
    for r in range(len(moji)):
        if ans[-1]+moji[r] in s:
            ans.append(ans[-1]+moji[r])
            break
        elif r==len(moji)-1:
            mojinum+=1
            ans.append(moji[mojinum])
    if len(ans)>=k:
        break
print(ans[k-1])

Measured memory_bytes: 38384
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <cstring>
using namespace std;
typedef long long ll;

int main () {
ios_base::sync_with_stdio(false);
cin.tie(NULL);

ll n,r;

cin >> n >> r;

if (n<10)
	cout << r+(100*(10-n));
else
	cout << r;


return 0;
}



Measured memory_bytes: 256
while n = gets.to_i
  break if n == 0
  arr = []
  arr << [0, 1000000001, -1]
  n.times do
    l = gets.split
    cmd = l.shift
    case cmd
    when "W"
      x, s = l.map(&:to_i)
      pos = 0
      loop do
        p, size, y = arr[pos]
        if y == -1
          arr[pos][2] = x
          if size <= s
            s -= size
          else
            arr[pos][1] = s
            arr.insert(pos + 1, [p + s, size - s, -1])
            break
          end
        end
        pos += 1
      end
    when "D"
      x = l[0].to_i
      arr.size.times do |i|
        arr[i][2] = -1 if arr[i][2] == x
      end
    when "R"
      sec = l[0].to_i
      arr.size.times do |i|
        p, size, y = arr[i]
        if p <= sec && sec - p < size
          p y
          break
        end
      end
    end
  end
  puts
end

Measured memory_bytes: 8912
#include <iostream>
using namespace std;
const int MAXN = 10005;
int a[MAXN], b[MAXN];

int main()
{
    int n;
    long long int diff1 = 0, diff2 = 0;

    cin >> n;

    for(int i = 1; i <= n; i++)
        cin >> a[i] ;
    for(int i = 1; i <= n; i++)
        cin >> b[i] ;

    for(int i = 1; i <= n; i++)
    {
        if(a[i] >= b[i])
        {
            diff1 += a[i] - b[i] ;
        }
        else
        {
            //int t = b[i] - a[i];
            //if(t & 1)
            //    t -= 1;
            diff2 += (b[i] - a[i]) / 2 * 2;
        }
    }

    if(diff2 / 2 >= diff1)
        cout << "Yes" << endl ;
    else
        cout << "No" << endl ;

    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <algorithm>
#include <functional>

#include <vector>

using namespace std;

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

	unsigned long long H, W;
	cin >> H >> W;

	if (H == 1 || W == 1)
	{
		cout << 1;
		return 0;
	}

	unsigned long long Wcount = 0;
	if (W % 2 == 0)
	{
		Wcount = W / 2;
	}
	else
	{
		Wcount = W / 2 + 1;
	}

	unsigned long long Hcount = H / 2;
	unsigned long long Hcount_mod = H % 2;

	unsigned long long result = (W * Hcount) + (Wcount * Hcount_mod);
	cout << result;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;

#define SZ(a) ((int)a.size())
#define ALL(a) a.begin(), a.end()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define fst first
#define snd second

void dout() { cerr << endl; }

template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

const int maxW = 3047;

int dp[maxW][2];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, t;
    cin >> n >> t;
    vi a(n), b(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i] >> b[i];
    }
    for (int i = 0; i < n; i++)
    {
        for (int w = maxW - 1; w >= 0; w--)
        {
            dp[w][1] = max(dp[w][1], dp[w][0] + b[i]);
            if (w - a[i] >= 0)
            {
                dp[w][0] = max(dp[w][0], dp[w - a[i]][0] + b[i]);
                dp[w][1] = max(dp[w][1], dp[w - a[i]][1] + b[i]);
            }
        }
    }
    int ans = 0;
    for (int i = 0; i <= t; i++)
    {
        ans = max(ans, dp[i][0]);
    }
    for (int i = 0; i < t; i++)
    {
        ans = max(ans, dp[i][1]);
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n,i,j;
  long long d[100010],s,m=0;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%lld",&d[i]);
  for(i=1;i<n;i++){
    for(j=s=0;i*j<n;j++){
      if((n-1)%i==0&&i*j>=n-1-i*j)break;
      if(n-i*j-1<i)break;
      s+=d[i*j]+d[n-i*j-1];
      if(m<s)m=s;
    }//printf("%d %lld\n",i,m);
  }
  printf("%lld\n",m);
  return 0;
}


Measured memory_bytes: 896
n,m = list(map(int,input().split()))
a = []
b = []
c = []
d = []

for i in range(n):
    aa,bb = map(int,input().split())
    a.append(aa)
    b.append(bb)

for i in range(m):
    cc,dd = map(int,input().split())
    c.append(cc)
    d.append(dd)

for i in range(n):
    ans = 0
    min_man = 10e8
    num=0
    for j in range(m):
        man = abs(a[i]-c[j])+abs(b[i]-d[j])
        num+=1
        if min_man > man:
            min_man = man
            ans = num
    print(ans)
    

Measured memory_bytes: 3064
k,x=map(int,input().split())
if x-k+1<-10000:
  n=10000 
else:
  n=x-k+1
if x+k-1>10000:
  ma=10000
else:
  ma=x+k-1
while n<ma+1:
  print(n, end=" ")
  n+=1

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

int main() {
  string s1;
  cin >> s1;
  if(s1[0] >= 'a' && s1[0] <= 'z'){
  cout << "a" << endl;
  }else{
  cout << "A" << endl;
  }
  return 0;
}


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

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int[] x=new int[3];
		x[0]=sc.nextInt();
		x[1]=sc.nextInt();
		x[2]=sc.nextInt();
		Arrays.sort(x);
		if(x[0]==x[1]&&x[1]!=x[2]||x[1]==x[2]&&x[1]!=x[0])
			pw.println("Yes");
		else
			pw.println("No");
		pw.close();
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public Scanner(String file) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

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

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

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}
	}
}

Measured memory_bytes: 21076
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>

#define phb push_back

using namespace std;

typedef vector< double > Row;
typedef vector< Row > Matrix;

const double kEps = 1e-4;

int D;
double V[10];

void read();
void soups_on();
bool yee_haw(int);
Row sugar_cube(Matrix &);

inline bool feq(double x, double y) { return abs(x - y) < kEps; }

int main() {
  while (cin >> D, D)
    read(), soups_on();

  return 0;
}

void read() {
  for (int i = 0; i < D + 3; ++i)
    cin >> V[i];
}

void soups_on() {
  for (int i = 0; i < D + 3; ++i)
    if (yee_haw(i)) {
      cout << i << "\n";
      break;
    }
}

bool yee_haw(int wv) {
  Matrix mtrx;
  double x, res;
  bool ret = false;

  for (int i = 0, j = 0; i < D + 3; ++i) {
    if (i == wv)
      continue;

    if (j < D + 1) {
      mtrx.phb(Row(D + 2)), x = 1.0;
      for (int k = D; k >= 0; --k, x *= double(i))
        mtrx[j][k] = x;
      mtrx[j][D + 1] = V[i];
    }
    else {
      Row coef = sugar_cube(mtrx);
      res = 0.0, x = 1.0;
      for (int k = D; k >= 0; --k, x *= double(i))
        res += x * coef[k];
      ret = !(abs(res - V[i]) + kEps > 1.0);
    }

    ++j;
  }

  return ret;
}

Row sugar_cube(Matrix &rm) {
  Row ret(D + 1);
  int i, j, r, c;
  double f;

  r = c = 0;
  for (r = 0; r < D + 1; ++r, ++c) {
    i = r;
    while (feq(rm[i][c], 0.0))
      ++i;

    if (i != r)
      swap(rm[r], rm[i]);

//    cout << "i = " << i << ", r = " << r << endl;
    for (i = 0; i < D + 1; ++i) {
      if (i == r)
        continue;

      f = -rm[i][c] / rm[r][c];
      for (j = 0; j <= D + 1; ++j)
        rm[i][j] += f * rm[r][j];
    }
  }

  for (r = 0; r < D + 1; ++r)
    for (c = 0; c < D + 1; ++c)
      if (!feq(rm[r][c], 0.0)) {
        ret[c] = rm[r][D + 1] / rm[r][c];
        break;
      }

  return ret;
}

Measured memory_bytes: 1260
#include <bits/stdc++.h>
using namespace std;
using ll = long long ;
using P = pair<ll, ll>;
using Vec = vector<ll>;
using VecP = vector<P>;
#define FOR(i, m, n) for(ll (i) = (m); (i) < (n); (i)++)
#define FORN(i, m, n) for(ll (i) = (m); (i) <= (n); (i)++)
#define FORR(i, m, n) for(ll (i) = (m); (i) >= (n); (i)--)
#define rep(i, n) FOR(i, 0, n)
#define repn(i, n) FORN(i, 1, n)
#define repr(i, n) FORR(i, n, 0)
#define repnr(i, n) FORR(i, n, 1)
#define co(n) cout << (n) << endl
#define cosp(n) cout << (n) << ' '
#define setp(n) cout << fixed << setprecision(n);
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second

const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const double PI = acos(-1);
const double EPS = 1e-9;

int main(void){
	string s;
	cin >> s;

	Vec alp(26);
	rep(i, s.length()){
		ll c = s[i]-'a';
		alp[c]++;
	}

	rep(i, 26){
		if(!alp[i]){
			co((char)('a'+i));
			return 0;
		}
	}

	puts("None");
	return 0;
}


Measured memory_bytes: 512
let () =
  let n = read_int () in
  let a = Array.init n (fun _ -> Scanf.scanf "%d " (fun e -> e)) in
  let b = Array.make n 0 in
  let c = Array.make (10000 + 1) 0 in
  Array.iter (fun e -> c.(e) <- c.(e) + 1) a;
  Array.iteri (fun i _ -> if i <> 0 then c.(i) <- c.(i) + c.(i-1)) c;
  for i = n - 1 downto 0 do
    b.(c.( a.(i) ) - 1) <- a.(i);
    c.( a.(i) ) <- c.( a.(i) ) - 1;
  done;
  print_int b.(0);
  for i = 1 to n - 1 do
    print_string " ";
    print_int b.(i);
  done;
  print_newline ()

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

#define fr first
#define sc second
//#define int long long
#define forn(i, x, n) for (int i = x; i < (int)n; ++i)
#define all(x) x.begin(), x.end()
#define endl '\n'
#define pb push_back

using namespace std;

const int MAXN = 1e5 + 2, INF = 1e9, MAXLOG = 18;
const double EPS = 1e-5;

typedef vector<int> vi;
typedef pair<int, int> pii;
const int MXSH = 201;

main() {
//    freopen("input.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int n;
    cin >> n;
    vi mas(n);
    int sum = 0;
    int mn = 101;
    forn(i, 0, n) {
        cin >> mas[i];
        sum += mas[i];
        if (mas[i] % 10) {
            mn = min(mn, mas[i]);
        }
    }
    if (sum % 10 == 0) {
        if ((sum - mn) % 10 == 0 || mn == 101) {
            cout << 0;
        } else {
            cout << sum - mn;
        }
    } else {
        cout << sum;
    }
}


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

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

using namespace std;

int n, m, d;
char x[100][101];

int main(){
  scanf("%d%d%d", &n, &m, &d);
  rep(i, n){
    scanf("%s", x[i]);
    rep(j, m){
      x[i][j] = x[i][j] == '.';
    }
  }

  int ans = 0;
  if(m >= d){
    rep(i, n){
      int e = 0;
      rep(j, d){
        e += x[i][j];
      }
      rep(j, m - d + 1){
        ans += e == d;
        e += x[i][j + d] - x[i][j];
      }
    }
  }
  if(n >= d){
    rep(j, m){
      int e = 0;
      rep(i, d){
        e += x[i][j];
      }
      rep(i, n - d + 1){
        ans += e == d;
        e += x[i + d][j] - x[i][j];
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}

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

using ll = long long;
using G = vector<vector<int>>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const ll MOD = 1000000007;

ll GCD(ll x, ll y){
	return y ? GCD(y, x%y) : x;	
}

int main() {
	ll n, k, q; cin >> n >> k >> q;
	ll a[100005];
	map<ll, ll> m;
	for(ll i=0;i<q;i++){
		cin >> a[i];
		m[a[i]]++;
	}
	for(ll i=1;i<=n;i++){
		if(k-q+m[i]>0){
			cout << "Yes" << endl;
		}else{
			cout << "No" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 7680
/*input
3 5 8
*/
#include <bits/stdc++.h>
using namespace std;

#define fill(a,val) memset(a, (val), sizeof a)
#define pb push_back
#define lli long long int
#define scantype int
#define endl "\n"
#define unique(x) x.erase(unique(x.begin(),x.end()), x.end())
#define sort_f(x)  sort(x.begin(),x.end());
#define sort_r(x)  sort(x.rbegin(),x.rend());

lli MOD  = 1000000007;
lli inf = 1e15;

void scan(scantype &x);
lli powermod(lli _a,lli _b,lli _m){lli _r=1;while(_b){if(_b%2==1)_r=(_r*_a)%_m;_b/=2;_a=(_a*_a)%_m;}return _r;}
lli string_to_number(string s){lli x=0; stringstream convert(s); convert>>x; return x;}
lli add(lli a,lli b){lli x = (a+b)%MOD; return x; }
lli mul(lli a,lli b){lli x = (a*b)%MOD; return x; }
lli sub(lli a,lli b){lli x = (a-b+MOD)%MOD; return x; }
lli divi(lli a,lli b){lli x = a;lli y = powermod(b,MOD-2,MOD);lli res = (x*y)%MOD;return res;}

#define N 200003

long  divisors(long x) {
    long limit = x;
    long numberOfDivisors = 0;

    if (x == 1) return 1;

    for (long i = 1; i < limit; ++i) {
        if (x % i == 0) {
            limit = x / i;
            if (limit != i) {
                numberOfDivisors++;
            }
            numberOfDivisors++;
        }
        if(numberOfDivisors>=4)
        {
            break;
        }
    }

    return numberOfDivisors;
}
 bool isPrime(long n)
{
   
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
 
    for (long i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;
 
    return true;
}
#define max_a 100001
bool visit[max_a]={false};
vector<long> a[max_a];
long sum=0;
long cost[max_a];
void dfs(long node)
{
    visit[node]=true;
    
    for(int i=0;i<(int)a[node].size();i++)
    {
        if(visit[a[node][i]]==false)
        {
            sum+=cost[a[node][i]];
            dfs(a[node][i]);
            
        }
    }
    
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m,k;
    cin>>n>>m>>k;
    for(int x = 0; x <= m ; ++x)
        {
            int num = n * x - k;
            int den = 2 * x - m;
            if(den == 0)
            {
                if(n * x == k)
                {
                    cout<<"Yes";
                   
                    return 0;      
                }
            }
            else if(num % den == 0 && num / den >= 0 && num / den <= n)
            {
                cout<<"Yes";
                return 0;
            }
        }
       cout<<"No";
          
    
   
    return 0;
}


Measured memory_bytes: 2560
package main

import (
    "bufio"
    "fmt"
    "os"
    "strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
    sc.Scan()
    i, e := strconv.Atoi(sc.Text())
    if e != nil {
        panic(e)
    }
    return i
}

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readLine() string {
    buf := make([]byte, 0, 1000000)
    for {
        l, p, e := rdr.ReadLine()
        if e != nil {
            panic(e)
        }
        buf = append(buf, l...)
        if !p {
            break
        }
    }
    return string(buf)
}

func nextLine() string {
    sc.Scan()
    return sc.Text()
}


func main(){
	var H,A,m,res int
	fmt.Scan(&H)
	fmt.Scan(&A)
	m=H
	for m>0 {
		m-=A
		res++
	}
	fmt.Println(res)

}


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

int main() {
  
  int A, B, a1, a2, a3, a4, a5;
  int N = 0;
  
  cin >> A >> B;

  for(int i = 0;i < B; i++) {
  
    a1 = A / 10000;
    a2 = (A - a1 * 10000) / 1000;
    a3 = (A - a1 * 10000 - a2 * 1000) / 100;
    a4 = (A - a1 * 10000 - a2 * 1000 - a3 * 100) / 10;
    a5 = A % 10;
  
    if(a1 == a5 && a2 == a4) {
      N += 1;
    }
    
    A += 1;
    if(A > B) {
      break;
    }
    
  }
  
  cout << N << endl;

}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    int l,r,ans;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>l>>r;
        ans+=r-l+1;
    }
    cout<<ans<<endl;
    return 0;
}

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

vector<vector<vector<double>>> dp;
int N;

double calc(int n1, int n2, int n3){
    if(dp[n1][n2][n3] >= 0) return dp[n1][n2][n3];

    dp[n1][n2][n3] = 1.0*N;
    if(n1 > 0) dp[n1][n2][n3] += n1*calc(n1-1,n2,n3);
    if(n2 > 0) dp[n1][n2][n3] += n2*calc(n1+1,n2-1,n3);
    if(n3 > 0) dp[n1][n2][n3] += n3*calc(n1,n2+1,n3-1);

    dp[n1][n2][n3] /= (n1+n2+n3);
    return dp[n1][n2][n3];
}

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

    dp = vector<vector<vector<double>>>(N+1, vector<vector<double>>(N+1, vector<double>(N+1, -1)));
    dp[0][0][0] = 0.0;
    cout << setprecision(12) << calc(a[1],a[2],a[3]) << endl;
}


Measured memory_bytes: 217088
#include<cstdio>

const int N=500;
int m,n;
int a[N+5][N+5],f[N+5][N+5],Ans,ans[N*N+5][5];

int main()
{
	scanf("%d %d",&m,&n);
	for(int i=1;i<=m;i++)
		for(int j=1;j<=n;j++)
		{
			scanf("%d",&a[i][j]);
			if( ( f[i][j] ^= (a[i][j] & 1) )&& j != n)
			{
				f[i][j]=0;
				f[i][j+1]=1;
				ans[++Ans][1]=i,ans[Ans][2]=j,ans[Ans][3]=i,ans[Ans][4]=j+1;
			}
		}
	for(int i=1;i<m;i++)
		if(f[i][n])
		{
			f[i][n]=0;
			f[i+1][n] ^= 1;
			ans[++Ans][1]=i,ans[Ans][2]=n,ans[Ans][3]=i+1,ans[Ans][4]=n;
		}
	printf("%d\n",Ans);
	for(int i=1;i<=Ans;i++)
		printf("%d %d %d %d\n",ans[i][1],ans[i][2],ans[i][3],ans[i][4]);
	return 0;
}

Measured memory_bytes: 8832
package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
)

// github.com/EndlessCheng/codeforces-go
func run(_r io.Reader, _w io.Writer) {
	const mod = 998244353
	const mx int = 2e5
	F := [mx + 1]int{1}
	for i := 1; i <= mx; i++ {
		F[i] = F[i-1] * i % mod
	}
	pow := func(x, n int) int {
		res := 1
		for ; n > 0; n >>= 1 {
			if n&1 == 1 {
				res = res * x % mod
			}
			x = x * x % mod
		}
		return res
	}
	invF := [...]int{mx: pow(F[mx], mod-2)}
	for i := mx; i > 0; i-- {
		invF[i-1] = invF[i] * i % mod
	}
	c := func(n, k int) int { return F[n] * invF[k] % mod * invF[n-k] % mod }

	var n, m, k, ans int
	Fscan(bufio.NewReader(_r), &n, &m, &k)
	for i := 0; i <= k; i++ {
		ans = (ans + c(n-1, i)*pow(m-1, n-1-i)) % mod
	}
	Fprint(_w, ans*m%mod)
}

func main() { run(os.Stdin, os.Stdout) }


Measured memory_bytes: 5048
//Author: Fuadul Hasan(fuadul202@gmail.com)
//BSMRSTU,Gopalganj

#include<bits/stdc++.h>
using namespace std;

#define ll long long

const int N   = 2e5 + 5;

int main(){

	int a,b;
	cin>>a>>b;
	cout<<max(a*b,(max(a-b,a+b)))<<endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> bool mmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }


int main()
{
    int N;
    cin >> N;
    vector<vector<int>> C(101, vector<int>(101, -1));
    vector<vector<int>> Cu(101, vector<int>(101, 1000001000));

    REP(i, N)
    {
        int x, y, h;
        cin >> x >> y >> h;
        REP(i, 101) REP(j, 101)
        {
            const int Cij = h + abs(x - i) + abs(y - j);
            if (h == 0) mmin(Cu[i][j], Cij);
            else
            {
                mmin(Cu[i][j], Cij);
                if (C[i][j] < 0) C[i][j] = Cij;
                else
                {
                    if (C[i][j] != Cij) Cu[i][j] = -1;
                }
            }
        }
    }
    int n = 0;
    REP(i, 101) REP(j, 101)
    {
        if (Cu[i][j] >= 0 and C[i][j] <= Cu[i][j])
        {
            cout << i << " " << j << " " << C[i][j] << endl;
            n++;
        }
        if (n > 1) exit(8);
    }
}


Measured memory_bytes: 384
def getlist():
	return list(map(int, input().split()))

X, Y, Z, K = getlist()
A = getlist()
B = getlist()
C = getlist()

L = []
for i in A:
	for j in B:
		L.append(i + j)

L = sorted(L)
l = []
n = min(len(L), K)
for i in range(n):
	l.append(L[-1 - i])

ans = []
for i in l:
	for j in C:
		ans.append(i + j)

ans = sorted(ans)

for i in range(K):
	print(ans[-1 - i])

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

int main() {
  int n;
  std::cin >> n;
  int R[n];
  for (int i = 0; i < n; i++) {
    std::cin >> R[i];
  }

  int min = R[0];
  int maxValue = -(1 << 31);

  for (int j = 1; j < n; j++) {
    maxValue = maxValue > R[j] - min ? maxValue : R[j] - min;
    min = R[j] < min ? R[j] : min;
  }

  std::cout << maxValue << '\n';

  return 0;
}



Measured memory_bytes: 3840
#include <iostream>
using namespace std;
int main(void){
   int i,n,a;
   int min=1000000,max=-1000000;
   long int sum=0;
   cin >> n;
   for(i=0;i<n;i++){
       cin >> a;
       if(a<min) min=a;
       if(a>max) max=a;
       sum+=a;
   }
   cout << min <<" "<< max<<" "<< sum << endl;
}



Measured memory_bytes: 3104
/*****/

#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <iomanip>	//cout << fixed << setprecision(桁数);
#include <stdexcept>

//#define int long long

using namespace std;
using ll = long long;
using ld = long double;
using vecll = vector<long long>;
using pll = pair<long long, long long>;
template<class T> using pr = pair<T, T>;
template<class T> using vec = vector<T>;

#define debug(x) (std::cerr << (x) << "\n")
#define debug_tab(n, x) (std::cerr << strMulti("\t",n) << (x) << "\n")
#define debug_cout(x) (std::cerr << #x << " : " <<  (x) << "\n")
#define debug_tabcout(n, x) (std::cerr << strMulti("\t",n) << #x << " : " <<  (x) << "\n")
#define debug_headcout(h, x) (std::cerr << h << " : " <<  (x) << "\n")
#define debug_tabheadcout(n, h, x) (std::cerr << strMulti("\t",n) << h << " : " <<  (x) << "\n")

#define str(n)	(n.toString())

#define rep(i, n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i, n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
#define rrep(i, n) for(ll i=(n)-1; i >= 0; --i)
#define rrep1(i, n) for(ll i=(n); i > 0; --i)
#define all(x) (x).begin(), (x).end()
#define pair(a, b) make_pair(a, b)
constexpr int INF = 2000000100;
constexpr ll MOD = 1000000007;	// 10e9+7
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> T divup(T a, T b) { if (a % b == 0) { return a / b; } return a / b + 1; }
std::string strMulti(std::string t, int n) { std::string out = ""; for (int i = 0; i < n; i++) { out += t; } return out; }
template<class T> T math_P(T m, T n) { T ret = 1; for (T i = m; i > m - n; i--) { ret *= i; } return ret; }
template<class T> T math_C(T m, T n) { T ret = math_P(m, n); for (T i = 2; i <= n; i++) { ret /= i; } return ret; }
template<class T> bool compare_by_b(pair<T, T> a, pair<T, T> b) { if (a.second != b.second) { return a.second < b.second; } return a.first < b.first; }
template<class T> T mod_pow(T x, T n, const T& p) { T ret = 1; while (n > 0) { if (n & 1) { (ret *= x) %= p; } (x *= x) %= p; n >>= 1; } return ret; }

/*****/

void Main()
{
	ll N, M;
	cin >> N >> M;
	vec<pll> c(M);
	rep(i, M)	cin >> c[i].first >> c[i].second;

	sort(all(c));

	ll ret = 0;

	int backS = -1;
	rep(i, M)
	{
		if (i == 0 && c[i].first != 1)
		{
			ret += (ll)pow(10, N - 1);
		}

		if (c[i].first == 1 && c[i].second == 0 && N != 1)
		{
			ret = -1;
			break;
		}

		if (backS == c[i].first)
		{
			if (c[i - 1].second != c[i].second)
			{
				ret = -1;
				break;
			}
			else
			{
				continue;
			}
		}

		ret += (ll)pow(10, N - c[i].first) * c[i].second;
		debug_cout((ll)pow(10, N - c[i].first) * c[i].second);

		backS = c[i].first;
	}

	if (ret == 0 && N != 1)
	{
		ret += (ll)pow(10, N - 1);
	}

	cout << ret;
}

/*****/

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

	//std::cout << std::fixed << std::setprecision(10);

	/*
	while (true)
	{
		Main();
		cout << endl;
	}
	//*/

	Main();
	cout << endl;

	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin>>n;
	vs s(n);
	cin>>s;
	rep(i,n){
		sort(all(s[i]));
	}
	sort(all(s));
	s.push_back("");
	ll ans=0,cnt=0; string v="";
	rep(i,n+1){
		if(v==s[i])cnt++;
		else{
			ans+=(cnt*(cnt-1)/2);
			cnt=1;
		}
		v=s[i];
	}
	puta(ans);
	return 0;
}

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

using namespace std;

int main(int argc, char *argv[])
{

  int A, B, C, X, ans, tmp, tmp2, tmp3;
  cin >> A >> B >> C >> X;

  for (int i = 0; i <= A; i++) {
    tmp = 500 * i;
    for (int j = 0; j <= B; j++) {
      tmp2 = tmp + 100 * j;
      for (int l = 0; l <= C; l++) {
        if ((tmp2 + 50 * l) == X) ans++;
      }
    }
  }

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


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

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

int main(){
  int A,B;
  cin>>A>>B;
  cout<<max({A+A-1,A+B,B+B-1})<<endl;


  return 0;
}
  


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

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

const ll inf = 1e16;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	int n, m;
	cin>>n>>m;
	vector<int> a(m), b(m), c(m);
	for(int i = 0; i < m; i++){
		cin>>a[i]>>b[i]>>c[i];
	}
	vector<ll> dist(n + 1, inf);
	dist[1] = 0;
	for(int i = 1; i < n; i++){
		for(int j = 0; j < m; j++){
			if(dist[a[j]] - c[j] < dist[b[j]]){
				dist[b[j]] = dist[a[j]] - c[j];
			}
		}
	}
	ll ans = dist[n];
	for(int j = 0; j < m; j++){
		if(dist[a[j]] - c[j] < dist[b[j]]){
			dist[b[j]] = dist[a[j]] - c[j];
		}
	}
	if(ans != dist[n]){
		cout<<"inf\n";
	}else{
		cout<<-ans<<'\n';
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#define rep(i,n) for (long long i=0; i < (n); ++i)
#define rep2(i,n,m) for(long long i=n;i<=m;i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
int main(){
int n ;
cin >>  n;
int ans= 0;
for(int i=1;i<=n;i+=2){
int yaku = 0;

rep2(j,1,i){
 if(i%j==0) yaku ++ ; 

}
if(yaku==8)
ans++ ;
}
cout <<ans <<endl ;
     return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("O999")
//#define long long ll
const int INF=0x3f3f3f3f;
const int maxn=50000005;
using namespace std;

int main(){
	//freopen(".in", "r",stdin );
	//freopen(".out","w",stdout);
	ios::sync_with_stdio(0);
	int n;
	cin >> n;
	int a[n+1], sum=0;
	for(int i=1; i<=n; i++)cin >> a[i];
	for(int i=1; i<n; i++)
		for(int j=i+1; j<=n; j++)
			sum+=a[i]*a[j];
	cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <stack>
#include <string>
#include <iostream>
#define ll long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main() {
    fastio
    ll t;
    cin>>t;
    string str="ACL",s="";
    while(t--)
    {
        s=s+str;
    }
    cout<<s<<"\n";
	// your code goes here
	return 0;
}


Measured memory_bytes: 3568
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,k;
  cin>>n>>k;
  int arr[n]; int sum = 0;
  for(int i =0;i<n;i++)
     cin>>arr[i];
  sort(arr,arr+n);
  for(int i =0;i<k;i++)
    sum += arr[i];
  cout<<sum;
  return 0;
}

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

#ifdef LOCAL
#include "prabh.hpp"
#endif

#define int long long
#define pb push_back
#define range(v) v.begin(),v.end()
#define rrange(v) v.rbegin(), v.rend()
#define mod (int)(1e9 + 7)
#define inf (int)(5e18)
#define N (int)(2e5 + 10)

using namespace std;

void solve() {
	int n; cin >> n;
	vector<int> a(n);
	for (int &i : a) cin >> i;
	vector<int> pref(n + 1);
	for (int i = 1; i <= n; i++)
		pref[i] = pref[i - 1] + a[i - 1];

	vector<vector<int>> dp(n + 1, vector<int>(n + 1));
	for (int l = n; l >= 1; l--) {
		for (int r = l; r <= n; r++) {
			if (l == r) dp[l][r] = 0;
			else {
				int &ans = dp[l][r];
				ans = inf;
				for (int i = l; i < r; i++)
					ans = min(ans, dp[l][i] + dp[i + 1][r] + pref[r] - pref[l - 1]);
			}
		}
	}

	cout << dp[1][n] << endl;
}
// Remember to clear the global containers



// Got stuck and want to leave ? look at the bottom once..
int32_t main() {
	ios_base::sync_with_stdio(false), cin.tie(nullptr), cin.tie(nullptr);
	int t_c = 1;
	// cin >> t_c;
	while (t_c--)
		solve();
}
/* Come on Dude .. Dont get up until u get the solution
 * Giving up not gonna help ryt ? So get ur lazy ass to code already
 * You can do it ... Stay Calm and Dont Panic :)
 */


Measured memory_bytes: 4500
import sys
n = int(input())
ab = [list(map(int, input().split())) for i in range(n)]

ab.sort(key=lambda x: x[1])
now = 0 #現在時刻
for i in range(n):
    now = now + ab[i][0]
    if now > ab[i][1]:
        print('No')
        sys.exit()

print('Yes')


Measured memory_bytes: 53600
N = int(input())
lst = []
for i in range(N-1):
    lst += [list(map(int, input().split()))]

# print (lst)
for i in range(N):
    t = 0
    for j in range(i, N-1):
        # print ('j', j)
        t = (max(lst[j][1], t)+lst[j][2] -1)//lst[j][2]*lst[j][2] + lst[j][0]
        # print ('t', t)
    print (t)

Measured memory_bytes: 3188
// 2020-07-30 08:41:10
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
using P = pair<int, int>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }
const int mod = 1000000007;
struct mint {
  ll val;
  constexpr mint(ll v = 0) noexcept : val(v % mod) {
    if (val < 0) val += mod;
  }
  constexpr mint operator + (const mint& rhs) const noexcept {
    return mint(*this) += rhs;
  }
  constexpr mint operator - (const mint& rhs) const noexcept {
    return mint(*this) -= rhs;
  }
  constexpr mint operator * (const mint& rhs) const noexcept {
    return mint(*this) *= rhs;
  }
  constexpr mint operator / (const mint& rhs) const noexcept {
    return mint(*this) /= rhs;
  }
  constexpr mint operator ~ () const noexcept {
    ll a = this->val, b = mod, u = 1, v = 0;
    while (b > 0) {
      ll t = a / b;
      a -= t * b;
      u -= t * v;
      ll c = a; a = b; b = c;
      ll w = u; u = v; v = w;
    }
    if (u < 0) u += mod;
    u %= mod;
    return u;
  }
  constexpr mint& operator += (const mint& rhs) noexcept {
    val += rhs.val;
    if (val >= mod) val -= mod;
    return *this;
  }
  constexpr mint& operator -= (const mint& rhs) noexcept {
    if (val < rhs.val) val += mod;
    val -= rhs.val;
    return *this;
  }
  constexpr mint& operator *= (const mint& rhs) noexcept {
    val = val * rhs.val % mod;
    return *this;
  }
  constexpr mint& operator /= (const mint& rhs) noexcept {
    val = val * (~(mint(rhs))).val % mod;
    return *this;
  }
  friend mint modpow (mint a, ll n) noexcept {
    auto res = mint(1);
    while(n > 0) {
      if(n&1) res *= a;
      a *= a;
      n >>= 1;
    }
    return res;
  }
  friend std::ostream& operator << (std::ostream& os, const mint& a) noexcept {
    return os << a.val;
  }
  friend std::string debug_s (mint a) noexcept {
    return std::to_string(a.val);
  }
};

void answer() {
  int n;
  cin >> n;
  vector<int> c(n);
  rep(i, n) cin >> c[i];
  sort(ALL(c));
  vector<mint> pow2(n+1);
  pow2[0] = 1;
  REPC(i, 1, n) pow2[i] = pow2[i-1] * 2;
  mint ans = 0;
  rep(i, n) {
    int r = n-i-1;
    mint cur = 0;
    cur += pow2[r];
    if(r>0) cur += pow2[r-1] * r;
    cur *= pow2[i] * c[i];
    ans += cur;
  }
  ans *= pow2[n];
  cout << ans << '\n';
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 5548
package main
 
import (
  "fmt"
)
 
func main() {
  var n int
  fmt.Scanf("%d", &n)
  
  if n == 2 {
    var a, b int
    fmt.Scanf("%d", &a)
    fmt.Scanf("%d", &b)

    fmt.Printf("%d\n", a + b)
  } else {
    fmt.Printf("Hello World\n")
  }
}

Measured memory_bytes: 1832
n,m=map(int,input().split())
l=[0]*(n+1)
ku=[]
for _ in range(m):
    ku.append(tuple(map(int,input().split())))
for x in ku:
    a,b=x
    l[a]=(l[a]+1)%2
    l[b]=(l[b]+1)%2
print("NO" if 1 in l else "YES")

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

int main(){
    int m;
    int64_t c[200000];
    int d[200000];
    int q;

    int nx[10] = {0,2,4,6,8,1,3,5,7,9};

    cin >> m;
    for(int i=0;i<m;++i) cin >> d[i] >> c[i];

    int64_t ans = 0;
    q = -1;
    for(int i=0;i<m;++i){
        while(c[i] > 1){
            if(c[i]%2 == 1){
                if(q < 0) q = d[i];
                else{
                    ++ans;
                    q += d[i];
                    if(q > 9){
                        ++ans;
                        q = q/10 + q%10;
                    }
                }
            }
            if(d[i] < 5) ans += c[i]/2;
            else ans += c[i]/2*2;
            d[i] = nx[d[i]];
            c[i] /= 2;
        }
        if(q < 0) q = d[i];
        else{
            ++ans;
            q += d[i];
            if(q > 9){
                ++ans;
                q = q/10 + q%10;
            }
        }
    }

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

Measured memory_bytes: 2560
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product, combinations_with_replacement
import sys
import bisect
import string
import math
import time

def I(): return int(input())
def S(): return input()
def MI(): return map(int, input().split())
def MS(): return map(str, input().split())
def LI(): return [int(i) for i in input().split()]
def LI_(): return [int(i)-1 for i in input().split()]
def StoI(): return [ord(i)-97 for i in input()]
def ItoS(nn): return chr(nn+97)
def input(): return sys.stdin.readline().rstrip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]


yn = ['Yes', 'No']
YN = ['YES', 'NO']
MOD = 10**9+7
inf = float('inf')
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)


show_flg = False
# show_flg = True


def main():
    N, K = MI()
    # arr = [[0] * N for i in range(N)]

    if K == 0:
        print(N * N)
        return

    # for b in range(1, N+1):
    #     for a in range(1, N+1):
    #         arr[b-1][a-1] = a % b

    ans = 0
    for b in range(N):
        if K <= (b + 1) - 1:
            # print(b+1, arr[b])
            loop = N // (b+1)
            r = N % (b+1)
            ans += loop * ((b+1) - K)
            ans += max(0, r - K + 1)
            # print(ans, loop * ((b+1) - K), r - K + 1)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 39532
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;

int main(){
    vector<int> a(3);
    for(int i=0;i<3;i++)cin>>a[i];
    sort(a.begin(),a.end(),greater<int>());
    cout<<(a[0]*10+a[1])+a[2]<<endl;

    return 0;
}

Measured memory_bytes: 256
/*
 * Aizu Online Judge
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 *
 * @author yoshkur
 */
public class Main {

	/**
	 * @param args the command line arguments
	 */
	public static void main(String[] args) {
		try {
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			InputData inputData = new InputData(br);
			Processing processing = new Processing(inputData);
			System.out.println(processing.getResult());

		} catch (IOException | NumberFormatException e) {
			System.err.println(e.getLocalizedMessage());
		}
	}
}

class InputData {

	private List<Integer> numberList = new ArrayList<>();

	public InputData(BufferedReader br) throws IOException {
		String line;
		while((line = br.readLine()) != null) {
			this.numberList.add(Integer.valueOf(line.trim()));
		}
	}

	public List<Integer> getNumberList() {
		return numberList;
	}

	public void setNumberList(List<Integer> numberList) {
		this.numberList = numberList;
	}

}

class Processing {
	private static final String RETCODE = System.getProperty("line.separator");

	private InputData inputData;

	public Processing(InputData inputData) {
		this.inputData = inputData;
	}

	public String getResult() {
		String result = null;
		StringBuilder sb = new StringBuilder();
		for (int i = 0;
				i < this.inputData.getNumberList().size() 
				&& this.inputData.getNumberList().get(i) != 0;
				i++) {
			sb.append("Case ");
			sb.append(i + 1);
			sb.append(": ");
			sb.append(this.inputData.getNumberList().get(i));
			sb.append(RETCODE);
		}
		result = sb.toString().trim();
		return result;
	}
}

Measured memory_bytes: 31196
#include <stdio.h>

int main() {
  char input[5];
  scanf("%s", input);
  if (input[0] == input[1]) {
    printf("Bad\n");
    return 0;
  }
  if (input[1] == input[2]) {
    printf("Bad\n");
    return 0;
  }
  if (input[2] == input[3]) {
    printf("Bad\n");
    return 0;
  }
  if (input[3] == input[4]) {
    printf("Bad\n");
    return 0;
  }
  printf("Good\n");
  return 0;
}


Measured memory_bytes: 128
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
dif = []
for i in range(N):
    dif.append((i+1)-A[i])
#dif.sort()
counter = Counter(dif)

ans = 0
for i in range(N):
    ans += counter[(i+1)+A[i]]

print(ans)

Measured memory_bytes: 42784
#include <iostream>
#include <cstdio>
#include <bitset>
#include <algorithm>
#include <vector>
#include <ctype.h>
const int bufSize = 1e6;
using namespace std;
inline char nc()
{
    #ifdef DEBUG
    return getchar();
    #endif
    static char buf[bufSize], *p1 = buf, *p2 = buf;
    return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, bufSize, stdin), p1 == p2) ? EOF : *p1++;
}
inline void read(char *s)
{
    static char c;
    for (; !isalpha(c); c = nc());
    for (; isalpha(c); c = nc()) *s++ = c;
    *s = '\0';
}
template<typename T>
inline T read(T &r)
{
    static char c;
    static int flag;
    flag = 1, r = 0;
    for (c = nc(); !isdigit(c); c = nc()) if (c == '-') flag = -1;
    for (; isdigit(c); c = nc()) r = r * 10 + c - 48;
    return r *= flag;
}
const int maxn = 3e5 + 100;
int n,m,k;
int row[maxn],col[maxn];
struct node
{
    int x,y;
}A[maxn];
bool cmp(const node &a,const node &b)
{
    if(a.x != b.x) return a.x < b.x;
    return a.y < b.y;
}
bool vis[maxn];
bitset<maxn> bs;
vector<int> v[maxn];
int main()
{
    read(n),read(m),read(k);
    for (int i = 1; i <= k; ++i) read(A[i].x), read(A[i].y), row[A[i].x]++, col[A[i].y]++,v[A[i].x].push_back(A[i].y);
    int maxx = 0,maxy = 0;
    for (int i = 1; i <= n; ++i) maxx = std::max(maxx,row[i]);
    for (int i = 1; i <= m; ++i) maxy = std::max(maxy,col[i]);
    for(int i = 1;i<=m;++i) if(col[i] == maxy) bs.set(i);
//    cout<<bs<<endl;
    int ans = maxx + maxy - 1;
    for (int i = 1; i <= n; ++i)
        if (row[i] == maxx)
        {
            bitset<maxn> ts;
            for(vector<int>::iterator it = v[i].begin();it!=v[i].end();++it) ts.set(*it);
            ts.flip();
            if((ts & bs).any())
            {
                ans = maxx + maxy;
                break;
            }
        }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 25280
#include <bits/stdc++.h>
#define INF 1000000000
#define LINF 1000000000000000000
#define MOD 1000000007
#define mod 998244353
#define INF63 1061109567
#define INF127 9187201950435737471
#define UINF 18446744073709551615
#define F first
#define S second
#define ll long long
using namespace std;
string s;
int main(){
	cin>>s;
	if(s=="SSS")
	{
		puts("0");
	}
	else if(s=="SRS"||s=="SSR"||s=="RSS"||s=="RSR")
	{
		puts("1");
	}
	else if(s=="SRR"||s=="RRS")
	{
		puts("2");
	}
	else
	{
		puts("3");
	}
	return 0;
}

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

int main()
{
	int n;
	vector<int> a;

	cin >> n;
	int t;

	for (int i = 0; i < n; i++){
		cin >> t;
		a.push_back(t);
	}

	int cnt = 0;

	int temp;

	if(a[0]==1){

		temp = a[0];
		a[0] = a[1];
		a[1] = temp;
		cnt++;
	}

	for (int i = 1; i < n-1; i++){
		if((i+1)==a[i]){
			if((i+1)!=a[i+1]){
				temp = a[i];
				a[i] = a[i+1];
				a[i+1] = temp;
				cnt++;
			}else if((i+1)!=a[i-1]){

				temp = a[i];
				a[i] = a[i - 1];
				a[i - 1] = temp;
				cnt++;
			}
			else
			{
				cout << "error" << endl;
			}
		}
	}

	if (a[n - 1] == n){

		temp = a[n-1];
		a[n-1] = a[n- 2];
		a[n-2] = temp;
		cnt++;
	}

	cout << cnt << endl;
}

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

#define endl '\n'

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

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

Measured memory_bytes: 3652