akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }

#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Vec2(T, n, m, xs, x0) vector<vector<T>> xs(n, vector<T>(m, x0))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(int, a, b);
    int c = 0;
    if(a == 0){
        c = ((b < 0) ? -b+1 : b);
    }
    else if(b == 0){
        c = ((a < 0) ? -a : a+1);
    }
    else if(abs(a) <= abs(b)){
        if(a < 0){
            c = ((b < 0) ? a-b+2 : b+a+1);
        }
        else{
            c = ((b < 0) ? -b-a+1 : b-a);
        }
    }
    else{
        if(a < 0){
            c = ((b < 0) ? b-a : -b-a+1);
        }
        else{
            c = ((b < 0) ? b+a+1 : a-b+2);
        }
    }
    Cout(c);
}


Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int times = Integer.parseInt(sc.nextLine());
		while (0 < times) {
			loop_1(sc, times);
			System.out.println("");
			times = Integer.parseInt(sc.nextLine());
		}	
	}
	
	private static void loop_1(Scanner sc, int times) {
		Map<String, String> map = new HashMap<String, String>();
		for (int i = 0; i < times; i++) {
			String[] line = sc.nextLine().split(" ");
			map.put(line[0], line[1]);
		}
		loop_2(sc, map);
	}
	
	private static void loop_2(Scanner sc, Map<String, String> map) {
		int times = Integer.parseInt(sc.nextLine());
		for (int i = 0; i < times; i++) {	
			String str = sc.nextLine();
			String conStr = (String) map.get(str);
			if (conStr == null) {
				System.out.print(str);
			} else {
				System.out.print(conStr);
			}
		}
	}
}

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

/*
ll gcds(ll a,ll b){
    if(a<b){
        swap(a,b);
    }
    ll r=a%b;
    if(r==0){
        return b;
    }
    while(r>0){
        r=a%b;
        a=b;
        b=r;
    }
    return a;
}


ll lcms(ll a,ll b){
    ll mmr=gcds(a,b);
    a=a/mmr;
    b=b/mmr;
    return a*b*mmr;
}
*/

ll attack(ll x){
    return x*2+1;
}


int main(){
    ll H;
    cin>>H;
    ll cnt=0;
    while(H>1){
        H=H/2;
        cnt++;
    }
    ll ans=1;
    for(ll i=0;i<cnt;i++){
        ans=attack(ans);
    }
    cout<<ans<<endl;
}

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

int main(){
	int N,t[105],M,P[105],x[105];
	scanf("%d",&N);
	for(int i=0;i<N;i++){
		scanf("%d",&t[i]);
	}
	scanf("%d",&M);
	for(int i=0;i<M;i++){
		scanf("%d%d",&P[i],&x[i]);
	}
	for(int i=0;i<M;i++){
		int res=0;
		for(int j=0;j<N;j++){
			if(P[i]!=j+1){
				res+=t[j];
			}
			else{
				res+=x[i];
			}
		}
		printf("%d\n",res);
		res=0;
	}
}

Measured memory_bytes: 128
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define INIT    \
    cin.tie(0); \
    ios::sync_with_stdio(false);

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

ll const INF = 1LL << 60;
ll const MOD = 1000000007;

int main() {
    INIT;
    string s;
    ll K;
    cin >> s >> K;

    vector<ll> dist;
    rep(i, SZ(s)) {
        if (s[i] == 'a') {
            dist.pb(0);
        } else {
            dist.pb(26 - (s[i] - 'a'));
        }
    }

    // repv(dist) { cout << *it << " "; }
    // cout << endl;

    rep(i, SZ(s)) {
        if (dist[i] <= K) {
            s[i] = 'a';
            K -= dist[i];
            dist[i] = 0;
        }
        // cout << s << ", K: " << K << endl;
    }

    K = K % 26;
    s[SZ(s) - 1] += K;

    cout << s << endl;

    return 0;
}

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

ll GCM(ll A, ll B) {
    if(A*B==1){ // ベースケース
        return 1;
    } else{ // 再帰ステップ
        for(ll i=2;i<=max(A,B);i++){
            if(A%i==0 && B%i==0){
                return GCM(A/i,B/i)*i;
            }else if(A%i==0){
                return GCM(A/i,B)*i;
            }else if(B%i==0){
                return GCM(A,B/i)*i;
            }
        } 
    }
}

int main() {
    ll A,B;
    cin >> A >> B;
    cout << GCM(A,B) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
#define MAXCH(a, b) ((a) = max((a), (b)))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;

ll N;
string S;
pll dp[500001][4];

int main(void) {
  cin >> N >> S;

  if(N <= 2) {
    cout << 0 << endl;
    return 0;
  }

  REP(i, 0, N + 1) REP(j, 0, 4) dp[i][j] = pll(-1, -1);
  if(S.substr(0, 2) == "00") dp[2][0] = pll(0, 0);
  if(S.substr(0, 2) == "01") dp[2][1] = pll(0, 1);
  if(S.substr(0, 2) == "10") dp[2][2] = pll(0, 1);
  if(S.substr(0, 2) == "11") dp[2][3] = pll(0, 2);
  REP(i, 2, N) {
    if(S[i] == '0') {
      if(dp[i][0].fi >= 0) {
        MAXCH(dp[i + 1][0].fi, dp[i][0].fi);
        MAXCH(dp[i + 1][0].se, dp[i][0].fi);
      }
      if(dp[i][1].fi >= 0) {
        MAXCH(dp[i + 1][2].fi, dp[i][1].fi);
        MAXCH(dp[i + 1][2].se, dp[i][1].se);
      }
      if(dp[i][2].fi >= 0) {
        MAXCH(dp[i + 1][0].fi, dp[i][2].fi);
        MAXCH(dp[i + 1][0].se, dp[i][2].fi);
      }
      if(dp[i][3].fi >= 0) {
        MAXCH(dp[i + 1][2].fi, dp[i][3].fi);
        MAXCH(dp[i + 1][2].se, dp[i][3].se);
      }
    } else {
      if(dp[i][0].fi >= 0) {
        MAXCH(dp[i + 1][1].fi, dp[i][0].fi);
        MAXCH(dp[i + 1][1].se, dp[i][0].se + 1);
      }
      if(dp[i][1].fi >= 0) {
        MAXCH(dp[i + 1][3].fi, dp[i][1].fi);
        MAXCH(dp[i + 1][3].se, dp[i][1].se + 1);
      }
      if(dp[i][2].fi >= 0) {
        MAXCH(dp[i + 1][1].fi, dp[i][2].fi);
        MAXCH(dp[i + 1][1].se, dp[i][2].fi + 1);
        MAXCH(dp[i + 1][2].fi, dp[i][2].fi + 1);
        MAXCH(dp[i + 1][2].se, dp[i][2].fi + 2);
        if(dp[i][2].se > dp[i][2].fi + 1) {
          MAXCH(dp[i + 1][0].fi, dp[i][2].se);
          MAXCH(dp[i + 1][0].se, dp[i][2].se);
        }
      }
      if(dp[i][3].fi >= 0) {
        MAXCH(dp[i + 1][3].fi, dp[i][3].fi);
        MAXCH(dp[i + 1][3].se, dp[i][3].se + 1);
      }
    }
  }

  // REP(i, 2, N + 1) printf("%3d (%c): (%3d, %3d), (%3d, %3d), (%3d, %3d), (%3d, %3d)\n", i, S[i - 1], dp[i][0].fi, dp[i][0].se, dp[i][1].fi, dp[i][1].se, dp[i][2].fi, dp[i][2].se, dp[i][3].fi, dp[i][3].se);
  cout << max({ dp[N][0].fi, dp[N][1].fi, dp[N][2].fi, dp[N][3].fi, 0LL }) << endl;
}


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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n;
	cin >> n;
	
	int m = 100000;
	
	for(int i = 0; i < n; ++i){
		m *= 1.05;
		if(m % 1000 != 0)
			m += 1000 - m % 1000;
	}
	
	cout << m << endl;
	
	return 0;
}

Measured memory_bytes: 1188
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>

std::string Alphabet(int num);

int main() {
   
   long N;
   
   std::cin >> N;
   
   //for (long M = 1; M <= 702; M++) {
   
   std::vector<std::string> Ans;
   
   while(N > 0) {
      
      int a = N%26;
      
      Ans.push_back(Alphabet(a));
      N = N/26;
      
      if (N == 1 && a == 0) {
         break;
      }
      
      if (a == 0) {
         N = N - 1;
      }
      
   }
   
   for (int i = Ans.size() - 1; i >= 0; i--) {
      std::cout << Ans[i];
   }
   std::cout << std::endl;
   
   // }
   
   return 0;
   
}

std::string Alphabet(int num) {
   
   if (num == 0) {
      return "z";
   }
   else if (num == 1) {
      return "a";
   }
   else if (num == 2) {
      return "b";
   }
   else if (num == 3) {
      return "c";
   }
   else if (num == 4) {
      return "d";
   }
   else if (num == 5) {
      return "e";
   }
   else if (num == 6) {
      return "f";
   }
   else if (num == 7) {
      return "g";
   }
   else if (num == 8) {
      return "h";
   }
   else if (num == 9) {
      return "i";
   }
   else if (num == 10) {
      return "j";
   }
   else if (num == 11) {
      return "k";
   }
   else if (num == 12) {
      return "l";
   }
   else if (num == 13) {
      return "m";
   }
   else if (num == 14) {
      return "n";
   }
   else if (num == 15) {
      return "o";
   }
   else if (num == 16) {
      return "p";
   }
   else if (num == 17) {
      return "q";
   }
   else if (num == 18) {
      return "r";
   }
   else if (num == 19) {
      return "s";
   }
   else if (num == 20) {
      return "t";
   }
   else if (num == 21) {
      return "u";
   }
   else if (num == 22) {
      return "v";
   }
   else if (num == 23) {
      return "w";
   }
   else if (num == 24) {
      return "x";
   }
   else {
      return "y";
   }
   
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using lint = long long int;
using ulint = unsigned long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T, class U> void assign(V<T>& v, int n, const U& a) { v.assign(n, a); }
template<class T, class... Args> void assign(V<T>& v, int n, const Args&... args) { v.resize(n); for (auto&& e : v) assign(e, args...); }


int main() {
  cin.tie(nullptr); ios_base::sync_with_stdio(false);
  int n, m; cin >> n >> m;
  VV<> g(n);
  V<> in(n);
  for (int i = 0; i < n - 1 + m; ++i) {
    int u, v; cin >> u >> v, --u, --v;
    g[u].push_back(v);
    ++in[v];
  }
  V<> st;
  for (int v = 0; v < n; ++v) {
    if (in[v] == 0) {
      st.push_back(v);
    }
  }
  V<> vs;
  while (!st.empty()) {
    int v = st.back();
    st.pop_back();
    vs.push_back(v);
    for (int w : g[v]) {
      --in[w];
      if (in[w] == 0) {
        st.push_back(w);
      }
    }
  }
  V<> res(n, -1);
  for (int v : vs) {
    for (int w : g[v]) {
      res[w] = v;
    }
  }
  for (int v = 0; v < n; ++v) {
    cout << res[v] + 1 << '\n';
  }
}

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

int main() {
     string s;
     cin >> s;
     int counter = 0;
     if(s[0]=='1') ++counter;
     if(s[1]=='1') ++counter;
     if(s[2]=='1') ++counter;
     cout << counter << endl;
}


Measured memory_bytes: 256
# abc107_a.py
# https://atcoder.jp/contests/abc107/tasks/abc107_a

# 問題文
# N両編成の列車があります。 この列車の前から i両目は、後ろから何両目でしょうか？

# 制約
#     1≤N≤100
#     1≤i≤N

# 入力
# 入力は以下の形式で標準入力から与えられる。
# N i

# 出力
# 答えを出力せよ。

# 入力例 1
# 4 2

# 出力例 1
# 3

# 4両編成の列車において、前から 2 両目の車両は、後ろから 3両目です。

# 入力例 2
# 1 1

# 出力例 2
# 1

# 入力例 3
# 15 11

# 出力例 3
# 5


def calculation(lines):
    N, i = list(map(int, lines[0].split()))
    # K = int(lines[1])
    return [N-i+1]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['4 2']
        lines_export = [3]
    if pattern == 2:
        lines_input = ['1 1']
        lines_export = [1]
    if pattern == 3:
        lines_input = ['15 11']
        lines_export = [5]
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    if len(args) == 1:
        mode = 0
    else:
        mode = int(args[1])
    return mode


# 主処理
def main():
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(1)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')


# 起動処理
if __name__ == '__main__':
    main()


Measured memory_bytes: 9148
#include <iostream>
using namespace std;
int main() {
  int x, y;
  while(true){
    cin >> x >> y;
    if(x == 0 && y == 0){
      break;
    }
    if(x > y) {
      cout << y << " " << x;
    } else {
      cout << x << " " << y;
    }
    cout << endl;
  }
}


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

struct data{
    int cnt,n;
};
bool ope(data a,data b){
    if(a.cnt==b.cnt) return a.n<b.n;
    else return a.cnt>b.cnt;
}

int main(){
    int n,m;
    while(cin>>n>>m,n||m){
        int input;
        data place[100]={};
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                cin>>input;
                if(input) place[j].cnt++;
                place[j].n=j+1;
            }
        }
        sort(place,place+m,ope);
        printf("%d",place[0].n);
        for(int i=1;i<m;i++){
            printf(" %d",place[i].n);
        }puts("");
    }
    return 0;
}

Measured memory_bytes: 1168
a, b, c = map(int, input().split())
 
if a<b and a<c:
    if b<c :
        print(a, b, c)
    else :
        print(a, c, b)
elif b<a and b<c :
    if a<c :
        print(b, a, c)
    else :
        print(b, c, a)
else :
    if a<b :
        print(c, a, b)
    else :
        print(c, b, a)


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

int n;
int main(){
  cin >> n;
  int flg = 0;

    for (int i = 0; i < 25; i++) {
      for (int j = 0; j < 15; j++) {
        if(i*4+j*7 == n) {
          flg = 1;
          break;
        }
      }
    }
  cout << (flg == 0 ? "No" : "Yes") << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
int gcd(int a,int b)
{
    while(a^=b^=a^=b%=a);
    return b;
}
int main()
{
    int y=1;
    int flag=1;
    int num=0;
    int n,m;
    cin>>n>>m;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        x=x/2;
        if(flag==1)
        {
            int t=gcd(x,y);
            long long z=x/t*y;
            if(z>m)
            {
                flag=0;
            }
            else
            {
                y=(int)z;
                int k=y/x;
                if(k%2==0)
                {
                    flag=0;
                }
            }
        }
    }
    if(flag==1)
    {
        int z=2*y;
        while(y<=m)
        {
            num++;
            y+=z;
        }
        cout<<num;
    }
    else
        cout<<0;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
template<class T> inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
int n;
ll a,b;
bool ok(ll mid,vl h){
    ll sum=0;
    rep(i,n){
        ll x=h[i]-mid*b;
        if(x>0){
            ll y=a-b;
            ll need=(x+y-1)/y;
            sum+=need;
        }
    }
    return sum<=mid;
}
int main(){
    cin >> n;
    cin >> a >> b;
    vl h(n);
    rep(i,n) cin >> h[i];
    vl ch=h;
    sort(ch.rbegin(),ch.rend());
    ll mx=ch[0];
    ll mx_cnt=(mx+b-1)/b;
    ll l=0,r=mx_cnt;
    while(r>l+1){
        ll mid=(r+l)/2;
        if(ok(mid,h)) r=mid;
        else l=mid;
        //cout << l << " " << r << endl;
    }
    cout << r << endl;
    return 0;
}

Measured memory_bytes: 2560
h,a,*m=open(0)
h,w,k,a,b,f,g=map(int,(h+a).split())
I=h*w
d=[I]*I
m+=d,
a=~w+a*w+b
q=[a]
d[a]=1
for s in q:
 for x in 0,1,2,3:
  for z in range(k):
   y=~z,0,z+1,0;i,j=s//w+y[x],s%w+y[x^1];t=i*w+j;p=d[s]+1
   if'.'!=m[i][j]or d[t]<p:break
   if d[t]>p:q+=t,;d[t]=p
print(d[~w+f*w+g]%I-1)

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

using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ll long long
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
void c_p_c()
{
#ifndef  ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
int binaryExponentiation(int base, int power, int modular)
{
	int res = 1;
	while (power)
	{
		if (power % 2 == 0)
		{
			power /= 2;
			base = (base * base) % modular;
		}
		else
		{
			res = (res * base) % modular;
			power--;
		}
	}
	return res;
}

bool prime[1000001];
int pp[1000001];
void sieve()
{
	memset(prime, true, sizeof(prime));
	int i, j;
	prime[1] = false;
	prime[0] = false;
	for (i = 2; i * i <= 1000000; i++)
	{
		if (prime[i])
		{
			for (j = i * i; j <= 1000000; j += i)
			{
				prime[j] = false;
			}
		}
	}

	int count = 0;
	for (i = 1; i <= 1000000; i++) {
		if (prime[i]) {
			count++;
		}
		if (prime[count])
			pp[i] = 1;
		else
			pp[i] = 0;
	}


}
int FindLCM(int a, int b)
{
	return (a * b) / __gcd(a, b);
}
int rangeDivisor(int m, int n, int a, int b)
{

	int lcm = FindLCM(a, b);

	int a_divisor = n / a - (m - 1) / a;
	int b_divisor = n / b - (m - 1) / b;

	// Find common divisor by using LCM
	int common_divisor = n / lcm - (m - 1) / lcm;

	int ans = a_divisor + b_divisor - common_divisor;
	return ans;
}
int32_t main()
{
	
	int  a, b, t;
	cin >> a >> b >> t;
	int count = 0;
	if (a > t + 0.5) {
		cout << "0";
		return 0;
	}
	cout << (t / a)*b;
}


Measured memory_bytes: 3612
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
b.append(0)
count = 0
for i in range(n+1):
  if a[i] >= b[i]:
    count += b[i]
  else:
    if a[i] + a[i+1] > b[i]:
      count += b[i]
      a[i+1] = a[i+1] - b[i] + a[i]
    else:
      count += a[i] + a[i+1]
      a[i+1] = 0
print(count)

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(ll i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;
#define MAX_N 110
#define MAX_2N 220
#define MAX_V MAX_2N

ll N;
ll RedId[MAX_N] = {};
ll BlueId[MAX_N] = {};
pair<ll, ll> Red[MAX_N] = {};
pair<ll, ll> Blue[MAX_N] = {};

class FordFullkerson {
    public:
        // 辺を表す構造体(行先、容量、m_G[i]における逆辺のインデックス)
        struct Edge {int to, cap, rev; };

        // from から to へ向かう容量 cap の辺をグラフに追加する
        void add_edge(int from, int to, int cap) {
            m_G[from].push_back((Edge){to, cap, static_cast<int>(m_G[to].size())});
            m_G[to].push_back((Edge){from, 0, static_cast<int>(m_G[from].size() - 1)});
        }

        // 増加パスを DFS で探す
        int dfs(int v, int t, int f) {
            if (v == t) { return f; }
            m_Used[v] = true;
            for(int i = 0; i < m_G[v].size(); ++i) {
                Edge &e = m_G[v][i];  // v から延びるエッジ i
                if(!m_Used[e.to] && e.cap > 0) {
                    int d = dfs(e.to, t, min(f, e.cap));
                    if(d > 0) {
                        e.cap -= d;
                        m_G[e.to][e.rev].cap += d;
                        return d;
                    }
                }
            }
            return 0;
        }

        // s から t への最大流を求める
        int max_flow(int s, int t) {
            int flow = 0;
            for(;;) {
                memset(m_Used, 0, sizeof(m_Used));
                int f = dfs(s, t, INF);
                if(f == 0) { return flow; }
                flow += f;
            }
            return flow;
        }
    public:
        vector<Edge> m_G[MAX_V];  // グラフの隣接リスト表現 (index: ノード番号)
        bool m_Used[MAX_V];       // DFS で既に調べたかのグラフ
};

signed main()
{
    cin >> N;
    MINUS(Red); MINUS(Blue);
    ll id = 1;
    REP(i, N) {
        ll x, y;
        cin >> x >> y;
        Red[i] = make_pair(x, y);
        RedId[i] = id;
        id++;
    }
    REP(i, N) {
        ll x, y;
        cin >> x >> y;
        Blue[i] = make_pair(x, y);
        BlueId[i] = id;
        id++;
    }
    FordFullkerson* ff = new FordFullkerson();

    REP(i, N) {
        REP(j, N) {
            if(Red[i].first < Blue[j].first && Red[i].second < Blue[j].second) {
                ff->add_edge(RedId[i], BlueId[j], 1);
            }
        }
    }
    REP(i, N) {
        ff->add_edge(0, RedId[i], 1);
        ff->add_edge(BlueId[i], MAX_V-1, 1);
    }
    printf("%lld\n", ff->max_flow(0, MAX_V-1));

    delete ff;

    return 0;
}


Measured memory_bytes: 512
k = [list(map(int, list(input().split()))) for i in range(3)]

for a1 in range(101):
    for a2 in range(101):
        for a3 in range(101):
            if (k[0][0] - a1) == (k[0][1] - a2) == (k[0][2] - a3):
                if (k[1][0] - a1) == (k[1][1] - a2) == (k[1][2] - a3):
                    if (k[2][0] - a1) == (k[2][1] - a2) == (k[2][2] - a3):
                        if k[0][0] - a1 >= 0 and k[0][1] - a2 >= 0 and k[0][2] - a3 >= 0:
                            if (k[1][0] - a1) >= 0 and (k[1][1] - a2) >= 0 and (k[1][2] - a3) >= 0:
                                if (k[2][0] - a1) >= 0 and (k[2][1] - a2) >= 0 and (k[2][2] - a3) >= 0:
                                    print("Yes")
                                    exit()

print("No")

Measured memory_bytes: 3188
import java.util.*;

public class Main
{
  public static void main(String[] args)
  {
  	Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int x = sc.nextInt();
    int t = sc.nextInt();

    int tmp = (int)Math.ceil((float)n/x);

    System.out.println(tmp*t);
  }
}

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

int main() {
	ll n;
  	cin>>n;
  
	ll bake[90];
  	bake[0]=2;
    bake[1]=1;
  
  for(int i=2;i<=n;i++){
    bake[i]=bake[i-2]+bake[i-1];
  }

  cout<<bake[n]<<endl;
  
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>

using namespace std;

typedef long long ll;

ll N;
int s, t;
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;

ll ask(int a, int b) {
	cout << "? " << a << " " << b << endl;
	cout.flush();
	ll ret;
	cin >> ret;
	return ret;
}

int main() {
	cin >> N >> s >> t;
	
	ll shortestpass = ask(s, t);
	
	for (int i = 1; i <= N; i++) {
		if (i == s || i == t) continue;
		ll tmp1 = ask(s, i), tmp2 = ask(i, t);
		if (tmp1 + tmp2 == shortestpass) {
			pq.push(make_pair(tmp1, i));
		}
	}

	vector<int> ans;
	ans.push_back(s);
	ll nowdis = 0;
	while (pq.size()) {
		auto now = pq.top(); pq.pop();
		ll tmp = ask(ans.back(), now.second);
		if (nowdis + tmp == now.first) {
			ans.push_back(now.second);
			nowdis += tmp;
		}
	}
	cout << "! ";
	for (int i = 0; i < ans.size(); i++) {
		cout << ans[i];
		cout << " ";
	}
	cout << t << endl;
	return 0;
}


Measured memory_bytes: 4668
#include<bits/stdc++.h>
using namespace std;
 
#define int             long long
#define ld              long double
#define ff              first
#define ss              second
#define pb              push_back
#define mp              make_pair
#define pii             pair<int, int>
#define mk(arr,n,type)  type *arr=new type[n];
#define vi              vector<int>
#define si              set<int>
#define usi             unordered_set<int>
#define mii             map<int, int>
#define umii            unordered_map<int, int>
#define pqmax           priority_queue<int>
#define pqmin           priority_queue<int, vi, greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define trailzrobits(x) __builtin_ctzll(x)
#define leadzrobits(x)  __builtin_clzll(x)
#define paritybits(x)   __builtin_parityll(x)
#define gcd             __gcd
#define lcm(x, y)       (x * y) / gcd(x, y)
#define mod             1000000007
#define endl            '\n'
#define PI              3.14159265358979323846
#define inf             1e18
#define sp(x,y)         fixed<<setprecision(y)<<x

void __print(int x) {cout<<x;}
void __print(float x){cout<<x;}
void __print(double x){cout<<x;}
void __print(ld x) {cout<<x;}
void __print(char x){cout <<'\''<<x<<'\'';}
void __print(const char *x){cout <<'\"' <<x<<'\"';}
void __print(const string &x) {cout<<'\"'<<x<<'\"';}
void __print(bool x) {cout<<(x?"true":"false");}
template<typename T,typename V>     void __print(const pair<T,V> &x) {cout<<'{';__print(x.first);cout<<',';__print(x.second);cout<<'}';}
template<typename T>                void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}void _print() {cout << "]\n";}
template <typename T,typename... V> void _print(T t, V... v) {__print(t);if(sizeof...(v))cout<<", ";_print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout<<"["<<#x<<"]=[";_print(x)
#else 
#define dbg(x...)
#endif

int power(int x, int y, int p = mod){
    int res = 1;
    x %= p;
    while(y > 0){
        if(y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res; 
}

int inv(int x, int p = mod){
    return power(x, p - 2) % p;
}

const int N = 1e6 + 6;
 
struct item{
    int wt, val;
};
int32_t main(){

    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    int t = 1;
    // cin >> t;
    while(t--){
       
        int n, W; cin>>n>>W; 
        vector<item> a(n+1);
        for(int i=1; i<=n; i++)
            cin>>a[i].wt>>a[i].val;
        
        int dp[n+1][W+1];

        for(int w=0; w<=W; w++)
            dp[1][w] = 0;
        dp[1][a[1].wt] = a[1].val;

        for(int i=2; i<=n; i++){
            for(int w=0; w<=W; w++){
                dp[i][w] = dp[i-1][w];
                if(w >= a[i].wt)
                    dp[i][w] = max(dp[i][w], a[i].val + dp[i-1][w-a[i].wt]);
            }
        }

        int ans = *max_element(dp[n], dp[n]+W+1LL);
        cout<<ans;
    }

    return 0;

}

Measured memory_bytes: 78336
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <map>

#define ll long long
#define REP(i,n) for(int i = 0; i < n; i++)
#define PI 3.141592653589
#define MOD 1000000007

#define rep(i, j, n) for(i = j; i <= n; i++)
using namespace std;

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

void solve_A(){
    int k;
    cin >> k;
    int a, b;
    cin >> a >> b;

    bool flag = false;
    int i = 1;
    while(i* k <= b){
        if(a <= i*k && i*k <= b) flag = true;
        i++;
    }

    if(flag) cout << "OK";
    else cout << "NG";
}

void solve_B(){
    ll x;
    cin >> x;

    int n = 0;
    while(1){
        if((ll)floor(100 * pow(1.01, n)) >= x){
            cout << n << endl;
            break;
        }
        n++;
    }
}

void solve_C(){
    int n, m, q;
    cin >> n >> m >> q;

    int a[q], b[q], c[q], d[q];
    REP(i,q) cin >> a[i] >> b[i] >> c[i] >> d[i];

    int A[10];
    int ans = 0, num;
    rep(A[0], 1, m){
        rep(A[1], A[0], m){
            rep(A[2], A[1], m){
                rep(A[3], A[2], m){
                    rep(A[4], A[3], m){
                        rep(A[5], A[4], m){
                            rep(A[6], A[5], m){
                                rep(A[7], A[6], m){
                                    rep(A[8], A[7], m){
                                        rep(A[9], A[8], m){
                                            num = 0;
                                            REP(i,q){
                                                if(A[b[i] - 1] - A[a[i] - 1] == c[i]){
                                                    num += d[i];
                                                }
                                            }
                                            if(num > ans){
                                                ans = num;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    cout << ans << endl;
}

int main(void){
    solve_C();
    
    return 0;
}

Measured memory_bytes: 3584
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(11);
	}
};
initializer _____;

int N, M, K, T, Q;
signed main() {
	cin >> N;
	string S, T;
	cin >> S;
	T = S;
	reverse(T.begin(), T.end());
	map< pair< string, string >, int > m1, m2;
	int ans = 0;
	for (int b = 0; b < (1 << N); b++) {
		string s, t;
		rep(i, N) {
			if ((b >> i) & 1)
				s.push_back(S[i]);
			else
				t.push_back(S[i]);
		}
		m1[make_pair(s, t)]++;
		string s2, t2;
		rep(i, N) {
			if ((b >> i) & 1)
				s2.push_back(T[i]);
			else
				t2.push_back(T[i]);
		}
		m2[make_pair(s2, t2)]++;
	}
	for (auto it = m1.begin(); it != m1.end(); it++) {
		ans += (it->second) * (m2[it->first]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 108288
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <string>
#include <numeric>
#include <queue>
#include <cstdio>
#include <cstring>
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<n;++i)
#define mrep(i,n) for(ll i=n;i>=0;--i)
#define all(a) (a).begin(),(a).end()
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define pl pair<ll,ll>
#define inf 1001001001001001000
//#define mod 1000000007
#define mod 998244353
#define pi 3.1415926535
using namespace std;
struct __INIT {
	__INIT() {
		cin.tie(0);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(15);
	}
}__init;


int main(void) {
	ll n, d;
	cin >> n >> d;
	vvl x(n, vl(d));
	rep(i, n) rep(j, d) {
		cin >> x[i][j];
	}
	ll ans = 0;
	rep(i, n) for (ll j = i + 1; j < n; j++) {
		double d1 = 0;
		rep(k, d) d1 += (x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
		d1 = sqrt(d1);
		if (d1 == (ll)d1) ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3612
def main():
  c = input()
  c = c.split(' ')
  x = int(c[0])
  y = int(c[1])

  for i in range(0, 100):
    turu = i * 2
    for j in range(0, 100):
      kame = j * 4
      if turu + kame == y and i + j == x:
        print('Yes')
        return
  print('No')
  
if __name__ == "__main__":
  main()

Measured memory_bytes: 9192
#include"bits/stdc++.h"
using namespace std;
int main()
{
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout); 
  #endif
  int k; cin>>k; int ld=k%10; 
  if(k==1){ cout<<1<<"\n"; return 0; }
  if(ld%2==0){ cout<<-1<<"\n"; return 0; }
  int res=7;  if(res%k==0){ cout<<1<<"\n"; return 0;}
  for(int i=2;i<=200000000;i++)
  { 
   res=(10*res+7)%k; if(res==0){ cout<<i<<"\n"; return 0; }  
  }
  cout<<-1<<"\n"; return 0; 
}

Measured memory_bytes: 3608
def gcd(a, b):
    if a < b:
        a, b = b, a
    while a % b != 0:
        a, b = b, a % b
    return b

def lcm(a):
    x = a[0]
    for i in range(1, len(a)):
        x = x * a[i] // gcd(x, a[i])
    return x

n = int(input())
t = [int(input()) for _ in range(n)]
print(lcm(t))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, m;
vector <int> a[N];
int cnt[N] = {0};

int main() {
    scanf("%d %d", &n, &m);
    for (int i = 1; i <= m; i++) {
        int x, y; scanf("%d %d", &x, &y);
        cnt[x]++;
        cnt[y]++;
    }
    for (int i = 1; i <= n; i++) {
        if (cnt[i] & 1) {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
inline LL read() {
	LL x = 0, fh = 1;
	char c = getchar();
	while (c < '0' || c > '9') {
		if (c == '-') fh = -1;
		c = getchar();
	}
	while (c >= '0' && c <= '9') {
		x = (x << 1) + (x << 3) + c - '0';
		c = getchar();
	}
	return x * fh;
}
const int N = 110;
int n, ans, i, j, a[N];
int main() {
	n = read();
	for (i = 1; i <= n; i++) a[i] = read();
	for (i = 1; i <= n; i++) {
		j = i;
		while (a[j] == a[j + 1]) j++;
		if (a[i] > a[i - 1] && a[j] > a[j + 1]) ans += a[i];
		if (a[i] < a[i - 1] && a[j] < a[j + 1]) ans -= a[i];
		i = j;
	}
	cout << ans << '\n';
	return 0;
}

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

print(0)
start_ans = input()
if start_ans == 'Vacant':
    quit()
end_ans = start_ans
start = 0
end = N
while True:
    mid = (start+end)//2
    print(mid)
    mid_ans = input()
    if mid_ans == 'Vacant':
        quit()
    if (mid-start)%2 == (start_ans == mid_ans):
        end = mid
        end_ans = mid_ans
    else:
        start = mid
        start_ans = mid_ans 

Measured memory_bytes: 3660
#include <iostream>
#include <cstdio>

using namespace std;

int main(void) {
	int w, n;
	cin >> w >> n;
	int *line = new int[w];
	for (int i = 0; i < w; i++)
		line[i] = i+1;
	for (int i = 0; i < n; i++) {
		int a, b;
		scanf("%d,%d", &a, &b);
		a--, b--;
		line[a] ^= line[b];
		line[b] ^= line[a];
		line[a] ^= line[b];
	}
	for (int i = 0; i < w; i++)
		cout << line[i] << endl;
	delete[] line;
	return 0;
}

Measured memory_bytes: 0
a,b,c = map(int,input().split())
k = int(input())

for i in range(k):
    if c > b > a:
        break
    elif b <= a:
        b = 2*b
    elif b >= c:
        c = 2*c
if c > b > a:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9168
/*
	In the name of ALLAH
	Author : Raashid Anwar
*/

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

#define int int64_t
#define mod 1000000007


int power(int a,int b) {
	int r=1;
	while(b) {
		if(b&1)
			r=(r*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return r;
}


int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n,m,a=0,b=0,p;
	cin>>n>>m;
	string s;
	int vis[n+1],vis2[n+1];
	memset(vis,0,sizeof(vis));
	memset(vis2,0,sizeof(vis2));
	for(int i=1;i<=m;i++) {
		cin>>p>>s;
		if(!vis[p]) {
			if(s=="AC") {
				vis[p]=1;
			}
			else {
				vis2[p]++;
			}
		}
	}
	for(int i=1;i<=n;i++) {
		if(vis[i]) {
			a++;
			b+=vis2[i];
		}
	}
	cout<<a<<" "<<b<<"\n";
}


Measured memory_bytes: 1792
n = int(input())
a = []
lis = [[] for _ in range(n)]
for i in range(n):
    inp = int(input())
    a.append(inp)
    for j in range(inp):
        x, y = map(int, input().split())
        x -= 1
        lis[i].append([x,y])
ans = 0
for i in range(2**n):
    true = []
    now = 0
    for j in range(n):
        if (i >> j) & 1:
            true.append(1)
            now += 1
        else:
            true.append(0)
    flag = False
    for j in range(n):
        if true[j] == 1:
            for xys in lis[j]:
                x = xys[0]
                y = xys[1]
                if true[x] != y:
                    flag = True
                if flag:
                    break
        if flag:
            break
    if not flag:
        ans = max(ans, now)
print(ans)

Measured memory_bytes: 45676
import sys
input = sys.stdin.readline
def solve():
  n,m = (int(i) for i in input().split())
  query = []
  for i in range(m):
    a,b = (int(i) for i in input().split())
    query.append((b-1,a-1))
  query.sort()
  ans = 0
  remove = 10**15
  for i in range(m):
    b,a = query[i]
    if a > remove or remove >= b:
        ans += 1
        remove = b-1
  print(ans)
    
solve()
  

Measured memory_bytes: 16996
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

using ll=long long;
using vi=std::vector<int>;
using vvi=std::vector<vi>;
using vll=std::vector<ll>;
using vvll=std::vector<vll>;
template<typename T> using vvec=std::vector<std::vector<T>>;
template<typename T>
auto make_v(size_t sz){return std::vector<T>(sz);}
template<typename T,typename... Ts>
auto make_v(size_t sz,Ts...ts){return std::vector<decltype(make_v<T>(ts...))>(sz,make_v<T>(ts...));}
template<typename T>
void fill_v(T&var,const T&x){var=x;}
template<typename V,typename T>
void fill_v(V&v,const T&x){for(auto&& w:v){fill_v(w,x);}}

template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<std::vector<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<std::deque<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s, const std::set<T>&v){
  s<<"\n";for(auto&& elm:v){s<<elm<<"\t";}s<<"\n";return s;}

inline void scan(int&a){scanf("%d",&a);}
inline void scan(ll&a){scanf("%lld",&a);}
inline void scan(char&a){scanf(" %c",&a);}
inline void scan(double&a){scanf("%lf",&a);}
inline void scan(std::string&s){char BUF[3000000];scanf(" %s",BUF);s=std::string(BUF);}
template<typename T>
inline void scan(std::vector<T>&v){for(auto&& sv:v){scan(sv);}}
template<typename First,typename...Args>
inline void scan(First&f,Args&...args){scan(f);scan(args...);}
inline void print(int a){printf("%d\n",a);}
inline void print(ll a){printf("%lld\n",a);}
inline void print(double a){printf("%.12f\n",a);}
inline void print(std::string s){std::cout<<s<<"\n";}

using namespace std;

int main() {
  string s; scan(s);
  int n = s.length();
  vi ins = {-1};
  rep (i, n) {
    if (s[i] != 'A' && s[i] != 'C' && s[i] != 'G' && s[i] != 'T') {
      ins.push_back(i);
    }
  }
  ins.push_back(n);
  int sz = ins.size();
  int ans = 0;
  rep (i, sz-1) {
    ans = max(ans, ins[i+1] - ins[i] - 1);
  }
  print(ans);

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  int n;
  int i;
  int sum;
  while(cin>>n){
    if(n==0) break;
    if(n==1){
      cout << "deficient number\n";
      continue;
    }
    sum=1;
    for(i=2;i*i<n;++i){
      if(n%i==0) sum+=(i+n/i);
    }
    if(sum==n) cout << "perfect number\n";
    else if(sum>n) cout <<"abundant number\n";
    else cout << "deficient number\n";
  }
  return 0;
}

Measured memory_bytes: 3028
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <map>
#include <set>
#include <utility>
#include <vector>

using namespace std;
int main(){
  string S;
  cin >> S;
  for (int i = S.length(); i >= 1; ){
    //cerr << S.substr(i-5, 5) << endl;
    if (((i-7) >= 0) && (S.substr(i-7, 7) == "dreamer")){
      //cerr << 1 << endl;
      i-=7;
      continue;
    }else if (((i-6) >= 0) && (S.substr(i-6, 6) == "eraser")){
      //cerr << 2 << endl;
      i-=6;
      continue;
    }else if (((i-5) >= 0) && (S.substr(i-5, 5) == "dream")){
      //cerr << 3 << endl;
      i-=5;
      continue;
    }else if (((i-5) >= 0) && (S.substr(i-5, 5) == "erase")){
      //cerr << 4 << endl;
      i-=5;
      continue;
    }else{
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}


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

using namespace std;

int a,b,d,c,ans,bmasu;

int solve(int a){
  if(a<4)cout<<1<<endl;
  else if(a<8)cout<<4<<endl;
  else if(a<9)cout<<8<<endl;
  else if(a<16)cout<<9<<endl;
  else if(a<25)cout<<16<<endl;
  else if(a<27)cout<<25<<endl;
  else if(a<32)cout<<27<<endl;
  else if(a<36)cout<<32<<endl;
  else if(a<49)cout<<36<<endl;
  else if(a<64)cout<<49<<endl;
  else if(a<81)cout<<64<<endl;
  else if(a<100)cout<<81<<endl;
  else if(a<121)cout<<100<<endl;
  else if(a<125)cout<<121<<endl;
  else if(a<128)cout<<125<<endl;
  else if(a<144)cout<<128<<endl;
  else if(a<169)cout<<144<<endl;
  else if(a<196)cout<<169<<endl;
  else if(a<216)cout<<196<<endl;
  else if(a<225)cout<<216<<endl;
  else if(a<243)cout<<225<<endl;
  else if(a<256)cout<<243<<endl;
  else if(a<289)cout<<256<<endl;
  else if(a<324)cout<<289<<endl;
  else if(a<343)cout<<324<<endl;
  else if(a<361)cout<<343<<endl;
  else if(a<400)cout<<361<<endl;
  else if(a<441)cout<<400<<endl;
  else if(a<484)cout<<441<<endl;
  else if(a<512)cout<<484<<endl;
  else if(a<529)cout<<512<<endl;
  else if(a<576)cout<<529<<endl;
  else if(a<625)cout<<576<<endl;
  else if(a<676)cout<<625<<endl;
  else if(a<729)cout<<676<<endl;
  else if(a<784)cout<<729<<endl;
  else if(a<841)cout<<784<<endl;
  else if(a<900)cout<<841<<endl;
  else if(a<961)cout<<900<<endl;
  else if(a<1000)cout<<961<<endl;
  else if(a<1024)cout<<1000<<endl;
}

int main(){
  cin>>b;
    solve(b);
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  sort(a.begin(), a.end(), [](const int a, const int b) { return a > b; });
  int res = 0;
  for (int i = 1; i < n; i += 2) res += a[i - 1] - a[i];
  if (n % 2) res += a[n - 1];
  cout << res << endl;
}


Measured memory_bytes: 256
def calc_digits(num):
    ans = 1
    while True:
        if num // 10 == 0:
            break
        num //= 10
        ans += 1

    return ans


def main():
    N = int(input())
    ans = 10 ** 10

    for A in range(1, int(N ** 0.5) + 1):
        if N % A != 0:
            continue
        B = N // A
        A_digits = calc_digits(A)
        B_digits = calc_digits(B)

        max_digits = max(A_digits, B_digits)
        if max_digits < ans:
            ans = max_digits

    print(ans)


if __name__ == "__main__":
    main()


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

using namespace std;

int main()
{
	int n;
	int head,fin;
	int temp;
	
	
//	vector<int> isPrime;
	bool isPrime[1000000];
	
	while(cin>>n)
	{
		for(int i = 0; i < n+1; i++){
//			isPrime.push_back(1);
			isPrime[i] = 1;
		}
//		cout << "Corecced!" << endl;
		isPrime[0] = isPrime[1] = 0;
		temp = 0;
		
		for(;;)
		{
			//TõXgÌæªð©Â¯é
			for(head = temp+1; head < n+1; head++){
				if(isPrime[head] == 1){
					break;
				}
			}
			//æªðÜÜÈ¢{ÍSÄ¬
			for(int i = head; i*head < n+1; i++){
				isPrime[i*head] = 0;
			}
			//TõXgÌÅãÖ
			for(fin = n; fin > 0; fin--){
				if(isPrime[fin] == 1){
					break;
				}
			}
		//	printf("head:%d    fin:%d\n",head,fin);
			
			if(fin <= head*head){
				break;
			}
			temp = head;
		}
		
		int cont = 0;
		for(int i = 0; i < n+1; i++){
			if(isPrime[i] == 1){
				cont++;
		//		cout << "+"<<i << endl;
			}
		}
		printf("%d\n",cont);
	}
}

Measured memory_bytes: 1848