akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main(){
        int n;
        cin >> n;
        for (int i = 0; i < n; i++){//i使うな
                int gx, gy;
                //bool f = 1;
                cin >> gx >> gy;
                vector<vector <long long>> v(gx + 1,vector <long long>(gy + 1));
                int p;
                cin >> p;
                vector<vector <int>> left(gx + 1, vector <int>(gy + 1));
                vector<vector <int>> under(gx + 1, vector <int>(gy + 1));
                for(int j = 0; j < p; j++){
                        int x1, x2, y1, y2;
                        cin >> x1 >> y1 >> x2 >> y2;
                        if(x1 == x2) under[x1][max(y1, y2)]++;
                        else if(y1 == y2) left[max(x1, x2)][y1]++;
                }
                //cout << left[1][0] << " " << under[0][1] << endl;
                for(int k = 0; k <= gy; k++){
                        for(int j = 0; j <= gx; j++){
                                if(j == 0 && k == 0) v[j][k] = 1;
                                else if(k == 0){
                                        if(left[j][k] > 0) v[j][k] = 0;
                                        else v[j][k] = v[j - 1][k];
                                }
                                else if(j == 0){
                                        if(under[j][k] > 0) v[j][k] = 0;
                                        else v[j][k] = v[j][k - 1];
                                }
                                else{
                                        if(left[j][k] > 0 && under[j][k] > 0) v[j][k] = 0;
                                        else if(left[j][k] > 0) v[j][k] = v[j][k - 1];
                                        else if(under[j][k] > 0) v[j][k] = v[j - 1][k];
                                        else v[j][k] = v[j][k - 1] + v[j - 1][k];
                                }
                        }
                }
                if(v[gx][gy] == 0) cout << "Miserable Hokusai!" << endl;
                else cout << v[gx][gy] << endl;
        }
        return 0;
}



Measured memory_bytes: 3084
#include <stdio.h>

#include <string.h> 

int  main() {
	int a,i; 
	char s[10];
	gets (s);
	a=strlen(s);
	if(a==2){
	printf("%s",s);
	}
	else {
	
	for(i=a-1;i>=0;i--){
		printf("%c",s[i]);
	} }
	return 0;
}

	
	
	
	
	

  

Measured memory_bytes: 128
package main

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

func main() {
	N := nextInt()
	P := make([]int, N)
	c := 0

	for i := 0; i < N; i++ {
		P[i] = nextInt()
	}

	for i := 1; i < N-1; i++ {
		if P[i-1] < P[i] && P[i] < P[i+1] {
			c++
		} else if P[i-1] > P[i] && P[i] > P[i+1] {
			c++
		}
	}

	fmt.Println(c)
}

var stdin = initStdin()

func initStdin() *bufio.Scanner {
	bufsize := 1 * 1024 * 1024 // 1 MB
	var stdin = bufio.NewScanner(os.Stdin)
	stdin.Buffer(make([]byte, bufsize), bufsize)
	stdin.Split(bufio.ScanWords)
	return stdin
}

func nextString() string {
	stdin.Scan()
	return stdin.Text()
}

func nextBytes() []byte {
	stdin.Scan()
	return stdin.Bytes()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextString())
	return i
}

func nextInt64() int64 {
	i, _ := strconv.ParseInt(nextString(), 10, 64)

	return i
}


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

using namespace std;

string MakeString(string S) {
  for (size_t i = 0; i < S.size(); ++i) {
    if (S[i] == '?') {
      S[i] = 'a';
    }
  }
  return S;
}

int main() {
  string S, T;
  cin >> S >> T;
  vector<string> results;
  for (size_t i = 0, end = S.size() - T.size() + 1; i < end; ++i) {
    if (S[i] == T[0] || S[i] == '?') {
      bool find = true;
      for (size_t j = 0; j < T.size(); ++j) {
        if (S[i+j] != '?' && S[i + j] != T[j]) {
          find = false;
          break;
        }
      }
      if (find) {
        results.push_back(
          MakeString(S.substr(0, i) + T + S.substr(i + T.size(), S.size() - i - T.size())));
      }
    }
  }
  if (results.size()) {
    sort(results.begin(), results.end());
    cout << results[0] << endl;
  } else {
    cout << "UNRESTORABLE" << endl;
  }
  
  return 0;
}


Measured memory_bytes: 3616
#include <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <map>
#define INF 100000000
#define rep(i,a) for(int i=0;i<(a);i++)

using namespace std;
typedef long long ll;

int hun[10]={512,256,128,64,32,16,8,4,2,1};

int main(){
    stack<int> ans;
    int n;
    while(cin>>n){
        rep(i,10){
            if(n>=hun[i]){
                n-=hun[i];
                ans.push(hun[i]);
            }
        }
        while(ans.size()){
            cout<<ans.top();
            ans.pop();
            if(ans.empty())cout<<endl;
            else cout<<" ";
        }
    }
    return 0;
}

Measured memory_bytes: 1200
#pragma GCC optimize ("-O3")
#include <bits/stdc++.h>
#include <complex>
#include <queue>
#include <set>
#include <unordered_set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <stack>
#include <iomanip>
#include <fstream>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<ll> v32;
typedef vector<vector<ll> > vv32;
typedef vector<vector<ll> > vv64;
typedef vector<vector<p64> > vvp64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
ll MOD = 998244353;
#define forn(i,e) for(ll i = 0; i < e; i++)
#define forsn(i,s,e) for(ll i = s; i < e; i++)
#define rforn(i,s) for(ll i = s; i >= 0; i--)
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// #define INF 1e18
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define vvv64 vector<vv32>
#define vvvv64 vector<vvv32>
ll exp(ll n, ll e)
{
    if (e==0)
        return 1;
    ll temp=exp((n*n)%MOD,e/2);
    return e%2==0 ? temp : (temp*n)%MOD;
}

ll inverse(ll n)
{
	return exp(n,MOD-2);
}

int LIM=2e5+100;
void solve()
{
//Read Comments below main
	int a,b,c;
	cin>>a>>b>>c;
	cout<<c<<" "<<a<<" "<<b<<endl;
}
 
int main() {
    fast_cin();
    ll t=1;
    // cin>>t;
    while (t--)
    {
        solve();
    }
    return 0;
}
// BITMASK:
// 1)When some constrall is of the order of 15-20, think of bitmask DP.
// 2)When some constrall is around 40, try out meet in the middle
// 3) See Strings,palindromes,prefix,suffix etc -> KMP,Z algo

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

using namespace std;

const int P=1e9+7;

int n,m,k,go[15],bcnt[1<<15],dp[1<<15],pw[233];
bool fb[1<<15];

int main(){
	scanf("%d%d",&n,&m);
	k=1<<n,pw[0]=1;
	for(int i=1,u,v;i<=m;i++)scanf("%d%d",&u,&v),u--,v--,go[u]|=1<<v,pw[i]=(pw[i-1]<<1)%P;
	for(int i=1;i<k;i++)bcnt[i]=bcnt[i>>1]+(i&1),fb[i]=(i&3)==2||(i&3)==1;
	for(int S=1;S<k;S++)if(!fb[S]){
		int&w=dp[S];w=1;
		for(int T=S;T;T=(T-1)&S)if(!fb[T]){
			int V=S-T;
			int a=1;
			for(int i=0;i<n;i++){
				if(V>>i&1)a=(long long)a*(pw[bcnt[go[i]&T]]-1)%P;
				if(T>>i&1)a=(long long)a*pw[bcnt[go[i]&V]]%P;
			}
			w=(w+(long long)a*dp[V])%P;
		}
	}
	printf("%lld\n",(pw[m]-dp[k-1]+P)%P);
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)

using namespace std;
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main()
{
  int A, P;
  cin >> A >> P;

  P += A*3;

  cout << P/2 << endl;


  return 0;
}


//cout << setprecision(13);
//next_permutation();
//__gcd();
//reverse();
//set ,tuple ,pair;
//bitset
//vector.find
//vector.count



Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		// 文字列の入力
		String[] s = sc.next().split("");
        ArrayList<String> list = new ArrayList<>();
        for(int i = 0; i < s.length; i++) {
          if (s[i].equals("B")) {
            if (list.size() > 0) {
             list.remove(list.size() - 1);
            }
          } else {
            list.add(s[i]);
          }
        }
        String ans = "";
        for(String word : list) {
          ans+= word;
        }
      
		// 出力
		System.out.println(ans);
	}
}

Measured memory_bytes: 21716
#include <iostream>
using namespace std;
int main(void){
    int table[200][200] = {{0}};
    int c, r;
    cin >> r >> c;
    
    for(int i = 0; i < r; i++){
        for(int j = 0; j < c; j++){
            cin >> table[i][j];
        }
    }
    
    //横計算
    for(int i = 0; i < r+1; i++){
        int sum = 0;
        for (int j = 0; j < c; j++){
            sum += table[i][j];
        }
        table[i][c] = sum;
    }
    
    //縦計算
    for(int j = 0; j < c+1; j++){
        int sum = 0;
        for (int i = 0; i < r; i++){
            sum += table[i][j];
        }
        table[r][j] = sum;
    }
    
    //出力
    for(int i = 0; i < r+1; i++){
        for (int j = 0; j < c; j++){
            cout << table[i][j] << ' ';
        }
        cout << table[i][c] << endl;
    }
   
}//ITP_7_C*


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

int d[514];
int n;
signed main() {
	cin >> n;
	rep(i, n - 1) {
		d[i] = log2((i + 1) & (-i - 1)) + 1;
	}
	rep(i, n - 1) {
		rep(j, n - i - 2) {
			printf("%lld ", d[j]);
		}
		printf("%lld\n", d[n - i - 2]);
	}
}


Measured memory_bytes: 512
n = gets.chomp.to_i
ss = gets.chomp.split(' ')
q = gets.chomp.to_i
ts = gets.chomp.split(' ')

c = 0
ts.each do |t|
  ss.each do |s|
    if s == t
      c += 1
      break
    end
  end
end
puts c


Measured memory_bytes: 7096
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){

	int n,m;
	int field[101][101];
	int peace[4][51][51];
	while(cin>>n>>m&&!(n==0&&m==0)){
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				cin>>field[i][j];
			}
		}
		for(int i = 0; i < m; i++)
			for(int j = 0; j < m; j++)
				cin>>peace[0][i][j];
		// 90x¸Âñ]³¹½àÌði[
		for(int i = 1; i < 4; i++){
			for(int j = 0; j < m; j++){
				for(int k = 0; k < m; k++){
					peace[i][j][k]=peace[i-1][m-1-k][j];
//					cout<<peace[i][j][k]<<" ";
				}
//				cout<<endl;
			}
//			cout<<endl;
		}
		pair<int,int> minPoint;
		minPoint.first=10000;
		minPoint.second=10000;
		for(int i = 0; i+m <= n; i++){
			for(int j = 0; j+m <= n; j++){
				for(int r = 0; r < 4; r++){
					bool f=true;
					pair<int,int> p;
					p.first=10000;
					p.second=10000;
					for(int k = 0; k < m; k++){
						for(int l = 0; l < m; l++){
							if(peace[r][k][l]==-1){

							}
							else if(peace[r][k][l]==field[i+k][j+l]){
								p=min(p,make_pair(i+k,j+l));
								//p.first=i+k;
								//p.second=j+l;
							}
							else{
								//p.first=i+k;
								//p.second=j+l;
								f=false;
								break;
							}
						}
						if(!f)
							break;
					}
					if(f){
						minPoint=min(minPoint,p);
					}
				}
			}
		}
		if(minPoint.first==10000)
			cout<<"NA"<<endl;
		else
			cout<<minPoint.second+1<<" "<<minPoint.first+1<<endl;
	}

	return 0;
}

Measured memory_bytes: 948
N = input()
cards = [int(raw_input()) for i in xrange(N)]
ans = cards[0] / 2
cards[0] %= 2

for i in xrange(1, N):
    if cards[i] != 0 and cards[i-1] != 0:
        cards[i] -= 1
        ans += 1
    ans += cards[i]/2
    cards[i] %= 2

print ans


Measured memory_bytes: 20892
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <bitset>
#include <climits>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define RFOR(i,a,b) for (int i=(a)-1;i>=(b);i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 1e9;
const int MOD = 1e9 + 7;

using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
	ll n;
	cin>>n;
	vector<ll> a(n);REP(i,n)cin>>a[i];
	ll ans = 1LL << 60;

	ll tmpsum = 0, tmpans = 0;
	REP(i,n){
		tmpsum += a[i];
		if(i& 1){
			if(tmpsum >= 0){
				tmpans += labs(tmpsum + 1);
				tmpsum = -1;
			}
		}	else{
			if(tmpsum <= 0){
				tmpans += labs(-tmpsum + 1);
				tmpsum = 1;
			}
		}
	}
	ans = min(tmpans,ans);
	tmpsum = 0, tmpans = 0;
	REP(i,n){
		tmpsum += a[i];
		if((i+1)&1){
			if(tmpsum >= 0){
				tmpans += abs(tmpsum + 1);
				tmpsum = -1;
			}
		}	else{
			if(tmpsum <= 0){
				tmpans += abs(-tmpsum + 1);
				tmpsum = 1;
			}
		}
	}
	ans = min(tmpans,ans);
	cout << ans << endl;
  return 0;
}


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

using namespace std;

#define FOR(i, first, last) for (int i = (first); i < (last); ++i)
#define REP(i, n) FOR(i, 0, n)
#define CLR(a) memset((a), 0, sizeof(a))
#define DUMP(x) std::cerr << #x << " = " << (x) << std::endl;
#define DUMPR(v) REP(_i,v.size()){std::cerr<< #v << "[" << _i << "] = " << (v[_i]) << std::endl;}
#define CIN_VEC(v,N) {v.clear(); v.reserve(N); REP(i,N){typename decltype(v)::value_type x; cin>>x; v.emplace_back(x);}};

inline int to_int(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T> inline string to_string(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

typedef unsigned long long ull;
typedef unsigned long ul;

int memo[ 100000 + 1];

int log(int n, int base) {
  int res = 0;
  int x = 1;
  while (x < n ) {
    x *= base;
    res++;
  }
  if (x > n) res--;
  return res;
}

int pow(int base, int n) {
  int res = 1;
  while(n--) res *= base;
  return res;
}

int solve(int N) {
  if (memo[N] != 0) return memo[N];
  // DUMP(N);
  if (N==0) return 0;
  if (N < 6) return N;

  int x9 = log(N, 9);
  int x6 = log(N, 6);

  int n6 = N - pow(6, x6);
  int n9 = N - pow(9, x9);

  return memo[N] = 1 + min(solve(n6), solve(n9));
}

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

  memset(memo, 0, N);
  cout << solve(N) << endl;

  return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>
#define MAX 10000

int main(){
  int *A, *B;
  int C[MAX + 1];
  int n, i;
  
  scanf("%d",&n);
  A = malloc((n + 1) * sizeof(int));
  B = malloc((n + 1) * sizeof(int));

  for(i = 0; i <= MAX; i++){
    C[i] = 0;
  }
  for(i = 0; i < n; i++){
    scanf("%d",&A[i + 1]);
    C[A[i + 1]]++;
  }
  for(i = 0; i < MAX; i++){
    C[i + 1] = C[i] + C[i + 1];
  }
  for(i = n; i > 0; i--){
    B[C[A[i]]] = A[i];
    C[A[i]]--;
  }
  for(i = 1; i < n; i++){
    printf("%d ",B[i]);
  }
  printf("%d\n",B[n]);
  
  return 0;
}



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

int main()
{
  int x, y;
  cin>>x>>y;
  if(y%2==0 && y>= x*2 && y<=x*4) {
    cout<<"Yes\n";
  }
  else
    cout<<"No\n";
  return 0;
}


Measured memory_bytes: 3632
#!/usr/bin/env python3
import sys


def solve(A: int, B: int):
    print(A * B)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()

Measured memory_bytes: 61912
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;

#define BIG_NUM 2000000000

using namespace std;

int main(){

	int N,K;

	scanf("%d %d",&N,&K);
	priority_queue<int> Q[11];	//priority_queue?????????
	int sum_table[11][N+1],workTable[11][N+1],index[11] = {1,1,1,1,1,1,1,1,1,1,1};

	int price,junle;

	for(int i = 0; i < N; i++){
		scanf("%d %d",&price,&junle);

		Q[junle].push(price);
	}

	for(int i = 1; i <= 10; i++){

		while(!Q[i].empty()){
			workTable[i][index[i]++] = Q[i].top();
			Q[i].pop();
		}

		sum_table[i][0] = 0;
		for(int k = 1; k < index[i]; k++){
			sum_table[i][k] = sum_table[i][k-1] + workTable[i][k];
		}
	}

	int dp[11][K+1];

	for(int i = 1; i <= 10; i++){
		for(int p = 0; p <= K; p++)dp[i][p] = 0;
	}

	for(int k = 1; k < index[10];k++){
		dp[10][k] = sum_table[10][k] + k*(k-1);
	}

	for(int jun = 9; jun >= 1; jun--){
		for(int num = 1; num <= K; num++){
			for(int p = 0; p < index[jun] && num-p >= 0; p++){
				if(dp[jun+1][num-p] == 0 && num >= index[jun]){
					dp[jun][num] = max(dp[jun][num],dp[jun+1][num]);
				}else{
					if(dp[jun+1][num-p] > 0){
						dp[jun][num] = max(dp[jun][num],max(dp[jun+1][num],dp[jun+1][num-p] + sum_table[jun][p] + p*(p-1)));
					}else{ //dp[jun+1][num-k] == 0 && num < index[jun]
						dp[jun][num] = max(dp[jun][num],max(dp[jun+1][num],sum_table[jun][num]+num*(num-1)));
					}
				}
			}
		}
	}

	int maximum = 0;
	for(int i = 1; i <= K; i++){
		maximum = max(maximum,dp[1][i]);
	}
	printf("%d\n",maximum);

	return 0;
}

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

using namespace std;


typedef long long ll;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;

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

int main() {
    string s;
    cin >> s;
    if((s[2] == s[3]) && (s[4] == s[5])) cout << "Yes"<< endl;
    else cout << "No" << endl;
    return 0;
}
/*
         ,--"""",--.__,---[],-------._         
       ,"   __,'            \         \--""""""==;-
     ," _,-"  "/---.___     \       ___\   ,-'',"
    /,-'      / ;. ,.--'-.__\  _,-"" ,| `,'   /
   /``""""-._/,-|:\       []\,' ```-/:;-. `. /
             `  ;:::      ||       /:,;  `-.\
                =.,'__,---||-.____',.=
                =(:\_     ||__    ):)=
               ,"::::`----||::`--':::"._
             ,':::::::::::||::::::::::::'.
    .__     ;:::.-.:::::__||___:::::.-.:::\     __,
       """-;:::( O )::::>_|| _<::::( O )::::-"""
   =======;:::::`-`:::::::||':::::::`-`:::::\=======
    ,--"";:::_____________||______________::::""----.          , ,
         ; ::`._(    |    |||     |   )_,'::::\_,,,,,,,,,,____/,'_,
       ,;    :::`--._|____[]|_____|_.-'::::::::::::::::::::::::);_
      ;/ /      :::::::::,||,:::::::::::::::::::::::::::::::::::/
     /; ``''''----------/,'/,__,,,,,____:::::::::::::::::::::,"
     ;/                :);/|_;| ,--.. . ```-.:::::::::::::_,"
    /;                :::):__,'//""\\. ,--.. \:::,:::::_,"
   ;/              :::::/ . . . . . . //""\\. \::":__,"
   ;/          :::::::,' . . . . . . . . . . .:`::\
   ';      :::::::__,'. ,--.. . .,--. . . . . .:`::`
   ';   __,..--'''-. . //""\\. .//""\\ . ,--.. :`:::`
   ;    /  \\ .//""\\ . . . . . . . . . //""\\. :`::`
   ;   /       . . . . . . . . . . . . . . . . .:`::`
   ;   (          . . . . . . . . . . . . . . . ;:::`
   ,:  ;,            . . . . . . . . . . . . . ;':::`
   ,:  ;,             . . . . . . . . . . . . .;`:::
   ,:   ;,             . . . . . . . . . . . . ;`::;`
    ,:  ;             . . . . . . . . . . . . ;':::;`
     :   ;             . . . . . . . . . . . ,':::;
      :   '.          . . . . . . . .. . . .,':::;`
       :    `.       . . . . . . . . . . . ;::::;`
        '.    `-.   . . . . . . . . . . ,-'::::;
          `:_    ``--..___________..--'':::::;'`
             `._::,.:,.:,:_ctr_:,:,.::,.:_;'`
________________`"\/"\/\/'""""`\/"\/""\/"____________________________

*/


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        String b = sc.next();
        if (b.equals("A")) {
            System.out.println("T");
        }
        if (b.equals("T")) {
            System.out.println("A");
        }
        if (b.equals("G")) {
            System.out.println("C");
        }
        if (b.equals("C")) {
            System.out.println("G");
        }
    }
}


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

int main() {
    int N;
    cin >> N;
    string S;
    cin >> S;
    int left = 0;
    int right = 0;
    int ansl = 0;
    int ansr = 0;

    rep(i,N){
      if(S[i] == '(') left++;
      else left--;
      if(left == -1){
        ansl++;left=0;
      }
    }
    rep(i, N) {
        if (S[N-1-i] == ')') right++;
        else right--;
        if (right == -1) {
            ansr++;right = 0;
        }
    }

    cout << string(ansl,'(') + S + string(ansr,')') << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }

    static class Task {

        void solve(InputReader in, PrintWriter out) {
            int N = in.nextInt();
            int[] H = in.nextIntArray(N);
            
            if (N < 2) {
                out.println("Yes");
            } else {
                for (int i = N - 1; i >= 1; --i) {
                    if (H[i] < H[i - 1] - 1) {
                        out.println("No");
                        return;
                    } else if (H[i] == H[i - 1] - 1) {
                        H[i - 1]--;
                    }
                }
                out.println("Yes");
            }
        }

    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

        int[] nextIntArray(int size) {
            int[] arr = new int[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        long[] nextLongArray(int size) {
            long[] arr = new long[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }
    }
}

Measured memory_bytes: 39728
#include <iostream>
#include <cstdio>
using namespace std;
int main(){
    int w,h,x,y;
    cin >> w >> h >> x >> y;
    int a = 0;
    if(w%2 == 0 && h%2 == 0){
        if(w/2 == x && h/2 == y) a = 1;
    }  
    double ans = (double)w*h/2.0;
    printf("%.10f %d\n", ans, a);
    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() {
	
	//vector<int> a(n);
	//cout << "test" << endl;

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


	int k,x;

	cin >> k >> x;
	//cout << "test" << endl;
	
	int s=x-k+1;
	
	
	rep(i,k*2-1){
		cout << s+i << " ";
	}
	
	cout << "\n";
	
	
	return 0;

    }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vi=vector<int>;

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

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {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;}

#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep2(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//indexは
long long INF = 1LL<<60;

int n;
void gene(int i,int rest,string s){
    if(s.size()==n){
        cout<<s<<endl;
        return;
    }
    if(i>n||rest<0)return;
    i++;
    rest--;
    for(int j=0;j<i+1;j++){
        //stringは記憶領域を共通してる?明示しないとコピー取らない?
        char tmp='a'+j;
        if(tmp!='a'){
            char fb=tmp-1;
            if(s.find(fb)==string::npos)continue;
        }
        gene(i,rest,s+tmp);
    }
}

int main( ){
    cin>>n;
    gene(0,n,"");
    return 0;
}




Measured memory_bytes: 1536
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.nextLine());
    Map<String, Integer> map = new HashMap<>();
    int max = 0;
    for(int i = 0; i < N; i++){
      String s = sc.nextLine();
      if(map.containsKey(s)){
        int n = map.get(s)+1;
        max = Math.max(n, max);
        map.put(s, n);
      }else{
        map.put(s, 1);
        max = Math.max(max, 1);
      }
    }
    List<String> list = new ArrayList<>();
    for (Map.Entry<String, Integer> entry : map.entrySet()) {
      if(entry.getValue() == max){
        list.add(entry.getKey());
      }
    }
    Collections.sort(list);
    for(String st : list){
      System.out.println(st);
    }
  }
}


Measured memory_bytes: 179572
#include <cstdio>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

#define TRACE(x) cerr << #x << " = " << x << endl
#define REP(i, n) for (int i=0; i<n; i++)
#define FOR(i, a, b) for (int i=(a); i<(b); i++)
#define _ << " " <<

typedef long long ll;
typedef pair<int, int> P;
#define X first
#define Y second

const int MAX = 1<<18;

int p[MAX];

int main()
{
  int n, T;
  scanf("%d%d", &n, &T);

  int rje = 0;
  REP(i, n) scanf("%d", &p[i]);
  REP(i, n) {
    if (i == n-1) rje += T;
    else rje += min(T, p[i+1] - p[i]);
  }

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

  return 0;
}


Measured memory_bytes: 1024
a, b = map(int, input().split())


for x in range(a + 1):
    for y in range(a + 1):
        z = a - x - y
        if z >= 0 and x*10000 + y*5000 + z*1000 == b:
            print(x,y,z)
            exit()
print("-1 -1 -1")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define For(a,b,c) for(int a=b;a<=c;++a)
#define Dor(a,b,c) for(int a=b;a>=c;--a)
using namespace std;
const int N=4007,P=1000000007;
int n,m,k,C[N][N],F[N];
int main() {
	scanf("%d%d",&n,&k),m=n-k;
	For(i,0,n<<1) {
		C[i][0]=C[i][i]=1;
		For(j,1,i-1) C[i][j]=(C[i-1][j-1]+C[i-1][j])%P;
	}
	For(i,1,k) {
		int a=C[k-1][i-1];
		int x=m-i+1;
		int b=C[x+i][i];
		printf("%lld\n",1LL*a*b%P);
	}
	return 0;
}

Measured memory_bytes: 61440
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace __gnu_pbds;
using namespace std;
//typedef
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
//constants
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
// gcd of a and b
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
// distance between (a,b) and (c,d)
long double dis(long long a,long long b,long long c,long long d){return sqrt( ((a)-(c))*((a)-(c))+((b)-(d))*((b)-(d)) );}
// simple prime check
bool isprime(long long a){
if(a==2)return 1;
if(!(a&1))return 0;
for(ll i=3;i*i<=a;i+=2){
	if(a%i==0)return 0;
}
return 1;
}
// fast expo
long long mpow(long long base,long long exponent,long long modulus){
if(modulus==1)return 0;
long long result = 1;
base=base%modulus;
while(exponent){
		if(exponent%2 == 1)
			result=(result*base)%modulus;
		exponent=exponent>>1;
		base=(base*base)%modulus;
	}
return result;
}
// modular inverse
ll minv(ll a,ll mod){
	ll _gcd=gcd(a,mod);
	assert(_gcd==1);
	return mpow(a,mod-2,mod);
}

/*
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/

/*
ll dx[]={1,0,-1,0,1,1,-1,-1};
ll dy[]={0,-1,0,1,1,-1,-1,1};
*/

/*
void sieve(int N){
	for(int i=0;i<=N;i++){
		spf[i]=i;
	}
	for(int i=2;i*i<=N;i++){
		if(spf[i]==i){
			for(int j=i*i;j<=N;j+=i){
				spf[j]=min(spf[j],i);
			}
		}
	}
	return;
}
*/

/*
void nCr(ll n,ll k){
	ll i,j;
	for(i=0;i<=n;i++){
		for(j=0;j<=min(i,k);j++){

			if(j==0 or j==i)C[i][j]=1LL;
			else  C[i][j]=(C[i-1][j-1]+C[i-1][j])%MOD;

		}
	}
	return;
}
*/
/*
ll ncr(ll N,ll K){
	if(N<K)return 0;
	if(K==0)return 1;
	if(N==0)return 0;

	ll den=1;
	for(ll i=1;i<=K;i++)den*=i;
	ll num=1;
	while(K--){
		num*=N;
		if(num%den==0){
			num/=den;
			den=1;
		}
		N--;
	}

	return num;
}
*/
ld w,h,x,y;
int main(){FAST;
	cin>>w>>h>>x>>y;
	cout<<(w*h)/2<<' ';
	if((ll)ceil(w/2) == x and (ll)floor(w/2) == x and (ll)ceil(h/2) == y and (ll)floor(h/2) == y){
		cout<<1;
	}
	else{
		cout<<0;
	}
return 0;
}

Measured memory_bytes: 256
N, q = gets.split.map(&:to_i)
S = "<#{gets.chomp}>"
Q = q.times.map{gets.chomp}
l,r = [1, N]

def move(pos, op)
  label = op[0]
  dir = op[2]
  S[pos] != label ? pos : (dir == 'L' ? pos - 1 : pos + 1)
end

Q.reverse_each do |op|
  l = (l - 1 .. l + 1).select{|pos| move(pos, op) >= l }.min
  r = (r - 1 .. r + 1).select{|pos| move(pos, op) <= r }.max
end

puts r < l ? 0 : r - l + 1


Measured memory_bytes: 16356
def main():
    X, K, D = map(int, input().split())

    # Xは0以上と仮定する
    X = X if X >= 0 else -X

    if X - (K * D) >= 0:
        print(X - K * D)
        return

    # 以下は X < K * D
    K -= X // D
    X %= D

    if K % 2 == 0:
        print(X)
    else:
        print(min(abs(X+D), abs(X-D)))

main()



Measured memory_bytes: 61896
#include <algorithm>
#include <functional>
#include <iostream>
#include <string>
using namespace std;

int main() {
	string s, t;
	cin >> s >> t;
	sort(s.begin(), s.end());
	sort(t.begin(), t.end(), greater<char>());
	if (s < t) cout << "Yes";
	else cout << "No";
}

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

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second

template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> P;

const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS  = 1e-10;

int main() {
	int n; cin >> n;
	string s; cin >> s;
	
	int cnt = 0, now = 0;
	REP(i, s.size()) {		
		if (s[i] == ')') {
			if (now == 0) cnt++;
			else now--;
		}
		else now++;
	}
	
	string tmp = "";
	REP(i, cnt) tmp += '(';
	s = tmp + s;
	
	cnt = 0; now = 0;
	for (int i = s.size() - 1; i >= 0; i--) {
		if (s[i] == '(') {
			if (now == 0) cnt++;
			else now--;
		}
		else now++;
	}
	
	REP(i, cnt) s += ')';
	
	cout << s << endl;
	
	return 0;
}


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

using namespace std;

long long n, cnt = 0;
vector<long long> a, b;

int main()
{
    cin >> n;
    a.assign(n + 1, 0);
    b.assign(n, 0);
    for(int i = 0; i < (int)a.size(); ++i) cin >> a[i];
    for(int i = 0; i < (int)b.size(); ++i) cin >> b[i];
    for(int i = 0; i < n; ++i)
    {
        if(a[i] > 0)
        {
            if(a[i] > b[i]) 
            {
                cnt += b[i];
                b[i] = 0;
            }
            else 
            {
                cnt += a[i];
                b[i] -= a[i];
            }
        }
        if(a[i + 1] > b[i]) 
        {
            a[i + 1] -= b[i];
            cnt += b[i];
            b[i] = 0;
        }
        else
        {
            b[i] -= a[i + 1];
            cnt += a[i + 1];
            a[i + 1] = 0;
        }
    }
    cout << cnt;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N = 0;
    cin >> N;
    vector<int> V(N);
    vector<int> C(N);
    for (int i = 0; i < N; ++i) {
        cin >> V.at(i);
    }
    for (int i = 0; i < N; ++i) {
        cin >> C.at(i);
    }

    //Value - Cost
    vector<int> VC(N);
    for (int i = 0; i < N; ++i) {
       VC.at(i) = V.at(i) - C.at(i);
    }

    int ans = 0;
    for (int i = 0; i < N; ++i) {
        if(VC.at(i) >=0){
            ans+= VC.at(i);
        }
    }
    cout << ans;
    return 0;
}

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

using namespace std;
int minHeight(int arr[], vector<int> &dp, int k, int index)
{
  int len = dp.size();
  if(index >= len)
  {
    return 0;
  }
  if(dp[index] == INT_MAX)
  {
   	int t1,t2;
    for(int i=1; i <= k && index-i >= 0; i++)
    {
      dp[index] = min( dp[index], abs( arr[index] - arr[index - i] ) + minHeight(arr, dp, k, index - i));
    }
    //dp[index] = min( , abs( arr[index] - arr[index - 2] ) + minHeight(arr, dp, index - 2) );
  }
  return dp[index];                 
}

int main()
{
  int n,k;
  cin >> n >>k;
  int arr[n];
  int h[k];
  for(int i = 0; i < n; i++)
  {
   	cin >> arr[i];
  }
  vector<int> ans(n,INT_MAX);
  ans[0] = 0;
  ans[1] = abs( arr[1] - arr[0] );
  minHeight(arr, ans, k, n-1);
  cout<< ans[n-1] <<endl;
}


Measured memory_bytes: 11888
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
const int N=2000;
int d,g;
int p[101],c[101],f[15][N+10];
int main() {
    scanf("%d%d",&d,&g);
    for (int i=1;i<=d;i++)
        scanf("%d%d",&p[i],&c[i]);
    for (int i=1;i<=d;i++) {
        for (int j=0;j<=p[i];j++) {
            for (int k=0;k+j<=N;k++) {
                if (j!=p[i]) f[i][k+j]=max(f[i][k+j],f[i-1][k]+i*100*j);
                else f[i][k+j]=max(f[i][k+j],f[i-1][k]+i*100*j+c[i]);
            }
        }
    }
    for (int i=0;i<=N;i++)
        if (f[d][i]>=g) {
            printf("%d\n",i);
            return 0;
        }
    return 0;
}


Measured memory_bytes: 384
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
static string[] input = Console.ReadLine().Split(' ');
static int n = int.Parse(input[0]);
static int q = int.Parse(input[1]);
static string s = Console.ReadLine();
static char[] aas = new char[q];
static char[] bbs = new char[q];
static int leftDrop = 0;
static int rightDrop = 0;

	static void Main()
	{
    for(int i = 0; i < q; i++)
    {
      var nums = Console.ReadLine().Split(' ');//１行ごとに受け取る
      aas[i] = nums[0][0];
      bbs[i] = nums[1][0];
    }

    leftDrop = SearchLeft(0, n);
    rightDrop = SearchRight(0, n);

    //Console.WriteLine(n+" " +leftDrop+" "+rightDrop);
    Console.WriteLine(n-leftDrop-rightDrop);  
	}

  static int SearchLeft(int min, int max)//二分探索法で最大値を求める
  {
    while (true)
    {
      int mid = min + (max - min) / 2;
      if(CheckLeft(mid)) min = mid;//さらに大きくても成り立つかも
      else max = mid;

      if(max - min <= 1)
      {
        if(CheckLeft(max)) 
        {
          return max;//最大値で成り立つかの確認を優先
        }
        else
        {
          return min;
        }
      break;
      }  
    }
  }

  static int SearchRight(int min, int max)//二分探索法で最大値を求める
  {
    while (true)
    {
      int mid = min + (max - min) / 2;
      if(CheckRight(mid)) min = mid;//さらに大きくても成り立つかも
      else max = mid;

      if(max - min <= 1)
      {
        if(CheckRight(max)) 
        {
          return max;//最大値で成り立つかの確認を優先
        }
        else
        {
          return min;
        }
      break;
      }  
    }
  }

  static bool CheckLeft(int testNum)
  {
    int nowPosition = testNum-1;
    if(nowPosition < 0) return true;
    
    for(int i = 0; i < q; i++)
    {
      if(aas[i] == s[nowPosition])
      {
        if(bbs[i] == 'L') nowPosition--;
        else nowPosition++;
      }
      if(nowPosition < 0) return true;
      else if(nowPosition >= n) return false;
    }

    return false;
  }

  static bool CheckRight(int testNum)
  {
    int nowPosition = n-testNum;
    if(nowPosition >= n) return true;
    
    for(int i = 0; i < q; i++)
    {
      if(aas[i] == s[nowPosition])
      {
        if(bbs[i] == 'L') nowPosition--;
        else nowPosition++;
      }
      if(nowPosition >= n) return true;
      else if(nowPosition < 0) return false;
    }

    return false;
  }
  
}

Measured memory_bytes: 18732
import sys
input = sys.stdin.readline


class Lights:

    def __init__(self):
        self.lights = []

    def add(self, light):
        self.lights.append(light)

    def is_all_up(self, switch):
        for light in self.lights:
            if not light.is_up(switch):
                return False
        return True

    def __str__(self):
        result = "{"
        for light in self.lights:
            result += str(light)
        return result + "}"


class Light:

    def __init__(self, k, s, p):
        self.k = k
        self.s = s
        self.p = p

    def is_up(self, switch):
        intersection = self.s.intersection(switch)
        return self.p == len(intersection) % 2

    def __str__(self):
        return "[k={}, s={}, p={}]".format(self.k, self.s, self.p)


def main():
    n, m = map(int, input().split())
    ks_lst = [list(map(int, input().split())) for _ in range(m)]
    p_lst = list(map(int, input().split()))
    lights = Lights()
    for ks, p in zip(ks_lst, p_lst):
        k, s = ks[0], set(ks[1:])
        lights.add(Light(k, s, p))

    ans = 0
    for bit in range(2**n):
        switches = set()
        for i in range(n+1):
            if (bit >> i) & 1:
                switches.add(i+1)
        if lights.is_all_up(switches):
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()


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

using namespace std;

int main(){
  string S; cin >> S;
  string x;
  for(int i=0; i < S.size()-1; i++){
    if(S.substr(i,1) == S.substr(i+1,1)){
      cout << "Bad" << endl;
      return 0;
    }
  }
  cout << "Good" << endl;
}
  

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;
public class Hello
{
    public static void Main()
    {
        int N = NextInt();
        int K = NextInt();
        string S = NextString();
        for (int i = 0; i < N; i++)
        {
            if (i == K - 1) Console.Write(S[i].ToString().ToLowerInvariant());
            else Console.Write(S[i]);
        }
        Console.WriteLine();
    }
}

public class Input
{
    private static Queue<string> queue = new Queue<string>();
    private static void Confirm() { if (queue.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) queue.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(queue.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(queue.Dequeue()); }
    public static string NextString() { Confirm(); return queue.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(queue.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}


Measured memory_bytes: 11220
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <functional>

using namespace std;


int main(){
  long n, m;
  cin >> n >> m;
  long long a,b,c, t;
  t = n*m;
  if(n % 3 == 0 || m % 3 == 0){
    cout << 0 << endl;
    return 0;
  }
  
  long long ans = 999999999999999;
  for(int i = 1; i < n; i++){
    a = i * m;
    b = ((n-i)/2)*m;
    c = t - a - b;
    if(c > 0 && b > 0){
      ans = min(ans, max(a,max(b,c)) - min(a,min(b,c)));
      //cout << a << "," << b << "," << c << endl;
    }
  }
  
  for(int i = 1; i < n; i++){
    a = i * m;
    b = (m/2) * (n-i);
    c = t - a - b;
    if(c > 0 && b > 0){
      ans = min(ans, max(a,max(b,c)) - min(a,min(b,c)));
      //cout << a << "," << b << "," << c << endl;
    }
  }

  swap(n,m);
  for(int i = 1; i < n; i++){
    a = i * m;
    b = ((n-i)/2)*m;
    c = t - a - b;
    if(c > 0 && b > 0){
      ans = min(ans, max(a,max(b,c)) - min(a,min(b,c)));
      //cout << a << "," << b << "," << c << endl;
    }
  }
  
  for(int i = 1; i < n; i++){
    a = i * m;
    b = (m/2) * (n-i);
    c = t - a - b;
    if(c > 0 && b > 0){
      ans = min(ans, max(a,max(b,c)) - min(a,min(b,c)));
      //cout << a << "," << b << "," << c << endl;
    }
  }
  cout << ans << endl;
  return 0;
} 


Measured memory_bytes: 256
<?php
$t="";
$array=array();
while ($line = fgets(STDIN)) {
   $t .= strtolower(trim($line).' ');
}
$array = explode(' ', $t);
    for ($i = 1; $i <= 30; $i++) {
        if(in_array($i,$array)){
            continue;
        }
        echo $i.PHP_EOL;
    }
?>


Measured memory_bytes: 9248
#include <stdio.h>
#include <string.h>

int main()
{
	char str[1300];
	while(fgets(str,1300,stdin))
	{
		int sum = 0;
		int i = 0;
		if(str[0] == '0')
		{
			break;	
		} 
		for(i=0; i<strlen(str)-1;i++)
		{
			sum += str[i] - '0';
		}
		printf("%d\n",sum);
	}
	return 0;
}



Measured memory_bytes: 2032
#include <bits/stdc++.h>
using namespace std;
 
const double pi  = 2 * acos(0.0);
const double eps = 1e-8;
 
#define REP(i,a,b) for(int i=(a); i<(b);++i)
#define rep(i,n) REP(i,0,n)
#define INF (1<<29)
#define INFLL (1L<<63)
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
int dx[8] = {0, 1, 0, -1, 1, -1, 1, -1};
int dy[8] = {1, 0, -1, 0, 1, -1, -1, 1};
 
int main(void) {
  ios_base::sync_with_stdio(false); cin.tie(0);
  unsigned a, b;
  cin >> a >> b;
  a -= 2; b -= 2;
  if (a == b) cout << "Draw" << endl;
  else if (a > b) cout << "Alice" << endl;
  else cout << "Bob" << endl;
  return 0;
}

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

using namespace std;

#define int long long
#define ll long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;


signed main(){

	int N;
	cin >> N;
	string s;
	cin >> s;
	int red = 0;
	for (int i = 0; i < s.length(); i++){
		if (s[i] == 'R') red++;
	}
	if (red > N - red){Yes}
	else No


	return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define ll long long
#define REP(i, n) for (ll (i) = 0; (i) < (n); (i)++)
#define REPI(i, a, b) for (ll (i) = (a); (i) < (b); (i)++)
#define int long long
using namespace std;
using P = pair<int, int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;

signed main() {
  int N;
  cin >> N;
  vector<string> W(N);
  map<string, int> m;
  REP (i, N) {
    cin >> W[i];
    m[W[i]]++;
  }
  if (m.size() < N) {
    cout << "No" << endl; return 0;
  }
  REP (i, N-1) {
    if (*(W[i].end()-1) != *(W[i+1].begin())) {
      cout << "No" << endl; return 0;
    } 
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 256
#coding:utf-8
from __future__ import division,print_function
try:
    input = raw_input
except NameError:
    pass
# 上記のコードはPython2とPython3の違いを一部吸収するためのもの

# N * Mの表をつくる.すべての要素はvにする。
def make_matrix(N,M,v):
    # return [[v for i in range(M)] for j in range(N)]とも書ける。
    ret = []
    for i in range(N):
        l = []
        for j in range(M):
            l.append(v)
        ret.append(l)
    return ret


def solve(numbers):
    MAX_NUMBER = 20
    SIGN = [-1,+1]
    rightside_of_expression = numbers[-1]
    leftside_of_expession = numbers[:-1]

    # (N-1) * 21 の表
    #  way_to_make[i][j] = i項まで使ってjをつくる+/-の組み合わせ
    way_to_make = make_matrix(len(leftside_of_expession),MAX_NUMBER+1,0)

    # インデックスを使いたいので直接 for i in leftside_of_expessionとはしない。
    #  enumerateをつかっても良い
    for i in range(len(leftside_of_expession)):
        v = leftside_of_expession[i]
        # 最初の項は+しかない。
        if i == 0:
            way_to_make[0][v] = 1
        else:
            for j in range(MAX_NUMBER+1):
                # way_to_make[i][j] = way_to_make[i-1][j-numbers[i]]
                #                   + way_to_make[i-1][j+numbers[i]]
                for s in SIGN:
                    p = j + s*numbers[i]
                    if 0 <= p <= MAX_NUMBER:
                        way_to_make[i][j] += way_to_make[i-1][p]

    return way_to_make[-1][rightside_of_expression]

def main():
    N = int(input())

    string_of_numbers = input().split(" ")
    numbers = []
    for s in string_of_numbers:
        numbers.append(int(s))

    # solveはNを必要としない。(N = len(numbers)だから。)
    print(solve(numbers))

main()

Measured memory_bytes: 4304
/* Bismillahirrahmanirrahim */
/* Author : Jehian Norman Saviero (@Reiva5) */
#include <bits/stdc++.h>
 
// MACROS SAMPAH
#define Jehian using
#define Norman namespace
#define Saviero std
 
Jehian Norman Saviero;
 
// MACROS TYPE
typedef long l;
typedef long long ll;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<l,l> pl;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<l> vl;
typedef vector<ll> vll;
 
// MACROS FOR PRINT
#define nl printf("\n")
 
// MACROS FOR ATTRIBUTE
#define fi first
#define se second
 
// MACROS FOR FUNCTION AND METHOD
#define eb emplace_back
#define mp make_pair
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define ALL(x) (x).begin(), (x).end()
#define ALLN(x,n) (x), (x)+(n)
#define CUBE(x) (SQR(x)*(x))
#define SET(x,y) for (int _qwe = sizeof(x)/sizeof(x[0]); _qwe; ) x[--_qwe] = (y)
#define SQR(x) ((x)*(x))
#define SSORT(x,sz) sort(ALLN(x,sz))
#define RESET(x) memset((x), 0, sizeof(x))
#define VSORT(x) sort(ALL(x))
 
// MACROS READ INPUT
#define sci(x) scanf("%d", &x)
#define scl(x) scanf("%ld", &x)
#define scll(x) scanf("%lld", &x)
#define scd(x) scanf("%lf", &x)
#define scld(x) scanf("%Lf", &x)
#define scul(x) scl(x)
#define scull(x) scll(x)

int main() {
	char cc;
	cin >> cc;
	cout << (char) (cc + 1) << '\n';
	return 0;
}

Measured memory_bytes: 256