akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
const int INF = 2147483647;//int max
const int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;


int main() {
    ll n;
    cin >> n;
    map<ll,ll> m;
    rep(i,n){
        ll a;
        cin >> a;
        m[a]++;
    }
    vector<ll> e;
    vector<ll> sq;
    for(auto p : m){
        if(p.second >= 2)e.push_back(p.first);
        if(p.second >= 4)sq.push_back(p.first);
    }
    sort(sq.begin(),sq.end(),greater<ll>());
    ll ans = 0;
    if(!sq.empty())ans = sq.at(0)*sq.at(0);
    for(ll i : e){//長方形
        for(ll j : e){
            if(i != j)ans = max(ans,i*j);
        }
    }

    cout << ans << endl;
    return 0;
}
/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 6528
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N, M, Q = map(int, input().split())
kukan = []

for i in range(M):
    l, r = map(int, input().split())
    kukan.append([r, -1, l])

for i in range(Q):
    p, q = map(int, input().split())
    kukan.append([q, i, p])

kukan.sort()

li = [0]*(N+1)
ans = [0]*Q

for t, flag, s in kukan:
    if flag == -1:
        li[s] += 1
    else:
        ans[flag] = sum(li[s:t+1])

for a in ans:
    print(a)


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

using namespace std;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

int N, M;
string A[51];
string B[51];
bool ok(int y, int x) {
    rep(i, M) rep(j, M) {
        if (A[y + i][x + j] != B[i][j]) return false;
    }
    return true;
}
int main() {
    cin >> N >> M;
    rep(i, N) cin >> A[i];
    rep(i, M) cin >> B[i];

    rep(y, N - M + 1) {
        rep(x, N - M + 1) {
            if (ok(y, x)) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define P pair<int,int>
#define PI 3.141592653589793
const int INF = 1001001001;
const ll MX = 1e18;
const int mod = 1000000007;
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}


int main() {
	int n;
	cin >> n;
	if (n == 1) {
		cout << 0 << endl;
		return 0;
	}
	ll x = 1;
	rep(i, n) {
		x *= 10;
		x %= mod;
	}
	ll y = 1;
	rep(i, n) {
		y *= 9;
		y %= mod;
	}
	y *= 2;
	y %= mod;
	ll z = 1;
	rep(i, n) {
		z *= 8;
		z %= mod;
	}
	ll ans = x - y + z;
	if (ans < 0) {
		ans += mod*2;
	}
	ans %= mod;
	cout << ans << endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
const int INF = 2147483640;

using namespace std;
struct edge
{
  int from, to, coin;
};

edge es[5000] = {};

pair<int, int> d[2500];
int n, m, p;

int bel(int s)
{
  REP(i, n)
  {
    d[i] = make_pair(-INF, 0);
  }
  d[s] = make_pair(0, 0);
  REP(j, 2 * n)
  {
    bool update = false;
    REP(i, m)
    {
      edge e = es[i];
      if (d[e.from].first != -INF && d[e.to].first < d[e.from].first + e.coin - p)
      {
        if (e.to == n - 1 && d[n - 1].first != -INF)
        {
          if (d[e.to].first < d[e.from].first + e.coin - p && j >= n)
          {
            return -1;
          }
        }
        d[e.to] = make_pair(d[e.from].first + e.coin - p, d[e.from].second + 1);
        update = true;
      }
    }
    if (!update)
      break;
  }
  return max(0, d[n - 1].first);
}

int main()
{
  cin >> n >> m >> p;
  REP(i, m)
  {
    int a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    es[i] = {a, b, c};
  }
  cout << bel(0) << endl;
}


Measured memory_bytes: 384
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

public class Main {
	
	public Main() {
		FastScanner scanner = new FastScanner();
		int N = scanner.nextInt();
		for (int i = 0; i < N; i++) {
			System.out.print("ACL");
		}
		System.out.println("");
	}
	
	public static void main(String[] args) {
		new Main();
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	
	private int readByte() {
		if (hasNextByte()) return buffer[ptr++];
		else return -1;
	}
	
	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}
	
	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
		return hasNextByte();
	}
	
	public String next() {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	
	public long nextLong() {
		if (!hasNext()) throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) nl;
	}
	
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 32520
main = getLine >>= print . sum . map (sum . map read) . divides

divides :: [a] -> [[[a]]]
divides [] = []
divides [x] = [[[x]]]
divides (x:xs) = let dxs = divides xs in map ([x] :) dxs ++ map (\(ys:yss) -> (x:ys):yss) dxs

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define log_2(a) (log((a)) / log(2))
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int N;
    cin >> N;

    vector<LL> v(N);
    bool zflg = false;
    for(int i = 0; i < N; ++i) {
        cin >> v[i];
        zflg = (zflg || v[i] == 0);
    }

    if(zflg) {
        cout << 0 << endl;
        return 0;
    }

    LL res = v[0];
    const LL MX = 1000000000000000000ll;
    for(int i = 1; i < N; ++i) {
        LL t = MX / res;
        if(v[i] > t) {
            cout << -1 << endl;
            return 0;
        }
        res *= v[i];
    }
    cout << res << endl;
    return 0;
}



Measured memory_bytes: 3992
N = int(input())

A = list(map(int,input().split()))
#print(A)

#リストを大きい順に並び替える
A.sort(reverse=True)
#print(A)

#Aliceは要素0から偶数分加算
Alice = sum(A[0::2])
#Bobは要素1から奇数分加算
Bob = sum(A[1::2])

#print(Alice,Bob)

#AliceからBobを引く
print(Alice-Bob)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for(int i = 1, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
#define PRINT(A) std::cout << (#A) << ":" << (A) << std::endl;
using namespace std;
#define repi(itr, ds) for(auto itr = ds.begin(); itr != ds.end(); itr++)

// vector
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for(T &x : vec) is >> x;
  return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
  os << "(" << pair_var.first << ", " << pair_var.second << ")";
  return os;
}
// vector
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "{";
  for(int i = 0; i < vec.size(); i++) {
    os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
  }
  os << "}\n   ";
  return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
  os << "{";
  repi(itr, map_var) {
    os << *itr;
    itr++;
    if(itr != map_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}
// set
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
  os << "{";
  repi(itr, set_var) {
    os << *itr;
    itr++;
    if(itr != set_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}

#define DUMPOUT cerr

void dump_func() { DUMPOUT << endl; }
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
  DUMPOUT << head;
  if(sizeof...(Tail) > 0) {
    DUMPOUT << ", ";
  }
  dump_func(std::move(tail)...);
}
#ifdef DEBUG_
#define DEB
#define dump(...)                                                             \
  DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                             \
          << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" << endl \
          << "    ",                                                          \
      dump_func(__VA_ARGS__)
#else
#define DEB if(false)
#define dump(...)
#endif

typedef long long int ll;
const int MOD = 1e9 + 7;
const int INF = 1e9;

vector<int64_t> divisor(int64_t n) {
  vector<int64_t> ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int main() {
  int N;
  cin >> N;
  vector<int> s = vector<int>(N + 1);
  vector<int> a = vector<int>(N + 1);
  REPS(i, N + 1) { cin >> a[i]; }
  vector<int> ans = vector<int>(N + 1);
  int M = 0;
  for(int i = N; i >= 1; i--) {
    int cnt = 0;
    for(int j = i; j <= N; j += i) {
      if(ans[j] == 1) {
        cnt++;
      }
    }
    if(cnt % 2 == 0) {
      ans[i] = a[i];
    } else {
      ans[i] = !a[i];
    }
    if(ans[i] == 1) {
      M++;
    }
  }

  if(M == 0) {
    cout << 0 << endl;
    return 0;
  }
  cout << M << endl;
  REPS(i, N + 1) {
    if(ans[i] == 1) {
      cout << i << " ";
    }
  }
  cout << endl;
}

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

int a[50];

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    if (is_sorted(a, a + n)) {
        cout << "YES" << endl;
        return 0;
    }
    for (int i = 0; i < n; i++)
        for (int j = i + 1; j < n; j++) {
            swap(a[i], a[j]);
            if (is_sorted(a, a + n)) {
                cout << "YES" << endl;
                return 0;
            }
            swap(a[i], a[j]);
        }
    cout << "NO" << endl;
}

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

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            if(Console.ReadLine() == "ABC")
            {
                Console.WriteLine("ARC");
            }
            else
            {
                Console.WriteLine("ABC");
            }
        }
    }
}


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

using namespace std;

int main()
{
    int a[3][3];
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            cin >> a[i][j];
        }
    }
    int n;
    cin >> n;
    vector<int> b(n);
    for(int i = 0; i < n; i++){
        cin >> b[i];
        for(int j = 0; j < 3; j++){
            for(int k = 0; k < 3; k++){
                if(a[j][k] == b[i]){
                    a[j][k] = -1;
                }
            }
        }
    }
    int v[3] = {0,0,0};
    int h[3] = {0,0,0};
    int na[2] = {0, 0};
    na[0] = a[0][0] + a[1][1] + a[2][2];
    na[1] = a[0][2] + a[1][1] + a[2][0];
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            h[i] += a[i][j];
        }
    }
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            v[i] += a[j][i];
        }
    }
    bool ans = false;
    for(int i = 0; i < 3; i++){
        if(h[i] == -3 || v[i] == -3) ans = true;
    }
    if(na[0] == -3 || na[1] == -3) ans = true;
    if(ans){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <bitset>
using namespace std;
#define ll long long
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dcm(a) setprecision(a)<<fixed
#define MOD 1000000007
#define clr(memo, a) memset(memo,a,sizeof(memo))
#define PI acos(-1)

int const N=1e5+5;
int const inf=1e9+5;
void solve(){
int n,k;
cin>>n>>k;
vector<int> dp(n,inf);
vector<int> v(n);
for(int i=0;i<n;i++)
    cin>>v[i];
dp[0]=0;
for(int i=1;i<n;i++){
        for(int j=i-1;j>=max(0,i-k);j--)
            dp[i]=min(dp[i],dp[j]+abs(v[i]-v[j]));
}
cout<<dp[n-1]<<endl;
}
int main(){
    fast;

solve();

return 0;}


Measured memory_bytes: 1024
from operator import itemgetter

N,M = map(int, input().split())
arr = []
counter = 0
for i in range(N):
    arr.append(list(map(int, input().split())))

arr_sort = sorted(arr, key=itemgetter(0))

money = 0
for A,B in arr_sort:
    M -= B
    money += A * B
    if M <= 0:
        print(money + M * A)
        exit()


Measured memory_bytes: 29744
N, M, K = map(int, input().split(' '))
A_ls = [0] + list(map(int, input().split(' ')))
for i in range(N):
    A_ls[i + 1] += A_ls[i]
B_ls = [0] + list(map(int, input().split(' ')))
for i in range(M):
    B_ls[i + 1] += B_ls[i]
b_cnt, rst = M, 0
for a_cnt in range(N + 1):
    if A_ls[a_cnt] > K:
        break
    while A_ls[a_cnt] + B_ls[b_cnt] > K and b_cnt >= 0:
        b_cnt -= 1
    rst = max(rst, a_cnt + b_cnt)
print(rst)

Measured memory_bytes: 45040
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>
#include<bitset>

#define PB push_back
#define ALL(a)  (a).begin(),(a).end()
#define all(v) begin(v), end(v)
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int INF = (int)1e9;
const ll inf = (ll)1e18;
const ll MOD{ (ll)1e9 + 7 };

ll N, A, B, X[100010];

int main()
{
	cin >> N >> A >> B;
	rep(i, N) cin >> X[i];

	ll sum = 0;
	for (ll i = 0; i < N - 1; i++) {
		sum += min((X[i + 1] - X[i]) * A, B);
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000000


int main(){
	int N;
	cin>>N;
	
	vector<int> ans(N*N,-1);
	
	vector<pair<int,int>> x(N);
	for(int i=0;i<N;i++){
		cin>>x[i].first;
		x[i].first--;
		x[i].second=i;
		
		ans[x[i].first] = i;
		
	}
	sort(x.begin(),x.end());
	int now = 0;
	for(int i=0;i<N;i++){
		for(int j=0;j<x[i].second;j++){
			while(true){
				if(ans[now]==-1){
					if(now>=x[i].first){
						cout<<"No"<<endl;
						return 0;
					}
					ans[now] = x[i].second;
					break;
				}
				now++;
			}
		}
	}
		
	reverse(x.begin(),x.end());
	now = N*N-1;
	for(int i=0;i<N;i++){
		for(int j=0;j<N-x[i].second-1;j++){
			while(true){
				if(ans[now]==-1){
					if(now<=x[i].first){
						cout<<"No"<<endl;
						return 0;
					}
					ans[now] = x[i].second;
					break;
				}
				now--;
			}
		}
	}
	cout<<"Yes"<<endl;
	for(int i=0;i<N*N;i++){
		if(i!=0)cout<<' ';
		cout<<ans[i]+1;
	}
	cout<<endl;
		
	
	return 0;
}


Measured memory_bytes: 2176
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n, x, t;
  cin >> n >> x >> t;
  int num = n / x;
  if (n % x != 0) num++;
  cout << t * num << endl;
  return 0;
}

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

int comp(const void *a, const void *b) { return *(int *) a - *(int *) b; }

int main() {
  while (1) {
    int N, P;
    scanf("%d %d", &N, &P);
    if (N == -1 && P == -1) break;
    int prime[100], primeSize = 0;
    for (int n = N + 1; primeSize < P; n++) {
      int isPrime = 2 <= n;
      for (int i = 2; i * i <= n; i++) isPrime &= n % i > 0;
      if (isPrime) prime[primeSize++] = n;
    }
    int primeSum[10000], primeSumSize = 0;
    for (int i = 0; i < primeSize; i++) {
      for (int j = i; j < primeSize; j++) primeSum[primeSumSize++] = prime[i] + prime[j];
    }
    qsort(primeSum, primeSumSize, sizeof(int), comp);
    printf("%d\n", primeSum[P - 1]);
  }
}



Measured memory_bytes: 2044
#include<stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n,arr[N][N];
int col[N],d[N],f[N],time;

void dfs(void);
void visit(int);

int main(){
  int i,j ,a,b,c;
    scanf("%d",&n);
  

  for(i =0;i<n;i++)
    for(j =0;j<n;j++)
      arr[i][j]=0;

  for(i =0;i<n;i++){
    scanf("%d %d",&a,&c);
    a--;
    for(j =0;j<c;j++){
      scanf("%d",&b);
      b--;
      arr[a][b] = 1;
    }
  }
  dfs();
  return 0;
}
  void dfs() {
    int a ;
    for(a=0;a<n;a++)
      col[a] = WHITE;
    time = 0;
    for(a=0;a<n;a++)
      if(col[a] == WHITE) 
	visit(a);
    for(a=0;a<n;a++)
      printf("%d %d %d\n",a+1,d[a],f[a]);
  }

  void visit(int r){
    int b;
    col[r]=GRAY;
    d[r]= ++time ;
    for(b=0;b<n;b++){
      if(arr[r][b] == 0)continue;
      if(col[b]==WHITE) visit(b);
    }
    col[r]=BLACK;
    f[r] = ++time;
  }
               

Measured memory_bytes: 636
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<cmath>
using namespace std;
typedef long long ll;
const int N=1005;
const double INF=23333333333333.0;
double road[N][N];
double dist[N];
double x[N],y[N],r[N];
int xs,xt,ys,yt;
int n;
double D(double x,double y,double xx,double yy){
    return sqrt((x-xx)*(x-xx)+(y-yy)*(y-yy));
}
bool vis[N];
void Dijkstra(){
    for(int i=1;i<=n;i++)
        dist[i]=road[n-1][i];
    int u=n-1;
    int cnt=1;
    vis[u]=1;
    while(cnt<n){
        double minv=INF;
        int x;
        for(int i=1;i<=n;i++)
            if(!vis[i]){
                if(dist[i]>dist[u]+road[u][i]){
                    dist[i]=dist[u]+road[u][i];
                }
                if(dist[i]<minv)
                    minv=dist[i],x=i;
            }
        u=x;
        vis[u]=1;
        cnt++;
    }
}
int main()
{
    scanf("%d%d%d%d",&xs,&ys,&xt,&yt);
    scanf("%d",&n);
    memset(dist,-1,sizeof dist);
    for(int i=1;i<=n;i++)
        scanf("%lf%lf%lf",&x[i],&y[i],&r[i]);
    n++;
    x[n]=xs,y[n]=ys,r[n]=0;
    n++;
    x[n]=xt,y[n]=yt,r[n]=0;
    for(int i=1;i<=n;i++)
        for(int j=i;j<=n;j++){
            double f=D(x[i],y[i],x[j],y[j]);
            if(f<r[i]+r[j]){
                f=0;
            }
            else
                f-=r[i]+r[j];
            road[i][j]=road[j][i]=f;
        }
    Dijkstra();
    printf("%.10lf",dist[n]);
}


Measured memory_bytes: 8192
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
typedef long long ll;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

int main() {
	// ?????????????????°??????????????????
	int in,h,m,s;
	cin >> in;
	h = in / 3600;
	m = (in - (h * 3600)) / 60;
	s = in - (h * 3600) - (m * 60);
	cout << h << ":" << m << ":" << s << endl;
	// ???????????§
}


Measured memory_bytes: 3080
<?php
fscanf(STDIN, "%d %d", $N, $K);
if(abs($N - $K) > $K){
    $N = $N%$K;
}

$ans = $N;
while(abs($N-$K) < $ans){
    $N = abs($N-$K);
    $ans = $N;
}

echo ($ans);
 
?>

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

int main() {
    long long int a,b;double avg,flr;
	cin>>a>>b;
	avg=(a+(double)b)/2;
	flr=floor(avg);
	//cout<<avg<<" "<<flr;
	if(avg>flr)
	cout<<"IMPOSSIBLE";
	else
	cout<<(long long int)avg;
	return 0;
	
}

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

using namespace std;

int main(){

    int N, M;
    cin >> N >> M;

    int left = 1;
    int right = N;

    int L, R;
    for(int i = 0; i < M; i++){
        cin >> L >> R;
        left = max(left, L);
        right = min(right, R);
    }

    cout << max(0, right - left + 1);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MN = 1010;
ll a[MN],b[MN],c[MN];
int main() {
	ll n,m;
	scanf("%lld %lld ",&n,&m);
	for(int i=0;i<n;i++) {
		scanf("%lld %lld %lld ",&a[i],&b[i],&c[i]);
	}
	ll ma = 0;
	for(int i=0;i<8;i++) {
		priority_queue<ll,vector<ll>,greater<ll>> pq;
		for(int j=0;j<n;j++) {
			ll x = a[j],y = b[j],z = c[j];
			if(i&1) {x *= -1;}
			if(i&2) {y *= -1;}
			if(i&4) {z *= -1;}
			pq.push(x+y+z);
		}
		while(pq.size() > m) {pq.pop();}
		ll tot = 0;
		while(!pq.empty()) {
			tot += pq.top();pq.pop();
		}
		ma = max(ma,tot);
	}
	printf("%lld\n",ma);
}

Measured memory_bytes: 384
kr :: [Int] -> [Int] -> Int
kr _ [] = 0
kr (y:y':ys) (x:xs) = min y x + min y' (x - min y x) + kr ((y' - min y' (x - min y x)):ys) xs

main = do
    _ <- getLine
    a <- map read . words <$> getLine :: IO [Int]
    b <- map read . words <$> getLine :: IO [Int]
    print $ kr a b


Measured memory_bytes: 96380
#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;
typedef long double ld;

const int INF = 1e9;
const ld EPS = 1e-8;

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

  int n = s.length();
  vector<string> sub;
  REP(i,n)REP(j, K) sub.push_back(s.substr(i, min(j + 1, n - i + 1)));
  sort(ALL(sub));
  sub.erase(unique(ALL(sub)), sub.end());
  cout << sub[K - 1] << endl;
  return 0;
}



Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

int n, x, a[200005], b[200005];

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> n >> x;
	int l = n, r = n, ma = x, mi = x;
	while (r - l + 1 <= 2*n-1) {
		if (mi >= 1) a[l--] = mi--;
		else a[l--] = ma++;
		if (ma <= 2*n-1) a[r++] = ma++;
		else a[r++] = mi--;
	}
	// for (int i = 1; i <= 2*n-1; i++) cout << a[i];
	// 	cout << endl;
	// for (int i = 1; i < n; i++) {
	// 	for (int j = 1+i; j <= 2*n-1-i; j++) {
	// 		vector<int> v(3);
	// 		if (i & 1) {
	// 			FOR(c, 3) v[c] = a[j-1+c];
	// 			sort(ALL(v));
	// 			b[j] = v[1];
	// 		}
	// 		else {
	// 			FOR(c, 3) v[c] = b[j-1+c];
	// 			sort(ALL(v));
	// 			a[j] = v[1];
	// 		}
	// 	}
	// }
	// // cout << b[n] <<endl;
	if (x == 1 || x == 2*n-1) cout << "No" << endl;
	else {
		cout << "Yes" << endl;
		for (int i = 1; i <= 2*n-1; i++) cout << a[i] << endl;
	}		
	return 0;
}

Measured memory_bytes: 2304
#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define POWER9 1000000000
#define MOD POWER9+7
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483647
#define INT_MAX 2147483647
#define LL_MIN (LL)-9223372036854775807
#define LL_MAX (LL)9223372036854775807
#define PI 3.14159265359

int N,K;
LL a[100001],plusWA[100001],allWA[100001];
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << setprecision(9);

	cin >> N >> K;
	for(int i=0; i<N; i++) cin >> a[i];
	plusWA[0] = 0;
	allWA[0] = 0;
	for(int i=0; i<N; i++){
		plusWA[i+1] = plusWA[i];
		plusWA[i+1] += max((LL)0,a[i]);
		allWA[i+1] = allWA[i] + a[i];
	}

	LL ans = 0;
	for(int i=0; i<N-K+1; i++){
		LL tmp = plusWA[i] + max((LL)0,allWA[i+K]-allWA[i]) + plusWA[N]-plusWA[i+K];
		ans = max(ans, tmp);
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 2560
import java.util.Scanner;
public class Main {
	public static void main(String[] $) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();		//要素数
		int[] a=new int[n];		//要素
		for (int i = 0; i < n; i++) {
			a[i]=sc.nextInt();		//入力
		}
		long ans=0;		//総数答え
		int right=0;	//右（しゃくとり）
		long xor=0,sum=0;	//XOR答え　合計
		for (int left = 0; left < n; left++) {	//左を固定する
			while (right<n&&(xor^a[right])==sum+a[right]){	//橋にはまだ到達していない　かつ　和とXORが等しい
				xor^=a[right];	//次に進める
				sum+=a[right];
				right++;
			}
			ans+=right-left;	//答え
			if(right==left)right++;
			else {
				sum-=a[left];
				xor^=a[left];	//左
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 81436
#include <stdio.h>
#include <string.h>

int gojo(int a, int b){
  if(a % b)
    return gojo(b, a%b);
  else
    return b;
}

int main(){
  int n, m;  scanf("%d %d", &n, &m);
  char s[100005], t[100005];
  scanf("%s %s", s, t);
  long ans = -1;
  if(gojo(n, m) == 1){
    if(s[0] == t[0])  ans = (long)n * (long)m;
  }else{
    int flag = 1, len = gojo(n, m);
    for(int i=0; i<len; i++)
      if(s[n/len*i] != t[m/len*i]){
	flag = 0;
	break;
      }
    if(flag)  ans = (long)(n / len) * (long)m;
  }
  
  printf("%ld\n", ans);
 
  return 0;
}


Measured memory_bytes: 1900
#pragma GCC optimize("Ofast,fast-math,unroll-loops")

#include <bits/stdc++.h>

#define int ll
//#define double long double
//#define endl '\n'
#define all(C) (C).begin(), (C).end()
#define rall(C) (C).rbegin(), (C).rend()
#define mp make_pair
#define pb emplace_back
#define dbg(x) cerr << #x << " : " << x << endl
#define PI 3.14159265358979

using namespace std;

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

/*
const ll MAX_MEM = 7e8;
char MEM[MAX_MEM];
ll MEM_POS = 0;
void* operator new(size_t x)
{
    auto ret = MEM + MEM_POS;
    MEM_POS += x;
    assert(MEM_POS < MAX_MEM);
    return ret;
}
void operator delete(void*)
{}
*/

template <class T>
istream& operator>> (istream &in, vector <T> &a)
{
    for (auto &i : a)
        in >> i;
    return in;
}

template <class T>
ostream& operator<< (ostream &out, vector <T> a)
{
    for (auto &i : a)
        out << i << ' ';
    return out;
}

template <class T, class U>
istream& operator>> (istream &in, pair <T, U> &p)
{
    in >> p.first >> p.second;
    return in;
}

template <class T, class U>
ostream& operator<< (ostream &out, pair <T, U> p)
{
    out << p.first << " " << p.second << " ";
    return out;
}

inline void Start()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    //freopen(".in", "r", stdin);
    //freopen(".out", "w", stdout);
}

const int P = 998244353;
int bpow(int a, int n)
{
    int res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % P;
        a = a * a % P;
        n >>= 1;
    }
    return res;
}

signed main()
{
    Start();
    int n;
    cin >> n;
    vector <int> d(n);
    cin >> d;
    if (count(all(d), 0) != 1 || d[0] != 0)
        return cout << 0, 0;
    sort(all(d));
    for (int i = 1; i < n; ++i)
        if (d[i] - d[i - 1] > 1)
            return cout << 0, 0;
    int ans = 1;
    vector <int> cnt(d[n - 1] + 1);
    for (auto i : d)
        ++cnt[i];
    for (int i = 1; i <= d[n - 1]; ++i)
        ans = ans * bpow(cnt[i - 1], cnt[i]) % P;
    cout << ans;
    return 0;
}



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


vector<int> transenisin(int num){
	vector<int> nisin;
	while(1){
		if(num%2==1)nisin.push_back(1);
		else nisin.push_back(0);
		num=num/2;
		if(num==1){nisin.push_back(1);break;}
	}
	
	return nisin;
}

void print(vector<int> v){
	
	for(int i=0;i<v.size();i++){
		cout<<v[i];
	}
	//cout<<endl;
}
int A,B,K;
void solve(){
	cin>>A>>B>>K;
	vector<int> v;
	for(int i=1;i<=100 ;i++){
		int a=A%i;
		int b=B%i;
		if((a==0)&&(b==0)){v.push_back(i);}
		
	}
	int num=v.size()-K;
	cout<<v[num]<<endl;

}


int main(){

    solve();
    return 0;
}




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

a = [0] + a
b = [0] + b

for i in range(1, n+1):
    a[i] += a[i-1]

for i in range(1, m+1):
    b[i] += b[i-1]

ans = 0

j = m
for i in range(n+1):
    while j > 0 and b[j] + a[i] > k:
        j -= 1
    if a[i] + b[j] > k:
        break

    ans = max(ans, i + j)


print(ans)

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

int main(){
    ll a, b, n;
    ll ans;
    cin >> a >> b >> n;
    ll x;
    x = min(n, b-1);
    ans = (a*x)/b;
    //ans = a*x/b-a* (x/b);
    //ans = (a*(x%b) - (a*x)%b)/b;
    cout << ans << endl;
    return 0;
    
   	//int A, B, N; cin >> A >> B >> N;
	//int m = min(B - 1, N);
	//cout << A * m / B - A * (m / B) << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(a) (a).begin(),(a).end()
#define overload4(_1, _2, _3, _4, name, ...) name
#define rep1(n) for(ll i = 0;i < (n);i++)
#define rep2(i,n) for(ll i = 0;i < (n);i++)
#define rep3(i,a,b) for(ll i = (a);i < (b);i++)
#define rep4(i,a,b,c) for(ll i = (a);i < (b);i += (c))
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep1(n) for(ll i = (n)-1;i >= 0;i--)
#define rrep2(i,n) for(ll i = (n)-1;i >= 0;i--)
#define rrep3(i,a,b) for(ll i = (a)-1;i >= (b);i--)
#define rrep4(i,a,b,c) for(ll i = (a)-1;i >= (b);i -= (c))
#define rrep(...) overload4(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define SHOW(x) cout << #x << ": " << x << endl;
const ll INF=1e18,MOD = 1e9+7;
const int iINF = 1e9;

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

    ll n,m,ans = 0;
    cin>>n;
    m = n;
    for(ll i = 2; i*i < n;i++){
        int cnt = 0,sub =1;
        while(m % i == 0){
            m /= i;
            cnt++;
        }
        while(true){
            if(cnt < sub)break;
            cnt -= sub;
            sub++;
            ans++;
        }
    }
    if(m != 1)ans++;
    cout<<ans<<endl;


    return 0;
}


Measured memory_bytes: 3636
// Gaurav Aggarwal

/*
useful stl
array<ll,size> ar;         //size(),front(),back(),fill(),empty()
deque<ll> d                //push_back(),push_front(),pop_front(),pop_back()
vector<ll> v(size,val);    //push_back(),*max_element(v.begin(),v.end()),accumulate(v.begin(),v.end(),0)
stack<ll> g;               //push(),pop(),top(),size(),empty()         LIFO
queue<ll> q;               //push(),size(),front(),back(),empty()      FIFO
priority_queue<ll> pq
*/

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

typedef long long ll;
typedef pair<ll,ll> ipair;
typedef pair<long,long> lpair;
#define scan(x) do{while((x=getchar_unlocked())<'0'); for(x-='0'; '0'<=(_=getchar_unlocked()); x=(x<<3)+(x<<1)+_-'0');}while(0)
char _;
#define For(i, a, b) for(__typeof (a) i=a; i<=b; i++)
#define mod 1000000007
#define PI 3.141592653589793238462643383279502884 
#define debug1(a) cout<<a<<"\n";
#define debug2(a,b) cout<<a<<" "<<b<<"\n";
#define debug3(a,b,c) cout<<a<<" "<<b<<" "<<c<<"\n";
#define debug_arr(a,n) {for(__typeof (n) i=0; i<n; ++i) {cout<<a[i]<<" ";}}
#define inp_arr(a,n) for(__typeof (n) i=0; i<n; ++i) {cin>>a[i];}
#define beg_arr(a,n) for(__typeof (n) i=0; i<n; ++i) {a[i] = 0;}

ll power(ll x, ll y) 
{ 
    ll res = 1;   
    while (y > 0) { 
        if (y & 1) 
            res = (res*x)%mod; 
        y = y>>1;
        x = (x*x)%mod; 
    } 
    return res%mod; 
}

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

    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("out.txt", "w", stdout); 
    // #endif  


    int n,q;
    cin>>n>>q;
    string s;
    cin>>s;
    
    int a[n+1] = {0};
    for(int i=0;i<n-1;++i) {
        if(s[i] == 'A' and s[i+1] == 'C') {
            a[i+1] = a[i] + 1;
        }
        else {
            a[i+1] = a[i];
        }
    } 
    a[n] = a[n-1];

    // debug_arr(a,n+1);cout<<"\n";
    while(q--) {
        int l,r;
        cin>>l>>r;
        cout<<a[r-1]-a[l-1]<<"\n";
    }

    return 0;
}

Measured memory_bytes: 1488
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cstring>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <stdio.h>
#include <sstream>
#include <stdlib.h>
using namespace std;
 
#define rep(i,n) for(int i=0; i<n; i++)
#define FOR(i,s,n) for(int i=s; i<n; i++)
#define ALL(x) x.begin(), x.end()
#define pb push_back
#define foreach(it,con) for(auto it=con.begin();it!=con.end();it++)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;


int main(){
	int id;
	float m,h;
	while(scanf("%d,%f,%f",&id,&m,&h)+1){
		if(m/(h*h)>=25.0){
			cout << id << endl;
		}
	}
	return 0;	
}

Measured memory_bytes: 1228
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
typedef pair<int, int> PII;
typedef long long ll;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int n;
double ans1, ans2, a, b, c;
double d[102];

int main() {

	cin >> n >> a >> b >> c;
	rep(i, n)cin >> d[i];

	sort(d, d + n);
	reverse(d, d + n);

	ans1 = a;
	ans2 = c;

	rep(i, n) {
		if (ans2 / ans1 < d[i] / b) {
			ans2 += d[i];
			ans1 += b;
		}
		else break;
	}

	cout << (int)(ans2 / ans1) << endl;

	return 0;
}




Measured memory_bytes: 3208
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(0,-1),(1,0),(0,1),(-1,0)]
ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)

def main():
    n = I()
    a = [LI() for _ in range(n)]
    d = collections.defaultdict(int)
    for x,y,w in a:
        for i in range(2):
            for j in range(2):
                d[(x+i,y+j)] += w
    r = max(d.values())

    return '{} / 1'.format(r)



print(main())




Measured memory_bytes: 114676
#include<stdio.h>
#include<string.h>
int main(){
	int a,b,c,i,j;
	char ase[1001],str[1001],sr[1001],p[1001];
	scanf("%s %d",str,&c);
	for(i=0;i<c;i++){
		scanf("%s %d %d",sr,&a,&b);
		if(strstr(sr,"print")!=NULL){
			for(j=a;j<=b;j++)printf("%c",str[j]);
			printf("\n");
		}
		else if(strstr(sr,"replace")!=NULL){
			scanf("%s",p);
			for(j=a;j<=b;j++)str[j]=p[j-a];
		}
		else if(strstr(sr,"reverse")!=NULL){
			strcpy(ase,str);
			for(j=a;j<=b;j++)str[j]=ase[b-(j-a)];
		}
	}
	return 0;
}



Measured memory_bytes: 2104
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {
	int n;
	string s1[26]={"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
	string s;
	cin>>n>>s;
	for(int i=0;i<s.length();i++){
		for(int j=0;j<26;j++){
			if(s.substr(i,1)==s1[j] && j+n<26){
				s.replace(i,1,s1[j+n]);
				break;
			}else if(s.substr(i,1)==s1[j] && j+n>=26){
				s.replace(i,1,s1[j+n-26]);
				break;
			}
		}
	}

	cout<<s<<endl;


	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,x; cin>>n;
  int mx=-1;
  map<string,int> mp;
  string temp;
  for(int i=0;i<n;i++)
  {
    cin>>temp;
    mp[temp]++;
    if(mp[temp]>mx)
      mx=mp[temp];
  }
  for(auto x: mp){
    if(x.second==mx)
      cout<<x.first<<endl;
  }
}





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

int main(){
  int a;
  cin >> a;
  if (a % 10 == 2 || a % 10 == 4 || a % 10 == 5 || a % 10 == 7 || a % 10 ==9)
  {
    cout << "hon" << endl;
  }
  else if (a % 10 == 0 || a % 10 == 1 || a % 10 == 6 || a % 10 == 8)
  {
    cout << "pon" << endl;
  }
  else
  {
    cout << "bon" << endl;
  }
}

Measured memory_bytes: 3640
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define eps 1e-10
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

ll ans=0;
int b[30],a[maxn];

inline void wk(int x,int opt)
{
	for(int i=0;i<=20;i++) if(x&(1<<i)) b[i]+=opt;
}

inline bool jud(int x)
{
	for(int i=0;i<=20;i++) if((x&(1<<i))&&b[i]) return false;
	return true;
}

int main()
{
	int n=read(),r=1;
	for(int i=1;i<=n;i++) a[i]=read();
	for(int i=1;i<=n;i++)
	{
		while(r<=n&&jud(a[r])) wk(a[r],1),r++;
		wk(a[i],-1); ans+=r-i; //cout<<i<<" "<<r<<endl;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
N = int(input())
a = input().split()
num=[]
numabs=[]
tex=[]
count=0
count2=0
for i in range(N):
	num.append(int(a[i]))
	numabs.append(abs(num[i]))
	if num[i] < 0 :
		count +=1
	elif num[i] == 0:
		count2 +=1
if count%2 ==0 or count2 > 0:
	res = sum(numabs)
else:
	res =sum(numabs)-2*min(numabs)
print(res)
             

Measured memory_bytes: 19316
#include <iostream>
#include <cstdio>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <complex>
#include <map>
#include <climits>
using namespace std;
 
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second
#define mkp make_pair
 
static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
static const int INF=1<<24;

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}


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

Measured memory_bytes: 1124
N, Q = [int(i) for i in input().split()]

E = [[] for _ in range(N + 1)]
for _ in range(N - 1):
    a, b = [int(i) for i in input().split()]
    E[a].append(b)
    E[b].append(a)

M = [0] * (N + 1)
for _ in range(Q):
    p, x = [int(i) for i in input().split()]
    M[p] += x


from collections import deque

ans = M[:]
visited = [False] * (N + 1)
visited[1] = True
Q = deque([1])
while Q:
    a = Q.popleft()
    for e in E[a]:
        if visited[e]:
            continue
        visited[e] = True
        ans[e] += ans[a]
        Q.append(e)

print(*ans[1:])

Measured memory_bytes: 109772
/*#include <bits/stdc++.h>
using namespace std;
#define pb push_back
vector <int>adj[2005];
int visited[2005];
int maxi=0;
int sum=0;
void dfs(int ele)
{
    cnt++;
    visited[ele]=true;
    int flag=0;

    for(int i=0;i<adj[ele].size();i++)
    {
        if(!visited[adj[ele][i]])
        {
            dfs(adj[ele][i]);
            flag=1;
            if(parent[ele]==-1)
            {
                cnt=maxi;
            }
        }
    }
    cnt--;

}
int main()
{
    int n,k,x,y;
    cin>>n>>k;
    for(int i=0;i<n-1;i++)
    {
        cin>>x>>y;
        adj[x].pb(y);
        adj[y].pb(x);
    }
    dfs();
}
*/
#include <bits/stdc++.h>
using namespace std;

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


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
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 main(){
	int n,m;
	while(1){
		cin >> n >> m;
		bool isok[20001];
		REP(i,20001) isok[i] = true;
		isok[0] = false;
		vector<pair<int,pair<int,int> > > sendd;
		if(n==0&&m==0) break;
		REP(i,m){
			int t,s,d;
			cin >> t >> s >> d;
			sendd.pb(mp(t,mp(s,d)));
		}
		sort(All(sendd));
		REP(i,m){
			if(isok[sendd[i].second.first-1]==false) isok[sendd[i].second.second-1] = false;
		}
		ll int cnt = 0;
		REP(i,n){
			if(!isok[i]) cnt++;
		}
		cout << cnt << endl;
		
	}
}

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

string s[50];
int n;

string g(string s,int k){
	string r = string(1,s[0]);
	for(int i = 1 ; i < s.size() ; i++){
		if( string("aiueo").find(s[i-1]) != -1 ){
			r += s[i];
		}
	}
	if( r.size() > k ) r.resize(k);
	return r;
}
set<string> f(int k){
	set<string> X;
	for(int i = 0 ; i < n ; i++)
		X.insert(g(s[i],k));
	return X;
}
int main(){
	while( cin >> n and n ){
		int mx = 0;
		for(int i = 0 ; i < n ; i++) cin >> s[i], mx = max<int>(mx,s[i].size());
		int l = 0, r = mx+1;
		while( l != r ){
			int m = (l+r) / 2;
			set<string> calc = f(m);
			if( calc.size() == n ){
				r = m;
			}else{
				l = m+1;
			}
		}
		if( r == mx+1 ){
			cout << -1 << endl;
		}else{
			cout << r << endl;
		}
	}
}

Measured memory_bytes: 3160
#include <iostream>
#include <algorithm>
using namespace std;
#define FOR(i,a,b) for (size_t i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (size_t i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define INF 1e7

#define xplice(p,q) p * (100 + x) / 100 + q * (100 + x) / 100
#define yplice(p,q) p * (100 + y) / 100 + q * (100 + y) / 100

int x, y, s, ans;

int main()
{
  while (cin>>x>>y>>s, x) {
    ans = 0;
    for (int a = 1; a <= s; a++) {
      for (int b = 1; b <= s; b++) {
        int tmp = xplice(a,b);
        if (tmp < s) {
          continue;
        } else if (tmp == s) {
          ans = max(ans, yplice(a,b));
          //cout<<a<<" "<<b<<" "<<tmp<<" "<<yplice(a,b)<<endl;
        } else {
          break;
        }
      }
    }
    cout<<ans<<endl;
  }

  return 0;
}



Measured memory_bytes: 3080
/* 
	Author: ankrypt
*/


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

ll N, M, K;
ll arr[100005], arr1[100005];
string S = "";
std::vector<ll> V;
// set<ll> S;
queue<ll> q;
stack<ll> st;


int main() {
	scanf("%lld", &N);
	for(int i = 0; i < N; i++) {
		scanf("%lld", &arr[i]);
	}	
	for(int i = 0; i < N; i++) {
		if(arr[i] % 2 == 0) {
			if(!(arr[i] % 3 == 0 || arr[i] % 5 == 0)) {
				printf("DENIED\n");
				return 0;
			}
		}
	}
	printf("APPROVED\n");
	return 0;
}
/*
	Powered by Buggy Plugin
*/


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

typedef long long ll;
typedef long double ld;
#define size(a) int((a).size())
#define present(c, x) (c.find(x) != c.end()) 
#define printArray(arr) for (ll u = 0; u<size(arr); u++) cout << arr[u] << " ";cout << '\n'
#define printVerdict(verdict) cout << (verdict ? "YES": "NO") << '\n'
#define printDecimal(d) printf("%.9f\n", d)
#define inrange(val, start, end) (val >= start && val <= end)

const ll inf = 0x3f3f3f3f;

template <class T1, class T2, class T3> 
void printTuple(tuple<T1, T2, T3> t) {cout << get<0>(t) << " " << get<1>(t) << " " << get<2>(t) << '\n';}
template <class T1, class T2>
void printPair(pair<T1, T2> p) {cout << p.first << " " << p.second << '\n';}

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n;
	ll W; cin >> n >> W;
	ll w[n], v[n];
	ll sum = 0;
	for (int i = 0; i<n; i++) {
		cin >> w[i] >> v[i];
		sum += v[i];
	}
	vector<ll> dp(sum + 1, 1e9+2);
	dp[0] = 0;
	for (int i = 0; i<n; i++) {
		for (ll j = sum; j>=1; j--) {
			if (v[i] <= j) dp[j] = min(dp[j], dp[j-v[i]] + w[i]); 
		}
	}
	ll ret = 0;
	for (ll i = 1; i<=sum; i++) {
		if (dp[i] <= W) ret = max(ret, i);
	}
	cout << ret << '\n';
}



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

int d[100], a[100];
map<vector<int>, int>id;
map<int, vector<int>>re;
int dp[100][5040];

int main() {
	int n; scanf("%d", &n);
	rep(i, n)scanf("%d", &d[i]);
	rep(i, n)scanf("%d", &a[i]);
	vector<int>v(7); iota(v.begin(), v.end(), 0);
	int p = 0;
	do {
		id[v] = p; re[p] = v;
		int cnt = 0, t = 0;
		for (int i : v) {
			rep(j, 7) {
				if ((t >> j & 1) && abs(j - i) <= d[j])cnt += a[j];
			}
			t |= 1 << i;
		}
		dp[0][p] = cnt;
		p++;
	} while (next_permutation(v.begin(), v.end()));
	int ans = 0;
	for (int i = 1; i + 6 < n; i++)rep(j, 5040) {
		vector<int>v = re[j];
		rep(k, 8) {
			auto t = v.begin();
			int cnt = 0, p = 0, o = 0;
			vector<int>q(7);
			rep(l, 8) {
				if (k == l) {
					rep(y, 8) {
						if ((p >> y & 1) && y + d[i - 1 + y] >= 7)
							cnt += a[i - 1 + y];
					}
					p |= 1 << 7; q[o++] = 6;
				}
				else {
					if ((p >> 7 & 1) && 7 - d[i + 6] <= *t)cnt += a[i + 6];
					p |= 1 << *t;
					if (*t)q[o++] = *t - 1;
					t++;
				}
			}
			int v = id[q];
			dp[i][v] = max(dp[i][v], dp[i - 1][j] + cnt);
			ans = max(ans, dp[i][v]);
		}
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 6296
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;


int main() {
int n,k;
cin >> n >> k;
if(n%k==0) {
  cout << "0" << endl;
} else {
  cout << "1" << endl;
}
return 0;
}


Measured memory_bytes: 256