akhauriyash/Code-Regression huggingface dataset:
#include <ext/pb_ds/assoc_container.hpp> 	// Common file
#include <ext/pb_ds/tree_policy.hpp> 		// Including tree_order_statistics_node_update
#include<bits/stdc++.h>
#define int            		long long
#define x              		first
#define y              		second
#define all(aaa)       		(aaa).begin(),(aaa).end()
#define REP(i,sss,eee) 		for(int i=sss;i<=eee;++i)
#define pb             		push_back
#define pii            		pair<int,int>
#define vi             		vector<int>
#define speed          		ios_base::sync_with_stdio(0);cin.tie(0);
#define N              		1000000007
#define inf					1000000000000000000
using namespace __gnu_pbds;
using namespace std;
template <class T>
T MAX(T a, T b){return ((a>b)?a:b);}
template <class T>
T MIN(T a, T b){return ((a<b)?a:b);}
template <class T>
T MOD(T a){return ((a>=0)?a:(-1*a));}
template <class T>
void SWAP(T &a,T &b){T temp=a;a=b;b=temp;}

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

inline int ex(int a, int b){
	if(b==0||a==1){return 1;}
	if(a==0||b==1){return a;}
	int tmp=ex(a,(b/2));
	if(b%2){return ((((tmp*tmp)%N)*a)%N);}
	else{return ((tmp*tmp)%N);}
}
inline int inv(int k){
	if(k==1){return 1;}
	else{return ex(k,N-2);}
}
/*****************default********************/
int solve()
{
	int a,b,c;
	cin>>a>>b>>c;
	cout<<MIN(b/a,c);
}
signed main(){
	speed
	int tt=1;
	//cin>>tt;
	while(tt--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 256
while True:
    a, op, b = input().split()
    a = int(a)
    b = int(b)
    if op == "+":
        ans = a+b
    elif op == "-":
        ans = a-b
    elif op == "*":
        ans = a*b
    elif op == "/":
        ans = a//b
    else:
        break
    print(ans)


Measured memory_bytes: 5596
#![allow(non_snake_case,unused_imports,dead_code)]
use std::cmp::max;
use std::cmp::min;
use std::str::FromStr;
use std::collections::{HashMap,HashSet,VecDeque,BinaryHeap};
use std::cmp::Ordering;

use proconio::input;
use proconio::marker::{Chars,Usize1,Isize1};

fn comp_f64(a: &f64, b: &f64) -> Ordering {
    if a < b {
        return Ordering::Less;
    } else if a > b {
        return Ordering::Greater;
    }
    Ordering::Equal
}

fn main() {
    input!{
        H:usize,
        W:usize,
        C:[[isize;10];10],
        A:[[isize;W];H]
    }
    let mut G = GraphWarshallFloyd::new(10,10000);
    for i in 0..10{
        for j in 0..10{
            G.set(i,j,C[i][j]);
        }
    }
    G.run();
    let mut ans = 0;
    for B in &A{
        for &a in B{
            if a==-1{continue;}
            ans += G.get(a as usize,1);
        }
    }
    println!("{}",ans);
}

struct GraphWarshallFloyd{
    N:usize,
    Dist:Vec<Vec<isize>>,
    INF:isize
}

impl GraphWarshallFloyd {
    fn new(N:usize,INF:isize) -> GraphWarshallFloyd{
        let mut ret = GraphWarshallFloyd{N:N,Dist:Vec::new(),INF:INF};
        ret.Dist = vec![vec![INF;N];N];
        for i in 0..N{
            ret.Dist[i][i] = 0;
        }
        ret
    }
    fn set(&mut self,from:usize,to:usize,dist:isize){
        self.Dist[from][to] = dist;
    }
    fn get(&self,from:usize,to:usize)->isize{
        self.Dist[from][to]
    }
    fn run(&mut self){
        let N = self.N;
        for k in 0..N{
            for i in 0..N{
                for j in 0..N{
                    self.Dist[i][j] = min(self.Dist[i][j],self.Dist[i][k]+self.Dist[k][j]);
                }
            }
        }
    }
}

Measured memory_bytes: 2528
#include<cstdio>
#include<iostream>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<deque>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<limits>
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
using namespace std;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef long long ll;
typedef unsigned long long ull;
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;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}
template<class T>inline void outs(vector<T> V){int n=V.size();rep(i,n)cout<<V[i]<<" \n"[i==n-1];}
inline void solve(void){
  cpp_int h,w;in(h,w);
  if(h==1||w==1)out(1);
  else out(((h+1)/2)*((w+1)/2)+((h/2)*(w/2)));
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 256
/*+lmake
 * STD = c++14
 * DEFINE += WAAUTOMATON
 */
#include <bits/stdc++.h>
using namespace std;
using LL=long long;
using ULL=unsigned long long;
#ifdef WAAUTOMATON
     #define debug(args...)            {dbg,args; cerr<<endl;}
#else
    #define debug(args...)              // Just strip off all debug tokens
#endif

struct debugger
{
    template<typename T> debugger& operator , (const T& v)
    {    
        cerr<<v<<" ";    
        return *this;    
    }
} dbg;
#define MAXN 100000
LL f[MAXN+10],g[MAXN+10];
void solve(long long n, long long e, long long t, vector<long long> x){
	g[n+1]=LLONG_MAX/3;
	int j=n;
	for(int i=n; i>=1; --i) {
		while(2*(x[j-1]-x[i-1])>t) --j;
		f[i]=min(f[j+1]+t,g[j+1]-2*x[i-1]);
		g[i]=min(g[i+1],f[i+1]+2*x[i-1]);
	}
	cout<<f[1]+e<<endl;
}

int main(){	
#ifdef WAAUTOMATON
	//freopen("in.txt","r",stdin);
#endif
	long long T;
	long long E;
	long long N;
	scanf("%lld",&N);
	vector<long long> x(N-1+1);
	scanf("%lld",&E);
	scanf("%lld",&T);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&x[i]);
	}
	solve(N, E, T, x);
	return 0;
}


Measured memory_bytes: 3328
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back

using namespace std;
const long long MOD = (long long)1e9 + 7;

int n, cnt[30], k;
string s;
long long quickpow(long long b, int e)
{
	return e ? ((e & 1 ? b : 1)*quickpow((b*b) % MOD, e >> 1)) % MOD : 1;
}
int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> s;
	for (int i = 0; i < (int)s.length(); i++) {
		if (cnt[s[i] - 'a'] == 0) k++;
		cnt[s[i] - 'a']++;
	}
	long long ans = 1;
		for (int i = 0; i < 30; i++) {
			if (cnt[i]) {
				ans = ans * (cnt[i] + 1);
				ans = ans % MOD;
			}
		}
	cout << (ans - 1 + MOD)%MOD << "\n";
	//system("pause");
	return 0;
}

Measured memory_bytes: 512
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = False

#コンビネーション
def cmb(n, r):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % mod

N = 200  # N は必要分だけ用意する
mod = pow(10, 50) + 7
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % mod)
    inv.append((-inv[mod % i] * (mod // i)) % mod)
    factinv.append((factinv[-1] * inv[-1]) % mod)


n, p = MAP()
a = LIST()
arr = [i % 2 for i in a]
num1 = sum(arr)
num0 = n - num1
ans = 0
for i in range(n + 1): #全体でi個選ぶ
    for j in range(i + 1): #1をj個選ぶ
        if j % 2 == p:
            ans += cmb(num1, j) * cmb(num0, i - j)
print(ans)


Measured memory_bytes: 60268
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn main() {
    let n = read::<u32>();
    if n >= 1000 {
        println!("ABD");
    } else {
        println!("ABC");
    }
}


Measured memory_bytes: 4352
#include<vector>
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<string.h>
#include<list>
#include<limits>
#include<bitset>
#include<ctype.h>
#include<set>
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
const ll MOD=1000000007LL;
const ll INF=1000000000;
const int MAX=100001;
const double EPS=1e-10;
int main(){
    ll n,m;
    cin>>n>>m;
    if(n==1&&m==1){
        cout<<1<<endl;
        return 0;
    }else if(n==2||m==2){
        cout<<0<<endl;
        return 0;
    }else if(n==1||m==1){
        cout<<max(n,m)-2<<endl;
        return 0;
    }else{
        ll ans=(n-2)*(m-2);
        cout<<ans<<endl;
    }
    return 0;
}

                           


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> v(N);
  for (int i=0;i<N;i++){
    cin >> v[i];
  }
  sort(v.begin(),v.end());
  int sum=0;
  for (int i=0;i<N;i++){
    if (i!=N-1){
      sum+=v[i];
    }
    else {
      sum+=v[i]/2;
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
//************************
//*  Date: 2018.9.22     *
//*  Problem:            *
//*  Author: xuziyuan    * 
//************************

#include <bits/stdc++.h>

#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define replet(c) for(char c='a';c<='z';c++)
#define LL long long
#define pii pair<int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair
#define sqr(a) ((a)*(a))

using namespace std;

const LL MOD=1e9+7;

string s;

int main()
{
	cin>>s;
	rep(i,3) if(s[i]=='1') s[i]='9';else s[i]='1';
	cout<<s<<endl;
	rt0;
}

Measured memory_bytes: 256
N = int(input())
h = list(map(int, input().split()))

dp=[0]*N

for n in range(1,N):
  
  if n==1:
    dp[1]=abs(h[1]-h[0])
    
  else:
    dp[n]=min(abs(h[n]-h[n-1])+dp[n-1],abs(h[n]-h[n-2])+dp[n-2])


print(dp[N-1])
    

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

void solve()
{
	int n;
	cin >> n;
	set<string> st;
	string s;
	
	for(int i = 0; i<n; i++)
	{
		cin >> s;
		st.insert(s);
	}
	cout << st.size() << "\n";
	
}

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


Measured memory_bytes: 19228
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Kein Yukiyoshi
 */

#include "bits/stdc++.h"
#define int long long
#define rep(i, n)           for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b)        for (int i = (int)(a); i < (int)(b); i++)
#define FOR(i, a)           for (auto &i : a)
#define ALL(obj)            begin(obj), end(obj)
#define MAX(x)              *max_element(ALL(x))
#define MIN(x)              *min_element(ALL(x))
#define SUM(x)              accumulate(ALL(x), 0LL)
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))

using namespace std;
const int MOD    = (int)(1e9 + 7);
const int INF    = (int)(1e13 + 7);
const double EPS = 1e-14;
const double PI  = acos(-1);

int CEIL(int a, int b) { return (a >= 0 ? (a + (b - 1)) / b : (a - (b - 1)) / b); } //ceil() for int
int mod(int a, int b) { return a >= 0 ? a % b : a - (b * CEIL(a, b)); }             //always return positive num
int bpm(int a, int b) {                                                             //return x^y in order(log(y))
  int res = 1;
  for (a %= MOD; b; a = a * a % MOD, b >>= 1)
    if (b & 1) res = res * a % MOD;
  return res;
}

class BAnOddProblem {
public:
  static void solve(istream &cin, ostream &cout) {
    int N;
    cin >> N;
    int ans = 0;
    rep(i, N) {
      int temp;
      cin >> temp;
      if (i % 2 == 0 and temp % 2 == 1) {
        ans++;
      }
    }
    cout << ans << endl;
  }
};


signed main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
  BAnOddProblem solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define INF 9223372036854775807
#define pairint pair<int,int>
signed main()
{
int x=0,y=0,z=0,w=0;
string s;
std::cin >>x>> s;
rep(i,x-2){
  if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C'){
  w++;
  i+=2;
  }
}
std::cout << w << '\n';
}


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

#define INF 1000000000
#define ALL(a) (a).begin(), (a).end()

using namespace std;
typedef long long ll;

int main()
{
  vector<vector<int>> vvi(600);
  int memo[600][600] = { };
  for (int i = 0; i < 600; i++) {
    for (int j = 0; j < 600; j++) {
      memo[i][j] = -1;
    }
  }

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

  // vvi[l][i] := 左端lの区間の右端
  for (int i = 0; i < m; i++) {
    int l, r;
    cin >> l >> r;
    vvi[l].push_back(r);
  }
  for (int i = 1; i <= 500; i++) {
    vvi[i].push_back(INF);
    sort(ALL(vvi[i]));
  }

  for (int i = 0; i < q; i++) {
    ll ans = 0;
    int l, r; cin >> l >> r;

    //右端をl～rまで動かす
    for (int j = l; j <= r; j++) {
      if (memo[j][r] != -1) {
        ans += memo[j][r];
        continue;
      }
      //[j, r]に含まれる区間の個数を数える
      //INFになってしまったらvvi[j]の全要素が[j, r]に含まれる
      //memo[j][r] = [j, r]に含まれる区間の個数として、再利用する
      int idx = upper_bound(ALL(vvi[j]), r) - vvi[j].begin();
      if (vvi[j][idx] != INF) {
        ans += idx;
        memo[j][r] = idx;
      } else {
        ans += vvi[j].size() - 1;
        memo[j][r] = vvi[j].size() - 1;
      }
    }
      cout << ans << endl;
  }
    return 0;
}


Measured memory_bytes: 3584
#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=1e9+7;

int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n+1),b(n+1);
    ll sum=0;
    rep(i,n+1){
        cin >> a[i];
        sum+=a[i];
        b[i]=a[i];
    }
    ll ans=0;
    ll curr=1;
    bool ok=true;
    rep(i,n+1){
        if(i==0){
            if((a[i]!=0 && n!=0) || (n==0 && a[i]!=1)){
                ok=false;
                break;
            }
            ans+=curr;
        }
        if(i){
            curr=min(2*curr,sum);
            curr-=a[i];
            if(curr<0){
                ok=false;
                break;
            }
            sum-=a[i];
            ans+=curr+a[i];
        }
    }
    if(!ok){
        cout << -1 << endl;
        return 0;
    }
    cout << ans << endl;
    return 0;
} 

Measured memory_bytes: 4820
#include <iostream>

using namespace std;

int main()
{
    string s;
    cin>>s;
    bool pot=false;
    for(int i=1;i<s.size();i++){
        if(s[i]!=s[i-1]){
            pot=true;
        }
    }
    if(pot==true){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
    return 0;
}


Measured memory_bytes: 256
a,b,c,x,y = list(map(int, input().split()))

if(c * 2 <= a + b):
  if(x >= y):
    hoge = c * (2 * x)
    fuga = c * (2 * y) + a * (x - y)
    if(hoge > fuga):
	    print(fuga)
    else:
      	print(hoge)
  else:
    hoge = c * (2 * y)
    fuga = c * (2 * x) + b * (y - x)
    if(hoge > fuga):
	    print(fuga)
    else:
      	print(hoge)
else:
  print(a * x + b * y)

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
string odd,even;
int main()
{
	cin>>odd>>even;

	string ans = "";
	int len_odd = odd.length();
	int len_even = even.length();

	int cnt_even = 0;
	for (int i = 0 ; i < len_odd ; i++)
	{
		ans+=odd[i];
		if (cnt_even < len_even) ans+=even[cnt_even++];
	}

	cout<<ans<<endl;

}

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


void init(){
    cin.tie(0);
    cin.sync_with_stdio(0);
}

#define ll long long
#define ld long double
#define ull unsigned long long
#define ull unsigned long long
#define mod 1000000007
#define pi (3.1415926)

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))

#define scd(a)  scanf("%lld",&a)
#define scdd(a,b)	scanf("%lld%lld",&a,&b)
#define scddd(a,b,c)	scanf("%lld%lld%lld",&a,&b,&c)
#define ptab(a)	printf("%lld ",a)
#define pdn(a)	printf("%lld\n",a)
#define pddn(a,b)	printf("%lld %lld\n",a,b)
#define pdddn(a,b,c)	printf("%lld %lld %lld\n",a,b,c)

#define Filein(N) freopen("N", "r", stdin);
#define Fileout(N) freopen("N", "w", stdout);

#define forr(n) for(ll i=0;i<n;i++)
#define rev(n) for(ll i=n-1;i>=0;i--)
#define forp(x, y) for(ll i=x;i<y;i++)
#define loop( j, k, in) for (ll i=j ; i<k ; i+=in)

#define en "\n"
#define sp " "
#define eps 1.0E-14
#define l length()
#define preci(x) cout << fixed<<setprecision(x)
#define inf LONG_LONG_MAX
#define ninf LONG_LONG_MIN

int fastpow(int a,int b)
{
  int wynik=1;
  while (b)
  {
    if (b&1)wynik=(wynik*a)%mod;
    a=(a*a)%mod;
    b>>=1;
  }
  return wynik;
}

bool odd(int n)
    {
        int x = sqrt(n);
    for (int i=2 ; i<=x ; ++i)

    {
        if(n%i == 0)return false;
    }

    return true;
    }
ll fact(int n ){

long long fact =1;

for (int i =2 ;i<=n;++i)

{
    fact*=i;
}
return fact;
}

ll sum (int n ){return ((n*(n+1)) / 2) ;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

bool myfunction (string i,string j) /* this function to check who is grater in
sorting strings as numbers ////////
int n;
    cin>>n;
    vector <string> arr(n);
    for(int i=0;i<n;i++)
        cin>>arr[i];


    sort(arr.begin(),arr.end(),myfunction);

    for(int i=0;i<n;i++)
        cout<<arr[i]<<endl;
*/
{
    int n=i.length();
    int m=j.length();
    if(n==m)
        return (i<j);

    return n<m;
}

int main()
{
    init();
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    int a , b; cin>>a>>b; cout << a*b;
}



Measured memory_bytes: 3680
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define speedX ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
#define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
template<typename T>
void __p(T a) { cout << a << " "; }
template<typename T, typename F>
void __p(pair<T, F> a) { cout << "{ "; __p(a.first); __p(a.second); cout << "}"; }
template<typename T>
void __f(const char* s, T t) { cout << s << " : "; __p(t); }
template<typename T>
void __t(const char* s, const T &x) { cout << s << " : { "; for (auto it : x) __p(it); cout << "} ";}
template<typename T, typename ... F>
void __f(const char* s, T t, F ... f) {
	int i = 0; for (;; ++i) if (s[i] == ',') break;
	cout.write(s, i) << " : "; __p(t); cout << " | "; __f(s + i + 1, f...);
}
#define trace(...) { cout<<"LINE: "<<__LINE__<<" || "; __f(#__VA_ARGS__,__VA_ARGS__); cout<<"\n\n"; }
#define debug(...) { cout<<"LINE: "<<__LINE__<<" || "; __t(#__VA_ARGS__,__VA_ARGS__); cout<<"\n\n"; }
int begtime = clock();
#define end_time() cout << "\n\nTime of execution: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define trace(...)
#define debug(...) 
#define end_time()
#endif
 
 
#define int long long 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef vector<int> vi;
typedef vector<pii> vii;

inline bool equals(ld a, ld b) {return fabs(a - b) < 1e-9;}
inline int gcd(int a, int b) { a=abs(a); b=abs(b); while(a>0 && b>0) (a>b?a%=b:b%=a); return (a==0?b:a); } 
inline int power(int x, int n, int m = LLONG_MAX)
    {  int res=1; x = (x%m + m)%m;
       while(n) { if(n&1) res=(res*x)%m;  x=(x*x)%m;  n >>= 1; }  return res;
    }
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define uset unordered_set
#define umap unordered_map
#define all(x) x.begin(), x.end()
#define mod 1000000007

void solve(){
	int k,a,b;
	cin>>k>>a>>b;
	int d = a/k;
	int l = k*d;
	if(l>=a && l<=b){
		cout<<"OK\n";
		return;
	}
	l+=k;
	if(l>=a && l<=b){
		cout<<"OK\n";
		return;
	}
	else{
		cout<<"NG\n";
		return;
	}
}
signed main(){
	speedX;
	#ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
	int t=1;
	//cin>>t;
	for(int i=1;i<=t;++i) {
		//cout<<"Case #"<<i<<": ";
		solve();
	}
	end_time();
	return 0;
}


Measured memory_bytes: 3640
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial
sys.setrecursionlimit(200000)
input = sys.stdin.readline

# X, A, B = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
S = input().strip()

l = set([v for v in range(97, 123)])
for v in S:
    l = l - {ord(v)}

if len(l) == 0:
    print("None")
    exit()
print(chr(min(l)))

Measured memory_bytes: 3564
// template version 1.15
using namespace std;
#include <bits/stdc++.h>

// varibable settings
#define int long long
const int INF=1e18;

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(a, b, c) make_tuple(a, b, c)
#define divceil(a,b) ((a)+(b)-1)/(b)
#define is_in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

void sputs(){}
template <class Head, class... Tail>
void sputs(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(Tail) == 0) { cout << endl; }
  else { cout << " "; }
  sputs(std::move(tail)...);
}

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}


int double_sweep(const auto & g){
  int n = sz(g);
  int x = 0;
  int max_d = 0;
  auto dfs = [&](const auto& dfs, auto& d, int u, int cost) -> void {
    each(v, g[u]){
      if (d[v]<INF) continue;
      d[v] = cost+1;
      if (d[v]>max_d){
        chmax(max_d, d[v]);
        x = v;
      }
      dfs(dfs, d, v, cost+1);
    }
  };

  vi d0(n, INF); d0[0] = 0;  // distance from 0
  dfs(dfs, d0, 0, 0);
  vi dx(n, INF); dx[x] = 0;  // distance from x
  int a = x;  // 保存

  max_d = 0;
  dfs(dfs, dx, x, 0);
  int b = x;

  return max_d; // d(a,b) == max_d;
}

signed main() {
  int n;cin>>n;
  vvi g(n);
  rep(i, n-1){
    int a,b;cin>>a>>b;
    a--;b--;
    g[a].pb(b);
    g[b].pb(a);
  }
  int max_d = double_sweep(g);
  dump(max_d);

  vi dp(n+1);
  dp[0] = 1;
  dp[1] = 0;
  rep(i, 2, n+1){
    if (dp[i-1]==0 || dp[i-2]==0) dp[i] = 1;
  }
  cout << (dp[max_d]?"First":"Second") << endl;

  return 0;
}


Measured memory_bytes: 20608
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
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; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    string S;
    cin >> S;

    rep(i, S.size()) {
        if (S[i] == ',') cout << " ";
        else cout << S[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  cout<<fixed;
  int a,b;
  cin>>a>>b;
  cout << max(a+b,max(a-b,a*b)) << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip>//setprecision
#include<math.h>
#include <functional>
#include<climits>
using namespace std;
#define ll  long long 
#define rep(i, n)        for(ll i=0; i<(ll)(n); ++i)
#define mod 1000000007
  vector<ll>to[1000005];
int main(){
  char a;cin>>a;
  if('a'<=a)cout<<"a";
  else cout<<"A";

}


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

string s, t, ans;
int dp[3005][3005];

int solve(int l, int r)
{
	if(l < 0 or r < 0) return 0;
	if(dp[l][r] != -1) return dp[l][r];
	if(s[l] == t[r]) return dp[l][r] = solve(l - 1, r - 1) + 1;
	return dp[l][r] = max(solve(l - 1, r), solve(l, r - 1));
}

void ANS(int l, int r)
{
	if(!l or !r) return;
	if(s[l] == t[r])
	{
		ANS(l - 1, r - 1);
		ans.push_back(s[l]);
	}
	else if(dp[l - 1][r] != -1 and dp[l - 1][r] > dp[l][r - 1])
		ANS(l - 1, r);
	else if(dp[l][r - 1] != -1)
		ANS(l, r - 1);
}

int main()
{
	cin >> s >> t;
	memset(dp, -1, sizeof(dp));
	s = "@" + s;
	t = "#" + t;
	solve(s.size() - 1, t.size() - 1);
	ANS(s.size() - 1, t.size() - 1);
	cout << ans << '\n';

	return 0;
}

Measured memory_bytes: 35840
#define _USE_MATH_DEFINES

#include <cmath>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <bitset>

using namespace std;

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

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

class edge {
public:
    int from, to;
    ll cost;

    edge(int t, ll c) : from(-1), to(t), cost(c) {}

    edge(int f, int t, ll c) : from(f), to(t), cost(c) {}

    bool operator<(const edge &e) const {
        return cost < e.cost;
    }

    bool operator>(const edge &e) const {
        return cost > e.cost;
    }
};

const ll INF = numeric_limits<ll>::max();

vector<ll> bellmanford(vector<edge> &g, int n, int s) {
    vector<ll> d(n, INF);
    d[s] = 0;
    for (int i = 0; i < n - 1; ++i) {
        for (auto &e : g) {
            if (d[e.from] == INF) continue;
            d[e.to] = min(d[e.to], d[e.from] + e.cost);
        }
    }

    // Negative Cycle -> d.empty()
    for (auto &e : g) {
        if (d[e.from] == INF) continue;
        if (e.to == n - 1 && d[e.to] > d[e.from] + e.cost) return vector<ll>();
        d[e.to] = min(d[e.to], d[e.from] + e.cost);
    }


    return d;
}

int main() {
    /*
    ios::sync_with_stdio(false);
    cin.tie(0);
     */
    int n, m;
    cin >> n >> m;
    vector<edge> g;
    for (int i = 0; i < m; ++i) {
        int a, b;
        ll c;
        cin >> a >> b >> c;
        a--, b--;
        g.emplace_back(a, b, -c);
    }

    auto dist = bellmanford(g, n, 0);
    if (dist.empty()) {
        cout << "inf" << endl;
    } else {
        cout << -dist[n - 1] << endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>
int main () {

   int  n, x, i, j, k, count;

   while (1) {
     scanf("%d %d\n", &n, &x);
     if (n == 0 && x == 0) {
       break;
     }

      count = 0;
      for (i = 1; i < n-1; i++) {
        for (j = i+1; j < n; j++) {
          for (k = j+1; k <= n; k++) {
              if (i+j+k == x) {
              count++;
              }
          }
        }
      }
      printf ("%d\n", count);
   }

   return 0;
}

Measured memory_bytes: 604
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        for(int i = 1; ; i++){
            int x = sc.nextInt();
            if(x == 0) break;
            System.out.printf("Case %d: %d\n",i, x);
        }
    }
}



Measured memory_bytes: 66956
A, B, K = map(int, input().split())
lista = [a for a in range(1, A + 1) if A % a == 0]
listb = [b for b in range(1, B + 1) if B % b == 0]
listc = sorted(list(set(lista) & set(listb)))

print(listc[-K])


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define for1(i, n) for(int i = 1; i <= (n);i++)
#define all(x) x.begin(),x.end()
using namespace std;
string s, ans;
deque<char>dq;
bool b; int q, f, t; char c;
signed main() {
	cin >> s >> q;
	for1(v, q) {
		cin >> t;
		if (t == 1)b = !b;
		else {
			cin >> f >> c;
			if ((f + b) % 2)dq.push_front(c);
			else s += c;
		}
	}
	for (char ch : dq)ans += ch; ans += s;
	if (b)reverse(all(ans));
	cout << ans << endl;
}

Measured memory_bytes: 1436
#include <bits/stdc++.h>
#define ull uint64_t
#define ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mx5 100005
#define mx6 1000005
#define mod 1000000007
#define nfs ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

ll dp[101][mx5] = {};

int main() {
    nfs
    int i, j, n, k, a[101] = {};
    
    cin >> n >> k;
    
    for (i = 1; i <= n; i++)
        cin >> a[i];

    for (i = 1, j = 0; j <= k; j++) {
        dp[i][j] = min(j + 1, a[i] + 1);
    }

    for (i = 2; i <= n; i++) {
        ll temp_sum = 0;
        for (j = 0; j <= k; j++) {
            temp_sum = (temp_sum + dp[i-1][j]) % mod;
            temp_sum = (temp_sum + ( mod - ((a[i] + 1 <= j) ? dp[i - 1][j - (a[i]+1)] : 0) ) % mod ) % mod;
            dp[i][j] = temp_sum;
        }
    }
    cout << (dp[n][k] + (mod - dp[n][k-1]) % mod) % mod;
}

Measured memory_bytes: 81796
#!/usr/bin/env python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def solve():
    S = input()
    i = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"].index(S)
    print(7 - i)


def main():
    solve()


if __name__ == '__main__':
    main()


Measured memory_bytes: 9776
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long
template<class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template<class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template<class T, class V>
typename enable_if<is_class<T>::value == 0>::type fill(T &t, const V &v) {
    t = v;
}
template<class T, class V>
typename enable_if<is_class<T>::value != 0>::type fill(T &t, const V &v){
    for (auto &e : t) fill(e, v);
}
// auto v = make_vec<int>(h, w);
// fill(v, 0);
const int INF = 1LL << 60;

signed main(){

  int h, n; cin >> h >> n;
  vector<int> a(n), b(n);
  for(int i = 0; i < n; i++){
    cin >> a[i] >> b[i];
  }

  // auto dp = make_vec<int>(n+1, h+1);
  // fill(dp, INF);
  // dp[0][0] = 0;
  // for(int i = 0; i < n; i++){
  //   for(int j = 0; j < h; j++){
  //     dp[i+1][max(h, j + a[i])] = min(dp[i+1][max(h, j + a[i])], dp[i][j] + b[i]);
  //   }
  // }
  auto dp = make_vec<int>(h+1);
  fill(dp, INF);
  dp[0] = 0;
  for(int i = 0; i < h; i++){
    for(int j = 0; j < n; j++){
      dp[min(h, i + a[j])] = min(dp[min(h, i + a[j])], dp[i] + b[j]);
    }
  }
  cout << dp[h] << endl;

  return 0;
}


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

// c++11
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>

#define mp make_pair
#define mt make_tuple
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
template <class T>
using max_priority_queue = priority_queue<T>;
template <class T>
using min_priority_queue = priority_queue<T, std::vector<T>, std::greater<T>>;

const int INF = 1 << 29;
const ll LL_INF = 1LL << 60;
const double EPS = 1e-9;
const ll MOD = 1000000007;

const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
int N, W;
const int MAX_N = 110;
const int MAX_V = 100010;
vector<pii> WV;
ll dp[MAX_N][MAX_V]; //(index, value)
void init()
{
    for (int i = 0; i < MAX_N; i++)
    {
        for (int j = 0; j < MAX_V; j++)
        {
            dp[i][j] = LL_INF;
        }
    }
}
int main()
{
    init();
    cin >> N >> W;
    for (int i = 0; i < N; i++)
    {
        int w, v;
        cin >> w >> v;
        WV.emplace_back(mp(w, v));
    }
    dp[0][0] = 0;
    for (int i = 0; i < N; i++)
    {
        int w, v;
        tie(w, v) = WV[i];
        for (int j = 0; j < MAX_V; j++)
        {
            if (j + v < MAX_V)
            {
                dp[i + 1][j + v] = min(dp[i + 1][j + v], dp[i][j] + w);
            }
            dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
        }
    }
    for (int j = MAX_V - 1; j >= 0; j--)
    {
        if (dp[N][j] <= W)
        {
            cout << j << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 86144
// Problem : C - String Transformation
// Contest : AtCoder - AtCoder Beginner Contest 110
// URL : https://atcoder.jp/contests/abc110/tasks/abc110_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,b,a) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
 
#define bug(x) cout<<#x<<"="<<x<<endl; 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 200001; //check the limits, dummy
 
int main() 
{
	ios_base::sync_with_stdio(0); cin.tie(0);    
	string S,T;
	cin>>S>>T;
	int N=sz(S);
	unordered_map<char,char> m1,m2;
	F0R(x,N)
	{
		if(m1.find(S[x])==m1.end())
		{
			m1[S[x]]=T[x];
			// continue;
		}
		else if(m1[S[x]]!=T[x])
		{
			cout<<"No"<<nl;
			return 0;
		}
		if(m2.find(T[x])==m2.end())
		{
			m2[T[x]]=S[x];
			// continue;
		}
		else if(m2[T[x]]!=S[x])
		{
			cout<<"No"<<nl;
			return 0;
		}
	}
	cout<<"Yes"<<nl;
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 3852
#include <stdio.h>
#define rep(i, n) for(int i = 0; i < n; ++i)

int count, flag[10], a[9];

int saiki(int n) {
  int i;
  if(n == 10) {
    if((a[0] + a[2] + a[5]) + (a[1] + a[4]) * 10 + a[3] * 100 == a[8] + a[7] * 10 + a[6] * 100) ++count;
    return 0;
  }
  if(a[n] != -1) saiki(n + 1);
  else {
    for(i = 1; i <= 9; ++i) {
      if(flag[i]) {
        flag[i] = 0, a[n] = i;
        saiki(n + 1);
        flag[i] = 1, a[n] = -1;
      }
    }
  }
  return 0;
}

int main(void) {
  int i, j, k;
  count = 0;
  rep(i, 9) scanf("%d", &a[i]);
  rep(i, 10) flag[i] = 1;
  rep(i, 9) if(a[i] != -1) flag[a[i]] = 0;
  saiki(0);
  printf("%d\n", count);
  return 0;
}


Measured memory_bytes: 2748
INF=float('inf')
h,w=map(int,input().split())
dist=[[0 for i in range(10)]for j in range(10)]
for i in range(10):
  s=list(map(int,input().split()))
  for j in range(10):
    if i==j:
      continue
    dist[i][j]=s[j]

for k in range(10):
  for i in range(10):
    for j in range(10):
      dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j])
ans=0
for i in range(h):
  T=list(map(int,input().split()))
  for j in range(w):
    if T[j]==-1:
      continue
    if T[j]==1:
      continue
    ans+=dist[T[j]][1]
print(ans)

Measured memory_bytes: 9128
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pb push_back
#define endl "\n"
#define ff first
#define ss second
#define inp(a) int a; cin>>a;
#define inpa(a,n) vector<int>a(n); FOR(i,0,n-1) cin>>a[i];
#define PI 3.141592653589793238
#define QUICK ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vec(x) vector<x>
#define pii pair<int,int>
#define mem(a,b) memset(a, b, sizeof a)
#define FOR(i,j,n) for(int i= j; i<=n; i++)
#define srt(a); sort(a.begin(), a.end())
#define CASE int t; cin>>t; while(t--)
#define setBits(n) __builtin_popcountll(n)
#define prec(n) fixed<<setprecision(n)
#define print(x) for(auto c : x) cout << c << " ";
#define dbg(x) cerr << #x << " :: "<< x << endl;
#define dbg2(x,y) cerr << #x << " :: "<<x <<"\t" << #y << " :: "<<y <<endl;
#define upcase(s)  transform(s.begin(), s.end(), s.begin(), ::toupper)
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define int ll
const int INF = 1e9 + 7;
const int SIZE = 1e5 + 5;
const int MOD = 1e9 + 7; 
//////////// template ends here //////////////////////////

vec(int)wt(101, 0), p(101, 0);
vec(vec(int))dp(101, vec(int)(SIZE, -1));

int topdown(int n, int w){

	if(n <= 0 || w <= 0)
		return 0;
	if(dp[n][w] != -1)
		return dp[n][w];

		int sub1 = topdown(n-1, w), sub2 = 0;
		if(wt[n] <= w)
			sub2 = topdown(n-1, w-wt[n]) + p[n] ;
	
	return dp[n][w] = max(sub1, sub2);
}

void solve(){	
	
	inp(n); inp(w);

	FOR(i,1,n){
		cin>>wt[i] >> p[i];
	}

    
    cout << topdown(n,w);
	
}



int32_t main(){
	#ifndef ONLINE_JUDGE 
		freopen ("input.txt","r",stdin);
		freopen ("output.txt","w",stdout);
	#endif	
	QUICK;
	
	solve();
	printclock;
}

Measured memory_bytes: 83008
#include <bits/stdc++.h>
typedef int64_t ll;
using namespace std;
 
int main() {

  string A,B;

  cin >> A >> B ;//入力終了

  int a=A.size(),b=B.size();
  
  int ans=0;

//文字列の大きさ（桁）で大小を判定
  if(a>b) cout << "GREATER" << endl;

  else if(a<b) cout << "LESS" << endl;

//桁数が同じ場合
  else{
    for(int i=0;i<A.size();i++){
      int An=(int)(A.at(i)-'0'),Bn=(int)(B.at(i)-'0');

      if(An>Bn){ans=1; break;}
      else if(An<Bn){ans=2; break;}
    }

    switch(ans) {
      case 0 : cout << "EQUAL" << endl; break;
      case 1 : cout << "GREATER" << endl; break;
      case 2 : cout << "LESS" << endl; break;
    }
  }

  return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cstdio>
#define ll long long int
#define pb push_back
using namespace std;
int main()
{
    string o,e;
    char p,q;
    ll i,j,k,n,f=0,h,w;
    cin>>o>>e;
    k=o.length();
    n=e.length();
    if(k>n)
    {
       for(i=0;i<n;i++)
       {
           cout<<o[i]<<e[i];
       }
       cout<<o[i]<<endl;
    }
    else if(k<n)
    {
         for(i=0;i<n;i++)
       {
           cout<<o[i]<<e[i];
       }
       cout<<e[i]<<endl;
    }
    else
    {
          for(i=0;i<n;i++)
       {
           cout<<o[i]<<e[i];
       }
       cout<<endl;
    }


    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;
void pz(int n){
	for(int i=0;i<n;i++){
		cout<<'0';
	}
	return;
}
void pl(int n){
	int cnt=0;
	int m=n;
	while (n>0){
		cnt++;
		n=n/10;
	}
	pz(6-cnt);
	if(m!=0) cout<<m;
	return;
}
int search(vector<long long int> a,long long int n){//a[ans]<=n and ans is the biggest
	if (a[0]>n) return -1;
	int ok=0,ng=a.size(),mid;
	while(ng-ok>1){
		mid=(ok+ng)/2;
		if(a[mid]<=n){
			ok=mid;
		}else{
			ng=mid;
		}
	}
	return ok;
}


int main(){
	int n,m;
	cin>>n>>m;
	vector<int> p(m),y(m);
	vector<int> ho[100001];
	for(int i=0;i<m;i++){
		cin>>p[i];
		cin>>y[i];
		ho[p[i]].push_back(y[i]);
	}
	for(int i=0;i<n;i++){
		sort(ho[i+1].begin(),ho[i+1].end());
	}
	for(int i=0;i<m;i++){
		printf("%012lld\n",ll(p[i])*1000000+int(lower_bound(ho[p[i]].begin(),ho[p[i]].end(),y[i])-ho[p[i]].begin()+1));
	}
	return 0;
}

Measured memory_bytes: 7808
# util functions

# debug
$debugFlag = ( ARGV[0] != nil )
p "==== DEBUG MODE ====" if $debugFlag

def pd(str)
  p str if $debugFlag
end

def printd(str)
  print str if $debugFlag
end

# input
arr = []
lc = 0
nn = 0
while l = $stdin.gets do
  if lc == 0
    nn = l.chomp.to_i
  else
    arr << l.chomp.to_i
  end
  lc += 1
end

# body
if $debugFlag
  p nn
  p arr
end

puts (nn.to_f/arr.min).ceil + 4


Measured memory_bytes: 1788
#include<iostream>
using namespace std;
int main()
{
   int n,p=1;
   cin>>n;
   char s[n],c;
   for(int i=0;i<n;i++)
   {
       cin>>s[i];
   }
   c=s[0];

   for(int i=1;i<n;i++)
   {
       if(s[i]==c)
       {
           continue;
       }
       else
       {
         p++;
         c=s[i];
       }
   }
   cout<<p<<endl;
    return 0;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
#include <cstdlib>
#define ll long long
#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define MX 100010
using namespace std;

int N,K;
vector<int> h;
vector<int> dp;
int dpm;

int main(){
        cin >> N >> K;
        h.resize(N);
        dp.resize(N);

        FOR(i,0,N) cin >> h[i];
        dp[0] = 0; 
        FOR(i,1,N){
                dp[i] = dp[i-1] + abs(h[i] - h[i-1]);
                for(int j=0; j<=K && j<=i; ++j){
                    dp[i] = min(dp[i], dp[i-j] + abs(h[i] - h[i-j]));
                    //cout << abs(h[i] - h[i-j]) << " ";
                }
                //cout << "/" << endl;
                //debug
                //FOR(j,0,N){
                //        cout << dp[j] << " ";
                //}
                //cout << endl;
        }
        cout << dp[N-1] << endl;
        return 0;
}


Measured memory_bytes: 1024
/* 
	Author: ankrypt
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int
#define ff first
#define ss second
#define all(x) x.begin(), x.end() 
#define ub upper_bound
#define lb lower_bound
#define MAX_INT 105
#define fi(a, b, c, d) for(int a = b; i < c; i += d)
#define fl(a, b, c, d) for(ll a = b; i < c; i += d)
#define quit exit(0)

ll N, M, A, B, C;
ll arr[MAX_INT], cache[MAX_INT], arr1[MAX_INT], data[MAX_INT];
vector<ll> V;

ll rec(ll X) {
	if(!X) {
		printf("Yes\n");
		quit;
	}
	if(X < 0) {
		return 1e15;
	}
	if(cache[X] != -1) {
		return cache[X];
	} 

	cache[X] = min(rec(X - 4), rec(X - 7));
	return cache[X];

}



int main() {
	scanf("%lld", &N);
	memset(cache, -1, sizeof(cache));
	rec(N);
	printf("No\n");
}
/*
	Powered by Buggy Plugin
*/




Measured memory_bytes: 256