akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;

int N, M;
int wa[100002];
bool done[100002];
int cor = 0, pen; string s;
int main(){
    cin.sync_with_stdio(0);
    cin.tie(0);
    cin >> N >> M;
    for (int i = 1, p; i <= M; i++) {
        cin >> p >> s;
        if(!done[p]){
            if(s=="WA"){
                wa[p]++;
            } else{
                cor++;
                pen += wa[p];
                done[p] = true;
            }
        }
    }
    cout << cor << ' '<< pen;
    return 0;
}

Measured memory_bytes: 768
#include <stdio.h>
#include <utility>
#include <algorithm>
#include <set>
using namespace std;
typedef long long ll;

int main(void) {
  ll i, j, k, n, q, a;
  char c[10];
  scanf("%lld%lld", &n, &q);
  pair<ll, ll> tm[n];
  ll pos[n], s[n];
  for(i = 0; i < n; ++i) {
    scanf("%lld", &tm[i].first);
    tm[i].second = i;
  }
  sort(tm, tm + n);
  for(i = 0; i < n; ++i) s[i] = tm[i].first, pos[tm[i].second] = i;
  multiset<ll> ms;
  for(i = 0; i < q; ++i) {
    scanf("%s%lld", c, &a);
    if(c[0] == 'A') --a, ms.insert(s[pos[a]]);
    else if(c[0] == 'R') --a, ms.erase(ms.lower_bound(s[pos[a]]));
    else {
      multiset<ll>::iterator it;
      if(ms.empty()) {
        if(a != n) printf("NA\n");
        else printf("0\n");
        continue;
      }
      it = ms.end();
      it--;
      if(s + n - upper_bound(s, s + n, *it) > a) {
        printf("NA\n");
        continue;
      }
      ll t = 1e9, h = -1;
      while(t != h + 1) {
        ll now = (t + h) / 2, las = -1, ans = 0;
        for(it = ms.begin(); it != ms.end(); ++it) {
          int f = lower_bound(s, s + n, *it - now) - s, b = upper_bound(s, s + n, *it) - s;
          if(f > las) ans += b - f;
          else ans += b - las - 1;
          las = b - 1;
        }
        if(ans >= n - a) t = now;
        else h = now;
      }
      printf("%lld\n", t);
    }
  }
  return 0;
}


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

int main(){
  int N;
  cin >> N;
  int F[N][10];
  int P[N][11];
  for(int i=0; i<N; i++){
    for(int j=0; j<10; j++) F[i][j]=0;
  }
  for(int i=0; i<N; i++){
    for(int j=0; j<11; j++) P[i][j]=0;
  }
  for(int i=0; i<N; i++){
    for(int j=0; j<10; j++) cin >> F[i][j];
  }
  for(int i=0; i<N; i++){
    for(int j=0; j<11; j++) cin >> P[i][j];
  }
  int ans=-1000000001;
  for(int i=1; i<1024; i++){
    vector<int> Opn(10);
    int temp=i;
    for(int j=0; j<10; j++){
      Opn.at(j)=temp%2;
      temp=temp/2;
    }
    int ant=0;
    for(int j=0; j<N; j++){
      int cnt=0;
      for(int k=0; k<10; k++){
        if(F[j][k]==1 && Opn.at(k)==1) cnt++; 
      }
      ant+=P[j][cnt];
    }
    ans=max(ans, ant);
  }
  cout << ans << endl;
}

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

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			var n = ReadLineInt();
			var d = new int[n, 2];
			var cnt = 0;
			var f = false;
			for (int i = 0; i < n; i++)
			{
				var input = ReadLineIntSplit();
				d[i, 0] = input[0];
				d[i, 1] = input[1];
				if (input[0] == input[1])
					cnt++;
				else
					cnt = 0;
				if (cnt >= 3)
				{
					f = true;
					break;
				}
			}
			if (f) Console.WriteLine("Yes");
			else Console.WriteLine("No");
		}

		public static int nCm(int n, int m)
		{
			if (n == 0) return 0;
			if (m == 0) return 1;
			return n * nCm(n - 1, m - 1) / m;
		}

		public static string ReadLine()
		{
			return Console.ReadLine();
		}

		public static int ReadLineInt()
		{
			return int.Parse(ReadLine());
		}

		public static long ReadLineLong()
		{
			return long.Parse(ReadLine());
		}

		public static string[] ReadLineStringSplit(char s = ' ')
		{
			return ReadLine().Split(s).ToArray();
		}

		public static int[] ReadLineIntSplit(char s = ' ')
		{
			return ReadLine().Split(s).Select(x => int.Parse(x)).ToArray();
		}

		public static long[] ReadLineLongSplit(char s = ' ')
		{
			return ReadLine().Split(s).Select(x => long.Parse(x)).ToArray();
		}
	}
}

Measured memory_bytes: 19124
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <iterator>
#include <limits>
#include <numeric>
#include <utility>
#include <cmath>
#include <cassert>
#include <cstdio>

// #include <unordered_set>
// #include <unordered_map>

#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())

#define pb push_back
#define mp make_pair

int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}

typedef std::pair<int, int> P;
typedef long long ll;
typedef long double ld;

const int MOD = 1000000007;
const int INF = 1e9;
const ll LINF = INF * 1ll * INF;
const ld DINF = 1e200;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

using namespace std;

// #define int long long

signed main(){
  

    ios::sync_with_stdio(false);
    cin.tie(0);
    //cin高速化

    int n;
    cin>>n;

    int a[n];
    int tmp[n];

    REP(i,n){
        cin>>a[i];
        tmp[i]=a[i];
    }

    sort(a,a+n);

    int left=a[n/2];
    int right=a[(n/2)-1];

    // cout<<right<<" "<<left<<endl;


    // REP(i,n){
    //     cout<<a[i]<<" ";
    // }cout<<endl;

    // cout<<a[n/2]<<endl;
    // cout<<a[(n/2)-1]<<endl;


    REP(i,n){

        // cout<<right<<" "<<a[i]<<" "<<left<<" "<<i<<endl;

        if(tmp[i]>=left){
            cout<<right<<endl;
        }else{
            cout<<left<<endl;
        }


    }
    
}

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

using namespace std;

template< typename cost_t >
struct FordFulkerson {
  struct edge {
    int to;
    cost_t cap;
    int rev;
    bool isrev;
  };

  vector< vector< edge > > graph;
  vector< int > used;
  const cost_t INF;
  int timestamp;

  FordFulkerson(int n) : INF(numeric_limits< cost_t >::max()), timestamp(0) {
    graph.resize(n);
    used.assign(n, -1);
  }

  void add_edge(int from, int to, cost_t cap) {
    graph[from].emplace_back((edge) {to, cap, (int) graph[to].size(), false});
    graph[to].emplace_back((edge) {from, 0, (int) graph[from].size() - 1, true});
  }

  cost_t dfs(int idx, const int t, cost_t flow) {
    if(idx == t) return flow;
    used[idx] = timestamp;
    for(auto &e : graph[idx]) {
      if(e.cap > 0 && used[e.to] != timestamp) {
        cost_t d = dfs(e.to, t, min(flow, e.cap));
        if(d > 0) {
          e.cap -= d;
          graph[e.to][e.rev].cap += d;
          return d;
        }
      }
    }
    return 0;
  }

  cost_t max_flow(int s, int t) {
    cost_t flow = 0;
    for(cost_t f; (f = dfs(s, t, INF)) > 0; timestamp++) {
      flow += f;
    }
    return flow;
  }

  void output() {
    for(int i = 0; i < graph.size(); i++) {
      for(auto &e : graph[i]) {
        if(e.isrev) continue;
        auto &rev_e = graph[e.to][e.rev];
        cout << i << "->" << e.to << " (flow: " << rev_e.cap << "/" << e.cap + rev_e.cap << ")" << endl;
      }
    }
  }
};

int main() {
  int V, E;
  scanf("%d %d", &V, &E);
  FordFulkerson< int > g(V);
  for(int i = 0; i < E; i++) {
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    g.add_edge(a, b, c);
  }
  printf("%d\n", g.max_flow(0, V - 1));
}


Measured memory_bytes: 3348
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	month, day := nextInt(), nextInt()
	cnt := 0

	for i := 1; i <= month; i++ {
		for j := 1; j <= day; j++ {
			d1 := j % 10
			d2 := j / 10
			if d1 >= 2 && d2 >= 2 && (d1*d2) == i {
				cnt++
			}

		}
	}

	fmt.Println(cnt)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REPR(i,n) for (int i=(int)(n)-1;i>=0;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
#define tpl(...) make_tuple(__VA_ARGS__)
const int INF = 0x3f3f3f3f;
const double EPS = 1e-8;
const double PI = acos(-1);
const int dy[] = {-1,0,1,0};
const int dx[] = {0,1,0,-1};
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; }
template<typename Ch,typename Tr,typename C,typename=decltype(begin(C()))>basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>&os,
const C& c){os<<'[';for(auto i=begin(c);i!=end(c);++i)os<<(i==begin(c)?"":" ")<<*i;return os<<']';}
template<class S,class T>ostream&operator<<(ostream &o,const pair<S,T>&t){return o<<'('<<t.first<<','<<t.second<<')';}
template<int N,class Tp>void output(ostream&,const Tp&){}
template<int N,class Tp,class,class ...Ts>void output(ostream &o,const Tp&t){if(N)o<<',';o<<get<N>(t);output<N+1,Tp,Ts...>(o,t);}
template<class ...Ts>ostream&operator<<(ostream&o,const tuple<Ts...>&t){o<<'(';output<0,tuple<Ts...>,Ts...>(o,t);return o<<')';}
template<class T>void output(T t,char z=10){if(t<0)t=-t,putchar(45);int c[20];
int k=0;while(t)c[k++]=t%10,t/=10;for(k||(c[k++]=0);k;)putchar(c[--k]^48);putchar(z);}
template<class T>void outputs(T t){output(t);}
template<class S,class ...T>void outputs(S a,T...t){output(a,32);outputs(t...);}
template<class T>void output(T *a,int n){REP(i,n)cout<<a[i]<<(i!=n-1?',':'\n');}
template<class T>void output(T *a,int n,int m){REP(i,n)output(a[i],m);}
template<class T>bool input(T &t){int n=1,c;for(t=0;!isdigit(c=getchar())&&~c&&c-45;);
if(!~c)return 0;for(c-45&&(n=0,t=c^48);isdigit(c=getchar());)t=10*t+c-48;t=n?-t:t;return 1;}
template<class S,class ...T>bool input(S&a,T&...t){input(a);return input(t...);}
template<class T>bool inputs(T *a, int n) { REP(i,n) if(!input(a[i])) return 0; return 1;}

int main() {
  int h,w;
  while(input(h, w)) {
    int g[10][10];
    REP(i,10)REP(j,10)cin>>g[i][j];
    REP(k,10)REP(i,10)REP(j,10)
      chmin(g[i][j], g[i][k]+g[k][j]);
    int ans = 0;
    REP(i,h)REP(j,w)
    {
      int x;
      cin >> x;
      if (x != -1)
        ans += g[x][1];
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 256
//I
//01背包
#include<cstdio>
#include<iostream> 
#include<cstring>
using namespace std;
int w[110],c[110];
long long f[100010];//f[v]表示不超过v价值的最小体积 
int main()
{
	for(int i=0;i<100010;i++)
		f[i]=1000000010;
	long long m,n,flag=0; 
	scanf("%d%d",&n,&m);//背包容量m和物品数量n 
	for(int i=1;i<=n;i++)
		scanf("%d%d",&w[i],&c[i]);//重量和价值 
	f[0]=0;
	for(int i=1;i<=n;i++)
		for(int v=100010;v>=c[i];v--)
			if(f[v-c[i]]+w[i]<f[v])
			{
				f[v]=f[v-c[i]]+w[i];
				if(f[v]<=m&&v>flag)
					flag=v;
			}
	printf("%lld",flag);
 } 

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


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

  if(a - b > 1 || b - a > 1){
    cout << 0 << endl;
  }
  else{
  long long ans = 1;
  long long q = pow(10, 9) + 7;

  for(int i = 1; i <= a; i++){
    ans *= i;
    ans %= q;
  }
  for(int i = 1; i <= b ; i++){
    ans *= i;
    ans %= q;
  }
  if(a == b){ans *= 2; ans %= q;}

  cout << ans << endl;
  }
}       

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;using ll=int_fast64_t;using ld=long double;using pll=pair<ll,ll>;constexpr ll INF=1LL<<60,MOD=1e9+7;//998244353;
void solve();int main(){cin.tie(nullptr);ios::sync_with_stdio(false);cout<<fixed<<setprecision(10);solve();return 0;}
#define SELECTOR(_1,_2,_3,_4,SELECT,...) SELECT
#define rep(...) SELECTOR(__VA_ARGS__,_rep2,_rep1,_rep0)(__VA_ARGS__)
#define _rep0(i,n) for(int i=0;i<(int)n;++i)
#define _rep1(i,k,n) for(int i=k;i<(int)n;++i)
#define _rep2(i,k,n,d) for(int i=k;d>0?i<(int)n:i>(int)n;i+=d)
#ifdef __LOCAL
#include "ostreams.h"
#endif
template<class T> inline bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
template<class T> vector<T> make_vector(size_t a,T b){return vector<T>(a,b);}
template<class... Ts> auto make_vector(size_t a,Ts... ts){return vector<decltype(make_vector(ts...))>(a,make_vector(ts...));}
void print(){cerr<<endl;} template<class T,class... Ts> void print(const T& a,const Ts&... ts){cerr<<a<<' ';print(ts...);}

using P = tuple<ll, ll, ll, ll, ll>;
void solve(){
    ll m, n, k; cin >> m >> n >> k;
    ll si, sj, ti, tj; cin >> si >> sj >> ti >> tj;
    si--; sj--; ti--; tj--;
    vector<string> grid(m);
    rep(i, m) cin >> grid[i];
    priority_queue<P, vector<P>, greater<P>> heap;
    auto dist = make_vector(m, n, 4, make_pair(INF, (ll)0));
    rep(i, 4){
        dist[si][sj][i] = {0, 0};
        heap.push({0, 0, si, sj, i});
    }

    vector<pair<ll, ll>> D{{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
    while(!heap.empty()){
        auto [d, r, i, j, dir] = heap.top(); heap.pop();
        if(dist[i][j][dir] != make_pair(d, r)) continue;
        // change direction
        rep(ndir, 4){
            pair<ll, ll> nd{d + (r > 0), 0};
            if(dist[i][j][ndir] > nd){
                dist[i][j][ndir] = nd;
                heap.push({nd.first, nd.second, i, j, ndir});
            }
        }
        // move to forth
        auto [di, dj] = D[dir];
        ll ni = i + di, nj = j + dj;
        if(not (0 <= ni and ni < m and 0 <= nj and nj < n)) continue;
        if(grid[ni][nj] == '@') continue;
        pair<ll, ll> nd;
        if(r == k - 1) nd = {d + 1, 0};
        else nd = {d, r + 1};
        if(dist[ni][nj][dir] > nd){
            dist[ni][nj][dir] = nd;
            heap.push({nd.first, nd.second, ni, nj, dir});
        }
    }

    ll ans = INF;
    rep(dir, 4){
        auto [d, r] = dist[ti][tj][dir];
        chmin(ans, d + (r > 0));
    }
    if(ans == INF) ans = -1;
    cout << ans << endl;
}

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

int main(){
  int n,cnt=1;
  cin >> n;
  vector<int> mochis(n);
  for(int i=0;i<n;i++){
    cin >> mochis.at(i);
  }
  sort(mochis.begin(),mochis.end());
  for(int i=0;i<n-1;i++){
    if(mochis.at(i)<mochis.at(i+1))cnt++;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 3592
using System;
using System.Linq;

public class A{
  static void Main(string[] args)
  {            
    var inputs = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse).OrderByDescending(x => x);
    Console.WriteLine(inputs.ElementAt(0) * 10 + inputs.ElementAt(1) + inputs.ElementAt(2));
  }
}

Measured memory_bytes: 13396
from collections import Counter


N = int(input())
S = input()

# 等間隔に並んでいる
count = 0

for start in range(N):
  offset = 1
  while True: 
      middle = start + offset
      end = middle + offset

      if end >= N:
          break

      s = {S[start], S[middle], S[end]}

      if len(s) == 3:
          count += 1

      offset += 1

c = Counter(S)

if len(c) != 3:
  print(0)
else:  
  x, y, z = c.values()
  print(x * y * z - count)


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

int main()
{
  int flag=0;
    char s[15];
    int y;
    int m;
    int d;
    // 入力
    scanf("%s", s);
    y=atoi(strtok(s,"/"));
    m=atoi(strtok(NULL,"/"));
    d=atoi(strtok(NULL,"/"));
    // 出力
  if(y>2019){
	flag=1;
  }else if(y==2019){
  if(m>4){
    flag=1;
  } else if(m==4&&d>30){
    flag =1;
  }
  }
  if(flag==0){
    printf("Heisei\n");
  }
  else{
    printf("TBD\n");
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define gcd            __gcd
#define setbits(x)     __builtin_popcountll(x)
#define zrobits(x)     __builtin_ctzll(x)
#define mod            1000000007
#define mod2           998244353
#define maxe           *max_element
#define mine           *min_element
#define inf            1e18
#define deci(x,y)      fixed<<setprecision(y)<<x
#define w(t)           int t; cin>>t; while(t--)
#define nitin          ios_base::sync_with_stdio(false); cin.tie(NULL)
#define PI             3.141592653589793238
using namespace std;

int power(int x, int y, int p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
int modi(int a, int m)
{
    return power(a, m - 2, m);
}
int32_t main()
{
    nitin;
    int n;
    cin>>n;
    vector<int>v(n);
    int median=0;
    for(int i=0;i<n;i++){
        cin>>v[i];
        v[i]=v[i]-i-1;
    }
    sort(v.begin(),v.end());
    if(n%2!=0)
        median=v[n/2];
    else
        median=(v[n/2]+v[n/2-1])/2;
    int ans=0;
    for(int i=0;i<n;i++){
        ans+=abs(v[i]-median);
    }
    cout<<ans<<endl;
    return 0;
}

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

print(N*(N-1)//2-N//2)
if N%2 == 1:
    for i in range(1, N):
        for j in range(i+1, N+1):
            if i == N-j:
                continue
            print(i, j)
else:
    for i in range(2, N):
        print(1, i)
        print(N, i)
    for i in range(2, N):
        for j in range(i+1, N):
            if i+j == N+1:
                continue
            print(i, j)

Measured memory_bytes: 3616
#include <iostream>
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include<math.h>
using namespace std;
//#define int long long
#define m_p make_pair
#define mod 1000000007
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define all(v)  v.begin(),v.end()
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>vec[i];
using namespace std;

int jousu(int, int);
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int kurai(int x00, int y00) {
	int z00 = (x00 % jousu(10, y00)) / jousu(10, y00 - 1);
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}



int main() {
	string s;
	cin >> s;
	if (s.size() % 2 == 1) {
		cout << "No" << endl;
		return 0;
	}
	for (int i = 0; i < s.size(); i += 2) {
		if (s[i] != 'h' || s[i + 1] != 'i') {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}



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

vector<ll> s;
void solve(){
    ll n,m,num,b,a,c,m1,m2,a1,a2;
    ll ans=0;
    ll ans1=0,ans2=0;
    cin>>n;
       for(int i=0;i<n;i++){
       cin>>num;
        c=num-i-1;
       s.push_back(c);
    }
    sort(s.begin(),s.end());
    if(n%2==0)
    {    
        m1=s[(n/2)-1];
        m2=s[n/2];
    for(int i=0;i<n;i++){
        a1=abs(s[i]-m1);
        ans1+=a1;
        a2=abs(s[i]-m2);
        ans2+=a2;
    }
    cout<<min(ans1,ans2)<<endl;

    }
    else
    { 
        m=s[n/2];
  for(int i=0;i<n;i++){
        a=abs(s[i]-m);
        ans+=a;
    }
    cout<<ans<<endl;


    }

}
int main(){
    solve();
    return 0;
}

Measured memory_bytes: 2420
acgt = ["A", "C", "G", "T"]
arr = gets.chomp.chars.map(&:to_s)


arr.each_with_index do |v, k|
  arr[k] = "hoge" unless acgt.include?(v)
end

result = []
i = 0
arr.each_with_index do |v, k|
  if v != "hoge"
    i += 1
    if k == arr.length - 1
      result << i 
    end
  else
    result << i
    i = 0
  end
end

puts result.max

Measured memory_bytes: 1788
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > > 
#define pq_pair_ts priority_queue <pair<ll,ll> > //第二成分の大きさが関係ない
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}

struct PrimeNumbers {
    
    vector<bool> sieve;
    vector<long long> prime;
    
    PrimeNumbers (int n) : sieve(n+1,true) {
        sieve[0] = sieve[1] = false;
        for (long long i = 2; i < sieve.size(); i++) {
            if (sieve[i]) {
                prime.push_back(i);
                for (long long j = i * i; j < sieve.size(); j += i) {
                    sieve[j] = false;
                }
            }
        }
    }
    
    bool isPrime(long long n) {
        return sieve[n];
    }
    
    int size(void) {
        return (int) prime.size();
    }
    
    long long  operator [] (int n) {
        return  prime[n];
    }
    
};
/*
 O(N loglogN) ←早い!
 usage:
 PrimeNumbers prime(N); // Nまでの素数を列挙
 prime.size();  //素数の数
 prime[i]; //i番目の素数
 prime.isPrime(A); // bool, Aの素数判別
 */

ll N , P;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin >> N >> P ;
    if(N==1){ cout << P << endl; return 0;}
    PrimeNumbers prime((int)sqrt(P+1));
    
    ll ans = 1;
    rep(i, prime.size()){
        ll num = prime[i];
        ll cnt = 0;
        while(P%num == 0){
            cnt ++;
            P/=num;
        }
        if(cnt >= N){
            ans *= pow(num, (cnt / N));
        }
    }
    
    cout << ans << endl;
    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


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

int main() {
	set<int> s;
	int sum = 0;
	for (int i = 0; i < 3; i++) {
		int a; cin >> a;
		sum += a;
		s.insert(a);
	}
	if (sum % 2 == 0 && s.count(sum/2)) { cout << "Yes\n"; return 0; }
	cout << "No\n";
}

Measured memory_bytes: 256
#!/usr/bin/env python3


class UnionFind():
    # 作りたい要素数nで初期化
    # 使用するインスタンス変数の初期化
    def __init__(self, n):
        self.n = n
        # root[x]<0ならそのノードが根かつその値が木の要素数
        # rootノードでその木の要素数を記録する
        self.root = [-1] * (n + 1)
        # 木をくっつける時にアンバランスにならないように調整する
        self.rnk = [0] * (n + 1)

    # ノードxのrootノードを見つける
    def Find_Root(self, x):
        if(self.root[x] < 0):
            return x
        else:
            # ここで代入しておくことで、後の繰り返しを避ける
            self.root[x] = self.Find_Root(self.root[x])
            return self.root[x]
    # 木の併合、入力は併合したい各ノード

    def Unite(self, x, y):
        # 入力ノードのrootノードを見つける
        x = self.Find_Root(x)
        y = self.Find_Root(y)
        # すでに同じ木に属していた場合
        if(x == y):
            return
        # 違う木に属していた場合rnkを見てくっつける方を決める
        elif(self.rnk[x] > self.rnk[y]):
            self.root[x] += self.root[y]
            self.root[y] = x

        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            # rnkが同じ（深さに差がない場合）は1増やす
            if(self.rnk[x] == self.rnk[y]):
                self.rnk[y] += 1
    # xとyが同じグループに属するか判断

    def isSameGroup(self, x, y):
        return self.Find_Root(x) == self.Find_Root(y)

    # ノードxが属する木のサイズを返す
    def Count(self, x):
        return -self.root[self.Find_Root(x)]


def main():
    N, M = map(int, input().split())
    UF = UnionFind(N)
    for _ in range(M):
        a, b = map(int, input().split())
        UF.Unite(a, b)
    ans = 0
    for i in range(N):
        ans = max(ans, UF.Count(i + 1))
    print(ans)


if __name__ == "__main__":
    main()


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

string str;
deque<bool> deq;

int main( void ) {
    
    int n, k;
    cin >> n >> k >> str;
    
    if( k > (n << 1) )
        k = (n << 1) + (k & 1);
    
    for( char ch : str )
        deq.push_back( ch - 'A' );
    
    bool ok = false;
    for( int i = 1; i <= k; i ++ ) {
        if( deq.front() == ok )
            deq.front() = !deq.front();
        else {
            ok = !ok;
            deq.pop_front();
            deq.push_back( ok );
        }
    }
    
    str.clear();
    for( bool x : deq )
        str.push_back( 'A' + ( !ok == x ) );
    
    cout << str << endl;
    return 0;
}

Measured memory_bytes: 900
#include <cstdint>
#include <iostream>
#include <vector>

using namespace std;

int32_t main() {
  while (true) {
    uint32_t n, k, m;
    cin >> n >> k >> m;

    if (n == 0 && k == 0 && m == 0) break;

    uint32_t size = n;
    vector<uint32_t> ring(n);
    for (uint32_t i = 0; i < ring.size(); i++) {
      ring[i] = i + 1;
    }

    uint32_t index = m - 1;
    ring.erase(ring.begin() + index);
    size--;
    while (1 < size) {
      index += k - 1;
      index %= size;
      ring.erase(ring.begin() + index);
      size--;
    }
    cout << ring[0] << endl;
  }

  return 0;
}

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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    char s[1231];
    Scs(s);
    int N = strlen(s)/2;

    bool ok = true;
    Rep(i,N){
        if( s[i] != s[N-1-i] ) ok = false;
        if( s[N+1+i] != s[N*2-i] ) ok = false;
        if( s[i] != s[N*2-i] ) ok = false;
    }

    YesNo(ok);

    return 0;
}



Measured memory_bytes: 256
import sys
input = sys.stdin.readline
h,n = map(int,input().split())
ab = [list(map(int,input().split()))for i in range(n)]
amx = 0
for i in range(n):
    if amx < ab[i][0]:
        amx = ab[i][0]
#dp[i] = モンスターの削る体力がiの時の魔力の消費の最小値
dp = [float('inf')]*(amx + h + 1)
dp[0] = 0
for i in range(amx + h + 1):
    for m in ab:
        if i-m[0] >= 0:
            dp[i] = min(dp[i], dp[i-m[0]] + m[1])

ans = float('inf')
for i in range(h,amx + h + 1):
    ans = min(ans, dp[i])

print(ans)


Measured memory_bytes: 43100
#include <stdio.h>

int main(void)
{
	int N, A[20], B[20], C[20];
	int i;
	int s=0, b=-1;	// 満足度の合計、現在の料理Aの値
	
	// 入力
	scanf("%d", &N);
	for(i=0; i<N; i++)	scanf("%d", &A[i]);
	for(i=0; i<N; i++)	scanf("%d", &B[i]);
	for(i=0; i<N-1; i++)scanf("%d", &C[i]);
	
	for(i=0; i<N; i++){
		//printf("%d %d %d\n", A[i], B[A[i]-1], b);
		s += B[A[i]-1];	// 満足度Bを追加
		if(i>0 && b==A[i]-1)	s += C[b-1];	// 順番通りなら満足度Cを追加
		b = A[i];	// 現在の料理Aの値を格納
		//printf("%d\n", s);
	}
	
	printf("%d\n", s);
	
	return 0;
}

Measured memory_bytes: 128
from itertools import starmap


def cross(a, b):
    return a.real * b.imag - a.imag * b.real


def has_intersection(p0, p1, p2, p3):
    max_x1, min_x1 = (p0.real, p1.real) if p0.real > p1.real else (p1.real, p0.real)
    max_x2, min_x2 = (p2.real, p3.real) if p2.real > p3.real else (p3.real, p2.real)
    if max_x1 < min_x2 or max_x2 < min_x1:
        return False
    max_y1, min_y1 = (p0.imag, p1.imag) if p0.imag > p1.imag else (p1.imag, p0.imag)
    max_y2, min_y2 = (p2.imag, p3.imag) if p2.imag > p3.imag else (p3.imag, p2.imag)
    if max_y1 < min_y2 or max_y2 < min_y1:
        return False

    return cross(p1 - p0, p2 - p0) * cross(p1 - p0, p3 - p0) < 1e-6 and \
           cross(p3 - p2, p0 - p2) * cross(p3 - p2, p1 - p2) < 1e-6


def point_to_segment(p0, p1, p2):
    prod = (p1 - p0).conjugate() * (p2 - p0)
    if prod.real <= 1e-6:
        return abs(p2 - p0)
    l = abs(p1 - p0)
    d = prod.real / l
    if d >= l:
        return abs(p2 - p1)
    return abs(prod.imag) / l


q = int(input())
while q:
    q -= 1
    p0, p1, p2, p3 = starmap(complex, zip(*[map(int, input().split())] * 2))
    if has_intersection(p0, p1, p2, p3):
        print(0)
        continue

    print(min(starmap(point_to_segment, ((p0, p1, p2), (p0, p1, p3), (p2, p3, p0), (p2, p3, p1)))))

Measured memory_bytes: 7880
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        sc.close();
        int x = 0;
        int max = 0;

        for (int i = 0; i < n; i++) {
            if (s.substring(i, i + 1).equals("I")) {
                x++;
                max = max < x ? x : max ;
            } else {
                x--;
            }
        }

        System.out.println(max);
    }
}


Measured memory_bytes: 22100
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
    	cin.tie(0);
    	ios::sync_with_stdio(false);
     
    	int n;
    	cin >> n;
    	int v[n];
    	for(int i = 0; i < n; i++) {
    		cin >> v[i];
    	}
    	sort(v, v + n);
    	double ans = (v[0] + v[1]) / 2.0;
    	for(int i = 2; i < n; i++) {
    		ans = (ans + v[i]) / 2.0;
    	}
    	cout << ans << endl;
    }

Measured memory_bytes: 256
N = int(input())
S=[]

for n in range(N):
    S.append(input())

AC ='AC x '
WA ='WA x '
TLE ='TLE x '
RE ='RE x '


print(AC + str(S.count("AC")))
print(WA + str(S.count("WA")))
print(TLE + str(S.count("TLE")))
print(RE + str(S.count("RE")))

Measured memory_bytes: 16236
def main():
    s = input()
    print('Yes' if is_easy_to_step(s) else 'No')


def is_easy_to_step(strs):
    for i, s in enumerate(strs):
        if i % 2 != 0 and (s == 'L' or s == 'U' or s == 'D'):
            continue
        elif i % 2 == 0 and (s == 'R' or s == 'U' or s == 'D'):
            continue
        else:
            return False

    return True


if __name__ == '__main__':
    main()


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

bitset<2000009> dp;

int main()
{
    int n, i, j, a[2009], sum = 0;

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

    dp[0] = 1;


    for(i = 0; i < n; i++)
    {
        dp |= (dp << a[i]);
//        cout << dp << endl;
    }

    for(i = sum/2; i >= 0; i--)
    {
        if(dp[i])
        {
            printf("%d", sum - i);
            return 0;
        }
    }
}


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

typedef long long ll;


int main(){
	
    ll n;
    cin>>n;
    vector<ll> v;
    ll x=0;
    for(int i=0;i<n;i++){
	ll a;
	cin>>a;
    v.push_back(a);
    x^=a;
   }
   
   for(int i=0;i<n;i++){
   	ll ans=x^v[i];
   	cout<<ans<<" ";
   }
   cout<<endl;




    
    
    
	
    
 return 0;
}




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

#ifdef LOCAL
#define debug(var) cerr << #var << " = " << var << endl;
#else
#define debug(var)
#endif

void init() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
}

const int N = 2e5+345;

vector<int> g[N];
int ans[N];

int bio[N];
void dfs(int u, int c=1) {
	bio[u] = c;
	for (int v: g[u]) {
		if (bio[v]) continue;
		dfs(v, c==1?2:1);
	}
}

void solve() {
	int n; scanf("%d", &n);
	for (int i = 0; i < n-1; ++i) {
		int a, b; scanf("%d%d", &a, &b);
		g[--a].push_back(--b);
		g[b].push_back(a);
	}
	dfs(0);
	int r = 0;
	int c = 1;
	for (int i = 0; i < n; ++i) if (bio[i] == c) ++r;
	if (r > n-r) {
		r = n-r;
		c = 2;
	}
	debug(r);
	if (r <= n/3) {
		int k = 1;
		for (int i = 0; i < n; ++i) {
			if (bio[i] == c && k*3 <= n) {
				ans[i] = k*3; ++k;
			}
		}
	} else {
		int k = 0, q = 0;
		for (int i = 0; i < n; ++i) {
			if (bio[i] == c) {
				if (k*3+1 <= n) {
					ans[i] = k*3+1;
					++k;
				}
			} else {
				if (q*3+2 <= n) {
					ans[i] = q*3+2;
					++q;
				}
			}
		}
	}
	set<int> s;
	for (int i = 1; i <= n; ++i) s.insert(i);
	for (int i = 0; i < n; ++i) {
		if (ans[i]) s.erase(ans[i]);
	}
	for (int i = 0; i < n; ++i) {
		if (!ans[i]) {
			ans[i] = *s.begin();
			s.erase(s.begin());
		}
		printf("%d ", ans[i]);
	}
}

int main() {
	init();
	int t = 1; //scanf("%d", &t);
	while (t--) {
		solve();
	}
	return 0;
}


Measured memory_bytes: 23920
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string in; cin >> in;
    int k = in.size();

    int cnt = 15 - k;
    for(auto& e : in){
        cnt += (e == 'o' ? 1:0);
    }

    cout << (cnt >= 8 ? "YES":"NO") << endl;

    return 0;
}


Measured memory_bytes: 256
n, m, k = gets.split.map(&:to_i)
flag = false
(n+1).times do |x|
  (m+1).times do |y|
    if (n-x)*y+x*(m-y) == k
      flag = true
    end
  end
end

if flag
  puts "Yes"
else
  puts "No"
end


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N;
    cin >> N;
    vector<int> vec(N);
    for (int i = 0; i < N; ++i) cin >> vec[i];
    sort(vec.begin(), vec.end());

    int ans = 0;

    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < i; ++j) {
            for (int k = 0; k < j; ++k) {
                if (vec[k] != vec[j] and vec[i] != vec[j] and
                    vec[k] + vec[j] > vec[i]) {
                    ans++;
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3584
inp=require('fs').readFileSync('/dev/stdin','utf8').trim().split('\n')
n=inp.shift()-0
s=inp[n]
f=0
c=0
for(i=0;i<n;i++){
  l=inp[i].split(' ')
  if(f){
    c+=l[1]-0
  }
  if(s==l[0]){
    f=1
  }
}
console.log(c)

Measured memory_bytes: 21064
#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 FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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 (a>b) { a=b; return 1; } return 0; }

map<ll, ll> prime_factor(ll n) {
  map<ll, ll> res;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ++res[i];
      n /= i;
    }
  }
  if (n != 1) res[n] = 1;
  return res;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(25);

  ll n;
  cin >> n;

  map<ll, ll> mp = prime_factor(n);
  ll ans = 0;
  for (auto it = mp.begin(); it != mp.end(); it++) {
    ll res = it->second, cnt = 0;
    while (res >= 0) {
      if (res - cnt - 1 < 0) break;
      cnt++;
      res -= cnt;
    }
    ans += cnt;
  }
  cout << ans << '\n';




  
  return 0;
}

Measured memory_bytes: 3660
#include <iostream>
#include <iomanip>
#define pi 3.14159265358979323846
using namespace std;

int main()
{
	long int n,a[10001],i,min,max,sum=0;
	cin>>n;
	cin>>a[1];
	min=max=sum=a[1];
	for(i=2;i<=n;i++)
	{
		cin>>a[i];
		if(a[i]<min)
			min = a[i];
		if(a[i]>max)
			max = a[i];
		sum = sum + a[i];
	}
	cout<<min<<" "<<max<<" "<<sum<<endl; 
	return 0;
}


Measured memory_bytes: 3168
#include <iostream>
#include <string>
using namespace std;
 
int main(){
  string a;
  cin >> a;
  if (a[0] == a[1]) cout << "Bad" << endl;
  else if (a[1] == a[2]) cout << "Bad" << endl;
  else if (a[2] == a[3]) cout << "Bad" << endl;
  else cout << "Good" << endl;
}

Measured memory_bytes: 256
s=input()
even=list(s[::2])
odd=list(s[1::2])
ans1=sum(i!='0' for i in even)+sum(i!='1' for i in odd)
ans2=sum(i!='1' for i in even)+sum(i!='0' for i in odd)
print(min(ans1,ans2))

Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
using ll         = long long;
constexpr ll MOD = 1000000007;
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define REP2(i, x, n) for (ll i = x; i < (n); i++)
const long long INF = numeric_limits<long long>::max();
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;
}
vector<ll> getNums(ll N) {
    vector<ll> num(N);
    REP(i, N) {
        cin >> num[i];
    }
    return num;
}
int main() {
    ll N, X, T;

    cin >> N >> X >> T;

    ll min   = 0;
    ll count = 0;
    while (count < N) {
        count += X;
        min += T;
    }

    cout << min << endl;
    return 0;
}

Measured memory_bytes: 3616
S = input()
if S=="A":
    set="set_A"
if S=="C":
    set="set_C"
if S=="G":
    set="set_G"
if S=="T":
    set="set_T"

if set == "set_A":
    ans = "T"
if set == "set_C":
    ans = "G"
if set == "set_G":
    ans = "C"
if set == "set_T":
    ans = "A"
print(ans)  

Measured memory_bytes: 3064
eval'N,K,*A='+`dd`.split*?,
d=(0..255).map{[0]*-~N}
d[0][0]=1
A.map{|a|N.downto(1){|i|256.times{d[_1^a][i]+=d[_1][i-1]*i}}}
p d[K].sum.%10**9+7

Measured memory_bytes: 21388
W, H, N = list(map(int, input().split()))
A = []
for _ in range(N):
  A.append(list(map(int, input().split())))
  
xmax, xmin, ymax, ymin = W, 0, H, 0
for a in A:
  if a[2] == 1:
    xmin = max(xmin, a[0])
  if a[2] == 2:
    xmax = min(xmax, a[0])
  if a[2] == 3:
    ymin = max(ymin, a[1])
  if a[2] == 4:
    ymax = min(ymax, a[1])
    
S = (xmax-xmin) * (ymax-ymin)
if S < 0 or xmin > xmax or ymin > ymax:
  S = 0
print(S)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <fstream>
#include <string>
#include <math.h>
#include <set>
#include <string>
#include <bitset>
#include <fstream>
#include <stack>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> T;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define revrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define f first
#define s second
#define pb push_back

ll mod = 1000000007;
const ll INF = 100000000000010000;
//const ull B = 998244353;
//ll kai[3010];

//void pres(double A, ll x = 20) { printf("%.20f\n", x); }

vector<ll> dx = { 0, 1, 0, -1, 1, -1, 1, -1, 0};
vector<ll> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0};

void chmin(ll& x, ll y) {
	x = min(x, y);
}

void chmax(ll& x, ll y) {
	x = max(x, y);
}

ll pow_long(ll x, ll y) {
	ll res = 1;
	while (y > 0) {
		if (y % 2 == 1) res *= x;
		x *= x;
		y /= 2;
	}
	return res;
}

void test() {
	cout << "888888888888888888888888" << endl;
}

ll gcd(ll x, ll y) {
	if (y == 0) return x;
	return gcd(y, x % y);
}

ll pow_mod(ll x, ll k) {
	x %= mod;
	ll res = 1;
	while (k > 0) {
		if (k % 2) {
			res *= x; res %= mod;
		}
		x *= x; x %= mod;
		k /= 2;
	}
	return res;
}

ll div_mod(ll x) {
	return pow_mod(x, mod - 2);
}

//コンビネーション
const int MAXcomb = 1000010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAXcomb; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod%i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}
ll comb(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * finv[k] % mod * finv[n - k] % mod;
}

ll H, W, K;
string S[11];
ll ans = INF;

void solve() {
	cin >> H >> W >> K;
	rep(i, H) cin >> S[i];
	rep(i, 1 << (H - 1)) {
		bool J = true;
		ll an = 0;
		vector<ll> vec;
		ll num[11];
		rep(j, 10) num[j] = 0;
		vec.pb(0);
		for (ll j = 1; j < H; j++) if (((1 << (j - 1)) & i) > 0) {
			vec.pb(j);
			an++;
		}
		vec.pb(H);
		rep(j, W) {
			ll nu[10];
			rep(k, 10) nu[k] = 0;
			rep(k, vec.size()) if (vec[k] != H) {
				for (ll l = vec[k]; l < vec[k + 1]; l++) if (S[l][j] == '1') nu[k]++;
				if (nu[k] > K) J = false;
			}
			bool ju = true;
			rep(k, vec.size()) if (vec[k] != H) if (nu[k] + num[k] > K) ju = false;
			if (ju) {
				rep(k, vec.size()) if (vec[k] != H) num[k] += nu[k];
			}
			else {
				rep(k, vec.size()) if (vec[k] != H) num[k] = nu[k];
				an++;
			}
		}
		if (!J) continue;
		ans = min(ans, an);
	}
	cout << ans << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll T = 1;
	//cin >> T;
	rep(i, T) solve();
}


Measured memory_bytes: 256
//Easy Linear Programming

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define fi first
#define se second
typedef pair<int,string> p;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

int main (){
    ll a,b,c,k;cin>>a>>b>>c>>k;
    ll kk=(k-a)-b;
    if(a>=k)cout<<k<<nnn;
    else if(kk<=0)cout<<a<<nnn;
    else cout <<a-(kk*1)<<nnn;
    return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define per(i, a, b) for(int i = (b) - 1; i >= (a); --i)
#define de(x) cout << #x << " = " << x << endl
#define dd(x) cout << #x << " = " << x << " "
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define pw(x) (1ll << (x))
#define endl '\n'
typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef pair<int, int> pii;

int main() {
	std::ios::sync_with_stdio(0);
	std::cin.tie(0);
	ll a; string tb;
	cin >> a >> tb;
	ll b = tb[0] - '0';
	rep(i, 2, 4) b = b * 10 + tb[i] - '0';
	a *= b;
	cout << a / 100 << endl; 
	return 0;
}


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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define ENDL "\n"
#define PRINT(x) cout << (x) << ENDL

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

inline int in(int& a) {return scanf("%d", &a);}
inline void out(int n) {printf("%d\n", n);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};

//最大公約数
ll gcd(ll a, ll b) {
  while (a && b) {
    if (a >= b) a %= b;
    else b %= a;
  }
  return a + b;
}
//最小公倍数
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b;}

signed main(){
    ll A, B, C, D;
    cin >> A >> B >> C >> D;
    ll c = B / C - (A - 1) / C;
    ll d = B / D - (A - 1) / D;
    ll LCM = lcm(C, D);
    ll cd = B / LCM - (A - 1) / LCM;
    //cerr << LCM << endl;
    PRINT(B - A + 1 - (c + d - cd));
    //cerr << c << " " << d << " " << cd << ENDL;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#include <list>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if(a + b + c >=22)puts("bust");
    else puts("win");
}

Measured memory_bytes: 256
var
  n,i,j,sum:longint;
  a:array[0..10010] of longint;
begin
  readln(n);
for i:=1 to n do read(a[i]);
for i:=1 to n-1 do
  for j:=i+1 to n do sum:=sum+a[i]*a[j];
  write(sum);
end.

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

using namespace std;
using ll = long long;

# define var auto

int main() {
    int num;
    cin >> num;
    vector<int> dp(3);
    for(var i=0;i<num;i++)
    {
        vector<int> newdp(3);
        vector<int> abc(3);
        cin >> abc[0] >> abc[1] >> abc[2];
        for(var j=0;j<3;j++)
            for(var k=0;k<3;k++)
                if(j!=k)
                    newdp[j]=max(newdp[j],dp[k]+abc[k]);
        dp=newdp;
    }
    cout << max(dp[0],max(dp[1],dp[2])) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <stack>
#include <queue>

using namespace std;

int main()
{

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


    cout << min(a+b, min(b+c, c+a)) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char* argv[]) {
  long long N, Y;
  cin >> N >> Y;

  for (int i = 0; i <= N; ++i) {
    int cost = i * 10000;
    for (int j = 0; j <= N - i; ++j) {
      int tmp = cost;
      tmp += j * 5000;
      tmp += (N - i - j) * 1000;
      if (tmp == Y) {
        cout << i << " " << j << " " << (N - i - j) << endl;
        return 0;
      }
    }
  }

  cout << "-1 -1 -1" << endl;

  return 0;
}

Measured memory_bytes: 256