akhauriyash/Code-Regression huggingface dataset:
n,m=map(int, input().split())  
a=[list(input()) for i in range(n)]
b=[list(input()) for i in range(m)]

count=0

for i in range(n-m+1):

    for j in range(n-m+1):

        for k in range(m):

            for l in range(m):

                if b[k][l]==a[i+k][j+l]:
                    count+=1

                else:
                    count=0
                    break
            if count==0:
                break
            
        if count==m**2:
            print('Yes')
            exit()
        
print('No')

Measured memory_bytes: 38256
r, g, b = map(int, input().split())

K = int(input())

while K > 0:
  if g <= r:
    g *= 2
    K -= 1
  elif b <= g:
    b *= 2
    K -= 1
  else:
    break
    




if g > r and b > g:
  print("Yes")
else:
  print("No")



Measured memory_bytes: 9108
#include <iostream>
using namespace std;
int a[6];
string s;
void C(int i,int j,int k,int l){
  int t;t=a[i];a[i]=a[j];a[j]=a[k];a[k]=a[l];a[l]=t;
}
int main(){
  for(int i=0;i<6;i++){
      cin>>a[i];
  }  
  cin>>s;
  for(int i=0;i<s.size();i++){
    if(s[i]=='E')for(int j=0;j<3;j++)C(0,2,5,3);
    if(s[i]=='W')C(0,2,5,3);
    if(s[i]=='S')for(int j=0;j<3;j++)C(0,1,5,4);
    if(s[i]=='N')C(0,1,5,4);
  }
  cout<<a[0]<<endl;
}



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




using namespace std;

const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;


#ifdef DEBUG
#define PRINT(A) std::cout << (#A) << ":" << (A) << std::endl;
#else
#define PRINT(A)
#endif

typedef pair<int, int> P;
typedef pair<ll, ll> PL;

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


class UnionFind{
    public:
    vector<int> par;
    vector<int> val;
    int root(int input){
        if(par[input]==input) return input;
        return par[input] = root(par[input]);
    }
    void unite(int val1, int val2){
        par[val1] = root(par[val2]);
    }
    bool same(int val1, int val2){
        return root(par[val1]) == root(par[val2]);
    }
    UnionFind(){
        return;
    }
};

ll N,M;
vector<ll> H;
vector<bool> good;

struct Edge{
    int from, to;
};

vector<P> edge;

int main() {
    
    cin >> N >> M;
    rep(i,N){
        int h;
        cin >> h;
        H.push_back(h);
        good.push_back(true);
    }

    rep(i,M){
        int a,b;
        cin >> a >> b;
        a--;
        b--;
        edge.push_back(make_pair(a,b));
    }


    rep(i,M){
        int from = edge[i].first;
        int to = edge[i].second;
        if(H[from] >= H[to]){
            good[to] = false;
        }
        if(H[from] <= H[to]){
            good[from] = false;
        }
        
    }

    int res = 0;
    rep(i,N){
        if(good[i] == true){
            res++;
        }
    }

    cout << res << endl;
    return 0;
}


Measured memory_bytes: 5560
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
#define MAX_N 810
#define pb push_back
#define fi first
#define sec second
#define INF 1000000000
struct edge{
	int to,cost;
	edge(){}
	edge(int to,int cost):to(to),cost(cost){}
};
vector<vector<edge> > g;
int d[MAX_N]; // cost of edge (par[v],v)
int p[MAX_N];
int dp1[MAX_N];
int dp2[MAX_N]; // must return
P ans[MAX_N];
void dfs(int v){
	if(g[v].size()==0){
		dp1[v]=-2*d[v];
		dp2[v]=-d[v];
		return;
	}
	for(int i=0;i<g[v].size();i++){
		dfs(g[v][i].to);
	}
	dp1[v]=0;
	int diff = 0;
	for(int i=0;i<g[v].size();i++){
		int u = g[v][i].to;
		int c = g[v][i].cost;
		dp1[v] += 3*c+dp1[u];
		diff = max(diff,dp1[u]-dp2[u]+c);	
	}
	dp2[v] = dp1[v]-diff;
	return;
}
void dump(vector<int> &vec){
	for(int i=0;i<vec.size();i++){
		cout << vec[i] << ' ';
	}
	cout << endl;
}
void evert(int v,P d_par){
	//cout << "call " << v << ' ' << d_par.fi << ' ' << d_par.sec << endl;
	int d1 = d_par.fi;
	int d2 = d_par.sec;
	int M = g[v].size();
	vector<int> diffl(M+1,0);
	vector<int> diffr(M+1,0);
	vector<int> suml(M+1,0);
	vector<int> sumr(M+1,0);
	int diff_par = max(0,d1-d2+d[v]);
	for(int i=0;i<M;i++){
		int u = g[v][i].to;
		int c = g[v][i].cost;
		suml[i] = 3*c+dp1[u];
		diffl[i] = max(0,dp1[u]-dp2[u]+c);
		if(i-1>=0)suml[i]  += suml[i-1];
		if(i-1>=0)diffl[i] = max(diffl[i],diffl[i-1]);
	}
	for(int i=M-1;i>=0;i--){
		int u = g[v][i].to;
		int c = g[v][i].cost;
		sumr[i] = 3*c+dp1[u];
		diffr[i] = max(0,dp1[u]-dp2[u]+c);
		if(i+1<M)sumr[i]  += sumr[i+1];
		if(i+1<M)diffr[i] = max(diffr[i],diffr[i+1]);
	}
	ans[v].fi  = d1+d[v]*3+sumr[0];
	/*cout << "--dump--" << endl;
	dump(suml);
	dump(sumr);
	cout << "-- end --" << endl;*/
	//if(M>0)assert(suml[M-1]==sumr[0]);
	ans[v].sec = d1+d[v]*3+sumr[0]-max(diff_par,diffr[0]);
	//if(M>0)assert(ans[v].sec==d1+suml[M-1]-max(diff_par,diffl[M-1]));
	for(int i=0;i<M;i++){
		int u = g[v][i].to;
		int c = g[v][i].cost;
		if(p[v]==-1&&M==1){
			evert(u,P(-2*c,-c));
			break;
		}
		int sum = d1+3*d[v], diff = diff_par;
		if(i-1>=0)sum += suml[i-1];
		if(i+1<M) sum += sumr[i+1];
		if(i-1>=0)diff = max(diff,diffl[i-1]);
		if(i+1<M) diff = max(diff,diffr[i+1]);
		evert(u,P(sum,sum-diff));
	}
	return;
}
bool solve(){
	int n;
	cin >> n;
	if(n==0)return false;
	for(int i=0;i<g.size();i++)g[i].clear();
	g.resize(n);
	p[0] = -1;
	for(int i=1;i<n;i++){
		cin >> p[i];
		p[i]--;
	}
	for(int i=1;i<n;i++){
		cin >> d[i];
	}
	for(int i=1;i<n;i++){
		g[p[i]].pb(edge(i,d[i]));
	}
	dfs(0);
	/*cout << "dp1,dp2" << endl;
	for(int i=0;i<n;i++){
		cout << i << ' ' << dp1[i] << ' ' << dp2[i] << endl;
	}*/
	evert(0,P(0,0));
	/*cout << "ans" << endl;
	for(int i=0;i<n;i++){
		cout << ans[i].fi << ' ' << ans[i].sec << endl;
	}*/
	int answer = INF;
	for(int i=0;i<n;i++)answer = min(answer,ans[i].sec);
	cout << answer << endl;
	return true;
}
int main(){
	while(solve()){}	
	return 0;
}


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

object Main {
  def loop(i:Int,s:Int,m:Int):Int =
    if(i==0) m
    else {
      val n = readInt
      val max = if(s+n > m) s+n else if(n>m) n else m
      val sum = if(s < 0 && n > s) n else s+n
      loop(i-1,sum,max)
    }

  def main(args:Array[String]) = {
    var n = 0
    while( {n = readInt;n} != 0 ) println(loop(n,0,-100000))
  }
}

Measured memory_bytes: 43752
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include<bits/stdc++.h>
#include <utility>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)

using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  double R,G;
  cin >> R >> G;
  cout << 2*G-R << endl;
  return 0; 
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1000 + 10;
int n, t, tt, x, xx, y, yy;

int main(){
    cin >> n;
    tt = 0; xx = 0; yy = 0;
    bool flag = true;
    for(int i = 0; i < n; i++){
        cin >> t >> x >> y;
        int tmp = abs(xx - x) + abs(yy - y);
        if(tmp > (t -tt)) flag = false;
        else if(tmp < (t -tt)){
            if(((t -tt) - tmp)%2 == 1) flag = false;
        }
        xx = x;
        yy = y;
        tt = t;
    }
    if(flag) cout << "Yes" << "\n";
    else cout << "No" << "\n";
    return 0;
}


Measured memory_bytes: 256
/* ex3_2
   seira3 */

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

int main(void){
    int N; //変数宣言
    scanf("%d",&N); //Nに入力
    int unit_digit; //Nの一の位
    unit_digit = N % 10; //代入
    if(unit_digit==3){ //Nの一の位が3のとき
        printf("%s\n","bon"); //bonを出力
    }
    else if(unit_digit==0||unit_digit==1||unit_digit==6||unit_digit==8){ //Nの一の位が0,1,6,8のとき
        printf("%s\n","pon"); //ponを出力
    }
    else{ //それ以外の時
        printf("%s\n","hon"); //honを出力
    }
    return 0;
}

Measured memory_bytes: 1644
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
const int INF = 1000000000;
const int MOD = 1000000007;
int main(){
	int n,m;
	cin >> n >> m;
	map<int,bool> isAC;
	map<int,int> cnt_wa;
	int penalty = 0;
	for(int i = 0;i < m;i++){
		int p;
		string s;
		cin >> p >> s;
		if(s == "AC" && isAC[p] == false){
			isAC[p] = true;
			penalty += cnt_wa[p];
		}
		else{
			cnt_wa[p]++;
		}
	}

	int ac = 0;
	for(auto p:isAC){
		if(p.second)ac++;
	}

	cout << ac << " " << penalty << endl;
}


Measured memory_bytes: 9600
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll mod=1e9+7;

int main(){
    ll n;
    cin >> n;
    vector<vector<ll>> a(2,vector<ll>(n));
    rep(j,2){
        rep(i,n){
            cin >> a[j][i];
        }
    }
    ll ans=0;
    rep(i,n){
        ll sum=0;
        for(ll j=0;j<=i;j++){
            sum+=a[0][j];
        }
        for(ll j=i;j<n;j++){
            sum+=a[1][j];
        }
        ans=max(ans,sum);
    }
    cout << ans << endl;
} 

Measured memory_bytes: 3628
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>

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

constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1 << 28;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;

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


struct SCORE {
	ll ac, pena, id;
	SCORE(ll _ac, ll _pena, ll _id) :ac(_ac), pena(_pena), id(_id) {}
	SCORE() :ac(0), pena(0), id(0) {}
	bool operator<(const SCORE& s) {
		if (ac == s.ac) {
			if (pena == s.pena) return id > s.id;
			else return pena < s.pena;
		}
		else {
			return ac > s.ac;
		}
	}
	bool operator ==(const SCORE& s) {
		return pena == s.pena && ac == s.ac;
	}
};
int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/
	int kkt = 89;
	while (kkt) {
		ll M, T, P, R; scanf("%lld %lld %lld %lld", &M, &T, &P, &R); if (M == 0 && T == 0 && P == 0 && R == 0) break;
		vector<SCORE> score(T); for (int i = 0; i < T; i++) score[i].id = i + 1;
		vector<vector<ll>> miss(T, vector<ll>(P));
		for (int i = 0; i < R; i++) {
			ll m, t, p, j; scanf("%lld %lld %lld %lld", &m, &t, &p, &j); t--; p--;
			if (j == 0) {
				score[t].ac++;
				score[t].pena += m + miss[t][p];
			}
			else {
				miss[t][p] += 20;
			}
		}
		sort(score.begin(), score.end());
		for (int i = 0; i < T; i++) {
			cout << score[i].id;
			if (i == T - 1) cout << "\n";
			else {
				if (score[i] == score[i + 1]) cout << "=";
				else cout << ",";
			}
		}
	}
	return 0;

}


Measured memory_bytes: 3224
#include <stdio.h>

int main(void)
{
	int a, b;

	scanf("%d %d", &a, &b);
	if(a == b)
	{
		printf("a == b\n");
	}
	else{
		if(a < b)
			printf("a < b\n");
		else
			printf("a > b\n");
	}

	return 0;
}

Measured memory_bytes: 580
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        int a,b;
        Scanner scan = new Scanner(System.in);
        a = scan.nextInt();
        b = scan.nextInt();
        if(a<b)System.out.println("a < b");
        if(a>b)System.out.println("a > b");
        if(a==b)System.out.println("a == b");
        scan.close();
        return;
    }
}


Measured memory_bytes: 26120
#include <stdio.h>
#include <stdlib.h>
#define int long long
#define inf (int)(1e18)

int min(int a, int b){
	return a <= b ? a : b;
}

signed main(){
	int N, a, i, j, k;
	char c[2];
	scanf("%lld", &N);
	int *w = (int *)malloc(sizeof(int) * N);
	int *b = (int *)malloc(sizeof(int) * N);
	for(i = 0; i < 2 * N; i++){
		scanf("%s %lld", c, &a);
		a--;
		if(c[0] == 'W'){
			w[a] = i;
		}
		else{
			b[a] = i;
		}
	}
	int ***dp2 = (int ***)malloc(sizeof(int **) * (N + 1));
	for(i = 0; i <= N; i++){
		dp2[i] = (int **)malloc(sizeof(int *) * 2 * N);
		for(j = 0; j < 2 * N; j++){
			dp2[i][j] = (int *)malloc(sizeof(int) * 2);
		}
	}
	for(j = 0; j < 2 * N; j++){
		for(k = 0; k < 2; k++){
			dp2[N][j][k] = 0;
		}
	}
	for(i = N - 1; i >= 0; i--){
		for(j = 0; j < 2 * N; j++){
			dp2[i][j][0] = dp2[i + 1][j][0];
			if(w[i] < j){
				dp2[i][j][0]++;
			}
			dp2[i][j][1] = dp2[i + 1][j][1];
			if(b[i] < j){
				dp2[i][j][1]++;
			}
		}
	}

/*	for(i = 0; i <= N; i++){
		for(j = 0; j < 2 * N; j++){
			for(k = 0; k < 1; k++){
				printf("dp2[%lld][%lld][%lld] = %lld\n", i, j, k, dp2[i][j][k]);
			}
		}
	}
	printf("\n");
	for(i = 0; i <= N; i++){
		for(j = 0; j < 2 * N; j++){
			for(k = 1; k < 2; k++){
				printf("dp2[%lld][%lld][%lld] = %lld\n", i, j, k, dp2[i][j][k]);
			}
		}
	}
	printf("\n");
*/

	int ***dp = (int ***)malloc(sizeof(int **) * 2 * N);
	for(i = 0; i < 2 * N; i++){
		dp[i] = (int **)malloc(sizeof(int *) * N);
		for(j = 0; j < N; j++){
			dp[i][j] = (int *)malloc(sizeof(int) * 2);
			for(k = 0; k < 2; k++){
				dp[i][j][k] = inf;
			}
		}
	}
	dp[0][0][0] = w[0];
	dp[0][0][1] = b[0];
	for(i = 1; i < 2 * N; i++){
		for(j = 0; j < N; j++){
			if(j <= i && i - j <= N){
//				printf("(i, j) = (%lld, %lld)\n", i, j);
				if(j == 0){
					dp[i][j][0] = dp2[j][w[j]][0] + dp2[i - j][w[j]][1] + dp[i - 1][i - j - 1][1];
					dp[i][j][1] = dp2[j][b[j]][1] + dp2[i - j][b[j]][0] + dp[i - 1][i - j - 1][0];
				}
				else if(j == i){
					dp[i][j][0] = dp2[j][w[j]][0] + dp2[i - j][w[j]][1] + dp[i - 1][j - 1][0];
					dp[i][j][1] = dp2[j][b[j]][1] + dp2[i - j][b[j]][0] + dp[i - 1][j - 1][1];
				}
				else{
					dp[i][j][0] = dp2[j][w[j]][0] + dp2[i - j][w[j]][1] + min(dp[i - 1][j - 1][0], dp[i - 1][i - j - 1][1]);
					dp[i][j][1] = dp2[j][b[j]][1] + dp2[i - j][b[j]][0] + min(dp[i - 1][j - 1][1], dp[i - 1][i - j - 1][0]);
				}
			}
		}
	}
/*	for(i = 0; i < 2 * N; i++){
		for(j = 0; j < N; j++){
			for(k = 0; k < 1; k++){
				printf("dp[%lld][%lld][%lld] = %lld\n", i, j, k, dp[i][j][k]);
			}
		}
	}
	printf("\n");
	for(i = 0; i < 2 * N; i++){
		for(j = 0; j < N; j++){
			for(k = 1; k < 2; k++){
				printf("dp[%lld][%lld][%lld] = %lld\n", i, j, k, dp[i][j][k]);
			}
		}
	}
*/	printf("%lld\n", min(dp[2 * N - 1][N - 1][0], dp[2 * N - 1][N - 1][1]));
	return 0;
}

Measured memory_bytes: 627584
#include <iostream>
#include <vector>
#include <string>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

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

int main(){

    char tmp;
    int n=0;

    while (cin>>tmp){
        if (tmp == '+'){
            n++;
        }else{
            n--;
        }

    }

    cout << n << endl;
    return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
using ll = long long;
#define vl vector<long long>
#define vll vector<vector<long long>>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const long long INF = 1LL << 60;
const long long MOD = 1000000007;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
//以上テンプレ

int main(){
    string S;
    cin>>S;
    ll a=S.size();
    ll sum=0;
    for(int bit=0;bit<(1<<(a-1));++bit){
        ll n=S.at(0)-'0';
        rep(i,a-1){
            if(bit&(1<<i)){
                sum+=n;
                n=S.at(i+1)-'0';
            }else{
                n*=10;
                n+=S.at(i+1)-'0';
            }
        }
        sum+=n;
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        int n = sc.NextInt();

        int answer = 0;
        for (int i = 0; i * i <= n; i++)
        {
            if (i * i <= n)
            {
                answer = i * i;
            }
        }

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 13140
s = gets.chomp
n = s.size

ans = 0
for i in 0..((1 << (s.size-1))-1)
    expr = "x = "
    for j in 0..n-1
        expr += s[j]
        if (i >> j & 1) == 1
            expr += '+'
        end
    end
    x = 0
    eval expr
    ans += x
end
puts ans

Measured memory_bytes: 14224
n,m = (int(i) for i in input().split())
x = [int(i) for i in input().split()]

if n >= m:
	print(0)
else:
	sorted_x = sorted(x)
 
	diff_x = []
	diff = 0
	result = 0
 
	for i in range(m-1):
		diff = sorted_x[i+1] - sorted_x[i]
		result += diff
		diff_x.append(diff)

	sorted_diff = sorted(diff_x, reverse=True)[:n-1]
 
	for i in range(n-1):
		result -= sorted_diff[i]
	 
	print(result)	

Measured memory_bytes: 58920
use std::io;
use std::cmp;


/// https://beta.atcoder.jp/contests/arc063/tasks/arc063_b
/// a[i]より右をみればO(n log n) => TLE
/// minを管理すればO(n)
fn main() {
    let (_, _) = {
        let i = read::<usize>();
        (i[0], i[1])
    };

    let a = read::<isize>();
    let mut min = 10_000_000_000;
    let mut diff_max = 0;
    let mut ans = 0;
    for i in a.into_iter() {
        min = cmp::min(min, i);
        match (i - min).cmp(&diff_max) {
            cmp::Ordering::Greater => {
                diff_max = i - min;
                ans = 1;
            },
            cmp::Ordering::Equal => ans += 1,
            _ => {}
        }
    }

    println!("{}", ans);

}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 6396
S = input()
n = len(S)
isKaibun = True
for i in range(n//2):
    if(S[i] != S[n-i-1] or S[i] != S[n//2-i-1] or S[n//2+i+1] != S[n//2-i-1]):
        isKaibun = False
        break
if(isKaibun):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
n,m,c=map(int,input().split())
B=list(map(int,input().split()))
A=[list(map(int,input().split()))for i in range(n)] #二次元配列でとっています
cnt=0
for i in range(n):
    total=0
    for j in range(m):
        total+=B[j]*A[i][j]
    total+=c
    if 0<total:
        cnt+=1
print(cnt)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

//const ll INF = 1e18L + 5;
const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

void	solve()
{
	int a, b, c;
	cin >> a >> b >> c;
	int ans = c - (a - b);
	cout << (ans < 0 ? 0 : ans) << endl;
}

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

	solve();
}


Measured memory_bytes: 256
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#include "bitset"
#include "queue"
#include "functional"
#include "map"
#include "unordered_map"
#include "set"
#include "stack"
#include "tuple"

#define rep(n) for (int i = 0; i < n; ++i)
#define REP(n,i) for (int i = 0; i < n; ++i)
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define intinf 1000000000
#define llmax 9223372036854775807
#define nyan "(=^･ω･^=)"
#define mkp make_pair
#define mkt make_tuple
#define P pair<ll, ll>
typedef long long ll;
using namespace std;

string s;
int n,p;
bool b[100000];

int main() {
	cin >> s;
	n = s.size();
	rep(n) {
		b[i] = s[i] - '0';
	}
	if (b[n - 1]||!b[0]) {
		cout << -1 << endl;
		return 0;
	}
	rep(n-1) {
		if (b[i] != b[n - i - 2]) {
			cout << -1 << endl;
			return 0;
		}
	}

	p = 1;
	for (int i = 1; i < n;++i) {
		if (b[i]) {
			for (int j = p; j <= i; ++j) {
				cout << j << sp << i + 1 << endl;
			}
			p = i + 1;
		}
	}
	for (int i = p; i < n; ++i) {
		cout << i << sp << n << endl;
	}
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000000


int main(){
	
	double R;
	cin>>R;
	
	cout<<fixed<<setprecision(10)<<2.0*R*acos(-1.0)<<endl;

	return 0;
}

Measured memory_bytes: 3780
using Asakatsu20200503.Questions;
using Asakatsu20200503.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace Asakatsu20200503.Questions
{
    /// <summary>
    /// ABC094
    /// </summary>
    public class QuestionD : AtCoderQuestionBase
    {
        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            var _ = inputStream.ReadInt();
            var a = inputStream.ReadIntArray();

            var n = a.Max();
            var r = a[0];
            foreach (var ai in a)
            {
                if (GetDistance(n, ai) >= GetDistance(n, r) && n != ai)
                {
                    r = ai;
                }
            }

            yield return $"{n} {r}";
        }

        int GetDistance(int n, int r) => Math.Min(n - r, r);
    }
}


namespace Asakatsu20200503
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionD();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

#region Base Classes

namespace Asakatsu20200503.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }

}

#endregion

#region Extensions

namespace Asakatsu20200503.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion

Measured memory_bytes: 21856
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

using namespace std;
typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1001001001;
const long long INFL = (1LL<<60);
const double eps = (1e-9);

struct abcd {
  ll a;
  ll b;
  ll c;
  ll d;
};

vector<abcd> qs;

// 数列Aが何点とれるか
ll calc(vector<ll>& a) {
  ll ret = 0;
  for (auto& q : qs) {
    if (a[q.b] - a[q.a] == q.c) ret += q.d;
  }
  return ret;
}

// n 桁の数字を作る。使える数字はの上限はM
ll dfs(int n, int m, vector<ll> a) {
  if (a.size() == n) return calc(a);
  ll ans = 0;
  for (int i = a.back(); i <= m; i++) {
    a.push_back(i);
    chmax(ans, dfs(n, m, a));
    a.pop_back();
  }
  return ans;
}

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

  ll n, m, q;
  cin >> n >> m >> q;
  rep(i, q) {
    ll a, b, c, d; cin >> a >> b >> c >> d; a--; b--;
    abcd s{a, b, c, d};
    qs.push_back(s);
  }

  ll ans = 0;
  for (int i = 1; i <= m; i++) {
    vector<ll> a;
    a.push_back(i);
    chmax(ans, dfs(n, m, a));
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
const ll INF = 1e18;
#define print(x) cout << (x) << endl;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    vector<int> S(n,0);
    string SS;
    cin >> SS;
    for (int i = 0; i < n; i++) {
        char c;
        c = SS.at(i);
        if (c == 'L') {
            S.at(i) = 0;
        }
        else {
            S.at(i) = 1;
        }
    }
    int sum = 0;
    int answer = 0;
    for (int i = 0; i < n-1; i++) {
        if (S.at(i) == S.at(i+1)) {
            sum++;
        }
    }
    if ((n - sum - 1) / 2 >= k) {
        answer = sum + k * 2;
    }
    else {
        answer = n - 1;
    }
    cout << answer << endl;
}

Measured memory_bytes: 896
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;

const int INF = INT_MAX / 3;
const int MAX_N = 1001;

int dp[MAX_N + 1][MAX_N + 1];

int levenshtein_distance(string &s1, string &s2) {
	fill_n((int *)dp, sizeof(dp) / sizeof(int), INF);	
	int n = s1.size();
	int m = s2.size();

	for(int i = 0; i <= n; ++i) dp[i][0] = i;	
	for(int j = 0; j <= m; ++j) dp[0][j] = j;	
	
	int cost = 0;
	for(int i = 1; i <= n; ++i) {
		for(int j = 1; j <= m; ++j) {
			cost = (s1[i-1] == s2[j-1]) ? 0 : 1;
			dp[i][j] = min(dp[i-1][j] + 1, dp[i][j-1] + 1); // insert or delete 
			dp[i][j] = min(dp[i][j], dp[i-1][j-1] + cost); // replace
		}
	}

	return dp[n][m];
}

int main() {
	string s1, s2;
	cin >> s1 >> s2;
	cout << levenshtein_distance(s1, s2) << endl;
	return 0;
}

Measured memory_bytes: 5108
a = []
b = []
i = 0

def calc_gcd(a, b)
   if a % b == 0
      return b
   else
      return calc_gcd(b, a % b)
   end
end

while true
   ln = gets
   if ln == nil
      break
   end
   a[i], b[i] = ln.chomp.split
   a[i], b[i] = a[i].to_i, b[i].to_i
   i = i + 1
end

for j in 0..(i - 1)
   gcd = calc_gcd(a[j], b[j])
   lcm = a[j] * b[j] / gcd
   puts gcd.to_s + " " + lcm.to_s
end


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

int main(){
  int n;
  cin>>n;
  double arr[3000];
  for(int i=0;i<n;i++) cin>>arr[i];
  double dp[3000][3000];
      dp[0][0]=1;
  for(int i=1;i<=n;i++) dp[0][i]=0;
  for(int i=1;i<=n;i++) dp[i][0]=dp[i-1][0]*(1-arr[i-1]);
  double ans=0;
  for(int i=1;i<=n;i++){
    for(int j=1;j<=i;j++){
             double p=arr[i-1];
        dp[i][j]=dp[i-1][j]*(1-p)+dp[i-1][j-1]*p;
      if(i==n &&j>n/2) ans+=dp[i][j];
      }
    }
    cout<<fixed<<setprecision(10)<<ans<<endl; 
  } 
 
  

Measured memory_bytes: 70272
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

const ll mod=1e9+7;

//vector書き出し
template <class T>
void cout_vec(const vector<T> &vec1){
  rep(i,len(vec1)){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;
    cin>>a>>b;
    string s;
    cin>>s;
    rep(i,len(s)){
        if(i==a){
            if(s[i]!='-'){
                cout<<"No"<<endl;
                return 0;
            }
        }else{
            int x=s[i]-'0';
            if(x<0 || x>9){
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mk make_pair
#define mod 1000000007
#define ll long long
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define ff first
#define ss second
#define prec(y,x) fixed<<setprecision(y)<<x
#define inf 1e18
#define pi 3.1415926535
vector<int> par;
int parent(int x)
{
	if (par[x] == x)
		return x;
	else
	{
		par[x] = parent(par[x]);
		return par[x];
	}
}
int 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

	int n, m;
	cin >> n >> m;
	par.resize(n + 1, 0);
	for (int i = 0; i <= n; i++)
	{
		par[i] = i;
	}
	while (m--)
	{
		int a, b;
		cin >> a >> b; int x, y;
		x = parent(a);
		y = parent(b);
		if (x == y)
		{

		}
		else if (x > y)
		{
			par[x] = y;
		}
		else
		{
			par[y] = x;
		}
	}
	int ans = 0;
	for (int i = 1; i <= n; i++)
	{
		if (par[i] == i)
			ans++;
	}
	cout << ans - 1;

	return 0;
}


Measured memory_bytes: 3708
#include <bits/stdc++.h>
using namespace std;
using ll = long long; // ll は long long　と同じとする。(int64_t)
int main(){
    int N;
    cin >> N;
    vector <int> A(N);
    for(int i = 0; i < N - 1; i++){
        cin >> A.at(i);
    }
    vector <int> count(N, 0);
    for(int i = 0; i < N - 1; i++){
        count.at(A.at(i) - 1)++;
    }
    for(int i = 0; i < N; i++){
        cout << count.at(i) << endl;
    }
}

Measured memory_bytes: 4720
H,W,N = map(int, input().split())
st = [int(i) for i in input().split()]
S = input()
T = input()

 
safe_ud = [1, H]
safe_lr = [1, W]
flag = True
for i in reversed(range(N)):
    if T[i] == 'L': #守りが'L'なら安全地帯の左端を狭める
        if safe_lr[1] != W:
            safe_lr[1] += 1
    elif T[i] == 'R': #守りが'R'なら安全地帯の右端を狭める
        if safe_lr[0] != 1:
            safe_lr[0] -= 1
    elif T[i] == 'U': #守りが'U'なら安全地帯の下端を狭める
        if safe_ud[1] != H:
            safe_ud[1] += 1
    elif T[i] == 'D': #守りが'D'なら安全地帯の上端を狭める
        if safe_ud[0] != 1:
            safe_ud[0] -= 1
    
    if S[i] == 'L': #攻めが'L'なら安全地帯の右端を広げる
        safe_lr[0] += 1
    elif S[i] == 'R': #攻めが'R'なら安全地帯の左端を広げる
        safe_lr[1] -= 1
    elif S[i] == 'U': #攻めが'U'なら安全地帯の上端を広げる
        safe_ud[0] += 1
    elif S[i] == 'D': #攻めが'D'なら安全地帯の下端を広げる
        safe_ud[1] -= 1

    if safe_lr[1] - safe_lr[0] < 0 or safe_ud[1] - safe_ud[0] < 0: #安全地帯が無くなったらOUT
        flag = False
        break
 
if flag:
    if safe_ud[0] <= st[0] <= safe_ud[1] and safe_lr[0] <= st[1] <= safe_lr[1]:
        pass
    else:
        flag = False
 
if flag:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 47024
n=int(input())
A=[]
for i in range(n):
  a,b,c=map(int,input().split())
  if a<b+c or (b+c)%2!=a%2:
    print("No")
    exit()
  A.append([a,b,c])
for i in range(n-1):
  if not A[i+1][0]-A[i][0]>=A[i+1][2]+A[i+1][1]-A[i][1]-A[i][2]:
    print("No")
    exit()
print("Yes")


Measured memory_bytes: 19504
import java.util.*;
public class Main{
  public static void main(String[] orgs){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    if(a*b%2 == 0)
      System.out.println("Even");
    else
      System.out.println("Odd");
  }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int inf = 1001001001;
 
template <typename T>
struct UnionFind {
   vector<T> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
 
   UnionFind(T N) : par(N) { //最初は全てが根であるとして初期化
        for(T i = 0; i < N; i++) par[i] = i;
   }
 
   int root(T x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
   }
 
   void unite(T x, T y) { // xとyの木を併合
       T rx = root(x); //xの根をrx
       T ry = root(y); //yの根をry
       if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
       par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
   }
 
   bool same(T x, T y) { // 2つのデータx, yが属する木が同じならtrueを返す
       T rx = root(x);
       T ry = root(y);
       return rx == ry;
   }
};
 
int main(){

    ll n,m;
    cin >> n >> m;
    vector<ll> data(n);
    rep(i,n) cin >> data[i];

    UnionFind<ll> tree(n);

    rep(i,m){
        ll x,y;
        cin >> x >> y;
        tree.unite(x-1,y-1);
    }

    ll cnt=0;
    rep(i,n){
        if(tree.same(i,data[i]-1)){
            cnt++;
        }
    }

    cout << cnt << endl;
 
}

Measured memory_bytes: 1792
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}

#define MOD 1000000007LL
#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll A,B,T;
	while(cin>>A>>B>>T) {
		ll ans = 0;
		RANGE(t, 1, T+1) {
			if(t%A==0) ans+=B;
		}
		
		cout<<ans<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Text;

namespace ProgrammingContestCS.AtCoder.ABC123
{
    class A
    {
        static void Main()
        {
            DataReader reader = new DataReader();
            int[] A = new int[5];
            for (int i = 0; i < 5; ++i)
            {
                A[i] = reader.ReadInt();
            }
            int K = reader.ReadInt();
            if (A[4] - A[0] <= K)
            {
 Console.WriteLine("Yay!");
            }
           else
            {

                Console.WriteLine(":(");
            }
        }
    }
}
class DataReader
{
    const char DEFAULT_SEPARATOR = ' ';
    public System.IO.TextReader Reader { get; set; }
    public char[] Separators { get; set; }
    System.Collections.Generic.Queue<string> data;
    public DataReader() : this(System.Console.In, new char[] { DEFAULT_SEPARATOR }) { }
    public DataReader(System.IO.TextReader reader, char[] separators)
    {
        Reader = reader;
        Separators = separators;
        data = new System.Collections.Generic.Queue<string>();
    }
    public string ReadString()
    {
        if (data.Count == 0)
        {
            ReadLineAndEnqueue();
        }
        string s = data.Dequeue();
        return s;
    }
    public int ReadInt()
    {
        string s = ReadString();
        int x = int.Parse(s);
        return x;
    }
    public long ReadLong()
    {
        string s = ReadString();
        long x = long.Parse(s);
        return x;
    }
    public double ReadDouble()
    {
        string s = ReadString();
        double x = double.Parse(s);
        return x;
    }
    void ReadLineAndEnqueue()
    {
        string s = Reader.ReadLine().Trim();
        if (s != null)
        {
            string[] ss = s.Split(Separators);
            foreach (string e in ss)
            {
                data.Enqueue(e);
            }
            return;
        }
        else
        {
            throw new System.IO.IOException("End of data");
        }
    }
}


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

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var N = cin.ReadInt;
            var Q = cin.ReadInt;
            var S = cin.Read;

            var countArray = new int[N];
            var ACcnt = 0;
            for(var i=0; i<N-1; i++)
            {
                if(S[i] == 'A' && S[i+1] == 'C')
                {
                    ACcnt++;
                }
                countArray[i+1] = ACcnt;
            }
            countArray[N - 1] = ACcnt;

            for(var i=0; i<Q; i++)
            {
                var l = cin.ReadInt;
                var r = cin.ReadInt;
                WriteLine(countArray[r-1] - countArray[l-1]);
            }
        }

        static long GcdArray(long[] array)
        {
            var ans = array[0];
            for(var i=1; i<array.Length; i++)
            {
                ans = Gcd(ans, array[i]);
            }
            return ans;
        }

        static long Gcd(long a, long b)
        {
            var v = new[] { a, b };
            while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
            return v[0];
        }

        static long Lcm(long a, long b)
        {
            return a / Gcd(a, b) * b;
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 16844
fun main(args: Array<String>) {
    val (N, M) = readLine()!!.split(" ").map(String::toInt)
    val roads = Array(M) { readLine()!!.split(" ").map(String::toInt).let { Pair(it[0], it[1]) } }
    val map = IntArray(N)
    roads.forEach {
        map[it.first - 1]++
        map[it.second - 1]++
    }
    map.forEach(::println)

}



Measured memory_bytes: 37740
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;

int main() {
  string s;
  cin >> s;
  if (s.back() == 's') s += "es";
  else s += 's';
  cout << s << endl;
  return 0; 
}

Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        sc.close();
        for(int i=a;i<=b;i++){
            if(i%k==0){
                System.out.println("OK");                
                return;
            }
        }
        System.out.println("NG");     
    }
}

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

int N,X,cnt=0;
vector<int> data;

void result(vector<int> data,int d){
  if(d>X)return;
  if(cnt>=N){cnt++;return;}
  d+=data.at(cnt);
  cnt++;
  result(data,d);
  return;
}

int main(){
  cin>>N>>X;
  for(int i=0;i<N;i++){
    int n;cin>>n;data.push_back(n);
  }
  result(data,0);
  cout<<cnt<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int n,x[100],i,j;
	cin>>n;
	for(i=0;i<n;i++){
	cin>>x[i];
	}
	for(j=n-1;j>=0;j--){
	cout<<x[j];
	if(j==0){
	continue;
	}
	cout<<" ";
	}
	cout<<endl;
        return 0;
    }


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

int main(void) {
    string S;
    cin >> S;
    int N = S.length();
    int total = 0;
    rep(i,N){
        if(i%2==0){
            if(S[i]=='L') total=1;
        }else{
            if(S[i]=='R') total=1;
        }
    }
    
    if(total==1) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
using System;

namespace abc133_a
{
    class Program
    {
        static void Main(string[] args)
        {
            var items = Console.ReadLine().Split(' ');
            // 人数
            var n = int.Parse(items[0]);
            // 電車 %1
            var a = int.Parse(items[1]);
            // タクシー %n
            var b = int.Parse(items[2]);

            var c = Math.Min(a * n, b);

            Console.WriteLine($"{c}");
        }
    }
}


Measured memory_bytes: 13140
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt(),
			b = sc.nextInt(),
			c = sc.nextInt();
		long k = sc.nextLong();
		if(k % 2 == 0) {
			System.out.println(a - b);
		} else {
			System.out.println(b - a);
		}
	}
}

Measured memory_bytes: 21716