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

#define M 1000000007
#define pb emplace_back
#define f first
#define s second
#define rep(i, st, ed) for(ll i=st; i<ed; ++i)
#define repn(i, st, ed) for(ll i=st; i<=ed; ++i)
#define repb(i, ed, st) for(ll i=ed; i>=st; --i)
#define all(v) v.begin(),v.end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define PI acosl(-1.0)
#define mp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ll> vec;
typedef vector<pll> vecp;
typedef map<ll, ll> mpll;


const int N = 1e5 + 10;
const ll INF = 1LL << 60;

template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << to_string(H) << endl;
  debug_out(T...);
}
#define LOCAL 3
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:" << endl, debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif



void solve()
{
	ll h, w, a, b;
	cin>>h>>w>>a>>b;
	rep(i, 0, h-b)
	{
		rep(j, 0, a) cout<<0;
		rep(j, a, w) cout<<1;
		cout<<endl;
	}
	rep(i, h-b, h)
	{
		rep(j, 0, a) cout<<1;
		rep(j, a, w) cout<<0;
		cout<<endl;
	}
}


int main()
{
    ll Tests = 1;
    //cin>>Tests;
    while(Tests--)
    {
        solve();
    }
    return 0;
}

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

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> a(N), b(N);
    rep (i, N) cin >> a.at(i) >> b.at(i);
    vector<int> c(M), d(M);
    rep (i, M) cin >> c.at(i) >> d.at(i);

    
    rep(i, N){
        int dis = inf;
        int chk;
        rep(j, M){
            if (abs(a.at(i) - c.at(j)) + abs(b.at(i) - d.at(j)) < dis) 
                {
                    chk = j + 1;
                    dis = abs(a.at(i) - c.at(j)) + abs(b.at(i) - d.at(j));
                }
        }
        cout << chk << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) ((int)(x).size())
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

int calc(int N) //0^1^...^N
{
    int res=0;
    for(int i=N/4*4;i<=N;i++) res^=i;
    return res;
}

signed main()
{
    int A,B; cin>>A>>B;
    if(A==0) cout<<calc(B)<<endl;
    else cout<<(calc(B)^calc(A-1))<<endl;
}


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

int main() {
    
    
    
    int n,m;
    cin>>n>>m;
    
    unordered_map<int,int> wa,ac;
    
    int correct=0,penalty=0;
    
    for(int i=0;i<m;i++){
        int q;
        cin>>q;
        
        string s;
        cin>>s;
        
        if(s[0]=='W' && s[1]=='A')
        wa[q]++;
        
        if(s[0]=='A' && s[1]=='C')
        ac[q]++;
        
        if(ac[q]==1 && s[0]=='A' && s[1]=='C' ){
            correct++;
            if(wa[q]!=0)
            penalty+=(wa[q]);
        }
        
        
        
        
    }    
        
    
    std::cout << correct << " " << penalty << std::endl;
    
    
	return 0;
}

Measured memory_bytes: 8520
#include <iostream>

using namespace std;

int main() {
    long long int X;
    cin >> X;
    
    long long int l=0, r=1e9;
    long long int mid;
    while(r-l>1) {
        mid = (l+r)/2;
        
        if(mid*(mid+1)/2<X) {
            l = mid;
        } else if(mid*(mid+1)>X) {
            r = mid;
        } else {
            break;
        }
    }

    cout << (l+1+r)/2 << endl;


    return 0;
    
}

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

int main(){
  int N, X, D, count, i;
  count = 1;
  D = 0;
  cin >> N >> X;
  
  int L[N];
  for(i=0;i<N;i++){
    cin >> L[i];
    D += L[i];
    if(D <= X){
      count++;
    }else{
      break;
    }
  }
  cout << count;
  return 0;
}

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

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


Measured memory_bytes: 3092
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		//簡単のため入力のチェックはしない
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		if(100 < n || n <= 0){
			System.out.println("不正な入力です");
			System.exit(0);
		}
		
		String[] stringSequence = new String[n];
		for(int i = 0; i < n; i++){
			stringSequence[i] = sc.next();
		}
		
		for(int i = n - 1; i >= 0; i--){
			switch(i){
			case 0:
				System.out.printf("%s\n", stringSequence[i]);
				break;
			default:	
				System.out.printf("%s ", stringSequence[i]);
				break;
			}
		}
	}
}


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

int main() {
  int l, r, d;
  cin >> l >> r >> d;
  int cnt = 0;
  for (int i = l; i <= r; i++) {
    if (i % d == 0) cnt++;
  }
  cout << cnt << endl;
}


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

#整数値龍力　複数の入力
def input_multiple_number():
    return map(int, input().split())

a,b,c = input_multiple_number()


if c-a-b < 0:
	print("No")
elif 4*a*b < (c-a-b)**2:
	print("Yes")
else:
	print("No")

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

const int MAX_N = 10;
int N, A, B, C;
int L[MAX_N];
int tmp[MAX_N];
int n;

ll cal(int* st, int s, int t, int goal)
{
	ll ans = 10*(t-s);
	ll len = 0;
	for(int i=s;i<=t;++i)len+=st[i];
	ans += abs(len-goal);
	return ans;
}

void solve()
{
	ll ans = 1e18;
	for(int i=1;i<(1<<N);++i)if(__builtin_popcount(i) >= 3){
	    n = 0;
	    for(int j=0;j<N;++j)if(i>>j&1)tmp[n++]=L[j];
    	sort(tmp,tmp+n);
    	do{
    		for(int i=0;i<n;++i)for(int j=i+1;j+1<n;++j){
    			ans = min(ans, cal(tmp,0,i,A)+cal(tmp,i+1,j,B)+cal(tmp,j+1,n-1,C));
    		}
    	}while(next_permutation(tmp,tmp+n));
	}
	cout << ans << '\n';
}

int main()
{
	cin >> N >> A >> B >> C;
	for(int i=0;i<N;++i) cin >> L[i];
	solve();
	return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ff first
#define ss second
#define pb push_back

#define N 100010
#define MOD 1000000007

int n, m;

ll a, b, c, d;

ll gcd(ll i, ll j)
{
	if(j == 0)
		return i;
	return gcd(j, i % j);
}
ll lcm(ll i, ll j)
{
	return (i * j)/gcd(i , j);
}

ll divi(ll k)
{
	ll ans = 0, c1, c2, n1 = a, n2 = b;
	c1 = (a % k ? k - (a % k) : 0);
	c2 = (b % k ? (b % k) : 0);
	n1 += c1, n2 -= c2;
	if(n1 > n2)
		ans = 0;
	else
		ans = (n2 - n1)/k + 1;
	return ans;  
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	cin >> a >> b >> c >> d;
	ll k1 = divi(c);
	ll k2 = divi(d);
	ll k3 = divi(lcm(c, d));
	// cout << k1 << " " << k2 << " " << k3 << "\n";
	ll ans = b - a + 1;
	ans = ans - (k1 + k2 - k3);
	cout << ans << "\n";
	return 0;
}

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

#define NREP() for(ll i = 0; i < n; i++)
#define MREP() for(ll j = 0; j < m; j++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define IPT(t, x) t ipt; cin >> ipt; x.push_back(ipt);
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;

const static ll MOD = 1e9 + 7;
ll n, cnt, ans, tmp, sum, minimum, maximum, a, b, c, d, k, m, h, w, q, x, y;
string s, t;

int main() {
    cin >> n >> k;
    ll rim = n % k;
    if (rim != 0) MSG(1)
    else
        MSG(0)
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
template <typename T> inline void read(T &x)
{
	x=0;int f=1;char c=getchar();
	for(;c>'9'||c<'0';c=getchar())if(c=='-')f=-1;
	for(;c>='0'&&c<='9';c=getchar())x=(x<<1)+(x<<3)+(c^48);
	x*=f;
}
template <typename T> inline void print(T x)
{
	if(x<0) putchar('-'),x=-x;
	if(x>9) print(x/10);
	putchar(x%10+48);
}
long long s[1010010];
long long a,ans=0;
int main()
{
	read(a);
	for(int i=1;i<=a;i++)
	{
		read(s[i]);
		if(s[i]%2!=0)
			ans++;
	}
	if(ans%2==0)
		cout<<"YES";
	else
		cout<<"NO";
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include<iomanip>
#include <cmath>
#include <climits>
#include <algorithm>
#include <stdio.h>
using namespace std;

long long dp1[3000][3000];
long long dp2[3000][3000];
long long a[3000];

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

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

    for(int i = 0; i < N; i++){
        dp1[i][i] = a[i];
        dp2[i][i] = -a[i];
    }

    for(int i = N - 1; i >= 0; i--){
        for(int j = i + 1; j < N; j++){
            dp1[i][j] = max(a[i] + dp2[i + 1][j], a[j] + dp2[i][j - 1]);
            dp2[i][j] = min(dp1[i + 1][j] - a[i], dp1[i][j - 1] - a[j]);
        }
    }
    cout << dp1[0][N-1] << endl;

    
    return 0;

}

Measured memory_bytes: 139776
from sys import stdin

def main():
    N = int(input())
    V = map(int, input().split())
    C = map(int, input().split())

    ans = 0
    for v, c in zip(V, C):
        if v > c:
            ans += v - c
    print(ans)

input = lambda: stdin.readline()
main()


Measured memory_bytes: 3060
n= int(input())
h = list(map(int,input().split()))

dp = [0 for _ in range(n+1)]

dp[1]=0
dp[2]=abs(h[0]-h[1])

for i in range(3,n+1):
    dp[i] = min(dp[i-2]+abs(h[i-3]-h[i-1]),dp[i-1]+abs(h[i-2]-h[i-1]))
print(dp[n])

Measured memory_bytes: 52720
n = int(input())
a = list(map(int,input().split()))

a.sort()
mx = a[-1]

half = mx / 2
dist = abs(half - a[0])
ans = 0
for i in range(1,n):
    if dist > abs(half - a[i]):
        dist = min(dist,abs(half - a[i]))
        ans = a[i]
print(mx,ans)


Measured memory_bytes: 14060
#include<iostream>

using namespace std;


int main()
{
    int a;
    cin >> a;
    int b;
    cin >> b;
    int t;
    cin >> t;

    float total_time = (float)t + 0.5;
    int n = total_time / a;

    int answer = n * b;

    cout << answer << endl;

    return 0;
}


Measured memory_bytes: 256
n,x,y = map(int , input().split())

d = [0] * n

for i in range(1,n):
  for j in range(i+1,n+1):
    dd =min (j-i,abs(i-x) + 1 + abs(j-y))
    d[dd] += 1

for i in range(1,len(d)):
  print(d[i])

Measured memory_bytes: 3444
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <stack>
#include <set>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int x;
    int ans = 0;
    for (int i = 0; i < n; ++i)
    {
        cin >> x;
        ans += x - 1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const double PI = acos(-1);
#define rep(i, n) for (int i = 0; i < (int)(n); i++ )
using namespace std;
int main() {
    string s,t;
    cin >> s >> t;
    int ans = 0;
    int n = s.size();
    rep(i,n){
        if(s.at(i) != t.at(i)) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3900
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        m: u32
    }
    let ans = 24 + (24 - m);
    println!("{}", ans);
}


Measured memory_bytes: 4352
/*
* @Author: kabbo
* @Date:   2020-06-14 17:50:39
* @Last Modified by:   kabbo
* @Last Modified time: 2020-06-14 18:01:52
*/
#include<bits/stdc++.h>
using namespace std;
#define pii pair<long long,long long>
#define endl '\n'
#define ull unsigned long long
#define ll long long
const int mod = 1e9 + 7;
using u64 = uint64_t;
using u128 = __uint128_t;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
void solve() {
	vector<ll>v(6);
	for (int i(1); i <= 5; ++i)
		cin >> v[i];
	for (int i(1); i <= 5; ++i) {
		if (v[i] == 0) {
			cout << i << endl;
			return ;
		}
	}
}
int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	/*int t;
	cin >> t;
	for (int i(1); i <= t; ++i) {
		printf("Case %d: ", i);*/
	solve();
	//}
#ifndef LOCAL_DEFINE
	cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
#endif
	return 0;
}

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

class Main{
	public static void main(String[] args) throws IOException {
		heap hoge=new heap(2000000);
		BufferedReader bfr=new BufferedReader(new InputStreamReader(System.in));
		String unko="";
		String[] bu=new String[2];
		while(true) {
			unko=bfr.readLine();
			if(unko.equals("end")) {
				System.exit(0);
			}
			else if(unko.charAt(0)=='i'){
				bu=unko.split(" ");
				long a=Long.parseLong(bu[1])*(-1);
				hoge.heap_push(a);
			}
			else {
				long aa=hoge.heap_pop();
				System.out.println(aa*-1);
			}
		}
	}

	static class heap{

		static int sz;		//現在のヒープに埋まっている数

		static long[] heap;

		public heap(int size) {
			sz=0; heap=new long[size];
		}

		int size() {		//サイズをかえす
			return sz;
		}

		void heap_push(long a) {		//ヒープに入れる
			int i=sz++;
			while(i>0) {	//今指しているヒープがルートに来るまで続ける
				int parent=(i-1)/2;
				if(heap[parent]<=a) {
					break;
				}
				heap[i]=heap[parent];
				i=parent;
			}
			heap[i]=a;
		}

		long heap_pop() {
             //小さい順から取り出す
			long ret=heap[0];
			long x=heap[--sz];
			int i=0;
			while(i*2+1<sz) {	//最下層の葉っぱまで行くまで続ける
				int a=i*2+1,b=i*2+2;		//aは左の葉っぱ、bは右の葉っぱ
				if(b<sz && heap[b]<heap[a]) {
					a=b;
				}
				if(heap[a]>=x) {
					break;
				}
				heap[i]=heap[a];
				i=a;
			}
			heap[i]=x;
			return ret;
		}
	}
}



Measured memory_bytes: 178596
n = int(input())
m = n
r = []
for i in range(2, n + 1):
    if i ** 2 > n:
        break
    if m % i == 0:
        c = 0
        while m % i == 0:
            m //= i
            c += 1
        r.append((i, c))
if m > 1:
    r.append((m, 1))
def calc(x):
    ans = 0
    for i in range(1, x + 1):
        if (1 + i) * i // 2 <= x:
            ans = i
        else:
            break
    return ans
ans = 0
for u, v in r:
    ans += calc(v)
print(ans)

Measured memory_bytes: 63596
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

class state{
public:
	int x,y,d;
	ll c;
	state(){}
	state(int xx,int yy,int dd,ll cc){
		x=xx;
		y=yy;
		d=dd;
		c=cc;
	}
	bool operator<(const state &s)const{
		return c>s.c;
	}
};

int h,w,k;
int sx,sy,gx,gy;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
vector<int> fie[1000006];
vector<ll> dp[4][1000006];

int main(void){
	scanf("%d%d%d",&h,&w,&k);
	scanf("%d%d%d%d",&sy,&sx,&gy,&gx);
	sx--;
	sy--;
	gx--;
	gy--;
	for(int i=0;i<h;i++){
		string s;
		cin >> s;
		for(int j=0;j<w;j++){
			for(int k=0;k<4;k++){
				dp[k][i].push_back(1LL<<60);
			}
			if(s[j]=='.'){
				fie[i].push_back(0);
			}else{
				fie[i].push_back(-1);
			}
		}
	}
	dp[0][sy][sx]=0;
	priority_queue<state> que;
	que.push(state(sx,sy,0,0));
	while(que.size()){
		state st=que.top();
		que.pop();
		if(dp[st.d][st.y][st.x]<st.c){
			continue;
		}
		//printf("%d %d %d %lld\n",st.x,st.y,st.d,st.c);
		for(int j=0;j<4;j++){
			int nx=st.x+dx[j];
			int ny=st.y+dy[j];
			if(nx<0 || nx>=w || ny<0 || ny>=h)continue;
			if(fie[ny][nx]==-1)continue;
			ll nc=st.c+1;
			if(st.d!=j){
				if(st.c%k==0){
					nc=st.c+1;
				}else{
					nc=st.c+k-(st.c%k)+1;
				}
			}
			if(dp[j][ny][nx]>nc){
				dp[j][ny][nx]=nc;
				que.push(state(nx,ny,j,nc));
			}
		}
	}
	ll ans=1LL<<60;
	for(int i=0;i<4;i++){
		ans=min(ans,dp[i][gy][gx]);
	}
	printf("%lld\n",ans==(1LL<<60)?-1:(ans+k-1)/k);
	return 0;
}


Measured memory_bytes: 174716
n = int(input())
c = input()
l, r = 0, n-1
ans = 0
while l < r:
	if c[l] == "W" and c[r] == "R":
		ans += 1
		l, r = l+1, r-1
	else:
		if c[l] == "R":
			l += 1
		if c[r] == "W":
			r -= 1
print(ans)

Measured memory_bytes: 67636
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n=int(input())
h=lnii()+[10**10]

ans=0
t_ans=0
for i in range(n):
  if h[i]>=h[i+1]:
    t_ans+=1
  else:
    ans=max(ans,t_ans)
    t_ans=0

print(ans)

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

#define rep( i, n ) for( int i = 0; i < ( n ); i++ )
#define PI 3.14159265
typedef long long ll;

int main( void ) {

    char ch;
    int AB[ 26 ]  = {};
    int  i         = 0;
    while(cin >> ch){
        if(isalpha(ch)){
            if( islower( ch ) ) ch = toupper( ch );
            AB[ch -'A']++;
        }
    }
    for( int i = 0; i < 26; i++){
        char c = i + 'a';
        cout << c << " : " << AB[ i ] << endl;
    } return 0;
}



Measured memory_bytes: 3084
import java.util.*; 

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] p = new int[n];
		int ans = 0;

		for(int i=0;i<n;i++){
			p[i] = sc.nextInt();
		}

		Arrays.sort(p);

		for(int j=0;j<k;j++){
			ans = ans + p[j];
		 }
		 System.out.println(ans);
		}
	  }

Measured memory_bytes: 39340
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
const long long mod = 1e9 + 7;

int n;
int arr[MAXN];
int segtree[2 * MAXN];
long long reqd;
long merge(long x, long y){
    return x + y;
}
void segtree_update(int ind, long val){
    for(segtree[ind += 2 * (n + 1)] += val; ind > 1; ind >>= 1)
        segtree[ind >> 1] = merge(segtree[ind], segtree[ind ^ 1]);
}
long segtree_query(int l, int r){
    long res = 0;
    for(l += 2 * (n + 1), r += 2 * (n + 1); l < r; l >>= 1, r >>= 1){
        if((l & 1) == 1)
            res = merge(res, segtree[l++]);
        if((r & 1) == 1)
            res = merge(res, segtree[--r]);
    }
    return res;
}
bool check(int mid){
    int i = 0;
    memset(segtree, 0, sizeof(segtree));
    segtree_update(n, 1);
    int sum = n;
    long long cnt = 0;
    for(i = 0; i < n; i++){
        sum += (arr[i] <= mid) ? 1 : -1;
        cnt += segtree_query(0, sum);
        segtree_update(sum, 1);
    }
    return cnt >= reqd;
}
void solve(){
    int lo = 0, hi = 1e9, ans = -1;
    long long tot = n * 1LL * (n + 1) >> 1;
    if(tot % 2)
        reqd = (tot + 1) / 2;
    else
        reqd = (tot + 2) / 2;
    while(lo <= hi){
        int mid = (lo + hi) >> 1;
        if(!check(mid))
            lo = mid + 1;
        else{
            hi = mid - 1;
            ans = mid;
        }
    }
    cout << ans;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int i = 0;
    cin >> n;
    for(i = 0; i < n; i++)
        cin >> arr[i];
    solve();
    return 0;
}


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

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

int main() {
	ios::sync_with_stdio(false);
	
	char c[10001];
	while(1) {
		cin >> c;
		if(cin.eof())break;
		int l = strlen(c), sj=0, si=0;
		rep(i, l-2) {
			if(c[i]=='J' && c[i+1]=='O' && c[i+2]=='I') {
				sj++;
				i+=2;
			}
		}
		rep(i, l-2) {
			if(c[i]=='I' && c[i+1]=='O' && c[i+2]=='I') {
				si++;
				i+=1;
			}
		}
		cout << sj <<endl;
		cout << si <<endl;
	}
	
	return 0;
}

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

#define int long long
#define double long double

#define REP(i, b) for(int i = 0; i < (b); i++)
#define REPS(i, b) for(int i = 1; i <= (b); i++)
#define ALL(v) (v).begin(), (v).end()

#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;

using pi = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vs = vector<string>;
using vb = vector<bool>;
using vpi = vector<pi>;
using vvi = vector<vi>;
using vvb = vector<vb>;

const int INF = 1e16;
const int MOD = 1e9+7;

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

signed main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    const int MAX = 1e6;
    int n = 1;
    vi pollock;
    while(true)
    {
        if(n*(n+1)*(n+2)/6 > MAX) break;
        pollock.pb(n*(n+1)*(n+2)/6);
        n++;
    }

    vi ans(MAX+1, INF);
    REP(i, pollock.size()) ans[pollock[i]] = 1;
    ans[0] = 0;
    REPS(i, MAX)
    {
        REP(j, pollock.size())
        {
            if(i >= pollock[j]) chmin(ans[i], ans[i-pollock[j]]+1);
        }
    }
    vi ans2(MAX+1, INF);
    REP(i, pollock.size()) if(pollock[i] % 2 == 1) ans2[pollock[i]] = 1;
    ans2[0] = 0;
    REPS(i, MAX)
    {
        REP(j, pollock.size())
        {
            if(pollock[j] % 2 == 1 && i >= pollock[j]) chmin(ans2[i], ans2[i-pollock[j]]+1);
        }
    }
    while(true)
    {
        int x; cin >> x;
        if(x == 0) break;
        cout << ans[x] << " " << ans2[x] << endl;
    }
}


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

using namespace std;

const int mod = 1e9 + 7;
int n;
long long a[100005];
long long s[100005];
long long t[100005];

long long pw(long long x, long long y) {
    long long r = 1;
    while (y) {
        if (y & 1) r = r * x % mod;
        x = x * x % mod;
        y >>= 1;
    }
    return r;
}
long long inv(long long x) {
    return pw(x, mod - 2);
}

int main(void) {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n;
    for (int i = 1; i <= n; ++i) cin >> a[i];
    long long ft = 1;
    for (int i = 1; i <= n; ++i) ft = ft * i % mod;
    long long ans = 0;
    for (int i = 1; i <= n; ++i) s[i] = (s[i - 1] + a[i]) % mod;
    t[1] = (s[n-1] - s[1] + mod) % mod;
    for (int i = 2; i <= n - 2; ++i)
        t[i] = (t[i-1] + s[n - i] - s[i] + mod) % mod;
    for (int i = 1; i <= n - 2; ++i)
        ans = (ans + t[i] * 2 * inv(i + 1) % mod * inv(i + 2)) % mod;
    for (int i = 1; i <= n - 1; ++i)
        ans = (ans + s[i] * inv(i + 1)) % mod;
    for (int i = 2; i <= n; ++i)
        ans = (ans + (s[n] - s[i-1] + mod) * inv(n - i + 2)) % mod;
    ans = (ans + s[n]) * ft % mod;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>

using namespace std;

int main()
{
    int n,k,t;
    int count=0;
    vector<int> h;
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>t;
        h.push_back(t);
    }
    for(int i=0;i<n;i++){
        if(h.at(i)>=k){
            count++;
        }
    }
    cout<<count;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl "\n"
using namespace std;

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

	int x;
	cin >> x;
	int a= __gcd(360,x);
	cout << 360/a << endl;

	return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = 0; i < (n); i++)
 
int main(){
	int N;
	cin >> N;
	int a;
	map<int,int> ma;
	rep(i,N){
		cin >> a;
		ma[a]++;
	}
	int n = ma.size();
	if(n == 3){
		auto itr = ma.begin();
		auto a1 = itr->first;
		auto a2 = itr->second;
		itr++;
		auto b1 = itr->first;
		auto b2 = itr->second;
		itr++;
		auto c1 = itr->first;
		auto c2 = itr->second;
		int d = a1 ^ b1;
		if(d == c1 && a2 == b2 && b2 == c2){
			cout << "Yes" << endl;
			return 0;
		}
	}else if(ma[0] == N){
		cout << "Yes" << endl;
		return 0;
	} else if(N%3 == 0 && n == 2 && ma[0] == N / 3){
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

int main()
{
  int H, W, D; scanf("%d %d %d", &H, &W, &D);
  vector<int> X(H * W + 5, -1), Y(H * W + 5, -1);
  int a;
  for (int i = 0; i < H; ++i) {
    for (int j = 0; j < W; ++j) {
      scanf("%d", &a);
      Y[a] = i;
      X[a] = j;
    }
  }
  vector<int> S(H * W + 5, 0);
  for (int i = D + 1; i <= H * W; ++i) {
    S[i] += S[i - D] + abs(X[i] - X[i - D]) + abs(Y[i] - Y[i - D]);
  }

  int Q; scanf("%d", &Q);
  while (Q-- > 0) {
    int l, r; scanf("%d %d", &l, &r);
    int ans = S[r] - S[l];
    printf("%d\n", ans);
  }
  return 0;
}


Measured memory_bytes: 2176
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <numeric>
#include <vector>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

using lli = long long int;
using namespace std;

int main() {
  int Q; cin >> Q;
  lli balance = 0;
  REP(i, Q) {
    char C; lli P, N; cin >> P >> C >> N;
    if (C == '(') {
      balance += N;
    } else if (C == ')') {
      balance -= N;
    } else {
      assert(false);
    }
    cout << (balance == 0 ? "Yes": "No") << endl;
  }
  return 0;
}

Measured memory_bytes: 3116
#include <cassert>
#include <cstdint>
#include <stdexcept>
#include <utility>

using namespace std;

void insersion_sort(int32_t array[], size_t size, void (*callback)(int32_t arrary[], size_t size))
{
  if (array == nullptr) throw runtime_error("array is null");

  for (int32_t i = 0; i < size; i++) {
    for (int32_t j = i; j >= 1; j--) {
      if (array[j - 1] > array[j]) {
        swap(array[j - 1], array[j]);
      }
    }
    if (callback != nullptr) {
      callback(array, size);
    }
  }
}

#if !defined(TEST)
#include <iostream>
static void callback(int32_t array[], size_t size)
{
  for (uint32_t i = 0; i < size; i++) {
    if (i != 0) cout << " ";
    cout << array[i];
  }
  cout << endl;
}

int32_t main(void)
{
  int32_t num;
  cin >> num;

  int32_t array[1024];
  for (uint32_t i = 0; i < num; i++) {
    cin >> array[i];
  }
  insersion_sort(array, num, callback);

  return 0;
}
#endif

Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod=1e9+7;

int main(){
    int N;
    string s, t, str, astr;
    cin >> N >> s >> t;
    vector<int> ans;
    ans.push_back(s.size());
    for(int i=0; i<s.size(); i++){
        if(s[i]==t[0]){
            ans.push_back(i);
            for(int j=0;j<s.size()-i;j++){
                if(s[j+i]!=t[j]){
                    ans.pop_back();
                    break;
                }
            }
        }
    }
    for(int j=0;j<*min_element(ans.begin(), ans.end());j++){
        astr += s[j];
    }
    astr += t;
    cout << astr.size();
}

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

int main() {
  string n;
  cin>>n;
  if(n[0]==n[1]&&n[1]==n[2])
    cout<<"Yes";
  else if(n[1]==n[2]&&n[2]==n[3])
    cout<<"Yes";
  else cout<<"No";
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int H, W, i, j;
	
	while(1)
	{
		scanf("%d %d", &H, &W);
		if(H == 0 && W == 0) break;
		for(i = 1; i <= H; i++)
		{
			for(j = 1; j <= W; j++)
			{
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}
	
	return 0;
}

Measured memory_bytes: 572
#include <iostream>
#include <string>
#include <map>
using namespace std;
map<string,int> mp;
int main(){
    int i,n;
    cin >> n;
    for(i=0;i<n;i++){
        string s; cin >> s;
        mp[s]++;
    }
    cout << mp.size() << endl;
}

Measured memory_bytes: 19232
X=int(input())
import math


x=X
y=int(math.sqrt(x)//1+1)
if X==2:
    print(2)
else:
    while 1:
      flag=0
      for i in range(y-1):
          if x%(i+2)==0:
              flag=1
              break
      if flag==0:
        print(x)
        break
      x=int(x+1)
      y=int(math.sqrt(x)//1+1)


Measured memory_bytes: 38512
#include <iostream>
#include<string>
using namespace std;
int main() {
	string n;
	int check = 0;
	cin >> n;
	int f = n.size();
	for (int i = 0; i < f; i++) {
		for (int j = i + 1; j < f; j++) {
			if (n[i] == n[j]) {
				check = 1;
			}
		}
	}
	if (check == 0) {
		cout << "yes" << endl;
	}
	else{
		cout << "no" << endl;
	}
	return 0;
}


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

typedef long long ll;
#define rep(i,n) for(i=0;i<n;++i)
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define mp make_pair
#define pb push_back
#define fi first
#define sc second

struct building{ int b,x,y; };
struct edge{ int to; double cost; };
typedef pair<double,int> pi;

const double INF=1e20;

long dist2(building A, building B)
{
	return (long)(A.x-B.x)*(A.x-B.x)+(long)(A.y-B.y)*(A.y-B.y);
}

int main()
{
	int i,j;
	while(1)
	{
		int n;
		cin >>n;
		if(n==0) break;

		vector<building> v(n);
		rep(i,n)
		{
			scanf(" %d %d %d",&v[i].b,&v[i].x,&v[i].y);
			--v[i].b;
		}

		//be connected?
		vector<edge> G[1000];
		rep(i,n)rep(j,i)
		{
			if(dist2(v[i],v[j])<=50*50)
			{
				G[v[i].b].pb(edge{v[j].b,sqrt(dist2(v[i],v[j]))});
				G[v[j].b].pb(edge{v[i].b,sqrt(dist2(v[i],v[j]))});
			}
		}

		int m;
		cin >>m;
		rep(i,m)
		{
			int s,g;
			scanf(" %d %d",&s,&g);
			--s;
			--g;

			double dist[1000];
			fill(dist,dist+1000,INF);
			dist[s]=0;
			int par[1000];
			fill(par,par+1000,-1);

			//dijkstra
			priority_queue<pi,vector<pi>,greater<pi>> que;
			que.push(pi(0,s));
			while(!que.empty())
			{
				pi p=que.top();
				que.pop();
				int v=p.sc;
				if(dist[v]<p.fi) continue;

				rep(j,(int)G[v].size())
				{
					edge e=G[v][j];
					if(dist[e.to]>dist[v]+e.cost)
					{
						//printf("%d -> %d\n",v,G[v][j]);
						dist[e.to]=dist[v]+e.cost;
						par[e.to]=v;
						que.push(pi(dist[e.to],e.to));
					}
				}
			}

			//search parent
			vector<int> ans;
			ans.pb(g+1);
			int now=g;
			while(par[now]!=-1)
			{
				ans.pb(par[now]+1);
				now=par[now];
			}

			reverse(ans.begin(),ans.end());

			//output
			if(ans[0]!=s+1) printf("NA\n");
			else
			{
				rep(j,(int)ans.size())
				{
					if(j) printf(" ");
					printf("%d", ans[j]);
				}
				printf("\n");
			}
		}

	}
}

Measured memory_bytes: 3176
#include<iostream>
#include<algorithm>
#include<cassert>
#include<vector>
#include<fstream>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<queue>
#include<map>

using namespace std;
#define REP(i,m,n) for(long long i=m;i<n;++i)
#define INF 10000000000000000
#define MOD 1000000007
#define ll long long
#define mp make_pair
#define all(v) v.begin(),v.end()

map<int, int>m;
vector<int>v;

int main() {
	int n;
	cin >> n;
	REP(i, 0, n) {
		int tmp;
		cin >> tmp;
		v.push_back(tmp);
		m[tmp]++;
	}
	sort(all(v));
	int ans = 0;
	m[v[0]] < v[0] ? ans += m[v[0]] : ans += m[v[0]] - v[0];
	REP(i, 1, n) {
		if(v[i]!=v[i-1])m[v[i]] < v[i] ? ans += m[v[i]] : ans += m[v[i]] - v[i];
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
    int temp = 1;
    for (int i = 0; i < 3; i++) {
        temp *= cin.get();
    }
    if (temp == (int)'a'*(int)'b'*(int)'c') {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
//2018.9.14 by ljz
#include<bits/stdc++.h>
using namespace std;
#define res register int
#define LL long long
#define inf 0x3f3f3f3f
#define eps 1e-15
inline int read(){
    res s=0;
    bool w=0;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')w=1;ch=getchar();}
    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=getchar();
    return w?-s:s;
}
inline void _swap(res &x,res &y){
    x^=y^=x^=y;
}
inline int _abs(const res &x){
    return x>0?x:-x;
}
inline int _max(const res &x,const res &y){
    return x>y?x:y;
}
inline int _min(const res &x,const res &y){
    return x<y?x:y;
}
const int N=2e3+10;
namespace MAIN{
    int n,m;
    struct E{
        int next,to;
        E() {}
        E(res next,res to):next(next),to(to) {}
    }edge[N<<1];
    int head[N],cnt;
    inline void addedge(res u,res v){
        edge[++cnt]=E(head[u],v),head[u]=cnt;
        edge[++cnt]=E(head[v],u),head[v]=cnt;
    }
    int tot;
    void dfs(res x,res fax,res depx){
        if(depx>m/2)tot++;
        for(res i=head[x];~i;i=edge[i].next){
            res tox=edge[i].to;
            if(tox==fax)continue;
            dfs(tox,x,depx+1);
        }
    }
    int ans=inf;
    inline void MAIN(){
        memset(head,-1,sizeof(head));
        n=read(),m=read();
        for(res i=1;i<n;i++){
            res u=read(),v=read();
            addedge(u,v);
        }
        if(m&1){
            for(res x=1;x<=n;x++)
                for(res i=head[x];~i;i=edge[i].next){
                    res tox=edge[i].to;
                    tot=0;
                    dfs(tox,x,0);
                    dfs(x,tox,0);
                    ans=_min(ans,tot);
                }
        }
        else {
            for(res x=1;x<=n;x++)
                tot=0,dfs(x,0,0),ans=_min(ans,tot);
        }
        printf("%d\n",ans);
    }
}
int main(){
    MAIN::MAIN();
    return 0;
}

Measured memory_bytes: 384
/**
 * author:    Ziel
 * created:   04.05.2020 19:15:27
**/

// ~zaletaet~

//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>

#define fi first
#define se second
#define sz(x) int(x.size())
#define all(x) x.begin(), x.end()
#define pb push_back

using namespace std;

using ll = long long;
using ull = unsigned long long;
// using big = __int128_t; // -10^38...10^38
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;

const ll N = 1e5 + 123, MOD = 1e9 + 7, oo = 1e9 + 9, INF = 1e18 + 9;
const double EPS = 1e-9, PI = acos(-1); // 3.14159265358979323846
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1}, dy[] = {0, 0, 1, -1, 1, -1, -1, 1};

main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  
  int n, k;
  cin >> n >> k;
  int r, s, p;
  cin >> r >> s >> p;
  string t;
  cin >> t;
  
  for (int i = k; i < n; i++) {
    if (t[i] == t[i - k]) t[i] = 'm';
  }
  ll ans = 0;
  for (int i = 0; i < n; i++) {
    if (t[i] == 'r')
      ans += p;
    if (t[i] == 'p')
      ans += s;
    if (t[i] == 's')
      ans += r;
  }
  
  cout << ans;
  return 0;
}

/*
  Raise your standard.
*/

Measured memory_bytes: 512
#include <iostream>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;

int main(){
    int R,G,B,N;
    cin >> R >> G >> B >> N;
    int ans = 0;
    for(int i = 0; i <= N/R; i++){
        for(int j = 0; j <= N/G; j++){
            if(N - i*R - j*G >= 0){
                if((N - i*R - j*G) % B == 0)
                    ans++;
            }
        }
    }
    cout << ans <<endl;
}

Measured memory_bytes: 256
#include<iostream>
std::string m[12];
void d(int x,int y){
	if(x&&m[y][x-1]-48)m[y][x-1]=48,d(x-1,y);
	if(x<11&&m[y][x+1]-48)m[y][x+1]=48,d(x+1,y);
	if(y&&m[y-1][x]-48)m[y-1][x]=48,d(x,y-1);
	if(y<11&&m[y+1][x]-48)m[y+1][x]=48,d(x,y+1);
	return ;
}
main(){
	while(1){
		int y=12,r=0;
		for(;y;y--)std::cin>>m[y-1];
		if(std::cin.eof())return 0;
		for(;y<12;y++)for(int x=0;x<12;x++)if(m[y][x]-48)r++,m[y][x]=48,d(x,y);
		std::cout<<r<<'\n';
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

void solve(){
    int a,b;
    cin >> a >> b;
    print(max(a+b,max(a-b,b*a)));
    return;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    solve();
    return 0;
}

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

using namespace std;

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

  string s, t;
  cin >> s >> t;

  int a, b;
  cin >> a >> b;

  map<string, int> m;

  m[s] = a;
  m[t] = b;

  string u;
  cin >> u;

  --m[u];

  cout << m[s] << " " << m[t] << "\n";

  return 0;
}


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

const int MAX = 1e5 + 5;
const int N = 1e6 + 5;
const int MOD = 998244353;

#define dbg(a) cout << "-> " << __LINE__ << ": " << #a << " = " << a << endl

int add (int a, int b) {
    return (a + b < MOD) ? (a + b) : (a + b - MOD);
}

int sub (int a, int b) {
    return (a >= b) ? (a - b) : (a - b + MOD);
}

int mul (int a, int b) {
    return (a * 1LL * b) % MOD;
}

int expo (int a, int b) {
    int ret = 1;
    while (b != 0) {
        if (b & 1) {
            ret = mul(ret, a);
        }
        a = mul(a, a);
        b >>= 1;
    }
    return ret;
}

int inv (int a) {
    return expo(a, MOD - 2);
}

int main() {
    int n;
    scanf("%d", &n);
    vector<int> val(N), sum(N);
    for (int i = 0; i < n; i++) {
        int a;
        scanf("%d", &a);
        int lim = sqrt(a + 1);
        for (int j = 1; j <= lim; j++) {
            if (a % j == 0) {
                int u = j, v = a / j;
                val[u] = add(val[u], mul(sum[u], a));
                sum[u] = add(sum[u], a);
                if (u != v) {
                    val[v] = add(val[v], mul(sum[v], a));
                    sum[v] = add(sum[v], a);
                }
            }
        }
    }
    
    long long ans = 0;
    for (int i = N - 1; i > 0; i--) {
        for (int j = i + i; j < N; j += i) {
            val[i] = sub(val[i], val[j]);
        }
        ans = add(ans, mul(val[i], inv(i)));
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 8064
//بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيمِ
//لا إله إلا الله محمد رسول الله

#include <bits/stdc++.h>

#pragma GCC optimize("Ofast")

#define ll long long
#define pb push_back
#define fr first
#define sc second
#define in freopen("input.txt", "r" , stdin)
#define out freopen("snakes.out", "w", stdout)
using namespace std;
ll n;
double dp[3005][3005];
double p[3005];
int main(){
    //in;
    //out;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> p[i];
    }

    dp[0][0] = 1;

    for (int i = 1; i <= n; i++) {
        for (int j = 0; j <= i; j++) {
            if (j == 0) {
                dp[i][j] = dp[i-1][j] * (1.0 - p[i]);
            }
            else dp[i][j] = dp[i-1][j] * (1.0 - p[i]) + dp[i-1][j-1] * p[i];
        }
    }

    double ans = 0;
    for (int i = n / 2 + 1; i <= n; i++) {
        ans += dp[n][i];
    }

    cout << fixed << setprecision(12)<< ans;
}




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

using ll = long long;
#define countof(a) (sizeof(a)/sizeof((a)[0]))
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define all(a) begin(a),end(a)
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
template<class T> void cout_v(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << endl; }
template<class T> void cout_h(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << (i==c.size()-1?"\n":" "); }
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}
template<class T> void sort3a(T& a,T& b,T& c) {if (a>b) swap(a,b); if (b>c) swap(b,c); if (a>b) swap(a,b);}
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 

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

    int N; cin >> N;
    string S; cin >>S;
    int K; cin >>K;
    
    rep(i, N) {
        if (S[i] != S[K-1]) S[i] = '*';
    }

    cout << S <<endl;
}


Measured memory_bytes: 256
#include <stdio.h>


int main(){
    int n;
    scanf("%d",&n);
    char name[11];
    unsigned long long c[5] = {0,0,0,0,0};
    int i,j,k;
    for(i=0;i<n;i++){
        scanf("%s",name);
        switch(name[0]){
        case 'M':
            c[0]++;
            break;
        case 'A':
            c[1]++;
            break;
        case 'R':
            c[2]++;
            break;
        case 'C':
            c[3]++;
            break;
        case 'H':
            c[4]++;
            break;
        default:
            break;
        }
    }
    unsigned long long ans = 0;
    for(i=0;i<3;i++){
        for(j=i+1;j<4;j++){
            for(k=j+1;k<5;k++){
                ans += c[i]*c[j]*c[k];
            }
        }
    }
    printf("%llu\n",ans);
    return 0;
}


Measured memory_bytes: 128
#![allow(unused_imports)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;
use std::ops::Bound::*;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<i64>();
    let (n, x, m) = (v[0], v[1], v[2]);
    let mut n = n - 1;
    let mut ans = x;
    let mut a = (x * x) % m;

    let mut found = HashSet::new();
    let mut roots = vec![];
    let mut cycle = 0;
    let mut cycle_begin = 0;
    for i in 0.. {
        found.insert(a);
        roots.push(a);
        // ans += a;
        a = (a * a) % m;
        if found.contains(&a) {
            for j in (0..roots.len()) {
                if roots[j] == a {
                    cycle = roots.len() - j;
                    cycle_begin = j;
                }
            }
            break;
        }
    }

    if n <= cycle_begin as i64 {
        ans += (0..n as usize).map(|x| roots[x]).sum::<i64>();
        println!("{}", ans);
        return;
    }
    ans += (0..cycle_begin).map(|x| roots[x]).sum::<i64>();
    n -= cycle_begin as i64;

    let roots = (cycle_begin..roots.len())
        .map(|x| roots[x])
        .collect::<Vec<_>>();

    let cycle_sum = roots.iter().sum::<i64>();
    ans += (n / cycle as i64) * cycle_sum;
    n %= cycle as i64;
    ans += (0..n).map(|x| roots[x as usize]).sum::<i64>();
    debug!(n, cycle_sum, cycle);
    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 3624
//06
#include<iostream>

using namespace std;

int main(){
  int n;
  cin>>n;
  while(n--){
    int x=0,y=0;
    int ds=0;
    int tx,ty;
    for(int dx,dy;cin>>dx>>dy,dx|dy;){
      x+=dx;
      y+=dy;
      if(x*x+y*y>ds||(x*x+y*y==ds&&x>tx)){
	tx=x;
	ty=y;
	ds=x*x+y*y;
      }
    }
    cout<<tx<<' '<<ty<<endl;
  }
  return 0;
}

Measured memory_bytes: 1156
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String Sa = scan.next();
        String Sb = scan.next();
        String Sc = scan.next();
        List<Character> list_a = new ArrayList<>();
        for(char i : Sa.toCharArray()) {
            list_a.add(i);
        }
        List<Character> list_b = new ArrayList<>();
        for(char i : Sb.toCharArray()) {
            list_b.add(i);
        }
        List<Character> list_c = new ArrayList<>();
        for(char i : Sc.toCharArray()) {
            list_c.add(i);
        }
        char turn = 'a';
        List<Character> current = list_a;
        while (!current.isEmpty()) {
            char x = current.remove(0);
            if (x == 'a') {
                turn = 'a';
                current = list_a;
            }
            if (x == 'b') {
                turn = 'b';
                current = list_b;
            }
            if (x == 'c') {
                turn = 'c';
                current = list_c;
            }
        }
        System.out.println((char) (turn-32));
    }
}


Measured memory_bytes: 22740