akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>

using namespace std;

/* template */

using ll = long long;

void debug_out() { std::cout << std::endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}

struct Edge{
    int to;
    ll weight;
    Edge(int t, ll w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    ll weight;
    edge(int f,int t,ll w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

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;
}

constexpr ll LNF = 1e15;

constexpr int INF = 1e9+7;

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

/* template */

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,c; cin >> n >> c;
    vector<vector<int>> d(c,vector<int>(c));
    vector<vector<int>> s(3,vector<int>(c,0));
    rep(i,0,c){
        rep(j,0,c){
            cin >> d[i][j];
        }
    }
    vector<vector<int>> color(n,vector<int>(n));
    rep(i,0,n){
        rep(j,0,n){
            cin >> color[i][j];
            color[i][j]--;
        }
    }
    rep(i,0,n){
        rep(j,0,n){
            rep(k,0,c){
                s[(i+j+2)%3][k] += d[color[i][j]][k];
            }
        }
    }
    int ans = INF;
    rep(i,0,c){
        rep(j,0,c){
            rep(k,0,c){
                if(i==j || j==k || k==i){
                    continue;
                }
                chmin(ans,s[0][i]+s[1][j]+s[2][k]);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1280
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char[] c = s.toCharArray();
		int[] n = new int[c.length];
		for (int i = 0; i < n.length; i++) {
			n[i] = Character.getNumericValue(c[i]);
		}
		int ans = Integer.MAX_VALUE /10;
		for (int i = 0; i < n.length -2; i++) {
			int X = n[i]*100 + n[i+1]*10 + n[i+2];
			ans = Math.min(ans, Math.abs(753-X));
		}
		System.out.println(ans);
		sc.close();
	}
}


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

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;

    if (min(B, D) - max(A, C) < 0) cout << 0 << endl;
    else cout << min(B, D) - max(A, C) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s; 
int main(){
	cin>>s;
	if(s[0]=='A') cout<<'T';
	if(s[0]=='T') cout<<'A';
	if(s[0]=='G') cout<<'C';
	if(s[0]=='C') cout<<'G';
 	return 0;
}

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

# 丸太がすべてxの長さ以下になる回数を出し、それがＫ回以下か判定する
def f(x):
    now = 0
    for i in range(N):
        now += (A[i]-1)//x
    return now <= K

l = 0
r = 10**9

while r-l > 1:
    mid = (r+l)//2
    if f(mid):
        r = mid
    else:
        l = mid
print(r)

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

int main(){
  int score[2];
  int h[2],k[2],a,b,c,d;

  cin >> h[0] >> h[1];
  cin >> k[0] >> k[1];
  cin >> a >> b >> c >>d;

  score[0] = h[0]*a + h[1]*b + h[0] / 10 * c + h[1] / 20 * d;
  score[1] = k[0]*a + k[1]*b + k[0] / 10 * c + k[1] / 20 * d;

  if(score[0] > score[1]){
    cout << "hiroshi" << endl;
  }else if(score[0] < score[1]){
    cout << "kenjiro" << endl;
  }else{
    cout << "even" << endl;
  }
  
  return 0;
}



Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
#define eb(t) emplace_back(t)
typedef long long ll;
typedef long long unsigned int llu;
ll INF = 1000000009;
ll MOD = 1000000007;


void solve(){

    int a,b;
    cin >> a >> b;
    cout << a*b << endl;

}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}


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

ll A , B;

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


int main(){
  cin >> A >> B;
  ll n = gcd(A , B);
  ll cnt = 1;
  for(ll i = 2; i * i <= n; ++i){
    if(n % i == 0){
      ++cnt;
      while(n % i == 0){n /= i;}
    }
  }
  if(n > 1)++cnt;
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
cnt = [0] * (10**6 + 1)

for i in a:
    cnt[i] += 1
    
unique = []

for i in range(10**6 + 1):
    if cnt[i] == 1:
        unique.append(i)

cnt = [0] * (10**6 + 1)

a = list(set(a))

for i in a:
    for j in range(i*2, 10**6 + 1, i):
        cnt[j] = 1
    
ans = 0

for i in unique:
    if cnt[i] == 0:
        ans += 1
        
print(ans)

Measured memory_bytes: 48316
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <iostream>
#include <queue>
using namespace std;
typedef long long LL;
const int inf = 1 << 30;
const LL INF = 1LL << 60;
const int MaxN = 100005;

LL N, M;

int main()
{
	while(scanf("%lld %lld", &N, &M) != EOF)
	{
		LL ans = 0LL;
		if(N >= 2 && M >= 2) {
			ans = 2LL * M + 2 * (N - 2LL);
		}
		else if(N == 1 && M >= 2) {
			ans = 2LL;
		}
		else if(N >= 2 && M == 1) {
			ans = 2LL;
		}
		else ans = 0LL;
		printf("%lld\n", N * M - ans);
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fst first
#define snd second
#define rep(n) for(lint I = 0; (I) < (lint)(n); ++(I))
#define repeat(i, n) for(lint i = 0; (i) < (lint)(n); ++(i))
#define repeat_to(i, n) for(lint i = 0; (i) <= (lint)(n); ++(i))
#define repeat_from(i, m, n) for(lint i = (m); (i) < (lint)(n); ++(i))
#define repeat_from_to(i, m, n) for(lint i = (m); (i) <= (lint)(n); ++(i))
#define repeat_reverse_from_to(i, m, n) for(lint i = (m); (i) >= (lint)(n); --(i))
#define el cout<<endl
#define dump(x) cout<<" "<<#x<<"="<<x
#define vdump(v) for(size_t I=0; I<v.size(); ++I){cout<<" "<<#v<<"["<<I<<"]="<<v[I];} cout<<endl
using namespace std;
using lint = long long;
using ld = long double;

/****************** グラフ ******************/
// 諸宣言
using Weight = lint;
using Flow = lint;
struct Edge {
    int src, dst;
    Weight weight;
    Flow cap;
    Edge() : src(0), dst(0), weight(0) {}
    Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) {}
    Edge(int s, int d, Weight w, Flow c) : src(s), dst(d), weight(w), cap(c) {}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;
using Array = vector<Weight>;
using Matrix = vector<Array>;

void add_edge(Graph &g, int a, int b, Weight w = 1, Flow c = 1) {
    g[a].emplace_back(a, b, w, c);
    g[b].emplace_back(b, a, w, c);
}
void add_arc(Graph &g, int a, int b, Weight w = 1, Flow c = 1) {
    g[a].emplace_back(a, b, w, c);
}

vector<Weight> dijkstra(const Graph &g, int s) {
    const Weight INF = numeric_limits<Weight>::max() / 8;
    using state = tuple<Weight, int>;
    priority_queue<state> q;
    vector<Weight> dist(g.size(), INF);
    dist[s] = 0;
    q.emplace(0, s);
    while (q.size()) {
        Weight d;
        int v;
        tie(d, v) = q.top();
        q.pop();
        d *= -1;
        /* if(v == t) return d; */
        if (dist[v] < d) continue;
        for (auto &e : g[v]) {
            if (dist[e.dst] > dist[v] + e.weight) {
                dist[e.dst] = dist[v] + e.weight;
                q.emplace(-dist[e.dst], e.dst);
            }
        }
    }
    return dist;
}

int main(void) {
    int k;
    cin >> k;
    Graph g(k);
    repeat(i, k - 1) {
        add_arc(g, i, i + 1, 1);
    }
    add_edge(g, k - 1, 0, 1);
    repeat(i, k) {
        int j = (i * 10) % k;
        if (i != j) add_arc(g, i, j, 0);
    }
    auto res = dijkstra(g, 1);
    cout << res[0] + 1 << endl;
}

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

int main(){
  string s;
  cin >> s;
  if(s == "SUN") cout << 7;
  if(s == "MON") cout << 6;
  if(s == "TUE") cout << 5;
  if(s == "WED") cout << 4;
  if(s == "THU") cout << 3;
  if(s == "FRI") cout << 2;
  if(s == "SAT") cout << 1;
  return 0;
}

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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  int H, W;
  cin >> H >> W;
  vector<vector<char>> A(H);
  char a;
  REP(i, H) {
    bool all_white = true;
    REP(j, W) {
      cin >> a;
      A.at(i).push_back(a);
      if (a == '#') {
        all_white = false;
      }
    }

    if (all_white) {
      replace(A.at(i).begin(), A.at(i).end(), '.', 'x');
    }
  }

  REP(j, W) {
    bool all_white = true;
    REP(i, H) {
      if (A.at(i).at(j) == '#') {
        all_white = false;
      }
    }
    if (all_white) {
      REP(k, H) { A.at(k).at(j) = 'x'; }
    }
  }

  REP(i, H) {
    bool empty = true;
    REP(j, W) {
      if (A.at(i).at(j) != 'x') {
        cout << A.at(i).at(j);
        empty = false;
      }
    }

    if (!empty) {
      cout << endl;
    }
  }

  return 0;
}


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

int main(){
  int N;
  cin>>N;
  set<int64_t> S;
  S.insert(0);
  bool frag=true;
  for(int i=0;i<N;++i){
    int64_t a;
    cin>>a;
    if(S.count(a)){
      frag=false;
      break;
    }
    else S.insert(a);
  }

  if(frag) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}


Measured memory_bytes: 9600
n = int(input())
a = [int(input()) for i in range(n)]
def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a

 #最小公倍数
def lcm(a,b):
  return a*b//gcd(a,b)

if len(a) ==0:
  print(a[0])
  exit()
else:
  a1 = a[0]
  for i in a:
    a2 = lcm(a1,i)
    a1 = a2
print(a2)
  

Measured memory_bytes: 3060
#include<stdio.h>
#include<string.h>
#include<math.h>

int main()
{	
	long i,fmax,y;
	int answer=0;
	double num;
	double snum=0.0;
	scanf("%lf",&num);

	snum=sqrt(num);

	for(i=1;i<=snum;i++){
		if((long)num%i == 0){
			y=i;
		}
	}

	fmax=(long)num/y;

	while(fmax!=0){
		fmax=fmax/10;
		answer++;
	}

	printf("%d\n",answer);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include<chrono>
using namespace std;
using ll = long long;

int main() {
  ll N;
  cin >> N;
  vector<ll> A(N+1);
  vector<ll> B(N);
  for (int i = 0; i< N+1; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < N; i++) {
    cin >> B[i];
  }
  ll ans = 0;
  for (int i = 0; i < N; i++) {
    ans += min(A[i], B[i]);
    ans += min(A[i+1], B[i]-min(A[i], B[i]));
    A[i+1] -= min(A[i+1], B[i]-min(A[i], B[i]));
  }
  cout << ans << endl;
}


Measured memory_bytes: 1792
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CXYZTriplets solver = new CXYZTriplets();
        solver.solve(1, in, out);
        out.close();
    }

    static class CXYZTriplets {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();

            IntCounter count = new IntCounter(n + 1);

            for (int x = 1; x <= 100; x++) {
                for (int y = 1; y <= 100; y++) {
                    for (int z = 1; z <= 100; z++) {
                        int val = x * x + y * y + z * z + x * y + y * z + z * x;
                        if (val <= n)
                            count.incr(val);
                    }
                }
            }

            for (int i = 1; i <= n; i++) {
                out.println(count.get(i));
            }
        }

    }

    static class InputReader {
        public final BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }

    static class IntCounter {
        final int[] freq;
        int distinct = 0;

        public IntCounter(int n) {
            freq = new int[n];
        }

        public IntCounter(int[] array) {
            int n = Util.max(array) + 1;
            freq = new int[n];
            for (int x : array) {
                incr(x);
            }
        }

        public void incr(int key) {
            if (freq[key] == 0)
                distinct++;
            freq[key]++;
        }

        public int get(int key) {
            return freq[key];
        }

    }

    static class Util {
        public static int max(int... x) {
            int max = Integer.MIN_VALUE;
            for (int i : x) {
                max = Math.max(i, max);
            }
            return max;
        }

        private Util() {
        }

    }
}



Measured memory_bytes: 28076
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using Pair = pair<int64_t, int64_t>;

// std::cout << std::setprecision(20) << 1.1 << endl;

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

  int64_t H, W;
  cin >> H >> W;
  // const int64_t L = static_cast<int64_t>(T.length());
  vector<vector<int64_t>> C(10, vector<int64_t>(10));
  for (int64_t a = 0; a < 10; ++a)
    for (int64_t b = 0; b < 10; ++b)
      cin >> C[a][b];

  vector<int64_t> dist(10, INT64_MAX);
  dist[1] = 0;
  priority_queue<Pair> q;
  q.emplace(dist[1], 1);
  while (!q.empty()) {
    const Pair p = q.top();
    q.pop();
    const int64_t c_dist = p.first;
    const int64_t c_num = p.second;
    for (int64_t n = 0; n < 10; ++n) {
      const int64_t next_dist = c_dist + C[n][c_num];
      if (n != c_num && n != 1 && next_dist < dist[n]) {
        dist[n] = next_dist;
        q.emplace(next_dist, n);
      }
    }
  }

  int64_t result = 0;
  for (int64_t i = 0; i < H; ++i) {
    for (int64_t j = 0; j < W; ++j) {
      int64_t a;
      cin >> a;
      if (a >= 0) {
        result += dist[a];
      }
    }
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 3636
N = int(input())
ans = 1
A, B = map(int, input().split())
topRank = A
worstRank = A
topPoint = B
worstPoint = B
for i in range(N-1):
    A, B = map(int, input().split())
    if A < topRank:
        ans += topRank - A
        topRank = A
        topPoint = B
    elif A > worstRank:
        ans += A - worstRank
        worstRank = A
        worstPoint = B
ans += topRank - 1
ans += worstPoint
print(ans)

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

int main() {
    ll n,k;
    std::cin >> n>>k;
    vector<ll> a(n);
    
    vector<ll> psum(n+1);
    vector<ll> sum( n+1);

    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
        sum[i+1] = sum[i]+a[i];
        psum[i+1] = psum[i];
        if(a[i]>0){
            psum[i+1] += a[i];
        }
    }
    
    ll result = -1e18;

    for (int i = 0; i < n-k+1; i++) {
        result = max(result,psum[n]-( psum[i+k]-psum[i] )+max( (ll)0, sum[i+k]-sum[i] ) );
    }
    std::cout << result << std::endl;
    // どれくらい柔軟な範囲のとり方ができるか。
    
    // 全部はいける kで撮ったあまりはいける
    
    // 2*k以下なら真ん中の自由度はなさそう。
    
    // どこかのk意外の場所は任意の色にできる？
    // その他のプラス分の合計+kの色（）
}


Measured memory_bytes: 2560
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <array>
#include <tuple>
#include <random>

using namespace std;
typedef long long int ll;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()

#define const INF 10000000000

ll a, b, c, d, n, x, y, z, w, h, ans = 0, cnt = 0, max = 0;
string s;

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

    cin >> n;
    a = n;
    while(n){
        cnt += n % 10;
        n /= 10;
    }
    if(a % cnt == 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
const int INF=(ll)(1LL<<31)-1;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
//int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}




int n;
int a[310][310];
int d[310][310];

int main(){
	cin>>n;
	REP(i,n){
		REP(j,n){
			cin>>a[i][j];
		}
	}
	ll ans=0;
	for(int i=0;i<n-1;i++){
		for(int j=i+1;j<n;j++){
			int flag=0;
			int edge=0;
			for(int k=0;k<n;k++){
				if(i!=k&&j!=k){
					if(a[i][j]>a[i][k]+a[k][j]){
						flag =1;
						break;
					}
					if(a[i][j]==a[i][k]+a[k][j]){
						edge=1;
					}
				}
			}
			if(flag==1){
				cout<<-1<<endl;
				return 0;
			}
			if(edge==0){
				ans+=(ll)a[i][j];
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

class Main{
    static int area(int a, int b){
	return a * b;
    }
    static int surr(int a, int b){
	return (2 *(a + b));
    }

    public static void main(String[] args){
	Scanner stdIn = new Scanner(System.in);
	int x = stdIn.nextInt();
	int y = stdIn.nextInt();
	System.out.println(area(x , y) + " " + surr(x , y));
    }
}

Measured memory_bytes: 17160
MOD = 10**9 + 7
S = input()
dp = [[0] * 13 for i in range(len(S))]

rs = [[0] * 10 for i in range(len(S))]
for i in reversed(range(len(S))):
    if i == len(S) - 1:
        for j in range(10):
            rs[i][j] = j % 13
        continue

    for j in range(10):
        rs[i][j] = rs[i+1][j] * 10 % 13


for i in reversed(range(len(S))):
    if i == len(S) - 1:
        if S[i] == '?':
            for v in range(10):
                r = v % 13
                dp[i][r] += 1
        else:
            v = int(S[i])
            r = v % 13
            dp[i][r] += 1
        continue

    if S[i] == '?':
        for v in range(10):
            for r in range(13):
                s = (rs[i][v] + r) % 13
                dp[i][s] += dp[i+1][r]
                dp[i][s] %= MOD
    else:
        v = int(S[i])
        for r in range(13):
            s = (rs[i][v] + r) % 13
            dp[i][s] += dp[i+1][r]
            dp[i][s] %= MOD

print(dp[0][5])


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

typedef double du ;
typedef string st ;
typedef long long ll ;
typedef long double ld ;
typedef long long int lli ;

#define vi vector <lli>
#define loop(num) for (lli i = 0 ; i < num ; i ++ )
#define loopcin(num , ar ) for (lli i = 0 ; i < num ; i ++ ) {cin >> ar [i] ;}
#define loopcout(num , ar) for (lli i = 0 ; i < num ; i ++ ) {cout << ar [i] << ' '; }

#define forr(num1 , num2) for (lli i = num1 ; i < num2 ; i ++ )
#define forrcin(num1 , num2 , ar ) for (lli i = num1 ; i < num2 ; i ++ ) {cin >> ar [i] ;}
#define forrcout(num1 , num2 , ar) for (lli i = num1 ; i < num2 ; i ++ ) {cout << ar [i] << ' '; }

#define D2forrcin(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cin >> A[i][j] ;}}
#define D2forrcout(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cout << A[i][j] << ' ' ;}cout << endl ;}

#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int main ()
{
    fastio
    lli num ;
    cin >> num ;
    cout << (num < 1000 ? "ABC" : "ABD") ;

    return 0 ;
}

/*___________________________________________________________________functions___________________________________________________________________________*/



Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define REP(i, n) for(int i = 0;i < n;i++)
#define ALL(a) a, a+sizeof(a)/sizeof(a[0])
#define all(a) a.begin(),a.end()
#define MOD 1000000007
using namespace std;
ll gcd(ll n, ll m) {
	if (m == 0) return n;
	return gcd(m, n % m);
}
ll lcm(ll n, ll m) { return m / gcd(n, m) * n; }

int main(void) {
	int a, b;
	cin >> a >> b;
	if (a < b) cout << "a < b" << endl;
	else if (a == b) cout << "a == b" << endl;
	else cout << "a > b" << endl;
	return 0;
}


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

int main() {
  double N, T, A;
  cin >> N >> T >> A;
  int H[int(N)];
  double ave[int(N)];
  for (int i = 0; i < N; i++) {
    cin >> H[i];
    ave[i] = T - double(H[i]) * 0.006;
  }
  double temp = 100000;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (fabs(ave[i] - A) < temp) {
      temp = fabs(ave[i] - A);
      ans = i;
    }
  }
  cout << ans + 1 << endl;
}


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

int main(){
    int N;
    cin >> N;
    vector<string> S(N);
    vector<ll> C(N);
    for (int i = 0; i < N; i++) {
        cin >> S[i] >> C[i];
    }
    
    vector<vector<pair<ll, ll>>> edge(N*40+1);
    for (int i = 0; i < N; i++) {
        int K = S[i].size();
        for (int j = 0; j < K; j++) {
            string ss = S[i].substr(K-j-1, j+1);
            ll K1 = j+1;
            for (int k = 0; k < N; k++) {
                ll K2 = S[k].size();
                string R = S[k];
                reverse(R.begin(), R.end());
                if (K1 < K2) {
                    if (R.substr(0, K1) == ss) {
                        edge[i*20+j].push_back({(k+N)*20+K2-K1-1, C[k]});
                    }
                }
                if (K1 > K2) {
                    if (ss.substr(0, K2) == R) {
                        edge[i*20+j].push_back({i*20+j-K2, C[k]});
                    }
                }
                string T = ss+S[k], U = T;
                reverse(U.begin(), U.end());
                if (T == U) {
                    edge[i*20+j].push_back({N*40, C[k]});
                }
            }
        }
    }
    
    for (int i = 0; i < N; i++) {
        int K = S[i].size();
        for (int j = 0; j < K; j++) {
            string ss = S[i].substr(0, j+1);
            ll K2 = j+1;
            for (int k = 0; k < N; k++) {
                ll K1 = S[k].size();
                string R = S[k];
                reverse(R.begin(), R.end());
                if (K1 < K2) {
                    if (R == ss.substr(K2-K1, K1)) {
                        edge[(i+N)*20+j].push_back({(i+N)*20+j-K1, C[k]});
                    }
                }
                if (K1 > K2) {
                    if (R.substr(K1-K2, K2) == ss) {
                        edge[(i+N)*20+j].push_back({k*20+K1-K2-1, C[k]});
                    }
                }
                string T = S[k]+ss, U = T;
                reverse(U.begin(), U.end());
                if (T == U) {
                    edge[(i+N)*20+j].push_back({N*40, C[k]});
                }
            }
        }
    }
    
    ll inf = 1e18;
    vector<ll> dist(N*40+1, inf);
    priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> pq;
    for (int i = 0; i < N; i++) {
        int K = S[i].size();
        dist[i*20+K-1] = C[i];
        pq.push({C[i], i*20+K-1});
        string T = S[i];
        reverse(T.begin(), T.end());
        if (S[i] == T) dist[N*40] = min(dist[N*40], C[i]);
    }
    while (!pq.empty()) {
        int now = pq.top().second;
        ll d = pq.top().first;
        pq.pop();
        if (d > dist[now]) continue;
        for (auto p : edge[now]) {
            int nxt = p.first;
            ll nd = d+p.second;
            if (dist[nxt] <= nd) continue;
            dist[nxt] = nd;
            pq.push({nd, nxt});
        }
    }
    
    if (dist[N*40] == inf) cout << -1 << endl;
    else cout << dist[N*40] << endl;
	return 0;
}


Measured memory_bytes: 3744
#include <stdio.h>
#include <stdlib.h>

int a[1000], top;

void push(int n) {
  a[++top] = n;
}


int pop() {
  top--;
  return a[top + 1];
}


int main() {
  char ch[100];
  int n1, n2;
  top = 0;

  while (scanf("%s", ch) != EOF) {
    if (ch[0] == '+') {
      n1 = pop();
      n2 = pop();
      push(n1 + n2);
    } else if (ch[0] == '-') {
      n1 = pop();
      n2 = pop();
      push(n2 - n1);
    } else if (ch[0] == '*') {
      n1 = pop();
      n2 = pop();
      push(n1 * n2);
    } else {
      push(atoi(ch));
    }
  }

  printf("%d\n", pop());

  return 0;
}



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

typedef long long ll;

const int MOD = 1000000007;

int main() {
  int n, m;
  ll x=0, y=0, tmp;
  cin >> n >> m;
  for (int i=1; i<=n; i++) {
    cin >> tmp;
    x += tmp * (2*i - n - 1) % MOD;
    x %= MOD;
  }
  for (int i=1; i<=m; i++) {
    cin >> tmp;
    y += tmp * (2*i - m - 1) % MOD;
    y %= MOD;
  }

  cout << x * y % MOD << endl;
  return 0;
}


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

int main() {
  int n, counter = 0; cin >> n;
  int a[110];
  for(int i = 0; i < n; i++) cin >> a[i];

  //--- Bubble Sort ---//
  bool flag = true;
  for(int i = 0; flag; i++) {
    flag = false;
    for(int j = n-1; j > i; j--) {
      if(a[j] < a[j-1]) {
        swap(a[j], a[j-1]);
        counter++;
        flag = true;
      }
    }
  }

  for(int i = 0; i < n; i++) cout << a[i] << (i == n-1 ? "\n" : " ");
  cout << counter << endl;
}



Measured memory_bytes: 3104
#include<stdio.h>
int main(void) {
	int N,a;
	double s,t;
	scanf("%d", &N);
	s = 1.0 / 2;
	a = N / 2;
	t = (a + 1.0) / N;
	if (N % 2 == 0)
		printf("%f",s);
	if ( N % 2 == 1) {
		printf("%f", t);
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define int long long
#define mp make_pair
#define eb emplace_back
#define pb push_back
#define ss second
#define ff first
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,A,B) for(int i=A;i<=B;i++)
#define mod 998244353
#define MOD (1000*1000*1000+7)
#define v1d vector<int>
#define v2d vector<vector<int>>
#define vip vector<pair<int,int> >
#define v1s vector<string>
#define pa pair<int,int>
#define print(v) for(auto i:v)cout<<i<<" ";cout<<"\n";
#define endl '\n'
#define input(b,n) for(int i=1;i<=n;i++)cin>>b[i];
#define Sort(v) sort(v.begin(),v.end())
#define RSort(v)   sort(v.rbegin(),v.rend())
#define all(v) v.begin(),v.end()
int gcd(int a,int b){return b?gcd(b,a%b):a;}
//string s= bitset<64>(a).to_string();

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define fbo find_by_order // iterator to the kth element
#define ook order_of_key  //number of items that are strictly smaller than our item k
#define T pair<int, int>
// #define ordered_set tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>

void solve(){
    int n;cin>>n;
    v1d f(n+1,0);
    v1d a(n+1);
    for(int i=1;i<=n;i++){
        cin>>a[i];
        f[a[i]]++;
    }
    v1d arr(n+1,0);
    int sum = 0;
    for(int i=1;i<=n;i++){
        arr[i] = f[i]*(f[i]-1)/2;
        sum += arr[i];
    }
    
    for(int i=1;i<=n;i++){
        int ans = sum-arr[a[i]] + (f[a[i]]-1)*(f[a[i]]-2)/2;
        cout<<ans<<"\n";
    }
    
}

int32_t  main(){ 
    IOS;
    cout.precision(15);
    int t=1;//cin>>t;
    while(t--){
        solve();
    }








}

Measured memory_bytes: 7296
import java.io.*;
import java.util.Scanner;


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int a = sc.nextInt();
		int p = sc.nextInt();
		
		pr.println((3 * a + p) / 2);
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);
			
		solve();
			
		pr.close();
		sc.close();
	}

	static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, M;
  cin >> N >> M;
  
  vector<int> vec(M);
  int sum = 0;
  for (int i = 0; i < M; i++) {
    cin >> vec.at(i);
    sum += vec.at(i);
  }
  
  if (N >= sum) {
    cout << N - sum << endl;
  }
  
  else {
    cout << -1 << endl;
  }
}


Measured memory_bytes: 3644
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map.Entry;

import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {
	
	public static void main(String[] args) throws IOException {	
		try(final Scanner sc = new Scanner(System.in)){
			final int N = sc.nextInt();
			
			long[] heights = new long[N];
			for(int i = 0; i < N; i++) {
				heights[i] = sc.nextLong();
			}
			
			int[] counts = new int[N];
			for(int i = N - 2 ; i >= 0; i--) {
				if(heights[i] >= heights[i + 1]) {
					counts[i] = counts[i + 1] + 1;
				}else {
					counts[i] = 0;
				}
			}
			
			System.out.println(Arrays.stream(counts).max().getAsInt());
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

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

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

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

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 46256
a, b, k = map(int, input().split())
ans = []

for i in range(min([a,b])):
	i+=1
	if ((int(a%i) == int(0)) and (int(b%i) == int(0))):
		ans.append(i)
ans.sort(reverse=True)
print(ans[k-1])

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

#define LL long long

#define FOR(INDEX, START, END) for (LL INDEX = (START); INDEX < (END); ++INDEX)
#define REP(INDEX, COUNT) for (LL INDEX = 0; INDEX < (COUNT); ++INDEX)

int main()
{
	LL N, A, B;
	cin >> N >> A >> B;

	cout << min(A, B) << " " << max((A + B) - N, 0LL) << endl;

	return 0;
}


Measured memory_bytes: 256
n = list(map(str,input().split()))
a = []
for i in range(len(n)):
  b = n[i]
  if b =="+":
    k = int(a.pop())
    l = int(a.pop())
    a.append(k+l)
  elif b =='-':
    k = int(a.pop())
    l = int(a.pop())
    a.append(l-k)
  elif b=='*':
    k = int(a.pop())
    l = int(a.pop())
    a.append(k*l)
  else :
    a.append(b)
print(*a)


Measured memory_bytes: 5600
#include<stdio.h>

#define MOD_N 1000000007

int main(void){

    int N,i,j,tmp,pow[1001] = {0};
    long long int ans = 1;

    scanf("%d",&N);

    for(i = 2;i <= N;i++){
        tmp = i;
        for(j = 2;j <= i;j++){
            while(tmp % j == 0){
                tmp /= j;
                pow[j]++;
            }
        }
    }

    for(i = 0;i <= N;i++){
        ans *= (pow[i]+1);
        ans %= MOD_N;
    }

    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int mod=1e9+7;
int n,m;
char grid[1009][1009];
int vis[1009][1009];
int num[1009][1009];
int dp(int x,int y){
    if(vis[x][y])return num[x][y];
    if(x>n||y>m)return 0;
    if(grid[x][y]=='#')return 0;
    if(x==n&&y==m)return 1;
    vis[x][y]=1;
    num[x][y]+=dp(x,y+1);num[x][y]%=mod;
    num[x][y]+=dp(x+1,y);num[x][y]%=mod;
    return num[x][y]%mod;
}
int main()
{
//    ios::sync_with_stdio(false);
    cin>>n>>m;
    for(int i=1;i<=n;i++)
            scanf("%s",grid[i]+1);
    cout<<dp(1,1)%mod<<endl;
    return 0;
}


Measured memory_bytes: 9216
a,b,c=map(int,input().split())
k=int(input())
if c>b and b>a:
    print("Yes")
else:
    while(b<=a and k):
        b=b*2
        k-=1

    while(c<=b and k):
        c=c*2
        k-=1
    if c>b and b>a:
        print("Yes")
    else:
        print("No")
        


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

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

    if (a > b) {
        std::cout << "a > b" << std::endl;
    } else if (a < b) {
        std::cout << "a < b" << std::endl;
    } else {
        std::cout << "a == b" << std::endl;
    }

    return 0;
}


Measured memory_bytes: 3072
import sys
from statistics import *
from collections import *
from operator import itemgetter

stdin = sys.stdin

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

x = ni()
a = ni()
b = ni()
x -= a
print(x - (x // b) * b)

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

int main(){
	string s,t;
	cin>>s>>t;
	bool ac = true;
	for(int i=0; i<s.size();i++){
		if(s[i]!=t[i])ac = false;
	}
	if(ac)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}


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

#define rep(a,b) for(ll ii=a;ii<b;ii++)
#define ll long long int
#define test() int tt; cin>>tt; while(tt--) 
#define fst_io ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl '\n'
#define lg 1000000000

int main()
{
  int d, t, s;
  cin>>d>>t>>s;

  if(d <= t*s) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 3624
#!/usr/bin/env python3
import sys


def solve(N: int):
    print(int((180 - 360 / N) * N))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	//var v string
	var in []string
	for {
		v := nextString(sc)
		if v == "0" {
			break
		}
		in = append(in, v)
	}

	for idx, v := range in {
		fmt.Printf("Case %d: %v\n", idx+1, v)
	}
}

func nextString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}



Measured memory_bytes: 2208
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define mod1 998244353 
using namespace std;
 ll dp[101][100001];
int main()
{
    int t=1;
    while(t--)
    {
        ll n,w;
        cin>>n>>w;
        ll i,j;
        ll W[n];
        ll V[n];
        for(i=0;i<n;i++)
        {
            cin>>W[i];
            cin>>V[i];
        }
       
        for(i=0;i<101;i++)
        {
            for(j=0;j<100001;j++)
            dp[i][j]=LLONG_MAX-1000000000;
        }
        for(i=0;i<=n;i++)
        dp[i][0]=0ll;
        for(i=1;i<=n;i++)
        {
            for(j=1;j<=100000;j++)
            {
                if(j>=V[i-1])
                {
                    dp[i][j]=min(dp[i][j],W[i-1]+dp[i-1][j-V[i-1]]);
                }
                dp[i][j]=min(dp[i][j],dp[i-1][j]);
            }
        }
        ll ans;
        for(i=100000;i>=0;i--)
        {
            if(dp[n][i]<=w)
            {ans=i; break;}
        }
        cout<<ans<<endl;

    }
    return 0;
} 



Measured memory_bytes: 82512
N = int(input())
para = [[i for i in map(int,input().split())] for j in range(N)]

for i in range(N):
    if para[i][2] >= 1 :
        test = i 
        break
for c_x in range(0,101):
    for c_y in range(0,101):
        H = para[test][2] + abs(para[test][0]-c_x) + abs(para[test][1]-c_y)
        flag = True
        for i in range(N):
            if para[i][2] == max(H - abs(para[i][0]-c_x) - abs(para[i][1]-c_y),0) :
                    continue

            flag = False 
        if flag and H >=1:        
            print("{} {} {}".format(c_x,c_y,H))
            exit()


Measured memory_bytes: 3064
use proconio::{input, fastout};
use proconio::marker::Bytes;

macro_rules! echo {
  ($val:expr) => {
    println!("{}", $val);
  }
}

#[fastout]
fn main() {
  input! {
    a: Bytes
  };
  if a[0] >= 97 {
    echo!("a");
  } else {
    echo!("A");
  }
}


Measured memory_bytes: 2200
# coding: utf-8
# Your code here!

n,k=map(int,input().split())
v=list(map(int,input().split()))
ans=0

for a in range(n+1):
    for b in range(n+1):
        if a+b>n:
            break
        if a+b>k:
            break
        if a+b==n:
            val=sum(v)
            ans=max(ans,val)
            # print(a,b,val)
            continue
        tmp=v[:a]+v[::-1][:b]
        val=sum(tmp)
        c=k-a-b
        tmp.sort()
        for i in range(min(c,a+b)):
            if tmp[i]<0:
                val-=tmp[i]
            else:
                break
        ans=max(ans,val)
        # print(a,b,val)
print(ans)


Measured memory_bytes: 73556
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

vector< vector< pair<int,long long> > > P;
vector<long long> D;

int dfs( int c, long long x ) {
    
    if ( D[c] != LLONG_MAX ) {
        return ( ( D[c] == x ) ? 1 : 0 );
    }
    
    D[c] = x;
    
    int ret = 1;
    for ( int i = 0; i < P[c].size(); i++ ) {
        ret = min( ret, dfs( P[c][i].first, x + P[c][i].second ) );
    }
    return ret;
}


int main() {
    
    int N,M;
    cin >> N >> M;
    
    P.resize(N);
    D.resize(N,LLONG_MAX);
    
    for ( int i = 0; i < M; i++ ) {
        int l,r;
        long long d;
        cin >> l >> r >> d;
        l--; r--;
        P[l].push_back( make_pair(r,d) );
        P[r].push_back( make_pair(l,-d) );
    }
    
    bool ans = true;
    for ( int i = 0; i < N; i++ ) {
        if ( D[i] == LLONG_MAX && dfs( i, 0 ) == 0 ) { ans = false; break; }
    }
    
    cout << ( ans ? "Yes" : "No" ) << endl;
    
    return 0;
}

Measured memory_bytes: 16512
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }
 
using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;
 
//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};
 
const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod


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

signed main(){
    int N; string S;
    cin>>N>>S;
    vector<int> ans(N);
    int A=0;
    REP(i,N){
        if(S[i]=='I'){
            A ++ ;
            ans[i] = A;
        }
        else{
            A --;
            ans[i] = A;
        }
    }
    Sort(ans); Reverse(ans);
  int AA =0;
    cout<<max(AA,ans[0])<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define f first
#define s second
using namespace std;

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n,i; cin >> n >> i;
    cout << n-i+1 << endl;
    return 0;
}


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

int main() {
  string S;
  cin>>S;
  int ans=999;
  for(int i=0;i<S.size()-2;i++){
    int tmp=stoi(S.substr(i,3));
    ans=min(ans,abs(753-tmp));
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
import heapq

n,m = map(int,input().split())
targets = input().split()

targets = [int(value) for value in targets]
rev = [num * -1 for num in targets]
heapq.heapify(rev)
for i in range(m):
    tmp = -1 * heapq.heappop(rev) // 2
    heapq.heappush(rev,-1 * tmp)

targets = [num * -1 for num in rev]
print(sum(targets))


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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpl;
typedef vector<vll> vvll;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define no cout<<"No"<<endl
#define NO cout<<"NO"<<endl
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  ll n;
  cin>>n;
  vll a(n);
  REP(i,n)cin>>a[i];

  if(a[n-1]!=2){
    cout<<-1<<endl;
    return 0;
  }
  ll l=2;
  ll r=3;
  for(ll i=n-2; i>=0; i--){
    ll lx=l/a[i];
    ll rx=r/a[i];
    if(rx-lx==0 && r%a[i]!=0 && l%a[i]!=0){
      cout<<-1<<endl;
      return 0;
    }

    if(l%a[i]==0)
      l=a[i]*lx;
    else
      l=a[i]*(lx+1);
    r=a[i]*(rx+1)-1;
  }

  cout<<l<<" "<<r<<endl;
}



Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <stack>
#include <set>
#include <algorithm>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; ++i) cin >> v[i];
    sort(v.begin(), v.end());

    cout << v[n-1] - v[0] << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;

int main() {
	double  r;
	cin >> r;
	cout << fixed << setprecision(10) << r*r*M_PI << " " << fixed<<setprecision(10) << r * 2 * M_PI << endl;
}


Measured memory_bytes: 3280