akhauriyash/Code-Regression huggingface dataset:
// IlyM

#include <bits/stdc++.h>
#define pb push_back
#define sp " "
#define sl "\n"
#define fi first
#define se second
#define mp make_pair
#define sz(a) ((int)a.size())
#define tra(a,b) for (auto a:b) 
#define fo(a,b,c) for (int a=b;a<=c;a++) 
#define ms(a,b) memset(a,b,sizeof(a)) 
#define all(a) a.begin(),a.end()
#define rev(a) reverse(a.begin(),a.end())
#define bit(i,j) (i&(1<<j))

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef pair<int,ii> iii;

const int N=2e5+5,mod=998244353;
string a;
int main()
{
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	cin>>a;
	if (a=="AAA" || a=="BBB") cout<<"No";
	else cout<<"Yes";
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned ll
#define db double
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PII pair<int, int>

const int MAXN=1000;
int n,a,b,c,d;
ll f[MAXN+10];
ll finv[MAXN+10];
ll dp[MAXN+10][MAXN+10];

ll qp(ll x,ll n) {
    ll ret=1;
    while (n) {
        if (n&1) ret=(ret*x)%MOD;
        n=n>>1;
        x=(x*x)%MOD;
    }
    return ret;
}

int main() {
    scanf("%d%d%d%d%d",&n,&a,&b,&c,&d);
    f[0]=finv[0]=1;
    for (int i=1;i<=MAXN;i++) {
        f[i]=(f[i-1]*i)%MOD;
        finv[i]=qp(f[i],MOD-2);
    }
    for (int i=0;i<=n;i++) dp[0][i]=1;
    for (int j=a;j<=b;j++) {
        for (int i=1;i<=n;i++) {
            ll accum=1;
            dp[i][j]=dp[i][j-1];
            for (int k=1;k<c;k++) accum=(accum*finv[j])%MOD;
            for (int k=c;k*j<=i&&k<=d;k++) {
                accum=(accum*finv[j])%MOD;
                ll co1=(((f[i]*finv[k*j])%MOD)*finv[i-k*j])%MOD;
                ll co2=(((f[k*j]*finv[k])%MOD)*accum)%MOD;
                ll co=(co1*co2)%MOD;//printf("co1:%lld co2:%lld co:%lld\n",co1,co2,co);
                dp[i][j]=(dp[i][j]+(co*dp[i-k*j][j-1])%MOD)%MOD;
            }
            //printf("i:%d j:%d val:%lld\n",i,j,dp[i][j]);
        }
    }
    printf("%lld\n",dp[n][b]);
}

Measured memory_bytes: 8192
n=int(input())
s=input()
B=s.count("B")
R=s.count("R")
G=s.count("G")
ans=R*G*B
for i in range(n-2):
    for j in range(i+1,n-1):
        k=j-i+j
        if k<n:
            if s[i]!=s[j] and s[j]!=s[k] and s[i]!=s[k]:
                ans-=1
print(ans)


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

using namespace std;

typedef long long ll;
typedef long double ld;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin>>n;
    vector<ld>v(n);
    ld med=0;
    for(int i=0;i<n;i++)
    {
        cin>>v[i];
        med+=v[i];
    }
    med/=(ld)n;
    ld mi=1e9;
    for(int i=0;i<n;i++)
    {
        mi=min(mi,fabs(med-v[i]));
    }
    for(int i=0;i<n;i++)
    {
        if(fabs(med-v[i])==mi)
        {
            cout<<i<<"\n";
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
n, m, x, y = map(int, input().split())
xs = input().split()
ys = input().split()

for i in range(n):
    xs[i] = int(xs[i])

for i in range(m):
    ys[i] = int(ys[i])

for i in range(x+1, y+1):
    if i > max(xs) and i <= min(ys):
        print("No War")
        exit()

print("War")


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

typedef vector<int> vi;  
typedef pair<int,int> ii;  
typedef vector<ii> vii;  
typedef list<int> li;  
typedef unordered_map<int,int> mii;

#define int long long
#define ll long long
#define rep(i,n) for (int i = 0; i < (n); i++)  
#define rrep(i,n) for (int i = (n)-1; i >= 0; i--)
#define rap(i,a,n) for (int i = a; i < (n); i++) 
#define rrap(i,n,a) for (int i = (n)-1; i >= a; i--) 

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,k,a,x;
    cin >> n >> k;
    vi v;
    rep(i,n) {
        cin >> a;
        v.push_back(a);
    }
    vi cost;
    cost.assign(n,10000000000000);
    cost[0] = 0;
    rap(i,1,n) {
        rap(j,i-k,i) {
            if (j < 0) continue;
            x = cost[j] + abs(v[j] - v[i]);
            if (x < cost[i]) cost[i] = x;
        }
    }

    cout << cost[n-1] << '\n';

    return 0;

    //compile: g++ -std=c++14 -O2 -Wall NAME.cpp -o NAME
}

Measured memory_bytes: 1144
from sys import exit
# A,B,C = [int(n) for n in input().split()]
# N = int(input())
# a = [int(input()) for _ in range(N)]
S = str(input())
# L = len(S)
# T = str(input())
# exit()
print(S[:3] + "8" + S[4:])

Measured memory_bytes: 2940
$n = <>;
$first = 1;

for (1..$n) {
    $_ = <>;
    my %hash;
    chomp;
    @a = split('');
    for (@a) {
        $hash{$_}++;
    }
    if ($first) {
        %glbl = %hash;
    } else {
        for (keys %glbl) {
            if ($glbl{$_} > $hash{$_}) {
                $glbl{$_} = $hash{$_};
            }
        }
    }
    $first = 0;
}
for (sort(keys %glbl)) {
    print $_ x $glbl{$_};
}
print "\n";

Measured memory_bytes: 512
#include<iostream>

using namespace std;

int main(){
    int n,f,b,c1=0,c2=0;
    cin>>n;
    f=n/100;
    b=n%100;
    if(0<b&&b<13)c1=1;
    if(0<f&&f<13)c2=1;
    if(c1==1&&c2==1)cout<<"AMBIGUOUS";
    else if(c1==1)cout<<"YYMM";
    else if(c2==1)cout<<"MMYY";
    else cout<<"NA";
    cout<<endl;
	return 0;
}


Measured memory_bytes: 256
fun main() = Thread(null, ::aising2020a, "(^o^)", 128 * 1024 * 1024).apply { start() }.join()

@OptIn(ExperimentalStdlibApi::class)
fun aising2020a() {
    val (l, r, d) = readLine()!!.split(' ').map { it.toInt() }

    val answer = (l..r).count { it % d == 0 }

    println(answer)
}


Measured memory_bytes: 36776
MAX_INT = 100

N = int(input())
a = list(map(int,input().split()))

dp = [[0]*(N) for i in range(N+1)]

if  N%2 == 0:
  hand = 0
else:
  hand = 1

for i in range(N):
  if hand == 0:
    dp[i][i] = -a[i]
  else:
    dp[i][i] = a[i]
  
for i in range(1,N+1):
  for j in range(N+1):
    if i+j < N:
      if (hand+i)%2 == 1: # 先手
        dp[j][i+j] = max(dp[j][i+j-1]+a[i+j],dp[j+1][i+j]+a[j])
      else:
        dp[j][i+j] = min(dp[j][i+j-1]-a[i+j],dp[j+1][i+j]-a[j])
    else:
      break  
print(dp[0][-1])

Measured memory_bytes: 114268
fn main() {
    let v = read_vec::<i32>();
    let x = v[0];
    let t = v[1];
    println!("{}", std::cmp::max(x - t, 0));
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


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

using namespace std;

#define MAX_V 100010
#define INF 1e9
typedef vector<int> Vec;

Vec G[MAX_V],ap;
int V,E;
int ord[MAX_V],low[MAX_V];

void init(){
    for(int i = 0 ; i < V ; i++){
        G[i].clear();
        ord[i] = -1; low[i] = INF;
    }
}

void dfs(int v,int prev,int &k){
    ord[v] = low[v] = k++;
    int cnt = 0;
    bool isAri = false;
    for(int i = 0 ; i < (int)G[v].size() ; i++){
        int to = G[v][i];
        if(to == prev) continue;
        if(ord[to] == -1){
            cnt++;
            dfs(to, v, k);
            low[v] = min(low[v], low[to]);
            if(prev >= 0 && ord[v] <= low[to]){
                isAri = true;
            }
        }
        low[v] = min(low[v], ord[to]);
    }
    if(prev == -1 && cnt >= 2) isAri = true;
    if(isAri) ap.push_back(v);
}

int main(){
    int s,t;
    cin >> V >> E; init();
    for(int i = 0 ; i < E ; i++){
        cin >> s >> t;
        G[s].push_back(t);
        G[t].push_back(s);
    }
    int k = 0;
    for(int i = 0 ; i < V ; i++){
        dfs(i, -1, k);
    }
    sort(ap.begin(),ap.end());
    for(int i = 0 ; i < (int)ap.size() ; i++){
        cout << ap[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 5072
#include <iostream>
#include<algorithm>
#include<math.h>
using namespace std;
int main() {
	int h;
	int w;
	char a[102][102];
	cin >> h;
	cin >> w;
	int b[102] = {};
	int c[102] = {};
	for (int i = 1; i < h + 1; i++) {
		for (int t = 1; t < w + 1; t++) {
			cin >> a[i][t];
			if (a[i][t] == '#') {
				b[i] = 1;
				c[t] = 1;
			}
		}

	}
	for (int i = 1; i < h + 1; i++) {
		for (int t = 1; t< w + 1; t++) {
			if (b[i] == 0)break;
			if (c[t] == 1)cout << a[i][t];
			if (t == w)cout << "\n";
		}

	}

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9+7;
struct edge{ll x,y;};
struct huga{ll honest; bool done;};

int main(){
    int n;
    cin >> n;
    vector<int>s;
    ll a[n];
    ll all[60];
    ll bi[60];
    ll cu = 1;
    for(int i = 0; i < 60; i++){
        bi[i] = cu;
        cu *= 2;
        all[i] = 0;
    }
    for(int i = 0; i < n; i++){
        ll temp;
        cin >> temp;
        vector<int>s;
        while(temp){
            s.push_back(temp%2);
            temp = temp / 2;
        }
    //reverse(begin(s),end(s));
        int nagasa = s.size();
        for(int i = 0; i < nagasa; i++){
            //all[i] = s[i];
            if(s[i] == 1){
                all[i]++;
            }
        }
    
    //a[i] = temp;
    }
    ll ans = 0;
    for(int i = 0; i < 60; i++){
        ll temp1,temp2;
        temp1 = all[i] * (n-all[i]) % mod;
        temp2 = bi[i] % mod;
        ans += temp1 * temp2 % mod;
      ans = ans % mod;
    }
    /*for(int i = 0; i < n; i++){
    for(int j = i+1; j < n; j++){
      ll temp = a[i] ^ a[j] ;//% mod;
    ans += temp;
    ans %= mod;
    }
    }*/

    cout << ans << endl;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);++i)
#define fi first
#define se second
#define INF 1000000009
#define lINF 1000000000000000009
typedef long long ll;

int main(){
  int n;
  cin>>n;
  cout<<(n+2-1)/2<<endl;
  return(0);
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
#include <string>
#include <vector>
#include <algorithm>
#include <map>
typedef long long ll;
#include <cmath>
#include <queue>

const int MAX = 1000000000;
const int MOD = 1000000007;


ll POWER(ll x,ll y)
{
	ll ret=1;
	ll p=x;
	for (ll i=y;i>0;i/=2)
	{
		if (i%2) ret=(ret*p)%MOD;
		p=(p*p)%MOD;
	}
	return ret;
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
	
	ll r=1;
	for (int i=0;i<k;i++)
	{
		r =(((r*(n-i))%MOD)*POWER(i+1,1000000005))%MOD;
	}
	return r;
}


int main(int argc, char *argv[])
{
	ll n,a,b;
	cin>>n>>a>>b;

	ll ret=POWER(2,n);
	ret--;
	cerr<<ret<<endl;
	ll t=COM(n,a);
	cerr<<t<<endl;
	ret=(ret+(MOD-t)%MOD)%MOD;
	t=COM(n,b);
	cerr<<t<<endl;
	ret=(ret+(MOD-t)%MOD)%MOD;

	cout<<ret<<endl;
	return 0;
}


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

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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

int dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int main(){
    int n; cin >> n;
    vector<int> lis(n), plis(n), qlis(n);
    REP(i, 0, n){lis[i] = i + 1;}
    REP(i, 0, n){cin >> plis[i];}
    REP(i, 0, n){cin >> qlis[i];}
    int a, b, count = 0;
    do{
        count++;
        REP(i, 0, n){
            if(lis[i] != plis[i]){
                break;
            }
        }
        a = count;
    }while(next_permutation(ALL(plis)));
    count = 0;
    do{
        count++;
        REP(i, 0, n){
            if(lis[i] != qlis[i]){
                break;
            }
        }
        b = count;
    }while(next_permutation(ALL(qlis)));
    cout << abs(a-b) << endl;
}

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

int main(){
  int64_t A, B, K;
  cin >> A >> B >> K;
  for(int i=0; i<K; i++){
    if(i%2==0){
      A=2*(A/2);
      B+=A/2;
      A/=2;
    }
    else{
      B=2*(B/2);
      A+=B/2;
      B/=2;
    }
  }
  cout << A << " " << B << endl;
}

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

using namespace std;

int N;
long long int H[100005];

int main(void) {

	cin >> N;

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

	string ans = "Yes";

	for (int i = 1; i <= N; i++) {
		if (H[i - 1] > H[i]) { ans = "No"; }
		else if (H[i - 1] < H[i]) { H[i]--; }
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

class Main {
	public static void main(String[] args) throws Exception {
		int n = new Scanner(System.in).nextInt();
		int i=1;
		do{
			int x=i;
			if(x%3==0){
				System.out.print(" "+i);
			}else{
				if(x/1000==3||x%1000/100==3||x%1000%100/10==3||x%1000%100%10==3||
					x/100==3||x%100/10==3||x%100%10==3||x/10==3||x%10==3){
					System.out.print(" "+i);
				}
			}
		}while(++i<=n);
		System.out.println("");
	}
}

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

int main()
{

    long long  i,n=0,k=0,l,c=0;
     string s;
     cin>>s;
     for(i=0;i<s.size();i++)
     {
        if(s[i]==',') cout<<" ";
        else cout<<s[i];

     }
      cout<<endl;
  return 0;
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1e9+7

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    ll k,x,i;
    cin>>s;
    cin>>k;
    for(i=0;i<s.length();i++){
        if(s[i]=='a')continue;
        x='z'-s[i];
        x++;
        if(x<=k){
            k-=x;
            s[i]='a';
        }
        if(k==0)break;
    }

    if(k==0){
        cout<<s<<endl;
        return 0;
    }

    k=k%26;

    int flag=0;
    for(i=s.length()-1;i>=0;i--){
        if(s[i]=='a')continue;
        s[i]+=k;
        flag=1;
        break;
    }

    ll n;
    n=s.length()-1;
    if(flag==0){
        s[n]+=k;
    }
    cout<<s<<endl;

    return 0;
}



Measured memory_bytes: 592
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define inf 1e10
#define mod 1000000007
#define mii map<int,int>
#define pii pair<int,int>
#define setbits(x) __builtin_popcountll(x)
#define lcm(x,y)  (x*y)/__gcd(x,y)
void c_p_c()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#ifndef  ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
int  fact(int n)
{
	if (n == 0 || n == 1)
		return 1;
	else
		return n * fact(n - 1);
}
int nCr(int n, int r)
{
	if (r == 0)
		return 1;
	else
		return fact(n) / (fact(n - r) * fact(r));
}
int floorRoot5(int n)
{
	// Base cases
	if (n == 0 || n == 1)
		return n;

	// Initialize result
	int res = 0;

	// Keep incrementing res while res^5 is
	// smaller than or equal to n
	while (res * res * res * res * res <= n)
		res++;

	// Return floor of 5'th root
	return res - 1;
}

int32_t main()
{
	//c_p_c();
	int n;
	cin >> n;
	int a[n];
	int i;
	for (i = 0; i < n; i++)
		cin >> a[i];
	sort(a, a + n);
	cout << a[n / 2] - a[(n / 2) - 1];

}



Measured memory_bytes: 1024
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <limits.h>
#include <cmath>
#include <queue>
#include <map>
#include <iomanip>
#include <random>
#include <fstream>
#define rep(i, n) for (int i = 0; i < n; i++)
#define pi 3.14159265358979323846
using namespace std;
typedef long long ll;

ll gcd(ll a, ll b)
{
  ll r;
  while ((r = a % b))
  {
    a = b;
    b = r;
  }
  return b;
}

int main()
{

  string s; cin >> s;
  if (s > "2019/04/30"){cout << "TBD" << endl;}
  else {cout << "Heisei" << endl;}

  return 0;
}


Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
import Control.Monad

main :: IO ()
main = do
  (n:m:_) <- fmap (map read . words) getLine :: IO [Int]
  lrs <- replicateM m $ (\(a:b:_) -> (a,b)) . map read . words <$> getLine :: IO [(Int, Int)]
  print $ solve n lrs

solve n lrs = max 0 $ rmin - lmx + 1
  where 
    lmx = maximum $ map fst lrs
    rmin = minimum $ map snd lrs

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

int main() {
  int h, n;
  cin >> h >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  cout << (h <= accumulate(a.begin(), a.end(), 0) ? "Yes" : "No") << endl;
}


Measured memory_bytes: 640
/*
ID: toooooEasy or RafaelSaddatimov
PROG:
*/
#include <bits/stdc++.h>
#define MAX 100005
#define MAXN 100005
#define MOD 1000000007
#define INF 21000000
#define EPS 1e-5
#define ll long long
#define F first
#define S second
#define all(a) a.begin(), a.end()
#define pb push_back
#define io ios_base::sync_with_stdio(false); cin.tie(0)
using namespace std;


int main() {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    printf("%d\n", max(a, max(b,c)) - min(a, min(b, c)));
}


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

using namespace std;

int main(){
  int n,x,a,b,c;
  cin >> n;
  vector <vector<int>> dp(n,{0,0,0});
  for(int i=0;i<3;i++){
    cin >> x;
    dp[0][i]=x;
  }
  for(int i=0;i<n-1;i++){
    cin >> a >> b >> c;
    dp[i+1][0]=max(dp[i][1]+a,dp[i][2]+a);
    dp[i+1][1]=max(dp[i][0]+b,dp[i][2]+b);
    dp[i+1][2]=max(dp[i][0]+c,dp[i][1]+c);
    }
  cout << max(max(dp[n-1][0],dp[n-1][1]) , dp[n-1][2]) << endl;
  return 0;
  }

Measured memory_bytes: 5760
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<typename T> bool chmax(T &a,T b) {if(a<b) {a=b; return true;} return false;}
template<typename T> bool chmin(T &a,T b) {if(a>b) {a=b; return true;} return false;}
#define itn int
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>=1;i--)
#define all(vec) vec.begin(),vec.end()
#define sortt(vec) sort((vec).begin(),(vec).end())
#define rsort(vec) sort((vec).rbegin(), (vec).rend())
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> tlll;
typedef tuple<int,int,int> tiii;
const ll mod=1e9+7;
const int inf=2e9;
const ll lnf=9e18;

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

int dp[1000010];

int main(){
  int n; cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  rep(i,n) dp[a[i]]++;
  bool f1=1;
  for(int i=2;i<=1000000;i++){
    itn cnt=0;
    for(int j=i;j<=1000000;j+=i){
      cnt+=dp[j];
      if(cnt>=2) f1=0;
    }
  }
  if(f1){
    cout << "pairwise coprime" << endl;
    return 0;
  }
  ll GCD=a[0];
  rep(i,n){
    GCD=gcd(GCD,a[i]);
  }
  if(GCD==1){
    cout << "setwise coprime" << endl;
    return 0;
  }
  cout << "not coprime" << endl;
}

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

#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORC(i,a,b,c) for(ll i=(a);i<(b);i+=(c))
#define pb(x) push_back(x)
#define ff first
#define ss second
#define F first
#define S second
#define MAX 1000003

typedef long long ll;
const ll mod = 1000000007;

ll prime[MAX];
unordered_map<ll, ll> max_map;

// Function to return a^n
ll power(ll a, ll n)
{
    if (n == 0)
        return 1;
    ll p = power(a, n / 2) % mod;
    p = (p * p) % mod;
    if (n & 1)
        p = (p * a) % mod;
    return p;
}

// Function to find the smallest prime factors
// of numbers upto MAX
void sieve()
{
    prime[0] = prime[1] = 1;
    for (ll i = 2; i < MAX; i++) {
        if (prime[i] == 0) {
            for (ll j = i * 2; j < MAX; j += i) {
                if (prime[j] == 0) {
                    prime[j] = i;
                }
            }
            prime[i] = i;
        }
    }
}

// Function to return the LCM modulo M
ll lcmModuloM(const ll* ar, ll n)
{

    for (ll i = 0; i < n; i++) {
        ll num = ar[i];
        unordered_map<ll, ll> temp;

        // Temp stores mapping of prime factor to
        // its power for the current element
        while (num > 1) {

            // Factor is the smallest prime factor of num
            ll factor = prime[num];

            // Increase count of factor in temp
            temp[factor]++;

            // Reduce num by its prime factor
            num /= factor;
        }

        for (auto it : temp) {

            // Store the highest power of every prime
            // found till now in a new map max_map
            max_map[it.first] = max(max_map[it.first], it.second);
        }
    }

    ll ans = 1;

    for (auto it : max_map) {

        // LCM is product of primes to their highest powers modulo M
        ans = (ans * power(it.F, it.S)) % mod;
    }

    return ans;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    sieve();
    ll n;
    cin>>n;
    ll arr[n];
    REP(i,n){
        cin>>arr[i];
    }
    ll ans=lcmModuloM(arr, n);
    ll sum=0;
    REP(i,n){
        sum=(sum+(ans%mod*power(arr[i],mod-2))%mod)%mod;
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 8576
(R,C,K),*RCV = $<.map{|ln| ln.split.map(&:to_i) }

Rs = Array.new(R){ [] }
RCV.each{|s,d,v|
	Rs[s-1] << [d-1,v]
}

r0 = [0]*C
while r = Rs.shift
	r.empty? and next or r.sort!

	c0,vs = 0,[0]*4
	until r.empty?
		c,v = r.shift
		r0c = r0[c0..c].max
		vs[0] = r0c if vs[0] < r0c
		vs[3] = vs[2]+v if vs[3] < vs[2]+v
		vs[2] = vs[1]+v if vs[2] < vs[1]+v
		vs[1] = vs[0]+v if vs[1] < vs[0]+v
		r0[c] = vs.max
		c0 = c+1
	end
end

p r0.max


Measured memory_bytes: 189192
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF          1e9
#define INFLL        1e18
#define EPS          1e-9
#define MOD          1000000007
#define REP(i,n)     for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)    for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)    for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)   for(ll i=(n);i>0;--i)
#define REPC(i,obj)  for(auto i:obj)
#define ALL(obj)     (obj).begin(),(obj).end()
#define SETP(n)      cout<<fixed<<setprecision(n)
#define VV(T,h,w)    move(vector<vector<T>>(h,move(vector<T>(w))))
#define VVI(T,h,w,i) move(vector<vector<T>>(h,move(vector<T>(w,i))))
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

int main()
{
	ll a = in(), b = in(), c = in();
	cout << (a + b == c || b + c == a || c + a == b ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
import java.io.PrintWriter
import java.util.*
import java.math.*
import java.lang.*

val pw = PrintWriter(System.out)
val MOD: Long = (1e+9 + 7).toLong()

fun main(args: Array<String>) {
    val (a, b) = readListOfString()
    val n = (a + b).toInt()
    val isSquare = isDecimal(Math.sqrt(n.toDouble())).not()

    println(if(isSquare) "Yes" else "No")
    pw.flush()
}

/****** Decrared Functions and Data Structures ******/
// IO
fun read() = readLine()!!
fun readInt() = read().toInt()
fun readLong() = read().toLong()
fun readDouble() = read().toDouble()
fun readListOfString() = read().split(" ")
fun readListOfInt() = readListOfString().map { it.toInt() }
fun readListOfLong() = readListOfString().map { it.toLong() }
fun readListOfDouble() = readListOfString().map { it.toDouble() }

fun Double.format(digits: Int) = String.format("%.${digits}f", this)

fun print(value: Any) { pw.print(value) }
fun println(value : Any) { pw.println(value) }

fun<T> permutations(src: List<T>): List<List<T>> {
    if(src.size == 1) return listOf(src)
    val perms = mutableListOf<List<T>>()
    val insertElement = src[0]
    permutations(src.drop(1)).forEach { perm ->
        for(i in 0..perm.size) {
            val newPerm = perm.toMutableList()
            newPerm.add(i, insertElement)
            perms.add(newPerm.toList())
        }
    }
    return perms
}

// return nCr, if you want nCr, please access v[n][r]
fun combinations(n: Long): List<List<Long>> {
    val v = (0..n).map { (0..n).map{0L}.toMutableList() }.toMutableList()
    for(i in 0 until v.size) {
        v[i][0] = 1L
        v[i][i] = 1L
    }
    for(i in 0 until v.size) {
        for(j in 1 until i) {
            v[i][j] = (v[i-1][j-1] + v[i-1][j] % MOD)
        }
    }
    val rtn = v.map { it.toList() }.toList()
    return rtn 
}

fun gcd(a: Long, b: Long): Long = 
if(b != 0L) a else gcd(b, a % b)

fun lcm(a: Long, b: Long) = 
if(b==0L) a else gcd(b, a % b)

fun sumDigits(num_: Long): Long {
    var num = num_
    var rtn: Long = 0
    while(num != 0.toLong()) {
        val tmp = num % 10
        rtn += tmp
        num /= 10
    }
    return rtn
}

fun isDecimal(v: Double): Boolean = ((v - Math.floor(v)) != 0.0)

// Data Structures
class Stack<T>(private var st: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = st.isEmpty()
    fun top(): T = st.last()
    fun push(e: T) { st.add(e) }
    fun pop() { st = st.dropLast(1).toMutableList() }
}

class Queue<T>(private var que: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = que.isEmpty()
    fun top(): T = que.first()
    fun push(e: T) { que.add(e) }
    fun pop() { que = que.drop(1).toMutableList() }
}


Measured memory_bytes: 36004
#include<bits/stdc++.h>
#define int long long int
#define ull unsigned long long
#define vii vector <int>
#define pii pair <int, int>
#define fi first
#define se second
#define rep(i,a,n)		for(int i=a;i<n;i++)
#define endl '\n'
#define mem(a,b) memset(a, b, sizeof a)
#define mod 1000000007LL;
#define mkp make_pair
#define pb push_back
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
using namespace std;
double pi=3.1415926535;
double eps=0.000001;

void print(vii &arr){
	for(int i=0;i<arr.size();i++)
		cout<<arr[i]<<" ";
	
	cout<<endl;
}
int binexpmod(int a,  int b){
    int res =1;
    while(b>0){
        if(b&1){
            res = res * a % mod;
        }
        a = a * a % mod;
        b>>=1;
    }
    return(res);
}

int32_t main(){
/////////////////////////////////////////////////////////////////////
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cerr.tie(NULL);
//For fast IO
///////////////////////////////////////////////////////////////////// 
//	std::cout.unsetf ( std::ios::floatfield );  // floatfield not set
//    std::cout.precision(10);
	string s1, s2,s3="";
	cin>>s1>>s2;
	int n1=s1.size(), n2=s2.size();
	int dp[n2+1][n1+1];
	mem(dp,0);
	char trace[n2+1][n1+1];
	mem(trace, 'o');
	rep(i,1,n2+1){
		rep(ii,1,n1+1){
			if(s2[i-1]==s1[ii-1]){
				dp[i][ii]+=dp[i-1][ii-1]+1;
				trace[i][ii]='d';
			} 
			else if(dp[i][ii-1]!=dp[i-1][ii]){
				 dp[i][ii]=max(dp[i][ii-1], dp[i-1][ii]);
				 if(dp[i][ii-1]>dp[i-1][ii]) trace[i][ii]='l';
				 else trace[i][ii]='u';
			}
			else{
				 dp[i][ii]=dp[i][ii-1];
				 trace[i][ii]='l';
			}
		}
	}

//	rep(i,0,n2+1){
//		rep(ii,0,n1+1) cout<<dp[i][ii]<<"  ";
//		cout<<endl;
//	}
//	cout<<"Trace: "<<endl;
//	rep(i,0,n2+1){
//		rep(ii,0,n1+1) cout<<trace[i][ii]<<"  ";
//		cout<<endl;
//	}
	int i2=n2, i1=n1;
	while(trace[i2][i1]!='o'){
		if(trace[i2][i1]=='d'){
			s3+=s2[i2-1];
			i2--;
			i1--;
		}
		else if(trace[i2][i1]=='u'){
			i2--;
		}
		else if(trace[i2][i1]=='l'){
			i1--;
		}
	}
	reverse(s3.begin(), s3.end());
	cout<<s3<<endl;
 	return 0;
	}
	


Measured memory_bytes: 79488
import java.util.Scanner;

class Main{
	static int[][] dp;




	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int N = sc.nextInt();
		int h = sc.nextInt();
		int w = sc.nextInt();
		int ans =(N-h+1)*(N-w+1);
		System.out.println(ans);
		
	}


}







class Pair implements Comparable{
	int from;		//p
	int end;		//y
	int num;
	int bango;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}



Measured memory_bytes: 23764
class UnionFindTree:
    def __init__(self, N):
        self.root = [i for i in range(N + 1)]
        self.friendcount = [1] * (N + 1)

    def getroot(self, x):
        node = self.root[x]
        if node == x:
            return x
        self.root[x] = self.getroot(node)
        return self.root[x]

    def unite(self, x, y):
        xroot = self.getroot(x)
        yroot = self.getroot(y)
        if xroot == yroot:
            return
        if xroot > yroot:
            self.root[xroot] = yroot
            self.friendcount[yroot] += self.friendcount[xroot]
        else:
            self.root[yroot] = xroot
            self.friendcount[xroot] += self.friendcount[yroot]

    def getfriendcount(self, x):
        xroot = self.getroot(x)
        return self.friendcount[xroot]

    def same(self, x, y):
        if self.getroot(x) == self.getroot(y):
            return True
        return False


N, M, K = map(int, input().split())
A = [0] * M
B = [0] * M
C = [0] * K
D = [0] * K

for i in range(M):
    A[i], B[i] = map(int, input().split())
for i in range(K):
    C[i], D[i] = map(int, input().split())

tree = UnionFindTree(N + 1)
for i in range(M):
    tree.unite(A[i], B[i])

friendscount = [0] * (N + 1)
blockcount = [0] * (N + 1)
for i in range(M):
    friendscount[A[i]] += 1
    friendscount[B[i]] += 1
for i in range(K):
    if tree.same(C[i], D[i]):
        blockcount[C[i]] += 1
        blockcount[D[i]] += 1

result = [str(tree.getfriendcount(i) - 1 - friendscount[i] - blockcount[i]) for i in range(1, N + 1)]
print(" ".join(result))


Measured memory_bytes: 33072
local a = {}
local c = {}
for i = 1, 9 do
  a[i] = io.read("*n")
  c[i] = false
end
local n = io.read("*n")
for i = 1, n do
  local b = io.read("*n")
  for j = 1, 9 do
    if a[j] == b then
      c[j] = true
    end
  end
end
local f = false
if c[1] and c[4] and c[7] then f = true end
if c[2] and c[5] and c[8] then f = true end
if c[3] and c[6] and c[9] then f = true end
if c[1] and c[2] and c[3] then f = true end
if c[4] and c[5] and c[6] then f = true end
if c[7] and c[8] and c[9] then f = true end
if c[1] and c[5] and c[9] then f = true end
if c[3] and c[5] and c[7] then f = true end
print(f and "Yes" or "No")


Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <map>

using namespace std;

int main() {
    map<string, int> dict;

    string mode, longest;
    while (true) {
        char buf[48];
        if (scanf("%s", buf) == EOF)
            break;

        string word(buf);
        ++dict[word];

        if (dict[mode] < dict[word])
            mode = word;

        if (longest.length() < word.length())
            longest = word;
    }

    
    printf("%s %s\n", mode.c_str(), longest.c_str());
    return 0;
}

Measured memory_bytes: 2896
n = int(input())
tt = [0]
xx = [0]
yy = [0]
for i in range(n):
    t,x,y = map(int,input().split())
    tt.append(t)
    xx.append(x)
    yy.append(y)
ans = "Yes"

for i in range(1,n+1):
    dist = abs(xx[i]-xx[i-1]) + abs(yy[i]-yy[i-1])
    time = tt[i]-tt[i-1]
    if time < dist or (time - dist)%2 != 0:
        ans = "No"
        break

print(ans)

Measured memory_bytes: 11828
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

typedef long long int ll;
typedef pair<int, int> Pii;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<double, double> Pdd;
typedef pair<ll, ll> P;
typedef pair<P, ll> PP;

const ll mod = 1e9+7;
const int INF = 2e9;
const double epsilon = 1e-7;
const double PI = 3.1415926535;

ll mi(ll x, ll y){
    if(x<y)return x;
    return y;
}

P job[200000];
int main(void){
    int n; cin >> n;
    for(int i = 0;i < n;i++){
        int a, b; cin >> a >> b; job[i] = P(b, a);
    }
    sort(job, job + n);
    int time = 0;
    for(int i = 0;i < n;i++){
        time += job[i].second;
        if(time > job[i].first){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
	return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

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

  int ans = 0;
  if (s == "SUN") ans = 7;
  if (s == "MON") ans = 6;
  if (s == "TUE") ans = 5;
  if (s == "WED") ans = 4;
  if (s == "THU") ans = 3;
  if (s == "FRI") ans = 2;
  if (s == "SAT") ans = 1;

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define bit(n) (1LL<<(n))
#define randInt(l,r) (uniform_int_distribution<ll>(l,r)(rnd))
#define randDouble(l,r) (uniform_real_distribution<double>(l,r)(rnd))

typedef long long ll;
typedef __int128_t lll;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modPow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
void dout(double d){printf("%.12f\n",d);}
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const double PI = acos(-1);
const double EPS = 1e-10;
static random_device rd;
static mt19937 rnd(rd());

const int N = 1e4+5;
string k;
int d, n;
ll full[N][100];
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> k >> d;
  n = sz(k);
  full[0][0] = 1;
  FOR(i, 1, N)FOR(j, 0, d)FOR(k, 0, 10) full[i][(j+k)%d] = (full[i][(j+k)%d] + full[i-1][j]) % MOD;
  int s = 0;
  ll ans = 0;
  FOR(i, 0, n){
    int c = k[i]-'0';
    FOR(j, 0, 10){
      if(j<c){
        ans = (ans + full[n-i-1][((-s-j)%d+d)%d]) % MOD;
      }else if(j==c){
        s += c;
      }else{
        break;
      }
    }
  }
  if(s%d) ans--;
  ans %= MOD;
  ans += MOD;
  ans %= MOD;
  cout << ans << endl;
}

Measured memory_bytes: 8064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>

using namespace std;

int main()
{
    vector<int> a(3);
    cin >> a[0] >> a[1] >> a[2];
    
    int ans = 0;
    sort(a.begin(), a.end());
    ans += abs(a[1] - a[0]);
    ans += abs(a[2] - a[1]);
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
int main(void){
    string s;cin>>s;
    string t[4]={"dream","dreamer","erase","eraser"};
    reverse(s.begin(),s.end());
    rep(i,4)reverse(t[i].begin(),t[i].end());
    while(true){
        if(s.size()==0){
            cout<<"YES"<<endl;
            return 0;
        }
        bool ok=false;
        rep(i,4){
            int sz=t[i].size();
            if(s.substr(0,sz)==t[i]){
                s=s.substr(sz,(s.size()-sz));
                ok=true;
            }
        }
        if(!ok){
            cout<<"NO"<<endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3760
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}

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

	int N=in(),M=in();
	int l=in(),r=in();
	REP(i,M-1){
		int tl=in(),tr=in();
		l = max(l,tl);
		r = min(r,tr);
	}
	cout << max(r-l+1,0) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  int N;
  cin >> N;
  int cnt1 = 0;
  int cnt2 = 0;
  int cnt4 = 0;
  for(int i=0;i<N;i++){
    int tmp;
    cin >> tmp;
    if(tmp%4==0) cnt4++;
    else if(tmp%2==0) cnt2++;
    else cnt1++;
  }


  if(cnt4 >= cnt1) cout << "Yes" << endl;
  else{
    if(cnt4 == cnt1 - 1 && cnt2 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};

ll a[300003];
int main() {

	ll n;
	ll total=0;

	cin>>n;

	ll n2=n*3;
	rep(i,n2){
		cin>>a[i];
	}
	sort(a,a+n2);

	for(int i=n; i<n2; i+=2){
		total+=a[i];
	}
	cout<<total<<endl;
	return 0;

}


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

int main() {
	long long N, A, B;
	cin >> N >> A >> B;
	if (A > B) {
		cout << 0 << endl;
	} else if (N >= 2) {
		cout << (N - 2) * (B - A) + 1 << endl;
	} else {
		cout << (A == B ? 1 : 0) << endl;
	}
	return 0;
}


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

cnt = 0
for i in range(N, 0, -1):
    if A[i] >= B[i-1]:
        cnt += B[i-1]
        A[i] -= B[i-1]
    elif B[i-1] > A[i]:
        cnt += A[i]
        B[i-1] -= A[i]
        if B[i-1] < A[i-1]:
            A[i-1] -= B[i-1]
            cnt += B[i-1]
        elif B[i-1] >= A[i-1]:
            cnt += A[i-1]
            A[i-1] = 0
            
print(cnt)


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

int main() {
  int n;
  cin >> n;
  vector<int> d(n);
  for (int i = 0; i < n; i++) {
    cin >> d.at(i);
  }
  int sum = 0;
  int sum2 = 0;
  for (int i = 0; i < n; i++) {
    sum += d.at(i);
    sum2 += d.at(i) * d.at(i);
  }
  cout << (sum * sum - sum2) / 2 << endl;
}


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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define mp(a,b) make_pair((a),(b))
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
//template<typename T> using vec=std::vector<T>;

const int INF=1<<30;
const long long int INFLL=1LL<<58;
const double EPS=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
	os << "[";
	for (const auto &v : vec) {
		os << v << ",";
	}
	os << "]";
	return os;
}

const int max_v=100000;
vector<int> graph[max_v];
bool used_v[max_v];
map<int,bool> used_e[max_v];
int ord[max_v],lowlink[max_v];
vector<pii> bridges;

void dfs(int v,int &k){
    used_v[v]=true;
    ord[v]=lowlink[v]=k++;
    for(int u:graph[v]){
        if(!used_v[u]){
            used_e[v][u]=true;
            dfs(u,k);
            lowlink[v]=min(lowlink[v],lowlink[u]);
            if(ord[v]<lowlink[u]) bridges.push_back(make_pair(min(v,u),max(v,u)));
        }else if(!used_e[u][v]) lowlink[v]=min(lowlink[v],ord[u]);
    }
}

void solve(){
    int v,e;
    cin >> v >> e;
    
    vector<pii> edges(e);
    rep(i,0,e){
        int s,t;
        cin >> s >> t;
        graph[s].push_back(t);
        graph[t].push_back(s);
        if(s>t) swap(s,t);
        edges[i]=make_pair(s,t);
    }
    
    int k=0;
    dfs(0,k);
    
    sort(bridges.begin(),bridges.end());
    
    for(auto &e:bridges) cout << e.first << " " << e.second << endl;
}

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

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

using namespace std;

#define forn(i, x, n) for (int i = int(x); i <= int(n); ++i)
#define for1(i, n, x) for (int i = int(n); i >= int(x); --i)
#define x first
#define y second
#define pb push_back

typedef long long ll;
typedef pair <int, int> pii;
typedef long double ld;
typedef vector <ll> vi;

const int N = 2e6 + 1;
const int INF = 1e9 + 9;
const int B = 1e9 + 7;

ll gcd(ll a, ll b) {
    return b ? gcd(b, a % b) : a;
}

int main() {
    #ifdef black
    freopen("in", "r", stdin);
    #endif // black
    ios_base :: sync_with_stdio(0);
    cin.tie(0);

    ll t;
    cin >> t;
    forn(it, 1, t) {
    //cerr << "test " << it << "\n";
        ll a, b, c, d;
        cin >> a >> b >> c >> d;
        if (d < b || a < b) {
        //cerr << "1\n";
            cout << "No\n";
            continue;
        }
        if (a > c) {
            a -= ((a / b) - (c / b)) * b;
            if (a <= c) a += b;
        }
        if (a < b) {
            //cerr << "2 " << a << "\n";
            cout << "No\n";
            continue;
        }
        if (b == d) {
            cout << "Yes\n";
            continue;
        }
        if (c + 1 <= b - 1) {
            ll g = gcd(b, d);
            ++c, --b;
            if (b - c >= g || (c % g <= b % g ? c % g <= a % g && a % g <= b % g : c % g <= a % g || a % g <= b % g)) {
                //cerr << "3 " << g << "\n";
                cout << "No\n";
                continue;
            }
        }
        cout << "Yes\n";
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string S;
    cin >> S;
    int count=0;
    for(int i=0; i<6; i++)
    {
        if(S.at(i)=='1')
        {
            count++;
        }
    }
    cout << count << endl;

}


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

using namespace std;

int main(void)
{
	string n; cin >> n;
	for (int i = 0; i < n.length(); i++) {
		if (n[i] == '1')n[i] = '9';
		else n[i] = '1';
	}
	cout << n << endl;

	return 0;
}

Measured memory_bytes: 256
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,k;
    cin >> n >> k;
    
    vector<int> A(n);
    unordered_set<int> setA;
    for(int i = 0; i < n; i++)
    {
        cin >> A[i];
        setA.insert(A[i]);
    }
    
    sort(A.begin(),A.end());
    vector<bool> dp(k+1);
    for(int i = 0; i <= k; i++)
    {
        if(i < A[0])
        {
            dp[i] = false;
            continue;
        }
        
        for(int j = 0; j < n; j++)
        {
            if(i >= A[j])
            {
                dp[i] = dp[i] || !dp[i-A[j]];
            }
        }
    }
    
    // for(int i = 0; i <= k; i++)
    // {
    //     cout << dp[i] << " ";
    // }
    // cout << '\n';
    
    if(dp[k])
    {
        cout << "First" << '\n';
    }
    else
    {
        cout << "Second" << '\n';
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    string s;
    cin>>s;
    int n=s.size();
    rep(i,n){
        if((i%2==0&&s[i]=='L')||(i%2==1&&s[i]=='R')){
            cout<<"No"; return 0;
        }
    }
    cout<<"Yes";
}

Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n, m, x;
    while(cin >> n >> m >> x, n){
        vector<vector<double>> dp(2, vector<double>(n*m+1, 0));
        dp[0][0] = 1;
        for (int i = 0; i < n; ++i) {
            int now = i&1, nxt = now^1;
            fill(dp[nxt].begin(),dp[nxt].end(), 0);
            for (int j = 0; j <= m*i; ++j) {
                for (int k = 1; k <= m; ++k) {
                    dp[nxt][j+k] += dp[now][j]/m;
                }
            }
        }
        double ans = 0;
        for (int i = 0; i <= n*m; ++i) {
            ans += dp[n&1][i]*max(i-x, 1);
        }
        printf("%.8f\n", ans);
    }
    return 0;
}


Measured memory_bytes: 3172
#include <iostream>
#include <vector>
#include <map>
typedef long long int llint;

int main(void){

  int n;
  std::cin >> n;
  int a[n];
  for(int i=0; i<n; i++){
    std::cin >> a[i];
    if(a[i]%2 == 1){
      std::cout << "first" << std::endl;
      exit(0);
    }
  }
  std::cout << "second" << std::endl;

  return 0;
}

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

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(int, k, x);

  cout << (500 * k >= x ? "Yes" : "No") << endl;
}

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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if((a<c&&c<b) || (b<c&&c<a)) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.PrintWriter

val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val n = next().toList()
    println(n.map { if (it == '1') '9' else '1' }.joinToString(separator = "").toInt())
}

fun next() = readLine()!!

fun println(value : Any) {
    pw.println(value)
}

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

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

int main(){
  int a,b;
  while(cin>>a>>b){
    if(a<b) swap(a,b);
    int d=gcd(a,b);
    cout<<d<<" "<<a/d*b<<endl;
  }
  return 0;
}

Measured memory_bytes: 1160