akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define fs first
#define sc second
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

const int32_t inf = 1001001001;
const int64_t infll = 1001001001001001001ll;
const int dx[] = {0, -1, 1, 0, -1, 1, -1, 1}, dy[] = {-1, 0, 0, 1, -1, -1, 1, 1};

template <typename T> using vector2d = vector<vector<T>>;

// clang-format off
template <typename T> void sort(vector<T> &v) { sort(all(v)); }
// ostream &operator<<(ostream &os, __int128_t value) { if (ostream::sentry(os)) { __uint128_t tmp = value < 0 ? -value : value; char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[tmp % 10]; tmp /= 10; } while (tmp != 0); if (value < 0) { --d; *d = '-'; } int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __int128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } if (in[0] == '-') value *= -1; return is; }
// ostream &operator<<(ostream &os, __uint128_t value) { if (ostream::sentry(os)) { char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[value % 10]; value /= 10; } while (value != 0); int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __uint128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } return is; }
template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { os << v[0]; for (int i = 1; i < v.size(); ++i) os << " " << v[i]; return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << p.fs << " " << p.sc; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.fs >> p.sc; return is; }

struct IoSetup { IoSetup(){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); cerr << fixed << setprecision(10); } } iosetup;

inline int64_t in() { int64_t x = 0; cin >> x; return x; }
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// clang-format on

signed main(int argc, char *argv[]) {
  int64_t a = in(), b = in();
  if (a % b == 0)
    cout << -1 << endl;
  else
    cout << a * (b + 1) << endl;
}


Measured memory_bytes: 256
N = int(input())

x=list()
u=list()

i = 1
for i in range(N):
    value,variaty = input().split()
    if variaty == "BTC":
        abs_value = 380000.0*float(value)
    else:
        abs_value = float(value)
    x.append(abs_value)
    #print(x)
total = sum(x)
print(total)

Measured memory_bytes: 3060
#include<stdio.h>
int main()
{
int  a,b,i,c,d,e;
  c=0;
scanf("%d %d",&a,&b);
  for(i=0;c==0 && i<1001;++i)
  {
  d=i*0.08;
  e=i*0.1;
  if(d==a && e==b) {printf("%d",i);
                   c++;}
  }
  
  
  if(c==0) printf("-1");
  
  
return 0;  
}

Measured memory_bytes: 128
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <deque>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

typedef long long ll;
typedef pair< int, int > pii;
typedef pair< ll, ll > pll;
typedef pair< ll, int > pli;
typedef pair< int, ll > pil;

int ceil(int x, int y){
  return (x % y == 0) ? x / y : x / y + 1;
}

int gcd(int x, int y){
  return y ? gcd(y, x % y) : x;
}

int lcm(int x, int y){
  return x / gcd(x, y) * y;
}

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

  int h, w;
  cin >> h >> w;
  int a[h][w];
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      cin >> a[i][j];
    }
  }

  vector< vector< int > > sx, sy;
  vector< int > x, y;
  bool f = true, found = false;
  for(int i = 0; i < h; i++){
    if(f){
      for(int j = 0; j < w; j++){
        if(found || a[i][j] % 2 == 1){
          y.push_back(i); x.push_back(j);
        }
        if(a[i][j] % 2 == 1){
          if(found){
            sy.push_back(y); sx.push_back(x);
            x.clear(); y.clear();
          }
          found = !found;
        }
      }
    }
    else{
      for(int j = w - 1; j >= 0; j--){
        if(found || a[i][j] % 2 == 1){
          y.push_back(i); x.push_back(j);
        }
        if(a[i][j] % 2 == 1){
          if(found){
            sy.push_back(y); sx.push_back(x);
            x.clear(); y.clear();
          }
          found = !found;
        }
      }
    }
    f = !f;
  }

  string buf;
  int n = 0;
  for(int i = 0; i < sx.size(); i++){
    for(int j = 0; j + 1 < sx[i].size(); j++){
      buf += to_string(sy[i][j] + 1) + " " +
        to_string(sx[i][j] + 1) + " ";
      buf += to_string(sy[i][j + 1] + 1) + " " +
        to_string(sx[i][j + 1] + 1) + "\n";
      ++n;
    }
  }

  cout << n << endl;
  cout << buf;

  return 0;
}


Measured memory_bytes: 20064
#include <sstream>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <string>
#include <queue>
#include <bitset>

using namespace std;

#define fto(i,a,b) for (int i = (a); i <= b; i++)
#define fdw(i,a,b) for (int i = (a); i >= b; i--)
#define rep(i,a) for(int i = 0; i < a; i++) 
#define read(a) cin >> a
#define read2(a, b) cin >> a >> b
#define read3(a, b, c) cin >> a >> b >> c
#define read4(a, b, c, d) cin >> a >> b >> c >> d
#define write(a, b) cout << a << b
#define writeln(a) cout << a << "\n"

#define PI 3.14159265
#define oo 1000000000
#define ooLL 100000000000000000
#define log(a) cerr << #a << " = " << a << endl

#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define tr(c,i) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define next thongdeptrai
#define prev thongbachuthegioi
#define y1 thongsieucapvutru
#define y0 thongnotgay

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long ll;

#define maxn 100005

using namespace std;

string s;

int main() {
	//#ifndef ONLINE_JUDGE
    //	freopen("in.inp", "r", stdin);
  //  #endif

    cin >> s;
    for(int i = 0; i < s.length(); i++) {
        if (i % 2 == 0) cout << s[i];
    }

 	#ifndef ONLINE_JUDGE
    	cout << endl;
    	cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	#endif
}


Measured memory_bytes: 512
#include<iostream>
#include<queue>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<cstdlib>
#include<math.h>
using namespace std;

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




int main() {
	int n,d,cnt=0;
	
	cin >> n>>d;
	int x[11][11];
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < d; j++) {
			cin >> x[i][j];
		}
	}
	for (int i = 0; i < n; i++) {

		for (int j = i+1; j < n; j++) {
			double sum = 0;
			for (int k = 0; k < d; k++) {

				
				sum += pow(x[j][k] - x[i][k], 2);

			}
			sum = sqrt(sum);
			if (ceil(sum) == floor(sum))cnt++;
		}
	}





	cout << cnt << endl;

	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>


using namespace std;


#define mp make_pair
#define pb push_back
#define ll long long



int main() {
    
    ll x, y;
    cin >> x >> y;
    
    ll ans = 1;
    while (2 * x <= y) x <<= 1, ans++;
    cout << ans;
    
    
    return 0;
}

Measured memory_bytes: 256
def solve():
    lH=[]
    for i in range(N):
        for j in range(i,N):
            lH += [sumH[j+1]-sumH[i]]
    lH = sorted(lH)
    lW=[]
    for i in range(M):
        for j in range(i,M):
            lW += [sumW[j+1]-sumW[i]]
    lW = sorted(lW)

    mul = {}
    dub = {}
    for i in lH:
        if i in mul.keys():
            mul[i] += 1
        else:
            mul[i] = 1
            dub[i] = 0
    for j in lW:
        if j in dub.keys():
            dub[j] += 1
    count = 0
    #print(mul,dub)
    for k in mul.keys():
        count += dub[k]*mul[k]
    return count

while True:
    N,M=map(int,input().split())
    if N==0: break
    sumH = [0]
    for _ in range(N):
        sumH += [sumH[-1]+int(input())]
    sumW=[0]
    for _ in range(M):
        sumW += [sumW[-1]+int(input())]
    print(solve())





Measured memory_bytes: 86188
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <string>
#include <cmath>
#include <time.h>

using namespace std;
typedef long long ll;

ll N = 0;
ll M = 0;
ll x = 0;
ll y = 0;

//?????????????????

struct UnionFind{
    //ご本体
    vector<ll > tree;
    //高さ
    vector<ll > rank;
    //グループごとのサイズ
    vector<ll > size;
 
    //定義
    UnionFind(ll N) : tree(N), rank(N), size(N){
        for(int i = 0; i < N; i++){
            tree[i] = i;
            rank[i] = 0;
            size[i] = 1;
        }
    }

    //どの根っこに属しているのか？さかのぼり続ける
    int root(int x){
        if(tree[x] == x){
            return x;
        }
        //経路圧縮
        return tree[x] = root(tree[x]);
    }

    //木と木を(高さが低い方に)くっつける
    ll unite(int x, int y){
        int tx = root(x);
        int ty = root(y);
        //xとyの根が同じならくっつけない
        if(tx == ty){
            return 0;
        }
        
        ll s = size[tx] + size[ty];
        ll r = size[tx] * size[ty];
        size[tx] = s;
        size[ty] = s;

        //tree[tx] = ty;
        //高くない方にくっつけたい：効果がいまいちわからん
        //下：ランク付けのつもり 
        if(rank[tx] < rank[ty]){
            //小さい方を大きい方
            //txの根が大きい方の根に更新
            tree[tx] = ty; 
        }else{
            tree[ty] = tx;
            //つなげるときに同じ高さだったらつなげた後に高さを＋１する
            if(rank[tx] == rank[ty]){
                rank[tx]++;
            }
        }

        return r;

    }

    //同じ木に属しているか？根っこをさかのぼって調べてみる
    bool same(int x, int y){
        int tx = root(x);
        int ty = root(y);
        if(tx == ty){
            return true;
        }else{
            return false;
        }
    }
    //グループのサイズを返す
    int FindSize(int x){
        return size[root(x)];
    }

};

int main(){

    cin >> N >> M;

    UnionFind test(N);

    vector<ll > ans;
    ll t_ans = 0;
    //初期状態：どの組み合わせも橋がないのでとても不便
    //ans.push_back((N * (N - 1)) / 2);
    t_ans = (N * (N - 1)) / 2;

    vector<ll> X;
    vector<ll> Y;
    for(ll i = 0; i < M; i++){
        cin >> x >> y;
        X.push_back(x - 1);
        Y.push_back(y - 1);
    }

    //入力
    for(ll i = M - 1; i >= 0; i--){
        ans.push_back(t_ans);
        if(test.same(X[i], Y[i])){
            continue;
        }
        
        //cout << test.FindSize(X[i]) * test.FindSize(Y[i]) << endl;
        //t_ans -= test.FindSize(X[i]) * test.FindSize(Y[i]);
        ll r = test.unite(X[i], Y[i]);
        t_ans -= r;

    }

    for(ll i = M - 1 ; i >= 0 ; i--){
        cout << ans[i] << endl;
    }

}

Measured memory_bytes: 6124
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


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

Measured memory_bytes: 3672
import 'dart:io';

void main() {
  String s = stdin.readLineSync();
  int yen = 700;
  int count;
  count = 0;
  for (int i = 0; i < 3; i++) {
    if (s[i] == "o") count++;
  }
  print(count * 100 + yen);
}

Measured memory_bytes: 13092
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <queue>

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

const float PI = 3.1415926;
static const int INFTY = (1<<30);

using namespace std;

typedef long long ll;
typedef long double ld;

string a, b, c;
int an=0, bn=0, cn=0;
map<char, int> mp;

int next(int t) {
  if(t==0) {
    t = mp[a[an]];    
    an++;
  } else if(t==1) {
    t = mp[b[bn]];
    bn++;
  } else {
    t = mp[c[cn]];
    cn++;
  }
  return t;
}

int main() {
  mp['a'] = 0;
  mp['b'] = 1;
  mp['c'] = 2;
  cin >> a >> b >> c;
  int t = 0;
  while(true) {
    t = next(t);
    if(an == a.size() && t == 0) {
      cout << 'A' << endl;
      break;
    } else if(bn == b.size() && t == 1) {
      cout << 'B' << endl;
      break;
    } else if(cn == c.size() && t == 2) {
      cout << 'C' << endl;
      break;
    }
  }
    
  return 0;
}


Measured memory_bytes: 256
import bisect

N=int(raw_input())
LN=map(int, raw_input().split())

LN.sort()

r = 0
for i in xrange(N-1, 1, -1):
    a = LN[i]
    for j in xrange(i-1, 0, -1):
        b = LN[j]
        if a > 2*b:
            break
        idx = bisect.bisect_left(LN, a-b+1)
        if idx < j:
            r += j - idx

print r

Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;
using ll=long long;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)

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; }

int main() {
	int n;
	cin >> n;
	vector<double> x(n), y(n);
	rep(i,n) {
		cin >> x[i] >> y[i];
	}
	vector<int> order;
	rep(i,n) order.pb(i+1);
	double acc = 0;
	do {
		double ans = 0;
		//cout  << order.size() << endl;
		for(int i=0; i<n-1; i++) {
			//int t1 = order[i], t2 = order[i + 1];
			//cout << i << endl;
			int t1 = order[i]-1, t2 = order[i+1]-1;
			ans += sqrt((x[t1] - x[t2]) * (x[t1] - x[t2]) + (y[t1] - y[t2]) * (y[t1] - y[t2]));
		}
		acc += ans;
	} while (next_permutation(order.begin(),order.end()));
	double temp = 1;
	for(int i=1; i<=n; i++) temp *= i;
	cout << setprecision(20) << acc / temp << endl;
  return 0;
}


Measured memory_bytes: 256
#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 main(){
    int a, b; cin>>a>>b;
    string s; cin>>s;
    bool canans=true;
    for(int i=0; i<s.size(); i++){
        if(i==a){
            if(s[i]!='-') canans=false;
        }
        else{
            if(isdigit(s[i])==0) canans=false;
        }
    }

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

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r);
#define TYPE long long
#define MEMSET(a) memset(a,0,sizeof(a))
long long mod=(long long)1e09+7;
int inf=1<<30;

int in(void){
    int i;scanf("%d",&i);
    return i;
}
long long llin(void){
    long long i;scanf("%lld",&i);
    return i;
}
double din(void){
    double i;scanf("%lf",&i);
    return i;
}
void chin(char s[]){
    scanf("%s",s);
}
void print(int a){
    printf("%d\n",a);
}
void llprint(long long a){
    printf("%lld\n",a);
}
void dprint(double a){
    printf("%.10f\n",a);
}
void print2(int a,int b){
    printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
    return a>b?a:b;
}
long long min(long long a,long long b){
    return a<b?a:b;
}
int cmp(const void *a,const void *b){
    return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
    return *(TYPE *)b-*(TYPE *)a;
}
int char_cmp(const void *a,const void *b){
    return strcmp((char *)a,(char *)b);
}
int char_cmp_r(const void *a,const void *b){
    return strcmp((char *)b,(char *)a);
}
void swap(int *a,int *b){
    int t=*a;
    *a=*b;
    *b=t;
}
long long gcd(long long x,long long y){
    return x%y?gcd(y,x%y):y;
}
long long lcm(long long x,long long y){
    return x/gcd(x,y)*y;
}

// write codes below this
// when you use 'sort',
// make sure TYPE macro is correct
int dp[20001][256];

int main(void){
    int n,m,c[16],x[20001],i,j,k,t,ans;
    while(n=in()){
        m=in();
        rep(i,m)c[i]=in();
        rep(i,n)x[i+1]=in();
        rep(i,n+1)rep(j,256)dp[i][j]=inf;
        dp[0][128]=0;
        for(i=1;i<=n;i++){
            rep(j,256){
                if(dp[i-1][j]==inf)continue;
                rep(k,m){
                    t=min(255,max(0,j+c[k]));
                    dp[i][t]=min(dp[i][t],dp[i-1][j]+sq(t-x[i]));
                }
            }
        }
        ans=inf;
        rep(i,256)ans=min(ans,dp[n][i]);
        print(ans);
    }
    return 0;
}


Measured memory_bytes: 21808
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ull unsigned long long
#define pb push_back
#define pii pair<int, int>
#define sz size()
 
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>void __f(const char* name, Arg1&& arg1){cout<<name<<" : "<<arg1<<"\n";}
template <typename Arg1, typename... Args>void __f(const char* names, Arg1&& arg1, Args&&... args)
{const char* comma=strchr(names+1,',');cout.write(names,comma-names)<<" : "<<arg1<<" , ";__f(comma+1, args...);} 
#define traceloop(x,a) { cerr<<#a<<": "; for(ll ix=0;ix<x;ix++) cerr<<a[ix]<<" "; cerr<<endl; }
 
int main()
{
	ios::sync_with_stdio(0);
 
	int i, j, k, n;
 
	cin>>n;
	double dp[n+1][n+1];
	memset(dp, 0, sizeof dp);
	
	dp[0][0] = 1;
 
	double ans = 0;
	for(i=1;i<=n;++i)
	{
		double temp;
		cin>>temp;
		for(j=0;j<=n;++j)
		{
			dp[i][j] = dp[i-1][j-1] * temp + dp[i-1][j] * (1-temp);
			//trace(i, j);
			//cout << "i: " << i; cout << "     j: " << j << "     dp[i][j]; ";cout  << dp[i][j] << "\n";
			if(i == n and j >= ((i+1)/2))
				ans += dp[i][j];
		}
	}
 
	cout << fixed << setprecision(10) << ans << "\n";
 
	return 0;
}

Measured memory_bytes: 70528
#include<iostream>
using namespace std;
int main(){
    string o,e;
    cin >> o >> e;
    for(int i=0;i<e.size();i++){
        cout << o.at(i) << e.at(i);
    }
    if(o.size()!=e.size())cout << o.at(o.size()-1);
    cout << endl;
}

Measured memory_bytes: 256
object Main extends App {
	val pw = new java.io.PrintWriter(System.out)

	@scala.annotation.tailrec
	def loop(start: Int, end: Int)(f: Int => Unit): Unit =
		if (start < end) {
			f(start)
			loop(start + 1, end)(f)
		}

	val s, t = Scanner.next.toSeq

	pw.println(s.zip(t).filter{case (a, b) => a != b}.size)
	pw.flush()
}

object Scanner {
	private val buf = new Array[Byte](1024); private var ptr = 0; private var len = 0

	@inline private def isPrintableChar(c: Int): Boolean = 33 <= c && c <= 126
	@inline private def hasNextByte(): Boolean = if (ptr >= len) { ptr = 0; len = System.in.read(buf); len > 0 } else true
	@inline private def hasNext(): Boolean = {
		while (hasNextByte() && !isPrintableChar(buf(ptr))) ptr += 1
		hasNextByte()
	}
	@inline private def readByte(): Byte = if (hasNextByte()) { val res = buf(ptr); ptr += 1; res } else -1

	def next(): String = {
		if(!hasNext()) ???
		val sb = new StringBuilder; var b = readByte()
		while (isPrintableChar(b)) { sb.append(b.toChar); b = readByte() }
		sb.toString
	}

	def nextInt(): Int = {
		val n = nextLong()
		if (n < Int.MinValue || Int.MaxValue < n) ???
		n.toInt
	}

	def nextLong(): Long = {
		if(!hasNext()) ???
		var minus = false; var b = readByte()
		if (b == '-') { minus = true; b = readByte() }

		@scala.annotation.tailrec
		def go (b: Byte, n: Long = 0): Long = if ('0' <= b && b <= '9') go(readByte(), n * 10 + b - '0') else if (minus) -n else n

		go(b)
	}

	def nextDouble(): Double = next().toDouble
}


Measured memory_bytes: 58304
#include <bits/stdc++.h>
using namespace std;
#define what_is(x) cerr << #x << " is " << x << endl;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define st first
#define nd second
#define endl '\n'

typedef long long ll;
typedef pair<int,int> pii;
const int N = 1e5+5;
const int INF = 1e9;
const int MOD = 1e9+7;

int n, k;
int a[N];

int main()
{
	IOS
	// freopen("input.txt", "r", stdin);
	cin >> n >> k;
	for(int i=0; i<n; i++){
		char c; cin >> c;
		a[i] = (c == 'L');
	}

	int ans = 0;
	for(int i=1; i<n; i++){
		ans += (a[i]==a[i-1]);
	}
	int cnt = 0;
	a[n] = a[0];
	for(int i=1; i<=n; i++){
		if (a[i] != a[i-1]) cnt++;
	}
	cnt /= 2;
	if (k< cnt) ans += 2*k;
	else ans += 2*cnt - (a[n-1] != a[n]);
	cout << ans << endl;

	return 0;
}


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

#define ll long long

using namespace std;

const ll inf = 1e18;

int main() {
#ifdef __APPLE__
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int n;
    scanf("%d", &n);
    vector<ll> a(n);
    vector<ll> pref(n);
    ll sum = 0;
    for (int i = 0; i < n; ++i) {
        scanf("%lld", &a[i]);
        pref[i] = i? (pref[i - 1] + a[i]) : a[i];
        sum += a[i];
    }
    ll ans = inf;
    for (int i = 0; i + 1 < n; ++i) {
        ll left = pref[i];
        ll right = sum - left;
        ans = min(ans, abs(left - right));
    }
    printf("%lld", ans);

    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  rep(i,n) a[i]--;
  vector<int> idx(n);
  rep(i,n) idx[a[i]] = i;
  set<int> s;
  ll ans = 0;
  for (int x = n-1; x >= 0; --x) {
    int i = idx[x];
    ll c = 0;
    { 
      s.insert(i);
      vector<int> l(2,-1);
      vector<int> r(2,n);
      { 
        auto it = s.find(i);
        rep(j,2) {
          if (it == s.begin()) break;
          --it;
          l[j] = *it;
        }
      }
      { 
        auto it = s.find(i);
        rep(j,2) {
          ++it;
          if (it == s.end()) break;
          r[j] = *it;
        }
      }
      vector<int> ls(2);
      ls[0] = i-l[0]; ls[1] = l[0]-l[1];
      vector<int> rs(2);
      rs[0] = r[0]-i; rs[1] = r[1]-r[0];
      c = (ll)ls[0]*rs[1] + (ll)ls[1]*rs[0];
    }
    ans += c*(x+1);
  }
  cout << ans << endl;
}


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

#define int long long
typedef vector<int> vint;
typedef pair<int, int> pint;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
template<typename T, typename U> inline bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> inline bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
struct Init {
    Init() {
        cout << fixed << setprecision(20);
    };
} init;

string S;
signed main() {
    cin >> S;
    if (S[0] == S[1] || S[1] == S[2] || S[2] == S[3]) { cout << "Bad" << endl; }
    else { cout << "Good" << endl; }
}

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

int main() {
	int x, y;
	while( 1 ){
		cin >> x >> y;
		if (x == 0 && y == 0) return 0;
		if (x > y)
		  cout << y << " " << x << endl;
		else 
		  cout << x << " " << y << endl;
	}
	return 0;
}


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

// Template for atcoder
public class Main {

    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;
    final long MOD = 1000L * 1000L * 1000L + 7;
    private static final int[] dx = {0, -1, 0, 1};
    private static final int[] dy = {1, 0, -1, 0};

    void solve() throws IOException {
        int n = nextInt();
        int W = nextInt();
        int[] weight = new int[n];
        int[] value = new int[n];
        for (int i = 0; i < n; i++) {
            weight[i] = nextInt();
            value[i] = nextInt();
        }
        long[] dp = new long[1 + W];
        Arrays.fill(dp, -1);
        dp[0] = 0;
        for (int i = 0; i < n; i++) {
            long[] nxt = new long[1 + W];
            Arrays.fill(nxt, -1);
            for (int j = 0; j <= W; j++) {
                if (dp[j] < 0) {
                    continue;
                }
                nxt[j] = Math.max(nxt[j], dp[j]);
                if (j + weight[i] <= W) {
                    nxt[j + weight[i]] = Math.max(nxt[j + weight[i]], dp[j] + value[i]);
                }
            }
            dp = nxt;
        }
        long res = -1;
        for (long v : dp) {
            res = Math.max(res, v);
        }
        outln(res);
    }

    void shuffle(int[] a) {
        int n = a.length;
        for(int i = 0; i < n; i++) {
            int r = i + (int) (Math.random() * (n - i));
            int tmp = a[i];
            a[i] = a[r];
            a[r] = tmp;
        }
    }
    private void outln(Object o) {
        out.println(o);
    }
    private void out(Object o) {
        out.print(o);
    }
    public Main() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }
    public static void main(String[] args) throws IOException {
        new Main();
    }

    public long[] nextLongArr(int n) throws IOException{
        long[] res = new long[n];
        for(int i = 0; i < n; i++)
            res[i] = nextLong();
        return res;
    }
    public int[] nextIntArr(int n) throws IOException {
        int[] res = new int[n];
        for(int i = 0; i < n; i++)
            res[i] = nextInt();
        return res;
    }
    public String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return null;
            }
        }
        return st.nextToken();
    }
    public String nextString() {
        try {
            return br.readLine();
        } catch (IOException e) {
            eof = true;
            return null;
        }
    }
    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
}


Measured memory_bytes: 52016
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int D = scan.nextInt();
        int L = scan.nextInt();

        if (D % L == 0) {
            System.out.println(D / L);
        } else {
            System.out.println(D / L + D % L);
        }
    }
}



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

int main(){
	int N, K, i;
	scanf("%d%d", &N, &K);
	int *A = (int *)malloc(sizeof(int) * N);
	for(i = 0; i < N; i++){
		scanf("%d", &A[i]);
	}
	printf("%d\n", ((N - 1) + (K - 1) - 1) / (K - 1));
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin,(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    int a,b;
    cin >> a >> b;
    string s;
    cin >> s;

    REP(i,s.length()){
        if(i == a&&s[i] != '-'){
            cout << "No" << endl;
            return 0;
        }
        else if(i != a && s[i] == '-'){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<list>
#include<bitset>
#include<sstream>
using namespace std;

int main() {

	int N;
	cin >> N;

	cout << N / 2 + N % 2 - 1 << endl;

	return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int main(){
    int n,K;
    cin>>n>>K;
    pair<ll,ll> p[n];
    for(int i=0;i<n;i++){
        ll x,y;
        cin>>x>>y;
        p[i]={x,y};
    }
    ll ans=9e18;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            for(int k=0;k<n;k++){
                for(int l=k+1;l<n;l++){
                    ll sx=p[i].first;
                    ll lx=p[j].first;
                    ll sy=p[k].second;
                    ll ly=p[l].second;
                    if(sx>lx)swap(sx,lx);
                    if(sy>ly)swap(sy,ly);
                    int cnt=0;
                    for(int i=0;i<n;i++){
                        if(sx<=p[i].first&&p[i].first<=lx&&sy<=p[i].second&&p[i].second<=ly)cnt++;
                    }
                    if(cnt>=K)ans=min(ans,(lx-sx)*(ly-sy));
                }
            }
        }
    }
    cout<<ans<<endl;
}


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

int main(){
  ll n;
  std::cin >> n;
  int cn[4]={};
  rep(i,n){
    string s;
    std::cin >> s;
    if(s=="AC")cn[0]++;
    else if(s=="WA")cn[1]++;
    else if(s=="TLE")cn[2]++;
    else if(s=="RE")cn[3]++;
  }

  std::cout << "AC x " <<cn[0]<<'\n';
  std::cout << "WA x " <<cn[1]<<'\n';
  std::cout << "TLE x " <<cn[2]<<'\n';
  std::cout << "RE x " <<cn[3]<<'\n';

  return 0;
}


Measured memory_bytes: 3624
from collections import deque
Sa = deque(input())
Sb = deque(input())
Sc = deque(input())

game = "a"
answer = ""
while True:
    try:
        if game == "a":
            game = Sa.popleft()
        elif game == "b":
            game = Sb.popleft()
        elif game == "c":
            game = Sc.popleft()
    except:
        answer = game
        break

print(answer.upper())

Measured memory_bytes: 3316
#include<stdio.h>
#define MAX 500000
#define INF 1000000001
int n,count,S[MAX];

void merge(int left,int right,int mid){
  int n1,n2,i,j,k,s1[MAX/2+2],s2[MAX/2+2];
  n1=mid-left;
  n2=right-mid;
  for(i=0;i<n1;i++) s1[i]=S[left+i];
  for(i=0;i<n2;i++) s2[i]=S[mid+i];
  i=j=0;
  s1[n1]=s2[n2]=INF;
  for(k=left;k<right;k++){
    count++;
      if(s1[i]>s2[j]) S[k]=s2[j++];
      else S[k]=s1[i++];
  }
}
void mergesort(int left,int right){
  int mid;
  if(left+1<right){
    mid=(left+right)/2;
    mergesort(left,mid);
    mergesort(mid,right);
    merge(left,right,mid);
  }
}

int main(){
  int i;
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&S[i]);

  mergesort(0,n);
  for(i=0;i<n;i++){
    if(i>0) printf(" ");
    printf("%d",S[i]);
  }
  printf("\n%d\n",count);
  return 0;
}



Measured memory_bytes: 5612
#include <stdio.h>

int main(void)
{
    int i, n, m, x, a[100];
    int c, cL, cR, masu[101]={0};

    scanf("%d%d%d",&n, &m, &x);
    for (i=0; i<m; i++) scanf("%d", &a[i]);

    for (i=0; i<m; i++) masu[a[i]]=1;

    cL = 0;
    for (i=x-1; i>=0; i--) {
        if (masu[i]==1) cL++;
    }

    cR = 0;
    for (i=x+1; i<=n; i++) {
        if (masu[i]==1) cR++;
    }

    c = (cL<cR)? cL:cR;
    printf("%d\n", c);

    return 0;
}

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

// ----------- define --------------
#define int long long
#define vi vector<int>
#define ii pair<int,int>
#define fi first
#define sc second
#define stoi stoll
#define popcnt __builtin_popcount
#define getBit(x, k) ((x >> k) & 1)
#define all(x) (x).begin(),(x).end()
// ---------------------------------

void Main() {
  int n; cin >> n;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  vector<int> d(n + 1), res;
  for (int i = n; i >= 1; i--) {
    int s = 0;
    for (int j = i; j <= n; j += i) {
      s += d[j];
    }
    if (s % 2 != a[i]) {
      d[i] = 1;
      res.push_back(i);
    }
  }
  cout << res.size() << '\n';
  for (auto &i : res) cout << i << ' ';
  if (res.size()) cout << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  cerr << "- ---- -- ----- <3\n";
#endif
  cin.tie(0)->sync_with_stdio(0);
  int T = 1;
  // cin >> T;
  while (T--) Main();
}


Measured memory_bytes: 7208
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int A,B,s;
    cin >> A >> B;
    s = 0;
    for(;A<=B;A++){
        int f1,f2,f3,f4,f5;
        f1 = A % 10;
        f2 = (A % 100 - f1)/10;
        f3 = (A % 1000 - 10*f2 - f1)/100;
        f4 = (A % 10000 - 100*f3 - 10*f2 - f1)/1000;
        f5 = A / 10000;
        if(f1 != 0){
            if(f1 == f5){
                if(f2 == f4){
                    s++;
                }
            }
        }
        
    }
    cout << s << endl;
}

Measured memory_bytes: 256
/*
ID: amagica1
TASK: ariprog
LANG: C++
*/
#include <bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3f
#define NINF -INF
#define mp make_pair
#define boost() cin.tie(0); cin.sync_with_stdio(0)
#define For(i, a, b) for(int i=a; i<b; i++)
#define FOR(i, a, b) for(int i=a; i<=b; i++)
#define Rev(i, a, b) for(int i=a; i>b; i--)
#define REV(i, a, b) for(int i=a; i>=b; i--)
typedef long long ll;
typedef long double ld;
typedef int64_t l;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;
const int MOD = 1e9 + 7;
const int MAXN = 100005;
ll gcd(ll a, ll b){return b == 0 ? a : gcd(b, a % b);}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
ll fpow(ll  b, ll exp, ll mod){if(exp == 0) return 1;ll t = fpow(b,exp/2,mod);if(exp&1) return t*t%mod*b%mod;return t*t%mod;}
ll divmod(ll i, ll j, ll mod){i%=mod,j%=mod;return i*fpow(j,mod-2,mod)%mod;}
int main() {
    //-----------FILE------------//
    // freopen("ariprog.in", "r", stdin);
    // freopen("ariprog.out", "w", stdout);
    //----------------------------//
    string s; cin >> s;
    int st=0, ed=s.length()-1;
    int cnt=0;
    while(st <= ed) {
        if(s[st] != s[ed]) cnt++;
        st++; ed--;
    }
    printf("%d\n", cnt);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Map = map<string,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;

ll F(ll x, ll y, ll z, ll w, ll H){
    return max(H-abs(x-z)-abs(y-w),0LL);
}

int main(){
    ll N;
    cin >> N;
    vector<ll> x(N,0);
    vector<ll> y(N,0);
    vector<ll> h(N,0);
    ll t;
    for(ll i=0;i<N;i++){
        cin>>x[i]>>y[i]>>h[i];
        if(h[i]){t=i;}
    ;}
    for(ll i=0;i<=100;i++){
     for(ll j=0;j<=100;j++){
         ll H1=h[t]+abs(x[t]-i)+abs(y[t]-j);
         bool check=0;
         for(ll k=0;k<N;k++){
             if(F(x[k],y[k],i,j,H1)!=h[k]){check=1;break;}
         ;}
         if(!check){cout<<i<<" "<<j<<" "<<H1<<endl;return 0;}
     ;}
    ;}
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
#include <utility>
using namespace std;

int main()
{
    int n,k;
    int i,j;
    cin >> n >> k;
    vector<int> h(n);
    int ans = 0;
    for(i = 0;i < n;++i){
        cin >> h.at(i);
        if(h.at(i) >= k){
            ++ans;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
// Aizu Vol0 0057: The Number of Area
// 2017.7.29

#include <stdio.h>
#include <stdlib.h>

char *gets(char *);
char buf[100];

int main()
{
	int n;

	while (gets(buf) != NULL) {
		n = atoi(buf);
		printf("%d\n", 1 + n*(n + 1) / 2);
	}
	return 0;
}

Measured memory_bytes: 524
import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}
import scala.collection.mutable.{Map, Stack, Queue, PriorityQueue, Set}

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)

  val N = in.next().toInt
  var S = in.next()

  //
  var ans = 0
  for (i <- 0 until N) {
    val zal = new ZAlgorithm(S)
    val Z = zal.Z
    for (j <- 1 until N-i) {
      ans = Math.max(ans, j min Z(j))
    }

    if (!S.isEmpty)
      S = S.tail
  }

  println(ans)
}

object Sub {
  def print2DimArray[A](mat: Array[Array[A]]): Unit = {
    mat.foreach(lin => println(lin.deep))
  }
}

class InputReader(stream: InputStream) {
  private[this] val reader = new BufferedReader(new InputStreamReader(stream))
  private[this] var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}

// O(|S|)
class ZAlgorithm(S: String) {
  private[this] val N = S.length

  // Z配列
  val Z = new Array[Int](N)

  Z(0) = N
  private[this] var i = 1
  private[this] var j = 0
  while (i < N) {
    while (i + j < N && S(j) == S(i+j))
      j += 1
    Z(i) = j

    if (j == 0) {
      i += 1
    }
    else {
      var k = 1
      while (k < j && k + Z(k) < j) {
        Z(i+k) = Z(k)
        k += 1
      }
      i += k
      j -= k
    }
  }
}


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


int main()
{
	long long a = 0, b = 0, c = 0;
	string str;
	cin >> a >> b;
	for (long long i = b - a + 1; i <= b + a - 1;i++) {
		if (i != b + a - 1) {
			cout << i << " " << endl;
		}
		else {
			cout << i << endl;
		}
	}
}


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

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

	int a=0,b=0;
	for(int i=0;i<s.length();i++){
		if(s[i]=='0')a++;
		else b++;
	}

	cout<<min(a,b)*2<<endl;

	return 0;
}


Measured memory_bytes: 512
int main(){
    int m,f,r;
    for(;;){
        scanf("%d %d %d",&m,&f,&r);
        if (m+f+r==-3) break;
        if (m==-1 || f==-1) printf("F\n");
        else if (m+f>=80) printf("A\n");
        else if (m+f>=65) printf("B\n");
        else if (m+f>=50) printf("C\n");
        else if (m+f>=30 && r>=50) printf("C\n");
        else if (m+f>=30) printf("D\n");
        else if (m+f<30)  printf("F\n");
    }
    return 0;   
}


Measured memory_bytes: 2048
let rec select acc trace = function
  | [] -> acc
  | x :: xs -> select ((trace, x, xs) :: acc) (x :: trace) xs
let select xs = select [] [] xs

let rec permutation = function
  | [] -> [[]]
  | xs -> 
      List.concat @@ List.map (fun (xs, x, ys) -> List.map (fun xs -> x :: xs) (permutation (List.rev_append xs ys)))
      (select xs)

let warshall_floyd ( + ) min n d =
  for i = 0 to n - 1 do
    for j = 0 to n - 1 do
      for k = 0 to n - 1 do
        d.(j).(k) <- min d.(j).(k) (d.(j).(i) + d.(i).(k))
      done
    done
  done

let () =
  let n, m, r = Scanf.scanf "%d %d %d\n" (fun n m r -> n, m, r) in
  let rs = Array.init r (fun _ -> Scanf.scanf "%d " (fun r -> r - 1)) in
  let abcs = Array.init m (fun _ -> Scanf.scanf "%d %d %d\n" (fun a b c -> a - 1, b - 1, c)) in
  let d = Array.make_matrix n n 10000000 in
  for i = 0 to n - 1 do
    d.(i).(i) <- 0
  done;
  Array.iter (fun (a, b, c) ->
    d.(a).(b) <- c;
    d.(b).(a) <- c) abcs;
  warshall_floyd ( + ) min n d;
  (Array.to_list rs
  |> permutation
  |> List.map (fun (r :: rs) ->
      List.fold_left (fun (r, a) s -> (s, (r, s) :: a)) (r, []) rs
      |> snd
      |> List.map (fun (r, s) -> d.(r).(s))
      |> List.fold_left ( + ) 0)
  |> List.fold_left min max_int
  |> Printf.printf "%d\n")

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

float N;
int numOdd;
float probs;

int main() {
    cin >> N;
    numOdd = 0;
    for (int i = 1; i <= N; i++) {
        if (i % 2 == 1) {
            numOdd++;
        }
    }
    probs = numOdd/N;
    cout << probs;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x).size()
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

signed main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin.exceptions(cin.failbit);
	int a, b, T;
	cin >> a >> b >> T;
	int ans = 0;
	for (int i = a; i <= T; i += a) {
		ans += b;
	}
	cout << ans << "\n";
}



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

int n;
char s[40];

int main(){
	scanf("%d %s", &n, s);
	
	vector < pair <int, string> > v;
	for(int mask = 0; mask < (1 << n); mask++){
		string a = "", b = "";
		for(int i = 0; i < n; i++){
			if(mask & (1 << i)){
				a += s[i];
			}else{
				b += s[i];
			}
		}

		reverse(b.begin(), b.end());
		a += b;
		
		v.push_back(make_pair(b.size(), a));
	}
	sort(v.begin(), v.end());
	
	long long res = 0;
	for(int mask = 0; mask < (1 << n); mask++){
		string a = "", b = "";
		for(int i = 0; i < n; i++){
			if(mask & (1 << i)){
				a += s[i + n];
			}else{
				b += s[i + n];
			}
		}
		reverse(b.begin(), b.end());
		b += a;
		
		pair <int, string> p = make_pair(a.size(), b);
		res += upper_bound(v.begin(), v.end(), p) - lower_bound(v.begin(), v.end(), p);
	}
	printf("%lld\n", res);
	
	return 0;
}


Measured memory_bytes: 21612
#include <iostream>
using namespace std;
int main(){
  int n;
  int k,x,y;

  cin >> n >> k;

  for(int i = 0 ; i < k ; i++ ){
    cin >> x >> y;
    x = min(x,n-x+1);
    y = min(y,n-y+1);
    int ans = min(x,y)%3;
    if(ans == 0)ans = 3;
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rep1(i,n) for(int i = 1; i < (n); i++)

int main(){
    int n;
    cin >> n;
    string s;
    vector<int> a(4);
    rep(i,n){
        cin >> s;
        if(s == "AC") a[0]++;
        if(s == "WA") a[1]++;
        if(s == "TLE") a[2]++;
        if(s == "RE") a[3]++;
    }
    cout << "AC x " << a[0] << endl;
    cout << "WA x " << a[1] << endl;
    cout << "TLE x " << a[2] << endl;
    cout << "RE x " << a[3] << endl;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
ll a,b,x;
  cin>>x>>a>>b;
  ll A=abs(x-a);
  ll B=abs(x-b);
  if(A>B) {
cout<<'B'<<endl;
  }
  else {
cout<<'A'<<endl;
  }
}

Measured memory_bytes: 3468
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for (int i = a; i < b; i++)
using namespace std;

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <tuple>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <stack>
#include <bitset>

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

	vector<int> a(M);
	vector<int> b(M);

	rep(i, M) {
		cin >> a.at(i) >> b.at(i);	
	}

	vector<int> road(N);

	rep(i, M) {
		road.at(a.at(i) - 1)++;
		road.at(b.at(i) - 1)++;	
	}

	rep(i, N) {
		cout << road.at(i) << endl;	
	}
}

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

struct bill{int n, x, y;};

std::vector<int> dijkstra(int, int);
double len[1001][1001];
const double INF = 10000000;

int main(){
	int n;
	while(std::cin >> n, n){
		for(int i=1;i<1001;i++)
		 	for(int j=1;j<1001;j++)
		 		len[i][j] = INF;

		std::vector<bill> bs;
		for(int i=n;i;i--){
			bill b;
			std::cin >> b.n >> b.x >> b.y;
			bs.push_back(b);
		}

		for(int i=0;i<bs.size()-1;i++){
			for(int j=i+1;j<bs.size();j++){
				double x = bs[i].x-bs[j].x, y = bs[i].y-bs[j].y, dist = sqrt(x*x+y*y);
				if(dist <= 50){
					len[bs[i].n][bs[j].n] = dist;
					len[bs[j].n][bs[i].n] = dist;
				}
			}
		}

		int m;
		std::cin >> m;
		for(;m;m--){
			int start, end;
			std::cin >> start >> end;
			std::vector<int> res = dijkstra(start, end);
			if(res[0] == -1)std::cout << "NA\n";
			else{
				for(int i=0;i<res.size();i++){
					std::cout << res[i] << (i+1-res.size()?" ":"\n");
				}
			}
		}
	}
}

std::vector<int> dijkstra(int s, int e){
	double dist[1001]; int used[1001]; int prev[1001];
	std::fill(dist, dist+1001, INF);
	std::fill(used, used+1001, 0);

	dist[s] = 0;
	while(1){
		int v = -1;
		for(int u=1;u<1001;u++){
			if(!used[u] && (v==-1 || dist[u]<dist[v]))v=u;
		}
		if(v == -1)break;
		used[v] = 1;
		for(int u=1;u<1001;u++){
			if(dist[u] > dist[v]+len[v][u])
				dist[u] = dist[v]+len[v][u], prev[u] = v;
		}
	}
	std::vector<int> res;
	if(dist[e] == INF)res.push_back(-1);
	else{
		res.push_back(e);
		int v = e;
		while(v != s){
			v = prev[v];
			res.push_back(v);
		}
		std::reverse(res.begin(), res.end());
		return res;
	}
}

Measured memory_bytes: 8756
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] dp = new int[n][3];
		dp[0][0] = sc.nextInt();
		dp[0][1] = sc.nextInt();
		dp[0][2] = sc.nextInt();
		for(int i = 1; i < n; i++) {
			int a = Integer.parseInt(sc.next());
			int b = Integer.parseInt(sc.next());
			int c = Integer.parseInt(sc.next());
			dp[i][0] = Math.max(dp[i-1][1]+a, dp[i-1][2]+a);
			dp[i][1] = Math.max(dp[i-1][0]+b, dp[i-1][2]+b);
			dp[i][2] = Math.max(dp[i-1][0]+c, dp[i-1][1]+c);
		}
		int max = Math.max(dp[n-1][0], Math.max(dp[n-1][1], dp[n-1][2]));
		System.out.println(max);
		sc.close();
	}

}

Measured memory_bytes: 66156
#include"bits/stdc++.h"
using namespace std;

//typedef
//------------------------------------------
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define PB push_back
#define MP make_pair
#define SORT(c) sort((c).begin(),(c).end())
#define COUT(x) cout<<x<<endl;

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double PI = acos(-1.0);
const LL MOD = 1e9 + 7;
const ULL INF= 1e20;

//function
//--------------------------------------------
LL gcd(LL, LL);
bool isEven(LL);

int main() {
	int a, b;
	cin >> a >> b;
	if (a > 8 || b > 8) COUT(":(")
	else COUT("Yay!")
	return 0;
}

LL gcd(LL a, LL b) {
	if (a == 0 || b == 0)return 0;
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	else gcd(b, a % b);
}
bool isEven(LL a) {
	return !((bool)(a % 2));
}

Measured memory_bytes: 256