akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
typedef long long ll;
typedef pair<int,int> P;
set<P> ps;
set<P> cand;
int H,W,N;
void add_cand(int x,int y){
	if(0<=x&&x<H-2&&0<=y&&y<W-2) cand.insert(P(x,y));
}
ll ans[10];
int main(){
	cin>>H>>W>>N;
	rep(i,N){
		int x,y;
		scanf("%d%d",&x,&y);
		x--,y--;
		ps.insert(P(x,y));
		rep(dx,3) rep(dy,3) add_cand(x-dx,y-dy);
	}
	for(P p:cand){
		int x=p.fs,y=p.sc;
		int c=0;
		rep(i,3) rep(j,3) if(ps.count(P(x+i,y+j))) c++;
		ans[c]++;
	}
	ll sum=(ll)(H-2)*(W-2);
	rep1(i,9) sum-=ans[i];
	ans[0]=sum;
	rep(i,10) cout<<ans[i]<<endl;
}


Measured memory_bytes: 47104
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<set>
#include<string>
#include<map>
#include<cassert>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
typedef pair<int, int> P;
typedef pair<int, P> PP;
set<PP>S;
signed main() {
	int n; cin >> n;
	rep(i, n) {
		int p[3];
		rep(j, 3)cin >> p[j];
		sort(p, p + 3);
		S.insert(PP(p[0], P(p[1], p[2])));
	}
	cout << n - S.size() << endl;
}



Measured memory_bytes: 3188
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::*;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::collections::*;

fn solve() {
    input! {
        a: usize,
        mut b: usize,
        mut c: usize,
        k: usize
    };

    let mut rest = k;
    while rest > 0 && b <= a {
        b *= 2;
        rest -= 1;
    }
    while rest > 0 && c <= b {
        c *= 2;
        rest -= 1;
    }
    let res = if a < b && b < c { "Yes" } else { "No" };
    println!("{}", res);
}

fn main() {
    std::thread::Builder::new()
        .name("big stack size".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(|| {
            solve();
        })
        .unwrap()
        .join()
        .unwrap();
}


Measured memory_bytes: 2212
#include<stdio.h>
#include<stdlib.h>

int p(int a[], int p, int r)
{
	int i = p - 1;
	int j = p;
	int x = a[r];
	int t;
	for (j; j < r; j++)
	{
		if (a[j] <= x)
		{
			i++;
			t = a[i];
			a[i] = a[j];
			a[j] = t;
		}
	}
	t = a[r];
	a[r] = a[i + 1];
	a[i + 1] = t;
	return i + 1;
}

int main()
{
	int n;
	scanf("%d", &n);
	int a[10000000];
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &a[i]);
	}
	int key=p(a, 0, n - 1);
	

	for (int i = 0; i < n; i++)
	{
		if (i)
			printf(" ");
		if (i == key)
			printf("[");
		printf("%d", a[i]);
		if (i == key)
			printf("]");
	}
	putchar(10);
	return 0;
}


Measured memory_bytes: 2948
#include<bits/stdc++.h>
using namespace std ;
int main(){
    int a[110] ;
    int n ;
    cin >> n ;
    for( int i = 1 ; i <= n ; i++ )
        cin >> a[i] ;
    int ans = 0 ;
    int cnt = 0 ;
    for( int i = 1 ; i <= n ; i++ ){
        if ( a[i] == a[i - 1] ) cnt++ ;
        else cnt = 1 ;
        if ( i == n || a[i] != a[i + 1] ) ans += cnt / 2 ;
    }
    cout << ans << endl ;
    return 0 ;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <set>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <bitset>
#include <stack>
#include <queue>
#include <ctype.h>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
#define MOD 1000000007
#define more(a,b) (((a)>(b))?(a):(b))
#define less(a,b) (((a)<(b))?(a):(b))
using namespace std;


int main(void)
{
	lli N, A, B; cin >> N >> A >> B;
	if (A % 2 == B % 2)cout << (B - A) / 2 << endl;
	else cout << less(A - 1, N - B) + 1 + (B - A - 1) / 2 << endl;
	

	return 0;
}


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

constexpr int NONE = -1;
struct Node {
    int id, id_parent = NONE, id_left = NONE, id_right = NONE;
};
using Tree = vector<Node>;
using Keys = vector<int>;

Tree solve(int h);
bool is_valid(int id, int size);
void print_tree(Tree tree, Keys keys);
void print_node(Node node, Keys keys);
void print_if_exist(int id, string name, Keys keys);

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

    Keys keys{};
    for (int i = 0; i < h; ++i) {
        int key;
        cin >> key;
        keys.push_back(key);
    }

    print_tree(solve(h), keys);
}

Tree solve(int h) {
    Tree tree{};
    for (int i = 0; i < h; ++i) {
        Node node{};
        node.id = i + 1;
        const int parent = floor((float)node.id / 2), left = 2 * node.id,
                  right = left + 1;
        if (is_valid(parent, h)) node.id_parent = parent;
        if (is_valid(left, h)) node.id_left = left;
        if (is_valid(right, h)) node.id_right = right;
        tree.push_back(node);
    }
    return tree;
}

bool is_valid(int id, int size) {
    return id >= 1 && id <= size;
}

void print_tree(Tree tree, Keys keys) {
    for (Node& node : tree) print_node(node, keys);
}

void print_node(Node node, Keys keys) {
    cout << "node " << node.id << ": ";
    print_if_exist(node.id, "key", keys);
    print_if_exist(node.id_parent, "parent key", keys);
    print_if_exist(node.id_left, "left key", keys);
    print_if_exist(node.id_right, "right key", keys);
    cout << endl;
}

void print_if_exist(int id, string name, Keys keys) {
    if (id != NONE) cout << name << " = " << keys.at(id - 1) << ", ";
}


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

def main():
  b = input()
  if b == 'A':
    print('T')
  if b == 'T':
    print('A')

  if b == 'G':
    print('C')
  if b == 'C':
    print('G')
  pass

if __name__=='__main__':
  main()

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
using P = pair<int,int>;
using ll = long long;
static const int INF = 1000000000;
static const ll MOD = 1000000007;

ll gcd(ll a, ll b){return b!=0 ? gcd(b, a%b) : a;}
ll lcm(ll a, ll b){return a / gcd(a, b) * b;}

int main(){
	int n;
	cin >> n;
	vector<ll> a(n), b(n);
	rep(i, n) cin >> a[i] >> b[i];
	
	reverse(a.begin(), a.end());
	reverse(b.begin(), b.end());
	
	ll push = 0;
	for(int i = 0; i < n; ++i){
		ll p = 0;
		if((a[i] +push) % b[i] != 0){
			p = b[i] - (a[i] + push) % b[i];
		}
		push += p;
	}
	cout << push << endl;
	return 0;
}



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

using namespace std;

using ll = long long;

const int N = 105, W = 1e5 + 5, INF = 1e9 + 5;

ll dp[N][W];

int main(){
	int n, w;	scanf("%d%d",&n,&w);
	for(int i = 1; i <= n; i++){
		int wi, vi;	scanf("%d%d",&wi,&vi);
		for(int j = 0; j < wi; j++)	dp[i][j] = dp[i - 1][j];
		for(int j = wi;	j <= w; j++)	dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - wi] + vi);
	}
	ll ans = 0;
	for(int i = 0; i <= w; i++)	ans = max(ans, dp[n][i]);
	printf("%lld\n", ans);
}


Measured memory_bytes: 81840
#include<iostream>
#include<algorithm>
#include <string>
#include <cstring>
#include<climits>
using namespace std;
typedef long long ll;

// i번째까지왔는데 0이아닌수를 j개 썼고 그때 값들이 n보다 크다면 1아니면 0 ㅋ
ll d[101][4][2];
int n, k;
string s;

ll go(int x, int y, int z) {
	if (x == n) {
		if (y == k)
			return 1;
		else return 0;
	}
	ll &ret = d[x][y][z];
	if (ret != -1)return ret;
	ret = 0;

	if (z == 0) {
		if (y < k) {
			ret += go(x + 1, y + 1, z) * (ll)9;
		}
		ret += go(x + 1, y, z);	
	}
	else {
		if (y < k) {
			for (int i = 1; i < (s[x] - '0'); i++) {
				ret += go(x + 1, y + 1, 0);
			}
		}
		if (s[x] != '0') {
			ret += go(x + 1, y, 0);
			if (y < k)
				ret += go(x + 1, y + 1, 1);
		}
		else {
			ret += go(x + 1, y, 1);
		}
	}
	return ret;
}
int main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin >> s >> k;
	n = s.size();
	memset(d, -1, sizeof(d));
	ll ans = 0;

	for (int i = 0; i < (s[0] - '0'); i++) {
		if (i == 0) {
			ans += go(1, 0, 0);
		}
		else {
			ans += go(1, 1, 0);
		}
	}
	if ((s[0] - '0') != 0) {
		ans += go(1, 1, 1);
	}
	else ans += go(1, 0, 1);

	cout << ans << '\n';
}

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

int main() {

	ll x, k, d; cin >> x >> k >> d;
	if (x < 0) x *= -1;
	ll quo = x / d;
	ll mod = x % d;
	ll ans;

	//if (d == x) {
	//	if (k % 2 == 0) {
	//		ans = x;
	//	}
	//	else {
	//		ans = 0;
	//	}
	//}
	//else {
		if (quo <= k) {
			if (k % 2 == quo % 2) {
				ans = mod;
			}
			else {
				ans = abs(d - mod);
			}
		}
		else if (k < quo) {
			ans = d * (quo - k) + mod;
		}
	//}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl;
#define printD(a) cout << setprecision(6) << (a) << endl;
using namespace std;
int max_int = 1000000007;
void Debug(auto a);
int nibul(auto a,auto b);
int nibuu(auto a,auto b);
void input(vector<int>& a,int n);

int n;

signed main(){
    int n;
    cin >> n;
    FOR(i,3,n+1){
        if(i%3==0){
            cout << " " << i;
        }
        else{
            int tmp = i;
            while(tmp!=0){
                if(tmp%10==3){
                    cout << " " << i;
                    break;
                }
                tmp /= 10;
            }
        }
    }
    cout << endl;
    return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}
int nibul(auto a,auto b){
    int x = lower_bound(All(a),b) - a.begin();
    //key以上の初めてのitr
    return x;
}
int nibuu(auto a,auto b){
    int x = upper_bound(All(a),b) - a.begin();
    //key以下の最後のitr
    return x-1;
}

void input(vector<int>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}



Measured memory_bytes: 3120
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

import fractions

a,b,c,d = mi()

g = c*d // fractions.gcd(c,d)

# cの倍数の個数
ac = (a-1)//c
bc = b//c
nc = bc-ac

# dの倍数の個数
ad = (a-1)//d
bd = b//d
nd = bd-ad

# cdのgcdの倍数の個数
ag = (a-1)//g
bg = b//g
ng = bg-ag

ans = b-(a-1)-nc - nd + ng

# print(g,nc,nd,ng)
print(ans)

Measured memory_bytes: 63852
#include <cstdio>
#include <vector>

using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DUMP(a, n) REP(i, n) printf("%lld%c", a[i], i + 1 == n ? '\n' : ' ')

typedef long long ll;

const int V_MAX = 100000;

struct edge { int to, cost; };

int V;
vector<edge> G[V_MAX];

ll dist[V_MAX];

int Q, K;

void add_edge(int a, int b, int c) {
  G[a - 1].push_back({b - 1, c});
  G[b - 1].push_back({a - 1, c});
}

void dfs(int p, int v) {
  REP(i, G[v].size()) {
    edge &e = G[v][i];
    if (e.to == p) continue;
    dist[e.to] = dist[v] + e.cost;
    dfs(v, e.to);
  }
}

void solve() {
  dist[K] = 0;
  dfs(-1, K);
  // DUMP(dist, V);
  REP(i, Q) {
    int x, y;
    scanf("%d%d", &x, &y);
    ll ans = dist[x - 1] + dist[y - 1];
    printf("%lld\n", ans);
  }
}

void input() {
  int N;
  scanf("%d", &N);
  V = N;
  REP(i, N - 1) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    add_edge(a, b, c);
  }
  scanf("%d%d", &Q, &K);
  K--;
}

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


Measured memory_bytes: 15872
#include <bits/stdc++.h>
using namespace std;
bool test(long long a,long long b)
{
	while (a%b==0)
	a/=b;
	return (a%b==1);
}
int main()
{
	long long n;
	cin >> n;
	int ans=0;
	for (int i=2;1LL*i*i<=n-1;i++)
	{
		if ((n-1)%i==0)
		{
			ans++;
			ans+=(1LL*i*i!=n-1);
		}
	}
	for (int i=2;1LL*i*i<=n;i++)
	{
		if (n%i==0)
		{
			ans+=test(n,i);
			if (1LL*i*i!=n)
			ans+=test(n,n/i);
		}
	}
	cout << (ans+1+(n!=2));
}

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

public class Main {

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

	static int INF = 1 << 30;
	static int modP = 1000000007;

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			long n = in.nextLong();
			long min = in.nextLong();
			long max = in.nextLong();

			long ans = 0;
			if (min > max) {
				ans = 0;
			} else if (min == max && n == 1) {
				ans = 1;
			} else if (min != max && n == 1) {
				ans = 0;
			} else {
				ans = (max*(n-2)-min*(n-2)+1);
			}
			out.println(ans);

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

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

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

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}


Measured memory_bytes: 21460
//Exchange.java
import java.util.Scanner;
class Main
{
	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
		int suma=sc.nextInt();
        int sumb=sc.nextInt();
        int k=sc.nextInt();

        for(int i=1; i<=k; i++){
            if(i%2==0){
                if(sumb%2==0){
                    suma+=sumb/2;
                    sumb=sumb-(sumb/2);
                }
                else{
                    sumb=sumb-1;
                    suma+=sumb/2;
                    sumb=sumb-(sumb/2);
                }
            }
            else{
                if(suma%2==0){
                    sumb+=suma/2;
                    suma=suma-(suma/2);
                }
                else{
                    suma=suma-1;
                    sumb+=suma/2;
                    suma=suma-(suma/2);
                }
            }
        }
        sc.close();
        System.out.println(suma+" "+sumb);
    }
}

Measured memory_bytes: 23892
/**
 *   created: 24 November 2019  09:33:01
**/
#include<bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef pair<int , int> pii;
typedef vector< pair<int , int> > vii;
typedef long long ll;
typedef vector<long long> vl;
typedef pair<long long , long long> pll;
typedef vector< pair<long long , long long> > vll;

#define int long long
#define PB push_back
#define PPB pop_back
#define all(c) c.begin(),c.end()
#define rep(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define rrep(i,a,b) for(int i = (int)(a-1); i>=(int)(b); i--)
#define INFLL 2000000000000000007
#define INF 2000000007
#define MOD 1000000007


#define TRACE

#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#else

#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif


void optimizeIO()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
}

//                                        //AUTHOR: Kaushalesh Shukla

//=========================================================================================================
int d(int n){
	int cnt=0;
	while(n){
		n /= 10;
		cnt++;
	}
	return cnt;
}
int32_t main()
{
	optimizeIO();
	int tt=1;
	//cin>>tt;
	while(tt--){
		int n,m;
		cin>>n>>m;
		string s;
		cin>>s;
		set<int> st;
		rep(i,0,n+1){
			if(s[i]=='0')
				st.insert(i);
		}
		int ind =n;
		vector<int> res;
		while(ind!=0){
			int temp = *st.lower_bound(ind-m);
			if(temp>=ind){
				cout<<-1;
				return 0;
			}
			res.push_back(ind-temp);
			ind = temp;
		}
		reverse(all(res));
		for(int x:res)
			cout<<x<<" ";
	}
	return 0;
}


Measured memory_bytes: 6216
def print(ch, n)
  n.times do
    putc ch
  end
end

sx, sy, tx, ty = gets.split.map(&:to_i)

dx = tx-sx
dy = ty-sy

print("U", dy)
print("R", dx)
print("D", dy)
print("L", dx+1)
print("U", dy+1)
print("R", dx+1)
print("D", 1)
print("R", 1)
print("D", dy+1)
print("L", dx+1)
print("U", 1)
putc "\n"


Measured memory_bytes: 1788
#include<iostream>
using namespace std;
#define lli long long int
lli MOD=998244353;
lli powa(lli x,lli y)
{
	lli ans=1;
	lli m=MOD;
	while(y>0)
	{
		if(y%2==1)
		{
			ans*=x;
			ans%=m;
		}
		y/=2;
		x=x*x;
		x%=m;
	}
	return ans%m;
}
lli a[3005];
lli dp[3004][3004];
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	lli n,s;
	cin>>n>>s;
	for(int i=0;i<n;i++)
		cin>>a[i+1];
	dp[0][0]=powa(2,n);
	lli inv=powa(2,MOD-2);
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<=s;j++)
		{
			dp[i+1][j]+=dp[i][j];
			dp[i+1][j]%=MOD;
			if(j+a[i+1]<=s)
			{dp[i+1][j+a[i+1]]+=dp[i][j]*inv;
			dp[i+1][j+a[i+1]]%=MOD;}
		}
	}
	cout<<dp[n][s];
}




Measured memory_bytes: 73964
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef long int li;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
typedef pair<ll, ll>P;
#define PI 3.14159265358979
#define MOD 998244353
const int MAX = 510000;

int main() {
  int K;
  string S;
  cin>>K>>S;
  if(S.size()>K){
  	rep(i,K){
    cout<<S[i];
    }
    cout<<"...";
  }
  else{
  	cout<<S;
  }
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 1000000007;

int main() {
	ll h,w;
	cin>>h>>w;
	ll arr[h][w];
	char c;
	for(ll i=0; i<h; i++) {
		for(ll j=0; j<w; j++) {
			cin>>c;
			if(c == '.')
				arr[i][j] = 0;
			else 
				arr[i][j] = 1;
		}
	}

	ll dp[h][w];
	memset(dp,0,sizeof(dp));
	dp[0][0] = 1;

	for(ll i=0; i<h; i++) {
		for(ll j=0; j<w; j++) {
			//cout<<"k"<<" ";
			if(i+j==0 || arr[i][j] == 1) {
				//cout<<"br"<<" ";
				continue;
			}
			else {
				//cout<<"con"<<" ";
				ll y = 0, z=0;
				if(i-1>=0 && arr[i-1][j] == 0)
					y = 1;
				if(j-1>=0 && arr[i][j-1] == 0)
					z = 1;
				dp[i][j] =	(y*(dp[i-1][j]) + z*(dp[i][j-1]))%mod;  
			}
		}
	}

	/*for(int i=0; i<h; i++) {
		for(int j=0; j<w; j++)
			cout<<dp[i][j]<<" ";
		cout<<"\n";
	}*/

	cout<<dp[h-1][w-1];

	return 0;
}

Measured memory_bytes: 15872
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<string>
#include<time.h>
#include<iomanip>
#include<list>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<random>
#include<bitset>
#include <queue>
#include <map>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldouble = long double;

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


int main() {
    int l;
    cin >> l;
    ldouble res = 1;
    res *= (ldouble)l;
    res *= (ldouble)l;
    res *= (ldouble)l;
    res /= (ldouble)27;
    cout << std::setprecision(10) << res << endl;
    return 0;
}



Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
    int n, m, A[105];
    int vsum=0, count=0;
    cin >> n >> m;

    for ( int i=0; i<n; i++){
        cin >> A[i];
        vsum += A[i];
    }

    for ( int i=0; i<n; i++){
        if (vsum / (4*m) < A[i] && vsum % (4*m) ) count++ ;
        else if (vsum / (4*m) <= A[i] && vsum % (4*m) == 0 ) count++ ;
    }

    if (m <= count) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
inline int read(){
    char c=getchar(); int res=0;
    while(!isdigit(c)) c=getchar();
    while(isdigit(c)){ res=(c&15)+(res<<1)+(res<<3); c=getchar(); }
    return res;
}
int n,*a,*b;
int main(){
    n=read();
    a=new int[n]; b=new int[n+1];
    pair<int,int>*bound=new pair<int,int>[n+1];
    for(int i=0;i<=n;i++) bound[i]=make_pair(-1,-1);
    for(int i=0,cur=0;i<n;i++){
        a[i]=read();
        if(cur!=a[i]){
            bound[cur].second=i-1;
            bound[a[i]].first=i;
            cur=a[i];
        }
    }
    bound[a[n-1]].second=n-1;
    for(int i=0;i<n;i++) b[i]=read();
    int*off=new int[n+3]; off[0]=0; off++;
    for(int i=0;i<=n+1;i++) off[i]=0;
    for(int i=0,l,r;i<n;i++){
        l=bound[b[i]].first;
        r=bound[b[i]].second;
        if(l!=-1&&r!=-1){
            if(i<l){
                off[l-i]--;
                off[r-i+1]++;
            }else if(i>r){
                off[n+l-i]--;
                off[n+r-i+1]++;
            }else{
                off[0]--;
                off[r-i+1]++;
                off[n+l-i]--;
            }
        }
    }
    for(int i=0;i<n;i++) off[i]+=off[i-1];
    int res=-1;
    for(int i=0;i<n;i++){
        if(off[i]==0){
            res=i;
            break;
        }
    }
    if(res==-1){
        printf("No");
    }else{
        printf("Yes\n");
        for(int i=n;i<n<<1;i++){
            printf("%d ",b[(i-res)%n]);
        }
    }
    return 0;
}

Measured memory_bytes: 7596
#include <bits/stdc++.h>
using namespace std;
long long a[4];

int main() {
	ios::sync_with_stdio(false);
	long long n;
	for (int i = 0; i < 4; i++)
		cin >> a[i];
	cin >> n;

	a[1] = min(a[1], 2 * a[0]);

	a[2] = min(a[2], 2 * a[1]);
	a[2] = min(a[2], 4 * a[0]);

	a[3] = min(a[3], 2 * a[2]);
	a[3] = min(a[3], 4 * a[1]);
	a[3] = min(a[3], 8 * a[0]);

	cout << (n / 2) * a[3] + (n % 2) * a[2] << endl;


	return 0;
}




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

using u32 = unsigned int;
using u64 = unsigned long long;
using u128 = __uint128_t;
template<class Int>
bool is_prime_impl(const Int &n, const Int *witness) {
    if (n == 2) return true;
    if (n < 2 || n % 2 == 0) return false;
    const Int m = n - 1, d = m / (m & -m);
    auto modpow = [&](Int a, Int b) {
        Int res = 1;
        for (; b; b /= 2) {
            if (b & 1) res = res * a % n;
            a = a * a % n;
        }
        return res;
    };
    auto suspect = [&](Int a, Int t) {
        a = modpow(a, t);
        while (t != n - 1 && a != 1 && a != n - 1) {
            a = a * a % n;
            t *= 2;
        }
        return a == n - 1 || t % 2 == 1;
    };
    for (const Int *w = witness; *w < n && *w; w++) {
        if (!suspect(*w, d)) return false;
    }
    return true;
}

bool is_prime(const u128 &n){
    if(n < (u64)1 << 32){
        // n < 2^32
        constexpr u64 witness[] = {2, 7, 61, 0};
        return is_prime_impl<u64>(n, witness);
    } else {
        // n < 2^64
        constexpr u128 witness[] = {2, 325, 9375, 28178, 450775, 9780504, 1795265022, 0};
        return is_prime_impl<u128>(n, witness);
    }
}

using namespace std;
#define rep(i,b) for(int i = 0; i < (int)(n); i++)
typedef long long ll;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    int ans = 0;
    rep(i,n){
        ll x;
        cin >> x;
        ans += is_prime(x);
    }
    cout << ans << endl;
}

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

int main(){
  int n;
  cin >> n;
  
  int ans=1;
  if(n>=64) ans=64;
  else if(n>=32) ans=32;
  else if(n>=16) ans=16;
  else if(n>=8) ans=8;
  else if(n>=4) ans=4;
  else if(n>=2) ans=2;
  
  cout << ans;
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define V vector
#define L long
#define W V<L>
L E=70,M=2e17,i,a,b;W S(V<W>p){if(!E){return{1,0};}V<V<W>>T(2);for(W x:p){T[x[1]&1].push_back({x[0]/2,x[1]/2});if(x[0]&1){T[(x[1]+1)&1].push_back({x[0]/2,(x[1]+1)/2});}}for(L i;i<2;i++){L c=0;for(W x:T[!i])c^=(2*x[0]+x[1])%3+1;if(!c){E--;W A=S(T[i]);A[0]*=2;A[1]*=2;A[1]+=i;return A;}}for(W&v:p)v[0]++;W A=S(p);A[0]--;return A;}int main(){cin>>i;V<W>p(i);while(i--,cin>>a>>b)p[i]={a+M,b+M};W x=S(p);cout<<x[0]-M<<" "<<x[1]-M;}

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

int main() {
    int w, h, x, y, r; cin >> w >> h >> x >> y >> r;

    if (r <= x && x <=(w - r) && r <= y && y <= (h - r))
        puts("Yes");
    else
        puts("No");
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<P ,ll> P3;
typedef pair<P ,P> PP;
const ll MOD = ll(1e9)+7;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(1e5 + 5);
const double EPS = 1e-6;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()

int main() {
    int n, k;
    cin >> n >> k;
    cout << n-k+1 << endl;


    return 0;
}


Measured memory_bytes: 256
k, n = (int(x) for x in input().split())
a = list(map(int, input().split()))

max = 0

for i in range(1,n):
  if abs(a[i] - a[i-1] ) > max:
    max = abs(a[i] - a[i-1])

if abs(k - a[-1]) + a[0] > max:
  max = abs(k - a[-1]) + a[0]


dist = k - max
print(dist)

Measured memory_bytes: 26444
n = int(input())
d = {'AC': 0, 'WA': 0, 'TLE': 0, 'RE': 0}
for i in range(n):
  s = input()
  d[s] += 1
print('AC x', d['AC'])
print('WA x', d['WA'])
print('TLE x', d['TLE'])
print('RE x', d['RE'])

Measured memory_bytes: 9200
ip = input().split()
N = int(ip[0])
H = int(ip[1])
amax = 0
ans = 0
b = []
for i in range(N):
    ip = input().split()
    a = int(ip[0])
    amax = max(amax, a)
    b.append(int(ip[1]))
b.sort()
b.reverse()
for x in b:
    if(amax>=x or H <= 0):
        break
    else:
        ans = ans + 1
        H = H - x
if(H > 0):
    ans = int(ans + (H + amax - 1)/amax)
print(ans)

Measured memory_bytes: 7384
/*
  Vivek Rathi
  CSE 3rd Year
  MNNIT
  THUMB RULE - THINK FOR DP FIRST AND THEN GREEDY!!!
*/
#include<bits/stdc++.h>
using namespace std;
#define M 1000000007
#define ll long long int
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define present(c,x) ((c).find(x) != (c).end())
#define null NULL
#define mp make_pair
#define sz(x)	(ll)x.size()
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define inf 1e18
#define flush fflush(stdout);
#define endl '\n'
//unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
//shuffle (foo.begin(), foo.end(), std::default_random_engine(seed));
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<ll, null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
ll modpower(ll a,ll b,ll c)
{
	ll res=1;
	while(b)
	{
		if(b&1LL)
			res=(res*a)%c;
		a=(a*a)%c;
		b>>=1;
	}
	return res;
}
//-------------------------------Template--Above-----------------------------------------------

int main()
{
	boost
	string s,t;
	cin>>s>>t;
	ll mini=inf;
	for(ll i=0;i<sz(s);i++)
	{
		ll idx=sz(t);
		ll co=0;
		for(ll j=0;j<sz(t);j++)
		{
			if(s[i+j]!=t[j])
			{
				co++;
				//break;
			}
		}
		if(i+sz(t)<=sz(s))
		{
			
			mini=min(mini,co);
		}
	}
	cout<<mini<<endl;
	return 0;
}

Measured memory_bytes: 3656
#include<stdio.h>
#define N 100

void output(int *,int);
void insertionSort(int *,int);

int main()
{
  int n,i;
  int a[N];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  output(a,n);
  insertionSort(a,n);

  return 0;
}

void output(int *a,int n)
{
  int i;
  for(i=0;i<n-1;i++){
      printf("%d ",a[i]);
    }
    printf("%d\n",a[n-1]);
}
void insertionSort(int *a,int n)
{
  int i,j,v;

  for(i=1;i<n;i++){
    v = a[i];
    j = i - 1;

    while( j >= 0 && a[j] > v ){
      a[j+1] = a[j];
      j--;
    }
    a[j+1] = v;
    
    output(a,n);
  }
}
      

    



Measured memory_bytes: 2144
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>

using namespace std;
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
#define REP(i, n) for(int i = 0;i < n;i++)
const long long INF = 1LL << 60;

int MOD = 1000000007;

int n,A,B,C;
std::vector<int> l;
int dfs(int k, int a, int b, int c){

    if(k==n){
        if(a==0||b==0||c==0) return 1e9;
        return abs(A-a)+abs(B-b)+abs(C-c);
    }

    int ans = 1e9;

    ans = min(ans, dfs(k+1, a+l[k], b, c) + (a>0?10:0));
    ans = min(ans, dfs(k+1, a, b+l[k], c) + (b>0?10:0));
    ans = min(ans, dfs(k+1, a, b, c+l[k]) + (c>0?10:0));
    ans = min(ans, dfs(k+1, a, b, c));

    return ans;

}

int main(){
    std::ios_base::sync_with_stdio(false);

    cin >> n >> A >> B >> C;
    l = std::vector<int>(n);
    REP(i,n) cin >> l[i];
    cout << dfs(0,0,0,0) << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static long CONST = (long) Math.pow(10, 9) + 7L;

	static Main instance = new Main();

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		//入力値
		int A = scan.nextInt();
		int B = scan.nextInt();
		int C = scan.nextInt();
		int D = scan.nextInt();
		//WK変数

		//演算
		int Takahashi = C / B + (C % B == 0 ? 0 : 1);
		int Aoki = A / D + (A % D == 0 ? 0 : 1);

		//結果出力
		System.out.println(Takahashi <= Aoki ? "Yes" : "No");
	}
}

Measured memory_bytes: 35816
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
ll cntP[55],cnt[55];

ll f(ll n, ll x)
{
	if (x == 0) return ll(0);
	if (n == 0) return ll(1);
	ll res = 0;
	if (x <= 1+cnt[n-1])
	{
		return f(n-1,x-1);
	}
	else
	{
		return cntP[n-1] + 1 + f(n-1,x-(2+cnt[n-1]));
	}
}

int main()
{
	ll N,X;
	cin >> N >> X;
	cntP[0] = 1;
	cnt[0] = 1;
	rep(i,N)
	{
		cntP[i+1] = cntP[i]*2 + 1;
		cnt[i+1] = cnt[i]*2 + 3;
	}
	cout << f(N,X) << endl;
	return 0;
}

Measured memory_bytes: 3544
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
long long s[200010][2],a[200010],sum=0;
int main(){
	int n;
	scanf("%d",&n);
	memset(s,0,sizeof(s));
	for(int i=1;i<=n;i++){
		scanf("%lld",&a[i]);
		s[a[i]][0]++;
	}
	for(int i=1;i<=n;i++){
		s[i][1]=(s[i][0]-1)*s[i][0]/2;
		sum+=s[i][1];
	}
	for(int i=1;i<=n;i++){
		long long ans=sum;
		ans-=s[a[i]][1];
		s[a[i]][0]--;
		ans+=(s[a[i]][0]-1)*s[a[i]][0]/2;
		s[a[i]][0]++;
		printf("%lld\n",ans);
	}
	return 0;
} 

Measured memory_bytes: 7928
#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
using ll=long long;
using namespace std;

int main() {
	ll N, M;
	
	cin >> N >> M;
	ll count=0;
	if (N*2 <= M) {

		count += N;
		count += (M-2*N) / 4;
		cout << count;
	}
	else {
		while (M > 1) {
			count++;
			M-=2;
		}
		cout << count;

	}


}

Measured memory_bytes: 256
a, b, k = gets.chomp.split(' ').map(&:to_i)

count = b - a + 1
if k >= (count + 1) / 2 then
  puts (a..b).to_a.join(' ')
else
  print (a..a + k - 1).to_a.join(' ')
  print ' '
  puts (b - k + 1..b).to_a.join(' ')
end


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

using namespace std;

int main(){
    int H, W, h, w;
    scanf("%d%d%d%d", &H, &W, &h, &w);

    if(H%h == 0 && W%w == 0){
        printf("No\n");
    }
    else{
        printf("Yes\n");
        for(int i=1;i<=H;i++){
            for(int j=1;j<=W;j++){
                if(i%h == 0 && j%w == 0) printf("%d ", -(w*h-1)*1000-1);
                else printf("1000 ");
            }
            printf("\n");
        }
    }
}


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

struct _dice {
    int num[7];
    void roll(char x);
};

void _dice::roll(char o){
    int tmp;
    if (o == 'W'){
        tmp = num[4];
        num[4] = num[1];
        num[1] = num[3];
        num[3] = num[6];
        num[6] = tmp;
    }
    if (o == 'N'){
        tmp = num[1];
        num[1] = num[2];
        num[2] = num[6];
        num[6] = num[5];
        num[5] = tmp;
    }
}

bool check(_dice dice1, _dice dice2){
    for (int i=1; i<7; i++)
        if (dice1.num[i] != dice2.num[i])
            return false;
    return true;
}

int main(){
    _dice dice[2];
    for (int i=0; i<2; i++)
        for (int j=1; j<7; j++) cin >> dice[i].num[j];
    for (int i=0; i<6; i++){
        for (int j=0; j<4; j++){
            dice[1].roll('N');
            if (check(dice[0], dice[1])){
                cout << "Yes" << endl;
                return 0;
            }
        }
        dice[1].roll('W');
        dice[1].roll('W');
        if (i == 1) dice[1].roll('W');
        if (i == 3){
            dice[1].roll('N');
            dice[1].roll('W');
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3096
/*  -*- coding: utf-8 -*-
 *
 * a.cc: A - Air Conditioner
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

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

  if (x >= 30) puts("Yes");
  else puts("No");
  return 0;
}


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

#define REP(i,n) for(ll i=0; i<ll(n); i++)
#define FOR(i,m,n) for(ll i=ll(m); i<ll(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VP vector<pair<int,int>>
#define VPP vector<pair<int,pair<int,int>>>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)
typedef pair <int, int> P;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
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 int  INF = (1 << 30) - 1;
const ll INFL = 1LL << 60;
const ll mod = 10000000007;




int main() {

	int a, b, c, k;
	cin >> a >> b >> c >> k;
	int cnt = 0;
	while (a >= b) {
		b *= 2;
		cnt++;
	}
	while (b >= c) {
		c *= 2;
		cnt++;
	}
	if (cnt <= k)cout << "Yes" << endl;
	else cout << "No" << endl;


}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
# define    all(a)              a.begin(), a.end()
#define forn(i, a, b) for (int i=a; i<b; i++)
#define pb push_back
#define mp make_pair
#define MOD int(1e9+7)
using namespace std;

typedef long long int ll;

bool cmp(int a, int b) {
    return a < b;
}

void printV(vector<int> nums) {
    for (int i: nums) {
        printf("%d ", i);// << " ";
    }
    printf("\n");
}

// void printV(vector<ll> nums) {
//     for (ll i: nums) {
//         printf("%lld ", i);// << " ";
//     }
//     printf("\n");
// }



int dir[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};

bool valid(int i, int j, int n, int m) {
    if (i >= 0 && i < n && j >=0 && j < m)
        return true;
    else 
        return false;
}

vector<int> seive(int n) {
    vector<int> prime;
    vector<bool> flag(n+1);
    int cnt = 0;
    for (int i=2; i<=n+1; i++) {
        cnt++;
        if (!flag[i]) {
            for (int j=2; j*i<=n; j++) {
                flag[i*j] = true;
                cnt++;
            }
        }
    }
    // cout << cnt << endl;
    for (int i=2; i<=n; i++)
        if (!flag[i])
            prime.pb(i);
    return prime;
}


int main() {
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif
    // ios_base::sync_with_stdio(false);
    // cin.tie(0);cout.tie(0);
    // time_t start, end;
    // time(&start);
    int n, m;
    cin >> n >> m;
    vector<string> ns(n), ms(m);
    for (int i=0; i<n; i++) cin >> ns[i];
    for (int i=0; i<m; i++) cin >> ms[i];
    bool mf = false;
    for (int i=0; i<=n-m; i++) {
        for (int j=0; j<=n-m; j++) {
            if (ns[i][j] == ms[0][0]) {
                bool flag = true;
                for (int k=0; k<m; k++) {
                    for (int l=0; l<m; l++) {
                        if (ns[i+k][j+l] != ms[k][l]) {
                            flag = false;
                            break;
                        }
                    }
                    if (!flag)
                        break;
                }
                if (flag) {
                    mf = true;
                    break;
                }
            }
            if (mf)
                break;
        }
        if (mf)
            break;
    }
    if (mf)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;


    // printV(res);
    // time(&end); 
    // double time_taken = double(end - start);
    // cout << "Time Taken: " << fixed << time_taken << setprecision(5);
    // cout << " sec" << endl;
    return 0;
}      

Measured memory_bytes: 3492
def S_n(n):
    num = []
    sum = 0
    while n != 0:
        num.append(n % 10)
        n = int(n / 10)
    for i in num:
        sum += i

    return sum

if __name__ == "__main__" :
    num = int(input())
    wa = S_n(num)
    # print(wa)
    if(num % wa == 0):  print("Yes")
    else:  print("No")
    

Measured memory_bytes: 2940
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include<algorithm>
#include<iomanip>
#include<math.h>
#include <stdlib.h>
#include <string.h>
using namespace std;

int main()
{
	int K , A , B;

	cin >> K >> A >> B;


	if (K == 1 || K == A || K == B) {

		cout << "OK";
		return 0;
	}

	if (A % K == 0 || B % K == 0) {
		cout << "OK";
		return 0;
	}
	if (A / K != B / K) {

		cout << "OK";
	}
	else {
		cout << "NG";
	}
}

Measured memory_bytes: 3564
N, K = map(int, input().split())
import numpy as np
#対称性を利用して点を単位格子K*2Kに圧縮
_2K, _4K = 2*K, 4*K
shape = (_2K+1,_4K+1) #後でK*2Kに圧縮
Grd = np.zeros(shape,dtype='int64')
for _ in range(N):
    x, y, c = input().split()
    x, y = int(x), int(y)
    if c == 'B':
        x, y = x%_2K, y%_2K
    else: 
        x, y = (x+K)%_2K, y%_2K
    #点について、2K*2K -> K*2Kの調整。次は等価、(K+i,K+j)==(i,j),(i,K+j)==(i+K,j)
    if x >= K and y >= K: x -= K; y -= K
    if x < K and y >= K: x += K; y -= K
    #この点がK*Kの黒色正方形内に入る。正方形を特徴づけるには左下の座標だけで十分。
    #⇒１つの点はK**2個の塗り方に+1の影響を与える。
    #毎回2K**2のマスにアクセスするとTLEするため、あとで累積和(計算量O(K**2))を取った時に+1される範囲が等しくなるように調整する(隣接差分を取る)。
    #K=3の場合
    #[[1 1 1 0 0 0]    [[ 1 0 0 -1 0 0  0]
    # [1 1 1 0 0 0]     [ 0 0 0  0 0 0  0]
    # [1 1 1 0 0 0]  => [ 0 0 0  0 0 0  0]
    # [0 0 0 0 0 0]     [-1 0 0  1 0 0  0]
    # [0 0 0 0 0 0]     [ 0 0 0  0 0 0  0]
    # [0 0 0 0 0 0]]    [ 0 0 0  0 0 0  0]
    #                   [ 0 0 0  0 0 0  0]
    
    Grd[y, x] += 1
    Grd[y+K, x+K] += 1
    Grd[y+K, x] += -1
    Grd[y, x+K] += -1
del x, y, c

#2重累積和計算
Grd = Grd.cumsum(axis=1).cumsum(axis=0)
#2K*4K -> K*2Kへ圧縮
Grd = Grd[:,:_2K] +Grd[:,_2K:_4K]
Grd = Grd[:K,:] +np.concatenate((Grd[K:_2K,K:_2K],Grd[K:_2K,:K]),axis=1) 

ans = Grd.max()
print(ans)

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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    vector<int> pre(n), suf(n);
    pre[0] = abs(a[0]);
    for (int i = 1; i < n; ++i) pre[i] = pre[i - 1] + abs(a[i] - a[i - 1]);
    suf[n - 1] = abs(a[n - 1]);
    for (int i = n - 2; i >= 0; --i) suf[i] = suf[i + 1] + abs(a[i] - a[i + 1]);
    for (int i = 0; i < n; ++i) {
        if (i == 0) {
            cout << abs(a[i + 1]) + suf[i + 1] << "\n";
        } else if (i == n - 1) {
            cout << abs(a[i - 1]) + pre[i - 1] << "\n";
        } else {
            cout << abs(a[i - 1] - a[i + 1]) + pre[i - 1] + suf[i + 1] << "\n";
        }
    }
    return 0;
}

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

int main(int argc, char const* argv[])
{
  string N; cin >> N;
  int ans {};
  for (int i = 0; i < N.length(); i++) ans += N[i] - '0';
  if (N.length() == 1) {
    cout << ans << endl;
  } else {
    cout << max(ans, (N[0] - '0') - 1 + 9 * (int)(N.length() - 1)) << endl;
  }
  return 0;
}


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

int main(){
    int r,c;
    cin>>r>>c;
    vector<vector<int> >x(r,vector<int>(c,0));
    for(int i=0; i<r; ++i){
        for(int j=0; j<c; ++j){
            cin>>x[i][j];
        }
    }
    for(int i=0; i<r; ++i){
        int sum=0;
        for(int j=0; j<c; ++j){
            sum+=x[i][j];
        }
        x[i].push_back(sum);
    }
    for(int i=0; i<r; ++i){
        for(int j=0; j<c+1; ++j){
            if(j!=c)cout<<x[i][j]<<" ";
            else cout<<x[i][j]<<endl;
        }
    }
    for(int i=0; i<c+1; ++i){
        int sum=0;
        for(int j=0; j<r; ++j){
            sum+=x[j][i];
        }
        if(i!=c)cout<<sum<<" ";
        else cout<<sum<<endl;
    }
}


Measured memory_bytes: 3188
#include <iostream>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<iomanip>
using namespace std;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)

int retl(int K,int L){
    int tmp=0;
    while(pow(2,tmp) * L < K){
        tmp++;
    }
    return tmp;
}

struct A{
    string s;
    int p;
    int order;
};


int main(){
    int N,M;
    long long mod=pow(10,9)+7;

    cin  >> N>>M;
    int A[M];
    long dp[N+1];
    FOR(i,N+1){
        dp[i]=0;
    }

    FOR(i,M){
        cin>>A[i];
        dp[A[i]]=-1;
    }
    dp[0]=1;
    for(int i=1;i<N+1;i++){
        bool neg=false;
        if(dp[i]<0){
            neg=true;
        }
        if(i==1){
            dp[i]=dp[0];
        }else{
           if(dp[i-2]<0 && dp[i-1]<0){
               dp[i]=-1;
           }else if(dp[i-1]<0){
               dp[i]=dp[i-2];
           }else if(dp[i-2]<0){
               dp[i]=dp[i-1];
           }else{
               dp[i]=(dp[i-2]+dp[i-1])%mod;
           } 
        }
        if(neg){
            dp[i]=-1;
        }
    }    

    
    

    long ans=dp[N];
    if(ans==-1){
        ans=0;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <cstdio>
#include <set>

using namespace std;

int main(){
  int N, i, delta, dist = 1;
  int d[100];
  cin >> N;
  for (i = 0; i < N; i++){
    cin >> d[i];
  }
  set<int> values;
  for (i = 0; i < N; i++){
    values.insert(d[i]);
  }
  cout << values.size();
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long n,h,ans;
  cin>>n>>h;
  vector<long> karyoku(n);
  vector<long> ikkai(n);
  ans=0;
  for(int i=0; i<n; i++){
    cin>>karyoku.at(i)>>ikkai.at(i);
  }
  sort(karyoku.begin(),karyoku.end());
  sort(ikkai.begin(),ikkai.end());
  for(int i=n-1; i>=0; i--){
    if(ikkai.at(i)<karyoku.at(n-1) || h<=0){
      break;
    }
    ans++;
    h=h-ikkai.at(i);
  }
  if(h>0){
    if(h%karyoku.at(n-1)==0){
      ans=ans-1;
    }
    ans=1+ans+h/karyoku.at(n-1);
  }
  cout<<ans;
}

Measured memory_bytes: 1792
//shan61916
#include <bits/stdc++.h>
  using namespace std;
typedef   long long ll;
typedef   unsigned long long ull ;
typedef   double dll ;

#define   mp make_pair
#define   pb push_back
#define   ff first 
#define   ss second
#define   IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define   endl "\n" 
#define   pll pair<ll, ll>
#define   all(x) x.begin(), x.end()
#define   vll vector<ll> 

const ll inf = (ll)(1e17 + 17);
const ll mod = (ll)(1e9 + 7);


int main(){
 IOS
#ifdef SHAN
    freopen("input.txt" , "r" , stdin);  
#endif
  ll k, n;
  cin >> k >> n;
  vll a(n + 1);
  for(ll i = 0; i < n; i++) {
  	cin >> a[i]; 
  }
  ll mx = k - a[n-1] + a[0];
  ll tot = mx;
  for(ll i = 1; i < n; i++) {
  	mx = max(mx, a[i] - a[i-1]);
  	tot+= a[i] - a[i-1];
  }
  cout << tot - mx << endl;
  return 0;
} //good night.

Measured memory_bytes: 1792
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#define getchar getchar_unlocked
#define putchar putchar_unlocked
int32_t nextint(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); bool s=false; if(c=='-'){s=true;c=getchar();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); int s=0; if(c=='-'){s=1;c=getchar();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
uint32_t nextstr(char *s){ char c=getchar(); while(c==' '||c=='\n') c=getchar(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar(); } *s='\0'; return len; }

int a[200000];
int b[200000];
int main(void){
	int n=nextint();
	for(int i=0; i<n; i++){
		a[i]=nextint();
	}
	for(int i=0; i<n; i++){
		b[i]=nextint();
	}
	int ans=0;
	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
			ans^=a[i]+b[j];
		}
	}
	printf("%d\n", ans);
}


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

int main(){
  int n;
  cin >> n;
  
  int dev = 0;
  int ans = 0;
  for(int i = 1; i <= n; i++){
    int tmp = i;
    int canDevide = 0;
    while(tmp>0){
      if(tmp%2!=0) break;
      canDevide++;
      tmp /= 2;
    } 
    if(canDevide>=dev){
      ans = i;
      dev = canDevide;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3636