akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
#define MOD 1000000007
#define eps 1e-8
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
//ifstream cinn("input.txt");ofstream coutt("output.txt");

signed main(){
    FASTER;
    string s;cin>>s;
    if(s[0]=='S'){
        cout<<"Cloudy";
    }else if(s[0]=='C'){
        cout<<"Rainy";
    }else{
        cout<<"Sunny";
    }
}



Measured memory_bytes: 256
import java.util.Scanner;

/**
 * 鈴木くんの参考 与えられた２つのサイコロが同じものかどうかを判定する
 * 
 * @author U633758
 *
 */
public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		Dice3 dc = new Dice3();
		Dice3 hikaku_dc = new Dice3();
		dc.dice(sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt());
		hikaku_dc.dice(sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt());

		if (dc.check(hikaku_dc)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		sc.close();// Scannerを閉じる
	}

}

/**
 * Dice3クラス ダイスの面に数字をインプットする。回転させたりする。
 * 
 * @author U633758
 *
 */
class Dice3 {
	private int T, S, E, W, N, U;

	Dice3() {
		this.T = 0; // Top
		this.S = 0;
		this.E = 0;
		this.W = 0;
		this.N = 0;
		this.U = 0; // Under
	}

	/**
	 * Diceに数字をインプットする
	 * 
	 * @param T_1
	 *            真上
	 * @param S_2
	 *            南
	 * @param E_3
	 *            東
	 * @param W_4
	 *            西
	 * @param N_5
	 *            北
	 * @param U_6
	 *            真下
	 */
	void dice(int T_1, int S_2, int E_3, int W_4, int N_5, int U_6) {
		this.T = T_1; // Top
		this.S = S_2;
		this.E = E_3;
		this.W = W_4;
		this.N = N_5;
		this.U = U_6; // Under
		// TODO 自動生成されたコンストラクター・スタブ
	}

	/**
	 * 南方向にサイコロを傾ける
	 */
	void MoveSouth() {
		int a = T;
		T = N;
		N = U;
		U = S;
		S = a;
	}

	void MoveEast() {
		int a = T;
		T = W;
		W = U;
		U = E;
		E = a;
	}

	void MoveNorth() {
		int a = T;
		T = S;
		S = U;
		U = N;
		N = a;
	}

	void MoveWest() {
		int a = T;
		T = E;
		E = U;
		U = W;
		W = a;
	}

	void right() {// 時計周りの回転
		int a = S;
		S = E;
		E = N;
		N = W;
		W = a;
	}

	/**
	 * 
	 * @param t
	 *            真上の数字（上面）
	 * @param f
	 *            南側の数字（前面）
	 * @return 東側（側面）の求めるべき数字
	 */
	int getRight(int t, int f) {
		for (int i = 0; i < 3; i++) {
			if (t == T) {
				break;
			}
			MoveNorth();
			if (t == T) {
				break;
			}
			MoveWest();
		}
		for (int i = 0; i < 3; i++) {
			if (f == S) {
				break;
			}
			right();
		}
		return E;
	}

	/**
	 * 引数と同じサイコロであるか判定する
	 * 
	 * @param hikaku
	 *            比較するサイコロ
	 * @return true:同じ false:異なる
	 */
	boolean check(Dice3 hikaku) {
		for (int i = 0; i < 4; i++) {
			if (checkAll(hikaku)) {
				break;
			}
			MoveNorth();
			for (int j = 0; j < 4; j++) {
				if (checkAll(hikaku)) {
					break;
				}
				right();
			}
		}

		for (int i = 0; i < 4; i++) {
			if (checkAll(hikaku)) {
				break;
			}
			MoveWest();
			for (int j = 0; j < 4; j++) {
				if (checkAll(hikaku)) {
					break;
				}
				right();
			}
		}
		if (checkAll(hikaku)) {
			return true;
		}
		return false;
	}

	boolean checkAll(Dice3 hikaku) {
		if (this.T == hikaku.T && this.S == hikaku.S && this.W == hikaku.W && this.E == hikaku.E && this.N == hikaku.N
				&& this.U == hikaku.U) {

			return true;
		}
		return false;
	}

}


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

class Main {
    public static void main(String[] args) {
        FastReader sc = new FastReader();
        int t = sc.nextInt();
        HashMap<String, Integer> hmap = new HashMap<>();
        while (t-- > 0) {
            String verdict = sc.next();
            hmap.put(verdict, hmap.getOrDefault(verdict, 0) + 1);
        }
        System.out.println("AC x " + (hmap.get("AC") == null ? 0 : hmap.get("AC")));
        System.out.println("WA x " + (hmap.get("WA") == null ? 0 : hmap.get("WA")));
        System.out.println("TLE x " + (hmap.get("TLE") == null ? 0 : hmap.get("TLE")));
        System.out.println("RE x " + (hmap.get("RE") == null ? 0 : hmap.get("RE")));
    }

    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: 49176
#include "bits/stdc++.h"
using namespace std;

typedef long long int ll;
const ll N = 1000010;

ll a1[N], b1[N], c1[N];

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

    for (int i = 1; i <= n; i ++) cin >> a1[i];

    ll x = 0, f = 0, c = 0;
    for (int i = 1; i <= n; i ++) {
        if (a1[i] % 2 == 0 && a1[i] % 4){
            c ++;
            continue;
        }
        if (a1[i] % 4) b1[x++] = a1[i];
        else c1[f++] = a1[i];
    }
    if (x == f && c > 0 && x == 0) cout << "Yes\n";
    else if (x == f+1 && c == 0) cout << "Yes\n";
    else if (x <= f && c >= 0) cout << "Yes\n";
    else cout << "No\n";

    //main();

    return 0;
}


Measured memory_bytes: 8832
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class Q088A
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数の入力
            long N = long.Parse(Console.ReadLine());
            long A = long.Parse(Console.ReadLine());

            string result = "No";
            if (A - (N - (N / 500)*500) >= 0)
            {
                result = "Yes";
            }

            Console.WriteLine(result);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
using namespace std;
 
int main() {
	int n,num;
	cin >> n;
	int array[n];
	for(int i=0; i < n; i++){
		cin >> num;
		array[i] = num ;
	}
	for(int k=n-1; k >= 0; k--){
		cout <<  array[k] ;
		if(k != 0)cout << " ";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3080
#include <iostream>
#include <string>

using namespace std;

int main(int argc, char const *argv[])
{
    string n; cin >> n;
    unsigned int m = 0;
    for(size_t i=0;i<n.length();++i) m = m * 10 + ((n[i]=='1')?9:1);
    cout << m << endl;

    return 0;
}


Measured memory_bytes: 256
import std.stdio, std.conv, std.string, std.algorithm,
       std.math, std.array, std.container, std.typecons;

void main() {
  long n, k;
  readf("%d %d\n", &n, &k);
  long[] p = readln.chomp.split.to!(long[]);
  long x = 0;
  for(long i=0; i<k; i++) {
    x += p[i];
  }
  long maxx = x;
  long maxxi = 0;
  for(long i=k; i<n; i++) {
    x = x-p[i-k]+p[i];
    if(x>maxx) {
      maxx=x;
      maxxi=i-k+1;
    }
  }
  double result = 0;
  for(long i=maxxi; i<maxxi+k; i++) {
    result += (p[i]+1)/2.0;
  }
  writef("%.15f\n", result);
}



Measured memory_bytes: 11560
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main() {
  int L, R, d, cnt = 0;
  cin >> L >> R >> d;
  FOR(i, L, R+1) {
    if (i % d == 0) {
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
#define sc(a) scanf("%d",&a)
#define scl(a) scanf("%lld",&a)
#define ll long long
#define pb push_back
#define mkp make_pair
#define inf 1e9
#define rn 100007
#define ppi pair<int,int>
#define mod 1000000007

int n,ara[100007],dp[100007];
int fun(int i)
{
    if(i>=n-1)return 0;
    if(dp[i]!=-1)return dp[i];
    int a=inf,b=inf;
    if(i+1<n)a=fun(i+1)+abs(ara[i+1]-ara[i]);
    if(i+2<n)b=fun(i+2)+abs(ara[i+2]-ara[i]);

    return dp[i]=min(a,b);
}
int main()
{
    cin>>n;
    memset(dp,-1,sizeof dp);
    for(int i=0;i<n;i++)
        cin>>ara[i];
    cout<<fun(0)<<endl;
}


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

int main(){
    int H, W;
    cin>>H>>W;
    int a[H][W];
    rep(i, H){
        rep(j, W){
            cin>>a[i][j];
        }
    }
    int b[W];
    rep(i, W){
        cin>>b[i];
    }
    int count=0;
    rep(i, H){
        count=0;
        rep(j, W){
            count+=a[i][j]*b[j];
        }
        cout<<count<<endl;
    }
}


Measured memory_bytes: 3128
n = int(input())
x_list = list(map(int,input().split()))

y_list = x_list.copy()
y_list.sort()

m1 = y_list[n//2-1]
m2 = y_list[n//2]

for x in x_list:
    if x <= m1:
        print(m2)
    else:
        print(m1)

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

int top, S[200];

int pop() {
	int number = S[top];
	top--;
	return number;
}

void push(int x) {
	top++;
	S[top] = x;
}


int main()
{
	top = 0;
	char a[200];
	while (scanf("%s", a)!=EOF) {
		if (a[0] == '+') {
			int a1 = pop();
			int a2 = pop();
			push(a1 + a2);
		}
		else if (a[0] == '-') {
			int a1 = pop();
			int a2 = pop();
			push(a2 - a1);
		}
		else if (a[0] == '*') {
			int a1 = pop();
			int a2 = pop();
			push(a1*a2);
		}
		else {
			push(atoi(a));
		}
		
	}
	printf("%d\n", pop());
    return 0;
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, n) for (ll i = 1; i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;

typedef vector<vector<int>> Graph;

Graph G;
vector<int> seen;
vector<int> d;

void dfs(int node, int value) {
    seen[node] = 1;
    d[node] = value;
    for (int to: G[node]) {
        if (seen[to] == 0)
            dfs(to, value);
    }
}

void Main()
{
    ll n, M;
    cin >> n >> M;

    vector<ll> A(M), B(M);
    rep(i, M) cin >> A[i] >> B[i];
    
    G.assign(n, vector<int>());
    seen.assign(n, 0);
    d.assign(n, 0);
    rep(i, M) {
        G[B[i]-1].push_back(A[i]-1);
        G[A[i]-1].push_back(B[i]-1);
    }

    rep (i, n) {
        if (seen[i] == 0) {
            dfs(i, i);
        }
    }

    vector<ll> cnt(n);
    rep(i, n) {
        cnt[d[i]]++;
    }

    put(*max_element(all(cnt)));
}
signed main(){ Main();return 0;}

Measured memory_bytes: 26692
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
#define double long double
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
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; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
#define eps 1e-12 
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N; cin >> N;
	int ans = 0;
	VI bit[22];
	REP(i, 22)bit[i].push_back(-1);
	REP(i, N) {
		int a; cin >> a;
		int j = 0;
		while (a) {
			if (a % 2)bit[j].push_back(i);
			a /= 2;
			j++;
		}
	}
	REP(i, 22)bit[i].push_back(INF);
	REP(R, N) {
		int L = -1;
		REP(i, 22) {
			auto it = LB(bit[i], R);
			//cout << *it << " ";
			if (*it > R) {
				it--;
			}
			if (it != bit[i].begin())it--;
			chmax(L, *it + 1);
			
		}
		//cout << endl;
		ans += R - L + 1;
		//cout << L << endl;
	}

	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 16068
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"

using namespace std;

const long long int MOD = 1000000007;
const long double EPS = 1e-9;

long long int N, M, K, H, W, L, R;

struct Edge {
	long long int to;
	long long int yen;
	long long int snuk;
};

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

	cin >> N >> M >> L >> R;
	vector<long long int>s(N + 1, MOD*MOD);
	vector<long long int>y(N + 1, MOD*MOD);
	vector<vector<Edge>>edge(N + 1);
	for (int i = 0; i < M; i++) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		edge[a].push_back({ b,c,d });
		edge[b].push_back({ a,c,d });
	}
	s[R] = 0;
	set<pair<long long int, int>>st;
	st.insert({ 0,R });
	while (!st.empty()) {
		auto c = *st.begin();
		st.erase(st.begin());
		if (s[c.second] < c.first)continue;
		for (auto i : edge[c.second]) {
			if (s[i.to] > s[c.second] + i.snuk) {
				s[i.to] = s[c.second] + i.snuk;
				st.insert({ s[i.to],i.to });
			}
		}
	}
	y[L] = 0;
	st.insert({ 0,L });
	while (!st.empty()) {
		auto c = *st.begin();
		st.erase(st.begin());
		if (y[c.second] < c.first)continue;
		for (auto i : edge[c.second]) {
			if (y[i.to] > y[c.second] + i.yen) {
				y[i.to] = y[c.second] + i.yen;
				st.insert({ y[i.to],i.to });
			}
		}
	}
	set<pair<long long int, int>>ans;
	for (int i = 1; i <= N; i++) {
		ans.insert({ y[i] + s[i],i });
	}
	for (int i = 1; i <= N; i++) {
		while ((*(ans.begin())).second < i) {
			ans.erase(ans.begin());
		}
		cout << 1000000000000000 - (*ans.begin()).first << endl;
	}
	return 0;
}


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

using namespace std;

typedef long long ll;

template<typename T> ostream& operator << (ostream& os, vector<T> v) {
  for (auto& i : v) os << i << " "; return os; 
}
template<typename T> istream& operator >> (istream& is, vector<T>& v) {
  for (auto& i : v) is >> i; return is;
}
template<typename T> inline bool chmin(T& x, T y) {
  if (x > y) {
    x = y;
    return true;
  }
  return false;
}
template<typename T> inline bool chmax(T& x, T y) {
  if (x < y) {
    x = y;
    return true;
  }
  return false;
}

int dfs(vector<vector<int>>& G, vector<int>& dp, int v) {
  if (dp[v] != -1) {
    return dp[v];
  }
  int res = 0;
  for (auto& nv: G[v]) {
    chmax(res, dfs(G, dp, nv) + 1);
  }
  dp[v] = res;
  return dp[v];
}

int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> G(n, vector<int>());
  for (int i=0; i<m; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    G[x].push_back(y);
  }
  vector<int> dp(n);
  for (int i=0; i<n; i++) {
    dp[i] = -1;
  }
  int res = 0;
  for (int i=0; i<n; i++) {
    chmax(res, dfs(G, dp, i));
  }
  cout << res;
  return 0;
}


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

using namespace std;

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

ll q, qi, A, B;

ll get(ll cnt, ll x) {
    ll p1 = x;
    ll p2 = cnt - x + 1;

    if (p1 >= A) p1++;
    if (p2 >= B) p2++;

    return p1 * p2;
}

bool check(ll cnt) {
    ll lo, hi, mid, p1, p2;

    mid = (1 + cnt) / 2;
    lo = max(1LL, mid - 30);
    hi = min(cnt, mid + 30);
    for (ll i = lo; i <= hi; i++)
        if (get(cnt, i) >= A * B) return false;

    return true;


    lo = 1;
    hi = cnt;
    while (lo < hi) {
        mid = (lo + hi) >> 1;

        if (get(cnt, mid) <= get(cnt, mid + 1))
            lo = mid + 1;
        else
            hi = mid;
    }

    return (get(cnt, lo) < A * B);
}

ll solve() {
    ll ans = min(A, B) - 1;
    ll limit = 4LL * max(A, B) - 1;

    for (ll step = 1LL << 40; step > 0; step >>= 1) {
        if (ans + step > limit) continue;
        if (check(ans + step)) ans += step;
    }

    //for (ll i = 1; i <= ans; i++)
    //    cerr << get(ans, i) << ' ';

    return ans;
}

int main()
{
 //   freopen("test.in","r",stdin);

    scanf("%lld", &q);
    for (qi = 1; qi <= q; qi++) {
        scanf("%lld%lld", &A, &B);
        printf("%lld\n", solve());
    }


    return 0;
}


Measured memory_bytes: 256
//??¨?¨????????????°??????
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br =
				new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();

		
		//???????????????????????????????????°??¨?????°?????\???
		String[] matrixStr = br.readLine().split(" ");		//??????????????°??¨?????°?????\??????matrixStr
		int rowNum = Integer.parseInt(matrixStr[0]);		//?????°rowNum
		int colNum = Integer.parseInt(matrixStr[1]);		//?????°colNum
		int[][] resultArray = new int[rowNum+1][colNum+1];
		int lastNum = 0;
		
		//?????????????´??????????
		for(int i=0; i<rowNum; i++) {						//?????°rowNum?????°??????
			String[] inputStr = br.readLine().split(" ");	//????´?????????????inputStr
		
			for(int j=0; j<colNum; j++) {					//??????????´???????
				resultArray[i][j] = Integer.parseInt(inputStr[j]);
				resultArray[i][colNum] = resultArray[i][colNum] + resultArray[i][j];
					sb.append(resultArray[i][j] + " ");		//
			}
			sb.append(resultArray[i][colNum] + "\n");
		}
		
		for(int j=0; j<colNum; j++) {
			for(int i=0; i<rowNum; i++) {
				resultArray[rowNum][j] = resultArray[rowNum][j] + resultArray[i][j];
			}

				sb.append(resultArray[rowNum][j] + " ");

			lastNum = lastNum + resultArray[rowNum][j];
		}
			sb.append(lastNum + "\n");
			System.out.print(sb.toString());
	}

}

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

int main(){
    int a,b,k;
    cin >> a >> b >> k;
    int res = 0;
  	int s = min(a,b);
    for(int i = s;i > 0;i--){
        if(a % i == 0 && b % i == 0){
            res++;
        }
        if(res == k){
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <unordered_map>
#include <unordered_set>
using namespace std;

#define ABS(a) (((a) >= 0) ? (a) : -(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define NINTH_POWER_OF_TEN 1000000000
#define LL_INF (numeric_limits<long long>::max()/2)
#define int long long

typedef long long ll;
typedef pair<int, int> Pair;

const int kMaxN = 200000;
const int kMaxM = 200000;

int N, M;
string s;
int a[kMaxM], b[kMaxM];
string ans;

vector<int> es[kMaxN];
int acnt[kMaxN];
int bcnt[kMaxN];
bool remain[kMaxN];

void Bfs(int i) {
  if (!remain[i]) { return; }
  if (acnt[i] > 0 && bcnt[i] > 0) { return; }

  remain[i] = false;
  REP(j, es[i].size()) {
    if (s[i] == 'A') {
      --acnt[es[i][j]];
    } else {
      --bcnt[es[i][j]];
    }
  }
  REP(j, es[i].size()) {
    Bfs(es[i][j]);
  }
}

signed main() {
  cin >> N >> M;
  cin >> s;
  REP(i, M) { cin >> a[i] >> b[i]; }

  REP(i, M) { --a[i]; --b[i]; }

  REP(i, M) {
    if (a[i] != b[i]) {
      es[a[i]].push_back(b[i]);
      if (s[b[i]] == 'A') {
        ++acnt[a[i]];
      } else {
        ++bcnt[a[i]];
      }
      es[b[i]].push_back(a[i]);
      if (s[a[i]] == 'A') {
        ++acnt[b[i]];
      } else {
        ++bcnt[b[i]];
      }
    } else {
      if (s[a[i]] == 'A') {
        ++acnt[a[i]];
      } else {
        ++bcnt[a[i]];
      }
    }
  }
  REP(i, N) { remain[i] = true; }

  REP(i, N) {
    if (!remain[i]) { continue; }
    Bfs(i);
  }

  ans = "No";
  REP(i, N) {
    if (remain[i]) { ans = "Yes"; break; }
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 20612
N,K=list(map(int,input().split()))
dic = {}

for x in input().split():
    dic[x] = dic.get(x,0) + 1

sort_d = sorted(dic.values())

ans = 0
el = len(dic) -K
for i,x in enumerate(sort_d):
    if i >= el:
        break
    else:
        ans += x
print(ans)

Measured memory_bytes: 35616
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
	string s;
	cin>>s;
	int aw=0;
	for (int i=0;i<s.size();i++){
		if (s[i]=='1'){
			aw++;
		}
	}
	cout<<aw<<endl;
	return 0;
}

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

using ll = long long;
using ull = unsigned long long;

#define MOD 1000000007

int main(void) {
    ll W, H, N;
    ll w[2], h[2];
    ll count = 0;
    cin >> W >> H >> N;
    w[0] = 0;
    w[1] = W;
    h[0] = 0;
    h[1] = H;
    for(ll i = 0;i < N;i++) {
        ll x, y, a;
        cin >> x >> y >> a;
        if(a == 1) {
            w[0] = max(w[0], x);
        } else if(a == 2) {
            w[1] = min(w[1], x);
        } else if(a == 3) {
            h[0] = max(h[0], y);
        } else {
            h[1] = min(h[1], y);
        }
    }
    cout << max(0LL, w[1] - w[0]) * max(0LL, h[1] - h[0]) << endl;
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys


def merge(_array, left, mid, right):
    count = 0
    array_left = _array[left:mid] + [1e9 + 1]
    array_right = _array[mid:right] + [1e9 + 1]
    left_length, right_length = mid - left, right - mid

    i, j = 0, 0

    for k in range(left, right):
        if array_left[i] <= array_right[j]:
            _array[k] = array_left[i]
            i += 1
        else:
            _array[k] = array_right[j]
            j += 1
            count += left_length - i
    return count


def merge_sort(_array, left, right):
    if left + 1 < right:
        mid = (left + right) // 2
        c1 = merge_sort(_array, left, mid)
        c2 = merge_sort(_array, mid, right)
        c3 = merge(_array, left, mid, right)
        return c1 + c2 + c3
    else:
        return 0


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    array_length = int(_input[0])
    array = list(map(int, _input[1].split()))
    # count = 0

    ans = merge_sort(array, 0, array_length)
    print(ans)

Measured memory_bytes: 31724
#include<bits/stdc++.h>
#define LL long long
LL n,cnt;
int judge(LL k,LL m){
	while(m>=k){
		if(m%k==0)m/=k;
		else m%=k;
	}
	if(m==1)return 1;
	else return 0;
}
int main(){
	LL i;
	scanf("%lld",&n);
	if(n==2){printf("1\n");return 0;}
	for(i=2;i*i<=n-1;i++)
		if((n-1)%i==0){
			cnt++;
			if(i!=(n-1)/i)cnt++;
		}
	cnt++;
	for(i=2;i*i<=n;i++)
		if(n%i==0){
			if(judge(i,n))cnt++;
			if(i!=n/i&&judge(n/i,n))cnt++;
		}
	cnt++;
	printf("%lld\n",cnt);
	return 0;
} 

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

int main() {
    int h,w,k,ans=0;
    cin>>h>>w>>k;
    char mp[h][w];
    rep(i,0,h){
        rep(j,0,w){
            cin>>mp[i][j];
        }
    }
    rep(i,0,(1<<h)){
        rep(j,0,(1<<w)){
            int tmp=0;
            rep(k,0,h){
                if(i&(1<<k)){
                    rep(l,0,w){
                        if(j&(1<<l)){
                            if(mp[k][l]=='#')
                                tmp++;
                        }
                    }
                }
            }
            if(tmp==k)
                ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3632
n, k = map(int, input().split())

def renzoku(count, i):
    if i >= k:
        return count
    else:
        i = i * 2
        count += 1
        return renzoku(count, i)

ans = 0
for i in range(1, n+1):    
    count = renzoku(0, i)
    prob = (1/n) * ((1/2) ** count)
    ans += prob
print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<vector>
using namespace std;
int total(int a, int b) {
	int c = 0;
	for (int i = 0; i < b + 1; i++) {
		c += a + i;
	}
	return 0;
}
#define rep(i,n) for(int i=0;i<n;i++)
#define vint(abc,n) vector<int> abc(n);
#define vcha(abc,n) vector<char> abc(n);
#define pi 3.14159265358979323846264338;
int main() {
	int w, h, x, y, r;
	cin >> w >> h >> x >> y >> r;
	int a = x - r, b = x + r, c = y - r, d = y + r;
	if (a >= 0 && b <= w && c >= 0 && d <= h) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 3100
s = input()
t = input()

ans = 0
for i in range(len(s) - len(t) + 1):
    cnt = 0
    for check_t, work in zip(t, s[i:i+len(t)]):
        if check_t == work:
            cnt+=1
    ans = max(ans, cnt)
print(len(t) - ans)

Measured memory_bytes: 9052
#include<iostream>
#include<algorithm>
#include<cassert>
#include<vector>
#include<fstream>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<queue>
#include<map>
#include<set>
#include<bitset>
#include<cmath>

using namespace std;
#define REP(i,m,n) for(int i=m;i<n;++i)
#define REPll(i,m,n) for(ll i=m;i<n;++i)
#define INF 10000000000000000
#define MOD 1000000007
#define ll long long
#define mp make_pair
#define all(v) v.begin(),v.end()

vector<int>v;

int main() {
	int a, b, c, aa, bb, cc, aaa, bbb, ccc;
	cin >> a >> b >> c >> aa >> bb >> cc >> aaa >> bbb >> ccc;
	if (aa - a == bb - b&&bb - b == cc - c&&aaa - a == bbb - b&&bbb - b == ccc - c&&b - a == bb - aa&&bbb - aaa == b - a&&ccc - aaa == c - a&&cc - aa == c - a) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}
	return 0;
}

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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define fin(ans) cout << (ans) << endl;
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef long long lli;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<ll> vll;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<ll, str>> vpls;
typedef vector<tuple<str, ll, ll>> vtsl;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

//実行部
void Main()
{
  str flag = "snuke";
  ll h, w; cin >> h >> w;
  rep(i, h)
  {
    rep(j, w)
    {
      str s; cin >> s;
      if(s == flag)
      {
        cout << (char)(j + 'A') << i + 1 << endl;
        return;
      }
    }
  }
  return;
}

//前処理
int main()
{
  //ios::sync_with_stdio(false);
  //cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}


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

#ifdef LOCAL
#include "debug.h"
#else
#define DEBUG(...)
#endif

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> f(n + 1, 1);
  for (int i = 1; i <= n; ++i) {
    f[i] = f[i - 1] * i;
  }
  auto p2i = [&](auto&& p) {
    int res = 0;
    for (int i = 0; i < n; ++i) {
      for (int j = i + 1; j < n; ++j) {
        if (p[i] > p[j]) {
          res += f[n - i - 1];
        }
      }
    }
    return res;
  };
  auto i2p = [&](int id) {
    vector<int> p(n), used(n);
    for (int i = 0; i < n; ++i) {
      while (used[p[i]]) {
        ++p[i];
      }
      while (id >= f[n - i - 1]) {
        ++p[i];
        while (used[p[i]]) {
          ++p[i];
        }
        id -= f[n - i - 1];
      }
      used[p[i]] = 1;
    }
    return p;
  };
  vector<int> d(f[n], -1);
  queue<int> que;
  d[0] = 0;
  que.push(0);
  while (not que.empty()) {
    int i = que.front();
    que.pop();
    if (d[i] == n / 2) continue;
    for (int r = 2; r <= n; ++r) {
      for (int l = 0; l + 2 <= r; ++l) {
        auto p = i2p(i);
        reverse(begin(p) + l, begin(p) + r);
        int j = p2i(p);
        if (d[j] == -1) {
          d[j] = d[i] + 1;
          que.push(j);
        }
      }
    }
  }
  vector<int> a(n);
  for (auto&& e : a) cin >> e, --e;
  vector<int> ia(n);
  for (int i = 0; i < n; ++i) {
    ia[a[i]] = i;
  }
  int id = p2i(a);
  if (d[id] != -1) {
    cout << d[id] << '\n';
  } else {
    int res = n;
    for (id = 0; id < f[n]; ++id) {
      if (d[id] != n / 2) continue;
      auto p = i2p(id);
      vector<int> c(n);
      for (int i = 0; i < n; ++i) {
        c[i] = p[ia[i]];
      }
      int j = p2i(c);
      if (d[j] != -1) {
        res = min(res, n / 2 + d[j]);
      }
    }
    cout << res << '\n';
  }
}



Measured memory_bytes: 21380
N = int(input())
A = list(map(int, input().split()))

# x1さえ求めてしまえば連立方程式の解は連鎖的にO(N)で求まる
X = list()
x_1 = sum(A)
for i in range(N):
    if i % 2 != 0:
        x_1 -= 2 * A[i]
X.append(x_1)

for i in range(1, N):
    x_i = 2 * A[i - 1] - X[i - 1]
    X.append(x_i)
print(' '.join([str(x) for x in X]))

Measured memory_bytes: 19088
fn read_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_owned()
}

fn reads<T>() -> Vec<T>
where
    T: std::str::FromStr,
    <T as std::str::FromStr>::Err: std::fmt::Debug,
{
    read_line()
        .split_whitespace()
        .map(|w| w.parse().unwrap())
        .collect()
}

fn main() {
    let q: usize = reads()[0];

    for _ in 0..q {
        let (a, b) = {
            let mut t: Vec<i64> = reads();
            // t.sort();
            (t[0], t[1])
        };

        let c = a * b;
        let sqc = (c as f64).sqrt() as i64;

        let ans = if a == b {
            sqc * 2 - 2
        } else if sqc * sqc == c {
            sqc * 2 - 3
        } else if sqc * (sqc + 1) >= c {
            sqc * 2 - 2
        } else {
            sqc * 2 - 1
        };

        println!("{}", ans);
    }
}


Measured memory_bytes: 4352
#include<stdio.h>
int main(){
    //int i;
    char moji;
    scanf("%c", &moji);
    /* アルファベットの小文字か大文字かを判定 */
    if((moji>= 'a') && (moji<='z')){
        printf("a\n");
    }
    else if((moji>= 'A') && (moji<='Z')){
        printf("A\n");
    }
    return 0;
}

Measured memory_bytes: 1584
# N = gets.chomp.to_i
# A, B, C = gets.chomp.split.map(&:to_i)
S = gets.chomp

case S
when 'SUN'
  p 7
when 'MON'
  p 6
when 'TUE' 
  p 5
when 'WED'
  p 4
when 'THU'
  p 3
when 'FRI'
  p 2
when 'SAT'
  p 1
end


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e18L +5;

ll sum(int a,int b,int arr[]){
    ll s =0;
    for(int i=a;i<=b;i++)
        s += arr[i];
        
    return s;    
}

int main()
{
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++)
    cin>>arr[i];
    
    
    ll dp[n+1][n+1];
    memset(dp,0,sizeof dp);
    
    for(int i = n-1;i>=0;i--){
        for(int j = i;j<n;j++){
            if( i == j)
            dp[i][j] = 0;
            else{
                dp[i][j] = INF;
                ll s = sum(i,j,arr);
                for(int k = i;k<j;k++){
                    dp[i][j] = min(dp[i][j],dp[i][k] + dp[k+1][j] + s);
                }
                
            }
        }
    }
    cout<<dp[0][n-1];
}

Measured memory_bytes: 1536
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
#include<set>
using namespace std;


const long long int mod=1000000007;
const long long int INF=99999999999999999;

long long int a,b,c;

int main() {
    cin>>a>>b>>c;
	long long int t=0;
	while(t<=3600){
		if(t/60==(a+t)/60&&t%60<=c&&c<=(a+t)%60||t/60!=(a+t)/60&&t%60<=c&&c<=59){
			cout<<t/60*60+c<<endl;
			return 0;
		}else if(t/60!=(a+t)/60&&1<=c&&c<=(a+t)%60){
			cout<<(t+60)/60*60+c<<endl;
			return 0;
		}
		t+=a+b;
	}
	cout<<-1<<endl;
} 



Measured memory_bytes: 3108
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;

int main(){
    int n, s[1000];
    double m, p, sum;
    
    while(1){
        scanf("%d", &n);
        sum = p = 0;
        if(n == 0) break;
        for(int i = 0; i < n; i++){
            scanf("%d", &s[i]);
            sum += s[i];
        }
        m = sum / n;
        for(int i = 0; i < n; i++){
            p += (s[i] - m) * (s[i] - m);
        }
        printf("%.8lf\n", sqrt(p/n));
    }
    return 0;
}


Measured memory_bytes: 3148
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
import decimal


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [Scanner.string() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [Scanner.int() for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True

    @staticmethod
    def fact(N):
        res = {}
        tmp = N
        for i in range(2, int(N ** 0.5 + 1) + 1):
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            if cnt > 0:
                res[i] = cnt
        if tmp != 1:
            res[tmp] = 1
        if res == {}:
            res[N] = 1
        return res


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


MOD = int(1e09) + 7
INF = int(1e15)


def solve():
    N = Scanner.int()
    A = Scanner.map_int()
    memo = defaultdict(int)

    ans = 0
    for i in range(N):
        memo[A[i] + i + 1] += 1
    for i in range(N):
        ans += memo[-A[i] + (i + 1)]
    print(ans)


def main():
    # sys.stdin = open("sample.txt")
    # T = Scanner.int()
    # for _ in range(T):
    #     solve()
    # print('YNeos'[not solve()::2])
    solve()


if __name__ == "__main__":
    main()


Measured memory_bytes: 137532
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n;
  cin >> n;
  vector<int>a(n+1);
  vector<int>b(n);
  for(int i=0;i<=n;i++){
    cin >> a.at(i);
  }
  for(int i=0;i<n;i++){
    cin >> b.at(i);
  }
  long long ans=0;
  for(int i=0;i<n;i++){
    if(a.at(i)>=b.at(i)){
      ans+=b.at(i);
      a.at(i)-=b.at(i);
      b.at(i)=0;
    }
    else if(a.at(i)<b.at(i)){
      ans+=a.at(i);
      b.at(i)-=a.at(i);
      a.at(i)=0;
    }
    if(b.at(i)>a.at(i+1)){
      ans+=a.at(i+1);
      a.at(i+1)=0;
    }
    if(b.at(i)>0&&b.at(i)<=a.at(i+1)){
      ans+=b.at(i);
      a.at(i+1)-=b.at(i);
    }
  }
  cout << ans << endl;
}
      

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n1) for(int i=0;i<n1;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define yesno(flg) if(flg){cout<<'YES'<<endl;}else{cout<<'NO'<<endl;}
#define vi vector<int>
#define pb push_back
#define i197 1000000007
#define MAX_N 200002
#define PI 3.141592653589793
using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<Pii,int> Piii;
typedef pair<int,ll> Pil;
typedef pair<ll,ll> Pll;
typedef pair<string,int> Psi;
typedef pair<Psi,int> Psii;

const ll inf=1000000007;
struct edge{
	int myc,to,c,cost;
};
struct pos{
	int to,cost,color;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

vector<Pii> v[100001];
ll dp[300000][60]={};
ll dp2[300000][60]={};
int main() {
	ll a,b,k;
	cin>>a>>b>>k;
	if(a>=k){
		a-=k;
	}else if((a+b)>=k){
		b=a+b-k;
		a=0;
	}else{
		a=0;
		b=0;
	}

	cout<<a<<" "<<b;
	return 0;
}


Measured memory_bytes: 3328
#include<stdio.h>

int main(void)
{
	int am, pm, sum[6];
	int shopnam, i, temp;
	char shop[5];
	shop[0] = 'A';
	shop[1] = 'B';
	shop[2] = 'C';
	shop[3] = 'D';
	shop[4] = 'E';
	
	while(scanf("%d %d",&am,&pm))
	{
		if(am==0&&pm==0)
			break;
		else
		{
			sum[0] = am+pm;
			for(i=1;i<5;i++)
			{
				scanf("%d %d",&am,&pm);
				sum[i] = am+pm;
			}
			temp = 0;
			for(i=0;i<5;i++)
			{
				if(temp<sum[i])
				{
					temp = sum[i];
					shopnam = i;
				}
			}
			printf("%c %d\n",shop[shopnam],temp);
		}
	}
	return 0;
}

Measured memory_bytes: 600
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

  int a,b;
  cin >> a >> b;

  int sum = 0;
  rep(i,2)
  {
    if(a > b)
    {
      sum += a;
      a--;
    }
    else
    {
      sum += b;
      b--;
    }
  }

  cout << sum;

  return 0;
}

// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
#define loop(i,a,b) for(int i = a ; i < b ; i++)
#define rep(i,a) for(int i = 0 ; i < a ; i++) 

bool maze[8][8];

bool inmaze(int x,int y){
  return (0<=x && x<8) && (0<=y && y<8);
}

int dfs(int x,int y){
  if(!inmaze(x,y))return 0;
  maze[x][y] = false;
  int cnt = 0;
  loop(i,-3,4){
    if(maze[x+i][y]){
      dfs(x+i,y);
    }
    if(maze[x][y+i]){
      dfs(x,y+i);
    }
  }
    
}
int main(void){
  int n;
  cin>>n;
  rep(k,n){
    string s;
    rep(i,8){
      cin>>s;
      rep(j,8)maze[i][j] = s[j] - '0';
    }
    int x,y;
    cin>>x>>y;
    dfs(--y,--x);
    if(k)cout<<endl;
    cout<<"Data "<<k+1<<":"<<endl;
    rep(i,8){
      if(i)cout<<endl;
      rep(j,8)cout<<maze[i][j];   
    }
  }
  cout<<endl;
}

Measured memory_bytes: 1208
#include<bits/stdc++.h>				//Written by ThiDaiLoc
using namespace std;				//Team Three Wolves
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> triple;

#define fu(i,a,b)   for(ll i=a;i<=b;i++)
#define fd(i,b,a)   for(ll i=b;i>=a;i--)
#define fuv(i,a)    for(ll i=0;i<a.size();i++)
#define fdv(i,a)    for(ll i=(ll)a.size()-1;i>=0;i--)
#define ms(a,x)     memset(a, x, sizeof a)
#define prec(n)     fixed<<setprecision(n)
#define uni(a)      (a).erase(unique(all(a)), (a).end())
#define pb(i)       push_back(i)
#define popb()      pop_back()
#define sc(a)       cin>>a
#define sc2(a,b)    cin>>a>>b
#define pr(a)       cout<<a<<endl
#define pr2(a)      cout<<a<<" "
#define bit(n,i)    (((n)>>(i))&1)
#define lowb(a,n,x) lower_bound(a,a+n,x) -a
#define lowb2(a,x)  lower_bound(all(a),x) -a.begin()
#define all(x)      (x).begin(), (x).end()
#define sz(a)       (ll)a.size()
#define le(s)       (ll)s.length()		
#define ast(x,a,b)  assert(x>=a and x<=b)				
#define re          return 	
#define	mp(a,b)     make_pair(a,b)
#define se          second
#define fi          first 
#define debug(x)    cerr << #x << " = " << x << endl
#define INPUT       freopen("locin.txt", "r", stdin)
#define OUTPUT      freopen("locout.txt", "w", stdout)
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline ll minize(ll& a,ll b){return a=(a>b?b:a);}
inline ll maxize(ll& a,ll b){return a=(a<b?b:a);}
inline string toString(ll n) {stringstream ss; ss << n;return ss.str();}
double const eps = 1e-6;
ll const Base=1e9+7,oo=1e17,MAXN=1e6;


ll A[MAXN+5];

ll Solves(){
	
	ll n,m,k,cnt=0,ans=0,x,y,q,c,sum=0,v,t;
	// PROCESS IN HERE
	cin>>n>>m>>t;
	fu(i,1,t){
		if(sum+n>t)break;
		ans+=m;
		sum+=n;
	}
	pr(ans);


	re 0;
	// Hack it if you can :)
}

int main(){
	//INPUT;
	ll JUDGE_ONLINE = 1;
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll test=1;
//	sc(test);
	fu(T,1,test){
//		cout<<"Case #"<<T<<": ";
		Solves();
	}
	if (!JUDGE_ONLINE) cout << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";  
		
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define sz(x) (int)x.size()
#define pb push_back
#define mp make_pair
#define ll long long 
#define mod 1000000007
void setIO(string name) {
  ios_base::sync_with_stdio(0); cin.tie(0);
  freopen((name+".in").c_str(),"r",stdin);
  freopen((name+".out").c_str(),"w",stdout);
}
void fast(){
  ios_base::sync_with_stdio(false);cin.tie(NULL);
}


int main() {
   fast(); 
   string s;
   cin>>s;
   int sum=0;
   for(int i=0;i<s.length();i++){
      sum+=(int)(s[i]-48);
   }
   if(sum%9==0){
    cout<<"Yes"<<"\n";
   }else{
    cout<<"No"<<"\n";
   }
   

} 

Measured memory_bytes: 3784
s = input()
t = input()
ls=len(s)
lt=len(t)

#sの文字数行*tの文字数列のDP
dp=[[0]*(lt+1) for _ in range(ls+1)]

for i in range(1,ls+1):
    for j in range(1,lt+1):
        if s[i-1]==t[j-1]:
        # sとtの見た文字が一致
        # →sとtの双方の1個前までの共通最大連続数に+1追加
            dp[i][j]=dp[i-1][j-1]+1
        else:
        # 一致しないとき
        # sの1個前までか、tの1個前の共通最大連続数の
        # 大きいほうを採用
            dp[i][j]=max(dp[i-1][j],dp[i][j-1])

# 復元はs,tとも後ろから見ていく
ans = ''
i=ls
j=lt
while i != 0 and j != 0:
    if dp[i][j] == dp[i-1][j]:
        # DP上でsの一個前から更新されてない
        # 即ちs[i-1]は共通列に入ってない
        i -= 1
    elif dp[i][j] == dp[i][j-1]:
        # 上と同じ論法でtの場合
        j -= 1
    else:
        # 今見ているs[i-1]とt[j-1]が共通になっているとき
        # 答えに採用（s[i-1]は頭につける）
        ans = s[i-1] + ans 
        i -= 1
        j -= 1
        
print(ans)

Measured memory_bytes: 112220
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
string s;
int main(){
std::ios::sync_with_stdio(false);std::cin.tie(0);
 cin>>s;
 if(s=="AAA"||s=="BBB") cout<<"No"<<'\n';
 else cout<<"Yes"<<'\n';
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<ll>
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(),x.end()
#define vll vector<ll>
#define M 3011

long double a[M];
long double dp[M][M];
long double  f(ll x,ll h,ll n){
	if(h<0)return 0;
	if(h>x)return 0;
	if(x==1){
		if(h==1)return a[1];
		else return (1-a[1]);
	}
	if(dp[x][h]!=-1)return dp[x][h];
	long double ans=0.0;
	ans=f(x-1,h-1,n)*a[x];ans+=(f(x-1,h,n)*(1-a[x]));
	dp[x][h]=ans;
	return ans;
}


int main()
{

    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	ll t,i,j,m,x,y,n,z,p,k,T;string s1,s2,s3;x=1;
	cin>>n;
	for(i=1;i<=n;++i)cin>>a[i],a[i]=a[i];
	for(i=0;i<=n;++i)for(j=0;j<=n;++j)dp[i][j]=-1;
	long double ans=0;
	for(i=0;i<=n;++i){
		if(n-i<i){
			ans+=f(n,i,n);
		}

	}cout<<setprecision(14)<<ans<<"\n";;









	
	return 0;
}

Measured memory_bytes: 141824
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;

vector<string>sts{

"mon"
,"tue"
, "wed"
, "thu"
, "fri"
, "sat"
, "sun"
};

int main() {	
	int a,b;cin>>a>>b;
	int N;cin>>N;
	vector<int>oks(1010);
	for (int i = 0; i < N; ++i) {
		int l,r;cin>>l>>r;
		for (int j = l; j < r; ++j) {
			oks[j]=true;
		}
	}
	bool ans=true;
	for (int j = a; j < b; ++j) {
		if(oks[j])ans=false;
	}
	if (ans) {
		cout<<0<<endl;
	}
	else {
		cout<<1<<endl;
	}
}

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

int main()
{
  int n, k; cin>>n>>k;
  vector<ll> a(n, 0);
  rep(i, n) cin>>a[i];
  ll nin = 1LL<<60;
  rep(bits, 1<<(n-1)) {
    ll bef = a[0];
    ll cost = 0;
    int nk = 1;
    for (int i=1; i<n; i++) {
      if (bits>>(i-1)&1) {
        cost += max(0LL, bef+1-a[i]);
        bef = max(bef+1, a[i]);
        nk++;
      } else {
        if (bef < a[i]) {
          bef = a[i];
          nk++;
        }
      }
    }
    if (k <= nk) nin = min(nin, cost);
  }
  cout << nin << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main() {
  int n;
  std::cin >> n;
  for (int i = 1; i <= n; i++) {
    int x = i;
    if (x % 3 == 0) {
      std::cout << " " << i;
      continue;
    }
    while (x) {
      if (x % 10 == 3) {
        std::cout << " " << i;
        break;
      }
      x /= 10;
    }
  }
  std::cout << std::endl;
}


Measured memory_bytes: 3080