akhauriyash/Code-Regression huggingface dataset:
using System;
class aoj
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        int[] b = new int[6];
        for(int i = 0; i < n; i++)
        {
            double a = double.Parse(Console.ReadLine());
            if (a < 165)
                b[0]++;
            else if (a >= 165 && a < 170)
                b[1]++;
            else if (a >= 170 && a < 175)
                b[2]++;
            else if (a >= 175 && a < 180)
                b[3]++;
            else if (a >= 180 && a < 185)
                b[4]++;
            else
                b[5]++;
        }
        for(int i = 0; i < 6; i++)
        {
            Console.Write("{0}:", (i + 1));
            for (int j = 0; j < b[i]; j++)
                Console.Write("*");
            Console.WriteLine();
        }
    }
}

Measured memory_bytes: 9096
#include <stdio.h>
#define STRING_LEN 3

int main(void) {
  char up[STRING_LEN], mid[STRING_LEN], down[STRING_LEN];
  
  scanf("%s", up);
  scanf("%s", mid);
  scanf("%s", down);
  
  printf("%c%c%c\n", up[0], mid[1], down[2]);
  
  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void)
{   int a,b,i;
    char op;
   
    for(i=0;;i++){
        scanf("%d %c %d", &a,&op,&b );
        if(op=='?')break;
           if(op=='+'){
               printf("%d\n",a+b);
           }else if(op=='-'){
               printf("%d\n",a-b);
           }else if(op=='*'){
               printf("%d\n",a*b);
           }else{
               printf("%d\n",a/b);
           }
    }
    return 0;
           }



Measured memory_bytes: 2076
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long[] passenger = new long[5];
		for(int i=0;i<5;i++) {
			passenger[i]=sc.nextLong();
		
		}
		Arrays.sort(passenger);
		
		System.out.println((long)Math.ceil(((double)n/(double)passenger[0])+4));
		}
	}


Measured memory_bytes: 21588
n, y = map(int,input().split())
flag=False
for i in range(y//10000, -1, -1):
    for j in range((y-i*10000)//5000, -1, -1):
        k=(y-i*10000-j*5000)/1000
        if i+j+k==n:
            print(str(i)+" "+str(j)+" "+str(int(k)))
            flag=True
            break
    if flag==True:
        break
if flag==False:
    print("-1 -1 -1")

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

namespace AtCoder
{
	class Program
	{
		public static void Main()
		{
			var intArray = IO.ReadIntArray();
			var combinationNum = Util.CombinationNum(intArray[0] + intArray[1] , 2);
			combinationNum -= (intArray[0] * intArray[1]);
			IO.Write(combinationNum);
		}
	}

	public static class IO
	{
		public static string   Read()								 { return Console.ReadLine(); }
		public static string[] ReadArray(char iSplitter = ' ')		 { return Read().Split(iSplitter); }
		public static int	   ReadInt()							 { return int.Parse(Read()); }
		public static int[]	   ReadIntArray(char iSplitter = ' ')	 { return ReadArray().Select(iText => int.Parse(iText)).ToArray(); }
		public static long	   ReadLong()							 { return int.Parse(Read()); }
		public static long[]   ReadLongArray(char iSplitter = ' ')	 { return ReadArray().Select(iText => long.Parse(iText)).ToArray(); }
		public static double   ReadDouble()							 { return double.Parse(Read()); }
		public static double[] ReadDoubleArray(char iSplitter = ' ') { return ReadArray().Select(iText => double.Parse(iText)).ToArray(); }
		public static char[]   ReadCharArray()						 { return Read().ToCharArray(); }

		public static void Write(string iValue)									   { Console.WriteLine(iValue); }
		public static void Write(int iValue)									   { Console.WriteLine(iValue); }
		public static void Write(IEnumerable<int> iValue , string iJoinWord = " ") { Console.WriteLine(string.Join(iJoinWord , iValue)); }
		public static void Write(long iValue)									   { Console.WriteLine(iValue); }
		public static void Write(double iValue)									   { Console.WriteLine(iValue); }
		public static void Write(decimal iValue)								   { Console.WriteLine(iValue); }
		public static void Write(bool iValue)									   { Console.WriteLine(iValue ? "Yes" : "No"); }
	}

	public static class Util
	{
		public static long Gcd(long i0 , long i1) { return (i0 > i1) ? _Gcd(i0 , i1) : _Gcd(i1 , i0); }
		public static long Lcm(long i0 , long i1) { return (i0 * i1) / Gcd(i0 , i1); }
		public static long ModPow(long iBaseNumber , long iPow , long iModNumber)
		{
			var num = 1L;
			while(iPow != 0)
			{
				if((iPow & 0x1) != 0)
				{
					num = (num * iBaseNumber) % iModNumber;
				}
				iBaseNumber = (iBaseNumber * iBaseNumber) % iModNumber;
				iPow >>= 1;
			}
			return num;
		}
		public static long CombinationNum(int iLeftNumber , int iRightNumber)
		{
			if(iRightNumber == 0) { return 1; }
			if(iLeftNumber == 0)  { return 0; }
			return iLeftNumber * CombinationNum(iLeftNumber - 1 , iRightNumber - 1) / iRightNumber;
		}

		private static long _Gcd(long i0 , long i1)	{ return (i1 == 0) ? i0 : _Gcd(i1 , i0 % i1); }
	}
}


Measured memory_bytes: 13268
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define rep(i, a, b) for (int i=a; i<(b); i++)
#define rp(i, a) for (int i=0; i<(a); i++)
#define repd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define rpd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(9);
    cout << std::fixed;

    char cur;
    ll cnt=0;
    string s;
    cin >> s;
    rp(i,s.length()){
        if(i == 0) cur = s[i];
        else {
            if(cur != s[i]){
                cur = s[i];
                cnt++;
            }
        }
    }
    cout << cnt<<endl;
    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <functional>

using namespace std;



int main() {


	int a, b;

	cin >> a >> b;

	if (a + b > 9) {
		cout << "error" << endl;
	}
	else {
		cout << a + b << endl;
	}



}



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

int main()
{
  	int n;
  	cin>>n;
  	long h = 0;
  	if(n >= 500)
    {
    	h += 1000*(n/500);
      	n %= 500;
    }
  	/*else if(n >= 100)
    	n %= 100;
  	else if(n >= 50)
      	n %= 50;
  	else if(n >= 10)
      	n %= 10;*/
  	if(n >= 5)
    {
    	h += 5*(n/5);
      	n %= 5;
    }
  	cout<<h<<"\n";
	return 0;
}


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

#define REP(i,s,n) for(int i=s; i<n; ++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

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

int main(){
	ll n, k, c;
	cin >> n >> k >> c;
	string s;
	cin >> s;
	vector<bool> is_o(n);
	set<ll> day1;
	rep(i, n) is_o[i] = (s[i] == 'o');

	ll cnt = 0;
	ll rest = IINF;
	rep(i, n){
		if(is_o[i] && rest >= c){
			cnt++;
			day1.insert(i+1);
			rest = 0;
		}else{
			rest++;
		}
	}

	if(cnt == k){
		set<ll> day2;
		ll rest = IINF;
		for(int i = n - 1; i >=0; --i){
			if(is_o[i] && rest >= c){
				day2.insert(i+1);
				rest = 0;
			}else{
				rest++;
			}
		}
		set<ll> result;
		set_intersection(day1.begin(), day1.end(),day2.begin(), day2.end(),inserter(result, result.end()));
		for(auto it :result) cout << it << endl;
	}

	return 0;
}


Measured memory_bytes: 29828
#include<bits/stdc++.h>
using namespace std;
int d[110];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int i,n,t=0;
    cin>>n;
    for(i=0;i<2*n;i++)cin>>d[i];
    sort(d,d+2*n);
    for(i=0;i<n;i++)t+=d[i*2];
    cout<<t;
    return 0;
}


Measured memory_bytes: 892
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
int main(){
 long long x,money=100;
 long long year=0;
 scanf("%lld",&x);
 while(money<x){
  year++;
  money+=money*0.01;
 }
  
 printf("%lld\n",year);
return 0;} 

Measured memory_bytes: 1736
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long[] x = new long[n];
    long[] y = new long[n];
    for(int i = 0; i < n; i++) {
      x[i] = sc.nextLong();
      y[i] = sc.nextLong();
    }
    int ans = 100;
    for(int i = 0; i < n; i++) {
      for(int j = 0; j < n; j++) {
        if(i != j) {
          long p = x[i] - x[j];
          long q = y[i] - y[j];
          int t = 0;
          for(int k = 0; k < n; k++) {
            for(int l = 0; l < n; l++) {
              if(k != l) {
                if((p == (x[k] - x[l])) && (q == (y[k] - y[l]))) t++;
              }
            }
          }
          ans = Math.min(ans, n - t);
        }
      }
    }
    if(ans == 100) ans = 1;
    System.out.println(ans);
  }
}

Measured memory_bytes: 22100
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		double ans = 0;
		for(int i = 0; i < N; i++) {
			double money = sc.nextDouble();
			String kind = sc.next();
			if(kind.equals("JPY")) {
				ans += money;
			} else {
				ans += money * 380000;
			}
		}
		System.out.println(ans);
	}

}


Measured memory_bytes: 24148
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        solve();
    }

    private static void solve() {
        Scanner input = new Scanner(System.in);

        int n = input.nextInt();
        int[] nums = new int[n];

        int first = 0;
        int second = 0;

        for (int i = 0; i < n; i++) {
        	nums[i]  = input.nextInt();
        	if (nums[i] >= first) {
        		second = first;
        		first = nums[i];
        	} else if (nums[i] >= second) {
        		second = nums[i];
        	}
        }

        for (int i = 0; i < n; i++) {
        	if (nums[i] == first) {
                System.out.println(second);
        	} else {
                System.out.println(first);
        	}
        }
    }
}


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

int main()
{
	int num1,num2,num3,num4,num5,num6,num7,num8,num9,num10;

	cin>>num1>>num2>>num3>>num4>>num5>>num6>>num7>>num8;
	num9=num1+num2+num3+num4;
	num10=num5+num6+num7+num8;
	if(num9>=num10){
		cout<<num9;
	}
	if(num9<num10){
		cout<<num10;
	}
	cout<<"\n";
	return 0;
}

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

ll digit(ll n){
  int i=0;
  while(n!=0){
    n/=10;
    i++;
  }
  return i;
}

ll f(ll a,ll b){
  return max(digit(a),digit(b));
}

int main(){
  int i,j,cnt=0;
  ll n;
  cin>>n;
  int mi=0;
  int a=(int)round(sqrt(n));
  for(i=a;i>1;i--){
    if(n%i==0){
      cout<<f((ll)i,(ll)n/i);
      return 0;
    }
  }
  cout<<digit(n);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair

using namespace std;

int main()
{
   FAST/**/
   
   string s;
   cin>>s;
   
   if(s == "SUN")
        cout<<7;
   else if(s == "MON")
        cout<<6;
   else if(s == "TUE")
        cout<<5;
   else if(s == "WED")cout<<4;
   else if(s == "THU")cout<<3;
   else if(s == "FRI")cout<<2;
   else cout<<1;
   
   return 0;
}  
   

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

using namespace std;
using Int = long long int;
using UInt = unsigned long long int;

int main(void) {
    Int n;
    cin >> n;
    vector<Int> c(n);
    vector<Int> s(n);
    vector<Int> f(n);
    for (Int i = 0; i < n; ++i) {
        cin >> c[i] >> s[i] >> f[i];
    }
    Int t;
    for (Int i = 0; i < n; ++i) {
        t = 0;
        for (Int j = i; j < n - 1; ++j) {
            t = max(t, s[j]);
            if (t % f[j] != 0) {
                t += (f[j] - (t % f[j]));
            }
            t += c[j];
        }
        cout << t << endl;
    }
    return 0;
}



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

int main(){
    int n, k;
    cin >> n >> k;
    int b = 1;
    for(int i = 1; i <= n; ++i){
        b *= k;
        if(n < b){
            cout << i << "\n";
            break;
        }
    }
    return 0;
}

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

int main() {
  ll n;
  cin>>n;
  ll a[n];
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  sort(a,a+n);
  ll ans=a[0];
  for(int i=1;i<n;i++)
  {
    ans=__gcd(ans,a[i]);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1152
x, y = map(int, input().split())

if (x+y)%3 != 0:
    print(0)
    exit()
if y > 2*x:
    print(0)
    exit()
if 2*y < x:
    print(0)
    exit()

if x > y:
    x, y = y, x

cnt = 0
while(y != 2*x):
    y += 1
    x -= 1
    cnt += 1

def mod_combination(n, k):
    mod = 1000000007
    v = 1
    for i in range(1, k+1):
        v *= n
        v %= mod
        v *= pow(i, mod-2, mod)
        v %= mod
        n -= 1
    return v % mod

print(mod_combination(x, cnt))

Measured memory_bytes: 3064
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 2000000000;//10^9
ll MOD  = 1000000007;
ll dp[100010];
ll h[100010];

int main() {
    int N;
    cin >> N;
    for(int i = 1;i <= N; i++){
        cin >> h[i];
    }
    
    dp[0] = INF;
    dp[1] = 0;
    for(int i = 2; i <= N; i++){
        dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]));
    }
    cout << dp[N] << endl;
}

Measured memory_bytes: 1792
// https://atcoder.jp/contests/abc156/tasks/abc156_e
// AtCoder Beginner Contest 156
// E - Roaming

/*
Problem.
n個の部屋に１人ずつ初期状態でいる時、1回の移動で1人が他の部屋に移動する。
k回の移動が発生する時、移動後の各部屋の人数の組み合わせとしてあり得るものは
何通りか？

Point.
空になる部屋の数v(0<=v<=min(n,k))についてsum({n-1Cn-v * n-1Cv})
*/

#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>

using namespace std;
using ll = long long;

const int maxn = 200000 + 10;
int fac[maxn], invfac[maxn];

#define MOD 1000000007
long long qpow(long long a, long long b){
    long long s = 1;
    while (b > 0) {
        if (b & 1)s = s * a % MOD;
        a = a * a % MOD;
        b >>= 1;
    }
    return s;
}
void init() {
    int n = maxn - 1;
    fac[0] = 1;
    for (int i = 1; i <= n; ++i)
        fac[i] = 1ll * fac[i - 1] * i % MOD;
    invfac[n] = qpow(fac[n], MOD - 2);
    for (int i = n - 1; i >= 0; --i) {
        invfac[i] = 1ll * invfac[i + 1] * (i + 1) % MOD;
    }
}
long long comb(int n, int m) {
    if (n < m) return 0;
    return 1ll * fac[n] * invfac[m] % MOD * invfac[n - m] % MOD;
}
ll comb_rep(int n, int m){ //重複組み合わせ
  return comb(n+m-1, m);
}


int main(){
  init();
  ll n, k;
  cin >> n >> k;
  ll ans = 0;
  for(int i = 0; i <= min(n-1, k); i++){
    ans += comb(n, i) * comb_rep(n-i, i);
    ans %= MOD;
  }
  cout << ans << endl;
}


Measured memory_bytes: 1792
#include <cstdio>

void printInt(long long& value);
void scanInt(long long* value);
void scanIntArray(long long* array, long long count);

int main() {
	long long N, A[100001], B[100000];
	scanInt(&N);
	scanIntArray(A, N + 1);
	scanIntArray(B, N);

	long long result = 0;

	for (int i = N; i > 0; --i) {
		if (A[i] >= B[i - 1]) {
			result += B[i - 1];
			continue;
		} else {
			B[i - 1] -= A[i];
			result += A[i];
		}

		if (A[i - 1] > B[i - 1]) {
			A[i - 1] -= B[i - 1];
			result += B[i - 1];
		} else {
			result += A[i - 1];
			A[i - 1] = 0;
		}
	}

	printInt(result);
}

void printInt(long long& value) {
	printf("%lld", value);
}

void scanIntArray(long long* array, long long count) {
	for (int i = 0; i < count; ++i) {
		scanInt(array + i);
	}
}

void scanInt(long long* value) {
	scanf("%lld", value);
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;

int main(){
  int n;
  cin >> n; 
  ll diff = n / 15 * 200;
  cout << n * 800 - diff << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		
		Scanner scan = new Scanner(System.in);

		int i = 1;

		while(true){
		    int x = scan.nextInt();
		    if(x==0) break;
		    System.out.println("Case " + (i++) + ": " + x );
		}
	}
} 

Measured memory_bytes: 33056
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
su = sum(A)
counter = Counter(A)
lis = {}
for i in range(Q):
  B, C = map(int, input().split())
  su -= B * counter[B]
  su += C * counter[B]
  counter[C] += counter[B]
  counter[B] = 0
  print(su)

Measured memory_bytes: 23668
package main

import "fmt"

func main() {
	var t int
	fmt.Scan(&t)
	for i := 0; i < t; i++ {
		solve()
	}
}

func solve() {
	var n, a, b, c, d int
	fmt.Scan(&n, &a, &b, &c, &d)

	memo := make(map[int]int)
	var rec func(n int) int
	rec = func(n int) int {
		if n == 0 {
			return 0
		}
		if n == 1 {
			return d
		}
		if v, ok := memo[n]; ok {
			return v
		}

		res := int(1e18)

		if n*d > 0 {
			res = min(res, n*d)
		}

		res = min(res, rec(n/2)+a+(n%2)*d)
		res = min(res, rec((n+1)/2)+a+n%2*d)
		res = min(res, rec((n)/3)+b+n%3*d)
		res = min(res, rec((n+2)/3)+b+(3-n%3)*d)
		res = min(res, rec((n)/5)+c+n%5*d)
		res = min(res, rec((n+4)/5)+c+(5-n%5)*d)

		memo[n] = res
		return res
	}
	fmt.Println(rec(n))
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}


Measured memory_bytes: 6700
#include <bits/stdc++.h>
using namespace std;
int main()
{
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	long long int n,d,x,y,z=0;
	cin>>n>>d;
	d=d*d;
	while(n--)
    {
        cin>>x>>y;
        if(x*x+y*y<=d)
        {
            z++;
        }
    }
    cout<<z<<endl;
	return 0;
}


Measured memory_bytes: 3600
from heapq import heappush, heappop

N, K = map(int, input().split())
A = list(map(int, input().split()))
F = list(map(int, input().split()))

F.sort()
x = [a * b for a, b in zip(F, sorted(A, reverse=True))]

ub = max(x)
lb = 0
while ub - lb > 1:
    mid = (ub + lb) // 2
    res = 0
    for i in range(N):
        tmp = max(0, x[i] - mid)
        res += -(-tmp // F[i])

    if res <= K:
        ub = mid
    else:
        lb = mid

if sum(A) <= K:
    print(0)
else:
    print(ub)



Measured memory_bytes: 123824
#include<stdio.h>
#include<math.h>
#define PI 3.141592653589793238
int main(){
   int A,B,H,M;
   scanf("%d%d%d%d",&A,&B,&H,&M);
   long double ans;

   ans = cos(2*PI*(H/12.0 + (M/(60.0*12.0)) - M/60.0));
   printf("%.20lf\n",sqrt(A*A+B*B-2*A*B*ans));
   return 0;
}


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

int main()
{
    int n, m;
    string str = "";

    cin >> n >> m;

    vector<int> s(m), c(m);
    for(int i = 0; i < m; ++i)
    {
        cin >> s[i] >> c[i];
    }

    for(int i = 0; i < 1000; ++i)
    {
        str = to_string(i);

        if(n != str.size())
            continue;

        bool check = true;
        for(int j = 0; j < m; ++j)
        {
            if(int (str[s[j] - 1]) - 48 != c[j])
            {
                check = false;
            }
        }
        if(check) 
        {
            cout << i << "\n";
            return 0;
        }
    }

    cout << -1 << "\n";

    return 0;
}

Measured memory_bytes: 3664
lst = []
for i in range(int(input())):
    S,P = input().split()
    lst.append([S,int(P),i+1])
lst2 = sorted(lst, key=lambda x:x[1],reverse=True)
lst3 = sorted(lst2, key=lambda x:x[0],reverse=False)
for i in lst3:
    print(i[2])

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

int main()
{
    int n;
    cin>>n;
    int suma=0,sumb=0;
    REP(i,n)
    {
        string a,b;
        cin>>a>>b;
        if(a>b)suma+=3;
        else if (a<b)sumb+=3;
        else {suma++;sumb++;}
    }cout<<suma<<" "<<sumb<<endl;
}




Measured memory_bytes: 3220
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
D = [V[i] - C[i] for i in range(N)]
F = [d for d in D if d > 0]
if len(F) == 0:
  print(0)
else:
  print(sum(F))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#include<stdio.h>
#include<string>
using namespace std;
#define pb push_back
#define pf push_front

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define sz(x) int(x.size())
#define INF 1e5
int main(){
	ll n;
	cin>>n;
	vi a(n+1),b(n+1);
	rep(i,n+1) cin>>a[i];
	rep(i, n) cin>>b[i];
	ll ans=0;
	rep(i,n){
			ans+=min(a[i]+a[i+1],b[i]);
			a[i+1]=min(max(a[i]+a[i+1]-b[i],0),a[i+1]);
		}
	cout<<ans<<endl;
}

Measured memory_bytes: 1024
'use strict';

function Main(INPUT) {
    const A = INPUT.split(" ").map(n => Number(n));
    A.sort((a, b) => a - b);
    console.log((A[1] - A[0]) + (A[2] - A[1]));
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
struct P
{
    //string r;
    int x,y,z;

    bool operator<(const P &a)const{
       // if(y!=a.y)
       // return y>a.y;
       return x>a.x;
//        return z>a.z;
    }
};

vector<P> v[5555];
//bitset<4001000> b;
int a,c,i,b,k,d,n,m,e;//dy[15]={0,1,0,-1,-1,1,-1,1},dx[15]={1,0,-1,0,1,1,-1,-1};//
int l[5555];
int o[5400];
int dx[10]={0,1,0,-1},dy[10]={1,0,-1,0},dz[10]={0,0,0,0,1,-1};

long long x,y,z,mod=1000000007;
P u[111111];
double j[111];

stack<int> s;
queue<P> q;
//'1'==49;
//'A'==65;
//'a'==97;
//unordered_
map<int,int > p;
//list<int> l;
string r;
//char r[333][333];


bool as(P a,P b)
{
    if(a.x!=b.x) return a.x<b.x;
    return a.y>b.y;
}


int main()
{
    scanf("%d",&a);
    for(int t=1;t<=2*a;t++)
        scanf("%d",&o[t]);
    sort(o+1,o+1+2*a);
    for(int t=1;t<=2*a;t+=2)
        k+=o[t];
    printf("%d",k);
}


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

using namespace std;

typedef long long ll;

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

  ll a,b;cin>>a>>b;
  if(a*b<=0){
      cout<<"Zero"<<endl;
      return 0;
  }
  else if(a>0){
      cout<<"Positive"<<endl;
      return 0;
  }
  else{
      if((b-a)%2){
          cout<<"Positive"<<endl;
          return 0;
      }
      else cout<<"Negative"<<endl;
      return 0;
  }
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){

    int a[1000],n,tmp=0,j,i;
    scanf("%d",&n);

    for (i=0; i<n; i++) {
        scanf("%d",&a[i]);
    }
    for (i=0; i<n; i++) {
    for (j=0; j<n-1-i; j++) {
        tmp=a[j+1];
        a[j+1]=a[j];
        a[j]=tmp;
    }
    }
    for (i=0; i<n; i++) {
        if (i==n-1)
            printf("%d",a[i]);
        else
        printf("%d ",a[i]);
        
    }printf("\n");
    return 0;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 1000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
 
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    } 
  

  int main(){
      lint n;
      cin >>n; vector<lint> a(n);
      rep(i,n)cin >> a[i];
      bool x[200005];
      fill(x,x+200005,false);
      P p[n];
      rep(i,n){
          x[a[i]]=true;
          if(!x[a[i]+1])p[i]=make_pair(a[i],1);
          else p[i]=make_pair(a[i],0);
      }
      sort(p,p+n);
      lint count=1;
      lint longe=-INF;
      rep(i,n){
          lint s,v;
          tie(s,v)=p[i];
          if(v==1)count++;
          else{
              longe=max(count,longe);
              count=1;
          }
      }
      if(count==(n+1))cout<<0<<endl;
     else cout<<n-longe<<endl;
  }
  
     


Measured memory_bytes: 5120
#include<bits/stdc++.h>
#define int long long int
#define mod 1000000007
#define pb push_back
#define pf push_front
#define ulli unsigned long long int
#define what_is(x) cerr << #x << " is " << x << endl;
#define pi 2*acos(0.0)
#define F  first
#define S  second
//#define endl '\n'
#define all(x) x.begin(),x.end()
using namespace std;
const int INF = 1e18L+5;
/*
int power(int x,int y)
{
	int res=1;
	while(y>0)
	{
		if(y%2==1)
			res=(res*x)%mod;
		x=(x*x)%mod;
		y=y/2;
	}
	return res;
}
*/
int32_t main()
{
	//cout.precision(10);
	//cout.setf(ios::fixed,ios::floatfield);
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	int T=1;
	//cin>>T;
	while(T--)
	{
		int n,ans=INF,a=INF,b=INF,i;
		cin>>n;
		for(i=1;i*i<=n;i++)
		{
			if(n%i==0)
			{
				a=i;
				b=n/i;
				if(ans>a+b-2)
				{
					ans=a+b-2;
				}
			}
		}
		cout<<ans<<endl;
	}
}


Measured memory_bytes: 256
def cmb(n,k):
  x,y=n,k
  for i in range(1,k):
    x*=n-i
    y*=k-i
  return x//y

n,m=[int(x) for x in input().split()]
N=cmb(n,2) if n>=2 else 0
M=cmb(m,2) if m>=2 else 0
print(N+M)


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

int N,K,S[100],B[100][100];

int main(){
	while(cin>>N>>K){
		if(!N)return 0;
		for(int i=0;i<K;i++)cin>>S[i];
		for(int i=0;i<N;i++)for(int j=0;j<K;j++)cin>>B[i][j];
		int f=1;
		for(int i=0;i<K;i++){
			int s=0;
			for(int j=0;j<N;j++)s+=B[j][i];
			if(s>S[i]){f=0;break;}
		}
		if(f)cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
}

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

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define RFOR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

const double EPS = 1e-14;
const double PI  = acos(-1.0);


int main(){
  int n;
  scanf("%d", &n);

  vector<int> v(n);
  int a;
  REP (i, n) {
    scanf("%d", &a);
    v[i] = a - (i + 1);
  }

  sort(v.begin(), v.end());

  int b = v[n / 2];

  LL ans = 0;
  REP (i, n) {
    ans += abs(v[i] - b);
  }
  cout << ans << endl;
}


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

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    int ans = 0;
    cin >> n >> m;
    vector<pair<int, int> > ch;
    vector<int> box(n, 1);
    vector<bool> red(n, false);
    rep (i, m) {
        int x, y;
        cin >> x >> y;
        x--, y--;
        ch.push_back(make_pair(x, y));
    }
    red[0] = true;
    rep (i, m) {
        int x, y;
        x = ch[i].first, y = ch[i].second;
        if (red[x]) red[y] = true;
        box[x]--, box[y]++;
        if (box[x] == 0) red[x] = false;
    }
    rep (i, n) {
        if (red[i]) ans++;
    }
    cout << ans << endl;
    
    return 0;
}



Measured memory_bytes: 1784
#include<stdio.h>
int main(void)
{
	int n,i,j,m=0,mz;
	int a,b,a1=0,b1=0;
	float x,y;
	mz=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%f %f %d %d",&x,&y,&a,&b);
		if(a>=5 && b>=2){
			x-=x*0.2;
			y-=y*0.2;
			m+=x*a;
			m+=y*b;
			printf("%d\n",m);
		}
		else {
			m+=x*a;
			m+=y*b;
			a1=a;
			b1=b;
			for(j=a;j<5;j++){
				a1+=1;
			}
			x-=x*0.2;
			mz=mz+a1*x;
			for(j=b;j<2;j++){
				b1+=1;
			}
			y-=y*0.2;
			mz+=b1*y;
			if(mz<=m){
				printf("%d\n",mz);
			}
			else {
				printf("%d\n",m);
			}
		}
		a1=0;
		b1=0;
		m=0;
		mz=0;
	}
	return 0;
}

Measured memory_bytes: 1060
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;

class Main {
    
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        List<Long> list = new ArrayList<>();
        for(int i=0; i<n; i++){
            list.add(scanner.nextLong());
        }
        scanner.close();
        Collections.sort(list);
        long sum = 0;
        for(int i=list.size()-1; i>=0; i--){
            if(i>list.size()-1-k){
                continue;
            }
            sum += list.get(i);
        }
        System.out.println(sum);
    }
    
}

Measured memory_bytes: 95728
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

using namespace std;

#define FOR(a,b) for(int a=0;a<b;a++)
#define F0R(a,b,c) for(int a = b; a<=c; a++)
#define f first
#define s second
#define m0(x) memset(x,0,sizeof(x))

typedef pair<int,int> pi;
typedef long long ll;
typedef vector<int> vi;
typedef vector<pi> vpi;

const ll mod = 1e9+7;

ll fastExpo(ll base, int po){
    if(po == 0) return 1;
    if(po == 1) return base;
    ll ans = fastExpo(base,po/2);
    ans *= ans;
    ans %= mod;
    if(po&1) ans = (ans*base)%mod;
    return ans;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n; cin >> n;
    ll ans = fastExpo(10,n) - 2LL*fastExpo(9,n) + fastExpo(8,n);
    ans += 2LL*mod;
    ans %= mod;
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3652
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
#include<deque>
using namespace std;

using ll = long long;
const int INF = 1001001001;

#define rep(i,n) for (int i = 0; i < (n); ++i)

int main()
{
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  double total = 0.0;
  rep(i, n) cin >> a[i];
  rep(i, n) total += a[i];

  sort(a.begin(), a.end(), greater<int>());
  rep(i, m) {
    if (a[i] < (double)(total / (4 * m))) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 256
n,x,y=map(int,input().split())
li=[0]*(n-1)
num=0
for i in range(1,n+1):
    for j in range(i+1,n+1):
        num=min(j-i,abs(i-x)+abs(j-y)+1)
        li[num-1]+=1
for i in li:
    print(i)

Measured memory_bytes: 3444
#include<bits/stdc++.h>
using namespace std;
int h[1000001],x[1000001];
int main(){
	int n,t,a,ans=0;
	double m=1000000,x,h;
	cin>>n;
	cin>>t>>a;
	for(int i=1;i<=n;i++){
	    cin>>h;
	    x=t-h*0.006;
	    if(m>abs(x-a)){
	      	m=abs(x-a);
	      	ans=i;
	    }
	}
	cout<<ans<<endl;
	return 0; 
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());

        switch (n) {
            case 1:
                System.out.print("Hello World\n");
                break;
            case 2:
                int a = sc.nextInt(); int b = sc.nextInt();
                System.out.print(a+b+"\n");
        }


    }

}



Measured memory_bytes: 23764
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstdint>

#define rep(ident, start, end) for(int ident=start;ident<end;ident++)

using namespace std;

int main(void){
	long long K;
	string S;
	int count=0;
	cin >> S;
	cin >> K;
	rep(i, 0, S.length()){
		if (S[i] == '1')count++;
		else break;
	}
	if (K <= count)cout << 1<<endl;
	else cout << S[count] << endl;
	return 0;
}


Measured memory_bytes: 256
L,R = map(int,input().split())
width = R-L

answer = 2019
if L%2019 + width >= 2019:
  answer = 0
else:
  for i in range(L%2019,R%2019):
      for j in range(i+1,R%2019+1):
          answer = (i*j)%2019 if (i*j)%2019 < answer else answer
print(answer)

Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
using namespace std;
#define max 100000
struct card{char icon;int num;};
int partition(card a[],int p,int r){
int x=a[r].num;
	card no;
	int j,i=p-1;
		for(j=p;j<r;j++){
			if(a[j].num<=x){
				i++;
				no=a[i];
				a[i]=a[j];
				a[j]=no;
			}
		}
	no=a[i+1];
	a[i+1]=a[r];
	a[r]=no;
	return i+1;
}	
void quicks(card a[],int p,int r){
int q;
	if(p<r){
		q=partition(a,p,r);
		quicks(a,p,q-1);
		quicks(a,q+1,r);
	}
}
bool ex(card a[],card b[],int n){
	for(int i=0;i<n;i++){
		if(a[i].icon!=b[i].icon)
		return false;
	}
	return true;
}
void merge(card a[],int left,int mid,int right){
int n1=mid-left,n2=right-mid;
	card L[n1+1],R[n2+1];
	int i,j,k;
	for(i=0;i<n1;i++)L[i]=a[left+i];
	for(i=0;i<n2;i++)R[i]=a[mid+i];
	L[n1].num=R[n2].num=1000000001;
	i=j=0;
	for(k=left;k<right;k++){
		if(L[i].num<=R[j].num){
		a[k]=L[i];
			i++;
		}
		else{
		a[k]=R[j];
			j++;
		}
		
	}
	
}

void merges(card a[],int left,int right){
	int mid;
	if(left+1<right){
		
		mid=(left+right)/2;
		merges(a,left,mid);
		merges(a,mid,right);
		merge(a,left,mid,right);
	}
}
main(){
	card a[max],c[max];
	int n,i;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf(" %c %d",&a[i].icon,&a[i].num);
		c[i]=a[i];
	}
	quicks(a,0,n-1);
	merges(c,0,n);
	if(ex(a,c,n))
	printf("Stable\n");
	else printf("Not stable\n");
	for(i=0;i<n;i++)
	printf("%c %d\n",a[i].icon,a[i].num);
	return 0;
}



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

using namespace std;

void doc()
{
    freopen("solve.inp","r",stdin);
    freopen("solve.out","w",stdout);
}

void solve() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int F[n][n];
    memset(F, 0, sizeof(F));
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            if (s[i] == s[j]) {
                if (i == 0) F[i][j] = 1;
                else F[i][j] = F[i - 1][j - 1] + 1;
            }
        }
    }
    int Res = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            if (F[i][j]) {
                int Len = j - i;
                Res = max(Res, min(Len, F[i][j]));
            }
        }
    }
    cout << Res;
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr);
    //doc();
    solve();
}


Measured memory_bytes: 97920
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>

struct node{
	struct node *right;
	struct node *left;
	struct node *parent;
	int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){


}

Node treeSearch(Node u, int k){


}

Node treeSuccessor(Node x){


}

void treeDelete(Node z){
	Node y; // node to be deleted
	Node x; // child of y



}

Node sss(int k, Node x){
	if (x == NIL){ return x; }
	if (k < x->key){
		if (x->left != NIL){
			return sss(k, x->left);
		}
		else{
			return x;
		}
	}
	else{
		if (x->right != NIL){
			return sss(k, x->right);
		}
		else{
			return x;
		}
	}
}

void insert(int k){
	Node y = sss(k,root);
	Node z;

	z = malloc(sizeof(struct node));
	z->key = k;
	z->left = NIL;
	z->right = NIL;
	z->parent = y;

	if (y == NIL){ root=z; }
	else if (y->key < k){
		y->right = z;
	}
	else{
		y->left = z;
	}
}

void inorder(Node u){
	if (u->left != NIL)
		inorder(u->left);
	printf(" %d", u->key);
	if (u->right != NIL)
		inorder(u->right);	
}
void preorder(Node u){
	printf(" %d", u->key);
	if (u->left != NIL)
		preorder(u->left);
	if (u->right != NIL)
		preorder(u->right);
}


int main(){
	int n, i, x;
	char com[20];
	scanf("%d", &n);

	for (i = 0; i < n; i++){
		scanf("%s", com);
		if (com[0] == 'f'){
			scanf("%d", &x);
			Node t = treeSearch(root, x);
			if (t != NIL) printf("yes\n");
			else printf("no\n");
		}
		else if (com[0] == 'i'){
			scanf("%d", &x);
			insert(x);
		}
		else if (com[0] == 'p'){
			inorder(root);
			printf("\n");
			preorder(root);
			printf("\n");
		}
		else if (com[0] == 'd'){
			scanf("%d", &x);
			treeDelete(treeSearch(root, x));
		}
	}

	return 0;
}

Measured memory_bytes: 24040
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main()
{
    string ans = "NO";
    int a, b, c;
    cin >> a >> b >> c;
    for (int i = i; i <= b; ++i)
    {
        int t = a * i;
        if (t % b == c)
        {
            ans = "YES";
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3488
#include<iostream>
#include<algorithm>
#include<bits/stdc++.h>

using namespace std;

int main()
{
    ios::sync_with_stdio(false); 
    cin.tie(nullptr); 
    cout.tie(nullptr);        
    int a,b,c,k,gc1,sum=0;
    cin>>k;
    for(a=1;a<=k;a++)
    {
        for(b=1;b<=k;b++)
        {
            gc1 = __gcd(a,b);
            for(c=1;c<=k;c++)
            {
                sum += __gcd(gc1,c);
            }
        }
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 3640
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)

	for i := 2; i < len(s); i += 2 {
		t := s[0 : len(s)-i]
		if t[0:len(t)/2] == t[len(t)/2:] {
			fmt.Println(len(s) - i)
			return
		}
	}
}


Measured memory_bytes: 1776
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ll n,d;
    cin>>n>>d;
    int cnt=0;
    while(n!=0)
    {
        ll x,y;
        cin>>x>>y;
        ll a=ll((x*x)+(y*y));
        ll b=d*d;
        if(a<=b)
        {
            cnt++;
            
        }

n--;

    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
#define rep(var,cnt) for(int (var)=0; (var)<(int)(cnt); ++(var))
#define Rep(var,init,cnt) for(int (var)=(init); (var)<(cnt); ++(var))
#define ran(var,vec) for(auto &(var):(vec))
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define SORT(v) sort(all(v))
#define RSORT(v) sort(rall(v))
#define SUM(v) accumulate(all(v),0)
#define tget(tp,idx) get<idx>(tp)
#define TF(flag) (flag)?1:0
#define yn(f) cout<<(f?"yes":"no")<<endl
#define Yn(f) cout<<(f?"Yes":"No")<<endl
#define YN(f) cout<<(f?"YES":"NO")<<endl
#define COUT(x) cout<<(x)<<endl
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pi = pair<int,int>;
using pl = pair<ll,ll>;
using ti = tuple<int,int,int>;
using tl = tuple<ll,ll,ll>;

template<typename T>
using vec = vector<T>;
template<typename T>
using mat = vector<vec<T>>;
template<typename T>
using cub = vector<mat<T>>;
template<typename T>
using val = valarray<T>;

template<typename T>
using pq = priority_queue<T>;
template<typename T>
using rpq = priority_queue<T,vec<T>,greater<T>>;

template<typename T1,typename T2>
ostream &operator<<(ostream &os, const pair<T1,T2> &p){
  os<<"P("<<p.first<<", "<<p.second<<") ";
  return os;
}

template<typename T1,typename T2>
istream &operator>>(istream &is, pair<T1,T2> &p){
  is>>p.first>>p.second;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  cout<<"V{";
  for(int i=0; i<(int)v.size(); ++i){
    os<<v[i]<<(i+1!=v.size()?" ":"");
  }
  cout<<"}";
  return os;
}

template<typename T>
istream &operator>>(istream &is, vector<T> &v){
  for(T &in:v) is>>in;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const valarray<T> &v){
  cout<<"V{";
  for(int i=0; i<(int)v.size(); ++i){
    os<<v[i]<<(i+1!=v.size()?" ":"");
  }
  cout<<"}";
  return os;
}

template<typename T>
istream &operator>>(istream &is, valarray<T> &v){
  for(T &in:v) is>>in;
  return is;
}

// Usual Template End ================================================

// Template End ======================================================

constexpr int MOD=1e9+7;

int main(void){
  int a,b; cin>>a>>b; COUT(max({a+b,a-b,a*b}));
}













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

typedef long long ll;
using namespace std;

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

Measured memory_bytes: 256
n, k = map(int, input().split())
s = input()


c = [1]
prev = s[0]
c_ind = 0

for i in range(1, n):
    if s[i] == prev:
        c[-1] += 1
    else:
        c.append(1)
        c_ind += 1
    prev = s[i]

cur_len = len(c)
cur_sum = sum(c) - cur_len

for _ in range(k):
    if cur_len == 1:
        break
    elif cur_len == 2:
        cur_sum += 1
        break
    else:
        cur_sum += 2
        cur_len -= 2

print(cur_sum)


Measured memory_bytes: 3956
# -*- coding: utf-8 -*-
N,M,C = list(map(int,input().split()))
B= list(map(int,input().split()))


res = 0
for _ in range(N):
    A = list(map(int,input().split()))
    score = sum([a * b for a,b in zip(A,B)])
    if score + C > 0:
        res += 1
print(res)


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

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

int X[100005], Y[100005];

int main() {
	int n, W, H;
	cin >> n >> W >> H;

	memset(X, 0, sizeof(X));
	memset(Y, 0, sizeof(Y));

	rep(i, n) {
		int x, y, w;
		cin >> x >> y >> w;

		X[max(0, x-w)]++;
		X[min(W, x+w)]--;

		Y[max(0, y-w)]++;
		Y[min(H, y+w)]--;
	}

	REP(i, 1, 100005) {
		X[i] += X[i-1];
		Y[i] += Y[i-1];
	}

	bool a = true, b = true;
	REP(i, 0, W) {
		if(X[i] == 0) a = false;
	}

	REP(i, 0, H) {
		if(Y[i] == 0) b = false;
	}

	if(a || b) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 1948
#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>
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)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,ll> pll;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

    int main(){
      int a[4];
      cin >> a[0] >> a[1] >> a[2] >> a[3];
      int count[4]={};
      rep(i,4){
        if(a[i]==1)count[0]++;
        if(a[i]==9)count[1]++;
        if(a[i]==7)count[2]++;
        if(a[i]==4)count[3]++;
      }
      if(count[0]>0 && count[1]>0 && count[2]>0 && count[3]>0){
      cout << "YES" << endl;
      }else cout << "NO" << endl;
      return 0;}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
const int MOD = 1e9+7;
const int INF = 0x3f3f3f3f;
const double PI = 4*atan(1);
typedef long long ll;
typedef pair<int,int> pii;
// int gcd(int a, int b) { 
//     if (a == 0) return b; 
//     return gcd(b % a, a); 
// }
// ll power(int base, int power) {
// 	ll prod = 1;
// 	ll b = base;
// 	while(power) {
// 		if (power & 1) {
// 			prod = f(prod*b);
// 		}
// 		b = f(b*b);
// 		power/=2;
// 	}
// 	return prod;
// }
int a,b,c;
void solve() {
	cin >> a >> b >> c;
	cout << c << " " << a << " " << b << endl;
}
int main() {

	// int t;
	// cin >> t;
	// for (int i = 1; i <= t; i++) { 
		// cout << "Case #" << i << ": ";
		solve();
	// }
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>
#include<iomanip>
#include<iterator>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rep(i,n) for(int i=0; i<n; i++)
#define FOR(i,a,n) for(int i=a; i<n; i++)

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, char> plc;

string mon[] = { "thu","fri","sat","sun","mon","tue","wed"};

int main()
{
	int x;
	cin >> x;
	cout << mon[x % 7] << endl;
	return 0;
}

Measured memory_bytes: 3192
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))



def main():
    n = ii()
    
    if n == 1:
        print(0)
    elif n == 2:
        print(1)
    else:
        ans = (n*(n-1))//2
        print(ans)
main()


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

int main(void) {
  int ac = 0, wa = 0, tle = 0, re = 0;
  int n, i;
  scanf("%d", &n);
  char buf[4];
  for(i=0; i<n; i++) {
    scanf("%s", buf);
    if(strcmp(buf, "AC")==0) {
      ac++;
    } else if(strcmp(buf, "WA")==0) {
      wa++;
    } else if(strcmp(buf, "TLE")==0) {
      tle++;
    } else {
      re++;
    }
  }
  printf("AC x %d\n", ac);
  printf("WA x %d\n", wa);
  printf("TLE x %d\n", tle);
  printf("RE x %d\n", re);
  return 0;
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
  using namespace std;
  #define rep(i, n) for (int i = 0; i < (int)(n); i++)
  #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
  typedef long long ll;
  #define all(x) (x).begin(),(x).end()
  int INF = 1000000000;

  int main() {
    int W, a, b; cin >> W >> a >> b;
    int s = min(a, b);
    if (s + W >= max(a, b)) {
      cout << 0 << endl;
    }
    else {
      cout << max(a, b) - s - W << endl;
    }
  }

Measured memory_bytes: 256