akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>

int main() {
  std::vector<std::string> weather{"Sunny", "Cloudy", "Rainy"};
  
  std::string current_weather;
  std::cin >> current_weather;
  
  int i = current_weather == "Sunny" ? 0 : (current_weather == "Cloudy" ? 1 : 2);
  std::cout << weather.at((i+1)%3) << std::endl;
}

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


#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+5;
int main(){
	int n;
	cin >> n;
	int s[N];
	for(int i=0;i<n;i++){		
		cin >> s[i];
	}
	int flag=1;
	if(n==1){
		cout << "Yes" << endl;
	}
	else{
		for(int i=n-1;i>0;i--){
			if(s[i-1]>s[i]){
				s[i-1]-=1;		
			}
		}
		for(int i=n-1;i>0;i--){
			if(s[i-1]>s[i]){
				flag=0;
				break;
			}
		}
		if(flag) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 640
import java.math.*;
import java.util.*;

	public class Main {

		public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);
			int h = sc.nextInt();
			int a = sc.nextInt();
			
			System.out.println((h+a-1)/a);
			
			
			
			
		}

	}

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

long long f(vector<long long> &a){
	long long n = (long long)a.size();
	long long r = 0;
	//cout << a[0] << " ";
	for(long long i = 1; i < n; i++){
		r += (long long)abs(a[i] - a[i - 1]);
		//cout << a[i] << " ";
	}
	//cout << endl;

	return r;
}

int main(){

	long long n; cin >> n;
	vector<long long> a(n);
	for(long long i = 0; i < n; i++) cin >> a[i];
	long long ans = 0;
	sort(a.begin(), a.end());

	if(n % 2 == 0){

		long long r = n / 2;
		long long l = r - 1;
		vector<long long> b;
		vector<long long> c;
		b.push_back(a[r]);
		c.push_back(a[l]);
		for(long long i = 0; i < n / 2 - 1; i++){
			b.push_back(a[i]);
			c.push_back(a[n - i - 1]);
			c.push_back(a[i]);
			b.push_back(a[n - i - 1]);
		}
		b.push_back(a[l]);
		c.push_back(a[r]);
		
		ans = max(f(c), f(b));

	}else{

		vector<long long> b;
		vector<long long> c;
		b.push_back(a[n/2]);
		c.push_back(a[n/2]);
		for(long long i = 0; i < n/2; i++){
			b.push_back(a[i]);
			b.push_back(a[n - i - 1]);
			c.push_back(a[n - i - 1]);
			c.push_back(a[i]);
		}

		ans = max(f(c), f(b));

	}

	cout << ans << endl;

	return 0;
}


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

using namespace std;

long long solve(const vector<pair<int, int> > &F) {
    long long ret = 0;
    priority_queue<int, vector<int>, greater<int> > pq;
    for (auto p : F) {
        pq.push(p.second);
        ret += p.second;
        if (pq.size() > p.first) {
            ret -= pq.top();
            pq.pop();
        }
    }
    return ret;
}

void run_case() {
    int n;
    cin >> n;
    vector<pair<int, int> > F, S;
    long long ans = 0;
    int k, l, r;
    for (int i = 0; i < n; i++) {
        cin >> k >> l >> r;
        ans += min(l, r);
        if (l >= r) {
            if (l == r)continue;
            F.push_back({k, l - r});
        } else {
            if (k == n)continue;
            S.push_back({n - k, r - l});
        }
    }
    sort(F.begin(), F.end());
    sort(S.begin(), S.end());
    cout << ans + solve(F) + solve(S) << "\n";
}


int main() {


    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin >> t;
    while (t--)run_case();


    return 0;
}




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

int main() {
  int N;
  string S;
  cin >> N >> S;

  long ans = 0;
  string T = "RGBRGB";
  for (int i = 0; i < N; i++) {
    string s1 = S.substr(0, i);
    string s2 = S.substr(i + 1);

    int t = T.find(S.at(i));
    char x = T.at(++t);
    char y = T.at(++t);

    int x1 = count(s1.begin(), s1.end(), x);
    int y1 = count(s1.begin(), s1.end(), y);
    int x2 = count(s2.begin(), s2.end(), x);
    int y2 = count(s2.begin(), s2.end(), y);

    ans += x1 * y2;
    ans += y1 * x2;

    reverse(s1.begin(), s1.end());
    int mi = min(s1.size(), s2.size());
    for (int j = 0; j < mi; j++) {
      if ((s1.at(j) == x && s2.at(j) == y) || (s1.at(j) == y && s2.at(j) == x)) ans--;
    }
  }

  cout << ans << "\n";
}

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

const long long mod = 1e9 + 7;
unsigned int K = 0;
std::vector<int> to[100005];
unsigned long ans = 1;

long long permutation(int n, int r) {
  long long ret = 1;
  for (unsigned int i = 0; i < r; ++i) {
    ret = (ret * (n - i)) % mod;
  }
  return ret;
}

void dfs(int node, int parent) {
  const std::vector<int>& children = to[node];
  // childrenがいない末端から進んでいく
  for (size_t i = 0; i < children.size(); ++i) {
    const int& child = children.at(i);
    if (child == parent) {
      continue;
    }
    dfs(child, node);
  }

  // calc nPr
  int n;                        // 色の候補
  if (parent == -1) {
    // rootの分を含めて候補はK個
    n = K;
  } else {
    // 親とその親の色は選べない
    n = K - 2;
  }

  int r;                        // 塗る対象
  if (parent == -1) {
    // rootも入れるので対象は+1
    r = children.size() + 1;
  } else {
    // 親はすでに塗ってあるので-1
    r = children.size() - 1;
  }

  ans = (ans * permutation(n, r)) % mod;
}

int main() {
  int N;
  std::cin >> N >> K;
  for (int i = 0; i < N - 1; ++i) {
    int a, b;
    std::cin >> a >> b;
    a -= 1;
    b -= 1;
    to[a].push_back(b);
    to[b].push_back(a);
  }

  dfs(0, -1);

  std::cout << ans << std::endl;

  return 0;
}


Measured memory_bytes: 9216
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		boolean check = false;
		if(a==1||a==2) {
			System.out.println(a);
			System.exit(0);
		}
		
	
		for(;;) {
		
			for(int j = 2;j*j<a;j++) {
				
				if(a%j==0) {
					check = false;
					break;
				}
				else {
					check = true;
				}
				
			}
			
			if(check) {
				System.out.println(a);
				break;
			}
			a= a+1;
			
			
			
		}
		
	}

}


Measured memory_bytes: 35764
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    int A, B;
    cin >> A >> B;
    if (B % A == 0) cout << A + B << endl;
    else cout << B - A << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
//#define ll long long
#define pb emplace_back
#define mp make_pair
#define nt _ll128
#define ld long double
long double PI =3.14159265358979323846;
using ll = long long;



const ll modo=1e9+7;
const ll inf=LONG_LONG_MAX;
const ll ms=(2e5)+5;

map<int,int> mm;
int main()
{
    idfc;

    int n;
    cin>>n;
    int i;
    int e;
    int d;
    ll a=0;
    for(i=1;i<=n;i++)
    {
        cin>>e;
        d=i-e;
        a+=mm[d];
        mm[i+e]+=1;
    }
    cout<<a;

    return 0;
}

Measured memory_bytes: 20616
def PalindJudge(num):
    
    judge = 1
    list = [0,0,0,0,0]
    
    for i in range(5):
        list[i] = num%10
        num //= 10
        
    for i in range(3):
        if list[i]!=list[4-i]:
            judge *= 0
            
    return judge

if __name__ == '__main__':
    
    a,b = map(int, input().split())
    
    count = 0
    
    for i in range(a, b+1):
        if PalindJudge(i) == 1:
            count += 1
            
    print(count)

Measured memory_bytes: 9204
#include <stdio.h>
#define CARD_NUM 13
void printOutput(char, int*);

int main(void)
{
    int S[CARD_NUM] = {0};
    int H[CARD_NUM] = {0};
    int C[CARD_NUM] = {0};
    int D[CARD_NUM] = {0};
    int i, n;

    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        char kind;
        int num;
        scanf(" %c %d", &kind, &num);
        switch (kind) {
            case 'S': S[num-1]++; break;
            case 'H': H[num-1]++; break;
            case 'C': C[num-1]++; break;
            case 'D': D[num-1]++; break;
        }
    }
    printOutput('S', S);
    printOutput('H', H);
    printOutput('C', C);
    printOutput('D', D);
    return 0;
}

void printOutput(char kind, int *array)
{
    int i;
    for (i = 0; i < CARD_NUM; i++) {
        if (array[i] == 0) {
            printf("%c %d\n", kind, i+1);
        }
    }
}

Measured memory_bytes: 596
#include<stdio.h>
#include<math.h>
#define d_flag 0
  


int main(){
  int n;
 double k,sum=0,p=1;
  scanf("%d%lf",&n,&k);
  if(d_flag)printf("%d,%lf\n",n,k);
  while(k>n)
    {
      k/=2;
      p/=2;
      if(d_flag)printf("p:%lf,k:%lf\n",p,k);
    }
  sum=(n-ceil(k)+1)*p;
      if(d_flag)printf("sum:%lf\n",sum);
  while(k>1)
    {
      k/=2;
      p/=2;
      sum+=(ceil(2*k)-ceil(k))*p;
      if(d_flag)printf("p:%lf,k:%lf,sum:%lf\n",p,k,sum);
    }
  
  printf("%0.12lf",sum/n);
  return 0;
}



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

int main()
{
    int n;
    string s,mae,ato;
    cin >> n >>s;
    if(n%2 !=0){
        cout<< "No" <<endl;
    }else{
        mae =s.substr(0,n/2);
        ato =s.substr(n/2);
        if(mae == ato){
            cout<< "Yes" <<endl;
        }else{
            cout<< "No" <<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <stack>
using namespace std;
vector<int> v;
int main(){
	map<string, int> mp;
	string s;
	while (cin >> s) {
		if (s == "insert") {
			string t; cin >> t;
			mp[t]++;
		}
		else if (s == "find") {
			string t; cin >> t;
			if (mp[t] == 0) {
				cout << "no" << endl;
			}
			else {
				cout << "yes" << endl;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 52460
let iota ?(start=0) ?(step=1) cnt =
  let rec doit i acc =
    if i <= 0 then acc
    else doit (i - 1) (start + step*(i - 1) :: acc) in
  doit cnt []

let safe_p p qs =
  let rec doit i = function
    | [] -> true
    | q :: qs ->
      if p = q + i || p = q - i then false
      else doit (i + 1) qs in
  doit 1 qs

let answer_p rc qs =
  let rec doit i = function
    | ([], _) -> true
    | (_, []) -> assert false
    | ((r, c) :: xs as rc, q :: qs) ->
      if r <> i then doit (i + 1) (rc, qs)
      else if c = q then doit (i + 1) (xs, qs)
      else false in
  doit 0 (rc, qs)

let print qs =
  List.iter (fun q ->
    for i = 0 to 7 do
      print_string (if i = q then "Q" else ".")
    done;
    print_newline ()) qs

let solve rc =
  let rec doit qs = function
    | [] -> if answer_p rc qs then print qs
    | ps ->
      List.iter (fun p ->
        if safe_p p qs then List.filter (fun e -> e <> p) ps |> doit (p :: qs))
        ps in
  iota 8 |> doit []

let () =
  let k = read_int () in
  let rec read i rc =
    if i = k then rc
    else read (i + 1) (Scanf.scanf "%d %d\n" (fun r c -> (r, c)) :: rc) in
  read 0 [] |> List.sort (fun (a, _) (b, _) -> a - b) |> solve

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

int main() {
    string a, b, c;
    cin >> a >> b >> c;
    cout << char(a[0]-'a'+'A') << char(b[0]-'a'+'A') << char(c[0]-'a'+'A') << endl;
    return 0;
}

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

#define min(a, b) a < b ? a : b
#define max(a, b) a > b ? a : b

#define MAXN 100000

int main(void)
{
	int i, N, ans = 0;
	//int max = 1;
	//int judge = 0;
	int a[MAXN];
	int num[MAXN] = {0};

	scanf("%d", &N);

	for (i = 0; i < N; i++) {
		scanf("%d", &a[i]);
		if (!num[a[i] - 1]) {
			num[a[i] - 1] = 1;
			ans++;
		}
	}
	/*for (i = 0; i < N; i++) {
		for (j = N - 1; j > i; j--) {
			if (a[j] < a[j - 1]) {
				tmp = a[j];
				a[j] = a[j - 1];
				a[j - 1] = tmp;
			}
		}
	}*/
	/*for (i = 0; i < max; i++) {
		if (cnum[i] >= 1) {
			ans++;
			if (cnum[i] > 1) judge += cnum[i] - 1;
		}
	}*/
	if ((N - ans) % 2) ans--;

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

	return (0);
}

Measured memory_bytes: 896
fun main(args : Array<String>) {
    val (n, m, k) = readLine()!!.split(" ").map { it.toInt() }
    val excluded = Array(n) { mutableListOf<Int>() }
    val uf = UnionFind(n)

    repeat(m) {
        val (a, b) = readLine()!!.split(" ").map { it.toInt()-1 }
        excluded[a].add(b)
        excluded[b].add(a)
        uf.merge(a, b)
    }

    repeat(k) {
        val (c, d) = readLine()!!.split(" ").map { it.toInt()-1 }
        if (uf.isSame(c, d)) {
            excluded[c].add(d)
            excluded[d].add(c)
        }
    }

    println((0 until n).map { uf.size(it) - excluded[it].size - 1 }.joinToString(separator = " "))
}

private data class UnionFind(val initSize: Int) {
    private val parents = IntArray(this.initSize) { it }
    private val sizes = LongArray(this.initSize) { 1L }

    fun root(idx: Int): Int {
        if (idx == parents[idx]) return idx

        val rootP = root(parents[idx])
        parents[idx] = rootP
        return rootP
    }

    // NOTE: merge to the larger group
    fun merge(p1: Int, p2: Int) {
        if (this.isSame(p1, p2)) return

        val rootP1 = root(p1)
        val rootP2 = root(p2)

        if (this.sizes[rootP1] >= this.sizes[rootP2]) {
            this.sizes[rootP1] += this.sizes[rootP2]
            this.parents[rootP2] = this.parents[rootP1]
        } else {
            this.sizes[rootP2] += this.sizes[rootP1]
            this.parents[rootP1] = this.parents[rootP2]
        }
    }

    fun isSame(p1: Int, p2: Int): Boolean {
        return this.root(p1) == this.root(p2)
    }

    fun size(idx: Int): Long {
        return this.sizes[this.root(idx)]
    }
}

Measured memory_bytes: 90200
using System;

namespace ForAtcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var x = Console.ReadLine().Split(" ");
            for (var i = 1; i <= 5; i++)
            {
                if(int.Parse(x[i - 1]) == 0) Console.WriteLine(i);
            }

        }
    }
}

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

int main() {
	string s;
	cin >> s;
	if (s.length() % 2 != 0) {
		cout << "No" << endl;
		return 0;//
	}
	for (int i = 0; i < s.length() / 2; i++) {
		char x = s.at(i * 2);
		char y = s.at(i * 2 + 1);
		if (x == 'h' && y == 'i')continue;
		else {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;

}

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

int main() 
{
 ios_base::sync_with_stdio(false);
 cin.tie(nullptr);
 cout.tie(nullptr);
 string s;
 cin >> s;
 int ans = 0;
 for(auto& ch: s) ans += (ch - '0');
 cout << (ans % 9 ? "No\n" : "Yes\n");
}


Measured memory_bytes: 3732
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn = new Scanner(System.in);
		
		int lo = 0;
		String s = scn.nextLine();
		for (int n = 0; n < s.length(); n++) {
			if (s.charAt(n) == 'x') lo++;
		}
		
		if (lo <= 7) System.out.println("YES");
		else System.out.println("NO");
	}

}


Measured memory_bytes: 21972
def d(s,t):
    s1=list(set([i for i in s]))
    t1=list(set([i for i in t]))
    ans='No'
    st=set(zip(s,t))
    if len(st)-len(s1)==0 and len(st)-len(t1)==0:
        ans='Yes'
    return ans
print(d(input(),input()))

Measured memory_bytes: 5296
#include <bits/stdc++.h>
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repr(i,a,n) for(int i=a;i>n;i--)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  
  int count = 0;
  int ans = 0;
  rep(i,0,n){
    count = 0;
    set<char> a;
    set<char> b;
    rep(j,0,i) a.insert(s.at(j));
    rep(j,i,n) b.insert(s.at(j));
    for (auto value : a) {
      if (b.count(value)) count++;
//      cout << value << endl;
    }
    ans = max(ans, count);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/// Typedef
typedef long long           ll;
typedef vector<int>         vi;
typedef pair<int,int>       pii;

#define pb                  push_back
#define ppb                 pop_back
#define MP                  make_pair
#define ff                  first
#define ss                  second
#define sf                  scanf
#define pf                  printf
#define SQR(x)              ((x)*(x))
#define loop(i, y)          for(int i=0; i<int(y); i++)
#define FOR(i, x, y)        for(int i=int(x); i<int(y); i++)
#define ROF(i, x, y)        for(int i=int(x); i>=int(y); i--)
#define all(c)              c.begin(), c.end()
#define sz(c)               int(c.size())
#define clr(x, y)           memset(x, y, sizeof(x))
#define si(x)               scanf("%d", &x)
#define sii(x, y)           scanf("%d %d", &x, &y)
#define siii(x, y, z)       scanf("%d %d %d", &x, &y, &z)
#define sl(x)               scanf("%lld", &x)
#define sll(x, y)           scanf("%lld %lld", &x, &y)
#define slll(x, y, z)       scanf("%lld %lld %lld", &x, &y, &z)

#ifdef VAMP
     #define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template < typename Arg1 >
    void __f(const char* name, Arg1&& arg1){
        cout << name << " = " << arg1 << std::endl;
    }
    template < typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names+1, ',');
        cout.write(names, comma - names) << " = " << arg1 <<" | ";
        __f(comma+1, args...);
    }
#else
    #define debug(...)
#endif
///******************************************START******************************************

/// Constants
#define MAX                 100005
#define MOD                 1000000007
#define eps                 1e-9
#define INF                 0x3f3f3f3f3f3f3f3f // 4,557,430,888,798,830,399
#define inf                 0x3f3f3f3f // 1,061,109,567
#define PI                  acos(-1.0)  // 3.1415926535897932
#define VT                  int

int DP[2][MAX];

int main(){
    #ifdef VAMP
        clock_t tStart = clock();
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int n, k; sii(n, k);
    DP[0][0] = 1;
    int now = 0, prv;
    FOR(i, 0, n){
        int x; si(x);
        prv = now;
        now = !now;
        FOR(j, 0, k+1){
            DP[now][j] =    ((j ? DP[now][j-1] : 0)+
                            DP[prv][j] -
                            (j-x-1>=0 ? DP[prv][j-x-1] : 0))%MOD;
            DP[now][j] = (DP[now][j] + MOD) % MOD;
        }
    }
    printf("%d\n", DP[now][k]);

    #ifdef VAMP
        fprintf(stderr, "\n>> Runtime: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC);
    #endif
    return 0;
}

Measured memory_bytes: 1024
x,n=map(int,input().split())
P=list(map(int,input().split()))

for i in range(100):
    u_flg = False
    l_flg = False

    x_u=x+i
    x_l=x-i
    for p in P:
        if x_u == p:
            u_flg = True
        if x_l == p:
            l_flg = True

    if u_flg == False and l_flg == False:
        print(min(x_u,x_l))
        break
    elif u_flg == False:
        print(x_u)
        break
    elif l_flg == False:
        print(x_l)
        break


Measured memory_bytes: 9200
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <utility>
#include <iomanip>
#include <chrono>
#include <random>
#include <bitset>

using namespace std;

#define sz(x) (int) x.size()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x)) 
#define y1 aksjdaskdjksjfksdjf
#define left kdnvldvoiwejifejg
#define right lkdsjflksdjfdjfk
#define prev asdasfsadjkjsdfjs
#define tm aklsjdasjdasjdkdjjf
#define lcm hddalkwjeidjjhasda
#define random_shuffle asdasdd

const int MAXN = 105000;

int n, qn;
string s;
int sum[MAXN];

int main() { 

  scanf("%d %d\n", &n, &qn);
  getline(cin, s);

  for (int i = 0; i < n; i++) {
    if (i + 1 < n && s[i] == 'A' && s[i + 1] == 'C') {
      sum[i] = 1;
    }
    if (i > 0) {
      sum[i] += sum[i - 1];
    }
  }

  for (int i = 0; i < qn; i++) {
    int l, r;
    scanf("%d %d", &l, &r);
    l--; r--;
    int ans = 0;
    if (r - 1 >= l) {
      ans += sum[r - 1];
    }
    if (l > 0) {
      ans -= sum[l - 1];
    }
    printf("%d\n", ans);
  }

  return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, l;
    cin >> n >> l;
    map<string, int> mp;
    vector<string> s(n);  
    rep(i, 0, n){
        cin >> s[i];
        mp[s[i]]++;
    }
    vector<string> p, c;
    rep(i, 0, n){
        string tmp = s[i];
        reverse(all(tmp));
        if(mp[tmp] != 0 && mp[s[i]] != 0){
            if(tmp == s[i] && mp[tmp] <= 1) continue;
            if(s[i] < tmp) p.push_back(s[i]);
            else p.push_back(tmp);
            mp[s[i]]--;
            mp[tmp]--;
        }
    }
    rep(i, 0, n){
        string tmp = s[i];
        reverse(all(tmp));
        if(tmp == s[i] && mp[s[i]] != 0){
            c.push_back(s[i]);
            mp[s[i]]--;
        }
    }
    sort(all(p));
    sort(all(c));
    string ans = "";
    rep(i, 0, p.size()){
        ans += p[i];
    }
    if(c.size() != 0){
        ans += c[0];
    }
    if(p.size() != 0){
        repb(i, p.size() - 1, 0){
            string tmp = p[i];
            reverse(all(tmp));
            ans += tmp;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3436
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

list_tap =  list(map(int, sys.stdin.readline().split()))

A = list_tap[0]
B = list_tap[1]

cnt = 1
cnt2 = 0

for i in range (20):
    if(cnt >= B):
        break
    cnt = cnt + A - 1
    cnt2 += 1
    #if(cnt >= B):
    #    break

print(cnt2)


Measured memory_bytes: 5588
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
int n,m;
vector<int> c[25];
int u[25];
queue<int> Q;
int main(){
	cin>>n>>m;
	for(int i=0;i<n;i++){
		u[i]=0;
	}
	for(int i=0;i<m;i++){
		int a,b;cin>>a>>b;a--,b--;
		c[a].push_back(b);
		u[b]++;
	}
	for(int i=0;i<n;i++){
		if(u[i]==0)Q.push(i);
	}
	while(!Q.empty()){
		int Qtop=Q.front();
		cout<<Qtop+1<<endl;
		for(int i=0;i<c[Qtop].size();i++){
			u[c[Qtop][i]]--;
			if(u[c[Qtop][i]]==0){
				Q.push(c[Qtop][i]);
			}
		}
		Q.pop();
	}
	return 0;
}

Measured memory_bytes: 3116
#include <iostream>

using namespace std;

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

  int L = S / 100;
  int R = S % 100;

  if (L >= 1 && L <= 12) {
    if (R >= 1 && R <= 12) {
      cout << "AMBIGUOUS" << endl;
    } else {
      cout << "MMYY" << endl;
    }
  } else {
    if (R >= 1 && R <= 12) {
      cout << "YYMM" << endl;
    } else {
      cout << "NA" << endl;
    }
  }
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int n, x;
  scanf("%d %d", &n, &x);
  int ac = 0;
  int cnt = 1;
  int input;
  for(int i = 0; i < n; i++){
    scanf("%d", &input);
    ac += input;
    if(ac > x){
      break;
    }
    cnt++;
  }
  printf("%d\n", cnt);
  return 0;
}


Measured memory_bytes: 128
#include<functional>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdlib>
#include<utility>
#include<string>
#include<cstdio>
#include<vector>
#include<bitset>
#include<cmath>
#include<ctime>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// ÉÏ ×ó ÏÂ ÓÒ
const int N=100005,M=1000005,K=200005,mod=1000000007;
const long long llinf=9223372036854775807ll;
//int long long
int m,d,a,b,ans;
int main(){
	cin>>m>>d;
	for(int i=1;i<=m;i++)
		for(int j=1;j<=d;j++)
			if((j/10)*(j%10)==i&&(j/10)>1&&(j%10)>1)
				ans++;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <climits>
#include <algorithm>
#include <vector>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <cassert>

using namespace std;

#define    watch(x); cout << "\n" <<  #x << " is: " << x << "\n";
#define    all(a) (a).begin(), (a).end()
#define    fi first
#define    se second

template<class A, class B>
ostream& operator << (ostream& output, const pair<A, B>& p) {
    output << "(" << p.first << ", " << p.second << ")";
    return output;
}

template<class A>
ostream& operator << (ostream& output, const vector<A>& a) {
    output << "[";
    for(auto it = a.begin(); it != a.end(); ++it) {
        if(it != a.begin()) {
            output << ", ";
        }
        output << *it;
    }
    output << "]";
    return output;
}

using lld = long long;
using pii = pair<int, int>;
using pll = pair<lld, lld>;

//const int inf = 1e9;
//const int mod = 1e9 + 7;
//const double PI = acos(-1.0);
//const int mx = 1e5 + 5;



int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif

    string s;
    cin >> s;
    int n = s.size();
    stack<char> st;
    int count = 0;
    for(int i = 0; i < n; ++i) {
        if(!st.empty()) {
            char ch = s[i];
            if(st.top() == '0' && ch == '1') {
                st.pop();
                count += 2;
            }
            else if(st.top() == '1' && ch == '0') {
                st.pop();
                count += 2;
            }
            else {
                st.push(ch);
            }
        }
        else {
            st.push(s[i]);
        }
    }
    cout << count << '\n';
    return 0;
}


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

int main(){
    int n,m,cnt=0;;
    cin >> n >> m;
    vector<int> road(2*m);
    for(int i=0;i<2*m;i++)
        cin >> road.at(i);
    for(int i=1;i<n+1;i++){
        cnt=0;
        for(int j=0;j<2*m;j++)
            if(road.at(j)==i)
                cnt++;
        cout << cnt << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
 
signed main(){
	int n;
	cin >> n;
	int ans = 1;
	
	for(int i = 1; i <= n; i++){
		ans = (ans * i) % 1000000007;
	}
	
	cout << ans << endl;
}

Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    s = [input() for i in range(n)]
    ke = ["AC", "WA", "TLE", "RE"]
    d = {k:0 for k in ke}
    for i in s:
        d[i] += 1
    for k in ke:
        print(k+" x "+str(d[k]))
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 78720
n=int(input())
s=[]
ans=-1
for i in range(n):
    s.append(int(input()))
sums=sum(s)
if sums%10!=0:
    print(sums)
    exit()
for i in range(n):
    tmp=0 if (sums-s[i])%10==0 else sums-s[i]
    ans=max(ans,tmp)
print(ans)

Measured memory_bytes: 9124
#include <cstdio>
#include <iostream>
#include <map>
#include <utility>
using namespace std;
int main(){
    int n,a;
    cin >> n;
    map<int,int> m;
    for(int i=0;i<n;i++){
        cin >> a;
        m[a]=i+1;
    }
    auto itr = m.begin();
    cout << itr->second << " ";
    for(int i=0;i<n-1;i++){
        itr = next(itr,1);
        cout << itr->second << " ";
    }
}

Measured memory_bytes: 5504
def solve(n, m):
    ans = [-1] * n
    for _ in range(m):
        s, c = input().split()
        s = int(s) - 1
        if ans[s] == c:
            continue
        elif ans[s] == -1:
            ans[s] = c
        else:
            return -1

    if ans[0] == '0':
        if n == 1:
            return '0'
        else:
            return -1
    elif ans[0] == -1:
        if n == 1:
            return '0'
        else:
            ans[0] = '1'
    for i in range(1, n):
        if ans[i] == -1:
            ans[i] = '0'
    return ''.join(ans)


n, m = list(map(int, input().split()))
print(solve(n, m))


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define N 405
#define M 1000000007
#define ll long long
#define inf 1000000000000000000
ll n, arr[N], sum[N], dp[N][N];



int main()
{
    cin >> n;
    for(int i = 1; i <= n; i++) {
        cin >> arr[i];
        sum[i] = sum[i - 1] + arr[i];
        //dp[i][i] = arr[i];
    }
    for(int j = 2; j <= n; j++)
    {
        for(int i = 1; i <= n - j + 1; i++)
        {
            int id = i + j - 1;
            dp[i][id] = 1000000000000000000LL;
            for(int  k = i; k < id; k++)
            {
                dp[i][id] = min(dp[i][id], dp[i][k] + dp[k + 1][id] + sum[id] - sum[i - 1]);
            }
        }
    }
    cout << dp[1][n] << endl;
}




Measured memory_bytes: 1536
#include <stdio.h>
#include <iostream>
#include <vector>
#include<algorithm>
using namespace std;

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

	for (int i = 0; i < 3; i++)
		cin >> a.at(i);

	int t = 0;
	for (int i = 0; i < 3; i++)
	{
		t += a.at(i) == 5 ? 1 : 0;
		t += a.at(i) == 7 ? 10 : 0;
	}
	if (t == 12)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <complex>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 300010

int ans[SIZE];

bool solve(int n, int a, int b){

  if(n + 1 < a + b){
    return false;
  }

  int t = n;
  int used[SIZE] = {};


  for(int i=0;i<n-b;){
    b--;
    int rest = (n-b) - i;
    t -= min(a,rest);
    for(int j=0;j<min(a,rest);j++){
      int q = t + 1 + j;
      ans[i] = q;
      used[q] = true;
      i++;
    }
  }

  if(t < 0 || b < 0){
    return false;
  }
  
  int k = n;
  
  for(int i=n-b;i<n;i++){
    while(used[k]) k--;
    ans[i] = k;
    used[k] = true;
  }
  
  return true;
}

int main(){
  int n, a, b;

  scanf("%d%d%d",&n,&a,&b);

  if(solve(n,a,b)){
    for(int i=0;i<n;i++){
      printf("%d%c",ans[i], " \n"[i+1==n]);
    }
  } else {
    puts("-1");
  }
  
  return 0;
}



Measured memory_bytes: 4480
tenki = input()

if tenki == "RRR":
    print("3")
elif tenki == "RRS":
    print("2")
elif  tenki == "RSR":
    print("1")
elif tenki == "RSS":
    print("1")
elif tenki == "SRR":
    print("2")
elif tenki == "SRS":
    print("1")
elif tenki == "SSR":
    print("1")
elif tenki == "SSS":
    print("0")


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

const ll MAXN = 200000;
const ll INF = 1001001001;

ll N, ans=0, tmp=0;
vector<vector<ll>> A, B;
signed main(){
    cin >> N;
    A.resize(N);
    B.resize(N);
    for(int i=0;i<N;i++) {
        A[i].resize(N);
        B[i].resize(N,1);
    }
    for(int i=0;i<N;i++) {
        for(int j=0;j<N;j++) {
            cin >> A[i][j];
        }
    }
    //cout << ans << endl;
    for(int k=0;k<N;k++) {
        for(int i=0;i<N;i++) {
            for(int j=0;j<N;j++) {
                if(k==i||k==j) continue;
                if(A[i][j]>A[i][k]+A[k][j]) {
                    cout << -1 << endl;
                    return 0;
                }
                if(A[i][j]==A[i][k]+A[k][j]) {
                    B[i][j] = 0;
                    B[j][i] = 0;
                }
            }
        }
    }
    for(int i=0;i<N;i++) {
        for(int j=0;j<N;j++) {
            if(B[i][j]==1) ans += A[i][j];
        }
    }
    cout << ans/2 << endl;
    return 0;
}

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

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

    if (K % 2 == 0) {
        std::cout << (K / 2) * (K / 2) << std::endl;
    } else {
        std::cout << (K / 2 + 1) * (K / 2) << std::endl;
    }

    return 0;
}


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

int main(void)
{
	long int i, n, time, t[200000];
	unsigned long int ans = 0;
	int j;
	scanf("%ld %ld", &n, &time);
	for(i = 0; i < n; i++){
		j = scanf("%ld", &t[i]);
	}
	for(i = 1; i < n; i++){
		if (time <= t[i] - t[i-1])
			ans = ans + time;
		else
			ans = ans + t[i] - t[i-1];
	}
	ans = ans + time;
	printf("%lu", ans);
	return 0;
}

Measured memory_bytes: 1664
#include<stdio.h>
void trace(int A[],int n){
    int i;
    for(i=1;i<=n;i++){
	if(i!=1) printf(" ");
	printf("%d",A[i]);
    }
    printf("\n");
}

int main(void){
    int n,i,j;
    int A[100000];
    int ans;
	while(1){    
	    scanf("%d",&n);
	    if(n==0) break;
	    
	    A[0]=-1;
	    for(i=1;i<=n;i++){
		scanf("%d",&A[i]);

		if(i%2==0){
		    if(A[i-1]!=A[i]){
			j=i-1;
			while(A[j]!=A[i]){
			    A[j]=A[i];
			    j--;
			}
		    }
		}

//		trace(A,i);
	    }

	    ans=0;
	    for(i=1;i<=n;i++){
		if(A[i]==0) ans++;
	    }
	    printf("%d\n",ans);
	}

    return 0;
}

Measured memory_bytes: 992
N=int(input())
A=list(map(int,input().split()))

#素数
def primes(n):
    n, correction = n-n%6+6, 2-(n%6>1)
    sieve = [True] * (n//3)
    for i in range(1, int(n**0.5)//3+1):
        if sieve[i]:
            k = 3*i+1|1
            sieve[k*k//3::2*k] = [False] * ((n//6-k*k//6-1)//k+1)
            sieve[k*(k-2*(i&1)+4)//3::2*k] = [False] * ((n//6-k*(k-2*(i&1)+4)//6-1)//k+1)
    return [2, 3] + [3*i+1|1 for i in range(1, n//3-correction) if sieve[i]]

primes=primes(int(1000))
points=[0]*1000001

from math import gcd
pairprime_flag=True
allgcd=A[0]
allprime=set()

for a in A:
    allgcd=gcd(allgcd,a)
    if pairprime_flag:
        for i in primes:
            if a%i==0:
                if points[i]==1:
                    pairprime_flag=False
                points[i]=1
                while a%i==0:
                    a//=i
            if a==1:
                break
        if a!=1:
            if points[a]!=0:
                pairprime_flag=False
            else:
                points[a]=1

if pairprime_flag:
    print('pairwise coprime')
elif allgcd==1:
    print('setwise coprime')
else:
    print('not coprime')


Measured memory_bytes: 189572
n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(1, n-1):
    if (p[i-1] < p[i] and p[i+1] > p[i]) or (p[i-1] > p[i] and p[i+1] < p[i]):
        ans += 1
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;

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

    size_t n, m = 0;
    cin >> n; // 店の件数.
    cin >> m; // 必要なドリンク数.
    assert(1 <= n && n <= pow(10, 5));
    assert(1 <= m && m <= pow(10, 5));

    map<int64_t, size_t> price_and_num;
    for(size_t i = 0; i < n; ++i)
    {
        int64_t price;
        size_t num;
        cin >> price;
        cin >> num;
        assert(1 <= price && price <= pow(10, 9));
        assert(1 <= num && num <= pow(10, 5));

        if (price_and_num.find(price) != price_and_num.end()) {
            price_and_num[price] += num;
        } else {
            price_and_num[price] = num;
        }
    }

    int64_t price_sum = 0;
    size_t current_num = 0;
    for (auto itr = price_and_num.begin(); itr != price_and_num.end(); ++itr)
    {
        if ((current_num + itr->second) < m) {
            // 必要個数を超えない場合.
            price_sum += itr->first * itr->second;
            current_num += itr->second;
            //cout << current_num << " " << price_sum << endl;
        } else {
            // 必要個数を超える場合(この際のみ二重のforループ).
            for(size_t i = 0; i < itr->second; ++i)
            {
                price_sum += itr->first;
                current_num++;
                //cout << current_num << " " << price_sum << endl;
                if (current_num == m) {
                    break;
                }
                assert(current_num <= m);
            }
            break;
        }
    }

    assert(current_num == m);
    cout << price_sum << endl;
}

Measured memory_bytes: 6528
#include<iostream>

using namespace std;

int main(){
	long long r, d, x2000, res;
	cin >> r >> d >> x2000;
	res = x2000;
	for(int i = 0; i < 10; i++){
		res = res * r - d;
		cout << res << '\n';
	}

	return 0;
}


Measured memory_bytes: 256
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

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

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

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

const inf = 1001001001001

func main() {
	sc.Split(bufio.ScanWords)
	N, C := getInt(), getInt()
	d := make([][]int, C)
	for i := 0; i < C; i++ {
		d[i] = make([]int, C)
		for j := 0; j < C; j++ {
			d[i][j] = getInt()
		}
	}
	c := make([][]int, N)
	for i := 0; i < N; i++ {
		c[i] = make([]int, N)
		for j := 0; j < N; j++ {
			c[i][j] = getInt() - 1
		}
	}

	var n [3][]int
	for i := 0; i < N; i++ {
		for j := 0; j < N; j++ {
			pos := ((i + 1) + (j + 1)) % 3
			n[pos] = append(n[pos], c[i][j])
		}
	}
	// out(n)

	var ans [3][30]int

	for i := 0; i < 3; i++ {
		for j := 0; j < C; j++ {
			cost := 0
			for _, v := range n[i] {
				cost += d[v][j]
			}
			ans[i][j] = cost
		}
	}
	// for i := 0; i < 3; i++ {
	// 	out(ans[i][:C])
	// }

	ret := inf
	for i := 0; i < C; i++ {
		for j := 0; j < C; j++ {
			if i == j {
				continue
			}
			for k := 0; k < C; k++ {
				if j == k || i == k {
					continue
				}
				x := ans[0][i] + ans[1][j] + ans[2][k]
				ret = min(ret, x)
			}

		}
	}
	out(ret)
}


Measured memory_bytes: 10496
n=int(input())
a=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97]
b=[0]*25
for i in range(1,n):
    m=i+1
    for j in a:
        while m%j==0:
            b[a.index(j)]+=1
            m//=j
sf=tf=ft=f=t=0
for i in b:
    if i>73:sf+=1
    if i>23:tf+=1
    if i>13:ft+=1
    if i>3:f+=1
    if i>1:t+=1
ans=sf
ans+=tf*(t-1)
ans+=ft*(f-1)
ans+=f*(f-1)*(t-2)//2
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template < typename T > string tost( const T& n ) { ostringstream stm; stm << n; return stm.str();}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
int const INF = 1001001001;


int main()
{
cin.tie(0);
ios::sync_with_stdio(false);
int a,b;
cin >> a >> b;
int ans = -INF;
chmax(ans, a+b);
chmax(ans, a-b);
chmax(ans, a*b);
cout << ans << endl;
return 0;
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
_ans=0

for _ in range(N-1):
    if A[_]+1==A[_+1]:
        _ans+=C[A[_]-1]
print(sum(B)+_ans)

Measured memory_bytes: 3064
n=int(input())
s=[input() for i in range(n)]
m=int(input())
t=[input() for i in range(m)]

d={}
for i in s:
  d[i]=d.get(i,0)+1
for i in t:
  d[i]=d.get(i,0)-1
ans=max(0,max(d.values()))
print(ans)



Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);
#define openfiles ifstream in("input.txt");ofstream out("output.txt");
const int inf=2e9;
const ll infll=1e18;
typedef pair<int,int> pii;
openfiles;
///---------------------------------------------------------------------------

int n;
vector<int> vec;

void init()
{
    faster;
    cin>>n;
    vec.resize(n);
    for(int i=0;i<n;i++)
        cin>>vec[i];

}
void solve()
{
    int sum=0;
    for(int i=0;i<n;i++)
    {
        sum+=vec[i];
    }
    bool b=1;
    for(int i=0;i<n;i++)
    {
        if(vec[i]>=sum-vec[i])
            b=0;
    }
    if(b)
        cout<<"Yes";
    else
        cout<<"No";
}

signed main()
{
    init();
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
#define all(v) (v).begin(), (v).end()
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

char D[9];
int N, K;

bool check(int x) {
	string xs = to_string(x);
	rep(i, 0, xs.size()) {
		rep(j, 0, K) {
			if(xs[i] == D[j]) return false;
		}
	}
	return true;
}

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

	cin >> N >> K;
	rep(i, 0, K) cin >> D[i];

	while(true) {
		if(check(N)) {
			cout << N << endl;
			return 0;
		}
		N++;
	}
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  static int i, j, k;
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    // Scanner scanString = new Scanner(System.in);
    int N = Integer.parseInt(scanner.nextLine());
    Card[] cards_1 = new Card[N];
    Card[] cards_2 = new Card[N];
    String[] str = scanner.nextLine().split(" ");
    for(i = 0; i < N; i++){
       char[] chr = str[i].toCharArray();
       cards_1[i] = new Card(chr[0], Character.getNumericValue(chr[1]));
       cards_2[i] = new Card(chr[0], Character.getNumericValue(chr[1]));
    }
    bubble(cards_1);
    select(cards_2);
  }

  public static void bubble(Card[] cards){
    for(i = 0; i < cards.length; i++){
      for(j = cards.length - 1; j > i; j--){
        if(cards[j].value < cards[j-1].value){
          Card dum = cards[j];
          cards[j] = cards[j-1];
          cards[j-1] = dum;
        }
      }
    }
    print(cards);
    System.out.println("Stable");
  }

  public static void select(Card[] cards){
    String stability = "Stable";
    for(i = 0; i < cards.length - 1; i++){
      int min = i;
      for(j = i; j <= cards.length - 1; j++){
        if(cards[min].value > cards[j].value){
          min = j;
        }
      }
      if(min != i){
        Card dum = cards[min];
        cards[min] = cards[i];
        cards[i] = dum;
        if(i+1 != min){
          for(k = i+1; k < min; k++){
            if((cards[i].value == cards[k].value) || (cards[min].value == cards[k].value)) stability = "Not stable";
          }
        }
      }
    }
    print(cards);
    System.out.println(stability);
  }

  public static void print(Card[] cards){
    for(i = 0; i < cards.length - 1; i++){
      System.out.print(cards[i].suit);
      System.out.print(cards[i].value + " ");
    }
    System.out.print(cards[cards.length-1].suit);
    System.out.println(cards[cards.length-1].value);
  }

  static class Card {
    char suit;
    int value;

    Card(char suit, int value){
      this.suit = suit;
      this.value = value;
    }
  }
}



Measured memory_bytes: 26292
//TLEしなかったらAOJが神になった証

#include "bits/stdc++.h"
using namespace std;
#define int long long
int mod=1e9+7;

signed main(){
  while(true){
    int n,m,s;
    cin>>n>>m>>s;
    if(n==0&&m==0&&s==0)break;
    vector<vector<int> > dp(n*n+1,vector<int>(s+1,0));
    dp[0][0]=1;
    for(int i=1;i<=m;i++){
      for(int j=n*n-1;j>=0;j--){
        for(int k=0;k<s;k++){
          if(k+i<=s)(dp[j+1][k+i]+=dp[j][k])%=100000;
        }
      }
    }
    cout<<dp[n*n][s]<<endl;
    /*
    vector<vector<vector<int> > > dp(n*n+1,vector<vector<int> >(s+1,vector<int>(m+1,0)));
    dp[0][0][0]=1;
    for(int i=0;i<n*n;i++){
      for(int j=0;j<s;j++){
        for(int k=0;k<m;k++){
          for(int l=k+1;l<=m;l++){
            if(j+l<=s)(dp[i+1][j+l][l]+=dp[i][j][k])%=100000;
          }
        }
      }
    }
    int ans=0;
    for(int i=1;i<=m;i++)(ans+=dp[n*n][s][i])%=100000;
    cout<<ans<<endl;
    */
  }
}



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

using namespace std;

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

    map<string, int> m;

    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        m[s] += 1;
    }

    int x = 0;
    vector<string> a;

    for (auto e : m) {
        if (e.second > x) {
            a.clear();
            a.push_back(e.first);
            x = e.second;
        } else if (e.second == x) {
           a.push_back(e.first);
        }
    }

    for (auto e : a) {
        cout << e << endl;
    }

    return 0;
}


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

using namespace std;

int main(){
   int A, B;
   int sum,diff,kake;

   cin >> A >> B;

   sum  = A + B;
   diff = A -B;
   kake = A * B; 

   int max = sum;

   if(sum < diff){
       max = diff;
       if(diff < kake){
           max = kake;
       }
   }else if(sum < kake){
       max = kake;
        if(kake < diff){
            max = diff;
        }
   }

   cout << max << endl;

}

Measured memory_bytes: 256