akhauriyash/Code-Regression huggingface dataset:
fun main(args: Array<String>) {
    val s = readLine()!!
    val t = readLine()!!

    if (s == t) {
        println("Yes")
        return
    }

    var memo1 = mutableMapOf<Char, Char>()
    var memo2 = mutableMapOf<Char, Char>()
    for (i in (0 until s.length)) {
        var cs = s[i]
        var ts = t[i]

        if (memo1.containsKey(cs)) {
            if (memo1[cs] != ts) {
                println("No")
                return
            }
        } else {
            memo1[cs] = ts
        }

        if (memo2.containsKey(ts)) {
            if (memo2[ts] != cs) {
                println("No")
                return
            }
        } else {
            memo2[ts] = cs
        }
    }

    println("Yes")
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

int32 n,m;
vector<vector<int32>> adj;

vector<int32> used;
vector<int32> vs;
bool dfs(int32 v){
    if(used[v] == -1)return false;
    if(used[v] == 1){
        vs.erase(vs.begin(),find(ALL(vs),v));
        return true;
    }
    vs.push_back(v);
    used[v] = 1;
    for(auto u : adj[v]){
        if(dfs(u))return true;
    }
    used[v] = -1;
    vs.pop_back();
    return false;
}

void solve(){
    vector<int32> nxt(n,-1);
    REP(i,vs.size()){
        nxt[vs[i]] = vs[(i+1)%vs.size()];
    }
    // REP(i,n)cout << nxt[i]+1 << " ";
    // cout << endl;
    int32 s = vs[0];
    int32 v = s;
    while(true){
        bool flg = false;
        for(auto u : adj[v]){
            if(nxt[v] != u && nxt[u] != -1){
                int32 x = nxt[v];
                while(x != u){
                    int32 y = nxt[x];
                    nxt[x] = -1;
                    x = y;
                }
                nxt[v] = u;
                v = u;
                s = u;
                flg = true;
                break;
            }
        }
        if(!flg){
            v = nxt[v];
            if(v == s)break;
        }
    }
    vector<int32> ans;
    REP(i,n){
        if(nxt[i] != -1)ans.pb(i+1);
    }
    ANS(ans.size());
    for(auto x : ans){
        ANS(x);
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m;
    adj.resize(n);
    REP(i,m){
        int32 a,b;
        cin >> a >> b;
        --a;--b;
        adj[a].pb(b);
    }
    used.resize(n);
    REP(i,n){
        if(used[i] == 0){
            if(dfs(i)){
                // for(auto x : vs)cout << x << " ";
                // cout << endl;
                solve();
                return 0;
            }
        }
    }
    ANS(-1);
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <queue>

using namespace std;
typedef long long ll;

int main(){
    int n, m;
    cin >> n >> m;
    priority_queue<ll> a;
    for(int i=0;i<n;i++){
        ll tmp;
        cin >> tmp;
        a.push(tmp);
    }

    for(int i=m; i>0; i--){
        a.push(a.top()/2);
        a.pop();
    }

    ll sum = 0;
    for(int i=0; i<n; i++){
        sum += a.top();
        a.pop();
    }

    cout << sum << endl;
}

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

const int INF = 1e9;
const int MAX_V = 16;
const int MAX_S = 1 << 16;

int V,E;
int dist[MAX_V][MAX_V];
int dp[MAX_S][MAX_V];

void chmin(int &a, int b){ if( a > b){ swap(a,b);} return ;}

int rec(int S, int a){
  if( dp[S][a] >= 0){ return dp[S][a];}
  if( S == (1<<V)-1 && a == 0){ return 0;}
  
  int res = INF;
  for(int u = 0; u < V; u++){
    if( !(( S >> u) & 1)){//まだuに未到達
      chmin(res, rec(S|(1<<u),u)+dist[a][u]);}}
   
  return dp[S][a] = res;
}
                             
      
    

int main(){
 scanf("%d",&V); scanf("%d",&E);
 
  
  for(int i = 0; i < MAX_V; i++){
    for(int j = 0; j < MAX_V; j++){
      dist[i][j] = INF;}}
  //繋がっていない状態をINFとする
  for(int i = 0; i < MAX_S; i++){
    for(int j = 0; j < MAX_V; j++){ 
      dp[i][j] = -1;}}
 
  //未更新を-1とする
  while(E--){
    int s,t,d; cin >> s >> t >> d; dist[s][t] = d;}
  
  if( rec(0,0) != INF){ printf("%d\n", rec(0,0)); }
  else{ printf("%d\n", -1) ;}return 0;}
  
  


Measured memory_bytes: 7308
#include <iostream>
using namespace std;
int main(void){
	int x,y,z,n,a[10010],temp;
	cin >> n;
	for (x=1;x<=n;x++) {
		a[x] = 0;
	}
	for (x=1;x*x<n;x++) {
		for (y=1;y*y<n;y++) {
			for (z=1;z*z<n;z++) {
				temp = x*x + y*y + z*z + x*y + y*z + z*x;
				if (temp <= n) {
					a[temp]++;
				} else {
					break;
				}
			}
		}
	}
	for (x=1;x<=n;x++) {
		cout << a[x] << '\n';
	}
}


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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define rrepa(i,a,n) for(int i=n;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
#define cmax(a,b) a=max(a,b)
#define cmin(a,b) a=min(a,b)
#define vc vector

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,int> pi;

int main(){

    int n,k;
    cin>>n>>k;
    vi h(n);
    rep(i,n)cin>>h[i];

    sort(all(h));

    if(n<=k){
        cout<<0<<"\n";
        return 0;
    }

    ll ans=0;
    rep(i,n-k){
        ans+=h[i];
    }

    cout<<ans<<"\n";

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <fstream>
#include<cstdio>
#include<iomanip>

#define REP(i, n) for(int i=0;i<n;i++)
#define REP_1(i, n) for(int i=1;i<n+1;i++)
using namespace std;
typedef long long ll;
typedef unsigned long ul;
typedef long double ld;


int main() {
    ll a, b, x;
    cin >> a >> b >> x;
    ll min;
    if (a % x == 0) { min = a / x; }
    else { min = a / x + 1; }
    ll max = b / x;
    cout << max - min + 1 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<string>
#include <iomanip>
#include <bits/stdc++.h>
#include <fstream>
#include <map>
using namespace std;
typedef long long ll;
//#define INF 1000000000000 //10^12:極めて大きい値,∞
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

int main(){
    int n,b,f,r,v;
    cin >> n;
    vector<vector<vector<int> > > bill(4, vector<vector<int> > (3, vector<int>(10,0)));

    REP(i,n){
        cin >> b >> f >> r >> v;
        bill[b-1][f-1][r-1] += v;
    }

    REP(i,4){
        REP(j,3){
            REP(k,10){
                cout << ' ' << bill[i][j][k];
                //if(k!=9) cout ;
            }
            //cout << ' ';
            cout << endl;
        }
        if(i!=3) cout << "####################" << endl;
    }
    //cout << endl;
    return 0;
}


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

int color[101][101];
int a[10001];

int main() {
    int H, W, N, column_idx = 0, color_idx = 0;
    cin >> H >> W >> N;
    for (int i = 0; i < N; i++) cin >> a[i];
    for (int i = 0; i < H; i++) {
        if (column_idx == 0) {
            while (column_idx < W) {
                if (a[color_idx] != 0) {
                    color[i][column_idx] = color_idx + 1;
                    column_idx++;
                    a[color_idx]--;
                }
                else {
                    color_idx++;
                }
            }
            column_idx = W - 1;
        }
        else {
            while (column_idx > -1) {
                if (a[color_idx] != 0) {
                    color[i][column_idx] = color_idx + 1;
                    column_idx--;
                    a[color_idx]--;
                }
                else {
                    color_idx++;
                }
            }
            column_idx = 0;
        }
    }
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cout << color[i][j] << " ";
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>

int main(){
  int a,b,c;
  if(scanf("%d",&a)==1 && scanf("%d",&b)==1 && scanf("%d",&c)==1){}
  
  int ans = c - (a-b);
  
  if(ans >= 0){
    printf("%d",ans);
  }else{
    printf("0");
  }
  
  return 0;
}

Measured memory_bytes: 128
from heapq import*
(N,M),*t=[map(int,s.split())for s in open(0)]
q=[0]*50*M
v=[[]for _ in q]
for a,b in t:v[a-1]+=b,
print(sum(([heappush(q,-j)for j in i],-heappop(q))[1]for i in v[:M]))

Measured memory_bytes: 371436
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF (1<<30)-1
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

int n, W, dp[110][10010];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> n >> W;
    vector<int> v(n), w(n);
    rep(i, 0, n) cin >> v[i] >> w[i];
    rep(i, 0, n) {
        erep(j, 0, W) {
            if (j - w[i] < 0) 
                dp[i+1][j] = dp[i][j];
            else
                dp[i+1][j] = max(dp[i][j], dp[i+1][j-w[i]] + v[i]);
        }
    }
    cout << dp[n][W] << endl;
    return 0;
}


Measured memory_bytes: 7144
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        String line=sc.nextLine();
        int length=line.length();
        for(int i=0;i<length;i++){
            char c=line.charAt(i);
            if(Character.isLowerCase(c)){
                c=Character.toUpperCase(c);

            }else{
                c=Character.toLowerCase(c);
            }
            System.out.print(c);
        }
        System.out.println();
    }
}


Measured memory_bytes: 26628
#include <bits/stdc++.h>
using namespace std;
#define rep(i,l) for(int i=0;i<l;i++)
#define reP(i,l) for(int i=1;i<=l;i++)
#define FOR(i,l,r) for(int i=l;i<=r;i++)
#define ROF(i,l,r) for(int i=l;i>=r;i--)
#define in(x) scanf("%d",&x)
#define lin(x) scanf("%lld",&x)
#define out(x) printf("%d\n",x)
#define lout(x) printf("%lld\n",x)
#define uout(x) printf("%llu\n",x)
typedef long long ll;
typedef unsigned long long ull;
const int N=3e5;
const int inf=0x3f3f3f3f;
const ll Inf=0x3f3f3f3f3f3f3f3f;

ll n,k,lim,ans,sum,a,b;
signed main(){
	lin(n),lin(k);
	vector<ll>v(n);
	rep(i,n){
		lin(v[i]);
	}
	lim=min(n,k);
	for(int l=0;l<=lim;l++){
		for(int r=0;r<=lim-l;r++){
			sum=0;
			vector<ll>t(n);
			for(int i=0;i<l;i++){
				sum+=v[i];
				if(v[i]<0)
				t.push_back(v[i]);
			}
			for(int i=0;i<r;i++){
				sum+=v[n-i-1];
				if(v[n-i-1]<0)
				t.push_back(v[n-i-1]);
			}
			sort(t.begin(),t.end());
			a=k-(l+r);
			b=t.size();
			for(int i=0;i<min(a,b);i++)
			sum-=t[i];
			ans=max(ans,sum);
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
class BIT(object):

    def __init__(self, size, init_data=None):
        self.size = size
        if init_data is None:
            init_data = [0] * (size + 1)
        self.data = init_data

    def sum(self, idx):
        ret = 0
        while idx > 0:            
            ret += self.data[idx]
            idx -= idx & -idx # idx = idx & (idx - 1)
        return ret

    def add(self, idx, value):
        while idx <= self.size:
            self.data[idx] += value
            idx += idx & -idx

if __name__ == "__main__":
    n, q = list(map(int, input().split()))
    bit = BIT(n)
    for _ in range(q):
        com, x, y = list(map(int, input().split()))
        if com == 0:
            bit.add(x, y)
        else:
            print(bit.sum(y)-bit.sum(x-1))

Measured memory_bytes: 9844
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;
int main()
{
    int N;
    vector<int> L;
    cin >> N;
    for(int i=0; i<N; i++)
    {
    	int a;
    	cin >> a;
    	L.push_back(a);
    }

    int M = *max_element(L.begin(), L.end());
    int S = accumulate(L.begin(),L.end(),-M);
    if(M<S) cout << "Yes" << endl;
    else cout << "No" << endl;
	return 0;
}

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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cout << #x << " = " << (x) << endl
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

template<class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	os<<"{";
	rep(i, v.size()) {
		if (i) os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

int main() {
	int N; cin >> N;
	vi A(N);
	rep(i, N) {
		cin >> A[i];
		--A[i];
	}

	vi ope;

	rep(t, N) {
		bool fd = false;
		int p = -1;
		for (int i = (int)A.size() - 1; i >= 0; --i) {
			if (A[i] == i) {
				ope.pb(i + 1);
				p = i;
				fd = true;
				break;
			}
		}
		if (!fd) {
			puts("-1");
			return 0;
		}
		vi nx;
		rep(i, A.size()) {
			if (i != p) {
				nx.pb(A[i]);
			}
		}
		A = nx;
	}
	reverse(ALL(ope));
	rep(i, N) {
		cout << ope[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <string>
#include <vector>
using namespace std;
 
#define rep(i,x) for(int i=0;i<(int)(x);++i)
#define reps(i,x) for(int i=1;i<=(int)(x);++i)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
 
long long int n, x;
long long int a[100000];

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

    for (long long int i = 0; i<n; ++i) {
        cin >> a[i];
    }

    long long int cnt = 0;

    for (long long int i = 0; i < n; ++i) {
        if (a[i] > x) {
            cnt += a[i] - x;
            a[i] = x;
        }
    }

    long long int sum, diff;
    for (long long int i = 0; i < (n-1); ++i) {
        sum = a[i] + a[i+1];
        if (sum > x) {
            diff = sum - x;
            a[i+1] -= diff;
            cnt += diff;
        }
    }

    cout << cnt << '\n';

    return 0;
}

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

#define pb     push_back
#define mp     make_pair
#define all(v) v.begin() , v.end()
#define allr(v) v.rbeginq(), v.rend()
const ll INF =  0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const int MOD = 1e9+7;
const int MAX = 1e5+5;

int n, m;
int l, r, d;
vector<pair<int, int> > adj[MAX];
vector<int> lmost;
int lft[MAX];
int rgt[MAX];
int coor[MAX];
bool flag = true;
bool visited[MAX] = {false};

void dfs(int s){
    visited[s] = true;
    for(int i = 0 ; i < (int) adj[s].size() ; i++){
        int v = adj[s][i].first;
        int d = adj[s][i].second;
        if(coor[v] == -1)
            coor[v] = coor[s] + d;
        else if(coor[v] != coor[s] + d){
            flag = false;
            return;
        }
        if(!visited[v])
            dfs(v);
    }
}

int main(int argc, char const *argv[]){
    ios_base::sync_with_stdio(false);

    scanf("%d %d" , &n, &m);
    for(int i = 0 ; i < m ; i++){
        scanf("%d %d %d" , &l, &r, &d);
        lft[r]++;
        rgt[l]++;
        adj[l].pb(mp(r, d));
    }

    if(m == 0){
        printf("Yes");
        return 0;
    }

    for(int i = 1 ; i <= n ; i++)
        coor[i] = -1;

    for(int i = 1 ; i <= n ; i++){
        if(lft[i] == 0 && rgt[i] > 0)
            lmost.pb(i);
    }

    if(lmost.size() == 0){
        printf("No");
        return 0;
    }
    else{
        for(int i = 1 ; i < (int)lmost.size() ; i++){
            coor[lmost[i]] = 0;
        }
        for(int i = 0 ; i < (int)lmost.size() ; i++){
            dfs(lmost[i]);
            if(!flag)
                break;
        }
    }

    if(flag)
        printf("Yes");
    else
        printf("No");

    return 0;
}


Measured memory_bytes: 11648
#include  <stdio.h>

int main(){
    int a;
    int b;
    int c;
    
        scanf ("%d %d %d",&a,&b,&c);
        int total = a+b+c;
    
    if (total >=22){
        printf("bust\n");
    }
    else{
         printf("win\n");
    }
    return 0;
}

Measured memory_bytes: 1624
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;

int main() {
  int N;
  string S;
  cin >> N >> S;
  vector<int> a(N+1);
  a.at(0)=0;
  for (int i=0; i<N; i++) {
    if (S.at(i)=='I') {
      a.at(i+1)=a.at(i)+1;
    }
    else {
      a.at(i+1)=a.at(i)-1;
    }
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  cout << a.at(0) << endl;
}

Measured memory_bytes: 3576
#include <iostream>
#include <algorithm>
#include <set>
#include <math.h>
using namespace std;
typedef long long ll;

void insetrtionsort(int a[], int n)
{
    int j, v;
    for (int i = 1; i < n; i++)
    {
        v = a[i];
        j = i - 1;
        while (j >= 0 && a[j] > v)
        {
            a[j + 1] = a[j];
            j--;
        }
        a[j + 1] = v;
        for (int i = 0; i < n; i++)
        {
            cout << a[i] << " ";
        }
        cout << endl;
    }
}

int gcd(int a, int b)
{
    if (a < b)
    {
        int t = a;
        a = b;
        b = t;
    }
    cout << a << " " << b << endl;
    if (b == 0) return a;
    else return gcd(b, b%a);
}

int main()
{
    int n;
    cin >> n;
    string op, s;
    set<string> s_set;
    for (int i = 0; i < n; i++){
        cin >> op >> s;
        if (op == "insert") s_set.insert(s);
        else {
            auto a = s_set.find(s);
          	if (a == s_set.end()) cout << "no" << endl;
          	else cout << "yes" << endl;
            
        }
    }

    return 0;
}



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

int main(){
  long long k,ans=0;
  string s; cin>>s>>k;
  if(s.size()==1){
    cout<<k/2<<endl;
    return 0;
  }
  char c=s[0]; long long count=1;
  for(int i=1;i<s.size();i++){
    if(c!=s[i]) break;
    count++;
  }
  if(count==s.size()){
    cout<<(k*count)/2<<endl;
    return 0;
  }long long count2=0;
  for(int i=s.size()-1;i>=0;i--){
    if(c!=s[i]) break;
    count2++;
  }ans+=((count+count2)/2)*(k-1)+(count/2)+(count2/2);
  long long count3=0;
  for(int i=count;i<s.size()-count2;i++){
    long long log=1;
    while(i+1!=s.size()-count2){
      if(s[i]==s[i+1]){
        log++;
        i++;
      }else break;
    }
    count3+=log/2;
  }
  cout<<(count3*k)+ans<<endl;
}

Measured memory_bytes: 256
def main():
    n, m = map(int, input().split())
    p = list(map(int, input().split()))
    parent = list(range(n+1))
    rank = [0]*(n+1)
    cnt = 0
    
    def root(x):
        if parent[x] == x:
            return x
        parent[x] = root(parent[x])
        return parent[x]
    
    def unite(x, y):
        x = root(x)
        y = root(y)
        if x != y:
            if rank[x] < rank[y]:
                parent[x] = y
            elif rank[x] > rank[y]:
                parent[y] = x
            else:
                parent[y] = x
                rank[x] += 1

    for _ in range(m):
        x, y = map(int, input().split())
        x = root(x)
        y = root(y)
        if x != y:
            parent[y] = x
    for i, pi in enumerate(p, 1):
        if root(i) == root(pi):
            cnt += 1
    print(cnt)

if __name__ == "__main__":
    main()


Measured memory_bytes: 14008
n, k = map(int, input().split())
d = []
a = []

for i in range(k):
    d.append(int(input()))
    a.append(list(map(int, input().split())))

buf = [0 for i in range(n)]

for i in range(k):
    for j in range(d[i]):
        buf[a[i][j] - 1] = 1

k = n - sum(buf)
print(k)

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

using namespace std;

#define fi first
#define se second
#define eb emplace_back
#define mt make_tuple
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

const ll INF=LLONG_MAX;

ld calc(int x1, int y1, int x2, int y2){
	int dx = abs(x1-x2);
	int dy = abs(y1-y2);
	ld dist = dx*dx+dy*dy;
	return sqrt(dist);
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	int n; cin >> n;
	vi seq;
	int x[n],y[n];
	int fact[n+1];
	fact[0]=1;
	for(int i=1; i<=n; i++){
		fact[i]=fact[i-1]*i;
	}
	for(int i=0; i<n; i++){
		cin >> x[i] >> y[i];
		seq.eb(i);
	}
	ld total=(ld)0;
	do{
		for(int i=0; i<n-1; i++){
			total += calc(x[seq[i]],y[seq[i]],x[seq[i+1]],y[seq[i+1]]);
		}
	}while(next_permutation(all(seq)));
	cout << fixed << setprecision(15) << total/fact[n] << endl;
}
	
// READ & UNDERSTAND
// ll, int overflow, array bounds, memset(0)
// special cases (n=1?), n+1 (1-index)
// do smth instead of nothing & stay organized
// WRITE STUFF DOWN


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,x,i,j,k,ans=0;
  cin>>a>>b>>c>>x;
  x/=50;
  for(i=0;i<=a;i++) for(j=0;j<=b;j++) for(k=0;k<=c;k++) if(10*i+2*j+k==x) ans++;
  cout<<ans<<endl;
}

Measured memory_bytes: 3600
sx,sy,tx,ty = map(int,input().split())
dx = tx-sx
dy = ty-sy
ans = ""
for i in range(dx):
    ans += "R"
for i in range(dy):
    ans += "U"
for i in range(dx):
    ans += "L"
for i in range(dy+1):
    ans += "D"
for i in range(dx+1):
    ans += "R"
for i in range(dy+1):
    ans += "U"
ans += "L"
ans += "U"
for i in range(dx+1):
    ans += "L"
for i in range(dy+1):
    ans += "D"
ans += "R"
print(ans)


Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cstring>
#include<map>
#include<utility>
#include<cmath>
#include<queue>
#include<unordered_map>
#include<unordered_set>

using namespace std;
#define ll long long
#define mk make_pair
#define out freopen("out.txt", "w", stdout)
const int N = 2e5 + 10;
const int mod = 998244353;
const int inf = 0x3f3f3f3f;

int a[N];

int main()
{
	int ans = 0, minn;
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)
		scanf("%d", &a[i]);
	ans++;
	minn = a[1];
	for (int i = 2; i <= n; i++)
	{
		if (minn >= a[i])
			ans++;
		minn = min(minn, a[i]);
	}
	cout << ans << endl;
}

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

int main() {
	int N,X,Y;
	cin >> N >> X >> Y;
	vector<int> r(N-1,0);

	rep(i,N)
		for(int j=i+1; j<N; ++j)
			++r.at(min(j-i, abs(X-1-i)+abs(Y-1-j)+1)-1);

	rep(i,N-1)
		cout << r.at(i) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int b[3]={},n,f=0;
	string a;
	cin>>n>>a;
	for(int i=0;i<n;i++) 
	{
		--a[i];
		if(a[i]=='1') f=1;
		b[a[i]-'0']+=(((n-1)&i)==i);
	}
	if(b[1]&1) cout<<"1";
	else if(!f&&(b[2]&1)) cout<<"2";
	else cout<<"0";
	return 0;
}


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

/*
提出前に確認!
- setとmultisetを間違えない
*/

/*
好きな文字をK個自由に入れる
入れられる場所はs.size() + 1箇所
大きさは自由
重複を考えなければ仕切りがs.size() + 1
ものがkなので 26^k * (s.size() + 1 + k)! / ((s.size() + 1)! * k!) 通り
でも実際は重複が存在する
重複しうるのは、もともとの文字の両端に、元々の文字と同じ文字を入れるとき？
^o^o^f^
^a^o^o^f^
^o^o^o^f^
for (int i = 0; i < k; i++)
ans *= 26 * 25 ^ (size + i - 1)
nHk = n+k-1Ck
*/

int mod = 1e9 + 7;

long long modpow(long long x, long long y){
    if (y == 0) return 1;
    if (y % 2) return x * modpow(x, y - 1) % mod;
    long long res = modpow(x, y / 2);
    return res * res % mod;
}

int	main(void)
{
	int k;
	cin >> k;
	string s;
	cin >> s;
	int size = s.size();
	vector<long long> fac(2e6 + 2, 1);
	for (int i = 2; i < 2e6 + 2; i++) fac[i] = fac[i - 1] * i % mod;
	vector<long long> inv(1e6 + 2, 1);
	for (int i = 2; i < 1e6 + 2; i++) inv[i] = (mod - (mod / i) * inv[mod % i] % mod) % mod;
	vector<long long> finv(1e6 + 2, 1);
	for (int i = 2; i < 1e6 + 2; i++) finv[i] = inv[i] * finv[i - 1] % mod;
	long long ans = 0;
	long long pow_25 = modpow(25, k);
	long long pow_26 = 1;
	for (int i = 0; i <= k; i++)
	{
		ans += ((((pow_26 * pow_25 % mod) * fac[(size - 1) + (k - i)] % mod) * finv[size - 1] % mod) * finv[k - i]) % mod; //(n + k - 1)! / (n - 1)! / (k)!
		ans %= mod;
		pow_26 *= 26;
		pow_26 %= mod;
		pow_25 *= inv[25];
		pow_25 %= mod;
	}
	cout << ans << endl;
	return (0);
}


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

int main() {
	int N;
  	cin >> N;
  
  	vector<ll> L(N);
    rep(i,N) {
      cin >> L.at(i);
    }
  
  	int cnt=0;
	for(int i=0; i<N-2; ++i) {
      for(int j=i+1; j<N-1; ++j) {
        if (L.at(i)==L.at(j)) continue;
        for(int k=j+1; k<N; ++k) {
          if ((L.at(i)==L.at(k)) || (L.at(j)==L.at(k))) continue;
          if ((L.at(k)>L.at(i) && L.at(k)>L.at(j)) && (L.at(i)+L.at(j))>L.at(k)) {
            cnt++;
            continue;
          } else if((L.at(j)>L.at(i) && L.at(j)>L.at(k)) && (L.at(i)+L.at(k))>L.at(j)) {
            cnt++;
            continue;
          } else if ((L.at(i)>L.at(j) && L.at(i)>L.at(k)) && (L.at(j)+L.at(k))>L.at(i)) {
            cnt++;
            continue;
          }
        }
      }
    }
  
    cout << cnt << endl;
    return 0;
}

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

#define ll long long int
#define mp make_pair
#define ff first
#define ss second
#define fr(i,l,r) for (long long int i = l; i < r; ++i)
#define frr(i,l,r) for (long long int i = r; i >= l; --i) 
#define sortarr sort(arr,arr+n) //sorts array in asc order
#define sortarr_r sort(arr, arr+n, greater<long long int>()) //sorts array in desc order
#define make_set set<long long int>s //Set arranges in asc order
#define make_set_r set<long long int, greater <long long int>>s ////Set arranges in desc order
#define make_vector vector<long long int>v; 
#define pb push_back


// string size = str.size()

// stack <int> s; 
// queue <int> gquiz; 
// __gcd(m, n) 

// ll arr[10e5 + 5];
// char arr[10e5 + 5];

// printf ("%.9f\n",x);

bool compare(string &s1,string &s2) 
{ 
    return s1.size() < s2.size(); 
} 
void yes()
{
    cout << "YES" << endl;
}
void no()
{
    cout << "NO" << endl;
}


int main(void)
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll n;
    cin >> n;
    n = n%10;
    if(n == 3)
    {
        cout << "bon" << endl;
    }
    else if(n == 0 || n == 1 || n ==6 || n==8)
    {
        cout << "pon" << endl;
    }
    else
    {
        cout << "hon" << endl;
    }
    return 0;
}   

Measured memory_bytes: 3648
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
using namespace std;
 
int main() {
  int h, w;
  string tmp;
  cin >> h >> w;
  vector<string> a(w+2,"#");
  vector<string> b(h);
  for(int i=0;i<h;i++){
    cin >> b[i];
  }

  // 最初の囲い
  for(int i=0;i<w+2;i++){
      cout << a[i];
  }
  cout << endl;
  for(int i=0;i<h;i++){
    cout << "#" << b[i] << "#" << endl; 
  }
  // 最後の囲い
  for(int i=0;i<w+2;i++){
      cout << a[i];
  } 
  cout << endl;
  
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var A, B, C int
	fmt.Scanf("%d %d %d", &A, &B, &C)
	for i := 1; i <= B; i++ {
		if A*i%B == C {
			fmt.Println("YES")
			return
		}
	}
	fmt.Println("NO")
}


Measured memory_bytes: 512
a=input()
len_a=len(a)
a=list(a)

c=0
for i in range(2**(len_a-1)): # 2^(N-1)
  s=a[0]
  for j in range(len_a-1):
      if ((i >> j) & 1) == 1: # 右から順番に1ビットかどうか確認
          s += "+"
      s += a[j+1]
  c += sum(map(int, s.split("+")))

print(c)



Measured memory_bytes: 3316
A,B,C,K = map(int,input().split())
S = A + B + C
S += S * K

if K % 2 == 0:
  # 差がそのまま
  S -= (B-A) + (C-A)
  a = S // 3
  b = a + (B-A)
  ans = a - b
else:
  # 差が逆
  S -= (A-B) + (A-C)
  a = S // 3
  b = a + (A-B)
  ans = a - b
  
if abs(ans) > 10 ** 18:
  print("Unfair")
  exit()
  
print(ans)




Measured memory_bytes: 9148
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<int(n);i++)
#define FOR(i,n,m) for(int i=n;i<int(m);i++)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

int vx[]={0,0,-1,1};
int vy[]={1,-1,0,0};
int dx[]={1,0,-1,1,-1,1,0,-1};
int dy[]={1,1,1,0,0,-1,-1,-1};

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a*b/gcd(a,b);}	

const ll mod=1e9+7;
const int INF=INT_MAX/2;
const int N_MAX=100010;

int main(){
	int x;
	cin>>x;
	if(x<100){
		cout<<0<<endl;
	}else{
		int y=x%1000;
		int z1=x/100;
		int z2=x%100;
		if(z1*5<z2){
			cout<<0<<endl;
		}else{
			cout<<1<<endl;
		}
	}
	return 0;
}



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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;

typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ld> vd;
typedef vector<ll> vl;

typedef set<int> si;
typedef set<ii> sii;
typedef set<ld> sd;
typedef set<ll> sl;

typedef map<int, int> mii;
typedef priority_queue<int> pqi;
typedef queue<int> qi;
 
#define mp make_pair
#define pb push_back
#define f first
#define s second

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

    int n, m;
    cin >> n >> m;
    vector<vi> g(n);
    for (int i = 0, u, v; i < n - 1 + m; i++) {
        cin >> u >> v;
        u--; v--; g[u].pb(v);
    }

    vector<bool> vis(n); vi val(n); vi order;
    function<void(int)> toposort = [&](int u) {
        // cout << u << endl;
        vis[u] = true;
        for (auto &v : g[u]) {
            if (!vis[v]) toposort(v);
        }
        order.pb(u);
    };

    for (int i = 0; i < n; i++) {
        if (!vis[i]) toposort(i);
    }

    reverse(order.begin(), order.end());
    // for (auto &x : order) cout << x << " ";
    // cout << endl;

    /*
    for (auto &x : order) cout << x + 1 << " ";
    cout << endl;
    */

    vi pos(n);
    for (int i = 0; i < n; i++) pos[order[i]] = i;

    vi par(n, -1);
    for (int i = 0; i < n; i++) {
        for (auto &v : g[i]) {
            if (par[v] == -1) par[v] = i;
            else if (pos[i] > pos[par[v]]) par[v] = i;
        }
    }

    for (auto &x : par) cout << x + 1 << endl;
}

/*
USE LONG LONG!!!!

          .=     ,        =.
  _  _   /'/    )\,/,/(_   \ \
   `//-.|  (  ,\\)\//\)\/_  ) |
   //___\   `\\\/\\/\/\\///'  /
,-"~`-._ `"--'_   `"""`  _ \`'"~-,_
\       `-.  '_`.      .'_` \ ,-"~`/
 `.__.-'`/   (-\        /-) |-.__,'
   ||   |     \O)  /^\ (O/  | .        <-  BESSIE THE COW
   `\\  |         /   `\    /
     \\  \       /      `\ /
      `\\ `-.  /' .---.--.\
        `\\/`~(, '()      ('
         /(O) \\   _,.-.,_)    
        //  \\ `\'`      /
       / |  ||   `""""~"`
     /'  |__||
           `o
*/

Measured memory_bytes: 11256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;


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() {
    double a, b;
    cin >> a >>b;

    FOR(i, round(12.5 * a),round(12.5*a + 12.5)) {
        FOR(j, 10 * b, 10*(b+1)) {
            if(i == j) {
                cout << i << endl;
                return 0;
            }
        }
    }
    cout << -1 << endl;
}


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

namespace Atc_0024
{
    class Program
    {
        static void Main(string[] args)
        {
            var rStr = Console.ReadLine();

            int A = int.Parse(rStr.Split(' ')[0]);
            int B = int.Parse(rStr.Split(' ')[1]);
            int C = int.Parse(rStr.Split(' ')[2]);

            if ((A == B && B != C) || (B == C && A != C) || (A == C && A != B))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }

        }
    }
}


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

const int MOD = 1000000007;

vector<pair<long long, long long>> factor(long long n) {
  vector<pair<long long, long long>> res;
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      long long ex = 0;
      while (n % i == 0) {
        ex++;
        n /= i;
      }
      res.push_back({i, ex});
    }
  }
  if (n != 1) res.push_back({n, 1});
  return res;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  map<long long, long long> cnt;
  for (int i = 2; i <= n; i++) {
    vector<pair<long long, long long>> f = factor(i);
    for (auto [p, ex] : f) {
      cnt[p] += ex;
    }
  }
  long long ans = 1;
  for (auto [p, ex] : cnt) {
    ans *= ex + 1;
    ans %= MOD;
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3664
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <istream>
#define rep0(i,n) for (int i = 0; i <= (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
using namespace std;
int main() {
	int N, K;
	long long int save = 9223372036854775807;
	cin >> N >> K;
	vector<long long int>h(N);
	K -= 1;
	N -= 1;
	rep0(i, N)cin >> h[i];
	sort(h.begin(), h.end());
	rep0(j, N - K) {
		save = min(save, h[j + K] - h[j]);
	}
	cout << save << endl;
	return 0;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

const int dx[8] = { 1,1,0,-1,-1,-1,0,1 };
const int dy[8] = { 0,1,1,1,0,-1,-1,-1 };


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	int x, y;
	cin >> x >> y;
	vi vx, vy;
	int n = s.size();
	int cnt = 0;
	REP(i, n) {
		if (s[i] == 'F')cnt++;
		else {
			if ((vx.size() + vy.size()) % 2 == 0)vx.push_back(cnt);
			else vy.push_back(cnt);
			cnt = 0;
		}
	}

	if ((vx.size() + vy.size()) % 2 == 0)vx.push_back(cnt);
	else vy.push_back(cnt);
	cnt = 0;

	x -= vx[0];
	vx.erase(vx.begin());
	vvi dpx(vx.size() + 1, vi(2 * n + 1, 0));
	dpx[0][n] = 1;
	REP(i, vx.size()) {
		REP(j, 2 * n + 1) {
			if (j >= vx[i])dpx[i + 1][j] |= dpx[i][j - vx[i]];
			if (j <= 2 * n - vx[i])dpx[i + 1][j] |= dpx[i][j + vx[i]];
		}
	}
	vvi dpy(vy.size() + 1, vi(2 * n + 1, 0));
	dpy[0][n] = 1;
	REP(i, vy.size()) {
		REP(j, 2 * n + 1) {
	
			if (j >= vy[i])dpy[i + 1][j] |= dpy[i][j - vy[i]];
			if (j <= 2 * n - vy[i])dpy[i + 1][j] |= dpy[i][j + vy[i]];
		}
	}
	if (dpx.back()[n + x] && dpy.back()[n + y])cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 492544
#include<iostream>
#include<queue>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<functional>
#include<set>
using namespace std;
#define int long long
typedef pair<int, int>P;
int v[55];
map<int, int>M1, M2;
int cmb(int n, int r) {
	int ans = 1;
	if (n < r)return 0;
	for (int i = 1; i <= r; i++) {
		int c = n - i + 1;
		ans *= c;
		ans /= i;
	}
	return ans;
}

signed main() {
	int n, a, b;
	cin >> n >> a >> b;
	for (int i = 0; i < n; i++) {
		cin >> v[i];
		M1[v[i]]++;
	}
	sort(v, v + n);
	int s=n-a, g = n - 1;
	double sum = 0;
	for (int i = s; i <= g; i++)sum += v[i];
	printf("%.9f\n", sum / (g - s + 1));

	if (v[s] == v[g]) {
		int ans = 0;
		int k = M1[v[s]];
		for (int i = a; i <= min(b, k);i++) {
			ans += cmb(k, i);
		}
		cout << ans << endl;
	}
	else {
		for (int i = s; i <= g; i++)M2[v[i]]++;
		int ans = 1;
		for (auto itr = M2.begin(); itr != M2.end(); itr++) {
			int F = itr->first, S = itr->second;
			ans *= cmb(M1[F], S);
		}
		cout << ans << endl;
	}
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 h,w;
    cin >> h >> w;
    int32 a, b;
    cin >> a >> b;
    REP(i,h){
        REP(j,w){
            if((i < b) ^ (j < a)){
                cout << 0;
            }else{
                cout << 1;
            }
        }
        cout << endl;
    }
    return 0;
}

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

//#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(n) begin(n),end(n)
#define rall(v) (v).rbegin(),(v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1002000007
#define INF LONG_LONG_MAX

 
int main(){
    int a,b,t;
    cin>>a>>b>>t;
    int su=0;
    cout<<(t/a)*b<<endl;
}

Measured memory_bytes: 256
h, w = list(map(int, input().split()))
b = [["#" for j in range(w + 2)] for i in range(h + 2)]

a = []

for i in range(h):
    a.append(list(input()))

for i in range(h):
    for j in range(w):
        b[i+1][j+1] = a[i][j]

for i in range(h + 2):
    for j in range(w + 2):
        print(b[i][j], end = "")
    print("")

Measured memory_bytes: 4596
while True:
    try:
        string = input()
        if int(string[:2]) > 0 and int(string[:2]) <= 12:
            if int(string[2:]) > 0 and int(string[2:]) <= 12:
                print('AMBIGUOUS')
            else:
                print('MMYY')
        else:
            if int(string[2:]) > 0 and int(string[2:]) <= 12:
                print('YYMM')
            else:
                print('NA')
    except:
        break

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

S = [0]*(N+1)
for i in range(N)[::-1]:
  S[i] = S[i+1]+A[i+1]

r = 1
ans = 1
for i in range(N+1):
  r -= A[i]
  if i<N and r<=0 or r<0:
    print(-1)
    exit(0)
  r = min(2*r, S[i])
  ans += r
print(ans)


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

class GetAC {
  private:
  	int N, Q;
  	std::string str;
  	std::vector<int> t;
  
  public:
  	void MakeArray (){
	  for(int i=0; i<str.size(); i++){
        if ( i==0 ) t[0] = 0;
        if ( str[i-1] == 'A' && str[i] == 'C' ) {
          t[i] = t[i-1] + 1;
        }
        else {
          t[i] = t[i-1];
        }
      }
    }
  
  
  	GetAC ( int N_, int Q_, std::string str_ ) {
      N = N_; Q = Q_; str = str_;
      t.resize(N);
      MakeArray();
    }
  
  	int Sol ( int l, int r ) {
      return t[r] - t[l];
    }
};

int main (void){
  int N, Q; std::cin >> N >> Q;
  std::string str; std::cin >> str;
  
  GetAC ac ( N, Q, str );
  
  for(int i=0; i<Q; i++){
    int l, r; std::cin >> l >> r;
    std::cout << ac.Sol(l-1,r-1) << std::endl;
  }
  
  return 0;
}

Measured memory_bytes: 1408
S=list(input())                                                                                                                                        
T=list(input())                                                                                                                                        
                                                                                                                                                       
T_size = len(T)                                                                                                                                        
                                                                                                                                                       
def match_num(x):                                                                                                                                      
    return T_size - sum([1 for a,t in zip(x, T) if a==t])                                                                                              
                                                                                                                                                       
b=[]                                                                                                                                                   
for i in range(len(S)-T_size+1):                                                                                                                       
    b.append(match_num(S[i:i+T_size]))                                                                                                                 
                                                                                                                                                       
print(min(b))

Measured memory_bytes: 9024
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=100010;
const ll mod=1e9+7;

vector<int> v[mx];

vector<int> low(mx,-1);
vector<int> ord(mx,-1);
vector<pair<int,int>> bridge;                            //bridge
vector<int> art;                                         //articulation list


void dfs(int &count, int from, int x){
  ord[x] = count++;
  low[x] = ord[x];
  bool isart=false;
  int cnt=0;
  
  for(auto to:v[x]){
    if(to==from){ continue; }                            //kitatokoro
    if(ord[to]==-1){                                     // unseen
      cnt++;
      dfs(count,x,to); 
      if(ord[x]<low[to]){ bridge.emplace_back(min(x,to),max(x,to)); } //bridge?       
      if(from!=-1 && ord[x]<=low[to]){ isart=true; }
      low[x] = min(low[x],low[to]);
    } else { low[x] = min(low[x],ord[to]); }
  }
  if(from==-1 && cnt>1){ isart=true; }
  if(isart){ art.emplace_back(x);}                       //articulation?
}
 

int main(){
  int n,m;
  cin >> n >> m;
  rep(i,m){
    int a,b; cin >> a >> b; a--; b--;
    v[a].emplace_back(b);
    v[b].emplace_back(a);
  }
  int cnt=0;
  dfs(cnt,-1,0);
  cout << bridge.size() << endl;
  return 0;
}


Measured memory_bytes: 3328
#include <stdio.h>
#include <string.h>
typedef struct {char name[11];int t;}queue;
queue que[1000000];

int main(void){
    int i,n,q;
    scanf("%d %d",&n,&q);
    int cnt=n,st=1,el=0;
    for(i=1;i<=n;i++){scanf("%s %d",que[i].name,&que[i].t);}
    while (cnt>0){
        if (que[st].t<=q){
            el+=que[st].t;
            printf("%s %d\n",que[st].name,el);
            st++;cnt--;
        }
        else{
            el+=q;que[st+cnt].t=(que[st].t)-q;
            strcat(que[st+cnt].name,que[st].name);
            st++;
        }
    }
    return 0;
}



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

int main(){
    int a,b;
    cin>>a>>b;

    int tap=0;
    int kuti=1;
    while(kuti < b){
        kuti--;
        kuti += a;
        tap++;
    }
    cout<<tap<<endl;

    return 0;
}

Measured memory_bytes: 256
// Aizu 2182: Eleven Lover
// 2017.9.20 bal4u@uu
// 2017.11.22

#include <stdio.h>
#include <string.h>

char a[80005];
int dp[2][11];

int main()
{
	int i, d, k1, k2, ans;
	char *p;

	while (scanf("%s", a) && *a != '0') {
		memset(dp, 0, sizeof(dp)); ans = 0;
		for (k1 = 0, k2 = 1, p = a; *p; k1 = k2, k2 = !k2) {
			memset(dp[k2], 0, 11*sizeof(int));
//			for (i = 0; i < 11; i++) dp[k2][i] = 0;
			d = *p++ & 0xf;
			for (i = 0; i < 11; i++) dp[k2][((i<<3)+(i<<1)+d) % 11] += dp[k1][i]; 
			ans += dp[k2][0];
			if (d > 0) dp[k2][d]++;
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 1872
#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<algorithm>
#include<queue>
#include<list>
#include<stack>
#include<cstdio>
#include<fstream>
#include<numeric>
#include<functional>
#include<utility>
#include<memory>
#include<cstring>
#include<bits/stdc++.h>
using namespace std; 
  
#define CLEAN(a,b) memset(a,b,sizeof(a))
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;

const int maxn=1e5*2+10;
ll a[maxn],b[maxn];
int n;

int main()
{
	cin>>n;
	for (int i=0;i<n;i++)
	{
		cin>>a[i];
		b[i]=a[i]-i-1;
	}
	ll sum=0;
	sort(b,b+n);
	for (int i=0;i<n;i++)
	{
		sum+=abs(a[i]-b[(n+1)/2-1]-i-1);
	}
	cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

string ser(string seq) {
  if (seq.size() == 6) {
    return seq;
  }
  return ser('0' + seq);
}

int main()
{
  int n, m;
  cin >> n >> m;
  vector<vector<ll>> prefs(n+1, vector<ll>(0));
  vector<map<ll, int>> mps(n+1);
  vector<pair<int, ll>> cs;
  rep(i, m) {
    int x;
    ll y;
    cin >> x >> y;
    cs.push_back(make_pair(x, y));
    cs[i].first;
    prefs[cs[i].first].push_back(cs[i].second);
  } 
  rep(i, n+1) {
    if (prefs[i].size() > 0) {
      sort(prefs[i].begin(), prefs[i].end());
      rep(j, prefs[i].size()) {
        mps[i][prefs[i][j]] = j+1;
      }
    }
  }
  rep(i, m) {
    int ord = mps[cs[i].first][cs[i].second];
    cout << ser(to_string(cs[i].first)) + ser(to_string(ord)) << endl;
  }
  return 0;
}

Measured memory_bytes: 21044
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]
d = [[1, 0], [-1, 0], [0, 1], [0, -1]]

for i in range(h):
    for j in range(w):
        if s[i][j] == "#":
            flg = False
            for x, y in d:
                if 0 <= x + j < w and 0 <= y + i < h:
                    if s[y+i][x+j] == "#":
                        flg = True
                        break
            else:
                if not flg:
                    print("No")
                    exit()

print("Yes")

Measured memory_bytes: 39152