akhauriyash/Code-Regression huggingface dataset:
def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = [2]
    limit = int(n**0.5)
    data = [i + 1 for i in range(2, n, 2)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]


q = int(input())
lrl = []
for _ in range(q):
    lrl.append(list(map(int, input().split())) )

primes = set(get_sieve_of_eratosthenes(10**5))
like2017s = []
cnt_dict = {}
cnt_dict[-1] = 0
for i in range(10**5//2):
    num = i*2+1
    num2 = (num+1)//2
    if num in primes and num2 in primes:
        cnt_dict[num] = cnt_dict[num-2]+1
    else:
        cnt_dict[num] = cnt_dict[num-2]

for lr in lrl:
    l,r = lr
    print(cnt_dict[r]-cnt_dict[l-2])

Measured memory_bytes: 34316
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define ALL(c) (c).begin(), (c).end()
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int s,w;
    cin >> s >> w;
    if (s <= w)
    {
        cout << "unsafe" << endl;
    }
    else
    {
        cout << "safe" << endl;
    }
    
    
}




Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ull = long long unsigned;
using P = pair<int,int>;
const int INF=1001001001;
const int NMAX=8;
const int MOD=1000000007;
const int dbase=80*160;

int main()
{
	int n,k;
	cin>>n>>k;
	int r,s,p;
	cin>>r>>s>>p;
	string t;
	cin>>t;
	int ans=0;
	rep(i,n){
		if (i-k>=0 & t[i-k]==t[i]){
			t.replace(i,1,"z");
			continue;
		}
		else{
			if (t[i]=='r') ans+=p;
			if (t[i]=='p') ans+=s;
			if (t[i]=='s') ans+=r;
		}
	}
	cout<<ans;
}


Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
    public static bool f = false, t = true;
    static void Main(string[] args)
    {
        int[] n = Console.ReadLine().Split().Select(int.Parse).ToArray();
        char[,] a = new char[n[0], n[1]];
        for (int i = 0; i < n[0]; i++)
        {
            string y = Console.ReadLine();
            for(int j = 0; j < n[1]; j++)
            {
                a[i, j] = y[j];
            }
        }
        int max = int.MaxValue;

        for (int i1 = 0; i1 < n[0] - 2; i1++)
        {
            for (int i2 = i1 + 2; i2 < n[0]; i2++)
            {
                int asn = 0;
                for (int i = 0; i <= i1; i++)
                {
                    for (int j = 0; j < n[1]; j++)
                    {
                        if (a[i, j] != 'W') { asn++; }
                    }
                }
                for (int i = i1 + 1; i <= i2 - 1; i++)
                {
                    for (int j = 0; j < n[1]; j++)
                    {
                        if (a[i, j] != 'B') { asn++; }
                    }
                }
                for (int i = i2; i <= n[0] - 1; i++)
                {
                    for (int j = 0; j < n[1]; j++)
                    {
                        if (a[i, j] != 'R') { asn++; }
                    }
                }
                if (asn < max) { max = asn; }
            }
        }
        Console.WriteLine(max);
        Console.ReadLine();

    }
    public static long gcd(long a, long b)
    {
        while (true)
        {
            if (a == 0) { return b; }
            if (b == 0) { return a; }
            if (a > b) { a -= b; }
            else { b -= a; }
        }
    }
    public static long lcm(long a, long b) { return a / gcd(a, b) * b; }
    public static string Reverse(string s)
    {
        return new string(s.Reverse().ToArray());
    }
    public static bool IsPrime(int num)
    {
        if (num < 2) return false;
        else if (num == 2) return true;
        else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

        double sqrtNum = Math.Sqrt(num);
        for (int i = 3; i <= sqrtNum; i += 2)
        {
            if (num % i == 0)
            {
                // 素数ではない
                return false;
            }
        }

        // 素数である
        return true;
    }
}
public static class Read
{
    public static void outl(string n = "") { Console.WriteLine(n); return; }
    public static long Long() { return long.Parse(Console.ReadLine()); }
    public static long[] longs() { return Console.ReadLine().Split().Select(long.Parse).ToArray(); }
    public static int Int() { return int.Parse(Console.ReadLine()); }
    public static int[] ints() { return Console.ReadLine().Split().Select(int.Parse).ToArray(); }
    public static string Str() { return Console.ReadLine(); }
    public static string[] Strs() { return Console.ReadLine().Split(); }
}


Measured memory_bytes: 9588
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, k, sum int
	fmt.Scan(&n, &k)

	var p = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&p[i])
	}
	sort.Ints(p)

	for i := 0; i < k; i++ {
		sum += p[i]
	}
	fmt.Println(sum)

}


Measured memory_bytes: 1872
import scala.io.StdIn.{readInt, readLine}
class IntTree(size: Int) {
    val tree: Array[List[Int]] = new Array[List[Int]](size)
    var root: Int = -1
    
    def add(target: Int, c: List[Int]): Unit = {
        tree(target) = c
        if (root == -1 || c.contains(root)) root = target
    }
    def toPrintableArray(): Array[String] = {
        val ret = new Array[String](size)
        def go(children: List[Int], parent: Int, depth: Int): Unit = {
            if (children != Nil) {
                val target = children.head
                val nodeType = if (tree(target) == Nil) "leaf" else "internal node"
                val c = tree(target).mkString(", ")
                ret(target) = s"node ${target}: parent = ${parent}, depth = ${depth}, ${nodeType}, [${c}]"
                go(tree(target), target, depth + 1)
                val tail = children.tail
                if (tail != Nil) go(tail, parent, depth)
            }
        }
        val c = tree(root).mkString(", ")
        ret(root) = s"node ${root}: parent = -1, depth = 0, root, [${c}]"
        go(tree(root), root, 1)
        ret
    }
}
object Main {
    def main(args: Array[String]): Unit = {
        val len = readInt
        val t = new IntTree(len)
        (0 until len).foreach { i =>
            val line = readLine.split(" ").map(_.toInt)
            t.add(line.head, line.slice(2, line.length).toList)
        }
        println(t.toPrintableArray.mkString("\n"))
    }
}


Measured memory_bytes: 294296
#include <iostream>
#include <utility>
#include <map>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <array>
#include <math.h>
#include <numeric>
#include <sstream>
#include <queue>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
int main(int argc, char const *argv[]) {
    int n;
    cin >> n;
    vector<ll> a(n);
    vector<ll> b(n);
    REP(i,n) cin >> a[i] >> b[i];
    ll ans = 0;
    ll s = 0;
    for (int i = n-1; i >= 0; --i) {
        ll x = 0;
        a[i] += s;
        ll m = a[i]%b[i];
        if (m == 0) x == 0;
        else x = b[i]-m;
        ans += x;
        s += x;
    }
    cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 1792
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
=begin
ITP1_6-C

Array - Official House
????????¶??? : 1 sec, ?????¢?????¶??? : 65536 KB
??¬????????\?±??????°

?????§?????????????????¢????????¨?±?????????????????????¬???????£??????????????????????????????¬????????\?±??????????????????±???????????????????????¨?±??????\?±??????°???????????????????????°?????????????????????????????????

n??¶????????±????????????????????????????????±??§?????????????????´??°b, f, r, v????????????????????????????????????b?£?f??????r???????????¨?±????v??????????????§??\?±????????????¨??????????????????v?????????????????´??????v????????????????????¨??????????????????

???????????¨????????¨?±?????????°?????\?±????????????????????????¨????????????
Input

????????????????????±?????° n ????????????????????????

?¶??????? n ??¶????????±????????????????????????????????±?????????????????´??° b, f, r, v ????????????????????§??????????????????????????????
Output

????£???????????????\?±??????°???????????????????????????????£???????????????????????????????????????????????????\?±??????°??????????????????????????????????????????????????????????????????????????????????????????????????¨?±??????\?±??????°????????????????????????????????\?±??????°???????????????????????????????????????????????????????????????????£?????????????####################(20??????#)??§????????£???????????????
Constraints

    ????????£????£??????????????????¨?±???????????????????????????????
    ?????????????¨???§?????¨?±??????\?±??????°?????????????°??????????????????¨????????????
    ?????????????¨???§?????¨?±??????\?±??????°???9???????????????????????¨????????????

Sample Input

3
1 1 3 8
3 2 2 7
4 3 8 1

Sample Output

 0 0 8 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
####################
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
####################
 0 0 0 0 0 0 0 0 0 0
 0 7 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
####################
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 1 0 0

=end

n = STDIN.gets.to_i
dt = Hash.new
while $_=STDIN.gets
  fl = $_.split.map!{|x| x.to_i}
  b=fl[0]
  f=fl[1]
  r=fl[2]
  v=fl[3]
  ky = format("%d:%d:%d", b, f, r)
  if dt.has_key?(ky) then
    dt[ky] += v
  else
    dt[ky] = v
  end
end

(1..4).each {|b|
  puts "####################"  if b!=1
  (1..3).each {|f|
    (1..10).each {|r|
      ky = format("%d:%d:%d", b, f, r)
      if dt.has_key?(ky) then
        num=dt[ky]
      else
        num=0
      end
      printf(" %d", num)
    }
    puts
  }
}

Measured memory_bytes: 8752
import java.util.*;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int a =sc.nextInt();
		int b =sc.nextInt();
		int c =sc.nextInt();
		int count = 0;

		if (a==b) {
			if (b!=c) {
				System.out.println("Yes");
				System.exit(0);
			}
		}
		if (a==c) {
			if (b!=c) {
				System.out.println("Yes");
				System.exit(0);
			}
		}
		if (b==c) {
			if (b!=a) {
				System.out.println("Yes");
				System.exit(0);
			}
		}
		System.out.println("No");

	}
}


Measured memory_bytes: 23636
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

using namespace std;

typedef pair<long long int, long long int> P;

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

long long int a[110000], LIS[110000], pos[110000], path[110000];

int main(){
	
	int N;
	cin >> N;
	
	for(int i = 0; i < N; i++){
		cin >> a[i];
        a[i] *= -1;
	}
	
	for(int i = 0; i < N; i++){
        pos[i] = -1;
		LIS[i] = INF;
	}
	
	bool flag = false;
    int p;
	
	for(int i = N - 1; i >= 0; i--){
		p = lower_bound(LIS, LIS + N, a[i]) - LIS;
		LIS[p] = a[i];
        if(p == 0){
            path[i] = -1;
        }else{
            path[i] = pos[p - 1];
        }
        pos[p] = i;
	}
	
	int num = (int)(lower_bound(LIS, LIS + N, INF) - LIS);
	long long int ans = 0;
    p = pos[num - 1];
    while(p != -1){
        ans -= a[p];
        p = path[p];
    }
	cout << ans << endl;
}


Measured memory_bytes: 6220
import java.util.*;
public class Main {
	static Scanner sc = new Scanner(System.in);
	static int A, B, round;
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO ツ篠ゥツ督ョツ青カツ青ャツつウツづェツつスツδソツッツドツ・ツスツタツブ
		while(read()){
			slove();
		}
	}
	static boolean read(){
		round = sc.nextInt();
		if(round == 0)
			return false;
		return true;
	}
	static void slove(){
		int getA = 0, getB = 0, A = 0, B = 0;
		for(int i = 0; i < round; i++){
			getA = sc.nextInt();
			getB = sc.nextInt();
			if(getA > getB){
				A += getA + getB;
			}else if(getB > getA){
				B += getB + getA;
			}else{
				A += getA;
				B += getB;
			}
		}
		System.out.print(A + " ");
		System.out.println(B);
	} 

}

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

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int N, Q;
  cin >> N >> Q;
  fenwick_tree<long> fw(N);
  for(int i=0; i<N; i++){
    int a;
    cin >> a;
    fw.add(i, a);
  }
  while(Q--){
    int t, x, y;
    cin >> t >> x >> y;
    if(t == 1)cout << fw.sum(x, y) << '\n';
    else fw.add(x, y);
  }
  return 0;
}

Measured memory_bytes: 8256
import java.util.Arrays;
import java.util.Scanner;
 
class Main {
	int n;
	int x;
	int[] a;
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		Main m = new Main(sc);
		m.solve();
		sc.close();
	}
	Main(Scanner sc){
		n = sc.nextInt();
		x = sc.nextInt();
		a = new int[n];
		for(int i=0;i<n;i++){
			a[i] = sc.nextInt();
		}
	}
	void solve(){
		Arrays.sort(a);
		int cnt = 0;
		while(x>0&&cnt<n){
			x-=a[cnt];
			cnt++;
		}
		if(x!=0){
			cnt--;
		}
		System.out.println(cnt);
	}
}

Measured memory_bytes: 23124
#include<iostream>
#include<fstream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<set>
 
using namespace std;
 
bool check(int bit, int k) {
  if(((bit >> k) & 1) > 0) return true;
  return false;
}
 
int main() {
  int n;
  cin >> n;
  int d[13] = {0};
  for(int i = 0; i < n; i++) {
    int b;
    cin >> b;
    d[b]++;
  }
  int ans = 0;
  d[0]++;
  for(int i = (1 << 24) - 1; i >= 0; i--) {
    if((i & 1) == 0) continue;
    bool b = false;
    bool c[24] = {false};
    for(int j = 1; j < 12; j++) {
      if(d[j] > 2) b = true;
      int k = 24 - j;
      if(d[j] == 0) {
        if(((i >> j) & 1) > 0 || ((i >> k) & 1) > 0) b = true;
      } else if(d[j] == 1) {
        int c = 0;
        if(((i >> j) & 1) > 0) c++;
        if(((i >> k) & 1) > 0) c++;
        if(c != 1) b = true;
      } else {
        if(((i >> j) & 1) == 0 && ((i >> k) & 1) == 0) b = true;
        if(((i >> j) & 1) == 1 && ((i >> k) & 1) == 0) c[j] = true;
        if(((i >> j) & 1) == 0 && ((i >> k) & 1) == 1) c[k] = true;
      }
    }
    if(d[12] > 0 && ((i >> 12) & 1) == 0) continue;
    if(d[0] > 1) c[0] = true;
    if(d[12] > 1) c[12] = true;
    if(b) continue;
    int sub = 12;
    for(int j = 0; j < 24; j++) {
      if(c[j]) {
        sub = 0;
        break;
      }
      if(!check(i, j)) {
        continue;
      }
      for(int k = 1; k < 12; k++) {
        if(check(i, (j + k) % 24) || check(i, (j - k + 24) % 24)) {
          sub = min(sub, k);
          break;
        }
      }
    }
 
    ans = max(ans, sub);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
	int N, x; cin >> N >> x;
	int a[N];
	rep(i, N) cin >> a[i];

	int ans = INF2;
	int b[N][N] = {};
	rep(i, N) b[i][0] = a[i];
	rep(i, N) {
		// cout << i << " " << 0 << " " << b[i][0] << endl;
		rep(k, N - 1) {
			b[i][k + 1] = min(b[i][(k + N) % N], a[(i - (k + 1) + N ) % N]);
			// cout << i << " " << k + 1 << " " << b[i][k + 1] << endl;
		}
	}
	rep(k, N) {
		int tmp = x * k;
		rep(i, N) {
			tmp += b[i][k];
		}
		ans = min(ans, tmp);
	}
	cout << ans << endl;

    return 0;
}


Measured memory_bytes: 31488
import sys
from collections import deque
def input(): return sys.stdin.readline().strip()


def main():
    a, b, c, d = map(int, input().split())
    p = a // d
    q = c // b
    if a % d != 0:
        p += 1
    if c % b != 0:
        q += 1
    
    if p >= q:
        print("Yes")
    elif p < q:
        print("No")
    
    

if __name__ == "__main__":
    main()


Measured memory_bytes: 64716
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int x[1000], y[1000],a, b, c, d, m;
int main() {
	while (true) {
		m = 0;
		memset(x, 0, 4000);
		memset(y, 0, 4000);
		cin >> a >> b;
		if (a == 0) { break; }
		for (int i = 0; i < a; i++) {
			cin >> c;
			for (int j = 0; j < c; j++) {
				cin >> d; m = max(m, d);
				x[d]++; y[d]++;
			}
		}
		sort(y, y + m + 1);
		if (y[m] < b) {
			cout << '0' << endl;
		}
		else {
			for (int i = 0; i < 999; i++) {
				if (y[m] == x[i]) {
					cout << i << endl;goto F;
				}
			}
		}
		F:;
	}
}

Measured memory_bytes: 1188
S = gets.chomp
s1 = S[0..1].to_i
s2 = S[2..3].to_i

yymm = false
mmyy = false
if 1 <= s1 and s1 <= 12 then
  mmyy = true
end
if 1 <= s2 and s2 <= 12 then
  yymm = true
end
  
if yymm then
  if mmyy then
    puts "AMBIGUOUS"
  else
    puts "YYMM"
  end
else
  if mmyy then
    puts "MMYY"
  else
    puts "NA"
  end
end

Measured memory_bytes: 14256
#include <iostream>
#include<algorithm>
#include<vector>
using namespace std;
using ll = long long;
#define INF 1e9

int main() {
	int N;
	cin >> N;
	int A[2][100];
	for (int i = 0; i < 2; ++i) {
		for (int j = 0; j < N; ++j) {
			cin >> A[i][j];
		}
	}
	int ans = 0;
	for (int k = 0; k < N; ++k) {
		int sum = 0;
		for (int j = 0; j <= k; ++j) {
			sum += A[0][j];
		}
		for (int l = k; l < N; ++l) {
			sum += A[1][l];
		}
		ans = max(sum, ans);
	}
	cout << ans << endl;
	return 0;
}

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

int main()
{
	ll a,b,n;
	cin>>a>>b>>n;
	
	ll x;
	if(b-1<=n)
	{
		x=b-1;
		cout<<floor(a*x/b)-a*floor(x/b)<< endl;
	}
	else
	{
		x=n;
		cout<<floor(a*x/b)-a*floor(x/b)<< endl;
	}
	
	return 0;
}


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

int main(){
  int D,G;
  cin >> D >> G;
  vector<int>P(D);
  vector<int>C(D);
  for (int i=0;i<D;i++){
    cin >> P.at(i) >> C.at(i);
  }
  long long res = 1e9;
  for (int i=0;i<1<<10;i++){
    int ansed_num = 0;
    int point = 0;
    bitset<10>is_comp(i);
    for (int j=0;j<10;j++){
      if (j<D){
        if (is_comp.test(j)){
          ansed_num += P.at(j);
          point += (j+1) * 100 * P.at(j) + C.at(j);
        }
      }
    }
    for (int j=9;j>=0;j--){
      if (j<D){
        if (!is_comp.test(j)){
          int ansed_num_this = 0;
          while (point < G && ansed_num_this < P.at(j)){
            ansed_num += 1;
            point += (j+1) * 100;
            ansed_num_this += 1;
          }
        }
      }
    }
    if (point >= G){
      if (ansed_num < res){
        res = ansed_num;
      }
    }
  }
  cout << res << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define in ({int x=0;int c=getchar(),n=0;for(;!isdigit(c);c=getchar()) n=(c=='-');for(;isdigit(c);c=getchar()) x=x*10+c-'0';n?-x:x;})
#define forinc(i,a,b) for(int i=a;i<=b;i++)
#define fordec(i,a,b) for(int i=a;i>=b;i--)

const int maxn=1e5+5;
int a[maxn],n,dem,ret;
stack<int> st;
int r[maxn];

main()
{
    cin>>n;
    forinc(i,1,n) cin>>a[i];
    a[n+1]=1e9+1;
    forinc(i,1,n)
    {
        if(a[i]>=a[i+1])
        {
            dem++;
        }
        else
        {
            ret=max(ret,dem);
          //  cout<<ret<<" ";
            dem=0;
        }
    }
    cout<<ret;

}


Measured memory_bytes: 640
N = int(input())
nanjo = -1
a = 1
while a <= N:
    a*=26
    nanjo += 1
A = [0]*(nanjo+1)
L = nanjo
for i in range(nanjo+1):
    A[i] = N//26**(nanjo)
    N -= A[i]*26**(nanjo)
    nanjo -= 1
for i in reversed(range(L+1)):
    if i != 0:
        if A[i] <= 0:
            A[i] += 26
            A[i-1] -= 1       
for i in range(L+1):
    if i == 0 and A[i] == 0:
        continue
    else:
        print(chr(A[i]+96), end = "")




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

int main()
{
	int a , b ;
	cin >> a >> b;
	if ( a < b )
	{
		cout << "a < b" << endl;
	}
		if ( a > b )
		{
			cout << "a > b" << endl;
		}
			if ( a == b )
			{
				cout << "a == b" << endl;
			}
		
	
}

Measured memory_bytes: 1156
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let (N, K) = read!(usize, usize);
    let V = read![[i64]];

    let mut D: Vec<i64> = vec![];
    let mut max_s = 0;
    for d in 0..K {
        let mut l = 0;
        while d + l <= K {
            let mut r = N;
            while l <= r && d + l + (N - r) <= K {
                D.clear();
                D.extend(&V[..l]);
                D.extend(&V[r..]);
                D.sort();

                let mut S = 0;
                for i in 0..D.len() {
                    if i < d && D[i] < 0 {
                        continue;
                    }
                    S += D[i];
                }
                max_s = max(max_s, S);

                if r == 0 {
                    break;
                }
                r -= 1;
            }
            if l == N {
                break;
            }
            l += 1;
        }
    }

    println!("{}", max_s)
}


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

int main(){
  int N, M;
  cin >> N >> M;
  
  vector<int> L(M);
  vector<int> R(M);
  for(int i=0; i<M; ++i) {
    int l, r;
    cin >> l >> r;
    L[i] = l;
    R[i] = r;
  }
  
  int Lmax = 0;
  int Rmin = R[0];
  for(int i=0; i<M; ++i) {
    Lmax = max(Lmax, L[i]);
    Rmin = min(Rmin, R[i]);
  }
  
  int count = 0;
  for(int i=0; i<=N; ++i) {
    if(Lmax <= i && i <= Rmin) { ++count; }
  }
  
  cout << count << endl;
  
}


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

int main() {
  int n, t;
  cin >> n >> t;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; i++) cin >> a.at(i) >> b.at(i);
  vector<vector<int>> dp_notused(n + 1, vector<int>(t)),
    dp_used(n + 1, vector<int>(t));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < t; j++) {
      dp_notused.at(i + 1).at(j) = dp_notused.at(i).at(j);
      if (j >= a.at(i)) {
        dp_notused.at(i + 1).at(j) = max(dp_notused.at(i + 1).at(j),
                                         dp_notused.at(i).at(j - a.at(i)) + b.at(i));
      }
      dp_used.at(i + 1).at(j) = max(dp_used.at(i).at(j),
                                    dp_notused.at(i).at(j) + b.at(i));
      if (j >= a.at(i)) {
        dp_used.at(i + 1).at(j) = max(dp_used.at(i + 1).at(j),
                                      dp_used.at(i).at(j - a.at(i)) + b.at(i));
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < t; i++) ans = max(ans, dp_used.at(n).at(i));
  cout << ans << endl;
}


Measured memory_bytes: 70912
n,m = map(int,input().split())
ps = [input().split() for i in range(m)]

ac = set()
wa = {}
c = 0
for p,s in ps:
  if p in ac:
    continue

  if s == 'WA':
    if p in wa:
      wa[p] += 1
    else:
      wa[p] = 1

  if s == 'AC':
    ac.add(p)
    if p in wa:
      c += wa[p]
    continue

print(len(ac) , c)


Measured memory_bytes: 38296
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

int main() {
  ll a,b,c;
  cin >> a >> b >> c;
  ll ans=b;
  ans+=min(c,a+b+1);
  cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input())
s = input()
cnt_R = s.count('E')
cnt_L = 0
INF = 10**18
ans = INF
for x in s:
    if x == 'W':
        ans = min(ans, cnt_L+cnt_R)
        cnt_L += 1
    else:
        cnt_R -= 1
        ans = min(ans, cnt_L+cnt_R)
print(ans)


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

int a;
bool b[31];

int main() {
	b[0] = true;
	rep(i,28) scanf("%d",&a), b[a] = true;
	rep(i,31) if (!b[i]) printf("%d\n",i);
}


Measured memory_bytes: 3124
# -*- coding: utf-8 -*-

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


count = 0
flag = 0
for i in range(N):

    if N == 1:
        break

    minj = i
    for j in range(i, N):
        if A[j] < A[minj]:
            minj = j
            flag = 1

    if flag == 1:
        A[i], A[minj] = A[minj], A[i]
        count += 1

    flag = 0


for i in range(N):
    if i == N - 1:
        print("{0}".format(A[i]))
    else:
        print("{0} ".format(A[i]), end="")

print(count)


Measured memory_bytes: 5612
#include<bits/stdc++.h>
#define eps 1e-6
#define ll long long
#define IOS cin.sync_with_stdio(false);cin.tie(0);cout.tie(0);
//#define int long long
#define MEM(x,y) memset(x,y,sizeof(x))
#define rep(i,a,n) for (ll i=a;i<n;i++)
#define fi first
#define se second
#define endl "\n"
const ll mod=1000000007;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
ll Max(ll a,ll b){return a>=b?a:b;}
ll Min(ll a,ll b){return a<=b?a:b;}
ll qpow(ll a,ll b){ll s=1;while(b>0){if(b%2==1){s=s*a;}a=a*a;b=b>>1;}return s;}
ll qpowmod(ll a, ll b, ll c){ll res,t;res=1;t=a%c;while(b){if(b&1){res=res*t%c;}t=t*t%c;b>>=1;}return res;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline long long read(){long long k=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){k=k*10+ch-'0';ch=getchar();}return k*f;}
inline void write(long long x){if(x<0)x=-x,putchar('-');if(x>9)write(x/10);putchar(x%10+'0');}
using namespace std;
//head file
int main()
{
    string s;
    cin>>s;
    if(s=="ABC")
        cout<<"ARC"<<endl;
    if(s=="ARC")
        cout<<"ABC"<<endl;
}


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

int main()
{
	int N, K;
	int64_t sum = 0;
	cin >> N >> K;

	for ( int i = K + 1; i <= N; i++ ) {
		int p = N / i, r = N % i;
		sum += p * max(0, i - K) + max(0, r - K + 1);
	}
	if ( K == 0 ) sum -= N;
	cout << sum << endl;

	return ( 0 );
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef  long long int ll;
typedef pair<ll, ll> pll;
#define pb push_back
typedef long double ld;
#define fi first
#define se second
#define PI 3.14159265358979323846264338327950288419716939937510
#define mp make_pair
ll inf = 1e18;
ll p = 1e9 + 7;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
ll pwr(ll x, ll y)
{
    ll res = 1;
    x = x ;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) ;
        y = y >> 1;
        x = (x * x) ;
    }
    return res;
}
ll modInverse(ll n, ll p)
{
    return power(n, p - 2, p);
}
vector<set<ll>>adj(2 * 1e5 + 1);
vector<ll>used(2 * 1e5 + 1, 0);
ll sz;
void dfs(ll s)
{
    used[s] = 1;
    sz++;
    for (auto u : adj[s])
    {
        if (used[u] == 0)
            dfs(u);
    }
}
int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll i, j, y, x,  z, w, g, key,  k, n, m, a, b;
    ll t2, t3, t4, t1, t5, t6;
    string s, t;

    cin >> n >> m;

    while (m--)
    {
        cin >> x >> y;
        adj[x].insert(y);
        adj[y].insert(x);
    }
    ll ans = 0;
    for (i = 1; i <= n; i++)
    {
        if (used[i] == 0)
        {
            sz = 0;
            dfs(i);
            ans = std::max(ans, sz);
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 39100
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	int a[20]={0};
	if(n<m)swap(n,m);
	a[0]=1;n--;
	for(int i=1;i<16;i++){
		if(a[i-1]==1&&m){
			a[i]=2;
			m--;
		}
		else if(a[i-1]==2&&n){
			a[i]=1;
			n--;
		}
		else 
			a[i]=0;
	}
	if(m||n)cout<<":("<<endl;
	else cout<<"Yay!"<<endl;
}

Measured memory_bytes: 256
class DualSegmentTree():

    def __init__(self, n, op, e):
        """
        :param n: 配列の要素数
        :param op: 作用素（モノイド＝結合則＋単位元存在）
        :param e:  単位元
        """
        self.n = n
        self.op = op
        self.e = e
        self.depth = (self.n - 1).bit_length()
        self.size = 1 << self.depth
        self.lazy = [self.e] * ((self.size << 1) + 1)

    def built(self, array):
        """
        arrayを初期値とするセグメント木を構築
        """
        for i in range(self.n):
            self.lazy[self.size + i] = array[i]

    def update(self, l, r, x):
        """
        半開区間 [l, r) の各々の要素 a に op(x, a)を作用させる （ 0-indexed ）　（ O(logN) ）
        """
        l += self.size
        r += self.size
        l0 = l//(l&-l)
        r0 = r//(r&-r)
        self.propagate(l0)
        self.propagate(r0-1)
        while l < r:
            if r&1:
                r -= 1              # 半開区間なので先に引いてる
                self.lazy[r] = self.op(x, self.lazy[r])
            if l&1:
                self.lazy[l] = self.op(x, self.lazy[l])
                l += 1
            l >>= 1
            r >>= 1

    def propagate(self, i):
        """
        根から葉に伝搬させる。可換モノイドの場合は更新時の伝搬をサボれる。　（ O(logN) ）
        """
        for k in range(self.depth, 0,-1):
            x = i>>k
            if self.lazy[x] == self.e:
                continue
            self.lazy[(x<<1)|1] = self.op(self.lazy[x], self.lazy[(x<<1)|1])
            self.lazy[x<<1] = self.op(self.lazy[x], self.lazy[x<<1])
            self.lazy[x] = self.e

    def get(self, i):
        """
        i 番目の値を取得（ 0-indexed ） ( O(logN) )
        """
        i += self.size
        self.propagate(i)
        return self.lazy[i]

    def __getitem__(self, i):
        return self.get(i)

    def __iter__(self):
        for x in range(1, self.size):
            if self.lazy[x] == self.e:
                continue
            self.lazy[(x<<1)|1] = self.op(self.lazy[x], self.lazy[(x<<1)|1])
            self.lazy[x<<1] = self.op(self.lazy[x], self.lazy[x<<1])
            self.lazy[x] = self.e
        for a in self.lazy[self.size:self.size+self.n]:
            yield a

    def __str__(self):
        for x in range(1, self.size):
            if self.lazy[x] == self.e:
                continue
            self.lazy[(x<<1)|1] = self.op(self.lazy[x], self.lazy[(x<<1)|1])
            self.lazy[x<<1] = self.op(self.lazy[x], self.lazy[x<<1])
            self.lazy[x] = self.e
        return str(self.lazy[self.size:self.size + self.n])

##################################################################################################################
import sys
from bisect import *
input = sys.stdin.readline

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

e = -1
op = lambda x, y: x if x != e else y
st = DualSegmentTree(Q, op, e)

Qu = [list(map(int, input().split())) for _ in range(N)]
Qu.sort(key=lambda x:x[2], reverse=True)

D = [int(input()) for _ in range(Q)]

for q in Qu:
    S, T, X = q
    L = bisect_left(D,S-X)
    R = bisect_left(D,T-X)
    st.update(L, R, X)
print(*st, sep="\n")

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

#define INF 1000010000
#define nl '\n'
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define pdd pair<double,double>
#define all(c) (c).begin(), (c).end()
#define SORT(c) sort(all(c))
#define sz(c) (c).size()
#define rep(i,n) for( int i = 0; i < n; ++i )
#define repi(i,n) for( int i = 1 ; i <= n; ++i )
#define repn(i,n) for( int i = n - 1 ; i >= 0 ; --i )
#define repf(j,i,n) for( int j = i ; j < n ; ++j )
#define die(s) {std::cout << s << nl;}
#define dier(s) {std::cout << s; return 0;}
#define dbg(var) {std::cout << #var << "  = " << var << nl;}
#define vi vector<int>
typedef long long ll;

using namespace std;


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

	int n , k;
	cin >> n >> k;

	vi h(n);
	for(auto& el : h) 
		cin >> el;

	vi dp(n , INF);
	dp[0]= 0;
	
	rep(i , n)
	{
		repi(j , k)
		{
			if(i - j >= 0 && i - j < n) dp[i] = min(dp[i] , dp[i - j] + abs(h[i] - h[i - j]));
		}
	}

	cout << dp[n - 1];

	return 0;
}

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 1e5 + 5;

vi v1, v2;

vi rec_gen(int cnt) {
	vi ans;
	if (cnt == 1) {
		ans.pb(0);
		ans.pb(1);
		return ans;
	}
	REP(i, 0, 1 << (cnt - 1)) {
		ans.pb(i ^ (i >> 1));
	}
	vi tmp = rec_gen(cnt - 2);
	int cur = ((1 << (cnt - 1)) | (1 << (cnt - 2)));
	REP(i, 0, SZ(tmp)) {
		ans.pb(cur | tmp[i]);
		cur ^= (1 << (cnt - 2));
		ans.pb(cur | tmp[i]);
	}
	return ans;
}

void solve(){
	int n, a, b;
	cin >> n >> a >> b;
	b ^= a;
	int cnt = 0;
	REP(i, 0, n) {
		if (b & (1 << i)) {
			cnt++;
		}
	}
	if (cnt % 2 == 0) {
		printf("NO\n");
		return;
	}
	
	REP(i, 0, 1 << (n - cnt)) {
		v2.pb(i ^ (i >> 1));
	}
	
	v1 = rec_gen(cnt);
	
	/*REP(i, 0, SZ(v1)) {
		printf("%d ", v1[i]);
	}
	putchar('\n');
	REP(i, 0, SZ(v2)) {
		printf("%d ", v2[i]);
	}
	putchar('\n');*/
	
	printf("YES\n");
	REP(i, 0, SZ(v1)) {
		int mask1 = 0;
		int ind = 0;
		REP(k, 0, n) {
			if (b & (1 << k)) {
				int coef = (v1[i] & (1 << ind)) ? 1 : 0;
				mask1 |= ((1 << k) * coef);
				ind++;
			}
		}
		REP(j, 0, SZ(v2)) {
			int j1 = j;
			if (i & 1) {
				j1 = SZ(v2) - 1 - j;
			}
			int mask2 = 0;
			int ind = 0;
			REP(k, 0, n) {
				if (!(b & (1 << k))) {
					int coef = (v2[j1] & (1 << ind)) ? 1 : 0;
					mask2 |= ((1 << k) * coef);
					ind++;
				}
			}
			int mask = mask1 ^ mask2 ^ a;
			//printf("%d %d %d\n", mask1, mask2, mask);
			printf("%d ", mask);
		}
	}
	putchar('\n');
	
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 1152
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

x = LI()
x.sort(reverse=1)
ans = x[0]*10 + x[1] + x[2]
print(ans)

Measured memory_bytes: 38384
// Author -- Frame

#include<bits/stdc++.h>

#define lowbit(x) ((x)&(-(x)))
#define Finline __inline__ __attribute__ ((always_inline))
#define DEBUG fprintf(stderr,"Running on Line %d in Function %s\n",__LINE__,__FUNCTION__)
#define SZ(x) ((int)x.size())
#define mkpr std::make_pair
#define pb push_back

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef std::pair<int,int> pi;
typedef std::pair<ll,ll> pl;
using std::min;
using std::max;

const int inf=0x3f3f3f3f,Inf=0x7fffffff;
const ll INF=0x3f3f3f3f3f3f3f3f;

Finline uint rnd(){static uint seed=416;return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;}
template <typename _Tp>_Tp gcd(const _Tp &a,const _Tp &b){return (!b)?a:gcd(b,a%b);}
template <typename _Tp>Finline _Tp abs(const _Tp &a){return a>=0?a:-a;}
template <typename _Tp>Finline void chmax(_Tp &a,const _Tp &b){(a<b)&&(a=b);}
template <typename _Tp>Finline void chmin(_Tp &a,const _Tp &b){(b<a)&&(a=b);}
template <typename _Tp>Finline void read(_Tp &x)
{
	char ch(getchar());bool f(false);while(!isdigit(ch)) f|=ch==45,ch=getchar();
	x=ch&15,ch=getchar();while(isdigit(ch)) x=(((x<<2)+x)<<1)+(ch&15),ch=getchar();
	f&&(x=-x);
}
template <typename _Tp,typename... Args>Finline void read(_Tp &t,Args &...args){read(t);read(args...);}
template <typename _Tp,typename... Args>Finline _Tp min(const _Tp &a,const _Tp &b,const Args &...args){return a<b?min(a,args...):min(b,args...);}
template <typename _Tp,typename... Args>Finline _Tp max(const _Tp &a,const _Tp &b,const Args &...args){return a<b?max(b,args...):max(a,args...);}
Finline int read_str(char *s)
{
	char ch(getchar());while(ch==' '||ch=='\r'||ch=='\n') ch=getchar();
	char *tar=s;*tar=ch,ch=getchar();while(ch!=' '&&ch!='\r'&&ch!='\n'&&ch!=EOF) *(++tar)=ch,ch=getchar();
	return tar-s+1;
}

const int N=100005;
const int mod=1000000007;
template<typename _Tp1,typename _Tp2>Finline void add(_Tp1 &a,_Tp2 b){(a+=b)>=mod&&(a-=mod);}
template<typename _Tp1,typename _Tp2>Finline void sub(_Tp1 &a,_Tp2 b){(a-=b)<0&&(a+=mod);}
char s[N];
int dp[N],sum[N];
int pos[3];
int main()
{
	int n=read_str(s+1);
	bool flag=true;for(int i=1;i<n;++i) flag&=s[i]!=s[i+1];
	if(flag) return puts("1"),0;
	for(int i=1;i<=n;++i) sum[i]=sum[i-1]+(s[i]=='a'?1:2),sum[i]%=3;
	dp[n+1]=1,pos[sum[n]]=n+1;
	for(int i=n;i>=1;--i)
	{
		int qwq=sum[i-1];
		dp[i]=dp[i+1]+((sum[n]-sum[i-1])==0);
		for(int j=1;j<=2;++j)
		{
			int to=(qwq+j)%3;
			if(pos[to]>i+1) add(dp[i],dp[pos[to]]);
		}
		pos[qwq]=i;
	}
	int ans=dp[1];sub(ans,sum[n]==0);
	printf("%d\n",ans);
	return 0;
}


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

int n;
ll h[100010][3],dp[100010][3];

int main() {
  cin >> n;

  rep(i,n)rep(j,3)
    cin >> h[i][j];

  rep(i,n){
    rep(j,3){
      rep(k,3){
      if(j==k) continue;
      dp[i+1][k]=max(dp[i+1][k],dp[i][j]+h[i][k]);
      }
    }
  }
  cout << max({dp[n][0],dp[n][1],dp[n][2]}) << endl;
}

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

using namespace std;

int main(){
    int a, b;
    scanf("%d %d", &a, &b);
    int sm, dif, mul;
    sm = a + b;
    dif = a - b;
    mul = a * b; 
    printf("%d\n", max(sm, max(dif, mul)));
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
using namespace std;

int n,W;
long long ans=-1e18;
const int Maxd=1e5+7;
long long w[107],v[107];
long long dp[107][Maxd];

int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	cin>>n>>W;
	REP(i,n)cin>>w[i]>>v[i];
	REP(i,107)
		REP(j,Maxd)
			dp[i][j]=-1e18;
	dp[0][0]=0;
	REP(i,n)
		for(int j=0;j<=W;j++)
		{
			dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
			if(j+w[i]<=W)dp[i+1][j+w[i]]=max(dp[i+1][j+w[i]],dp[i][j]+v[i]);
		}
	for(int i=0;i<=W;i++)ans=max(ans,dp[n][i]);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 83840
#include <string>
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
using int64 = long long int;

const int64 INF = 1LL << 60;
int64 dp[310][310];
int main() {
  int N; cin >> N;
  vector<int> A(N), S(N+1);
  for(int i=0; i<N; i++) {
    cin >> A[i];
    S[i+1] = S[i] + A[i];
  }

  fill(dp[0], dp[N+1], INF);
  for(int i=0; i<N; i++) {
    dp[i][i] = dp[i][i+1] = 0;
  }
  for(int d=2; d<=N; d++) {
    for(int l=0; l<N-d+1; l++) {
      int r = l + d;
      for(int k=l+1; k<r; k++) {
        int vl = S[k] - S[l];
        int vr = S[r] - S[k];

        int64 c = 0, cost = 0;
        while(vl > 0 or vr > 0 or c > 0) {
          int x = vl % 10, y = vr % 10;
          int nc = (x + y + c >= 10);
          cost += x * y + c;
          c = nc;
          vl /= 10, vr /= 10;
        }

        dp[l][r] = min(dp[l][r], dp[l][k] + dp[k][r] + cost);
      }
    }
  }
  cout << dp[0][N] << endl;
  return 0;
}



Measured memory_bytes: 3820
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<string.h>
using namespace std;
int main(){
	string a,b,c;
	cin>>a>>b>>c;
	if(a[a.size()-1]==b[0]&&b[b.size()-1]==c[0])cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}


Measured memory_bytes: 256
a, b, k = map(int, input().split())

if b - a + 1 <= k * 2:
    for i in range(a, b + 1):
        print(i)
else:
    for i in range(a, a + k):
        print(i)
    for i in range(b - k + 1, b + 1):
        print(i)


Measured memory_bytes: 3060
#include<iostream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include<unordered_map>
using namespace std;
const long long int mod1=1000000007;
const long long int mod2 = -1;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define pp pop_back                                       
#define ff first
#define ss second
#define ll long long int
#define ull unsigned long long int
#define ordered_set tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define ordered1 tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define inf mod1
#define all(x) x.begin(),x.end()
ll gcd(ll a, ll b){
    ll c;
     while(b){
        c = b;
        b = a % b;
        a = c;
     }
     return a;
}
ll power1(ll a, ll b){
     if(b == 0) return 1;
     else if(b % 2) return a * power1(a, b - 1);
     else {
        ll temp = power1(a, b / 2);
        return temp * temp;
     }
}
ll power2(ll a, ll b, ll m){
     a %= m;
     if(b == 0) return 1;
     else if(b % 2) return (a * power2(a, b - 1, m)) % m;
     else{
        ll temp = power2(a, b / 2, m);
        return (temp * temp) % m;
     }
}
ll mod(ll x, ll p){
return (x % p + p) % p;
}
ll lcm(ll x, ll y){
return (x * y)/gcd(x, y);
}
int main(){
    fast;
    ll tt = 1;
    //cin >> tt;
    while(tt--){
        double x = 6.28318530717958623200;
        double n;
        cin >> n;
        cout << x * n << endl;   
    }
}


Measured memory_bytes: 3800
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i, s, e) for (int i = s; i < e; i++)
#define endl '\n'
int main()
{
    bool x;
    cin >> x;
    if (x)
    {
        cout << 0 << endl;
    }
    else
    {
        cout << 1 << endl;
    }
}

Measured memory_bytes: 3560
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
using namespace std;
typedef long long ll;

int main(){
  char a, b;
  cin >> a >> b;

  if((a == 'H' && b == 'H') || (a == 'D' && b == 'D')) cout << 'H' << endl;
  else cout << 'D' << endl;

  return 0;
}


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

using namespace std;
typedef long long ll;
#define int ll
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

signed main(void)
{
  int k, a, b;
  cin >> k >> a >> b;
  if(a <= b) {
    if(a >= k) cout << 1 << endl;
    else cout << -1 << endl;
  } else {
    if(a >= k) cout << 1 << endl;
    else cout << ceil((k-a), (a-b))*2 + 1 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <string>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <cmath>
#include <limits>
#include <tuple>
#include <queue>
#include <stack>

using namespace std;
typedef long long ll;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()

bool check(int x)
{
	set<int> s;
	for (int i = 1; i < 100; i += 2) {
		int n = x / i;
		int m = x % i;
		if (m == 0) {
			s.insert(i);
			s.insert(n);
		}
	}
	return s.size() == 8;
}

int main()
{
	int N;
	cin >> N;
	vector<int> v;
	for (int i = 1; i <= N; i += 2) {
		if (check(i))
			v.push_back(i);
	}
	int ans = v.size();
	cout << ans << endl;
	return 0;
}


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

int main(){
    int W,H,x,y,r;
    cin>>W>>H>>x>>y>>r;
    if(x-r>=0 && x+r<=W && y-r>=0 && y+r<=H)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
        
    return 0;
}


Measured memory_bytes: 3104