akhauriyash/Code-Regression huggingface dataset:
class Factorial:
    def __init__(self,n,mod):
        self.f=f=[0]*(n+1)
        f[0]=b=1
        self.mod=mod
        for i in range(1,n+1):f[i]=b=b*i%mod
        self.inv=inv=[0]*(n+1)
        inv[n]=b=pow(self.f[n],mod-2,mod)
        for i in range(n,0,-1):inv[i-1]=b=b*i%mod
    def factorial(self,i):
        return self.f[i]
    def ifactorial(self,i):
        return self.inv[i]
    def comb(self,n,k):
        if n>=k:
            return self.f[n]*self.inv[n-k]%self.mod*self.inv[k]%self.mod
        else:
            return 0
M=10**9+7
a,b,c,d=map(int,input().split())
comb=Factorial(c+d+2,M).comb
f=lambda r,c:comb(c+r+2,r+1)-c-r-2
print((f(c,d)-f(c,b-1)-f(a-1,d)+f(a-1,b-1))%M)

Measured memory_bytes: 161268
data = [                                                                             
    [[0 for r in range(10)] for i in range(3)] for b in range(4)                     
    ]                                                                                
                                                                                     
n = int(input())                                                                     
                                                                                     
for i in range(n):                                                                   
    b, f, r, v = [int(i) for i in input().split()]                                   
    data[b-1][f-1][r-1] += v                                                         
                                                                                     
for bi, b in enumerate(data):                                                        
    for f in b:                                                                      
        for r in f:                                                                  
            print(' {0}'.format(r), end='')                                          
        print()                                                                      
    if bi < 3:                                                                       
        print("#" * 20)                                                              

Measured memory_bytes: 7744
#include <iostream>
#include <stdio.h>

using namespace std;
typedef long long ll;
const int INF = 1001001001;

int main(){
    int M,N,X;
    cin>>N>>M>>X;
    
    ll C[N];
    ll A[N][M];
    ll Al_SUM[M];
    
    ll C_SUM=0;
    ll min=INF;

    
    for(int i=0;i!=N;++i){
        cin>>C[i];
        for(int j=0;j!=M;++j){
            cin>>A[i][j];
        }
    }
    
    for(int i=0;i!=M;++i) Al_SUM[i]=0;
   
   /*
    for(int i=0;i!=N;++i){
        for(int j=0;j!=M;++j){
            cout<<"A["<<i<<"]["<<j<<"]"<<A[i][j]<<" ";
        }
    }
    cout<<endl;
    */
    
    
    for(int bit=0;bit<(1<<N);++bit){

        for(int i=0;i<N;++i){        //iは本の冊数
            if(bit>>i&1){
                for(int j=0;j!=M;++j){
                    Al_SUM[j]+=A[i][j];
                    //cout<<"Al_SUM["<<j<<"]:"<<Al_SUM[j]<<endl;
    
                }
                C_SUM+=C[i];
                //cout<<C_SUM<<endl;
            }
        }
        //for(int i=0;i!=M;++i)cout<<"Al_SUM["<<i<<"]:"<<Al_SUM[i]<<endl;
        bool ok=true;
        for(int j=0;j!=M;++j){
            if(Al_SUM[j]<X){
                ok=false;
                //cout<<flag<<endl;
                break;
            }else{
                
            }
        }
        if(ok){
        min=(C_SUM<min)?C_SUM:min;
        }
        for(int j=0;j!=M;++j)Al_SUM[j]=0;
        C_SUM=0;
    }
    
    //cout<<"flag:"<<flag<<endl;
    
    if(min!=INF){
        cout<<min<<endl;
       
    }else{
         cout<<-1<<endl;
    }
    
}



Measured memory_bytes: 3620
n = int(input())
l = list(map(int, input().split()))

cnt = 0
for i in range(n):
    for j in range(n):
        for k in range(n):
            a, b, c = l[i], l[j], l[k]
            if a < b < c:
                if a != b and b != c:
                    if a + b > c and b + c > a and c + a > b:
                        cnt += 1

print(cnt)


Measured memory_bytes: 9180
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 25;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };

int ans;
string str;


int main() {
	while ( ( cin >> str ) ) {
		ans = 0;
		for ( int i = 0; i < str.size(); i++ ) {
			if ( str[ i ] == 'M' ) {
				if ( ans % 1000 ) {
					ans += 800;
				}
				else {
					ans += 1000;
				}
			}
			else if ( str[ i ] == 'D' ) {
				if ( ans % 500 ) {
					ans += 300;
				}
				else {
					ans += 500;
				}
			}
			else if ( str[ i ] == 'C' ) {
				if ( ans % 100 ) {
					ans += 80;
				}
				else {
					ans += 100;
				}
			}
			else if ( str[ i ] == 'L' ) {
				if ( ans % 50 ) {
					ans += 30;
				}
				else {
					ans += 50;
				}
			}
			else if ( str[ i ] == 'X' ) {
				if ( ans % 10 ) {
					ans += 8;
				}
				else {
					ans += 10;
				}
			}
			else if ( str[ i ] == 'V' ) {
				if ( ans % 5 ) {
					ans += 3;
				}
				else {
					ans += 5;
				}
			}
			else {
				ans++;
			}
		}
		printf( "%d\n", ans );
	}
	return 0;
}

Measured memory_bytes: 1172
#!/usr/bin/env python3
#AGC23 B

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

def check(x):
    for i in range(n):
        for j in range(n):
            if x[i][j] == x[j][i]:
                continue
            return False
    return True

n = I()
s = [list(input()) for _ in range(n)]
ans = 0
for b in range(n):
    flg = True
    for i in range(n):
        for j in range(n):
            if s[(i+b)%n][j] == s[(j+b)%n][i]:
                continue
            else:
                flg = False
                break
    if flg:
        ans += n
print(ans)

Measured memory_bytes: 47136
#include <cstdio>

using namespace std;

int x[100000];
long long fact[100001];

int main() {
    int n, c = 0, m = 1000000007, i;
    long long ans = 1;
    
    scanf("%d", &n);
    
    for (i = 0; i < n; i++) scanf("%d", &x[i]);
    
    fact[0] = fact[1] = 1;
    for (i = 2; i <= n; i++) fact[i] = fact[i - 1] * i % m;
    
    for (i = 0; i < n; i++) {
        if (x[i] < c * 2 + 1) {
            ans = ans * (c + 1) % m;
        } else {
            c++;
        }
    }
    
    ans = ans * fact[c] % m;
    
    printf("%lld\n", ans);
    
    return 0;
}


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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORd(i, a, b) for (int i = (a) ; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define sp system("pause")
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
const int N = (int) 1e5 + 10;
void TimeExecution() {
    cout << "\n\n===>> Time Execution: " << clock() / (double)1000 << " sec(s).";
}
int t;
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    /*
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    */
    int a, b;
    char c;
    cin >> a >> c >> b;
    if(c == '+') cout << a + b;
    else cout << a - b;
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3

import sys
# import math
# from string import ascii_lowercase, ascii_upper_case, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)


def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1               # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    n = ii()
    if n % 2 == 0:
        print((n // 2) ** 2)
    else:
        print((n // 2) * (n // 2 + 1))


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#ifdef __GNUC__
#include <bits/stdc++.h>
#else
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#endif
using namespace std;
using ll = long long;

#define REPI(i, a, n)	for(int (i)=(a);(i)<(n);(i++))
#define REP(i,n) REPI(i,0,n)
#define REP1(i,n) REPI(i,1,n)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;

int vector_finder(std::vector<int> vec, int number) {
	auto itr = std::find(vec.begin(), vec.end(), number);
	size_t index = std::distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	return gcd(a % b, b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
ll fact(ll n) {
	int m;
	if (n == 0) {
		return 1;
	}
	m = fact(n - 1);
	return n * m;
}

struct stc {
	int fL, fV, aL, aV;
	int Value;
};

int main() {
	int v[32] = {
		1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
	};
	int i;
	cin >> i;
	cout << v[i-1] << endl;
	return 0;
}

Measured memory_bytes: 256
import itertools,sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,M = LI()
a = set([I() for _ in range(M)])
dp = [0]*(N+1) #1_indexed
dp[0] = 1
dp[1] = 0 if 1 in a else 1
for i in range(2,N+1):
    if i in a:
        dp[i] = 0
        continue
    dp[i] = (dp[i-1]+dp[i-2])%(10**9+7)
print(dp[-1])


Measured memory_bytes: 13212
#include <string>
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <cmath>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
int main()
{
    int n, m;
    cin >> n >> m;
    vector<bool> isAC(n+1);
    vector<int> WANum(n+1);
    int wrongNum = 0, ansNum = 0;
    rep(i, m){
        int p;
        string s;
        cin >> p >> s;
        if(!isAC[p]){
            if(s == "AC"){
                isAC[p] = true;
                ansNum++;
                wrongNum += WANum[p];
            } 
            else WANum[p]++;
        }
    }
    cout << ansNum << " "<< wrongNum << endl;
}

Measured memory_bytes: 3784
import os
import sys
from atexit import register
from io import BytesIO
sys.stdin = BytesIO(os.read(0, os.fstat(0).st_size))
sys.stdout = BytesIO()
register(lambda: os.write(1, sys.stdout.getvalue()))
input = lambda: sys.stdin.readline().rstrip('\r\n')
raw_input = lambda: sys.stdin.readline().rstrip('\r\n')

from collections import deque

def bfs(graph,s,n):
    visited=[False for _ in xrange(n+1)]
    ans = [None for _ in xrange(n+1)]
    stack=deque([s])
    while stack:
        node=stack.popleft()
        for nodes in graph[node]:
            if not visited[nodes]:
                if ans[nodes] is None:
                    ans[nodes] = str(node)
                stack.append(nodes)
                visited[nodes] = True
    return ans


n,m = (int(x) for x in input().split())
graph = dict()
for x in xrange(m):
    a,b = (int(x) for x in input().split())
    try:
        graph[a].append(b)
    except:
        graph[a] = [b]
    try:
        graph[b].append(a)
    except:
        graph[b] = [a]
ans = bfs(graph,1,n)
print('Yes')
print('\n'.join(ans[2:]))


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

int main() {
  int n, z, w; cin >> n >> z >> w;
  for (int i = 0; i < n-2; i++) { int a; cin >> a; }
  if (n == 1) {
    int a; cin >> a;
    cout << abs(a - w) << endl;
  }
  else {
    int a1, a2; cin >> a1 >> a2;
    cout << max(abs(a1 - a2), abs(a2 - w)) << endl;
  }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<math.h>
int main(void)
{
	int a[5],s=0,d,f,g,h,i,j;
	for(i=0;i<4;i++)
		scanf("%d",&a[i]);
	for(i=0;i<4;i++){
		if(a[i]!=-1){
			for(j=i+1;j<4;j++){
				if(a[i]==a[j]){
					a[i]=-1;
					a[j]=-1;
				}
			}
		}
	}
	for(i=0;i<4;i++) if(a[i]==-1) s++;
	if(s==4) printf("yes\n");
	else printf("no\n");
	return 0;
}

Measured memory_bytes: 2688
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int n;
set<string> st;

void dfs(string s, int l) {
  // cout << s << endl;
  if (s.size() == n) {
    st.insert(s);
    return;
  }
  for (int i = 0; i <= l + 1; ++i) {
    char c = (char)(i + 'a');
    if (i == l + 1) {
      dfs(s + c, l + 1);
    } else {
      dfs(s + c, l);
    }
  }
}

int main() {
  cin >> n;
  dfs("a", 0);
  for (auto a : st) {
    cout << a << endl;
  }
  return 0;
}

Measured memory_bytes: 12416
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstring>
#include <map>
#include <set>
#include <queue>
#include <math.h>
#include <unordered_map>
#include <algorithm>

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
inline int gcd(int a,int b){return b?gcd(b,a%b):a;}
inline int lcm(int a,int b){return a*b/gcd(a,b);}
typedef long long ll;
typedef std::vector<int> VI;
typedef std::pair<int, int> PII;

using namespace std;

int main()
{
  int N;
  cin >> N;
  vector<int> A(N+1);
  vector<int> B(N+1, 0);
  int count = 0;
  REP(i,N+1) cin >> A[i+1];
  for (int i=N;i>0;i--)
  {
    int t = 0;
    for (int j=i*2;j<=N;j+=i)
    {
      if (B[j]) t = 1-t;
    }
    if (A[i] != t)
    {
      B[i] = 1;
      count++;
    }
  }
  int count2 = 0;
  printf("%d\n", count);
  for (int i = 1; i < N+1; i++)
  {
    if (B[i])
    {
      count2++;
      if (count2 == count)
      {
        printf("%d\n", i);
      } else {
        printf("%d ", i);
      }
    }
  }
  return 0;
}


Measured memory_bytes: 2432
n = int(input())
dp = [[0]*3 for i in range(n)]
li = [list(map(int, input().split())) for i in range(n)]
dp[0] = li[0]

for i in range(1,n):
    dp[i][0] = max(dp[i-1][1]+li[i][0], dp[i-1][2]+li[i][0])
    dp[i][1] = max(dp[i-1][0]+li[i][1], dp[i-1][2]+li[i][1])
    dp[i][2] = max(dp[i-1][0]+li[i][2], dp[i-1][1]+li[i][2])

print(max(dp[-1][0], dp[-1][1], dp[-1][2]))

Measured memory_bytes: 102180
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))

def gcd(a, b):
  if a<b:
    a, b = b, a
  if b==0:
    return a
  return gcd(b, a%b)

from functools import reduce
g = reduce(gcd, a)

if k%g==0 and k<=max(a):
  print("POSSIBLE")
else:
  print("IMPOSSIBLE")

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

using namespace std;

int main(){
    
    int n;
    vector<int> vec;
    
    cin>>n;
    
    for(int i=0;i<n;i++){
        
        int x;
        cin>>x;
        vec.push_back(x);
    }
    
    vector<int> dp;
    
    dp.push_back(0);
    dp.push_back(abs(vec[0]-vec[1]));
    
    for(int i=2;i<n;i++){
        
        int y = min(abs(vec[i-1]-vec[i])+dp[i-1],abs(vec[i-2]-vec[i])+dp[i-2]);
        dp.push_back(y);
        
    }
    
    cout<< dp[n-1];
    
    return 0;
    
}

Measured memory_bytes: 1400
#include "bits/stdc++.h"
using namespace std;

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

    if (A == B) {
        cout << C << endl;
    }
    else if (B == C) {
        cout << A << endl;
    }
    else if (C == A) {
        cout << B << endl;
    }
}

Measured memory_bytes: 256
h, w = map(int, input().split())
a = [''] * h
for i in range(h):
	a[i] = input()
 
row = [False] * h
col = [False] * w
for i in range(h):
	for j in range(w):
		if a[i][j] == '#':
			row[i] = True
			col[j] = True
 
for i in range(h):
	if row[i]:
		for j in range(w):
			if col[j]:
				print(a[i][j], end = '')
		print()

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

int solve(vector<int> &h, int n, int k){
    vector<int> dp(n, INT32_MAX);
    dp[0] = 0;

    for(int i = 1;i < n;i++){
        for(int j = 1;j <= k;j++){
            if(i >= j){
                dp[i] = min(dp[i], dp[i-j] + abs(h[i]- h[i-j]));
            }
        }
    }

    return dp[n-1];
}

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    for(auto &x: h){
        cin >> x;
    }

    cout << solve(h, n, k) << endl;

    return 0;
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]C - Multiple Clocks
            int n = int.Parse(Console.ReadLine());
            var t = ReadLines(n);

            var lib = new Library.Gcd();
            long lcm = t[0];

            for (int i = 1; i < n; i++)
            {
                lcm = lib.GetLcm(lcm, t[i]);
            }

            Console.WriteLine(lcm);
        }

        static List<long> ReadLines(long count = 0)
        {
            //[summary]コンソールの値を読み込む
            var lines = new List<long>();
            string s;

            //読み込む行数が未指定のときは、1行目の値を"count"とみなす
            if (count == 0)
            {
                s = Console.ReadLine().TrimEnd();
                count = long.Parse(s);
            }

            for (long i = 0; i < count; i++)
            {
                s = Console.ReadLine().TrimEnd();
                lines.Add(long.Parse(s));
            }

            return lines;
        }
    }
}

namespace Library
{
    public class Gcd
    {
        public long GetGcd(long a, long b)
        {
            //[summary]a,b2つの数の最大公約数を求める
            //以下リンクを参考に実装
            //https://qiita.com/gushwell/items/e9614b4ac2bea3fc6486

            if (a < b)
            {
                //引数を入れ替えて自分を呼び出す
                return GetGcd(b, a);
            }
            else
            {
                while (b > 0)
                {
                    long remainder = a % b;

                    a = b;
                    b = remainder;
                }

                return a;
            }
        }

        public long GetLcm(long a, long b)
        {
            //[summary]a,b2つの数の最小公倍数を求める
            //Lcm: least Common Multiple
            //以下リンクを参考に実装
            //https://qiita.com/gushwell/items/f08d0e71fa0480dbb396

            long gcd = GetGcd(a, b);
            return a / gcd * b;
        }
    }
}

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

const int N = 1005;

char ans[N][N];

void pattern1(int x, int y) {
	ans[x][y] = ans[x][y + 1] = 'a';
	ans[x + 1][y] = ans[x + 1][y + 1] = 'b';
}

void pattern2(int x, int y) {
	ans[x][y] = ans[x + 1][y] = 'c';
	ans[x][y + 1] = ans[x + 1][y + 1] = 'd';
}

int main() {
	int n;
	scanf("%d", &n);
	if (n == 2) {
		printf("-1\n");
	} else if (n == 3) {
		printf("aab\n");
		printf("d.b\n");
		printf("dcc\n");
	} else if (n == 7) {
		printf(".iijjkk\n");
		printf("xaab...\n");
		printf("xd.b...\n");
		printf("ydcc...\n");
		printf("y...aab\n");
		printf("z...d.b\n");
		printf("z...dcc\n");
	} else if (n % 2 == 0) {
		for (int i = 1; i <= n; i++) {
			for (int j = 1; j <= n; j++) {
				ans[i][j] = '.';
			}
		}
		for (int i = 1; i <= n; i += 2) {
			pattern1(i, i);
		}
		for (int i = 1; i <= n; i += 2) {
			if (i < n - 1) {
				pattern2(i, i + 2);
			} else {
				pattern2(i, 1);
			}
		}
		for (int i = 1; i <= n; i++) {
			for (int j = 1; j <= n; j++) {
				printf("%c", ans[i][j]);
			}
			printf("\n");
		}
	} else {
		for (int i = 1; i <= n; i++) {
			for (int j = 1; j <= n; j++) {
				ans[i][j] = '.';
			}
		}
		for (int i = 1; i <= n - 5; i += 2) {
			pattern1(i, i);
		}
		for (int i = 1; i <= n - 5; i += 2) {
			if (i < n - 6) {
				pattern2(i, i + 2);
			} else {
				pattern2(i, 1);
			}
		}
		ans[n - 4][n - 4] = ans[n - 4][n - 3] = 'a';
		ans[n - 4][n - 2] = ans[n - 4][n - 1] = 'b';
		ans[n - 4][n] = ans[n - 3][n] = 'c';
		ans[n - 2][n] = ans[n - 1][n] = 'd';
		ans[n][n] = ans[n][n - 1] = 'e';
		ans[n][n - 2] = ans[n][n - 3] = 'f';
		ans[n][n - 4] = ans[n - 1][n - 4] = 'g';
		ans[n - 2][n - 4] = ans[n - 3][n - 4] = 'h';
		ans[n - 3][n - 3] = ans[n - 2][n - 3] = 'i';
		ans[n - 1][n - 2] = ans[n - 1][n - 1] = 'j';
		for (int i = 1; i <= n; i++) {
			for (int j = 1; j <= n; j++) {
				printf("%c", ans[i][j]);
			}
			printf("\n");
		}
	}
	return 0;
}

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

using ll = long long;
#define mod 1000000007
#define init ios::sync_with_stdio(0), cin.tie(0);
typedef vector<int> vi;
typedef pair<int, int> pi;
#define MS(x, y) memset(x, y, sizeof(x))
#define F first
#define S second
#define PB push_back
#define MP make_pair

int main()
{
    init;
    string s, t;
    cin >> s >> t;

    int cnt = 0;

    for (int i = 0; i < s.length(); i++)
    {
        if (s[i] != t[i])
            cnt++;
    }
    cout << cnt;
}

Measured memory_bytes: 3760
import itertools
import sys

num = list(map(int,input().split()))
per = []

for i in range(num[0],num[1]+1):
    for j in range(num[0],num[1]+1):
        if i <= j:
            break
        else:
            per.append((i*j)%2019)
            if (i*j)%2019 == 0:
                print(0)
                sys.exit()
per.sort()

print(per[0])


Measured memory_bytes: 11056
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>
#include <iomanip>

using namespace std;

#define FOR(i, a, b) for(int (i)=(a);(i)<(b);(i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)
#define REP(i, n) FOR((i), 0, (n))

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class T>
void print_container(T &container, string delim=" ") {
    bool first = true;
    for(auto &t: container){
        if(!first){
            cout << delim;
        }
        first = false;
        cout << t;
    }
    cout << endl;
}

int main() {
    int a, b, x;
    cin >> a >> b >> x;
    int v = a * a * b;

    double ans = 0.0;
    if(x*2 >= v){
        ans = atan(2*(v-x) / pow(a, 3)) * 180 / M_PI;
    }
    else{
        ans = (M_PI_2 - atan(2.0*x/a/b/b)) * 180 / M_PI;
    }
    printf("%.14f\n", ans);

    return 0;
}

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

struct abcd{int a,b,c,d;};
abcd abcd_array[55];

int calc_tokuten(vector<int> array,int q){
    int sum = 0;
    for(int i=0;i<q;i++){
        //cout << abcd_array[i].b-1 << " " << abcd_array[i].a -1 << endl;
        if (array.at(abcd_array[i].b - 1) - array.at(abcd_array[i].a -1) == abcd_array[i].c){
            sum += abcd_array[i].d;
        }
    }
    return sum;
}

void func(int m,vector<int> &array,int keta,int q,vector<int> &sum_array){
    if(keta == -1){
        int s = calc_tokuten(array,q);
        sum_array.push_back(s);
        return;
    }
    for(int i=1;i<=m;i++){
        array.at(keta) = i;
        func(i,array,keta-1,q,sum_array);
    }
}



int main(){
    int n,m,q;
    cin >> n >> m >> q;
    vector<int> array(n),sum_array(0);
    for(int i=0;i<q;i++) cin >> abcd_array[i].a >> abcd_array[i].b >> abcd_array[i].c >> abcd_array[i].d;
    func(m,array,n-1,q,sum_array);

    int maxi = -1;
    for(int i=0;i<sum_array.size();i++){
        if(maxi < sum_array.at(i)) maxi = sum_array.at(i);
    }
    cout << maxi << endl;
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  ll n, m, k;
  cin >> n >> m >> k;
  vector<ll> avec(n);
  vector<ll> bvec(m);
  vector<ll> asum(n+1, 0);
  vector<ll> bsum(m+1, 0);
  rep(i, n) {
    cin >> avec[i];
    asum[i+1] = asum[i] + avec[i];
  }
  rep(i, m) {
    cin >> bvec[i];
    bsum[i+1] = bsum[i] + bvec[i];
  }
  ll ans = 0;
  ll r = m;
  rep(i, n+1) {
    if (asum[i] > k) continue;
    while((asum[i] + bsum[r]) > k) r--;
    ans = max(ans, i+r);
  }
  cout << ans << endl;
  
  
  return 0;
}

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

const int maxN = 2e5+5;

void solve(){
    int n; cin >> n;
    int A[maxN];
    int count_red = 0, count_red2 = 0;
    for(int i = 0; i < n; i++){
        char c; cin >> c;
        if(c == 'W') A[i] = 0;
        else{
            A[i] = 1;
            count_red++;
        }
    }
    for(int i = count_red; i < n; i++){
        if(A[i] == 1) count_red2++;
    }
    int ans = 0;
    for(int i = 0; i < count_red; i++){
        if(A[i] == 0 && count_red2 > 0){
            ans++;
            count_red2--;
        }
        else if(A[i] == 0){
            ans++;
        }
    }
    cout << ans+count_red2 << "\n";


}


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

    bool multitest = false;
    //multitest = true;
    if(multitest){
        int t; cin >> t;
        while(t--)
            solve();
    }
    else
        solve();
}






Measured memory_bytes: 4428
/*
                       _oo0oo_
                      o8888888o
                      88" . "88
                      (| -_- |)
                      0\  =  /0
                    ___/`---'\___
                  .' \\|     |// '.
                 / \\|||  :  |||// \
                / _||||| -:- |||||- \
               |   | \\\  -  /// |   |
               | \_|  ''\---/''  |_/ |
               \  .-\__  '-'  ___/-. /
             ___'. .'  /--.--\  `. .'___
          ."" '<  `.___\_<|>_/___.' >' "".
         | | :  `- \`.;`\ _ /`;.`/ - ` : | |
         \  \ `_.   \_ __\ /__ _/   .-` /  /
     =====`-.____`.___ \_____/___.-`___.-'=====
                       `=---='
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  Vikash Kumar @ Codechef/codeforces 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/   
#include<bits/stdc++.h>
 
#define ll                    long long int
#define ll_MAX                LLONG_MAX
#define ll_MIN                LLONG_MIN
#define pi                    3.14159265358979323846
#define count_1(n)            __builtin_popcountll(n)
#define MOD                   1000000007
#define MAX                   1e9
#define MIN                   -1e9
#define itoc(c)               ((char)(((int)'0')+c))
#define mid(s,e)              (s+(e-s)/2)
const int MX=10010896;
const int lmt=3164;
const int N=10000001;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
ll extgcd(ll a,ll b,ll& x,ll& y){if(b==0){x=1;y=0;return a;}else{int g=extgcd(b,a%b,y,x);y-=a/b*x;return g;}}
ll modpow(ll a,ll b) {ll res=1;a%=MOD;for(;b;b>>=1){if(b&1)res=res*a%MOD;a=a*a%MOD;}return res;}
#define print_upto(a,n)        for(int i=0;i<n;i++)    cout<<a[i]<<" "; cout<<endl
#define print(a)        for (auto x : a) cout << x << " "; cout << endl

inline void solve(){
  string s;cin>>s;
  int n=s.length();
  int cnt=0,i=0,mx=0;
  while(i<n){
    if(s[i]=='R'){
      cnt++;
    }
    else
      cnt=0;
    mx=max(cnt,mx);
    i++;
  }
  cout<<mx<<"\n";

}

int main()
{
	cout<<fixed<<setprecision(12);
	fastio;ll  t=1,tc=1;
	#ifndef ONLINE_JUDGE
    	//freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout);
	#endif
	//cin>>t;
	while(t--){solve();}return 0;
}

Measured memory_bytes: 3652
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long LL;
struct wf{
	LL l,r,w;
}tree[100005<<2];
LL sta[100005<<1],l[100005],r[100005],n,m,k,sum[100005];
LL a[100005],b[100005],dp[100005<<1],N,ans;
void pushdown(LL root)
{
	if (tree[root].w)
	{
		tree[root<<1].w=tree[root<<1|1].w=tree[root].w;
		tree[root].w=0;
	}
}
void build(LL l,LL r,LL root)
{
	tree[root].l=l;
	tree[root].r=r;
	if (l==r) return;
	build(l,l+r>>1,root<<1);
	build((l+r>>1)+1,r,root<<1|1);
}
void change(LL l,LL r,LL x,LL root)
{
	if (tree[root].l>r||tree[root].r<l) return;
	if (tree[root].l>=l&&tree[root].r<=r)
	{
		tree[root].w=x;
		return;
	}
	pushdown(root);
	change(l,r,x,root<<1);
	change(l,r,x,root<<1|1);
}
LL ask(LL l,LL root)
{
	if (tree[root].l>l||tree[root].r<l) return 0;
	if (tree[root].l==tree[root].r) return tree[root].w;
	pushdown(root);
	return ask(l,root<<1)+ask(l,root<<1|1);
}
int main()
{
	scanf("%lld%lld",&n,&k);
	for (LL i=1;i<=n;++i)
	{
		scanf("%lld%lld",&a[i],&b[i]);
		sum[i]=sum[i-1]+a[i];
		if (b[i]==1&&k<2*a[i])
		{
			printf("-1");
			return 0;
		}
	}
	for (LL i=n;i;--i)
	{
		if (b[i]==2) l[i]=0,r[i]=k-1;
		else l[i]=(-2*sum[i-1]%k+k)%k,r[i]=(-2*sum[i]%k+k)%k;
		sta[++N]=l[i],sta[++N]=r[i];
	}
	sort(sta+1,sta+N+1);
	N=unique(sta+1,sta+N+1)-sta-1;
	build(1,N,1);
	for (LL i=n;i;--i)
	{
		l[i]=lower_bound(sta+1,sta+N+1,l[i])-sta;
		r[i]=lower_bound(sta+1,sta+N+1,r[i])-sta;
		LL w=ask(l[i],1);
		if (w!=0) dp[i]=dp[w]+(sta[l[w]]-sta[l[i]]+k)%k;
		else dp[i]=0;
		if (l[i]>r[i]) change(r[i]+1,l[i]-1,i,1);
		else
		{
			change(1,l[i]-1,i,1);
			change(r[i]+1,N,i,1);
		}
	}
	ans=dp[1];
	for (LL i=N;i;--i)
	{
		//printf("%lld ",ans);
		LL w=ask(i,1);
		if (!w) ans=0;
		else ans=min(ans,dp[w]+(sta[l[w]]-sta[i]+k)%k);
	}
	printf("%lld",2*sum[n]+ans);
	return 0;
}

Measured memory_bytes: 13824
#include <stdio.h>
long long Q, H, S, D, N;
long long min(long long x, long long y) { return x < y ? x : y; }
long long solve() { return (N / 2) * min(8 * Q, min(4 * H, min(2 * S, D))) + (N % 2) * min(4 * Q, min(2 * H, S)); }
int main() {
  scanf("%lld %lld %lld %lld %lld", &Q, &H, &S, &D, &N);
  printf("%lld\n", solve());
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int pnt[100010];
int main(){
	int n;
    cin>>n;
    long long int num[n+10];
    for(int i=0;i<n;i++)
        cin>>num[i];
    int cnt = 0;
    
    if(n>2&&num[0]>=num[1]){
        num[0]--;
        if(num[0]>num[1])
            return cout<<"No\n",0;
    }
    //cout<<num[0]<<" "<<num[1]<<endl;
    for(int i=1;i<n-1;i++){
        //cout<<"Ok "<<n<<endl;
        if(num[i]>num[i-1])
            num[i]--;
        if(num[i]>num[i+1])
            return cout<<"No\n",0;
        
            
    }
    return cout<<"Yes\n",0;
    
}


Measured memory_bytes: 1024
#include<iostream>
using namespace std;
 
int main()
{
	int A, B,result=0,i;
	cin >> A >> B;
	for (i = 0; i<2; i++){
		if (A > B){
			result += A;
			A--;
		}
		else{
			result += B;
			B--;
		}
	}
	cout << result << endl;
	return 0;
}

Measured memory_bytes: 256
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>

auto& in = std::cin;
auto& out = std::cout;
#define all(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;

int32_t dot,shr;
char map[100][101];

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	in >> dot>>shr;

	for (int32_t h = 0; h < 20; h++)
	{
		for (int32_t w = 0; w < 100; w++)
		{
			if (h % 2) {
				map[h][w] = '#';
			}
			else if (w%2==0) {
				map[h][w] = '.';
			}
			else {
				map[h][w] = '#';
			}
		}
		map[h][100] = '\0';
	}
	for (int32_t w = 0; w < 100; w++)
	{
		map[20][w] = '.';
		map[21][w] = '.';
	}
	for (int32_t h = 22; h < 42; h++)
	{
		for (int32_t w = 0; w < 100; w++)
		{
			if (h % 2) {
				map[h][w] = '.';
			}
			else if (w % 2 == 0) {
				map[h][w] = '#';
			}
			else {
				map[h][w] = '.';
			}
		}
	}

	dot = 501 - dot;
	shr = 501 - shr;


	for (int32_t h = 0; h < 20; h++)
	{
		for (int32_t w = 0; w < 100; w++)
		{
			if (map[h][w] == '.' && dot > 0) {
				--dot;
				map[h][w] = '#';
			}
		}
	}
	for (int32_t h = 22; h < 42; h++)
	{
		for (int32_t w = 0; w < 100; w++)
		{
			if (map[h][w] == '#' && shr > 0) {
				--shr;
				map[h][w] = '.';
			}
		}
	}


	out << 42 << ' ' << 100 << endl;
	for (int32_t i = 0; i < 42; i++)
	{
		out << map[i] << endl;
	}

	return 0;
}
#endif


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

string s[300];
char tmp[300][300];

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
#ifdef LOCAL
	std::ifstream in("in");
	std::cin.rdbuf(in.rdbuf());
#endif

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

	int ans = 0;
	for(int k = 0; k < N; k++){
		for(int i = 0; i < N; i++){
			for(int j = 0; j < N; j++){
				int x = (i + k) % N;
				int y = j;
				tmp[i][j] = s[y][x];
			}
		}
		bool ok = true;
		for(int i = 0; i < N; i++){
			for(int j = 0; j < N; j++){
				if(tmp[i][j] != tmp[j][i]) ok = false;
			}
		}
		if(ok) ans += N;
	}
	cout << ans << endl;
}


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

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

  vector<int> a(n), b(n), c(n-1);
  for (int i = 0; i < n; i++) cin >> a.at(i);
  for (int i = 0; i < n; i++) cin >> b.at(i);
  for (int i = 0; i < n - 1; i++) cin >> c.at(i);

  
  int ans = 0;
  for (int i = 0; i < n; i++ ) {
    ans += b.at(a.at(i) - 1);
    if ( i > 0 && a.at(i) == a.at(i - 1) + 1) ans += c.at(a.at(i - 1) - 1);
  }

  cout << ans << endl;
  
  return 0;
}

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

int main() {
    string s, t, res;
    cin >> s >> t;

    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
	reverse(t.begin(), t.end());

    res = s < t ? "Yes" : "No";
    cout << res << endl;
}

Measured memory_bytes: 3640
N = int(input())
DP = [[0]*3]*N
abc = [0] * N
for i in range(N):
    L = list(map(int,input().split()))
    abc[i] = L
for i,value in enumerate(abc):
    dp = [0]*3
    for j in range(3):
        for k in range(3):
            if j != k:
                dp[k] = max(dp[k],DP[i-1][j] + value[k])
    DP[i] = dp
print(max(DP[-1]))

Measured memory_bytes: 66124
#include <cstdio>
#include <vector>
#include <stack>
#include <iostream>
#include <string>
#include <tuple>
#include <random>
#include <map>
#include <queue>
#include <set>
#include <complex>
#include <algorithm>
#include <cassert>
#include <iterator>
#include <numeric>
#include <cmath>
#include <stdio.h>

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
const ll INF = 1e15;
const ld eps = 1e-6;

int main() {
  ll A, B, Q;
  cin >> A >> B >> Q;
  set<ll> ast;
  for(int i=0;i<A;i++){
    ll x;
    cin >> x;
    ast.insert(x);
  }
  set<ll> bst;
  for(int i=0;i<B;i++){
    ll x;
    cin >> x;
    bst.insert(x);
  }
  ast.insert(-INF);
  ast.insert(INF);
  bst.insert(-INF);
  bst.insert(INF);
  for(int i=0;i<Q;i++){
    ll q;
    cin >> q;
    auto ia = ast.lower_bound(q);
    ll ra = *ia;
    ia--;
    ll la = *ia;
    auto ib = bst.lower_bound(q);
    ll rb = *ib;
    ib--;
    ll lb = *ib;
    ll ans = min({max(rb, ra) - q, q - min(lb, la), min(q - la, rb - q) + rb - la, min(ra - q, q - lb) + ra - lb});
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 10752
#include<iostream>
#include<math.h>
#include<bits/stdc++.h>
#define ll long long int
#define hell 1000000007LL
using namespace std;
ll power(ll x, ll y){ 
    if(y==0)
     return 1;
    else
    {
        ll p=power(x,y/2);
        if(y%2==0)
         return (p*p)%hell;
        else
        return (x*((p*p)%hell))%hell;
    }}
ll gcd(ll x,ll y)
{
    if(y==0)
     return x;
    else
    return gcd(y,x%y);
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(20);
    char x;
    cin>>x;
    if(x>='A'&&x<='Z')
    cout<<"A";
    else
    cout<<"a";}

Measured memory_bytes: 3604
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

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


Measured memory_bytes: 3700
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <random>

#define _overload(a, b, c, d, ...) d
#define _rep1(X, A, Y) for (int (X) = (A);(X) <= (Y);++(X))
#define _rep2(X, Y) for (int (X) = 0;(X) < (Y);++(X))
#define rep(...) _overload(__VA_ARGS__, _rep1, _rep2)(__VA_ARGS__)
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define all(X) (X).begin(),(X).end()
#define len(X) ((int)(X).size())
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};


ll N;

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

  cin >> N;


  ll ans = 0;
  for (ll k = 1; k*k <= N; ++k) {
      if (N%k == 0) {
          ll mp1 = N/k;
          if (k < mp1-1) {
              ans += mp1-1;
          }
      }
  }

  cout << ans << endl;
  
  return 0;
}


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

int n,k,a[1000005],b[1000005],sum,maxi=0,ka;

int main()
{
	scanf("%d%d",&k,&n);
	for(int i=0;i<n;i++)scanf("%d",&a[i]);
	for(int i=0;i<n-1;i++)
	{
		
		b[i]=a[i+1]-a[i];
		if (b[i]>maxi)maxi=b[i];
	}
	ka=k-a[n-1]+a[0];
	if (ka>maxi)maxi=ka;
	
	sum=k-maxi;
	printf("%d",sum);

	return 0;
}

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

int main()
{
    int x;
    cin >> x;
    cout << 10 - (x / 200);
}

Measured memory_bytes: 3672
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;
 
 //In Contest Submission//
 /*
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long  a,b,c;
    cin >> a>>b>>c;
    if(sqrt(static_cast<long double>(a))+sqrt(static_cast<long double>(b))<sqrt(static_cast<long double>(c)))cout<<"Yes";
    else cout<<"No";
    }
*/

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b,c;
    cin >> a>>b>>c;
    ll d = (c-a-b);
    if(d>0 && d*d > 4*a*b)cout <<"Yes"<<endl;
    else cout << "No"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll d,n;
  cin >> d >> n;
  ll count = 0;
  ll i = 0;
  while(1){
    i++;
    ll k = 0;
    ll copy = i;
    while(copy % 100 == 0){
      k++;
      copy /= 100;
    }
    if(k == d)count++;
    if(count == n){
      cout << i << endl;
      return 0;
    }
  }
}



Measured memory_bytes: 3632
#include <string>
#include <iostream>

int main(){

    std::string string_first, string_second;
    std::cin >> string_first >> string_second;
    int num_of_op = 0;
    int length_string = string_first.size();

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

        if(string_first.at(i) == string_second.at(i)){
            continue;
        }else{
            ++num_of_op;
        }
    }

    std::cout << num_of_op << std::endl;


}

Measured memory_bytes: 3920
#include<stdio.h>

int main(void){
   int p;
   scanf("%d",&p);
   if(p%10==2||p%10==4||p%10==5||p%10==7||p%10==9){
      printf("hon");
   }else if(p%10==0||p%10==1||p%10==6||p%10==8){
      printf("pon");
   }else if(p%10==3){
      printf("bon");
   }

   return 0;
}


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

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

	if(S == "Sunny"){
		cout << "Cloudy";
	}
	else if(S == "Cloudy"){
		cout << "Rainy";
	}
	else
	{
		cout << "Sunny";
	}

	cout << endl;

	return 0;
}

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

struct Edge {
  int to, id;
};

vector<vector<Edge> > g;
vector<int> ans;

void dfs(int v, int c = -1, int p = -1) {
  int k = 1;
  rep(i, g[v].size()) {
    int u = g[v][i].to, ei = g[v][i].id;
    if (u == p) continue;
    if (k == c) k++;
    ans[ei] = k;
    k++;
    dfs(u, ans[ei], v);
  }
}

int main() {
  int n;
  cin >> n;
  g.resize(n);
  ans.resize(n - 1);
  rep(i, n - 1) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back((Edge){b, i});
    g[b].push_back((Edge){a, i});
  }
  dfs(0);
  int mx = 0;
  rep(i, n) mx = max(mx, (int)g[i].size());
  cout << mx << endl;
  rep(i, n - 1) cout << ans[i] << endl;
  return 0;
}

Measured memory_bytes: 10944
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using P = pair<ll, ll>;

// chmin, chmax関数
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

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

int main(){
    ll n,x;
    cin >> n >> x;
    VL a(n);
    rep(i,n) cin >> a[i];
    
    ll ans = 0;
    rep(i,n-1){
        if(a[i]+a[i+1] > x){
            ll diff = a[i] + a[i+1] - x;
            ans += diff;
            if(diff <= a[i+1]){
                a[i+1] -= diff;
            }else{
                diff -= a[i+1];
                a[i+1] = 0;
                a[i] -= diff;
            }
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024