akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define fi			first
#define se			second
#define fz(i,a,b)	for(int i=a;i<=b;i++)
#define fd(i,a,b)	for(int i=a;i>=b;i--)
#define foreach(it,v) for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define all(a)		a.begin(),a.end()
#define giveup(...) return printf(__VA_ARGS__),0;
#define fill0(a)	memset(a,0,sizeof(a))
#define fill1(a)	memset(a,-1,sizeof(a))
#define fillbig(a)	memset(a,0x3f,sizeof(a))
#define fillsmall(a) memset(a,0xcf,sizeof(a))
#define mask(a)		(1ll<<(a))
#define maskx(a,x)	((a)<<(x))
#define _bit(a,x)	(((a)>>(x))&1)
#define _sz(a)		((int)(a).size())
#define filei(a)	freopen(a,"r",stdin);
#define fileo(a)	freopen(a,"w",stdout);
#define fileio(a) 	freopen(a".in","r",stdin);freopen(a".out","w",stdout)
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define put(x)		putchar(x)
#define eoln        put('\n')
#define space		put(' ')
#define y1			y_chenxiaoyan_1
#define y0			y_chenxiaoyan_0
typedef pair<int,int> pii;
inline int read(){
	int x=0,neg=1;char c=getchar();
	while(!isdigit(c)){
		if(c=='-')	neg=-1;
		c=getchar();
	}
	while(isdigit(c))	x=x*10+c-'0',c=getchar();
	return x*neg;
}
inline void print(int x){
	if(x<0){
		putchar('-');
		print(abs(x));
		return;
	}
	if(x<=9)	putchar(x+'0');
	else{
		print(x/10);
		putchar(x%10+'0');
	}
}
inline int qpow(int x,int e,int _MOD){
	int ans=1;
	while(e){
		if(e&1)	ans=ans*x%_MOD;
		x=x*x%_MOD;
		e>>=1;
	}
	return ans;
}
int n=read(),m=read(),q=read();
int a[55],b[55],c[55],d[55];
int x[15],ans=0;
inline void dfs(int cur){
	if(cur==n+1){
		int sum=0;
		fz(i,1,q){
			if(x[b[i]]-x[a[i]]==c[i])	sum+=d[i];
		}
		ans=max(ans,sum);
		return;
	}
	fz(i,x[cur-1],m){
		x[cur]=i;
		dfs(cur+1);
	}
}
signed main(){
	x[0]=1;
	fz(i,1,q)	cin>>a[i]>>b[i]>>c[i]>>d[i];
	dfs(1);
	cout<<ans<<endl;
	return 0;
}

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

int main() {
  int K,S;
  int counter = 0;
  cin >> K >> S;
  for (int x = 0; x < K + 1; x++) {
    for (int y = 0; y < K + 1; y++) {
      int z = S - (x + y);
      if ((0 <= z) && (K >= z)) {
        counter++;
      }
    }
  }
  cout << counter << endl;
}



Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
	int n;
	while(scanf("%d",&n),n!=-1){
		char change[] = {'0','1','2','3'};
		char ans[100000]={0};
		if(n < 4)ans[0] = n+48;
		else{
			for(int i = 0;; i++){
				ans[i] = change[n%4];
				n /= 4;
				if(n < 4){
					ans[i+1] = n+48;
					break;
				}
			}
		}
		int len = strlen(ans);
		reverse(ans,ans+len);
		printf("%s\n",ans);
	}
	return 0;
}

Measured memory_bytes: 1116
#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.at(i);
    
    vector<int> kosuu(100010);
    for(int i = 0; i < N; i++) {
        int x = A.at(i);
        kosuu.at(x)++;
    }
    
    int ans = 0;
    for(int i = 0; i < 100000; i++) {
        int tmp;
        if(i == 0) tmp = kosuu.at(i) + kosuu.at(i+1);
        else tmp = kosuu.at(i-1) + kosuu.at(i) + kosuu.at(i+1);
        ans = max(ans, tmp);
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
def main():
    n = int(input())
    b = [0] * n
    for i, ai in enumerate([int(i) for i in input().split()][::-1]):
        m = n - i
        c = 0
        for j in range(m * 2, n + 1, m):
            c += b[j - 1]
        b[m - 1] += ai ^ (c % 2)
    c = [i + 1 for i, bi in enumerate(b) if bi]
    print(len(c))
    print(*c)

if __name__ == '__main__':
    main()

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

int main(){
    int N;cin>>N;
    int a[N];
    for(int i=0;i<N;i++)cin >> a[i];
    int count =0;
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            for(int k=j+1;k<N;k++){
                if(a[i]!=a[j]&&a[j]!=a[k]&&a[k]!=a[i]){
                    if((a[i]+a[j]>a[k])&&(a[j]+a[k]>a[i])&&(a[k]+a[i]>a[j]))count++;
                }

            }
        }
    }
    cout <<count<<endl;
}

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

LL a, b, c, d, n;

int main(){
	scanf("%lld%lld%lld%lld%lld", &a, &b, &c, &d, &n);
	c = min(c, min(4*a, 2*b));
	if (n&1) printf("%lld\n", min(n*c, n/2*d+c));
	else printf("%lld\n", min(n*c, n/2*d));
	return 0;
}

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.HashMap;
import java.util.InputMismatchException;
import java.util.Map;
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) {

			int N = in.nextInt(), M = in.nextInt();
			Map<Integer, Integer> map = new HashMap<>();
			for (int i = 0; i < M; i++) {
				int a = in.nextInt();
				int b = in.nextInt();
				map.merge(a, 1, Integer::sum);
				map.merge(b, 1, Integer::sum);
			}

			for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
				if (entry.getValue() % 2 == 1) {
					out.println("NO");
					return;
				}
			}

			out.println("YES");

		}
	}
	static class P {
		int toNode, count;
		P (int toNode) {
			this.toNode = toNode;
			this.count = 1;
		}
	}

	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: 52808
#include <bits/stdc++.h>

using namespace std;

int main(int argc, char const *argv[]) {
	int ss[100001];
	int ts[100001];
	char s[100001];
	char t[100001];
	scanf("%s%s", s, t);
	ss[0] = 0;
	ts[0] = 0;
	for(int i = 0, ls = strlen(s); i < ls; i++) {
		if (s[i] == 'A') {
			ss[i + 1] = (ss[i] + 1) % 3;
		} else {
			ss[i + 1] = (ss[i] + 2) % 3;
		}
	}
	for(int i = 0, lt = strlen(t); i < lt; i++) {
		if (t[i] == 'A') {
			ts[i + 1] = (ts[i] + 1) % 3;
		} else {
			ts[i + 1] = (ts[i] + 2) % 3;
		}
	}
	int q;
	scanf("%d", &q);
	for(int i = 0; i < q; i++) {
		int a, b, c, d;
		scanf("%d%d%d%d", &a, &b, &c, &d);
		if (((ss[b] - ss[a - 1]) - (ts[d] - ts[c - 1])) % 3 == 0) {
			printf("YES\n");
		} else {
			printf("NO\n");
		}
	}
	return 0;
}


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

int main(){
	int N; cin >> N; int pre = 0 , cnt = 0;
	for(int i = 1 ; i <= N ; ++i){
		int x; cin >> x;
		if(pre == x){++cnt; x = 10001;}
		pre = x;
	}
	cout << cnt; return 0;
}

Measured memory_bytes: 256
def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0

def modinv(a, m):
    g, x, y = xgcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m

MOD = 10**9+7
x, y = map(int, input().split())
if (x+y)%3 != 0 or 3*x < x+y or 3*y < x+y:
    print(0)
    exit()
n = (x+y)//3
x -= n
y -= n
fact = [1, 1]
for i in range(2,n+1):
    fact.append(fact[i-1] * i % MOD)
factX = fact[x]
factY = fact[y]
factN = fact[n]
# print(x,y,n)
# print(factX,factY,factN)

c = factN * modinv(factX, MOD) * modinv(factY, MOD)
c %= MOD
print(c)


Measured memory_bytes: 86512
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>
#include <tuple>

template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
  if (lhs > rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
  if (lhs < rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

// [l, r) from l to r
struct range {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { ++i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr l, r;
  constexpr range(int l_, int r_): l(l_), r(std::max<int>(l_, r_)) { }
  constexpr itr begin() const { return l; }
  constexpr itr end() const { return r; }
};

// [l, r) from r to l
struct revrange {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { --i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr r, l;
  constexpr revrange(int l_, int r_): l(l_ - 1), r(std::max<int>(l_, r_) - 1) { }
  constexpr itr begin() const { return r; }
  constexpr itr end() const { return l; }
};

signed main() {
  int K, Q;
  std::cin >> K >> Q;
  std::vector<int> D(K);
  for (int &x: D) {
    std::cin >> x;
  }
  while (Q--) {
    int N, X, M;
    std::cin >> N >> X >> M;
    X %= M;
    int zero = 0;
    long long sum = 0;
    for (int x: D) {
      int tmp = x % M;
      sum += tmp;
      if (tmp == 0) {
        ++zero;
      }
    }
    zero *= (N - 1) / K;
    sum *= (N - 1) / K;
    sum += X;
    for (int i: range(0, (N - 1) % K)) {
      int tmp = D[i] % M;
      sum += tmp;
      if (tmp == 0) {
        ++zero;
      }
    }
    std::cout << (N - 1) - sum / M - zero << '\n';
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<cstdlib>
#include<vector>
#include<map>
#include<set>
#include<algorithm>

using namespace std;
int x;

int main(){
  cin>>x;

  if(x == 1){
    cout<<"1"<<endl;
  } else {
    int ans = -1;
    for(int i=2;i<=x;i++){
      int tmp = i*i;
      while(1){
        if(tmp <= x){
          ans = max(ans,tmp);
          tmp *= i;
        } else {
          break;
        }
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}

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

#define MOD 1000000007
#define MAX 101 
using namespace std;

typedef long long int lli;

lli fac[MAX], finv[MAX], inv[MAX];
lli COMNUM[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;
    }
}

// 二項係数計算
lli COM(lli n, lli k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main(void){
  COMinit();
  lli M,N;
  cin >> N >> M;
  lli p,q;
  p = COM(N,2);
  q = COM(M,2);
  cout << p + q << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 100005;
const int mod = 1000000007;


int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  int m,n;
  cin>>m>>n;
  unordered_set<int>st;
  for(int i=0;i<n;i++){
    int x;
    cin>>x;
    st.insert(x);
  }
  int l,r;
  for(int i=m;;i++){
    if(st.find(i)==st.end()){
      r = i;
      break;
    }
  }
  for(int i=m-1;;i--){
    if(st.find(i)==st.end()){
      l = i;
      break;
    }
  }
  if(abs(m-l)<=abs(m-r)){
    cout<<l<<endl;
  } else cout<<r<<endl;
  return 0;
}

Measured memory_bytes: 3636
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <random>
#include <chrono>

#define _ << " " <<
#define all(v) v.begin(), v.end()
#define sp(n) fixed << setprecision(n)
#define ff first
#define ss second

using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const ll mod = 1e9 + 7;
const double eps = DBL_EPSILON;

int dp[101000];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> a(n);
	for (int& i : a) cin >> i;
	dp[1] = abs(a[0] - a[1]);
	for (int i = 2; i < n; i++) dp[i] = min(dp[i - 1] + abs(a[i] - a[i - 1]), dp[i - 2] + abs(a[i] - a[i - 2]));
	cout << dp[n - 1] << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
int n,m,a,b,i,c[2][N];
vector<int>e[N];
char s[N];
bool inq[N];
queue<int>q;
int main(){
	scanf("%d%d%s",&n,&m,s+1);
	for(i=0;i<m;++i){
		scanf("%d%d",&a,&b);
		e[a].push_back(b),e[b].push_back(a),++c[s[a]-'A'][b],++c[s[b]-'A'][a];
	}
	for(i=1;i<=n;++i)if(!c[0][i] || !c[1][i])q.push(i),inq[i]=1;
	for(;!q.empty();){
		a=q.front();q.pop();
		for(int v:e[a])if(!inq[v] && !--c[s[a]-'A'][v])inq[v]=1,q.push(v);
	}
	for(i=1;i<=n;++i)if(!inq[i])break;
	puts(i<=n?"Yes":"No");
	return 0;
}

Measured memory_bytes: 12672
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int a,b;
	cin>>a>>b;
	if(a>=13)	cout<<b<<endl;
	else  if(6<=a&&a<=12)	cout<<b/2<<endl;
	else	cout<<0<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define MAX ((int)(1e9))
#define pi (1.0*acos(-1))
#define M ((int)(1e9 + 7))
#define NN ((ll)(305))
#define N ((int)(2e5+7))
#define eps 0
#define log 20


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;


typedef tree < ll,  null_type,  less < ll >,  rb_tree_tag,  tree_order_statistics_node_update > o_set;
/// o_set s;
/// s.order_of_key(k) : Number of items strictly smaller than k .
/// *(s.find_by_order(k)) : K-th element in a set (counting from zero).

int dp[N];

char s[N];

int main()
{
    scanf("%s",s);
    int n = strlen(s);
    dp[n] = 0;
    ll ans = 0;
    for(int i = n-1; i>=0; i--){
        if(s[i]=='A'){
            for(int j = i+1; j<n; j++){
                if(s[j]=='A'){
                    dp[i] += dp[j];
                    break;
                }
                else if(s[j]=='B' && s[j+1]=='C'){
                    j++;
                    dp[i]++;
                }
                else break;
            }
            ans += dp[i];
        }
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//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; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

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

    int minv = A[1];
    for(int i=2; i<=N; i++){
        B[i] = A[i]-minv;
        minv = min(minv, A[i]);
    }

    int ans = 0;
    int maxv = B[2];
    for(int i=2; i<=N; i++) maxv = max(maxv, B[i]);

    for(int i=2; i<=N; i++) if(B[i] == maxv) ans++;

    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <unordered_map>
#include <numeric>
using namespace std;
using ll = long long;
#define rep(i, j, n) for(int i = (j); i < (n); ++i)
#define rrep(i, j, n) for(int i = (n) - 1; (j) <= i; --i)

constexpr ll MOD = 1000000007;
constexpr ll INF = 1LL << 60;


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

	int a, b; cin >> a >> b;
	if (a > b) {
		cout << a + a - 1;
	}
	else if (a == b) {
		cout << a * 2;
	}
	else {
		cout << b + b - 1;
	}

	return 0;
}


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

#define MOD 1000000007
#define ll long long int
#define vll vector<ll>

int main() {

    ll N, K;
    cin >> N >> K;

    vll A;
    ll tmp;
    for (ll i = 0; i < N; i++) {
        cin >> tmp;
        A.push_back(tmp);
    }

    ll x = 0;
    for (ll i = 0; i < N-1; i++) {
        for (ll j = i+1; j < N; j++) {
            if (A[i] > A[j]) x++;
        }
    }
    x %= MOD;

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

    ll y = 0;
    ll num = 1;
    for (ll i = 0; i < N-1; i++) {
        if (A[i] < A[i+1]) {
            y += (N-1 - i) * num;
            num = 1;
        }
        else num++;
    }

    y %= MOD;
    ll z = (K * (K-1) / 2) % MOD;

    cout << (x*K + y*z) % MOD << endl;

    return 0;
}


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

int main(){
	string a, b, c;
	cin >> a >> b >> c;
	cout << char(a[0]-'a'+'A') << char(b[0]-'a'+'A') << char(c[0]-'a'+'A') << endl;
	return 0;
}

Measured memory_bytes: 256
n,m = list(map(int, input().split()))

if n % 2 == 1:
    for i in range(m):
        print("{} {}".format(2 + i, n - i))
else:
    for i in range(m):
        if i % 2 == 0:
            print("{} {}".format(int(n / 2 - i / 2), int(n / 2 + 1 + i / 2)))
        else:
            print("{} {}".format(int(2 + i // 2), int(n - i // 2)))

Measured memory_bytes: 9228
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define reprev(i, n) for(int i = (n-1LL); i >= 0; --i)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t; cin >> s >> t;
    map<char, vector<int> > ms, mt;
    rep (i, s.size()) ms[s[i]].push_back(i);
    rep (i, t.size()) mt[t[i]].push_back(i);

    for (auto x : ms) {
        eprintf("%c:(", x.first);
        for (int y : x.second) eprintf("%d,", y);
        eprintf(") ");
    }
    eprintf("\n");

    ll nth = 0, now = -1;
    rep (i, t.size()) {
        int ng = -1, ok = ms[t[i]].size();
        if (ok == 0) {
            cout << "-1\n";
            return 0;
        }
        if (ms[t[i]].back() <= now) {
            nth++; now = ms[t[i]].front();
    } else {
        while (ok - ng > 1) {
            int med = (ok + ng) / 2;
            if (ms[t[i]][med] > now) ok = med;
            else ng = med;
        }
            now = ms[t[i]][ok];
        }
        eprintf("%c:%lld,%lld ", t[i], nth, now);
    }
    eprintf("\n");

    cout << nth * s.size() + now + 1 << "\n";
    return 0;
}

Measured memory_bytes: 2120
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int mod=1e9+7;
#define N 2020
inline int read(){
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*f;
}
int n,dp[N>>1][N],ans,sum[N];
int main(){
	n=read();
	dp[0][0]=1;
	for(int i=1;i<=n/3;++i){
		sum[0]=dp[i-1][0];
		for(int j=1;j<=n;++j){
			sum[j]=(sum[j-1]+dp[i-1][j])%mod;
		}
		for(int j=3;j<=n;++j){
			dp[i][j]=sum[j-3];
		}
		ans=(ans+dp[i][n])%mod;
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 8888
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;

vector<int> topological_sort(const vector<vector<int>> &G) {
  const int N = G.size();
  vector<int> indeg(N, 0);
  for(auto &&vs : G) {
    for(int v : vs) {
      indeg[v]++;
    }
  }
  queue<int> Q;
  for(int i = 0; i < N; ++i) {
    if(indeg[i] == 0) Q.push(i);
  }
  vector<int> ret;
  while(!Q.empty()) {
    int v = Q.front(); Q.pop();
    ret.push_back(v);
    for(int u : G[v]) {
      indeg[u]--;
      if(indeg[u] == 0) Q.push(u);
    }
  }
  return ret;
}

int main() {
  ios::sync_with_stdio(false);
  int V, E; cin >> V >> E;
  vector<vector<int>> G(V);
  for(int i = 0; i < E; ++i) {
    int s, t; cin >> s >> t;
    G[s].push_back(t);
  }
  for(auto &&v : topological_sort(G)) {
    cout << v << endl;
  }
}

Measured memory_bytes: 1976
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define repp(i,a,b) for(int i = a ; i < b ; i++)
#define rep(i,n) repp(i,0,n)
#define endl '\n'
#define pb push_back
#define mod 1000000007
#define reppr(i,a,b) for(int i = a-1 ; i>=b ; i--)
#define repr(i,n) reppr(i,n,0)
#define ff first
#define ss second
#define all(n) n.begin(),n.end()
#define SORT(a) sort(all(a));
#define REVERSE(a) reverse(all(a));

int powmod(int x,int y) 
{ 
    if (y == 0) return 1; 
    int p = powmod(x, y/2) % mod; 
    p = (p * p) % mod;   
    return (y%2 == 0) ? p : (x * p) % mod; 
}
 
int inverse(int a) 
{ 
   return powmod(a,mod-2); 
}

void solve();
signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	int t = 1;
	// cin >> t;
	while(t--) solve();
}

void solve()
{
	int l , r , d;
	cin >> l >> r >> d;
	cout << r/d - (l-1)/d << endl;	
}

Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <cstring>

using namespace std;
typedef pair<int ,int > P;

int main()
{

long long  x , y;
    for(;cin >> x >> y;)
    {
        if( abs(x - y) <= 1)
            cout << "Brown" <<endl;
        else
            cout << "Alice" <<endl;
    }
}


Measured memory_bytes: 3604
#include<iostream>
#include<string>
#include<cstring>
using namespace std;
int main(){
  char c[1000];//ansc[1000];
  int x,count=0;
  //cin.getline(c,1000);
  while(cin>>c){
    x = strlen(c);
    if(count!=0) cout << ' ';
    //cout << x << endl;
    for(int i=0;i<x;i++){ 
      if(c[i]>='a'&&c[i]<='z') c[i] = c[i] - 'a' +'A';
      else if(c[i]>='A'&&c[i]<='Z') c[i] = c[i] + 'a' - 'A';
      cout << c[i];
    }
    count++;
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 1136
#include <bits/stdc++.h>
using namespace std;
int N, h[100001], dp[100001];
int main(){
    scanf("%d", &N);
    for(int i=1; i<=N; i++)
        scanf("%d", &h[i]);
    dp[2] = abs(h[2] - h[1]);
    for(int i=3; i<=N; i++)
        dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
    printf("%d\n", dp[N]);
}


Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.ABC_155
{
    class E
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            string s = Read();
            long[,] dp = new long[s.Length, 2];
            dp[0, 0] = s[0] - '0';
            dp[0, 1] = 1 + 10 - dp[0, 0];
            for (int i = 0; i < s.Length - 1; i++)
            {
                int num = s[i+1] - '0';
                dp[i + 1, 0] = Min(dp[i, 0], dp[i, 1]) + num;
                dp[i + 1, 1] = Min(dp[i, 1] - 1 + 10 - num, dp[i, 0] + 1 + 10 - num);
            }
            WriteLine(Min(dp[s.Length - 1, 0], dp[s.Length - 1, 1]));
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 30432
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<ctime>
#include<queue>
using namespace std;
int a[1001];
bool ok=0;
int tot;
int main()
{
int n;cin>>n;
while(n)
{
	a[++tot]=n%10;
	n/=10;
}
for(int i=1;i<=tot;i++)
{
	if(a[i]!=a[tot-i+1]){
		ok=1;break;
	}
}
if(ok==1)cout<<"No";
else cout<<"Yes";
	return 0;
 }


Measured memory_bytes: 256
K, N = map(int,input().split())
A = list(map(int,input().split()))
gap = []

for i in range(N):
    if i < N - 1:
        sa = A[i+1] - A[i]
    else:
        sa = A[0] + (K - A[N-1])
    gap.append(sa)
    i += 1
    
dist = max(gap)
ans = K - dist
print(ans)


Measured memory_bytes: 25452
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,r;
  while(cin >> n >> r,n){
    vector<int> a(n);
    for(int i=0; i<n; i++) a[i] = n-i;

    for(int i=0; i<r; i++){
      int p,c;
      cin >> p >> c;

      vector<int> v1,v2;
      for(int j=0; j<p-1; j++) v1.push_back(a[j]);
      for(int j=0; j<c; j++) v2.push_back(a[j+p-1]);
      for(int j=0; j<c; j++) a[j] = v2[j];
      for(int j=0; j<p-1; j++) a[j+c] = v1[j];
    }
    cout << a[0] << endl;
  }
  return 0;
}




Measured memory_bytes: 2996
#include <bits/stdc++.h>
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, x, y;
    cin >> n >> x >> y;

    //cout << n << endl;

    vector<int> v(n, 0);

    for (int i = 1; i <=n-1; i++){
        for (int j = i + 1; j <= n; j++){
            int tt = j - i;

            tt = min(abs(x - i) + abs(y - j)+1, tt);

            v[tt]++;
        }
    }

    for (int i = 1; i < n; i++){
        cout << v[i] << endl;
    }
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
  vector<int> ar;
  int n;
  int d;
  cin >> n;
  for(int i=0;i<n;i++){
    for(int j=0;j<3;j++){
      cin >> d;
      ar.push_back( d );
    }
    sort( ar.begin() , ar.end() , greater<int>() );
    int a = ar[0] * ar[0];
    int b = ar[1] * ar[1];
    int c = ar[2] * ar[2];
    if(a == (b + c)){
      cout << "YES" << endl;
    }else {
      cout << "NO" << endl;
    }
    ar.clear();
  }
}

Measured memory_bytes: 1208
#include<bits/stdc++.h>
using namespace std;
int q;
int n;
int query(int a, int cnt){
    int next = 0;
    if(a < 10){
        return cnt;
    }
    for(int i = 10; ; i *= 10){
        if(a < i)
            break;
        next = max(next, (a / i) * (a % i));
    }
    if(next >= a){
        return -1;
    }
    query(next, cnt + 1);
}
int main(){
    cin >> q;
    for(int i = 0; i < q; i++){
        cin >> n;
        cout << query(n, 0) << endl;
    }
    return 0;
}


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

using namespace std;

#define MP make_pair
#define PB push_back
#define f first
#define s second

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

//int dr1[] = {-1, 0, 1, 0};
//int dc1[] = {0, 1, 0, -1};
//int dr3[] = {0, 1, 2, 3, 2, 1, 0, -1, -2, -3, -2, -1, -1, 1, 0, 0};
//int dc3[] = {3, 2, 1, 0, -1, -2, -3, -2, -1, 0, 1, 2, 0, 0, -1, 1};
const int MOD = 1000000007;
const int INF = 1000000007;

ll modx(ll a)
{
    return (a%MOD+MOD)%MOD;
}

ll times(ll a, ll b)
{
    return modx(modx(a)*modx(b));
}

ll add(ll a, ll b)
{
    return modx(modx(a)+modx(b));
}

ll sub(ll a, ll b)
{
    return modx(MOD+modx(a)-modx(b));
}

ll fastExp(ll base, ll exp)
{
    if(exp == 0LL)
    {
        return 1LL;
    }

    if(exp%2==0)
    {
        return fastExp(times(base, base), exp/2);
    }
    else
    {
        return times(exp, fastExp(times(base, base), exp/2));
    }
}


const int MAXN = 201;
ll N;
pair< double, pair<ll, ll> > coords[MAXN];

ll res(pll a)
{
    return a.f*a.f + a.s*a.s;
}


int main()
{
    //freopen("input.in","r",stdin);
    //freopen("output.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> N;
    for(int i=0; i<N; i++)
    {
        cin >> coords[i].s.f >> coords[i].s.s;
        if(abs(coords[i].s.f) + abs(coords[i].s.s))
           coords[i].f = atan2(double(coords[i].s.s), double(coords[i].s.f));
        else
            coords[i].f = -1000;
    }

    sort(coords, coords+N);
    for(int i=N; i<2*N; i++)
    {
        coords[i] = coords[i-N];
    }
    double ans = 0;
    for(int i=0; i<N; i++)
    {
        pll t = {0, 0};
        for(int j=0; j<N; j++)
        {
            t.f += coords[j+i].s.f;
            t.s += coords[j+i].s.s;
            ans = max(ans, sqrt(res(t)));
        }
    }
    cout << setprecision(25) << ans;
    return 0;
}


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

int n, a[10009], sum;

int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		while (a[i] % 2 == 0) { a[i] /= 2; sum++; }
	}
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
  string s;
  cin>>s;
  int ans;
  int tmp=0;
  ans=0;
  int j=0;
  for(int i=1;i<4;i++){
    if(s[0]==s[i])
      {
	tmp++;
	j=i;
      }
  }
  if(tmp!=1){
    cout<<"No"<<endl;
  }
  else {
    for(int i=2;i<4;i++){
      if(j==1){
	if(s[2]==s[3]) ans++;
	break;
      }
      else {
	if(j==i) continue;
	if(s[1]==s[i]) ans++;
      }
    }
    if(ans==1)
      {
      cout<<"Yes"<<endl;
    }
    else
      {
	cout<<"No"<<endl;
      }
  }
  return 0;
}


Measured memory_bytes: 256
import qualified Control.Arrow               as Arrow
import qualified Control.Monad               as Monad
import qualified Data.Bits                   as Bits
import qualified Data.List                   as List
import qualified Data.ByteString.Char8       as BSC8
import qualified Data.Vector.Unboxed         as VU

getI :: BSC8.ByteString -> Maybe (Int, BSC8.ByteString)
getI = fmap (Arrow.second BSC8.tail) . BSC8.readInt
getAN :: Int -> IO (VU.Vector Int)
getAN n = VU.unfoldrN n getI <$> BSC8.getLine

main :: IO ()
main = do
  n  <- readLn :: IO Int
  xs <- getAN n
  let ys = VU.map (Bits.xor (VU.foldl1' Bits.xor xs)) xs
  Monad.forM_ [0..(n-2)] $ \i -> do
    putStr $ show $ ys VU.! i
    putStr " "
  putStrLn $ show $ ys VU.! (n - 1)

Measured memory_bytes: 13184
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define vpii vector< pair<int,int> >
#define mii map<int,int>
#define MOD 1000000007
#define fr(i,k,n) for(int i=k;i<n;i++)
#define fl(i,k,n) for(int i=k;i>=n;i--)
#define endl "\n"
using namespace std;
typedef long long ll;
int prime[100001]={};
void sieve()
{
	prime[0]=1;
	prime[1]=1;
	for(int i=0;i*i<100001;i++)
	{
		if(prime[i]==0)
		{
			for(int j=i*i;j<100001;j+=i)
			{
				prime[j]=1;
			}
		}
	}
}
ll binpow(ll a,ll b,ll m)
{
	ll res=1;
	while(b>0)
	{

	if(b&1)
	{
		res=res*a%m;
	}
	a=a*a%m;
	b>>=1;
   }
   return res;
}
bool yes(int a,int b,int c,int d)
{
  while(a>0 && c>0)
  {
    if(a<=0)
      return 0;
    else if(c<=0)
      return 1;
    else
    {
      c-=b;
      if(c<=0)
        return 1;
      a-=d;
      if(a<=0)
        return 0;
    }
}
}
void solve()
{
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if(yes(a,b,c,d))
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t=1;
//cin>>t;
while(t--)
{
solve();
}

return 0;
}




Measured memory_bytes: 3640
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		int N=stdIn.nextInt();
		int T=stdIn.nextInt();
		int t[]=new int[N];
		long sum=0;
		int z=0;
		while(z<N) {
			t[z]=stdIn.nextInt();
			z++;
		}z=1;
		while(z<N) {
			if(t[z]-t[z-1]<T)
				sum+=t[z]-t[z-1];
			else
				sum+=T;
			z++;
		}
		sum+=T;
		System.out.println(sum);
	}
}

Measured memory_bytes: 64944
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long int ll;
typedef unsigned long long int ull;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> o_set; 

#define     int                 ll
#define     pb                  push_back
#define     mp                  make_pair
#define     xx                  first
#define     yy                  second    
#define     all(a)              a.begin(),a.end()
#define     vi                  vector<int>
#define     vpi                 vector<pii>
#define     pii                 pair<int, int>
#define     present(DT, val)    (DT.find(val) != DT.end()) //for set and map
#define     cpresent(DT, val)   (find(all(DT),val) != DT.end()) //vectors
#define     input               "/home/pollution/Desktop/WorkSpace/C++/Files/input.txt"
#define     output              "/home/pollution/Desktop/WorkSpace/C++/Files/output1.txt"
#define     error               "/home/pollution/Desktop/WorkSpace/C++/Files/error.txt"
#define     IO()                ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define     INF                 2e18
#define     MOD                 1000000007
#define     clr(x)              memset(x, 0, sizeof(x))
#define     init(x, a)          memset(x, a, sizeof(x))
#define     out(a)              for (auto i: a) cout<<i<<' '; cout<<'\n'
#define     cpy(a,b)            memcpy(a,b,sizeof(b))
#define     is(a)               to_string(a)
#define     ci(a,c)             a-c
#define     db(i)               cout<<"point :"<<i<<'\n';
#define     setd(val,n)         cout<<fixed<<setprecision(n)<<val<<'\n'
#define 	M_PI 		        3.14159265358979323846

void solve(){
 	double r; cin>>r;   
 	setd(2*M_PI*r, 5);
}

signed main() { 
    IO();
    
    int t=1;
    // cin>>t;
    while(t--) solve();
    return 0; 
}

Measured memory_bytes: 3804
#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define mod 1000000007
#define FT() int t; scanf("%d",&t); while(t--)
#define pb push_back
#define nl printf("\n")
#define fi(i,start,end) for(int i=start; i < (int)end ; ++i)
#define ip(n)   scanf("%d",&n)
#define mz(a)   memset(a,0,sizeof(a))
#define inpArr(A,n) fi(i,0,n)   ip(A[i]);
#define print(a)  for(auto i : a)   cout<<i<<" "; nl;
#define Fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
ll max(ll a,ll b)   {return a>b?a:b;}
ll min(ll a,ll b)   {return a<b?a:b;}

int main() {
    #ifndef ONLINE_JUDGE
    freopen("D:/Sublime/Rough/input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    #endif
    //std::cout << std::fixed;
    //std::cout << std::setprecision(6);
    Fastio;
    int testcase = 1;
    //cin>>testcase;
    while(testcase--)
    {
        int n;
        cin>>n;
        int a[n];
        for(int i=0;i<n;i++)
            cin>>a[i];
        int dp[n];
        dp[0] = a[0];
        for(int i=1;i<n;i++)
            dp[i] = max(a[i],dp[i-1]);
        ll sm = 0;
        for(int i=0;i<n;i++)
            sm+= dp[i] - a[i];
        cout<<sm;
    }

    #ifndef ONLINE_JUDGE
    cout<<"\nTime Elapsed : " << 1.0*clock() / CLOCKS_PER_SEC << " s";
    #endif
    
    return 0;
}

Measured memory_bytes: 5116
# -*- coding: utf-8 -*-
#ARC088C
import sys
import math

#n=int(input())
tmp = input().split()
x,y = list(map(lambda a: int(a), tmp))

count=1
tmp=x
while(1):
	tmp=tmp*2
	if(tmp<=y):
		count+=1
	else:
		break
print(count)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);


  Int r, d, x2000;
  cin>>r>>d>>x2000;

  for(Int i=0;i<10;i++){
    x2000 = r * x2000 - d;
    cout<<x2000<<endl;
  }

  return 0;
}


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

using namespace std;
const int _max = 2e6 + 10;
const int mod = 1e9 + 7;
typedef unsigned long long ll;

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    int count=0;
    for(int i=a;i<=b;i++){
        if(i%c==0){
            count++;
        }
    }
    cout<<count;
    return 0;
}

Measured memory_bytes: 3592
/*hello guys！~*/ 
#include<bits/stdc++.h>
using  namespace std;
typedef long long ll;
int main()
{
	ll a,v,b,w,t;
 cin>>a>>v>>b>>w>>t;
 if(a==b)
    printf("YES\n");
 else{
 if(w>=v)
    printf("NO\n");
 else
 {
     if(abs(a-b)<=(v-w)*t)
        printf("YES\n");
     else
        printf("NO\n");
 }}
}

Measured memory_bytes: 3636
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();

		int N = Integer.parseInt(s);

		s = sc.nextLine();
		String[] ns = s.split(" ");

		int n[] = new int[ns.length];
		for(int i=0;i<ns.length;i++) {
			n[i] = Integer.parseInt(ns[i]);
		}

		Arrays.sort(n);

		int sum=0;
		for(int i=0;i<n.length-1;i++) {
			sum += n[i];
		}

		if(sum > n[n.length - 1]) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 21716
#pragma target("avx")
#pragma optimize("O3")
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;
using PP = std::pair<ll,P>;
using V = std::vector<ll>;
template<typename T> using pq = std::priority_queue<T>;
template<typename T> using rpq = std::priority_queue<T, std::vector<T>, std::greater<T>>;

#define REP(i,b,e) for(ll i=b; i<e; i++)
#define ALL(vec) vec.begin(),vec.end()
#define PRINT(vec) printf("[ ");for(auto &i:vec)printf("%ld ",i);puts("]");
#define SCAN(vec) for(auto &i:vec)scanf("%ld",&i)
#define fi first
#define se second

const int MOD = 1e9+7;
const ll INF = 1e18;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

int main(){
	ll fact[100001];
	fact[0] = 1;
	REP(i, 1, 100001) fact[i] = fact[i-1] * i % MOD;

	int n, m;
	scanf("%d %d", &n, &m);
	if(n==m) printf("%ld\n", fact[n] * fact[m] % MOD * 2 % MOD);
	else if(abs(n-m)==1) printf("%ld\n", fact[n] * fact[m] % MOD);
	else puts("0");
	return 0;
}



Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <bitset>

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define szz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
typedef tuple<int, int, int> t3;
typedef pair<ll, ll> pll;
typedef long double ldouble;
typedef pair<double, double> pdd;
typedef pair<pii, int> ppi;

ll gc(ll x, ll y) { return y == 0 ? x : gc(y, x%y); }
ll f[200020];
const int MOD = 1e9 + 7;

ll pw(ll x, ll y = MOD - 2) {
	ll res = 1;
	while(y) {
		if(y & 1) res = res * x % MOD;
		x = x * x % MOD;
		y >>= 1;
	}
	return res;
}

ll nCr(ll n, ll r) {
	return f[n] * pw(f[r]) % MOD * pw(f[n-r]) % MOD;
}

int main(){
	f[0] = 1;
	for(int i=1;i<200020;i++) f[i] = (ll) i * f[i-1] % MOD;
	
	ll dp[200020] = {};
	dp[0] = 0, dp[1] = 1;
	for(int x=2;x<200020;x++) {
		dp[x] = (x * dp[x-1] + f[x - 1]) % MOD;
	}
	
	int N; scanf("%d", &N);
	ll ans = 0;
	for(int i=1;i<=N;i++) {
		int a; scanf("%d", &a);
		int ta = i - 1, tb = N - i;
		ll ff = nCr(N, tb + 1) * dp[tb+1] % MOD * f[ta] % MOD;
		ff += nCr(N, ta + 1) * dp[ta+1] % MOD * f[tb] % MOD;
		ff -= f[N];
		if(ff < 0) ff += MOD;
		ans = (ans + ff * a) % MOD;
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 3328
from fractions import gcd


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


N, M = map(int, input().split())
A = list(map(int, input().split()))

# a1が2で何回割れるか
ii = 0
while A[0] % 2 == 0:
  ii += 1
  A[0] //= 2


# 全ての要素について、素因数2の数が等しくなければ不適
for i, a in enumerate(A[1:], 1):
  if a % (2**ii) == 0 and a % (2**(ii+1)) != 0:
    A[i] //= 2**ii
  else:
    print(0)
    quit()


# (ak//2) (k=1, 2, ...)の最小公倍数を求める
l = 2**(ii-1)
for b in A:
  l = lcm(l, b)

# xは最小公倍数の奇数倍
print(-(-(M//l) // 2))

Measured memory_bytes: 16320
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    int n,k;
    int tmp;
    int ans = 0;

    cin >> n >> k;
    for(int i = 0; i < n;  i ++){
        cin >> tmp;
        ans += min(abs(k-tmp),tmp)*2;
    }
    cout << ans;

    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pf push_front
#define fr first
#define sc second
#define r_0 return 0
#define ld long double

using namespace std;

    const ll N = 1e5 + 7;
    const ll mod = 1e9 + 7;
    const ld eps = 1e-9;

bool check(string s){

}

void solve(){
    int n;
    string s;
    int ans = 0;
    cin >> n >> s;
    deque < int > W , R;
    for(int i =0 ; i < n; ++ i){
        if(s[i] == 'W'){
            W.pb(i);
        }
        else{
            R.pb(i);
        }
    }

    while(!R.empty() && !W.empty()){
        if(R.back() < W[0])break;
        R.pop_back();
        W.pop_front();
        ++ ans;
    }
    cout << ans;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int tt = 1;
    //cin >> tt;
    while(tt --){
            solve();
    }
}

/**

**/


Measured memory_bytes: 4444
#include <bits/stdc++.h>
using namespace std;
// ----------------------R00TDADA------------------------------
#define rep(i, a, b) for (__typeof((b)) i = (a); i < (b); i++)
#define nrep(i, a, b) for (__typeof((b)) i = (b); i > (a); i--)
#define all(a) (a).begin(), (a).end()
#define ff first
#define ss second
#define ppi pair<int, int>
#define pppi pair<ppi, int>
#define vi vector<int>
#define vii vector<ppi>
#define viii vector<pppi>
#define vs vector<string>
#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()
#define M_PI 3.14159265358979323846
#define rootdada ios_base::sync_with_stdio(false)
#define int long long

signed main()
{

    rootdada;
    int n;
    cin>>n;
    int a[n],b[n],c[n];
    rep(i,0,n)
        cin>>a[i];
    rep(i,0,n)
        cin>>b[i];
    rep(i,0,n-1)
        cin>>c[i];
    int s=0;
    rep(i,0,n)
    {
        s+=b[a[i]-1];
        if((i!=0) && a[i]==a[i-1]+1)
        {
            s+=c[a[i-1]-1];
        }


    }
    cout<<s<<endl;
        


}

Measured memory_bytes: 256
n = int(input()) 
a = list(map(int, input().split()))
y = a[0]
for i in range(1,n):
    x = a[i]
    if(x < y):
        c = x
        x = y
        y = c
    while(y != 0):
        c = x % y
        x = y
        y = c
    y = x
    if(y == 1):
        break
print(y)

Measured memory_bytes: 14252