akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  string s;
  cin >> s;
  REP(i, int(s.size()))
  {

    if ((i + 1) % 2 == 1 && s[i] == 'L')
    {
      cout << "No" << endl;
      return 0;
    }
    else if ((i + 1) % 2 == 0 && s[i] == 'R')
    {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define sc scanf
#define pr printf
#define pb push_back
#define ll long long int
int main()
{
   ll a,b;
   cin>>a>>b;
   if(b%a)
    cout<<b-a<<endl;
   else
    cout<<b+a<<endl;
    return 0;
}


Measured memory_bytes: 256
p = int(input())
data = list(map(int,input().split()))
al = data[1]
for i in range(p):
  k = int(input())
  if k < data[0] +1:
    al += ((data[0] - 1)// k + 1)
  else:
    al += 1
  k = 0
print(al)

Measured memory_bytes: 3060
s = input()
t = input()
S = len(s)
T = len(t)
dp = [[0 for i in range(T+1)] for j in range(S+1)]

for i in range(S):
    for j in range(T):
        if s[i] == t[j]:
            dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + 1)
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j])
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j+1])

ans = ""
while S > 0 and T > 0:
    if dp[S][T] == dp[S-1][T]:
        S -= 1
    elif dp[S][T] == dp[S][T-1]:
        T -= 1
    else:
        ans = s[S-1] + ans
        S -= 1
        T -= 1

print(ans)

Measured memory_bytes: 121308
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>

using namespace std;
using lli = long long int;
// #define DEBUG
#ifdef DEBUG
#define debug(var) cout << (#var) << ": " << (var) << endl;
template<class T> void dump_array_impl(const T& a) {
  bool first = true;
  for (auto&& x : a) {
    if (!first) { cout << ", "; first = false; }
    cout << x;
  }
}
#define debug_array(a) cout<<(#a)<<": ";dump_array_impl(a);cout<<endl
#else
#define debug(var) {}
#define debug_array(a) {}
#endif
template<class T> void read_n(vector<T>& v, size_t n) {
  v = vector<T>(n);
  for (lli i=0; i<n; ++i) cin >> v[i];
}

int main() {
  lli v[3];
  cin >> v[0] >> v[1] >> v[2];
  sort(begin(v), end(v));
  cout << v[2]*10+v[1]+v[0] << endl;
  return 0;
}


Measured memory_bytes: 256
def main():
    n,k = map(int,input().split())
    h = list(map(int, input().split()))

    # 無限大の値
    INF = 10**10

    # DP テーブル
    # DP テーブル全体を初期化 (最小化問題なので INF に初期化)
    dp = [INF] * n

    # 初期条件
    dp[0] = 0
    dp[1] = abs(h[0] - h[1])

    # ループ
    for i in range(2,n):
        # ...
        # for j in range(1,min(k,i)+1):
        #     hk = dp[i-j] + abs(h[i-j] - h[i])
        #     dp[i] = min(hk,dp[i])
        dp[i] = min(dp[i-j] + abs(h[i-j] - h[i]) for j in range(1,min(k,i)+1))

    # 解を得て出力
    print(dp[n-1])

if __name__ == "__main__":
    main()

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

using namespace std;

int64_t solve(const std::vector<int>& ss) {
  int const n = ss.size();
  if (n == 1) {
    return ss.front();
  }
  int const iMax = 1 << (n - 1);
  int64_t ret = 0;
  for (int i = 0; i < iMax; ++i) {
    int64_t value = 0;
    int64_t digit = 0;
    for (int j = 0; j < n; ++j) {
      digit = digit * 10 + ss[j];
      if (i & (1 << j)) {
        continue;
      }
      value += digit;
      digit = 0;
    }
    ret += value;
  }
  return ret;
}

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  std::string s;
  std::cin >> s;
  std::vector<int> ss;
  ss.reserve(s.size());
  for (auto ch : s) {
    ss.push_back(ch - '0');
  }
  std::cout << solve(ss) << std::endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{ 
        public static void main(String[] args){
            int i=0,j,k,count=0;
            int a[];
            int b[];
            int c[];
            a = new int[100000];
            b = new int[100000];
            c = new int[100000];
                Scanner n = new Scanner(System.in);
                while(true){
                     a[i] = n.nextInt();
                     b[i] = n.nextInt();
                     c[i] = n.nextInt();
                     if(a[i]==-1 && b[i]==-1 && c[i]==-1){
                         break;
                     }
                     count++;
                     i++;
                }
                i=0;
                while(count>i){
                    int d = a[i]+b[i];
                        if(a[i]==-1 || b[i]==-1){
                            System.out.printf("F");
                        }else if(d>=80){
                            System.out.printf("A");
                        }else if(d>=65 && d<80){
                            System.out.printf("B");
                        }else if(d>=50 && d<65){
                            System.out.printf("C");
                        }else if(d>=30 && d<50){
                            if(c[i]>=50){
                                System.out.printf("C");
                            }else{
                            System.out.printf("D");
                            }
                        }else if(d<30){
                            System.out.printf("F");
                        }
                     i++;
                     System.out.printf("\n");
                }
        }
    }


Measured memory_bytes: 27416
#include <bits/stdc++.h>
#include <map>
#include <algorithm>
#include <vector>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <chrono>
#include <thread>
#include <string.h>
 
#define rep(i,n)    for(ll i=0;i<n;i++)
#define repu(i,k,n) for(ll i=k;i<=n;i++)
#define repd(i,k,n) for(ll i=k;i>=n;i--)
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define endl "\n"
#define INF (ll)ll_MAX
 
typedef long long ll;
typedef long double ld;
typedef std::pair<ll, ll> pii;
typedef std::vector< ll > vi;
typedef std::vector< pii > vii;
typedef std::vector< ll > vll;
typedef std::vector< std::pair < pii, ll > > vpp;
 
const ll N = 3*1e5 +5 ;
const long long MOD = 1000000007;
const long long MOD2 = 998244353;
const long long inf = 1e18;
 
using namespace std;

// ll g[200000], ig[200000];



bool ok;

void dfs1(ll u, bool vis[], ll tot[], ll p[],ll h[], vll v[]){
    if(vis[u]==1) return;
    vis[u] = 1;

    ll sum = 0;

    sum += p[u];

    ll sorr = 0;

    for(ll i=1;i<v[u].size();i++){
        // cout<<'a';
        dfs1(v[u][i],vis,tot,p,h,v);
        sum+= tot[v[u][i]];
        sorr = sorr +  tot[v[u][i]] - h[v[u][i]];
    }

    // cout<<sum;

    tot[u] = sum;

    // if(tot[u]-h[u]>sorr){
    //     cout<<tot[u]-h[u]<<' '<<sorr<<'\n';
    //     ok = false;
    //     // cout<<"NOOOOO";
    // }

    return;

}

void dfs2(ll u, bool vis[], ll tot[], ll p[],ll h[], vll v[]){
    if(vis[u]==1) return;
    vis[u] = 1;

    // ll sum = 0;

    // sum += p[u];

    ll sorr = 0;

    for(ll i=1;i<v[u].size();i++){
        // cout<<'a';
        dfs2(v[u][i],vis,tot,p,h,v);
        // sum+= tot[v[u][i]];
        sorr = sorr +  tot[v[u][i]] - h[v[u][i]];
    }

    // cout<<sum;

    // tot[u] = sum;

    // cout<<sorr<<endl;

    if(tot[u]-h[u]>sorr + 2*p[u]){
        // cout<<u<<' '<<tot[u]-h[u]<<' '<<sorr<<'\n';
        ok = false;
        // cout<<"NOOOOO";
    }

    if((tot[u]-h[u])%2==1){
        ok = false;
    }

    if(h[u]>(tot[u]) or h[u]<(-tot[u])){
        ok = false;
    }

    return;

}





void solve()
{	
   
    int n;
    string a;
    cin>>n;
    cin>>a;
    int ctr = 0;

    int left = 0,right = n-1;

    while(left<right){
        if(a[left]=='R'){
            left++;
            continue;
        }
        if(a[right]=='W'){
            right--;
            continue;
        }
        swap(a[left],a[right]);
        ctr++;
        left++;
        right--;
    }

    cout<<ctr;



}

int main() {


    // #ifndef ONLINE_JUDGE
    //     // for getting input from input.txt
    //     freopen("input.txt", "r", stdin);
    //     // for writing output to output.txt
    //     freopen("output.txt", "w", stdout);
    // #endif


    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    ll t = 1;
    // cin>>t;
    ll ctr=0;
    while(t--)
    {   
        ctr++;
        // cout<<"Case #"<<ctr<<": ";
        solve();    
    } 
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
 
}

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

using namespace std;

int main() {
  int h,w,k;
  cin >> h >> w >> k;
  vector<string> s(h);

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

  int ans = 0;
  for(int is = 0; is < 1<<h; is++){
    for(int js = 0; js < 1<<w; js++){
      int cnt = 0;
      
      for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
          if(is>>i&1)  continue;
          if(js>>j&1)  continue;
          if(s[i][j] == '#')  cnt++;
        }
      }
      if(cnt == k) ans++;
    }
  }

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

Measured memory_bytes: 3604
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) {
		new BinSearchTree1().run();
	}
}

class BinSearchTree1 {

	Node root;

	public void run() {

		root = null;

		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

			int m = Integer.parseInt(br.readLine());
			for (int i = 0; i < m; i++) {

				String line = br.readLine();

				if(line.charAt(0) == 'i') {

					int val = Integer.parseInt(line.substring(7));
					insert(val);

				} else if (line.charAt(0) == 'f') {
					int val = Integer.parseInt(line.substring(5));
					Node result = find(val);
					if (result != null) {
						System.out.println("yes");
					} else {
						System.out.println("no");
					}

				} else if (line.charAt(0) == 'd') {

					int val = Integer.parseInt(line.substring(7));
					delete(val);

				} else {
					print();
				}

			}

		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	private void delete(int val) {
		Node tgt = find(val);

		if (tgt == null) return;

		Node del;
		if ( tgt.left == null || tgt.right == null) {
			del = tgt;
		} else {
			del = getSuccessor(tgt);
		}

		// del??????x????±???????
		Node x;
		if ( del.left != null) {
			x = del.left;
		} else {
			x = del.right;
		}

		if ( x != null ) {
			x.parent = del.parent;
		}

		if (del.parent == null) {
			root = x;		// del ???????????¨??????x????????¨??????
		} else if ( del == del.parent.left ) {
			del.parent.left = x;
		} else {
			del.parent.right = x;
		}

		if ( del != tgt ) {
			tgt.key = del.key;
		}

	}

	private Node getSuccessor(Node tgt) {
		if (tgt.right != null) {
			return getMinimun(tgt.right);
		}

		Node y = tgt.parent;
		while (y != null && tgt == y.right) {
			tgt = y;
			y = tgt.parent;
		}

		return y;
	}

	private Node getMinimun(Node tgt) {
		while (tgt.left != null) {
			tgt = tgt.left;
		}
		return tgt;
	}

	private Node find(int tgt) {

		Node now = root;

		while ( now != null ) {
			if (now.key == tgt) {

				break;

			} else {
				if (tgt < now.key) {
					now = now.left;
				} else {
					now = now.right;
				}
			}
		}

		return now;

	}

	private void insert(int val) {

		Node y = null;
		Node x = root;

		Node z = new Node();
		z.key = val;
		z.left = null;
		z.right = null;

		while (x != null) {
			y = x;
			if (val < x.key) {
				x = x.left;
			} else {
				x = x.right;
			}
		}
		z.parent = y;

		if (y == null) {
			root = z;
		} else {
			if (val < y.key) {
				y.left = z;
			} else {
				y.right = z;
			}
		}
	}

	private void print() {

		pByInOrder(root);
		System.out.println();
		pByPreOrder(root);
		System.out.println();

	}

	private void pByInOrder(Node node) {

		if(node == null) return;

		pByInOrder(node.left);
		System.out.print(" " + node.key);
		pByInOrder(node.right);

	}

	private void pByPreOrder(Node node) {

		if(node == null) return;

		System.out.print(" " + node.key);
		pByPreOrder(node.left);
		pByPreOrder(node.right);

	}

}

class Node {

	int key;
	Node left, right, parent;

}

Measured memory_bytes: 125312
package main

import "fmt"

func main() {
	var n int
	var s string
	fmt.Scan(&n, &s)
	m := make(map[byte]int)
	for i := 0; i < n; i++ {
		m[s[i]]++
	}

	ans := 1
	for _, v := range m {
		ans = ans * (v + 1) % (1e9 + 7)
	}
	fmt.Println(ans - 1)
}


Measured memory_bytes: 1280
n = int(input())
csf = [list(map(int, input().split())) for _ in range(n-1)]
for i in range(n):
    res = 0
    for j in range(i, n-1):
        if res < csf[j][1]:
            res += abs(csf[j][1] - res)
            res += csf[j][0]
        else:
            if (res - csf[j][1]) % csf[j][2] != 0:
                res += csf[j][2] - ((res - csf[j][1]) % csf[j][2])
            res += csf[j][0]
    print(res)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define ARRAY_LENGTH(array) sizeof(array)/sizeof(*array)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main() {
    ll N;
    cin >> N;

    if(N == 1) {
        cout << 0 << endl;
    } else if(N == 0) {
        cout << 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
int main()
{
   long long int A,B,K,D=0,j;
  scanf("%lld%lld%lld",&A,&B,&K);
  for(long long int i=A;D!=K;i--)
  {
    if(A%i==0 && B%i==0) D++;
    j=i;
  }
  printf("%lld",j);
  return 0;
}


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

int n;

int lcs(char x[],char y[]){
  int i,j,a[N][N];
  int m=strlen(x);
  int n=strlen(y);

  for(i=1;i<=m;i++) a[i][0]=0;
  for(j=0;j<=n;j++) a[0][j]=0;
  for(i=1;i<=m;i++){
    for(j=1;j<=n;j++){
      if(x[i-1]==y[j-1]) a[i][j]=a[i-1][j-1]+1;
      else if(a[i-1][j]>=a[i][j-1]) a[i][j]=a[i-1][j];
      else a[i][j]=a[i][j-1];
    }
  }
  return a[m][n];
}

int main(){
  int i,A[N];
  char x[N],y[N];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%s",&x);
    scanf("%s",&y);
    A[i]=lcs(x,y);
  }
  for(i=0;i<n;i++) printf("%d\n",A[i]);

  return 0;
}

Measured memory_bytes: 4528
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;

#define MAX_N 1000000000

int next0index(int index,int *numArray,int n){
	for(int i = index; i < n;i++){
		if(numArray[i] == 0){
			return i;
		}
	}
	return n;
}

void cut1height(int left,int right,int *numArray){
	for(int i = left; i <= right; i++){
		numArray[i]--;
	}
}

bool areTheseAllFlat(int n,int *numArray){
	for(int i = 0; i < n; i++){
		if(numArray[i] != 0){
			return false;
		}
	}
	return true;
}

int startZeroIndex(int n, int *numArray){
	for(int i = 0; i < n-1;i++){
		if(numArray[i] == 0 && numArray[i+1] != 0){
			return i;
		}
	}
	return n;
}

int main()
{
	int n;
	cin>>n;
	int *h = new int[n];
	for(int i = 0; i < n; i++){
		cin>>h[i];
	}
	int count = 0;
	while( areTheseAllFlat(n,h)==false){
		int left,right;
		if( h[0] != 0){
			left = 0;
		}else{
			left = startZeroIndex(n,h)+1;
		}
		right = next0index(left+1,h,n)-1;
		cut1height(left,right,h);
		/*for(int i = 0 ; i < n; i ++){
			cout<<h[i]<<" ";
		}
		cout<<endl;*/
		count++;
	}
	cout<<count<<endl;
	return 0;
}



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

int main(void) {
    int N, a, b;

    cin >> N;

    if (N == 1) 
        cout << "Hello World" << endl;
    else if (N == 2) {
        cin >> a >> b;
        cout << a + b << endl;
    }
    return 0;
}

Measured memory_bytes: 256
S=input()
S=S[::-1]
divide=['dream','dreamer','erase','eraser'] 
flag=False
for i in range(4):
  divide[i]=divide[i][::-1]

i=0
while i!=len(S):
  flag=False
  for d in divide:
    if S[i:i+len(d)]==d:   
      flag=True
      i+=len(d)
      break
    
  if flag==False:
     break
      
print('YES' if flag else 'NO')

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long long i=0; i<(long long)(n); i++)
#define REP(i, k, n) for(long long i=(long long)(k); i<(long long)(n); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define PQ(T) priority_queue<T>
#define PQS(T) priority_queue<T, vector<T>, greater<T> >
#define deci cout << fixed << setprecision(15);
typedef long long ll;
const ll inf = 1020304050607080910;
const int INF = 1073741823;
const ll mod = 1000000007;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
template<class T> bool chmin(T&x,T y){if(x>y){x=y;return true;}return false;}
template<class T> bool chmax(T&x,T y){if(x<y){x=y;return true;}return false;}
ll gcd(ll x,ll y){if(x>y)swap(x, y);while(x!=0){y%=x;swap(x, y);}return y;}
ll mpow(ll x,ll r){if(r==0)return 1;if(r%2==1){return x*mpow(x,r-1)%mod;}else{ll aa=mpow(x,r/2);return aa*aa%mod;}}

int main(){
	ll N; cin >> N;
	ll s = 0, p = 0;
	for(ll i=1; i<=N; i++){
		s += ((i + (N/i)*i)*(ll)(N/i))/2;
	}
	cout << s << endl;
	return 0;
}


Measured memory_bytes: 3628
#include<iostream>
#include<algorithm>
#include<cassert>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)

int m[500][500];
int dp[500][500];

int dx[]={-1,0,1};

int solve(int r,int c){
  rep(i,r+2)rep(j,c)dp[i][j]=0;
  rep(j,c)if(m[0][j] == 0)dp[0][j]=1;

  rep(i,r-1){
    rep(j,c){
      if (m[i][j] == 0 ){
	rep(k,3){
	  int nex = j+dx[k];
	  if (nex<0||nex>=c)continue;
	  if (m[i+1][nex] == 0)dp[i+1][nex]+=dp[i][j];
	  else if (m[i+1][nex] == 2 && k == 1)dp[i+1][nex]+=dp[i][j];
	}
      }else if (m[i][j] == 2 && m[i+2][j] != 1){
	dp[i+2][j]+=dp[i][j];
      }
    }
  }
  
  int ans = 0;
  rep(j,c)ans+=dp[r][j]+dp[r-1][j];
  return ans;
}

main(){
  int c,r;
  while(cin>>c>>r && r){
    rep(i,r)rep(j,c)cin>>m[i][j];
    rep(j,c)m[r][j]=0;
    cout << solve(r,c) << endl;
  }
}

Measured memory_bytes: 0
n = int(input())
S = []

for i in range(n):
    a, b = input().split()
    S.append([a, -int(b), i + 1])

#ソートの時に０番目を基準にソートし，次に１番目を基準にソートする
S.sort()

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


Measured memory_bytes: 3060
<?php
$games = str_split(trim(fgets(STDIN)));
$count = 15 - count($games);
$win = 0;
foreach($games as $game){
	if($game=="o"){
		$win += 1;
	}
}
$answer = $count + $win >= 8 ? "YES" : "NO";
echo $answer . "\n";
?>

Measured memory_bytes: 3700
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Int32;

class Program
{
    static void Main(string[] args)
    {
        label:
        int n = Parse(ReadLine());
        var ruiseki = new long[n];
        var sp = ReadLine().Split();
        long tmp = 0;
        for (int i = 0; i < sp.Length; ++i)
        {
            tmp += long.Parse(sp[i]);
            ruiseki[i] = tmp;
        }
        int left = 0;
        var splits = new long[n - 2, 4];
        for (int naka = 1; naka < n - 2; ++naka)
        {
            long diff = Math.Abs(ruiseki[naka] - ruiseki[left] * 2);
            for (int newLeft = left + 1; newLeft < naka; ++newLeft)
            {
                tmp = Math.Abs(ruiseki[naka] - ruiseki[newLeft] * 2);
                if (tmp < diff)
                {
                    left = newLeft;
                    diff = tmp;
                }
                else
                {
                    break;
                }
            }
            splits[naka - 1, 0] = ruiseki[left];
            splits[naka - 1, 1] = ruiseki[naka] - ruiseki[left];
            //WriteLine($"{naka + 1}:{splits[naka - 1, 0]}/{splits[naka - 1, 1]}  diff[{Math.Abs(splits[naka - 1, 0] - splits[naka - 1, 1])}]({left + 1}:{naka - left})");
        }
        int right = n - 2;
        for (int naka = n - 3; 1 <= naka; --naka)
        {
            long all = ruiseki[n - 1] + ruiseki[naka];
            long diff = Math.Abs(all - ruiseki[right] * 2);
            for (int newRight = right - 1; naka < newRight; --newRight)
            {
                tmp = Math.Abs(all - ruiseki[newRight] * 2);
                if (tmp < diff)
                {
                    right = newRight;
                    diff = tmp;
                }
                else
                {
                    break;
                }
            }
            splits[naka - 1, 2] = ruiseki[right] - ruiseki[naka];
            splits[naka - 1, 3] = ruiseki[n - 1] - ruiseki[right];
            //WriteLine($"{n - naka - 1}:{splits[naka - 1, 2]}/{splits[naka - 1, 3]}  diff[{Math.Abs(splits[naka - 1, 2] - splits[naka - 1, 3])}]({right - naka}:{n - right - 1})");
        }
        long result = long.MaxValue;
        for(int i = 0; i < n - 3; ++i)
        {
            long max = splits[i, 0];
            long min = max;
            for(int j = 1; j < 4; ++j)
            {
                max = Math.Max(max, splits[i, j]);
                min = Math.Min(min, splits[i, j]);
            }
            result = Math.Min(result, max - min);
        }
        WriteLine(result);
    }
}


Measured memory_bytes: 36828
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

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

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let a: usize = iterator.next().unwrap().parse().unwrap();
    let b: usize = iterator.next().unwrap().parse().unwrap();

    return if (a * b) % 2 == 0 {
        "Even".to_string()
    } else {
        "Odd".to_string()
    };
}


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

int main() {
    int H, A;
    cin >> H >> A;
    cout << (H + A - 1) / A << '\n';
    return 0;
}

// overflow
// corner cases


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

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;

int gcd(int a, int b) {
  if (a < b) {
    swap(a, b);
  }
  // printf("a=%d, b=%d\n", a, b);
  if (b == 0) {
    return a;
  }
  int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vi a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  // int ans = 0;
  // for (int i = 0; i < n; i++) {
  //   int tmp_gcd = 0;
  //   if (i == 0) {
  //     tmp_gcd = a[1];
  //   } else {
  //     tmp_gcd = a[0];
  //   }
  //   for (int j = 0; j < n; j++) {
  //     if (i == j) {
  //       continue;
  //     }
  //     // printf("call gcd i=%d, j=%d, tmp_gcd=%d, a[j]=%d\n", i, j, tmp_gcd,
  //     // a[j]);
  //     tmp_gcd = gcd(tmp_gcd, a[j]);
  //   }
  //   // printf("i=%d, tmp_gcd=%d\n", i, tmp_gcd);
  //   ans = max(ans, tmp_gcd);
  // }
  // cout << ans << endl;

  vi l(n + 1, 0);
  vi r(n + 1, 0);
  for (int i = 0; i < n; i++) {
    l[i + 1] = gcd(l[i], a[i]);
  }
  for (int i = n - 1; i >= 0; i--) {
    r[i] = gcd(r[i + 1], a[i]);
  }

  int ans = 0;
  for (int i = 0; i < n; i++) {
    ans = max(ans, gcd(l[i], r[i + 1]));
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1408
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
using namespace std;
 
#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
ll ans=0;llfor;///////////////////////////////////////////////////////////
int main(){
  string S,X="No";
  cin>>S;
  if(S[0]==S[2]) X="Yes";
  cout<<X;
return 0;}

Measured memory_bytes: 3604
#include <iostream>
#include <list>
#include <vector>
#include <algorithm>

#define MAXM 10001
#define MAXN 501
#define UNDEF -1

using namespace std;

typedef struct
{
	int size;
	int price;
} box;

int n_manju,n_boxes,dp[MAXN][MAXM];
vector<int> manju,m_sum;
vector<box> boxes;

int main(void)
{
	box tb;
	int ti,sum = 0;
	for(int i = 0;i < MAXN;i++)
	{
		for(int ii = 0;ii < MAXM;ii++)
		{
			dp[i][ii] = 0;
		}
	}
	cin >> n_manju >> n_boxes;
	for(int i = 0;i < n_manju;i++)
	{
		cin >> ti;
		manju.push_back(ti);
	}
	for(int i = 0;i < n_boxes;i++)
	{
		cin >> tb.size >> tb.price;
		boxes.push_back(tb);
	}
	sort(manju.begin(),manju.end(),[](const int& a,const int& b){return a > b;});
	m_sum.push_back(0);
	for(auto itr = manju.begin();itr < manju.end();itr++)
	{
		sum += *itr;
		m_sum.push_back(sum);
	}
	for(int n = 0;n < n_boxes;n++)
	{
		for(int m = 0;m <= n_manju;m++)
		{
			dp[n+1][m] = max(dp[n+1][m],dp[n][m]);
			dp[n+1][min(n_manju,m+boxes[n].size)] = max(dp[n+1][min(n_manju,m+boxes[n].size)],(dp[n][m]+(m_sum[min(n_manju,m+boxes[n].size)]-m_sum[m]))-boxes[n].price);
		}
	}
	int result = 0;
	for(int m = 0;m <= n_manju;m++)
	{
		result = max(result,dp[n_boxes][m]);
	}
	cout << result << endl;
}

Measured memory_bytes: 22832
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int a = sc.nextInt();
        int b = sc.nextInt();
        String U = sc.next();

        if(U.equals(S)){
            a--;
        }else{
            b--;
        }
        System.out.println(a + " " + b);
    }
}

Measured memory_bytes: 23764
var n,i,ans:longint;
    a,b:array[1..1000]of longint;
begin
    readln(n);
    for i:=1 to n do
    begin
        readln(a[i],b[i]);
        inc(ans,b[i]-a[i]+1);
    end;
    writeln(ans);
end.

Measured memory_bytes: 128
N,L=map(int,input().split())
X=0
Y=0
if L>=0 :
    for i in range(N-1):
        X=X+L+i+1

elif L+N<=1:
    for i in range(N-1):
        X=X+L+i

else:
    for i in range(N):
        X=X+L+i
print(X)               

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>

int main(){
    int n,w;
    std::cin>>n>>w;
    std::vector<std::pair<int,int>> items;
    for (int i = 0; i < n; ++i) {
        int a,b;
        std::cin>>a>>b;
        items.emplace_back(b,a);
    }
    std::vector<std::pair<int,std::vector<int>>> dp(n*1000+1,std::make_pair(-1,std::vector<int>()));
    dp[0].first=w;
    for (int i = 1; i < dp.size(); ++i) {
        int hw=-1;
        int hwind=-1;
        int t;
        for (int j = 0; j < n; ++j) {
            if(items[j].first>i)continue;
            if(dp[i-items[j].first].first==-1)continue;
            if(dp[i-items[j].first].first<items[j].second)continue;
            for(auto it:dp[i-items[j].first].second){
                if(j==it)goto endloop;
            }

            t=dp[i-items[j].first].first-items[j].second;
            if(t<0)continue;
            if(hw<t){
                hw=t;
                hwind=j;
            }

            endloop:;
        }
        if(hwind==-1)continue;
        dp[i].first=hw;
        dp[i].second=dp[i-items[hwind].first].second;
        dp[i].second.emplace_back(hwind);
    }
    int ans=0;
    for (int i = 0; i < dp.size(); ++i) {
        if(dp[i].first!=-1)ans=i;
    }
    std::cout<<ans<<std::endl;
    return 0;
}

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define EXIST(m,v) (m).find((v)) != (m).end()
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

void Main(){
    ll N; cin >> N;
    VL n(N+1,0);

    FOR(i,1,N+1){
        for(int j=i; j<=N; j+=i) n[j]++;
    }

    ll ans = 0;
    for(ll i=1; i<=N; i++){
        ans += i*n[i];
    }
    cout << ans << en;
    return;
}

int main(void){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t=1; //cin>>t;
    REP(_,t) Main();
    return 0;
}

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

int main()
{
    long long N,D;
    cin >> N >> D;
    int count = 0;
    for (int i = 0; i < N; i++)
    {
        long long x,y;
        cin >> x >> y;
        if(x*x + y*y <= D*D)
        {
            count++;
        }
    }
    cout << count << endl;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef long long int ll;
typedef vector< pair<int,int> > vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long int> vll;
typedef pair<int,int> pii;

const ll INF= ll (1e18);
const int MOD= 1e9+7;
const int N=200000+10;

int manhat(int x,int y,int xx,int yy)
{
    return abs(x-xx)+ abs(y-yy);
}

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

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

    vii student,check;

    for(int i=1;i<=n;i++)
    {
        int a,b;
        cin>>a>>b;

        student.pb(mp(a,b));
    }
    for(int i=1;i<=m;i++)
    {
        int a,b;
        cin>>a>>b;

        check.pb(mp(a,b));
    }

    for(int i=0;i<n;i++)
    {
        int x=student[i].ff;
        int y=student[i].ss;

        int dist=INT_MAX;
        int index;

        for(int j=0;j<m;j++)
        {
            int xi=check[j].ff;
            int yi=check[j].ss;

            int curdist=manhat(x,y,xi,yi);

            if(curdist<dist)
            {
                index=j+1;
                dist=curdist;
            }
        }

        cout<<index<<endl;
    }

    return 0;
}


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

int main()
{
  int n;
cin >> n;
  
  if (n >= 1800 ) {
    cout << 1;
  }
  else if (n >= 1600 ) {
    cout << 2;
  }
  else if (n >= 1400 ) {
    cout << 3;
  }
  else if (n >= 1200 ) {
    cout << 4;
  }
  else if (n >= 1000 ) {
    cout << 5;
  }
  else if (n >= 800 ) {
    cout << 6;
  }
  else if (n >= 600 ) {
    cout << 7;
  }
  else {
    cout << 8;
  }
    return 0;
}


Measured memory_bytes: 3620
#include<iostream>
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>

using namespace std;

class Counting {
	unsigned long long p, n;
	vector<long long> invMemo, facMemo, facInvMemo;
public:
	Counting(unsigned long long nn, unsigned long long np) {
		p = np;
		n = nn;
		invMemo.resize(n + 1);
		facMemo.resize(n + 1);
		facInvMemo.resize(n + 1);
		facMemo[0] = 1;
		facMemo[1] = 1;
		facInvMemo[0] = 1;
		facInvMemo[1] = 1;
		invMemo[0] = 0;
		invMemo[1] = 1;
		for (unsigned long long i = 2; i <= n; i++) {
			invMemo[i] = p - (p / i)*invMemo[p%i] % p;
			facMemo[i] = (facMemo[i - 1] * i) % p;
			facInvMemo[i] = (facInvMemo[i - 1] * invMemo[i]) % p;
		}
	}
	unsigned long long fac(unsigned long long k) {
		return facMemo[k];
	}
	unsigned long long facInv(unsigned long long k) {
		return facInvMemo[k];
	}
	unsigned long long choose(unsigned long long n, unsigned long long k) {
		if (!(0 <= k && k <= n))
			return 0;
		return (((facMemo[n] * facInvMemo[k]) % p)*facMemo[n - k]) % p;
	}
	unsigned long long divide(unsigned long long a, unsigned long long b) {
		return (a * invMemo[b]) % p;
	}
	unsigned long long mod(unsigned long long a) {
		a %= p;
		if (a < 0) a += p;
		return a;
	}
	unsigned long long power(unsigned long long a, unsigned long long e) {
		unsigned long long ans = 1;
		for (; e > 0; e /= 2) {
			if (e % 2 != 0)
				ans = ans * a % p;
			a = a*a%p;
		}
		return ans;
	}
};

class Data {
public:
	int id;
	long long a;
	Data(int i, long long ll){
		id = i;
		a = ll;
	}
	bool operator<(Data &rhs) {
		if (this->a > rhs.a) {
			return true;
		}
		else if (this->a == rhs.a) {
			return this->id > rhs.id;
		}
		return false;
	}

	bool operator>(Data &rhs) {
		if (this->a < rhs.a) {
			return true;
		}
		else if (this->a == rhs.a) {
			return this->id < rhs.id;
		}
		return false;
	}
};

int main() {
	int n;
	vector<long long> ans;
	cin >> n;
	vector<Data>dt;
	ans.resize(n);
	for (int i = 0; i < n; i++) {
		long long a;
		cin >> a;
		Data hoge(i, a);
		dt.push_back(hoge);
	}
	sort(dt.begin(), dt.end());
	long long id = n;
	for (int i = 0; i < n - 1; i++) {
		if (id > dt[i].id) {
			id = dt[i].id;
		}
		ans[id] += (dt[i].a - dt[i + 1].a)*(i + 1);
	}
	if (id > dt[n - 1].id) {
		id = dt[n - 1].id;
	}
	ans[id] += dt[n - 1].a * n;

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

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a == b && b != c) {
    cout << "Yes" << endl;
  } else if (a == c && c != b) {
    cout << "Yes" << endl;
  } else if (b == c && c != a) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REP(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main(){

  ll N, D;
  cin >> N;
  cin >> D;

  if ((N % (2*D+1)) == 0)
    cout << (N / (2*D+1)) << endl;
  else
    cout << (N / (2*D+1)) + 1 << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i == n-1];}
#define INF (1e18)
const ll SIZE = 200010;
struct BIT
{
	int bit[SIZE];
	
	void init()
	{
		memset(bit,0,sizeof(bit));
	}
	void add(int k,int x)
	{
		k++;
		while(k<SIZE)
		{
			bit[k]+=x;
			k+=k&-k;
		}
	}
	int get(int k)
	{
		k++;
		int ret=0;
		while(k>0)
		{
			ret+=bit[k];
			k-=k&-k;
		}
		return ret;
	}
	int get(int s,int t)
	{
		return get(t)-get(s-1);
	}
	int pos(int k)//k 番目
	{
		int l=0,r=SIZE;
		while(r-l>1)
		{
			int m=(l+r)/2;
			if(get(m)<k) l=m;
			else r=m;
		}
		return r;
	}
};

int main(){   
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,K;
    cin >> N >> K;
    BIT bit;
    ll A[200010];
    rep(i,0,N) cin >> A[i];
    rep(i,0,N) A[i] -= K;
    ll sum[200010] = {};
    rep(i,0,N) sum[i+1] = sum[i] + A[i];
    vector<ll> v;
    rep(i,0,N+1) v.push_back(sum[i]);
    sort(v.begin(), v.end());
    unique(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());

    ll ans = 0;
    rep(i,0,N+1){
        ll pos = lower_bound(v.begin(), v.end(), sum[i]) - v.begin();
        ans += bit.get(pos);
        bit.add(pos, 1);
    }
    print(ans);
}


Measured memory_bytes: 6260
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int dy[] = {-1, 0, 1, 0};
int dx[] = {0, 1, 0, -1};
int n;
string s[110];

bool is_valid(int y, int x, int d) {
  if (y < 0 || y >= n || x < 0 || x >= n) return false;
  for (int i = 0; i < 4; i++) {
    int ny = y + dy[i], nx = x + dx[i];
    if (i == (d + 2) % 4) continue;
    if (ny >= 0 && ny < n && nx >= 0 && nx < n && s[ny][nx] == '#') return false;
  }
  return true;
}

void solve() {
  cin >> n;
  fill_n((string*)s, 110, string(n, ' '));
  int y = n - 1, x = 0, d = 0;
  while (true) {
    s[y][x] = '#';
    if (!is_valid(y + dy[d], x + dx[d], d)) (d += 1) %= 4;
    if (!is_valid(y + dy[d], x + dx[d], d)) break;
    y += dy[d], x += dx[d];
  }
  for (int i = 0; i < n; i++) {
    cout << s[i] << endl;
  }
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int d;
  cin >> d;
  for (int i = 0; i < d; i++) {
    if (i) cout << endl;
    solve();
  }  

  return 0;
}


Measured memory_bytes: 3128
#include <bits/stdc++.h>
#define REP(i, n) REPI(i, 0, n)
#define REPI(i, a, b) for (int i = (int)(a) ; i < (int)(b) ; i++)

#define SZ(x) ((int)(x).size())


using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using namespace std;

uint GetDigit(uint num){
    uint digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}

int main()
{
    int N, odig, mod, numlen;
    cin >> N;
    odig = N;
    numlen = GetDigit(N);
    mod = pow(10, numlen - 1);
    while (mod != 1)
    {
        odig %= mod;
        mod /= 10;
    }
    
    if (odig == 3)
    {
        cout << "bon" << endl;
    }
    else if (odig == 0 || odig == 1 || odig == 6 || odig == 8)
    {
        cout << "pon" << endl;
    }
    else
    {
        cout << "hon" << endl;
    }
    return 0;
}




Measured memory_bytes: 3808
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sn = new Scanner(System.in);
		int A = sn.nextInt();
		int B = sn.nextInt();
		if(A == 1){
			A = 14;
		}
		if(B == 1){
			B = 14;
		}
		if(A<B){
			System.out.print("Bob");
		}else if(A>B){
			System.out.print("Alice");
		}else{
			System.out.print("Draw");
		}

	}

}


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

int main(){
    int n;
    int a,b;
    cin >> n >> a >> b;
    
    int cnt=0;
    for(int i=1;i<=n;i++){
        int ans=(i/10000)%10+(i/1000)%10+(i/100)%10+(i/10)%10+i%10;
        if(a<=ans&&ans<=b){
            cnt+=i;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
process.stdin.resume();
process.stdin.setEncoding('utf8');
var input = '';
process.stdin.on('data', function(chunk) {
    input += chunk;
});
process.stdin.on('end', function() {
    var lines = input.split('\n').map(Number);
    for (var i = 0; i < lines.length && lines[i] != 0; i++) {
        console.log('Case %d: %d', i + 1, lines[i]);
    }
});

Measured memory_bytes: 13300
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>	
using namespace std;
#define all(v)			((v).begin()), ((v).end())
#define sz(v)			((int)((v).size()))
#define clr(v, d)		memset(v, d, sizeof(v))
#define rep(i, v)		for(int i=0;i<sz(v);++i)
#define lp(i, n)		for(int i=0;i<(int)(n);++i)
typedef long long         ll;
const double EPS = (1e-7);
int dcmp(double x, double y) { return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1; }
#define pb					push_back
#define P(x)				cout<<#x<<" = { "<<x<<" }\n"
clock_t T;
#define ctime cerr << "Time : " << double(clock() - T) / CLOCKS_PER_SEC << endl
void GOAT()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	//freopen("output.txt", "w	", stdout);
#else
#endif

}
string a, b, ans = "";
int mem[3001][3001];
int lcs(int i, int j)
{
	if (i >= sz(a) || j >= sz(b))return 0;
	int& ret = mem[i][j];
	if (~ret)return ret;
	ret = -1;
	if (a[i] == b[j]) {
		// += a[i];
		return  lcs(i + 1, j + 1)+1;
	}
	int ch1 = lcs(i, j + 1);
	int ch2 = lcs(i + 1, j);
	return ret = max(ch1, ch2);

}
void solve(int i, int j)
{
	if (i >= sz(a) || j >= sz(b))return;
	if (a[i] == b[j]) {
		ans += a[i];
		solve(i + 1, j + 1);
	}
	else
	{
		if (lcs(i + 1, j) >= lcs(i, j + 1))
			solve(i + 1, j);
		else solve(i, j + 1);
	}


}
int main()
{
	//GOAT();
	clr(mem, -1);
	cin >> a >> b;
	lcs(0, 0);
	solve(0, 0);
	cout << ans << endl;


}


Measured memory_bytes: 36096
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstdio>
#include <map>

int main()
{
  int K, N;
  std::cin >> K >> N;

  std::vector<int> A(N);

  for (auto i = 0; i < N; ++i)
    std::cin >> A[i];

  int max = 0;
  for (auto i = 0; i < N - 1; ++i)
  {
    max = std::max(max, A[i + 1] - A[i]);
  }
  max = std::max(max, A[0] + (K - A[N - 1]));

  std::cout << K - max;
} 

Measured memory_bytes: 1024
#include <cstdio>
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;

int main()
{
	string s;
	cin >> s;
	bool fla = false;
	for (int i = 0; i < s.size(); i++) {
		for (int j = 0; j < s.size(); j++) {
			if (i < j && s.at(i) == 'C' && s.at(j) == 'F') {
				fla = true;
			}
		}
	}
	if (fla == true) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)

def xor(x):
  if x <= 0:
    return 0
  if x == 1:
    return 1
  if x == 2:
    return 3
  if x == 3:
    return 0
  t = 2 ** (len(bin(x))-3)
  if x==t:
    return t
  return t*((x-t)%2^1) + xor(x-t)
a, b = map(int, input().split())
print(xor(b) ^ xor(a-1))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  long long m = 1;
  int f = 0;
  int f2 = 0;
  vector<long long> vec(n);
  for (int i = 0; i < n; i++) {
    cin >> vec.at(i);
    if(vec.at(i)==0){
        f = 1;
        break;
    }
    if(vec.at(i)>1000000000){
        f2 = f2 + 1;
    }
  }
    sort(vec.begin(), vec.end());
    reverse(vec.begin(), vec.end());
  if(f==0){
    for (int i = 0; i < n; i++) {
      m = m*vec.at(i);
      if(m>1000000000000000000){
          f = 2;
          break;
      }
    }
  }
  if(f==0&&f2 <=1){
  cout << m << endl;
  }else if(f==1){
  cout << 0 << endl;
  }else if(f==2 || f2>=2){
  cout << -1 << endl;
  }
} 

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

void Main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    sort(a.rbegin(), a.rend());
    long sum = 0;
    for (int i = 0; i < n-1; i++)
    {
        sum += a[(i+1)/2];
    }
    // 4
    // 43 : 4 ... 4
    // 432 : 3 ... 7
    // 4132 : 3 ... 10
    // 41320 : 2
    // 413a20 : 2
    // 4b13a20 : 1

    cout << sum << endl;
}

int main(int argc, char **argv)
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    Main();
    return 0;
}


Measured memory_bytes: 3944
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<set>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef pair<ll,ll> pll;
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
#define MOD 1000000007
#define ARRAY_MAX 100005

const int INF = 1e9+7;


int main(){

    int n,m;
    while(cin >> n >> m,n|m){

        int cost = 0;
        int dist = 0;
        vector<pii> a(n);
        for(int i = 0;i < n;i++){
            cin >> a[i].second >> a[i].first;
            cost += a[i].second * a[i].first;
            dist += a[i].second;
        }

        int tmp = dist - m;
        if(tmp <= 0){
            cout << "0" << endl;
        }else{
            sort(a.begin(),a.end());
            int cnt = 0;
            int ans = 0;
            
            for(int i = 0;i < n;i++){
                if(cnt + a[i].second <= tmp){
                    ans += a[i].first * a[i].second;
                    cnt += a[i].second;
                }else{
                    while(cnt < tmp){
                        ans += a[i].first;
                        cnt++;
                    }
                }
            }
            cout << ans << endl;
        }

        a.shrink_to_fit();
    }
    return 0;
}


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

typedef pair<int,int> pii;

void solve(int h,int w){
    int sq = h*h+w*w;
    vector<pii> v;
    for(int i=1;i<=150;i++){
        for(int j=i+1;j<=150;j++){
            v.push_back(make_pair(i*i+j*j,i));
        }
    }
    sort(v.begin(),v.end());
    for(int i=0;i<v.size();i++){
        if(sq==v[i].first && v[i].second>h){
            for(int j=0;j<=150;j++){
                if(v[i].second*v[i].second+j*j==sq){
                    cout << v[i].second << " " << j << endl;
                    return;
                }
            }
        }else if(v[i].first>sq){
            for(int j=0;j<=150;j++){
                if(v[i].second*v[i].second+j*j==v[i].first){
                    cout << v[i].second << " " << j << endl;
                    return;
                }
            }
        }
    }
}

int main(){
    int h,w;
    while(cin>>h>>w){
        if(h==0 && w==0) break;
        solve(h,w);
    }
}

Measured memory_bytes: 3208