akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>
#include <cstring>

#define rep(i,n) for(int i=0;i<int(n);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back

using namespace std;
using ll = long long;


const ll mod = 1000000007;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
// bool debug=false;

/*---------------------------------------------------*/

int X[20][20];

int main() {
  int N, D;
  cin >> N >> D;
  for(int i = 0; i < N; i++){
    for(int j = 0; j < D; j++) {
      cin >> X[i][j];
    }
  }

  int ans = 0;
  for(int i = 0; i < N; i++){
    for(int j = i + 1; j < N; j++) {
      int calc = 0;
      for(int k = 0; k < D; k++) {
	calc += pow(X[i][k] - X[j][k], 2);
      }
      for(int k = 0; k < 1000; k++) {
	if(calc == k * k) {ans++; break;}
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
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;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------

int main(void){
    int n, m;
    cin >> n >> m;

    vector<ll> dp((1 << n), INF);

    vector<pair<int,int>> c(m);

    for(int i = 0; i < m; i++){
        cin >> c[i].first;
        int b;
        cin >> b;
        int bit = 0;
        for(int j = 0; j < b; j++){
            int tmp;
            cin >> tmp;
            tmp--;
            bit |= (1 << tmp);
        }
        c[i].second = bit;
    }

    dp[0] = 0;

    for(int i = 0; i < m; i++){
        for(int j = 0; j < (1 << n); j++){
            dp[j | c[i].second] = min(dp[j | c[i].second], dp[j] + c[i].first);
        }
    }

    if(dp[(1 << n) - 1] == INF){
        cout << -1 << endl;
    } else {
        cout << dp[(1 << n) - 1] << endl;
    }
    
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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 T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
    auto val = table(args...);
    return vector<decltype(val)>(n, move(val));
}
const ll INF = 1e17;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 200005;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h,w,k;
    cin >> h >> w >> k;
    vector<string> c(h);
    vector<vector<int>> cnt(h,vector<int>(w,0));
    rep(i,h) cin >> c[i];
    rep(i,h){
        rep(j,w){
            if (c[i][j] == '1') cnt[i][j]++;
        }
    }
    int ans = 1000000;
    rep(bit,(1<<(h-1))){
        int b = 0;
        int size = 0;
        vector<vector<int>> ki(h,vector<int>(w,0));
        rep(i,w) ki[0][i] = cnt[0][i];
        rep(i,h-1){
            if (bit&(1<<i)){
                size++;
                b++;
            }
            rep(j,w) ki[size][j] += cnt[i+1][j];
        }
        size++;
        bool f = 0;
        rep(i,size){
            rep(j,w){
                if (ki[i][j] > k) f = 1;
            }
        }
        if (f) continue;
        vector<int> a(size,0);
        rep(i,w){
            rep(j,size){
                a[j] += ki[j][i];
                if (a[j] > k){
                    rep(l,size) a[l] = ki[l][i];
                    b++;
                    break;
                }
            }
        }
        chmin(ans,b);
    }
    PRINT(ans);
}


Measured memory_bytes: 384
/*
 * Author: .-O_O-.
 */
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define f first
#define s second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define nx cout<<"\n"
#define int long long
// void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
                                                     
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]"<<endl;}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
const ll mod = 1000000007;
const ll N = 200005;
const ll mm = 1e+18;
int f1(int n,int b){
    if(n<b) return n;
    return f1(n/b,b)+n%b;
}
void solve()
{
    int n,s;
    cin>>n>>s;
    if(n==s){
        cout<<n+1;
        return;
    }
    if(n<s){
        cout<<-1;
        return;
    }
    repp(i,2,sqrt(n)+1){
        if(f1(n,i)==s){
            cout<<i;
            return;
        }
    }
    int mi=mm;
    repp(i,1,sqrt(n)){
        if((n-s)%(i)==0){
            if(f1(n,(n-s+i)/(i))==s){
                mi=min(mi,(n-s+i)/(i));
            }
        }
    }
    if(mi==mm) mi=-1;
    pr(mi);
}
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    //cin>>t;
    rep1(_i,t){
        //cout<<"Case #"<<_i<<": ";
        solve();
        //nx;
    }
    return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
const ll MAX = 1001001;
const ll MOD = 1000000007;
int main()
{
    ll n, x, t;
    cin >> n >> x >> t;
    cout << ((n - 1) / x + 1) * t << endl;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define INF (1e9)
#define x real()
#define y imag()
#define N 105
using namespace std;
typedef complex<double> point;
typedef pair<int,int> P;
typedef pair<double,P> P1;

vector<point> v[N];
vector<P1> e[N][2];
point p[N];
int n;

double dot(point a,point b){
  return a.x*b.x+a.y*b.y;
}
 
double cross(point a,point b){
  return a.x*b.y-a.y*b.x;
}
 
int ccw(point a,point b,point c){
  point d = b-a;
  point e = c-a;
  if(cross(d,e)>0) return 1;//"COUNTER_CLOCKWISE"
  if(cross(d,e)<0) return -1;//"CLOCKWISE"
  if(dot(d,e)<0) return 2;//"ONLINE_BACK"
  if(abs(d) < abs(e)) return -2;//"ONLINE_FRONT"
  return 0;//"ON_SEGMENT"
}

bool intersection(point a,point b,point c,point d){
  return (ccw(a,b,c)*ccw(a,b,d)<=0&&ccw(c,d,a)*ccw(c,d,b)<=0);
}

vector<point> CrossPoints_CC(point a,double ra,point b,double rb){
  vector<point> res;
  b-=a;
  double d= ( norm(b) + ra*ra - rb*rb ) / ( 2.0 * abs(b)  );
  double  c = sqrt( ra*ra - d*d );
  point base = b/abs(b);
  res.push_back(point(d,c) * base + a);
  res.push_back(point(d,-c) * base + a);  
  return res;
}

bool check(int a,int b,int c,int d){
  point A=v[a][b],B=v[c][d];
  for(int i=a+1;i<c;i++)
    if(!intersection(A,B,v[i][0],v[i][1]))return false;
  return true;
}

double dijkstra(){
  priority_queue<P1,vector<P1>,greater<P1> > q;
  double d[N][2];
  for(int i=0;i<=n;i++)d[i][0]=d[i][1]=INF;
  q.push(P1(0,P(0,0)));
  d[0][0]=0;
  while(!q.empty()){
    P1 t=q.top(); q.pop();
    double cost=t.first;
    int node=t.second.first,idx=t.second.second;
    if(d[node][idx]<cost)continue;
    if(node==n)return cost;
    for(int i=0;i<(int)e[node][idx].size();i++){
      double ncost=cost+e[node][idx][i].first;
      int nnode=e[node][idx][i].second.first;
      int nidx=e[node][idx][i].second.second;
      if(d[nnode][nidx]>ncost){
	d[nnode][nidx]=ncost;
	q.push(P1(ncost,P(nnode,nidx)));
      }
    }
  }
  return -1;
}

int main(){
  double r[N],a,b;
  while(1){
    cin>>n;
    if(!n)break;
    for(int i=1;i<=n;i++)cin>>a>>b>>r[i],p[i]=point(a,b);
    v[0].push_back(p[1]);
    for(int i=1;i<n;i++)v[i]=CrossPoints_CC(p[i],r[i],p[i+1],r[i+1]);
    v[n].push_back(p[n]);
    for(int i=0;i<n;i++)
      for(int j=0;j<(int)v[i].size();j++)
	for(int k=i+1;k<=n;k++)
	  for(int l=0;l<(int)v[k].size();l++)
	    if(check(i,j,k,l))e[i][j].push_back(P1(abs(v[i][j]-v[k][l]),P(k,l)));
    printf("%.8f\n",dijkstra());
    for(int i=0;i<=n;i++){
      v[i].clear();
      for(int j=0;j<2;j++)e[i][j].clear();
    }
  }
  return 0;
}

Measured memory_bytes: 1392
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
typedef pair<int, int> P;

int main() {
  int n; cin >> n;
  vector<vector<P>> t(n);
  for (int i = 0; i < n-1; i++) {
    int a, b, c; cin >> a >> b >> c; a--; b--;
    t[a].push_back(P(b, c));
    t[b].push_back(P(a, c));
  }
  int q, k; cin >> q >> k; k--;

  queue<int> que;
  vector<long long> dist(n, -1);
  que.push(k);
  dist[k] = 0;
  while (!que.empty()) {
    int v = que.front(); que.pop();
    for (P p : t[v]) {
      if (dist[p.first] < 0) {
        que.push(p.first);
        dist[p.first] = dist[v] + p.second;
      }
    }
  }

  for (int i = 0; i < q; i++) {
    int x, y; cin >> x >> y; x--; y--;
    cout << dist[x] + dist[y] << endl;
  }
}

Measured memory_bytes: 9472
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace Tasks
{
    public class B
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var NM = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            var (N, M) = (NM[0], NM[1]);
            var students = new (int X, int Y)[N];
            var checkPoints = new (int X, int Y)[M];
            for (var i = 0; i < N; i++)
            {
                var ab = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
                students[i] = (ab[0], ab[1]);
            }
            for (var i = 0; i < M; i++)
            {
                var cd = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
                checkPoints[i] = (cd[0], cd[1]);
            }
            for (var i = 0; i < N; i++)
            {
                var min = (long)1e18;
                var answer = 0;
                for (var j = 0; j < M; j++)
                {
                    var distance = Math.Abs(students[i].X - checkPoints[j].X) + Math.Abs(students[i].Y - checkPoints[j].Y);
                    if (distance < min)
                    {
                        min = distance;
                        answer = j;
                    }
                }
                Console.WriteLine(answer + 1);
            }
        }
    }
}


Measured memory_bytes: 28124
#include <iostream>
#include <algorithm>

#define rep(i, n) for(int i = 0; i < (n); ++i)

using namespace std;

const int mod = 1e9 + 7;

int n;
int a[100000];
int b[100000];

int main(){
  cin >> n;
  rep(i, n){
    cin >> a[i];
  }
  rep(i, n){
    b[i] = abs(n - 2 * i - 1);
  }
  sort(a, a + n);
  sort(b, b + n);
  rep(i, n){
    if(a[i] != b[i]){
      cout << 0 << endl;
      return 0;
    }
  }
  int p = 1;
  rep(i, n / 2){
    p = p * 2 % mod;
  }
  cout << p << endl;
  return 0;
}

Measured memory_bytes: 1024
from itertools import combinations_with_replacement
N,M,Q = map(int,input().split())
li = [list(map(int,input().split())) for i in range(Q) ]
counter = []
for comb in combinations_with_replacement(range(1,M+1),N):
    A = list(comb)
    tmp = 0
    for i in li:
        if A[i[1]-1] - A[i[0]-1] == i[2]:
            tmp += i[3]
    counter.append(tmp)
print(max(counter))


Measured memory_bytes: 12688
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();

        N = N % 10;

        if (N == 0 || N == 1 || N == 6 || N == 8) {
            System.out.println("pon");
        } else if (N == 3) {
            System.out.println("bon");
        } else {
            System.out.println("hon");
        }

    }
}


Measured memory_bytes: 35784
#include <ctime>
#include <iomanip>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <list>
#include <queue>
#include <numeric>
using namespace std;

#define int long long
#define INF 1e18
#define EPS 1e-9
#define NIL -1

signed main() {
    int n; cin >> n;
    vector<int> a;

    for(int i = 0; i < n; i++) {
        int b; cin >> b;
        if(b - 1 > a.size()) {
           cout << -1 << endl;
           return 0;
        }
        a.insert(a.begin() + b - 1, b);
    }

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

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int a,b,c,x,r=0;
  scanf("%d%d%d%d",&a,&b,&c,&x);
  for(int i=0;i<=a;i++)for(int j=0;j<=b;j++)for(int k=0;k<=c;k++)if(x==500*i+100*j+50*k)r++;
  printf("%d",r);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
using namespace std;
struct edge{
    int to;
    int cap;
    int rev;
};
struct Ford{
    vector<vector<edge>> G;
    int V;
    vector<int> used;
    Ford(int N){
        V = N;
        used.resize(N, 0);
        G.resize(N);
    }
    void add(int u, int v, int c){
        edge e1 = {v, c, (int)G[v].size()};
        G[u].push_back(e1);
        edge e2 = {u, 0, (int)G[u].size() - 1};
        G[v].push_back(e2);
    }
    int dfs(int s, int t, int f){
        if(s == t) return f;
        used[s] = 1;
        for(edge &e: G[s]){
            if(used[e.to] == 0 && e.cap > 0){
                long long temp = dfs(e.to, t, min(f, e.cap));
                if(temp > 0){
                    e.cap -= temp;
                    G[e.to][e.rev].cap += temp;
                    return temp;
                }
            }
        }
        return 0;
    }
    int solve(int s, int t){
        int ans = 0;
        int INF = 1e9;
        while(1){
            used.assign(V, 0);
            int res = dfs(s, t, INF);
            if(res == 0) return ans;
            ans += res;
        }
    }
};
int main(){
    int N, M;
    cin >> N >> M;
    vector<string> S(N);
    for(int i = 0; i < N; i++) cin >> S[i];
    int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, -1, 0, 1};
    Ford F(N * M + 2);
    for(int i = 0; i < N; i++){
        for(int j = 0; j < M; j++){
            if(S[i][j] == '#') continue;
            if((i + j) % 2 == 1){
                int s = i * M + j;
                F.add(N * M, s, 1);
                for(int k = 0; k < 4; k++){
                    int nx = i + dx[k], ny = j + dy[k];
                    if(0 <= nx && nx < N && 0 <= ny && ny < M && S[nx][ny] == '.'){
                        int t = nx * M + ny;
                        F.add(s, t, 1);
                    }
                }
            }
            else{
                int s = i * M + j, t = N * M + 1;
                F.add(s, t, 1);
            }
        }
    }
    int f = F.solve(N * M, N * M + 1);
    cout << f << endl;
    auto check = [&](int x, int y, int nx, int ny){
        if(x == nx && y + 1 == ny) S[x][y] = '>', S[nx][ny] = '<';
        else if(x == nx && y - 1 == ny) S[x][y] = '<', S[nx][ny] = '>';
        else if(x + 1 == nx && y == ny) S[x][y] = 'v', S[nx][ny] = '^';
        else if(x - 1 == nx && y == ny) S[x][y] = '^', S[nx][ny] = 'v';
    };
    for(int i = 0; i < N; i++){
        for(int j = 0; j < M; j++){
            if(S[i][j] == '#') continue;
            if((i + j) % 2 == 1){
                for(edge e: F.G[i * M + j]){
                    if(e.to == N * M || e.to == N * M + 1) continue;
                    if(e.cap == 0){
                        int ny = e.to % M, nx = e.to / M;
                        check(i, j, nx, ny);
                    }
                }
            }
        }
    }
    for(int i = 0; i < N; i++) cout << S[i] << endl;
}

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

#define MIN_INT -2147483648
#define MAX_INT 2147483647
#define MIN_LONG -9223372036854775808L
#define MAX_LONG 9223372036854775807L

#define long long long int

using namespace std;

// @author: pashka

const long MOD = 1000000007;

int main() {
    ios::sync_with_stdio(false);

    int n, k;
    cin >> n >> k;
    vector<vector<long>> d(2 * n * n + 1, vector<long>(n + 1));
    vector<vector<long>> dd(2 * n * n + 1, vector<long>(n + 1));
    d[n * n][0] = 1;
    for (int i = 0; i < n; i++) {
        for (int q = 0; q < 2 * n * n; q++) {
            for (int c = 0; c <= n; c++) {
                dd[q][c] = 0;
            }
        }
//        cout << i << "\n";
        for (int q = 0; q < 2 * n * n; q++) {
            for (int c = 0; c <= n; c++) {
                if (d[q][c] == 0) continue;
//                cout << q << " " << c << " " << d[q][c] << "\n";
                dd[q - i - i][c + 1] += d[q][c];
                dd[q - i - i][c + 1] %= MOD;
                dd[q][c] += d[q][c];
                dd[q][c] %= MOD;
                if (c > 0) {
                    dd[q + i + i][c - 1] += d[q][c] * c * c;
                    dd[q + i + i][c - 1] %= MOD;
                    dd[q][c] += d[q][c] * c * 2;
                    dd[q][c] %= MOD;
                }
            }
        }
        swap(d, dd);
    }
//    cout << n << "\n";
//    for (int q = 0; q < 2 * n * n; q++) {
//        for (int c = 0; c <= n; c++) {
//            if (d[q][c] == 0) continue;
//            cout << q << " " << c << " " << d[q][c] << "\n";
//        }
//    }
    cout << d[n * n + k][0] << "\n";

    return 0;
}

Measured memory_bytes: 4608
import java.util.*;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int a = sc.nextInt();
		if(x < a){
			System.out.print(0);
		}
if(x >= a){
	System.out.print(10);
}

	}
}


Measured memory_bytes: 21844
"use strict";
    
const main = arg => {
    const A = arg.split("\n")[0].split(" ")[0];
    const B = arg.split("\n")[0].split(" ")[1];
    
    const N = parseInt(A + B);
    for(let i=1; i<N; i++) {
        if(Math.pow(i, 2) === N) {
            console.log("Yes");
            return;
        } 
    }
    
    console.log("No");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector
;
#define vvec(s) vector<vector
> ;
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout<<(bool x?"Yes":"No")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " ";
#define INF 10000000000
#define all(s) s.begin(),s.end()
void vout(vector<int> v){
    for(int i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    lli mod=1000000007;
    lli ans=0;
    lli n,k;
        cin>>n>>k;
    vi sum(n+1);

    sum[0]=0;
    rep(i,n){
        sum[i+1]=sum[i]+i+1;
    }
    for(int j=k;j<=n;j++){
        ans+=(sum[n]-sum[n-j])-sum[j-1]+1;
        ans%=mod;
    }
    ans+=1;
    ans%=mod;
    out(ans);

}

Measured memory_bytes: 4796
import sys
import  math
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))


N=list(ns())
keta=0
for i in range(len(N)):
    keta+=int(N[i])

print('Yes' if keta%9==0 else 'No')




Measured memory_bytes: 11728
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author cherrypi59
 */

#pragma GCC optimize ("O2")
#pragma GCC optimize ("tree-vectorize")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FFOR(i, a, b) FOR(i, a, b+1)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) FOR(i, 1, n+1)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define LEN(x) (int)(x).size()
#define DUMP(x) cerr<<__LINE__<<' '<<#x<<"="<<(x)<<endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair

using namespace std;
using lint = long long;
using pii =  pair<int, int>;
using pll =  pair<lint, lint>;
template <typename T> using vc = vector<T>;
template <typename T> using vvc = vector<vector<T>>;
template <typename T> inline bool chmax(T &a, T b){if(a<b){a = b; return true;} return false;}
template <typename T> inline bool chmin(T &a, T b){if(a>b){a = b; return true;} return false;}

constexpr lint ten(int n) {return n==0 ? 1 : ten(n-1)*10;}

struct edge{int from, to, cost;};

class ETravelByCar {
public:
    int N, M, L;
    vvc<edge> G;
    vvc<pii> dist;

    void dijkstra(int s){
        using pip = pair<pii, int>;
        priority_queue<pip, vector<pip>, greater<>> pq;
        pq.emplace(pii(0, -L), s);
        while(not pq.empty()){
            int now = pq.top().second;
            auto p = pq.top().first;
            pq.pop();
            if(dist[s][now].first<p.first) continue;
            if(dist[s][now].first==p.first and dist[s][now].second>=-p.second) continue;
            dist[s][now].first = p.first;
            dist[s][now].second = -p.second;
            for(auto& e : G[now]){
                int to = e.to;
                int cost = e.cost;
                int x = p.first, y = -p.second - cost;
                if(cost>L) continue;
                if(y<0) ++x, y = L - cost;
                if(dist[s][to].first<x) continue;
                if(dist[s][to].first==x and dist[s][to].second>=y) continue;
                pq.emplace(pii(x, -y), to);
            }
        }
    }

    void solve(std::istream& in, std::ostream& out){
        ios_base::sync_with_stdio(false);
        in.tie(nullptr), out.tie(nullptr);
        const int INF = 101010101;
        in>>N>>M>>L;
        G.resize(N);
        REP(i, M){
            int a, b, c;
            in>>a>>b>>c;
            a--, b--;
            G[a].pb({a, b, c});
            G[b].pb({b, a, c});
        }
        dist.resize(N, vc<pii>(N, make_pair(INF, 0)));
        REP(i, N) dijkstra(i);
        int Q;
        in>>Q;
        while(Q--){
            int s, t;
            in>>s>>t;
            s--, t--;
            if(dist[s][t].first==INF) out<<"-1\n";
            else out<<dist[s][t].first<<'\n';
        }
    }
};


int main() {
	ETravelByCar solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

const int N = 3 * 1000 + 10;

int n;
int val[N];
vector <int> adj[N];
bool mark[N], isGood[N];

void input() {
    cin >> n;

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

    for (int i = 0; i < n - 1; i++) {
        int u, v;
        cin >> u >> v;
        u--, v--;
        if (val[v] > val[u])
            adj[v].push_back(u);
        else if (val[v] < val[u])
            adj[u].push_back(v);
    }
    return;
}

void DFS(int v) {
    mark[v] = true;

    bool tmp = true;
    for (auto u : adj[v]) {
        DFS(u);
        tmp &= isGood[u];
    }

    isGood[v] = !tmp;
    return;
}

void output() {
    for (int i = 0; i < n; i++)
        if (isGood[i])
            cout << i + 1 << " ";
    return;
}

int main() {
    input();

    for (int i = 0; i < n; i++)
        if (!mark[i])
            DFS(i);

    output();
    return 0;
}


Measured memory_bytes: 384
import sys
readline = sys.stdin.readline

def main():
    N, K = map(int, readline().rstrip().split())
    X = list(map(int, readline().rstrip().split()))
    len_m = len([x for x in X if x < 0])
    len_p = len([x for x in X if x > 0])
    ans = 10**10
    idx = max(0, len_m-K)
    s = [0] + X[idx:idx+K-1]
    for i in range(max(0, len_m-K), min(len_m+K, N-K+1)):
        s.pop(0)
        s.append(X[i+K-1])
        if s[0] < 0 and s[-1] > 0:
            c = min(abs(s[0]) * 2 + s[-1], abs(s[0]) + s[-1] * 2)
        else:
            c = max(abs(s[0]), abs(s[-1]))
        ans = min(ans, c)

    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 14844
#!/usr/bin/ruby
# -*- coding: utf-8 -*-

while true do
    # n??????
    n = gets.to_i
    break if n == 0 # 0?????¨????????????
    v = gets.split(" ").map{|vstr| vstr.to_i}.sort
    dv = []
    (v.length - 1).times do |i|
        dv.push(v[i+1] - v[i])
    end
    puts dv.min
end

Measured memory_bytes: 9084
#include <iostream>
#include<string.h>
using namespace std;
int main(void){
    string x;
    string array[] = {"", "SAT", "FRI", "THU", "WED", "TUE", "MON", "SUN"};
    cin >> x;
    for(int i = 0; i < 9; i++)
        if(array[i] == x)
            cout << i << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>

#define MOD 1e9+7;
#define INF 1e17+9;
#define PI acos(-1);

using namespace std;

int main(){
	int c[3][3];
	for(int i=0;i<3;i++){
		for(int j=0;j<3;j++){
			cin >> c[i][j];
		}
	}
	if(c[0][0]-c[0][1]==c[1][0]-c[1][1] && c[1][0]-c[1][1]==c[2][0]-c[2][1]){
		if(c[0][1]-c[0][2]==c[1][1]-c[1][2] && c[1][1]-c[1][2]==c[2][1]-c[2][2]){
			if(c[0][0]-c[0][2]==c[1][0]-c[1][2] && c[1][0]-c[1][2]==c[2][0]-c[2][2]){
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
			cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll R,C,K;
    cin >> R >> C >> K;
    vector<vvl> dp(R,vvl(C,vl(4,0)));
    rep(i,R){
        rep(j,C){
            rep(k,4){
                dp[i][j][k]=0;
            }
        }
    }
    vvl mp(R,vl(C,0));
    rep(i,K){
        ll r,c,v;
      	cin >> r >> c >> v;
        r--;c--;
        mp[r][c]=v;
    }
    rep(i,R){
        rep(j,C){
            rep(k,4){
                if(i==0&&j==0){
                    dp[i][j][0]=0;
                    if(k>0&&mp[i][j]!=0){
                        dp[i][j][k]=mp[i][j];
                    }
                }
                else if(i==0){
                    dp[i][j][k]=dp[i][j-1][k];
                    if(k>0)chmax(dp[i][j][k],dp[i][j-1][k-1]+mp[i][j]);
                }
                else if(j==0){
                    dp[i][j][k]=dp[i-1][j][3];
                    if(k>0&&mp[i][j]>0){
                        dp[i][j][k]=dp[i-1][j][3]+mp[i][j];
                    }
                }
                else{
                    dp[i][j][k]=dp[i][j-1][k];
                    if(k>0)chmax(dp[i][j][k],dp[i][j-1][k-1]+mp[i][j]);
                    if(k==0)chmax(dp[i][j][3],dp[i-1][j][k]);
                  	if(k>0)chmax(dp[i][j][k],dp[i-1][j][3]+mp[i][j]);
                }
            }
        }
    }
    ll ans=0;
    rep(i,R){
        rep(j,C){
            rep(k,4){
                chmax(ans,dp[i][j][k]);
            }
        }
    }
    cout << ans << endl;    
}
/*
overflow checked?
corner case checked?
boundary checked?
not TLE in worst case checked?
*/

Measured memory_bytes: 706040
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <map>
#include <iterator>
#include <functional>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <fstream>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <list>
#include <sstream>
#include <cstring>
#include <stdio.h>
#include <complex>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

typedef long double LD;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef pair<LD, LD> PDD;
typedef pair<LL, LL> PLL;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<char> VCH;
typedef vector<LD> VLD;
typedef vector<string> VS;
typedef vector<VS> VSS;
typedef vector<VI> VVI;
typedef vector<VLL> VVLL;
typedef vector<VCH> VVCH;
typedef vector<PII> VPII;
typedef vector<PLL> VPLL;
typedef vector<PDD> VPDD;
#define MP make_pair
#define PB push_back
#define X first
#define Y second
#define next fake_next
#define prev fake_prev
#define left fake_left
#define right fake_right

#define FOR(i, a, b) for(LL i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, t) FOR(i, 0, t)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))

const LD PI = acos(-1.0);
const LD EPS = 1e-9;
const LL INF = 1e9;
const LL LINF = 1e18;
const LL mod = 1000000007;
const LL MAXN = 1e5 + 47;
const LL MAX = 1e5 + 47;

LL n;
VI g[MAX];
char used[MAX];
bool dw;

void dfs(int v, char color = 1)
{
	used[v] = color;
	for (auto i : g[v])
	{
		if (used[i] == 0)
			dfs(i, 3 - color);

		if (used[i] == used[v])
			dw = 0;
	}
}

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//freopen("In.txt", "r", stdin);

	LL u, v, m;
	cin >> n >> m;
	FOR(i, 0, m)
	{
		cin >> u >> v;
		--u; --v;
		g[u].push_back(v);
		g[v].push_back(u);
	}

	LL l = 0, k = 0;
	LL ans = 0;
	m = n;
	FOR(i,0,n)
		if (SZ(g[i]) == 0)
		{
			ans += 2LL * m - 1;
			--m;
		}
		else
		{
			if (used[i])
				continue;
		
			dw = 1;
			dfs(i, 1);
			if (dw)
				++k;
			else
				++l;
		}

	ans += 2 * k*k;
	ans += l * l;
	ans += 2 * k*l;
	cout << ans;
	cin >> n;	
	return 0;
}

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

int main() {
  int a, b, c, d; cin >> a >> b >> c >> d;
  int e=a+b, f=c+d;
  if(e>f){
    cout << "Left" << endl;
  }
  else if (e<f) {
    cout << "Right" << endl;
  }
  else if (e==f) {
    cout << "Balanced" << endl;
  }
}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




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

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 7752
from collections import deque
dx=[1,0,-1,0]
dy=[0,1,0,-1]

h, w = list(map(int, input().split()))
board = [list(input()) for i in range(h)]
q = deque()
for i in range(h):
    for j in range(w):
        if board[i][j] == "#":
            board[i][j] = True
            q.append((i, j, 0))
        else:
            board[i][j] = False

ans = 0
while q:
    i,j,cnt = q.popleft()
    for x, y in zip(dx,dy):
        if 0<=i+x<h and 0<=j+y<w and not board[i+x][j+y]:
            board[i+x][j+y] = True
            q.append((i+x, j+y, cnt+1))
            ans = max(ans, cnt+1)
print(ans)

Measured memory_bytes: 164444
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <numeric>
using namespace std;

const int month_days[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

const int days_in_400years = 146097;

inline int is_leap(int y) {
    return (y % 100 && y % 4 == 0) || y % 400 == 0;
}

int main() {
    char buf[20];
    int b, ka, t, w, ki, y, m, d, leap, i;
    long long days;

    while (gets(buf) != NULL) {
        if (buf[0] == '#') break;
        days = 0;
        if (sscanf(buf, "%d.%d.%d.%d.%d", &b, &ka, &t, &w, &ki) == 5) {
            days = (long long)b*144000 + ka*7200 + t*360 + w*20 + ki;
            days += 4739; // 2000.1.1 - 2012.12.21
            y = (days / days_in_400years) * 400;
            days = days % days_in_400years;
            for (;days > 0; y++) {
                if (is_leap(y)) {
                    if (days > 366) days -= 366;
                    else break;
                }
                else {
                    if (days > 365) days -= 365;
                    else break;
                }
            }
            for (m = 1; m <= 12; m++) {
                int md = m == 2 ? month_days[m]+is_leap(y): month_days[m];
                if (days > md) {
                    days -= md;
                }
                else {
                    break;
                }
            }
            printf("%d.%d.%d\n", y + 2000, m, (int)days);
        }
        else if (sscanf(buf, "%d.%d.%d", &y, &m, &d) ==3) {
            leap = is_leap(y);
            days = 10;
            days -= 13 * 365 + 4;
            days += ((long long)y - 2000) / 400 * days_in_400years;
            for (i = 0; i < y % 400; i++) {
                if (is_leap(i)) days += 366;
                else days += 365;
            }
            days += accumulate(month_days+1, month_days+m, 0);
            if (m > 2) days += leap;
            days += d;

            // printf("%d.%d.%d   %lld\n", y, m, d, days);
            printf("%lld.%lld.%lld.%lld.%lld\n", 
                   (days / 144000) % 13,
                   (days%144000) / 7200,
                   (days%7200) / 360,
                   (days%360) / 20,
                   days%20);
        }
    }
    return 0;
}

Measured memory_bytes: 1200
import java.util.*;
import java.math.*;
class Main {
    //
    static final int MOD = 1_000_000_007; // 10^9+7
    //static final int MAX = 2_147_483_646; // intの最大値
    static final int INF = 1_000_000_000; // 10^9
    static final int MAX = 10_000_000;
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String s;
        int[] ary;
        long n = sc.nextLong();
        long a = sc.nextLong();
        long b = sc.nextLong();
        long ans = (n/(a+b))*a;
        n %= a+b;
        if(n < a){
            ans += n;
        }else{
            ans+=a;
        }
        System.out.println(ans);
        
    }
}



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

int main() {
int n;
cin >> n;
string s;
cin >> s;
int ans = 0;
for(int i= 0; i <n-1; ++i)
{
	if(s[i] != s[i+1]) ++ans;
}
ans++;
cout << ans << endl;
return 0;
}


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

public class Main {
	public static void main(String[] args) {
		InputStreamReader isr;
		BufferedReader br;
		try {
	   		br = createBufferedReader();
	        String line = br.readLine();
	    	final int n = Integer.parseInt(line);
	        if (n < 2 || n > 20) {
	        	throw new IllegalArgumentException();
	        }
	        int[] a = new int[n];
	        int[] b = new int[n];
	        int[] c = new int[n - 1];
	        line = br.readLine();
	        StringTokenizer st = new StringTokenizer(line, " ");
	        for (int i = 0; i < n; i++) {
	        	a[i] = Integer.parseInt(st.nextToken());
	        }
	        line = br.readLine();
	        st = new StringTokenizer(line, " ");
	        for (int i = 0; i < n; i++) {
	        	b[i] = Integer.parseInt(st.nextToken());
	        }
	        line = br.readLine();
	        st = new StringTokenizer(line, " ");
	        for (int i = 0; i < n - 1; i++) {
	        	c[i] = Integer.parseInt(st.nextToken());
	        }
	        int result = 0;
	        for (int i = 0; i < n; i++) {
	        	result += b[a[i] - 1];
	        	if (i > 0 && a[i] - a[i - 1] == 1) {
	        		result += c[a[i] - 2];
	        	}
	        }
	        System.out.println(result);
		} catch (IOException ioe) {
			ioe.printStackTrace();
		} catch (IllegalArgumentException iae) {
			iae.printStackTrace();
			System.err.println("入力が正しくありません。");
		}
	}

	// 以下問題問わずに共通部分
	// 標準入力の BufferedReader を返す.
	private static BufferedReader createBufferedReader() {
		InputStreamReader isr =new InputStreamReader(System.in);
	   	return new BufferedReader(isr);
	}
}


Measured memory_bytes: 22612
from collections import defaultdict

if __name__ == "__main__":
    n = int(input())
    mean = 0
    numbers = defaultdict(int)
    tmp = [int(i) for i in input().split()]
    for i in tmp:
        numbers[i] += 1
        mean += i
    mean = round(mean / n)
    res = 0
    for number in numbers:
        res += numbers[number] * (mean - number) ** 2

    print(res)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

using namespace std;
typedef pair<int,int> P;

const int MOD=1000000007;
int INF=100100100100100;

signed main(){
  int h,w,n;cin>>h>>w>>n;
  int po=max(h,w);
  cout<<(n-1)/po+1<<endl;
  return 0;
}

Measured memory_bytes: 256
class UnionFind:
    """
    - sizeを指定
    - 要素をグループにまとめる(unite) 
    - 要素同士が同じグループか判定する(isSame)
    - 分離はできない
    - par: 親の番号(はじめ par[i]==i つまりすべての頂点が根)
     - 始め各要素は別々のグループ"""
    def __init__(self, size: int):
        self.par = [-1]*size
        for i in range(size):
            self.par[i] = i 
    
    def root(self, x: int) -> int:
        """根を求める"""
        if self.par[x] == x: # if root
            return x
        else:
            self.par[x] = self.root(self.par[x]) # 経路圧縮
            return self.par[x]
    
    def isSame(self, x:int, y:int)->bool:
        """x と y が同じ集合に属するか否か"""
        return self.root(x)==self.root(y)
    
    def unite(self, x:int, y:int):
        """x と y の属する集合を併合"""
        x = self.root(x)
        y = self.root(y)
        if x == y: return
        self.par[x] = y

        
        
##### main #####
N,M = map(int, input().split())
a,b = [0]*M, [0]*M
for i in range(M):
    ai,bi = map(int, input().split())
    a[i],b[i] = ai-1, bi-1
    
ans = 0
for i in range(M):
    uf = UnionFind(N)
    for j in range(M):
        if i==j: continue # この辺はパス
        uf.unite(a[j], b[j])
    bridge = False
    for i in range(N):
        if not uf.isSame(0,i):
            bridge = True
    if bridge:
        ans += 1
print(ans)

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;

namespace code_festival_2017_qualc_c
{
	class Program
	{
		static void Main(string[] args)
		{
			string s = Console.ReadLine();
			string[] arr = s.Split('x');
			string a = "";
			for (int i = 0; i < arr.Length; i++) a += arr[i];
			char[] c = a.ToCharArray(); Array.Reverse(c);
			if (a == new string(c))
			{
				List<int> list = new List<int>();
				int count = 0;
				for (int i = 0; i < s.Length; i++)
				{
					if (s[i] == 'x') count++;
					else
					{
						list.Add(count);
						count = 0;
					}
				}
				list.Add(count);
				int ret = 0;
				for (int i = 0; i < list.Count; i++)
				{
					ret += Math.Abs(list[i] - list[list.Count - i - 1]);
				}
				Console.WriteLine(ret / 2);
			}
			else
			{
				Console.WriteLine(-1);
			}
		}
	}
}

Measured memory_bytes: 35920
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<iomanip>
using namespace std;

int main(void)
{
	int a, b;
	cin >> a >> b;
	if (a % 2 != b % 2) { cout << "IMPOSSIBLE" << endl; }
	else { cout << (a + b) / 2 << endl; }
}


Measured memory_bytes: 256
import sys
stdin = sys.stdin
import itertools

mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))

N = ni()
A = list()
for _ in range(N):
    A.append(ni())
cnt = 0
if N==1:
    print(A[0]//2)
    quit()
for i in range(N-1):
    ccnt = (A[i] + A[i+1]) //2
    A[i+1] -= max(0, ccnt*2 - A[i])
    A[i] = max(0, A[i]-ccnt*2)
    cnt += ccnt
print(cnt)

Measured memory_bytes: 7148
import java.io.{BufferedReader, InputStreamReader}

object ModN {
  implicit def toModN(n: Long): ModN = {
    new ModN(n)
  }
}

class ModN(n: Long) {
  val MOD = 1000000007L

  def +(other: ModN): ModN = {
    new ModN((n + other.toLong) % MOD)
  }

  def *(other: ModN): ModN = {
    new ModN((n * other.toLong) % MOD)
  }

  val toLong: Long = n % MOD
}

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val n = in.readLine().toInt
    val as = in.readLine().split("\\s").map(_.toLong)

    val cs = Array.ofDim[Int](60)

    as.foreach { a =>
      (0 until 60).foreach { shift =>
        cs(shift) = cs(shift) + ((a >> shift) & 1).toInt
      }
    }

    val ans = (0 until 60).foldLeft(new ModN(0L)) { case (acc, shift) =>
      acc + (0 until shift).foldLeft(new ModN(cs(shift)) * new ModN(n - cs(shift))) { case (acc2, _) =>
        acc2 * 2L
      }
    }

    System.out.println(ans.toLong)
  }
}


Measured memory_bytes: 97368
// V solo
#include <bits/stdc++.h>

#define forn(i, a, b) for (int i = a; i <= b; ++i)

using namespace std;

const int N = (int)2e5 + 1;
const long long INF = 1e9 + 7;

typedef long long ll;
typedef long double ld;

typedef pair < int, int > pii;
typedef pair < ll, ll > pll;

int n, m;
vector < pii > v;
int main (){
  scanf ("%d %d", &n, &m);
  forn (i, 1, m){
    int x, y;
    scanf ("%d %d", &x, &y);
    v.push_back({x, y});
  }
  sort (v.begin(), v.end());
  int ans = 1, cur = v[0].second - 1;
  forn (i, 0, v.size() - 1){
    if (v[i].first <= cur){
      if (v[i].second < cur){
        cur = v[i].second - 1;
      }
    } else {
      cur = v[i].second - 1;
      ans++;
    }
  }
  printf ("%d\n", ans);
  return 0;
}


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

int main()
{  
    int n,comm,key;
    string color;
    map<string,int>s;
    cin>>n;
    REP(i,n)
    {
        cin>>comm;
        if(comm==0)
        {
            cin>>color>>key;
            s[color]=key;
        }
        if(comm==1)
        {
            cin>>color;
            if(s.find(color)!=s.end())
            {
                cout<<s[color]<<endl;
            }else cout<<0<<endl;
        }
        if(comm==2)
        {
            cin>>color;
            s.erase(color);
        }
        if(comm==3)
        {
            string l,r;
            cin>>l>>r;
            decltype(s)::iterator it=s.lower_bound(l);
            decltype(s)::iterator end=s.upper_bound(r);
            while(it!=end)
            {
                cout<<it->first<<" "<<it->second<<endl;
                it++;
            }
        }
    }
}



Measured memory_bytes: 27820