akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author bhavy seth
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, InputReader sc, PrintWriter out) {
            int n = sc.nextInt();
            int m = sc.nextInt();
            int a[] = new int[n + 1];
            for (int i = 1; i <= n; i++) {
                a[i] = sc.nextInt();
            }
            int count = n;
            boolean counted[] = new boolean[n + 1];
            for (int i = 0; i < m; i++) {
                int ai = sc.nextInt();
                int bi = sc.nextInt();
                if (!counted[ai] && a[ai] <= a[bi]) {
                    count--;
                    counted[ai] = true;
                }
                if (!counted[bi] && a[bi] <= a[ai]) {
                    count--;
                    counted[bi] = true;
                }
            }
            out.println(count);
        }

    }

    static class InputReader {
        BufferedReader br;
        StringTokenizer st;

        public InputReader(InputStream inputStream) {
            br = new BufferedReader(new
                    InputStreamReader(inputStream));
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



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

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

    int ans = 0;
    for (int b = 1; b < 32; b++) {
        for (int p = 2; p < 10; p++) {
            int a = pow(b, p);
            if (a <= x) ans = max(ans, a);
        }
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import Control.Applicative ((<$>))
import Control.Monad
import Data.Complex
import Data.Maybe
import Text.Printf

type Point = Complex Double
type Vector = Complex Double

eps :: Double
eps = 1e-7

dot :: Vector -> Vector -> Double
dot a b = realPart $ conjugate a * b

cross :: Vector -> Vector -> Double
cross a b = imagPart $ conjugate a * b

normalize :: Vector -> Vector
normalize = signum

readWords :: Read a => IO [a]
readWords = map read . words <$> getLine

data Line = Line {
  a :: Double,
  b :: Double,
  c :: Double
}

data LineSeg = LineSeg {
  p :: Point,
  q :: Point,
  l :: Line
}

mkLine :: Point -> Point -> Line
mkLine p1@(x:+y) p2 = Line a b c where
  (nx:+ny) = (p2-p1)*(0:+1)
  a = nx
  b = ny
  c = -(a*x+b*y)

mkLineSeg :: Point -> Point -> LineSeg
mkLineSeg p1 p2 = LineSeg p1 p2 $ mkLine p1 p2

intersect :: Line -> Line -> Maybe Point
intersect (Line a1 b1 c1) (Line a2 b2 c2)
  | abs ((a1:+b1)`cross`(a2:+b2)) < eps = Nothing
  | otherwise = Just (x/det:+y/det)
  where
    det = a1*b2-b1*a2
    x = c2*b1-c1*b2
    y = a2*c1-a1*c2

intersectLS :: LineSeg -> LineSeg -> Maybe Point
intersectLS (LineSeg p1 q1 l1) (LineSeg p2 q2 l2)
  | cpM == Nothing = Nothing
  | onSeg p1 q1 cp && onSeg p2 q2 cp = Just cp
  | otherwise = Nothing
  where
    cpM = intersect l1 l2
    cp = fromJust cpM
    onSeg p q cp = (cp-p)`dot`(cp-q) < eps
    
main :: IO ()
main = do
  q <- readLn
  qs <- replicateM q $ do
    [x0,y0,x1,y1,x2,y2,x3,y3] <- readWords :: IO [Double]
    let
      p0 = x0:+y0
      p1 = x1:+y1
      p2 = x2:+y2
      p3 = x3:+y3
    return (p0,p1,p2,p3)

  forM_ qs $ \(p0,p1,p2,p3) -> do
    let
      (Just (x:+y)) = intersectLS (mkLineSeg p0 p1) (mkLineSeg p2 p3)
      zero f
        | abs f < eps = 0
        | otherwise = f

    printf "%.10f %.10f\n" (zero x) (zero y)

Measured memory_bytes: 6512
#ABC054A
a,b = map(int,input().split())
s = "Alice"
t = "Bob"
if ((a == 1)and(b == 13)):
    print(s)
elif((a == 13)and(b == 1)):
    print(t)
elif ((a > b) and (a != 1) ):
    print(s)
elif ((a < b) and (a != 1)):
    print(t)
else:
    print("Draw")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define Rep(i,N) for(i=0;i<N;i++)
#define mod 1000000007

long mmax(long a,long b,long c){return a<b?max(b,c):max(a,c);}

long mmin(long a,long b,long c){return a<b?min(a,c):min(b,c);}

long long modinv(long long a) {
    long long b = mod, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= mod;
    if (u < 0) u += mod;
    return u;
}

long long moddevide(long long a,long long b){return (a*modinv(b))%mod;}

long long modncr(long long n,long long r){
  long long i,plus=1;
  for(i=0;i<r;i++){
    plus=(plus*(n-i))%mod;
    plus=moddevide(plus,i+1);
  }
  return plus;
}

long long euclidean_gcd(long long a, long long b) {
  if(a < b) return euclidean_gcd(b, a);
  long long r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int main(){
  int i,N,A,B,sm,tm,sM,tM,mid;
  long x,a,b,c,d;
  cin>>A>>B>>N;
  vector<long> sh(A+2,0),te(B+2,0);
  Rep(i,A){
  cin>>sh[i+1];
  }
  sh[0]=-10000000000;
  sh[A+1]=20000000000;
  Rep(i,B){
  cin>>te[i+1];
  }
  te[0]=-10000000000;
  te[B+1]=20000000000;

  Rep(i,N){
    cin>>x;
    sM=A+1;sm=0;
    while(abs(sM-sm)>1){
      mid=(sM+sm)/2;
      if(sh[mid]<x){
        sm=mid;
      }else{
        sM=mid;
      }
    }
    a=sh[sM]-x;b=x-sh[sm];
    tM=B+1;tm=0;
    while(abs(tM-tm)>1){
      mid=(tM+tm)/2;
      if(te[mid]<x){
        tm=mid;
      }else{
        tM=mid;
      }
    }
    c=te[tM]-x;d=x-te[tm];
    cout << min({a+d+min(a,d),b+c+min(b,c),max(a,c),max(b,d)}) <<endl;
  }
  return 0;
}

Measured memory_bytes: 2944
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <functional>
#include <map>
#include <climits>
#include <stack>
#include <string>
#include <random>
#include<set>
#include <iomanip>
#include <climits>
#include <memory>

int main() {
	int n, p;
	std::cin >> n >> p;
	while (n != 0) {
		std::vector<int> players(n, 0);
		int pos = 0;
		int in_cup = p;
		while (in_cup != 1 || players[pos] + 1 != p) {
			if (in_cup > 0) {
				players[pos]++;
				in_cup--;
			}
			else {
				in_cup += players[pos];
				players[pos] = 0;
			}
			pos = (pos + 1) % n;
		}
		std::cout << pos << std::endl;
		std::cin >> n >> p;
	}
}



Measured memory_bytes: 3080
/*input
6 0
*/
/**
    Author: Kristopher Paul
    Date Created: 12-01-2020
    Contest Name:
                _/    _/   _/_/_/_/   _/   _/_/_/_/
               _/  _/     _/    _/   _/   _/
              _/_/       _/_/_/_/   _/   _/_/_/_/
             _/  _/     _/  _/     _/         _/
            _/    _/   _/    _/   _/   _/_/_/_/
**/
#include<bits/stdc++.h>
#include<stdio.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int ll
#define pb push_back
#define INF 1e18
#define MOD 1000000007
//#define MOD 998244353
#define mp make_pair
const double PI=3.141592653589793238462643383279502884197169399375105820974944;
#define REP(i,n) for (int i = 0; i < n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)
#define remax(a,b) a = max(a,b)
#define remin(a,b) a = min(a,b)
#define umap unordered_map
#define pii pair<int,int>
#define F first
#define S second
#define mii map<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define itr :: iterator it
#define all(v) v.begin(),v.end()
#define WL(t) while(t--)
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define out(x) cout << #x << " is " << x << endl
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

//Uncomment for File I/O
/*
#define cin fin
#define cout fout

ifstream fin("input.in");
ofstream fout("input.out");
*/

using namespace std;
//using namespace __gnu_pbds;

//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> pbds; // set
//typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> pbds; // multiset

int ModExp(int x,int y,int m){
    int res = 1;
    x = x % m;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % m;

        y = y>>1;
        x = (x*x) % m;
    }
    return res;
}

void solve(){
    int n,m;
    cin >> n >> m;
    umap<int,bool> c;
    int a = 0,b = 0;
    umap<int,int> cnt;
    FOR(i,0,m){
        int p;
        string s;
        cin >> p >> s;
        if(s == "AC"){
            if(c[p] == false){
                c[p] = true;
                a++;
            }
        }else{
            if(c[p] == false){
                cnt[p]++;
            }
        }
    }
    FOR(i,1,n+1){
        if(c[i] == true){
            b += cnt[i];
        }
    }
    cout << a << " " << b << endl;
}

signed main(){
    FastIO;
    int t = 1;
//    cin >> t;
    WL(t){
        solve();
    }
}

Measured memory_bytes: 8484
/*
 * 	The way if it's all predetermined
 * 		And the way i should go all my life
 * 			I swear to go wherever will be
 * 				'Cause there'll be something to see and to find
 */
//#pragma GCC optimize("Ofast,unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#ifdef rd
#define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma=strchr(names+1,',');
	cout.write(names,comma-names)<<" : "<<arg1<<" | ";
	__f(comma+1,args...);
}
#else
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef long double f80;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
const ll infl=2e18;
const int infi=1e9;
//const int mod=998244353;
const int mod=1000000007;
typedef vector<int> vi;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;
auto clk=clock();
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}


int powm(int a, int b) {
	a%=mod;
	int res=1;
	while(b) {
		if(b&1)
			res=(res*a)%mod;
		b>>=1;
		a=(a*a)%mod;
	}
	return res;
}

void solve() {
	int n,a,b,c,d;
	cin>>n>>a>>b>>c>>d;
	string s;
	cin>>s;
	s='.'+s;
	for(int i=a; i<c; i++) {
		if(s[i]=='#'&&s[i+1]=='#') {
			cout<<"No"<<endl;
			return;
		}
	}
	for(int i=b; i<d; i++) {
		if(s[i]=='#'&&s[i+1]=='#') {
			cout<<"No"<<endl;
			return;
		}
	}
	bool tolol=0;
	for(int i=max(0LL,b-1); i<d&&i+1<n; i++) {
		if(s[i]=='.'&&s[i+1]=='.'&&s[i+2]=='.') {
			tolol=1;
		}
	}
	if(c<d||tolol) {
		cout<<"Yes"<<endl;
		return;
	} else {
		cout<<"No"<<endl;
	}
}

signed main() {
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	cout<<fixed<<setprecision(10);
	int t=1;
//	cin>>t;
	while(t--)
		solve();
#ifdef rd
	cout<<endl<<endl<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
#endif
	return 0;
}


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

public class Main {

  public static void main(String[] args) throws IOException {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    String readStr;
    int[] numPatternCount = new int[19];
    int i, j, k, l;
    int size = 9;
    int sum;
    i:
    for (i = 0; i <= size; i++) {
      int kSize = size;
      j:
      for (j = 0; j <= size; j++) {
        int lSize = size;
        k:
        for (k = 0; k <= kSize; k++) {
          if (i + j + k > 18) {
            kSize = 18 - i - j;
            continue j;
          }
          l:
          for (l = 0; l <= size; l++) {
            sum = i + j + k + l;
            if (i + j + k + l > 18) {
            lSize = 18 - i - j - k;
            continue k;
          }
            numPatternCount[sum]++;
          }
        }
      }
    }

    while ((readStr = reader.readLine()) != null) {
      int n = Integer.parseInt(readStr);
      System.out.println(
              n > 36 ? 0
              : numPatternCount[n > 18 ? numPatternCount.length - (n - numPatternCount.length) - 2 : n]
      );
    }
  }

}

Measured memory_bytes: 16876
n,l=gets.split.map &:to_i
a=gets.split.map &:to_i
j=false
c=nil
(n-2).downto(0) do |i|
  if a[i]+a[i+1]>=l
    j=true
    c=i
    break
  end
end
if j
  puts :Possible
  c.times do |i|
    p i+1
  end
  (n-2).downto(c) do |i|
    p i+1
  end
else
  puts :Impossible
end

Measured memory_bytes: 16780
#include <stdio.h>

int main(){
  int N, H[101], max=0;
  int ans=0;
  scanf("%d",&N);
  for(int i=0; i<N; i++){
    scanf("%d",&H[i]);
    if(max<=H[i]){
      ans++;
      max=H[i];
    }
  }
  printf("%d\n",ans);
}

Measured memory_bytes: 128
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        Array.Sort(a);
        var ret = a[2] - a[1];
        var w = a[1] - a[0];
        if (w % 2 == 0) ret += w / 2;
        else ret += (w - 1) / 2 + 2;
        Console.WriteLine(ret);
    }
}

Measured memory_bytes: 13268
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
using ull=unsigned long long;
constexpr auto inf=static_cast<ll>(1e18);
template<typename T=ll>inline T in(){T ret;cin>>ret;return ret;}
template<typename T=ll>inline auto vec2(size_t h,size_t w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}
inline void setp(int n){cout<<fixed<<setprecision(n);}
inline void delnl(){cin.ignore(numeric_limits<streamsize>::max(),'\n');}

int main()
{
    ll n=in();
    string s;cin>>s;
    for(auto c:s){
        cout<<(char)((c-'A'+n)%26+'A');
    }
    cout<<endl;
}


Measured memory_bytes: 256
(let* ((n (read))
    (p (make-array n))
    (ans 0))

    (loop for i below n do
        (setf (aref p i) (read))
    )

    (loop for i from 1 below (- n 1) do
        (let ((a (make-array 3)))
            (setf (aref a 0) (aref p (- i 1)))
            (setf (aref a 1) (aref p i))
            (setf (aref a 2) (aref p (+ i 1)))
            (setf a (sort a #'<))
            (if (= (aref p i) (aref a 1))
                (incf ans)
            )
        )
    )
    (princ ans)
)

Measured memory_bytes: 24512
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#define sqr(x) (x)*(x)
using namespace std;
long long n,m,i,j,num[100005],ans;
string st;
int main()
{
	cin>>n>>m;
	if (n>m) swap(n,m); 
	if (n==1)
	{
		if (m==1)
		{
			cout<<1;
			return 0;
		}
		cout<<m-2;
		return 0;
	}
	if (n==2)
	{
		cout<<0;
		return 0;
	}
	cout<<(n-2)*(m-2);
	return 0; 
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
public static void main(String[] args){
             Scanner sc = new Scanner(System.in);
              
             while(true){
             int a =sc.nextInt();
             String op = sc.next();
             int b=sc.nextInt();
              
               
             if(op.equals("?"))break;
             if(op.equals("+")){
                System.out.println(a+b);
             } else if (op.equals("-")){
                 System.out.println(a-b);
             }else if(op.equals("*")){
                 System.out.println(a*b);
             }else if(op.equals("/")){
                 System.out.println(a/b);
             }
}
             
              
             sc.close();
}
}


Measured memory_bytes: 26352
#include<bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    LL n;
    cin >> n;
    vector< LL > div;

    for( LL i = 1; i * i <= n; ++i ) {
        if( !( n % i ) ) {
            div.pb( i );

        }
    }

    int dig = INF;
    LL d = 10;
    for( int i = 0; i < div.size(); ++i ) {
        int cnt = 0;
        LL tmp = div[i];
        while( tmp > 0 ) {
            tmp /= d;
            ++cnt;
        }
        tmp = n / div[i];

        int cnt2 = 0;
        while( tmp > 0 ) {
            tmp /= d;
            ++cnt2;
        }

        dig = min( dig, max( cnt, cnt2 ) );
    }

    cout << dig << endl;
    return 0;
}



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

#define select(_1, _2, x, ...) x

#define repn(i, n) for (int i = 0; i < (n); i++)
#define repr(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, ...) select(__VA_ARGS__, repr, repn)(i, __VA_ARGS__)

#define rrepn(i, n) for (int i = (n - 1); i >= 0; i--)
#define rrepr(i, a, b) for (int i = (b - 1); i >= (a); i--)
#define rrep(i, ...) select(__VA_ARGS__, rrepr, rrepn)(i, __VA_ARGS__)

#define all(v) v.begin(), v.end()
#define debug(x) cerr << #x << " = " << x << endl

using namespace std;
using ll = long long;

const int INF = 1e9;
const ll LINF = 1e18;


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

    vector<ll> a(n);
    vector<ll> b(n, 0);

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

    rep(i, n)
        b[a[i] - 1]++;

    ll sum = 0;

    rep(i, n)
        sum += b[i] * (b[i] - 1) / 2;

    rep(i, n) {
        ll t = b[a[i] - 1];
        cout << sum + 1 - t << endl;
    }

    return 0;
}


Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define All(a) a.begin(),a.end()
#define INF 1000000007
const int MOD = 1000000007;
//accumulate(vec.begin(), vec.end(), 0)

int gcd(int x,int y){
  if(x%y==0) return y;
  else return gcd(y,x%y);
}

int main(){
  int n,k;
  cin >> n >> k;
  int cnt = 0;
  while(n){
    n/=k;
    cnt++;
  }
  cout<< cnt <<endl;
}


Measured memory_bytes: 256
pub 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()
}

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

pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

use std::cmp::max;

fn main() {
    let nm: Vec<usize> = read_vec();
    let n = nm[0];
    let m = nm[1];
    let sc: Vec<Vec<i32>> = read_vec2(m);

    let mut v = vec![-1; n];

    for i in 0..m {
        let s = sc[i][0] as usize - 1;
        let c = sc[i][1];

        if v[s] >= 0 && v[s] != c {
            println!("-1");
            return;
        }

        v[s] = c;
    }

    if n > 1 && v[0] == 0 {
        println!("-1");
        return;
    }

    if n == 1 && v[0] == -1 {
        println!("0");
        return;
    }

    if v[0] == -1 {
        v[0] = 1;
    }

    let mut ans = 0;
    for a in v {
        ans *= 10;
        ans += max(a, 0);
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#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 n, r;
    cin >> n >> r;
    if(n >= 10){
        cout << r << "\n";
    }else{
        cout << r+100*(10-n) << "\n";
    }
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define rep(i,n) for(int i=0;i<(lint)(n);i++)
#define REP(i,n) for(int i=1;i<=(lint)(n);i++)
#define all(V) V.begin(),V.end()
#define stackReplaceBegin(size)\
	void* p=malloc(size);\
	esp_new=(lint)p+size-1;\
	void * stack_extend_memory_ = malloc(size);\
	void * stack_extend_origin_memory_;\
	char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);\
	*stack_extend_dummy_memory_ = 0;\
	asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
typedef long long lint;
typedef unsigned long long ulint;
typedef std::pair<int, int> P;
constexpr int INF = INT_MAX/2;
constexpr lint LINF = LLONG_MAX/2;
constexpr double eps = DBL_EPSILON;
constexpr double PI = 3.141592653589793238462643383279;
lint esp_new;
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
inline lint gcd(lint a, lint b) {
	while (b) {
		lint c = a;
		a = b; b = c % b;
	}
	return a;
}
inline lint lcm(lint a, lint b) {
	return a / gcd(a, b) * b;
}
bool isprime(lint n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
template<typename T>
T mypow(T a, unsigned int b) {
	T res(1),now(a);
	while(b){
		if(b&1)res*=now;
		b>>=1;
		now*=now;
	}
	return res;
}
template<typename T>
void printArray(std::vector<T>& vec) {
	rep(i, (int)vec.size() - 1)std::cout << vec[i] << " ";
	if(!vec.empty())std::cout << vec.back() << std::endl;
}
template<typename T>
void printArray(T l, T r) {
	T rprev = r;
	rprev--;
	for (T i = l; i != rprev; i++) {
		std::cout << *i << " ";
	}
	std::cout << *rprev << std::endl;
}
int main(){
	lint a,b,c;
	std::cin>>a>>b>>c;
	if(c-a-b<0)puts("No");
	else if(4*a*b<(c-a-b)*(c-a-b))puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>

using namespace std;

/* template */

using ll = long long;

void debug_out() { std::cout << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n)-1); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n)-1); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    int weight;
    edge(int f,int t,int w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

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

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

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

bool isPalindrome(string s){
    string t = s;
    reverse(all(t));
    return s==t;
}

constexpr ll INF = 1e18;

vector<int> dx = {-1,0,1,0};
vector<int> dy = {0,-1,0,1};

/* template */

vector<int> bfs(int s,const graph &g){
    int _size = g.size();
    vector<int> c(_size,-1);
    c[s] = 0;
    queue<int> que;
    que.push(s);
    while(!que.empty()){
        int x = que.front();
        que.pop();
        for(auto nx: g[x]){
            if(c[nx]<0){
                que.push(nx);
                c[nx] = c[x]+1;
            }
        }
    }
    return c;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll k; cin >> k;
    ll ans = 0;
    rep(i,1,k+1){
        rep(j,1,k+1){
            rep(l,1,k+1){
                ans += __gcd(__gcd(i,j),l);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;

int main() {
  ll q,h,s,d,n;
  cin>>q>>h>>s>>d>>n;
  ll one=min(4*q,min(2*h,s));
  ll ans;
  if(2*one<=d) ans=n*one;
  else{
    ans=(n%2==1 ? n/2*d+one : n/2*d);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<random>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
//const int inf = 1e9 + 7;
//int dy[] = {0, 0, -1, 1};
//int dx[] = {1, -1, 0, 0};

int main() {
    int n; cin >> n;
    while (n--) {
        string q; cin >> q;
        set<string> s;
        rrep(i, 1, q.size()) {
            string a, b;
            a = q.substr(0, i);
            b = q.substr(i, q.size() - i);
            s.insert(a + b);
            s.insert(b + a);
            reverse(a.begin(), a.end());
            s.insert(a + b);
            s.insert(b + a);
            reverse(b.begin(), b.end());
            s.insert(a + b);
            s.insert(b + a);
            reverse(a.begin(), a.end());
            s.insert(a + b);
            s.insert(b + a);
        }
        cout << s.size() << endl;
    }
    
}



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

ll frac(ll n){
    ll dp[n+1];
    dp[0] = 1;
    for(int i = 1;i < n+1;i ++){
        dp[i] = dp[i-1]*i%mod;
    }
    return dp[n];
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,m,ans=0;
    cin >> n >> m;
    if(n<m) swap(n,m);
    ll fn = frac(n),fm = frac(m);
    if(n-m==1) ans = fn*fm%mod;
    else if(n==m) ans = fn*fm*2%mod;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>

using namespace std;

int main(){
	int n,p,d1,d2;
	int sum;
	int num,kyori;

	while(cin >> n,n){
		for(int i=0;i<n;i++){
			cin >> p >> d1 >> d2;
			if(i == 0){
				num = p;
				kyori = d1+d2;
			}else{
				if(d1+d2 > kyori){
					num = p;
					kyori = d1 + d2;
				}
			}
		}
		cout << num << " " << kyori << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
typedef unsigned long long ull;
typedef long long ll;
#define MAX 200005
#define __TRUE "Yes"
#define __FALSE "No"
using namespace std;

int main() {
  int N,H,W;
  cin >> N >> H >> W;
  cout << (N-H+1)*(N-W+1) << endl;
}

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

int main(){
    int n;
    int building[5][4][11];
    memset(building,0,sizeof(building));
    cin >> n;
    for (int i=0;i<n;i++){
        int b,f,r,v;
        cin >> b >> f >> r >> v;
        building[b][f][r] += v;
    }
    for(int i=1;i<5;i++){
        for(int j=1;j<4;j++){
            for(int k=1;k<11;k++){
                cout << " " << building[i][j][k];
            }
            cout << endl;
        }
        if (i!=4){
            for (int j=0;j<20;j++) cout << "#";
            cout << endl;
        }
    }
}


Measured memory_bytes: 3068
#include<bits/stdc++.h>
#define FOR(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++)
#define RFOR(i,a,b) for(long long i = (long long)(a); i >= (long long)(b); i--)
#define MIN3(a,b,c) (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c))
#define MAX(a,b) (a)>(b)?(a):(b)
#define MIN2(a,b) (a)<(b)?(a):(b)
using namespace std;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long long ll;
#define ull unsigned long long
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll,ll> lll;
#define deb(x )     cerr << #x << " here "<< x << endl;
#define endl    "\n"
#define printCase() "Case #" << caseNum << ": "
inline bool is_palindrome(const string& s){ return std::equal(s.begin(), s.end(), s.rbegin()); }
const ll MOD = 1000000007;
const ll INF = 1e9+5;
const double eps = 1e-7;
const double PI = acos(-1.0);
#define coud(a,d) cout << fixed << showpoint << setprecision(d) << a;
inline void debug_vi(vi a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
inline void debug_vll(vll a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
#define ff first
#define ss second
/*----------------------------------------------------------------------*/

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

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int r,g,b,n,ans=0; cin>>r>>g>>b>>n;
    FOR(i, 0, n+1) {
    	FOR(j, 0, n+1) {
    		int tot = r * i + j * g;
    		if(tot <= n && (n-tot)%b==0) ans++;
    	}
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <map>
using namespace std;
typedef long long LL;
const LL mod = 1e9+7;
const int SIZEN = 10010;
LL gcd(LL x,LL y){
    if(y == 0)return x;
    return gcd(y,x%y);
}
LL qpow(LL x,LL len){
    LL ret = 1;
    for(;len;len>>=1){
        if(len & 1)ret = ret * x % mod;
        x = x*x % mod;
    }
    return ret;
}
int a[SIZEN];
int prime[1000100] = {0};
bool vis[1000100] = {0};
map<int,int> mp;
int cnt = 0;
int mi[1000100] = {0};
int N;
void Init(){
    for(int i = 2;i <= 1000000;i++){
        if(!vis[i])prime[++cnt] = i,mp[i] = cnt;
        for(int j = 1;j <= cnt && prime[j] * i <= 1000000;j++){
            vis[i * prime[j]] = true;
            if(i % prime[j] == 0)break;
        }
    }
}
int main(){
    Init();
    scanf("%d",&N);
    for(int i = 1;i <= N;i++)scanf("%d",&a[i]);
    for(int i = 1;i <= N;i++){
        int tmp = a[i];
        for(int j = 1;prime[j] * prime[j] <= tmp;j++){
            int tot = 0;
            while(tmp % prime[j] == 0){
                tmp /= prime[j];
                tot++;
            }
            mi[j] = max(mi[j],tot);
        }
        if(tmp != 1)mi[mp[tmp]] = max(mi[mp[tmp]],1);
    }
    LL lcm = 1;
    for(int i = 1;i <= cnt;i++){
        lcm = lcm * qpow(prime[i],mi[i]) % mod;
    }
    LL ans = 0;
    for(int i = 1;i <= N;i++){
        ans = (ans + lcm * qpow(a[i],mod-2) % mod) % mod;
    }
    printf("%lld\n",ans);
}

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

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef long double ld;


const ll mod = (ll)1e9 + 7;
const ll mxN = 200200;



void solve() {
	ll a,b;
	cin>>a>>b;
	cout<<a*b<<"\n";
}


int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.precision(20);
	cout << fixed;

//	pre();
//	ll t;cin>>t;while (t--)
		solve();
}


Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;



int main(){
    int a,b,c; cin >> a >> b >> c;
    bool ok = true;
    if(a == b && b == c) ok = false;
    if(a != b && a != c && b != c) ok = false;
    cout << (ok?"Yes":"No") << endl;
}

    



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S, T;
  cin >> S >> T;
  int j = 0;
    for (int i = 0; i < S.size(); i++) {
      if (S.at(i) == T.at(i)) {
        j++;
      }
    }
    if (j == S.size()) {
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
template <class T> void chmax(T & a, T const & b) { if (b > a) a = b; }
template <typename T>
string to_string(const T &n){ostringstream stm;stm << n;return stm.str();}
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = LLONG_MAX;

int n,m,ans;
int imos[112345];
signed main(){
    cin>>n>>m;
    rep(i,m){
        int l,r;
        cin>>l>>r;
        imos[l]+=1;
        imos[r+1]-=1;
    }
    rep(i,112345){
        imos[i+1]+=imos[i];
    }
    rep(i,n+10){
        //cout<<imos[i]<<" ";
        if(imos[i]==m)ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 640
n = int(input())
a = list(map(int,input().split()))
ans = [0] * n
ans[0] = sum(a) - 2 * (sum(a[1::2]))
for i in range(1,n):
    ans[i] = 2*a[i-1]-ans[i-1]
print(' '.join(map(str,ans)))

Measured memory_bytes: 25008
#include <cstdio>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <stack>
#include <climits>
#include <deque>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
double EPS=1e-10;
double EQ(double a,double b){
    return abs(a-b)<EPS;
}
void fast_stream(){
  std::ios_base::sync_with_stdio(0);
}
template<class T>
string IntToString(T num){
  string res;stringstream ss;ss<<num;
  return ss.str();
}
ll StringToInt(string &str){
  ll res=0;
  for(int i=0;i<(int)str.size();i++)
    res=(res*10+str[i]-'0');
  return res;
}
const int MAX_N=1<<20;
const ll INF=1LL<<50;
class RMQ{
public:
  // セグメント木を持つグローバル配列
  int n;
  ll dat[2*MAX_N-1];
  // 初期化
  void init(int n_){
    n=1;
    while(n<n_)n*=2;
    fill(dat,dat+2*n-1,0);
  }
  // k番目の値(0-indexed)をaに変更
  void update(int k,ll a){
    // 葉の節点
    k+=n-1;
    dat[k]=a;
    // のぼりながら更新
    while(k>0){
      k=(k-1)/2;
      dat[k]=max(dat[k*2+1],dat[k*2+2]);
    }
  }
  // [a,b)の最大値を求める
  // kは節点の番号、l,rはその節点が[l,r)に対応づいていることを表す
  // したがって、外からはquery(a,b,0,0,n)として呼ぶ
  ll _query(int a,int b,int k,int l,int r){
    if(r<=a||b<=l)return 0;
    else if(a<=l&&r<=b)return dat[k];
    ll vl=_query(a,b,k*2+1,l,(l+r)/2);
    ll vr=_query(a,b,k*2+2,(l+r)/2,r);
    return max(vl,vr);
  }
  ll query(int a,int b){
    return _query(a,b,0,0,n);	
  }
};
int as[1000001];
ll dp[100001];
ll sum;
RMQ rmq;
int main(){
  int n;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>as[i];
    sum+=as[i];
  }
  rmq.init(n+1);
  rmq.update(as[0],as[0]);
  ll res=as[0];
  for(int i=1;i<n;i++){
    ll val=rmq.query(0,as[i]);
    rmq.update(as[i],val+as[i]);
    res=max(res,val+as[i]);
  }
  cout<<sum-res<<endl;
  return 0;
}

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

namespace Atcoder
{
    public class Program
    {
        static void Main(string[] args)
        {
            var s = Read();
            var t = Read();

            if (s != t.Substring(0, s.Length))
            {
                WriteRead("No");
                return;
            }

            if (s.Length + 1 == t.Length)
            {
                Write("Yes");
            }
            else
            {
                Write("No");
            }
            Read();
        }

        public static string Read()
        {
            return Console.ReadLine();
        }

        public static string[] ReadSplit()
        {
            return Console.ReadLine().Split(' ');
        }

        public static void WriteRead(object str)
        {
            Console.WriteLine(str);
            Read();
        }

        public static void Write(object str)
        {
            Console.WriteLine(str);
        }

        private static bool ChangeMin<T>(ref T a, T b) where T : IComparable
        {
            if (a.CompareTo(b) > 0)
            {
                a = b;
                return true;
            }
            return false;
        }

        private static bool ChangekMax<T>(ref T a, T b) where T : IComparable
        {
            if (b.CompareTo(a) > 0)
            {
                a = b;
                return true;
            }
            return false;
        }
    }
}


public static class Extentions
{
    public static int Int(this object obj)
    {
        return int.Parse(obj.ToString());
    }

    public static long Long(this object obj)
    {
        return long.Parse(obj.ToString());
    }

    public static decimal Decimal(this object obj)
    {
        return decimal.Parse(obj.ToString());
    }

    public static double Double(this object obj)
    {
        return double.Parse(obj.ToString());
    }

    public static T2 GetValueZero<T1, T2>(this Dictionary<T1, T2> d, T1 key) where T2 : struct
    {
        T2 value;
        if (d.TryGetValue(key, out value))
        {
            return value;
        }
        return new T2();
    }
}



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

int main(){
	int x1[4] = {-1,0,0,1}, y1[4] = {0,1,-1,0};
	int x2[4] = {-1,-1,1,1}, y2[4] = {-1,1,-1,1};
	int x3[4] = {-2,0,0,2}, y3[4] = {0,-2,2,0};
	int p[10][10], x, y, s, nx, ny, maxl = 0, count = 0;
	for(int i = 0;i < 10;i++)
		for(int j = 0;j < 10;j++)p[i][j] = 0;
	char c;
	while(cin >> x >> c >> y >> c >> s){
		p[y][x]++;
		for(int i = 0;i < 4;i++){
			nx = x + x1[i];ny = y + y1[i];
			if(nx>=0&&nx<10&&ny>=0&&ny<10)p[ny][nx]++;
		}
		if(s > 1){
			for(int i = 0;i < 4;i++){
				nx = x + x2[i];ny = y + y2[i];
				if(nx>=0&&nx<10&&ny>=0&&ny<10)p[ny][nx]++;
			}
			if(s == 3){
				for(int i = 0;i < 4;i++){
					nx = x + x3[i];ny = y + y3[i];
					if(nx>=0&&nx<10&&ny>=0&&ny<10)p[ny][nx]++;
				}
			}
		}
	}
	for(int i = 0;i < 10;i++){
		for(int j = 0;j < 10;j++){
			maxl = max(maxl, p[i][j]);
			if(!p[i][j])count++;
		}
	}
	cout << count << endl << maxl << endl;
	return 0; 
}

Measured memory_bytes: 3088
#include <algorithm>
#include <iostream>

using namespace std;
using ll = long long;

ll s(ll H, ll W) {
  ll ret = H + W, d;
  for (ll i : {0, 1}) {
    ll h1 = H / 3 + i, a1 = h1 * W, hr = H - h1;
    if (hr * W % 2) {
      ll x = min(hr, W), a2 = (hr * W + x) / 2, a3 = a2 - x;
      auto [m, M] = minmax({a1, a2, a3});
      d = M - m;
    } else {
      d = abs(a1 - hr * W / 2);
    }
    ret = min(ret, d);
  }
  return ret;
}

int main() {
  ll H, W, ans{};
  cin >> H >> W;
  if (H * W % 3) ans = min(s(H, W), s(W, H));
  cout << ans << endl;
}


Measured memory_bytes: 3492
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;

int main() {
    int a, b, c, k, sum = 0;
    cin >> a >> b >> c >> k;
    for(int i = 0; i < k; i++){
        if(a > 0){
            sum++;
            a--;
            continue;
        }
        if(b > 0){
            b--;
            continue;
        }
        if(c > 0){
            sum--;
            c--;
            continue;
        }
    }
    cout << sum << endl;
return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define rep(i, n) for(ll i = 0;i < n;i++)
template<class T, class U> void cmax(T& a, U b) { if (a<b) a = b; }
template<class T, class U> void cmin(T& a, U b) { if (a>b) a = b; }

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

  string s;
  cin >> s;

  bool c = 0, f = 0;
  for (auto&& i : s) {
    c |= (i == 'C');
    f |= (i == 'F' && c);
  }
  if (c && f) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vector>

using namespace std;
static const int MAX = 200000;

int main() {
    int R[MAX], n;

    cin >> n;
    for (int i=0; i<n; i++) cin >> R[i];

    int maxv = -2000000000;
    int minv = R[0];

    for (int i=1; i<n; i++) {
        maxv = max(maxv, R[i] - minv);
        minv = min(minv, R[i]);
    }

    cout << maxv << endl;

    return 0;
}


Measured memory_bytes: 3872
#include <stdio.h>
typedef struct{
	int f1;
	int f2;
	int f3;
	int f4;
	int f5;
	int f6;
	int tmp;
}Dice;
int main(void)
{
	int i, Y, N;
	Dice D0, D1;
	scanf("%d%d%d%d%d%d", &D0.f1, &D0.f2, &D0.f3, &D0.f4, &D0.f5, &D0.f6);
	scanf("%d%d%d%d%d%d", &D1.f1, &D1.f2, &D1.f3, &D1.f4, &D1.f5, &D1.f6);
	i=Y=N=0;
	while((D0.f1 != D1.f1 || D0.f6 != D1.f6) && i<6){
		i++;
		i==6 ? N++ : 0;
		D1.tmp = D1.f1;
		switch(i%2){
			case 0:
				D1.f1 = D1.f4;
				D1.f4 = D1.f6;
				D1.f6 = D1.f3;
				D1.f3 = D1.tmp;
				break;
			case 1:
				D1.f1 = D1.f2;
				D1.f2 = D1.f6;
				D1.f6 = D1.f5;
				D1.f5 = D1.tmp;
		}
	}
	for(i=0; i<4; i++){
		D1.tmp = D1.f2;
		D1.f2 = D1.f3;
		D1.f3 = D1.f5;
		D1.f5 = D1.f4;
		D1.f4 = D1.tmp;
		D0.f2==D1.f2 && D0.f3==D1.f3 && D0.f5==D1.f5 && D0.f4==D1.f4 ? Y++ : 0;
	}
	Y>0 && N==0 ? puts("Yes") : puts("No");
	return 0;
}

Measured memory_bytes: 580
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;

int main() {
	int n, d; cin >> n >> d;
	vector< vector<double> >x;
	for (int i = 0; i < n; i++) {
		vector<double>tmp(d);
		for (int j = 0; j < d; j++) {
			cin >> tmp[j];
		}
		x.push_back(tmp);
	}
	int ans = 0;
	for (int i = 0; i < n - 1; i++) {
		for (int j = i + 1; j < n; j++) {
			double point = 0;
			for (int k = 0; k < d; k++) {
				point += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
			}
			point = sqrt(point);
			int pon = point;
			if (point - pon == 0) ans++;
		}
	}
	cout << ans << endl;

	return 0;
}

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

int main() {
	// your code goes here
	int i,n,a[200005],ma=0,ma2=0,p;
	cin >> n;
	for(i=1;i<=n;i++){
		cin >> a[i];
		if(ma<a[i]){
			ma=a[i];
			p=i;
		}
	}
	for(i=1;i<=n;i++){
		if(i!=p&&ma2<a[i]) ma2=a[i];
	}
	for(i=1;i<=n;i++){
		if(i==p) cout << ma2 << endl;
		else cout << ma << endl;
	}
	return 0;
}

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

int main() {
	int64_t N, X, patty = 0;
	cin >> N >> X;
	for (int64_t i = (int64_t)(1 << (N >> 1)) * (1 << (N >> 1)) * (1 << (N & 1) + 1);i >= 1;i >>= 1, -- X) {
      	if (X + 1 >= i) { // 半分より多い
			patty |= i >> 1;
			X -= i - 2;
		}
	}
	cout << patty;
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

まず、レベルLバーガーの枚数を考えてみるか(本題じゃないけど)
枚数をf(x)とする
この時、f(0)=1, f(x)=3+2f(x-1)より、f(x)=2^(x+2)-3
ということでXは最大で2^52-3が考えられるのでオーバーフローとかに注意、あとはO(X)は許されないっぽい

次に、バーガーの規則を考えていこう
まず、試しに5個だけ列挙
P
BPPPB
BBPPPBPBPPPBB
BBBPPPBPBPPPBBPBBPPPBPBPPPBBB
BBBBPPPBPBPPPBBPBBPPPBPBPPPBBBPBBBPPPBPBPPPBBPBBPPPBPBPPPBBBB
さて、これをどう考えるか考えてみよう
まず、全てのバーガーは対称な形をしているので、X≧2^(N+1)-1なら、答えはX-2^(N+1)+1と2^(N+1)-2の時の答え+1と表すことができる
ちなみに2^(N+1)-2の計算後の答えは2^N-1ね
さて、上の操作でまずXが半分を超えることは無くなった
次に、X-1は要するに1個上のバーガーなので、この時の答えが分かれば再帰的に求まる
よって、これを再帰でもメモ化再帰でもすれば求まる
今回は小さいし再帰しようか、O(N)ね
*/

Measured memory_bytes: 888
package main

import (
	"fmt"
)

func main() {
	var k int
	fmt.Scan(&k)
	m := make([]int, 8)
	for i := 0; i < 8; i++ {
		m[i] = -1
	}
	
	for i := 0; i < k; i++ {
		var r int
		fmt.Scan(&r)
		fmt.Scan(&m[r])
	}

	search(0, &m)

	for r := 0; r < 8; r++ {
		for c := 0; c < 8; c++ {
			if m[r] == c {
				fmt.Print("Q")
			} else {
				fmt.Print(".")
			}
		}
		fmt.Println()
	}
}

func search(r int, m *[]int) bool {
	if r >= 8 {
		return true
	}
	if (*m)[r] >= 0 {
		return search(r+1, m)
	}
	for c := 0; c < 8; c++ {
		if check(r, c, m) == false {
			continue
		}
		
		(*m)[r] = c
		if search(r+1, m) {
			return true
		} else {
			(*m)[r] = -1
		}
	}
	return false
}

func check(r int, c int, m *[]int) bool {
	for i := 0; i < 8; i++ {
		if (*m)[i] == -1 {
			continue
		}
		if c == (*m)[i] {
			return false
		}
		if (r - c) == (i - (*m)[i]) {
			return false
		}
		if (r + c) == (i + (*m)[i]) {
			return false
		}
	}
	return true
}



Measured memory_bytes: 1176
#include <utility>
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
using namespace std;

int main(int argc, char const *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S;
  std::cin >> S;
  int val=700;

  for (size_t i = 0; i < 3; i++) {
    if (S[i]=='o') {
      val += 100;
    }

  }
  std::cout << val << '\n';

  return 0;
}


Measured memory_bytes: 256