akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string S;
    cin >> S;
    if (S[2] == S[3] && S[4] == S[5]) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    

    return 0;
}

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

using namespace std;
using LL = long long;
using P = pair<int, int>;
using Tapris = tuple<int, int, int>;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e15;
const int MOD = 1e9 + 7;

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

/*************** using variables ***************/
int n;
vector<int> c, w;
int ruiseki[1005];
bool dp[1005][1005];

/**********************************************/

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

    cin >> n;
    c.resize(n);
    w.resize(n);
    REP(i, n) cin >> c[i] >> w[i];

    ruiseki[0] = w[0];
    FOR(i, 1, n) ruiseki[i] = ruiseki[i-1] + w[i];
    
    REP(i, n) REP(j, n) dp[i][j] = false;
    REP(i, n) dp[i][i] = true;

    for(int len = 2; len <= n; len++){
        REP(l, n){
            int r = l + len - 1;
            if(r >= n) break;
            if(dp[l][r-1]){
                int weight = ruiseki[r-1];
                if(l != 0) weight -= ruiseki[l-1];
                dp[l][r] |= weight <= c[r];
            }
            if(dp[l+1][r]){
                int weight = ruiseki[r] - ruiseki[l];
                dp[l][r] |= weight <= c[l];
            }
        }
    }

    vector<int> ans(n, INF);
    ans[0] = 1; // ans[n] := n番目までで下にいる最低人数

    for(int r = 1; r < n; r++){
        ans[r] = ans[r-1] + 1;
        for(int l = 0; l < r; l++){
            if(dp[l][r]){
                if(l == 0) ans[r] = min(ans[r], 1);
                else ans[r] = min(ans[r], ans[l-1] + 1);
            }
        }
    }

    cout << ans[n-1] << endl;
}



Measured memory_bytes: 4208
import java.util.Scanner;

public class Main {
	public static int count = 0;
	
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int length = scanner.nextInt();
		
		Card[] array = new Card[length];
		
		for (int i=0; i<length; i++) {
			char[] temp = scanner.next("[SHCD][0-9]").toCharArray();
			array[i] = new Card(temp[0], Character.getNumericValue(temp[1]));
		}
		scanner.close();
		
		Card[] orgArray = array.clone();
		Card[] array2 = array.clone();
		
		bubbleSort(array, length);
		printArray(array);
		System.out.println(compareArray(orgArray, array));
		
		selectionSort(array2, length);
		printArray(array2);
		System.out.println(compareArray(orgArray, array2));

		
	}
	
	public static void selectionSort(Card[] array, int length) {
		// Variable i stands for the smallest value at this moment.
		// j to traverse the remain items, identify the position of the smallest value in the remain queue.
		for (int i=0; i<length; i++) {
			int mini = i;
			for (int j=i+1; j<length; j++) {
				if (array[j].getValue() < array[mini].getValue()) {
					mini = j;
				}
			}
			// Swap mini and i if mini!=i
			if (mini != i) {
				Card tmpCard = array[mini];
				array[mini] = array[i];
				array[i] = tmpCard;
				count++;
			}
		}
	}
	
	public static void bubbleSort(Card[] array, int length) {
		// Variable i stands for the smallest value at this moment.
		// j to traverse the remain items, smallest bubbled to the position i.
		for (int i=0; i<length; i++) {
			for (int j=length-1; j>i; j--) {
				if (array[j].getValue() < array[j-1].getValue()) {
					// Switch the value of array[j] and array[j-1]
					Card tmpCard = array[j];
					array[j] = array[j-1];
					array[j-1] = tmpCard;
					count++;
				}
			}
		}
	}
	
	public static void printArray(Card[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i>0) System.out.print(" ");
			System.out.print(array[i]);
		}
		System.out.print("\n");
	}
	
	public static String compareArray(Card[] org, Card[] sorted) {
		int length = org.length;
		for (int i=0; i<length; i++) {
			for (int j=i+1; j<length; j++) {
				for (int a=0; a<length; a++) {
					for (int b=a+1; b<length; b++) {
						if (org[i].getValue()==org[j].getValue() 
								&& sorted[a].getValue()==sorted[b].getValue() 
								&& org[i].getValue()==sorted[b].getValue() 
								&& org[i].getSuit()==sorted[b].getSuit() 
								&& org[j].getSuit()==sorted[a].getSuit())
							return "Not stable";
					}
				}
			}
		}
		return "Stable";
	}
	
}

class Card {
	private char suit;
	private int value;
	
	public Card(char suit, int value) {
		this.suit = suit;
		this.value = value;
	}
	
	public char getSuit() {
		return suit;
	}
	
	public int getValue() {
		return value;
	}
	
	public void setSuit(char suit) {
		this.suit = suit;
	}
	
	public void setValue(int value) {
		this.value = value;
	}
	
	@Override
	public String toString() {
		return "" + this.suit + this.value;
	}
}


Measured memory_bytes: 26692
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
	cout << fixed << setprecision(10);
	int n;
	cin >> n;
	vector<int> v(n);
	rep(i,n) cin >> v[i];
	int i=0;
	int cnt = 0;
	int now = 1;
	while(i<n){
		if(v[i]==now){
			now ++;
			i++;
			continue;
		}
		else{
			cnt++;
			i++;
		}
	}
	if(n==1 && v[0]==1) cout << 0 << endl;
	else if(now == 1 ){
		cout << -1 << endl;
	}else{
		cout << cnt << endl;
	}
	return 0;
}

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

namespace ABC178B
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] abcd = Console.ReadLine().Split(' ');
            long a = long.Parse(abcd[0]);
            long b = long.Parse(abcd[1]);
            long c = long.Parse(abcd[2]);
            long d = long.Parse(abcd[3]);
            long ac = a * c;
            long ad = a * d;
            long bc = b * c;
            long bd = b * d;
            long max1 = Math.Max(ac, ad);
            long max2 = Math.Max(bc, bd);
            long max3 = Math.Max(max1, max2);
            Console.WriteLine(max3);
        }
    }
}


Measured memory_bytes: 27496
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

bool check(vector<long long int> &A) {
    int N = A.size();
    for (int i = 0; i < N; i++) {
        if (A[i] >= N) return false;
    }
    return true;
}

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

    long long int ans = 0;
    while(!check(A)) {

        vector<long long int> D;
        long long int cnt = 0;
        for (int i = 0; i < N; i++) {
            long long int d = (A[i] - 1 - (N - 1)) / N + 1;
            if (A[i] < N) d = 0;
            cnt += d;
            A[i] -= d * N;
            D.push_back(d);
        }

        for (int i = 0; i < N; i++) {
            A[i] += cnt - D[i];
        }
        ans += cnt;
    }
    cout << ans << endl;
    return 0;
}

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

const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;

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;
}

int main(){
    string s;
    cin >> s;

    if((s[2] == s[3]) && (s[4] == s[5])){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


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

int main() {
	string s,y,m,d;
	cin >> s;
	y = s[0] + s[1] + s[2] + s[3];
	m = s.substr(5,2);
	d = s[8] + s[9];
	int Y = atoi(y.c_str());
	int M = atoi(m.c_str());
	int D = atoi(d.c_str());
	
	if (M >= 5) {
		cout << "TBD" << endl;
		return 0;
	}
	if (M <= 4) {
		cout << "Heisei" << endl;
		return 0;
	}

	return 0;
}

Measured memory_bytes: 256
import collections

s = input()
q = int(input())
rev = 0
ans = collections.deque(['S'])

for _ in range(q):
  query = list(input().split())
  if int(query[0]) == 1:
    rev += 1
  else:
    if int(query[1]) == 1:      # 先頭
      if rev%2 == 0:
        ans.appendleft(query[2])
      else:
        ans.append(query[2])
    else:                       # 末尾
      if rev%2 == 0:
        ans.append(query[2])
      else:
        ans.appendleft(query[2])

ans = ''.join(ans)
mes = ans.replace("S", s)
if rev%2 == 0:
  print(mes)
else:
  print(mes[::-1])



Measured memory_bytes: 6900
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define pi pair<int,int>
#define ll long long
#define rep(i,a,b) for(int i=int(a); i<=int(b);i++)
#define repv(vec,v) for(v=(vec).begin(); v!=(vec).end();v++)
#define sz(vec) (int)(vec).size()
#define PB push_back
#define F first()
#define S second()


int main(){
	double l;
	cin >> l;
	double x = l/3.0;

	cout << setprecision(15) << x*x*x;
	return 0;
}


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

int main(){
  long N;
  cin  >> N;
  double n=N;
  
  cout << fixed << setprecision(8);
  
  if(N%2 == 0 ){
    cout << 0.5 << endl;
  }
  else{
    cout << (n+1)/(2*n) << endl;
  }
}




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

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)

using namespace std;


int main(){
  int Dpower;
  cin >> Dpower;
  int n;
  cin >> n;
  vector<int> point1;
  rep(i,n) { 
    char c; int point;
    cin >> c >> point;
    if( c == 'D' ) point1.push_back(point);
  }
  cin >> n;
  vector<int> point2;
  rep(i,n){
    string s; int point;
    cin >> s >> point;
    if( s == "DD" ) point2.push_back(point);
  }
  int maxi = 0;
  sort(point1.begin(),point1.end(),greater<int>());
  int sp = 0;
  if( ( Dpower & 1 ) && point1.size() ) {
    maxi += point1[0];
    --Dpower, ++sp;
  }
  for(int i=sp;i<point1.size();i+=2) point2.push_back(point1[i]+point1[i+1]);
  sort(point2.begin(),point2.end(),greater<int>());
  rep(i,point2.size()){
    if( Dpower <= 1 ) break;
    Dpower -= 2;
    maxi += point2[i];
  }
  cout << maxi << endl;
  return 0;
}

Measured memory_bytes: 1236
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define ARR(array) for(int i=0;i<array.size();i++)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 1e18
#define MOD 100000007
#define SIZE 10005
#define PI 	3.14159265358979323846

unsigned euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

char input(){
  char a;
  cin >> a;
  return a;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    ll one=0,two=0,four=0;
    REP(i,n){
      ll a;
      cin >> a;
      if(!(a%4))four++;
      else if(!(a%2))two++;
      else one++;
    }
    if(!two&&four+1==one) cout << "Yes" << endl;
    else cout << (one>four?"No":"Yes") << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main (void){
 int a,b;

 scanf("%d %d",&a,&b);
 
 if(a==b){
  printf("a == b\n");
 }else if(a>b){
  printf("a > b\n");
 }else{
  printf("a < b\n");
 }

 return 0;
}


Measured memory_bytes: 2032
N = input().strip() ;

arr = list ( map ( int , input().strip().split(" ") ) ) ; 

dic = {} ;
for v in arr :
	d = dic[v] if v in dic else 0;
	dic[v] = d + 1; 

Q = int ( input().strip() ) ;
s0 = sum ( arr ) ;
for zz in range( Q  ) :
	b , c = map ( int , input().strip().split(" ") ) ;
	

	if not b in dic :
		pass ;
	else :
		s0 -= b * dic[b] ;
		s0 += c * dic[b] ;

		d = dic[c] if c in dic else 0 ;
		dic[c] = dic[b] + d ;
		del dic[b] ;
	print (  s0 ) ;

Measured memory_bytes: 21068
# coding: utf-8
import sys
from bisect import bisect_left, bisect_right

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

R = ir()
target = [1200, 2800]
i = bisect_right(target, R)
answer = ['ABC', 'ARC', 'AGC'][i]
print(answer)


Measured memory_bytes: 3060
#!python3

def LI():
    return list(map(int, input().split()))

# input
S = input()


def main():
    a = 1 <= int(S[:2]) <= 12
    b = 1 <= int(S[2:]) <= 12
    
    if a and b:
        ans = "AMBIGUOUS"
    elif a:
        ans = "MMYY"
    elif b:
        ans = "YYMM"
    else:
        ans = "NA"
    
    print(ans)



if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define int long long
#define N 100010
using namespace std;
const int INF = 1LL<<55;
const int mod = (1e9)+7;
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}


bool check(string a,string b){
  for(int i=0;i<(int)a.size();i++) if(a[i]!='?' && a[i]!=b[i]) return 0;
  return 1;
}

string change(string s,string t,int idx){

  for(int i=0;i<(int)t.size();i++) s[idx+i] = t[i];
  for(int i=0;i<(int)s.size();i++) if(s[i] == '?') s[i] = 'a';
  return s;
}

signed main(){
  string s,t;
  cin>>s>>t;
  int n = s.size(),m = t.size();
  string ans = "{";
  for(int i=0;i<n;i++){
    if(i+m > n || !check(s.substr(i,m),t)) continue;
    Min(ans,change(s,t,i));
  }
  
  if(ans == "{") ans = "UNRESTORABLE";
  cout<<ans<<endl;
  return 0;
}


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

#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);

using ll = long long;

void updatetree(ll* tree,int s,int e,int ind,int i,ll val)
{
    // cout << i << " " << s << " " << e << " " << ind << " " << i << endl;
    if(s==e){
        tree[ind] = max(val,tree[ind]);
        return;
    }

    int mid = s + (e-s)/2;

    if(mid >= i){
        updatetree(tree,s,mid,2*ind,i,val);
    }

    else{
        updatetree(tree,mid+1,e,2*ind+1,i,val);
    }

    tree[ind] = max(tree[2*ind],tree[2*ind+1]);
}

ll query(ll* tree,int s,int e,int x,int y,int ind)
{
    if(x > y) return 0;
    if(x <= s && y >= e) return tree[ind];
    if(s > y || x > e) return 0;
    int mid = s + (e-s)/2;
    ll leftval = query(tree,s,mid,x,y,2*ind);
    ll rightval = query(tree,mid+1,e,x,y,2*ind+1);
    return max(leftval,rightval);
}

int main()
{
    fast
    int n;
    cin >> n;
    ll h[n];
    for(int i=0; i<n; i++){
        cin >> h[i];
    }
    ll a[n];
    for(int i=0; i<n; i++){
        cin >> a[i];
    }

    ll tree[4*n+2] = {0};
    ll res = 0;

    for(int i=0;i<n;i++){
        ll prevmax = query(tree,1,n,1,h[i]-1,1);
        // cout << i << " " << prevmax << endl;
        res = max(res,a[i]+prevmax);
        updatetree(tree,1,n,1,h[i],a[i]+prevmax);
        // for(int i=1; i<=7; i++){
        //     cout << tree[i] << " ";
        // }

        // cout << endl << endl;
    }

    cout << res;
}


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

int main()
{
    int n;
    cin >> n;
    vector<int> h(n);
    rep(i, n) cin >> h[i];
    int cnt = 0;
    int tmp = 0;
    rep(i, n - 1)
    {
        if (h[i + 1] <= h[i])
            cnt++;
        else{
            if(tmp<cnt)
                tmp = cnt;
            cnt = 0;
        }
    }
    if(tmp<cnt)
        tmp = cnt;
    cout << tmp << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
#define lli long long int
#define fop(i,m,n) for (int i=(m);i<(n);i++)
#define FOP(i,m,n) for (int i=(m)-1;i>=(n);--i)
#define test(x) cout << #x << ' ' << x << endl;
#define print(a) {\
    for (auto i : a) cout << i << ' ';\
    cout << '\n';\
}
#define eb emplace_back
#define pb push_back
#define mp make_pair 
#define mt make_tuple
#define pii pair<int,int> 
#define pdd pair<ld,ld> 
#define ld double
#define pll pair<lli,lli>
#define tiii tuple<int,int,int>
#define all(a) a.begin(), a.end()
#define X first
#define Y second
#define oset tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update>
auto SEED = chrono::steady_clock::now().time_since_epoch().count();
mt19937 rng(SEED);
const int x = 864197532, N = 50000;
const long long mod = 9223372036854775807;
const double eps = 1e-6, Pi = 3.1415926535;

int main () {
	ios::sync_with_stdio(false);
	cin.tie(0);
	lli n;
	cin >> n;
	vector <pll> v;
	for (lli i = 2; i * i <= n; ++i) {
		if (n % i == 0) {
			v.pb({i, 0});
			while (n % i == 0) {
				n /= i;
				v.back().Y++;
			}
		}
	}
	if (n > 1) v.pb({n, 1});
	int ans = 0;
	for (auto A : v) {
		int now = 1;
		while (A.Y >= now) {
			A.Y -= now;
			now++;
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 3656
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

int main(void) {
    int N;
    cin >> N;
    vector<int> A(N), B(N), C(N-1);
    for(int i=0; i<N; i++) {
        cin >> A[i];
        --A[i];
    }
    for(int i=0; i<N; i++) {
        cin >> B[i];
    }
    for(int i=0; i<N-1; i++) {
        cin >> C[i];
    }

    int ans = accumulate(B.begin(), B.end(), 0);
    for(int i=0; i<N-1; i++) {
        if(A[i+1] == A[i] + 1) {
            ans += C[A[i]];
        }
    }

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


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll INF=1e18;

int main(){
    string s,t;
    cin >> s >> t;
    ll i=0;
    while(true){
        if(i%2==0 && i/2==s.length()) break;
        if(i%2==1 && i/2==t.length()) break;
        if(i%2==0) cout << s[i/2];
        else cout << t[i/2];
        i++;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3616
using System;
using System.Linq;

namespace ABC104A
{
    class ABC104A
    {
        static void Main(string[] args)
        {
            var dg = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            var n = dg[0] - 1;
            var k = dg[1] - 1;

            Console.WriteLine(n * k);
        }
    }
}


Measured memory_bytes: 13396
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

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

    ll N, K;
    cin >> N >> K;
    vec H(N);
    Rep (i, N) {
        cin >> H[i];
    }

    sort(H.begin(), H.end());

    ll ans = 0;
    Rep (i, N-K) {
        ans += H[i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 1792
N, W = gets.split.map(&:to_i)
lists = []
N.times do
  lists << gets.split.map(&:to_i)
end
# p lists
# lists.sort_by!{|v, w| -v.to_f / w}
# p lists
dp = Array.new(W+1, -1)
dp[0] = 0
ans = 0
# binding.pry
N.times do |k|
  lists[k][1].upto(W) do |i|
    if dp[i - lists[k][1]] != -1
      if dp[i] < dp[i - lists[k][1]] + lists[k][0]
        dp[i] = dp[i - lists[k][1]] + lists[k][0]
      end
      if ans < dp[i]
        ans = dp[i]
      end
    end
  end
end
puts ans


Measured memory_bytes: 6956
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<map>
using namespace std;
#define ll long long
#define pb push_back
#define rep(i,n) for(int i=0; i<n; i++)
#define forp(i,a,b) for(int i=a;i<b;i++)
#define forn(i,a,b) for(int i=a;i>=b;i--)
#define All(x,v) for(auto x:v)
#define arrin(a,n) ll a[n]; rep(i,n) cin>>a[i]
#define vi vector<int>
#define nl "\n"
#define print(arr) All(x,arr) cout<<x<<" "; cout<<nl
#define sz(x) (int)x.size()
#define all(v) v.begin(),v.end()
#define vdsort(v) sort(v.begin(),v.end(),greater<int>())
#define F first
#define S second
#define mod 1000000007
const int MAXN=100005;
int spf[MAXN];
int gcd(int x, int y){ return y?gcd(y,x%y):x; }

void precal(){  
    spf[1] = 1; 
    for (int i=2; i<MAXN; i++)  spf[i] = i; 
    for (int i=4; i<MAXN; i+=2) spf[i] = 2; 
    for (int i=3; i*i<MAXN; i++) { 
        if (spf[i] == i) 
            for (int j=i*i; j<MAXN; j+=i) 
                if (spf[j]==j)  spf[j] = i; 
    } 
} 
vector<int> getFactorization(int x){
    vector<int> ret; 
    while (x != 1) { 
        ret.push_back(spf[x]); 
        x = x / spf[x]; 
    } 
    return ret; 
}

ll exp(ll n, ll m){
    ll a = 1;
    while (m){
        if (m & 1) a = (a * n % mod) % mod;
        m /= 2;
        n = (n*n) % mod;
    }
    return a;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    // freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
    int n,t=1;
    // cin>>t;
    while(t--){
        string s,t;
        cin>>s>>t;
        n=sz(s);
        int cnt=0;
        rep(i,n){
            cnt+=s[i]!=t[i];
        }
        cout<<cnt<<nl;
    }
    return 0;
}

Measured memory_bytes: 3428
#include<iostream>
#include<unordered_map>
#include<bitset>
#include<math.h>
#include<vector>
#include<set>
#include<algorithm>
#include<ctype.h>
#include<unordered_set>
#include<string>
#include<iomanip>
#include<queue>
#include<limits>
#include<map>
#include<stack>
#include<iterator>
#include<cstring>
 
#include<deque>
#define pi 3.141592653589793238
#include<chrono>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define MOD 1000000007
#define INF 999999999999999999 
#define pb push_back
#define ff first
#define ss second
 
#define mt make_tuple
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
 
 
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
 
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    fast;
    ll T = 1, i, j;
    
    //cin >> T;
    while (T--) {
        ll d, t , s;
        cin >> d >> t >> s;
        if (s * t >= d){
            cout << "Yes";
        }
        else{
            cout << "No";
        }
    }
    return 0;
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    if(s.size()%2==0)
    {
        string f="hi";
        int j=0;
        int c=0;
        for(int i=0;i<s.size();i++)
        {
            if(s[i]=='h'&& s[i+1]=='i')
            {
                c++;
                i++;
            }
            else
            {
                cout<<"No"<<endl;
                return 0;
            }
        }
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }




}


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

class Main {
    static Scanner scanner = new Scanner();
    static int mod = 1000000007;
    static int inf = 0x7ffffff;

    void solve() {
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        int[] a = new int[n + 1];
        for (int i = 0; i < n; i++) {
            a[i + 1] = (a[i] + scanner.nextInt() - 1) % k;
        }
        long ans = 0;
        Map<Integer, Integer> count = new HashMap<>();
        for (int i = 0; i <= n; i++) {
            if (k <= i) {
                count.merge(a[i - k], -1, Integer::sum);
            }
            Integer c = count.get(a[i]);
            if (c == null) {
                count.put(a[i], 1);
            } else {
                ans += c;
                count.put(a[i], c + 1);
            }
        }
        System.out.println(ans);
    }

    public static void main(String[]$) throws Exception {
        new Main().solve();
        System.out.flush();
    }
}

class System {
    static PrintWriter out = new PrintWriter(java.lang.System.out);

    static void exit() {
        java.lang.System.exit(0);
    }
}

class Scanner {
    private BufferedReader reader = new BufferedReader(new InputStreamReader(java.lang.System.in), 0x10000);
    private StringTokenizer tokenizer;

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

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

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

    char[][] nextCharArray(int n, int m) {
        char[][] a = new char[n][m];
        for (int i = 0; i < n; i++) {
            a[i] = next().toCharArray();
        }
        return a;
    }

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

    int[] nextIntArray(int n, IntUnaryOperator op) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = op.applyAsInt(nextInt());
        }
        return a;
    }

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

    long[] nextLongArray(int n, LongUnaryOperator op) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = op.applyAsLong(nextLong());
        }
        return a;
    }
}


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

#define rep(i,n) for(ll i=0;i<(ll)n;++i)
#define rep1(i,n) for(ll i=1;i<=(ll)n;++i)
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;


int main(){
  ll a, b, k;
  cin >> a >> b >> k;
  
  if(a > k)
    a -= k;
  else{
    b -= (k - a);
    a = 0;
    if(b < 0) b = 0;
  }
  
  
  cout << a << " " << b << endl;
}



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

using namespace std;

const int MAX_N=50+10;
long long int a[MAX_N];

int main()
{
    //INPUT
    long long int k;
    cin >> k;
    //SOLVE
    long long int y=(k+50-1)/50+50,x=(y-50+1)*50;
    for(int i=0;i<50;i++)
    {
        a[i]=y;
    }
    for(long long int i=x;i>k;i--)
    {
        sort(a,a+50);
        a[49]-=50;
        for(int j=0;j<49;j++)
        {
            a[j]++;
        }
    }
    //OUTPUT
    cout << 50 << endl;
    for(int i=0;i<50;i++)
    {
        cout << a[i] << " ";
    }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] s = new int[n];
		for (int i = 0; i < n; i++) {
			s[i] = sc.nextInt();
		}
		int q = sc.nextInt();
		int[] t = new int[q];
		for (int i = 0; i < q; i++) {
			t[i] = sc.nextInt();
		}

		int count = 0;
		for (int i = 0; i < q; i++) {
			for (int j = 0; j < n; j++) {
				if (t[i] == s[j]) {
					count++;
					break;
				}
			}
		}
		System.out.println(count);

	}

}



Measured memory_bytes: 40168
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
typedef int64_t ll;
typedef long double ld;
using namespace std;
const ll mod=1000000007;
const ll INF=(1LL<<62);
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
void init(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
}

struct LazySegmentTree {
private:
    int n;
    vector<ll> node, lazy;
 
public:
    LazySegmentTree(vector<ll> v) {
        int sz = (int)v.size();
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n-1);
        lazy.resize(2*n-1, 0);
 
        for(int i=0; i<sz; i++) node[i+n-1] = v[i];
        for(int i=n-2; i>=0; i--) node[i] = node[i*2+1] + node[i*2+2];
    }
 
    void eval(int k, int l, int r) {
        if(lazy[k] != 0) {
            node[k] += lazy[k];
            if(r - l > 1) {
                lazy[2*k+1] += lazy[k] / 2;
                lazy[2*k+2] += lazy[k] / 2;
            }
            lazy[k] = 0;
        }
    }
 
    void add(int a, int b, ll x, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        eval(k, l, r);
        if(b <= l || r <= a) return;
        if(a <= l && r <= b) {
            lazy[k] += (r - l) * x;
            eval(k, l, r);
        }
        else {
            add(a, b, x, 2*k+1, l, (l+r)/2);
            add(a, b, x, 2*k+2, (l+r)/2, r);
            node[k] = node[2*k+1] + node[2*k+2];
        }
    }
 
    ll getsum(int a, int b, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        eval(k, l, r);
        if(b <= l || r <= a) return 0;
        if(a <= l && r <= b) return node[k];
        ll vl = getsum(a, b, 2*k+1, l, (l+r)/2);
        ll vr = getsum(a, b, 2*k+2, (l+r)/2, r);
        return vl + vr;
    }
    ll getA(ll n){
      return getsum(n,n+1);
    }
};

int main(){
    init();
    ll N,D,A;cin>>N>>D>>A;
    vector<pair<ll,ll>>v(N);
    rep(i,N)cin>>v[i].first>>v[i].second;
    sort(v.begin(),v.end());

    vector<ll>X(N);
    vector<ll>H(N);
    rep(i,N){
      X[i]=v[i].first;
      H[i]=v[i].second;
    }

    


    LazySegmentTree seg(H);
    ll ans=0;
    rep(i,N){
      if(seg.getA(i)<=0)continue;
      ll num=(seg.getA(i)+A-1)/A;
      //左を見つける
      ll right=N;
      ll left=i;
      ll z=X[i]+2*D;
      while(right-left>1){
        ll mid=(right+left)/2;
        if(X[mid]<=z)left=mid;
        else right=mid;
      }
      seg.add(i,right,-1*A*num);
      ans+=num;
      //cout<<right<<endl;
    }
    cout<<ans<<endl;


}

Measured memory_bytes: 16256
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define mod2 998244353 
#define PI 3.14159265
#define ll long long
#define ld long double
#define pi pair<ll,ll>
#define pb push_back
#define vi vector<ll>
#define sz size()
#define fi first
#define se second
#define lz length()
#define all(x) (x).begin(),(x).end()
#define scf(x) scanf("%lld",&x)
#define rep(i,n) for(ll i=0;i<n;i++)
const int INF = (int)1e9;
const ll IINF=1LL<<62;
const int maxn=10000005;
//int divr[maxn];
/**/
/*void divisor()
{for(int i=2;i<sqrt(maxn);i++)
     {
          if(!divr[i])
          {
               for(int j=i*i;j<maxn;j+=i)if(!divr[j])divr[j]=i;     
          }
     }
     for(int i=1;i<maxn;i++)if(!divr[i])divr[i]=i;
}*/
 
/*const int N=1000005;
ll n;
struct line {
    long long m, c;
    long long eval(long long x) { return m * x + c; }
    long double intersectX(line l) { return (long double) (c - l.c) / (l.m - m); }
};
vector<pair<pi,ll>> rect;
deque<line> dq;
*/
 
 
 
 


ll modexpo(ll a,ll b)
{
     ll res=1LL;
     while(b>0)
     {
          if(b&1)res=(res*a)%mod;
          a=(a*a)%mod;
          b>>=1;
     }
     return res;
}













bool compare(pi a,pi b){
     if(a.fi-a.se>b.fi-b.se)return  true;
     else if(a.fi-a.se==b.fi-b.se&&a.se<b.se)return true;
     return false;
}




const int N=1000005;
int pr[1000005];
int main()
{
     pr[0]=1,pr[1]=1;
     for(int i=2;i<N;i++){
          if(!pr[i]){
               for(int j=i+i;j<N;j+=i){
               pr[j]=1;
          }
          }
          
     }
     ll res[100005]={0};
     for(int i=1;i<=100000;i+=2){
          if(pr[i]==0){
               int t=(i+1)/2;
               if(pr[t]==0)res[i]=1;
          }
     }
     for(int i=1;i<=100000;i++)res[i]+=res[i-1];
     int q;
     cin>>q;
     while(q--){
          int l,r;
          cin>>l>>r;
          cout<<res[r]-res[l-1];
          cout<<"\n";
     }

}







 
 

















Measured memory_bytes: 5376
import math
N = int(input())
xy = [tuple(map(int, input().split())) for i in range(N)]
ans = 0
for i in range(N):
    for j in range(i+1, N):
        if i == j:
            continue
        else:
            ans += ((xy[i][0] - xy[j][0])**2 + (xy[i][1] - xy[j][1])**2)**0.5

print(ans*math.factorial(N-2)*(N-1) / math.factorial(N) * 2)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()
    
int main(){
    int r,g,b;
    cin >> r >> g >> b;
    int k;
    cin >> k;
    bool ok = false;
    for(int i=0; i<=k; i++){
        for(int j=0; j<=k-i; j++){
            int R=r*pow(2,i);
            int G=g*pow(2,j);
            int B=b*pow(2,k-i-j);
            if(R<G && G<B){
                ok = true;
            }
        }
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 4004
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <functional>
#include <queue>
#include <utility>
using namespace std;
typedef long long ll;
int main(){
  ll N,K,Q;
  cin >> N >> K >> Q;
  vector<ll> A(Q);
  map<ll,ll> mp;
  for(ll i = 0;i < Q;i++){
    cin >> A[i];
    A[i]--;
    mp[A[i]]++;
  }


  for(ll i = 0;i < N;i++){
    if(mp[i] - Q + K > 0)cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}


Measured memory_bytes: 7680
#include<iostream>

using namespace std;

int main(){
  int n;
  string s;
  char prev;
  bool yes_or_no;
  cin >> n;
  while(n-- > 0){
    cin >> s;
    prev = s[0];
    yes_or_no = true;
    for(int i=1;i<s.length();i++){
      if(prev == s[i]){
	yes_or_no = false;
	break;
      }
	prev = s[i];
    }
    if(yes_or_no)cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 1324
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> c(m);
  for (int i = 0; i < m; ++i) {
    cin >> c[i];
  }
  vector<int> dp(n + 1, 1e9);
  dp[0] = 0;
  for (int i = 0; i <= n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (i + c[j] <= n) {
        dp[i + c[j]] = min(dp[i + c[j]], dp[i] + 1);
      }
    }
  }
  cout << dp[n] << endl;
  return 0;
}


Measured memory_bytes: 3172
var
	n,m,ans:int64;
	i:Longint;
begin
	read(n,m);
	i:=1;
	while i*i<=m do begin
		if m mod i=0 then begin
			if(m div i>=n)and(ans<i)then ans:=i;
			if(i>=n)and(ans<m div i)then ans:=m div i;
		end;
		inc(i);
	end;
	writeln(ans);
end.


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

int N, A[100];

int main(){
	int sum = 0;
	scanf("%d", &N);
	for(int i = 0; i < N; i++)
		scanf("%d", &A[i]), sum += A[i];
	sort(A, A + N);
	if(sum % 10 == 0){
		bool val = false;
		for(int i = 0; i < N && !val; i++)
			if(A[i] % 10 != 0)
				val = true, sum -= A[i];
		if(!val) sum = 0;
	}
	printf("%d\n", sum);
	return 0;
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

using llu = long long unsigned int;

llu power( llu b, llu i ){
    llu r = 1;
    while( i ){
        if( i&1 ) r *= b;
        i >>= 1;
        b *= b;
    }
    return r;
}

int main() {

    int N;
    Scd(N);

    char s[312][312];

    Rep(i,N) Scs(s[i]);

    llu hash = 0;
    llu roll = 1000000007;
    llu roll2 = 998244353;
    vector<vector<llu>> vh(N,vector<llu>(N,0)); // vertical hash
    vector<vector<llu>> hh(N,vector<llu>(N,0)); // horizontal hash
    vector<vector<llu>>vhh(N,vector<llu>(N,0)); // vertical hash hash
    vector<vector<llu>>hhh(N,vector<llu>(N,0)); // horizontal hash hash

    Rep(i,N){
        hash = 0;
        Rep(j,N) hash = hash*roll + s[i][j];
        Rep(j,N){
            hh[i][j] = hash;
            hash = hash*roll - s[i][j]*power(roll,N) + s[i][j];
        }
    }
    Rep(j,N){
        hash = 0;
        Rep(i,N) hash = hash*roll2 + hh[i][j];
        Rep(i,N){
            hhh[i][j] = hash;
            hash = hash*roll2 - hh[i][j]*power(roll2,N) + hh[i][j];
        }
    }
    Rep(j,N){
        hash = 0;
        Rep(i,N) hash = hash*roll + s[i][j];
        Rep(i,N){
            vh[i][j] = hash;
            hash = hash*roll - s[i][j]*power(roll,N) + s[i][j];
        }
    }
    Rep(i,N){
        hash = 0;
        Rep(j,N) hash = hash*roll2 + vh[i][j];
        Rep(j,N){
            vhh[i][j] = hash;
            hash = hash*roll2 - vh[i][j]*power(roll2,N) + vh[i][j];
        }
    }

    int ans = 0;
    Rep(i,N) Rep(j,N){
        // printf ("%020llu %020llu\n", vhh[i][j], hhh[i][j] );
        if( vhh[i][j] == hhh[i][j] ) ans++;
    }
    printf ("%d\n", ans );

    return 0;
}





Measured memory_bytes: 3200
// kartikay26
#include <bits/stdc++.h>
using namespace std;
#define debug(x...) 
#ifdef LOCAL
#include "prettyprint.hpp"
#endif
typedef long long int ll; typedef double db; typedef vector<ll> vi; typedef pair<ll, ll> pii;
#define int ll
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define clr(x) memset(x, 0, sizeof(x))
#define fast_io() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
void print(){cout << endl;} void prints(){}
template<typename T> void get(T* x, int n){for (int i = 0; i < n; ++i) { cin >> x[i]; }}
template<typename T> void get(T& x, int n){for (int i = 0; i < n; ++i) { cin >> x[i]; }}
template<typename T, typename... A> void print(T x,A... r){cout << x << " ";print(r...);}
template<typename T, typename... A> void prints(T x,A... r){cout << x << " ";prints(r...);}

const int mod = 1e9+7;
const int N = 1e6+1;

db a, b, x;

db a1 (db t){ // t in radians
	db t0 = atan2(b, a);
	if (t < t0){
		return b * a - a * a * tan(t) / 2;
	} else {
		return b * b / (2 * tan(t));
	}
}

bool check(db t){
	db pi = acos(-1);
	db A = x / a;
	return a1(t * pi / 180) > A;
}

int32_t main(){
	fast_io();

	cin >> a >> b >> x;
	db V = a * a * b;

	// find point where true changes to false in check(i)
	db x = 0;
	cout << setprecision(20);
	for (db b = 90; b >= 1e-12; b /= 2){
		while(check(x+b)) x += b;
		debug(x);
	}
	print(x);

	return 0;
}

Measured memory_bytes: 256
#include<stdlib.h>
#include<stdio.h>
#include<string.h>



int main(){
    int A,B,K;
    scanf("%d %d %d",&K,&A,&B);
    for (int i=K; i<=1000; i+=K) {
        if(A<=i && i<=B){
            printf("OK\n");
            return 0;
        }
    }
    printf("NG\n");
    return 0;
}


Measured memory_bytes: 1660
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.lang.*;

public class Main{
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int h = sc.nextInt();
		int w = sc.nextInt();
		int k = sc.nextInt();
		String[] s = new String[h];
		for (int i = 0; i < h; i++) {
			s[i] = sc.next();
		}
		int[][] ans = new int[h][w];
		int count = 1;
		for (int i = 0; i < h; i++) {
			int lasti = -1;
			while (s[i].indexOf("#", lasti + 1) != -1) {
				for (int j = lasti + 1; j <= s[i].indexOf("#", lasti + 1); j++) {
					ans[i][j] = count;
				}
				count++;
				lasti = s[i].indexOf("#", lasti + 1);
			}
			if (lasti >= 0 && lasti < w - 1) {
				count--;
				for (int j = lasti + 1; j < w; j++) {
					ans[i][j] = count;
				}
				count++;
			}
		}
		int start = -1;
		int last = -1;
		for (int i = 0; i < h; i++) {
			if (ans[i][0] == 0) {
				if (start == -1) {
					start = i;
				}
			} else {
				if (start != -1) {
					for (int j = start; j < i; j++) {
						ans[j] = ans[i];
					}
					start = -1;
				}
				last = i;
			}
		}
		if (start != -1) {
			for (int i = start; i < h; i++) {
				ans[i] = ans[last];
			}
		}
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w - 1; j++) {
				System.out.print(ans[i][j] + " ");
			}
			System.out.println(ans[i][w - 1]);
		}
	}
}



class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	private int readByte() {
		if (hasNextByte()) {
			return buffer[ptr++];
		} else {
			return -1;
		}
	}
	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}
	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
		return hasNextByte();
	}
	public String next() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	public long nextLong() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || Integer.MAX_VALUE < nl) {
			throw new NumberFormatException();
		}
		return (int) nl;
	}
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 45616
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <map>
#include <set>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <assert.h>
#include <math.h>
#include <stack>
#include <queue>
#include <list>
using namespace std;

// #define __DEBUG__

#ifdef __DEBUG__
bool debug_disabled = false;
#else
bool debug_disabled = true;
#endif

#define dbg if (debug_disabled) {} else cerr

void solve() {
    int d, t, s;
    cin >> d >> t >> s;
    if (s * t >= d) cout << "Yes" << endl;
    else cout << "No" << endl;
}

int main() {
    cout.setf(ios::fixed, ios::floatfield);
    cout.setf(ios::showpoint);
    cout.precision(12);
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);

    int T = 1;
    // cin >> T;
    for (int i = 1; i <= T; ++i) {
        solve();
    }

    return 0;
}


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


int a,b;

int main(){
    scanf("%d%d",&a,&b);
    if(a*b%2==1){
        printf("Odd");
    }else{
        printf("Even");
    }
}

Measured memory_bytes: 256