akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;

#define rep(i, n) REP(i, 0, n)
#define REP(i, k, n) for(auto i = k; i != n; i++)
#define rrep(i, n) RREP(i, n, 0)
#define RREP(i, n, k) for(auto i = n; i != k; i--)

#define debug(x) cerr << #x << " " << x << endl
#define print(x) cout << x;
#define println(x) cout << x << endl;
#define spc << " " <<

#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define ppf pop_front
#define ppb pop_back
#define eb emplace_back
#define np next_permutation

using ll = long long;
using Pii = pair<int, int>;
using Tiii = tuple<int, int, int>;
template<class T>using V = vector<T>;
template<class T>using VV = vector<vector<T>>;
using Vi = vector<int>;
using VVi = vector<vector<int>>;

int main() {
   int n; cin >> n;
   Vi R = Vi(n); rep(i, n) cin >> R[i];
   int ans = R[1] - R[0];
   int min_v = R[0];
   REP(i, 1, n) {
      ans = max(ans, R[i] - min_v);
      min_v = min(min_v, R[i]);
   }
   cout << ans << endl;
   return 0;
}



Measured memory_bytes: 3616
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int[] x = new int[100001];
      for(int i = 0;i < n;i++){
      	int a = sc.nextInt();
        if(a==0){
        	x[0]++;
            x[1]++;
        }else if(a==100000){
        	x[99999]++;
            x[100000]++;
        }else{
        	x[a-1]++;
        	x[a]++;
        	x[a+1]++;
        }
      }
      int max = 0;
      for(int i = 0;i < 100000;i++)max = Math.max(max,x[i]);
      System.out.println(max);
    }
}


Measured memory_bytes: 52844
#include <stdio.h>
int main(){
  int a, total, i;
  while(1){
    scanf("%d",&total);
    if( total == 0 ){
      break;
    }
    for( i = 0 ; i < 9 ; i++ ){
    scanf("%d",&a);
   total -= a;
  }
    printf("%d\n",total);
  }
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()

const int oo = 1e9;
const int N = 2505, E = 5005;

int n, e, m;
int nxt[E], head[N], to[E], cost[E];
int reach[N][N];
int dist[N];

void add_edge(int f, int t, int c)
{
  nxt[e] = head[f];
  head[f] = e;
  to[e] = t;
  cost[e++] = c;
}

void bfs(int src)
{
  for(int i = 0 ; i < n ; i++){
    reach[src][i] = 0;
  }
  queue<int> q;
  q.push(src);
  vector<int> vis(n, 0);
  vis[src] = 1;
  while(!q.empty()){
    int cur = q.front();
    q.pop();
    reach[src][cur] = 1;
    for(int k = head[cur] ; ~k ; k = nxt[k]){
      int v = to[k];
      if(!vis[v]){
        vis[v] = 1;
        q.push(v);
      }
    }
  }
}

void bellman()
{
  for(int i = 0 ; i < n ; i++)
    dist[i] = oo;
  dist[0] = 0;
  for(int it = 0 ; it < n - 1 ; it++){
    for(int i = 0 ; i < n ; i++){
      for(int k = head[i] ; ~k ; k = nxt[k]){
        int j = to[k];
        int c = cost[k];
        if(dist[i] < oo && dist[i] + c < dist[j]){
          dist[j] = dist[i] + c;
        }
      }
    }
  }
}

int main()
{
  int p;
  e = 0;
  memset(head, -1, sizeof head);
  cin >> n >> m >> p;
  for(int i = 0 ; i < m ; i++){
    int u, v, c;
    cin >> u >> v >> c;
    add_edge(--u, --v, p - c);
  }
  // for(int i = 0 ; i < n ; i++){
  //   for(int k = head[i] ; ~k ; k = nxt[k])
  //     cout << to[k] << " ";
  //   cout << endl;
  // }
  for(int i = 0 ; i < n ; i++)
    bfs(i);
  // for(int i = 0 ; i < n ; i++){
  //   for(int j = 0 ; j < n ; j++)
  //     cout << reach[i][j] << " ";
  //   cout << endl;
  // }
  bellman();
  for(int i = 0 ; i < n ; i++){
    for(int k = head[i] ; ~k ; k = nxt[k]){
      int j = to[k];
      int c = cost[k];
      if(dist[j] > dist[i] + c && reach[0][i] && reach[j][n - 1]){
        cout << -1 << endl;
        return 0;
      }
    }
  }
  cout << max(0, -dist[n - 1]) << endl;
  return 0;
}


Measured memory_bytes: 24960
#include<iostream>
#include<vector>
#include<queue>
using namespace std;

vector<bool> used(10000, 0);
vector<int> indeg(10000, 0), child[10000], res;

int main(){
    int v, e, s, t;
    cin >> v >> e;

    for(int i = 0; i < e; i++){
        cin >> s >> t;
        child[s].push_back(t);
        indeg[t]++;
    }

    queue<int> q;
    for(int i = 0; i < v; i++)  if(indeg[i] == 0)   q.push(i);

    while(!q.empty()){
        int x = q.front();  q.pop();
        used[x] = true;
        res.push_back(x);
        for(int c : child[x]){
            indeg[c]--;
            if(indeg[c] == 0)   q.push(c);
        }
    }

    for(int x : res)    cout << x << endl;

    return 0;
}


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

int main() {
  int N;
  cin >> N;
  int a[N];
  for (int i=0; i < N; ++i) {
    cin >> a[i];
  }
  int alice = 0;
  int bob = 0;
  int flag = 1;
  int ans;
  sort(a, a + N, greater<int>());
  for (int i=0; i < N; ++i) {
    if (flag) {
      alice += a[i];
      flag = 0;
    }
    else {
      bob += a[i];
      flag = 1;
    }
  }
  ans = alice - bob;
  cout << ans << "\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<stack>
#include<iostream>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define vec(a) vector<int>a
using namespace std;
//fibonacci
int binet(int n)
{
	return (pow((1+sqrt(5)),n-1)-pow((1-sqrt(5)),n-1))/(pow(2,n-1)*sqrt(5));
}


int main()
{
#ifndef ONLINE_JUDGE
	freopen("output.txt", "w", stdout);
	freopen("input.txt", "r", stdin);
#endif
	fastio
	char ch;
	cin>>ch;
	cout<<char(int(ch)+1)<<"\n";
	//cout<<ch<<" is followed by "<<char(int(ch)+1)<<"."<<"\n";
	return 0;
}
	

Measured memory_bytes: 3692
#include <iostream>
#include <list>

using namespace std;

int main(void) {
	int n,r;
	while (cin >> n >> r, n) {
		list<int> hana;
		for (int i = 0; i < n; ++i) {
			hana.push_back(i+1);
		}
		
		int p,c,count;
		for (int i = 0; i < r; ++i) {
			cin >> p >> c;
			count = 1;
			for (list<int>::iterator itr = hana.begin(); itr != hana.end();) {
				if (count > n-(p-1)-c && count < n-(p-2)) {
					hana.push_back(*itr);
					itr = hana.erase(itr);
				}
				else {
					++itr;
				}
				++count;
			}
		}
		count = 1;
		for (list<int>::iterator itr = hana.begin(); itr != hana.end(); ++itr) {
			if (count == n) {
				cout << *itr << endl;
			}
			++count;
		}
	}

	return 0;
}

Measured memory_bytes: 3076
import java.util.Scanner;

public class Main {
    public static void main(String [] args) {
        Scanner scanner = new Scanner(System.in);
        long n = scanner.nextLong();
        long sum = 0;
        for (long i = 1; i <= Math.sqrt(n); ++i) {
            long j = n / i;
           // m + 1 = i
            if (i > 1) {
                long m = i - 1;
                if (n % m == n / m) {
                    sum += m;
                }
            }

            // m + 1 = j
            if (j - 1 > 0) {
                long m = j - 1;
                if (n % m == n / m) {
                    sum += m;
                }
            }
        }
        System.out.println(sum);
    }
}


Measured memory_bytes: 23892
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  ll N,K,Q;
  cin >> N >> K >> Q;
  vector<ll> A(Q);

  rep(i,Q) {
    cin >> A[i];
    A[i]--;
  }
  vector<ll> account(N,0);
  rep(i,Q) {
    account[A[i]]++;
  }
  rep(i,N){
    if(K-Q+account[i]>0){
      cout<< "Yes" << endl;
    }
    else cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 2176
from collections import deque
import sys
sys.setrecursionlimit(10**7)
t = int(input())
memo = dict()
def calc(n):
    global a,b,c,d
    #print(n)
    if n in memo:
        return memo[n]
    if n <= 0:
        return 0
    elif n == 1:
        return d
    res = d * n
    #何らかの操作を行った後、2で割る
    if n % 2 == 0:
        res = min(res, calc(n//2) + a)
    else:
        res = min(res, calc((n + 1)//2) + a + d, calc((n - 1)//2) + a + d)
    
    if n % 3 == 0:
        res = min(res, calc(n//3) + b)
    else:
        res = min(res, calc((n - (n % 3))//3) + b + d * (n % 3),
         calc((n + (3 - (n % 3)))//3) + b + d * (3 - (n % 3)))

    
    if n % 5 == 0:
        res = min(res, calc(n//5) + c)
    else:
        res = min(res, calc((n - (n % 5))//5) + c + d * (n % 5),
         calc((n + (5 - (n % 5)))//5) + c + d * (5 - (n % 5)))
    memo[n] = res
    #print("n : {} ,  res : {}".format(n,memo[n]))
    return memo[n]

for _ in range(t):
    n, a, b, c, d = map(int, input().split())
    print(calc(n))
    memo = dict()

Measured memory_bytes: 11380
#include <bits/stdc++.h>
using namespace std;
int F[114]={};
int fib(int n){
    if(n == 0 || n == 1) return F[n] = 1;
    else if(F[n] != 0) return F[n];
    else {
        return F[n] = fib(n-1) + fib(n-2);
    }
}

int main() {
    ios::sync_with_stdio(false);
    int n;
    cin >>n;
    fib(n);
    cout << F[n] << endl;
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  if ( ( N % 1110 ) < 10 ) {
    cout << "Yes" << endl;
  }
  else if ( ( N % 1000 ) % 111 == 0 ) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
} 

Measured memory_bytes: 256
def main():
    n,x,m=map(int,input().split())
    A=[]
    s=set()
    while True:
        A.append(x)
        s.add(x)
        x**=2
        x%=m
        if x==0:
            A.append(0)
            break
        if x in s:
            break
    #print(A)
    if n<=len(A):
        return sum(A[:n])
    if A[-1]==0:
        return sum(A)
    for idx,a in enumerate(A):
        if a==x:
            break
    l=len(A)-idx
    cycles=(n-idx)//l
    remain=(n-idx)%l
    #print(idx,l,cycles)
    s=sum(A[idx:])
    ans=sum(A[:idx])
    ans+=s*cycles
    ans+=sum(A[idx:idx+remain])
    return ans
    
if __name__=='__main__':
    print(main())

Measured memory_bytes: 77028
a, b, c = map(int, input().split())

A = []
if a < c:
    A.append(0)
    c = c-a
    if b<c:
        A.append(0)
    else:
        A.append(b-c)
else:
    A.append(a-c)
    A.append(b)

print(A[0], A[1])

Measured memory_bytes: 38384
fun main(args: Array<String>) {
    val ab = (1..3).map { readLine()!!.split(" ").map { it.toInt() } }.flatten()
    var flag = true
    for (i in 1..4) {
        if (!(ab.count { it == i } in 1..2)) {
            flag = false
            break
        }
    }
    println(if (flag) "YES" else "NO")
}

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

using namespace std;

int a[111111], b[111111];
int main()
{
	int n, s = 0;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		scanf("%d", a + i);
		s += abs(a[i] - a[i - 1]);
		if (i > 1) b[i - 1] = abs(a[i - 2] - a[i]) - abs(a[i - 2] - a[i - 1]) - abs(a[i] - a[i - 1]);
	}
	s += abs(a[n]);
	b[n] = abs(a[n - 1]) - abs(a[n - 1] - a[n]) - abs(a[n]);
	for (int i = 1; i <= n; i++)
		cout << s + b[i] << '\n';
	cout << flush;
	return 0;
}


Measured memory_bytes: 2048
x,y,a,b,c=map(int,input().split())
p=sorted(list(map(int,input().split())),reverse=True)[:x]
q=sorted(list(map(int,input().split())),reverse=True)[:y]
r=list(map(int,input().split()))
print(sum(sorted(p+q+r,reverse=True)[:x+y]))

Measured memory_bytes: 22504
import std.stdio, std.conv, std.array, std.string;
import std.algorithm;
import std.container;
import std.range;

class Node {
  public int id;
  public int count;
  public Node from;
  public Node[] subNodes;

  this(int id) {
    this.id = id;
  }
}

void main() {
  int N, Q; readf("%d %d\n", &N, &Q);

  Node[] nodes = new Node[N];
  N.iota.each!(i => nodes[i] = new Node(i));
  foreach(i; 0..N-1) {
    int from, to; readf("%d %d\n", &from, &to);
    from--; to--;
    nodes[to].from = nodes[from];
    nodes[from].subNodes ~= nodes[to];
  }
  
  foreach(i; 0..Q) {
    int nodeId, increments; readf("%d %d\n", &nodeId, &increments);
    nodes[nodeId - 1].count += increments;
  }

  int[] totals = new int[N];
  auto tree = [nodes[0]];
  while(!tree.empty) {
    foreach(node; tree) {
      totals[node.id] += node.count;
      if (node.from) totals[node.id] += totals[node.from.id];
    }
    tree = tree.map!(node => node.subNodes).joiner.filter!(node => node !is null).array;
  }

  totals.to!(string[]).join(" ").writeln;
}


Measured memory_bytes: 44924
#include<stdio.h>
int main()
{
    int n,m,i,p,j;
    long int t[1000],sum,x,sub;
    scanf("%d",&n);
    for(i = 0; i<n ;i++)
    {
        scanf("%ld",&t[i]);
    }
    scanf("%d",&m);
    for(i = 0 ;i<m ; i++)
    {
        sum = 0;
        scanf("%d",&p);
        scanf("%ld",&x);
        sub = x;
        for(j = 0 ;j<n;j++)
        {
            if(j!=p-1)
            sum += t[j];
        }
        printf("%ld\n",sum+sub);
    }
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <map>
#include <vector>

using namespace std;

#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)

typedef vector<string> vs;

const string s1 = " ',-.?ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string s2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";
vs CODE1{
    "101",
    "000000",
    "000011",
    "10010001",
    "010001",
    "000001",
    "100101",
    "10011010",
    "0101",
    "0001",
    "110",
    "01001",
    "10011011",
    "010000",
    "0111",
    "10011000",
    "0110",
    "00100",
    "10011001",
    "10011110",
    "00101",
    "111",
    "10011111",
    "1000",
    "00110",
    "00111",
    "10011100",
    "10011101",
    "000010",
    "10010010",
    "10010011",
    "10010000",
};

int main() {
    map<char,string> dic;
    rep(i,32){
        dic[s1[i]] = CODE1[i];
    }

    string l;
    while(getline(cin, l)) {
        string code;
        rep(i,l.size()){
            code += dic[l[i]];
        }
        code += string((5-code.size()%5)%5,'0');

        string res;
        rep(i,code.size()){
            string num = code.substr(i, 5);
            int val = 0;
            rep(j,5){
                val<<=1;
                val+=num[j]-'0';
            }
            res += s2[val];
            i+=4;
        }
        cout << res << endl;
    }
}

Measured memory_bytes: 1200
#include<stdio.h>
int main(){
 
  int n,m,l;
  scanf("%d %d %d", &n, &m, &l);
 
  int i,j,a[n][m];
   
  for ( i = 0 ; i < n ; i++ ){
    for ( j = 0 ; j < m ; j++ ){
      scanf("%d", &a[i][j]);
    }
  }
 
  int b[m][l];
 
  for ( i = 0 ; i < m ; i++ ){
    for( j = 0 ; j < l ; j++ ){
      scanf("%d", &b[i][j]);
    }    
  }
 
  long sum,c[n][l];
  int k;
  sum =0;
 
  for ( i = 0 ; i < n ; i++ ){
    for ( j = 0 ; j < l ; j++ ){
      for ( k = 0 ; k < m ; k++ ){
 
    sum = sum + a[i][k] * b[k][j];
 
      }
 
      c[i][j] = sum;
      sum = 0;
 
    }
  }
 
  for ( i = 0 ; i < n ; i++ ){
    for ( j = 0 ; j < l ; j++ ){
 
      printf("%ld", c[i][j]);
 
      if ( j == l - 1 ){
    printf("\n");
    break;
      }
 
      printf(" ");
       
    }
     
  }
 
  return 0;
   
}

Measured memory_bytes: 756
#include <iostream>
#include <cmath>
using namespace std;
int main(){
	int n, d, x;
	cin >> n >> d >> x;
	int a[n];
	int sum=0;
	sum+=n;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		sum+=(d-1)/a[i];
	}
	cout << sum+x << endl;
	return 0;
}


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

int main(){
	int t,h,s;
	while(cin>>t>>h>>s&&t!=-1&&h!=-1&&s!=-1){
		int a,b,c;
		a=2-t;
		b=0-h;
		c=0-s;
		if(b<0){
			a-=1;
			b+=60;
			}
		if(c<0){
			b-=1;
			c+=60;
			}		
			
			if(b<0){
			a-=1;
			b+=60;
			}
		if(c<0){
			b-=1;
			c+=60;
			}		
			
			printf("%.2d:%.2d:%.2d\n",a,b,c);
		
		int d=a*3;
		int e=b*3;
		int f=c*3;
		
		if(f>=60){
			f-=60;
			e+=1;
			}
		if(f>=60){
			f-=60;
			e+=1;
			}	
			
		if(e>=60){
			e-=60;
			d+=1;
			}	
		if(e>=60){
			e-=60;
			d+=1;
			}
			
			printf("%.2d:%.2d:%.2d\n",d,e,f);	
	}
		return 0;
	}

Measured memory_bytes: 3144
import fractions
from functools import reduce
m=int(input())
a=list(map(int,input().split()))
def lcm_base(x,y):
    return (x*y)//fractions.gcd(x,y)
def lcm_list(numbers):
    return reduce(lcm_base,numbers,1)
mod=10**9+7
n=lcm_list(a)
ans=0
for i in range(m):
    ans+=(n//a[i])
print(ans%mod)

Measured memory_bytes: 6108
// Problem : D - Alter Altar
// Contest : AtCoder - AtCoder Beginner Contest 174
// URL : https://atcoder.jp/contests/abc174/tasks/abc174_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl '\n'
int main()
{
	ll i,j,k,m,n,t;
	cin>>n;
	string s;
	cin>>s;
	ll r=0;
	for(i=0;i<n;i++)
	{
		if(s[i]=='R') r++;
	}
	ll w=0;
	for(i=0;i<r;i++)
	if(s[i]=='W') w++;
	cout<<w;
}

Measured memory_bytes: 3752
#include<bits/stdc++.h>
using namespace std;
using ll = int64_t;
int main(){
    ll a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);
    ll K;
    cin >> K;
    for(ll i = 0; i < K; i++) a[2] *= 2;
    cout << a[0] + a[1] + a[2] << endl;
    return 0;
}

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

int main()
{
  long long n,m,l;
  cin>>n>>m>>l;
  long long a[n][m];
  long long b[m][l];
  long long c[n][l];
  for (long long i = 0; i < n; ++i)
  {
    for (long long j = 0; j < m; ++j)
    {
      cin>>a[i][j];
    }
  }
  for (long long i = 0; i < m; ++i)
  {
    for (long long j = 0; j < l; ++j)
    {
      cin>>b[i][j];
    }
  }
  for (long long i = 0; i < n; ++i)
  {
    for (long long j = 0; j < l; ++j)
    {
      long long sum=0;
      for (long long k = 0; k < m; ++k)
      {
        sum+=a[i][k]*b[k][j];
      }
      c[i][j]=sum;
    }
  }
  for (long long i = 0; i < n; ++i)
  {
    for (long long j = 0; j < l; ++j)
    {
      cout<<c[i][j];
      if(j!=l-1) cout<<" ";
    }
    cout<<endl;
  }
}


Measured memory_bytes: 3312
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 1000000000; //10^9

int main(){
    string S;
    cin >> S;
    string temp = "ACGT";
    ll ans = 0;
    ll cnt = 0;
    int i = 0;
    while(i < S.size()){
        if(temp.find(S[i]) == string::npos){
            cnt = 0;
        }else{
            cnt++;
        }
        ans = max(ans, cnt);
        i++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 using namespace std;
 typedef long long ll;
 #define rep(i, j, n) for(int i = j; i < (int)(n); i++)
 const ll MOD = 1000000007;

 int main() {
     ll x, ans = 0;
     cin >> x;

     ans += x / 11 * 2;
     x %= 11;
     if (x > 0 && x <= 6) ans++;
     else if (x >= 7) ans += 2;

     cout << ans << endl;
 }


Measured memory_bytes: 256
#include <iostream>
#include <cmath>

using namespace std;

typedef long scalar;
class point{
	public:
	scalar x;
	scalar y;
	void print(){
		cout << x << " " << y; 
	}
	scalar cross(point a){//??????
		return x * a.y - y * a.x;
	}
	scalar dot(point a){//??????
		return x * a.x + y * a.y;
	}
	scalar norm2(void){
		return x * x + y * y;
	}
	scalar norm(void){
		return sqrt(norm2());
	}
	point operator =(point a){
		this->x = a.x;
		this->y = a.y;
		return *this;
	}
	point operator +(point a){
		point r;
		r.x = this->x + a.x;
		r.y = this->y + a.y;
		return r;
	}
	point operator -(point a){
		point r;
		r.x = this->x - a.x;
		r.y = this->y - a.y;
		return r;
	}
};

point operator *(scalar t, point a){
	point r;
	r.x = t * a.x; 
	r.y = t * a.y; 
	return r;
}


int main(){
	point p0, p1, p2;
	point p01,p02;
	int q;
	scalar crossproduct,innerproduct;
	cout.precision(20);
	cin >> p0.x >> p0.y >> p1.x >> p1.y;
	cin >> q;
	for(int i = 0;i < q;i++){
		cin >> p2.x >> p2.y;
		p01 = p1-p0;
		p02 = p2-p0;
		crossproduct = p01.cross(p02);
		innerproduct = p01.dot(p02);
		if(crossproduct > 0)
			cout << "COUNTER_CLOCKWISE" << endl;
		else if(crossproduct < 0)
			cout << "CLOCKWISE" << endl;
		else if(innerproduct < 0)
			cout << "ONLINE_BACK" << endl;
		else if(p02.norm2() > p01.norm2())
			cout << "ONLINE_FRONT" << endl;
		else 
			cout << "ON_SEGMENT" << endl;
	}
	return 0;
}

Measured memory_bytes: 1156
'use strict';
let fn = val => {
  return val % 2 == 0 ? val / 2 : val * 3 + 1;
};
let execute = input => {
  let val = +input;
  let set = new Set([val]);
  let i = 2;
  while (true) {
    val = fn(val);
    if (set.has(val)) return i;
    set.add(val);
    i++;
  }
};

function Main(input) {
  console.log(execute(input));
}
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7500
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 100000000
#define mod 998244353
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
ll dp0[10005],dp1[INF];
int main(){
  ll N;cin>>N;
  ll i,j,k;
  ll ga,sa,ba;cin>>ga>>sa>>ba;
  ll gb,sb,bb;cin>>gb>>sb>>bb;
  for(i=N+1;i<10005;i++) dp0[i]=-INF;
  dp0[N]=N;
  for(i=N-1;i>=0;i--){
    dp0[i]=max(dp0[i+ga] + (gb-ga) , max(dp0[i+sa] + (sb-sa) , max(dp0[i+ba] + (bb-ba), dp0[i+1] ) ) );
  }
  ll tmp=dp0[0];
  // cout<<tmp<<endl;
  for(i=tmp+1;i<INF;i++) dp1[i]=-INF;
  dp1[tmp]=tmp;
  for(i=tmp-1;i>=0;i--){
    dp1[i]=max(dp1[i+gb] + (ga-gb) , max(dp1[i+sb] + (sa-sb)   , max(dp1[i+bb] + (ba-bb), dp1[i+1] ) ) );
  }
  cout<<dp1[0]<<endl;
}


Measured memory_bytes: 781568
#include <bits/stdc++.h>
#include <numeric>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
    double n,ave=0;
    int cost=0;
    cin >> n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
        ave+=a[i];
    }
    ave=round(ave/n);
    for(int i=0;i<n;i++){
        cost+=pow(ave-a[i],2);
    }
    cout << cost << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(ll i = m, i##_len = (n); i < i##_len; ++i)
#define reprev(i, n) for(ll i = (n-1LL); i >= 0; --i)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	rep (i, n) cin >> a[i];
	sort(all(a));
	bool dp_left[n + 1][k + 1] = {}, dp_right[n + 1][k + 1] = {};
	dp_left[0][0] = true;
	dp_right[n][0] = true;
	rep (i, n) {
		rep (j, k + 1) {
			if (j - a[i] >= 0) dp_left[i + 1][j] |= dp_left[i][j - a[i]];
			dp_left[i + 1][j] |= dp_left[i][j];
		}
	}
	reprev (i, n) {
		rep (j, k + 1) {
			if (j - a[i] >= 0) dp_right[i][j] |= dp_right[i + 1][j - a[i]];
			dp_right[i][j] |= dp_right[i + 1][j];
		}
	}
	int ng = -1, ok = n;
	while (ok - ng > 1) {
		int med = (ok + ng) / 2;
		bool ch = false;
		if (a[med] >= k) ch = true;
		else {
			repp (j, k - a[med], k) {
				rep (l, j + 1) {
					ch |= dp_left[med][l] && dp_right[med + 1][j - l];
				}
			}
		}
		if (ch) ok = med;
		else ng = med;
	}
	cout << ok << endl;
	return 0;
}

Measured memory_bytes: 49152
// All Heil Fire Lord Zuko

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

const int N = 100 * 1000 + 19;

int n, a[N];

int main() {
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cin >> n;
    for (int i = 1; i <= n; i ++)
        cin >> a[i];
    int ans = 0;
    for (int i = 1; i <= n; i ++) {
        if (a[i] == i) {
            ans ++;
            swap(a[i], a[i + 1]);
        }
    }
    cout << ans;
    return 0;
}

/* THINGS TO CHECK !! */

// Runtime -> Valid Bool Needed
// Overflows -> Checked
// Order is -> N^2

/* READ PROBLEM STATEMENT CAREFULLY */


Measured memory_bytes: 640
#include <iostream>

using namespace std;

class Dice {
    public:
    int face[6];
    Dice() {}
    void rotateX () {
        rotate(0, 1, 5, 4);
    }
    void rotateY () {
        rotate(0, 2, 5, 3);
    }
    void rotateZ () {
        rotate(1, 2, 4, 3);
    }
    void rotate (int a, int b, int c, int d) {
        int t = face[a];
        face[a] = face[b];
        face[b] = face[c];
        face[c] = face[d];
        face[d] = t;
    }
    void move (char c) {
        if (c == 'E') for (int i = 0; i < 3; i++) rotateY();
        if (c == 'W') rotateY();
        if (c == 'N') rotateX();
        if (c == 'S') for (int i = 0; i < 3; i++) rotateX();
    }
};

int main () {
    Dice d;
    string com;
    
    for (int i = 0; i < 6; i++) cin >> d.face[i];
    cin >> com;

    for (int i = 0; i < com.size(); i++) d.move(com[i]);

    cout << d.face[0] << endl;
}


Measured memory_bytes: 3160
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int n = sc.nextInt();
			if (n == 0)
				break;
			Train[] trains = new Train[n];
			for (int i = 0; i < n; i++) {
				String depstr = sc.next();
				String[] depstrs = depstr.split(":");
				int dep = Integer.parseInt(depstrs[0]) * 3600
						+ Integer.parseInt(depstrs[1]) * 60
						+ Integer.parseInt(depstrs[2]);
				String arrstr = sc.next();
				String[] arrstrs = arrstr.split(":");
				int arr = Integer.parseInt(arrstrs[0]) * 3600
						+ Integer.parseInt(arrstrs[1]) * 60
						+ Integer.parseInt(arrstrs[2]);
				trains[i] = new Train(dep, arr);
			}
			int maxtrain = 0;
			int nowtrain = 0;
			for (int i = 0; i < 24*60*60; i++) {
				for(int j=0;j<n;j++){
					if(i==trains[j].dep)
						nowtrain++;
					if(i==trains[j].arr)
						nowtrain--;
				}
				maxtrain = Math.max(maxtrain, nowtrain);
			}
			System.out.println(maxtrain);
		}
		sc.close();
	}
}

class Train {
	int dep;
	int arr;

	Train(int d, int a) {
		dep = d;
		arr = a;
	}
}

Measured memory_bytes: 67368
#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  cin >> q;
  map<string, int> M;
  while (q--) {
    int op;
    cin >> op;
    if (op == 0) {
      string k;
      int x;
      cin >> k >> x;
      M[k] = x;
    } else {
      string k;
      cin >> k;
      cout << M[k] << endl;
    }
  }
}


Measured memory_bytes: 27860
#include<bits/stdc++.h>
using namespace std;
string a,b;
int type=0;
int main(){
	cin >> a >> b;
	if(a.size()>b.size()){
		printf("GREATER");
	}else if(a.size()<b.size()){
		printf("LESS");
	}else{
		for(int i=1;i<=a.size();i++){
			if(a[i-1]>b[i-1]){
				type=1;
				break;
			}
			if(a[i-1]<b[i-1]){
				type=-1;
				break;
			}
		}
		if(type==1){
			printf("GREATER");
		}else if(type==0){
			printf("EQUAL");
		}else printf("LESS");
	}
}

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

#define ll long long int
#define vi vector<int> 
ll prime(int i){

    int j=2;
    for(j=2;j<sqrt(i);j++){
        if(i%j==0)return 0;
        
    }
return 1;    
}




int main() {
 string a;
 string b;
 int n;
 cin >> n;
 cin >> a >> b;
 for(int i=0;i<2*n;i++){
     if(i%2==0)cout<<a[i/2];
     else cout<<b[i/2];
 }
    
}


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

using namespace std;

const int max_n = 1011, inf = 1000111222;
const int dx[] = {-1, 1, 0, 0};
const int dy[] = {0, 0, -1, 1};

int n, m, dist[max_n][max_n];
char s[max_n][max_n];
queue<int> qx, qy;

bool is_in(int x, int y) {
    return 0 <= x && 0 <= y && x < n && y < m;
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    memset(dist, -1, sizeof(dist));
    scanf("%d%d", &n, &m);
    for (int i = 0; i < n; ++i) {
        scanf("%s", s[i]);
        for (int j = 0; j < m; ++j) {
            if (s[i][j] == '#') {
                dist[i][j] = 0;
                qx.push(i);
                qy.push(j);
            }
        }
    }
    int ans = 0;
    while (!qx.empty()) {
        int x = qx.front();
        int y = qy.front();
        qx.pop();
        qy.pop();
        ans = dist[x][y];
        for (int i = 0; i < 4; ++i) {
            int nx = x + dx[i];
            int ny = y + dy[i];
            if (is_in(nx, ny) && dist[nx][ny] == -1) {
                dist[nx][ny] = dist[x][y] + 1;
                qx.push(nx);
                qy.push(ny);
            }
        }
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 13440
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; i++)
#define RFOR(i, a, n) for (ll i = (ll)n - 1; i >= (ll)a; i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define bra(first, second) '(' << first << ',' << second << ')'
constexpr ll MOD = 1000000007;
//constexpr ll MOD = 998244353;
ll INF = 1001001001001001001;
long double EPS = 1e-9;
long double PI = 3.141592653589793238;
template <typename T>
void remove(std::vector<T> &vector, unsigned int index)
{
   vector.erase(vector.begin() + index);
}

using Graph = vector<vector<tuple<ll, ll, ll>>>;

// MOD確認

int main(){
   string S;
   cin >> S;
   cout << S.substr(0,3) << endl;
}


Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;

ll Power(ll x, ll m){
    //繰り返し二乗法
    if(m == 0) return 1;
    if(m == 1) return x;
    if(m % 2 == 0){
        return Power(x*x,m/2);
    }else{
        return Power(x*x,m/2)*x;
    }
}

int main(){
    ll n,k; cin >> n >> k;
    ll ans = k * Power(k-1,n-1);
    cout << ans << endl;
}

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

int main() {
	int a, b, c, d, e, f; cin >> a >> b >> c >> d >> e >> f;

	int mixedAns = 0, sugarAns = 0; double conc = -1.0;
	for (int ai = 0; ai <= f; ai += 100 * a) {
		for (int bi = 0; ai + bi <= f; bi += 100 * b) {
			int water = ai + bi; if (water == 0)continue;
			for (int ci = 0; water + ci <= f; ci += c) {
				for (int di = 0; water + ci + di <= f; di += d) {
					int sugar = ci + di;
					double nowC = 100.0 * sugar / (water + sugar);
					int limitS = water / 100 * e;
					if (sugar <= limitS && nowC > conc) {
						conc = nowC; mixedAns = water + sugar; sugarAns = sugar;
					}
				}
			}
		}
	}
	cout << mixedAns << ' ' << sugarAns << endl;

	return 0;
}

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

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int ans = 0;
	int H;
	int x = 1;
	
	cin>>H;
	
	while(H > 0){
		ans += x;
		x *= 2;
		H >>= 1;
	}
	
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 256
import copy
import sys

input = sys.stdin.readline
n, k = map(int, input().split())
a = list(map(int, input().split()))
b = copy.deepcopy(a)

cnta = 0
cntc = 0

w = 10 ** 9 + 7

e = [0] * len(a)

for i in range(len(a)):
    for j in range(len(a) - 1, i, -1):
        if a[j] < a[j - 1]:
            a[j], a[j - 1] = a[j - 1], a[j]

            e[i] += 1
# print(e)

f = [0] * len(b)
for i in range(len(b)):
    for j in range(len(b)):
        if b[i] > b[j]:
            f[i] += 1
# print(f)

wa = (k*(k - 1)//2) * sum(f)  + sum(e) * k
print(wa % w)


Measured memory_bytes: 3700
s=input()
a=s.lower()
l=len(s)
count=0
dif=0

if s[0]=='A':
  for i in range(2,l-1):
    if s[i]=='C':
      count+=1
  if count==1:
    for i in range(1,l):
      if s[i]!=a[i]:
        dif+=1
    if dif==1:
      print('AC')
      exit()
print('WA')

Measured memory_bytes: 9052
process.stdin.resume();
process.stdin.setEncoding('utf8');
var input = '';
process.stdin.on('data', function (chunk) {
  input += chunk;
});
process.stdin.on('end', function () {
  var lines = input.split('\n');
  var l = 0;
  while (true) {
    var w = Number(lines[l++]);
    if (w === -1) {
      break;
    }
    var ans = 1150;
    if (w > 10) {
      ans += Math.min(10, w - 10) * 125;
    }
    if (w > 20) {
      ans += Math.min(10, w - 20) * 140;
    }
    if (w > 30) {
      ans += (w - 30) * 160;
    }
    console.log(4280 - ans);
  }
});

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

int main()
{
	long long n, m;
	cin >> n >> m;

	long long cn = 0;
	if (1 < n) {
		cn = n * (n - 1) / 2;
	}

	long long cm = 0;
	if (1 < m) {
		cm = m * (m - 1) / 2;
	}

	cout << cn + cm << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vl vector<ll>
#define ti tuple<int, int, int>

int main() {

    string S;
    int Q;
    cin >> S >> Q;

    int reverse_count = 0;

    int T, F;
    string C;
    string head = "";
    string tail = "";
    for (int i = 0; i < Q; i++) {
        cin >> T;
        if (T == 1) {
            // reverse(S.begin(), S.end());
            reverse_count++;
        }
        else{
            cin >> F >> C;
            if (F == 1) {
                if (reverse_count%2 == 0) {
                    // S = C + S;
                    head += C;
                }
                else {
                    // S = S + C;
                    tail += C;
                }
            }
            else {
                if (reverse_count%2 == 0) {
                    // S = S + C;
                    tail += C;
                }
                else {
                    // S = C + S;
                    head += C;
                }
            }
        }

    }

    if (reverse_count%2 == 1) {
        reverse(S.begin(), S.end());
        reverse(tail.begin(), tail.end());
        cout << tail << S << head << endl;
    }
    else {
        reverse(head.begin(), head.end());
        cout << head << S << tail << endl;
    }

    return 0;
}


Measured memory_bytes: 1088
use proconio::input;
use std::cmp;
fn main() {
    input!{
        n:usize,k:i64,a:[i64;n],
    }
    let ans=solve(n,k,&a);
    println!("{}",ans);
}

fn ceil(a:i64,b:i64)->i64{
    if b==0{
        return 0;
    }
    (a+b-1)/b
}
fn solve(n:usize,k:i64,a:&[i64])->i64{
    let mut max_a:i64=0;
    for i in 0..n{
        max_a=cmp::max(max_a,a[i]);
    }
    let mut right:i64=max_a;
    let mut left:i64=0;
    while right-left>1{
        let x:i64=(right+left)/2;
        let mut cut_times:i64=0;
        for i in 0..n{
            cut_times+=ceil(a[i],x)-1;
        }
        if cut_times>k{
            left=x;
        }
        else {
            right=x;
        }
    }
    right
}

Measured memory_bytes: 5408
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define endl "\n"
 
const ll mod=1e9+7;
 
int main(){
	ios_base::sync_with_stdio(false);
 
	ll n,k;
	cin>>n>>k;
	pair<ll,ll>a[n+1];
	for(ll i=1;i<=n;i++){
		cin>>a[i].second;
		a[i].first=abs(a[i].second);
	}
	sort(a+1,a+n+1);
	reverse(a+1,a+n+1);
	ll cnt=0;
	for(ll i=1;i<=k;i++){
		if(a[i].second<0) cnt++;
		if(a[i].second==0){
			cnt=0;
			break;
		}
	}
	if(cnt%2==0){
		ll res=1;
		for(ll i=1;i<=k;i++){
			res=(res*a[i].first)%mod;
		}
		cout<<res<<endl;
		return 0;
	}
	ll smallminus=-1,smallplus=-1,bigminus=-1,bigplus=-1;
	for(ll i=1;i<=k;i++){
		if(a[i].second<0){
			smallminus=i;
		}else{
			smallplus=i;
		}
	}
	for(ll i=n;i>k;i--){
		if(a[i].second<0){
			bigminus=i;
		}else{
			bigplus=i;
		}
	}
	if((smallplus==-1 || bigminus==-1) && (bigplus==-1 || smallminus==-1)){
		reverse(a+1,a+n+1);
		ll res=1;
		for(ll i=1;i<=k;i++){
			res=(res*a[i].first)%mod;
		}
		res=(res*-1);
		res=(res+mod)%mod;
		cout<<res<<endl;
		return 0;
	}
	if(smallplus==-1 || bigminus==-1){
		ll res=1;
		for(ll i=1;i<=k;i++){
			if(i==smallminus) continue;
			res=(res*a[i].first)%mod;
		}
		res=(res*a[bigplus].first)%mod;
		cout<<res<<endl;
		return 0;
	}
	if(smallminus==-1 || bigplus==-1){
		ll res=1;
		for(ll i=1;i<=k;i++){
			if(i==smallplus) continue;
			res=(res*a[i].first)%mod;
		}
		res=(res*a[bigminus].first)%mod;
		cout<<res<<endl;
		return 0;
	}
	ll y=(a[bigplus].first*a[smallplus].first)-(a[smallminus].first*a[bigminus].first);
	if(y!=0){
		ll d=a[smallminus].first*a[smallplus].first;
		if(y>0){
			if(d<0) y=-1;
			else y=1;
		}else{
			if(d<0) y=1;
			else y=-1;
		}
	}
	if(y>=0){
		ll res=1;
		for(ll i=1;i<=k;i++){
			if(i==smallminus) continue;
			res=(res*a[i].first)%mod;
		}
		res=(res*a[bigplus].first)%mod;
		cout<<res<<endl;
		return 0;
	}else{
		ll res=1;
		for(ll i=1;i<=k;i++){
			if(i==smallplus) continue;
			res=(res*a[i].first)%mod;
		}
		res=(res*a[bigminus].first)%mod;
		cout<<res<<endl;
		return 0;
	}
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	while(true){
		int N=in();
		if(!N) break;

		int ans = 1<<30;
		int A=N/200;
		for(int a=0;a<=A;a++){
			int B=(N-200*a)/300;
			for(int b=0;b<=B;b++){
				int R=N-200*a-300*b;
				if(R>=0 && !(R%500)){
					int c=R/500;
					int V = (a/5)*1520+(a%5)*380;
					V += (b/4)*1870+(b%4)*550;
					V += (c/3)*2244+(c%3)*850;
					ans = min(ans,V);
				}
			}
		}
		
		out(ans);
	}
	return 0;
}



Measured memory_bytes: 3096
#include <iostream>
  
int main() {

        int T=3;
        int arr[T];

        for(int i=0; i<T; i++) std::cin >> arr[i];
        std::swap(arr[0], arr[1]);
        std::swap(arr[0], arr[2]);

        for(int i=0;i<T;i++) std::cout << arr[i] << " ";

  return 0;
}

Measured memory_bytes: 256
using System;

class Program
{
    static void Main()
    {
        var input = Console.ReadLine();

        var flag = true;
        for (int i = 0; i < input.Length; i++)
        {
            if (i % 2 == 0 &&
                input[i] != 'R' && input[i] != 'U' && input[i] != 'D')
            {
                flag = false;
            }
            else if (i % 2 == 1 &&
                input[i] != 'L' && input[i] != 'U' && input[i] != 'D')
            {
                flag = false;
            }
        }
        Console.WriteLine(flag ? "Yes" : "No");
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(long long i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,N-1,0)
#define RREPS(i,n) RFOR(i,N,1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
const int INF=1e18;
const int MOD=1e9+7;

signed main(){
    int N;cin>>N;
    int A[N];
    REP(i,N)cin>>A[i];
    int to=0,from=0;
    int sum=A[0];
    int ans=N;
    while(from<N){
        while(to<N-1&&sum+A[to+1]==(sum ^ A[to+1])){
            to++;
            sum+=A[to];
        }
        ans+=to-from;
        sum-=A[from];
        from++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <math.h>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <set>
#include <queue>
#include <sstream>
#include <stack>
#include <deque>
#include <memory.h>
#include <cassert>
#include <ctime>
#include <climits>
#include <list>
#include <time.h>
#include <unordered_map>
#include <bitset>
#include <exception>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef unsigned long long ull;
#define pb push_back
#define mp make_pair
#define INPUT "/Users/bekhzodsoliev/Desktop/C++/cp/cp/file.in"
#define OUTPUT "/Users/bekhzodsoliev/Desktop/C++/cp/cp/file.out"
#define lc v << 1
#define rc (v << 1) + 1
#define inf 1e+9
#define linf ll(1e+18)
#define dinf 1e+14

void solve()
{
    string s;
    cin >> s;
    for(int i = 0; i < (int) s.length(); i++)
    {
        if(s[i] == ',')
        {
            cout << " ";
        }
        else
        {
            cout << s[i];
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0); cout.tie(0);
    //freopen(INPUT, "r", stdin);freopen(OUTPUT, "w", stdout);
    //freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
    int t = 1;
    //cin >> t;
    
    
    while(t--)
    {
        solve();
    }
    
    return 0;
}


Measured memory_bytes: 256
n=gets.to_i

arr=gets.split.map(&:to_i)


arr2=arr.sort

if  n==2
    puts "#{arr2[-1]} #{arr2[0]}"
    exit
end


a=arr2[-1]


   key=(a.to_f)/2
   
   arr=arr[0..n-2]
    
 arr4=arr.min_by{ |j| (j-key).abs}

puts "#{a} #{arr4}"














Measured memory_bytes: 10112
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vd=vector<double>;
using vvd=vector<vd>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using vs=vector<string>;
#define rep(i,n) range(i,0,n)
#define range(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define LINF    	((ll)1ll<60)
#define INF     	((int)1<<30)
#define EPS     	(1e-9)
#define MOD     	(1000000007)
#define fcout(a)	cout<<setprecision(a)<<fixed
#define fs 			first
#define sc			second
#define PI			3.141592653589793

template<class S,class T>ostream& operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s; a=0;} return os;}
/*
 * 自明
 */

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


int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	
	int n;
	ll a=0;
	cin>>n;
	rep(i,n){
	    ll t; cin>>t;
	    a+=t-1;
	}
	cout<<a<<endl;
	return 0;
}


Measured memory_bytes: 256
n, p = map(int, input().split())
x = p
so = []
for i in range(2, int(p**(1/2))+1):
    c = 0
    while x%i==0:
        c += 1
        x //= i
    if c:
        so.append([c, i])
    if x==1:
        break
if x:
    so.append([1, x])
result = 1
for s, t in so:
    result *= t**(s//n)
print(result)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;

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

int main(){
 ll h,w;
 cin>>h>>w;
 vector<vector<bool> > map(h+2,vector<bool>(w+2,false) );
 vector<vector<ll> > dp( h+2, vector<ll>(w+2,inf) );
 for(int i=1;i<=h;i++){
  for(int j=1;j<=w;j++){
   char tmp;
   cin>>tmp;
   if( tmp == '.' ){
    map[i][j] = true;
   }
  }
 }

 dp[1][1] = 0;
 if( !map[1][1] ) dp[1][1] = 1;
 for(int i=1;i<=h;i++){
  for(int j=1;j<=w;j++){
   if( i==1 && j==1 ){
    continue;
   }
   
   int di = dp[i-1][j];
   int dj = dp[i][j-1];
   if( !map[i][j] && map[i-1][j] ) di++;
   if( !map[i][j] && map[i][j-1] ) dj++;
   dp[i][j] = min( di , dj );
  }
 }

 /*for(int i=1;i<=h;i++){
  for(int j=1;j<=w;j++){
   cout<<dp[i][j]<<' ';
  }
  cout<<endl;
 }*/
 cout<<dp[h][w]<<endl;

    return 0;
}


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

long long DigitSum(long long n){
    
    long long res = 0;
    while(n > 0){
        res += n % 10;
        n /= 10;
    }

    return res;
}

long long po(long long n){
    
    long long res = 1;
    for(int i = 0; i < n; i++){
        res *= 10;
    }

    return res;
}

int main(){

    long long ans = 0;
    long long n; cin >> n;
    for(int i = 0; i < 20; i++){
        long long temp = (n / po(i)) * po(i);
        //cout << temp << endl;
        ans = max(ans, DigitSum(temp));
        ans = max(ans, DigitSum(temp - 1));        
    }

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

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)<(y)?(x):(y))
#define FOR(i,m,n) for(i=m;i<n;i++)

int main(void)
{
	long long int a=0,c,x=0,i;
	char b[100010];
	scanf("%s",&b);
	c=strlen(b);
	for(i=0;i<c;i++){
		if(b[i]=='0'){
			a++;
		}
	}
	x=min(a,c-a);
	printf("%lld",x*2);
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		// 入力
		String s = sc.next();

		int ramen = 700;
		for (int i = 0; i < s.length(); i++){
			if(s.charAt(i) == 'o'){
				ramen+= 100;
			}
		}

		// 出力
		System.out.println(ramen);
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long;


int main(){
    int r;
    cin >> r;
    cout << r  * r << endl;
}

Measured memory_bytes: 256