akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define all(x) (x).begin(), (x).end()
#define endl '\n'
#define fsp(x) cout << fixed << setprecision(x)
const ll inf = LLONG_MAX;
const long double pi = M_PI;
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
  ll x, y;
  cin >> x >> y;
  if (x % y == 0) cout << -1 << endl;
  else {
    cout << x << endl;
  }
}

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

using ll = int64_t;

signed main(){

  int n;
  cin>>n;
  vector<ll> a(n);
  for(auto& ai:a)cin>>ai;

  vector<ll> power(60);
  for(int i=0;i<60;++i)power[i] = (1LL<<i);
  map<ll,ll> cnt;
  for(auto& ai:a)cnt[ai]++;
  sort(a.begin(),a.end(),greater<>());
  int ans = 0;
  for(int i=0;i<n;++i){
    for(int j=0;j<60;++j){
      if(cnt.count(power[j]-a[i])==0)continue;
      if(power[j]-a[i]==a[i]){
        if(cnt[a[i]]>=2){
          cnt[a[i]]-=2;
          ans++;
        }
      }
      else if(cnt[power[j]-a[i]]>=1&&cnt[a[i]]>=1){
        cnt[power[j]-a[i]]--;
        cnt[a[i]]--;
        ans++;
      }
    }
  }
  cout<<(ans)<<endl;

}

Measured memory_bytes: 14336
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
const int inf = 1012345678;
int A, B, a[15][15], b[15][15], c[15][15], d[15][15], g[105][105];
int main() {
	cin >> A >> B;
	for (int i = 0; i < A; i++) {
		for (int j = 0; j < B; j++) {
			cin >> d[i][j];
		}
	}
	bool found = true;
	for (int i = 0; i < A; i++) {
		for (int j = 0; j < B; j++) {
			a[i][j] = -1;
			for (int k = 0; k <= 100; k++) {
				for (int l = 0; l <= 100; l++) {
					int val = (i + 1) * k + (j + 1) * l;
					if (val > d[i][j]) continue;
					int nc = d[i][j] - val; bool flag = false;
					for (int p = 0; p < A; p++) {
						for (int q = 0; q < B; q++) {
							if ((p + 1) * k + (q + 1) * l + nc < d[p][q]) {
								flag = true;
							}
						}
					}
					if (!flag) a[i][j] = k, b[i][j] = l, c[i][j] = nc;
				}
			}
			if (a[i][j] == -1) found = false;
		}
	}
	if (!found) cout << "Impossible" << endl;
	else {
		cout << "Possible" << endl;
		for (int i = 0; i <= 100; i++) {
			for (int j = 0; j <= 100; j++) {
				g[i][j] = inf;
			}
		}
		int xs = 0, ys = 0;
		for (int i = 0; i < A; i++) {
			for (int j = 0; j < B; j++) {
				g[a[i][j]][b[i][j]] = min(g[a[i][j]][b[i][j]], c[i][j]);
				xs = max(xs, a[i][j]);
				ys = max(ys, b[i][j]);
			}
		}
		int cnt = 0;
		for (int i = 0; i <= 100; i++) {
			for (int j = 0; j <= 100; j++) {
				if (g[i][j] != inf) cnt++;
			}
		}
		cout << xs + ys + 2 << " " << xs + ys + cnt << endl;
		for (int i = 0; i < xs; i++) cout << i + 1 << " " << i + 2 << " X\n";
		for (int i = 0; i < ys; i++) cout << xs + i + 3 << " " << xs + i + 2 << " Y\n";
		for (int i = 0; i <= 100; i++) {
			for (int j = 0; j <= 100; j++) {
				if (g[i][j] != inf) {
					cout << i + 1 << " " << xs + j + 2 << " " << g[i][j] << "\n";
				}
			}
		}
		cout << 1 << " " << xs + 2 << "\n";
	}
	return 0;
}

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

int main(){
    int n,a=1,b=1;
    cin>>n;
    for(int i=0; i<n; i++) {
        int x; cin>>x;
        a *= 3;
        if(x%2==0) b *= 2;
    }
    cout<<a-b;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 998244353;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
string s;
int r, b;
//i回目のbの個数
ll dp[4001][4001];
int numb[2001];
int numr[2001];
//i個目のbに要求されるrの個数
int q[4001];
//i個目のrに要求されるbの個数
int p[4001];
int main() {
	cin >> s; int n = s.length();
	rep(i, n) {
		if (s[i] == '0')r += 2;
		else if (s[i] == '2')b += 2;
		else {
			r++; b++;
		}
	}
	rep(i, n) {
		if (s[i] == '0')numr[i]++;
		else if (s[i] == '2')numb[i]++;
	}
	int cnt = 0; int cntb = 0;
	int cntr = 0;
	rep(i, n) {
		int t = cntb;
		if (s[i] == '2') {
			t += 2;
		}
		else if (s[i] == '1') {
			t++;
		}
		else {
			cnt++;
		}
		Rep1(j, cntb + 1, t) {
			q[j-1] = max(i+1-j,0);
		}
		cntb = t;
	}
	cnt = 0;
	rep(i, n) {
		int t = cntr;

		if (s[i] == '2') {
			cnt++;
		}
		else if (s[i] == '1') {
			t++;
		}
		else {
			t += 2;
		}
		Rep1(j, cntr + 1, t) {
			p[j-1] = max(i+1-j,0);
		}
		cntr = t;
	}
	dp[0][0] = 1;
	rep(i, 2 * n) {
		rep(j, i + 1) {
			//次にbを追加
			int nb = j, nr = i - j;
			if (q[nb] <= nr) {
				(dp[i + 1][j + 1] += dp[i][j]) %= mod;
			}
			if (p[nr] <= nb) {
				(dp[i + 1][j] += dp[i][j]) %= mod;
			}
		}
	}
	cout << dp[2 * n][b] << endl;
	/*rep(i, b) {
		cout << q[i] << endl;
	}*/
	//stop
	return 0;
}

Measured memory_bytes: 123648
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <math.h>
#include <string>
#include <cstring>
#include <bits/stdc++.h>
#include <search.h>
#include <algorithm>
#include <vector>
#include <deque>
#include <set>
#include<stack>
#include <utility>
using namespace std;
int main()
{
int r;
cin>>r;
cout<<r*r;
return 0;
}

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

string s, t;

int main() {
	cin >> s >> t;
	int n = s.size();
	int ans = 0;

	for (int i = 0; i < n; ++i)
		if (s[i] != t[i])
			++ans;
	cout << ans << endl;
}


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

using namespace std;

int main()
{
    int N;
    cin>>N;
    vector<long long> a(N);
    for (long long &t: a)
        cin>>t;
    long long K = 0;
    while (true)
    {
        bool up = false;
        for (int i=0; i<N; i++)
        if (a[i]>N-1)
        {
            up = true;
            long long c = a[i]/N;
            K += c;
            for (int j=0; j<N; j++)
                if (j==i)
                    a[j] -= c*N;
                else
                    a[j] += c;
        }
        if (!up)
            break;
    }
    cout<<K<<endl;
}


Measured memory_bytes: 256
n=int(input())
l=sorted([int(input()) for _ in range(n)])
s = sum(l)
if s%10!=0:
    print(s)
    exit()
l_e=[i for i in l if i%10!=0]
if len(l_e)==0:
    print(0)
    exit()
else:print(s-l_e[0])

Measured memory_bytes: 3064
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> //Policy Based Data Structure
// using namespace __gnu_pbds;              //Policy Based Data Structure
using namespace std;
// typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> pbds; //Policy Based Data Structure
// #define gc              getchar_unlocked
// #define pqb             priority_queue<int>
// #define pqs             priority_queue<int, vi, greater<int> >
// #define mk(arr,n,type)  type *arr = new type[n]
#define fo(i,n)         for(i=0;i<n;i++)
#define Fo(i,k,n)       for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define int             long long
#define endl            '\n'
#define w(t)            int t; cin>>t; while(t--)
#define deb(x)          cout << #x << "=" << x << endl
#define deb2(x,y)       cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb              push_back
#define mp              make_pair
#define F               first
#define S               second
#define all(x)          x.begin(), x.end()
#define clr(x)          memset(x, 0, sizeof(x))
#define sortall(x)      sort(all(x))
#define tr(it,a)        for(auto it = a.begin(); it != a.end(); it++)
#define ps(x,y)         fixed<<setprecision(y)<<x
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define PI              3.1415926535897932384626
#define inf             1e18
// mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());  //Random Shuffler
typedef pair<int, int>   pii;
typedef vector<int>     vi;
typedef vector<pii>     vpii;
typedef vector<vi>      vvi;
typedef map<int, int>    mii;
int mpow(int base, int exp);
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
// const int N = 3e5, M = N;
// vi g[N];
//=======================

void sol()
{
	int n;
	cin >> n;
	int a[n][2];
	for (int i = 0; i < n; i++)
		cin >> a[i][0] >> a[i][1];
	bool b = false;
	for (int i = 0; i < n - 2; ++i)
	{
		if ((a[i][0] == a[i][1]) && (a[i + 1][0] == a[i + 1][1]) && (a[i + 2][0] == a[i + 2][1]))
		{
			b = true;
			break;
		}

	}
	cout << (b ? "Yes" : "No") << endl;

}

int32_t main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	sol();

	return 0;
}

int mpow(int base, int exp) {
	base %= mod;
	int result = 1;
	while (exp > 0) {
		if (exp & 1) result = (result * base) % mod;
		base = (base * base) % mod;
		exp >>= 1;
	}
	return result;
}

// void ipgraph(int n, int m){
//     int i, u, v;
//     while(m--){
//         cin>>u>>v;
//         g[u-1].pb(v-1);
//         g[v-1].pb(u-1);
//     }
// }
//
// void dfs(int u, int par){
//     for(int v:g[u]){
//         if (v == par) continue;
//         dfs(v, u);
//     }
// }


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

int main(void){
	int N;
	char str[100];
	char ans[200];
	scanf("%d",&N);
	int i;
	scanf("%s",str);
	//printf("%s\n%d\n",str,strlen(str));
	int mae = 0,ato = 0;
	int add_mae=0;
	for(i = 0;i < N;i++){
		if(str[i] == '('){mae++;}
		if(str[i] == ')'){ato++;}
		if(ato > mae){ato--;add_mae++;}
	}
	for(i = 0;i < add_mae;i++){
		ans[i] = '(';
	}
	for(i = add_mae;i < add_mae + N;i++){
		ans[i] = str[i - add_mae];
	}
	for(i = 0;i < mae-ato;i++){
		ans[i + add_mae + N] = ')';
	}
	ans[i + add_mae + N] = '\0';
	printf("%s",ans);
	
	
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
int main(){
ll a,b;cin>>a>>b;
if(a==0){cout<<0;return 0;}
cout<<min(a%b,b-(a%b));
return 0;

}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <tgmath.h>
#include <queue>
#include <cstring>
#include <map>
#include <set>
typedef long long ll;
using namespace std;

int N, M;
string s[100];
string t[100];

map<string,int> redMap;
map<string,int> blueMap;


int main(){
    cin >> N;
    for(int i=0; i<N;i++){
        cin >> s[i];
    }
    cin >> M;
    for(int i=0; i < M;i++){
        cin >> t[i];
    }
    for(int i=0;i<N;i++){
        if(redMap.count(s[i])==0){
            redMap.emplace(s[i],1);
            continue;
        }
        auto ite = redMap.find(s[i]);
        ite->second += 1; 
    }
    for(int i=0;i<M;i++){
        if(blueMap.count(t[i])==0){
            blueMap.emplace(t[i],1);
            continue;
        }
        auto ite = blueMap.find(t[i]);
        ite->second += 1;
    }

    int ans = 0;
    for(auto ite = redMap.begin(); ite != redMap.end(); ite++){
        int redValue = ite->second;
        int blueValue = blueMap.find(ite->first)->second;
        ans = max(ans,redValue-blueValue);
    }
    cout << ans << endl;
    

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MAXn = 2e5 + 10;
typedef pair<int, int> pii;
int n;
long long t;
pii ar[MAXn];

int main() {
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> ar[i].second >> ar[i].first;
	}
	sort(ar, ar + n);
	for (int i = 0; i < n; i++) {
		if (ar[i].second + t > ar[i].first)
			return cout << "No",0;
		t += ar[i].second;
	}
	cout << "Yes";
}


Measured memory_bytes: 1792
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
cnt=0
for i in range(n):
    if a[i]>=b[i]:
        cnt+=b[i]
    else:
        cnt+=a[i]
        b[i]=b[i]-a[i]
        if b[i]>=a[i+1]:
            cnt+=a[i+1]
            a[i+1]=0
        else:
            cnt+=b[i]
            a[i+1]=a[i+1]-b[i]
print(cnt)

Measured memory_bytes: 18624
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define pi 3.14159265358979323846

int main(){
	int n,m;cin>>n>>m;
	vector<vector<int>> G(n);
	for(int i=0;i<m;i++){
		int a,b;cin>>a>>b;
		a--;b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}

	queue<int> que;
	que.push(0);
	vector<bool> visit(n,false);
	vector<int> key(n,-1);//道しるべ
	
	while(que.size()!=0){
		int now=que.front();
		que.pop();
		if(visit[now]==true) continue;

		visit[now]=true;

		for(auto next:G[now]){
			if(visit[next]==true) continue;
			
			if(key[next]==-1){key[next]=now;}
			que.push(next);
		}
	}
	
	cout<<"Yes"<<endl;
	for(int i=1;i<n;i++){
		cout<<key[i]+1<<endl;
	}

	return 0;
}

Measured memory_bytes: 10304
#include<stdio.h>
int a, b, c, t;
int main(void){
	scanf("%d%d%d", &a, &b, &c);
	if(a>b){t=a; a=b; b=t;}
	if(b>c){t=b; b=c; c=t;}
	if(a>b){t=a; a=b; b=t;}
	printf("%d\n", a+b);
}



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

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

  ll n;
  cin >> n;

  map<ll,int> mp;

  for (ll i = 2; i*i <= n; ++i) {
    while (n % i == 0) {
      n /= i;
      ++mp[i];
    }
  }

  if (n != 1) ++mp[n];

  int ans = 0;
  for (auto e : mp) {
    int cnt = 1;
    while (e.second - cnt >= 0) {
      e.second -= cnt;
      ++cnt;
    }

    ans += (cnt - 1);
  }

  cout << ans << '\n';

  return (0);
}


Measured memory_bytes: 3628
#!/usr/bin/python
# coding: UTF-8

n = input()

n = int(n)

d = []
for i in range(n):
    s,p = input().split()

    s = s
    p = str(100 - int(p)).zfill(3)

    id = s + "__" + p + "__" + str(i+1)

    d += (id,)

d.sort()

for i in d:
    i = i.split("__")

    print(i[2])

Measured memory_bytes: 3060
# -*- coding: utf-8 -*-
import sys
# sys.setrecursionlimit(10**6)
buff_readline = sys.stdin.buffer.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()

def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


class Mod:
    def __init__(self, m):
        self.m = m

    def add(self, a, b):
        return (a + b) % self.m

    def sub(self, a, b):
        return (a - b) % self.m

    def mul(self, a, b):
        return ((a % self.m) * (b % self.m)) % self.m

    def div(self, a, b):
        return self.mul(a, pow(b, self.m-2, self.m))

    def pow(self, a, b):
        return pow(a, b, self.m)


class Combination:
    def __init__(self, n, mod):

        g1 = [1, 1]
        g2 = [1, 1]
        inverse = [0, 1]
        for i in range(2, n + 1):
            g1.append((g1[-1] * i) % mod)
            inverse.append((-inverse[mod % i] * (mod//i)) % mod)
            g2.append((g2[-1] * inverse[-1]) % mod)
        self.MOD = mod
        self.N = n
        self.g1 = g1
        self.g2 = g2
        self.inverse = inverse

    def __call__(self, n, r):
        if (r < 0 or r > n):
            return 0
        r = min(r, n-r)
        return self.g1[n] * self.g2[r] * self.g2[n-r] % self.MOD



@mt
def slv(N, M, K):
    m = Mod(998244353)
    C = Combination(N, 998244353)

    ans = 0
    col = M
    for x in range(N-1, -1, -1):
        tmp = col
        tmp = m.mul(tmp, C(N-1, x))
        if x <= K:
            ans = m.add(ans, tmp)
        col = m.mul(col, M-1)
    return ans


def main():
    N, M, K = read_int_n()
    print(slv(N, M, K))


if __name__ == '__main__':
    main()


Measured memory_bytes: 109588
#include<stdio.h>
int main(void)
{
  int i,j;
  int ymd[100][3], n, y3=590, date;

  scanf("%d", &n);
  for(i=0; i<n; i++) {
    for(j=0; j<3; j++) {
      scanf("%d", &ymd[i][j]);
    }
  }

  for(i=0;i<n;i++) {
    date = 0;
    date += ((ymd[i][0]-1)/3)*y3;
    switch(ymd[i][0]%3){
    case 2:
      date += 195;
      for(j=0;j<ymd[i][1]-1;j++) {
	j%2 ? (date += 19):(date += 20);
      }
      date += ymd[i][2];
      break;
      
    case 1:
      for(j=0;j<ymd[i][1]-1;j++) {
	j%2 ? (date += 19):(date += 20);
      }
      date += ymd[i][2];
      break;
      
    case 0:
      date += 390;
      for(j=0;j<ymd[i][1]-1;j++) {
	date += 20;
      }
      date += ymd[i][2];
      break;
    }
    printf("%d\n", 196471 - date);
  }

  for(i=0;i<100000;i++) 
    for(j=0;j<100000;j++)

  return 0;
}
      

Measured memory_bytes: 600
import java.util.Scanner;


public class Main {

    static void solve() {
        Scanner scan = new Scanner(System.in);
//        int t = scan.nextInt();
        int s = scan.nextInt();
        int w = scan.nextInt();
        if(w>=s) {
            System.out.println("unsafe");
        }else{
            System.out.println("safe");
        }
//        for (int i = 0; i < t; i++) {
//            int n = scan.nextInt();
//            int res = scase(n);
//            System.out.println(res);
//            solveCase(i, n, strs);
//        }
    }

    static void solveCase(int t, int n, String[] strs) {
//
//        System.out.println("Case #" + (t+1) + ": " + res);
    }


//    static int scase(int n) {
//
//    }


    public static void main(String[] args) {

//
        solve();

        //        Main m = new Main();
        //        Scanner scan = new Scanner(System.in);

        //        long n = scan.nextLong();
        //        long r = scan.nextLong();
        //        List<Long> list = new ArrayList<>();
        ////        int[] arr = new int[n];
        //        for (long i=0;i<n;i++){
        //            list.add(scan.nextLong());
        //        }
//            System.out.println(ch);
        //        solve(n, arr);
        //        scan.close();
    }


//
//    class Counter extends HashMap<Integer, Integer> {
//        public int get(int k) {
//            return containsKey(k) ? super.get(k) : 0;
//        }
//
//        public void add(int k, int v) {
//            put(k, get(k) + v);
//        }
//    }


//    static class Node {
//        int val;
//        Node next;
//        Node random;
//
//        public Node(int val) {
//            this.val = val;
//            this.next = null;
//            this.random = null;
//        }
//    }

//    static class Node {
//        int key;
//        int data;
//        Node next;
//        Node prev;
//
//        Node(int key, int data) {
//            this.key = key;
//            this.data = data;
//        }
//    }

    static class TreeNode {
        int val;
        TreeNode left;
        TreeNode right;

        TreeNode(int x) {
            val = x;
        }
    }
}


Measured memory_bytes: 27084
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func arrayContains(arr []int, num int) bool {
	for _, v := range arr {
		if v == num {
			return true
		}
	}
	return false
}

func main() {
	var x, n int
	var pt []string
	var p []int
	fmt.Scan(&x, &n)

	if n == 0 {
		fmt.Print(x)
		return
	}

	sc := bufio.NewScanner(os.Stdin)

	if sc.Scan() {
		pt = strings.Split(sc.Text(), " ")
	}

	for _, e := range pt {
		num, _ := strconv.Atoi(e)
		p = append(p, num)
	}

	i := 1
	current := x
	for {
		if !arrayContains(p, current) {
			fmt.Print(current)
			return
		}

		if current == x {
			current = x - 1
			continue
		}
		if current < x {
			current = x + i
		} else {
			i += 1
			current = x - i
		}
	}
}


Measured memory_bytes: 1844
/* 
	Author: ankrypt
*/


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

ll A, B, T;

int main() {
	ll cnt = 0;
	scanf("%lld %lld %lld", &A, &B, &T);
	for(int i = A; i < T + 1; i += A) {
		cnt += B;
	}
	printf("%lld\n", cnt);

	
	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <deque>
#include <tuple>

using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl


//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) > (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    long long int n,tmp1,tmp2;
    scanf("%lld", &n);
    deque<tuple<long long int,long long int,long long int>> d(n);
    REP(i,n){
        scanf("%lld%lld", &tmp1, &tmp2);
        d.push_back(make_tuple(tmp1+tmp2,tmp1,tmp2));
    }
    long long int taka = 0,ao=0;
    sort(d.begin(), d.end());
    REP(i,n){
        if(1&i){
            ao += get<2>(d.back());
            d.pop_back();
        }else{  
            taka += get<1>(d.back());
            d.pop_back();
        }
    }
    cout << taka - ao << endl;
    return 0;
}


Measured memory_bytes: 5120
#include <bits/stdc++.h>
#define ll long long
#define ld long double 
#define For(i, a, n) for(long long i = a; (a < n) ? (i < n) : (i > n); (a < n) ? (i++) : (i--))
#define ee 1000000007
#define pb push_back
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
 
using namespace std;

void solve() {
    ll x;
    cin >> x;
    x == 1 ? cout << "0\n" : cout << "1\n";
}

int main() {
    fio;
    solve();
}

Measured memory_bytes: 3584
#include <iostream>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <float.h>
#include <limits>
#include <vector> 
#include <string.h>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define ll long long
#define asort(a) sort(a.begin(),a.end());

using namespace::std;

int jo(ll int jxo, ll int jyo){//累乗
	ll int jhogeo = 1;
	rep(jinto,0,jyo) jhogeo=jhogeo*jxo;
	return jhogeo;
}
char tobig(char toxbig){//char大文字化
  return (toxbig-0x20);
}
char tolow(char toxlow){//char小文字化
  return (toxlow+0x20);
}
int ctoi(char cctoi){//char->int
  if('0' <= cctoi && cctoi <= '9') return (cctoi-'0');
  return -1;
}
int gcd(int gcad, int gcbd) {//最大公約数
  if(gcad < gcbd) return gcd(gcbd, gcad);
  int gcrd;
  while ((gcrd=gcad%gcbd)) {
    gcad = gcbd;
    gcbd = gcrd;
  }
  return gcbd;
}
int lcm(int lcam, int lcbm){//最小公倍数
 return (lcam*lcbm)/gcd(lcam,lcbm);
}


int main(){
  int r,d,x;
  cin>>r>>d>>x;
  rep(i,1,11){
    x=r*x-d;
    cout<<x<<" ";
  }
  

}

// int *p = new int[N];

//  vector<int> 変数名(要素数);
//  sort(変数名.begin(),変数名.end());//昇順ソート

// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//


Measured memory_bytes: 256
from sys import stdin

def main():
    n,w = map(int, input().split())
    ary = [list(map(int, stdin.readline().split())) for _ in range(n)]
    xmax = sum([i[1] for i in ary])
    dp = [[float('inf')] * (xmax+1) for _ in range(n+1)]
    dp[0][0]= 0
    for i in range(n):
        for j in range(xmax+1):
            if j - ary[i][1] >= 0:
                dp[i+1][j] = min(dp[i+1][j] , dp[i][j-ary[i][1]] + ary[i][0])
            dp[i+1][j] = min(dp[i+1][j], dp[i][j])

    ans = 0
    for j in range(xmax+1):
        if dp[n][j] <= w:
            ans = j
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 309968
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1000000000
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

int dp[100];


ll prime_factorial_cnt(ll n, ll p){
    ll res = 0;
    ll pd = p;
    while(n >= p){
        res = res + n / p;
        printf("%lld\n", n / p);
        p *= pd;
    }

    return res;
}

int main(){
    cin >> dp[0];
    cout << dp[0] * M_PI * 2<< endl;

    return 0;
}

Measured memory_bytes: 3788
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int k= 1;
        HashMap<String,Integer> hashMap = new HashMap<>();
        hashMap.put("SUN",7);
        hashMap.put("MON",6);
        hashMap.put("TUE",5);
        hashMap.put("WED",4);
        hashMap.put("THU",3);
        hashMap.put("FRI",2);
        hashMap.put("SAT",1);
        String s1;
        String s2;
        int a,b;
        double n;
        while(k-->0){
            a=s.nextInt();
            s1=s.next();
            if(a<3200)
                System.out.println("red");
            else
                System.out.println(s1);
        }
    }

    private static int binary_search(
            int arr[], int l,
            int h, int x)
    {
        while (l <= h) {
            int mid = (l + h) / 2;
            if (arr[mid] <= x)
                l = mid + 1;
            else
                h = mid - 1;
        }
        return h;
    }
    static int gcd(int a, int b)
    {
        if(b==0) {
            return a;
        }
        return gcd(b,a%b);
    }
    private static boolean isPrime(int n) {
        if (n == 2)
            return true;
        else if ((n % 2 == 0 && n > 2) || n < 2)
            return false;
        else {
            for (int i = 3; i <= (int) Math.sqrt(n); i += 2) {
                if (n % i == 0)
                    return false;
            }
            return true;
        }


    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

}

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

int main() {
  long N;
  cin>>N;
  vector<long> a(N);
  for(int i=0;i<N;i++) cin>>a[i];
  long ans=1000, low=0, kabu=0;
  for(int i=0;i<N-1;i++){
    if(a[i+1]>a[i]){
      kabu=ans/a[i];
      ans-=ans/a[i]*a[i];
      ans+=kabu*a[i+1];
      kabu=0;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
#define FOR(i, m, n) for(int i = m;i < n;i++)
int MAX_N = 100000;
#define REP(i, n) for(int i = 0;i < n;i++)
int MAX_W = 100000;

int main(){
  string X;cin >>X;
  X[3] = '8';
  cout << X << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#define repp(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define repm(i,a,b) for(int i=(int)a;i>(int)b;--i)
using ll=long long;
static const ll mod = 1e9 + 7;
static const ll INF = 1LL << 50;
using namespace std;


int main() {
	//スターグラフにK本足すか、完全グラフからK本引く
	int n, k;
	cin >> n >> k;
	bool loop = true;
	if (k > (n - 1) * (n - 2) / 2) {
		cout << -1 << endl;
		return 0;
	}
	vector<pair<int, int>>v;
	repp(i, 1, n) {
		//ウニグラフを作る
		v.emplace_back(0, i);
	}int a = 1, b = 2;
	while (v.size() < (n - 1)*n / 2 - k) {
		v.emplace_back(a,b);
		++b;
		if (b == n) {
			++a;
			b = a + 1;
		}
	}cout << v.size() << endl;
	repp(i, 0, v.size()) {
		cout << v[i].first + 1 << " " << v[i].second + 1 << endl;
	}
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
template<class T>bool maxi(T &a,const T &b){if(a<b){ a=b; return 1;} return 0;}
template<class T>bool mini(T &a,const T &b){if(b<a){ a=b; return 1;} return 0;}
#define y0 y3487465 //j0
#define y1 y1347829 //j1
#define INF2 4000000000000000037
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;

void Main(){

  int N; cin>>N;

  int a[N+2];

  a[0]=0; a[N+1]=0;

  rep(i,N){
    cin>>a[i+1];
  }

  int ans=0;

  rep(i,N+1){
    ans+=abs(a[i]-a[i+1]);
  }

  rep(i,N){
    if((a[i]-a[i+1])*(a[i+1]-a[i+2])>=0){
      cout<< ans<<"\n";
    }
    else{
      cout<<ans-(2*min(abs(a[i+1]-a[i]),abs(a[i+1]-a[i+2])))<<"\n";
    }
  }
}

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


Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=100000000000000001;
struct edge{int to,cost;};
struct pos{
	int x,y,cost;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};

int main() {

	string s;
	cin>>s;
	if(s[2]==s[3]&&s[4]==s[5])cout<<"Yes"<<endl;
	else cout<<"No"<<endl;


	return 0;
}


Measured memory_bytes: 256
# coding: utf-8

A, B, K = map(int, input().split())

for i in range(K):
    if i % 2 == 0:
        if A % 2 != 0:
            A -= 1
        B += A // 2
        A = A // 2
    else:
        if B % 2 != 0:
            B -= 1
        A += B // 2
        B = B // 2
print(A, B)

Measured memory_bytes: 3060
//g++ -std=c++14 test.cpp -o test.out
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
using namespace std;

int N;
long long int a[1000];
long long int K;
long long int ans = 0;

vector<long long int> list;

void solve(){
	for(int i=0;i<N;i++){//a[i]を始点として
		for(int j=i;j<N;j++){//a[j]までを足し合わせる(a[j]含む)
			long long int sum = 0;
			for(int k=i;k<=j;k++){
				sum+=a[k];
			}
			list.push_back(sum);
		}
	}
	sort(list.begin(),list.end(),greater<long long int>());

	if(list[list.size()-1]==0 && list.size()<=K) return;

	for(int i=63;i>=0;i--){
		vector<long long int> new_list;
		for(int j=0;j<list.size();j++){
			if((list[j]>>i)&1ll){
				new_list.push_back(list[j]);
			}
		}
		if(new_list.size()>=K){
			list = new_list;
			if(new_list.size()==K) break;
		}
	}
	ans = ~ans;
	for(int j=0;j<list.size();j++){
		ans&=list[j];
	}
}

int main(){
	cin >> N >> K;
	for(int i=0;i<N;i++) cin >> a[i];

	solve();

	cout << ans;
	return 0;
}


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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  ll n;
  cin >> n;
  if (n % 2) {
    cout << 0 << endl;
    return 0;
  }

  // 10,20,30,40,50…にある5の数を数える
  ll ans = 0;
  for (ll i = 10; i <= n; i *= 5) {
    ans += n / i;
  }
  cout << ans << endl;
}


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

int main(){
    int n;
    string ans = "No";
    cin>>n;
    for(int i=1;i<=9;i++)
    {
      for(int j=1;j<=9;j++)
      {
        if(i*j==n)ans="Yes";
      }
    }
    cout <<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
class Dice:
    def __init__(self, dice):
        self.dice = dice
        self.face = {'head':1, 'tail':4, 'left':3, 'right':2, 'above':0, 'below':5}
    
    def roll(self, ch):
        dice = self.dice
        face = self.face
        if ch == 'S':
            tmp = dice[face['head']]
            dice[face['head']] = dice[face['above']]
            dice[face['above']] = dice[face['tail']]
            dice[face['tail']] = dice[face['below']]
            dice[face['below']] = tmp
        elif ch == 'N':
            tmp = dice[face['head']]
            dice[face['head']] = dice[face['below']]
            dice[face['below']] = dice[face['tail']]
            dice[face['tail']] = dice[face['above']]
            dice[face['above']] = tmp
        elif ch == 'W':
            tmp = dice[face['left']]
            dice[face['left']] = dice[face['above']]
            dice[face['above']] = dice[face['right']]
            dice[face['right']] = dice[face['below']]
            dice[face['below']] = tmp
        else:
            tmp = dice[face['left']]
            dice[face['left']] = dice[face['below']]
            dice[face['below']] = dice[face['right']]
            dice[face['right']] = dice[face['above']]
            dice[face['above']] = tmp

    def top(self):
        dice = self.dice
        face = self.face
        return dice[face['above']]
    
    def find_right(self, a, b):
        dice = self.dice
        face = self.face
        order = 'NNNNWNNNWNNNENNNENNNWNNN'
        for ch in order:
            self.roll(ch)
            if dice[face['above']] == a and dice[face['head']] == b:
                break
        return dice[face['right']]

    def equal(self, dice2):
        dice = self.dice
        dice2 = dice2.dice
        tag = False
        order = 'NNNNWNNNWNNNENNNENNNWNNN'
        for ch in order:
            self.roll(ch)
            flag = True
            for i in range(6):
                if dice[i] != dice2[i]:
                    flag = False
                    break
            if flag:
                tag = flag
                break
        return tag

dice = Dice([*map(int, input().split())])
dice2 = Dice([*map(int, input().split())])
print(['No','Yes'][dice.equal(dice2)])


Measured memory_bytes: 5620
#include <bits/stdc++.h>
using namespace std;
//cout << atan(1)*180/3.1415926535 << endl;
int main() {
double a,b,x;
  cin >> a >> b >> x;
  if(a * a * b == x){
  	cout << 0 << endl;
  }
  else{
    x = x/a;
    double c = 2*b-(2*x/a);
  	if(2*x/b <= a){
    	cout << fixed << setprecision(12) << 90-atan(2*x/b/b)*180/3.1415926535 << endl;
    }
    else{
    	cout << fixed << setprecision(12) << 90-atan(a/c)*180/3.1415926535 << endl;
    }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int cnt = 0;
    string S;
    cin >> S;
    for(auto c:S)if(c == 'o')cnt++;
    int rem = 15 - S.size();
    cnt += rem;
    if(cnt >= 8)cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
#define ll long long
#define pb push_back

using namespace std;

const int N=1e6+5;

int n,a[N],freq[N],mx;

bool prime[N];

int main()
{
    cin >> n;
    int gcd=0;
    for (int i=0; i<n; i++)
    {
        cin >> a[i];
        mx=max(mx,a[i]);
        gcd=__gcd(gcd,a[i]);
        for (ll j=2; j*j<=a[i]; j++)
        {
            if (a[i]%j==0)
            {
                freq[j]++;
                while(a[i]%j==0)
                {
                    a[i]/=j;
                }
            }
        }
        freq[a[i]]++;
    }
    if (*max_element(freq+2,freq+N)==1||mx==1)cout << "pairwise coprime\n";
    else if (gcd==1)cout << "setwise coprime\n";
    else cout << "not coprime\n";
    return 0;
}


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

int main() {
    int N,answer = 0;
    cin >> N;
    vector<int> d(N);
    vector<int> num(1000) ;
    for (int i = 0; i < N; i++){
        cin >> d.at(i);
    }
     for (int i = 0; i < 1000; i++)
    {
        num.at(i) = 0;
    } 
    for (int i = 0; i < N; i++)
    { 
        
        num.at(d.at(i))++;
    }
    
    for (int i = 1; i <= 100; i++)
    {
        if(num.at(i) > 0){
            answer++;
        }
        
    }
    
    cout << answer << endl;
    
}
    

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <climits>
#include <cassert>
#include <algorithm>
#include <utility>

using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<long long int>;
using VVI = vector<vector<long long int> >;

int main(void) {
    Int a, b, c;
    cin >> a >> b >> c;
    if (a == b && a != c) {
        cout << "Yes" << endl;
    }
    else if (b == c && b != a) {
        cout << "Yes" << endl;
    }
    else if (c == a && c != b) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3596
#41 A - Shrinking
import collections 
s = list(input())
cnt = collections.Counter(s)
valcnt = list(cnt.values())
M = max(valcnt)
# 出現回数が最多の文字リスト
mkeys = [i for i,v in cnt.items() if v == M]

ans = len(s)
for key in s:
    m = 0
    cnt = 0
    # 最多の文字の区間の最大値がその文字の最小値
    for S in s:
        if S == key: 
            m = max(m,cnt)
            cnt = 0
        else:
            cnt += 1
    m = max(m,cnt)
    ans = min(ans,m)
ans = min(ans,len(s)//2)
print(ans)

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

int main() {
  int A;//時間当たり料金
  int B;//定料金
  int N;//時間
  int x;//最安値
  
  cin >> N >> A >> B;
  
  if ( A * N <= B ){
    x = A * N;
  }
  
  else{
    x = B;
  }
  
  cout << x << endl;
  
  
  
  
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0

n=int(input())
s=list(input())
S = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
m=len(S)
for i in range(len(s)):
    tmp=S.index(s[i])
    tmp=(tmp+n)%m
    s[i]=S[tmp]
print(*s,sep="")


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

int main() {
  ll n, k, s;
  cin >> n >> k >> s;

  vector<ll> ans(n);
  rep(i, n) {
      if (i < k){
        ans[i] = s;
      }else{
        if (s == 1000000000){
          ans[i] = 999999999;
        } else {
        ans[i] = 1000000000;
        }
      }
  }

  rep(i, n) { cout << ans[i] << " "; }
  return 0;
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define INF 1000000000000000001
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main()
{
  ll N;
  cin >> N;
  cout << (N - 1) * 2 << endl;
  vector<ll> A(N);
  ll m = INF, m_ind = 0, M = -INF, M_ind = 0;
  for (ll i = 0; i < N; ++i)
  {
    cin >> A.at(i);
    if (A.at(i) < m)
    {
      m = A.at(i);
      m_ind = i;
    }
    if (A.at(i) > M)
    {
      M = A.at(i);
      M_ind = i;
    }
  }
  if (abs(M) >  abs(m))
  {
    for (ll i = 0; i < N; ++i)
    {
      if (M_ind == i)
      {
        continue;
      }
      cout << M_ind + 1 << ' ' << i + 1 << endl;
    }
    for (ll i = 0; i < N - 1; ++i)
    {
      cout << i + 1 << ' ' << i + 2 << endl;
    }
  }
  else
  {
    for (ll i = 0; i < N; ++i)
    {
      if (m_ind == i)
      {
        continue;
      }
      cout << m_ind + 1 << ' ' << i + 1 << endl;
    }
    for (ll i = N - 1; i > 0; --i)
    {
      cout << i + 1 << ' ' << i << endl;
    }
  }

}


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

signed main() {
    int mi = 1e9, ma = -1;
    for (int i = 0; i < 5; i++) {
        int a;
        cin >> a;
        mi = min(mi, a);
        ma = max(ma, a);
    }

    int k;
    cin >> k;

    cout << (ma - mi > k ? ":(" : "Yay!") << endl;
}


Measured memory_bytes: 256
import java.util.*;import java.io.*;import java.math.*;
public class Main
{
    public static void process()throws IOException
    {
        String s=nln();
        int sum=0;
        for(int i=0;i<s.length();i++)
            sum=(sum+s.charAt(i)-48)%9;
        if(sum==0)
            pn("Yes");
        else
            pn("No");
    }
    static long mod=(long)1e9+7l;
    static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        boolean oj = true;
        if(oj){sc=new AnotherReader();out=new PrintWriter(System.out);}
        else{sc=new AnotherReader(100);out=new PrintWriter("output.txt");}
        int t=1;
        // t=ni();
        while(t-- > 0) {process();}
        out.flush();out.close();  
    }

    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static int[] nai(int N)throws IOException{int[]A=new int[N];for(int i=0;i!=N;i++){A[i]=ni();}return A;}
    static long[] nal(int N)throws IOException{long[]A=new long[N];for(int i=0;i!=N;i++){A[i]=nl();}return A;}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}

/////////////////////////////////////////////////////////////////////////////////////////////////////////

    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}
   
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

Measured memory_bytes: 36572
#include<bits/stdc++.h>
#define mx 1000000007
#define ll long long int

using namespace std;

ll n,w;

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>> n >> w;
    ll arr[n+1][2]={0};
    for(ll i=1;i<=n;++i)
        cin>> arr[i][0] >> arr[i][1] ;
    ll dp[n+1][w+1]={0};
    memset(dp,0,sizeof(dp));
    for(ll i=1;i<=n;++i){
    	for(ll j=1;j<=w;++j){
    		if(arr[i][0]>j)
    			dp[i][j]=dp[i-1][j];
    		else
    			dp[i][j]=max(arr[i][1]+dp[i-1][j-arr[i][0] ],dp[i-1][j]) ;
    	}
    }
    cout<< dp[n][w] ;
	return 0;
}


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

int main(){
    int N,M,k,l;
    cin>>N>>M;
    vector<int>s(M),c(M);
    for(int i=0;i<M;i++){
        cin>>s.at(i)>>c.at(i);
    }
    bool flag = true,A=false,B=false,C=false;
    if (N == 1){
        k = 0;
        l = 10;
        A = true;
    }else if(N == 2){
        k = 10;
        l = 100;
        B = true;
    }else{
        k = 100;
        l = 1000;
        C = true;
    }
    
    for(int j=k;j<l;j++){
        flag = true;
        for(int i=0;i<M;i++){
            if(C){
                if(s.at(i)==1){
                    if(j/100!=c.at(i)){
                        flag = false;
                    }
                }else if(s.at(i)==2){
                        if(j/10-(j/100)*10!=c.at(i)){
                            flag = false;
                        }
                }else if(s.at(i)==3){
                        if(j%10!=c.at(i)){
                            flag = false;
                        }
                    }
            }else if(B){
                if(s.at(i)==1){
                    if(j/10!=c.at(i)){
                        flag = false;
                    }
                }else{
                    if(j%10!=c.at(i)){
                        flag = false;
                    }
                }
            }else if(A){
                if(s.at(i)==1){
                    if(j!=c.at(i)){
                        flag = false;
                    }
                }
            }
            }
        if(flag){
            cout<<j<<endl;
            break;
        }
    }
    
    if(!flag){
        cout<<-1<<endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int t,y,n;
  char c;
  int ty=0,h=0;
  while(cin>>t>>c>>y>>c>>n){
    if(t*t+y*y==n*n)ty++;
    if(t==y)h++;
  }
  cout<<ty<<"\n"<<h<<endl;
  return 0;
}

Measured memory_bytes: 1164
import scala.io.StdIn.{readLine,readInt}

object Main extends App {
  val n = (1 to readInt).toArray
  val m = readInt
  for(i <- 1 to m) {
    val h = readLine.split(",").map(_.toInt)
    val temp = n(h(0)-1)
    n(h(0)-1) = n(h(1)-1)
    n(h(1)-1) = temp
  }
  n.foreach(println)
}

Measured memory_bytes: 43748