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

struct UnionFind {
    vector<int> par;
    vector<int> rank;

    UnionFind(int N) : par(N), rank(N) {
        for (int i = 0; i < N; i++) {
            par[i] = i;
            rank[i] = 0;
        }
    }

    int root(int x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        if (rank[rx] < rank[ry]) swap(rx, ry);
        par[ry] = rx;
        if (rank[rx] == rank[ry]) rank[rx]++;
    }

    bool same(int x, int y) {
        return root(x) == root(y);
    }
};

int main() {
    int N, M; cin >> N >> M;
    UnionFind uf(N);
    vector<int> p(N);
    for (int i = 0; i < N; i++) {
        int a; cin >> a; a--;
        p[i] = a;
    }
    for (int i = 0; i < M; i++) {
        int x, y; cin >> x >> y; x--; y--;
        uf.unite(x, y);
    }
    int ans = 0;
    for (int i = 0; i < N; i++) {
        if (uf.same(i, p[i])) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1408
#include<iostream>

int main(void){
    unsigned long n;
    int in[100];
    std::cin >> n;
    int i;
    {
        int temp;
        for(i = 0;i < n;++i){
            std::cin >> temp;
            in[i] = temp;
        };
    }
    int j;
    int k;
    int a = 0;
    for(i = 0;i < n;++i){
        for(j = i + 1;j < n;++j){
            if(in[i] != in[j]){
                for(k = j + 1;k < n;++k){
                    if((in[i] != in[k]) && (in[j] != in[k])){
                        if((in[i] > in[j]) && (in[i] > in[k])){
                            if(in[i] < (in[j] + in[k])){
                                ++a;
                            };
                        }
                        else if((in[j] > in[i]) && (in[j] > in[k])){
                            if(in[j] < (in[i] + in[k])){
                                ++a;
                            };
                        }
                        else{
                            if(in[k] < (in[i] + in[j])){
                                ++a;
                            };
                        };
                    };
                };
            };
        };
    };
    std::cout << a << std::endl;
    return 0;
};


Measured memory_bytes: 3632
//Robs Code
/***********HEADER***************/
#include <iostream>
#include <bitset>
#include <deque>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <algorithm>
#include <list>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <set>
#include <queue>
#include <map>
/***********MACROS***************/
#define int long long int
#define fri(l,k) for (i=l;i<=k;i++)
#define frj(l,k) for (j=l;j>=k;j--)
#define fij(a,b,l,k) for(i=a;i<=b;i++) for(j=l;j<=k;j++)
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define endl "\n"
#define pb push_back
#define _1 first
#define _2 second
#define pii pair<int,int>
using namespace std;
int n,m,i,j,l,k,x,y,a,b,cnt[3],sum[3];
/***********MAIN**************/
signed main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	cin>>n;
	string s1,s2;
	cin>>s1>>s2;
	for(int i=0;i<n;i++){
		cout<<s1[i]<<s2[i];
	}
    return 0;
}
//.........

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
vector<int> dy = {1, 0, -1, 0};
vector<int> dx = {0, 1, 0, -1};
int main(){
  while (1){
    int w, h;
    cin >> w >> h;
    if (w == 0 && h == 0){
      break;
    }
    vector<vector<char>> a(h + 2, vector<char>(w + 2, '#'));
    for (int i = 1; i <= h; i++){
      for (int j = 1; j <= w; j++){
        cin >> a[i][j];
      }
    }
    vector<vector<bool>> B(h + 2, vector<bool>(w + 2, false));
    queue<pair<int, int>> Q1;
    for (int i = 1; i <= h; i++){
      for (int j = 1; j <= w; j++){
        if (a[i][j] == 'B'){
          Q1.push(make_pair(i, j));
        }
      }
    }
    while (!Q1.empty()){
      int y = Q1.front().first;
      int x = Q1.front().second;
      Q1.pop();
      for (int i = 0; i < 4; i++){
        int y2 = y + dy[i];
        int x2 = x + dx[i];
        if (a[y2][x2] == '.' && !B[y2][x2]){
          B[y2][x2] = true;
          Q1.push(make_pair(y2, x2));
        }
      }
    }
    vector<vector<bool>> W(h + 2, vector<bool>(w + 2, false));
    queue<pair<int, int>> Q2;
    for (int i = 1; i <= h; i++){
      for (int j = 1; j <= w; j++){
        if (a[i][j] == 'W'){
          Q2.push(make_pair(i, j));
        }
      }
    }
    while (!Q2.empty()){
      int y = Q2.front().first;
      int x = Q2.front().second;
      Q2.pop();
      for (int i = 0; i < 4; i++){
        int y2 = y + dy[i];
        int x2 = x + dx[i];
        if (a[y2][x2] == '.' && !W[y2][x2]){
          W[y2][x2] = true;
          Q2.push(make_pair(y2, x2));
        }
      }
    }
    int B_ans = 0;
    int W_ans = 0;
    for(int i = 1; i <= h; i++){
      for (int j = 1; j <= w; j++){
        if (B[i][j] && !W[i][j]){
          B_ans++;
        }
        if (W[i][j] && !B[i][j]){
          W_ans++;
        }
      }
    }
    cout << B_ans << ' ' << W_ans << endl;
  }
}


Measured memory_bytes: 3104
# -*- coding: utf-8 -*-
# 標準入力の取得
N = int(input())
A = list(map(int, input().split()))


def main() -> None:
    """Entry point
    """
    # 求解処理
    """
    1 <= i < j <= Nとすると、
    j - i = A_i + A_j ⇒ -A_j + j = A_i +i
    となる。
    したがって、各jについて、左辺の値を計算し、等式が成立するようなi(< j)の個数を求めればよい。
    """
    right = {}
    result = 0
    for j in range(N):
        l = -A[j] + j
        result += right.get(l, 0)
        r = A[j] + j
        right[r] = right.get(r, 0) + 1

    # 結果出力
    print(result)


if __name__ == "__main__":
    main()


Measured memory_bytes: 40460
#include<iostream>
#include<sstream>
#include<ios>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<string>
#include<numeric>
#include<set>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using vi = vector<int>;
using vl = vector<long>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<long>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
using vpii = vector<pii>;

int main(){
  long r;
  cin >> r;

  cout << r*r << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <bitset>
#include <map>
#include <set>
#include <tuple>
#include <string.h>
#include <math.h>
#include <random>
#include <functional>
#include <assert.h>
#include <math.h>
#include <sstream>
#include <iterator>

using namespace std;

using i64 = long long int;
using ii = pair<int, int>;
using ii64 = pair<i64, i64>;

int main()
{
    int n, k, q;

    scanf("%d %d %d", &n, &k, &q);

    vector<int> arr(n);

    for (int i = 0; i < n; i++)
        scanf("%d", &arr[i]);

    vector<int> sorted = arr;

    sort(sorted.begin(), sorted.end());

    int ans = sorted.back() - sorted[0];

    for (int i = 0; i < n - q; i++)
    {
        i64 lo = sorted[i];
        i64 hi = sorted.back();
        int l = -1;

        while (lo <= hi)
        {
            i64 mid = (lo + hi) / 2;

            int c = 0;
            int s = 0;
            int prev = 0;

            for (int j = 0; j < n; j++)
            {
                if (arr[j] < sorted[i])
                {
                    int ss = min(s, j - prev - k + 1);
                    c += max(ss, 0);

                    prev = j + 1;
                    s = 0;
                }
                else if (arr[j] <= mid)
                    s++;
            }

            int ss = min(s, n - prev - k + 1);
            c += max(ss, 0);

            if (c >= q)
            {
                l = mid;
                hi = mid - 1;
            }
            else
            {
                lo = mid + 1;
            }
        }

        if (l != -1)
            ans = min(ans, l - sorted[i]);
    }

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

    return 0;
}

Measured memory_bytes: 256
/*
{By GWj
*/
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
#define R(a) cin>>a
#define R2(a,b) cin>>a>>b
#define check_min(a,b) a=min(a,b)
#define check_max(a,b) a=max(a,b)
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
/*}
*/

int rest=0;
int have[1000000+20];
int main(){
	fastio;
	int n;
	R(n);
	rb(i,1,n)
		for(int j=i;j<=n;j+=i)
			have[j]++;
	rb(i,1,n-1)
	{
		rest+=have[i];
	}
	cout<<rest<<endl;
	return 0;
}


Measured memory_bytes: 7436
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<cstdio>
using namespace std;

typedef long long ll;

int main() {
  int N; cin >> N;
  int x[101],y[101],h[101];
  for ( int i = 0; i < N; i++ ) cin >> x[i] >> y[i] >> h[i];

  for ( int posY = 0; posY <= 100; posY++ ) {
    for ( int posX = 0; posX <= 100; posX++ ) {
      vector<int>data;
      for ( int i = 0; i < N; i++ ) {
	data.push_back(h[i] + abs(x[i]-posY) + abs(y[i]-posX));
      }

      for ( int d = 0; d < data.size(); d++ ) {
	bool f = true;
	for ( int i = 0; i < N; i++ ) {
	  int dist = abs(x[i]-posY)+abs(y[i]-posX);
	  if(max(data[d]-dist,0) != h[i]) f = false;
	}
	if(f) {
	  cout << posY << " " << posX << " " << data[d] << endl;
	  return 0;
	}
      }
    }
  }


  return 0;
}


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

int main() {
  int N,K, Output=1 ;
 cin >>N >>K;
   for (int i = 0; i<N ; i++) {
   if (Output < K){
     Output *= 2;}
   else {
     Output += K;}
   } 
   cout << Output <<endl;
}


Measured memory_bytes: 384
#include <iostream>
using namespace std;
typedef long long ll;
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
int main(){
  ll i,n,k;
  ll a[100010]={0};
  cin >> n >> k;
  rep(i,n) cin >> a[i];
  cout << (n-1+k-2)/(k-1) << endl;
  return 0;
}

Measured memory_bytes: 4412
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
  int N, X;
  cin >> N >> X;
  vector <int> D(N + 1);
  D[0] = 0;
  rep(i,N){
    int x;
    cin >> x;  //L[i]
    D[i + 1] = D[i] + x;
  }

  int ans = 0;
  rep(i,N + 1){
    if (D[i] <= X) ans ++;
  }
  cout << ans << endl;

}


Measured memory_bytes: 3632
#include <cstdio>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <string>
#include <algorithm>
#include <bitset>
using namespace std;

typedef long long ll;

//#define dbg(arg) (printf arg)
#define dbg(arg)

int main() {
    int n;
    cin >> n;
    string str;
    cin >> str;
//    cout << str;
    int state(0);
    ll v(1);
    for (int i = 0; i < n; ++i) {
      if (i + 1 == n || str[i] != str[i+1]) {
//        cout << "one\n";
        if (state == 0) {
          v *= 3;
        } else if (state == 1) {
          v *= 2;
        } else if (state == 2) {
          v *= 1;
        }
        state = 1;
      } else {
//        cout << "two\n";
        if (state == 0) {
          v *= 6;
        } else if (state == 1) {
          v *= 2;
        } else if (state == 2) {
          v *= 3;
        }
        state = 2;
        ++i;
      }
      v %= 1000000007LL;
    }
    cout << v << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        int count = 0;
        while (true) {
            if (a > 0) {
                a /= b;
                count++;
            } else {
                break;
            }
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  string A, B, C;
  cin >> A >> B >> C;
  int count = 0;
  for(int i=0; i<N; i++){
    if(A.at(i) != B.at(i) && B.at(i) != C.at(i) && A.at(i) != C.at(i)){
      count += 2;
    }
    else if(A.at(i) == B.at(i) && B.at(i) == C.at(i)){
      continue;
    }
    else{
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val r = sc.nextInt()
    println(problem104a(r))
}

fun problem104a(r: Int): String {
    return if (r < 1200) "ABC" else if (r < 2800) "ARC" else "AGC"
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define contains(v, t) (find(v.begin(), v.end(), t) != v.end())
#define MOD 1000000007
using ll = long long;
using ull = unsigned long long;

struct UnionFind {
  vector<int> par;
  vector<int> siz;

  UnionFind(int n) {
    par = vector<int>(n);
    siz = vector<int>(n, 1);
    rep(i, n) {
      par[i] = i;
    }
  }

  int root(int x) {
    if (par[x] == x) return x;
    return par[x] = root(par[x]);
  }

  bool same(int x, int y) {
    return root(x) == root(y);
  }

  void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) return;
    if (siz[x] < siz[y]) swap(x, y);
    siz[x] += siz[y];
    par[y] = x;
  }

int size(int x) {
    return siz[root(x)];
  }
};

int main() {
  int n,k,l;
  cin>>n>>k>>l;
  UnionFind road(n+1), rail(n+1);
  rep(i, k) {
    int a,b;
    cin>>a>>b;
    road.unite(a,b);
  }
  rep(i, l) {
    int a,b;
    cin>>a>>b;
    rail.unite(a,b);
  }
  // Aのroadかrailでの根とBのroadかrailでの根が一致していれば繋がっている
  map<pair<int, int>, int> v;
  for(int i = 1; i <= n; i++) {
    v[{road.root(i), rail.root(i)}]++;
  }
  for(int i = 1; i <= n; i++) {
    cout << v[{road.root(i), rail.root(i)}] << " ";
  }
}


Measured memory_bytes: 15104
#include <bits/stdc++.h>
#define ll long long
using namespace std;
void fast()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

int main() {
    fast();
    double a,b,c;
    cin>>a>>b>>c;
    if(a/c<=b)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}

Measured memory_bytes: 3704
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math

# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev

def main():
	N, W = map(int, input().split())
	wv = []
	for i in range(N):
		w, v = map(int, input().split())
		if w <= W:
			wv.append((w,v))
		
	DP = [[0 for _ in range(100001)] for _ in range(N)]
	
	for i, val in enumerate(wv):
		w, v = val
		if i == 0:
			DP[i][w] = v
			continue
			
		for j in range(W):
			DP[i][j] = max(DP[i-1][j], DP[i][j])
			
			if j+w <= W:
				DP[i][j+w] = max(DP[i-1][j] + v, DP[i][j+w])
			
	print(max(DP[N-1]))
	
if __name__ == "__main__":
	main()


Measured memory_bytes: 170760
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define ALL(vec) vec.begin(), vec.end()
#define rALL(vec) vec.rbegin(), vec.rend()
using namespace std;
using ll = long long;
// ------------------------------

int main() {
    int N, M;
    cin >> N >> M;
    if (M == 0) {
        cout << 1 << endl;
        return 0;
    }
    vector<set<int>> tmp(N, set<int>());
    rep(i, M) {
        int tmp1, tmp2;
        cin >> tmp1 >> tmp2;
        tmp[tmp1 - 1].insert(tmp2 - 1);
        tmp[tmp2 - 1].insert(tmp1 - 1);
    }
    vector<vector<int>> G(N, vector<int>());
    rep(i, N) {
        vector<int> tmp3(ALL(tmp[i]));
        G[i] = tmp3;
    }
    vector<int> visit(N, 0);
    int ans = 1;
    rep(i, N) {
        if (visit[i] == 1 || G[i].size() == 0) continue;
        queue<int> que;
        que.push(i);
        int cnt = 0;
        while (!que.empty()) {
            int v = que.front();
            que.pop();
            for (int nv : G[v]) {
                if (visit[nv] == 1) continue;
                visit[nv] = 1;
                que.push(nv);
                cnt += 1;
            }
        }
        ans = max(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 43280
x,n = map(int, input().split())
if n==0:
  print(x)
else:
  p_list = list(map(int, input().split()))

  i=0
  while True:
    koho1=x-i
    koho2=x+i
    if not (koho1 in p_list):
      ans=koho1
      break
    if not (koho2 in p_list):
      ans=koho2
      break
    i=i+1
  print(ans)


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

using namespace std;

#define ff first
#define ss second
#define int long long
#define pii pair<int,int>
#define mp make_pair

signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int i,j,a,b;
	string s1,s2;
	cin>>s1>>s2;
	a=s1.size();b=s2.size();
	int memo[a+1][b+1];
	for(i=0;i<=a;i++){
		memo[i][0]=0;
	}
	for(j=0;j<=b;j++){
		memo[0][j]=0;
	}
	for(i=1;i<=a;i++){
		for(j=1;j<=b;j++){
			if(s1[i-1]==s2[j-1]){
				memo[i][j]=memo[i-1][j-1]+1;
			}
			else{
				memo[i][j]=max(memo[i][j-1],memo[i-1][j]);
			}
		}
	}
	string lcs="";
	i=a;j=b;
	while(i!=0&&j!=0){
		if(memo[i][j]>memo[i-1][j-1]&&memo[i-1][j-1]==memo[i-1][j]&&memo[i-1][j-1]==memo[i][j-1]){
			lcs+=s1[i-1];
			i--;j--;
		}
		else if(memo[i-1][j]>memo[i][j-1])i--;
		else j--;
	}
	for(i=lcs.size()-1;i>=0;i--){
		cout<<lcs[i];
	}	
	cout<<endl;
}

Measured memory_bytes: 70656
using System;
using System.Collections.Generic;
using System.Linq;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = ReadInt();
            var S = Read();
            var Q = ReadInt();
            var k = ReadArrayInt();
            var D = new long[N + 1];
            var M = new long[N + 1];
            var DM = new long[N + 1];
            for (int i = 0; i < N; i++)
            {
                if (S[i] == 'D')
                {
                    D[i + 1] = D[i] + 1;
                    M[i + 1] = M[i];
                    DM[i + 1] = DM[i];
                }
                else if (S[i] == 'M')
                {
                    D[i + 1] = D[i];
                    M[i + 1] = M[i] + 1;
                    DM[i + 1] = DM[i] + D[i];
                }
                else
                {
                    D[i + 1] = D[i];
                    M[i + 1] = M[i];
                    DM[i + 1] = DM[i];
                }
            }
            foreach (var kk in k)
            {
                var ans = 0L;
                for (int i = 0; i < N; i++)
                {
                    if (S[i] == 'C')
                    {
                        ans += DM[i];
                        if (i >= kk - 1)
                        {
                            ans -= D[i - kk + 1] * (M[i] - M[i - kk + 1]);
                            ans -= DM[i - kk + 1];
                        }
                    }
                }
                Console.WriteLine(ans);
            }

            Console.WriteLine();
            Console.ReadLine();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

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

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

    string w;
    cin >> w;
    transform(w.begin(), w.end(), w.begin(), ::tolower);

    int count = 0;
    string in;
    while (true) {
        cin >> in;
        if (in == "END_OF_TEXT")
            break;
        transform(in.begin(), in.end(), in.begin(), ::tolower);
        if (w == in)
            count++;
    }
    cout << count << endl;
}


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

int main() {
    int n;
    string s;
    cin >> n >> s;
    int ans = n - 1, num = 0;
    for (int i = 1; i < n; i++) {
        if (s.at(i) == 'E') num++;
    }
    //cout << num << endl;
    ans = min(ans, num);
    for (int i = 0; i < n - 1; i++) {
        if (s.at(i) == 'W') num++;
        if (s.at(i + 1) == 'E') num--;
        ans = min(ans, num);
        //cout << num << endl;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3796
#include <iostream>

using namespace std;

int main(){
    int64_t a,b,c;
    cin >> a >> b >> c;
    
    int64_t d = c-a-b;
    if(d>0 && d*d > 4*a*b) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()
 
using namespace std;
using ll = long long;
 
struct edge { int to, cost; };
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = 1e9;
//const ll INF = 1e18;
const double EPS = 1e-10;
const int MOD = 1e9+7;
const double PI = acos(-1.0);


int main() {
	int n;
	cin >> n;
	int ma = 0, ans = 0;
	rep(i,n){
		int a;
		cin >> a;
		if(a >= ma){
			ans++;
			ma = a;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int cnt=0,ma=0;
    for(char c:s)
    {
        if(c=='R')
        cnt++;
        else
        {
            ma=max(ma,cnt);
            cnt=0;
        }
    }
    ma=max(ma,cnt);
    cout<<ma;
}

Measured memory_bytes: 3592
n=int(input())
w=[]
for i in range(n):
    w.append(input())

s=set(w)
if len(s)!=n:
    print("No")
    exit()
for i in range(1,n):
    if w[i-1][-1]!=w[i][0]:
        print("No")
        exit()
print("Yes")


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

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

using ll = long long;
using P = pair<ll,ll>;
using graph = vector<vector<int>>;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll INF = 1LL<<60;
const ll mod = 1000000007LL;

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

ll dp[55][5010];

int main(){
    ll N,A;
    cin>>N>>A;
    vector<int> v(N);
    rep(i,N) cin>>v[i];
    rep(i,N) v[i] = A-v[i];
    dp[0][2505] = 1;
    rep(i,N){
        rep(j,5010){
            dp[i+1][j]+=dp[i][j];
            if(j+v[i]>=0&&j+v[i]<5010) dp[i+1][j+v[i]]+=dp[i][j];
        }
    }
    cout<<dp[N][2505]-1<<endl;
}

Measured memory_bytes: 5544
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace lec12B
{
    public class Ver
    {
        public int id;
        public int state = 0;
        public int d;
        public int p;
        public int[] arr;

        public Ver(int n)
        {
            arr = new int[n];
            for(int i = 0; i < n; i++)
            {
                arr[i] = Program.Inf;
            }
        }

    }
    class Program
    {
        public const int Inf = 1000000000;

        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            Ver[] array = new Ver[n];
            for (int i = 0; i < n; i++)
            {
                string[] inp = (Console.ReadLine()).Split(' ');
                int x = int.Parse(inp[0]);
                int deg = int.Parse(inp[1]);
                array[x] = new Ver(n);

                for (int j = 3; j <= ((deg * 2) + 2); j +=2)
                {
                    int v = int.Parse(inp[j-1]);
                    int c = int.Parse(inp[j]);
                    array[x].arr[v] = c;
                }
                array[x].d = Inf;
                array[x].id = x;
            }

            Dijkstra(array ,n );

            for (int i = 0; i < n; i++)
            {

                Console.WriteLine(i+" "+array[i].d);
            }


            Console.ReadLine();

        }

        static void Dijkstra(Ver[] v , int n)
        {
            int minv;
            v[0].d = 0;
            v[0].state = 1;

            while (true)
            {
                minv = Inf;
                int u = -1;
                for (int i = 0; i < n; i++)
                {
                    if (v[i].state != 2 && v[i].d < minv)
                    {
                        minv = v[i].d;
                        u = i;
                    }
                }

                if (u == -1)
                {
                    break;
                }

                v[u].state = 2;

                for (int i = 0; i < n; i++)
                {
                    if (v[i].state != 2 && v[u].arr[i] < Inf)
                    {
                        if (v[u].arr[i]  + v[u].d< v[i].d)
                        {
                            v[i].d = v[u].arr[i] + v[u].d;
                            v[i].state = 1;
                        }
                    }
                }
            }
        }
    }
}




Measured memory_bytes: 17940
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define FOR(i, x, y) for (decay<decltype(y)>::type i = (x), _##i = (y); i < _##i; ++i)
#define FORD(i, x, y) for (decay<decltype(x)>::type i = (x), _##i = (y); i > _##i; --i)
#ifdef zerol
#define dbg(x...) do { cout << "\033[32;1m" << #x << " -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }
#else
#define dbg(...)
#endif
// -----------------------------------------------------------------------------

int main() {
    int n, even = 0, odd = 0, p;
    cin >> n >> p;
    while (n--) {
        int a; cin >> a;
        if (a % 2 == 0) even++;
        else odd++;
    }
    if (odd == 0 && p) {
        puts("0");
    } else {
        cout << (1LL << (even + max(odd - 1, 0))) << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repm(i, m, n) for (int i = m; i < (n); i++)
#define eps (1e-7)
#define inf (1e9)
#define pi (acos(-1))
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll a, b, c, i, j, k, l, m, n, ans, tmp, hoge;

bool compare(pair<int, int> p1, pair<int, int> p2)
{
    return p1.second < p2.second;
}

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

    cin >> n;
    vector<pii> p(n);
    rep(i, n)
    {
        cin >> a;
        p[i] = make_pair(i + 1, a);
    }
    sort(p.begin(), p.end(), compare);

    rep(i, n) cout << p[i].first << " ";

    return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
 
using ll = int64_t;
constexpr ll mod = ll(1e9 + 7);
 
void GetPos(ll N, ll k, vector<ll>& A) {
//  cout << "h2" << endl;
  int l = 0, r = N-1;
  ll ans = 1;
  while (k > 1) {
    if (A[l]*A[l+1] >= A[r]*A[r-1]) {
      ans *= (A[l]*A[l+1]) % mod;
      l += 2;
      k -= 2;
    } else {
      ans *= A[r--];
      --k;
    }
    ans %= mod;
  }
//  cout << "k: " << k << "; [" << l << ", " << r << "]" << endl;

  if (k) {
    if (A[r] <= 0 && r+1 < N) {
      ans /= A[++r];
      ans *= A[l++];
      ans *= A[l++];
    } else {
      ans *= A[r--];
    }
  }
  ans %= mod;
  ans += mod;
  ans %= mod;
  cout << ans << endl;
}

void GetNeg(ll N, ll k, vector<ll>& A) {
//  cout << "h1" << endl;
  int l = 0, r = 0;
  while (r < N && A[r] < 0) ++r;
  l = r-1;
  ll ans = 1;
  while (k) {
    if (r == N || (l >= 0 && llabs(A[l]) < A[r])) {
      ans *= A[l--];
    } else {
      ans *= A[r++];
    }
    ans %= mod;
    --k;
  }
  ans %= mod;
  ans += mod;
  ans %= mod;
  cout << ans << endl;
}
int main () {
  ios::sync_with_stdio(0); cin.tie(0);
 
  ll N, K;
  cin >> N >> K;
  vector<ll> A(N);
  for (auto& x : A) cin >> x;
  sort(A.begin(), A.end());
  int n_neg = 0, n_pos = 0;
  for (int x : A) {
    if (x < 0) {
      ++n_neg;
    } else {
      ++n_pos;
    }
  }
  if (n_neg - (n_neg&1) + n_pos >= K) {
    if (!(K&1) || n_pos) {
      GetPos(N, K, A);
      return 0;
    }
  }

  // options: return 0, or smallest negative number
  if (n_neg+n_pos < N) {
    cout << 0 << endl;
    return 0;
  }
  // return smallest negative number
  GetNeg(N,K,A);
}


Measured memory_bytes: 4748
#include<bits/stdc++.h>
#define ll long long
using namespace std;
string s,t;
int dp[3000+1][3000+1];
ll solve(ll i,ll j){
  if(i>=s.size()||j>=t.size()){
    return 0;
  }
  if(dp[i][j]!=-1){
    return dp[i][j];
  }
  ll l=0;
  if(s[i]==t[j]){
   l=1+solve(i+1,j+1);
  }
  else{
    l=max(solve(i,j+1),solve(i+1,j));
  }
  return dp[i][j]=l;
}
string getString(){
  string ans="";
  int i=0;int j=0;
  ll l=solve(0,0);
  if(l==0)
    return ans;
  while(l){
  if(s[i]==t[j]){
    ans+=s[i];
      i++;
    j++;
    l--;
  }
  else{
    if(dp[i+1][j]>dp[i][j+1])
      i++;
    else
      j++;
  }
  }
  return ans;
}


int main(){
memset(dp,-1,sizeof(dp));
cin>>s>>t;
string ans="";
cout<<getString();
return 0;
}


Measured memory_bytes: 39092
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<int,int> P;
const LL mod=998244353;
const LL LINF=1LL<<62;
const LL INF=1<<17;

vector<LL> fact;
vector<LL> inver(200001);

LL combi(int n,int r){
    if(n<r||n<0||r<0) return 0;
    return fact[n]%mod*inver[n-r]%mod*inver[r]%mod;
}

LL hcombi(int n,int r){
    return combi(n+r-1,r); 
}

LL fpow(LL a, LL n){
    LL x = 1;
    while(n > 0){
        if(n&1){
            x=x*a%mod;
        }
        a=a*a%mod;
        n >>= 1;
    }
    return x;
}

void set_combi(){
    LL s=1;
    fact.push_back(1);
    for(int i=1;i<=200000;i++){
        s*=i;
        s%=mod;
        fact.push_back(s);
    }
    inver[200000]=fpow(fact[200000],mod-2);
    for(int i=199999;i>=0;i--){
        inver[i]=inver[i+1]*(i+1)%mod;
    }
}




int main(){
    int N,K;
    cin >> K >> N;
    set_combi();
    for(int k=2;k<=2*K;k++){
        int p=min(k,2*K+2-k)/2;
        LL ret=0;
        for(int i=0;i<=p;i++){
            if(i%2==0) ret=(ret+combi(p,i)*hcombi(K,N-2*i))%mod;
            else ret=(ret+mod-(combi(p,i)*hcombi(K,N-2*i)%mod))%mod;
        }
        cout << ret << endl;
    }
    return 0;
}



Measured memory_bytes: 3956
n,m=map(int,input().split())
if n%2==1:
    x=[f"{i+1} {n-i}" for i in range(m)]
    print(" ".join(x))
else:
    x=[f"{i+1} {n-i}" if i<m/2 else f"{i+1} {n-i-1}" for i in range(m)]
    print(" ".join(x))


Measured memory_bytes: 75636
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iterator>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

	cout << N / 3;

	return 0;
}

Measured memory_bytes: 256
n = input()
al = list(map(int,input().split()))


ans = float("inf")
for a in al:
    point = 0
    while True:
        if a % 2 == 0:
            point += 1
            a = a // 2
        else:
            break
    if ans > point:
        ans = point

print(ans)

Measured memory_bytes: 38640
# D
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
sum_a = sum(a)
q = int(input())
bc = [list(map(int, input().split())) for _ in range(q)]
a = Counter(a)
# print(a, sum_a)
for i in range(q):
    # print(a)
    # print(bc[i][0], bc[i][1], sum_a)
    num = a[bc[i][0]]*bc[i][1]
    sum_a = sum_a - (a[bc[i][0]] * bc[i][0]) + num

    a[bc[i][1]] += a[bc[i][0]]
    a[bc[i][0]] = 0
    print(sum_a)


Measured memory_bytes: 39376
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
using namespace std;

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

  set<long long> a_set;

  for (int i = 0; i < n; i++)
  {
    long long a;
    cin >> a;
    if (a_set.count(a) == 1)
    {
      cout << "NO" << endl;
      return 0;
    }
    a_set.insert(a);
  }

  cout << "YES" << endl;;
  return 0;
}

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

using namespace std;

int main()
{
int N ;
int d ,sum=0;
cin >> N;
int s[N]={0};

for(int i=0 ; i<N;i++)
{
    cin >> d;
    s[i]=d;
}

for(int i=0 ; i<N;i++)
{
    for(int j=0; j<i;j++)
{
    sum=sum+(s[i]*s[j]);
}
}
cout << sum ;



    return 0;
}


Measured memory_bytes: 256
while 1:
    try:
        s = list(input())
    except EOFError:
        break

    joi = ["J", "O", "I"]
    ioi = ["I", "O", "I"]
    cnt_j = 0
    cnt_i = 0
    for i in range(len(s) - 2):
        if [s[i], s[i+1], s[i+2]] == joi:
            cnt_j += 1
        elif [s[i], s[i+1], s[i+2]] == ioi:
            cnt_i += 1

    print(cnt_j)
    print(cnt_i)



Measured memory_bytes: 5604
import sys
input = lambda: sys.stdin.readline().rstrip()
from math import floor,ceil,sqrt,factorial,log
from heapq import heapify, heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from decimal import Decimal
inf = float('inf')
mod = 1000000007

t = list(input())

for i in range(len(t)):
    if t[i] == '?':
        t[i] = 'D'

print(''.join(t))



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

int main(void){
  vector<pair<int, int> > cnt; // cnt[i] = {vote cnt, cand id}
  int n,m;
  
  while(true){
    cin >> n >> m;
    if (n==0 && m==0) break;
    cnt = vector<pair<int, int> >(m);
    for (int i=0; i<m; i++){
      cnt[i].first = 0;
      cnt[i].second = i+1;
    }
    for (int i=0; i<n; i++){
      for (int j=0; j<m; j++){
        int t;
        cin >> t;
        cnt[j].first -= t;
      }
    }
    stable_sort(cnt.begin(), cnt.end());
    cout << cnt[0].second;
    for (int i=1; i<m; i++){
      cout << " " << cnt[i].second;
    }
    cout << endl;
  }
  return 0;
}



Measured memory_bytes: 3032
#include <iostream>
#include <string>
#include <stack>

using namespace std;

int main()
{
  stack<string> A_Un;
  string s;

  int n;

  cin >> n;

  string judge = "YES";
  for (int i = 0; i < n; i++) {
    cin >> s;
    if (s == "A") {
      A_Un.push(s);
    } else if (s == "Un") {
      if (A_Un.empty() || A_Un.top() == "Un") {
        judge = "NO";
      } else {
        A_Un.pop();
      }
    } else {
      judge = "NO";
    }
  }

  if (!A_Un.empty()) judge = "NO";
  
  cout << judge << endl;
}



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

using namespace std;

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

    int a, b, c;
    cin >> a >> b >> c;
    swap(a, b);
    swap(a, c);
    cout << a << " " << b << " " << c << endl;

    return 0;
}


Measured memory_bytes: 892
#include <iostream>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <algorithm>

using namespace std;

bool isPalindrome(string s) {
    int left = 0, right = (int)s.size() - 1;
    while (left < right) {
        if (s[left++] != s[right--]) {
            return false;
        }
    }
    return true;
}

int main() {
    string S;
    cin >> S;

    int n = (int)S.size();
    if (isPalindrome(S)
    && isPalindrome(S.substr(0, (n - 1) / 2))
    && isPalindrome(S.substr((n + 1) / 2))) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

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

class q1
{
    static void Main (string[] args)
    {
        string[] str = Console.ReadLine().Split(' ');

        int a = int.Parse(str[0]);
        int b = int.Parse(str[1]);

        int[] n = new int[3];

        n[0] = a + b;
        n[1] = a - b;
        n[2] = a * b;

        Console.WriteLine(n.Max());
    }
}


Measured memory_bytes: 13268
#include<cstdio>
#include<cmath>
#include<algorithm>
#define INF 987654321
int main()
{
    int n;
    scanf("%d",&n);
    int a[100], sum=0;
    for(int i=0; i<n; i++)
    {
        scanf("%d",&a[i]);
        sum += a[i];
    }
    int minDiff = INF;
    int pos;
    for(int i=0; i<n; i++)
    {
        if(abs(a[i]*n - sum) < minDiff)
        {
            minDiff = abs(a[i]*n - sum);
            pos = i;
        }
    }
    printf("%d",pos);
    return 0;
}


Measured memory_bytes: 128
package main

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

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() (int, []int) {
	n := readInt()
	return n, readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int

// -----------------------------------------------------------------------------

func main() {
	defer stdout.Flush()
	s := readString()
	for _, w := range []string{"", "A"} {
		for _, x := range []string{"", "A"} {
			for _, y := range []string{"", "A"} {
				for _, z := range []string{"", "A"} {
					if s == w+"KIH"+x+"B"+y+"R"+z {
						println("YES")
						return
					}
				}
			}
		}
	}
	println("NO")
}

// -----------------------------------------------------------------------------


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

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

	int W, H, N;
	cin >> W >> H >> N;

	int x0 = 0;
	int y0 = 0;
	int x1 = W;
	int y1 = H;

	for( int i = 0; i < N; ++i ) {
		int x, y, a;
		cin >> x >> y >> a;

		if( a == 1 && x > x0 ) {
			x0 = x;
		}
		else if( a == 2 && x < x1 ) {
			x1 = x;
		}
		else if( a == 3 && y > y0 ) {
			y0 = y;
		}
		else if( a == 4 && y < y1 ) {
			y1 = y;
		}
	}

	cout << max( x1-x0, 0 ) * max( y1-y0, 0 ) << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
#define RG register
#define IL inline
#define inf 2147483640
#define LL long long
#define pi acos(-1.0)
#define db double
#define N 100005
using namespace std;
IL int gi()
{
	RG int res=0,w=1;
	RG char ch;
	for(ch=getchar();(ch<'0'||ch>'9')&&ch!='-';ch=getchar());
	if(ch=='-') w=-1,ch=getchar();
	for(;ch>='0'&&ch<='9';ch=getchar()) res=10*res+ch-48;
	return res*w;
}
int n,a[N],b[N],c[N];
LL ans,v[N];
int main()
{
	//freopen("1.in","r",stdin);
	//freopen("1.out","w",stdout);
	n=gi();
	for(RG int i=1;i<=n;++i) a[i]=gi();
	for(RG int i=1;i<=n;++i) b[i]=gi();
	for(RG int i=1;i<=n;++i) c[i]=gi();
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	for(RG int i=1;i<=n;++i) {
		RG int pos=upper_bound(c+1,c+n+1,b[i])-c;
		v[i]=n-pos+1;
	}
	for(RG int i=n;i>=1;--i) v[i]+=v[i+1];
	for(RG int i=1;i<=n;++i) {
		RG int pos=upper_bound(b+1,b+n+1,a[i])-b;
		ans+=v[pos];
	}
	printf("%lld",ans);
	//fclose(stdin);fclose(stdout);
	return 0;
}

Measured memory_bytes: 2176
#include <stdio.h>

int main(){
    long long int n;
    scanf("%lld", &n);
    
    long long int sum = 0;
    
    for(int i = 1; i<=n; i++){
        if(i%15 && i%3 && i%5){
            sum += i;
        }
    }
    
    printf("%lld\n", sum);

    return 0;
}

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

int main() {
  int N, i, number;
  cin >> N;
  number = 0;
  
  for (i = 0; i < N; i++) {
    int l, r;
    cin >> l >> r;
    number += (r - l + 1);
  }
  
  cout << number << endl;
}

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string N; cin >> N;
    int ok=0;
    for (char c:N) if (c=='7') ok=1;
    cout << (ok?"Yes":"No") << '\n';
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int K;
    cin >> K;
    cout << ((K+1) / 2) * (K / 2) << '\n';
}


Measured memory_bytes: 3500
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define full(a) a.begin(),a.end()
#define rfull(a) a.rbegin(),a.rend()

using namespace std;
const double pi=acos(-1.0);
const double pii=2*pi;
const double eps=1e-6;
const long long MOD=1e9+7;

void solve(){
    long long x;
    cin>>x;
    for(long long i=1;;i++){
        if(((i+1)*x)%360==0){
            cout<<i+1<<"\n";
            return;
        }
    }
}

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

    solve();
    return 0;
}

Measured memory_bytes: 3648
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> p;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const ll INF = 1e18;


int main() {
	int n; cin >> n;
	vector<bool> f(1e5+1);
	rep(i, 2, 1e5+1) {
		if (f[i]) continue;
		rep(j, i * 2, 1e5+1) {
			f[j] = true;
			j += (i - 1);
		}
	}
	vector<int> cnt(1e5 + 1, 0);
	rep(i, 3, 1e5+1) {
		if (!(f[i]) && !(f[(i + 1) / 2])) cnt[i]++;
		i++;
	}
	rep(i, 3, 1e5+1) cnt[i] += cnt[i - 1];
	rep(i, 0, n) {
		int p1, p2; cin >> p1 >> p2;
		cout << cnt[p2] - cnt[p1 - 1] << endl;
	}
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll t1,t2;
const ll mod = 1000000007;
const int INF = 1e9;
const ll INFLONG = 1e18;
void swap(ll *x,ll *y){
  ll tmp;
  tmp = *x;
  *x = *y;
  *y = tmp;
}
int main(){
  ll a,b;
  cin >> a >> b;
  if(a > b){
    swap(a,b);
  }
  ll ans = 0;
  rep(i,b){
    ans *= 10;
    ans += a;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
/*
 * Author : Andrew J
*/
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) x.begin() , x.end()
#define rall(x) x.rbegin() , x.rend()
#define vz(x) x.size()
using ll = long long;
using ii = pair <int , int>;
void in(int &x);
// const int N = ;
const int INF = 1e9 + 50;
const int MOD = 1e9 + 7;
string s;

int main() {
  int n; in(n);
  for (int i = 0 ; i < n ; i++) {
    s += "ACL";
  }
  cout << s << endl;
  return 0;
}

void in(int &x){
	bool neg = false;
	register int c;
	x = 0;
	c = getchar();
	if(c == '-'){
		neg = true;
		c = getchar();
	}
	for (; c > 47 && c < 58; c = getchar())
	x = (x << 1) + (x << 3) + c - 48;
	if (neg) x *= -1;
}


Measured memory_bytes: 3612
s = input()
count = 0

for i in s:
    if ord("A") <= ord(i) <= ord("Z"):
        count += 1
else:
    if s.count("C") == 0:
        print("WA")
        exit()
    if s[0] == "A" and 2 <= s.index("C") <= len(s)-2 and count == 2:
        print("AC")
    else:
        print("WA")


Measured memory_bytes: 2940
#pragma warning(disable:4996)
#include <bits/stdc++.h>

using namespace std;

//macro
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define EPS (1e-8)
#define equals(a,b)(fabs((a)-(b))<EPS)

using ll = long long;
using ull = unsigned long long;
using vb = vector<bool>;
using vi = vector<int>;
using vll = vector<ll>;
using vs = vector<string>;
using vvb = vector<vb>;
using vvi = vector<vi>;
using vvll = vector<vll>;
//func
template<typename A, typename T>void assign2d(A&arr, ll H, ll W, T t) { arr.resize(H); REP(i, H) arr[i].assign(W, t); }
template<class T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); REP(i, n)os << v[i] << (i == n - 1 ? "" : " "); return os; }
template <class T = int> inline T IN() { T x; cin >> x; return x; }
template<class T> inline void OUT(const T &x) { cout << x << "\n"; }
void YESNO(bool c) { OUT(c ? "YES" : "NO"); };
void YesNo(bool c) { OUT(c ? "Yes" : "No"); };
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); /*cout << fixed << setprecision(6);*/ } } pre__;

int main() {
	string S;
	vb A(26, false);
	cin >> S;
	REP(i, S.size()) {
		A[(int)S[i] - (int)'a'] = true;
	}
	REP(i, 26) {
		if (!A[i]) {
			OUT((char)('a' + i));
			return 0;
		}
	}
	OUT("None");
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i < (n); ++i)
#define ll long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; }}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; }}

using namespace std;

int main() {
    ll counts, b, r;
    cin >> counts >> b >> r;

    ll set = b + r;
    ll loop = counts / set;
    ll amari = counts % set;

    cout << min(amari, b) + loop * b << endl;
}


Measured memory_bytes: 256