akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

const int MAX_N = 1000000;

int main() {
    int a, b;
    cin >> a >> b;
    string ret;
    if(a >= 1) ret = "Positive";
    else if (b >= 0) ret = "Zero";
    else if ((b - a) % 2 == 0) ret = "Negative";
    else ret = "Positive";
	cout << ret << endl;
}

Measured memory_bytes: 256
ans = 0
count = 0
flag = false
weathers = gets.chomp.split("").map do |weather|
  if weather == "R" && !flag
    flag = true
    count = 1
  elsif weather == "R" && flag
    count += 1
  else
    flag = false
    count = 0
  end
  if ans < count 
    ans = count
  end
end
p ans

Measured memory_bytes: 14344
#include<bits/stdc++.h>
using namespace std;
typedef long long unsigned int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, start, end) for(int i = start; i < (int)(end); ++i)

int main(){
    double h, a;
    cin >> h >> a;
    cout << ceil(h/a) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <limits.h>
#include <string>
using namespace std;
int match[10] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};

bool my_compare(pair<int, int> a, pair<int, int> b){
  if (a.first != b.first) {
    return a.first > b.first;
  }
  if (a.second != b.second) {
    return a.second > b.second;
  }
  return true;
}

int main() {
  int N, M, a;
  cin >> N >> M;
  pair<int, int> A[M];
  int dp[N+1] = {};
  for (int i=0; i<M; i++) {
    cin >> a;
    A[i] = make_pair(a, match[a]);
  }
  sort(A, A+M, my_compare);

  for (int i=1; i<N+1; i++) {
    int max_digit = INT_MIN;
    for (int j=0; j<M; j++) {
      if (A[j].second <= i) {
        if (dp[i - A[j].second]+1 > max_digit) {
          max_digit = dp[i - A[j].second] + 1;
        }
      }
    }
    dp[i] = max_digit;
  }
  int idx = N;
  while (idx > 0) {
    for (int i=0; i<M; i++) {
      if (idx-A[i].second>=0 && dp[idx]-1 == dp[idx-A[i].second]){
        cout << A[i].first;
        idx -= A[i].second;
        break;
      }
    }
  }
  cout << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)
#define ALL(x) x.begin(),x.end()

void solve(){
  string s, t; cin >> s >> t;
  int ans=0;
  FOR(i,0,3) ans += (s[i]==t[i]);
  cout << ans << endl;
}

int main(){
  solve();
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
ll modpow(ll n, int k) {
    ll r = 1;
    while (k > 0) {
        if (k & 1) (r *= n) %= mod;
        (n *= n) %= mod;
        k >>= 1;
    }
    return r;
}
ll f(int n) {
    return modpow(2, n);
}
int main() {
    int N;
    cin >> N;
    ll res = 1, res0 = 0;
    map<pair<ll, ll>, pair<int, int>> cnt;
    for (int i = 0; i < N; ++i) {
        ll a, b;
        cin >> a >> b;
        if (b < 0) {
            a = -a;
            b = -b;
        }
        if (a == 0 && b == 0) {
            ++res0;
        } else {
            auto g = abs(gcd(a, b));
            a /= g;
            b /= g;
            if (a <= 0) {
                ++cnt[{b, -a}].second;
            } else {
                ++cnt[{a, b}].first;
            }
        }
    }
    for (auto p : cnt) {
        auto t = f(p.second.first) + f(p.second.second) + mod - 1;
        (res *= t) %= mod;
    }
    res = (res + res0 + mod - 1) % mod;
    cout << res << endl;
}


Measured memory_bytes: 15964
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>

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

  std::vector<int> A(N);

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

  sort(A.begin(), A.end(), std::greater<int>());

  int answer = 0;

  for (int i = 0; i < A.size(); i++) {
    answer += (i % 2 == 0 ? 1 : -1) * A[i];
  }

  std::cout << answer << std::endl;
}


Measured memory_bytes: 256
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <vector>
#include <stack>
#include <cstdio>
#include <bitset>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
int Gcd(int a,int b){if (b == 0) return a; return Gcd(b , a%b);}
int Lcm(int a, int b){ return a/Gcd(a,b)*b;}
inline int read(){
    int f = 1, x = 0;char ch = getchar();
    while (ch > '9' || ch < '0'){if (ch == '-')f = -f;ch = getchar();}
    while (ch >= '0' && ch <= '9'){x = x * 10 + ch - '0';ch = getchar();}
    return x * f;
}
const LL maxn = 1e18;
const int inf = 2147483647;
const LL Inf = 9223372036854775807;
int main(){
    //cout << maxn<< endl;
    LL s;
    cin >> s;
    LL x1 = 0,y1 = 0,x2 = 0,y2 = 0,x3 = 0,y3 = 0;
    LL m = sqrt(s);
    //cout << m*m << ' ' << s << endl;
    if (m*m == s){
        x1 = m;
        y2 = m;
        printf("%lld %lld %lld %lld %lld %lld\n",x1,y1,x2,y2,x3,y3);
    }else{
        x1 = m+1;
        y2 = m+1;
        y1 = 1;
        x2 = x1*y2 - s;
        //cout << abs(x1*y2 - x2*y1) << endl;
        printf("%lld %lld %lld %lld %lld %lld\n",x1,y1,x2,y2,x3,y3);
    }
    return 0;
}

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

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 100010, mod = 1000000007;

int n, m;
int f[N];
bool bro[N];

int main()
{
    cin >> n >> m;
    for(int i = 1; i <= m; i++)
    {
        int x;
        cin >> x;
        bro[x] = true;
    }

    f[0] = 1, f[1] = !bro[1];
    for(int i = 2; i <= n; i++)
        if(bro[i]) f[i] = 0;
        else f[i] = (f[i - 1] + f[i - 2]) % mod;

    cout << f[n] << endl;
    return 0;
}


Measured memory_bytes: 768
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define N 2*10e5
#define precise cout<<fixed<<setprecision(10)
#pragma GCC optimize("O0")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")
#define rep(i,a,b) for(int i=a;i<b;i++)
#define min3(a,b,c) min(a,min(b,c))
#define nl cout<<"\n";
#define all(v) v.begin(),v.end()
#define F first
#define S second
typedef long long ll;
typedef vector<long long> vl;
typedef vector<pair<long,long>> vp;
void get(ll arr[],ll n){for(ll i=0;i<n;i++) cin>>arr[i];}
ll gcd(ll a,ll b);
ll binpow(ll a,ll b);
void solve()
{
    ll n;
    cin>>n;
    ll arr[n];
    get(arr,n);
    ll ans=0;
    rep(i,1,n)
    {
        if(arr[i]<arr[i-1])
        {
            ans+= arr[i-1]-arr[i];
            arr[i]=arr[i-1];
        }
    }
    cout<<ans;
}
int main()
{
 	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll t;
	t=1;
	//cin>>t;
	while(t--)
	{
	 	solve();
	}
	//cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}
ll binpow(ll a, ll b) {
   ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
ll gcd(ll a,ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

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

int main() {
    string S;
    cin >> S;
    int c[26];
    rep(i, 26) c[i] = 0;
    rep(i, S.size()) c[S[i] - 'a']++;
    rep(i, 26) if (c[i] > 1) {
        cout << "no" << endl;
        return 0;
    }
    cout << "yes" << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int i,count=0;
    char s[4];
    scanf("%s",s);
    for(i=0;i<4;i++)
    {
        if(s[i]=='+')
        {
            count++;
        }
        else if(s[i]=='-')
        {
            count--;
        }
    }
    printf("%d\n",count);
    return 0;


}


Measured memory_bytes: 128
using System;

namespace ABC058C
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] s = new string[n];
            for (int i = 0; i < n; i++)
            {
                s[i] = Console.ReadLine();
            }

            char[] chars =
            {
                'a',
                'b',
                'c',
                'd',
                'e',
                'f',
                'g',
                'h',
                'i',
                'j',
                'k',
                'l',
                'm',
                'n',
                'o',
                'p',
                'q',
                'r',
                's',
                't',
                'u',
                'v',
                'w',
                'x',
                'y',
                'z'
            };
            
            int[] counts = new int[26];

            for (int i = 0; i < chars.Length; i++)
            {
                int max = 50;
                for (int j = 0; j < n; j++)
                {
                    int count = 0;
                    for (int k = 0; k < s[j].Length; k++)
                    {
                        if (s[j][k] == chars[i])
                        {
                            count++;
                        }
                    }

                    max = Math.Min(max, count);
                }

                counts[i] = max;
            }

            string ans = "";
            for (int i = 0; i < 26; i++)
            {
                for (int j = 0; j < counts[i]; j++)
                {
                    ans += chars[i];
                }
            }
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 11092
#include <stdio.h> 

int main(void){    

int a;    

int b;    

int z;    

int min;    

int max;    

long int sum;    

min = 1000000;    

max = -1000000;     

sum = 0;     

scanf("%d",&a);     

for(b=0; b<a; b++)    {        

scanf("%d",&z);                 

if(min > z)        {            

min = z;        

}        

if(max < z)        {            

max =z;        

}        

sum = sum + z;    

}         

printf("%d %d %ld\n",min,max,sum);     

return 0;

}

Measured memory_bytes: 600
#include <iostream>
#include <iomanip> //! for setprecision(10)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>
#include <limits.h>

using namespace std;

typedef long long LL;

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define dumpMap(m) { for (auto it: m) cout << it.first << "=>" << it.second << ' '; }


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

    int ans = (N-1) / 2;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val d = Array(N + 1) { 0 }

    for (i in 1 .. N) {
        var m = i
        for (j in 2 .. i) {
            while(m % j == 0) {
                m /= j
                d[j]++
            }
        }
    }

    val M = 75
    val dp = Array(M + 1) { 0L }
    dp[1] = 1L

    for (i in 1..N) {
        if (d[i] == 0) continue
        for (j in M downTo 1) {
            for (k in 1..d[i]) {
                if (j * (k + 1) <= M) {
                    dp[j * (k + 1)] += dp[j]
                }
            }
        }
    }

    println(dp[75])
}


Measured memory_bytes: 33912
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>

using namespace std;

int N,M;
vector<int>G[5005];
vector<int>res;
int vis[5005];

void dfs(int v){
  if(vis[v]) return;
  vis[v] = 1;
  for(int i=0;i<G[v].size();i++) dfs(G[v][i]);
  res.push_back(v);
}

int judge(){
  for(int i=1;i<N;i++){
    if(find(G[res[i]].begin(), G[res[i]].end(), res[i-1]) == G[res[i]].end()) return 1;
  }
  return 0;
}

int main(){
  scanf("%d%d", &N,&M);
  for(int i=0;i<M;i++){
    int a,b;scanf("%d%d", &a,&b); a--; b--;
    G[b].push_back(a);
  }

  for(int i=0;i<N;i++) dfs(i);

  for(int i=0;i<N;i++) printf("%d\n", res[i]+1);
  printf("%d\n", judge());
  return 0;
}

Measured memory_bytes: 1872
#include <stdio.h>
#include <stdbool.h>

int find_max(int n[4][4]);
bool check(int a1, int a2, int a3, int n[4][4]);


int main()
{
    int grid[4][4];		/* 0は使わない */
    int max;

    for (int i = 1; i < 4; i++)
    {
	scanf("%d", &grid[i][1]);
	scanf("%d", &grid[i][2]);
	scanf("%d", &grid[i][3]);
    }

    max = find_max(grid);

    for (int i = 0; i <= max; i++)
    {
	for (int j = 0; j <= max; j++)
	{
	    for (int k = 0; k <= max; k++)
	    {
		if (check(i, j, k, grid) == true)
		{
		    printf("Yes\n");
		    
		    return 0;
		}
	    }
	}
    }

    printf("No\n");
    
    return 0;
}

bool check(int a1, int a2, int a3, int n[4][4])
{
    int testing_a[4];
    int testing_b[4];

    testing_b[1] = n[1][1] - a1;
    testing_b[2] = n[2][2] - a2;
    testing_b[3] = n[3][3] - a3;

    testing_a[1] = a1;
    testing_a[2] = a2;
    testing_a[3] = a3;

    for (int i = 1; i < 4; i++)
    {
	for (int j = 1; j < 4; j++)
	{
	    if (testing_a[i] + testing_b[j] != n[i][j])
	    {
		return false;
	    }
	}
    }
    
    return true;
}

int find_max(int n[4][4])
{
    int max = 0;

    for (int i = 1; i < 4; i++)
    {
	for (int j = 1; j < 4; j++)
	{
	    if (max < n[i][j])
	    {
		max = n[i][j];
	    }
	}
    }
    
    return max;
}


Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main(){

    int s;
    cin>>s;
    // if(s<=4){
    switch(s){
        case 1: cout<<4<<endl; return 0;
        case 2: cout<<4<<endl; return 0;
        // case 3: cout<<4<<endl; break;
        case 4: cout<<4<<endl; return 0;
    }
    // return 0;
    // }

    int pre = s;
    int now;
    for(int i=2;i<=1000000;i++){
        if(pre%2==0){
            now=pre/2;
        }else{
            now=pre*3+1;
        }
        if(now==4){
            cout<<i+3<<endl;
            return 0;
        }else{
            // cout<<now<<endl;
        }
        pre=now;
    }

//     int a[10005];

//     a[1]=s;
//     for(int i=2;i<=10000;i++){
//         if(a[i-1]%2==0){
//             a[i]=a[i-1]/2;
//         }else{
//             a[i]=a[i-1]*3+1;
//         }
//     }

// cout<<a[1]<<endl;
// cout<<a[2]<<endl;
// cout<<a[3]<<endl;

//     int rev;
//     for(int k=1;k<=10;k++){
//         rev=a[k];
//         for(int i=k+1;i<=10;i++){
//             if(a[i]==rev){
//                 cout<<i<<endl;
//                 return 0;
//             }
//             cout<<k<<"  "<<i<<"  "<<"  "<<a[i]<<"   "<<rev<<endl;
//         }
//     }
//     cout<<"err"<<endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        //変数
        int count = 0;
        boolean sw = false;
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;

        int answer=0;

        List<Integer> list1 = new ArrayList<>();
        List<String> list2 = new ArrayList<>();
        //int array1[] = new int[];
        //int array2[] = new int[];

        //入力
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int V[]=new int[N];
        for(int i=0;i<N;i++)
        {
            V[i]=sc.nextInt();
        }
        int array1[]=new int[N];
        int C[]=new int[N];
        for(int i=0;i<N;i++)
        {
            C[i]=sc.nextInt();
        }

        //処理

        for(int i=0;i<N;i++)
        {
            array1[i]=V[i]-C[i];
        }

        for(int i=0;i<N;i++)
        {
            if(array1[i]>0)
            {
                int tmp=array1[i];
                answer+=tmp;
            }
        }

        //Collections.sort(a);
        //System.out.println(Arrays.toString(list1.toArray()));
        //System.out.println(Arrays.toString(array1));
		//System.out.println(Arrays.deepToString(a));
        System.out.println(answer);
    }
}


Measured memory_bytes: 23380
package main

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

func main() {
	N := nextInt()
	M := nextInt()
	var a, b, c []int
	for i := 0; i < M; i++ {
		a = append(a, nextInt()-1)
		b = append(b, nextInt()-1)
		c = append(c, -nextInt())
	}

	dist := make([]int, N)
	for i := 1; i < N; i++ {
		dist[i] = math.MaxInt64
	}

	for loop := 0; loop < N-1; loop++ {
		for i := 0; i < M; i++ {
			if dist[a[i]] == math.MaxInt64 {
				continue
			} else if dist[b[i]] > dist[a[i]]+c[i] {
				dist[b[i]] = dist[a[i]] + c[i]
			}
		}
	}

	ans := -dist[N-1]

	negative := make([]bool, N)
	for loop := 0; loop < N; loop++ {
		for i := 0; i < M; i++ {
			if dist[a[i]] == math.MaxInt64 {
				continue
			} else if dist[b[i]] > dist[a[i]]+c[i] {
				dist[b[i]] = dist[a[i]] + c[i]
				negative[b[i]] = true
			} else if negative[a[i]] {
				negative[b[i]] = true
			}
		}
	}

	if negative[N-1] {
		fmt.Println("inf")
	} else {
		fmt.Println(ans)
	}
}

// Input. ----------

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Split(bufio.ScanWords)
}

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}

	return i
}

func nextString() string {
	sc.Scan()
	if err := sc.Err(); err != nil {
		panic(err)
	}

	return sc.Text()
}

// ---------- Input.

// Util. ----------

func min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}

func max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}

// ---------- Util.


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

#define FOR(i, x, n) for(int i = x; i < n; i++)

using namespace std;
typedef long long int ll;


long long int binPow(long long int a, long long int b, long long int m){
    a = a%m;
    long long int res = 1;
    while(b){
        if(b&1)res = res*a%m;
        a = a*a;
    }
    return res;
}

long long int binPow(long long int a, long long int b){
    a = a;
    long long int res = 1;
    while(b){
        if(b&1)res = res*a;
        a = a*a;
    }
    return res;
}

long long int gcd(long long int a, long long int b){
    while(a){
        long long int temp = a;
        a = b%a;
        b = temp;
    }
    return b;
}

int main(){
    int n;
    cin >> n;
    int ans[n+1];
    FOR(i, 1, n+1){
        int val;
        cin >> val;
        ans[val] = i;
    }
    FOR(i, 1, n+1)cout << ans[i] << " ";
}


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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
using ld = long double;
ll mod = 1000000007;

int main() {
    ll n;
    cin >> n;
    rep(i, 50000) {
        double temp = i * 1.08;
        if ((ll)temp == n) {
            cout << i << endl;
            return 0;
        }
    }
    cout << ":(" << endl;
    return 0;
}



Measured memory_bytes: 3588
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
using namespace std;
int n,l,r;
int check(int x,int y)
{
	return y-x+1;
}
int hs(int z)
{
	int ans=0;
	for(int i=1;i<=z;i++)
	{
		cin>>l>>r;
		ans+=check(l,r);
	}
	return ans;
}
int main()
{
    cin>>n;
    cout<<hs(n);
    
    return 0;
}

Measured memory_bytes: 256
/*
    TOP GUN: MAVERICK!!
                                */
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
//#include <boost/functional/hash.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int lli;
lli mod=1e9+7.;   
lli INF=1e17;
#define sqr(x) (x) * (x)
#define bip(n) __builtin_popcountll(n)//no of ones bit in binary!!
#define bictz(n) __builtin_ctzll(n)//no of trailing zeroes in binary!!
#define biclz(n) __builtin_clzll(n)//no of leading zeroes in binary!!
#define bffs(n) __builtin_ffsll(n)//index of first one bit!!
typedef pair<lli,lli> ll;
#define mem1(a,x) fill(&a[0], &a[0] + sizeof(a) / sizeof(a[0]), x)
#define mem2(a,x) fill(&a[0][0], &a[0][0] +sizeof(a)/sizeof(a[0][0]),x)
#define mem3(a,x) fill(&a[0][0][0], &a[0][0][0] +sizeof(a)/sizeof(a[0][0][0]),x)
#define fi1 ifstream fin("input.txt")
#define of1 ofstream fout("output.txt")
int fmx(int x, int y) { return (((y-x)>>(31))&(x^y))^y; }
int fmi(int x, int y) { return (((y-x)>>(31))&(x^y))^x; }
typedef tree<lli,null_type,less<lli>,rb_tree_tag,tree_order_statistics_node_update> ost;
lli n,q,z,y,k,m;
const double pi1=3.14159265358979323846;
//unordered_map<pair<ll,lli>,lli> mp;
lli me(lli a,lli b,lli M)
{
    if(b==0)
    return 1;
    else if(b%2==0)
    return me((a*a)%M,b/2,M);
    else
    return (a%M*me((a*a)%M,(b-1)/2,M)%M)%M;
}
lli mI(lli a,lli m)
{
    return me(a,m-2,m);
}
//lli tot=0;
vector<lli> pf(string s) {
    int n = (int)s.length();
    vector<lli> pi(n);
    for (int i = 1; i < n; i++) {
        int j = pi[i-1];
        while (j > 0 && s[i] != s[j])
            j = pi[j-1];
        if (s[i] == s[j])
            j++;
        pi[i] = j;
    }
    return pi;
}

int main()
{
    ios_base::sync_with_stdio(0);
    //cin.tie(0);
    cin>>n;
    multiset<lli> ss;
    lli a[n+1];
    for(int i=1;i<=n;i++)
    {
    	cin>>y;
    	a[i]=y;
    	ss.insert(y);
    }
    for(int i=1;i<n;i++)
    {
    	ss.erase(ss.find(a[i]));
    	lli d=*ss.begin();
    	d=a[i]-d;
    	if(d>1)
    	return cout<<"No",0;
    }
    cout<<"Yes";
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
  cin>>a[i];
  }
  sort(a.begin(),a.end());
  double ans=((double)a[0]+a[1])/2;
  for(int i=2;i<n;i++){
  ans=(((double)ans+a[i])/2);
  }
  cout<<setprecision(6)<<ans<<endl;
  return 0;
}

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

typedef long long ll;
const ll MOD = 1e9 + 7;
const long long INF = 1LL<<60;
const double PI=3.14159265358979323846;
const int NMAX=100005;
using namespace std;


int main(){
    int n;
    cin >> n;
    vector<vector<pair<int,int>>> a(n);
    for(int i = 0; i < n; i++){
        int an;
        cin >> an;
        for(int j = 0; j < an; j++){
            int x,y;
            cin >> x >> y;
            x--;
            a[i].push_back({x,y});
        }
    }

    int ans = 0;
    for(int i = 0; i < (2<<n); i++){
        vector<bool> honest(n,false);
        int cnt = 0;
        for(int j = 0; j < n; j++){
            if((i>>j) & 1){
                honest[j] = true;
                cnt++;
            }
        }

        for(int j = 0; j < n; j++){
            if(honest[j] == false) continue;
            for(int k = 0; k < a[j].size(); k++){
                int x = a[j][k].first;
                int y = a[j][k].second;
                if((honest[x] == false && y == 1) ||
                    (honest[x] == true && y == 0)){
                        cnt = -1;
                        break;
                    }
            }
            if(cnt == -1) break;
        }
        ans = max(ans, cnt);
    }

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <tuple>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(perm),end(perm)
#define showall(obj) for(auto x:obj)cout<<x<<endl;
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
typedef vector<int> vint;
typedef vector<ll> vll;
const int inf = 100100100;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
    int n; cin>>n;
    set <int> s;
    rep(i,n){
        int p; cin>>p; s.insert(p);
    }
    cout<<s.size()<<endl; return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

def main():
	N,K = inputMap()
	h = inputList()

	ans = 0
	for i in h:
		if i >= K:
			ans += 1

	print(ans)


if __name__ == "__main__":
	main()


Measured memory_bytes: 50848
#include <stdio.h>

int main(void) {
	int n, ans = 0;
	int a[20], b[20], c[19];

	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf("%d", &a[i]);
	}
	for (int i = 0; i < n; ++i) {
		scanf("%d", &b[i]);
	}
	for (int i = 0; i < n - 1; ++i) {
		scanf("%d", &c[i]);
	}

	int old = a[0];
	for (int i = 0; i < n; ++i) {
		ans += b[a[i]-1];
		if (a[i] - old == 1) {
			ans += c[old - 1];
		}
		old = a[i];

	}
	printf("%d", ans);

	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = 0;
		int ans = 0;
		for (int i = 0; i < n; i++) {
			a = sc.nextInt();
			while (a % 2 == 0) {
				a /= 2;
				ans++;
			}
		}
		sc.close();

		System.out.println(ans);
	}
}


Measured memory_bytes: 34272
if __name__ == "__main__":
    p, q = input().split()
    p = int(p)
    q = int(q)
    if p > q:
        answer = p
        p = p - 1
    else:
        answer = q
        q = q - 1
    if p > q:
        answer += p
    else:
        answer += q
    print(answer)


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

int howLong(int i) {
    int l = ((1+i)*i)/2;
    return l;
}

int main() {
    int a, b; cin >> a >> b;
    cout << howLong(b-a-1) - a << endl;

    return 0;
}

Measured memory_bytes: 256
N,M,Q = map(int,input().split())
line = [tuple(map(int,input().split())) for i in range(M)]
query = [tuple(map(int,input().split())) for i in range(Q)]
dp = [[0 for i in range(N+1)] for i in range(N+1)]
for l in line:
    dp[l[0]][l[1]] += 1
for i in range(N):
    for j in range(N):
        dp[i+1][j+1] += dp[i+1][j]
for i in range(N):
    for j in range(N):
        dp[i+1][j+1] += dp[i][j+1]
for p,q in query:
    print(dp[q][q]-dp[q][p-1]-dp[p-1][q]+dp[p-1][p-1])

Measured memory_bytes: 44408
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
 
int main(){
  int x[100],i=0;
  char s[100];
 
  while( scanf("%s", s) != EOF ){
    if ( s[0] == '+' ){
      i--;
      x[i-1]=x[i-1]+x[i];
    } else if ( s[0] == '-' ){
      i--;
      x[i-1]=x[i-1]-x[i];
    } else if ( s[0] == '*' ){
      i--;
      x[i-1]=x[i-1]*x[i];
    } else {
      x[i] = atoi(s);
      i++;
    }
  }
  printf("%d\n",x[0]);
  return 0;
}

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

using namespace std;

const int MAXN = 200000;
int A[MAXN+1],B[MAXN+1];
int C[MAXN+1];

int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)scanf("%d",&A[i]);
    for(int i=1;i<=n;i++)B[A[i]] = i;

    for(int i=1;i<=n;i++)
    {
        if(B[i]>B[i-1])C[i] = C[i-1]+1;
        else C[i] = 1;
    }

    int ans = 0;
    for(int i=1;i<=n;i++)ans = max(ans, C[i]);

    printf("%d",n-ans);

    return 0;
}


Measured memory_bytes: 2560
def main():
    n = int(input())
    A = list(map(int, input().split()))
    B = [None] * n
    cnt = 0
    for i in range(n):
        if A[i] <= 0:
            cnt += 1
        B[i] = abs(A[i])
    print(sum(B) - 2 * min(B) if cnt % 2 == 1 else sum(B))


if __name__ == '__main__':
    main()


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

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return b/gcd(a,b)*b;}

int main() {
  string a, b;
  int i_a, i_b;
  cin >> a >> b;
  i_a = stoi(a);
  i_b = stoi(b);
  if (i_a <= i_b) {
    rep(i, i_b) {
      printf("%c", a[0]);
    }
  }else{
    rep(i, i_a) {
      printf("%c", b[0]);
    }
  }
  return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.math.*;
import java.util.*;

class Main{
	public static void main(String[] args) throws IOException{
		Scanner r = new Scanner(System.in);
		String str;
		char[] c;
		int flag;
		int ans=0;
		while(r.hasNext()){
			flag=0;
			str = r.next();
			c =str.toCharArray();
			if(str.length() == 1) ans++;
			else{
				for(int i=0;i<str.length()/2;i++){
					if(c[i]==c[str.length()-1-i])continue;
					else {
						flag=1;
						break;
					}
				}
				if(flag == 0 )ans++;
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 17136
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define REP(i,n) for(int i = 0;i < (int)(n);++i)
#define RREP(i,n) for(int i = (int)n-1;i >= 0;--i)
#define FOR(i,s,n) for(int i = s;i < (int)n;++i)
#define RFOR(i,s,n) for(int i = (int)n-1;i >= s;--i)
#define ALL(a) a.begin(),a.end()
#define IN(a, x, b) (a<=x && x<b)
template<class T>inline void out(T t){cout<<t<<"\n";}
template<class T,class... Ts>inline void out(T t,Ts... ts){cout<<t<<" ";out(ts...);}
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;}
constexpr int INF = 1e18;

signed main(){
	int N;
	cin >> N;
	vector<int>a(N);
	REP(i,N){
		cin >> a[i];
	}
	vector<int>dp(2020);
	dp[0] = 1;
	REP(i,N){
		RREP(j,2020){
			if(dp[j] == 0)continue;
			if(j + a[i] < 2020)dp[j + a[i]] = 1;
		}
	}
	int Q;
	cin >> Q;
	REP(i,Q){
		int t;
		cin >> t;
		if(dp[t])out("yes");
		else out("no");
	}
}


Measured memory_bytes: 3092
#include <stdio.h>
#define N 500001

int H;

void maxHeap(int *A,int i){
  int l,r;
  int tmp;
  int L;
  l = i * 2;
  r = i * 2 + 1;

  if(l <= H && A[l] > A[i])
    L = l;
  else L = i;

  if(r <= H && A[r] > A[L])
    L = r;

  if(L != i){
    tmp = A[i];
    A[i] = A[L];
    A[L] = tmp;
    maxHeap(A,L);
  }
}

void buildmaxHeap(int *A){
  int i;
  for(i = H/2 ; i >= 1 ; i--)maxHeap(A,i);
}
int main(){
  int i;
  int A[N];
  scanf("%d",&H);
  for(i = 1 ; i <= H ; i++)scanf("%d",&A[i]);
  buildmaxHeap(A);
  for(i = 1 ; i <= H ; i++)printf(" %d",A[i]);
  printf("\n");
  return 0;
}



Measured memory_bytes: 3676
<?php
$wresult = array();
fscanf(STDIN, "%d %d", $h, $w);
$index =0;
for($i=0;$i<$h;$i++){
  fscanf(STDIN, "%s", $s);
  $cut[$i] = str_split($s);
  $count=0;
  for($j=0;$j<$w;$j++){
    $results[$i][$j] = $cut[$i][$j];
    if($cut[$i][$j] == "."){
      $count++;
    }
    if($j == $w-1){
      if($count !== $w){
        for($c=0;$c<$w;$c++){
           $wresult[$index][] = $results[$i][$c];
        }
          echo "\n";
          $index++;
      }
    }
  }
}
$h = count($wresult);
$hresults = array();
$hresult = array();
$index =0;
for($i=0;$i<$w;$i++){ //横
  $count=0;
  for($j=0;$j<$h;$j++){  //縦
    $hresults[$j][$i] = $wresult[$j][$i];
    if($wresult[$j][$i] == "."){
      $count++;
    }
    if($j == $h-1){
      if($count !== $h){
        for($c=0;$c<$h;$c++){
          $hresult[$c][$index] = $hresults[$c][$i];
        }
        $index++;
      }
    }
  }
}
$h = count($hresult);
for($i=0;$i<$h;$i++){
  $w = count($hresult[$i]);
  for($j=0;$j<$w;$j++){
    echo $hresult[$i][$j];
    if($j == $w-1){
      echo "\n";
    }
  }
}

?>


Measured memory_bytes: 8696
#include <iostream>
using namespace std;
int main ()
{

    int a;
    int b;
    string s;
    string t;
    string u;
    cin >> s;
    cin >> t;
    cin >> a;
    cin >> b;
    cin >> u;
    if (u == s){
        a-=1;
        cout << a<<" "<<b;
    }
    else {
        b-=1;
        cout<< a<<" "<< b;
    }
    return 0;
}

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

using namespace std;

#define fi first
#define se second
#define eb emplace_back
#define mt make_tuple
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

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

const ll INF=LLONG_MAX;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	int n;
	cin >>n;
	ll a[n];
	for(int i=0; i<n; i++){
		cin >> a[i];
	}
	sort(a,a+n);
	ll ans = 1LL;
	for(int i=0; i<n; i++){
		ll x = log2(ans);
		ll y = log2(a[i]);
		if(x+y>=60){
			cout << -1 << endl;
			return 0;
		}
		ans *= a[i];
	}
	if(ans>(ll)1e18){
		cout << -1 << endl;
		return 0;
	}
	cout << ans << endl;
}
	
// READ & UNDERSTAND
// ll, int overflow, array bounds, memset(0)
// special cases (n=1?), n+1 (1-index)
// do smth instead of nothing & stay organized
// WRITE STUFF DOWN


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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	vector<int> L,R;
	vector<long long> K(1,0);
	int N;
	cin>>N;
	for(int i=0;i<N;i++){ int l,r; cin>>l>>r; L.push_back(l); R.push_back(-r); }
	sort(L.begin(),L.end());
	sort(R.begin(),R.end());
	while(!L.empty()){
		int l=L.back(); 
		int r=R.back();
		L.pop_back();
		R.pop_back();
		if(l+r>=0){
			if(min(l,r)>=0) K.front()+=l+r; 
			else{ K.push_back(max(l,r)+K.front()); K.front()+=l+r; }
		}
		else{
			K.front()+=max({0,l,r});
			break;
		}
	}
	long long res=0;
	for(int i=0;!K.empty();i++){
		res=max(res,K.back());
		K.pop_back();
	}
	cout<<res*2<<endl;
	return 0;
}

Measured memory_bytes: 1524
#include "bits/stdc++.h"
using namespace std;


/* macro */
#define rep(i,a,b) for(int i=a;i<b;i++)
#define revrep(i,a,b) for(int i = a; i > b; i--)
#define int long long
#define exist(s,e) ((s).find(e)!=(s).end())
#define all(v) (v).begin(), (v).end()
#define each(s,itr) for(auto (itr) = s.begin(); (itr) != s.end(); (itr)++)
#define sum(v) accumulate(all(v), (0LL))
#define pb push_back


/* alias */
template<class T> using vec = vector<T>;
typedef vector<int> vi;
typedef pair<int, int> pi;


/* constant */
const int inf = pow(2, 62);
const int mod = 1e9 + 7;
int dx[8]={1,0,-1,0,-1,1,-1,1};
int dy[8]={0,1,0,-1,-1,-1,1,1};
const string alpha = "abcdefghijklmnopqrstuvwxyz";

/* io_method */
int input(){int tmp;cin >> tmp;return tmp;}
string raw_input(){string tmp;cin >> tmp;return tmp;}
string readline(){string s;getline(cin, s);return s;}
template<class T> void printx(T n){cout << n;}
template<class T, class U> void printx(pair<T, U> p){cout << "(" << p.first << "," << p.second << ")";}
template<class T> void printx(vector<T> v){cout << "{";rep(i,0,v.size()){printx(v[i]);if(i != v.size()-1)printx(",");}cout << "}";}
template<class T> void print(T n){printx(n);cout << endl;}
template<class T> void print(set<T> s){cout << "{";each(s, e){if(e != s.begin()) printx(",");printx(*e);}cout << "}" << endl;}
template<class T, class U> void print(map<T, U> mp){cout << "{";each(mp, e){cout << "(" << e -> first << "," << e -> second << ")";}cout << "}" << endl;}


/* general_method */
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; }




/* main */


signed main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    string s = raw_input();

    if((s[0] == s.back()) ^ ((int)s.size() % 2 == 1)){
        print("First");
    }else{
        print("Second");

    }

    

    

   

    




    



    





    


    

}



Measured memory_bytes: 512
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rel register ll
#define rec register char
#define gc getchar
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
template <typename mitsuha>
inline bool read(mitsuha &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return 0&pc(48);
  if (x<0) pc('-'),x=-x;
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  return 0;
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
int main(){
int n=read();
string ans;
for (;n;n/=-2){
  if (n&1) n--,ans="1"+ans;
  else ans="0"+ans;
  }
if (!ans.size()) ans="0";
cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<list>
#include<set>
#include<string>
using namespace std;
int gcd(int a, int b) {
	int c = a % b;
	while (c != 0) {
		a = b;
		b = c;
		c = a % b;
	}
	return b;
}
struct UnionFind {
	vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

	UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
		for (int i = 0; i < N; i++) par[i] = i;
	}

	int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}

	void unite(int x, int y) { // xとyの木を併合
		int rx = root(x); //xの根をrx
		int ry = root(y); //yの根をry
		if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
		par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
	}

	bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};
typedef long long ll;

const ll M = 998244353;

vector<ll> fac(300001); //n!(mod M)
vector<ll> ifac(300001); //k!^{M-2} (mod M)

ll mpow(ll x, ll n) {
	ll ans = 1;
	while (n != 0) {
		if (n & 1) ans = ans * x % M;
		x = x * x % M;
		n = n >> 1;
	}
	return ans;
}
ll comb(ll a, ll b) {
	if (a == 0 && b == 0)return 1;
	if (a < b || a < 0)return 0;
	ll tmp = ifac[a - b] * ifac[b] % M;
	return tmp * fac[a] % M;
}
// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a) {
	long long b = M, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= M;
	if (u < 0) u += M;
	return u;
}
int main() {
	int n, i, w[111], sum = 0, sum2 = 0,ans;
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> w[i];
		sum += w[i];
	}
	ans = sum;
	for (i = 0; i < n; i++) {
		sum2 += w[i];
		ans = min(ans, abs(sum - sum2 * 2));
	}
	cout << ans << endl;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
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;
}

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << "square1001" << endl;
    return 0;
}


Measured memory_bytes: 3032
#define STOPIT
#include <bits/stdc++.h>
#define loop(n) for (lint ngtkana_is_a_genius = 0; ngtkana_is_a_genius < lint(n); ngtkana_is_a_genius++)
#define rep(i, begin, end) for (lint i = lint(begin); (i) < lint(end); i++)
#define all(v) v.begin(), v.end()
#define rand(l, r) std::uniform_int_distribution<>(l, r)(mt)
using lint = long long;
auto mt = std::mt19937_64(std::random_device{}());
auto cmn = [](auto&& a, auto b){ if (a > b) {a = b; return true;} return false; };
auto cmx = [](auto&& a, auto b){ if (a < b) {a = b; return true;} return false; };
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { std::cerr << " " << head; debug_impl(tail...); }
#ifndef STOPIT
#define debug(...)\
  do {\
    std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
    debug_impl(__VA_ARGS__);\
    std::cerr << std::noboolalpha;\
  } while (false)
#else
#define debug(...) {}
#endif

int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  lint h, w; std::cin >> h >> w;
  if (h > w) std::swap(h,w);
  auto cal = [&] {
    if (2 <= h) return (h-2)*(w-2);
    else if (2 <= w) return w - 2;
    return 1ll;
  };
  lint ans = cal();
  std::cout << ans << std::endl;
  return 0;
}

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  ll n,k,x,y;
  cin >> n >> k >> x >> y;
  cout << x*min(n, k)+y*max(0LL, n-k) << endl;
}

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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(long long i=(l);i<(r);i++)
#define dec(i, l, r)   for(long long i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    std::ios::sync_with_stdio(false);
    int n;cin >> n;
    vector<int> t(n+1), x(n+1), y(n+1);
    t[0] = 0;
    x[0] = 0;
    y[0] = 0;
    inc(i, 1, n+1){
        cin >> t[i] >> x[i] >> y[i];
    }
    string ans = "Yes";
    inc(i, 1, n+1){
        int dt = t[i]-t[i-1];
        int dx = abs(x[i]-x[i-1]);
        int dy = abs(y[i]-y[i-1]);
        if(dt%2 != (dx+dy)%2) ans = "No";
        if(dt < dx+dy) ans = "No";
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1408
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math

# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    N = inputInt()
    a = inputList()
    
    tmp = {}
    for i in a:
        if i in tmp:
            tmp[i] += 1
        else:
            tmp[i] = 1
            
    ans = 0
    for k, v in tmp.items():
        if k != v:
            if k < v:
                ans += v-k
            else:
                ans += v
    
    print(ans)
            	
if __name__ == "__main__":
	main()


Measured memory_bytes: 72044
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <sstream>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define ll long long
#define INF 0x3f3f3f3f 
#define MEM(x,y) memset(x,y,sizeof(x))
#define int long long
#define rep(i , a , b) for(int i = a ; i <= b ; i ++)
#define P pair<int,int>
#define  sc(a) scanf("%lld",&a)
#define pf(a) printf("%lld ",a)
int q[300000];
int w[300000];
using namespace std;
signed main()
{
	int n;
    cin >> n;
	rep(i, 1, n )
		sc(q[i]);
       rep(i,1,n)
        {
            if (i % 2 == 1)
                w[1] += q[i];
            else
                w[1] -= q[i];
        }
        rep(i,2,n)
        {
            w[i] = 2 * q[i - 1] - w[i - 1];
        }
      rep(i,1,n)
        {
            pf(w[i]);
        }
  
}











Measured memory_bytes: 4096
# Aizu Problem ITP_1_2_A: Small, Large or Equal
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")

a, b = [int(_) for _ in input().split()]
if a < b:
    print("a < b")
elif a > b:
    print("a > b")
else:
    print("a == b")

Measured memory_bytes: 7708
#include<bits/stdc++.h>
#define all(v) v.begin(), v.end() 
using namespace std;
typedef long long ll;

const int N = 102;

int n, res, shop[N][N], p[N][N];

int main() {
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   res = -1e9;
   cin >> n;
   for(int i=0; i<n; ++i) {
       for(int j=1; j<=10; ++j)
          cin >> shop[i][j];
   }
   for(int i=0; i<n; ++i) {
       for(int j=0; j<=10; ++j)
           cin >> p[i][j];
   }
   for(int b=1; b<(1<<10); ++b) {
       int profit = 0;
       for(int i=0; i<n; ++i) {
           int tot = 0;
           for(int j=0; j<10; ++j) {
               if((b & (1 << j)) && shop[i][j+1]){
                   ++tot;
               }
           }
           profit += p[i][tot];
       }
       res = max(res, profit);
   }
   cout << res << "\n";
   return 0;
} 


Measured memory_bytes: 384
def solve():
    board = read()
    result = think(board)
    write(result)


def read():
    h, w = read_int(2)
    board = []
    for y in range(h):
        board.append(read_line(w))
    return board


def read_int(n):
    return list(map(lambda x: int(x), read_line().split(' ')))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(board):
    # destructive method
    vacant_cell_symbol = '.'
    bomber_cell_symbol = '#'

    x_range, y_range = get_xy_range(board)

    new_board = [[0 for x in range(x_range)] for y in range(y_range)]

    for y in range(y_range):
        for x in range(x_range):
            if board[y][x] == bomber_cell_symbol:
                new_board[y][x] = bomber_cell_symbol
            else:
                cells = gather_cells_around(board, x, y)
                new_board[y][x] = cells.count(bomber_cell_symbol)
    return new_board


def get_xy_range(board):
    return len(board[0]), len(board)


def gather_cells_around(board, x, y):
    x_range, y_range = get_xy_range(board)
    offsets = [[-1, -1], [-1, 0], [-1, 1], [0, -1], [0, 1], [1, -1], [1, 0], [1, 1]]
    cells = []
    for offset in offsets:
        if on_board(offset, x, y, x_range, y_range):
            cells.append(board[y + offset[1]][x + offset[0]])
    return cells


def on_board(offset, x, y, x_range, y_range):
    return 0 <= x + offset[0] < x_range and 0 <= y + offset[1] < y_range


def write(result):
    for line in result:
        print(''.join(list(map(lambda x: str(x), line))))

if __name__ == '__main__':
    solve()

Measured memory_bytes: 3188