akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int MAX_N = 1 << 20, BLKSIZ = 50;
const int P2 = 200003, P2R = 2;
const ll P = 998244353, PR = 3;

ll sq(ll x) { return x * x % P; }
ll qpow(ll a, ll b) { return b ? sq(qpow(a, b / 2)) * (b & 1 ? a : 1) % P : 1; }
ll inv(ll x) { return qpow(x, P - 2); }

ll omega[MAX_N], disc_log[P2], disc_pow[P2];

void NTT(ll A[], int n, int d = 1) {
    for (int i = 0, j = 0; i < n; i++) {
        if (i < j) swap(A[i], A[j]);
        for (int k = n / 2; (j ^= k) < k; k /= 2);
    }
    for (int i = 1; i < n; i *= 2) {
        ll u = omega[(MAX_N + d * MAX_N / (2 * i)) % MAX_N];
        for (int j = 0; j < n; j += 2 * i) {
            ll v = 1;
            for (int k = 0; k < i; k++) {
                ll a = A[j + k], b = A[j + k + i] * v % P;
                A[j + k] = (a + b) % P; A[j + k + i] = (a - b + P) % P;
                (v *= u) %= P;
            }
        }
    }
    if (d == -1) {
        ll inv_n = inv(n);
        for (int i = 0; i < n; i++) (A[i] *= inv_n) %= P;
    }
}

void init() {
    omega[0] = 1; omega[1] = qpow(PR, (P - 1) / MAX_N);
    for (int i = 2; i < MAX_N; i++) omega[i] = omega[i - 1] * omega[1] % P;
    disc_pow[0] = 1;
    for (int i = 1; i < P2; i++) disc_pow[i] = disc_pow[i - 1] * P2R % P2;
    for (int i = 0; i < P2 - 1; i++) disc_log[disc_pow[i]] = i;
}

void solve() {
    static ll A[MAX_N];
    ll ans = 0;
    int n; scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        ll a; scanf("%lld", &a);
        if (a) {
            ans -= a * a % P2;
            A[disc_log[a]]++;
        }
    }
    for (int i = 0; i < P2 - 1; i++) {
        if (A[i] > BLKSIZ) {
            for (int j = 0; j < P2 - 1; j++) {
                ans += A[i] * A[j] * (i == j ? 1 : 2) * disc_pow[(i + j) % (P2 - 1)];
            }
            A[i] = 0;
        }
    }
    NTT(A, MAX_N);
    for (int i = 0; i < MAX_N; i++)
        A[i] = sq(A[i]);
    NTT(A, MAX_N, -1);
    for (int i = 0; i < MAX_N; i++) {
        ans += A[i] * disc_pow[i % (P2 - 1)];
    }
    ans /= 2;
    printf("%lld\n", ans);
}

int main() {
    init();
    solve();
}

Measured memory_bytes: 23264
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 998244353;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd_calc(T a, T b){ if(b){ return gcd_calc(b, a % b); }else{ return a; }}
template<class T> T gcd(T a, T b){ if(a < b) swap(a, b); return gcd_calc(a, b); }
template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }
inline int at(int x, int k){ return (x >> k) & 1; }
random_device rnd;

int main(){
    int s;
    cin >> s;
    int now = s;
    set<int> nums;
    for(int i = 1; true; i++){
        if(nums.find(now) != nums.end()){
            cout << i << endl;
            return 0;
        }
        nums.insert(now);
        if(now % 2){
            now = 3 * now + 1;
        }else{
            now /= 2;
        }
    }
}


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;

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

    if (a < b)
    {
        int ans = b - a - W;
        if (ans < 0)
            cout << 0 << endl;
        else
            cout << ans << endl;
    }
    else
    {
        int ans = a - b - W;
        if (ans < 0)
            cout << 0 << endl;
        else
            cout << ans << endl;
    }

    return 0;
}

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

const int M = 1000000007;
int d[] = { 0, 1, 0, -1, 0 };
int dist[50][50][1 << 10][2];
int isup[50][50][1 << 10];

int main() {
    int w, h, s;
    cin >> w >> h;
    vector<string> m(h);
    int si, sj;
    for (int i = 0; i < h; ++i) {
        cin >> m[i];
        for (int j = 0; j < w; ++j) {
            if (m[i][j] == '%') {
                si = i;
                sj = j;
            }
        }
    }
    cin >> s;
    vector<vector<string>> ms(max(s, 1), vector<string>(h));
    for (int i = 0; i < s; ++i) {
        for (int j = 0; j < h; ++j) {
            cin >> ms[i][j];
        }
    }
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            if (m[i][j] == '#' || m[i][j] == '|') continue;

            for (int k = 0; k < (1 << s); ++k) {
                int up = m[i][j] == '^' || m[i][j] >= 'A' && m[i][j] <= 'Z';
                for (int l = 0; l < s; ++l)
                    if (((k >> l) & 1) && ms[l][i][j] == '*')
                        up ^= 1;

                isup[i][j][k] = up;
            }
        }
    }
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            for (int k = 0; k < (1 << s); ++k) {
                for (int l = 0; l < 2; ++l)
                    dist[i][j][k][l] = M;
            }
        }
    }
    queue<int> qi, qj, qs, qh;
    dist[si][sj][0][0] = 0;
    qi.push(si);
    qj.push(sj);
    qs.push(0);
    qh.push(0);
    while (!qi.empty()) {
        int pi = qi.front(), pj = qj.front(), ps = qs.front(), ph = qh.front();
        qi.pop();
        qj.pop();
        qs.pop();
        qh.pop();
        int dis = dist[pi][pj][ps][ph];
        if (m[pi][pj] == '&') {
            cout << dis << "\n";
            return 0;
        }
        if (m[pi][pj] == '|' && dist[pi][pj][ps][1 - ph] > dis + 1) {
            dist[pi][pj][ps][1 - ph] = dis + 1;
            qi.push(pi);
            qj.push(pj);
            qs.push(ps);
            qh.push(1 - ph);
        }
        else if (m[pi][pj] >= 'A' && m[pi][pj] <= 'Z' || m[pi][pj] >= 'a' && m[pi][pj] <= 'z') {
            int sw = (m[pi][pj] | 32) - 'a';
            int ts = ps ^ (1 << sw);
            int th = (ms[sw][pi][pj] == '*' ? 1 - ph : ph);
            if (dist[pi][pj][ts][th] > dis + 1) {
                dist[pi][pj][ts][th] = dis + 1;
                qi.push(pi);
                qj.push(pj);
                qs.push(ts);
                qh.push(th);
            }
        }
        for (int i = 0; i < 4; ++i) {
            int ti = pi + d[i], tj = pj + d[i + 1];
            if (m[ti][tj] != '#' && (m[ti][tj] == '|' || ph == isup[ti][tj][ps]) && dist[ti][tj][ps][ph] > dis + 1) {
                dist[ti][tj][ps][ph] = dis + 1;
                qi.push(ti);
                qj.push(tj);
                qs.push(ps);
                qh.push(ph);
            }
        }
    }
    cout << "-1\n";
    return 0;
}

Measured memory_bytes: 33128
/*#include<bits/stdc++.h>         //暴力:(
using namespace std;  
int getint()
{
	char c;
	int ans=0,k=1;
	while(c=getchar(),c>'9' || c<'0') if(c=='-') k=-1;
	while(ans=ans*10+c-'0',c=getchar(),c>='0' && c<='9');
	return ans*k;
}
const int N=2e6+5;
int a[N][2];
int n;
int work(int x,int y,int z)
{
	int t;
	if(x>y) t=x,x=y,y=t;
	if(y>z) t=y,y=z,z=t;
	return x>y?x:y; 
}
int main()
{
	freopen("pyramid.in","r",stdin);
	freopen("pyramid.out","w",stdout);
	scanf("%d",&n);
	int l=1,r=n*2-1;
	bool t=0,s;
	for(int i=1;i<=r;i++) cin>>a[i][t];
	for(int i=1;i<n;i++){
		s=!t;
		for(int j=l+i;j<=r-i;j++)
			a[j][s]=work(a[j-1][t],a[j][t],a[j+1][t]);
		t=!t;
	}
	cout<<a[n][s]<<endl;
}*/
#include<bits/stdc++.h>
using namespace std;
int getint()
{
	char c;
	int ans=0,k=1;
	while(c=getchar(),c>'9' || c<'0') if(c=='-') k=-1;
	while(ans=ans*10+c-'0',c=getchar(),c>='0' && c<='9');
	return ans*k;
}
const int N=2e6+5;
int n;
int a[N];
inline bool check(int k){
    if((a[n-1]<=k&&a[n]<=k)||(a[n]<=k&&a[n+1]<=k))return 1;
    if((a[n-1]> k&&a[n]> k)||(a[n]> k&&a[n+1]> k))return 0;
    for(int i=1;i<n-1;i++){
        if((a[n+i]<=k&&a[n+i+1]<=k)||(a[n-i]<=k&&a[n-i-1]<=k))return 1;
        if((a[n+i]> k&&a[n+i+1]> k)||(a[n-i]> k&&a[n-i-1]> k))return 0;
    }
    return a[1]<=k;
}
int main()
{
	scanf("%d",&n);
	int left=0,right=(n<<1)-1;
	for(int i=1;i<=right;i++) a[i]=getint();
	int mid;
	while(left<=right){
		mid=left+right>>1;
		if(check(mid)) right=mid-1;
		else left=mid+1;
	}
	printf("%d\n",left);
	
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;
typedef long double LD;

const LL inf = 1123456789;
std::vector<std::vector<LL>>G;
std::vector<LD>memo;
LL N, unable;

LD dp(LL v)
{
	if (v == N) return 0;
	if (memo[v] != -1) return memo[v];
	LD sum = 0, max = 0, res;
	for (LL u : G[v])
	{
		sum += dp(u) + 1;
		max = std::max(max, dp(u) + 1);
	}
	if (v == unable && G[v].size() >= 2) res = (sum - max) / (G[v].size() - 1);
	else res = sum / G[v].size();
	return memo[v] = res;
}

int main()
{
	LL M;
	in >> N >> M;
	std::vector<LL>s(M), t(M);
	rep(i, M) in >> s[i] >> t[i];

	G.resize(N + 1);
	rep(i, M) G[s[i]].push_back(t[i]);

	LD ans = inf;
	for (unable = 1; unable <= N; ++unable)
	{
		memo.clear();
		memo.resize(N + 1, -1.);
		ans = std::min(ans, dp(1));
	}

	out << std::fixed << std::setprecision(10);
	out << ans << std::endl;
}


Measured memory_bytes: 5376
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int X = sc.nextInt();
        int count = 0;
        for(int i = 0; i <= A; i++){
            for (int j = 0; j <= B; j++) {
                for (int k = 0; k <= C; k++) {
                    if(i * 500 + j * 100 + k * 50 == X){
                        count++;
                    }
                }

            }
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 23764
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <fstream>
#include <unordered_map>
#include <unordered_set>
#include <assert.h>
using namespace std;


#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>

ll a, b, n, ans = MINF;

void solve(ll x) {
	ans = max(ans, a * x / b - a * (x / b));
}

int main() {
	cin >> a >> b >> n;
	solve(n);
	if(n >= b - 1) solve(b - 1);
	cout << ans << endl;
}
 

Measured memory_bytes: 3636
def main():
    n = int(input())
    row0 = list(map(int, input().split()))
    row1 = list(map(int, input().split()))

    temp_max = 0
    for i in range(n):
        temp = sum(row0[:i+1]) + sum(row1[i:])
        temp_max = max(temp_max, temp)

    print(temp_max)


if __name__ == '__main__':
    main()


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

int  main()
{
    int n, m;
    cin>>n>>m;
    ll a1=((n-1)*n)/2;
    a1+=((m-1)*m)/2;
    cout<<a1<<endl;



    return 0;
}

Measured memory_bytes: 3564
n = int(input())
t,x,y=[0],[0],[0]
for _ in range(n):
    T,X,Y = map(int, input().split())
    t.append(T)
    x.append(X)
    y.append(Y)

can = True
for i in range(n):
    dt = t[i+1] - t[i]
    dist = abs(x[i+1]-x[i]) + abs(y[i+1]-y[i])
    if dist > dt:
        can = False
    elif dist%2 != dt%2:
        can = False
if can:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 11728
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n;
  cin >> n;
  vector<long long>a(n);
  for(int i=0;i<n;i++){
    cin >> a.at(i);
  }
  sort(a.begin(),a.end());
  bool judge=true;
  for(int i=0;i<n-1;i++){
    if(a.at(i)==a.at(i+1)){
      judge=false;
      break;
    }
  }
  if(judge){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
}


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

int main() {
  int n,k;
  cin >> n >> k;
  int ans=0;
  for(int i=0; i<n; i++){
    int h;
    cin >> h;
    if(h>=k) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
// AOJ 2663: RUPC
// 2018.1.3 bal4u@uu

#include <stdio.h>
#include <stdlib.h>

int a[300002]; long long sa[300002]; int sz;
int b[300002];
long long c[300002];

int cmp(int *a, int *b) { return *a - *b; }

//#define getchar_unlocked()  getchar()
int in()
{
	int n, c;
//	while ((c = getchar_unlocked()) < '0');
	c = getchar_unlocked();
	n = 0; do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

long long inl()
{
	int c; long long n;
//	while ((c = getchar_unlocked()) < '0');
	c = getchar_unlocked();
	n = 0; do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

int bsch(int x)
{
	int m, l = 0, r = sz;

    while (l < r) {
        m = (l + r) >> 1;
		if (a[m] == x) return m;
        if (a[m] < x) l = m + 1; else r = m;
    }
	return l-1;
}

int uniq(int *a, int n)
{
	int i, j, k;
	
	for (i = 0, j = 1; j < n; j++) {
		k = 1;
		while (j < n && a[j] == a[i]) j++, k++;
		if (j < n) {
			if (i == 0) sa[0] = (long long)a[0]*k;
			else        sa[i] = sa[i-1] + (long long)a[i]*k;
			if (++i != j) a[i] = a[j];
		}
	}
	if (i == 0) sa[0] = (long long)a[0]*k;
	else        sa[i] = sa[i-1] + (long long)a[i]*k; 
	return i+1;
}

int main()
{
	int n, m, i;
	long long s;

	n = in();
	for (i = 0; i < n; i++) a[i] = in();
	qsort(a, n, sizeof(int), cmp);
	sz = uniq(a, n);

	m = in();
	for (i = 0; i < m; i++) b[i] = in();
	for (i = 0; i < m; i++) c[i] = inl();

	for (i = 0; i < m; i++) {
		if (b[i] < a[0]) s = 0;
		else             s = sa[bsch(b[i])];

		puts(s >= c[i]? "Yes": "No");
	}
	return 0;
}




Measured memory_bytes: 8264
#include<stdio.h>

int main(void)
{
	int S;
	int h,m,s;
	scanf("%d",&S);
	h=S/3600;
	m=(S%3600)/60;
	s=(S%3600)%60;
	printf("%d:%d:%d\n",h, m, s);

	return 0;
} 


Measured memory_bytes: 2104
#include<bits/stdc++.h>
using namespace std;
const int N=200005;
int to[N],nxt[N],first[N],tot=1,n,u,v;
long long f[N],g[N],pr[N],su[N],p[N],ans[N],m;
inline void add(int u,int v) 
{
    to[tot]=v;
    nxt[tot]=first[u];
    first[u]=tot++;
    to[tot]=u;
    nxt[tot]=first[v];
    first[v]=tot++;
}
void dfs(int root,int fa) 
{
    int tot=0;
    f[root]++;
    for(int i=first[root];i;i=nxt[i])
    {
        if(to[i]!=fa) 
        {
            dfs(to[i],root);
            f[root]=f[root]*f[to[i]]%m;
        }
    }
    for(int i=first[root];i;i=nxt[i]) 
    	if(to[i]!=fa) 
    		p[++tot]=to[i];
    f[root]++;f[root]%=m;
    pr[0]=su[tot+1]=1;
    for(int i=1;i<=tot;i++) 
    	pr[i]=pr[i-1]*f[p[i]]%m;
    for(int i=tot;i>=1;i--) 
    	su[i]=su[i+1]*f[p[i]]%m;
    for(int i=1;i<=tot;i++) 
    	g[p[i]]=pr[i-1]*su[i+1]%m;
}
void dfs2(int root,int fa) 
{
    if(root==1) 
    	ans[root]=1;
    else 
    	ans[root]=(g[root]*ans[fa]+1)%m;
    for(int i=first[root];i;i=nxt[i])
        if(to[i]!=fa) 
        	dfs2(to[i],root);
}
int main() 
{
    scanf("%d%lld",&n,&m);
    for(int i=1;i<n;i++)
     {
        scanf("%d%d",&u,&v);
        add(u,v);
    }
    dfs(1,1);
    dfs2(1,1);
    for(int i=1;i<=n;i++) 
    	printf("%lld\n",ans[i]*(m+f[i]-1)%m);
    return 0;
}

Measured memory_bytes: 14976
#include <bits/stdc++.h>
using namespace std;
#define dbg(x) #x "=" << x << " "
#define fore(i,a,b) for(int i=a,gon=b;i<gon;++i)
#define pb push_back
#define F first
#define S second
typedef double lf;
typedef long long ll;
typedef pair<int, int> pii;

const int N = 1e5+1;
int fact[N] = {1};

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        //freopen("out.txt", "w", stdout);
    #else
        #define endl '\n'
    #endif
    int n, m, M = 1e9+7;
    cin >> n >> m;
    if (abs(n-m) > 1) {
        cout << "0\n";
        return 0;
    }
    fore(i,1,max(n, m)+1) {
        fact[i] = (1ll*i*fact[i-1]) % M;
    }
    int ans = (1ll*fact[n]*fact[m]) % M;
    if (n == m) ans = (ans*2) % M;
    cout << ans << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e18+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int N;
    cin >> N;
    vector<string>S(N);
    for(int i = 0; i < N; i++) {
        cin >> S[i];
    }
    int ans = 0;
    for(int i = 0; i < N; i++) {
        bool ok = true;
        for(int j = 0; j < N; j++) {
            for(int k = 0; k < N; k++) {
                if(S[j][k] != S[(k+i)%N][(j+N-i)%N]) {
                    ok = false;
                }
            }
        }
        if(ok) {
            ans++;
        }
    }
    cout << ans*N << endl;
}


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

#define int long long int
#define MOD 1000000007
const int N = 1E6 ;
bool isPrime[N] ;
vector<int> prime ;
void sieve()
{
    memset(isPrime, true, sizeof(isPrime)) ;
    isPrime[0] = isPrime[1] = false ;
    for(int i = 2 ; i * i < N ; i++)
    {
        if(isPrime[i])
        {
            for(int j = i * i ; j < N ; j += i)
            {
                isPrime[j] = false ;
            }
        }
    }
    for(int i = 2 ; i < N ; i++)
    {
        if(isPrime[i])
        {
            prime.push_back(i) ;
        }
    }
}

void solve()
{
    int x ;
    cin >> x ;
    cout << (prime[lower_bound(prime.begin(), prime.end(), x) - prime.begin()]) ;
}

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

    sieve() ;
    int t = 1 ;
    //cin >> t ;
    while(t--)
    {
        solve() ;
    }
    return 0 ;
}

Measured memory_bytes: 2552
#include<bits/stdc++.h> 
using namespace std; 
   
int countFreq(string &pat, string &txt) 
{ 
    int M = pat.length(); 
    int N = txt.length(); 
    int res = 0; 
    
    /* A loop to slide pat[] one by one */
    for (int i = 0; i <= N - M; i++) 
    {  
        /* For current index i, check for  
           pattern match */
        int j; 
        for (j = 0; j < M; j++) 
            if (txt[i+j] != pat[j]) 
                break; 
   
        // if pat[0...M-1] = txt[i, i+1, ...i+M-1] 
        if (j == M)   
        { 
           res++; 
           j = 0; 
        } 
    } 
    return res; 
} 
    
/* Driver program to test above function */
int main() 
{ 
   int n;string txt;
   cin>>n>>txt;
   string pat = "ABC"; 
   cout << countFreq(pat, txt); 
   return 0; 
} 

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<functional>
#include <string>
#include<iomanip>
#include<cstdio>
#include<math.h>
#include<set>
#include<stack>
#include<queue>
#include<cstring>
#include<vector>
typedef long long int ll;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define EREP(i,n) for(int i=(n-1);i>=0;--i)
#define D(n,retu) REP(i,n){cin>>retu[i];}
#define mod 1000000007
#define MIN -93193111451418101
#define INF 931931114518101
using namespace std;
typedef pair<ll, ll>P;
template<typename T>
void fill_all(T& arr, const T& v) {
	arr = v;
}
template<typename T, typename ARR>
void fill_all(ARR& arr, const T& v) {
	for (auto& i : arr) { fill_all(i, v); }
}
#define MAX_NUM 50
long long comb[MAX_NUM + 1][MAX_NUM + 1];

ll par[100000], depth[100000];
#define yo 100001
//------------------変数-----------------------//
ll d, n, t[300] = {}, dp[101][301][101] = {}, W;
P p[101] = {};
ll mini;
//-------------------関数----------------------//

ll DP(ll num,ll weight,ll hoge) {
	if (hoge*mini + weight > W) { return -INF; }
	if (num == n) { return 0; }
	if (dp[num][weight][hoge] >= 0) { return dp[num][weight][hoge]; }

	return dp[num][weight][hoge] = max(DP(num + 1, weight + p[num].first - mini,hoge+1) + p[num].second, DP(num + 1, weight,hoge));
}

int main() {
	cin >> n >> W;
	fill_all(dp, (ll)-1);
	REP(i, n) {
		ll w, v; cin >> w >> v;
		p[i].first = w; p[i].second = v;
	}
	sort(p, p + n);
	mini = p[0].first;
	cout << DP(0, 0, 0) << endl;
	return 0;
}




Measured memory_bytes: 24960
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,m,c;
  cin >> n >> m >> c;
  vector<int> b(m);
  vector<int> a(m);
  int ans =0;
  for(int i = 0;i<m;i++){
    cin >> b.at(i);
  }
  for(int i=0;i<n;i++){
    int sum = 0;
    for(int j =0;j<m;j++){
      cin >> a.at(j);
      sum += a.at(j)*b.at(j);
    }
    if((sum + c )> 0){
      ans +=1;
    }
  }
  cout << ans;
}

Measured memory_bytes: 256
#define _USR_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > > 
#define pq_pair_ts priority_queue <pair<ll,ll> > //第二成分の大きさが関係ない
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}

ld x[3];
ld y[3];
ld a[3];

ld dist[3];
ld angle[3];

ld caldist(ll index1, ll index2){
    return sqrt((x[index1] -x[index2])*(x[index1] - x[index2]) + (y[index1] - y[index2])*(y[index1]-y[index2]));
}

void inp(){
    rep(i,3){
        cin >> x[i] >> y[i] ;
    }
    


    rep(i,3){
        dist[i] = caldist((i+1)%3, (i+2)%3);
    }
    
    angle[0] = acos((pow(dist[1], 2) + pow(dist[2], 2) - pow(dist[0],2))/(2.0*dist[1] * dist[2]));
    angle[1] = acos((pow(dist[2], 2) + pow(dist[0], 2) - pow(dist[1],2))/(2.0*dist[2] * dist[0]));
    angle[2] = acos((pow(dist[0], 2) + pow(dist[1], 2) - pow(dist[2],2))/(2.0*dist[0] * dist[1]));
    
    rep(i,3){

        angle[i] = acos(
                            (
                             pow(dist[(i+1)%3],2)
                            +pow(dist[(i+2)%3],2)
                            -pow(dist[i],2)
                             )
                        /
                            (
                             2.0 * dist[(i+1)%3] * dist[(i+2)%3]
                            )
                        );
        angle[i] *= 0.5;
    }
    
}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    inp();
    
    ld ans = 0.0;
    
    rep(i, 3){
        ld ret =  1/tan(angle[(i+1)%3]) +  1/ tan( angle[(i+2)%3] ) + 2;
        ret = dist[i] / ret;
        
        
        ans = max(ret, ans);
    }
    
    cout << fixed << setprecision(16) << ans << endl;
    

    
    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new java.io.InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        StringTokenizer st = new StringTokenizer(br.readLine());

        int N = Integer.parseInt(st.nextToken());
        
        int ans = 0;

        for(int i = 1; i < N; i++) {    
            ans += (N-1) / i;
        }
        
        pw.println(ans);
        br.close();
        pw.close();
    }
}

Measured memory_bytes: 32804
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
const ll MOD=1000000007;
const long double PI=3.14159265358979;
const ll MAX=0;

vector<pair<long long,int>> PF(long long N){
  vector<pair<long long ,int>> ans(1,{0,0});
  long long n=N;
  for(int i=2;i<sqrt(n);i++){
    if(N%i==0){
      N/=i;
      if(ans.at(ans.size()-1).first==i){
        ans.at(ans.size()-1).second++;
      }
      else{
        ans.push_back({i,1});
      }
      i--;
    }
    if(N==1){
      break;
    }
  }
  if(N!=1){
    ans.push_back({N,1});
  }
  auto itr1=ans.begin();
  ans.erase(itr1);
  return ans;
}

int main() {
  ll N;
  cin>>N;
  vector<pair<long long,int>> A=PF(N);
  ll ans[A.size()];
  for(int i=0;i<A.size();i++){
    //cout<<A[i].first<<endl;
    ans[i]=A[i].second;
    
  }
  
  ll Ans=0;
  for(int i=0;i<A.size();i++){
    ll a=0;
    while(a*(a+1)/2<=ans[i]){
      a++;
    }
    Ans+=a-1;
  }
  cout<<Ans;
  
}

Measured memory_bytes: 3752
Q, H, S, D = map(int, input().split())
N = int(input())
ans = 0

if N >= 2:
    tmp = N // 2
    ans += (min(Q * 8, H * 4, S * 2, D) * tmp)
if N % 2 != 0:
    ans += min(Q * 4, H * 2, S)

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;

signed main(){
	int n; cin >> n;
	string s; cin >> s;
	int q; cin >> q;
	vector<set<int> > SET(26, set<int> {INF});
	for(int i = 0; i < n; i++) SET[s[i] - 'a'].insert(i);
	for(int i = 0; i < q; i++){
		int type; cin >> type;
		if(type == 1){
			int l; cin >> l; char c; cin >> c; --l;
			if(s[l] != c){
			  SET[s[l] - 'a'].erase(l);
			  SET[c - 'a'].insert(l);
			  s[l] = c;
			}
		}
		if(type == 2){
			int l, r; cin >> l >> r; --l;
			int c = 0;
			for(int j = 0; j < 26; j++){
				if(SET[j].empty()) continue;
				if(*SET[j].lower_bound(l) < *SET[j].lower_bound(r)) c++;
			}
			cout << c << endl;
		}
	}
}


Measured memory_bytes: 26244
#include <bits/stdc++.h>
#define ll long long int
//#define m 1000000007
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp> //required
// #include <ext/pb_ds/tree_policy.hpp>     //required
// using namespace __gnu_pbds;              //required
// using namespace std;
// template <typename T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

// ordered_set<int> s;
// ordered_set<int>::iterator itr;
// /* or:
// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// ordered_set s;
// This works in C++98 but the above version only works in C++11
// */
// //char str[10000000];
void swap(ll *xp, ll *yp)
{
    ll temp = *xp;
    *xp = *yp;
    *yp = temp;
}
int main()
{
    ll n, m;
    cin >> m >> n;
    ll arr[n];
    bool vis[102] = {0};
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i];
        vis[arr[i]] = 1;
    }
    ll minim1 = 1000000;
    ll ans = 0;

    for (int i = -30; i <= 101; i++)
    {
        if (vis[i])
            continue;
        else
        {
            if (fabs(m - i) < minim1)
            {
                minim1 = fabs(m - i);
                ans = i;
            }
        }
    }
    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 3628
n = int(input())
As = list(map(int, input().split()))

Alics_score = 0
Bob_score = 0

for _ in range(int(n/2)+1):
    if As == []:
        break
    Alics_score += max(As)
    As.remove(max(As))
    if As == []:
        break
    Bob_score += max(As)
    As.remove(max(As))

print(Alics_score - Bob_score)

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <climits>
typedef long long ll;
using namespace std;

const ll mod=1000000007;

int main(void){
  ll n,i,j,k,tmp;
  static ll dp[100010][13];

  string s;
  cin>>s;
  n=s.size();
  
  for(i=0;i<n+1;i++){
    for(j=0;j<13;j++){
      dp[i][j]=0;
    }
  }

  if(s[n-1]=='?'){
    for(i=0;i<10;i++){
      dp[1][i]=1;
    }
  }
  else{
    i=s[n-1]-'0';
    dp[1][i]=1;
  }

  tmp=10;
  for(i=2;i<=n;i++){
    if(s[n-i]=='?'){
      for(j=0;j<10;j++){
        for(k=0;k<13;k++){
          dp[i][(k+tmp*j)%13]+=dp[i-1][k];
          dp[i][(k+tmp*j)%13]%=mod;
        }
      }
    }
    else{
      j=(s[n-i]-'0');
      for(k=0;k<13;k++){
        dp[i][(k+tmp*j)%13]+=dp[i-1][k];
        dp[i][(k+tmp*j)%13]%=mod;
      }
    }
    tmp=(tmp*10)%13;
  }

  cout<<dp[n][5]<<endl;

  return 0;
}


Measured memory_bytes: 10624
#include<bits/stdc++.h>
//A:Frog 1

using namespace::std;

int cost(int a,int b){
	return abs(a - b);
}

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

	int N;
	cin >> N;

	vector<int> H(N + 1);
	for(int i = 1;i <= N;i++)
		cin >> H[i];

	vector<int> sol(N + 1);
	sol[2] = abs(H[2] - H[1]);
	for(int i = 3;i <= N;i++)
		sol[i] = min(sol[i - 1] + cost(H[i],H[i - 1]),sol[i - 2] + cost(H[i],H[i - 2]));

	cout << sol[N] << '\n';

	return 0;
}


Measured memory_bytes: 1024
//Md Fahad
// CSE 18

#include<bits/stdc++.h>

using  namespace  std;

#define PI              acos(-1.0)
#define lcm(a,b)        (a * (b / __gcd(a,b)))
#define en '\n'

#define READ_IN freopen("Input.txt","r",stdin);
#define READ_OUT freopen("Output.txt","w",stdout);
#define Infi                0x3f3f3f3f

const int fx[] = {+1,-1,+0,+0};                         // 4 X directions
const int fy[] = {+0,+0,+1,-1};                         // 4 Y directions
const int fx8[] = {+0,+0,+1,-1,-1,+1,-1,+1};            // King X Moves
const int fy8[] = {-1,+1,+0,+0,+1,+1,-1,-1};            // King Y Moves
const int kx[] = {-2, -2, -1, -1,  1,  1,  2,  2};      // Knight X Moves
const int ky[] = {-1,  1, -2,  2, -2,  2, -1,  1};      // Knight Y Moves



int  Set    (int N,int pos) {return N=N | (1<<pos);}    /// turn a bit on
int  reset  (int N,int pos) {return N= N & ~(1<<pos);}  /// turn a bit off
bool check  (int N,int pos) {return (bool)(N & (1<<pos));} /// check, if a bit is on or not

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define trace(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define trace(x...)
#endif

typedef long long int           ll;
typedef unsigned long long int  llu;


int main(void)
{
   //READ_IN;
    //READ_OUT;

    int n; cin >> n;

    vector<int> a(n);

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

    int even =0;
    int cnt=0;

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

        if(a[i]%2==0){
            even++;
        }

        if((a[i]%3==0 || a[i]%5==0) && a[i]%2==0){
            cnt++;
        }

    }

    //trace(even,cnt);

    if(even==cnt){
        cout <<"APPROVED" << endl;
    }
    else{
        cout << "DENIED" << endl;
    }


    return 0;
}



Measured memory_bytes: 256
void main() {
	auto ip = readAs!(int[]), x_1 = ip[0], y_1 = ip[1], x_2 = ip[2], y_2 = ip[3];
	auto dy = abs(y_2 - y_1), dx = abs(x_2 - x_1);

	if(x_1 < x_2) {
		if(y_1 > y_2) {
			p(x_2 + dy, y_2 + dx, x_1 + dy, y_1 + dx);
		} else {
			p(x_2 - dy, y_2 + dx, x_1 - dy, y_1 + dx);
		}
	} else {
		if(y_1 > y_2) {
			p(x_2 + dy, y_2 - dx, x_1 + dy, y_1 - dx);
		} else {
			p(x_2 - dy, y_2 - dx, x_1 - dy, y_1 - dx);
		}
	}
}

void p(int a, int b, int c, int d) {
	writefln("%d %d %d %d", a, b, c, d);
}
// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    int h[2], m[2], k;
    cin >> h[0] >> m[0] >> h[1] >>  m[1] >> k;
    int a, b;
    a = h[0] * 60 + m[0];
    b = h[1] * 60 + m[1];
    // if(a<=b){
    //     int x = b - k;
    //     int H, M;
    //     x -= a;

    // } 
    cout << b - a - k << endl;
    return 0;
}


Measured memory_bytes: 3624
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(g);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double PI = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef deque<ll> dll;
ll mod = 1e9 + 7;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);

	long long c[3][3], sum = 0, s1, s2;
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			cin >> c[i][j];
			sum += c[i][j];
		}
	}
	s1 = c[0][0] + c[1][1] + c[2][2];
	s2 = c[0][2] + c[1][1] + c[2][0];
	if (sum == s1 * 3 && sum == s2 * 3)
		puts("Yes");
	else
		puts("No");
	return 0;
}

Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.*;

public class Main {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {

        long start = System.nanoTime();

        int n = sc.nextInt();

        int[] a = new int[n];
        for (int i=0; i < n; i++)
            a[i] = sc.nextInt();

        List<Integer> gcd1 = new ArrayList<>();
        List<Integer> gcd2 = new ArrayList<>();

        gcd1.add(a[0]);
        gcd2.add(a[n-1]);
        for (int i=1; i < (n-1); i++) {
            gcd1.add(gcd(gcd1.get(i-1), a[i]));
        }
        for (int i=1; i < (n-1); i++) {
            gcd2.add(gcd(gcd2.get(i-1), a[n-1-i]));
        }

        // System.out.println("GCD took " + (System.nanoTime() - start)/1000000L + " ms");

        int max = 1;

        for (int i=0; i < n; i++) {
            if (i == 0)
                max = Math.max(max, gcd2.get(n-2));
            else if (i == n-1)
                max = Math.max(max, gcd1.get(n-2));
            else
                max = Math.max(max, gcd(gcd1.get(i-1), gcd2.get(n-2-i)));
        }

        System.out.println(max);

        long end = System.nanoTime();

        // System.out.println("Took " + (end - start)/1000000L + " ms");
    }

    public static int gcd(int a, int b) {
        BigInteger num1 = BigInteger.valueOf(a);
        BigInteger num2 = BigInteger.valueOf(b);

        return num1.gcd(num2).intValue();
    }

}


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

int main(int argc, char **argv) {
  int N;
  cin >> N;
  multimap<string, multimap<int, int, greater<int>> *> SP;
  multimap<int, int, greater<int>> *val;
  string tmpS, prevS = "";
  int tmpP, i;

  for (i = 0; i < N; i++) {
    cin >> tmpS >> tmpP;
    auto found = SP.find(tmpS);
    if (tmpS != prevS && found == SP.end()) {
      val = new multimap<int, int, greater<int>>();
      SP.insert(make_pair(tmpS, val));
    } else {
      if (found->second != val) {
        val = found->second;
      }
    }
    val->insert(make_pair(tmpP, i + 1));
    prevS = tmpS;
  }

  for (auto itr : SP) {
    val = itr.second;
    for (auto valitr : *val) {
      cout << valitr.second << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int inf = 1001001001;
 
int main(){

    long double a;
    long double b;
    cin >> a >> b;
    cout << (ll)(a*b)<< endl;
 
}

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

int main()
{
    int N; cin >> N;
    string S, T;
    cin >> S >> T;

    for (int i = 0; i < N; i++)
    {
        cout << S[i] << T[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int count = 0;
        for(int i = 0; i < s.length(); i++) {
            if(i % 2 == 0 && s.charAt(i) == 'L') {
                System.out.println("No");
                return;
            } else if(i % 2 != 0 && s.charAt(i) == 'R') {
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
}



Measured memory_bytes: 23636
#include<iostream>

using namespace std;

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

	float sum = 0;
	int a;
	for(int i=0; i<n; i++)
	{
		cin>>a;
		sum = sum + 1/(float)a;
	}

	sum = (float)1/sum;

	cout<<sum;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
    string s;
    cin>>s;
    if(s=="Sunny")
    {
        cout<<"Cloudy"<<endl;

    }
    else if(s=="Rainy")
    {
        cout<<"Sunny"<<endl;
    }
    else
    {
        cout<<"Rainy"<<endl;
    }
}


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

int main(){
    ll n,ans=0,m=1e18;
    cin >> n;
    for(int i = 0;i < 5;i ++){
        ll x;
        cin >> x;
        m = min(m,x);
    }
    ans = 4+n/m+(n%m?1:0);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);	
		
		Map<Integer, Integer> map = new HashMap<>();
		
		int n = sc.nextInt();
		for(int i = 1; i <= n; i++) {
		
		map.put(new Integer(sc.nextInt()), new Integer(i));
		}
		
		for(int i = 1; i <= n; i++) {		
			System.out.print(map.get(i)+ " ");
			}
		
	}
}


Measured memory_bytes: 73452
using System;
class Program
{
	static void Main()
	{
		for (int i = 0; i < 7; i++)//7回繰り返す
		{
		string 入力 = Console.ReadLine();//入力を一行読み込む
string[] 分割された文字列 = 入力.Split(' ');//スペースを基準に分割
int 最高気温 = int.Parse(分割された文字列[0]);//1つ目のデータint型にを変換
int 最低気温 = int.Parse(分割された文字列[1]);//2つ目のデータをint型に変換
Console.WriteLine(最高気温 - 最低気温);//最高気温と最低気温の差を画面に出力
}
	}
}

Measured memory_bytes: 5616
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int K = sc.nextInt();

    long ans = 0;
    int count =1;
    char prev='$';
    List<Integer> list = new ArrayList<>();
    for (int i = 0; i < S.length(); i++) {
      char c = S.charAt(i);
      if(c == prev){
        count++;
      }else{
        list.add(count);
        ans += count/2;
        count=1;
        prev=c;
      }
    }
    list.add(count);
    ans += count/2;

    ans = ans * K;

    if( (K > 1)
        && (S.charAt(0)==S.charAt(S.length()-1))
        && (list.get(1) % 2 == 1)
        && (list.get(list.size()-1) % 2 == 1)
      ){

      if(list.size()==2){
        ans += K/2;
      }else{
        ans += K-1;
      }
    }
    System.out.println(ans);
  }


}


Measured memory_bytes: 21844
/*
	Name:
	Author: xiaruize
	Date:
*/
#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD 1000000007
#define ALL(a) (a).begin(), (a).end()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define form(i,j,n) for(int i=int(j);i<=int(n);i++)
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define pis pair<int,string>
#define sec second
#define ll long long
#define fir first
#define sz(a) int((a).size())

signed main()
{
 	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
 	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
    string s;
    cin>>s;
    cout<<s;
    if(s[s.size()-1]=='s')
		cout<<"es"<<endl;
	else
		cout<<"s"<<endl;
	return 0;
}


Measured memory_bytes: 3644
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (n);i++)
using ll = long long;
const ll MOD=1000000007;
const double pi=acos(-1);





int main() 
{
  int N; cin>>N;
  vector<int> A(N);
  set<int> list;
  rep(i,N)
  {
    cin>>A.at(i);
    list.insert(A.at(i));
  }
  sort(A.begin(),A.end());
  
  
  vector<bool> judge(N,true);  
  rep(i,N)
  {
    if(i==0) {continue;}
    if(A.at(i)==A.at(i-1))
    {
      judge.at(i)=false;
      judge.at(i-1)=false;
    }
  }
  rep(i,N)
  {
    if(!(judge.at(i))) {continue;}
    int a=A.at(i);
    for(int j=1;j*j<=a;j++)
    {
      if(a%j==0)
      {
        if(a!=j&&list.count(j)) {judge.at(i)=false;}
        if(a/j!=a&&list.count(a/j)) {judge.at(i)=false;}
      }
    }
  }
  
  int ans=0;
  rep(i,N)
  {
    if(judge.at(i)) {ans++;}
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 13556
#include <bits/stdc++.h>
#define sz(arr) (int)(arr).size()
#define rng(arr) arr.begin(), arr.end()
#define show(x) cout << #x << " = " << x << endl;
#define rep(i, n) for (int i = 0; i < (n); ++i)

using namespace std;
typedef long long int ll;

void _cin() {}
template <class Head, class... Tail>
void _cin(Head&& head, Tail&&... tail) {
  cin >> head;
  _cin(forward<Tail>(tail)...);
}

#define Cin(T, ...) \
  T __VA_ARGS__;    \
  _cin(__VA_ARGS__)

#define Cins(T, n, xs) \
  vector<T> xs(n);     \
  for (int i = 0; i < n; ++i) cin >> xs[i]

void Main();
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(15);
  Main();
  return 0;
}

void Main() {
  Cin(string, s);

  bool ok = regex_match(s, regex("[A]?KIH[A]?B[A]?R[A]?"));
  cout << (ok ? "YES" : "NO") << endl;
}

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

using namespace std;

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

    map<string, int> mp;

    while(n--) {
        string s;
        cin >> s;
        mp[s]++;
    }

    cout << "AC x " << mp["AC"] << "\n";
    cout << "WA x " << mp["WA"] << "\n";
    cout << "TLE x " << mp["TLE"] << "\n";
    cout << "RE x " << mp["RE"] << "\n";
    return 0;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n); for(int i = 0;i < (int)(n);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
int main(){
    ll x;
    cin >> x;
    ll a = 100;
    int cnt = 0;
    while(a<x){
        a*=1.01;
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}

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

using ll = long long int;

const int MAX_N = (int)(2 * 1e5 + 5);

int n;
ll a[MAX_N], b[MAX_N];

ll ans;

int main(void){
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%lld", &(a[i]));
  }

  if (a[0] != 0) {
    printf("%d\n", -1);
    return 0;
  }

  for (int i = 1; i < n; ++i) {
    if (a[i] - a[i - 1] > 1) {
      printf("%d\n", -1);
      return 0;
    }
  }

  for (int i = 1; i < n; ++i) {
    if (a[i] == a[i - 1] + 1) {
      ans += 1;
    }
    else {
      ans += a[i];
    }
  }

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

  return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define loop(i,x,z) for (int i=x;i<z;i++)
using ll = long long;
int n, h[200002];
vector<int>neg[200002], ad[200002];
ll ans = 0;
int main()
{
	cin >> n;
	loop(i, 1, n+1)cin >> h[i];
	loop(i, 1, n + 1)
	{
		if (i + h[i] < 200002)ad[i + h[i]].push_back(i);
		if (i - h[i] > 0)neg[i - h[i]].push_back(i);
	}
	loop(i, 1, 200001)ans += ad[i].size() * neg[i].size();
	cout << ans;
}

Measured memory_bytes: 21792
#include<bits/stdc++.h>
#include<unordered_map>
#include<string>
#define ll long long
using namespace std;
const ll INF = 1LL << 60;
const int inf = 1 << 30;
const int N= 1e5 + 10;
inline void fastio()
{ 
     ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}


int main()
{
    string s;
    string abc = "ABC", arc = "ARC";
    cin >> s;
    string ans;
    ans = (s == abc) ? arc :abc;
    cout << ans;
    return 0;
}



Measured memory_bytes: 3620
/**
*   @Author : MeGaCrazy
*   @InitTime : Thu Jan 17 08:13:23 2019
*   @Idea :
*
*
*
*
*
*  Happy Solving :)
**/
#include <bits/stdc++.h>
using namespace std;
map<int,int>mp;
int main(){
#ifndef ONLINE_JUDGE
   //freopen("in","r",stdin);
   //freopen("out","w",stdout);
#endif

   int n;
   cin>>n;
   set<int>s;
   for(int i=0;i<n;i++){
   	int a;
   	cin>>a;
   	s.insert(a);
   	mp[a]++;
   }
   vector<pair<int,int> >v(s.size());
   for(auto a:s){
   	v.emplace_back(a,mp[a]);
   }
   sort(v.rbegin(),v.rend());
   long long ft=0,se=0;
   for(int i=0;i<v.size();i++){
   //	cerr<<v[i].first<<" "<<v[i].second<<endl;
   	if(ft!=0&&se!=0)break;
   	if(v[i].second <2)continue;
   	if(v[i].second >=4 && ft==0&&se==0){
   		cout<<1ll*v[i].first*v[i].first<<endl;
   		return 0;
   	}
   	if(v[i].second >=2){
   	        if(ft==0)ft=v[i].first;
   	        else if(se==0)se=v[i].first;
   	}
   }
   cout<<ft*se<<endl;


}

Measured memory_bytes: 11136