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

using namespace std;

int main(void) {
    int N, max = 0;
    long int min = 10000000000;
    cin >> N;

    int A[N];

    for (int i = 0; i < N; i++) cin >> A[i];

    for (int i = 0; i < N; i++) {
        if (A[i] > max) {
            max = A[i];
        }
        if (A[i] < min) {
            min = A[i];
        }
    }

    cout << max - min << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 40001
using namespace std;
#define int long long
int T;
bool used[N];
vector<int> prime;


signed main(){
  used[0] = used[1] = 1;
  for(int i=2;i*i<N;i++)
    if(used[i] == 0)
      for(int j=2;j<N/i;j++)used[i*j] = 1;
  for(int i=0;i<N;i++) if(!used[i]) prime.push_back(i);
  
  while(1){
    cin>>T;
    if(T==0)break;
  

  
    int ans = 0;
    for(int i=0;i<prime.size();i++)
    for(int j=i;j<prime.size();j++){
      int a = prime[i];
      int b = prime[j];
      int c = T-(a+b);
      if(b>c)continue;
      if(a+b>=T||used[c] == 1)continue;
      if(a+b>c && a+c>b && b+c>a)ans++;
    }
  cout<<ans<<endl;
  }  
  return 0;
}

Measured memory_bytes: 3160
using System;
using System.Linq;
using System.Diagnostics;
using System.Collections.Generic;
using static System.Math;

class P
{
    static void Main()
    {
        int[] abx = Console.ReadLine().Split().Select(int.Parse).ToArray();
        Console.WriteLine(abx[0]<=abx[2]&&abx[1]+ abx[0] >= abx[2] ? "YES":"NO");
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}

int main() {
  string s1,s2,s3;
  cin>>s1>>s2>>s3;
  string t;
  t.push_back(toupper(s1[0]));
  t.push_back(toupper(s2[0]));
  t.push_back(toupper(s3[0]));
  cout<<t<<endl;
  return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define tcase int _; cin >> _; while(_--)
const int MAX = 1e6;

long long n, q;
long long v[MAX];
long long ans;

void solve() {
	memset(v, 0, sizeof v);
	ans = 0;
	cin >> n;
	for(int i=0; i<n; i++) {
		int x; cin >> x;
		v[x]++;
		ans += x;
	}
	cin >> q;
	while(q--) {
		long long a, b;
		cin >> a >> b;
		ans -= a*v[a];
		ans += b*v[a];
		v[b] += v[a];
		v[a] = 0;
		cout << ans << "\n";
	}
}

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

 	solve();

  	return 0;
}



Measured memory_bytes: 11464
import java.util.Scanner;
class Main {
	public void small() {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if(a < b) {
			System.out.println("a < b");
		} else {
			if(a > b) {
				System.out.println("a > b");
			} else {
				System.out.println("a == b");
			}
		}
	}
	public static void main(String[] args) {
		new Main().small();
	}
}

Measured memory_bytes: 17324
fun main(args: Array<String>) {
  val N = readInt()
  val A = readLongs().toMutableList()
  val cumSumA = Array(N) { 0L }
  cumSumA[0] = A[0]
  for (i in 1 until N) {
    cumSumA[i] = cumSumA[i - 1] + A[i]
  }

  var min = Long.MAX_VALUE

  var iL = 0
  var iR = 2
  for (iM in 1 until N - 2) {
    val sumL = cumSumA[iM]
    val sumR = cumSumA[N - 1] - sumL

    while (true) {
      val l = cumSumA[iL]
      val r = sumL - l
      val ll = cumSumA[iL + 1]
      val rr = sumL - ll
      if (Math.abs(l - r) <= Math.abs(ll - rr)) break
      iL++
    }
    while (true) {
      val l = cumSumA[iR] - sumL
      val r = sumR - l
      val ll = cumSumA[iR + 1] - sumL
      val rr = sumR - ll
      if (Math.abs(l - r) <= Math.abs(ll - rr)) break
      iR++
    }

    val d0 = cumSumA[iL]
    val d1 = sumL - d0
    val d2 = cumSumA[iR] - sumL
    val d3 = sumR - d2
    val dList = listOf(d0, d1, d2, d3)

    min = Math.min(min, dList.max()!! - dList.min()!!)
  }
  println(min)
}

fun gcd(a: Int, b: Int): Int = if (a < b) gcd(b, a) else if (b == 0) a else gcd(b, a % b)
fun lcm(a: Int, b: Int): Int = (a * b) / gcd(a, b)

fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readInts() = readLine()!!.split(" ").map { it.toInt() }
fun readLongs() = readLine()!!.split(" ").map { it.toLong() }


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

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

    string s, t;
    cin >> s >> t;
    int ls=s.length(), lt=t.length();
    if (lt!=ls+1) {
        cout << "No";
    }
    else {
        for (int i=0;i<ls;i++) {
            if (s[i]!=t[i]) {
                cout << "No";
                return 0;
            }
        }
        cout << "Yes";
    }
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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(){
    string s,t;
    cin>>s>>t;
    int i=0,j=0;
    while(i<s.size()||j<t.size()){
        if(j<t.size()) cout<<s[i]<<t[j];
        else cout<<s[i];
        i++;j++;
    }
    cout<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <math.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REP2(i,n1,n2) for(int i=n1;i<n2;i++)
using namespace std;
typedef long long ll;

int main() {
    int n;
    cin >> n;
    int t[100001],x[100001],y[100001];
    t[0] = x[0] = y[0];
    REP2(i,1,n+1){
        cin >> t[i] >> x[i] >> y[i];
    }
    bool flag = true;
    REP(i,n){
        if((t[i+1]-t[i])<(abs(x[i+1]-x[i])+abs(y[i+1]-y[i]))){
            flag = false;
        }
        if((t[i+1]-t[i])%2!=(abs(x[i+1]-x[i])+abs(y[i+1]-y[i]))%2){
            flag = false;
        }
    }
    if(flag){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 1408
#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;

#define int long long int
#define double long double
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define rep(i,a,b) for (int i = a; i < b; ++i)
#define IOS ios::sync_with_stdio(false); cin.tie(NULL);
#ifndef LOCAL
#define dbg(...) ;
#define endl '\n'
#endif

const int inf = 1e15;
const int MOD = 1e9 + 7;
const int N = 2e5 + 5;

int dp[N];

int power(int x, int y, int MOD) 
{ 
    int res = 1;
    x = x % MOD;
    while (y) {
        if(y & 1) res = res * x % MOD;
        y >>= 1;
        x = x * x % MOD;
    }
    return res; 
}

signed main(){
    IOS;
    dp[0] = 0;
    for (int i = 1; i < N; i++) {
        int p = __builtin_popcount(i);
        dp[i] = dp[i % p] + 1;
    }
    int n;
    string s;
    cin >> n >> s;
    int p = 0;
    for (int i = 0; i < n; i++)
        p += (s[i] == '1');
    int num1 = 0; // plus1
    int num2 = 0; // minus1
    for (int i = n - 1; i >= 0; i--) {
        num1 = (num1 + (s[i] == '1') * power(2, (n-1-i), p+1)) % (p+1);
        if (p > 1)
        num2 = (num2 + (s[i] == '1') * power(2, (n-1-i), p-1)) % (p-1);
    }
    for (int i = 0; i < n; i++) {
        int num;
        if (s[i] == '0')
            num = (num1 + power(2, (n-1-i), p+1)) % (p+1);
        else if (p > 1)
            num = (num2 - power(2, (n-1-i), p-1) + p-1) % (p-1);
        else {
            cout << 0 << endl;
            continue;
        }
        cout << dp[num] + 1 << endl;
    }
    return 0;
}

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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pl;

const int INT_INF = 2147483646;
const ll LL_INF = 9223372036854775807;
const double PI=3.1415926535897932;

bool SecondCompare(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second>b.second;
}

ll minll(ll a, ll b){
    if(a >= b)  return b;
    else    return a;
}

ll maxll(ll a, ll b){
    if(a >= b)  return a;
    else    return b;
}

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


const ll SIZE = (1e5+10)*2;
ll n;
string s;


int main(){
    cin >> n;
    cin >> s;
    if(n%2 == 1){
        cout << "No\n";
        return 0;
    }

    for(int i = 0; i < n/2; i++){
        if(s[i] != s[i+n/2]){
            cout << "No\n";
            return 0;
        }
    }

    cout << "Yes\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int64_t i = 0; i < (n); ++i)
#define repe(i, n) for (int64_t i = 0; i <= (n); ++i)
#define reps(i, s, n) for (int64_t i = (s); i < (n); ++i)
#define repse(i, s, n) for (int64_t i = (s); i <= (n); ++i)
#define repr(i, n) for (int64_t i = (n); i >= 0; --i)
const int64_t inf = (int64_t)1e18;
const int64_t mod = (int64_t)1e9 + 7;

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

  int64_t A, B; cin >> A >> B;
  int64_t X = 549755813888;
  vector<int64_t> ans(40, 0);
  A--;

  int64_t a = 0, b = 0;
  int i = 0;
  while (X > 0) {
    if (A >= X) {
      a = A - X + 1;
      A -= X;
    }
    if (B >= X) {
      b = B - X + 1;
      B -= X;
    }
    ans[i] ^= (a + b) % 2;
    if (X == 2) {
      if (a != 0) ans[i + 1] ^= 1;
      if (b != 0) ans[i + 1] ^= 1;
    }
    // cout << X << " " << a << " " << b << endl;
    a = b = 0;
    X >>= 1;
    i++;
  }

  // for (int64_t x : ans) {
  //   cout << x;
  // }
  // cout << endl;

  int64_t f = 0;
  int64_t y = 1;
  for (int i = 39; i >= 0; --i) {
    f += ans[i] * y;
    y <<= 1;
  }

  cout << f << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	int year, month, day, slush;
	cin >> year;
	cin.ignore(1);
	cin >> month;
	cin.ignore(1);
	cin >> day;
	
	if (year < 2019)cout << "Heisei" << endl;
	else if(year == 2019 && month <= 4)cout << "Heisei" << endl;
	else cout << "TBD" << endl;

	return 0;
}

Measured memory_bytes: 256
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string { sc.Scan(); return sc.Text() }
func scanRunes() []rune { return []rune(scanString()) }
func scanInt() int { a,_ := strconv.Atoi(scanString()); return a }
func scanInt64() int64 { a,_ := strconv.ParseInt(scanString(),10,64); return a }
func scanFloat64() float64 { a,_ := strconv.ParseFloat(scanString(),64); return a }

func scanInts(n int) []int {
	res := make([]int, n); for i := 0; i < n; i++ { res[i] = scanInt() }; return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int { if a<0 { return -a }; return a }
func min(a,b int) int { if a<b { return a }; return b }
func max(a,b int) int { if a>b { return a }; return b }

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n,m,r := scanInt(), scanInt(), scanInt()
	rs := scanInts(r)
	for i := 0; i < r; i++ {
		rs[i]--
	}

	g := make([][]int, n)
	for i := 0; i < n; i++ {
		g[i] = make([]int, n)
		for j := 0; j < n; j++ {
			g[i][j] = 1<<31-1
		}
	}
	for i := 0; i < m; i++ {
		a,b,c := scanInt()-1, scanInt()-1, scanInt()
		g[a][b] = c
		g[b][a] = c
	}

	warshallfloyd(&g)

	ans := 1<<31-1
	permutationSearch(r, func(a []int) {
		sum := 0
		for i := 0; i < r-1; i++ {
			sum += g[rs[a[i]]][rs[a[i+1]]]
		}
		ans = min(ans, sum)
	})

	fmt.Fprintln(wr, ans)
}

func warshallfloyd(a *[][]int) {
	min := func(a,b int) int { if a<b { return a }; return b }
	g := *a
	for k := 0; k < len(g); k++ {
		for i := 0; i < len(g); i++ {
			for j := 0; j < len(g); j++ {
				g[i][j] = min(g[i][j], g[i][k]+g[k][j])
			}
		}
	}
}


func permutationSearch(n int, fn func(a []int)) {
	a := make([]int, n)
	for i := 0; i < n; i++ { a[i] = i }
	swap := func(i,j int) { a[i],a[j] = a[j],a[i] }

	fn(a)
	for i := n-2; i >= 0; i-- {
		if a[i] > a[i+1] { continue }
		for j := n-1; j >= 0; j-- {
			if a[i] > a[j] { continue }
			swap(i,j)
			for k := i+1; k < (n+i+1)/2; k++ { swap(k,n-(k-i)) }
			fn(a)
			i = n-1
			break
		}
	}
}


Measured memory_bytes: 1280
import java.util.Scanner;
import java.util.Arrays;
public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int a[] = new int[10];
		for(int i=0;i<10;i++) {
			a[i] = in.nextInt();
		}
		Arrays.sort(a);
		for(int i=9;i>=7;i--)
			System.out.println(a[i]);
		in.close();
	}
}


Measured memory_bytes: 26204
#include <iostream>

using namespace std;

int main() {
    char s[4];
    cin >> s;
    // cout << s << endl;

    int ans=0, i;
    for(i=0; i<3; i++) {
        if(s[i]=='1') ans += 1;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
//AGC 006-A
#define _USE_MATH_DEFINES
 
#include <iostream>
#include <cmath>
#include <stdlib.h>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cstring>
#include <numeric>
#include <string>
#include <map>
#include <sstream>
using namespace std;
 
 int main(){
 	int N, CutWord = 0;
 	string s, t;
 	cin >> N >> s >> t;

 	for (int i = 0; i < N; i++){
 		if(s.substr(N-1-i ,i+1)==t.substr(0, i+1)) CutWord = i + 1;
 	}
 	cout << 2*(N-CutWord)+CutWord << endl;
 }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define opt ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define lli long long int
int main()
{
	opt;
	lli n,m;
	cin>>n>>m;
	set<lli>s;
	lli i,j,k,l;
	for(i=0;i<m;i++)
	{
		cin>>j>>k;
		if(j==1 || k==1)
		{
			if(s.find(j+k-1)==s.end())
			s.insert(j+k-1);
			else
			{
				cout<<"POSSIBLE\n";
				return 0;
			}
		}
		else if(j==n || k==n)
		{
			if(s.find(j+k-n)==s.end())
			s.insert(j+k-n);
			else
			{
				cout<<"POSSIBLE\n";
				return 0;
			}
		}
	}
	cout<<"IMPOSSIBLE\n";
}

Measured memory_bytes: 9600
#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;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    string S; cin >> S;
    Ans(S[0] == S[1] && S[1] == S[2], "No", "Yes");

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

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

    int n, m;
    cin >> n >> m;
    vector<int> h(n);
    for(int i = 0; i < n; ++i)  cin >> h[i];
    vector<int> ok(n, 1);
    for(int i = 0; i < m; ++i){
        int a, b;
        cin >> a >> b;
        --a, --b;
        if(h[a] > h[b]) ok[b] = 0;
        else if(h[a] < h[b])    ok[a] = 0;
        else{
            ok[a] = 0;
            ok[b] = 0;
        }
    }
    int ans = 0;
    for(int i = 0; i < n; ++i){
        if(ok[i] == 1)  ++ans;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3992
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define st first
#define nd second
#define pii pair<int,int>

using namespace std;

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

    int n,x,t; cin>>n>>x>>t;

    int cnt = (n + x - 1) / x * t;
    cout<<cnt;

    return 0;
}


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

/*----------------------------- DEFINES ------------------------------*/

#define eps 1e-9
#define mod 1000000007
#define ump unordered_map // operations take less time compared to map
#define pb push_back
#define pf push_front
#define pof pop_front()
#define pob pop_back()
#define mp make_pair
#define ps(x) push(x) // for stack and queue
#define T top() //  for stack
#define FR front()// for queue
#define BA back()// for queue
#define PP pop()// for queue and stack
#define B begin()
#define E end()
#define F first
#define S second
#define tostr(x) to_string(x)
#define SZ(x) ((int)x.size())
#define ins insert
#define MAE max_element
#define MIE min_element
#define cnt(x) count(x)
#define lb(x) lower_bound(x) // returns an it ptng to the element >=x if no such returns end
#define ub(x) upper_bound(x) // returns an it ptng to the element >x if no such returns end
#define rep(i,x,y) for(int i=x;i<y;i++)
#define per(i,x,y) for(int i=x;i>y;i--)
#define repi(i,x,y) for(int i=x;i<=y;i++)
#define peri(i,x,y) for(int i=x;i>=y;i--)
#define reps(i,x,y,k) for(int i=x;i<y;i+=k)
#define sper(i,x,y,k) for(int i=x;i>y;i-=k) 
#define all(x) ((x.B),(x.E))
#define inf (ll)LLONG_MAX
#define ds1(i,x) for(auto i=x.begin();i!=x.end();i++)
#define ds2(i,x) for(auto i:x) // easy method to iterate through a ds
#define sq(a) (a)*(a)
#define fib(n) ceil(pow((1+sqrt(5),n)-pow((1-sqrt(5),n)/(float)(pow(2,n)*sqrt(5)// compute fib(n) in O(1)
#define FIO {ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);}// fast i/o
#define dig(n) (int)(log10(n)+1) // num of digits
#define ss(x,k) substr(x,k)  // x is the start pos and k is the length of substr.
#define f(x) find(x)
#define set(x,k) memset(x,k,sizeof x)

/*------------------------------ TYPEDEFS-----------------------------*/

typedef long long ll;
typedef long l;
typedef string str;
typedef vector<int> vi;
typedef vector<ll> vlli;
typedef vector<pair<int,int> > vpii;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef ump<int,int> umpii;

/*-----------------------------START FROM HERE -----------------------*/

int main(){
	FIO
	
	int a,b,c,d;cin>>a>>b>>c>>d;
	cout<<max(a*b,c*d);
	return 0;
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define VAR(v, i) __typeof(i) v=(i)
#define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define all(v) (v).begin(),(v).end()

#define PII pair<int,int>
#define st first
#define nd second
#define pb push_back
#define lint long long int
#define VI vector<int>

#define debug(x) {cout <<#x <<" = " <<x <<endl; }
#define debug2(x,y) {cerr <<#x <<" = " <<x << ", "<<#y<<" = "<< y <<endl; } 
#define debug3(x,y,z) {cerr <<#x <<" = " <<x << ", "<<#y<<" = "<< y << ", " << #z << " = " << z <<endl; } 
#define debugv(x) {{cout <<#x <<" = "; FORE(itt, (x)) cerr <<*itt <<", "; cerr <<endl; }}
#define debugt(t,n) {{cerr <<#t <<" = "; FOR(it,0,(n)) cerr <<t[it] <<", "; cerr <<endl; }}

#define make( x) int (x); scanf("%d",&(x));
#define make2( x, y) int (x), (y); scanf("%d%d",&(x),&(y));
#define make3(x, y, z) int (x), (y), (z); scanf("%d%d%d",&(x),&(y),&(z));
#define make4(x, y, z, t) int (x), (y), (z), (t); scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define makev(v,n) VI (v); FOR(i,0,(n)) { make(a); (v).pb(a);} 
#define IOS ios_base::sync_with_stdio(0)
#define HEAP priority_queue

#define read( x) scanf("%d",&(x));
#define read2( x, y) scanf("%d%d",&(x),&(y));
#define read3(x, y, z) scanf("%d%d%d",&(x),&(y),&(z));
#define read4(x, y, z, t) scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define readv(v,n) FOR(i,0,(n)) { make(a); (v).pb(a);}
#define jeb() fflush(stdout);

using namespace std;

int main() {
	make2(n, m); make2(y, x);
	FOR(i,0,n) {
		FOR(j,0,m) {
			int a = (i < x) ? 1 : 0;
			int b = (j < y) ? 1 : 0;
			a = (a+b)%2;
			a ? putchar('1') : putchar('0');
		}
		putchar('\n');
	}
}



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

#define int long long
#define ll long long
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define rf(i,n,a) for(int i=n ; i>=a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;

const int inf = 1e9;
const int inf64 = 1e18;
const int MOD = inf + 7;

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

   int xr = 0;

   int a[n];
   f(i,0,n) cin >> a[i] , xr ^= a[i];
   
   f(i,0,n) {
      int ans = xr^a[i];
      cout << ans << " ";
   }
}

Measured memory_bytes: 5100
n=int(input())
ans=int(0)
check=int(0)
A=[]
for i in range(1,n*100):
    ans+=i
    A.append(i)
    if ans>=n:
        break

check=ans-n
for i in range(len(A)):
    if i==check-1:
        continue
    else:
        print(A[i])

Measured memory_bytes: 3572
#include <bits/stdc++.h>
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
#pragma GCC optimize("Ofast")
#define x first
#define y second
#define mp make_pair
#define all(a) a.begin(), a.end()
#define pub push_back
#define ll long long
		
using namespace std;

const int p1 = 31;
const int p2 = 43;
const int mod1 = (int)1e9 + 7;
const int mod2 = (int)1e9 + 9;

int n, p;
ll cnk[55][55];
ll a[2];

int main(){
	//freopen("input.txt", "r", stdin);
	ios_base::sync_with_stdio(0); cin.tie(0);

	for (int i = 0; i < 55; i++){
		cnk[i][0] = 1;
		for (int j = 1; j <= i; j++){
			cnk[i][j] = cnk[i - 1][j] + cnk[i - 1][j - 1];
		}
	}

	cin >> n >> p;
	for (int i = 0; i < n; i++){
		int x;
		cin >> x;
		a[x % 2]++;
	}

	ll ans = 0;

	if (p == 0){
		for (int i = 0; i <= a[1]; i+= 2){
			ans += cnk[a[1]][i] * ((ll)1 << a[0]);
		}
	} else {
		for (int i = 1; i <= a[1]; i+= 2){
			ans += cnk[a[1]][i] * ((ll)1 << a[0]);
		}
	}
	cout << ans;
}

Measured memory_bytes: 892
n = int(input())
a = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(n)]
ans = "Yes"
for i in range(n) :
  diff = sum(a[i+1]) - sum(a[i])
  if(diff % 2 == 1 or diff - 2*(a[i+1][0] - a[i][0]) > 0) : ans = "No" 
print(ans)

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


int main() {
    int P, Q, R; cin >> P >> Q >> R;
    int min1 = min(P, Q);
    int min2 = 0;
    if (P < Q) min2 = min(Q, R);
    else min2 = min(P, R);

    cout << min1 + min2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <utility>
#include <string>
#include <stack>
#include <regex>
 
#define REP(i, n) for (ll i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
 
using namespace std;
 
typedef long long ll;

int main(int argc, char const *argv[])
{
  ll n,m;
  cin >> n >> m;
  vector<ll> imos(n+1,0);
  REP(i,m) {
    ll l,r;
    cin >> l >> r;
    imos[l]++;
    if (r < n) imos[r+1]--;
  }
  REP(i,n){
    imos[i+1] += imos[i];
  }
  cout << std::count(ALL(imos),m) << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <iomanip>
#include <cstdlib>
using namespace std;
 
int main () {
	int n,i,t=0;
	int a,b,c,d,f,g,a11,b1,c1,d1,f1,g1;
	string s="EEEESEEEESEEEESEEEESESEEEESSEEE";
	cin >> a >> b >> c >> d >> f >> g ;
	cin >> a11 >> b1 >> c1 >> d1 >> f1 >> g1;
	n=s.size();
	int a1[n+1],a2[n+1],a3[n+1],a4[n+1],a5[n+1],a6[n+1];
	a1[0]=a11; a2[0]=b1; a3[0]=c1; a4[0]=d1; a5[0]=f1; a6[0]=g1;
	for(i=0;i<n;i++){
		if(s[i]=='S'){
			a1[i+1]=a5[i]; a2[i+1]=a1[i]; a3[i+1]=a3[i]; a4[i+1]=a4[i]; a5[i+1]=a6[i]; a6[i+1]=a2[i];
		}
		else if(s[i]=='N'){
			a1[i+1]=a2[i]; a2[i+1]=a6[i]; a3[i+1]=a3[i]; a4[i+1]=a4[i]; a5[i+1]=a1[i]; a6[i+1]=a5[i];
		}
		else if(s[i]=='W'){
			a1[i+1]=a3[i]; a2[i+1]=a2[i]; a3[i+1]=a6[i]; a4[i+1]=a1[i]; a5[i+1]=a5[i]; a6[i+1]=a4[i];
		}
		else if(s[i]=='E'){
			a1[i+1]=a4[i]; a2[i+1]=a2[i]; a3[i+1]=a1[i]; a4[i+1]=a6[i]; a5[i+1]=a5[i]; a6[i+1]=a3[i];
		}
		if((a1[i+1]==a)&&(a2[i+1]==b)&&(a3[i+1]==c)&&(a4[i+1]==d)&&(a5[i+1]==f)&&(a6[i+1]==g)){
			t=1;  break;
		}
	}
	if(t==1) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 1200
import math,sys
from sys import stdin, stdout
from collections import Counter, defaultdict, deque
input = stdin.readline
I = lambda:int(input())
li = lambda:list(map(int,input().split()))

def case():
    a,b,c,k=li()
    ans=0
    if(k>=a):
        ans+=a
        k-=a 
    else:
        ans=k
        k=0
   # print(ans)
    if(k>=b):
        ans+=0
        k-=b 
    else:
        k=0 
    if(k>=c):
        ans-=c
    else:
        ans-=k 
    print(ans)

for _ in range(1):
    case()

Measured memory_bytes: 9480
#include <iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<string>
#include<iomanip>
using namespace std;

int main()
{
    double a, b;
    double pi = 3.14159265358979;
    double h, m;
    cin >> a >> b >> h >> m;
    double t = h * 60 + m;
    double c = ((5.5) * t );
    double r = c * pi / 180;
    cout << fixed << setprecision(15) << pow(a * a + b * b - 2 * a * b * cos(r), 0.5) << endl;
    return 0;
}



Measured memory_bytes: 4356
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int a[101][101],f[101],e[101],t=1;
int color[101];
int n;

void dfs(int u){
    f[u]=t++;
    color[u]=1;
    rep(v,n){
        if(color[v]==0 && a[u][v]) dfs(v);
    }
    e[u]=t++;

}

int main() {
    cin>>n;
    rep(i,n){
        int u,cur;
        cin>>u>>cur;
        rep(j,cur){
            int v;
            cin>>v;
            a[u-1][v-1]=1;
        }
    }
    rep(i,n){
        if(!color[i]) dfs(i);
    }
    rep(i,n) cout<<i+1<<" "<<f[i]<<" "<<e[i]<<endl;
}


Measured memory_bytes: 3144
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

#ifndef U_L_LONG
typedef unsigned long long U_L_LONG;
#endif
#ifndef L_LONG
typedef long long L_LONG;
#endif

#ifndef LL_ABS
#define LL_ABS(x) (((((x) < 0) ? ((x) * (-1)) : (x))))
#endif

static void C_problem();

int main()
{
	C_problem();
	
	fflush(stdout);
	return 0;
}


static L_LONG llong_gcd(L_LONG first, L_LONG second)
{
	L_LONG num1 = first, num2 = second;

	if (num1 == 0)	return num2;
	if (num2 == 0)	return num1;

	L_LONG remainder = 0, common = 0;
	
	while (!common) {
		remainder = num1 % num2;

		if (remainder == 0) {
			common = num2;
		}
		else {
			num1 = num2;
			num2 = remainder;
		}
	}
	return(common);
}

static L_LONG C_Euclidean(L_LONG* container, int cSize)
{
	if (cSize == 2) {
		return(llong_gcd(container[0], container[1]));
	}

	std::vector<L_LONG> gcdFwds, gcdBkwds;
	gcdFwds.resize(cSize - 1, 0);
	gcdBkwds.resize(cSize - 1, 0);

	L_LONG gcdFwd = container[0];
	L_LONG gcdBkwd = container[cSize - 1];
	 
	for (int i = 1; i < cSize - 1; i++) {
		gcdFwds[i] = gcdFwd = llong_gcd(gcdFwd, container[i]);
		gcdBkwds[cSize - 2 - i] = gcdBkwd = (llong_gcd(gcdBkwd, container[cSize - 1 - i]));
	}

	int size = gcdFwds.size();
	
	L_LONG maxGcd = 0;// std::max(gcdFwds[size - 2], gcdBkwds[2]);
	for(int i = 0; i < size - 1; i++) {
		maxGcd = std::max(maxGcd, llong_gcd(gcdFwds[i], gcdBkwds[i + 1]));
	}
	return maxGcd;
}

static void C_problem()
{
	int N = 0;
	static L_LONG A[100008] = { 0 };

	scanf(" %d", &N);
	for (int i = 1; i < N + 1; i++) {
		scanf(" %lld", &A[i]);
	}
	//	先頭と末尾に0を追加する. 合計で N+2
	A[0] = 0;
	A[N + 1] = 0;

//	std::sort(&A[0], &A[N - 1]);
//	std::sort(&A[1], &A[N - 1], std::greater<L_LONG>());

	printf("%lld\n", C_Euclidean(A, N + 2));
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> oset;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using ll = long long;


bool ok(vector<int>& a,double x , int k){
	int k0;
	for(int d : a){
		k0 = ceil(d/(x))-1;
		if(round(d/(k0+1)) > x){
			k0++;
		}
		k -= k0;
	}
	return k >= 0;
} 

void test_case(){
	int n , k; cin >> n >> k;
	vector<int> has(n);
	for(auto &x : has)
		cin >> x;
	int l = 0;
	int r = INT_MAX;
	int m;
	while(l < r-1){
		m = l + (r-l)/2;
		if(ok(has,m,k)){
			r = m;
		}
		else{
			l = m;
		}
	}
	cout<<r<<"\n";
}
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int T=1;
	while(T--){
		test_case();
	}
	return 0;
}


Measured memory_bytes: 3992
#include <iostream>
using namespace std;
int main(void){
  int n,a[100] = {0};
  cin >> n;
  for(int i = 0; i < n; i++){
      cin >> a[i];
  }
  for(int i = n - 1; i >= 0; i--){
      if(i == n - 1){
          cout << a[i];
      }
      else{
          cout << " " << a[i];
      }
  }
  cout << endl;
}


Measured memory_bytes: 3092
N = int(input())
H = list(map(int,input().split()))

if N == 1:
  print('Yes')
  exit()

ans = 'No'
var = H[0] - 1
for i in range(1, N):
  if H[i] < var:
    break
  else:
    var = max(var, H[i]-1)
else:
  ans = 'Yes'
  
print(ans)

Measured memory_bytes: 14252
N, K = map(int, input().split())
As = list(map(int, input().split()))
def calcgcd(a, b):
  if a > b:
    a, b = b, a
  while a > 0:
    a, b = b%a, a
  return b
gcd = 0
for A in As:
  gcd = calcgcd(gcd, A)
if K%gcd == 0 and K <= max(As):
  print("POSSIBLE")
else:
  print("IMPOSSIBLE")


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

using namespace std;

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

int main()
{
	string s;
	cin >> s;
	int res = 700;
	rep(i, 3) {
		if (s[i] == 'o') res += 100;
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
import itertools
n = int(input())
f = [list(map(int, input().split())) for i in range(n)]
p = [list(map(int, input().split())) for i in range(n)]
ans = -(10**10)
for l in itertools.product(range(2), repeat=10):
  if sum(l) == 0:
    continue
  s = 0
  for i in range(n):
    c = 0
    for j in range(10):
      c += l[j] * f[i][j]
    s += p[i][c]
  ans = max(ans, s)
print(ans)


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

#define fi first
#define se second
#define be begin
#define en end
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ALL(a) (a).be() , (a).en()
#define REP(i,n) for(int i=0;i<(n);i++)        //repeat n times
#define REP2(i,s,n) for(int i=(s);i<(n);i++)   //repeat from s to n 
#define REPD(i,n) for(int i=(n);i>=0;i--)      //repeat from n to 0
#define REPD2(i,s,e) for(int i=(s);i>=(e);i--) //repeat from s to e
#define RANGE(i,v) for(auto &i:v)                  //repeat range
#define ASIZE(a) (sizeof(a) / sizeof(a[0]))          //array size

using LL = long long;

template<typename T1,typename T2> using P = pair< T1, T2 >;
using Pii = P<int,int>;
using Pll = P<LL,LL>;
using Pdd = P<double,double>;
using Psi = P<string,double>;

template<typename T> using V = vector< T >;
using Vi = V<int>;
using Vll = V<LL>;
using Vs = V<string>;

int main(){
    int N,K;
    cin>>N>>K;
    Vi p(N);
    REP(i,N) cin>>p[i];
    sort(ALL(p));
    int ans = 0;
    REP(i,K) ans += p[i];
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3644
#include <stdio.h>

int main()
{
    char x[1000];
    int sum,i;
    scanf("%s", &x);
    while(x[0] != '0') {
      sum=0; i=0;
      while(x[i] != '\0')
          sum += x[i++]-'0';
      printf("%d\n", sum);
      scanf("%s", &x);
    }

    return 0;
}



Measured memory_bytes: 2036
#include<stdio.h>
 
int main()
{
  int t[4][14];
  int n, i,j,c;
  char m, d;
  for(i=0; i < 4; i++){
    for(j=0; j < 14; j++){
      t[i][j]=0;
    }
  }
 scanf("%d", &c);
  for(i = 0; i < c; i++){
    scanf("%c", &d);
    scanf("%c %d", &m, &n);
    if(m == 'S'){
      t[0][n] = 1;
    }
    else if(m == 'H'){
      t[1][n] = 1;
    }
    else if(m == 'C'){
      t[2][n] = 1;
    }
    else if(m == 'D'){
      t[3][n] = 1;
    }
  }
  for(j=1; j < 14; j++){
    if(t[0][j] != 1){
      printf("S %d\n", j);
    }
  }
 
 for(j=1; j < 14; j++){
    if(t[1][j] != 1){
      printf("H %d\n", j);
    }
  }
 
 for(j=1; j < 14; j++){
    if(t[2][j] != 1){
      printf("C %d\n", j);
    }
  }
 
 for(j=1; j < 14; j++){
    if(t[3][j] != 1){
      printf("D %d\n", j);
    }
  }
 return 0;
}
 



Measured memory_bytes: 2044
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string.h>
#include<math.h>
#include<cstring>
using namespace std;
int h,w,c;
char map[101][101];
char fru;
void dfs(int i,int j){
    int dx,dy,nx,ny;
    map[i][j]='.';
    for(dy=-1;dy<=1;dy++){
        for(dx=-1;dx<=1;dx++){
            if(dx*dy==0){//斜めはダメ
                ny=i+dy;nx=j+dx;
                if(map[ny][nx]==fru&&0<=ny&&ny<h&&0<=nx&&nx<w){
                    dfs(ny,nx);
                }
            }
        }
    }
    return;
}
int main(){
    while(1){
        c=0;
        int i,j;
        cin>>h>>w;
        if(h==0&&w==0)break;
        for(i=0;i<h;i++){
            for(j=0;j<w;j++){
                cin>>map[i][j];
            }
        }
        for(i=0;i<h;i++){
            for(j=0;j<w;j++){
                switch(map[i][j]){
                    case '@':
                        fru='@';
                        dfs(i,j);
                        c++;
                        break;
                    case '#':
                        fru='#';
                        dfs(i,j);
                        c++;
                        break;
                    case'*':
                        fru='*';
                        dfs(i,j);
                        c++;
                        break;
                    default:
                        break;
                }
            }
        }
        cout<<c<<endl;
    }
    return 0;
}

Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
	int h,w;cin>>h>>w;
	char g[h][w];
	rep(i,h) rep(j,w) cin>>g[i][j];

	int dp[h+1][w+1];//dp[i][j]は(i,j)までの最小の魔法回数
	rep(i,h) rep(j,w) dp[i][j]=inf;
	if(g[0][0]=='.') dp[0][0]=0;
	else dp[0][0]=1;

	rep(i,h){
		rep(j,w){
			if(g[i][j]=='.'){
				int add=0;
				if(g[i+1][j]=='#') add=1; 
				dp[i+1][j]=min(dp[i+1][j],dp[i][j]+add);

				add=0;
				if(g[i][j+1]=='#') add=1;
				dp[i][j+1]=min(dp[i][j+1],dp[i][j]+add);
			}
			else{
				dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
				dp[i][j+1]=min(dp[i][j+1],dp[i][j]);
			}
		}
	}

/*	rep(i,h){
		rep(j,w){
			cout<<dp[i][j]<<" ";
		}
		cout<<"\n";
	}
*/
	cout<<dp[h-1][w-1]<<"\n";
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int n;
    int w[100];
    int s1, s2, sa = 1000000000;
    int i,tmp;
    
    scanf("%d", &n);
    
    for(i = 0; i < n; i++){
        scanf("%d", &w[i]);
    }
    
    s1 = w[0];
    s2 = 0;
    for(i = 1; i < n; i++){
        s2 += w[i];
    }
    
    for(i = 1; i < n; i++){
        tmp = s2 - s1;
        if(tmp < 0){
            tmp *= -1;
        }
        
        if(sa > tmp){
            sa = tmp;
        }
        
        s1 += w[i];
        s2 -= w[i];
    }
    
    printf("%d", sa);
    
    return 0;
}

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);

/* -----  2019/05/26  Problem: ABC 128 A / Link: http://abc128.contest.atcoder.jp/tasks/abc128_a  ----- */


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


	LL A, P; cin >> A >> P;
	LL ans = (3*A+P) / 2;
	
	
	cout << (ans) << "\n";

	return 0;
}


Measured memory_bytes: 256
h, w, m = map(int, input().split())
h_list = [0] * h
w_list = [0] * w
bomb = []
for i in range(m):
    h_tmp, w_tmp = map(int, input().split())
    h_list[h_tmp - 1] += 1
    w_list[w_tmp - 1] += 1
    bomb.append((h_tmp - 1, w_tmp - 1))
bomb = set(bomb)
mh = max(h_list)
id_h = []
for i, n in enumerate(h_list):
    if n == mh:
        id_h.append(i)

mw = max(w_list)
id_w = []
for i, n in enumerate(w_list):
    if n == mw:
        id_w.append(i)

for i in id_h:
    for j in id_w:
        if not (i, j) in bomb:
            print(mh + mw)
            exit()

print(mh + mw - 1)

Measured memory_bytes: 83548
n = int(input())

p = list(int(i) for i in input().split())


ans = 0
for i in range(1, n - 1):
    l = [p[i - 1], p[i], p[i + 1]]
    l.sort()
    if (l[1] == p[i]):
        ans += 1

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define aeiou printf("vowel")

using namespace std;

int main() {
  char c;
  c=getchar();
  for (int i = 0; i < 5; i++) {
    if (c=='a'||c=='e'||c=='i'||c=='o'||c=='u') {
      printf("vowel");
      return (0-0);
    }
  }
  printf("consonant");
  return 0;
}
//hehe


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define ALL(a)    a.begin(), a.end() 
#define rep(i, K, N)  for(long long int i = K; i < N; i++)
#define ll long long int
using namespace std;

int main(){
ll N, K;cin >> N >> K;

if(K%2 == 0)cout << ( ( N + K/2)/K )*( ( N + K/2)/K )*( ( N + K/2)/K ) + (N/K)*(N/K)*(N/K);

else cout << (N/K)*(N/K)*(N/K);

}

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


int main()
{  
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n,k;
    cin>>n>>k;
    int a[n],s[k+1],dp[n][k+1];
    for(int i=0;i<n;i++)cin>>a[i];
    s[0]=1;dp[0][0]=1;
    for(int j=1;j<=k;j++)
    {
        if(j<=a[0])dp[0][j]=1;
        else dp[0][j]=0;
        s[j]=s[j-1]+dp[0][j];
    }
    
    for(int i=1;i<n;i++)
    {
        dp[i][0]=1;
        for(int j=1;j<=k;j++)
        {
            if(j<=a[i])dp[i][j]=s[j]%mod;
            else dp[i][j]=(s[j]-s[j-a[i]-1])%mod;
            
            if(dp[i][j]<0)dp[i][j]+=mod;
        }
        for(int j=1;j<=k;j++)
        {
            s[j]=(s[j-1]+dp[i][j])%mod;
        }
    }
    cout<<dp[n-1][k]<<"\n";
    
}

Measured memory_bytes: 39680
import math

mod = 1000000007

def modinverse(a, m):
    x = 0
    y = 1
    gcd = m
    px = 1
    py = 0
    pgcd = a
    temp = 0

    while gcd > 0:
        quotient = pgcd // gcd

        temp = x
        x = px - quotient * temp
        px = temp

        temp = y
        y = py - quotient * temp
        py = temp

        temp = gcd
        gcd = pgcd - quotient * temp
        pgcd = temp
    if px < 0:
        px += m
    return px

def combination(n, r):
    u = 1
    for i in range(n, n - r, -1):
        u = (u * i) % mod
    d = 1
    for i in range(r, 1, -1):
        d *= i
    inverse = modinverse(d, mod)
    return (u * inverse) % mod
 
 

prime = [2]
N, M = map(int, input().split())   
count = 0
for i in range(3, math.floor(math.sqrt(M)) + 1, 2):
    f = True
    for x in prime:
        if i % x == 0:
            f = False
            break
    if f:
        prime.append(i)

c = [0 for i in range(len(prime))]
num = M
for i in range(len(prime)):
    while num % prime[i] == 0:
        c[i] += 1
        num = num // prime[i]
if num != 1:
    prime.append(num)
    c.append(1)

ans = 1
for i in range(len(prime)):
    if c[i] != 0:
        ans *= combination(c[i] + N - 1, c[i])
        ans %= mod

print(ans)

Measured memory_bytes: 3188
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		int N=scanner.nextInt();
		int T[]=new int[3];
		for(int i=0;i<N;i++){
			for(int j=0;j<3;j++)
				T[j]=scanner.nextInt();
			Arrays.sort(T);
			if(T[0]*T[0]+T[1]*T[1]==T[2]*T[2]){
				System.out.println("YES");
			}else{
				System.out.println("NO");
			}
		}
	}

}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
#define ll long long
const ll mod=1e9+7;
const int maxn=10000;
using namespace std;
 bool sortbysec(pair<ll,ll> &a, pair<ll,ll> &b) { 
    return (a.second < b.second); 
} 
 
int main()
//int found; found=chaine.find(cara); if (found!=std::string::npos) how to verify if a caracter exists in a chaine
// toupper(caractere) ==> return the majuscule of a caractere
//floor(x) Returns the largest integer smaller than x
//ceil(x) returns  Returns the smallest integer greater
/* #ifndef ONLINE_JUDGE
      freopen("input.txt","r",stdin);
    #endif */
{ 
    int l,r,d;
    int n;
    cin>>n;
    int a[n+1];
    r=n;
    l=1;
    int nb=0;
	for(int i=l;i<=r;i++)
    {
    	cin>>a[i];
    	if((i%2==1)and(a[i]%2==1))nb++;
	}
	cout<<nb;
}



Measured memory_bytes: 3552
#include<algorithm>     //sort,二分探索,など
#include<bitset>        //固定長bit集合
#include<cmath>         //pow,logなど
#include<complex>       //複素数
#include<deque>         //両端アクセスのキュー
#include<fstream>       //ファイルストリーム（標準入力変更用）
#include<functional>    //sortのgreater
#include<iomanip>       //setprecision(浮動小数点の出力の誤差)
#include<iostream>      //入出力
#include<iterator>      //集合演算(積集合,和集合,差集合など)
#include<map>           //map(辞書)
#include<numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include<queue>         //キュー
#include<set>           //集合
#include<stack>         //スタック
#include<string>        //文字列
#include<unordered_map> //イテレータあるけど順序保持しないmap
#include<unordered_set> //イテレータあるけど順序保持しないset
#include<utility>       //pair
#include<vector>        //可変長配列

//名前
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef map<string, int> msi;
typedef map<string, ll> msll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pllll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;

//定数
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;

//マクロ
#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,s,e) for(int i=s;i<e;i++)
#define repse(i,s,e) for(int i=s;i<=e;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define in(x1) cin >> x1
#define in2(x1, x2) cin >> x1 >> x2
#define in3(x1, x2, x3) cin >> x1 >> x2 >> x3
#define inN(x, N) rep(i, N) in(x[i])
#define outl(x) cout << x << endl
#define out2l(x, y) cout << x << " " << y << endl 

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

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

    //標準入力をファイルに変更
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());

    string N;
    in(N);

    if (N.back() == '3')
        outl("bon");
    else if (N.back() == '0' || 
             N.back() == '1' || 
             N.back() == '6' || 
             N.back() == '8')
        outl("pon");
    else
        outl("hon");
    return 0;
}

Measured memory_bytes: 3660