akhauriyash/Code-Regression huggingface dataset:
class Dice:
    def __init__(self, labels):
        self.labels = labels
        self.up = labels[0]
        self.front = labels[1]
        self.right = labels[2]
        self.left = labels[3]
        self.back = labels[4]
        self.down = labels[5]
    def east(self):
        self.up, self.right, self.down, self.left = self.left, self.up, self.right, self.down
        self.update_labels()
    def north(self):
        self.up, self.back, self.down, self.front = self.front, self.up, self.back, self.down
        self.update_labels()
    def south(self):
        self.up, self.front, self.down, self.back = self.back, self.up, self.front, self.down
        self.update_labels()
    def west(self):
        self.up, self.left, self.down, self.right = self.right, self.up, self.left, self.down
        self.update_labels()
    def clockwise(self):
        self.front, self.left, self.back, self.right = self.right, self.front, self.left, self.back
        self.update_labels()
    def counterclockwise(self):
        self.front, self.right, self.back, self.left = self.left, self.front, self.right, self.back
        self.update_labels()
    def set_up(self, up):
        for i in range(6):
            if up == self.up:
                break
            if i % 2:
                self.east()
            else:
                self.north()
    def set_front(self, front):
        while True:
            if front == self.front:
                break
            self.clockwise()
    def update_labels(self):
        self.labels = [self.up, self.front, self.right, self.left, self.back, self.down]

dice_1 = Dice(list(map(int, input().split())))
dice_2 = Dice(list(map(int, input().split())))
flag = False
for i in range(30):
    if dice_1.labels == dice_2.labels:
        flag = True
        break
    if i % 5 == 0:
        if i % 10 == 0:
            dice_2.east()
        else:
            dice_2.north()
    else:
        dice_2.clockwise()
if flag:
    print('Yes')
else:
    print('No')

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

template <class T, class F = multiplies<T>>
T power(T a, long long n, F op = multiplies<T>(), T e = {1}) {
  assert(n >= 0);
  while (n) {
    if (n & 1) e = op(e, a);
    if (n >>= 1) a = op(a, a);
  }
  return e;
}

template <unsigned M> struct modular {
  using m = modular;
  unsigned v;
  modular(long long a = 0) : v((a %= M) < 0 ? a + M : a) {}
  m operator-() const { return m() -= *this; }
  m& operator+=(m r) { if ((v += r.v) >= M) v -= M; return *this; }
  m& operator-=(m r) { if (v < r.v) v += M; v -= r.v; return *this; }
  m& operator*=(m r) { v = (uint64_t)v * r.v % M; return *this; }
  m& operator/=(m r) { return *this *= power(r, M - 2); }
  friend m operator+(m l, m r) { return l += r; }
  friend m operator-(m l, m r) { return l -= r; }
  friend m operator*(m l, m r) { return l *= r; }
  friend m operator/(m l, m r) { return l /= r; }
  friend bool operator==(m l, m r) { return l.v == r.v; }
};

constexpr long long mod = 1e9 + 7;
using mint = modular<mod>;

vector<mint> fact, inv_fact, minv;
void prepare(int n) {
  fact.resize(n + 1), inv_fact.resize(n + 1), minv.resize(n + 1);
  for (int i = 0; i <= n; ++i) fact[i] = i ? i * fact[i - 1] : 1;
  inv_fact[n] = power(fact[n], mod - 2);
  for (int i = n; i; --i) inv_fact[i - 1] = i * inv_fact[i];
  for (int i = 1; i <= n; ++i) minv[i] = inv_fact[i] * fact[i - 1];
}
mint binom(int n, int k) {
  if (k < 0 or k > n) return 0;
  return fact[n] * inv_fact[k] * inv_fact[n - k];
}
template<> mint& mint::operator/=(mint r) {
  return *this *= r.v < minv.size() ? minv[r.v] : power(r, mod - 2);
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int a, b;
  cin >> a >> b;
  prepare(a + b);
  vector<vector<mint>> f(a + 1, vector<mint>(b, 1));
  for (int j = 1; j < b; ++j) {
    mint sum = 1;
    for (int i = 0; i < a; ++i) {
      sum += binom(j - 1, i + 1);
      f[i + 1][j] = f[i][j] + sum;
    }
  }
  mint res;
  for (int x = 0; x <= a; ++x) {
    for (int y = 0; y <= min(a - x, b - 1); ++y) {
      res += binom(b - 1, y) * f[a - x - y][y];
    }
  }
  cout << res.v << '\n';
}


Measured memory_bytes: 16000
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

int main(){
  int n, x;
  cin >> n >> x;

  int m[n];

  for(int i = 0; i < n; i++){
    cin >> m[i];
    x -= m[i];
  }
  sort(m, m+n);

  int a = x / m[0];

  cout << n + a << endl;

}


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

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

    vector<int> seq(n);
    for(int i=0; i<n; i++){
        cin >> seq[i];
    }
    for(int i=seq.size()-1; i>0; i--){
        cout << seq[i] << " ";
    }
    cout << seq[0] << endl;
    return 0;
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false), cin.tie(0)
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define ALL(x) (x).begin(), (x).end()
#define dump(x) cout << (x) << endl
#define LMAX 9223372036854775807LL
#define LMIN -9223372036854775807LL
using ll = int64_t;
template<typename T>
using vec = vector<T>;
using P = pair<ll, ll>;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
	fill((T *)array, (T *)(array + N), val);
}

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//ll pas[51][52];

signed main(){
	IOS;
	ll n;
	cin >> n;
    vec<ll> a(n);   
    REP(i, n)cin >> a[n - i - 1];
    ll m = 2, M = 2;
    REP(i, n){
        ll m2 = ((m - 1)/ a[i] + 1) * a[i];
        ll M2 = (M / a[i]) * a[i] + a[i] - 1;
        if(M2 < m || m2 > M2){
            dump(-1);
            return 0;
        }
        M = M2;
        m = m2;
    }    
    cout << m << " " << M << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s,t;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s.at(i) == '0') t = t + '0';
    else if (s.at(i) == '1') t = t + '1';
    else if (!t.empty()) t.pop_back();
  }
  
  cout << t << endl;
}

Measured memory_bytes: 256
local X = io.read("*n")

for i = X, 10^5+3 do
    local Y = math.ceil(math.sqrt(i))
    local Z = true
    for j = 2, Y do
        if i~=j and i%j==0 then
           Z = false 
        end
    end
    if Z then
        print(i)
        break
    end
end

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

int n;
int p[100000];

int main(){
    cin >> n;

    for(int i = 0; i < n; i++)  cin >> p[i];

    int ans = 0, accum = 0;
    for(int i = 0; i < n-1; i++){
        if(i+1 == p[i]){
            ans++;
            swap(p[i], p[i+1]);
        }
    }
    if(n == p[n-1]){
        ans++;
        swap(p[n-2], p[n-1]);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
/** Seek God..Trust God..Praise God..**/

#include<bits/stdc++.h>
using namespace std;


#define fRead(x)        freopen("x.txt","r",stdin)
#define fWrite(x)       freopen ("x.txt","w",stdout)

#define mt              make_tuple
#define ld              long double
#define ll              long long
#define ull             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define INF             2e16
#define PI              acos(-1.0)
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>
#define endl            "\n";

#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())


#define FASTIO        ios_base::sync_with_stdio(0);cin.tie(nullptr);




///..................Sort by second element in a pair in decending order............. ///
bool SortbySecDesc(const pair<long long,long long > &a, const pair<long long,long long > &b)
{
    return a.second>b.second;
}

///.........................first element of pair in descending order..........................//////
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}



///.............................................................TEMPLATE................................................./////



/*
long long  Prime[3000000],nPrime;
long long  mark[10000002];

void seive(long long int n)
{
	long long int i,j,limit=sqrt(n*1.0)+2;
	mark[1]=1;
	for(i=4; i<=n ;i+=2)
	mark[i]=1;
	Prime[nPrime++]=2;
	for(i=3; i<=n; i+=2)
	{
		if(!mark[i])
		{
			Prime[nPrime++]=i;
			if(i<=limit)
			{
				for(j=i*i; j<=n ;j+=i*2)
				{
					mark[j]=1;
				}
			}
		}
	}
}
*/


int main()
{
    FASTIO;

    string s;
    cin >> s;


    if(s[s.size()-1]=='s')
    {
        s.pb('e');
        s.pb('s');
        cout << s << endl;
    }
    else if(s[s.size()-1]!='s')
    {
        s.pb('s');

        cout << s << endl;
    }





    return 0;
}


Measured memory_bytes: 3616
#include <cassert>
#include <algorithm>
#include <array>
#include <bitset>
#include <cctype>
#include <cstdint>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <memory>
#include <utility>
#include <limits>
 
#define rep(i, a, b) for (long long i = (a); (i) < (b); (i)++)
#define all(i) i.begin(), i.end()
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if(b==0)return 1;
  if ((a == 0)||(mod!=-1&&(a+mod)%mod==0))return 0;
  long long x = 1;
  while (b > 0) {
    if (b & 1)x = (mod!=-1)?(x * a) % mod:x*a;
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}

//const long long MOD = 998244353;
const long long MOD = 1e9 + 7;

using ll = long long;
using P=std::pair<long long,long long>;

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

  std::string s;
  std::cin>>s;

  ll n=s.size();

  bool isok=true;
  rep(i,0,n){
    if(s[i]!=s[n-1-i])isok=false;
  }
  rep(i,0,(n-1)/2){
    if(s[i]!=s[(n-3)/2-i])isok=false;
  }
  rep(i,(n+1)/2,n){
    if(s[i]!=s[n-1+(n+1)/2-i])isok=false;
  }

  if(isok)std::cout<<"Yes\n";
  else std::cout<<"No\n";
  return 0;
}


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

public class Main {
    private static final boolean N_CASE = false;

    private void solve() {
        int A = sc.nextInt();
        int B = sc.nextInt();
        out.println(A * B);
    }

    private void run() {
        int T = N_CASE ? sc.nextInt() : 1;
        for (int t = 0; t < T; ++t) {
            solve();
        }
    }

    private static MyWriter out;
    private static MyScanner sc;

    private static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        private MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

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

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

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

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

        int[] nextArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextInt();
            }
            return a;
        }

        List<Integer> nextList(int n) {
            List<Integer> list = new ArrayList<>();
            for (int i = 0; i < n; i++) {
                list.add(nextInt());
            }
            return list;
        }
    }

    private static class MyWriter extends PrintWriter {
        private MyWriter(OutputStream outputStream) {
            super(outputStream);
        }

        void printArray(int[] a) {
            for (int i = 0; i < a.length; ++i) {
                print(a[i]);
                print(i == a.length - 1 ? '\n' : ' ');
            }
        }

        void printlnArray(int[] a) {
            for (int v : a) {
                println(v);
            }
        }

        void printList(List<Integer> list) {
            for (int i = 0; i < list.size(); ++i) {
                print(list.get(i));
                print(i == list.size() - 1 ? '\n' : ' ');
            }
        }

        void printlnList(List<Integer> list) {
            list.forEach(this::println);
        }
    }

    public static void main(String[] args) {
        out = new MyWriter(new BufferedOutputStream(System.out));
        sc = new MyScanner();
        new Main().run();
        out.close();
    }
}

Measured memory_bytes: 32824
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
#define ALL(x) (x).begin(), (x).end()
#define dll(x) scanf("%I64d",&x)
#define xll(x) printf("%I64d\n",x)
#define sz(a) int(a.size())
#define all(a) a.begin(), a.end()
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define gg(x) getInt(&x)
#define db(x) cout<<"== [ "<<x<<" ] =="<<endl;
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll powmod(ll a,ll b,ll MOD){ll ans=1ll;while(b){if(b&1)ans=ans*a%MOD;a=a*a%MOD;b>>=1;}return ans;}
inline void getInt(int* p);
const int maxn=1000010;
const int inf=0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/
int n;
ll a,b;
ll x[maxn];

int main()
{
	//    freopen("C:\\Users\\DH_M\\Desktop\\code_io\\in.txt.txt","r",stdin);
	//    freopen("C:\\Users\\DH_M\\Desktop\\code_io\\out.txt.txt","w",stdout);
	gbtb;
	cin>>n>>a>>b;
	repd(i,1,n)
	{
		cin>>x[i];
	}	
	ll ans=0ll;
	repd(i,2,n)
	{
		ll cha=x[i]-x[i-1];
		if(cha*a<=b)
		{
			ans+=cha*a;
		}else
		{
			ans+=b;
		}
	}
	cout<<ans<<endl;
	
	
    return 0;
}

inline void getInt(int* p) {char ch;do {ch = getchar();} 
while (ch == ' ' || ch == '\n');if (ch == '-') {*p = -(getchar() - '0');
while ((ch = getchar()) >= '0' && ch <= '9') {*p = *p * 10 - ch + '0';}}
else {*p = ch - '0';while ((ch = getchar()) >= '0' && ch <= '9') 
{*p = *p * 10 + ch - '0';}}}

Measured memory_bytes: 1024
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL

int main() {
	priority_queue<int> PQ;
	while (true) {
		char command[10]; cin >> command;
		if (command[0] == 'i') {
			int key; scanf("%d", &key);
			PQ.push(key);
		}
		else if (command[1] == 'x') {
			printf("%d\n", PQ.top());
			PQ.pop();
		}
		else {
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 6756
#include<iostream>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<algorithm>//min,max,swap,rand,reverse,sort,lower_bound
#include<functional>
#include<vector>
#include<list>
#include<map>
#include<tuple>
#include<cmath>//abs, sin, cos
#include<bitset>
using namespace std;

int main()
{
	int N;
	cin >> N;
	cout << N + (N*N*N) + (N*N) << endl;
	return 0;
}

Measured memory_bytes: 3184
import sys
n,p=map(int,input().split())
s=list(input())
if p==2 or p==5:
    ans=0
    for i in range(n):
        if int(s[i])%p==0:
            ans+=i+1
    print(ans)
    sys.exit(0)
ans=0
count=[0]*p
count[0]=1
s=s[::-1]
num=0
seki=1
for i in range(n):
    num+=int(s[i])*seki
    num=num%p
    count[num]+=1
    seki=seki*10
    seki=seki%p
for i in range(p):
    N=count[i]
    ans+=N*(N-1)//2
print(ans)
#print(count)

Measured memory_bytes: 63600
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
      Scanner input = new Scanner(System.in);
      int a = Integer.valueOf(input.next());
      int b = Integer.valueOf(input.next());
      int c = Integer.valueOf(input.next());

      if (a < b && b < c) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      } 
  }

  private static int secondToHour(int second) {
    return second / 3600;
  }

  private static int secondToMinute(int second) {
    return (second % 3600) / 60;
  }
}


Measured memory_bytes: 26112
#include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

int k;
char cnv(char c,int d) {
    c-='0';
    c=(c+d+10)%10;
    return c+'0';
}
int dfs(int pos,int cnt,string s,const string &goal) {
    //cout<<pos<<","<<cnt<<": "<<s<<endl;
    if(pos==s.size()) {
        if(s==goal) return cnt;
        else return INF;
    }
    int v1=s[pos]-'0';
    int v2=goal[pos]-'0';
    int d=v2-v1;
    int ret=INF;

    if(d==0) ret=min(ret,dfs(pos+1,cnt,s,goal));
    else {
        for(int i=pos;i<k;i++) {
            s[i]=cnv(s[i],d);
            ret=min(ret,dfs(pos+1,cnt+1,s,goal));
        }
    }

    return ret;
}

int main() {
    string init,goal;
    while(1) {
        cin>>k;
        if(k==0) break;
        cin>>init>>goal;
        cout<<dfs(0,0,init,goal)<<endl;
    }
    return 0;
}

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

#define     fast()              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define     ll                  long long int
#define     test()              ll t; cin>>t; while(t--) 
#define     lp0(i,begin,end)    for(ll i=begin;i<end;i++)
#define     lp1(i,begin,end)    for(ll i=begin;i<=end;i++)
#define     rlp(i,begin,end)    for(ll i=end;i>=begin;i--)
#define     prec(n)             fixed<<setprecision(n)
#define     initial(a,i)        memset(a,i,sizeof(a))
#define     pb                  push_back
#define     PI                  3.1415926535897932384626433832795
#define     MOD                 1000000007
#define     F                   first
#define     S                   second
#define     all(a)              (a).begin(),(a).end()
#define     BPC(x)              __builtin_popcountll(x)
#define     gcd(a,b)            __gcd(a,b)

ll gcd(ll a,ll b) {if (a==0) return b;return gcd(b%a,a);}

ll power(ll x,ll n)
{
    ll result = 1;
    while (n)
    {
        if (n & 1)
            result = result * x;
        n = n / 2;
        x = x * x;
    }
    return result;
}


// Solution Function
void solution(ll compte)
{
    // cout<<compte<<"\n";
    ll A,B,C;
    cin >> A >> B >> C;
    ll ans = C-A+B;
    cout << max(0,int(ans)) << endl;
}
// Driver Function
int main()
{
    ll compte = 1;
    //test()
    //{
        solution(compte);
        compte++;
    //}
    return 0;
}


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


int main(){
  int n;
  cin >> n;
  int x;
  x=n/1.08;
  if(x*1.08==n){
    cout << x << endl;
  }else if((x+1)*1.08>n && (x+1)*1.08<(n+1)){
    cout << x+1 << endl;
  }else{
    cout << ":(" << endl;
  }
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
const long long INF = 1LL << 60;
const int MOD = 1e9 + 7;

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


/* ACL */

//using namespace atcoder;

int main(){
    int N,X,T;
    cin >> N >> X >> T;
    cout << ((N+X-1) / X)*T << endl;
}

Measured memory_bytes: 3580
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
#include<cassert>
using namespace std;
#include<atcoder/all>
using namespace atcoder;


#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 998244353;
const ll MAX = 4000001;
const long double eps = 1E-14;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

using mint = modint998244353;

typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;

typedef vector<mint> vmint;
typedef vector<vector<mint>> vvmint;
typedef vector<vector<vector<mint>>> vvvmint;

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

int main() {
	ll N, D;
	cin >> N >> D;

	vll X(N), Y(N);
	rep(i, N)cin >> X[i] >> Y[i];

	two_sat ts(N);

	rep(i, N)rep(j, N) {
		if (i == j) { continue; }
		if (abs(X[i] - X[j]) < D) { ts.add_clause(i, false, j, false); }
		if (abs(X[i] - Y[j]) < D) { ts.add_clause(i, false, j, true); }
		if (abs(Y[i] - X[j]) < D) { ts.add_clause(i, true, j, false); }
		if (abs(Y[i] - Y[j]) < D) { ts.add_clause(i, true, j, true); }
	}

	if (ts.satisfiable()) {
		auto ans = ts.answer();
		cout << "Yes" << endl;
		rep(i, N) {
			if (ans[i]) { cout << X[i] << endl; }
			else { cout << Y[i] << endl; }
		}
	}
	else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 3760
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cstdlib>
#include <ctime>
#include <string>
#include <iostream>
#include <bitset>
#define PII pair <int, int>
#define PPI pair <PII, int>
#define x first
#define y second
#define P 998244353

using namespace std;

typedef long long ll;

int N, X;

ll F[2][6010][2][3], G[3010][6010], C[6010][6010];

void add(ll &x, ll y) {
    x = (x + y) % P;
}
int main() {
    scanf("%d%d", &N, &X);
    G[0][0] = 1;
    ll ans = 0;
    for(int i = 0; i < N; i++)
        for(int j = 0; j < X; j++) {
            add(G[i + 1][j], G[i][j]);
            add(G[i + 1][j + 1], G[i][j]);
            add(G[i + 1][j + 2], G[i][j]);
        }
    if(X % 2 == 1) {
        for(int i = 0; i <= N; i++)
            for(int j = 0; j <= i; j++)
                C[i][j] = !j ? 1 : (C[i - 1][j - 1] + C[i - 1][j]) % P;
        for(int i = X; i <= N; i++)
            add(ans, C[N][i]);
    }
    for(int i = 0; i < X; i++) add(ans, G[N][i]);
    int a = 0, b = 1;
    memset(F, 0, sizeof F);
    F[a][0][0][1] = 1;
    for(int i = 0; i < N - 1; i++, swap(a, b)) {
        memset(F[b], 0, sizeof F[b]);
        for(int o = 0; o < X; o++)
            for(int s = 0; s < 2; s++)
                for(int k = 1; k < 3; k++)
                    for(int l = 0; l + k < 3; l++) {
                        add(F[b][o + l][s][k + l], F[a][o][s][k]);
                        if(l) add(F[b][o + l][!s][l], F[a][o][s][k]);
                    }
        for(int o = 1; o < X; o++)
            for(int k = 1; k < 3; k++)
                for(int l = 1; l + k < 3; l++)
                    add(ans, 1LL * F[b][o][1][k] * G[N - i - 2][X - 1 - o - l] % P);
    }
    printf("%lld\n", (ans % P + P) % P);
    return 0;
}

Measured memory_bytes: 283264
#include <functional>
#include <list>
#include <string>
#include <vector>
#include <climits>
#include <cstring>
#include <map>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <set>
#include <deque>
#include <stack>
#include <cassert>
using namespace std;
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define ALL(x) (x).begin(),(x).end()
#define CASET2 int ___T, case_n = 1; scanf("%d ", &___T); while ((___T > 0 ? printf("Case #%d:\n", case_n++) : 0), ___T-- > 0)
#define CASET1 int ___T, case_n = 1; scanf("%d ", &___T); while ((___T > 0 ? printf("Case #%d: ", case_n++) : 0), ___T-- > 0)
#define CASET int ___T; scanf("%d ", &___T); while (___T-- > 0)
#define SZ(X) ((int)(X).size())
#define LEN(X) strlen(X)
#define REP(i,n) for(int i=0;i<int(n);i++)
#define REP1(i,a,b) for(int i=(a);i<=int(b);i++)
#define PER1(i,a,b) for(int i=(a);i>=(b);i--)
#define REPL(i,x) for(int i=0;x[i];i++)
#define PER(i,n) for(int i=(n)-1;i>=0;i--)
#define RI1(x) scanf("%d",&x)
#define RI2(x,y) RI1(x), RI1(y)
#define RI3(x,y...) RI1(x), RI2(y)
#define RI4(x,y...) RI1(x), RI3(y)
#define RI5(x,y...) RI1(x), RI4(y)
#define RI6(x,y...) RI1(x), RI5(y)
#define GET_MACRO(_1, _2, _3, _4, _5, _6, NAME, ...) NAME
#define RI(argv...) GET_MACRO(argv, RI6, RI5, RI4, RI3, RI2, RI1)(argv)
#define DRI(argv...) int argv;RI(argv)
#define WRI(argv...) while (RI(argv) != EOF)
#define DWRI(x...) int x; WRI(x)
#define RS(x) scanf("%s",x)
#define MP make_pair
#define PB push_back
#define MS0(x) memset(x,0,sizeof(x))
#define MS1(x) memset(x,-1,sizeof(x))
#define X first
#define Y second
#define V(x) vector<x >

typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef long long LL;
const int INF = 1000000000;

void print(int i) { printf("%d", i); }
template<class T> void PI(T i) { print(i); puts(""); }
template<class T> void PIS(T i) { print(i); printf(" "); }

template<class T>
void PV(T const &v, int N) {
    REP(i, N) {
        print(v[i]);
        printf("%c", i == N-1 ? '\n' : ' ');
    }
}

template<class T> void PV(T const &v) { PV(v, SZ(v)); }

template<class T, class S> bool has_bit(T mask, S i) { return (mask >> i) & 1; }
long long shift(int i) { return 1ll << i; }

template<class C> void mini(C&a4, C b4){a4=min(a4, b4); }
template<class C> void maxi(C&a4, C b4){a4=max(a4, b4); }
int popcount(int x) { return __builtin_popcount(x); } 
int popcount(long long x) { return __builtin_popcountll(x); } 

#include <unordered_set>
#include <unordered_map>
#define EB emplace_back
#define RL(x) scanf("%lld", &(x))
#define PL(x) printf("%lld\n", x)
#define DRL(x) LL x; RL(x)

int main() {
  DRI(a, b);
  if (a > 0) {
    puts("Positive");
  } else if (b >= 0) {
    puts("Zero");
  } else {
    puts((b - a) % 2 == 0 ? "Negative" : "Positive");
  }
  return 0;
}


Measured memory_bytes: 256
N, x = map(int, input().split())
A = list(map(int, input().split()))
cnt = 0
if A[0] > x:
    d = A[0] - x
    A[0] -= d
    cnt += d
for i in range(N-1):
    if A[i] + A[i+1] > x:
        d = A[i] + A[i+1] - x
        A[i+1] -= d
        cnt += d
print(cnt)

Measured memory_bytes: 14132
// atcoder/abc126/E/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

const int inf = 1 << 29;

class UnionFind {
public:
  vector<int> rank, p;
  UnionFind(int size)
  {
    rank.resize(size, -inf);
    p.resize(size, -inf);
  }
  void make(int a)
  {
    rank[a] = 0;
    p[a] = a;
  }
  void unite(int a, int b)
  {
    link(find(a), find(b));
  }
  int find(int a)
  {
    return (a == p[a]) ? a : p[a] = find(p[a]);
  }
  bool isSameSet(int a, int b)
  {
    return find(a) == find(b);
  }
  void link (int a, int b)
  {
    if (rank[a] > rank[b]) {
      p[b] = a;
    } else {
      p[a] = b;
      if(rank[a] == rank[b]) rank[b]++;
    }
  }
};

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n, m;
  while (cin >> n >> m) {
    UnionFind uf(n);
    for (int i = 0; i < n; ++i) {
      uf.make(i);
    }

    for (int i = 0; i < m; ++i) {
      int x, y, z;
      cin >> x >> y >> z;
      --x;
      --y;
      uf.unite(x, y);
    }
    for (int i = 0; i < n; ++i) {
      uf.find(i);
    }
    set<int> s;
    for (int i = 0; i < n; ++i) {
      s.insert(uf.find(i));
    }
    cout << s.size() << endl;
  }

  return 0;
}


Measured memory_bytes: 5888
import java.util.Scanner;
class Main{
public static void main(String[] args){
Scanner scan=new Scanner(System.in);
int a=scan.nextInt();
int[] c=new int[101];
for(int b=0;b<a;b++){
c[b]=scan.nextInt();
}
for(int e=a-1;e>=0;e--){
	if(e!=a-1)
		System.out.print(" ");
		
System.out.print(c[e]);
}
System.out.println();
}
}

Measured memory_bytes: 26404
n = str(input())

ans_1 = 0
ans_2 = 0
x = int(n[0])
for i in range(len(n)):
    ans_1 += x * 10**i
    ans_2 += (x+1)*10**i
if ans_1 >= int(n):
    print(ans_1)
else:
    print(ans_2)

Measured memory_bytes: 3060
'''二分探索'''
#import bisect
'''デック'''
#from collections import deque
'''順列,組み合わせ,累積和,直積・forネスト'''
#from itertools import permutations, combinations, accumulate, product
'''小数点以下切り捨て,小数点以下切り上げ,平方根,階乗,最大公約数'''
#from math import floor, ceil, sqrt, factorial, gcd
'''input 文字列は最後に\nを含む'''
#import sys
#input = sys.stdin.readline


def main():
    n = int(input())
    a = list(map(int, input().split()))
    buka = [0]*(n+1)
    for i in a:
        buka[i] += 1
    print(*buka[1:], sep="\n")


if __name__ == '__main__':
    main()


Measured memory_bytes: 94912
#include<bits/stdc++.h>
using namespace std;
int n, k, num[100007];
vector<int>e[100007];
priority_queue<pair<int, int> >q;
bool vis[100007];
int read()
{
	int num = 0;
	char c = getchar();
	while (c < '0' || c>'9')c = getchar();
	while (c >= '0' && c <= '9')num = num * 10 + c - '0', c = getchar();
	return num;
}
int main()
{
	n = read();
	for (int i = 2; i <= n; i++)
	{
		int a = read(), b = read();
		e[a].push_back(b);
		e[b].push_back(a);
	}
	k = read();
	for (int i = 1; i <= k; i++)
	{
		int a = read(), b = read();
		num[a] = b;
		q.push(make_pair(-b, a));
		vis[a] = 1;
	}
	while (!q.empty())
	{
		int x = q.top().second;
		q.pop();
		for (int i = e[x].size() - 1; i >= 0; i--)
			if (!vis[e[x][i]])
			{
				vis[e[x][i]] = 1;
				num[e[x][i]] = num[x] + 1;
				q.push(make_pair(-num[e[x][i]], e[x][i]));
			}
	}
	for(int i=1;i<=n;i++)
		for(int j=e[i].size()-1;j>=0;j--)
			if (abs(num[i] - num[e[i][j]]) != 1)
			{
				cout << "No" << endl;
				return 0;
			}
	cout << "Yes" << endl;
	for (int i = 1; i <= n; i++)
		printf("%d\n", num[i]);
	return 0;
}

Measured memory_bytes: 8052
#include<iostream>
#include <bits/stdc++.h>
#include<stdio.h>
#include <stdlib.h>
#include<string>
#include<queue>
#include<algorithm>
#include<math.h>

using namespace std;

int main(){
	int a[6],b[6]={},ok=1;
	for(int i=0;i<6;i++){
		cin>>a[i];
		b[a[i]]++;
	}
	for(int i=1;i<5;i++){
		if(b[i]==3){
			ok=0;
		}
	}
	if(ok==0){
		cout<<"NO"<<endl;
	}else{
		cout<<"YES"<<endl;
	}
}

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

const ll MOD = 1000000007;
int main(){
  ll N , K;
  cin >> N >> K;
  ll sum = 0LL;
  for(ll i = K; i <= N+1; i++){
    sum += (i * (N - i + 1) + 1) % MOD;
  }

  cout << sum % MOD << endl;
}


Measured memory_bytes: 3628
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
int main() {
	unsigned int a, b;
	cin >> a >> b;
	if (a == b)cout << -1 << endl;
	else if (a < b)cout << a << endl;
	else if (a % b == 0)cout << -1 << endl;
	else cout << a << endl;
	return 0;
}

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

vector<P>E[100];
int d[100][3];
struct st {
	int p, b, c;
};
bool operator<(st a, st b) { return a.c > b.c; }
int main() {
	int n, m;
	while (scanf("%d%d", &n, &m), n) {
		rep(i, n)E[i].clear();
		rep(i, m) {
			int a, b, c; scanf("%d%d%d", &a, &b, &c); a--; b--;
			E[a].push_back(P(c, b)); E[b].push_back(P(c, a));
		}
		priority_queue<st>que;
		memset(d, 0x3f, sizeof(d));
		d[0][0] = 0; que.push({ 0,0,0 });
		while (!que.empty()) {
			st p = que.top(); que.pop();
			if (d[p.p][p.b] != p.c)continue;
			for (P v : E[p.p]) {
				if (p.b < 2) {
					if (d[v.second][p.b + 1] > p.c) {
						d[v.second][p.b + 1] = p.c;
						que.push({ v.second,p.b + 1,d[v.second][p.b + 1] });
					}
				}
				if (p.b != 1) {
					if (d[v.second][p.b] > p.c + v.first) {
						d[v.second][p.b] = p.c + v.first;
						que.push({ v.second,p.b,d[v.second][p.b] });
					}
				}
			}
		}
		printf("%d\n", d[n - 1][2]);
	}
}

Measured memory_bytes: 3228
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef double db;
#define pb(x) push_back(x)
#define mkp(x,y) make_pair(x,y)
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
//char buf[1<<21],*p1=buf,*p2=buf;
#define int long long
inline int read() {
	int x=0,f=1;char ch=getchar();
	while(!isdigit(ch)) {if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch))x=x*10+(ch^48),ch=getchar();
	return x*f;
}
const int N = 1000005;
const int M = N - 5;
const int mod = 998244353;
const int iv2 = (mod + 1) >> 1;
int n, c[N], mu[N], pri[N/9], cnt, f[N], ans, g[N], a[N];
bool vis[N];
void Sieve(const int&N) {
	mu[1] = 1;
	for (int i = 2; i <= N; ++ i) {
		if(!vis[i])pri[++cnt]=i,mu[i]=-1;
		for (int j = 1; i * pri[j] <= N; ++ j) {
			vis[i * pri[j]] = 1;
			if (i % pri[j]) mu[i * pri[j]] = - mu[i];
			else break;
		}
	}
	for (int i = 1; i <= N; ++ i)
		for (int j = 1; i * j <= N; ++ j)
		f[i * j] = (f[i * j] +1ll * mu[i] * i % mod) % mod;
	for (int i = 1; i <= N; ++ i)
		for (int j = 1; i * j <= N; ++ j)
			g[i] = (g[i] + 1ll * j * c[i * j]) % mod;
	for (int i = 1; i <= N; ++ i)
		ans = (ans + 1ll * i * f[i] % mod * g[i] % mod * g[i] % mod) % mod;
}
signed main() {
	n = read();
	for (int i = 1; i <= n; ++ i) ++c[a[i] = read()];
	Sieve(M);
	for(int i = 1; i <= n; ++ i) ans = (ans - a[i]) % mod;
	ans = 1ll * ans * iv2 % mod;
	printf("%d\n", (ans + mod) % mod);
	return 0;
}

Measured memory_bytes: 38052
#include<bits/stdc++.h>
#define X first
#define Y second
#define pb emplace_back
#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define EFOR(i,a,b) for(int (i)=(a);i<=(b);++(i))
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define REP rep
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define all(X) (X).begin(),(X).end()
#define eb emplace_back

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef ll LL;
typedef pii PII;
typedef pll PLL;
const ll MOD=1e9+7;

#define rall(X) (X).rbegin(),(X).rend()
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}

int N;
LL K;
bool has[214514];
int vis[214514];
int start[214514];
int A[214514];
int nxt[214514];
int app[214514];
int las[214514];

signed main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);

  cin >> N >> K;
  rep(i, N) {
    cin >> A[i];
    las[i] = i;
  }
  
  fill(app, app+214514, -1);
  rrep(i, N) {
    nxt[i] = app[A[i]];
    app[A[i]] = i;
  }

  las[N] = N;
  A[N] = 200001;
  app[A[N]] = -1;
  rrep(i, N) {
    if (nxt[i] == -1) continue;
    //if (nxt[i]+1 == N) continue;
    las[i] = las[nxt[i]+1];
  }

  int pos = 0;
  if (N >= K) {
    rep(i, K-1) {
      int idx = las[pos];
      int npos = app[A[idx]]+1;
      pos = npos;
      //cout << "i=" << i+1 << ": " << pos << endl;
    }
  } else { 
    int cnt = 0;
    while (1) {
      int idx = las[pos];
      int npos = app[A[idx]]+1;

      cnt++;
      if (vis[npos] > 0) {
        int b = vis[npos];
        int md = cnt-b;
        pos = start[(K-1-b)%md + b];
        break;
      }

      pos = npos;
      start[cnt] = pos;
      vis[pos] = cnt;
    }
  }

  vector<int> ans;
  reps(i, pos, N) {
    if (has[A[i]]) {
      while (1) {
        assert(!ans.empty());
        int v = ans.back(); ans.pop_back();
        has[v] = false;
        if (A[i] == v) break;
      }
    } else {
      has[A[i]] = true;
      ans.eb(A[i]);
    }
  }

  int m = ans.size();
  rep(i, m) {
    if (i) cout << " ";
    cout << ans[i];
  }
  cout << endl;
}


Measured memory_bytes: 7028
n = int(input())
weight_list = list(map(int,input().split()))
min_diff = float("inf")
for i in range(n):
    if abs(sum(weight_list[:i])-sum(weight_list[i:])) < min_diff:
        min_diff = abs(sum(weight_list[:i])-sum(weight_list[i:]))
print(min_diff)

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

int main(){
	int s=0,n;
	cin>>n;
	
	string s1,s2,s3;
	
	cin>>s1>>s2>>s3;
	
	for(int i=0;i<n;i++){
		if(s1[i]==s2[i]&&s1[i]==s3[i]&&s2[i]==s3[i]){
			continue;
		}else if(s1[i]==s2[i]||s1[i]==s3[i]||s2[i]==s3[i]){
			s++;
		}else if(!(s1[i]==s2[i]==s3[i])){
			s+=2;
		}
	}
	cout<<s<<endl;
	
	return 0;
} 

Measured memory_bytes: 256
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
import queue
#import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys

sys.setrecursionlimit(100000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

def factorial(i):
    if i == 1:
        return 1
    else:
        return i*factorial(i-1)
 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)




def main(): #startline--------------------------------------------
    n = int(input())
    p = list(map(int,input().split()))
    ans = 1
    minc = p[0]
    for i in range(n):
        if p[i] < minc:
            ans += 1
            minc = p[i]
    print(ans)
if __name__ == "__main__":
    main() #endline===============================================
    

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

int main(){
  int N;
  cin >> N ;
  vector<int> eeai(N,0);
  vector<int> biiai(N,0);
  int count = 0;
  
  for(int i=0; i<N ; i++){
  cin >> eeai.at(i);  
  }
  
  for(int i=N ; i > 0; i--){
    count = 0;
    for(int j=i ; j < N + 1 ; j+=i){
      if(j%i == 0){
        count += biiai.at(j-1);
      }
    }
    if(count%2 == eeai.at(i-1)){
      biiai.at(i-1)=0;
    }else{
      biiai.at(i-1)=1;
    }
  }
  
  int M=0;
  for(int i=0 ; i<N ; i++){
    M += biiai.at(i);
  }
  cout << M <<endl;
  
  for(int i=0 ; i<N ; i++){
    if( biiai.at(i) == 1 ){
    cout << i+1 << " " ;
    }
  }
  
}


Measured memory_bytes: 2432
#include <stdio.h>

int main(void) {
	
	 int x,y,z,v;
	 scanf("%d\n",&x);
	 y=x/3600;
	 z=(x%3600)/60;
	 v=x%60;
	 printf("%d:%d:%d\n",y,z,v);
	 
	return 0;
}

Measured memory_bytes: 596
n = int(input())
l = [0] * 52
pdic = {"S":0,"H":1,"C":2,"D":3}
ndic = "SHCD"
for i in range(n):
    p, num = input().split()
    num = int(num)
    l[pdic[p]*13-1 + num] = 1
for i in range(52):
    if l[i] == 0:
         print(ndic[i//13] + " " +  str(i % 13 + 1))



Measured memory_bytes: 5596
hoge = input().split()
N = int(hoge[0])
M = int(hoge[1])

WA = [0] * 105000
AC = [False] * 105000

WAnum = 0
ACnum = 0

for i in range(M):
    hoge = input().split()
    if AC[int(hoge[0])]:
      continue
    if hoge[1] == "AC":
      AC[int(hoge[0])] = True;
      ACnum += 1
      WAnum += WA[int(hoge[0])]
    elif hoge[1] == "WA":
      WA[int(hoge[0])] += 1
      
print(ACnum, WAnum)

Measured memory_bytes: 4724
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main(){
  int i = 0, j = 0,c;
  //  char s[1000];
  int a[101];
  int digit = 0,flag = 0;
  while(1){
    c = getchar();
    if(c == EOF) break;
    //printf("%c\n", s[j]);
    if(c == '+') {
      a[i-2] = a[i-1] + a[i-2];
      i=i-1;
      // j++;
    }
    else if(c == '-'){
      a[i-2] = a[i-2] - a[i-1];
      i = i-1;
      //j++;
    }
    else if(c == '*'){
      a[i-2] = a[i-1] * a[i-2];
      i = i-1;
      //j++;
    }
    else if(c == ' ') {
      if (flag == 1){
      a[i] = digit;
      i++;
      digit = 0;
      //j++;
      flag =0;
      }
    }
    else {
      flag = 1;
      digit = digit * 10 + c - '0';
      // a[i]=atoi(s[j]);
      // i++;
      //j++;
    }
  }
  printf("%d\n",a[i-1]);
  return 0;
}

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


using namespace std;


using ll = long long;


class Edge {
    public:
        ll to, a, b;
        Edge(ll to, ll a, ll b)
            : to(to), a(a), b(b) {
        }
};


class Data {
    public:
        ll city, silver, mintime;
        Data(ll city, ll silver, ll mintime)
            : city(city), silver(silver), mintime(mintime) {
            }
        bool operator<(const Data &n) const {
            return mintime > n.mintime;
        }
};


const ll MAX_SILVER = 50 * 50 + 5;
const ll INF = LONG_LONG_MAX - 1000000001;
const ll MAX_V = 50;
ll dp[MAX_V][MAX_SILVER + 5];


int main() {
    ll N, M, S;
    cin >> N >> M >> S;
    vector<vector<Edge>> graph(N);
    for (ll i = 0; i < M; i++) {
        ll u, v, a, b;
        cin >> u >> v >> a >> b;
        graph[u - 1].emplace_back(Edge(v - 1, a, b));
        graph[v - 1].emplace_back(Edge(u - 1, a, b));
    }

    vector<ll> C(N);
    vector<ll> D(N);
    for (ll i = 0; i < N; i++) {
        cin >> C[i];
        cin >> D[i];
    }

    ll init_silver = min(S, 50 * N + 1);
    // vector<vector<ll>> dp(N, vector<ll>(MAX_SILVER, INF));
    for (ll i = 0; i < MAX_V; i++) {
        for (ll j = 0; j < MAX_SILVER + 5; j++) {
            dp[i][j] = INF;
        }
    }

    priority_queue<Data> q;
    q.push(Data(0, init_silver, 0));
    while (!q.empty()) {
        Data now = q.top();
        q.pop();

        if (dp[now.city][now.silver] < now.mintime) {
            continue;
        }

        ll to, next_silver, time;
        for (auto e : graph[now.city]) {
            to = e.to;
            next_silver = min(MAX_SILVER, now.silver - e.a);
            time = now.mintime + e.b;
            if (next_silver >= 0 && dp[to][next_silver] > time) {
                q.push(Data(to, next_silver, time));
                dp[to][next_silver] = time;
            }
        }
        next_silver = min(MAX_SILVER, now.silver + C[now.city]);
        time = now.mintime + D[now.city];
        if (dp[now.city][next_silver] > time) {
            q.push(Data(now.city, next_silver, time));
            dp[now.city][next_silver] = time;
        }
    }
    for (ll i = 1; i < N; i++) {
        ll ans = INF;
        for (ll j = 0; j < MAX_SILVER + 5; j++) {
            ans = min(ans, dp[i][j]);
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 7292
#include <bits/stdc++.h>
#define REP(i,a,b) for(int(i)=(a);(i)<(b);++(i))
#define RREP(i,a,b) for(int(i)=(a)-1;(i)>=(b);--(i))
#define ALL(x) (x).begin(),(x).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)
using namespace std;
typedef long long ll;

int H,W;
string S[2010];
int L[2010][2010];
int R[2010][2010];
int U[2010][2010];
int D[2010][2010];

int main()
{
  cin >> H >> W;
  REP(i,0,H) cin >> S[i];

  // i行目について:
  REP(i,0,H) {
    // L[i][j]: j-1列目まで; (i,j)に居るときの左の.
    L[i][0] = 0;  // left
    REP(j,1,W) {
      // 左のマス
      if (S[i][j-1] == '.') L[i][j] = L[i][j-1] + 1;
      else L[i][j] = 0;  // reset if #
      // printf("(%d,%d) -> %d\n", i, j, L[i][j]);
    }
    // R[i][j]: j+1列目から; (i,j)に居るときの右
    R[i][W-1] = 0;
    RREP(j,W-1,0) {  // W-2から
      // 右のマス
      if (S[i][j+1] == '.') R[i][j] = R[i][j+1] + 1;
      else R[i][j] = 0;
      // printf("(%d,%d) -> %d\n", i, j, R[i][j]);
    }
  }

  // j列目について: (上下)
  REP(j,0,W) {
    U[0][j] = 0;  // Up
    REP(i,1,H) {
      // 上のマス
      if (S[i-1][j] == '.') U[i][j] = U[i-1][j] + 1;
      else U[i][j] = 0;
    }
    D[H-1][j] = 0;  // Down
    RREP(i,H-1,0) {
      // 下のマス
      if (S[i+1][j] == '.') D[i][j] = D[i+1][j] + 1;
      else D[i][j] = 0;
    }
  }

  // ** 計算
  int ans = -1;  // 照らされるマスの個数の最大値
  REP(i,0,H) REP(j,0,W) {
    // 上下左右4方向
    // 障害物のないマスから
    // 明かりを設置したマスも照らされ
    if (S[i][j] == '.') chmax(ans, 1 + L[i][j] + R[i][j] + U[i][j] + D[i][j]);
  }
  assert(ans >= 1);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 67456