akhauriyash/Code-Regression huggingface dataset:
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif
// 実数の場合
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

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

    Int x, a, b;
    cin >> x >> a >> b;

    Int ab = b - a;
    if (ab <= 0) {
        cout << "delicious" << endl;
    } else if (0 < ab && ab <= x) {
        cout << "safe" << endl;
    } else {
        cout << "dangerous" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<algorithm>
using namespace std;
int main(){
  int n,ans=0,t[1000],u[1000];
  bool visited[1000];
  map<int,int> change;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>t[i];
    change[t[i]]=i;
    u[i]=t[i];
    visited[i]=false;
  }
  sort(u,u+n);
  for(int i=0;i<n;i++){   
    int w=i,x=0,y=0,z=10000;
    while(!visited[w]){
      z=min(z,t[w]);
      y+=t[w];
      x++;
      visited[w]=true;
      w=change[u[w]];
    }
    if(x>=2)ans+=min(y+z+u[0]*(x+1),y+z*(x-2));
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3224
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;

struct event {
  int t, type, val;
  bool operator < (const event &e){
    return t < e.t;
  }
};

signed main(){
  int N, Q;
  cin >> N >> Q;

  vector<event> v(2*N);
  REP(i, N){
    int s, t, x;
    cin >> s >> t >> x;
    v[i]   = {s-x, 1, x};
    v[i+N] = {t-x, -1, x};
  }
  sort(ALL(v));

  int k = 0;
  multiset<int> s;
  REP(i, Q){
    int D; cin >> D;

    while(k < 2*N && v[k].t <= D){
      if(v[k].type == 1) s.insert(v[k].val);
      else s.erase(s.find(v[k].val));
      k++;
    }

    if(s.empty()) cout << -1 << "\n";
    else cout << *s.begin() << "\n";
  }

  return 0;
}

Measured memory_bytes: 19968
#include<iostream>
#include<vector>
#include<set>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
typedef long long ll;

int main(){
    int n; 
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    rep(i,n) a[i]--;
    vector<int> idx(n);
    rep(i,n) idx[a[i]] = i;
    set<int> s;
    ll ans = 0;
    for(int x=n-1; x>=0; x--){
        int i=idx[x];
        ll c=0;
        { // calc c
            s.insert(i);
            vector<int> l(2, -1);
            vector<int> r(2, n);
            { // calc l
                auto it = s.find(i);
                rep(j,2){
                    if(it == s.begin()) break;
                    it--;
                    l[j] = *it;
                }
            }
            { // calc l
                auto it = s.find(i);
                rep(j,2){
                    it++;
                    if(it == s.end()) break;
                    r[j] = *it;
                }
            }
            vector<int> ls(2);
            ls[0] = i-l[0];
            ls[1] = l[0]-l[1];
            vector<int> rs(2);
            rs[0] = r[0]-i;
            rs[1] = r[1]-r[0];
            c = (ll)ls[0]*rs[1] + (ll)ls[1]*rs[0];
        }
        ans += c*(x+1);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int a,b;
    cin>>a>>b;
    cout<<max(a-2*b,0)<<'\n';
}


Measured memory_bytes: 256
#include <stdio.h>

int	main(void)
{
	int		a, b;
	double	d;
	scanf("%d %d", &a, &b);

	printf("%d ", a / b);
	printf("%d ", a % b);
	d = (double)a / b;
	printf("%.5f\n", d);
	return (0);
}



Measured memory_bytes: 2116
#include<cstdio>
int a[100001];
int n;
int ans=0;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	for(int i=1;i<=n;i++) while(!(a[i]&1)) a[i]>>=1,ans++;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
      	int[] array = new int[200];
        for(int i = 0 ; i < n ; i ++){
          array[i] = sc.nextInt();
        }
      	boolean flg = true;
      	int count = 0 ;
      while (flg) {
        for(int i = 0 ; i < n ; i ++){
          if(array[i] % 2 != 0){
            flg = false;
            break;
          }
          array[i] = array[i] / 2;
        }
        if (!flg) break;
        count ++ ; 
      } 
      
      System.out.print(count);
    }
}


Measured memory_bytes: 36108
package main

import "fmt"

func main() {
	k, a := input()
	ans := run(k, a)
	output(ans)
}

func run(k int, a []int) int {
	town := 0
	trajectory := make(map[int]int)
	var begin, end int
	var ok bool
	var i int
	for i = 0; i < k; i++ {
		begin, ok = trajectory[town]
		if ok {
			end = i
			break
		}
		trajectory[town] = i
		town = a[town]
	}
	if i == k {
		return town + 1
	}
	t := (k - begin) % (end - begin)
	arr := make([]int, end-begin, end-begin)
	for i, v := range trajectory {
		if begin <= v && v < end {
			arr[v-begin] = i
		}
	}
	return arr[t] + 1
}

func firstAppearance(x int, t map[int]int) int {
	for i, v := range t {
		if x == v {
			return i
		}
	}
	return -1
}

func output(a int) {
	fmt.Println(a)
}

func input() (int, []int) {
	var n, k int
	fmt.Scan(&n, &k)
	a := make([]int, n, n)
	var t int
	for i := range a {
		fmt.Scan(&t)
		a[i] = t - 1
	}
	return k, a
}


Measured memory_bytes: 15896
#pragma GCC optimize("Ofast")  
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define int long long 
#define endl "\n"
#define all(x) (x).begin(),(x).end()
const int MOD = 1e9+7;
const int mxN = 2e5+3;

void solve(){
	int n;
	cin >> n;
	string s;
	cin >> s;
	int st = 0;
	int en = n - 1;
	while(s[st] == 'R'){
		st++;
	}
	while(s[en] == 'W'){
		en--;
	}
	int ans = 0;
	while(st < en){
		if(s[st] == 'W' and s[en] == 'R')ans++,st++,en--;
		else if(s[st] == 'R' and s[en] == 'R')st++;
		else if(s[st] == 'W' and s[en] == 'W')en--;
		else st++,en--;
	}
	cout << ans << endl;
}

int32_t main(){
	IO;
	
	int nT = 1;
	//cin >> nT;
	for(int i = 1; i <= nT; ++i)
		solve();
	return 0;
}


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

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	for(int src,dst;cin>>src>>dst;){
		vvi a(101,vi(101));
		do{
			a[src][dst]++;
			a[dst][src]++;
		}while(cin>>src>>dst,src|dst);
		string res="OK";
		repi(i,1,3)
			if(accumulate(allof(a[i]),0)%2==0)
				res="NG";
		repi(i,3,a.size())
			if(accumulate(allof(a[i]),0)%2==1)
				res="NG";
		cout<<res<<endl;
	}
	
	return 0;
}

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


void solve(long long N, std::vector<std::string> S){
    map<string,int> mp;
    int mx = 0;
    for(int i=0;i<N;i++){
        if(mp[S[i]] ==0){
            mp[S[i]] =1;
        }else{
            mp[S[i]]++;
        }
        mx=max(mx,mp[S[i]]);
    }
    vector<string> ans;
    for(auto itr = mp.begin(); itr != mp.end(); ++itr) {
        if(itr->second == mx){
            ans.push_back(itr->first);
        }
    }
    sort(ans.begin(),ans.end());

    for(int i=0;i<ans.size();i++){
        cout << ans[i] << endl;
    }


}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<std::string> S(N);
    for(int i = 0 ; i < N ; i++){
        std::cin >> S[i];
    }
    solve(N, std::move(S));
    return 0;
}


Measured memory_bytes: 28404
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include <fstream>
#include <time.h>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define m0(x) memset(x,0,sizeof(x))
#define print(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
#define int long long
#define all(x) (x).begin(), (x).end()

using namespace std;

int MOD = (ll)1000000000 + 7;
ll INF = 1e17;
const double pi = acos(-1);
const double EPS = 1e-10;
const int MAX = 500050;
typedef pair<int, int>P;


vector<int>G[100010];
bool visited[100010];
int c[100010];
bool cir = false;
void dfs(int n, int pre,int cnt) {
	for (auto nex : G[n]) {
		if (nex == pre)continue;
		if (visited[nex]) {
			if (cnt%2 == c[nex]%2) {
				cir = true; return;
			}
		}
		else {
			c[nex] = cnt + 1;
			visited[nex] = true;
			dfs(nex, n, cnt + 1);
		}
		
	}
}

signed main() {
	int N, M; cin >> N >> M;
	REP(i, M) {
		int x, y; cin >> x >> y; x--, y--;
		G[x].pb(y); G[y].pb(x);
	}
	m0(visited);
	c[0] = 0;
	visited[0] = true;
	dfs(0, 0, 0);
	ll ans = 0;
	if (cir) {
		ans = N * (N - 1) / 2 - M;
	}
	else {
		int eve = 0, odd = 0;
		REP(i, N) {
			if (c[i] % 2 == 0)eve++; else odd++;
		}
		ans = eve * odd - M;
	}
	print(ans);
}

Measured memory_bytes: 8320
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	s, t := Scanner(), Scanner()
	ans := 0
	for i, _ := range s {
		if s[i] == t[i] {
			ans++
		}
	}
	fmt.Println(ans)
}


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

#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

typedef pair<int, int> pint;

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front

#define MOD (1000 * 1000 * 1000 + 7)

void set_map(vector<vector <int> > &m, int i, int j, int v) {
    m[i][j] = v;
    m[j][i] = v;
}

void solve(vector<vector <int> > &m, int N, vector<int> nodes, vector<int> used) {
    if (N <= 1) return;

    // cout << "solve = " << N << endl;
    // REP(i, N) {
    //     cout << nodes[i] << ", ";
    // }
    // cout << endl;

    vector< vector<int>> group(2, vector<int>());
    REP(i, N) {
        group[i%2].pb(nodes[i]);
    }

    int next = 0;
    while (used[next] == 1) next++;
    used[next] = 1;

    for (int i: group[0]) {
        for (int j: group[1]) {
            set_map(m, i, j, next);
        }
    }

    solve(m, SZ(group[0]), group[0], used);
    solve(m, SZ(group[1]), group[1], used);
}

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

    vector<vector <int> > m(N, vector<int>(N, 0));

    vector<int> used(N*N, 0);
    used[0] = 1;

    vector<int> nodes;
    REP(i, N) {
        nodes.pb(i);
    }

    solve(m, N, nodes, used);

    int max_v = 0;
    REP(i, N-1) {
        // REP(j, i) cout << "  ";
        FOR(j, i+1, N) {
            if  (j > i+1) cout << " ";
            cout << m[i][j];
            max_v = max(max_v, m[i][j]);
        }
        cout << endl;
    }

    // cout << max_v << endl;


    return 0;
}

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

char incrementChar(char x){
    return static_cast<char>(x + 1);
}

int weekToInt(string x){
    int num;
    if(x == "SUN"){
        num = 1;
    }else if(x == "MON"){
        num = 2;
    }else if(x == "TUE"){
        num = 3;
    }else if(x == "WED"){
        num = 4;
    }else if(x == "THU"){
        num = 5;
    }else if(x == "FRI"){
        num = 6;
    }else if(x == "SAT"){
        num = 7;
    }else{
        num = 0;
    }

    return num;
}

int main(){
    int a;
    string s;

    cin >> a >> s;

    if(a < 3200){
        cout << "red" << endl;
    }else{
        cout << s << endl;
    }

    return 0;
}


Measured memory_bytes: 256
import sys

a_b_c = list(map(int, input().split()))
r = a_b_c[0]
g = a_b_c[1]
b = a_b_c[2]
k = int(input())

while (g <= r and k >= 0):
    g *= 2
    k -= 1
while (b <= g and k >= 0):
    b *= 2
    k -= 1
if (k < 0):
    print("No")
else:
    print("Yes")

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

using namespace std;

int main(){
    string weather;
    cin >> weather;
    if(weather == "Sunny"){
        cout << "Cloudy";
        
    }
    if(weather == "Cloudy"){
        cout << "Rainy";
        
    }
    if(weather == "Rainy"){
        cout << "Sunny";
        
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <unordered_map>

using namespace std;

int main(){
    int n;
    cin >> n;
    unordered_map<int, int> m;
    for(int i = 0; i < n-1; i++){
        int boss;
        cin >> boss;
        m[boss]++;
    }
    for(int i = 1; i <=n; ++i){
        cout << m[i] << endl;
    }

}

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

int main(void) {
  char A[11];
  char B[11];
  char C[11];
  scanf("%s %s %s", A, B, C);

  int LA = strlen(A);
  int LB = strlen(B);
  if(A[LA-1] == B[0] && B[LB-1] == C[0]) {
    printf("YES\n");
  } else {
    printf("NO\n");
  }

  return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
 
typedef struct p{
  char name[100];
  int time;
}Process;
 
Process Que[100000];
int head, tail, n;
 
void enqueue(Process x){
  Que[tail] = x;
  tail = (tail + 1)%100000;
}
 
Process dequeue(){
  Process x = Que[head];
  head = (head + 1)%100000;
  return x;
}
 
int min(int a, int b){ 
  return a < b ? a:b;
}
 
int main(void) {
  int i, n, q;
  scanf("%d %d\n", &n, &q);

  for (i=0; i<n;i++) {
      Process que;
      scanf("%s %d", que.name, &que.time);
      enqueue(que);
  }

  int e = 0;
  while (head != tail) {
      Process proc = dequeue();
      if (proc.time <= q) {
          e += proc.time;
          printf("%s %d\n", proc.name, e);
      } else {
          e += q;
          proc.time -= q;
          enqueue(proc);
      }
  }
  return 0;
}

Measured memory_bytes: 11928
gets
ps = [0] + gets.split.map(&:to_i)
xys = $stdin.read.split

h = {}
xys.each_slice(2) do |xs,ys|
  x = xs.to_i
  y = ys.to_i
  h[x] ||= []
  h[x] << y
  h[y] ||= []
  h[y] << x
end

used = {}
ret = 0
h.each do |k,v|
  next if used[k]
  b = v
  lused = {}
  lused[k] = 1
  until b.empty?
    b.each do |n|
      lused[n] = 1
    end
    b = b.flat_map {|n| h[n] || []}.uniq.reject {|n| lused[n]}
  end
  used.merge!(lused)

  ret += lused.keys.count {|n| lused[ps[n]]}
end

1.upto(ps.length-1) do |i|
  ret += 1 if !used[i] && ps[i] == i
end

p ret


Measured memory_bytes: 53364
def framod(n, mod, a=1):
    for i in range(1,n+1):
        a=a * i % mod
    return a
def power(n, r, mod):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod
def comb(n, k, mod):
    a=framod(n, mod)
    b=framod(k, mod)
    c=framod(n-k, mod)
    return (a * power(b, mod-2, mod) * power(c, mod-2, mod)) % mod



N = int(input())
K = int(input())
SN = str(N)
LN = list(SN)
keta =len(LN)
Nzer = keta-K
Nsei = K
output = 0
if keta>=K:
    output += comb(keta,K,10**9+7)*9**K
    t = 0
    s = 0
    while (s<=K-1)and(t<=keta-1):
        if LN[t]!="0":
            output -= (9-int(LN[t]))*comb(keta-1-t,K-1-s,10**9+7)*9**(K-1-s)
            t += 1
            s += 1
        elif LN[t]=="0":
            output -= (9-int(LN[t]))*comb(keta-1-t,K-1-s,10**9+7)*9**(K-1-s)
            t+=1
print(int(output))

Measured memory_bytes: 38768
#include <bits/stdc++.h>
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define pb push_back
#define f first
#define s second
#define fast_cin ios_base::sync_with_stdio(false);cin.tie(NULL);
#define precise fixed(cout);cout<<setprecision(16);
#define OUT(x) for(auto a:x) cout << a << " "; cout << endl;
#define OK cout << "ok" <<endl;

using namespace std;

int main()
{
    string s,t;
	cin >> s >> t;
	int cn=0;
	for(int i=0;i<3;i++){
		if(s[i]==t[i]) cn++;
	}
	cout << cn << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
using ll = long long;
using lint = long long;
typedef pair<int,int> P;
const lint inf=1e18+7;
const int MOD=1000000007;
signed main(){
  int H,W,h,w;cin>>H>>W>>h>>w;
  int r=(H/h);
  int c=(W/w);
  int rem=(H%h)*W+(W%w)*H-(H%h)*(W%w);//H*W-r*c*h*w;
  if(H%h+W%w<=0){
      cout<<"No"<<"\n";
      return 0;
  }
  cout<<"Yes"<<"\n";
  rep1(i,H){
      rep1(j,W){
          int buf=r*c+5;
          if(i%h==0&&j%w==0){
              buf*=-h*w+1;
            buf-=1;
          }
          cout<<buf<<" ";
      }
      cout<<endl;
  }
  return 0;
}


Measured memory_bytes: 3588
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
			　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <memory>
#include <iomanip>
#define rep(i, n) for(Int (i) = 0; (i) < (n); ++(i))
#define debug(var) cout << #var << ": " << var << endl
using namespace std;
using Int = int64_t;
using Double = double;
using Uint = uint64_t;
constexpr Uint mod = 1e9 + 7;
constexpr Int INF = INT_MAX;
using Container = vector<Int>;
template<typename T>
using Grid = vector<vector<T>>; // 二次元配列。[y][x]
template<typename T, typename U>
using Umap = unordered_map<T, U>;
template<typename T>
using Uset = unordered_set<T>;
template<typename T>
using P = pair<T, T>;

int main() {

	Int A, B, C; cin >> A >> B >> C;
	if ((A == B && A != C) || (B == C && B != A) || (C == A && C != B)) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

}

Measured memory_bytes: 256
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
j = 0
dp = [0] * 100100
dp[0] = 1
for i in range(1,N+1):
    if j < M and i == A[j]:
        j += 1
        dp[i] = 0
    else:
        dp[i] = dp[i-1] + dp[i-2]
        dp[i] %= 10**9+7
print(dp[N])


Measured memory_bytes: 7824
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

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

    struct city
    {
        int x;
        int y;
    };
    vector<city> cities(n);
    for (auto &city : cities)
    {
        cin >> city.x >> city.y;
    }

    const auto calcDistance = [](const city &a, const city &b)
    {
        const double dx = a.x - b.x;
        const double dy = a.y - b.y;
        return sqrtf(dx * dx + dy * dy);
    };

    vector<int> indices;
    for (int i = 0; i < n; ++i)
    {
        indices.push_back(i);
    }

    double sum = 0.0;
    int count = 0;
    do
    {
        auto currentCity = cities[indices[0]];
        for (int i = 1; i < n; ++i)
        {
            const int nextIndex = indices[i];
            auto nextCity = cities[nextIndex];
            sum += calcDistance(currentCity, nextCity);
            currentCity = nextCity;
        }
        ++count;
    }
    while (next_permutation(indices.begin(), indices.end()));
    const double average = sum / count;

    printf("%f\n", average);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

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

    int N;
    cin >> N;
    vector<int> V(N);
    int sum = 0;
    for (auto &x : V) {
        cin >> x;
        sum += x;
    }

    if (sum % 10) {
        cout << sum << endl;
        exit(0);
    }
    sort(V.begin(), V.end());
    for (auto &x : V) {
        if (x % 10) {
            sum -= x;
            break;
        }
    }

    cout << ((sum % 10) ? sum : 0) << endl;

    return 0;
}

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

int main(){
  int x1, x2, x3, x4, x5;
  
  cin >> x1 >> x2 >> x3 >> x4 >> x5 ;
  
  if(x1 == 0){std::cout << 1 << std::endl;}
  else if(x2 == 0){std::cout << 2 << std::endl;}
  else if(x3 == 0){std::cout << 3 << std::endl;}
  else if(x4 == 0){std::cout << 4 << std::endl;}
  else if(x5 == 0){std::cout << 5 << std::endl;}


  
}


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

using namespace std;

int main(){
    string s;
    cin>>s;
    for(int i = 0; i < s.size(); i++){
        if(s[i]=='1')
            s[i] = '9';
        else
            s[i] = '1';
    }
    cout<<s;
}

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

using namespace std;

int main()
{
    long long int n, m;
    cin >> n >> m;

    if (n == 1 && m == 1) {
        cout << 1 << endl;
    }
    else if (n == 1 || m == 1) {
        cout << n*m-2 << endl;
    }
    else {
        cout << (m-2) * (n-2) << endl;
    }
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<(n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) (s.substr(f-1,t-f+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
struct Grid{ll x,y,t;};
struct Edge{ll to,cost;};
struct Graph{vector<vector<Edge>>E;int V;
  const ll Inf = llINF;const int MAX_V=201010;vector<ll>d;
  Graph(int n):E(n){d.resize(MAX_V);E.resize(n);V=n;}
  void init(){for(int i=0;i<MAX_V;i++)d[i]=Inf;}
  void add_edge(ll from,ll to,ll cost){E[from].pb({to,cost});}
};
struct UF
{
  vector<int> par; // 親のインデックスを記憶する配列
  vector<int> sz; // サイズを記憶する。
  vector<int> rank;
  // 初期化
  UF(int n):par(n),sz(n),rank(n){
    for(int i = 0; i < n; i++){
      par[i] = i;sz[i] = 1;rank[i] = 0;
    }
  }
  // 親を求める
  int find(int x) {
    if (par[x] == x) return x;
    else return par[x] = find(par[x]);
  }
  // xとyの属する集合を併合
  void merge(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return;
    if(rank[x] < rank[y]){
      par[x] = y;
      sz[y] += sz[x];
    }
    else{
      par[y] = x;
      sz[x] += sz[y];
      if(rank[x] == rank[y])rank[x]++;
    }
  }
  // xとyが同じ集合ならtrue
  bool same(int x, int y) { return find(x) == find(y); }
  // 素の集合のサイズを求める
  int size(int n){return sz[find(n)];}
};
vector< priority_queue<ll,vi,greater<ll>>>pri(111111);
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m;cin>>n>>m;
  vi cost(n);for(int i=0;i<n;i++){cin>>cost[i];}
  UF uni(n+10);

  for(int i=0;i<m;i++){
    ll a,b;cin>>a>>b;
    uni.merge(a,b);
  }
  for(int i=0;i<n;i++){
    pri[uni.find(i)].push(cost[i]);
  }
  ll ans=0;
  ll cnt=0;
  priority_queue<ll,vi,greater<ll>>que;
  for(int i=0;i<n;i++){
    if(!pri[i].empty()){
      cnt++;
      if(uni.size(i)!=n)
	ans+=pri[i].top();
      pri[i].pop();
      while(!pri[i].empty()){que.push(pri[i].top());pri[i].pop();}
    }
  }
  //cout<<ans<<endl;
  bool anfl=true;
  for(int i=0;i<2*(cnt-1)-cnt;i++){
    if(que.empty()){anfl=false;break;}
    ans+=que.top();
    que.pop();
  }
  if(anfl)cout<<ans<<endl;
  else cout<<"Impossible"<<endl;
  return 0;
}


Measured memory_bytes: 8832
#include<iostream>
using namespace std;
int main(){
	int n,i,j,k;string s,t;cin>>n;getline(cin,s);
	while(n--){getline(cin,s);t=s;
		for(i=99;i;i--)for(j=0;j<26;j++){
			for(k=0;k<s.size();k++)if(t[k]-32)t[k]=97+(i*s[k]+j)%26;
			if(t.find("this")+1||t.find("that")+1)goto p;
		}p:cout<<t<<endl;
	}return 0;
}

Measured memory_bytes: 3028
#include <bits/stdc++.h>
#include <boost/range/adaptors.hpp>

using namespace std;
using ll = long long;
using ld = long double;

namespace NyaGadget
{
	struct NyaStruct {
		ll times = 0;
		ll v = 0;
	};

	auto NyaSort = [](const NyaStruct& l, const NyaStruct& r)
	{	// 昇順は演算子>, 昇順は演算子<, if順の優先でソートされる
		return l.v > r.v;
	};
}

#define all(collection) (collection).begin(), (collection).end()              // begin to end
#define divc(a, b) ceil((ld) a / (ld) b);                                     // div ceiling
#define rep(i, begin, end) for (ll i = begin; i < end; i++)                   // repeat
#define repr(i, begin, end) for (ll i = begin; end < i; i--)                  // repeat reverse
#define size(collection) ((ll) (collection).size())                           // collection size
/********** for each macro **********/
#define fori(i, ...) if(ll i = -1) for(__VA_ARGS__) if(i++, true)
#define each(i, e, v) fori(i, auto& e: v)
#define forir(i, ...) if(ll i = size(v)) for(__VA_ARGS__) if(i--, true)
#define eachr(i, e, v) forir(i, auto& e: boost::adaptors::reverse(v))

using namespace NyaGadget;

int main(void)
{
	ll N, M; cin >> N >> M;

	vector<ll> A(N);
	each(i, e, A)
		cin >> e;

	vector<NyaStruct> B(M);
	each(i, e, B)
		cin >> e.times >> e.v;
	sort(all(A));
	sort(all(B), NyaSort);

	vector<ll> change;
	[&]
	{
		each(i, e, B)
		{
			rep(j, 0, e.times)
			{
				change.push_back(e.v);
				if (size(change) == N) return;
			}
		}
	}();
	
	each(i, e, change)
		if (A[i] < e) A[i] = e;

	cout << accumulate(all(A), 0LL);
	return 0;
}


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

int main(void){
    int N;
    cin >> N;
    int L[N];
    for(int i = 0 ; i < N ; i++){
        cin >> L[i];
    }
    sort(L,L+N,greater<int>());
    int sum = 0;
    for(int i = 1 ; i < N ; i++){
        sum += L[i];
    }
    if(L[0] < sum) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3576
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
template <typename T> using posteriority_queue = priority_queue<T, vector<T>, greater<T> >;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
template <typename T> void unique(vector<T> &a) { a.erase(unique(ALL(a)), a.end()); }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  ll x; cin >> x;
  ll ans = x / 11 * 2;
  x %= 11;
  if (x > 0) {
    ++ans;
    x -= 6;
  }
  if (x > 0) {
    ++ans;
    x -= 5;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

S = sys.stdin.readline().rstrip()
w = int(sys.stdin.readline())
print(S[::w])


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

using namespace std;

int main()
{
   int n;
   cin >> n;
   set<string> s;
   while(n--) {
       string str;
       cin >> str;
       s.insert(str);
   }
   cout << s.size()  <<  endl;
   
   return 0;
}

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

typedef long long i64;

const i64 MOD = 1e9 + 7;
const i64 MAXN = 100000 + 5;

template<class T = long long>
struct matrix
{
private:
	T data[3][3];
public:
	matrix(int dig = 0)
	{
		for (int i = 0; i < 3; i++)
			for (int j = 0; j < 3; j++)
				data[i][j] = (i == j ? dig : 0);
	}
	virtual ~matrix() = default;

	T * operator [](int index)
	{
		return data[index];
	}

	const T * operator[](int index) const
	{
		return data[index];
	}

	matrix operator *(const matrix & rhs)
	{
		matrix result(0);

		for (int k = 0; k < 3; k++)
			for (int i = 0; i < 3; i++)
				for (int j = 0; j < 3; j++)
					result[i][j] = (result[i][j] + data[i][k] * rhs[k][j] % MOD)
							% MOD;

		return result;
	}

	// Modulus operator is a dummy
	matrix operator %(const T & rhs)
	{
		return (*this);
	}
};

template<class T, class expType>
T modularExp(T base, expType exp)
{
	T answer(1);
	while (exp)
	{
		if (exp & 1)
			answer = answer * base % MOD;
		base = base * base % MOD;
		exp = exp >> 1;
	}
	return answer;
}

i64 N, M, x[MAXN];
matrix<> mat;
i64 dp1[3], dp2[3];
i64 *oldDp, *newDp;

int main()
{

	cin >> N >> M;
	for (int i = 1; i <= M; i++)
		cin >> x[i];
	mat[0][0] = 1, mat[0][1] = 1, mat[0][2] = 2;
	mat[1][0] = 1, mat[1][1] = 2, mat[1][2] = 2;
	mat[2][0] = 0, mat[2][1] = 1, mat[2][2] = 1;

	oldDp = dp1, newDp = dp2;

	oldDp[0] = 1, oldDp[1] = (x[1] == 1 ? 1 : 2), oldDp[2] = 1;

	x[0] = 1, x[M + 1] = N;

	for (i64 i = 1 + (x[1] == 1); i <= M + 1; i++)
	{
		//printf("now %d, %d %d %d\n", i, oldDp[0], oldDp[1], oldDp[2]);
		matrix<> now = modularExp(mat, x[i] - x[i - 1]);

		for (int k = 0; k < 3; k++)
			newDp[k] = (oldDp[0] * now[k][0] % MOD + oldDp[1] * now[k][1] % MOD
					+ oldDp[2] * now[k][2] % MOD) % MOD;

		newDp[1] = (newDp[1] - newDp[0] + MOD) % MOD;
		swap(newDp, oldDp);
	}

	cout << oldDp[0] << endl;

	return 0;
}



Measured memory_bytes: 1024
#include <stdio.h>

int main(){
    
    char c[100000];
    int i=0,j;
    while(1){
        scanf("%c",&c[i]);
        if(i%2==0)
            printf("%c",c[i]);
        if(c[i]=='\n')
            break;
        i++;
    }
    
}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    h,w,k = LI()
    aa = [[c=="#" for c in S()] for _ in range(h)]
    rr = [[0]*w for _ in range(h)]
    t = 0
    for i in range(h):
        if not any(aa[i]):
            continue
        t += 1
        f = False
        for j in range(w):
            if aa[i][j]:
                if f:
                    t += 1
                else:
                    f = True
            rr[i][j] = t

        for ii in range(i+1,h):
            if any(aa[ii]):
                break
            for j in range(w):
                rr[ii][j] = rr[i][j]

        for ii in range(i-1,-1,-1):
            if any(aa[ii]):
                break
            for j in range(w):
                rr[ii][j] = rr[i][j]

    return JAA(rr,"\n", " ")


print(main())





Measured memory_bytes: 10776
#include <stdio.h>
#include <string.h>
#define M 2000000
#define I (1<<30)

int H,A[M+1];

void maxheapify(int i){
    int l,r,largest,cng;
    l=2*i;
    r=2*i+1;

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

    if(largest != i){
        cng=A[largest];
        A[largest]=A[i];
        A[i]=cng;
	maxheapify(largest);
    }
}

int extract(){
    int v;
    if(H<1)return -I;
    v=A[1];
    A[1]=A[H--];
    maxheapify(1);
    return v;
}

void increase(int i,int key){
    int cng;
    if(key<A[i])return;
    A[i]=key;
    while(i>1 && A[i/2]<A[i]){
        cng=A[i/2];
        A[i/2]=A[i];
        A[i]=cng;
        i=i/2;
    }
}

void insert(int key){
    H++;
    A[H]=-I;
    increase(H,key);
}

int main(){
    int key;
    char s[10];

    while(1){
        scanf("%s",s);
        if(s[0]=='e' && s[1]=='n')break;
        if(s[0]=='i'){
            scanf("%d",&key);
            insert(key);
        }else{
            printf("%d\n",extract());
        }
    }
    return 0;
}



Measured memory_bytes: 5612
#include "bits/stdc++.h"
using namespace std;
#define repi(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)
#define rep(i,n) repi(i,0,n)
#define all(x) (x).begin(),(x).end()
#define vsort(v) sort((v).begin(), (v).end())
#define gsort(v) tsort(v); reverse((v).begin(), (v).end())
#define vrev(v) reverse((v).begin(), (v).end())
#define siz(v) ((int)(v).size())
#define ers(v, n) (v).erase((v).begin() + n)
#define cnt(v, n) count(all(v), n)
#define vmin(v) *min_element(v.begin(), v.end())
#define vmax(v) *max_element(v.begin(), v.end())
#define el "\n"
#define co(x) cout<<(x)<<el
#define coc(c, a, b) if(c)co((a));else co((b))
#define cosp(x) cout<<(x)<<' '
#define YES(c) coc(c,"YES", "NO")
#define Yes(c) coc(c,"Yes", "No")
#define yes(c) coc(c,"yes", "no")
#ifdef tqktmp_2
#define gc() getchar(); getchar()
#else
#define gc() 1
#endif
typedef long long lint;

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

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	
	lint n, i=0, h=0; cin >> n;
	string s; cin >> s;
	while (i < n) {
		if (s[i] == '(')h++;
		else h--;

		if (h < 0) {
			s.insert(0, "(");
			h++;
			i++; n++;
		}
		
		i++;
	}
	rep(i, h) {
		s.push_back(')');
	}
	co(s);
	gc();
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	static char[][] c;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 定型ループ
		int a = sc.nextInt();
		int b = sc.nextInt();

		int ans = a - 1;
		if (b >= a) {
			ans += 1;
		}

		System.out.println(ans);
	}
}


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

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))
#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
typedef pair<int,int>   II;
typedef vector< II >      VII;
typedef vector<int>     VI;
typedef vector< VI > 	VVI;
typedef long long int 	LL;
typedef vector<LL> 		VL;
#define si(n) cin>>n
#define dout(n) cout<<n<<"\n"
#define DRT() int t; si(t); while(t--)
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
//# define M_PI           3.14159265358979323846264338327950288
// DSU
void IO(){
	#ifndef ONLINE_JUDGE
    freopen("../input.txt", "r", stdin);
    freopen("../output.txt", "w", stdout);
	#endif
	srand(chrono::steady_clock::now().time_since_epoch().count());
	off;
}

int main(){
	IO();
	LL n,x,t;
	cin>>n>>x>>t;
	LL a = (n+x-1)/x;
	a = a*t;
	cout<<a;
	return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define mem(a) memset(a, 0, sizeof(a))
using namespace std;
typedef pair<int, int> Pii;
typedef long long LL;
const int MAXN = 2005;
const int inf = 0x3f3f3f3f;
const int Mod = 100000000;
LL a[MAXN];
int main()
{
    LL n, z, w;
    scanf("%lld %lld %lld", &n, &z, &w);
    for(int i=1;i<=n;++i)
        scanf("%lld", &a[i]);
    LL ans;
    ans=abs(w-a[n]);
    if(n!=1)
        ans=max(ans, abs(a[n]-a[n-1]));
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF = (1 << 29);

struct Matrix
{
  int r, c;
};

vector<Matrix> M;

int rec(vector<vector<int>> &dp, int top, int bottom)
{
  if (dp.at(top).at(bottom) != INF)
  {
    return dp.at(top).at(bottom);
  }
  if (top == bottom)
  {
    dp.at(top).at(bottom) = 0;
    return 0;
  }
  for (int mid = top; mid < bottom; mid++)
  {
    dp.at(top).at(bottom) = min(dp.at(top).at(bottom), rec(dp, top, mid) + rec(dp, mid + 1, bottom) + M.at(top).r * M.at(mid).c * M.at(bottom).c);
  }
  return dp.at(top).at(bottom);
}

int main()
{
  int n;
  cin >> n;
  M.resize(n);
  for (int i = 0; i < n; i++)
  {
    int r, c;
    cin >> r >> c;
    M.at(i) = Matrix{r, c};
  }
  vector<vector<int>> dp(n + 1, vector<int>(n + 1, INF));
  cout << rec(dp, 0, n - 1) << endl;
}


Measured memory_bytes: 3196
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=505;
int mp[maxn][maxn];
void f(int l,int r,int deep){
    int s=r-l+1;
    if(s==2){
        mp[l][r]=deep;
        return;
    }
    if(s==1){
        return;
    }
    int s1=s/2,s2=s-s1;//s1<=s2
    for(int i=l;i<=l+s1-1;i++){
        for(int j=l+s1;j<=r;j++){
//            printf("i=%d j=%d\n",i,j);
            mp[i][j]=deep;
        }
    }
    f(l,l+s1-1,deep-1);
    f(l+s1,r,deep-1);
    return;
}
int main(){
    int n;
    cin>>n;
    int nn=n;
    int maxc=1;
    while(nn>2){
        nn=(nn+1)/2;
        maxc++;
    }
//    printf("maxc=%d\n",maxc);
    f(1,n,maxc);
    for(int i=1;i<=n-1;i++){
        for(int j=i+1;j<=n;j++){
            printf("%d ",mp[i][j]);
        }
        printf("\n");
    }
}









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

using namespace std;

#define MAX 6001
#define MAX_CP 2001
#define INF 1e9

struct State{
  int dist,v,cap;
  State(int dist,int v,int cap) 
    : dist(dist),v(v),cap(cap) {}

  bool operator > (const State &s)const{
    return dist > s.dist;
  }
};

struct Edge{
  int to,dist;
  Edge(int to,int dist) : to(to),dist(dist) {}
};

int N,M,cap,src,dst,idx;
set<int> LPG;
vector<Edge> G[MAX];

void init(){
  idx = 1;
  LPG.clear();
  for(int i = 0 ; i < MAX ; i++){
    G[i].clear();
  }
}

int dijkstra(){
  vector<int> dist[idx];
  cap *= 10;
 
  for(int i = 0 ; i < idx ; i++){
    dist[i].resize(cap+1);
    for(int j = 0 ; j <= cap ; j++){
      dist[i][j] = INF;
    }
  }

  dist[src][cap] = 0;

  priority_queue<State,vector<State>,greater<State> > Q;
  Q.push(State(0,src,cap));

  while(!Q.empty()){
    State s = Q.top(); Q.pop();
    int v = s.v,c = s.cap;
    
    if(dist[v][c] < s.dist) continue;
    
    if(v == dst){
      return dist[v][c];
    }

    for(int i = 0 ; i < (int)G[v].size() ; i++){
      Edge e = G[v][i];
      int nc = (LPG.find(v) != LPG.end()) ? cap : c;
      if(e.dist <= nc){
        nc -= e.dist;
        if(dist[v][c] + e.dist < dist[e.to][nc]){
          dist[e.to][nc] = dist[v][c] + e.dist;
          Q.push(State(dist[e.to][nc],e.to,nc));
        }                           
      }
    }
  }
  return -1;
}

int main(){
  int d;
  string a,b;
  
  while(cin >> N >> M >> cap, N){
    init();
    map<string,int> mp; 
    cin >> a; mp[a] = src = idx++; 
    cin >> a; mp[a] = dst = idx++; 
    for(int i = 0 ; i < N ; i++){
      cin >> a >> b >> d;
      if(mp.find(a) == mp.end()){
        mp[a] = idx++;
      }
      if(mp.find(b) == mp.end()){
        mp[b] = idx++;
      }
      G[mp[a]].push_back(Edge(mp[b],d));
      G[mp[b]].push_back(Edge(mp[a],d));
    }
    for(int i = 0 ; i < M ; i++){
      cin >> a;
      LPG.insert(mp[a]);
    }
    cout << dijkstra() << endl;
  }
  return 0;
}

Measured memory_bytes: 50720
#include <iostream>

using namespace std;

int main() {
    long long N, M;
    cin >> N >> M;
    if (N == 1 && M == 1) {
        cout << 1 << endl;
    } else if (N == 1) {
        cout << (M-2) << endl;
    } else if (M == 1) {
        cout << (N-2) << endl;
    } else {
        cout << ((N-2)*(M-2)) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,s,n) for(int i=s;i<n;i++)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define int long long
using namespace std;
using P=pair<int,int>;
using Graph=vector<vector<int>>;
using ll=long long;


ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}
bool root(string s){
    int n=s.length();
    if(n==2){
        if(s[0]==s[1]){
            return true;
        }
        else return false;
    }
    if(n==3){
        if(s[0]==s[2]){
            return true;
        }
        else return false;
    }
 
    return false;
}
 
 
//深さ優先
vector<int> seen;
vector<ll> h;
 
//普通の深さ優先探索seenを返す感じ
void dfs(const Graph &G,int v){
    seen[v] = 0; //v探索済み
 
    P good=make_pair(v,h[v]);
    for(auto next_v :G[v]){
        if(seen[next_v]!=-1) continue;//もう探索していた
        if(h[next_v]>good.second){
            good=make_pair(next_v,h[next_v]);
        }
        dfs(G,next_v);
    }
 
    if(!(h[v]==good.second && v==good.first)){
        seen[good.first]=1;
    }
}
 
signed main(){
    /*
    int n,m;
    cin>>n>>m;
 
    h.assign(n,0);
    rep(i,0,n) cin>>h[i];
 
    Graph G(n);
    rep(i,0,m){
        int a,b; cin>>a>>b;
        G[a-1].push_back(b-1);
        G[b-1].push_back(a-1);
    }
 
    seen.assign(n,-1);
 
    rep(i,0,n){
        if(seen[i]==-1){
            dfs(G,i);
        }
    }
 
    int sum=accumulate(all(seen),0);
 
    cout<<sum<<endl;*/
 
    int n;
    cin>>n;
    vector<vector<int>> a(2,vector<int>(n,0));
    rep(i,0,2){
        rep(j,0,n) cin>>a[i][j];
    }

    int res=0;
    rep(i,0,n){
        int ans=0;
        rep(ue,0,i+1){
            ans+=a[0][ue];
        }
        rep(sit,i,n){
            ans+=a[1][sit];
        }

        res=max(ans,res);
    }

    cout<<res<<endl;
}   

Measured memory_bytes: 256
import numpy as np
i8 = np.int64
i4 = np.int32

def calc(dp1, dp2, k):
    dp2[k:] += dp1[:dp1.shape[0]-k]
    dp2[:dp2.shape[0]-k] += dp1[k:]

def solve(z, dp):
    zero = dp.shape[2] // 2
    dp[0, 0, zero + z[0, 0]] = 1
    dp[0, 0, zero - z[0, 0]] = 1
    for x in range(1, z.shape[1]):
        calc(dp[0, x - 1], dp[0, x], z[0, x])
    for y in range(1, z.shape[0]):
        calc(dp[y - 1, 0], dp[y, 0], z[y, 0])
        for x in range(1, z.shape[1]):
            calc(dp[y, x - 1], dp[y, x], z[y, x])
            calc(dp[y - 1, x], dp[y, x], z[y, x])
            if (x + y) % 50 == 0:
                dp[y, x] = dp[y, x] > 0
    for i in range(zero, dp.shape[2]):
        if dp[dp.shape[0] - 1, dp.shape[1] - 1, i] > 0:
            return i - zero
    return -1

def main2():
    stdin = open('/dev/stdin')
    H, W = map(int, stdin.readline().split())
    a = np.empty((H, W), i8)
    b = np.empty((H, W), i8)
    for i in range(H):
        for j, c in enumerate(map(int, stdin.readline().split())):
            a[i, j] = c
    for i in range(H):
        for j, c in enumerate(map(int, stdin.readline().split())):
            b[i, j] = c
    z = np.abs(a - b)
    dp = np.zeros((H, W, 80 * 80 *2 + 1), i8)
    ans = solve(z, dp)
    print(ans)


main2()

Measured memory_bytes: 652580