akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
    long long int L, R;
    cin >> L >> R;
    int ans = 2019;
    for(long long int i = L; i <= R; i++) {
        if(i - L == 2019) {
            break;
        }
        for(long long int j = i+1; j <= R; j++) {
            if(j - (i+1) == 2019) {
                break;
            }
            int I = i % 2019;
            int J = j % 2019;
            int tmp = (I * J) % 2019;
            ans = min(ans, tmp);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

int main(){
   int N;
   std::cin >> N;
   std::map<std::string, int> mp;
   std::string S;
   for(int i=0; i<N; ++i){
      std::cin >> S;
      mp[S] += 1;
   }
   int max = 0;
   for(const auto& x : mp){
      max = std::max(max, x.second);
   }
   for(auto itr=mp.begin(); itr!=mp.end(); ++itr){
      if(itr->second==max)
	 std::cout << itr->first << std::endl;
   }
   return 0;
}


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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
ll T;
ll N, A[1010];
char S[1010];

ll i, j, k;

void q(){
    scanf("%lld", &N);
    fornum(i,0,N){
        scanf("%lld", &A[i]);
    }
    scanf("%s", S);
    vector<vector<ll>> dp(N + 5, vector<ll>(N + 5));
    vector<ll> mk(90);
    i = N;
    while(i){
        --i;
        ll a = A[i];
        if(S[i]=='0'){
            fornum(j,0,90){
                if(a>>j==0)
                    break;
                if((a>>j)&1){
                    if(mk[j]==0){
                        mk[j] = a;
                        break;
                    }
                    a ^= mk[j];
                }
            }
        }else{
            fornum(j,0,90){
                if((a>>j)==0)
                    break;
                if((a>>j)&1){
                    if(mk[j]==0){
                        printf("1\n");
                        return;
                    }
                    a ^= mk[j];
                }
            }
        }
        //fornum(j,0,10){
        //    printf("%lld ", mk[j]);
        //}
        //printf("\n");
    }
    printf("0\n");
}

int main(){
    scanf("%lld", &T);
    while(T--){
        q();
    }
    return 0;
}

Measured memory_bytes: 3956
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int S(ll n) {
    int s = 0;
    while (n > 0) {
        s += n % 10;
        n /= 10;
    }
    return s;
}

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

    int k;
    cin >> k;

    ll t = 0, s = 1;
    while (1) {
        ll a = t + s;
        ll b = t + s * 10;
        if (a * S(b) > b * S(a)) {
            s *= 10;
        }
        t += s;
        cout << t << '\n';
        if (--k <= 0) goto exit;
    }

exit:
    cout << flush;

    return 0;
}

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

int main() {
  int n;
  cin >> n;
  
  int a;
  set<int> s;
  for(int i=0; i<n; i++) {
    cin >> a;
    s.insert(a);
  }
  cout << s.size() << endl;
  return 0;
}

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



typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;
typedef vector< vector< vector<ll> > > vvvint;
typedef vector<string> vstring;
typedef vector< vector<string> > vvstring;
typedef vector<char> vchar;
typedef vector< vector<char> > vvchar;
typedef vector<long double> vdouble;
typedef vector< vector<long double> > vvdouble;
typedef vector< vector< vector<long double> > > vvvdouble;
typedef pair<ll,ll> pint;
typedef vector<pint> vpint;
typedef vector<bool> vbool;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define ALL(obj) (obj).begin(), (obj).end()
// #define LLONG_MAX 9223372036854775806
#define vmax(vec) *max_element(vec.begin(), vec.end())
#define vmin(vec) *min_element(vec.begin(), vec.end())
#define vsort(vec) sort(vec.begin(), vec.end())
#define vsortgr(vec) sort(vec.begin(), vec.end(), greater<ll>())
#define MOD 1000000007
// #define MOD 998244353
// #define MOD LLONG_MAX
const double PI=3.14159265358979323846;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }




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



void printv(vint &v){
  for(auto e:v) cout<<e<<" ";
  cout<<endl;
}


// 繰り返し二乗法
ll power(ll a, ll b){
  if(a==1)return a;
  // if(a==0)re
  ll res=1;
  while(b>0){
    if(b&1) res=res*a%MOD;
    a=a*a%MOD;
    b>>=1;
  }
  return res;
}

const int MAX=2100000;
 
ll fact[MAX], fact_inv[MAX];
 
void init_fact(ll n){
  fact[0]=1;
  // 階乗の計算
  rep(i, n) fact[i+1]=fact[i]*(i+1)%MOD;
  fact_inv[n]=power(fact[n], MOD-2);
  // 逆元の計算
  for(ll i=n-1;i>=0;i--) fact_inv[i]=fact_inv[i+1]*(i+1)%MOD;
}
 
ll comb(ll n, ll r){
  return (fact[n]*fact_inv[r])%MOD*fact_inv[n-r]%MOD;
}
 
ll perm(ll n, ll r){
  return (fact[n]*fact_inv[n-r])%MOD;
}






int main() {
  cout<<fixed<<setprecision(10);

  ll x,y; cin>>x>>y;

  cout<<x+y/2<<endl;

}






Measured memory_bytes: 764
'''     ##     ##  #######  # #  ######
        ##     ##  ##   ##  ###    ##
        ##     ##  ##    #  # #    ##
        #########  #######  # #    ##    '''

import sys
import math
# sys.setrecursionlimit(10**6)

def get_ints(): return map(int, input().strip().split())
def get_list(): return list(get_ints())

def printspx(*args): return print(*args, end="")
def printsp(*args): return print(*args, end=" ")
def printchk(*args): return print(*args, end=" \ ")

MODPRIME = int(1e9+7); BABYMODPR = 998244353;

ONLINE_JUDGE = 1
if not ONLINE_JUDGE:
    sys.stdin = open("input.txt","r")  # <<<  Comment this line  >>> #
    sys.stdout = open("output.txt","w")  # <<<  Comment this line  >>> #
    sys.stderr = open("output.txt","w")  # <<<  Comment this line  >>> #

# for _testcases_ in range(int(input())):
li = get_list()
if sorted(li) == [5, 5, 7]:
    print("YES")
else:
    print("NO")
'''
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
THE LOGIC AND APPROACH IS BY ME @luctivud ( UDIT GUPTA )
SOME PARTS OF THE CODE HAS BEEN TAKEN FROM WEBSITES LIKE::
(I Own the code if no link is provided here or I may have missed mentioning it)
DO NOT PLAGIARISE.
TESTCASES:
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
'''

Measured memory_bytes: 38256
#include<stdio.h>

int main(){
  int a,b,c;
  int i,count=0;
  scanf("%d %d %d",&a,&b,&c);
  for(;a<=b;a++){
    if((c%a)==0){
      count++;
    }
  }
  printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 2704
#デックをインポート
from collections import deque

#前準備
n,k=[int(i) for i in input().split()]

#デックを用意
D=deque()
h=[int(i) for i in input().split()]
for i in h:
    D.append(i)   
    
#答え
maxnum=0

#繰り返す単位
times=min(n,k)

#aとbの操作の合計のlimitを設定
for limit in range(times+1):
#     print(D)
    
    #aの操作を決定
    for a in range(limit+1):
        get=[]
        Dcopy=deque()
        for i in range(n):
            Dcopy.append(D[i])
        b=limit-a
        for i in range(a):
            get.append(Dcopy.popleft())
        for i in range(b):
            get.append(Dcopy.pop())
        get.sort(reverse=True)
#         print(get)
        for i in range(k-limit):
            if len(get)==0:
                break
            if get[-1]>=0:
                break
            get.pop()
        sumnum=0
        for i in get:
            sumnum+=i
        if sumnum>maxnum:
            maxnum=sumnum
            
#         print(a,b,Dcopy,get,sumnum)
print(maxnum)

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

using namespace std;

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

	auto count = map<int, int>{};
	while (N--) {
		int A; cin >> A;

		count[A]++;
	}

	auto numbers = 0;
	for (auto &i: count) {
		numbers += (i.second % 2);
	}

	cout << numbers << endl;
}

Measured memory_bytes: 4864
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<utility>
#include<queue>
#include<deque>
#include<tuple>
#include<stdio.h>
#include<iomanip>
#define rep(i, n) for(int i=0;i<n;i++)
using namespace std;

int main(){
	int x, y;
	cin>>x>>y;
	rep(i, x+1){
		if(2*i+4*(x-i)==y){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}

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

#define all(x) (x).begin(),(x).end()
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)

typedef long long ll;
const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const double eps = 1e-9;



int main()
{
    string s, t, ans;
    int n;
    cin >> n >> s >> t;

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



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long A = sc.nextLong();
        long B = sc.nextLong();
        long rem = N % (A + B);
        long result = (N - rem) / (A + B) * A;
        if (rem - A >= 0) {
            result += A;
        } else {
            result += rem;
        }
        System.out.println(result);
    }

}


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


int main() {
	int h, w;
	cin >> h >> w;
	const int dx[] = { 1,1,0,-1,-1,-1,0,1 };
	const int dy[] = { 0,1,1,1,0,-1,-1,-1 };

	string board[50];
	for (int i = 0; i < h; ++i) cin >> board[i];
	for (int i = 0; i < h; ++i) {
		for (int j = 0; j < w; ++j) {
			if (board[i][j] == '#') continue;
				int num = 0;
				for (int d = 0; d < 8; ++d) {
					const int ni = i + dy[d];
					const int nj = j + dx[d];
					if (ni < 0 or h <= ni) continue;
					if (nj < 0 or w <= nj) continue;
					if (board[ni][nj] == '#') num++;
				}
				board[i][j] = char(num + '0');
		}
	}
for (int i = 0; i < h; ++i) cout << board[i] << endl;

}

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

using namespace std;

int main() {
	int n;
	cin>>n;
	int k;
	bool flag = false;
	for(int i = 0; i<n; i++) {
		cin>>k;
		if(!flag && k % 2 == 0)
		 {
		    if(k % 3 == 0 || k % 5 == 0)	continue;
		    else flag = true;
		 }
	}
	if(flag) cout<<"DENIED"<<endl;
	else cout<<"APPROVED"<<endl;
	return 0;
}
	


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast;

long long mod = 1000000007;

long long div(long long a, long long b, long long c){
    return b / c - (a - 1) / c;
}

int main() {
    int n, max = 0, c = 0;
    cin >> n;
    vector<long> as(n);
    map<int, int> cnt;
    for (int i = 0; i < n; i++){
        cin >> as[i];
    }
    for (int i = 0; i < n - 1; i++){
        if (as[i] >= as[i + 1]){
            c++;
            if (c > max){
                max = c;
            }
        }else{
            c = 0;
        }
        //cout << c << endl;
    }
    cout << max << endl;
}

Measured memory_bytes: 1152
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
n = I()
print((n*(n+1))//2)
#B

#C

#D
"""
s = S()
l = len(s)
for i in range(l-1):
    if s[i] == s[i+1]:
        print(i+1,i+2)
        quit()
for i in range(l-2):
    if s[i] == s[i+2]:
        print(i+1,i+3)
        quit()
print(-1,-1)
"""

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T


Measured memory_bytes: 38512
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repa(i, s, n) for(int i = s; i < (int)n; i++)
using namespace std;
using ll = long long;
typedef vector<int> vi;

int main(){
	string s, t;
    cin >> s >> t;
    ll cnt = 0;
    for(ll i = 0; i < s.size(); i++){
        if(s[i] != t[i]) cnt++;
    }

    cout << cnt;
    return 0;
}

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

int H, W, K, dp[110][110];

int main()
{
    cin>>H>>W>>K;
    dp[0][1]=1;
    for(int i=1; i<=H; ++i)
        for(int k=0; k<1<<(W-1); ++k) if (!(k&k/2))
            for(int m=k<<1, j=1; j<=W; ++j)
                (dp[i][j]+=dp[i-1][m>>j&1 ? j+1 : m>>(j-1)&1 ? j-1 : j])%=1000000007;
    cout<<dp[H][K]<<endl;
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

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

    OP((n * (n - 1)) / 2);
    return 0;
}

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

using namespace std;

int main()
{
  int w, d;
  while(cin >> w >> d, w || d){
    int cnt[2][22] = {{0}};
    int h;
    for(int i = 0; i < w; i++) cin >> h, cnt[0][h]++;
    for(int i = 0; i < d; i++) cin >> h, cnt[1][h]++;
    int ans = 0;
    for(int i = 1; i <= 20; i++){
      ans += cnt[0][i]*i;
      cnt[1][i] = max(0, cnt[1][i]-cnt[0][i]);
    }
    for(int i = 1; i <= 20; i++) ans += cnt[1][i]*i;
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>//復習必須
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#define rep(i, n) for (int i = 0; i < n; ++i)
using ll = long long;
using namespace std;
#define P pair<int, int>
int main () {
    string s ;
    cin >>  s;
    if(s == "ARC"){
        cout << "ABC" << endl;
    }else{
        cout << "ARC" << endl;
    }
    
    return 0 ;
}

 


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;


#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    ll n;
    cin>>n;
    ll ans=n-1;
    for (ll i = 1; i <= sqrt(n); i++)
    {
        if(n%i==0)
        {
            ll j=n/i;
            ans=min(ans,i+j-2);
        }
    }
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll          long long int
#define uu          first
#define vv          second
#define pii         pair<int,int>
#define pll         pair<ll,ll>
#define INF         1e9
#define fastRead    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;

const int MAX = 1e6 + 6;

int n;
ll a[MAX] , b[MAX];

int main()
{
    fastRead;
    int n;
    cin>>n;
    for(int i = 0 ; i < n ; i++ ) cin>>a[i]>>b[i];
    
    ll ans = 0;
    
    for(int i = n-1 ; i >=0 ; i-- ) {
        
        a[i] += ans;
        
        int rem = a[i]%b[i];
        
        if(rem == 0 ) continue;
        
        ans += b[i] - rem;
    }
    
    cout<<ans<<'\n';
    return 0;
    
}

Measured memory_bytes: 5120
# include<iostream>
# include<vector>
using namespace std;
using vector1 = vector<int>;
using vector2 = vector<vector1>;
int last(int d, int j, vector2 t){
  for(int i=1; i<=d; i++){
    if(t[i][j] == j) return i;
  }
  return 0;
}
int down(vector1 c, int d, int p, vector2 t){
  int m = 0;
  for(int i=1; i<p; i++){
    m += c[i] * (d - last(d, i, t));
  }
  return m;
}
int main(){
  int D; cin >> D;
  vector1 c(26+1, 0); for(int i=1; i<=26; i++) cin >> c[i];
  vector2 s(D+1, vector1(26+1));
  for(int i=1; i<=D; i++){
    for(int j=1; j<=26; j++){
      cin >> s[i][j];
    }
  }

  vector2 S_(D+1, vector1(26+1));
  vector2 t(D+1, vector1(26+1));

  for(int i=0; i<=D; i++) S_[i][0] = 0;
  for(int j=0; j<=26; j++) S_[0][j] = 0;
  for(int i=1; i<=D; i++){
    S_[i][1] = S_[i-1][1] + s[i][1];
    t[i][1] = 1;
  }
  for(int i=1; i<=D; i++){
    for(int j=2; j<=26; j++){
      int new_ = S_[i-1][j] + s[i][j] - down(c, i, j, t);
      int old_ = S_[i][j-1] - c[j] * (i - last(i-1, j, t));
      if(new_ >= old_){
        S_[i][j] = new_; t[i][j] = j;
      }else{
        S_[i][j] = old_; t[i][j] = t[i][j-1];
      }
    }
  }

  for(int i=1; i<=D; i++) cout << t[i][26] <<"\n";
/*  for(auto a : t){
    for(auto b : a){
      cout << b <<"  ";
    };
    cout <<"\n";
  };
cout <<"\n";

//  cout << S_[D][26] <<"\n";
  for(auto a : S_){
    for(auto b : a){
      cout << b <<"  ";
    };
    cout <<"\n";
  };
*/
  return 0;
}


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

#define ll long long
#define N 100001
#define MX 1000000001
#define logg(a)(b) log(b)/log(a)
#define pb(x) push_back(x);
#define T int t, q=0; scanf("%d", &t); while(q++<t)
#define pi acos(-1)
#define flag bool fl=true;
#define fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0);

int main()
{

    ll a,b,n;
    cin>>a>>b;
    n=a*b;
    cout<<n<<endl;

}



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

#define PI 3.14159265359
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descSort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;

int main(void)
{
    int n,k;
    cin>>n>>k;
    vector<int> a(n);
    rep(i,0,n)cin>>a[i];

    sort(a.begin(),a.end());
    int sum=0;
    rep(i,0,k)sum+=a[i];
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 3604
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner((System.in));
        int a = sc.nextInt();
        int b = sc.nextInt();

        if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) {
            System.out.println("Possible");
        } else {
            System.out.println("Impossible");
        }

		sc.close();
	}
}


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

using namespace std;

#define fori(x) for (int i = 0; i < x; ++i)
#define forj(x) for (int j = 0; j < x; ++j)

typedef long long ll;

const int INF = 2e9 + 5;
const int alength=100100;

int main() {
	int n;
	cin>>n;
	int jpy=0;double btc=0;
	fori(n){
		double x;string s;
		cin>>x>>s;
		if(s=="JPY"){
			jpy+=x;
		}else{
			btc+=x;
		}
	}

	cout<<fixed<<setprecision(7)<<(jpy+btc*380000);
}

Measured memory_bytes: 256
N, K, S = map(int, input().split())
l = [0 for i in range(N)]

for i in range(K):
  l[i] = S
if N != K:
  if S != 1000000000:
    for j in range(K,N):
      l[j] = 1000000000
  else:
    for j in range(K,N):
      l[j] = 999999999
  
l1 = ' '.join(map(str, l))
print(l1)

Measured memory_bytes: 12056
def main():
    N = int( input())
    s = input()
    t = input()
    for i in range(N):
        check = True
        for j in range(N-i):
            if not s[i+j]  == t[j]:
                check = False
                break
        if check:
            print(i+N)
            return
    print(N*2)
if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = (1 << 30) - 1;

int N, C, D[50][50], g, color[3][50], ans = inf;

int main()
{
    cin >> N >> C;
    for (int i = 0; i < C; i++)
    {
        for (int j = 0; j < C; j++)
        {
            cin >> D[i][j];
        }
    }
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < N; j++)
        {
            cin >> g;
            color[(i + j) % 3][g - 1]++;
        }
    }
    for (int i = 0; i < C; i++)
    {
        for (int j = 0; j < C; j++)
        {
            for (int k = 0; k < C; k++)
            {
                if (i == j || j == k || k == i)
                    continue;
                int sum = 0;
                for (int l = 0; l < C; l++)
                    sum += D[l][i] * color[0][l] + D[l][j] * color[1][l] + D[l][k] * color[2][l];
                ans = min(ans, sum);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
def check(s):
	l = len(s)
	c = 1

	if l != 1:

		if l % 2 == 1:
			l -= 1

		for i in range(int(l/2)):
			if s[i] != s[0-1-i]:
				c = 0

	return c

if __name__ == '__main__':
	S = input()
	LEN = len(S)
	l = int((LEN-1)/2)

	r = l+1
	s1 = S[0:l]
	s2 = S[r:LEN]

	c = check(s1) * check(s2) * check(S)

	if c == 1:
		print('Yes')
	else:
		print('No')

Measured memory_bytes: 3064
#include <stdio.h>

int main(){                                                                                         int m, f, r;
        while(1){                                                                                           scanf(" %d %d %d", &m, &f, &r);
                if(m == -1 && f == -1 && r == -1)
                        break;
                if(m == -1 || f == -1)
                        puts("F");
                else if(m+f >= 80)
                        puts("A");
                else if(m+f >= 65)
                        puts("B");
                else if(m+f >= 50)
                        puts("C");
                else if(m+f >= 30){
                        if(r >= 50)
                                puts("C");
                        else
                                puts("D");
                        }
                else
                        puts("F");
        }
        return 0;
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define usecppio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(x) ((x).begin()),((x).end())
#define int ll
using pii = pair <int, int>;
const int mod = 1000000007;

ll modpow(ll x, ll y, ll p = mod)
{
    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;
}

int ncr(int n, int r)
{
    int a = 1, b = 1;
    for (int i = 1; i<=r; i++)
    {
        a *= i;
        a %= mod;
    }
    for (int i = n; i>=n-r+1; i--)
    {
        b *= i; b %= mod;
    }
    a = modpow(a, mod-2);
    return (b*a)%mod;
}

int32_t main()
{
    int n, a, b;
    cin >> n >> a >> b;
    int u = modpow(2,n);
    int v = ncr(n,a);
    int v2 = ncr(n, b);
    cout << (u + mod - v - v2 + mod*10 - 1 + mod)%mod;
}

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

int digitsum(int n) {
  string s = to_string(n);
  int res = 0;
  rep(i,s.size()) res += s[i] - '0';
  return res;
}

int main() {
  int n, a, b;
  cin >> n >> a >> b;
  int ans = 0;
  rep(i,n) {
    if (a <= digitsum(i+1) && digitsum(i+1) <= b) ans += (i+1);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int max=0;
  int ans=0;
  int n;
  int a,b;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> a >> b;
    if(max<a){
      max=a;
      ans=a+b;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define N 25
typedef struct{
  int p;
  int l;
  int r;
}Node;
 
void preorder(int);
void inorder(int);
void postorder(int);
 
Node T[N];
int main(){
  int n, i, j;
  int id, left, right;
  scanf("%d\n",&n);
  for(i = 0 ; i < n ; i++){
    T[i].p = -1;
    T[i].l = -1;
    T[i].r = -1;
  }
  for(i = 0 ; i < n ; i++){
    scanf("%d%d%d", &id, &left, &right);
    T[id].l = left;
    T[left].p = id;
    T[id].r = right;
    T[right].p = id;
  }
  printf("Preorder\n");
  for(i = 0 ; i < n ; i++){
    if(T[i].p == -1){
      preorder(i);
    }
  }
  printf("\n");
  printf("Inorder\n");
  for(i = 0 ; i < n ; i++){
    if(T[i].p == -1){
      inorder(i);
    }
  }
  printf("\n");
  printf("Postorder\n");
  for(i = 0 ; i < n ; i++){
    if(T[i].p == -1){
      postorder(i);
    }
  }
  printf("\n");
  return 0;
}
 
void preorder(int u)
{
  if(u == -1){
     return;
  }
  printf(" %d", u);
  preorder(T[u].l);
  preorder(T[u].r);
}
void inorder(int u)
{
  if(u == -1){
    return;
  }
  inorder(T[u].l);
  printf(" %d", u);
  inorder(T[u].r);
}
 
void postorder(int u)
{
  if(u == -1){
    return;
  }
  postorder(T[u].l);
  postorder(T[u].r);
  printf(" %d", u);
}

Measured memory_bytes: 616
/**
     *    author:  shashank_hire
    **/
#include <bits/stdc++.h>
using namespace std;
#define IOS                  \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
#define ll long long
#define ld long double
#define MOD 1000000007

// A C++ program for Dijkstra's single source shortest path algorithm. 
// The program is for adjacency matrix representation of the graph 
 
// #include <limits.h> 
// #include <stdio.h>

// Number of vertices in the graph 
ll V;

// A utility function to find the vertex with minimum distance value, from 
// the set of vertices not yet included in shortest path tree 
int minDistance(int dist[], bool sptSet[]) 
{ 
	// Initialize min value 
	int min = INT_MAX, min_index; 

	for (int v = 0; v < V; v++) 
		if (sptSet[v] == false && dist[v] <= min) 
			min = dist[v], min_index = v; 

	return min_index; 
} 

// A utility function to print the constructed distance array 
int printSolution(int dist[]) 
{ 
	// printf("Vertex \t\t Distance from Source\n"); 
	// for (int i = 0; i < V; i++) 
	// 	printf("%d \t\t %d\n", i, dist[i]); 
    if(dist[V-1]==2147483647)
        cout<<"-1\n";
    else
    cout<<dist[V-1]<<"\n";
} 

// Function that implements Dijkstra's single source shortest path algorithm 
// for a graph represented using adjacency matrix representation 
void dijkstra(int graph[1001][1001], int src) 
{ 
	int dist[V]; // The output array. dist[i] will hold the shortest 
	// distance from src to i 

	bool sptSet[V]; // sptSet[i] will be true if vertex i is included in shortest 
	// path tree or shortest distance from src to i is finalized 

	// Initialize all distances as INFINITE and stpSet[] as false 
	for (int i = 0; i < V; i++) 
		dist[i] = INT_MAX, sptSet[i] = false; 

	// Distance of source vertex from itself is always 0 
	dist[src] = 0; 

	// Find shortest path for all vertices 
	for (int count = 0; count < V - 1; count++) { 
		// Pick the minimum distance vertex from the set of vertices not 
		// yet processed. u is always equal to src in the first iteration. 
		int u = minDistance(dist, sptSet); 

		// Mark the picked vertex as processed 
		sptSet[u] = true; 

		// Update dist value of the adjacent vertices of the picked vertex. 
		for (int v = 0; v < V; v++) 

			// Update dist[v] only if is not in sptSet, there is an edge from 
			// u to v, and total weight of path from src to v through u is 
			// smaller than current value of dist[v] 
			if (!sptSet[v] && graph[u][v] && dist[u] != INT_MAX 
				&& dist[u] + graph[u][v] < dist[v]) 
				dist[v] = dist[u] + graph[u][v]; 
	} 

	// print the constructed distance array 
	printSolution(dist); 
}

int main()
{
	ll h, cnt;
	cin>>h;
	cnt=0;
	while(h)
	{
		h>>=1;
		cnt++;
	}
	cout<<(ll)pow(2, cnt) - 1LL<<"\n";
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		String strNum = String.valueOf(n);
		int sum = 0;
		for (int i = 0; i < strNum.length(); i++) {
			sum += Integer.parseInt(strNum.substring(i, i + 1));
		}
		
		if (n % sum == 0) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		scanner.close();

	}

}


Measured memory_bytes: 23764
from bisect import *
N,M=map(int,input().split())
kagi=[]
for i in range(M):
    a,b=map(int,input().split())
    C=list(map(int,input().split()))
    value=0
    for i in range(b):
        C[i]-=1
        value+=2**C[i]

    kagi.append([a,value])


dp=[[10**8 for i in range(2**N)] for m in range(M+1)]
dp[0][0]=0
for i in range(M):
    for s in range(2**N):
        dp[i+1][s]=min(dp[i][s],dp[i+1][s])
        dp[i+1][s|kagi[i][1]]=min(dp[i+1][s|kagi[i][1]],dp[i][s]+kagi[i][0])
if 10**8==dp[M][-1]:
    print(-1)
else:
    print(dp[M][-1])


Measured memory_bytes: 82008
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
import sys
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = float('inf')


a, b, t = Is()
n = (t+0.5)//a
print(int(b*n))


Measured memory_bytes: 64108
#include<stdio.h>

int main(void){
  int num;
  int a,b,c,d;
  int count=0;
  while(scanf("%d",&num)!=EOF){
    count=0;
    for(a=0;a<=9;a++){
      for(b=0;b<=9;b++){
	for(c=0;c<=9;c++){
	  for(d=0;d<=9;d++){
	    if((a+b+c+d)==num){
	      count++;
	    }
	  }
	}
      }
    }
    printf("%d\n",count);
  }
  return 0;
}

Measured memory_bytes: 0
N = 10000

A,B = [int(s) for s in input().split()]

set_a = set()
set_b = set()

for x in range(N):
  if int(x * 0.08) == A:
    set_a.add(x)
  if int(x * 0.1) == B:
    set_b.add(x)
    
print(min(set_a & set_b)) if set_a & set_b else print(-1)

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

int main()
{
	int n, num;
	char m;
	int a[1 + 13 * 4] = { 0 };
	cin >> n;
	while (n--) {
		cin >> m >> num;
		if (m == 'S')a[num] = 1;
		else if (m == 'H')a[num + 13] = 1;
		else if (m == 'C')a[num + 13 * 2] = 1;
		else a[num + 13 * 3] = 1;
	}
	for (int i = 1; i <= 52; i++) {
		if (!(a[i])) {
			if (1 <= i && i <= 13) {
				cout << "S " << i << endl;
			}
			else if (14 <= i && i <= 13 * 2) {
				cout << "H " << i - 13 << endl;
			}
			else if (13 * 2 + 1 <= i && i <= 13 * 3) {
				cout << "C " << i - 13 * 2 << endl;
			}
			else if (13 * 3 + 1 <= i && i <= 13 * 4) {
				cout << "D " << i - 13 * 3 << endl;
			}
		}
	}
    return 0;
}

Measured memory_bytes: 1160
n = int(raw_input())
S = raw_input().strip()

face_E = 0
face_W = 0
for i in S:
    if i=='E':
        face_E+=1
    else:
        face_W+=1

change = n
left_E = 0
left_W = 0
right_E = face_E
right_W = face_W
for people in S:
    if people == 'W':
        right_W -= 1
        change = min(change, left_W + right_E)
        left_W += 1
    else:
        right_E -= 1
        change = min(change, left_W + right_E)
        left_E += 1

print change

Measured memory_bytes: 3076
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;

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

    sort(a, a+3*N, greater<int>());

    long int sum = 0;
    int cnt = 0;

    for(int i = 0; i < 3*N; i++){
        if(i%2 == 1) {
            sum+= a[i];
            cnt++;
        }
        if(cnt==N) break;
    }

    cout << sum << endl;
}

Measured memory_bytes: 1408
///In the name of Almighty Allah(swt).

#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    int n,m,cunt=0;
    cin>>n;
    m = n;
    while(m!=0)
    {
        m=m/10;
        cunt++;
    }

    if(cunt <= 3)
        cout<<1000-n<<endl;
    else if(cunt == 4)
    {
        int x,p;
        if(n%1000==0)
            cout<<0<<endl;
        else{
        x = n/1000;
        p = (x+1)*1000;
        cout<<p-n<<endl; }
    }
    else if(cunt == 5)
    {
        cout<<0<<endl;
    }


    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define INF 1000000000
#define LINF 1000000000000000000
#define MOD 1000000007
#define mod 998244353
#define INF63 1061109567
#define INF127 9187201950435737471
#define UINF 18446744073709551615
#define F first
#define S second
#define ll long long
#define N 200010
using namespace std;
ll n,m,a[N],b[N];
struct SegT{
	ll l,r,val,pd,pd2;
}dp[8*N];
void build_tree(ll l,ll r,ll x)
{
	if(l>r)
	{
		return;
	}
	dp[x].l=l;
	dp[x].r=r;
	dp[x].val=0;
	dp[x].pd=0;
	dp[x].pd2=-1;
	if(l==r)
	{
		return;
	}
	ll mid=(l+r)>>1,a=x<<1;
	build_tree(l,mid,a);
	build_tree(mid+1,r,a|1);
	return;
}
void push_down(ll x)
{
	ll a=x<<1;
	dp[a].val+=dp[x].pd;
	dp[a|1].val+=dp[x].pd;
	dp[a].pd+=dp[x].pd;
	dp[a|1].pd+=dp[x].pd;
	dp[x].pd=0;
	return;
}
void push_down2(ll x)
{
	ll a=x<<1;
	dp[a].val=dp[x].val;
	dp[a|1].val=dp[a|1].l-dp[a].l+dp[x].val;
	dp[a].pd2=dp[x].pd2;
	dp[a|1].pd2=dp[x].pd2;
	dp[a].pd=0;
	dp[a|1].pd=0;
	dp[x].pd=0;
	dp[x].pd2=-1;
	return;
}
void update(ll l,ll r,ll x)
{
	if(l>r)
	{
		return;
	}
	ll tl=dp[x].l,tr=dp[x].r;
	if(tl>r||tr<l)
	{
		return;
	}
	if(dp[x].pd2!=-1)
	{
		push_down2(x);
	}
	push_down(x);
	if(l<=tl&&tr<=r)
	{
		dp[x].val++;
		dp[x].pd++;
		return;
	}
	ll mid=(tl+tr)>>1,a=x<<1;
	if(mid>=l)
	{
		update(l,r,a);
	}
	if(mid<r)
	{
		update(l,r,a|1);
	}
	dp[x].val=min(dp[a].val,dp[a|1].val);
	return;
}
ll query(ll l,ll r,ll x)
{
	if(l<0||r<0||l>=m||r>=m)
	{
		return LINF;
	}
	ll tl=dp[x].l,tr=dp[x].r;
	if(tl>r||tr<l)
	{
		return LINF;
	}
	if(dp[x].pd2!=-1)
	{
		push_down2(x);
	}
	push_down(x);
	if(l<=tl&&tr<=r)
	{
		return dp[x].val;
	}
	ll mid=(tl+tr)>>1,a=x<<1,ret=LINF;
	if(mid>=l)
	{
		ret=min(ret,query(l,r,a));
	}
	if(mid<r)
	{
		ret=min(ret,query(l,r,a|1));
	}
	dp[x].val=min(dp[a].val,dp[a|1].val);
	return ret;
}
void update2(ll l,ll r,ll x,ll val)
{
	if(l>r)
	{
		return;
	}
	ll tl=dp[x].l,tr=dp[x].r;
	if(l<=tl&&tr<=r)
	{
		dp[x].val=val+tl-l+1;
		dp[x].pd=0;
		dp[x].pd2=l;
		dp[x<<1].pd=0;
		dp[(x<<1)|1].pd=0;
		push_down2(x);
		return;
	}
	if(dp[x].pd2!=-1)
	{
		push_down2(x);
	}
	push_down(x);
	ll mid=(tl+tr)>>1,a=x<<1;
	if(mid>=l)
	{
		update2(l,r,a,val);
	}
	if(mid<r)
	{
		update2(l,r,a|1,val);
	}
	dp[x].val=min(dp[a].val,dp[a|1].val);
	return;
}
int main(){
	ll i,j;
	scanf("%lld%lld",&n,&m);
	for(i=0;i<n;i++)
	{
		scanf("%lld%lld",&a[i],&b[i]);
		a[i]--;
		b[i]--;
	}
	build_tree(0,m-1,1);
	for(i=1;i<=n;i++)
	{
		update(0,a[i-1]-1,1);
		update(b[i-1]+1,m-1,1);
		update2(a[i-1],b[i-1],1,query(a[i-1]-1,a[i-1]-1,1));
//		for(j=0;j<m;j++)
//		{
//			query(j,j,1);
//		}
		j=dp[1].val;
		if(j<INF)
		{
			printf("%lld\n",j);
		}
		else
		{
			puts("-1");
		}
	}
	return 0;
}

Measured memory_bytes: 47800
#include <stdio.h>
int main(void){
	char a='A',t='T',c='C',g='G';
  	char m,n;
  	scanf("%c\n",&m);
  	if(m==a)n=t;
  	if(m==t)n=a;
  	if(m==c)n=g;
  	if(m==g)n=c;
  	printf("%c\n",n);
  	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define downque(que) priority_queue<ll> que;
#define upque(que) priority_queue<ll, vector<int>, greater<int>> que;
typedef long long ll;
typedef vector<vector<int>> Matrix;
const int MOD = 1e9 + 7;
const int MAX = 1e7;
const int INF = numeric_limits<int>::max();



int main(){

  int a,b,c,x; cin>>a>>b>>c>>x;
  int res = 0;

  REP(i, a+1)
  {
    REP(j, b+1)
    {
      REP(k, c+1)
      {
        int num=500 * i+ 100 * j + 50 * k;
        if (num == x)
          res++;

      }
    }
}
  cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
int y[50],r,n;

bool check(double cy){
  double x=sqrt(r*r-cy*cy);
  if(cy>=0)x=r;
  int L=-x-25.9999,R=x+25.9999;

  for(int i=L;i<R;i++){
    int x1=i-24-i/25;
    double y1=y[i]-cy;
    if(x1*x1+y1*y1<r*r)return 0;
  }
  return 1;
}

int main(){
  while(1){
    cin>>r>>n;
    if(!r&&!n)break;
    for(int i=0;i<50;i++)y[i]=0;

    for(int i=0;i<n;i++){
      int x1,x2,h;
      cin>>x1>>x2>>h;
      for(int j=x1;j<x2;j++) y[j+25]=max(y[j+25],h);
    }
    double ans=0;
    while(check(ans-r))ans+=0.0009;
    cout <<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 1248
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  int ans = 0;
  for(int i = 0; i < S.size(); i++) {
    int count = 0;
    for(int j = i; j < S.size(); j++) {
      if(S.at(j) == 'A' || S.at(j) == 'C' || S.at(j) == 'G' || S.at(j) == 'T') {
        count++;
      }
      else {
        break;
      }
    }
    if(count > ans) {
      ans = count;
    }
  }
  cout << ans << endl;
}

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

//定数
const long long MOD1=1000000007;
const long long MOD2=998244353;
const long double PI=3.1415926535897932;
const long long MAXLL=9223372036854775807;
const long long INF=2305843009213693951;
const long long dx[]={0,1,0,-1,1,-1,1,-1};
const long long dy[]={1,0,-1,0,1,1,-1,-1};

//省略
#define ll long long
#define ull unsigned long long
#define ld long double
#define uld unsigned long double
#define pll pair<long long,long long>
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define vvvl vector<vector<vector<long long>>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vs vector<string>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vp vector<pair<long long,long long>>
#define umap unordered_map
#define uset unordered_set
#define Lqueue priority_queue<long long>
#define Squeue priority_queue<long long,vector<long long>,greater<long long>>
#define fi first
#define se second
#define mp make_pair
#define eb emplace_back

//マクロ
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rbf(a,x) for(auto& a:x)
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s);i<(long long)(n);i++)
#define bitrep(i,s,n) for(long long i=(s);i<(1LL<<(n));i++)
#define bitcheck(bit,i) (bit)&(1LL<<(i))
#define Maxe(x) *max_element((x).begin(),(x).end())
#define Mine(x) *min_element((x).begin(),(x).end())
#define Size(x) ((long long)(x).size())
#define Lin(s) getline(cin,(s))

//Yes,No
void Yes(bool a){cout<<(a?"Yes":"No")<<endl;}
void YES(bool a){cout<<(a?"YES":"NO")<<endl;}

//MAX,MIN
template<class T,class U> auto max(T a,U b){return a>b?a:b;}
template<class T,class U> auto min(T a,U b){return a<b?a:b;}

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

//切り上げ除算
long long cutup(long long a,long long b){return (a+b-1)/b;}

//累乗
template<typename t>
constexpr t my_pow(t a,long long b){
    if(b==0)return 1;
    if(a==0)return 0;
    t x=1;
    while(b>0){
        if(b&1LL)x*=a;
        a*=a;
        b>>=1LL;
    }
    return x;
}
#define pow my_pow

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

//組み合わせ O(r)
template<typename t>
constexpr t nCr(t n,long long r){
    if(r==0)return 1;
    if(n==0)return 0;
    if(n<r)return 0;
    t x=1;
    for(long long i=1;i<=r;i++){
        x*=n-i+1;
        x/=i;
    }
    return x;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n;
    cin>>n;
    vl A(n);
    rep(i,n)cin>>A[i];
    ll a=A[0];
    rep(i,n)a=gcd(a,A[i]);
    cout<<a<<endl;
}

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

int main(){
        int H,W;
         cin >> H >> W;
        while(H != 0){
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
            cout << "#";
            }
            cout << endl;
        }
        cout << endl;
        cin >> H >> W;
        }
        
}




Measured memory_bytes: 3096
#include <bits/stdc++.h>
#include <functional>
#include <iomanip>
using namespace std;
	
#define int long long
#define pb push_back
#define ub upper_bound
#define lb upper_bound
#define mp make_pair
#define F first
#define S second
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n) FOR(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define ve vector
#define vi vector<int>
#define vp vector<pair<int,int>>
#define vvi vector<vector<int>>

using ll = long long;
ll INF = LLONG_MAX / 4 - 100;
ll mod = 1e9 + 7;
int dx[] = {-1,0,1,0}, dy[] = {0,1,0,-1};
vector<ll> prime;
	
class fact {
public:
	int fmod = 1e9+7;
	vector<int> fac, inv;
	fact (int n, int Mod = 1e9+7) {
		fmod = Mod;
		fac = vector<int>(n,0);
		inv = vector<int>(n,0);
		fac[0] = 1; for (int i = 1; i < n; i++) fac[i] = fac[i-1] * i % fmod;
		for (int i = 0;i < n;i++) inv[i] = fact::POW(fac[i],fmod-2);
	}
	ll nCr(ll n, ll r) {return (fac[n] * inv[r] % fmod) * inv[n-r] % fmod;}
	ll POW(ll a, ll b) {ll c = 1; while (b > 0) {if (b & 1) {c = a * c%fmod;}a = a * a%fmod; b >>= 1;}return c;}
};
	
template <class T = ll> T in() {T x; cin >> x; return (x);}
void DEBUG(vector<int> a) {for(int i=0;i<a.size();i++)cout<<a[i]<<" ";cout<<endl;}
void EMP(int x) {cout<<"!!!"<<x<<"!!!"<<endl;}
ll GCD(ll a, ll b) {ll c; while (b != 0) {c = a % b; a = b; b = c;}return a;}
ll LCM(ll a, ll b) {return a * b / GCD(a, b);}
ll POW(ll a, ll b) {ll c = 1; while (b > 0) {if (b & 1) {c = a * c%mod;}a = a * a%mod; b >>= 1;}return c;}
void PRI(ll n) {bool a[n + 1LL]; for (int i = 0; i < n + 1LL; i++) {a[i] = 1LL;}for (int i = 2; i < n + 1LL; i++) {if (a[i]) {prime.pb(i); ll b = i; while (b <= n) {a[b] = 0; b += i;}}}}
template <typename T> T chmin(T& a, T b) {if(a>b)a=b;return a;}
template <typename T> T chmax(T& a, T b) {if(a<b)a=b;return b;}
bool isSqrt(ll a) {return pow(sqrt(a),2) == a ? 1 : 0;}
void YesNo(bool a) {if (a) cout << "Yes"; else cout << "No"; cout << endl;}
void yesno(bool a) {if (a) cout << "yes"; else cout << "no"; cout << endl;}
void YESNO(bool a) {if (a) cout << "YES"; else cout << "NO"; cout << endl;}
double dis(int x1, int x2, int y1, int y2) {
    return sqrt((double)abs(x1-x2)*(double)abs(x1-x2)+(double)abs(y1-y2)*(double)abs(y1-y2));
}

bool solve() {
    int a,b; cin >> a >> b;
    int A = a+b;
    int B = a-b;
    int C = a*b;
    cout << max({A,B,C}) << endl;
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
signed main(){
    int n,t;cin >> n >> t;
    int a[n];
    rep(i,n)cin >> a[i];
    int time = 0;
    int ans = 0;
    rep(i,n){
        if(time + t <= a[i]){
            ans += t;
            time = a[i];
        }
        else{
            ans += a[i]-time;
            time = a[i];

        }
        

    }
    ans += t;
    cout << ans << endl;
    //cout << time << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define  pb push_back
#define  pob pop_back
#define mp make_pair
#define db long double
#define up upper_bound
#define lb lower_bound
#define pll pair<ll,ll>
#define vll vector<ll>
#define all(a) (a).begin(),(a).end()
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define sz(x) (int)x.size()
#define endl '\n'
#define int long long
#define mod 1000000007
#define MAX 100005
using namespace std;
 
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
 
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
 
    ll a,b;
    cin >> a >> b;
    cout << ((((1^2)^3)^a)^b);
    
    return 0;
 
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <queue>
#include <sstream>
#include <unordered_map>
#include <cstring>
#include <iomanip>

using namespace std;

typedef long long ll;

const ll INF=1e9+7;

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

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

int main(){
    int N,a,b,c;
    cin>>N;
    int L[N],count=0;
    rep(i,N) cin>>L[i];
    sort(L,L+N);
    for(int i=0;i<N-2;i++){
        for(int j=i+1;j<N-1;j++){
            for(int k=j+1;k<N;k++){
                a=L[i];
                b=L[j];
                c=L[k];
                if(a<b+c&&b<a+c&&c<a+b){
                    count++;
                }
            }
        }
    }
    cout<<count<<endl;
    return 0;
}

//a=97,z=122
// 1,2,3,4,5   1,2,3 1,2,4 1,2,5, 1,3,4 1,3,5, 1,4,5, 2,3,4, 2,3,5 2,4,5 3,4,5

Measured memory_bytes: 256
import java.util.*;
public class Main{
    public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      long k = sc.nextLong();
      int[] a = new int[n];
      int[] b = new int[n];
      long sum = 0;
      TreeMap<Integer,Integer> map = new TreeMap<Integer,Integer>();
      for(int i = 0;i < n;i++){
        a[i]=sc.nextInt();
        b[i]=sc.nextInt();
        if(map.containsKey(a[i])){
          int p = map.get(a[i]);
          map.remove(a[i]);
          map.put(a[i],p+b[i]);
        }
        else map.put(a[i],b[i]);
      }
      Arrays.sort(a);
      int s = 0;
      while(s <= n-1&&sum < k){
      	sum += (long)map.get(a[s]);
        s++;
        while(s<=n-1&&a[s-1]==a[s])s++;
      }
      System.out.println(a[s-1]);
    }
}


Measured memory_bytes: 89900
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = System.Console.ReadLine().Trim().Split(' ');
            int ir = int.Parse(sS[0]);
            int iD = int.Parse(sS[1]);
            int ix = int.Parse(sS[2]);

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            List<int> lstRet = new List<int>() { ix };
            for (int i = 1; i < 11; i++)
            {
                lstRet.Add(lstRet[i - 1] * ir - iD);
            }

            // 出力
            for (int i = 1; i < 11; i++)
            {
                System.Console.WriteLine("{0}", lstRet[i].ToString().Trim());
            }

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}


Measured memory_bytes: 13268