akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>

unsigned gaps[] = {1,8,23,77,281,1073,4193,16577,65921,262913,1050113};
// generated from pow(4,i)+3*pow(2,i-1)+1 (prefixed with 1)

unsigned insertion_sort(unsigned a[], unsigned n, unsigned gap){
  unsigned i,count = 0;
  for(i = gap; i < n; i++){
    unsigned v = a[i];
    int j = i - gap;
    while(j >= 0 && a[j] > v){
      a[j+gap] = a[j];
      j -= gap;
      count++;
    }
    a[j+gap] = v;
  }
  return count;
}

void shell_sort(unsigned a[], unsigned n){
  int i;
  unsigned gap_num = 0;
  while(gaps[++gap_num] < n);
  gap_num--;

  unsigned count = 0;
  for(i = gap_num; i >= 0; i--) count += insertion_sort(a,n,gaps[i]);

  printf("%u\n",(gap_num+1));

  for(i = gap_num; i; i--) printf("%u ",gaps[i]);
  printf("%u\n",gaps[0]);

  printf("%u\n",count);
}

int main(){
  unsigned n,i;
  scanf("%u",&n);
  unsigned* a = (unsigned*)malloc(sizeof(unsigned)*n);
  for(i = 0; i < n; i++) scanf("%u",&a[i]);
  shell_sort(a,n);
  for(i = 0; i < n; i++) printf("%u\n",a[i]);
  free(a);
  return 0;
}

Measured memory_bytes: 4252
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef double D;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef long double ld;

#define rd(x) scanf("%d",&x)
#define rd2(x,y) scanf("%d %d",&x,&y)
#define rd3(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define rl(x) scanf("%lld",&x)
#define rl2(x,y) scanf("%lld %lld",&x,&y)
#define rl3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define wd(x) printf("%d" ,x)
#define wd2(x,y) printf("%d %d",x,y)
#define wl(x) printf("%lld",x)
#define wl2(x,y) printf("%lld %lld",x,y)
#define PC(x) putchar(x)
#define GC() getchar()
#define NL printf("\n")
#define SP printf(" ")
 
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define F first
#define S second
#define MP make_pair
#define PB push_back

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define fr(i,s,e) for(int i=s;i<e;i++)
#define frl(i,s,e) for(ll i=s;i<e;i++)
#define frr(i,s,e) for(int i=s-1;i>=e;i--)
#define frv(i,a) for(int i = 0;i<(int)a.size();i++)
#define frvr(i,a) for(int i = a.size()-1;i>=0;i--)
#define tr(i,a) for(typeof(a.begin()) i = a.begin(); i != a.end();i++)

#define inf 10000000000000
#define mod 1000000007
#define maxn 100009
#define maxr 100009
void solve()
{
	string str,front="",back="";
	cin>>str;
	//ll turn=0;
	bool turn =false;
	ll q;
	rl(q);
	fr(i,0,q)
	{
		ll t;
		rl(t);
		if(t==1)
		{
			turn=!turn;
		}
		else
		{
			ll f;
			rl(f);
			char c;
			cin>>c;
			//scanf("%c",&c);
			if(f==1)
			{
				if(!turn)
				{
					//str=c+str;
					front+=c;
				}
				else
					back+=c;
					//str+=c;
			}
			else
			{
				if(!turn)
				{
					//str+=c;
					back+=c;
				}
				else
				{
					front+=c;
					//str=c+str;
					//c+=str;
				}
			}
		}
	}
	if(turn)
	{
		reverse(ALL(str));
		reverse(ALL(back));
		str=back+str+front;
	}
	else
	{
		reverse(ALL(front));
		str=front+str+back;
	}
	cout<<str<<endl;
	return;
}
int main()
{
	
	ll t=1;
	//rl(t);

	//cin>>t;
	//scanf()
	while(t--)
	{
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 1348
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

import static java.lang.Integer.parseInt;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		int t1 = 0;//直角三角形
		int t2 = 0;//鋭角三角形
		int t3 = 0;//鈍角三角形

		outer:
		while ((line = br.readLine()) != null && !line.isEmpty()) {
			StringTokenizer st = new StringTokenizer(line);
			int[] e = new int[3];
			for (int i = 0; i < 3; i++) {
				e[i] = parseInt(st.nextToken());
			}
			for (int i = 0; i < 3; i++) {
				if (!(e[i % 3] < e[(i + 1) % 3] + e[(i + 2) % 3])) {
					break outer;
				}
			}
			Arrays.sort(e);
			int t = e[2] * e[2] - e[0] * e[0] - e[1] * e[1];
			if (t == 0) {
				t1++;
			} else if (t < 0) {
				t2++;
			} else {
				t3++;
			}
		}
		System.out.format("%d %d %d %d\n", t1 + t2 + t3, t1, t2, t3);
	}
}

Measured memory_bytes: 16992
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define bitsz(x) int(__builtin_popcount(x))
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb(x) push_back(x)
#define INF 2e9
#define LINF 1e18
#define mod 1000000007
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
const int di[4] = {1,0,-1,0};
const int dj[4] = {0,1,0,-1};

map<ll, int> res;

void factorize(ll n) {
    for (int i=2; i*i<=n; i++) {
        while (n%i == 0) {
            ++res[i];
            n /= i;
        }
    }
    if (n != 1) ++res[n];
}

int main() {
    ll n; cin >> n;
    REP(i,2,n+1) factorize(i);
    ll ans = 1;
    rep(i,n+1) {
        ans *= res[i]+1;
        ans %= mod;
    }
    // for (auto x : res) {
    //     ans *= x.second+1;
    //     ans %= mod;
    // }
    cout << ans << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
// 43

using namespace std;



int main() {
    //ifstream cin("A.in");
    //ofstream cout("A.out");
    int i, n, t, x, y;
    ios::sync_with_stdio(false);
    cin >> n;
    int t1 = 0;
    int x1 = 0, y1 = 0;
    for(i = 1; i <= n; i++) {
        cin >> t >> x >> y;
        if((t - t1) % 2 != (abs(x - x1) + abs(y - y1)) % 2 || t - t1 < abs(x - x1) + abs(y - y1)) {
           cout << "No";
           return 0;
        }
        t1 = t;
        x1 = x;
        y1 = y;
    }
    cout << "Yes";
    //cin.close();
    //cout.close();
    return 0;
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

int nextInt() { int x; scanf("%d", &x); return x;}

int main2() {
  int N = nextInt();
  int M = nextInt();
  priority_queue<int> pq;
  REP(i, N) pq.push(nextInt());
  REP(_, M) {
    int x = pq.top();
    pq.pop();
    x >>= 1;
    pq.push(x);
  }
  ll ans = 0;
  REP(_, N) {
    int x = pq.top();
    pq.pop();
    ans += x;
  }
  cout << ans << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


Measured memory_bytes: 892
a = [int(input())for i in range(5)]
k = int(input())
cnt = 0
for i in a:
    for j in a:
        if abs(i-j) > k:
            print(':(')
            cnt += 1
            break
    else:
        continue
    break
if cnt == 0:
    print('Yay!')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

int main() {
    ll N, M;
    cin >> N >> M;
    ll ans = 0;

    while (N >= 1 && M >= 2) {
        if (2 * N >= M) {
            ans += (M / 2);
            break;
        } else if (2 * N < M) {
            ans += N;
            M -= (N * 2);
            N = 0;
            
            N = (M / 2) - (M / 2) % 2;
            M/=2;
            M += (M / 2) % 2;
            N /= 2;
        }
    }
    cout << ans << '\n';
}


Measured memory_bytes: 3536
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 200000 + 10;
int n; char s[N];
int main() {
	scanf("%s",s+1);
	int c=0;n=strlen(s+1);
	for(int i=1;i<=n;i++){
		if(s[i]=='o')c++;
	}
	c+=15-n;
	printf("%s\n", c>=8?"YES":"NO");
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<int> P(N);
	for (int i = 0; i < N; ++i) {
		cin >> P[i];
	}
	int mn = N + 1, ans = 0;
	for (int i = 0; i < N; ++i) {
		if (P[i] <= mn) {
			++ans;
		}
		mn = min(mn, P[i]);
	}
	cout << ans << endl;
	return 0;
}

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

vector<int> listp, listm;

int main(){
    int N; cin >> N;
    int A[100100];
    for(int i=0; i<N; i++){
        cin >> A[i];
    }
    sort(A,A+N);

    //マイナスの数
    int num=0;
    while(num<N && A[num]<0) num++;

    //＋の数
    int num1=0;
    while(num1<N && A[N-1-num1]>0) num1++;

    if(num==N){
        listp.push_back(N-1);
        for(int i=0; i<N-1; i++){
            listm.push_back(i);
        }
    }
    else if(num1==N || num==0){
        listm.push_back(0);
        for(int i=1; i<N; i++){
            listp.push_back(i);
        }
    }
    else{
        for(int i=0; i<N; i++){
            if(A[i]<0) listm.push_back(i);
            else listp.push_back(i);
        }
    }
    //これで足すべきもの引くべきものが決まった

    int a = listm.size();
    int b = listp.size();
//    cout << a << " " << b << endl;

//答えを求める
    int ans=0;
    for(int i=0; i<a; i++){
        ans -=A[i];
    }
    for(int i=a; i<N; i++){
        ans +=A[i];
    }
    cout << ans << endl;

//操作を出力

    int la = A[N-1];
    int now =A[a-1];
    for(int i=a; i<N-1; i++){
        cout << now << " " << A[i] << endl;
        now = now-A[i]; 
    }
    cout << la << " " << now << endl;
    now = la- now;
    for(int i=0; i<a-1; i++){
        cout << now << " " << A[i] << endl;
        now = now-A[i];
    }
}

Measured memory_bytes: 2808
// E.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <bitset>

using namespace std;

typedef long long LL;

const LL MOD = 1000000007;
static const size_t MAX_N = 1000001;

struct modll {
	long long x;
	modll() { }
	modll(long long _x) : x(_x) { }
	operator int() const { return (int)x; }
	modll operator+(const modll& r) { return (x + r.x) % MOD; }
	modll operator+=(const modll& r) { return x = (x + r.x) % MOD; }
	modll operator-(const modll& r) { return (x + MOD - r.x) % MOD; }
	modll operator-=(const modll& r) { return x = (x + MOD - r.x) % MOD; }
	modll operator*(const modll& r) { return (x * r.x) % MOD; }
	modll operator*(int r) { return (x * r) % MOD; }
	modll operator*=(const modll& r) { return x = (x * r.x) % MOD; }
	static modll modinv(int a) { return modpow(a, MOD - 2); }
	static modll modpow(int a, int b) {
		modll x = a, r = 1;
		for (; b; b >>= 1, x *= x) if (b & 1) r *= x;
		return r;
	}
};

vector<modll> fact, inv;

LL combination(LL n, LL r) {
	if (r > n) {
		return 0;
	}
	return (fact[n] * inv[r]) * inv[n - r];
}

int main(int argc, char* argv[]) {
#ifdef _MSC_VER
	while (true)
#endif
	{
		int n = -1, k;
		cin >> n >> k;
		if (n < 0) return 0;
		vector<int> a(n);
		for (int i = 0; i < n; ++i) {
			cin >> a[i];
		}

		fact.resize(n + 1);
		inv.resize(n + 1);
		fact[0] = 1;
		for (int i = 1; i <= n; ++i) {
			fact[i] = fact[i - 1] * i;
		}
		inv[n] = modll::modinv(fact[n]);
		for (int i = n; i >= 1; --i) {
			inv[i - 1] = inv[i] * i;
		}

		modll ans = 0;
		sort(a.rbegin(), a.rend());
		for (int i = 0; i <= n - k; ++i) {
			modll x = (MOD + a[i]) % MOD;
			x *= combination(n - i - 1, k - 1);
			ans += x;
		}

		sort(a.begin(), a.end());
		modll ans2 = 0;
		sort(a.begin(), a.end());
		for (int i = 0; i <= n - k; ++i) {
			modll x = (MOD + a[i]) % MOD;
			x *= combination(n - i - 1, k - 1);
			ans2 += x;
		}

		ans += (MOD - ans2);
		cout << ans << endl;

	}
	return 0;
}


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

char input[101000];
char ans[78];
int len, pos;

int main(void)
{
    int i, j, tmp, in;
    int aa = 0;
    scanf("%d", &tmp);
    while (scanf("%s",input) != EOF) {
        pos = 0;
        aa = 0;
        len = strlen(input);
        tmp = 0;
        for (i = 0; i < len; i++) {
            if (input[i] != '0') {
                tmp++;
                in = input[i] - '0';
            } else {
                if (tmp) {
                    if (in == 1) {
                        tmp--;
                        tmp %= 5;
                        if (tmp == 0) {
                            ans[aa++] = '.';
                        } else if (tmp == 1) {
                            ans[aa++] = ',';
                        } else if (tmp == 2) {
                            ans[aa++] = '!';
                        } else if (tmp == 3) {
                            ans[aa++] = '?';
                        } else if (tmp == 4) {
                            ans[aa++] = ' ';
                        }
                    } else if (in == 2) {
                        tmp--;
                        tmp %= 3;
                        ans[aa++] = 'a' + tmp;
                    } else if (in == 3) {
                        tmp--;
                        tmp %= 3;
                        ans[aa++] = 'd' + tmp;
                    } else if (in == 4) {
                        tmp--;
                        tmp %= 3;
                        ans[aa++] = 'g' + tmp;
                    } else if (in == 5) {
                        tmp--;
                        tmp %= 3;
                        ans[aa++] = 'j' + tmp;
                    } else if (in == 6) {
                        tmp--;
                        tmp %= 3;
                        ans[aa++] = 'm' + tmp;
                    } else if (in == 7) {
                        tmp--;
                        tmp %= 4;
                        ans[aa++] = 'p' + tmp;
                    } else if (in == 8) {
                        tmp--;
                        tmp %= 3;
                        ans[aa++] = 't' + tmp;
                    } else if (in == 9) {
                        tmp--;
                        tmp %= 4;
                        ans[aa++] = 'w' + tmp;
                    }
                    in = 0;
                    tmp = 0;
                }
            }
        }
        ans[aa] = 0;
        printf("%s\n", ans);
    }
    return 0;
}

Measured memory_bytes: 592
#include <iostream>
#include <string>
#include <vector>

using namespace std;

using ll = long long;

int main(){

  int N;
  cin >> N;
  int v;

  for(int i = 0; i < N; ++i){
    cin >> v;
    if(v % 2 == 0){
      if(v % 3 != 0 && v % 5 != 0){
        cout << "DENIED" << endl;
        return 0;
      }
    }
  }

  cout << "APPROVED" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!$BDs=P;~$K%3%a%s%H%"%&%H(B!!
#ifdef DEBUG_
#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

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 <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int mod = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);
const long double PI = 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899;
int dx[] = {0,0,-1,1};
int dy[] = {-1,1,0,0};


signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);

    LL N; cin >> N;
    FOR(n,1,N+1){
        LL ans = 0;
        for(LL i = 1; i*i<=n; i++){
            for(LL j = 1; j*j<=(n-i*i); j++){
                LL sqr = (i+j)*(i+j) - 4*(i*j + i*i + j*j) + 4*n;
                if(sqr <= 0) continue;
                LL ng = 0, ok = 10010;
                while(abs(ok-ng)>1){
                    LL mid = (ok+ng) / 2;
                    if(mid*mid >= sqr) ok = mid;
                    else ng = mid;
                }
                if(ok*ok != sqr) continue;
                LL tmp = ok - i-j;
                if(tmp <= 0 or tmp%2 == 1) continue;
                ans++;
                    
            }
        }
        cout << ans << endl;


    }

}

Measured memory_bytes: 3604
let () =
  Array.init (Scanf.scanf "%d\n" (fun n -> n)) (fun _ -> Scanf.scanf "%d " (fun a -> a))
  |> Array.to_list
  |> List.fold_left
      (fun (pos_sum, pos_ops, neg_sum, neg_ops) a ->
        (max 1 (neg_sum + a), neg_ops + max 0 (1 - neg_sum - a), min (-1) (pos_sum + a), pos_ops + max 0 (1 + pos_sum + a)))
      (0, 0, 0, 0)
  |> (fun (_, pos_ops, _, neg_ops) -> min pos_ops neg_ops)
  |> Printf.printf "%d\n"


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

using namespace std;

const int N = 105;

string s[N];

int n, l;

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);

	cin >> n >> l;
	for (int i = 0; i < n; i ++) {
		cin >> s[i];
	}
	sort(s, s + n);
	for (int i = 0; i < n; i ++) {
		cout << s[i];
	}
	return 0;
}

Measured memory_bytes: 256
using System;

namespace ITP1_11_B
{
    class Dice
    {
        private int[,] adj = new int[6, 4] { { 2, 3, 5, 4 }, { 1, 4, 6, 3 }, { 1, 2, 6, 5 }, { 1, 5, 6, 2 }, { 1, 3, 6, 4 }, { 2, 4, 5, 3 } };
        public int Top { get; private set; }
        public int North { get; private set; }
        public Dice(int top = 1, int north = 5) { Top = top; North = north; }

        public int GetRight(int top, int front)
        {
            int index = GetIndex(top, front);
            return adj[top - 1, (index + 1) % 4];
        }

        private int GetIndex(int top, int val)
        {
            for (int i = 0; i < 4; i++) if (adj[top - 1, i] == val) return i;
            throw new Exception();
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            string[] strs = Console.ReadLine().Split(' ');
            int[] a = Array.ConvertAll(strs, int.Parse);
            int n = int.Parse(Console.ReadLine());
            Dice dice = new Dice();
            for (int i = 0; i < n; i++)
            {
                int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
                Console.WriteLine(a[dice.GetRight(GetNum(a,input[0]),GetNum(a,input[1]))-1]);
            }    
        }

        static int GetNum(int[] array,int val)
        {
            for (int i = 0; i < array.Length; i++) if (array[i] == val) return i+1;
            throw new Exception();
        }
    }
}

Measured memory_bytes: 9160
import java.util.*;

class Main{
  static public void main(String[] args)throws Exception{
    Scanner sc=new Scanner(System.in);
   int n=sc.nextInt();
   int sum=0;
   List<Integer>list=new ArrayList<>();
   for(int i=0;i<n;i++){
    list.add(sc.nextInt());
    sum+=list.get(i);
   }
   Collections.sort(list);
   for(int i=0;i<n;i++){
    if((sum%10)!=0){
        System.out.println(sum);
        return;
    }
    else{
        if((list.get(i)%10)!=0)sum-=list.get(i);
    }
   }
   System.out.println(0);
    sc.close();
  }
}


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

using namespace std;

int main()
{
    string s, t; cin >> s >> t;

    for( int i = 0, p = s.size() - 1; i <= p; i++, s = s.back() + s.substr( 0, p ) )
        if ( s == t )
        {
            cout << "Yes"; return 0;
        }

    cout << "No";
}


Measured memory_bytes: 256
n,t = gets.split(" ")
n = n.to_i
t = t.to_i

min_cost = 10000
while path = gets do
    cost,time = path.split(" ")
    cost = cost.to_i
    time = time.to_i
    if t >= time
        min_cost = cost if min_cost > cost
    end
end

if min_cost == 10000
    puts "TLE".chomp
else
    puts min_cost
end


Measured memory_bytes: 1788
NMXY = list(map(int, input().split(' ')))

N = list(map(int, input().split(' ')))

M = list(map(int, input().split(' ')))

if ( NMXY[2] < min(M) and NMXY[3] >= min(M) ) :
  if ( max(N) < min(M) ):
    print('No War')
  else :
    print('War')
else :
  print('War')
  
  

Measured memory_bytes: 3064
# -*- coding: utf-8 -*-
P,Q,R = [int(i) for i in input().split()]
if P+Q <= Q+R and P+Q <= P+R:
    print(P+Q)
elif Q+R <= P+Q and Q+R <= P+R:
    print(Q+R)
elif P+R <= Q+R and P+R <= P+Q:
    print(P+R)

Measured memory_bytes: 3060
//============================================================================
// Name        : AtcoderDpH.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;
const int MAX = 1001;
int h, w;
ll dp[MAX][MAX];
char grid[MAX][MAX];

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

	cin >> h >> w;

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

	dp[0][0] = 1;

	for (int i = 0; i < h; ++i) {
		for (int j = 0; j < w; ++j) {
			dp[i][j] %= MOD;

			if(grid[i + 1][j] != '#') dp[i + 1][j] += dp[i][j];
			if(grid[i][j + 1] != '#') dp[i][j + 1] += dp[i][j];
		}
	}

	printf("%lld\n", dp[h - 1][w - 1]);
}


Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main(){
    LL N;cin >> N;
    LL A,B;cin >> A >> B;
/*
    double half = (N+2-1)/2;
    if(A % 2 == B % 2)cout << (B - A)/2 << endl;
    else{
        if((double)(B - half) <= (double)(half - A))cout << B -1 << endl;
        else cout << N - A << endl;
    }
    */

   if(A % 2 == B % 2)cout << (B-A)/2 << endl;
   else{
       if(B-A >= 3){
           LL tmp = min(A+(B-A-1)/2,N-B+1+(B-A-1)/2);
           cout << tmp << endl;
       }
       else{
           LL tmp = min(B-1,N-A);
           cout << tmp << endl;
       } 
   }
}


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

int main(){
  int n;
  cin >> n;
  vector<int> h(n);
  rep(i,n) cin>>h[i];
  int pre = -999;
  rep(i,n){
    if(pre<=h[i]-1){
      pre = h[i]-1;
    }
    else if(pre==h[i]){
      pre = h[i];
    }
    else{
      puts("No");
      return 0;
    }
  }
puts("Yes");
return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> v(n);
  vector<int> c(n);
  for(int i=0; i<n; ++i) cin >> v[i];
  for(int i=0; i<n; ++i) cin >> c[i];
  int ans = 0;
  for(int i=0; i<n; ++i){
    int ansp = v[i]-c[i];
    if(ansp>0) ans += ansp;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	long MOD = 1000000007;

	public void run() {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int len = s.length();
		long dp[][] = new long[len+1][2];


		//a,bの組の数
		dp[0][0]=1;
		for(int i=0; i<len; i++) {
			//ai+bi=0
			int c=s.charAt(i);
			{
				//遷移先
				if(c == '0') {
					dp[i+1][0] = dp[i][0];
					dp[i+1][1] = dp[i][1];
				}else {
					dp[i+1][1] = (dp[i][0] + dp[i][1]) % MOD;
				}
			}
			//ai+bi=1;
			{
				//遷移先
				//ai=1 bi=0とai=0 bi=1の2パターンある
				if(c == '0') {
					dp[i+1][1] += dp[i][1] * 2;
					dp[i+1][1] %= MOD;
				}else {
					dp[i+1][0] += dp[i][0] * 2;
					dp[i+1][0] %= MOD;
					dp[i+1][1] += dp[i][1] * 2;
					dp[i+1][1] %= MOD;
				}
			}
		}
		System.out.println((dp[len][0]+dp[len][1]) % MOD);
		sc.close();
	}
}


Measured memory_bytes: 42960
#include <stdio.h>

int
main(int argc, char *argv[])
{
  int a, b;
  scanf("%d%d", &a, &b);
  
  int d = b - a;
  int h = d * (d + 1) / 2;
  int ans = h - b;
  printf("%d\n", ans);
  
  return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

class Date
{
    long long countDate() const
    {
        int days[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
        if((y % 4 == 0 && y % 100 != 0) || y % 400 == 0)
            ++ days[2];

        long long ret = (y-1) * 365LL + (y-1) / 4 - (y-1) / 100 + (y-1) / 400;
        for(int i=1; i<m; ++i)
            ret += days[i];
        ret += d - 1;

        return ret;
    }
public:
    long long y;
    int m, d;
    Date(long long y0, int m0, int d0)
    {
        y = y0;
        m = m0;
        d = d0;
    }
    long long operator-(const Date& other) const
    {
        return countDate() - other.countDate();
    }
    Date operator+(long long x) const
    {
        int days[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

        x += countDate();
        Date ret(0, 1, 1);

        long long a[] = {LLONG_MAX, 400, 100, 4, 1, 0};
        int b[] = {97, 24, 1, 0};
        for(int i=0; i<4; ++i){
            ret.y += min(a[i] - a[i+1], x / (365 * a[i+1] + b[i]) * a[i+1]);
            x -= (365 * a[i+1] + b[i]) * (ret.y % a[i] / a[i+1]);
        }
        ++ ret.y;

        if((ret.y % 4 == 0 && ret.y % 100 != 0) || ret.y % 400 == 0)
            ++ days[2];
        while(x >= days[ret.m]){
            x -= days[ret.m];
            ++ ret.m;
        }

        ret.d = (int)x + 1;

        return ret;
    }
};

int main()
{
    int x[] = {13, 20, 20, 18, 20};

    for(;;){
        string s;
        cin >> s;
        if(s == "#")
            return 0;
        istringstream iss(s);

        if(count(s.begin(), s.end(), '.') == 2){
            long long y;
            int m, d;
            char c;
            iss >> y >> c >> m >> c >> d;

            long long a = Date(y, m, d) - Date(2012, 12, 21);

            vector<int> ret(5);
            for(int i=4; i>=0; --i){
                ret[i] = a % x[i];
                a /= x[i];
            }
            for(int i=0; i<4; ++i)
                cout << ret[i] << '.';
            cout << ret[4] << endl;
        }else{
            long long a = 0;
            for(int i=0; i<5; ++i){
                int b;
                char c;
                iss >> b >> c;
                a *= x[i];
                a += b;
            }

            Date ret(2012, 12, 21);
            ret = ret + a;

            cout << ret.y << '.' << ret.m << '.' << ret.d << endl;
        }
    }
}

Measured memory_bytes: 1236
import java.util.*

object MainKt {
	@JvmStatic
	fun main(args: Array<String>) {
		val scanner = Scanner(System.`in`)
		val h = scanner.nextInt()
		val w = scanner.nextInt()
		val data = Array(h, {IntArray(w)})
		val begVs = IntArray(w, {-1})
		var max = 0
		for (i in 0..h-1){
			val s = scanner.next().toCharArray()
			var beg = -1
			for (k in 0..w-1){
				val c = s[k]
				if (c=='#') {
					if (beg!=-1){
						val d=k-beg
						for (j in beg..k-1) {
							data[i][j]+=d
							max = Math.max(max, data[i][j])
						}
						beg=-1
					}
					if (begVs[k]!=-1){
						val d=i-begVs[k]
						for (j in begVs[k]..i-1) {
							data[j][k]+=d
							max = Math.max(max, data[j][k])
						}
						begVs[k]=-1
					}
					data[i][k]=0
				}else {
					if (beg==-1) beg = k
					if (begVs[k]==-1) begVs[k]=i
				}
			}
			if(beg!=-1){
				val d = w-beg
				for (j in beg..w-1) {
					data[i][j]+=d
					max = Math.max(max, data[i][j])
				}
			}
		}
		for (k in 0..w-1){
			if (begVs[k]!=-1){
				val d = h-begVs[k]
				for (j in begVs[k]..h-1) {
					data[j][k]+=d
					max = Math.max(max, data[j][k])
				}
			}
		}

		println(if (max==0) 0 else max-1)
	}
}

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

int main() {
	char a, b, c, d;
	cin >> a >> b >> c >> d;
	
	if (b == c && (a == b || c == d)) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


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

#define REP(i,n) for(int i=0;i<(n);i++)
#define REAP(i,a,n) for(int i=(a);i<(n);i++)
#define YES cout<<"Yes"<<endl
#define NO cout<<"No"<<endl
#define fr first
#define sc second
#define pb push_back
#define All(v) v.begin(),v.end()
typedef long long ll;

int main(){
    ll n;
    cin >> n;
    ll num = (n+1)/2;
    int k;
    cin >> k;
    ll a,b;
    REP(i,k){
        cin >> a >> b;
        if(n%2==0){
            if(a>num)a--;
            if(b>num)b--;
        }
        a=num-abs(a-num);
        b=num-abs(b-num);
        int loc=(min(a,b)-1)%3;
        if(loc==0)cout << 1 << endl;
        else if(loc==1)cout << 2 << endl;
        else cout << 3 << endl;
    }
}



Measured memory_bytes: 3100
import sys

n, k = map(int, sys.stdin.readline().split())

def main():
    res = 0
    for b in range(k+1, n+1):
        q, r = divmod(n, b)
        res += q * (b - k) + max(0, r - (k - 1))
    if k == 0:
        res -= n - k
    return res

if __name__ == '__main__':
    ans = main()
    print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
 
const ll MOD=1e9+7;
const ll INF=1e18;
 
int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};

int d[2][4] = {
    {-1,0,1,0},
    {0,1,0,-1},
};
//d[0][0] = {-1,0,1,0};
//d[1][0] = {0,1,0,-1};
int posi[203][2];

int main(){
    while(true){
        int n;
        cin >> n;
        if(n == 0) break;
        int minmax[2][2]; minmax[0][0] = 0; minmax[0][1] = 0; minmax[1][0] = 0; minmax[1][1] = 0;
        for(int i = 1;i < n;i++){
            int ni,di;
            cin >> ni >> di;
            for(int j = 0;j < 2;j++){
                posi[i][j] = posi[ni][j] + d[j][di];
                minmax[0][j] = min(minmax[0][j],posi[i][j]);
                minmax[1][j] = max(minmax[1][j],posi[i][j]);
            }
        }
        cout << minmax[1][0]-minmax[0][0]+1 << " " << minmax[1][1]-minmax[0][1]+1 << endl;

    }
}



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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  
  if (a == b && b == c) {
    cout << 1 << endl;
  }
  else if (a == b || b == c || c == a) {
    cout << 2 << endl;
  }
  else {
    cout << 3 << endl;
  }
}

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

int n;
int pos;
vector<int> pre, in, post;

void rec(int l, int r){
  if(l >= r) return;
  int root = pre[pos++];
  int m = distance(in.begin(), find(in.begin(), in.end(), root));
  rec(l, m);
  rec(m+1, r);
  post.push_back(root);
}

void solve() {
  pos = 0;
  rec(0, pre.size());
  for(int i=0; i<n; i++){
    if(i) cout << " ";
    cout << post[i];
  }
  cout << endl;
}

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

  for(int i=0; i<n; i++){
    cin >> k;
    pre.push_back(k);
  }

  for(int i=0; i<n; i++){
    cin >> k;
    in.push_back(k);
  }
  
  solve();
  
  return 0;
}



Measured memory_bytes: 3148
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(){
    int a,b,r,i;
    scanf("%d %d %d",&a,&b,&r);
    for(i=1;i<=r;i++){
        if(i%2==1){
          if(a%2==1){
            a=a-1;
            b=b+(a/2);
            a=a/2;
           }
          else{
              b=b+(a/2);
              a=a/2;
          }
        }
        else{
            if(b%2==1){
                b=b-1;
                a=a+(b/2);
                b=b/2;
            }
            else{
                a=a+(b/2);
                b=b/2;
            }
        }
    }
    printf("%d %d",a,b);
    return 0;
    
}

Measured memory_bytes: 128
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
using namespace std;

#define pb         push_back
#define mp         make_pair
#define ll         long long
#define PI         acos(-1.0)
#define ALL(A)     ((A).begin(), (A).end())
#define vsort(v)   sort(v.begin(),v.end())
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)

int main(){
    double v1, v2, l[10];
    while(scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf", &l[0],&l[1],&l[2],&l[3],&l[4],&l[5],&l[6],&l[7],&l[8],&l[9],&v1,&v2)!=EOF){

        double p[11];
        p[0] = 0;
        FOR(i, 1, 11){
            p[i] = p[i-1] + l[i-1];
        }
        FOR(i, 0, 10){
            double vt = (p[10] * v1) / (v1 + v2);
            if(p[i] < vt && p[i+1] >= vt){
                cout << i+1 << endl;
                break;
            }
        }
    }
}

Measured memory_bytes: 3216
#include <iostream>
#include <cstdint>
#include <string>

const int MOD = 1000000007;

using namespace std;

int main() {

  ios::sync_with_stdio(false);
  cin.tie(0);

  string s;
  cin >> s;
  for (int i = 97; i < 123; i++) {
    char temp = (char)i;
    if (s.find(temp) != string::npos) {
      continue;
    } else {
      cout << temp << endl;
      return 0;
    }
  }
  cout << "None" << endl;
}



Measured memory_bytes: 512
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;

template <typename T1, typename T2>
string print_iterable(T1 begin_iter, T2 end_iter, int counter) {
    bool done_something = false;
    stringstream res;
    res << "[";
    for (; begin_iter != end_iter and counter; ++begin_iter) {
        done_something = true;
        counter--;
        res << *begin_iter << ", ";
    }
    string str = res.str();
    if (done_something) {
        str.pop_back();
        str.pop_back();
    }
    str += "]";
    return str;
}

vector<int> SortIndex(int size, std::function<bool(int, int)> compare) {
    vector<int> ord(size);
    for (int i = 0; i < size; i++) ord[i] = i;
    sort(ord.begin(), ord.end(), compare);
    return ord;
}

template <typename T>
bool MinPlace(T& a, const T& b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
bool MaxPlace(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template <typename Container>
int SZ(const Container& S) { return S.size(); }

template <typename S, typename T>
ostream& operator <<(ostream& out, const pair<S, T>& p) {
    out << "{" << p.first << ", " << p.second << "}";
    return out;
}

template <typename T>
ostream& operator <<(ostream& out, const vector<T>& v) {
    out << "[";
    for (int i = 0; i < (int)v.size(); i++) {
        out << v[i];
        if (i != (int)v.size()-1) out << ", ";
    }
    out << "]";
    return out;
}

#if DEBUG && !ONLINE_JUDGE
    ifstream input_from_file("input.txt");
    #define cin input_from_file

    #define dbg_var(x) clog << #x  << ": " << x << endl;
    #define dbg_array(x, len) clog << #x << ": " << print_iterable(x, x+len, -1) << endl;
#else
    #define dbg_var(x)
    #define dbg_array(x, len)
#endif

///////////////////////////////////////////////////////////////////////////
//////////////////// DO NOT TOUCH BEFORE THIS LINE ////////////////////////
///////////////////////////////////////////////////////////////////////////

const int MAXN = -1; 

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); // Remove in problems with online queries!

    int N;
    LL start_pos;
    cin >> N >> start_pos;
    vector<LL> X(N);
    vector<LL> P(N);
    for (int i = 0; i < N; i++) cin >> X[i] >> P[i];
    
    // cout << N << X[N-1] << " " << P[N-1] << endl;
    int A = 0;
    int B = N-1;
    vector<LL> vec;
    while (X[A] < start_pos and start_pos < X[B]) {
        if (P[A] >= P[B]) {
            vec.push_back(X[B]);
            P[A] += P[B];
            B--;
        } else {
            vec.push_back(X[A]);
            P[B] += P[A];
            A++;
        }
    }
    if (start_pos < X[A]) vec.push_back(X[B]);
    else vec.push_back(X[A]);
    vec.push_back(start_pos);
    // cout << vec << "\n";
    LL res = 0;
    for (int i = 0; i < (int)vec.size()-1; i++) res += llabs(vec[i]-vec[i+1]);
    cout << res << "\n";
}



Measured memory_bytes: 2936
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<vector>
#include<map>
#include<queue>
#include<cmath>
#include<set>
#include<cstdlib>
#include<cctype>
#include<ctime>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll maxn = 2e3 + 5e2 + 5;
const ll maxm = 5e1 + 5;
template<class T>
inline T qread(T &IEE){
	register T x = 0, f = 1;
	register char ch = getchar();
	while(!isdigit(ch)){
		if(ch == '-'){
			f = -f;
		}
		ch = getchar();
	}
	while(isdigit(ch)){
		x = (x << 1) + (x << 3) + (ch ^ 48);
		ch = getchar();
	}
	return IEE = x * f;
}
template<class T>
inline void qwrite(T a){
	if(!a){
		putchar('0');
		return ;
	}
 	if(a < 0){
		putchar('-');
		a = -a;
	}
	if(a > 9) qwrite(a / 10);
	putchar(a % 10 + 48);
	return ;
}
template<class T>
inline T ab(T a){
	return (a > 0) ? a : -a;
}
template<class T>
inline void swa(T &a, T &b){
	a ^= b ^= a ^= b;
	return ;
}
ll ma, y, x, s, m, n;
ll a[maxm][maxm], b[maxm][maxm], c[maxm], d[maxm];
ll dis[maxm][maxn];
bool al[maxm][maxn];
queue<pair<ll, ll> > q;
void spfa(){
	memset(dis, 0x3f, sizeof(dis));
	dis[1][s] = 0;
	q.push(make_pair(1, s));
	al[1][s] = 1;
	while(!q.empty()){
		ll fir = q.front().first, sec = q.front().second;
//		cout << fir << " " << sec << endl;
		q.pop();
		al[fir][sec] = 0;
		for(int i = 1;i <= n;i++){
			if(!a[fir][i]){
				continue;
			}
			if(sec >= a[fir][i] && dis[i][sec - a[fir][i]] > dis[fir][sec] + b[fir][i]){
				dis[i][sec - a[fir][i]] = dis[fir][sec] + b[fir][i];
				if(al[i][sec - a[fir][i]]){
					continue;
				}
				q.push(make_pair(i, sec - a[fir][i])); 
			}
		}
		if(dis[fir][min(sec + c[fir], 2500ll)] > dis[fir][sec] + d[fir]){
			dis[fir][min(sec + c[fir], 2500ll)] = dis[fir][sec] + d[fir];
			if(al[fir][min(sec + c[fir], 2500ll)]){
				continue;
			}
			q.push(make_pair(fir, min(sec + c[fir], 2500ll))); 
		}
	} 
	return ;
}
int main(){
	qread(n);
	qread(m);
	qread(s);
	if(s > 2500){
		s = 2500;
	}
	for(int i = 1;i <= m;i++){
		qread(x);
		qread(y);
		qread(a[x][y]);
		qread(b[x][y]);
		a[y][x] = a[x][y];
		b[y][x] = b[x][y];
	}
	for(int i = 1;i <= n;i++){
		qread(c[i]);
		qread(d[i]);
	}
	spfa();
	for(int i = 2;i <= n;i++){
		ma = 0x3f3f3f3f3f3f3f3fll;
		for(int j = 0;j <= 2500;j++){
			ma = min(ma, dis[i][j]);
		}
		cout << ma << endl;
	}
	return 0;
}


Measured memory_bytes: 5544
def anordinarygame(s):

    ans = ""
    if s[0] == s[-1]:
        ans = "Second" if len(s) % 2 else "First"
    else:
        ans = "First" if len(s) % 2 else "Second"

    return ans

def main():
    s = list(str(input()))
    print(anordinarygame(s))

if __name__ == '__main__':
    main()

Measured memory_bytes: 46064
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
long long Comb(int a,int b){
 	if(a<b||b<0)return 0;
 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
long long pw(long long a,long long b){
	if(a<0LL)return 0;
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
// ここから編集しろ

int main(){
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	printf("%d\n",b*(c/a));
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  int s[100][100] = {0};
  vector<int> k(m), p(m);
  for (int i = 0; i < m; i++) {
    cin >> k[i];
    for (int j = 0; j < k[i]; j++) {
      cin >> s[i][j];
    }
  }
  for (int i = 0; i < m; i++) {
    cin >> p[i];
  }
  vector<int> a(m, 0);
  int ans = 0;
  for (int bit = 0; bit < (1<<n); bit++) {
    for (int i = 0; i < m; i++) {
      a[i] = 0;
    }
    bool flag = true;
    for (int i = 0; i < n; i++) {
      if (bit & (1<<i)) {
        for (int j = 0; j < m; j++) {
          for (int l = 0; l < k[j]; l++) {
            if (s[j][l] == i + 1) {
              a[j]++;
            }
          }
        }
      }
    }
    for (int i = 0; i < m; i++) {
      if (a[i]%2 != p[i]) {
        flag = false;
      }
    }
    if (flag) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	string S, T;
	cin >> S >> T;
	
	bool F[26] = { false };
	vector<VI> cnt(26);
	REP(i, S.size()) {
		cnt[S[i] - 'a'].push_back(i);
		F[S[i] - 'a'] = true;
	}
	int ans = 0;
	int tmp = -1;

	

	REP(i, T.size()) {


		if (!F[T[i] - 'a']) {
			cout << -1 << endl;
			return 0;
		}

		int b = T[i] - 'a';
		int a = lower_bound(cnt[b].begin(), cnt[b].end(), tmp)-cnt[b].begin();
		if (tmp == cnt[b][a])a++;
		if (a >= cnt[b].size()) {
			//cout << tmp << " " << a << endl;
			ans += S.size() - tmp - 1;
			ans += cnt[b][0] + 1;
			tmp = cnt[b][0];
		}
		else {
			ans += cnt[b][a] - tmp;
			tmp = cnt[b][a];
		}
		
		//cout << tmp << " " << a << endl;
		//cout << ans << endl;
	}

	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 1736
import java.util.Scanner;

public class Main {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(),m = sc.nextInt();
        System.out.printf("%d %d\n",n * m,n * 2 + m * 2);
        sc.close();
    }

}

Measured memory_bytes: 26080
#include "bits/stdc++.h"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/operators.hpp>
#include <boost/dynamic_bitset.hpp>

namespace adaptor = boost::adaptors;
using index_t = std::size_t;

namespace lib
{
	template<class T>constexpr T pow(T val, std::uint64_t p)
	{
		auto ret = T(1);
		for (auto i : boost::irange(0, 63))
		{
			if (p & (1ULL << i))
			{
				ret *= val;
			}
			val *= val;
		}
		return ret;
	}
	template<std::uint64_t Mod>class modnum :
		private boost::addable<modnum<Mod>>,
		private boost::subtractable<modnum<Mod>>,
		private boost::multipliable<modnum<Mod>>,
		private boost::dividable<modnum<Mod>>
	{
		std::uint64_t val;
		void clamp()
		{
			val %= Mod;
		}
	public:
		modnum() = default;
		modnum(std::int64_t v) :val()
		{
			if (v < 0)
			{
				v += (std::abs(v) / Mod + 1) * Mod;
			}
			val = v;
			clamp();
		}
		modnum(std::uint64_t v) :val(v)
		{
			clamp();
		}
		modnum(std::int32_t v) :modnum(static_cast<std::int64_t>(v))
		{

		}
		modnum(std::uint32_t v) :modnum(static_cast<std::uint64_t>(v))
		{

		}
		friend std::ostream& operator<<(std::ostream& os, modnum const& num)
		{
			return os << num.val;
		}
		auto& operator+=(modnum const& rhs)
		{
			val += rhs.val;
			clamp();
			return *this;
		}
		auto& operator-=(modnum const& rhs)
		{
			val += Mod - rhs.val;
			clamp();
			return *this;
		}
		auto& operator*=(modnum const& rhs)
		{
			val *= rhs.val;
			clamp();
			return *this;
		}
		auto& operator/=(modnum const& rhs)
		{
			val *= pow(rhs, Mod - 2).val;
			clamp();
			return *this;
		}
		auto const& operator*()const
		{
			return val;
		}
	};
}
using mod_t = lib::modnum<1000000007>;

template<class T>auto set_factorial(std::size_t N)
{
	std::vector<T> ret(N + 1);
	ret[0] = 1;
	for (auto i : boost::irange<index_t>(0, N))
	{
		ret[i + 1] = ret[i] * (i + 1);
	}
	return ret;
}


void Main()
{
	int N, K;
	std::cin >> N >> K;
	std::vector<std::int64_t> val(N);
	for (auto& v : val)
	{
		std::cin >> v;
	}
	boost::sort(val);
	if (K == 1)
	{
		std::cout << 0 << std::endl;
		return;
	}
	auto fact = set_factorial<mod_t>(N);
	mod_t mul = 0;
	mod_t result = 0;
	for (auto i : boost::irange(0, N - K + 1))
	{
		mul += fact[K - 2 + i] / (fact[K - 2] * fact[i]);
		result += mul * (val[K - 1 + i] - val[N - K - i]);
		//lib::print::debug(K - 1 + i, N - K - i, mul);
	}
	std::cout << result << std::endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

Measured memory_bytes: 1792
#include <inttypes.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{
    intmax_t N, K, d[100], A[100][100];
    intmax_t snuke_[100] = {};
    intmax_t ans = 0;

    scanf("%jd%jd", &N, &K);
    for (size_t i = 0; i < K; i++) {
        scanf("%jd", &d[i]);
        for (size_t j = 0; j < d[i]; j++) {
            scanf("%jd", &A[i][j]);
        }
    }

    for (size_t i = 0; i < K; i++) {
        for (size_t j = 0; j < d[i]; j++) {
            snuke_[A[i][j] - 1]++;
        }
    }

    for (size_t i = 0; i < N; i++) {
        if (snuke_[i] == 0)
            ans++;
    }

    printf("%jd\n", ans);

    return 0;
}


Measured memory_bytes: 2188