akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;
int main(){

	int W,H,x,y,r;

	cin >> W >> H >> x >> y >> r;

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

	return 0;
}

Measured memory_bytes: 1156
#include<iostream>
using namespace std;
int main()
{
	int a,b,c;
	string s;
	
	cin >> a >> b >> c;
	
	if ((a == b) && (b == c)){
			cout << "Yes" <<endl;
		}else{
			cout << "No" << endl;
		}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main(){
    string b;
    cin >> b ;
    if(b == "A"){
        cout << "T\n" ;
    }

    if(b == "G"){
        cout << "C\n" ;
    }

    if(b == "C"){
        cout << "G\n" ;
    }

    if(b == "T"){
        cout << "A\n" ;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
map<pair<int, int>, int> cnt;
map<pair<int, int>, int> seen;
int Grundy(int X, int K){
	if(X < K) return 0; 
	if(X % K == 0) return X/K; 
	return Grundy(X - (X+K-1)/K, K); 
}
int main(){
	int N; cin >> N;  
	int G = 0; 
	int A[210], K[210]; 
	for(int i = 0; i < N; i++){
		cin >> A[i] >> K[i]; 
		cnt[make_pair(A[i], K[i])] ++;
	}
	for(int i = 0; i < N; i++){
		if(cnt[make_pair(A[i], K[i])] % 2 == 0) continue;  
		G ^= Grundy(A[i], K[i]);
		seen[make_pair(A[i], K[i])] = true; 
	}
	cout << (G ? "Takahashi" : "Aoki") << endl; 
}

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

int main(void){

    long long X, Y;

    scanf("%lld%lld", &X, &Y);

    int l = 0;

    for(long long i = X; i <= Y; i *= 2){
        l++;
    }

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

    return 0;
}

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

int main() {

  int N,K;
  cin >> N;
  cin >> K;
  
  int wk;
  int min=(1<<0)+K*N;
  
  for (int i = 1; i <= N; i++) {
    wk = (1<<i)+K*(N-i);
    if(wk < min)
      min = wk;
  }

  cout << min << endl;
}

Measured memory_bytes: 256
#define REP(i, n) for(int i = 0; i < (int)(n); i++)

#include "bits/stdc++.h"
using namespace std;

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

	if (a * b <= 0) {
		cout << "Zero" << endl;
	}
	else if (a > 0) {
		cout << "Positive" << endl;
	}
	else {
		if ((b - a + 1) % 2 == 0) {
			cout << "Positive" << endl;
		}
		else {
			cout << "Negative" << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
long long int gcd(long long int a, long long int b) {

	long long int tmp;

	while (a % b != 0)
	{
		tmp = b;
		b = a % b;
		a = tmp;
	}

	return b;
}

long main() {

	long long int num_n;
	long long int i, j;
	long long int res = 1;

	long long int  *clock;

	scanf("%lld\n", &num_n);

	clock = (long long int *) malloc(sizeof(long long int *) * num_n);
//	fflush(stdin);

	for (i = 0; i < num_n; i++) {
		scanf("%lld\n", &clock[i]);
//		fflush(stdin);
	}

	for (i = 0; i < num_n; i++) {
		res *= (clock[i]/gcd(res,clock[i]));
	}

	printf("%lld",res);
	fflush(stdout);

	return 0;

}

Measured memory_bytes: 128
#include <bits/stdc++.h>
        using namespace std;
        #define int long long
const int MAX = 1000001;
const int MOD = 1000000007;
   
        signed main() {
           int h,n;
           cin>>h>>n;
           int dp[h+1];
           int a[n],b[n];
           for(int i=0;i<n;i++)cin>>a[i]>>b[i];
           for(int i=0;i<=h;i++)dp[i]=MOD;
           dp[0]=0;
           for(int i=0;i<h;i++){
               for(int j=0;j<n;j++){
                   dp[min(h,i+a[j])]=min(dp[min(h,i+a[j])],dp[i]+b[j]);
               }
           }
           cout<<dp[h];

           return 0;

        }


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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

using i64=int64_t;

void solve(){
    int A,B,C;
    cin >> A >> B >> C;

    if(A==B) cout << C << endl;
    else if(B==C) cout << A << endl;
    else cout << B << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 256
a,b=input().split()
a=int(a)
b=int(b)
i=0
sum=0
if b==1:
    print(0)
else:
    while True:
        if i==0:
            b=b-a
            sum+=1
            i+=1
        elif b<=0:
            print(sum)
            break
        else:
            b=b-a+1
            sum+=1
            i+=1

Measured memory_bytes: 9192
##C - Walking Takahash
##正負が反転しないなら単調増加、減少
##反転するなら、反転した瞬間で残りの回数が偶数なら、その値、奇数なら、一つ前にの値
X,K,D = map(int,input().split())
##X1の正負フラグがあれば簡潔に書けるかも
if X < 0:
    X = -X
R = K - X // D
if X-K*D >= 0:
    print(X-K*D)
else:
    if R % 2 == 0:
        print(X - D*(X//D))
    else:
        print(abs(X - D*(X//D)-D))

Measured memory_bytes: 9120
#include <iostream>
#include <map>
#define ll long long
using namespace std;

int main()
{
    ll x;
    cin >> x;
    for(ll i= -1000; i<=1000; i++){
        for(ll j=-1000; j<=1000; j++){
                if(i*i*i*i*i-j*j*j*j*j==x){
                    cout << i << " " << j;
                    return 0;
        }
    }
    }
    return 0;
}


Measured memory_bytes: 3636
// AOJ 2208: The Melancholy of Thomas Right
// 2017.11.6 bal4u@uu

#include <stdio.h>
#include <stdlib.h>
#define TM 0
#if TM
#include <time.h>
#endif

int r[10001], c[10001];

char buf[60001], *p;
int getint()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	return n;
}

int cmp(int *a, int *b) { return *b - *a; }
int main()
{
	int n, i, j;

	while (fgets(p=buf, 10, stdin) && *buf != '0') {
		n = getint();
		fgets(p=buf, 60000, stdin);
		for (i = 0; i < n; i++) r[i] = getint(), p++;
		fgets(p=buf, 60000, stdin);
		for (i = 0; i < n; i++) c[i] = getint(), p++;
		qsort(r, n, sizeof(int), cmp);
		for (i = 0; ; i++) {
			if (i == n) { puts("Yes"); break; }
			for (j = 0; j < n; j++) if (c[j] > 0) c[j]--, r[i]--;
			if (r[i]) { puts("No"); break; }
		}
	}
#if TM
	end = clock();
	printf("time %lf\n", (double)(end-start)/CLOCKS_PER_SEC);
#endif
	return 0;
}

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

int main(){
  map<char, int>mp = {
    {'S', 0}, 
    {'H', 1}, 
    {'C', 2}, 
    {'D', 3}, 
  };
  string mark = "SHCD";
  vector<vector<int>> a(4, vector<int>(13, 0));
  int n;
  cin >> n;
  for(int i = 0; i < n; i++){
    char c; cin >> c;
    int x; cin >> x;
    a[mp[c]][x - 1] = 1;
  }
  for(int i = 0; i < 4; i++){
    for(int j = 0; j < 13; j++){
      if(!a[i][j]){
        cout << mark[i] << " " << j + 1 << endl;
      }
    }
  }
}


Measured memory_bytes: 3180
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
typedef int64_t ll;
typedef long double ld;
struct Circle {
    ld x, y, z, r;
    ll p;
};

int n,q;
vector<Circle> cs;

ll solve(int sx, int sy, int sz, int dx, int dy, int dz){
    auto myhpt = [](ld x, ld y, ld z, Circle c){
        auto sq = [](ld x){ return x*x; };
        return sqrt(sq(x-c.x) + sq(y-c.y) + sq(z-c.z));
    };
    dx -= sx; dy -= sy; dz -= sz;
    ll ans = 0;
    for (int j = 0; j < n; j++){
        ld left = 0, right = 1;
        ld d = (ld)1e200;
        rep(t,200){
            ld m1 = (left+left+right) / 3;
            ld m2 = (left+right+right) / 3;
            ld m1x = sx + m1*dx, m1y = sy + m1*dy, m1z = sz + m1*dz;
            ld m2x = sx + m2*dx, m2y = sy + m2*dy, m2z = sz + m2*dz;
            ld d1 = myhpt(m1x, m1y, m1z, cs[j]);
            ld d2 = myhpt(m2x, m2y, m2z, cs[j]);
            if (d1 < d2) right = m2; else left = m1;
            d = min(d, min(d1,d2));
        }
        if(d < cs[j].r + 1e-9) ans += cs[j].p;
    }
    return ans;
}

int main(){
    while(cin >> n >> q){
        cs.resize(n);
        rep(i,n) cin >> cs[i].x >> cs[i].y >> cs[i].z >> cs[i].r >> cs[i].p;
        rep(i,q){
            ld sx, sy, sz, dx, dy, dz;
            cin >> sx >> sy >> sz >> dx >> dy >> dz;
            cout << solve(sx, sy, sz, dx, dy, dz) << endl;
        }
    }
}

Measured memory_bytes: 1236
//file_name:ABC84_C.cpp
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // int scan
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // matrix scan
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // string scan
    /*
    string s;
    cin >> s;
    */


int main() {
    int n;
    scanf("%d",&n);
    int c[n];
    int s[n];
    int f[n];
    int dp[n+1][n+1];
    rep(i,n+1){
        rep(j,n+1){
            dp[i][j]=0;
        }
    }
    srep(i,1,n){
        cin >> c[i] >> s[i] >> f[i];
    }

    srep(i,1,n){
        srep(j,1,i+1){
            if(dp[i][j]<=s[i]){
                dp[i+1][j] = s[i] + c[i];
            }else{
                int x = 0;
                if(dp[i][j]%f[i]==0)x++;
                dp[i+1][j] = (dp[i][j]/f[i]+1-x)*f[i] + c[i];
            }
        }
    }
    srep(i,1,n+1){
        cout << dp[n][i] << endl;
    }


    return 0;
}



Measured memory_bytes: 1280
import sys
from heapq import heapify, heappush, heappop

read = sys.stdin.read
readline = sys.stdin.readline

H, W = map(int, readline().split())
s = tuple(map(str, read().split()))
INF = 10 ** 10
grid = [[INF] * W for _ in range(H)]
if s[0][0] == '#':
    grid[0][0] = 1
else:
    grid[0][0] = 0
start = (grid[0][0], (0, 0))
heap = [start]
heapify(heap)
while heap:
    d, (x, y) = heappop(heap)
    for i, j in ((0, 1), (1, 0)):
        new_x = x + i
        new_y = y + j
        if new_x == H or new_y == W:
            continue
        if grid[new_x][new_y] <= d:
            continue
        if s[x][y] == '.' and s[new_x][new_y] == '#':
            grid[new_x][new_y] = d + 1
            heappush(heap, (d + 1, (new_x, new_y)))
        else:
            grid[new_x][new_y] = d
            heappush(heap, (d, (new_x, new_y)))

print(grid[-1][-1])


Measured memory_bytes: 3188
import sys
sys.setrecursionlimit(2147483647)
input=sys.stdin.readline
import math
from heapq import heappush, heappop

def solve(h,w,tables,A):
  for i in range(10):
    for j in range(10):
      for k in range(10):
        tables[j][k] = min(tables[j][k], tables[j][i] + tables[i][k])
  cost = 0
  for i in range(h):
    for j in range(w):
      p = A[i][j]
      if p == -1:
        continue
      cost += tables[p][1]
  return cost
  

def main():
  h, w = map(int, input().split(' '))
  tables = []
  for i in range(10):
    tables.append(list(map(int, input().split(' '))))
  A = []
  for _ in range(h):
    A.append(list(map(int, input().split(' '))))
  ans = solve(h, w, tables, A)
  print(ans)
  

if __name__=='__main__':
  main()

Measured memory_bytes: 9616
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
    return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

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

    cout << min(n * a, b) << endl;

    return 0;
}


Measured memory_bytes: 256
n = gets.chomp.to_i
inputs = gets.split.map(&:to_i)
reject = 0
temp = 200000

(0...n).each do |i|
  _temp_1 = inputs[i]
  if temp < _temp_1
    reject += 1
  else
    temp = _temp_1
  end
end

puts n - reject

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

int main()
{
   int a,b,c=0;
   cin>>a>>b;
   c=a+b;
   if(c<24)
    cout<<c;
    else if(c==24)
        cout<<0;
   else {
        c-=24;
   cout<<c;
   }
    return 0;
}

Measured memory_bytes: 3628
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int c2d(char c){
  return c - '0';
}

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

  string s;
  while(cin>>s, s!="0"){
	int N = SZ(s);
	VI dp(11, 0);
	int ans = 0, sum = 0;
	dp[0] = 1;
	for(int i=0;i<N;++i){
	  sum = (sum + (i%2? -1: 1) * c2d(s[i]) + 11) % 11;
	  ans += dp[sum];
	  if(i+1<N && c2d(s[i+1]) != 0) dp[sum]++;
	}
	cout << ans << endl;
  }
  
  return 0;
}

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

int main() {
    int K,X;
    cin >> K >> X;
    long long sum = 0;
    for(int i = 0;i<K;++i)sum +=500;
    if(sum >= X){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
	return 0;
}

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

int main(void) {
  long long  N, K;
  cin >> N >> K;

  long long  n1 = N + 1;
  long long  n2 = K - 1;

  long long  ans = 0;
  ans += (N+1) * n1 * (n1+1) / 2 - n1 * (n1 + 1) * (2 * n1 + 1) / 6 + n1;
  ans -= (N+1) * n2 * (n2+1) / 2 - n2 * (n2 + 1) * (2 * n2 + 1) / 6 + n2;
  cout << ans % 1000000007 << std::endl;

  return 0;
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

ll T1, T2, A1, A2, B1, B2;
ll X, Y;

ll f(ll a, ll b, ll c, ll d, ll lb, ll ub){
    if(X == Y){
        return -1;
    }

    ll x = X, y = Y;

    if(y - x < 0){
        std::swap(x, y);
        std::swap(a, c);
        std::swap(b, d);
    }
    
    ll alpha = (a - c) * lb + (b - d), beta = (a - c) * ub + (b - d);

    if(a - c < 0){
        std::tie(alpha, beta) = std::make_tuple(beta + 1, alpha + 1);
    }
    alpha = std::max<ll>(alpha, 0);
    beta = std::max<ll>(beta, alpha);

    ll s = (alpha + (y - x) - 1) / (y - x), t = (beta + (y - x) - 1) / (y - x);

    return t - s;
}

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

  std::cin >> T1 >> T2 >> A1 >> A2 >> B1 >> B2;

  X = T1 * A1 + T2 * A2;
  Y = T1 * B1 + T2 * B2;

  ll c1 = f(A1, 0, B1, 0, 0, T1), c2 = f(A2, T1 * A1, B2, T1 * B1, 0, T2);
  
  // std::cout << "!" << c1 << ", " << c2 << std::endl;

  if(c1 == -1 || c2 == -1){
      std::cout << "infinity" << std::endl;
  }else{
      std::cout << std::max<ll>(c1 + c2 - 1, 0) << std::endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>

using namespace std;

int N,M;


int main(void) {

	cin >> N >> M;

	int ans = 0;

	if (N >= 2) { ans += (N*(N - 1)) / 2; }

	if (M >= 2) { ans += (M*(M - 1)) / 2; }

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int digit(int x) {
	int cnt = 0;
	while (x > 0) {
		cnt += x % 10;
		x /= 10;
	}
	return cnt;
}

signed main() {
	int n;
	cin >> n;
	int a[100005];
	rep(i, n) {
		cin >> a[i];
	}
	int ans = 0;
	for (int i = 1; i < n; i++) {
		if (a[i] > a[i - 1]) {
			ans++;
		}
	}
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 3868
num_int = list(map(int, input().split()))
A = num_int[0]
B = num_int[1]

if(A+B > A-B):
    if(A+B > A*B):
        print(A+B)
    else:
        print(A*B)
else:
    if(A-B > A*B):
        print(A-B)
    else:
        print(A*B)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod 1000000007
#define rep(i, n) for (int i = 0; i < n; ++i)
using Graph = vector<vector<int>>;
#define grepq priority_queue<double, std::vector<double>, std::greater<double>>
#define all(v) v.begin(), v.end()
#define PI acos(-1) 
bool IsPrime(int num)
{
    if (num < 2)
        return false;
    else if (num == 2)
        return true;
    else if (num % 2 == 0)
        return false; // 偶数はあらかじめ除く

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

    // 素数である
    return true;
}
const ll INF = 10010001010;
const int inf = 2000000000;
ll lcm(ll a, ll b)
{
    return a * b / __gcd(a, b);
}

typedef tuple<string, int, int> TUP;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
vector<int> Eratosthenes(const int N)
{
    vector<bool> is_prime(N + 1);
    for (int i = 0; i <= N; i++)
    {
        is_prime[i] = true;
    }
    vector<int> P;
    for (int i = 2; i <= N; i++)
    {
        if (is_prime[i])
        {
            for (int j = 2 * i; j <= N; j += i)
            {
                is_prime[j] = false;
            }
            P.emplace_back(i);
        }
    }
    return P;
}
vector<long long> divisor(long long n)
{
    vector<long long> ret;
    for (long long i = 1; i <= n; i++)
    {
        if (n % i == 0)
        {
            ret.push_back(n / i);
        }
    }
    return ret;
}
int main()
{
    ll A;
    long double B;
    cin >> A >> B;
    ll ans = A * B;
    
    cout << ans << endl;
}


Measured memory_bytes: 3800
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
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; }
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  IOS;
  int n,m; cin >> n >> m;
  M ma;
  REP(i,m) {
    int a; cin >> a;
    ma[a] = 1;
  }

  vector<int> dp(n+1,0);
  dp[0] = 1;
  for (int i = 1; i <= n; i++) {
    if (ma[i] == 1) continue;

    dp[i] += dp[i-1];
    if (i-2 >= 0) dp[i] += dp[i-2];

    dp[i] %= MOD;
  }

  COUT(dp[n]);
  return 0;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repeq(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define rep1(i,x,n) for(int (i)=(x);(i)<(int)(n);(i)++)
#define rep1eq(i,x,n) for(int (i)=(x);(i)<=(int)(n);(i)++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
using namespace std;
using ll = long long;
using Int = long long;

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;
typedef pair<int,int> P;
typedef std::priority_queue<int> IntPrioQueue;
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue;

//少数点表示
//cout << std::fixed << std::setprecision(14) << 値

int main(){
    cin.tie( 0 ); ios::sync_with_stdio( false );
    ll n;
    cin >> n;
    vector<ll> a(n+1),b(n);
    rep(i,n+1) cin >> a[i];

    rep(i,n) cin >> b[i];

    ll cnt = 0;
    rep(i,n){
        if(b[i]>=a[i]+a[i+1]){
            cnt += (a[i]+a[i+1]);
            a[i+1] = 0;
        }else if(b[i]>=a[i] && b[i]<a[i]+a[i+1]){
            cnt += b[i];
            a[i+1]=a[i+1]-(b[i]-a[i]);
        }else{
            cnt += b[i];
        }
    }
    cout << cnt <<endl;
    return 0;

}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <map>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <utility>

#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; i++)
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 (a > b) {a = b; return 1;} return 0; }

typedef long long ll;
using namespace std;
int main() {
    
    ll w, h;
    cin >> h >> w;

    ll ans = 1ll << 60;
    vector<ll> s(3, 0);

    for (ll w0 = 0; w0 < w; w0++) {
        s[0] = w0 * h;
        s[1] = (w - w0) * (h / 2);
        s[2] = (w - w0) * (h - h/2);
        chmin(ans, max({s[0], s[1], s[2]}) - min({s[0], s[1], s[2]}));
        s[1] = ((w - w0) / 2) * h;
        s[2] = ((w - w0) - (w - w0) / 2) * h;
        chmin(ans, max({s[0], s[1], s[2]}) - min({s[0], s[1], s[2]}));
    }
    
    for (ll h0 = 0; h0 < h; h0++) {
        s[0] = h0 * w;
        s[1] = (h - h0) * (w / 2);
        s[2] = (h - h0) * (w - w/2);
        chmin(ans, max({s[0], s[1], s[2]}) - min({s[0], s[1], s[2]}));
        s[1] = ((h - h0) / 2) * w;
        s[2] = ((h - h0) - (h - h0) / 2) * w;
        chmin(ans, max({s[0], s[1], s[2]}) - min({s[0], s[1], s[2]}));
    }

    cout << ans << endl;
    
}

Measured memory_bytes: 256
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>  
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000000000000000000000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
int ans[200000] = {};
int main() {
#define int long long
	int n, l, t;
	cin >> n >> l >> t;
	vector<pair<int, int>> input;
	REP(i, n) {
		int a, b;
		cin >> a >> b;
		if (b == 1) {
			input.push_back(make_pair(a, 1));
		}
		else {
			input.push_back(make_pair(a, -1));
		}
	}
	vector<int> positions;
	for (int i = 0; i < n; ++i) {
		int now_position = input[i].first;
		now_position += input[i].second * (t % l);
		now_position %= l;
		now_position += l;
		now_position %= l;
		positions.push_back(now_position);
	}
	int starter = positions[0];
	sort(positions.begin(), positions.end());
	int now_cnt = 0;
	for (int i = 1; i < n; ++i) {
		if (input[i].second != input[0].second) {
			if (input[0].second == 1) {
				int first_step = input[i].first - input[0].first;
				int now_ans = 2*t;
				if (first_step < now_ans) {
					now_ans -= first_step;
					now_cnt += 1LL + (now_ans - 1) / l;
					now_cnt %= n;
				}
			}
			else {
				int first_step = (l - input[i].first) + input[0].first;
				int now_ans = 2LL * t;
				if (first_step < now_ans) {
					now_ans -= first_step;
					now_cnt -= 1LL + (now_ans - 1) / l;
					now_cnt += n * (abs(now_cnt) / n + 1);
					now_cnt %= n;
				}
			}
		}
	}
	int now_itr = 0;
	if (input[0].second == 1) {
		for (int i = 0; i < positions.size(); ++i) {
			if (positions[i] == starter) {
				now_itr = i;
				break;
			}
		}
	}
	else {
		for (int i = positions.size() - 1; i >= 0; --i) {
			if (positions[i] == starter) {
				now_itr = i;
				break;
			}
		}
	}
	for (int i = 0; i < n; ++i) {
		ans[now_cnt] = positions[(now_itr+i)%n];
		now_cnt++;
		now_cnt %= n;
	}
	REP(i, n) {
		cout << ans[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 4976
using System;
using System.Collections.Generic;

namespace cswork
{

    class Program
    {
        public Program() { }

        Scanner cin;

        void Omame()
        {
            cin = new Scanner();

            int n = cin.nextInt();

            List<List<int[]>> say = new List<List<int[]>>();
            for (int i = 0; i < n; i++)
            {
                int m = cin.nextInt();
                List<int[]> list = new List<int[]>();
                for (int j = 0; j < m; j++)
                {
                    int[] tmp = new int[2];
                    tmp[0] = cin.nextInt() - 1;
                    tmp[1] = cin.nextInt();
                    list.Add(tmp);
                }
                say.Add(list);
            }

            int ans = 0;
            // bit全探索（1:正直者、0:不親切）
            for (int i = 0; i < 1 << n; i++)
            {
                int count = 0;
                for (int j = 0; j < n; j++)
                {
                    // 不親切な人はスキップ
                    if ((i >> j & 1) == 0)
                    {
                        continue;
                    }

                    count++;

                    // 誠実な人の言うことがあっているか確認
                    for (int k = 0; k < say[j].Count; k++)
                    {
                        int trg = i >> say[j][k][0] & 1;
                        int isHonest = say[j][k][1];

                        if (trg != isHonest)
                        {
                            count--;
                            break;
                        }
                    }
                }

                int honestCount = 0;
                for (int j = 0; j < n; j++)
                {
                    if ((i >> j & 1) == 1)
                    {
                        honestCount++;
                    }
                }
                if (count == honestCount)
                {
                    ans = Math.Max(ans, count);
                }
            }

            Console.WriteLine(ans);
        }

        static void Main(string[] args)
        {
            new Program().Omame();
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();

            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next();
        }

        public int nextInt()
        {
            return int.Parse(next());
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }
    }
}

Measured memory_bytes: 11220
/* BISMILLAHIR RAHMANIR RAHIM */
#include<bits/stdc++.h>
using namespace std;
#define ll        long long
#define ull       unsigned long long
#define sd(x)     scanf("%lf", &x)
#define l0(i,n)   for(ll i=0; i<n; i++)
#define MAX       100005
#define maxn 	  200005
#define pb 		  push_back
#define mk 		  make_pair
#define endl	  "\n"
#define INF 	  1000000000
#define MOD		  1000000007
#define imie(...) "[" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

int cost[maxn];
int dp[maxn];
int main()
{
	int n;
	cin >> n;
	for (int i=0 ; i<n ; i++) cin >> cost[i];
	dp[0] = 0;
	for (int i=1 ; i<n ; i++)
	{
		if(i==1) dp[i] = dp[i-1] + abs(cost[i] - cost[i-1]);
		else
		dp[i] = min(dp[i-1] + abs(cost[i] - cost[i-1]) , dp[i-2] + abs(cost[i] -  cost[i-2]));
	}
	cout << dp[n-1] << endl;
	return 0;
}


Measured memory_bytes: 4416
#include"bits/stdc++.h"
using namespace std;
#define REP(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define rep(i,n) REP((i),0,(n))
using ll = long long;

int main()
{
	ll N;
	cin >> N;
	map<string, ll>mp;

	rep(i, N) {
		string s;
		cin >> s;
		sort(s.begin(), s.end());
		mp[s]++;
	}

	ll res = 0;
	for (auto itr : mp) {
		res += itr.second*(itr.second - 1) / 2;
	}
	cout << res << endl;

	return 0;
}


Measured memory_bytes: 11136
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{

    class Program
    {
        static void Main(string[] args)
        {
            var vals = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var N = vals[0];
            var M = vals[1];
            vals = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var diffs = new long[M - 1];
            var sorted = vals.OrderBy(x => x).ToArray();
            for(var i=0; i<M-1; i++)
            {
                diffs[i] = sorted[i + 1] - sorted[i];
            }
            var diffsorted = diffs.OrderByDescending(x => x).Skip(N - 1).ToArray();
            if(diffsorted.Length == 0)
            {
                Console.WriteLine(0);
            }
            else
            {
                Console.WriteLine(diffsorted.Sum());
            }
        }

    }
}
//A

Measured memory_bytes: 27616
#include <bits/stdc++.h>
using namespace std;
int main(){
  int64_t n, y, c;
  cin >> n;
  int64_t x=sqrt(n);
  int64_t m=1;
  for(int64_t i=1;i<x+1;i++){
    if(n%i==0) {
      m=max(i, m);
    }
  }
  y=n/m;
  c=1;
  while(y>9){
    y=y/10;
    c++;
  }
  cout << c << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define first_more_idx(ve, num) upper_bound(all(ve), num)-ve.begin() // idx = first_more_idx(ve,num); if(idx = ve.size()) , then not exist
#define first_lessequal_idx(ve, num) lower_bound(all(ve), num)-ve.begin()
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > // only sort first param
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}
ll power(ll x, ll n){if(n == 0) return 1;return  (n%2)? x*power(x, n-1)%MOD : power(x*x%MOD, n/2);}
ll dx[]={0, 0, -1, 1};
ll dy[]={1, -1, 0, 0};// up,down,left right


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

    ll N;
    cin >> N ;

    vector<ll> A;
    
    rep(i, N){
        ll inp; cin >> inp;
        A.pb(inp);
    }

    
    for(int i = N-2; i >= 0; i--){
        if(A[i] > A[i+1]) A[i]--;
        
        if(A[i] > A[i+1]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    
    
    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}






Measured memory_bytes: 1400
<?php
const MOD = 10 ** 9 + 7;
list($s) = ints();
echo dfs();
function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}
function dfs($sum = 0)
{
    global $s, $memo;
    if (isset($memo[$sum])) return $memo[$sum];
    if ($sum > $s) return 0;
    if ($sum === $s) return 1;
    $res = 0;
    for ($i = 3; $i <= $s - $sum; ++$i) {
        $res += dfs($sum + $i);
        $res %= MOD;
    }
    $memo[$sum] = $res;
    return $res;
}


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

int main() {
  ll n, a, b, ans = 0;
  cin >> n;
  vector<int> c(n);
  rep(i, n) {
    cin >> a >> b;
    c[i] = a + b;
    ans -= b;
  }
  sort(c.rbegin(), c.rend());

  for (int i = 0; i < n; i += 2) ans += c[i];
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3748
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

int main()
{
    long n, a, b;
    std::string s, t, u;

    std::cin >> s >> t;
    std::cin >> a >> b;
    std::cin >> u;
    if (s == u)
        a--;
    if (t == u)
        b--;
    std::cout << a << " " << b << std::endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

int N;
Graph G;

vector<int> res;
void dfs(int v, int p, int c)
{
    res[v] = c;
    for (auto e : G[v])
    {
        if (e.first == p)
            continue;
        if (e.second & 1)
            dfs(e.first, v, 1 - c);
        else
            dfs(e.first, v, c);
    }
}

void solve(long long N, std::vector<long long> u, std::vector<long long> v, std::vector<long long> w)
{

}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    cin >> N;
    G.assign(N,vector<Edge>());

    for (int i = 0; i < N - 1; i++)
    {
        int u,v,w;
        cin >> u >> v >> w;
        --u;--v;
        G[u].push_back(Edge(v,w));
        G[v].push_back(Edge(u,w));
    }
    res.assign(N,0);
    dfs(0,-1,1);
    for (auto &&v : res)
    {
        cout << v << endl;
    }
    
    return 0;
}


Measured memory_bytes: 8960
if __name__ == '__main__':
    N, Y = map(int, input().split())

    target = 10000 * N - Y

    ans_x = -1
    ans_y = -1
    for x in range(0, N + 1):
        y = 0
        while x + y <= N:
            if 9000 * x + 5000 * y == target:
                ans_x = x
                ans_y = y
                break
            y += 1

    if ans_x != -1:
        print(str(N - ans_x - ans_y) + ' ' + str(ans_y) + ' ' + str(ans_x))
    else:
        print("-1 -1 -1")


Measured memory_bytes: 3060
#include<stdio.h>
int main()
{
    int a, b, k;
    scanf("%d %d %d", &a, &b, &k);
    int ans = a + 1;
    if (ans < b + 1)
        ans = b + 1;
    while (k > 0)
    {
        ans--;
        if (a%ans == 0 && b%ans == 0)
            k--;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 128
// Hint: Don't look, No need, Let'em Play.

#pragma optimize("O2")
#include <bits/stdc++.h>
#include "bits/stdc++.h"

using namespace std;

#define int long long
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#ifndef bhupixb
    #define var(...)
    #define stl(...)
#endif

void solve() {
  int n, x;
  cin >> n;
  const int mx = 1e6 + 4;
  vector<int> used(mx);
  for (int i = 0; i < n; ++i) {
    cin >> x;
    used[x]++;
  }
  // for (int &x: used) if (x > 1) x = 0;
  vector<bool> found(mx);
  for (int i = 1; i < mx; ++i) {
    for (int j = i + i; j < mx; j += i) {
        if (used[i]) found[j] = true;
    }
  }
  int ans = 0;
  for (int i = 1; i < mx; ++i) {
    if (used[i] > 1) continue;
    ans += !found[i] * used[i];
    if (found[i] && used[i]) {
        var(i);
    }
  }
  cout << ans << '\n';
}

signed main() {
    fast;
    int t = 1; //cin >> t;
    while (t--) {
        solve();
    }


  return 0;
}


Measured memory_bytes: 11376
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

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

    bool zoro = false;
    int cur = 0;
    for (int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;
        if (a == b) {
            cur++;
            if (cur == 3) zoro = true;
        } else {
            cur = 0;
        }
    }

    cout << (zoro ? "Yes" : "No") << endl;
    return 0;
}

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

int time(int* t,int* i){
    int ans = *t + *i;
    if (ans >= 24){
        ans = ans -24;
    }
    return ans;
}

int main() {
    int t,i;
    cin >> t>>i;
    int ans = time(&t,&i);
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
using pii = std::pair<int, int>;
#define SORT(v) std::sort(v.begin(), v.end())

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, k, ans = 0, max_ele = 0;
	cin >> n;
	int a[100001] = {0};
	for (int i = 0; i < n;++i) {
		cin >> k;
		a[k]++;
		max_ele=max(max_ele, k);
	}

	for (int i = 0; i <= max_ele; ++i) {
		if (i == 0) {
			ans = a[0] + a[1];
		}
		else if (i == max_ele) {
			ans=max(ans, a[i] + a[i - 1]);
		}
		else {
			ans=max(ans, a[i - 1] + a[i + 1] + a[i]);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
import math


inputs = input().split(' ')
a,b = int(inputs[0]), int(inputs[1])
h,m = int(inputs[2]), int(inputs[3])

h *= 30
h += m/2
m *= 6

a1 = a * math.sin(math.radians(h))
a2 = a * math.cos(math.radians(h))
b1 = b * math.sin(math.radians(m))
b2 = b * math.cos(math.radians(m))

print(math.sqrt((a1 - b1)**2 + (a2 - b2)**2))

Measured memory_bytes: 9532
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        static void Main(string[] args)
        {
            try
            {
                SetOut(sw);
                Solve.Answer();
                Out.Flush();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
                Out.Flush();
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            var s = ReadLine();
            for (int i = 0; i < s.Length - 1; i++)
            {
                if (s[i] == 'A' && s[i + 1] == 'C')
                {
                    WriteLine("Yes");
                    return;
                }
            }
            WriteLine("No");
        }

    }

    public struct Pair
    {
        public Pair(int a, int b)
        {
            this.a = a;
            this.b = b;
        }
        public int a;
        public int b;
    }

    public class IO
    {
        #region Input
        public static int RInt => int.Parse(ReadLine());
        public static long RLong => long.Parse(ReadLine());
        public static double RDouble => double.Parse(ReadLine());

        public static string[] RSString => ReadLine().Split();
        public static int[] RSInt => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        public static long[] RSLong => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
        public static double[] RSDouble => ReadLine().Split().Select(s => double.Parse(s)).ToArray();
        #endregion

        #region Output
        public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
        public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");
        public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES" : "NO");
        #endregion
    }

    public class Mod
    {
        #region
        private readonly static long M = 1000000007;

        public static long Add(long a, long b) => (a * b) % M;
        public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
        public static long Multi(long a, long b) => (a * b) % M;
        #endregion
    }
}

Measured memory_bytes: 17364
#include<bits/stdc++.h>
#define rep(i,n)  for(ll i=0; i<n; i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF 1e9
using ll = long long;
using namespace std;
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 main(){
  int n; cin >> n;
  map<int,int> mp;
  rep(i,n){
    int a; cin >> a;
    mp[a-1]++;
    mp[a]++;
    mp[a+1]++;
  }
  int ans = 0;
  for(auto x : mp) chmax(ans,x.second);
  cout << ans;
  cout << "\n";
  return 0;
}


Measured memory_bytes: 7872
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define repp(i, m, n) for(int i = m; i < n; i++)
const int    INF = 100000000;
const double EPS = 1e-10;
const int    MOD = 1000000007;
using namespace std;
typedef long long ll;
typedef pair<int, int> pai;
typedef pair<ll,ll> pal;

int parent[55], sz[55]; // サイズを忘れずに入れる

void build(int n)
{
    repp(i, 1, n+1)
    {
        parent[i]=i;
        sz[i]=1;
    }
}

int root(int a)
{
    if(parent[a]==a)    return a;
    else    return (parent[a]=root(parent[a]));
}

bool same_set(int a, int b)
{
    return (root(a)==root(b));
}

void unite(int a, int b)
{
    if(root(a)!=root(b))
    {
        if(sz[root(a)]<sz[root(b)]) swap(a, b);
        sz[root(a)]+=sz[root(b)];
        parent[root(b)]=root(a);
    }
}
int main()
{
    int n, m;
    cin >> n >> m;
    pai ed[55];
    rep(i, m) cin >> ed[i].first >> ed[i].second;
    int ans=0;
    rep(i, m)
    {
        build(n);
        rep(j, m)
        {
            if(j!=i) unite(ed[j].first, ed[j].second);
        }
        repp(j, 2, n+1) 
        {
            if(!same_set(1, j))
            {
                ans++;
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import scala.io.StdIn._

object Main {
  def main(args: Array[String]): Unit = {
    val Array(n, k) = readLine().split(" ").map(_.toInt)
    val a: Array[Int] = readLine().split(" ").map(_.toInt)
    //println(solve(n, k, a))
    println(solve(n,k,a))
    //count(a).map((x) => print(x))

  }

  def count(ints: Array[Int]): List[(Int, Int)] = {
    val gen = ints.sortWith(_<_)
    var ans: List[(Int, Int)] = Nil
    var temp = (ints(0), 0)

    for(x <- gen){
      if(x == temp._1) temp = (temp._1, temp._2 + 1)
      else {
        ans = temp :: ans
        temp = (x, 1)
      }
    }
    temp :: ans
  }


  def solve(i: Int, i1: Int, ints: Array[Int]): Int = {
    val a = count(ints)
    a.sortBy(_._2).take(if(a.length > i1) a.length - i1 else 0).foldLeft(0)((acc, x) => acc + x._2 )
  }


}


Measured memory_bytes: 80744
N = int(input())
T = [2 * int(i) for i in input().split()]
V = [2 * int(i) for i in input().split()]

su = sum(T)
A = [min(i, su - i) for i in range(su + 1)]

cnt = 0
for t, v in zip(T, V):
    for i in range(cnt, cnt + t + 1):
        A[i] = min(A[i], v)
    cnt += t

for i in range(su):
    A[i + 1] = min(A[i + 1], A[i] + 1)

for i in reversed(range(su)):
    A[i] = min(A[i], A[i + 1] + 1)

print(sum(A) / 4)

Measured memory_bytes: 4648