akhauriyash/Code-Regression huggingface dataset:
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	const maxWord = (1 << 30)
	buf := []byte{}
	sc.Buffer(buf, maxWord)
	sc.Split(bufio.ScanWords)
}

func input() string {
	sc.Scan()
	return sc.Text()
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func main() {
	n, _ := strconv.Atoi(input())
	a := make([]int, n)
	b := make([]int, n)
	c := make([]int, n)
	for i := 0; i < n; i++ {
		a[i], _ = strconv.Atoi(input())
		b[i], _ = strconv.Atoi(input())
		c[i], _ = strconv.Atoi(input())
	}

	dp := make([][]int, n)
	for i := 0; i < n; i++ {
		dp[i] = make([]int, 3)
	}
	dp[0][0] = a[0]
	dp[0][1] = b[0]
	dp[0][2] = c[0]
	for i := 1; i < n; i++ {
		dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + a[i]
		dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + b[i]
		dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + c[i]
	}

	ans := max(dp[n-1][0], dp[n-1][1])
	ans = max(ans, dp[n-1][2])
	fmt.Println(ans)
}


Measured memory_bytes: 8704
///There is No God Besides Allah, Hazrat Muhammad (SAW) is the Messenger of Allah

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

#define _FIO ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define TC(t) while(t--){slove();}

#define all(v) (v).begin(),(v).end()
#define rall(v) reverse(all(v))
#define S(v) sort(all(v))
#define SP(v,s,e) sort(v.begin()+s,v.begin()+e)
#define Rs(v) sort(rall(v))
#define f(s,e) for(int i=s;i<e;i++)
#define rf(e,s) for(int i=e;i>=s;i--)
#define fi(it,v) for(auto it=v.begin();it!=v.end();++it)
#define unq(v) sort(all(v)),(v).erase(unique(all(v)),v.end())
#define mi(v) *min_element(all(v))
#define ma(v) *max_element(all(v))
#define fup(v,n) fill(all(v),n)
#define point(x)  fixed<<setprecision(x)
#define endl "\n"

#define pb push_back
#define ff first
#define se second

const double pi = acos(-1.0);
const int mod=1000000007;///1e9+7
const int maxn = 2000010;

typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef set<ll> St;
typedef multiset<ll> MSt;
typedef map<ll,ll> M;
typedef map<string,ll> MS;
typedef map<char,char> MC;

ll b_exp(ll a,ll n)
{
    ll ans = 1;
    while(n>0)
    {
        if(n&1)
            ans*=a;
        a*=a;
        n>>=1;
    }
    return ans;
}

void slove()
{
    int n;
    cin>>n;
    double c = (double)2*pi*n;
    cout<<point(20)<<c<<endl;

}


int main()
{
   // _FIO;
//   int t;
//   cin>>t;
//   TC(t);


slove();

}

///ALHAMDULILLAH

///Source_C0de-Fahim Shahriar


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

int main()
{
	vector<int> x(4), y(4);
	cin >> x[0] >> y[0] >> x[1] >> y[1];
	int dx = x[1] - x[0], dy = y[1] - y[0];
	x[2] = x[1] - dy;
	y[2] = y[1] + dx;
	dx = x[2] - x[1], dy = y[2] - y[1];
	x[3] = x[2] - dy;
	y[3] = y[2] + dx;
	cout << x[2] << " " << y[2] << " " << x[3] << " " << y[3] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
#define PIL pair<int,LL>
#define PLI pair<LL,int>
#define PIII pair<int,PII>
#define PLL pair<LL,LL>
#define PLII pair<LL,PII>
#define VI vector<int>
#define VVI vector<VI>
#define VL vector<LL>
#define VVL vector<VL>
#define VPII vector<PII>
#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define all(x) x.begin(),x.end()
#define watch(x) cout<<(#x)<<" = "<<(x)<<'\n'
#define mset(a,v) memset(a,v,sizeof(a))
#define setp(x) cout<<fixed<<setprecision(x)
#define EPS 0.00000000001
#define PI acos(-1)
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
using namespace std;

const int MOD = 1e9 + 7;
const LL MX = 1e9;
const LL INF = 1e9;

void print_a(VI v)
{
    if(v.size()) cout<<v[0];
    loop(i,1,v.size()) cout<<' '<<v[i];
    cout<<'\n';
}

VVI init_vvi(int n, int m, int val)
{
    return VVI(n,VI(m,val));
}

VVL init_vvl(int n, int m, LL val)
{
    return VVL(n,VL(m,val));
}

void inv_mod(LL a, LL b, LL &x, LL &y)
{
    if(a == 0)
    {
        x = 0; y = 1;
        return;
    }

    LL x1, y1;
    inv_mod(b%a,a,x1,y1);

    y = x1;
    x = y1 - (b/a) * x1;
}

int main()
{
    //ofstream out("output.txt");
    //ifstream in("input.txt");
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    int n, m;
    cin>>n>>m;

    LL tm1[n+1];
    tm1[n] = 1;
    rev_loop(i,n-1,0)
    {
        tm1[i] = (tm1[i+1] * (m - i)) % MOD;
    }

    LL ans = (tm1[0] * tm1[0]) % MOD, ans1, tm2 = 1, tm3 = 1, tm4 = 1, inv;
    loop(i,1,n+1)
    {
        tm2 = (tm2 * (m - i + 1)) % MOD;
        ans1 = tm2;

        ans1 = (ans1 * tm1[i]) % MOD;
        ans1 = (ans1 * tm1[i]) % MOD;

        tm3 = (tm3 * (n - i + 1)) % MOD;
        ans1 = (ans1 * tm3) % MOD;

        tm4 = (tm4 * i) % MOD;
        if(tm4 != 1)
        {
            LL x, y;
            inv_mod(tm4,MOD,x,y);
            inv = (x + MOD) % MOD;
        }
        else inv = 1;
        ans1 = (ans1 * inv) % MOD;

        if(i & 1) ans = (ans + MOD - ans1) % MOD;
        else ans = (ans + ans1) % MOD;
    }

    cout<<ans<<'\n';

    /*
    int t,n;
    cin>>t;
    while(t--)
    {
        cin>>n;
        int a[n];
        loop(i,0,n) cin>>a[i];
    }
    */

    /*
    int n;
    cin>>n;
    int a[n];
    loop(i,0,n) cin>>a[i];
    */

    /*
    cout<<ans<<'\n';

    if(f) cout<<"YES\n";
    else cout<<"NO\n";

    if(f) cout<<"Yes\n";
    else cout<<"No\n";
    */

    return 0;
}


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

namespace Atcoder
{
    public class Program
    {
        static void Main(string[] args)
        {
            var r = Console.ReadLine().Split(' ');
            var H = r[0].ToDecimal();
            var W = r[1].ToDecimal();
            if (W == 0)
            {
                Console.WriteLine(0);
                return;
            }
            if (H == 1 || W == 1)
            {
                Console.WriteLine(1);
                return;
            }
            var a = Math.Floor((H * W)/2);
            var ans = a + ((H * W) % 2 == 0 ? 0 : 1);
            Console.WriteLine(ans);
            Console.ReadLine();
        }
    }
}

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

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



Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
char itoc (int i) {
    string S = "0123456789";
    return S[i];
}

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<char>> S(H+2);
    for (int i = 0; i <= W+1; i++){
        S[0].push_back('.');
    }
    vector<vector<int>> memo;
    char s;
    for (int i = 1; i <= H; i++)
    {
        S[i].push_back('.');
        for (int j = 1; j <= W; j++)
        {
            cin >> s;
            S[i].push_back(s);
            if (s == '.'){
            memo.push_back({i,j});
            }
        }
        S[i].push_back('.');
    }
    for (int i = 0; i <= W+1; i++){
        S[H+1].push_back('.');
    }
    
    for (int i = 0; i < memo.size(); i++){
        int tmp = 0;
        for (int j = -1; j <= 1; j++){
            for (int k = -1; k <= 1; k++){
                if (S[memo[i][0] + j][memo[i][1] + k] == '#' ){
                    tmp++;
                }
            }
        }
        S[memo[i][0]][memo[i][1]] = itoc(tmp);

    }
    for (int i = 1; i <= H; i++){
        for (int j = 1; j <= W; j++){
            cout << S[i][j];
        }
        cout << endl;
    }
}



Measured memory_bytes: 384
def solve(string):
    a, b, m = 0, 1, 10**9 + 7
    for l in string:
        a, b = ((3 * a + b) % m, 2 * b % m) if l == "1" else (3 * a % m, b)
    return str((a + b) % m)


if __name__ == '__main__':
    print(solve(input()))


Measured memory_bytes: 3188
package main

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

func main() {
	sc := NewScanner(os.Stdin)
	a, _ := sc.NextInt()
	b, _ := sc.NextInt()
	c, _ := sc.NextInt()
	d, _ := sc.NextInt()
	ans := solve(a, b, c, d)
	fmt.Println(ans)
}

const mod = 998244353

func solve(a, b, c, d int) (ans int) {
	dp := make([][]int, c+1)
	for i := range dp {
		dp[i] = make([]int, d+1)
	}
	dp[a][b] = 1
	for i := a; i <= c; i++ {
		for j := b; j <= d; j++ {
			if i == a && j == b {
				continue
			}
			tmp := j * dp[i-1][j] % mod
			tmp = (tmp + i*dp[i][j-1]%mod) % mod
			tmp = (tmp - (i-1)*(j-1)*dp[i-1][j-1]%mod + mod) % mod
			dp[i][j] = tmp
		}
	}
	return dp[c][d]
}

// Scanner is a wrapper of bufio.Scanner which is customized for competitive programing.
type Scanner struct {
	bufio.Scanner
}

// NewScanner is a constructor for Scanner.
func NewScanner(r io.Reader) *Scanner {
	sc := Scanner{*bufio.NewScanner(r)}
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Split(bufio.ScanWords)
	return &sc
}

// NextInt reads a integer from io stream.
func (sc *Scanner) NextInt() (int, error) {
	if !sc.Scan() {
		return -1, errors.New("failed to scan")
	}
	return strconv.Atoi(sc.Text())
}


Measured memory_bytes: 76856
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <iomanip>
using ll = long long;
using uint = unsigned int;
using graph = std::vector<std::vector<ll>>;
using wGraph = std::vector<std::vector<std::pair<ll,ll>>>;
#define rep(i,n) for (int i=0; i < int(n); i++)

using namespace std;
ll MOD7 = 1000000007;
ll MOD9 = 1000000009;
vector<ll> InputVec(ll N){
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    return A;
}
void OutputVec(vector<ll> A){
    for (int i = 0; i < A.size(); ++i) {
        cout << A[i] << ",";
    }
    cout << endl;
}
vector<vector<ll>> InputVec2d(ll H,ll W){
    vector<vector<ll>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<ll>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        for (int xi = 0; xi < W; ++xi) {
            cin >> A[yi][xi];
        }
    }
    return A;
}
vector<vector<char>> InputVec2dStr(ll H,ll W){
    vector<vector<char>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<char>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        string S;
        cin >> S;
        for (int xi = 0; xi < W; ++xi) {
            A[yi][xi] = S[xi];
        }
    }
    return A;
}
void OutputVec2d(vector<vector<ll>> A){
    for (int yi = 0; yi < A.size(); ++yi) {
        for (int xi = 0; xi < A[yi].size(); ++xi) {
            cout << A[yi][xi] << ",";
        }
        cout << endl;
    }
}
graph InputGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    return G;
}
graph InputDGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
    }
    return G;
}
void OutputGraph(graph G){
    for (int i = 0; i < G.size(); ++i) {
        cout << i << ":";
        for (int j = 0; j < G[i].size(); ++j) {
            cout << G[i][j]<< ",";
        }
        cout << endl;
    }
}
void OutputAnswerBool(bool b,bool isUpperCase = false){
    if(b){
        if(isUpperCase){
            cout << "YES" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }else{
        if(isUpperCase){
            cout << "NO" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

int main() {
    ll N,K;
    cin >> N >> K;
    ll res = K;
    for (int i = 1; i < N; ++i) {
        res *= K-1;
    }
    cout << res << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
const int MOD = 1e9 + 7;
int main()
{
  int s,w;
  cin>>s>>w;
  if(w>=s)
    cout<<"unsafe"<<endl;
  else
    cout<<"safe"<<endl;
}

Measured memory_bytes: 3596
import sys


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n, m = list(map(int, input().rstrip('\n').split()))
    pw = pow(2, n)
    dp = [10 ** 15] * pw
    dp[0] = 0
    for _ in range(m):
        a, b = list(map(int, input().rstrip('\n').split()))
        c = sum(2 ** (i - 1) for i in list(map(int, input().rstrip('\n').split())))
        for i in range(pw):
            dp[c | i] = min(dp[c | i], dp[i] + a)
    print(dp[-1] if dp[-1] != 10 ** 15 else -1)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 42460
import java.util.Scanner; 
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String a = stdIn.next();
		String b = stdIn.next();
		String c = stdIn.next();
		String x = "";
		x+= a.charAt(0);
		x+= b.charAt(0);
		x+= c.charAt(0);
		String X = x.toUpperCase();
		System.out.println(X);
	}
}


Measured memory_bytes: 20820
#include<bits/stdc++.h>
using namespace std;
int n,a[200005];
bool check(int k)
{
	for (int i=1;i<n;i++)
	{
		if (a[n+i]>k && a[n+i-1]>k || a[n-i]>k && a[n-i+1]>k) return 0;
		if (a[n+i]<=k && a[n+i-1]<=k || a[n-i]<=k && a[n-i+1]<=k) return 1;
	}
	return a[1]<=k;
}
int main()
{
	//freopen("pyramid.in","r",stdin);
	//freopen("pyramid.out","w",stdout);
	scanf("%d",&n);
	for (int i=1;i<=2*n-1;i++) scanf("%d",&a[i]);
	int l=0,r=2*n-1;
	while (l<r)
	{
		int mid=(l+r)/2;
		if (check(mid)) r=mid;
		else l=mid+1;
	}
	printf("%d",l);
	return 0;
}

Measured memory_bytes: 1024
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.text.ParseException;
import java.util.*;


public class Main {

    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer st;
    static StringBuilder sb = new StringBuilder("");

    static int[] inputArray(int n) throws IOException {
        int[] a = new int[n];
        st = new StringTokenizer(br.readLine());
        for(int i = 0 ; i < n ; i++) {
            a[i] = Integer.parseInt(st.nextToken());
        }
        return a;
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;
        StringBuilder sb = new StringBuilder("");
        st = new StringTokenizer(br.readLine());
        long a = Long.parseLong(st.nextToken());
        long b = Long.parseLong(st.nextToken());
        long c = Long.parseLong(st.nextToken());
        long d = Long.parseLong(st.nextToken());
        System.out.println(Math.max(Math.max(a*d , a*c) , Math.max(b*c , b*d)));
    }

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

    static void longestGcdSeq(int a[] , int n) {
        int coprimes[] = new int[n];
        for(int i = 0 ; i < n ; i++) {
            if(a[i] < a[(i+1)%n]) {
                if(gcd(a[(i+1)%n] , a[i]) != 1) {
                    coprimes[i] = 1;
                }
            }
            else {
                if(gcd(a[i] , a[(i+1)%n]) != 1) {
                    coprimes[i] = 1;
                }
            }
        }
        //System.out.println(Arrays.toString(coprimes));
        int maxLen = 0 , startLen = 0 , endLen = 0;
        int i = 0;
        while(i < n && coprimes[i] == 1) {
            startLen++;
            i++;
        }
        i = n -1;
        while(i >= 0 && coprimes[i] == 1) {
            endLen++;
            i--;
        }
        int start = 0;
        for(i = 0 ; i < n ; i++) {
            if(coprimes[i] == 0) {
                maxLen = Math.max(maxLen , i - start);
                start = i + 1;
            }
        }
        maxLen = Math.max(maxLen , i - start);
        start = i + 1;
        //System.out.println(startLen + " " + maxLen + " " + endLen);
        int contMax = startLen == n ? n : Math.max(startLen + endLen , maxLen) + 1;
        //System.out.println(contMax);
        for(int k = 2 ; k <= n ; k++) {
            System.out.print((contMax-1)/(k-1) + " ");
        }
        System.out.println();
    }

}
/*

if(tree.size == 2) {

}

5 8
5 1 2 4 3
0 1
0 2
0 3
0 4
0 5
1 1000000000
1 1
1 500000000


 */

Measured memory_bytes: 32892
#include <iostream>
#include <iomanip>
#include <bits/stdc++.h>
#define ff first
#define ss second
#define M 1000000007
typedef long long int ll;
using namespace std;
ll power(ll a,ll b){
    ll ans = 1;
    while(b>0){
        if(b%2!=0){
            ans = ((ans)*(a));
        }
        a = ((a)*(a));
        b=b/2;
    }
    return ans;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,k;
    cin>>n>>k;
    vector <ll> a(n);
    for(ll i=0;i<n;i++){
        cin>>a[i];
    }
    vector <ll> dp(k+1,0);
    dp[0]=0;
    for(ll i=1;i<=k;i++){
        for(ll j=0;j<n;j++){
            if(i>=a[j] && dp[i-a[j]]==0){
                dp[i]=1;
                break;
            }
        }
    }
    if(dp[k]){
        cout<<"First";
    }
    else
        cout<<"Second"<<endl;
    return 0;
}


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


int main() {
	int N;
  cin >> N;
  vector<int > p(N);
  for(int i=0;i<N;i++) cin >>p[i];
  int x =0;
  for(int i=0;i<N;i++){
     if(p[i] != i+1) x++ ;
  }
 
  if(x ==0  ||x ==2) puts("YES");
  else puts("NO");
 }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
typedef long long int ll;
using namespace std;

int main(){
	while(1){
	  int a; cin >> a;
	  string s; cin >>s;
	  int b ; cin >>b;
	  if(s == "?")break;
	  else if(s == "+")cout << a+b << endl;
	  else if(s == "-")cout << a-b << endl;
	  else if(s == "*")cout << a*b << endl;
	  else if(s == "/")cout << a/b << endl;

	}
}


Measured memory_bytes: 3132
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> V;
#define rep(i,e) for(ll i=0;i<e;i++ )
typedef pair<ll,ll> P;
const ll mod = 1e9+7;
const ll INF = INT64_MAX;
ll i;



int main(){
    ll N;
    cin>>N;
    V A(N+1),B(N);
    rep(i,N+1)cin>>A.at(i);
    rep(i,N)cin>>B.at(i);
    ll ans=0;
    for(ll j=N-1;j>=0;j--){
        if(B.at(j)>=A.at(j+1)){
            ans+=A.at(j+1);
            B.at(j)-=A.at(j+1);
            ans+=min(B.at(j),A.at(j));
            A.at(j)-=min(B.at(j),A.at(j));
        }
        else{
            ans+=B.at(j);
            B.at(j)=0;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1792
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define mod 1000000007 //1e9+7
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 1001

bool calc(){
  int e;
  int ans = INF;
  
  scanf("%d",&e);

  if(e==0) return false;

  for(int i=0;i*i*i<=e;i++){
    for(int j=0;j*j+i*i*i<=e;j++){
      ans = min(ans,j+i+(e-j*j-i*i*i));
    }
  }
      
  printf("%d\n",ans);
  
  return true;
}

int main(){
    
  while(calc());
  
  return 0;
}

Measured memory_bytes: 3208
lit=[0 for ased in range(26)]
while True:
	try:
		s=input()
		for a in s:
			g=(ord(a))
			if g>=65 and g<=65+26:
				lit[g-65]+=1
			elif g>=97 and g<=97+26:
				lit[g-97]+=1
	except EOFError:
		break
		
for AA in range(26):
	print(chr(97+AA)+' : '+str(lit[AA]))


Measured memory_bytes: 5568
#include <iostream>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int a, b, c;
	a = n % 10;
	b = (n / 10) % 10;
	c = (n / 100) % 10;
	int x, y, z;
	if (a == 1)
		z = 9;
	else
		z = 1;
	if (b == 1)
		y = 9;
	else
		y = 1;
	if (c == 1)
		x = 9;
	else
		x = 1;
	int result = 100 * x + 10 * y + z;
	cout << result << endl;
	return 0;
}

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

int main() {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;

    int d1 = x2 - x1;
    int d2 = y2 - y1;

    cout << x2 - d2 <<  " " << y2 + d1 << " " <<  x1 -d2 << " " << y1 + d1 << endl;
}


Measured memory_bytes: 256
<?php
  
$input = (int)fgets(STDIN);
$count = 0;

for($i=1; $i<=$input; $i++){
  if($i < 10){
    $count += 1;
  }elseif($i >= 100 and $i < 1000){
    $count += 1;
  }elseif($i >= 10000 and $i < 100000){
    $count += 1;
  }
}

echo $count;

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

int main()
{
    int H, W;
    cin >> H >> W;
    int c[10][10];
    for (int i = 0; i <= 9; i++)
    {
        for (int j = 0; j <= 9; j++)
        {
            cin >> c[i][j];
        }
    }
    int A[205][205];
    for (int h = 1; h <= H; h++)
    {
        for (int w = 1; w <= W; w++)
        {
            cin >> A[h][w];
        }
    }

    for (int k = 0; k <= 9; k++)
    {
        for (int i = 0; i <= 9; i++)
        {
            for (int j = 0; j <= 9; j++)
            {
                if (c[i][j] > c[i][k] + c[k][j])
                {
                    c[i][j] = c[i][k] + c[k][j];
                }
            }
        }
    }

    int ans = 0;
    for (int h = 1; h <= H; h++)
    {
        for (int w = 1; w <= W; w++)
        {
            if (A[h][w] == -1) continue;
            ans += c[A[h][w]][1];
        }
    }

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

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <algorithm>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define stdi(in) freopen(in, "r", stdin)
#define stdo(out) freopen(out, "w", stdout)
#define stdio(in, out) stdi(in); stdo(out)
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define MAX 1000007
#define MOD 1000000007
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
//typedef int ittt;
//#define int ll


using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
#define ordered_set tree<int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

const ll inf = 1e18;

ll hit[MAX];
ll dp[MAX];
int n,k;

ll solve(int i){
	if(i<=1){
		return 0;
	}

	if(dp[i]!=-1) return dp[i];

	ll ans = solve(i-1)+abs(hit[i]-hit[i-1]);

	for(int j = 2; j<=k; j++){
		if(i-j>0){
			ans = min(ans, solve(i-j)+abs(hit[i]-hit[i-j]));
		}
	}

	return dp[i] = ans;

}

int main(){
    /*#ifndef ONLINE_JUDGE
        stdio("in", "out");
    #endif*/
    fast;
    cin>>n>>k;

    for(int i=1;i<=n;i++){
    	cin>>hit[i];
    	dp[i] = -1;
    }

    ll ans = solve(n);
    cout<<ans<<'\n';
    
    return 0;
}

Measured memory_bytes: 9856
(* 2^n * nm *)
let n, m = Scanf.scanf " %d %d" @@ fun a b -> a, b
let sss = Array.init m @@ fun _ -> Scanf.scanf " %d" @@ fun k -> Array.init k @@ fun _ -> Scanf.scanf " %d" @@ fun s -> s - 1
let ps = Array.init m @@ fun _ -> Scanf.scanf " %d" @@ (+) 0
let f ss bits p =
  Array.fold_left (fun acc s -> if bits lsr s land 1 = 1 then acc + 1 else acc) 0 ss mod 2 = p
let rec check i bits =
  if i >= m then true
  else if not @@ f sss.(i) bits ps.(i) then false
  else check (i + 1) bits
let ans = ref 0
let _ =
  for i = 0 to 1 lsl n - 1 do if check 0 i then incr ans done;
  Printf.printf "%d\n" !ans

Measured memory_bytes: 640
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,sse,sse2,ssse3,tune=native")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ll long long
#define ld long double
#define all(a) a.begin(),a.end()
#define endl '\n'
#define ull unsigned long long
#define y1 asjdlfaskavslbcjasndscf
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define iter set< int >::iterator
#define iter1 multiset<int>::iterator
#define int long long
using namespace std;
using namespace __gnu_pbds;

template<class T>
using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

template<class T>
using ordered_multiset=tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rnd1(chrono::steady_clock::now().time_since_epoch().count());

//find_by_order
//order_of_key

const int N=2e5+7;
const int inf=1e18+1e9;
const int mod=1e9+7;
const ld eps=1e-9;

//const int MAX_MEM=4e8;
//int mpos=0;
//char mem[MAX_MEM];
//
//inline void * operator new(size_t n){
//    char *res=mem+mpos;
//    mpos+=n;
//    if (mpos>=MAX_MEM){
//        cout<<"BAD"<<endl;
//        exit(0);
//    }
//    return (void*)res;
//}
//
//inline void operator delete(void *) {}

int nsk(int a,int b)
{
    int res=a*b/__gcd(a,b);
    return res;
}

main ()
{
    ios;
    int c;
    cin>>c;
    int f=360/__gcd(c,(int)360);
    cout<<f<<endl;

}

//18 10
//8 1 2 3 4 9 9 5 1 6 6 7 8 6 2 9 10 7
//1 2 3 4 5 6 7 8 9 10


Measured memory_bytes: 3656
import numpy as np
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.readline
readlines = sys.stdin.buffer.readlines

n = int(readline())
a = []
[a.append(int(readline())) for _ in range(n)]

check = [0] * n
check[0] = 1
next = 0
times = 0
while True:

    next = a[next] - 1
    times += 1

    if next == 1 :
        print(times)
        break
    
    if check[next] != 0:
        print(-1)
        break

    check[next] += 1



Measured memory_bytes: 26552
import math

a, b = map(int, input().split())

def calc_xor(n):
    l = n

    if n == 0:
        d = 1
    else:
        d = int(math.log(n, 2)) + 1

    results = [0] * d
    results[0] = int(n % 4 in [1, 2])
    for i in range(2, d + 1):
        target = 2 ** i
        mod = l % target
        bit = int(mod >= target // 2 and not mod % 2)
        # print(mod, i, target)
        results[i - 1] = int(mod >= target // 2 and not mod % 2)

    results.reverse()
    return results


def to_int(n):
    result = 0
    for bit in n:
        result <<= 1
        result |= bit
    return result

ra = calc_xor(a)
rb = calc_xor(b)

# print(ra, list(map(int, bin(a)[2:])), rb)
print(to_int(ra) ^ a ^ to_int(rb))

# for x in range(a, b + 1):
#     print(("{:0" +str(d)+ "d}").format(int(bin(x)[2:])))

# r = 0
# for x in range(a, b + 1):
#     r ^= x
# print(bin(r)[2:])


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

const char wall = '#';
vector<vector<char>> fields;
vector<vector<bool>> used;
vector<vector<ll>> dist;
const int dx[4] = {0, -1, 0, 1};
const int dy[4] = {1, 0, -1, 0};

vector<ll> A;
// vectorのリサイズ
// A.resize(N);

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() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll n;
  cin >> n;
  vector<ll> a(n), b(n);
  rep(i, n) cin >> a[i] >> b[i];
  reverse(a.begin(), a.end());
  reverse(b.begin(), b.end());
  ll ans = 0;
  rep(i, n) {
    if (a[i] % b[i] != 0) ans += b[i] - (a[i] % b[i]);
    if (i < n-1) {
      a[i+1] += ans;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
N = int(input())
X = list(map(int, input().split()))
Y = sorted(X)
l, r = Y[N//2-1], Y[N//2]
A = []
for i in range(N):
    if X[i] <= l:
        A.append(r)
    else:
        A.append(l)
print('\n'.join(map(str, A)))

Measured memory_bytes: 30740
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,int> piii; 
#define fi first
#define se second 
void read(int &x){
	char ch=getchar();x=0;
	for (;ch==' '||ch=='\n';ch=getchar());
	for (;ch!=' '&&ch!='\n';x=x*10+ch-'0',ch=getchar());
}
void write(ll x){
	if (x>9) write(x/10);
	putchar(x%10+'0');
}
int n;
piii v[1003];
bool cmp(piii a,piii b){
	return a.fi.fi+a.fi.se>b.fi.fi+b.fi.se;
}
ll dp[10003],ans;
int main(){
	read(n);
	for (int i=1;i<=n;i++) read(v[i].fi.fi),read(v[i].fi.se),read(v[i].se);
	sort (v+1,v+1+n,cmp);
	for (int i=1;i<=n;i++){
		for (int j=0;j<=10000;j++)
			if (j>=v[i].fi.fi) dp[min(j-v[i].fi.fi,v[i].fi.se)]=max(dp[min(j-v[i].fi.fi,v[i].fi.se)],dp[j]+v[i].se);
		dp[v[i].fi.se]=max(dp[v[i].fi.se],1ll*v[i].se);
	}
	for (int i=0;i<=10000;i++) ans=max(ans,dp[i]);
	write(ans);
}

Measured memory_bytes: 384
#include<stdio.h>
#include<string.h>
#include<math.h>
#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
    int N;
    while(~scanf("%d",&N))
    {
        printf("%s\n",N%10==9||N/10==9?"Yes":"No");
    }
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    ll N, W;
    cin >> N >> W;


    map<ll, vector<ll>> I;
    REP(i, N) {
        ll w, v;
        cin >> w >> v;
        I[w].pb(v);
    }

    unordered_map<ll, ll> m;
    m[0] = 0;
    for (auto it=I.begin(); it!=I.end(); it++) {
        sort(it->se.begin(), it->se.end(), greater<ll>());

        ll w = it->fi;

        REP(i, it->se.size()) {
            unordered_map<ll, ll> tmp;
            ll v = it->se[i];
            for(auto j=m.begin(); j!=m.end(); ++j) {
                ll nw = j->fi + w;
                if (m.find(nw) != m.end()) tmp[nw] = max(j->se + v, m[nw]);
                else tmp[nw] = j->se + v;
            }

            for(auto j=tmp.begin(); j!= tmp.end(); ++j) {
                m[j->fi] = max(m[j->fi], j->se);
            }
        }
    }

    ll ans = 0;
    for(auto it=m.begin(); it!=m.end(); ++it) {
        if(it->fi > W) continue;
        ans = max(ans, it->se);
    }

    cout << ans << endl;
    
}


Measured memory_bytes: 896
#include <iostream>

using namespace std;

typedef long long ll;

int main() {
    int K, A, B;
    cin >> K >> A >> B;

    ll ans = 1;
    int i = K;
    while (i > 0) {
        if (B - A > 2 && ans >= A && i > 1) {
            i -= 2;
            ans += B - A;
        } else {
            i -= 1;
            ans += 1;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7;
constexpr long long INF = numeric_limits<LL>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<double, double> Dll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourth; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Rrep(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, k, t, s, p, q, last, first, cnt, sum, ans, dp[3200][3200],b[200000];
string str, ss;
Pll a[210000];
bool f;
char c;
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
struct Edge { LL to, cost; };
struct edge { LL from, to, cost; };
vector<LL>vec;
vector<edge>ed;
vector<LL>v;
map<LL,LL>ma;
set<LL>st;
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}


int main() {
	cin >> h >> w;
	cin >> n;
	ans = h;
	rep(i, n) {
		LL x, y;
		cin >> x >> y;
		a[i] = Pll(x,y);
	}
	sort(a, a + n);
	rep(i, n) {
		LL x = a[i].fir, y = a[i].sec;
		if (x == y + cnt) {
			cnt++;
		}
		else if (x > y + cnt) {
			ans = min(ans, x - 1);
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4352
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
template<typename T=ll>inline T in(istream&is=cin){T ret;is>>ret;return ret;}
template<typename T>inline auto vec2(typename vector<T>::size_type h,typename vector<T>::size_type w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}

class Bellman_Ford{
private:
    using size_type=std::vector<long long>::size_type;
    static inline constexpr auto inf=std::numeric_limits<long long>::max();
    static inline constexpr auto minf=std::numeric_limits<long long>::min();
    struct edge_info{
        size_type from;
        size_type to;
        long long cost;
        edge_info(size_type from,size_type to,long long cost):from(from),to(to),cost(cost)
        {
        }
    };
    std::vector<edge_info>edge;
    std::vector<long long>dist;
public:
    Bellman_Ford(size_type node_cnt):dist(node_cnt)
    {
    }
    void add_edge(size_type from,size_type to,long long cost)
    {
        edge.emplace_back(from,to,cost);
    }
    const std::vector<long long>&operator()(size_type start=0)
    {
        std::fill(dist.begin(),dist.end(),inf);
        dist[start]=0;
        bool is_updated=false;
        for(size_type i=0;i<dist.size();++i){
            for(auto[from,to,cost]:edge){
                if(dist[from]!=inf&&dist[to]>dist[from]+cost){
                    dist[to]=dist[from]+cost;
                    is_updated=true;
                }
            }
            if(!is_updated)break;
        }
        if(is_updated){
            for(auto[from,to,cost]:edge){
                if(dist[from]==minf||(dist[from]!=inf&&dist[to]>dist[from]+cost)){
                    dist[to]=minf;
                }
            }
        }
        return dist;
    }
    long long get_dist(size_type node)
    {
        return dist[node];
    }
    bool is_unreacheable(size_type node)
    {
        return dist[node]==inf;
    }
    bool is_in_negative_loop(size_type node)
    {
        return dist[node]==minf;
    }
};
int main()
{
    ll n=in(),m=in();
    Bellman_Ford bf(n);
    for(ll i=0;i<m;++i){
        ll a=in(),b=in(),c=in();
        bf.add_edge(a-1,b-1,-c);
    }
    bf();
    cout<<(bf.is_in_negative_loop(n-1)?"inf":to_string(-bf.get_dist(n-1)))<<endl;
}


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

int main(){
	int a, b, k;
	set<int> q;
	cin >> a >> b >> k;
	rep(i, k){
		if(a+i <= b)q.insert(a + i);
	}
	for(int i = k-1; i >= 0; i--){
		if(b-i >= a)q.insert(b - i);
	}
	for(auto i = q.begin(); i != q.end(); i++) cout << *i << endl;
    return 0;
}

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

#define int long long

#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint,int> P1;
typedef pair<int,pint> P2;
static const ll maxLL = (ll)1 << 62;
const ll MOD=1000000007;
const ll INF=1e18;
int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};

int a,b,c;

signed main(){
    cin.tie(0);
	ios::sync_with_stdio(false);
    cin>>a>>b>>c;
    if(a==b)cout<<c<<endl;
    else if(b==c)cout<<a<<endl;
    else cout<<b<<endl;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second

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;
}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e15;
const int INF=1e9;

struct LCA{
private:
	vector<vector<int>> v;
	vector<vector<int>> parent;
	vector<int> depth;
	int h = 0;
	void dfs(int n,int m,int d){
		parent[0][n] = m;
		depth[n] = d;
		for(auto x:v[n]){
			if(x!=m) dfs(x,n,d+1);
		}
	}
public:
	LCA(int N,int root,vector<vector<int>>& tree){
		while((1<<h)<=N) h++;
		v = tree;
		parent = vector<vector<int>>(h,vector<int>(N,0));
		depth = vector<int>(N,0);
		dfs(root,-1,0);
		for(int j=0;j+1<h;j++){
			for(int i=0;i<N;i++){
				if(parent[j][i]<0) parent[j+1][i] = -1;
				else parent[j+1][i] = parent[j][parent[j][i]];
			}
		}
	}
	int lca(int n,int m){
		if(depth[n]>depth[m]) swap(n,m);
		for(int j=0;j<h;j++){
			if((depth[m]-depth[n]) >> j&1) m = parent[j][m];
		}
		if(n==m) return n;
		for(int j=h-1;j>=0;j--){
			if(parent[j][n]!=parent[j][m]){
				n = parent[j][n];
				m = parent[j][m];
			}
		}
		return parent[0][n];
	}
	int dep(int n){return depth[n];}
};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	int root=0;
	vector<vector<int>> g(n);
	rep(i,n){
		int k;
		cin>>k;
		rep(j,k){
			int c;
			cin>>c;
			g[i].push_back(c);
		}
	}
	LCA lca(n,root,g);
	int q;
	cin>>q;
	while(q--){
		int a,b;
		cin>>a>>b;
		cout<<lca.lca(a,b)<<endl;
	}
}


Measured memory_bytes: 23532
/*
 * ARC091_C.cpp
 *
 *  Created on: May 22, 2018
 *      Author: 13743
 */
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<cstring>
using namespace std;
typedef long long lng;
typedef unsigned long long ulng;

#define pb push_back
#define SZ(a) int((a).size())
#define ALL(a) (a).begin(), (a).end
#define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
#define FORD(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) FOR(i,0,n-1)
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())

lng power(lng b, lng e) {lng sol=1; while(e>0) {if(e&1) {sol=sol*b;} e>>=1; b*= b;} return sol;}



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

	lng N, M;
	cin >> N >> M;

	if(N==1 && M == 1) cout << 1 << endl;
	else if(N==1) cout << M-2 << endl;
	else if(M==1) cout << N-2 << endl;
	else {
		cout << N*M - (N-1)*2 - (M-1) * 2 << endl;
	}
}






Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int n,tmp;
  
  scanf("%d",&n);
  
  while(n>0){
    tmp=n%10;
    if(tmp==7){
      printf("Yes");
      return 0;
    }
    n=(n-tmp)/10;
  }
  printf("No");
  return 0;
}
    

Measured memory_bytes: 1732
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;
const long double eps = 1E-14;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

mint pw(mint a, ll b) {
	if (b == 0) { return 1; }
	mint ret = pw(a, b >> 1);
	ret *= ret;
	if (b & 1) { ret *= a; }
	return ret;
}

typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;

typedef vector<mint> vmint;
typedef vector<vector<mint>> vvmint;
typedef vector<vector<vector<mint>>> vvvmint;

//////////////////////////////////////

int main() {
	ll N;
	cin >> N;
	vll A(N), B(N);
	rep(i, N)cin >> A[i];
	rep(i, N)cin >> B[i];

	priority_queue<pair<ll, ll>> pq;
	rep(i, N)pq.push({ B[i],i });

	ll ans = 0;

	while (!pq.empty()) {
		auto p = pq.top();
		pq.pop();

		ll x = p.second;
		ll y = (x - 1 + N) % N;
		ll z = (x + 1) % N;

		if ((B[x] - A[x]) % (B[y] + B[z]) == 0) {
			ans += (B[x] - A[x]) / (B[y] + B[z]);
			B[x] = A[x];
		}
		else {
			if (B[x] <= B[y] + B[z] && B[x] != A[x]) { cout << -1 << endl; return 0; }
			ans += B[x] / (B[y] + B[z]);
			B[x] %= B[y] + B[z];
			if (B[x] < A[x]) { cout << -1 << endl; return 0; }

			pq.push({ B[x],x });
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 10592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//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; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

int main(){
    string s; cin >> s;
    int N = s.size();

    if((s[0] == s[N-1] && N%2 == 0) || (s[0] != s[N-1] && N%2 == 1)) cout << "First" << endl;
    else cout << "Second" << endl;
}

Measured memory_bytes: 512
#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <map>
#include <functional>
#include <set>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
#define MIN(a, b) (((a) < (b)) ? (a) : (b))

using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pint;
const ll inf = (1LL << 60);
const ll mod = 1000000007;
ll max(ll a, ll b) {
	if (a < b)
		return b;
	else
		return a;

}
ll min(ll a, ll b) {
	if (a < b)
		return a;
	else
		return b;

}



int main() {
	string S;

	cin >> S;

	if (S == "Sunny") {
		cout << "Cloudy";
	}
	else if (S == "Cloudy") {
		cout << "Rainy";
	}
	else
		cout << "Sunny";
	
	return 0;
}

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

int main(){

    int N;
    cin >> N;
    vector<bool> zorome(N);
    rep (i, N){
        int D1, D2;
        cin >> D1 >> D2;
        if (D1 == D2) zorome[i] = true;
    }

    bool ans = false;
    int count = 0;
    rep (i, N){
        if (zorome[i]) count++;
        else count = 0;
        if (count == 3) ans = true;
    }

    if (ans) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<cctype>
#include<stack>
#define ld long double
#define ll long long int
#define ull unsigned long long int
using namespace std;
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 long long INF=1LL<<60;
//set<int>::iterator it;



int main(void){
	ios::sync_with_stdio(false); cin.tie(0);
	
	int i,n,c,k,ans=0,j;
	cin>>n>>c>>k;
	int t[n];
	for(i=0;i<n;i++)cin>>t[i];
	sort(t,t+n);
	for(i=0;i<n;i++){
		for(j=i;j<i+c&&j<n&&t[j]-t[i]<=k;j++);
//		cout<<i<<" "<<j<<" "<<ans<<endl;
		ans++;
		i+=j-1-i;
	}
	cout<<ans<<endl;
	
	
	
	
	return 0;
}

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

using namespace std;

int main(void) {
  int t;
  cin >> t;

  for (int i = 0; i < t; i++) {
    int n;
    cin >> n;

    vector<int> a(n);
    for (int j = 0; j < n; j++) {
      cin >> a[j];
    }

    int ans_up = 0, ans_down = 0;
    for (int j = 0; j < n; j++) {
      if (j > 0) {
        ans_up = max(ans_up, a[j] - a[j - 1]);
        ans_down = min(ans_down, a[j] - a[j - 1]);
      }
    }

    cout << ans_up << " " << -ans_down << endl;
  }

  return 0;
}


Measured memory_bytes: 3068
<>=~$";$i=$\=1;$M=$';$m=1e9+7;
until(++$i**2>$M){
	$c=0;
	$M/=$i,$c++until$M%$i;
    next if!$c;
	$r=$d=1;
	$d=$d*$c--%$m,$r=$r*($`+$c)%$m while$c;
	$h=2e9+10;
	$r=$r*($h%2?$d:1)%$m,$d=$d*$d%$m while$h/=2;
	$\=$\*$r%$m;
}
$\=$\*$`%$m if$M>1;
print

Measured memory_bytes: 512
#include <iostream>
#include <vector>

using namespace std;

int main() {
	int N, M;
	int r, t, n, m, s, q, ts, te;
	while (cin >> N >> M && (N || M)) {
		vector<vector<int> > cnt(M, vector<int>(750, 0));
		vector<vector<int> > ans(M, vector<int>(750, 0));
		cin >> r;
		for (int i = 0; i < r; ++i) {
			cin >> t >> n >> m >> s;
			m--, t -= 539;
			if (s) cnt[m][t]++;
			else cnt[m][t]--;
		}
		for (int i = 0; i < M; ++i) {
			for (int j = 0; j < 750; ++j) {
				if (j) cnt[i][j] += cnt[i][j - 1];
				if (cnt[i][j]) ans[i][j]++;
				if (j) ans[i][j] += ans[i][j - 1];
			}
		}
		cin >> q;
		for (int i = 0; i < q; ++i) {
			cin >> ts >> te >> m;
			m--, ts -= 540, te -= 540;
			cout << ans[m][te] - ans[m][ts] << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 60116