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

// #include <atcoder/all>

using namespace std;
// using namespace atcoder;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
typedef long long ll;
// #define int ll

#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
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 (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;
// int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
// int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
vi dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
// vi dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
// const ll MOD = 1000000007;
const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'


signed main() {
    int k;
    cin >> k;
    rep (i, k) cout << "ACL";
    cout << endl;
}

Measured memory_bytes: 3628
import java.util.*;
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		Num[] array=new Num[3*n];
		Num[] array2=new Num[3*n];
		for(int i=0;i<3*n;i++) {
			Num num=new Num();
			num.position=i;
			num.value=sc.nextInt();
			array[i]=num;
			array2[i]=num;
		}
		Arrays.sort(array2, new Comparator<Num>() {
			public int compare(Num n1, Num n2) {
				return n1.value-n2.value;
			}
		});
		long sum=0;
		int count=0;
		int minPosiRank=0;
		int minZeroRank=0;
		
		for(int i=0;i<3*n;i++) {
			array2[i].rank=i;
			if(count<n && array2[i].position>n-1) {
				sum-=array2[i].value;
				array2[i].sign=-1;
				count++;
			}
		}
		count=0;
		
		for(int i=3*n-1;i>=0;i--) {
			if(count<n && array2[i].position<=n-1) {
				sum+=array2[i].value;
				array2[i].sign=1;
				minPosiRank=i;
				count++;
			}
			if(array2[i].sign==0) {
				minZeroRank=i;
			}
		}
		
		long maxsum=sum;
		
		for(int i=n;i<2*n;i++) {
			if(array[i].sign==-1) {
				array[i].sign=0;
				sum+=array[i].value;
				int j=minZeroRank;
				while(true){
					if(array2[j].sign==0 & array2[j].position>i) {
						array2[j].sign=-1;
						sum-=array2[j].value;
						minZeroRank=j+1;
						break;
					}
					j++;
				}
			}
			
			if(array[i].value>array2[minPosiRank].value) {
				array2[minPosiRank].sign=0;
				array[i].sign=1;
				sum=sum+array[i].value-array2[minPosiRank].value;
				int j=minPosiRank;
				while(true) {
					if(array2[j].sign==1) {
						minPosiRank=j;
						break;
					}
					j++;
				}
			}
			maxsum=Math.max(maxsum, sum);
		}
		System.out.println(maxsum);
	}
}

class Num {
	int position;
	int value;
	int rank;
	int sign=0;
}

Measured memory_bytes: 109844
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;

#define MOD 1000000007
LL powmod(LL a, LL n){
    if(n == 0) return 1;
    if(n % 2) return (a*powmod(a,n-1)) % MOD;
    LL c = powmod(a, n/2);
    return (c*c) % MOD;
}
LL inv(LL a){
    return powmod(a, MOD-2);
}
LL fact[110000];
LL invfact[110000];

LL ncr(LL n, LL r){
    if(r < 0 || n < 0) return 0;
    if(n < r) return 0;
    LL a = fact[n];
    a = (a * invfact[r]) % MOD;
    a = (a * invfact[n-r]) % MOD;
    return a;
}
void init(){
    fact[0] = 1;
    invfact[0] = 1;
    LL inv2 = inv(2);
    for(LL i = 1; i < 110000; i++){
        fact[i] = (i*fact[i-1]) % MOD;
        invfact[i] = inv(fact[i]);
    }
}

LL dp[51][51][51];

int main(){
    init();
    int N = 50;
    for(int button = 0; button <= N; button++){
        for(int i = 0; i <= N; i++){
            for(int j = 0; j <= N; j++){
                //calculate dp[i][j][button];
                dp[i][j][button] = 0;
                if(i == 0 && j == 0){
                    if(button == 0){
                        dp[i][j][button] = 1;
                    }
                    continue;
                }
                for(int c = 0; c <= button - i - j; c++){
                    for(int d = 0; c + d <= button - i - j; d++){
                        int a = i-c+d;
                        int b = j-d+c;
                        if(a < 0 || b < 0 || a > N || b > N) continue;
                        LL newans = dp[c][d][button - i - j];
                        newans = (newans * invfact[a]) % MOD;
                        newans = (newans * invfact[b]) % MOD;
                        dp[i][j][button] += newans;
                        dp[i][j][button] %= MOD;
                    }
                }
            }
        }
    }
    int n;
    cin >> n;
    cout << (dp[1][0][n] * fact[n]) % MOD << endl;
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 99999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(150) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
  lli A,B,C,D,E,F,N,M,K,L,R,X,Y,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> K >> A >> B;
  if(B-A<2)Out(K+1);
  else{
    sum=1;
    if(1<A){K-=A-1;sum=A;}
    sum+=(B-A)*(K/2);
    if(K%2==1)sum++;
    Out(sum);
    }
  }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(x, name)in(x)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(x,v) for(auto &x:(v))
#define all(x) (x).begin(),(x).end()
#define print(...) out(__VA_ARGS__);cout<<endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void out(){} template<class T,class... U> void out(T t,U ...u){cout<<t<<" ";out(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

void solve() {
  VAR(int, X, a, b);
  print(abs(X - a) > abs(X - b) ? "B" : "A");
}


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();
      String t = sc.next();

      Map<Character, Character> mapping = new HashMap<>();
      Map<Character, Character> mapping2 = new HashMap<>();
      for(int i = 0; i < s.length(); i++) {
        char c1 = s.charAt(i);
        char c2 = t.charAt(i);
        if(mapping.containsKey(c1)) {
          if(mapping.get(c1) != c2) {
            System.out.println("No");
            return;
          }
        } else if (mapping2.containsKey(c2)) {
          if(mapping2.get(c2) != c1) {
            System.out.println("No");
            return;
          }
        } else {
          mapping.put(c1, c2);
          mapping2.put(c2, c1);
        }
      }

      System.out.println("Yes");
  }
}

Measured memory_bytes: 27676
n,m = (int(i) for i in input().split())
x = [[int(i) for i in input().split()] for i in range(m)]
red,num = set([1]),[1 for i in range(n+1)]
for i,j in x:
	num[i],num[j] = num[i]-1,num[j]+1
	if i in red:
		red.add(j)
		if num[i]==0: red.remove(i)
print(len(red))

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

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n, k, o;
  cin >> n >> k;
  o = n % k;
  long long ans = 0;
  if(o == 0)
    cout << 0;
  else{
    ans = n > abs(k-o)?abs(k-o):n;
    cout << ans;
  }
  return 0;
}

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

int main(){
	
  	int N;
  string S;
  cin>>N>>S;
	
  ll r=0,g=0,b=0,ans=0;
  rep(i,N){
  	if(S[i]=='R') r++;
    if(S[i]=='G') g++;
    if(S[i]=='B') b++;
  }
  
  ans=r*g*b;
  
  rep(i,N-2){
  	for(ll j=i+1;j<N-1;j++){
      if(2*j-i<N){
    	if((S[i]!=S[j]) && (S[i]!=S[2*j-i]) && (S[j]!=S[2*j-i])) ans--;
      }
    }
  }
  cout<<ans;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long 
const long long inf=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;
#define FORR(x,arr) for(auto& x:arr)
#define ZERO(a) memset(a,0,sizeof(a))





//3111111111111111111111111111111
	
	int dp[310000];

	void solve(){

		
		ini(n);
		ini(n1);
		ini(k);
		vi tmp;
		vi tmp1;
		FOR(i,0,n){
			ini(x);
			tmp.push_back(x);
			
		}
		FOR(i,0,n1){
			ini(x);
			tmp1.push_back(x);
		}
		int rick = 0;
		vpii tmpp(310000);
		vpii tmpp1(310000);
		
		tmpp[0] = {tmp[0],0};
		tmpp1[0] = {tmp1[0],0};

		FOR(i,1,n){
			tmpp[i].first = tmp[i]+tmpp[i-1].first;
			tmpp[i].second = i;
		}

		FOR(i,1,n1){
			tmpp1[i].first = tmp1[i]+tmpp1[i-1].first;
			tmpp1[i].second = i;
		}
		FOR(i,0,n){
			if(tmpp[i].first>k){break;}
			int tmpx = k-tmpp[i].first;
			int l = 0;
			int r = n1-1;
			while(l<=r){
				int mid = l+(r-l)/2;
				if(tmpp1[mid].first>=tmpx){
					r= mid-1;
				}
				else{
					l = mid+1;
				}
			}
			if(l >= n1){
				rick = max(rick,i+1+n1);
			}
			pair<int,int>tmppair = tmpp1[l];
			if(tmppair.first == tmpx){
				rick = max(rick,i+tmppair.second+2);
			}
			else{
				rick = max(rick,i+tmppair.second+1);
			}
		}
		FOR(i,0,n1){
			if(tmpp1[i].first>k){break;}
			int tmpx = k-tmpp1[i].first;
			int l = 0;
			int r = n-1;
			while(l<=r){
				int mid = l+(r-l)/2;
				if(tmpp[mid].first>=tmpx){
					r= mid-1;
				}
				else{
					l = mid+1;
				}
			}
			if(l >= n){
				rick = max(rick,i+1+n);
			}
			pair<int,int>tmppair = tmpp[l];
			if(tmppair.first == tmpx){
				rick = max(rick,i+tmppair.second+2);
			}
			else{
				rick = max(rick,i+tmppair.second+1);
			}
		}





		out(rick);
		
		


			
			
			


				
		


		
		
		
		

		


		
		
	}



	



















int32_t main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall 
	oneforall

	solve();
	


	return 0;
}


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

int main() {
  int H, W, K;
  cin >> H >> W >> K;
  vector V(H, vector(W, 0));
  for (int h, w, v; cin >> h >> w >> v;) V.at(--h).at(--w) = v;
  auto cmax = [&](long &a, long b) {a = max(a, b);};
  vector DP(H, vector(W, vector(5, 0L)));
  DP.at(0).at(0).at(1) = V.at(0).at(0);
  for (int h = 0; h < H; h++) {
    for (int w = 0; w < W; w++) {
      for (int i = 0; i < 4; i++) {
        long now = DP.at(h).at(w).at(i);
        if (h + 1 < H) cmax(DP.at(h + 1).at(w).at(0), now);
        if (h + 1 < H) cmax(DP.at(h + 1).at(w).at(1), now + V.at(h + 1).at(w));
        if (w + 1 < W) cmax(DP.at(h).at(w + 1).at(i), now);
        if (w + 1 < W) cmax(DP.at(h).at(w + 1).at(i + 1), now + V.at(h).at(w + 1));
      }
    }
  }
  cout << *max_element(DP.at(H - 1).at(W - 1).begin(), DP.at(H - 1).at(W - 1).begin() + 4) << "\n";
}

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

int main() {
  int K;
  cin >> K;
  
  string S;
  cin >> S;
  
  if (S.size() <= K) {
    cout << S << endl;
  } else {
    for (int i = 0; i < K; i++) {
      cout << S.at(i);
    }
    cout << "...";
  }
}

Measured memory_bytes: 3628
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

#ifdef _DEBUG
#include "../../library/library/debug_template.cpp"
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

struct init {
	init() {
		cin.tie(nullptr); ios::sync_with_stdio(false);
		cout << fixed << setprecision(10);
	}
} init_;

int main() {

	int N;
	cin >> N;

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

	int sum = 0;
	for (int i = 0; i < N; i++) sum ^= A[i];

	for (int i = 0; i < N; i++) {
		cout << (sum ^ A[i]) << "\n";
	}

	return 0;
}



Measured memory_bytes: 3912
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>& p) { os << p.first << " " << p.second; return os; }
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) { for(int i = 0; i < (int) v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }

void solve()
{
    int n, m; cin >> n >> m;
    if(n == m) cout << "Yes" << endl;
    else cout << "No" << endl;
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

Measured memory_bytes: 256
N,M = map(int,input().split())
war_list = []
divide_list = []
for i in range(M):
    war_list.append(list(map(int,input().split())))
war_list.sort(key = lambda x : x[1])

divide_list = [war_list[0][1]]
for i in range(1,M):
    if  war_list[i][0] < divide_list[-1]:
        pass
    else:
        divide_list.append(war_list[i][1])
    
print(len(divide_list))


Measured memory_bytes: 29440
package main

import (
    "fmt"
    "os"
    "bufio"
    "strconv"
    // "sort"
)
var sc = bufio.NewScanner(os.Stdin)


func main() {
    sc.Split(bufio.ScanWords)
    // code goes here
    _, M, X := nextInt(), nextInt(), nextInt()
    
    left := 0
    right := 0
    for i := 0; i < M; i += 1 {
        a := nextInt()
        if a < X {
            left += 1
        } else {
            right += 1
        }
    }
    fmt.Println(Min(left, right))
}



func nextInt() int {
    sc.Scan()
    v, e := strconv.Atoi(sc.Text())
    if e != nil { panic(e) }
    return v
}
func nextInt64() int64 {
    sc.Scan()
    v, e := strconv.ParseInt(sc.Text(), 10, 64)
    if e != nil { panic(e) }
    return v
}
func nextString() string {
    sc.Scan()
    return sc.Text()
}
func nextFloat() float64 {
    sc.Scan()
    v, e := strconv.ParseFloat(sc.Text(), 64)
    if e != nil { panic(e) }
    return v
}
func Max(x, y int) int { if x > y { return x }; return y }
func Min(x, y int) int { if x < y { return x }; return y }
func Abs(x int) int { if x > 0 { return x }; return -x }



Measured memory_bytes: 640
N,K = map(int, input().split())
P=[(float(x)+1)/2 for x in input().split()]
#print(P)
max=0
kitai=0
for i in range(K):
    kitai+=P[i]
max=kitai
for i in range(N-K):
    kitai-=P[i]
    kitai+=P[i+K]
    if max<kitai:
        max=kitai
print(max)


Measured memory_bytes: 23588
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <limits.h>
#include <cinttypes>
#include <string.h>
#include <bits/stdc++.h>

#define countof(a) (sizeof(a)/sizeof(*a))

#define vi vector<int>
#define vvi vector<vector<int> >
#define pi pair<int,int>
#define fi first
#define se second

#define FOR(var, to)          for (register s64 var = 0; var < (s64)to; var++)
#define FROMTO(var, from, to) for (register s64 var = from; var <= (s64)to; var++)

#define INIT(var) FOR(i,countof(var)) var[i] = 0
#define INPUT(var) FOR(i,countof(var)) var[i] = ri()

#define SORT(v) qsort(v,countof(v),sizeof(*v),int_less)
#define SORTT(v) qsort(v,countof(v),sizeof(*v),int_greater)

#define MOD 1000000007
#define INF (1 << 30)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

using namespace std;

static inline int ri() {
  int a;
  scanf("%d", &a);
  return a;
}

static inline s64 rs64() {
  s64 a;
  scanf("%" SCNd64, &a);
  return a;
}

static inline void wi(int a) {
  printf("%d", a);
}

static inline void wu64(u64 a) {
  printf("%" PRIu64, a);
}

static inline void ws64(s64 a) {
  printf("%" PRId64, a);
}

int int_less(const void *a, const void *b) {
  return (*((const int*)a) - *((const int*)b));
}
int int_greater(const void *a, const void *b) {
  return (*((const int*)b) - *((const int*)a));
}

int main() {
    int n = ri();
    int m = ri();
    int q = ri();
    int l[m],r[m];
    FOR(i,m) l[i]=ri()-1,r[i]=ri()-1;
    int pp[q];
    int qq[q];
    FOR(i,q) pp[i]=ri()-1,qq[i]=ri()-1;
    
    int mapp[n][n]; // l,r
    FOR(i,n)FOR(j,n)mapp[i][j]=0;
    FOR(i,m) mapp[l[i]][r[i]]++;
    int summ[n][n]; // l,r
    FOR(i,n)FOR(j,n)summ[i][j]=0;
    FOR(i,n) { // r
        int cur = mapp[n-1][i];
        if (i)
            summ[n-1][i]=cur+summ[n-1][i-1];
        else summ[n-1][i]=cur;
        for (int j = n-2; j >=0; j--) { // l
            cur += mapp[j][i];
            if (i)
                summ[j][i]=cur+summ[j][i-1];
            else summ[j][i]=cur;
        }
    }
    
    FOR(i,q) {
        printf("%d\n", summ[pp[i]][qq[i]]);
    }
    
  return 0;
}


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

int Menseki(int _x, int _y) {
	return _x * _y;
}

int Syuukai(int _x, int _y) {
	return 2 * (_x+_y);
}

int main() {

	int x, y, a, b;
	cin >> x >> y;

	a = Menseki(x, y);
	b = Syuukai(x, y);

	cout << a << " " << b << endl;

	//system("pause");
	return 0;
}


Measured memory_bytes: 3076
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		if(a==1)a=14;
		if(b==1)b=14;
		
		if(a>b)System.out.println("Alice");
		if(a<b)System.out.println("Bob");
		if(a==b)System.out.println("Draw");
	
	}

}


Measured memory_bytes: 23380
#include <bits/stdc++.h>
#define inf 1000000007
#define N 100007
using namespace std;

int a[N];
int b[N];
int c[N];
int n;
long long mem[N][3];

long long dp(int i, int j)
{
    if(i >= n)
        return 0;
    if(mem[i][j] != -1)
        return mem[i][j];
    long long ans = 0;
    for(int k = 0;k < 3;k++)
    {
        if(k == 0 && k != j)
        {
            long long val = a[i] + dp(i + 1, k);
            ans = max(ans, val);
        }
        if(k == 1 && k != j)
        {
            long long val = b[i] + dp(i + 1, k);
            ans = max(ans, val);
        }
        if(k == 2 && k != j)
        {
            long long val = c[i] + dp(i + 1, k);
            ans = max(ans, val);
        }
    }
    mem[i][j] = ans;
    return ans;
}

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> n;
    for(int i = 0;i < n;i++)
        cin >> a[i] >> b[i] >> c[i];
    memset(mem, -1, sizeof(mem));
    long long val1 = dp(0, 0);
    long long val2 = dp(0, 1);
    long long val3 = dp(0, 2);
    long long ans = max(val1, val2);
    ans = max(ans, val3);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 14868
n,m=map(int,input().split())
h=list(map(int,input().split()))
j=[]
make=[]
for i in range(m):
    j.append(list(map(int,input().split())))
for i in j:
    if h[i[0]-1]==h[i[1]-1]:
        make.append(i[0]-1)
        make.append(i[1]-1)
    else:
        if h[i[0]-1]<h[i[1]-1]:
            make.append(i[0]-1)
        else:
            make.append(i[1]-1)
print(n-len(set(make)))

Measured memory_bytes: 37912
import java.util.*;

class Main {
    final Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
        long a = sc.nextLong();
        long b = sc.nextLong();
        long c = sc.nextLong();
        long k = sc.nextLong();

        long ans = 0;
        if (k < a) {
            ans = k;
        } else if (k < a + b) {
            ans = a;
        } else if (k < a + b + c) {
            ans = 2*a + b - k;
        } else {
            ans = a - c;
        }
        System.out.println(ans);
    }
}



Measured memory_bytes: 35764
#include<bits/stdc++.h>
using namespace std;
int main(){
  char a[3],b[3];
  for(int i=0;i<3;i++){
      cin >> a[i];
  }
  for(int i=0;i<3;i++){
      cin >> b[i];
  }
  int count = 0;
  for(int i=0;i<3;i++){
      if(a[i]==b[i]){
        count++;
      }
  }
  cout << count ;
  return 0;
}


Measured memory_bytes: 256
H, W, K = map(int, input().split())
cc = [list(input()) for _ in range(H)]
c = [c[:] for c in [[''] * W] * H]
ans = 0
for h in range(2**H):
    for w in range(2**W):
        for i in range(H):
            for j in range(W):
                 c[i][j] = cc[i][j]            
        for i in range(H):
            if ((h >> i) & 1):
                for jj in range(W):
                    c[i][jj] = "!"
        for j in range(W):
            if ((w >> j) & 1):
                for ii in range(H):
                    c[ii][j] = "!"
        black = 0
        for i in range(H):
            for j in range(W):
                 if c[i][j] == '#':
                    black += 1
        if black == K:
            ans += 1
print(ans)

Measured memory_bytes: 9244
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,ans=0;
    string a,b,c;
    cin>>n>>a>>b>>c;
    for(int i=0;i<n;i++)
    {
        if(a[i]!=b[i]&&b[i]!=c[i]&&a[i]!=c[i]) ans+=2;
        else if(a[i]==b[i]&&b[i]==c[i]) ans+=0;
        else ans+=1;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array


class UnionFind(object):

    def __init__(self, number_of_nodes, typecode="L"):
        self.typecode = typecode
        self.par = array.array(typecode, range(number_of_nodes))
        self.rank = array.array(typecode, (0 for i in range(number_of_nodes)))

    def root(self, node):
        if self.par[node] == node:
            return node
        else:
            r = self.root(self.par[node])
            self.par[node] = r
            return r

    def in_the_same_set(self, node1, node2):
        return self.root(node1) == self.root(node2)

    def unite(self, node1, node2):
        x = self.root(node1)
        y = self.root(node2)
        if x == y:
            pass
        elif self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1


def main():
    n, m = map(int, input().split())
    uf = UnionFind(n, "I")
    for _ in range(m):
        a, b = map(lambda x: int(x) - 1, input().split())
        uf.unite(a, b)
    city_representatives = set()
    num_cities_and_villages = 0
    for i in range(n):
        rep = uf.root(i)
        if i == rep:
            num_cities_and_villages += 1
        else:
            city_representatives.add(rep)
    num_cities = len(city_representatives)
    answer = abs(num_cities_and_villages - 2 * num_cities)
    print(answer)


if __name__ == '__main__':
    main()

Measured memory_bytes: 7908
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <queue>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int a,b; cin >> a >> b;
	cout << (a+b-1)/b << endl;
}

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

int main() {
  long double N,ans=0;
  cin>>N;
  vector<long double> a(N);
  for(int i=0;i<N;i++){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  for(int i=0;i<N-1;i++){
    a[i+1]=(a[i]+a[i+1])/2;
  }
  cout<<a[N-1];
  

}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <random>
using namespace std; typedef unsigned long long _ulong; typedef long long int lint; typedef pair<lint, lint> plint; typedef pair<double long, double long> pld;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define endk '\n'
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; }
const lint mod = 1e9 + 7, INF = 1e18;
lint dx[8] = { 0, -1, 1, 0, 1, -1, 1, -1 }, dy[8] = { 1, 0, 0, -1, -1, -1, 1, 1 };

template< typename T >
struct BinaryIndexedTree {
	vector< T > data;

	BinaryIndexedTree(int sz) {
		data.assign(++sz, 0);
	}

	T sum(int k) {
		T ret = 0;
		for (++k; k > 0; k -= k & -k) ret += data[k];
		return (ret);
	}

	void add(int k, T x) {
		for (++k; k < data.size(); k += k & -k) data[k] += x;
	}
};

lint N, K, arr[200000];
lint sums[200001];
set<lint> st;
map<lint, int> to_idx;
int main() {
	cin >> N >> K;
	REP(i, N) {
		cin >> arr[i]; arr[i] -= K;
	}
	REP(i, N) {
		sums[i + 1] = sums[i] + arr[i];
	}
	REP(i, N + 1) st.insert(sums[i]);
	lint idx = 0;
	for (auto itr : st) {
		to_idx[itr] = idx;
		idx++;
	}

	BinaryIndexedTree<lint> tree(N + 1);
	lint ans = 0;
	REP(i, N + 1) {
		ans += tree.sum(to_idx[sums[i]]);
		tree.add(to_idx[sums[i]], 1);
	}
	cout << ans << endk;
}	

Measured memory_bytes: 29836
n, k = map(int, input().split())
s = input()
s_list = list(s)
if s_list[k-1] == "A":
	s_list[k-1] = "a"
elif s_list[k-1] == "B":
	s_list[k-1] = "b"
elif s_list[k-1] == "C":
	s_list[k-1] = "c"
s_change = "".join(s_list)
print(s_change)

Measured memory_bytes: 3060
/*
Author : Hocky Yudhiono
5/31/2020 7:17:36 PM

1. You can sort the query if offline!
2. Don't bring the dp remaining state when dfsing on DP on Tree.
3. Try to reverse (Think from the back) if you stuck.
4. Be careful when submitting Div. 2 D-F, dont waste it on stupid WAs.
5. Try to reduce a problem
*/

#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <cstdio>
#include <limits>
#include <string>
#include <vector>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;

typedef long long LL;
typedef long long ll;
typedef long double LD;
typedef vector<int> vi;
typedef pair<LL,LL> PLL;
typedef pair<LL,int> PLI;
typedef pair<int,int> PII;
typedef pair<int,int> pii;
typedef vector<vector<LL>> VVL;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define popf pop_front
#define pf push_front
#define popb pop_back
#define mp make_pair
#define pb push_back
#define remove erase
#define fi first
#define se second

//If the time limit is strict, try not to use long double

//Remember to undefine if the problem is interactive
#define endl '\n'
#define DEBUG(X) cout << ">>> DEBUG(" << __LINE__ << ") " << #X << " = " << (X) << endl

const double EPS = 1e-9;
const int INFMEM = 63;
const int INF = 1061109567;
const LL LINF = 4557430888798830399LL;
const double DINF = numeric_limits<double>::infinity();
const LL MOD = 1000000007;
const int dx[8] = {0,0,1,-1,1,-1,1,-1};
const int dy[8] = {1,-1,0,0,1,-1,-1,1};
// Do dir^1 to get reverse direction
const char dch[4] = {'R','L','D','U'};
// const string ds[8] = {"E","W","S","N","SE","NW","SW","NE"};
const double PI = 3.141592653589793;

inline void open(string a){
    freopen((a+".in").c_str(),"r",stdin);
    freopen((a+".out").c_str(),"w",stdout);
}

inline void fasterios(){
    //Do not use if interactive
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
}

LL n;
vector <PLL> segt;

bool cmp(PLL a, PLL b){
    if(a.se != b.se) return a.se > b.se;
    return a.fi < b.fi;
}

int main(){
    cin >> n;
    segt.resize(n);
    for(int i = 0;i < n;i++) cin >> segt[i].fi >> segt[i].se;
    sort(segt.begin(),segt.end());
    if(n%2 == 1){
        PLL mx;
        mx.fi = segt[n/2].fi;
        sort(segt.begin(),segt.end(),cmp);
        mx.se = segt[n/2].se;
        cout << mx.se-mx.fi+1 << endl;
    }else{
        PLL st, ed;
        st.fi = segt[(n-1)/2].fi; ed.fi = segt[(n/2)].fi;
        sort(segt.begin(),segt.end(),cmp);
        ed.se = segt[(n-1)/2].se; st.se = segt[(n/2)].se;
        // cout << st.fi << " " << st.se << " " << ed.fi << " " << ed.se << endl;
        cout << (st.se+ed.se)-(st.fi+ed.fi)+1 << endl;

    }
    return 0;
}

Measured memory_bytes: 6364
package main

import (
	"fmt"
	"math"
)

func main() {
	var n, k int
	fmt.Scan(&n, &k)

	ans := 0.0
	for i := 1; i <= n; i++ {
		cnt := 0.0
		for tmp := i; tmp < k; {
			tmp *= 2
			cnt++
		}
		ans += (1 / float64(n)) * math.Pow(0.5, cnt)
	}

	fmt.Println(ans)
}


Measured memory_bytes: 512
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main (String[] args) {
		Scanner scan = new Scanner(System.in);
		ArrayList<Integer> color = new ArrayList<Integer>();
		for(int i=0; i<3; i++) {
			int cl = scan.nextInt();
			if(!color.contains(cl))color.add(cl);
		}
		System.out.println(color.size());
 	}

}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/detail/standard_policies.hpp>
#define ll  long long 
#define ull unsigned long long int
#define boost ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL)
#define vi vector<int>
#define P push_back
#define F first
#define S second
#define debug(x) cout<<x<<" "
#define pi vector<pair<int,int> >
#define all(a) a.begin(),a.end()
#define int ll
using namespace std;
// using namespace __gnu_pbds;
// typedef tree <int, null_type,less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
ll const mod=1e9+7;
int powi(int i,int b){
    int res=1;
    while(b){
        if(b&1)res*=i,res%=mod;
        b>>=1;
        i*=i;
        i%=mod;
    }
    return res;
}
// map<int,int> m;
// ll fact(int n){
// 	//if(n==0)return 0;
// 	if(n<=1)return 1;
// 	if(m[n]!=0)return m[n];
// 	return m[n]=(n*fact(n-1))%mod;
//}
// int ncr(int n,int r){
//     int h=fact(n);
//     int v=fact(r);
//     int j=fact(n-r);
//     v*=j;
//     v%=mod;
//     v=powi(v,mod-2);
//     return (h*v)%mod;
// }
// vi ar(2000000);
// vi sz(2000000);
// int root(int a){
//     if(ar[a]==a)return a;
//     return ar[a]=root(ar[a]);
// }
// int merge(int a,int b){
//     int h=root(a),j=root(b);
//     int ans=sz[h]*sz[j];
//     sz[j]+=sz[h];
//     if(h!=j){
//         ar[h]=j;
//     }
//     return ans;
// }
bool cmp(pair<int,pair<int,string>> &a1,pair<int,pair<int,string>> &a2){
    if(a1.S.S<a2.S.S){
        return 1;
    }
    if(a1.S.S>a2.S.S){
        return 0;
    }
    if(a1.S.F>a2.S.F){
        return 1;
    }
    return 0;
}
void solve(){
    int n;
    cin>>n;
    vector<pair<int,pair<int,string>>> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i].S.S>>a[i].S.F;
        a[i].F=i;
    }
    sort(all(a),cmp);
    for(int i=0;i<n;i++){
        cout<<a[i].F+1<<"\n";
    }
}
signed main(){
    boost;
    int t=1;
    //cin>>t;
    for(int _=1;_<=t;_++){
        //cout<<"Case #"<<_<<": ";
        solve();
        cout<<"\n";
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <string>
#include <sstream>
#include <cstdio>

int main()
{
	std::string s;
	while(std::getline(std::cin,s)){
		std::stack<double> stack;
		std::stringstream ss(s);
		while(ss >> s){
			if(!(s == "+" || s == "-" || s == "*" || s == "/")){
				stack.push(std::stoi(s));
			} else {
				auto x1 = stack.top(); stack.pop();
				auto x2 = stack.top(); stack.pop();
			
				switch(s[0]){
					case '+':
						stack.push(x2 + x1);
						break;
					case '-':
						stack.push(x2 - x1);
						break;
					case '*':
						stack.push(x2 * x1);
						break;
					case '/':
						stack.push(x2 / x1);
						break;
				}
			}
		}
		//std::cout << stack.top() << std::endl;
		std::printf("%.6f\n",stack.top());
	}
}

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

int main(){
  string S;
  cin>>S;
  if((S.at(0)==S.at(1)&&S.at(1)==S.at(2))||(S.at(1)==S.at(2)&&S.at(2)==S.at(3))){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,a=0,e=0;
    cin>>t;
    int arr[t];
    for(int i=0;i<t;i++)
    {
        scanf("%d",&arr[i]);
    }
    for(int i=0;i<t;i++)
    {
        if(arr[i]%2==0)
        {
            e++;
            if(arr[i]%3==0 || arr[i]%5==0)
            {
                a++;
            }
        }

    }
    if(e==a)
    {
        cout<<"APPROVED"<<endl;
    }
    else
    {
        cout<<"DENIED"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
static const int MAX = 200000;
int main(){
    int n;
    int maxv = -2000000000;
    int minv;
    int val;
    cin>>n;
    for(int i=0;i<n;i++){
        if(i==0)
            cin>>minv;
        else{
            cin>>val;
            maxv = max(maxv,val-minv);
            minv = min(val,minv);
        }
    }
    cout<<maxv<<endl;
    return 0;
}


Measured memory_bytes: 3104
#include<bits/stdc++.h>
using namespace std;
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
const int MOD = 1000000007;

void solve() {
  string s;
  cin >> s;
  // s[0] = '0' のとき
  int cnt1 = 0;
  rep(i,s.length()) {
    if (i % 2 != (s[i] - '0')) cnt1++;
  }
  // s[0] = '1' のとき
  int cnt2 = 0;
  rep(i,s.length()) {
    if (i % 2 == (s[i] - '0')) cnt2++;
  }
  cout << min(cnt1, cnt2) << endl;
}

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

Measured memory_bytes: 3760
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <stack>
#include <bitset>
#include <utility>
// #include <numeric>
using namespace std;



typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vint;
typedef vector<vector<ll>> vvint;
typedef pair<ll,ll> pint;
typedef vector<pint> vpint;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define INT_MAX 2147483647
#define LLONG_MAX 9223372036854775807
#define vmax(vec) *max_element(vec.begin(), vec.end())
#define vmin(vec) *min_element(vec.begin(), vec.end())
#define vsort(vec) sort(vec.begin(), vec.end())
#define vsortgr(vec) sort(vec.begin(), vec.end(), greater<ll>())


typedef struct{
  ll pos;
  ll depth;
} data;
//
// struct Node{
//
// }



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

// ll X,Y,Z,K;
// ll pmax = 30000000000;
// vint A,B,C;




// int binary_search(int key){
//  //isOKを満たす要素のうち最小のインデックスを返す。（要ソート）
//   int left = -1;
//   int right = N;
//
//   while(right - left > 1){
//     int mid = left + (right - left)/2;
//
//     if(isOK(mid, key)) right=mid;
//     else left=mid;
//   }
//
//   return right;
// }

// ll gcd(ll m, ll n){
//   if(m<n) swap(m,n);
//   if(n==0) return m;
//   return gcd(n, m%n);
// }



int main() {

  ll N;
  cin >> N;
  vector<string> s(N);

  ll mid = 0;
  ll x=0;ll y=0; ll z=0;
  rep(i,N){
    cin>>s[i];
    rep(j, s[i].size()-1){
      if(s[i].substr(j,2)=="AB"){
        mid++;
      }
    }
    if(s[i].front() == 'B' && s[i].back() == 'A') z++;
    else if(s[i].front() == 'B') x++;
    else if(s[i].back() == 'A') y++;
  }

  ll ans = mid;
  if(z>0){
    ans += (z-1+(int)(x>0)+(int)(y>0)+max(min(x-1,y-1), 0ll));
  }else{
    ans += min(x,y);
  }

  cout << ans << endl;

}

















//


Measured memory_bytes: 768
import java.io.*;
import java.util.Scanner;


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int[] abcde = new int[5];
		for (int i = 0; i < 5; i++) {
			abcde[i] = sc.nextInt();
		}
		int k = sc.nextInt();

		int cnt = 0;
		for (int i = 0; i < 5; i++) {
			for (int j = i + 1; j < 5; j++) {
				if (abcde[j] - abcde[i] <= k) {
					cnt++;
				}
			}
		}

		if (cnt < 10) {
			pr.println(":(");
		} else {
			pr.println("Yay!");
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);
			
		solve();
			
		pr.close();
		sc.close();
	}

	static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
}


Measured memory_bytes: 21844
#include<cstdio>

using namespace std;

int main() {

    int x[10000];
    int n;

    for(int i = 0; ; i++) {
        scanf("%d" ,&x[i]);
        if(x[i] == 0) {
            n = i + 1;
            break;
        }
    }

    for(int i = 0; i < n - 1; i++) {
        printf("Case %d: %d\n", i + 1, x[i]);
    }

    return 0;

}


Measured memory_bytes: 2652
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
static class Program{
	const int mod=1000000007;
	static void Main(){
		Sc sc=new Sc();
		string s=Convert.ToString(sc.L,2);
		int n=s.Length;
		s=" "+s;
		long[,] dp=new long[n+1,3];
		dp[0,0]=1;
		for(int i=1;i<=n;i++){
			if(s[i]=='0'){
				dp[i,0]=(dp[i-1,0]+dp[i-1,1])%mod;
				dp[i,1]=dp[i-1,1]%mod;
				dp[i,2]=(dp[i-1,1]+dp[i-1,2]*3)%mod;
			}
			else{
				dp[i,0]=dp[i-1,0]%mod;
				dp[i,1]=(dp[i-1,0]+dp[i-1,1])%mod;
				dp[i,2]=(dp[i-1,1]*2+dp[i-1,2]*3)%mod;
			}
		}
		Console.WriteLine("{0}",(dp[n,0]+dp[n,1]+dp[n,2])%mod);
	}
}

public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()).Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()).Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
}


Measured memory_bytes: 13268
#include <map>
#include <set>
#include <cmath>
#include <stack>
#include <queue>
#include <cstdio>
#include <math.h>
#include <vector>
#include <bitset>
#include <iomanip>
#include <sstream>
#include <cstring>
#include <iostream>
#include <string.h>
#include <algorithm>
using namespace std;
#define PI 3.14159265
#define INF	9999999999
#define pb push_back
#define FOR(i,f_limit) for(long long int i=0;i<f_limit;i++)
#define FR(i,s_limit,f_limit) for(long long int i=s_limit;i<f_limit;i++)
#define nearestPowerOfTwo(S) ((int)pow(2.0, (int)((log((double)S) / log(2.0)) + 0.5)))
typedef long long int ll; 
typedef vector<ll> vi;
typedef vector<vi> vii;


int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll a,b;
	cin>>a>>b;
	cout<<(a-1)*(b-1);
	return 0;
}

Measured memory_bytes: 256
x, n = map(int, input().split())
p = list(map(int, input().split()))

if n == 0:
    ans = x
else:
    ans = float('inf')

d = float('inf')

for i in range(n+2):
    tmpx = x + 1 + n//2 - i
    if not tmpx in p:
        tmpd = abs(x -tmpx) 
        if d >= tmpd:
            d = tmpd
            if ans >= tmpx:
                ans = tmpx

print(ans)




Measured memory_bytes: 9212
H, W = map(int, input("").split(" "))

grid = []
blacks = []
for i in range(H):
    row = list(input(""))
    grid.append(row)

    for idx, r in enumerate(row):
        if r == "#":
            blacks.append((i, idx))

c = 0
while len(blacks) > 0:
    c += 1

    new_blacks = []
    for b in blacks:
        top = b[0] - 1
        bottom = b[0] + 1
        left = b[1] - 1
        right = b[1] + 1

        if top >= 0:
            if grid[top][b[1]] == ".":
                grid[top][b[1]] = "#"
                new_blacks.append((top, b[1]))
        if bottom < H:
            if grid[bottom][b[1]] == ".":
                grid[bottom][b[1]] = "#"
                new_blacks.append((bottom, b[1]))
        if left >= 0:
            if grid[b[0]][left] == ".":
                grid[b[0]][left] = "#"
                new_blacks.append((b[0], left))
        if right < W:
            if grid[b[0]][right] == ".":
                grid[b[0]][right] = "#"
                new_blacks.append((b[0], right))

    blacks = new_blacks

print(c - 1)


Measured memory_bytes: 132708
#include <stdio.h>

int main(void)
{
	int K,i,j=0,count=9;
	long long a[100005]={1,2,3,4,5,6,7,8,9};
	scanf("%d",&K);
	for(i=0;count<K;i++){
		if(a[i]%10!=0){
			a[count]=(long long)a[i]*10+a[i]%10-1;
			count++;
		}
		a[count]=(long long)a[i]*10+a[i]%10;
		count++;
		if(a[i]%10!=9){
			a[count]=(long long)a[i]*10+a[i]%10+1;
			count++;
		}
	}
	printf("%lld",a[K-1]);
	return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pii pair<ll, ll>
#define SZ(x) ((int)(x).size())
#define endl "\n"
#define vvi vector<vector<int> >
#define vvl vector<vector<long long> >
ll mod = 1e9 + 7;
const double pi = acos(-1.0);

ll c[2001][2001];

void combina(){
        for (int i=0;i<=2000;i++)
        for (int j=0;j<=i;j++)
        {
            if (j==i||j==0)
                c[i][j]=1;
            else
            c[i][j]=c[i-1][j-1]+c[i-1][j];
            c[i][j]%=mod;
        }
        //return c[i][j];
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cout<<fixed;
    cout.precision(12);
    ll n;
    cin>>n;
    combina();
    ll r=1, an = 0;
    while((n-2*r-1)>=0){
        ll x = n-2*r-1;
        an = (an + c[x][r-1])%mod;
        r++;
    }
    cout<<an<<endl;
    return 0;
}


Measured memory_bytes: 26240
#include<bits/stdc++.h>
using namespace std;
int main()
{
	char a,s,d,f,g,h,j,k,l;
	cin>>a>>s>>d;
	cin>>f>>g>>h;
	cin>>j>>k>>l;
	cout<<a<<g<<l<<endl;
	return 0;
 } 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int, nuint_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set; 
#define int long long
#define MOD 1000000007
#define what_is(x) cerr << #x << " is " << x << endl;
#define loop(i,a,n) for(int i=a;i<n;i++)
#define pb emplace_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, szof(x))
#define sortall(x) sort(aint(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626 
 
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef pair<int, int> pt;

// int arr[2][2]={{0,1},{1,0}};
signed main() {

	fastio();
	//#define LOCAL_DEFINE	
	#ifdef LOCAL_DEFINE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
		//https://zhuhan0.blogspot.com/2017/09/leetcode-425-word-squares.html
		//https://yzygitzh.github.io/algorithm/2018/11/09/leetcode-summary.html
		//https://beginnersbook.com/2015/03/why-dont-we-call-run-method-directly-why-call-start-method/
		//https://leetcode.com/problems/lfu-cache/
	// int n,k;
	// cin>>n>>k;
	// vector<int> arr(n);
 // 	for(int i=0;i<n;i++)
 // 	{
 // 		cin>>arr[i];
 // 	}
 // 	set<int> hash;
 // 	int ans=0;
 // 	bool flag=false;
 // 	for(int i=0;i<k;i++)
 // 	{
 // 		if(hash.lower_bound(arr[i])!=hash.end())
 // 		{
 // 			flag=true;
 // 		}
 // 		hash.insert(arr[i]);
 // 	}
 // 	if(flag)
 // 	{
 // 		ans++;
 // 	}
 // 	bool flag1=false;
 // 	for(int i=k;i<n;i++)
 // 	{
 // 		cout<<ans<<endl;
 // 		hash.erase(arr[i-k]);
 // 		if(hash.lower_bound(arr[i])!=hash.end())
 // 		{
 // 			ans++;
 // 		}else if(hash.lower_bound(arr[i-k])!=hash.begin())
 // 		{
 // 			ans++;
 // 		}else{
 // 			flag1=true;
 // 		}

 // 		hash.insert(arr[i]);	
 // 	}
 // 	if(!flag || !flag1)
 // 		ans++;
 // 	cout<<ans;

	int n,m;
	cin>>n>>m;
	vector<int> cost(m);
	vector<int> box(m);
	for(int i=0;i<m;i++)
	{
		int a,b;
		cin>>a>>b;
		cost[i]=a;
		int mask=0;
		for(int j=0;j<b;j++)
		{
			int x;
			cin>>x;
			x--;
			mask=mask|(1LL<<x);
		}

		box[i]=mask;
	}
	vector<vector<int>> dp(m+1,vector<int>((1LL<<n),INT_MAX));
	for(int i=0;i<=m;i++)
	{
		dp[i][0]=0;
	}
	for(int i=0;i<m;i++)
	{
		for(int j=0;j<(1LL<<n);j++)
		{
			dp[i+1][j]=min(dp[i][j],dp[i+1][j]);
			if(dp[i][j]!=INT_MAX)
			{
				int res=(dp[i][j]+cost[i]);
				//cout<<res<<" ";
				//cout<<(j|box[i])<<endl;
				if((j|box[i])==(j))
					continue;
				dp[i+1][(j|(box[i]))]=min(res,dp[i+1][(j|(box[i]))]);
				//cout<<dp[i+1][(j|box[i])]<<endl;
			}
			
			//cout<<dp[i][j]<<" ";

		}
	//	cout<<endl;
	}

	if(dp[m][((1LL<<n)-1)]==INT_MAX)
	{
		cout<<-1;
	}
	else
			cout<<dp[m][((1LL<<n)-1)];
 	return 0;
}
 

Measured memory_bytes: 32384
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<stack>
#include<functional>
#include<list>
#include<map>
#include<unordered_map>
#define int long long
using namespace std;

signed main() {
	int a;
	cin >> a;
	int s = 0;
	for (int b = 0; b < a; b++) {
		int c; scanf("%lld", &c);
		bool k = true;
		for (int d = 1; d*d <= c; d++) {
			if ((c - d) % (2 * d + 1) == 0)k = false;
		}
		if (k)s++;
	}
	cout << s << endl;
}

Measured memory_bytes: 3088