akhauriyash/Code-Regression huggingface dataset:
# s = "dreameraser"

s = gets.chomp
given_word = %w(dreamer dream eraser erase)

s.reverse!
given_word.map! do |w|
  w.reverse
end

def remove_word(s, s_index, given_word)
  if s_index == s.length
    return "YES"
  end
  s_temp = s[s_index, 7]

  if (s_temp =~ /^#{given_word[0]}/) == 0
    s_index += given_word[0].length
    return remove_word(s, s_index, given_word)
  elsif (s_temp =~ /^#{given_word[1]}/) == 0
    s_index += given_word[1].length
    return remove_word(s, s_index, given_word)
  elsif (s_temp =~ /^#{given_word[2]}/) == 0
    s_index += given_word[2].length
    return remove_word(s, s_index, given_word)
  elsif (s_temp =~ /^#{given_word[3]}/) == 0
    s_index += given_word[3].length
    return remove_word(s, s_index, given_word)
  end

  return "NO"
end

s_index = 0
puts remove_word(s, s_index, given_word)


Measured memory_bytes: 33892
a = int(input())
b = list(map(int, input().split()))
b = sorted(b, reverse=True)
c = 0
d = 0
for i in range(1, len(b), 2):
    c += min(b[i], b[i-1])
    d += 1
    if d == a:
        break
print(c)


Measured memory_bytes: 3060
import java.util.*;

public class Main {
    public static void main(String args[]) {
    	Scanner in = new Scanner(System.in);
    	int n = in.nextInt(), w = in.nextInt();
        
        int[] val = new int[n];
        int[] wt = new int[n];
        for(int i = 0; i < n; i++)
        {
        	wt[i] = in.nextInt();
        	val[i] = in.nextInt();
        }

        // Populate base cases
        long[][] mat = new long[n + 1][w + 1];
        for (int r = 0; r < w + 1; r++) {
            mat[0][r] = 0;
        }
        for (int c = 0; c < n + 1; c++) {
            mat[c][0] = 0;
        }
        
        // Main logic
        for (int item = 1; item <= n; item++) {
            for (int capacity = 1; capacity <= w; capacity++) {
                long maxValWithoutCurr = mat[item - 1][capacity]; // This is guaranteed to exist
                long maxValWithCurr = 0; // We initialize this value to 0
                
                int weightOfCurr = wt[item - 1]; // We use item -1 to account for the extra row at the top
                if (capacity >= weightOfCurr) { // We check if the knapsack can fit the current item
                    maxValWithCurr = val[item - 1]; // If so, maxValWithCurr is at least the value of the current item
                    
                    int remainingCapacity = capacity - weightOfCurr; // remainingCapacity must be at least 0
                    maxValWithCurr += mat[item - 1][remainingCapacity]; // Add the maximum value obtainable with the remaining capacity
                }
                
                mat[item][capacity] = Math.max(maxValWithoutCurr, maxValWithCurr); // Pick the larger of the two
            }
        }
        
        System.out.println(mat[n][w]); // Final answer
    }
}

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

int n;
string x, y;
bool mat[1000][1000];
int a[1000][1000];

int max(int i, int j) {
	int r = (!mat[i - 1][j] ? a[i - 1][j] : 0);
	r = ((!mat[i][j - 1] && a[i][j - 1] > r) ? a[i][j - 1] : r);
	return r > a[i - 1][j - 1] ? r : a[i - 1][j - 1];
}

int main(){
	cin >> n;
	for (int ia = 0; ia < n; ia++) {
		int ans = 0;
		cin >> x >> y;
		for (int i = 0; i < x.length(); i++) {
			mat[i][0] = x[i] == y[0] ? true : false;
			a[i][0] = mat[i][0] ? 1 : 0;
		}
		for (int i = 1; i < y.length(); i++) {
			mat[0][i] = x[0] == y[i] ? true : false;
			a[0][i] = mat[0][i] ? 1 : 0;
		}
		for (int i = 1; i < x.length(); i++) {
			for (int j = 1; j < y.length(); j++) {
				mat[i][j] = x[i] == y[j] ? true : false;
				a[i][j] = max(i, j) + (mat[i][j] ? 1 : 0);
			}
		}
		int p = 0;
		for (int i = 0; i < x.length(); i++) {
			p = a[i][y.length() - 1] > p ? a[i][y.length() - 1] : p;
		}
		for (int i = 0; i < y.length() - 1; i++) {
			p = a[x.length() - 1][i] > p ? a[x.length() - 1][i] : p;
		}
		cout << p << endl;
	}


	return 0;
}

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

const int N = 2e5 + 10;
int p[N], dp[N];

int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> p[i];
    for (int i = 0; i < n; i++)
        dp[p[i]] = dp[p[i] - 1] + 1;
    int ans = 0;
    for (int i = 1; i <= n; i++)
        ans = max(ans, dp[i]);
    cout << n - ans << "\n";
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;

int w, h, n;

int main()
{
	scanf("%d %d %d", &w, &h, &n);
	
	vector<P> spot(n);
	for (int i = 0; i < n; i++){
		scanf("%d %d", &spot[i].first, &spot[i].second);
	}
	
	P current = spot[0];
	int cost = 0;
	for (int i = 1; i < spot.size(); i++){
		int dx = spot[i].first - current.first;
		int dy = spot[i].second - current.second;
		
		cost += abs(dx) + abs(dy);
		if (dx > 0 && dy > 0 || dx < 0 && dy < 0){
			cost -= min(abs(dx), abs(dy));
		}
		current = spot[i];
	}
	printf("%d\n", cost);
	
	return 0;
}

Measured memory_bytes: 1196
n = int(input())
a = list(map(int,input().split()))
if 0 in a:
    print(0)
else:
    s = 1
    for i in range(n):
        s *= a[i]
        if s > 10**18:
            break
        elif a[i] == 0:
            break
            
    if s > 10**18:
        print(-1)
    else:
        print(s)



Measured memory_bytes: 21580
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
constexpr ll Mod = 998244353;
constexpr ll mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
const double PI = acos(-1);
template <typename T> constexpr bool chmax(T &a, const T &b) {
    if(a >= b) return false;
    a = b;
    return true;
}
template <typename T> constexpr bool chmin(T &a, const T &b) {
    if(a <= b) return false;
    a = b;
    return true;
}

/*-------------------------------------------*/

void f(vector<int> &v) {
    int n = v.size();
    vector<int> x(n + 1);
    rep(i, n) {
        x[max<ll>(0, i - v[i])]++;
        x[min<ll>(n, i + v[i] + 1)]--;
    }
    rep(i, n) x[i + 1] += x[i];
    x.pop_back();
    v = x;
}

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

    int n, k;
    cin >> n >> k;
    vector<int> a(n);

    rep(i, n) cin >> a[i];
    rep(i, k) {
        f(a);
        if(count(ALL(a), n) == n) {
            break;
        }
    }
    rep(i, n) cout << a[i] << " \n"[i == n - 1];

    return 0;
}

Measured memory_bytes: 5000
/**
 *      ABC 76 C
 *      author  : kyomukyomupurin
 *      created : 2018-09-29 12:32:59
**/

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string S, T; cin >> S >> T;

    string answer = {};
    for (auto i = 0; i < (int) S.size(); ++i) {
        answer.push_back('z');
    }

    bool exist = false;

    for (auto i = 0; i < (int) S.size() - (int) T.size() + 1; ++i) {
        bool flag = true;
        for (auto j = 0; j < (int) T.size(); ++j) {
            if (S[i + j] != '?' && S[i + j] != T[j]) flag = false;
        }
        if (flag){
            exist = true;
            string temp = S;
            temp.replace(i, (int) T.size(), T);
            for (auto i = 0; i < (int) S.size(); ++i) {
                if (temp[i] == '?') temp[i] = 'a';
            }
            if (temp < answer) answer = temp;
        }
    }

    if (!exist) cout << "UNRESTORABLE" << endl;
    else cout << answer << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(long long i=0; i<(n); i++)
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; }
vector<long long> calc_divisor(long long n) {
    vector<long long> res;
    for (long long i=1ll; i*i<=n; i++) {
        if (n % i == 0) {
            res.push_back(i);
            long long j = n / i;
            if (j != i) res.push_back(j);
        }
    }
    sort(res.begin(), res.end());
    return res;
}

int main(){
    ll n; cin>>n;
    vector<ll> div=calc_divisor(n);
    ll res=0;
    for(ll a : div){
        if(a==1) continue;
        ll b = n;
        while(b%a==0) b/=a;
        if(b%a==1) res++;
    }

    vector<ll> div2=calc_divisor(n-1);
    for(ll a: div2){
        if(a==1) continue;
        res++;
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 384
// i-1,iをみて、越えたらiから優先的に取る（次も使えるので）
package main

import "fmt"

func main() {
	var N, X int
	fmt.Scan(&N, &X)
	A := make([]int, N)
	for i := 0; i < N; i++ {
		var V int
		fmt.Scan(&V)
		A[i] = V
	}
	ans := 0
	for i := 1; i < N; i++ {
		if A[i]+A[i-1] > X {
			surplus := A[i] + A[i-1] - X
			ans += surplus
			A[i] -= surplus
			// A[i-1]は二度と使わんのでどうでもいい
			if A[i] < 0 {
				A[i] = 0
			}
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 7168
#include <bits/stdc++.h>
#define fore(x,a,b) for(int x=a, qwert=b; x<qwert; x++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(a) ((int)(a).size())
#define FIN ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb push_back
#define fst first
#define snd second
using namespace std;
typedef long long ll;

int main(){
	ll X, Y; cin >> X >> Y;
	int ans=0;
	while(X<=Y){
		ans++;
		X*=2;
	}
	cout << ans << "\n";
}

Measured memory_bytes: 256
import std.stdio;
import std.algorithm;
import std.string;
import std.range;
import std.array;
import std.conv;
import std.complex;
import std.math;
import std.ascii;
import std.bigint;
import std.container;


void main() {
	int n = to!int(readln().strip());
	int[][string] d = ["N": [0,1], "E": [1,0], "S": [0,-1], "W": [-1, 0]];
	while(n) {
		int[][] p;
		foreach(i; 0..n) {
			p ~= array(map!(to!int)(readln().strip().split()));
		}
		int m = to!int(readln().strip());
		bool[21][21] q;
		int x = 10;
		int y = 10;
		foreach(i; 0..m) {
			auto s = readln().strip().split();
			auto t = to!int(s[1]);
			foreach(j; 0..t) {
				x += d[s[0]][0];
				y += d[s[0]][1];
				q[x][y] = true;
			}
		}
		bool f = true;
		foreach(pi; p){
			f &= q[pi[0]][pi[1]];
		}
		writeln(f?"Yes":"No");

		n = to!int(readln().strip());
	}

}

Measured memory_bytes: 1780
#include <bits/stdc++.h>
using namespace std;
int main() {
	// your code goes here
	int n,q;
	cin>>n;
	int a[n];
	int h[100001];
	long long int s=0;
	memset(h,0,sizeof(h));
	for(int i=0;i<n;i++){
		cin>>a[i];
		h[a[i]]++;
		s=s+a[i];
	}
	cin>>q;
	while(q--){
		long long int b,c;
		cin>>b>>c;
		if(h[b]>0){
			h[c]=h[c]+h[b];
			
			s=s-(b*h[b])+(c*h[b]);
			h[b]=0;
		
		}
		cout<<s<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 4356
use proconio::{fastout, input};

#[fastout]
fn main() {
    input!(mut a: i32, b: i32, mut c: i32, d: i32);
    loop {
        c -= b;
        if c <= 0 {
            println!("Yes");
            return;
        }
        a -= d;
        if a <= 0 {
            println!("No");
            return;
        }
    }
}


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

#define int long long
#define double long double

#define REP(i, b) for(int i = 0; i < (b); i++)
#define REPS(i, b) for(int i = 1; i <= (b); i++)
#define ALL(v) (v).begin(), (v).end()

#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;

using pi = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vs = vector<string>;
using vb = vector<bool>;
using vpi = vector<pi>;
using vvi = vector<vi>;
using vvb = vector<vb>;

const int INF = 1e16;
const int MOD = 1e9+7;

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

int gcd(int a, int b)
{
    if(b == 0) return a;
    return gcd(b, a%b);
}

signed main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int K; cin >> K;
    int ans = 0;
    REPS(a, K)
    {
        REPS(b, K)
        {
            REPS(c, K)
            {
                ans += (gcd(a, gcd(b, c)));
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3652
#include<iostream>
#include<algorithm>
using LL = long long;
LL x, y,z,r;

int main() {
	std::cin >> x>> y;
	r = x - y;
	z = std::llabs(r);
	if(z <= 1) {
		std::cout << "Brown" << std::endl;
	}
	else {
		std::cout << "Alice" << std::endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,m,k;vector<ll>da,db;
#define pb push_back
int main()
{
	cin>>n>>m>>k;ll minno,sum=0,cnt=0;
	da.pb(0);db.pb(0);
	for(ll i=0;i<n;i++)
	{
		ll ai;cin>>ai;sum+=ai;
		da.pb(sum);
	}sum=0;
	for(ll i=0;i<m;i++)
	{
		ll ai;cin>>ai;sum+=ai;
		db.pb(sum);
	} ll j=m;
	for(ll i=0;i<=n;i++)
	{
		if(da[i]>k)break;
		while(db[j]> (k-da[i]) )
		{
			j--;
		}
		cnt=max(cnt,i+j);
	}
	cout<<cnt<<endl;
}

Measured memory_bytes: 7896
//#define LOCAL
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string>
#include<math.h>
#include<map>
#include<random>
#include<stack>
using namespace std;
using lld = long long int;
using llu = unsigned long long int;
using pii = pair<int, int>;
using pli = pair<lld, int>;
using pil = pair<int, lld>;
using pll = pair<lld, lld>;
using piii = pair<pii, pii>;
using pdii = pair<int, pii>;
lld n;
lld sqr(lld a) {
	lld x, y;
	if (a < 0)return -1;
	if (a == 0)return 0;
	x = 1;
	int cnt = 50;
	while (cnt--) {
		y = (x + a / x) / 2;
		if (x == y)break;
		x = y;
	}
	for (y = x - 2; y <= x + 2; y++) {
		if (y < 0)continue;
		if (y * y == a)return y;
	}
	return -1;
}
int main() {
	int i, j, k, l;
	int t = 1, tv = 0;
	while (t--) {
		scanf("%lld", &n);
		for (lld x = 1; x <= n; x++) {
			if (n % x == 0) {
				lld m = n / x;
				// x^4 + 5x^2y + 5y^2 = m
				//--> 5y^2 + 5xxy + xxxx - m = 0
				//--> 25xxxx - 20xxxx+20m = 5x^4 + 20m
				lld D = 20 * m + 5 * x * x * x * x;
				lld sqrD = sqr(D);
				//printf("%lld %lld %lld %lld\n", x, m, D, sqrD);
				if (sqrD >= 0) {
					// y = -5xx +- sqrt(D) / 10
					lld y;
					y = (-5 * x * x + sqrD);
					//printf("%lld\n", y);
					if (y % 10 == 0) {
						y /= 10;
						lld tD = x * x + 4 * y;
						lld trD = sqr(tD);
						//printf("%lld %lld\n", tD, trD);
						// a = x +- sqrt(tD) / 2
						if (trD >= 0) {
							lld a = x + trD;
							lld b = x - trD;
							if (a % 2 == 0 && b % 2 == 0) {
								a /= 2;
								b /= 2;
								printf("%lld %lld\n", a, -b);
								return 0;
							}
						}
					}
					y = (-5 * x * x - sqrD);
					//printf("%lld\n", y);
					if (y % 10 == 0) {
						y /= 10;
						lld tD = x * x + 4 * y;
						lld trD = sqr(tD);
						//printf("%lld %lld\n", tD, trD);
						// a = x +- sqrt(tD) / 2
						if (trD >= 0) {
							lld a = x + trD;
							lld b = x - trD;
							if (a % 2 == 0 && b % 2 == 0) {
								a /= 2;
								b /= 2;
								printf("%lld %lld\n", a, -b);
								return 0;
							}
						}
					}
				}
			}
		}
	}
}

Measured memory_bytes: 1732
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
using namespace std;

typedef long long int lli;

const lli maxn = lli(2e5)+5, inf = lli(1e18)+5, MOD = lli(1e9)+7;

lli n, D[maxn][2], W[maxn][2];
vector<pair<lli, lli>> graph[maxn];

inline lli lliMOD(lli a, lli b)
{
	return ((a%b)+b)%b;
}

void dijkstra(lli node, lli t)
{
	for(lli i = 0;i < n;i++) D[i][t] = inf, W[i][t] = 0;
	D[node][t] = 0, W[node][t] = 1;
	set<pair<lli, lli>> Q;
	Q.insert({D[node][t], node});

	while(!Q.empty())
	{
		pair<lli, lli> top = *Q.begin();
		Q.erase(Q.begin());

		for(auto it: graph[top.second])
		{
			if(D[it.first][t] > D[top.second][t]+it.second)
			{
				if(D[it.first][t] != inf) Q.erase({D[it.first][t], it.first});
				D[it.first][t] = D[top.second][t]+it.second;
				W[it.first][t] = W[top.second][t]%MOD;
				Q.insert({D[it.first][t], it.first});
			}
			else if(D[it.first][t] == D[top.second][t]+it.second)
			{
				W[it.first][t] += W[top.second][t]%MOD;
				W[it.first][t] %= MOD;
			}
		}
	}
}

int main(void)
{
	lli m, s, t, u, v, d;
	scanf("%lld%lld%lld%lld", &n, &m, &s, &t);
	s--, t--;

	for(lli i = 0;i < m;i++)
	{
		scanf("%lld%lld%lld", &u, &v, &d);
		u--, v--;
		graph[u].push_back({v, d}), graph[v].push_back({u, d});
	}

	dijkstra(s, 0), dijkstra(t, 1);
	lli dis = D[t][0], ans = 0;

	for(lli i = 0;i < n;i++) W[i][0] %= MOD, W[i][1] %= MOD;

	for(lli i = 0;i < n;i++)
	{
		//cout << i << " " << D[i][0] << ":" << W[i][0] << " " << D[i][1] << ":" << W[i][1] << "\n";
		if(D[i][0]+D[i][1] == dis && D[i][0] == dis/2ll && D[i][1] == dis/2ll)
		{
			lli v = ((W[i][0]%MOD)*(W[i][1]%MOD))%MOD;
			ans += (v*v)%MOD;
			ans %= MOD;
		}
		for(auto it: graph[i])
		{
			if(D[i][0]+it.second+D[it.first][1] == dis && D[i][0] < dis/2ll && D[it.first][1] < dis/2ll)
			{
				lli v = ((W[i][0]%MOD)*(W[it.first][1]%MOD))%MOD;
				ans += (v*v)%MOD;
				ans %= MOD;
			}
		}
	}

	printf("%lld\n", lliMOD(((W[t][0]%MOD)*(W[t][0]%MOD)%MOD)-ans%MOD, MOD)%MOD);
}

Measured memory_bytes: 25968
#include <iostream>
#include <vector>

using namespace std;

using vi = vector<int>;
using vvi = vector<vi>;
using vb = vector<bool>;

int ff(const vvi &e, int x, vi &f, int clr) {
    if (f[x] != -1) {
        return 0;
    }

    int r = 1;
    f[x] = clr;

    for (int y : e.at(x)) {
        r += ff(e, y, f, clr);
    }

    return r;
}

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

    int n, m, k;
    cin >> n >> m >> k;
    vvi e1(n);
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        e1.at(a).push_back(b);
        e1.at(b).push_back(a);
    }

    vi sz;
    vi f(n, -1);
    int clr = 0;
    for (int i = 0; i < n; i++) {
        if (f.at(i) == -1) {
            sz.push_back(ff(e1, i, f, clr++));
        }
    }

    vi ans(n);
    for (int i = 0; i < n; i++) {
        ans.at(i) = sz.at(f.at(i)) - 1 - e1.at(i).size();
    }

    for (int i = 0; i < k; i++) {
        int c, d;
        cin >> c >> d;
        c--, d--;

        if (f[c] == f[d]) {
            ans.at(c)--;
            ans.at(d)--;
        }
    }

    for (int i = 0; i < n; i++) {
        cout << ans.at(i) << " \n"[i==n-1];
    }
    cout.flush();

    return 0;
}


Measured memory_bytes: 10708
use std::cmp;
use std::fmt::Debug;
use std::str::FromStr;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where
    T: FromStr,
    <T as FromStr>::Err: Debug,
{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim()
        .split_whitespace()
        .map(|c| T::from_str(c).unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_as_string() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main() {
    let n: usize = read_as_vec()[0];
    let mut x_plus_y: Vec<i64> = vec![];
    let mut x_minus_y: Vec<i64> = vec![];
    for _ in 0..n {
        let line: Vec<i64> = read_as_vec();
        let (x, y) = (line[0], line[1]);
        x_plus_y.push(x + y);
        x_minus_y.push(x - y);
    }

    x_plus_y.sort();
    x_minus_y.sort();
    println!(
        "{}",
        cmp::max(
            x_plus_y.last().unwrap() - x_plus_y.first().unwrap(),
            x_minus_y.last().unwrap() - x_minus_y.first().unwrap()
        )
    );
}


Measured memory_bytes: 5860
#include <bits/stdc++.h>
using namespace std;
int main() {
	int cn, cs, ce, cw;
	string s;
	cin >> s;
	cn = cs = ce = cw = 0;
	for (int i = 0; i < (int)s.length(); i++) {
		if (s[i] == 'N') cn = 1;
		else if (s[i] == 'S') cs = 1;
		else if (s[i] == 'E') ce = 1;
		else if (s[i] == 'W') cw = 1;
	}
	if (!(cn ^ cs) && !(ce ^ cw)) puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
struct UF
{
  vector<int> par;
  vector<int> sz;
  vector<int> rank;
  UF(int n):par(n),sz(n),rank(n){
    for(int i = 0; i < n; i++){
      par[i] = i;sz[i] = 1;rank[i] = 0;
    }
  }
  int find(int x) {
    if (par[x] == x) return x;
    else return par[x] = find(par[x]);
  }
  void merge(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return;
    if(rank[x] < rank[y]){
      par[x] = y;
      sz[y] += sz[x];
    }
    else{
      par[y] = x;
      sz[x] += sz[y];
      if(rank[x] == rank[y])rank[x]++;
    }
  }
  bool same(int x, int y) { return find(x) == find(y); }
  int size(int n){return sz[find(n)];}
};

bool isdig(char c){
  return '0' <= c && c <= '9';
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;cin>>s;
  ll a;cin>>a;
  for(int i=0;i<s.size();i+=a){
    cout<<s[i];
  }
  cout<<endl;
  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=500005;
char ch[N];
int a[N<<1];
int main(){
	scanf("%s",ch);
	int n=strlen(ch),sum=0;
	reverse(ch,ch+n);
	for (int i=0;i<n;i++) a[i]=(ch[i]-'0')*9,sum+=a[i];
	int i=0;
	while (i<n){
		if (a[i]>=10){
			sum-=a[i];
			sum-=a[i+1];
			a[i+1]+=a[i]/10;
			a[i]%=10;
			sum+=a[i];
			sum+=a[i+1];
			if (i+1>=n) n++;
		}
		i++;
	}
	for (int i=1;i<=20*n;i++){
		sum+=9; a[0]+=9;
		for (int j=0;j<=n;j++){
			if (a[j]>=10){
				sum-=a[j];
				sum-=a[j+1];
				a[j+1]+=a[j]/10;
				a[j]%=10;
				sum+=a[j];
				sum+=a[j+1];
				if (j+1>=n) n++;
			} else break;
		}
		if (sum<=9*i){printf("%d\n",i); return 0;}
	}
	return 0;
}

Measured memory_bytes: 4608
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
#define int long long
#define pb push_back
#define fi first
#define se second
#define fr(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
#define IO ios :: sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define pii pair<int,int>
#define sz(x) (int)x.size()
const int mod = 1e9 + 7;
const int mod1 = 998244353;
typedef long double f80;

#ifndef LOCAL
#pragma GCC optimize ("O2")
#define endl '\n'
#endif

template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rand(int l, int r){
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}

ll pwr(ll a,ll b, ll mod){
    a %= mod;
    int ans = 1;
    while(b){
        if(b & 1) ans = (ans * a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return ans;
}

string to_string(string s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

void solve(){
	int R, G, B, N;
	cin >> R >> G >> B >> N;
	int ans = 0;
	fr(i, 0, N){
		fr(j, 0, N){
			int val = N - i * R - j * G;
			if(val % B == 0 && val >= 0)
				ans ++;
		}
	}
	cout << ans;
}
signed main(){
    IO;
    #ifdef LOCAL
        freopen("inp.txt","r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    cout << setprecision(10) << fixed;
    int t = 1;
    // cin >> t;
    fr(tt, 1, t){
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
import numpy as np

N = int(input())
max_power = int(np.log10(N))
counter = 0
for power in range(1, max_power+1, 2):
    counter += 10 ** power - 10 ** (power - 1)
if max_power % 2 == 0:
    counter += N - 10 ** max_power + 1
else:
    pass
print(counter)


Measured memory_bytes: 12484
#include<iostream>
#include<math.h>
#include<algorithm>
#include<vector>
#include<string.h>
using namespace std;
#define all(c) (c).beign(), (c).end()
int main(void){
	vector<int> v(3);
	for(int i=0;i<3;i++){
		cin >> v[i];
	}
	
	sort(v.begin(), v.end());
	cout << v[0] << " " << v[1] << " "  << v[2] <<endl;
	return 0;
}

Measured memory_bytes: 3160
import sys
from collections import defaultdict, Counter, deque
from itertools import accumulate, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right, bisect
from heapq import heappop, heappush
from fractions import gcd
from math import ceil, floor, sqrt, cos, sin, pi
from copy import deepcopy

# If you use recursive call, uncomment this code
#sys.setrecursionlimit(10**6)

def main():
    N,M = map(int, input().split())
    H = list(map(int, input().split()))
    nodes = [[] for _ in range(N)]
    for _ in range(M):
        a,b = map(int,input().split())
        nodes[a-1].append(b-1) 
        nodes[b-1].append(a-1)
    count = 0
    for i in range(N):
        res = True
        if len(nodes[i]) == 0:
            count += 1
            continue
        for n in nodes[i]:
            res = res and (H[n] < H[i])
        count += int(res)
    print(count)
if __name__ == '__main__':
    main()


Measured memory_bytes: 31456
#include <bits/stdc++.h>
#define rep(i,l,r) for((i)=(l);(i)<(r);(i)++)
#define MOD 1000000007
using namespace std;
long long dp[100005][13];
int main(){
    char s[100005];
    cin>>s;
    int n=strlen(s),i,j,k;
    dp[0][0]=1;
    rep(i,0,n){
        int c;
        if(s[i]=='?')c=-1;
        else c=s[i]-48;
        rep(j,0,10){
            if(c!=-1&&c!=j)continue;
            rep(k,0,13){
                dp[i+1][(k*10+j)%13]+=dp[i][k]%MOD;
            }
        }
        rep(j,0,13)dp[i+1][j]%=MOD;
    }
    cout<<dp[n][5]<<endl;
}

Measured memory_bytes: 10496
#include<bits/stdc++.h>
  
#define lol long long
#define gcd(x,y) __gcd(x,y)
#define mt make_tuple
#define mp make_pair
#define fi first
#define se second
#define fixed(x) fixed<<setprecision(x)
using namespace std;
using pii=pair<int,int>;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
template <class A> inline A abs(A &a) { return (a < 0 ? -a : a); }
bool inLine(int x,int y,int mx,int my){return (x>=0&&y>=0&&x<mx&&y<my);}
const lol inf=(1LL<<62);
const lol MOD=(1e9)+7;
const lol mod=998244353;
const int dx[]={1,0,-1,0,1,1,-1,-1};
const int dy[]={0,1,0,-1,1,-1,1,-1};
bool can(int a,int b,int c){
  if(a==b||b==c||a==c) return false;
  int ans;
  if(a>b){
    ans=-b;
    if(a>c) ans+=a-c;
    else ans+=c-a;
  }else{
    ans=-a;
    if(c>b) ans+=c-b;
    else ans+=b-c;
  }
  return (ans<0);
}
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >>n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin >>a[i];
  }
  int ans=0;
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      for(int p=j+1;p<n;p++){
        if(can(a[i],a[j],a[p])) ans++;
      }
    }
  }
  cout <<ans<<'\n';

  return(0);
}

Measured memory_bytes: 3644
N, M = map(int, input().split())
graph = [0 for i in range(N)]
ab = []
for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    ab.append([a, b])
    graph[a] |= 1 << b
    graph[b] |= 1 << a
all_use = (1 << N) - 1


def rec(v, use):
    use |= 1 << v
    for u in range(N):
        if (not graph[v] >> u & 1) or (use >> u) & 1:
            continue
        use |= rec(u, use)
    return use

ans = 0
for a, b in ab:
    graph[a] ^= 1 << b
    graph[b] ^= 1 << a
    if rec(0, 0) != all_use:
        ans += 1
    graph[a] ^= 1 << b
    graph[b] ^= 1 << a
print(ans)
    

Measured memory_bytes: 3064
/******************************************
* AUTHOR : kamesh_11 *
* INSTITUTION : GVPCOE *
******************************************/

#include <bits/stdc++.h>
using namespace std;

#define pi 3.141592653589793
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define bs binary_search
#define endl '\n'
#define start_clock clock_t beginn=clock()
#define end_clock clock_t endd=clock()
#define cal_exec_time double time_spent=(double)(endd-beginn)/CLOCKS_PER_SEC
#define print_exec_time cout<<endl<<time_spent<<" secs"

typedef long long int ll;

const ll MOD = 1000000007;
const ll INF = 1e15;

ll powmod(ll a,ll b) {ll res=1;a%=MOD; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%MOD;a=a*a%MOD;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

ll n, arr[405], pref[405];

ll get(ll L, ll R){
	if(L > R)
		return INF;
	return pref[R] - pref[L-1];
}

ll find_min(ll i, ll j, vector<vector<ll>>& dp){
	if(i == j)
		return dp[i][j] = 0;
	if(i+1 == j)
		return dp[i][j] = arr[i]+arr[j];

	if(dp[i][j] != -1)
		return dp[i][j];

	ll mini = INF;
	for(ll k=i;k<j;k++){
		ll cnt = get(i, j) + find_min(i, k, dp) + find_min(k+1, j, dp);
		if(cnt < mini)
			mini = cnt;
	}

	return dp[i][j] = mini;
}

int main() 
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	cin>>n;
	for(ll i=1;i<=n;i++)
		cin>>arr[i];
	for(ll i=1;i<=n;i++)
		pref[i] = pref[i-1] + arr[i];

	vector<vector<ll>>dp(n+1, vector<ll>(n+1, -1));
	cout<<find_min(1, n, dp);

	return 0;
}

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

int main(void){
	int n,s;
	int A[N];
	int i,j,k;
	int p;
	
	scanf("%d",&n);
	
	for(i = 0 ;i < n ;i++){		//????????????
		scanf("%d",&s);
		A[i] = s;
	}

	
	for(i=0;i<n;i++){
		p = A[i];
		j = i-1;
		while(j >= 0 && p < A[j]){		//?????\?????????
			A[j+1] = A[j];
			j--;
			A[j+1] = p;
		}
		for(j=0 ;j < n ;j++){
			printf("%d",A[j]);
			if(j == n-1) printf("\n");	//?????????????????¨?????¬?????????????????§?????¨??????
			else printf(" ");
		}
	}
	
	
	return 0;
}

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

int main() {

  int N;
  cin >> N;

  vector<int> h(N+1);

  for (int i = 1; i <= N; i++) {
    cin >> h[i];
  }

  int answer = 0;

  vector<int> dp(N+1);

  dp[0] = 0;
  dp[1] = 0;
  dp[2] = abs(h[1] - h[2]);

  for (int i = 3; i <= N; i++) {
    dp[i] = min(abs(h[i - 2] - h[i]) + dp[i - 2], abs(h[i - 1] - h[i]) + dp[i - 1]);
  }

  cout << dp[N] << endl;

}

Measured memory_bytes: 1024
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        int n = sc.nextInt();
        int[] a = sc.nextIntArray(n);
        int ans = 0;
        for(int i = 1; i <= 100; i++){
            boolean water = false;
            for(int j = 0; j < n; j++){
                if(a[j] > 0 && !water){
                    water = true;
                    ans++;
                    a[j]--;
                }else if(a[j] <= 0 && water){
                    water = false;
                }else if(water){
                    a[j]--;
                }
            }
        }
        System.out.println(ans);
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

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

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

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

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

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


Measured memory_bytes: 21204
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
using namespace std;

string S;

int num[20];

typedef long long ll;

ll ans = 0;

int rec(vector<bool>& f)
{
    if(f.size() == S.size() - 1)
    {
        ll sum = 0;
        ll now = num[0];
        for(int i = 0;i < f.size();i++)
        {
            if(f[i])
            {
                sum += now;
                now = 0;
            }           
            now = now * 10 + num[i + 1]; 
        }
        sum += now;

        ans += sum;
    }
    else
    {
        f.push_back(true);
        rec(f);
        f.pop_back();
        f.push_back(false);
        rec(f);
        f.pop_back();
    }

    return 0;
}

int main()
{
    cin >> S;

    for(int i = 0;i < S.size();i++)
    {
        num[i] = (int)S[i] - (int)'0';
    }

    vector<bool> v;

    rec(v);

    cout << ans << endl;

}

Measured memory_bytes: 256
n = int(input())
cnt = 0
tmp = 0
for i in range(1, n + 1, 2):
    tmp = 0
    for j in range(1, n + 1, 2):
        if (i % j == 0):
            tmp += 1
    if (tmp > 7):
        cnt += 1
print(cnt)

Measured memory_bytes: 2940
N,K = map(int,input().split())
A = list(map(int,input().split()))
T = [1]
TN = 1
for i in range(min(N,K)):
    T.append(A[TN-1])
    TN = T[-1]
if min(N,K) ==K:
    print(TN)
else:
    R1 = T[-1]
    R2 = T[-1]
    T2 = [T[-1]]
    for i in range(N):
        if R2 != A[R1-1]:
            T2.append(A[R1-1])
            R1 = T2[-1]
        else:
            break
    K = K - N
    Kmod = K%len(T2)
    print(T2[Kmod])


Measured memory_bytes: 32380
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int T = sc.nextInt();
        int[] c= new int[N];
        int[] t = new int[N];
        int min=1000;
        boolean[] check = new boolean[N];
        int count =0;
        for(int i=0;i<N;i++){
            c[i] = sc.nextInt();
            t[i] = sc.nextInt();
            if(t[i]<=T)check[i] = true;
            else check[i] = false;
        }
        for(int i=0;i<N;i++){
            if(check[i]){
                if(min>c[i]){
                    min = c[i];
                }
                count++;
            }
        }
        if(count>0)System.out.println(min);
        else System.out.println("TLE");
    }
}


Measured memory_bytes: 23764
h,w=map(int,input().split())

maze=[list(input()) for _ in range(h)]

group=[[0]*w for _ in range(h)]

group_no=0
color_cnt=[]

for y in range(h):
    for x in range(w):
        if group[y][x]==0:
            stack=[(y,x)]
            group_no+=1

            color_cnt_tmp=[0,0]

            while len(stack)>0:
                tmp=stack.pop()
                group[tmp[0]][tmp[1]]=group_no
                #print(tmp)
                if maze[tmp[0]][tmp[1]]=="#":
                    color_cnt_tmp[0]+=1
                else:
                    color_cnt_tmp[1]+=1

                for (ny,nx) in [(0,1),(1,0),(-1,0),(0,-1)]:
                    my=ny+tmp[0]
                    mx=nx+tmp[1]
                    if 0<=my<h and 0<=mx<w:
                        if group[my][mx]==0:
                            if maze[tmp[0]][tmp[1]]!=maze[my][mx]:
                                stack.append((my,mx))
                                group[my][mx]=group_no
            color_cnt.append(color_cnt_tmp)

ans=0
for (b,w) in color_cnt:
    ans+=b*w

print(ans)



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

const int N = 1000005;

int n, p[N], r;

int main(){
    scanf("%d", &n);
    for(int i = 1, x; i <= n; i++){
        scanf("%d", &x);
        p[x] = i;
    }
    for(int i = 1, t = 1; i <= n; i++){
        if(p[i] > p[i + 1]){ r = max(r, t); t = 1; }
        else t++;
    }
    printf("%d\n", n - r);
}

Measured memory_bytes: 1024
<?php
while (($line = trim(fgets(STDIN))) != 0) {
    $n = intval($line);
    $mul5  = 0;
    $mul2  = 0;
 
    for ($i = 1; $i <= $n; $i++) {
        $target = $i;
        while ($target % 2 == 0) {
            $mul2++;
            $target /= 2;
        }
        while ($target % 5 == 0) {
            $mul5++;
            $target /=5;
        }
    }
 
$res = 1;
for ($i=(int)$line;$i>1;$i--) {
    $res *= $i;
}
$tmpArray = str_split($res);
for ($i=count($tmpArray);$i>0;$i--) {
    if ($tmpArray[$i-1] == '0') {
        $zero[] = true;
    } else {
        break;
    }
}

    echo min($mul5, $mul2) . "\n";
}

Measured memory_bytes: 15232
#include <bits/stdc++.h>
using namespace std;
#define PI 3.14159265358979323
#define ll long long int
#define vi vector <int>
#define vl vector <ll>
#define all(v) (v).begin(),(v).end()
#define pb push_back
 
ll power(ll a, ll b){//a^b
    ll res=1;
    while(b>0){
        if(b&1){res=(res*a);b--;}
        a=(a*a);
        b>>=1;
    }
    return res;
}
 
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
 
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,m,k;
	cin>>n>>m>>k;
	vl a(n),b(m);
	for(ll i=0;i<n;i++){
		cin>>a[i];
		if(i)
			a[i]+=a[i-1];
	}
	for(ll i=0;i<m;i++){
		cin>>b[i];
		if(i)
			b[i]+=b[i-1];
	}
	ll ans=upper_bound(all(b),k)-b.begin();
	for(ll i=0;i<n;i++){
		ll read=a[i];
		if(read>k)
			break;
		ll rem=k-read;
		ll br=upper_bound(all(b),rem)-b.begin();
		ans=max(ans,i+1+br);
	}
	cout<<ans<<"\n";
}


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


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

  long long answer = 0;
  for (int i = 1; i <= N; ++i) {
    if (i % 3 != 0 && i % 5 != 0) {
      answer += i;
    }
  }

  cout << answer << endl;
}

Measured memory_bytes: 3580
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
#include <list>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
#define LNF __LONG_LONG_MAX__
const ll MOD = 1000000007;
const int MAX = 200000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
long long gcd(long long x, long long y){
    if(y==0) return x;
    else return gcd(y,x%y);
}
//最小公倍数
long long lcm(long long x, long long y){
    return x / gcd(x, y) * y;
}
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    int A,B,T; cin >> A >> B >> T;
    int num = T/A;
    cout << B*num << endl;
    return 0;
}


Measured memory_bytes: 3536
#include<bits/stdc++.h>
 
using namespace std;
 
int main(){
	long int N;
	long int ch=0;
	string S;
	cin >> N >> S;
	for(long int i=1;i<N;i++){ 
		if(S[i] == 'E'){
			ch++;
		}
	}
	long int ans=ch;
 
	for(long int pivot=1;pivot<N;pivot++){
		if(S[pivot]=='E'){
			ch--;
		}
      if(S[pivot-1]=='W'){
			ch++;
		}
		if(ans > ch){
			ans = ch;
		}
	}
 
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 900
#include<stdio.h>

// 配列の要素を順番に出力
void trace(int A[], int N) {
    for (int i=0; i<N; i++) {
        if (i>0) printf(" ");  //隣接する要素の間に1つの空白を出力
        printf("%d", A[i]);
    }
    printf("\n");
}

// 挿入ソート(0オリジン配列)
void insertionSort(int A[], int N) {
    int j, i, tmp;
    for (i=1; i<N; i++) {
        tmp = A[i];
        j = i-1;
        while (j>=0 && A[j]>tmp) {
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = tmp;
        trace(A, N);
    }
}

int main() {
    int N, i, j;
    int A[100];

    scanf("%d", &N);
    for (i=0; i<N; i++) scanf("%d", &A[i]);

    trace(A, N);
    insertionSort(A, N);

    return 0;
}


Measured memory_bytes: 2112
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a,b,k,x=0;
  cin>>k>>a>>b;
  for(int i=a;i<=b;i++)
  {
      if(i%k==0){
        x=1;
        break;
        }
  }
if(x==1){
cout<<"OK";
}
else{
cout<<"NG";
}
}

Measured memory_bytes: 3608
// abc059.a

#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>

using namespace std;

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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, m;
	int k[100];
	int a[100][100];
	int x[100] = {0};
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> k[i];
		for (int j = 0; j < k[i]; j++) {
			cin >> a[i][j];
			int t = a[i][j];
			x[t - 1]++;
		}
	}

	int ans = 0;
	for (int i = 0; i < m; i++) {
		if (x[i] == n) {
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stdio.h>
#include <cmath>

using namespace std;

int main()
{
    int w, h, x, y, r;
    cin >> w >> h >> x >> y >> r;
    bool f = false;

    if (x - r >= 0 && x + r <= w)
    {
        if (y - r >= 0 && y + r <= h)
        {
            f = true;
        }
    }

    if (f)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 3108
import java.util.Scanner;
class Main{
    public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
    
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();

        if(a < b) {
            if (b < c) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        } else {
            System.out.println("No");
        }
    }
}

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

int main() {
    int a, b; cin >> a >> b;
    a--, b--;
    rep(i, 3) {
        if (a != i && b != i)
            cout << i + 1 << endl;
    }
}


Measured memory_bytes: 256
n= int(input())
data = [int(i) for i in input().split()]

k = max(data)
idx = [abs(data[i] - (k/2)) for i in range(n)]
msa = int(min(idx) + k/2)
msb = int(k/2 - min(idx))
if msa in data and msa == k:
    print(k,0)
elif msa in data:
    print(k,msa)
else:
    print(k,msb)


Measured memory_bytes: 14060
(defn coins [x n]
  (map #(* x %) (range (inc n))))

(defn yens [xs ys zs]
  (for [x xs y ys z zs] (+ x y z)))

(def a (read))
(def b (read))
(def c (read))
(def x (read))

(->>
  (yens (coins 500 a) (coins 100 b) (coins 50 c))
  (filter (partial = x))
  (count)
  (println))

Measured memory_bytes: 77452
import java.io.*;
import java.util.*;

class Main {

	static final int M = 1000000007;

	private static Map<Long, Long> factorize(long n) {
		Map<Long, Long> a = new HashMap<>();
		for (long i = 2; i * i <= n; i++) {
			if (n % i != 0) continue;
			long count = 0;
			while (n % i == 0) {
				count++;
				n /= i;
			}
			a.putIfAbsent(i, count);
		}

		if (n != 1) a.putIfAbsent(n, 1L);
		return a;
	}

	public static void main(String[] args) throws Exception {
		final Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Map<Long, Long> lcm = new HashMap<>();
		long[] A = new long[N];
		for (int i = 0; i < N; i++) {
			A[i] = sc.nextLong();
			for (Map.Entry<Long, Long> e : factorize(A[i]).entrySet()) {
				lcm.putIfAbsent(e.getKey(), e.getValue());
				if (lcm.get(e.getKey()) < e.getValue()) {
					lcm.put(e.getKey(), e.getValue());
				}
			}
		}

		long LCM = 1;
		for (Map.Entry<Long, Long> e : lcm.entrySet()) {
			for (int i = 0; i < e.getValue(); i++) {
				LCM *= e.getKey();
				LCM %= M;
			}
		}

		long answer = 0;
		for (int i = 0; i < N; i++) {
			answer += LCM * pow(A[i], M - 2, M);
			answer %= M;
		}

		System.out.println(answer);
	}

	private static long pow(long a, long n, long M) {
		long x = 1;
		while (n > 0) {
			if ((n & 1) == 1) {
				x *= a;
				x %= M;
			}
			a *= a;
			a %= M;
			n >>= 1;
		}
		return x;
	}
}


Measured memory_bytes: 34888
/*
??????????????????????????´??° a ??¨ b ??????????????°???????????????????????°?????????????????????????????????
???????????????????????° <= 200
*/

#include <iostream>
#include <string>

using namespace std;
 
int main()
{

	int a, b, calc, strCount = 0;
	string str = "";

	for ( int i = 0; i < 200;  i++ ) {
		a = b = 0;
		
		cin >> a >> b;

		if ( a == 0 && b == 0 ) {
			break;
		}

		calc = a + b;
		str = to_string( calc );
		strCount = str.size();
		
		cout << strCount << endl;
	}

    return 0;
}

Measured memory_bytes: 3288
input_data = gets.chomp.split(" ")
m = input_data[0].to_i
min = input_data[1].to_i
max = input_data[2].to_i

while m != 0 do
    array = []
    m.times do
        g = gets.chomp.to_i
        array.push(g)
    end
    
    gapMax = 0
    tem = 0
    (min..max).each do |i|
        gap = array[i-1] - array[i]
        #1件目の10でストップしている。　最後まで検証するには、=をつける必要がある。
        if gapMax <= gap
            gapMax = gap
            tem = i
        end
    end
    p tem
    input_data = gets.chomp.split(" ")
    m = input_data[0].to_i
    min = input_data[1].to_i
    max = input_data[2].to_i
end




Measured memory_bytes: 6888
n = 0

def format_input(filename = None):
	global n
	if filename == None:
		n = int(input())

	elif filename == '__random__':
		from random import randint as rng
		n = rng(10**2, 10**3 - 1)
		print(n)

def get_answer():
	answer = 'No'
	digits = []
	k = n
	while k > 0:
		digits.append(k % 10)
		k //= 10
	if digits.count(7) > 0:
		answer = 'Yes'
	return answer

if __name__ == '__main__':
	format_input()

	ans = get_answer()
	print(ans)


Measured memory_bytes: 9196