akhauriyash/Code-Regression huggingface dataset:
n, k = map(int, input().split())
A = list(map(int, input().split()))

k_sum = sum(A[:k])

for i in range(k, n):
    k_sum_next = k_sum - A[i-k] + A[i]
    if k_sum < k_sum_next:
        print('Yes')
    else:
        print('No')
    k_sum = k_sum_next

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

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

  ll a, b, c, x, y; cin >> a >> b >> c >> x >> y;
  ll ans = pow(10, 10);

  ll m;
  for (ll i = 0; i <= max(x, y)*2 ; i+=2) {
    m = c*i;
    if (x-i/2 > 0) m += (x-i/2)*a;
    if (y-i/2 > 0) m += (y-i/2)*b;
    ans = min(ans, m);
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 10e9+9
#define EPS 1e-10
#define MAX_N 100100
#define MAX_M 100100

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

int n;

vector<int> divisor(int n){
	vector<int> res;
	for (int i = 1; i*i <= n; i++){
		if (n%i == 0){
			res.push_back(i);
			if (i != n / i)res.push_back(n / i);
		}
	}
	return res;
}

int main(){
	while (cin >> n&&n){
		vector<int> vi = divisor(n);
		ll sum = 0;
		REP(i, vi.size()){
			sum += vi[i];
			//cout << vi[i] << " ";
		}
		//cout << endl;
		if (sum - n == n)cout << "perfect number" << endl;
		else if (sum - n > n)cout << "abundant number" << endl;
		else cout << "deficient number" << endl;
	}
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define md 1000000007
#define ld long double
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n, i = 0, j= 0, k = 0, l = 0, m = 0, a = 0, b = 0, sum = 0, x = 0, y = 0, z = 0, c, p = 0;
    string s;
    cin >> s;
    for(i = 0; i < 3; i++){
        if(s[i] == '7'){
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";

    return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cctype>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <numeric>
#include <functional>
int main() {
	int N, b, c;
	std::cin >> N;
	std::vector<int> A(N);
	for (int i = 0; i < N;++i) {
		std::cin >> A[i];
	}
	b = *std::max_element(A.begin(), A.end());
	c = *std::min_element(A.begin(), A.end());
	std::cout << b - c << std::endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
b_list = list(map(int, input().strip().split()))

a_list = [b_list[0]]

for i in range(N - 1):
	b = b_list[i]
	if a_list[i] > b:
		a_list[i] = b
	a_list.append(b)
print(sum(a_list))


Measured memory_bytes: 3060
using System;
using System.Linq;

namespace ABC074_B
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var k = int.Parse(Console.ReadLine());
            var x = Console.ReadLine().Split().Select(int.Parse).ToArray();

            var d = x.Sum(a => Math.Min(a * 2 , (k - a) * 2));
            Console.WriteLine(d);
        }
    }
}


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

#define name ""
#define ini freopen(name".inp","r",stdin); freopen(name".out","w",stdout)
#define foe(it,c) for (__typeof(c.begin()) it = c.begin(); it != c.end(); it++)
#define long long long 
#define db double 
#define pii pair <int, int>
#define pll pair <long, long>
#define all(c) c.begin(), c.end()
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

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

const int N = 1e6+2;
string s;
int n, dp[N][2], ssum[N];

int main()
{
  fastio;
  cin >> s; reverse(all(s)); 
  int n = s.size(); s = '#' + s;
  for (int i = n; i > 0; i--) ssum[i] = ssum[i + 1] + (9 - (s[i] - '0'));
  dp[0][0] = dp[0][1] = 0;
  int mn = ssum[1];
  for (int i = 1; i <= n; i++){
    dp[i][0] = min(dp[i - 1][0], dp[i - 1][1]) + (s[i] - '0');
    dp[i][1] = mn - ssum[i + 1] + 2;
    mn = min(mn, dp[i][0] + ssum[i + 1]);
    mn = min(mn, dp[i][1] + ssum[i + 1]);
  }
  cout << min(dp[n][0], dp[n][1]); 
  return 0;
}

Measured memory_bytes: 13128
N = int(raw_input())
As = [(int(i), 2) for i in raw_input().split(" ")]
Bs = [(int(i), 1) for i in raw_input().split(" ")]
Cs = [(int(i), 0) for i in raw_input().split(" ")]

l = sorted(As + Bs + Cs, key=lambda x: x[0] + x[1] * 0.1)

ac = 0
bc = 0
cc = 0

for i in l:
    if i[1] == 2:
        ac += 1
    elif i[1] == 1:
        bc += ac
    elif i[1] == 0:
        cc += bc
print cc

Measured memory_bytes: 57144
n,m=map(int,input().split())
a=[int(j) for j in input().split()]
ma=0
sum=0
for i in range(1,m):
    diff=a[i]-a[i-1]
    ma=max(ma,diff)
    sum+=diff

diff=n-sum
ma=max(ma,diff)
print(n-ma)


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

signed main(){
  int N;
  cin>>N;
  string ans="";
  while(N>0){
    N-=1;
    ans+='a'+N%26;
    N/=26;
  }
  reverse(begin(ans),end(ans));
  cout<<ans<<endl;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
#define pb push_back
#define ff first 
#define ss second  
typedef pair<ll,ll> pp;
bool com(pp x,pp y){
    return x.ff<y.ff;
} 
ll power(ll a,ll b){
    ll res=1;
    while(b){
        if(b&1){
            res=(a*res)%10;
        }
        a=(a*a)%10;
        b/=2;
    }
    return (res%10);
} 
void solve(){
    int n,k;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++) cin>>a[i];
    sort(a,a+n);
    int ans=0;
    for(int i=0;i<k;i++) ans+=a[i];
    cout<<ans;
}
int main() {
	// your code goes here
	//isprime();
	//prime(); 
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//int t;
	//cin>>t;
	//while(t--) 
	    solve();
	return 0; 
	
}


Measured memory_bytes: 3628
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <utility>
#include <string>
#include <ctype.h>
#include <cstring>
using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)

int a[11];
bool ans;

int main()
{
	int n; cin >> n;
	REP(l, n)
	{
		REP(i, 10) cin >> a[i];
		int b = 0; int c = 0;
		REP(i, 10)
		{

			if (a[i] < b&&a[i] < c) goto miss;
			else if (a[i] > b&& a[i] > c)
			{
				if (b > c) b = a[i];
				else c = a[i];
			}
			else if (a[i] > b&& a[i] < c) b = a[i];
			else if (a[i] < b&& a[i] > c) c = a[i];
		}
		cout << "YES" << endl;
		continue;
	miss:
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 1148
#include <iostream>

using namespace std;

int main()
{
	long long A, V;
	cin >> A >> V;
	long long B, W;
	cin >> B >> W;
	long long T;
	cin >> T;

	if (abs(A - B) <= (V - W) * T)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;

	return 0;
}

Measured memory_bytes: 3600
#include<iostream>
#include<cmath>
#include<vector>
#include<iomanip>
#include<cassert>

#define N 16
using namespace std;
typedef long long int lli;
const int infty = (1LL<<31)-1;

bool vis[N];
int Mat[N][N];
int A[N];
int D[N];
int best_ans;

void dfs(int n, int now, int now_ans){
  if( now_ans >= best_ans )
    return ;
  if( now == n ){
    best_ans = min( best_ans, now_ans );
    return ;
  }
  for(int i = 0; i < n; ++i){
    if(!vis[i]){
      vis[i]=true;
      A[now]=i;
      int distant=now>0?distant=Mat[i][A[now-1]]:0;
      int sumd=0;
      for(int j = now-2; j >= 0; --j){
	sumd += D[j];
	distant = max( distant, Mat[i][A[j]]-sumd );
      }
      if(now>0)
	D[now-1]=distant;
      dfs(n,now+1,now_ans+distant);
      vis[i]=false;
    }
  }
  return ;
}


int main()
{
  while(true){
    int tMat[N][N]={{0,},};
    int n;
    cin>>n;
    if(n==0)break;
    for(int i = 0; i < n; ++i){
      vis[i]=false;
      for(int j = 0; j < n; ++j){
	cin >> tMat[i][j];
      }
    }
    
    for(int i = 0; i < n; ++i){
      for(int j = 0; j < n; ++j){
	Mat[i][j] = max(tMat[j][i], tMat[i][j]);
      }
    }

    best_ans=infty;
    dfs(n,0,0);
    if(n<=1)best_ans=0;
    cout << best_ans << endl;
  }
  return 0;
}

Measured memory_bytes: 868
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<iomanip>
typedef long long LL;

using namespace std;



int main(void) {
	int n, m, k;
	cin >> n >> m >> k;
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= m; j++) {
			if (i*(m - j) + j * (n - i) == k) {
				cout << "Yes";
				return 0;
			}
		}
	}
	cout << "No";
	return 0;
}

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

int main() {
  int N, T;
  cin >> N >> T;
  int ans = 1e9;
  for (int i = 0; i < N; i++) {
    int c, t;
    cin >> c >> t;
    if (t <= T) ans = min(ans, c);
  }
  if (ans == 1e9) return cout << "TLE" << "\n", 0;
  cout << ans << "\n";
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    private static int N;
    private static int[] A;

    static {
        Scanner sc = new Scanner(System.in);
        N = Integer.parseInt(sc.next());
        A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(sc.next());
        }
    }

    public static void main(String[] args) {
        int g = 0;
        for (int i = 0; i < N; i++) {
            g = gcd(g, A[i]);
        }
        System.out.println(g);
    }

    private static int gcd(int a, int b) {
        return b > 0 ? gcd(b, a % b) : a;
    }
}


Measured memory_bytes: 49128
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


class Mod:
    def __init__(self, m):
        self.m = m

    def add(self, a, b):
        return (a + b) % self.m

    def sub(self, a, b):
        return (a - b) % self.m

    def mul(self, a, b):
        return ((a % self.m) * (b % self.m)) % self.m

    def div(self, a, b):
        return self.mul(a, pow(b, self.m-2, self.m))

    def pow(self, a, b):
        return pow(a, b, self.m)

M = Mod(10**9+7)


class Combination:
    def __init__(self, n, mod):

        g1 = [1, 1]
        g2 = [1, 1]
        inverse = [0, 1]
        for i in range(2, n + 1):
            g1.append((g1[-1] * i) % mod)
            inverse.append((-inverse[mod % i] * (mod//i)) % mod)
            g2.append((g2[-1] * inverse[-1]) % mod)
        self.MOD = mod
        self.N = n
        self.g1 = g1
        self.g2 = g2
        self.inverse = inverse

    def __call__(self, n, r):
        if (r < 0 or r > n):
            return 0
        r = min(r, n-r)
        return self.g1[n] * self.g2[r] * self.g2[n-r] % self.MOD


@mt
def slv(N, K):
    C = Combination(N*2, 10**9+7)
    ans = 0
    for i in range(0, min(K+1, N)):
        r = N - i
        t = M.mul(C(N, i), C(r+i-1, i))
        ans = M.add(ans, t)

    return ans




def main():
    N, K = read_int_n()
    print(slv(N, K))


if __name__ == '__main__':
    main()


Measured memory_bytes: 117736
void main() {
  problem();
}

void problem() {
  auto a = scan;

  string solve() {
    return a[$-1] == 's' ? a ~ "es" : a ~ "s";
  }

  solve().writeln;
}

// ----------------------------------------------

import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons, std.numeric;
T[][] combinations(T)(T[] s, in int m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; }
T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
void deb(T ...)(T t){ debug writeln(t); }
alias Point = Tuple!(long, "x", long, "y");

// -----------------------------------------------


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

using namespace std;
#define foru(i, a, n) for (int i=(a); i<=(n); i++)
#define ford(i, n, a) for (int i=(n); i>=(a); i--)
#define rep(i, n) for(int i=0; i<n; i++)
#define foreach(it, a) for (auto it = (a).begin(); it != (a).end(); it++)
#define pb push_back
#define mp make_pair
#define sz(a) int((a).size())
#define all(x) (x).begin(),(x).end()
#define ms(s, n) memset(s, n, sizeof(s))
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define fi first
#define se second
#define bit(n, i) (((n) >> (i)) & 1)
#define bit1cnt(x) (__builtin_popcountll(x))
#define bit0dau(x) (__builtin_clzll(x))
#define bit0cuoi(x) (__builtin_ctzll(x))
#define sqr(x) ((x) * (x))
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair <ll, ll> LL;
typedef vector<int> vi;
typedef vector <ii> vii;
const int MOD = (int) 1e9 + 7;
const int MOD2 = 1007681537;
const int inf = (int) 1e9;
const ll linf = (ll) 1e18;
const ld pi = acos((ld) -1);
const ld eps = 1e-9;
const int N = 256;
ll n;
string s[N], res = "Yes";
map<string, int> ma;

int main() {
    ///freopen("a.in", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    foru(i, 1, n) {
        cin >> s[i];
        if (ma[s[i]] == 1) res = "No";
        ma[s[i]] = 1;
        if (i > 1 && s[i][0] != s[i - 1].back()) res = "No";
    }
    cout << res;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var item = Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToArray();
            var N = item[0];
            var K = item[1];

            int answer = 0;
            while (N > 0)
            {
                N /= K;
                answer++;
            }

            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 11348
S = []
N,M = [int(i) for i in input().split(" ")]

for  _ in range(M):
    s,c = input().split(" ")
    S.append([int(s)-1,c])

start = 0 if N == 1  else 10**(N-1)
ans = -1
for num in range(start,10**N):
    flag = True
    s_num = str(num)
    for s in S:
        if (s_num[s[0]] != s[1]):
            flag = False
            break
    if (flag):
        ans = num
        break

print (ans)

Measured memory_bytes: 3064
import           Control.Monad
import qualified Data.ByteString.Char8 as BS
import           Data.List
import           Data.Maybe

readInts :: IO [Int]
readInts = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine

main = do
  n <- BS.readInt <$> BS.getLine
  nums <- readInts
  putStrLn $ ans nums

ans :: [Int] -> String
ans nums
  | solve nums == -1 = "No"
  | otherwise = "Yes"

solve :: [Int] -> Int
solve = foldr f 1000000001
  where
    f :: Int -> Int -> Int
    f x acc
      | acc >= x = x
      | acc >= x - 1 = x - 1
      | otherwise = -1


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

int main() {
  int n;
  string s;
  cin >> n >> s;
  string t;
  for(int i=0;i<n/2;i++){
    t+=s.at(i);
  }
  if(n%2!=0||s!=t+t){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <list>
#include <stdio.h>
using namespace std;

#define MAX_N 100000

struct Node {
  int id;
  Node* parent;
  list<Node*> children;
};

void print_node(Node* node) {
  int parentId = -1;
  if (node->parent != NULL) {
    parentId = node->parent->id;
  }
  int depth = 0;
  for(Node* n = node; n->parent != NULL; n = n->parent) {
    depth++;
  }
  printf("node %d: parent = %d, depth = %d, ", node->id, parentId, depth);

  if(depth == 0) {
    printf("root, ");
  } else if(node->children.size() == 0) {
    printf("leaf, ");
  } else {
    printf("internal node, ");
  }

  printf("[");
  for(list<Node*>::iterator it = node->children.begin(); it != node->children.end(); it++) {
    printf("%d", (*it)->id);
    it++;
    if(it != node->children.end()) {
      printf(", ");
    }
    it--;
  }
  printf("]\n");
}

int main() {
  Node nodes[MAX_N];
  nodes[0].parent = NULL;

  int n;
  cin >> n;
  for(int i=0; i<n; i++) {
    int id, k;
    cin >> id >> k;
    nodes[id].id = id;

    int cid;
    for(int j=0; j<k; j++) {
      cin >> cid;
      nodes[cid].parent = &nodes[id];
      nodes[id].children.push_back(&nodes[cid]);
    }
  }

  for(int i=0; i<n; i++) {
    print_node(&nodes[i]);
  }
  return 0;
}

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

int main()
{
    int n,k,x,y,sum=0;
    scanf("%d",&n);
    scanf("%d",&k);
    scanf("%d",&x);
    scanf("%d",&y);
    if(n>=k)
        sum=x*k+(n-k)*y;
    else
        sum=n*x;
    printf("%d\n",sum);
    return 0;
}


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

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPr(i, n) for(int i = (n)-1; i >= 0; --i)
#define FORq(i, m, n) for(int i = (m); i <= (n); ++i)
#define FORqr(i, m, n) for(int i = (n); i >= (m); --i)
#define MP make_pair
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x, 0, sizeof(x))
#define FILL(x, y) memset(x, y, sizeof(x))
#define MM(x) memset(x, -1, sizeof(x))
#define ALL(x) (x).begin(), (x).end()
#define DB(x) cerr << #x << " = " << x << endl
#define DB2(x, y)                                                              \
    cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n";
#define DEBUG                                                                  \
    int x12345;                                                                \
    cin >> x12345;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
const long long MOD = 1e9 + 7;
///////////////////////////////////////////////
// for template
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;
}
///////////////////////////////////////////////
/// 🍈( '-' 🍈 |AC|
int main() {
    ll N; cin >> N;
    vector<ll> A(N);
    map<ll,ll> F;
    ll S = 0;

    REP(i,N){
        cin >> A[i];
        S += A[i];
        F[A[i]]++;
    }

    int Q; cin >> Q;
    while(Q--){
        ll B,C;
        cin >> B >> C;
        ll d = F[B];
        S += C * d - B * d;
        F[B] = 0;
        F[C] += d;
        cout << S << "\n";
    }
}

Measured memory_bytes: 9656
import java.util.Scanner;


public class Main {

	public static void main(String[] args)  {
		Scanner sc = new Scanner(System.in);
		//int n = Integer.parseInt(sc.next());
		String[] s = sc.next().split("");
		String[] t = sc.next().split("");

		int ans = 0;
		for(int i = 0 ; i < s.length; i++){

			if(!s[i].equals(t[i])) {
				ans++;
			}
		}

		System.out.println(ans);

	}
}




Measured memory_bytes: 56472
num = int(input())
arr = list(map(int, input().split()))

colors = [0]*8
special = 0

for rate in arr:
    if rate < 400:
        colors[0]=1
    elif rate < 800:
        colors[1]=1
    elif rate < 1200:
        colors[2]=1
    elif rate < 1600:
        colors[3]=1
    elif rate < 2000:
        colors[4]=1
    elif rate < 2400:
        colors[5]=1
    elif rate < 2800:
        colors[6]=1
    elif rate < 3200:
        colors[7]=1
    else:
        special += 1

min_kind = sum(colors)
max_kind = min_kind + special
if min_kind==0:
    min_kind=1
print(min_kind, max_kind)


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


int main() {
  ll d, t ,s;
  cin >> d >> t >> s;
  if(d <= t * s){
    cout << "Yes";
  }
  else{
    cout << "No";
  }
  return 0;
}






Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include <vector>
#include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n)  FOR(i,0,n)
#define rrep(i,n)  RFOR(i,n-1,0)

// #define int long long
using namespace std;
const int MX = 1e6;
const int inf = 1e9+5;
const int mod = 1e18+7;
using ll = long long;
struct mint {
  ll x; // typedef long long ll;
mint(ll x=0):x((x%mod+mod)%mod){}
mint operator-() const { return mint(-x);}
mint& operator+=(const mint a) {
if ((x += a.x) >= mod) x -= mod;
return *this;
}
mint& operator-=(const mint a) {
if ((x += mod-a.x) >= mod) x -= mod;
return *this;
}
mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
mint operator+(const mint a) const { return mint(*this) += a;}
mint operator-(const mint a) const { return mint(*this) -= a;}
mint operator*(const mint a) const { return mint(*this) *= a;}
mint pow(ll t) const {
if (!t) return 1;
mint a = pow(t>>1);
a *= a;
if (t&1) a *= *this;
return a;
 }
mint inv() const { return pow(mod-2);}
mint& operator/=(const mint a) { return *this *= a.inv();}
mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
vector<mint> fac(MX);
vector<mint> ifac(MX);
mint comp(ll a, ll b) {
    return fac[a]/fac[b]/fac[a-b];
}

signed main(){
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    vector<int> s(n);
    int ma = 0;
    int mai = 0;
    int mii = 0;
    int mi = inf;
    rep(i,n) {
        int x,y;
        cin >> x >> y;
        a[i]=x;
        b[i]=y;
        s[i]=x+y;
        if(s[i]>ma) {
            ma = s[i];
            mai = i;
        }
        if(s[i]<mi) {
            mi = s[i];
            mii = i;
        }
    }
    int ans = abs(a[mai]-a[mii])+abs(b[mai]-b[mii]);
    //cout << ans << endl;
    ma = 0;
    mai = 0;
    mii = 0;
    mi = inf;
    rep(i,n) {
        int x,y;
        x=a[i];
        y=b[i];
        s[i]=1e9-x+y;

        if(s[i]>ma) {
            ma = s[i];
            mai = i;
        }
        if(s[i]<mi) {
            mi = s[i];
            mii = i;
        }
        //cout << ma<<" "<<mi <<" "<<s[i] << endl;
    }
    // cout << abs(a[mai]-a[mii])+abs(b[mai]-b[mii]) << endl;
    ans = max(ans,abs(a[mai]-a[mii])+abs(b[mai]-b[mii]));
    cout << ans << endl;
    return 0;

}


Measured memory_bytes: 21212
list = list(int(input()) for _ in range(5))
ans = 0
tag = 9
count = 0
for i in range(5):
  if list[i]%10==0:
    ans+=list[i]
    count+=1
  else:
    ans+=list[i]+(10-(list[i]%10))
    if tag>list[i]%10:
      tag = list[i]%10
print(ans if count==5 else ans-(10-tag))

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

using namespace std;

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

  string a, b;
  cin >> a >> b;
  if (a < b) {
    cout << "<\n";
  } else if (a > b) {
    cout << ">\n";
  } else {
    cout << "=";
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ld;
 
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;
 
const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;
 
#define _  %  MOD
#define __ %= MOD
 
#define      each(it,s)        for(auto it = s.begin(); it != s.end(); ++it)
#define      sortA(v)          sort(v.begin(), v.end())
#define      sortD(v)          sort(v.begin(), v.end(), greater<auto>())
#define      fill(a)           memset(a, 0, sizeof (a))
 
#define      swap(a,b)        {a=a+b;b=a-b;a=a-b;}
#define      rep(i, n)         for(ll i = 0; i < (n); ++i)
#define      repA(i, a, n)     for(ll i = a; i <= (n); ++i)
#define      repD(i, a, n)     for(ll i = a; i >= (n); --i)
#define watch(x) cout << (#x) << " is " << (x) <<endl
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
 
#define fbo find_by_order
#define ook order_of_key
 
ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}
ll power(ll x,ll y){ll res=1; while(y>0){if(y&1) res=res*x;y=y>>1;x=x*x;}return res;} // modular exponent
 
int main()
{
    ios_base::sync_with_stdio(false); // don't use printf and scanf
    cin.tie(NULL); // cout<<fixed<<setprecision
	ll t;
	cin>>t;
	while(t--)
	{
		ll n;
		cin>>n;
		ll l[n],r[n],k[n];
		vector<ll> g[n+2],g1[n+2];
		rep(i,n)
		{
			cin>>k[i]>>l[i]>>r[i];
			k[i]--;
			g[k[i]].pb(i);
			g1[k[i]+1].pb(i);
			
		}
		vector<ll> chk(n,0);
		set<pair<ll,ll>> st;
		for(ll i=n-1;i>=0;i--)
		{
			if(!g[i].empty())
			{
				for(auto it:g[i]) st.insert(mp(l[it]-r[it],it));
			}
			if(!st.empty())
			{
				auto it=st.rbegin();
				if((*it).fi>0){
					chk[(*it).se]=1;
					st.erase(*it);
				}
			}
		}
		st.clear();
		for(ll i=0;i<n;i++)
		{
			if(!g1[i].empty())
			{
				for(auto it:g1[i]) st.insert(mp(r[it]-l[it],it));
			}
			if(!st.empty())
			{
				auto it=st.rbegin();
				if((*it).fi>0)
				{
					chk[(*it).se]=1;
					st.erase(*it);
				}
			}
		}
		ll ans=0ll;
		rep(i,n) 
		{
			if(chk[i]) ans+=max(l[i],r[i]);
			else ans+=min(l[i],r[i]);
		}
		cout<<ans<<'\n';
	}
	return 0;	
}
// JUST ASK YOURSELF DID YOU GIVE YOUR BEST ? ISSE ZYADA
// KUCH KAR BHI NAHI SAKTE !! ENJOY AND GIVE YOUR BEST!!



Measured memory_bytes: 33228
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


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


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    cin>>n>>m;
    vector<vector<int>> v(m);
    REP(i,m){
        int k;cin>>k;
        v[i].resize(k);
        REP(j,k){
            cin>>v[i][j];
            v[i][j]--;
        }
    }
    vector<int> p(m);
    REP(i,m) cin>>p[i];
    int ans=0;
    REP(i,(1<<n)){
        bool ok=true;
        REP(j,m){
            int c=0;
            for(auto id:v[j]){
                if((i>>id)&1) c++;
            }
            c%=2;
            if(c!=p[j]) ok=false;
        }
        if(ok) ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*; 
import java.text.*;
//Solution Credits: Taranpreet Singh
public class Main{
    //SOLUTION BEGIN
    void solve(int TC) throws Exception{
        String s = n();long ans = 0, b = 0;
        for(int i = 0; i<s.length(); i++){
            if(s.charAt(i)=='W')ans+=b;
            else b++;
        }
        pn(ans);
    }
    //SOLUTION END
    long MOD = (long)1e9+7, IINF = (long)1e9+5;
    final int INF = (int)2e9, MAX = (int)2e5+1;
    DecimalFormat df = new DecimalFormat("0.0000000000");
    double PI = 3.1415926535897932384626433832792884197169399375105820974944, eps = 1e-8;
    static boolean multipleTC = false, memory = false;
    FastReader in;PrintWriter out;
    void run() throws Exception{
        in = new FastReader();
        out = new PrintWriter(System.out);
        int T = (multipleTC)?ni():1;
        //Solution Credits: Taranpreet Singh
        for(int i = 1; i<= T; i++)solve(i);
        out.flush();
        out.close();
    }
    public static void main(String[] args) throws Exception{
        if(memory)new Thread(null, new Runnable() {public void run(){try{new Main().run();}catch(Exception e){e.printStackTrace();}}}, "1", 1 << 28).start();
        else new Main().run();
    }
    long gcd(long a, long b){return (b==0)?a:gcd(b,a%b);}
    int gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}
    int bit(long n){return (n==0)?0:(1+bit(n&(n-1)));}
    void p(Object o){out.print(o);}
    void pn(Object o){out.println(o);}
    void pni(Object o){out.println(o);out.flush();}
    String n(){return in.next();}
    String nln(){return in.nextLine();}
    int ni(){return Integer.parseInt(in.next());}
    long nl(){return Long.parseLong(in.next());}
    double nd(){return Double.parseDouble(in.next());}

    class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FastReader(String s) throws Exception{
            br = new BufferedReader(new FileReader(s));
        }

        String next(){
            while (st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (IOException  e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine(){
            String str = "";
            try{    
                str = br.readLine();
            }catch (IOException e){
                e.printStackTrace();
            }   
            return str;
        }
    }
}    

Measured memory_bytes: 26580
from heapq import heappush,heappop
x,y,a,b,c = map(int,input().split())
r = list(map(int,input().split()))
g = list(map(int,input().split()))
b = list(map(int,input().split()))
r.sort()
g.sort()
b.sort()
hq = []
for i in range(x):
  heappush(hq,r[-i-1])
for i in range(y):
  heappush(hq,g[-i-1])
while b:
  a = heappop(hq)
  if a < b[-1]:
    c = b.pop()
    heappush(hq,c)
  else:
    heappush(hq,a)
    break
print(sum(hq))

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

int main() {
  ll n,a,b;
   cin >> n >> a >> b;
   ll ans = n/(a+b)*a;
   ll p = n%(a+b);
   if(p < a) ans += p;
   else ans += a;

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

Measured memory_bytes: 384
#include<stdio.h>
#include<math.h>
int main(void){
	int h,w,i,i2;
	scanf("%d %d",&h,&w);
	while(h!=0&&w!=0){
		for(i=0;i<h;i++){
			for(i2=0;i2<w;i2++){
				if(i==0||i2==0||i==h-1||i2==w-1){
					printf("#");
				}
				else{
					printf(".");
				}
			}
			printf("\n");
		}
		printf("\n");
		scanf("%d %d",&h,&w);
	}
	return 0;
}

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

namespace AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            string line;
            while ((line = Console.ReadLine()) != null)
            {
                var n = int.Parse(line);
                Console.WriteLine(2 + (n == 1 ? 0 : (n - 1) * (2 + n) / 2));
            }
        }
    }
}

Measured memory_bytes: 5596
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
using llong = long long;

llong n;
llong a[100005];

int main() {
    llong ansa, ansb;
    ansa = ansb = 0;

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

    {
        llong sum = 0;
        for (int i = 0; i < n; i++) {
            sum += a[i];
            if ((i & 1) && sum <= 0) {
                ansa += -sum + 1;
                sum = 1;
            }
            else if (!(i & 1) && sum >= 0) {
                ansa += sum + 1;
                sum = -1;
            }
        }
    }
    {
        llong sum = 0;
        for (int i = 0; i < n; i++) {
            sum += a[i];
            if (!(i & 1) && sum <= 0) {
                ansb += -sum + 1;
                sum = 1;
            }
            else if ((i & 1) && sum >= 0) {
                ansb += sum + 1;
                sum = -1;
            }
        }
    }

    cout << min(ansa, ansb) << endl;

    return 0;
}


Measured memory_bytes: 1024
//-----------------------
// author : xyqkoala
// time : 2020-07-01
//-----------------------

#include<iostream>
#include<vector>
#include<string>
#include<deque>
#include<unordered_map>
#include<unordered_set>
#include<queue>
#include<algorithm>
#include<cmath>
#include<numeric>
using namespace std;

typedef long long LL;
const int MOD = 1e9+7;

void solve();


int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int T = 1;
	// cin>>T;
	while(T--){
		solve();
	}
	return 0;
}


void solve(){
	int n;
	cin>>n;
	LL res = 1;
	vector<int> dp(n+1,1);
	for(int i=2;i<=n;i++){
		int j = 1;
		while((i*j)<=n){
			dp[i*j]++;
			j++;
		}
		res+= 1ll * i*dp[i];
	}
	cout<<res<<endl;
}


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


void solve(long long K, long long A, long long B){
    for(int i = A; i <= B; i++) {
        if(i % K == 0) {
            cout << "OK" << endl;
            return;
            break;
        }
    }

    cout << "NG" << endl;
    
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long K;
    scanf("%lld",&K);
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(K, A, B);
    return 0;
}


Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define mp make_pair
#define mem(a,val) memset(a,val,sizeof(a))
const ll N =10e5+3;

int32_t main()
{
	IOS
	ll n,i,j;
	cin>>n;
	ll a[N][3],dp[N+1][3];
	for(i=0;i<n;i++)
	{
		for(j=0;j<3;j++)
			cin>>a[i][j];
	}
	mem(dp,-1);
	dp[0][0]=a[0][0];dp[0][1]=a[0][1];dp[0][2]=a[0][2];
	//cout<<dp[0][0]<<" "<<dp[0][1]<<" "<<dp[0][2]<<" ";
	for(i=1;i<n;i++)
	{
		for(j=0;j<3;j++)
		{
			if(j==0)
			{
				 dp[i][j]=a[i][j]+max(dp[i-1][1],dp[i-1][2]);
			}    
			if(j==1)
			{
				dp[i][j]=a[i][j]+max(dp[i-1][0],dp[i-1][2]);
			}
			if(j==2)
			{
				dp[i][j]=a[i][j]+max(dp[i-1][0],dp[i-1][1]);
			}
            
		}
		//cout<<endl;
	}
	cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]});
}

Measured memory_bytes: 28672
class UnionFindVerSize():
    def __init__(self, N):
        """ N個のノードのUnion-Find木を作成する """
        # 親の番号を格納する。自分が親だった場合は、自分の番号になり、それがそのグループの番号になる
        self._parent = [n for n in range(0, N)]
        # グループのサイズ（個数）
        self._size = [1] * N

    def find_root(self, x):
        """ xの木の根(xがどのグループか)を求める """
        if self._parent[x] == x: return x
        self._parent[x] = self.find_root(self._parent[x]) # 縮約
        return self._parent[x]

    def unite(self, x, y):
        """ xとyの属するグループを併合する """
        gx = self.find_root(x)
        gy = self.find_root(y)
        if gx == gy: return

        # 小さい方を大きい方に併合させる（木の偏りが減るので）
        if self._size[gx] < self._size[gy]:
            self._parent[gx] = gy
            self._size[gy] += self._size[gx]
        else:
            self._parent[gy] = gx
            self._size[gx] += self._size[gy]

    def get_size(self, x):
        """ xが属するグループのサイズ（個数）を返す """
        return self._size[self.find_root(x)]

    def is_same_group(self, x, y):
        """ xとyが同じ集合に属するか否か """
        return self.find_root(x) == self.find_root(y)

    def calc_group_num(self):
        """ グループ数を計算して返す """
        N = len(self._parent)
        ans = 0
        for i in range(N):
            if self.find_root(i) == i:
                ans += 1
        return ans

import sys

input=sys.stdin.readline

N=int(input())
X=[]
Y=[]
for i in range(N):
    x,y=map(int,input().split())
    X.append((x,y,i))
    Y.append((y,x,i))

X.sort()
Y.sort()

edge=[]

for i in range(N-1):
    x1,y1,x2,y2=X[i][0],X[i][1],X[i+1][0],X[i+1][1]
    if min(abs(x1-x2),abs(y1-y2))==abs(x1-x2):
        edge.append((abs(x1-x2),X[i][2],X[i+1][2]))

for i in range(N-1):
    x1,y1,x2,y2=Y[i][0],Y[i][1],Y[i+1][0],Y[i+1][1]
    if min(abs(x1-x2),abs(y1-y2))==abs(x1-x2):
        edge.append((abs(x1-x2),Y[i][2],Y[i+1][2]))

uf=UnionFindVerSize(N)
ans=0
edge.sort()
for i in range(len(edge)):
    cost,u,v=edge[i]
    if not uf.is_same_group(u,v):
        uf.unite(u,v)
        ans+=cost

print(ans)


Measured memory_bytes: 122928
package main

import (
  "bufio"
  "fmt"
  "os"
  "sort"
  "strconv"
  "strings"
)

const MOD int64 = 998244353

func main() {
  input := Input{bufio.NewReaderSize(os.Stdin,100)}
  n := input.NextInt()
  x := make([]int,n)
  y := make([]int,n)
  for i:=0;i<n;i++ { x[i],y[i] = input.NextInts() }
  x = compress(x)
  y = compress(y)
  p := make([]int,n)
  a := make([][]int,n)
  for i:=0;i<n;i++ {
    p[x[i]] = y[i]
    a[i] = make([]int,4)
  }
  bit := NewFenwickTree(n)
  for i:=0;i<n;i++ {
    a[i][0] = bit.Sum(p[i])
    a[i][1] = i-a[i][0]
    bit.Add(p[i],1)
  }
  bit = NewFenwickTree(n)
  for i:=n-1;i>-1;i-- {
    a[i][2] = bit.Sum(p[i])
    a[i][3] = n-1-i-a[i][2]
    bit.Add(p[i],1)
  }
  oo := make([]int64,4)
  xo := make([]int64,4)
  ans := int64(0)
  for i:=0;i<n;i++ {
    for j:=0;j<4;j++ {
      xo[j] = pow(2,a[i][j])
      oo[j] = xo[j]-1
    }
    ans += (((xo[0]*oo[1])%MOD)*((oo[2]*xo[3])%MOD))%MOD
    ans += (((oo[0]*xo[1])%MOD)*((xo[2]*oo[3])%MOD))%MOD
    ans -= (((oo[0]*oo[1])%MOD)*((oo[2]*oo[3])%MOD))%MOD
    ans += (((xo[0]*xo[1])%MOD)*((xo[2]*xo[3])%MOD))%MOD
    ans = (ans%MOD+MOD)%MOD
  }
  fmt.Println(ans)
}

func pow(a int64,b int) int64 {
  p := a
  ret := int64(1)
  for i:=0;i<32;i++ {
    if (b>>uint(i))&1 == 1 { ret = (ret*p)%MOD }
    p = (p*p)%MOD
  }
  return ret
}

func compress(a []int) []int {
  n := len(a)
  b := make([]int,n)
  copy(b,a)
  sort.Ints(b)
  m := map[int]int{b[0]:0}
  v := 1
  for i:=1;i<n;i++ {
    if b[i] == b[i-1] { continue }
    m[b[i]] = v
    v++
  }
  c := make([]int,n)
  for i:=0;i<n;i++ { c[i] = m[a[i]] }
  return c
}

type FenwickTree struct { bit []int }
func NewFenwickTree(n int) FenwickTree { return FenwickTree{make([]int,n)} }
func(b FenwickTree) Add(i int,v int) {
  for x:=i+1;x<=len(b.bit);x+=x&-x { b.bit[x-1] += v }
}
func(b FenwickTree) Sum(i int) int {
  r := 0
  for x:=i+1;x>0;x-=x&-x { r += b.bit[x-1] }
  return r
}

type Input struct { reader *bufio.Reader }
func(i *Input) NextLine() string {
  var buffer []byte
  for {
    line,isPrefix,err := i.reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer,line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func(i *Input) NextInt() int {
  n,_ := strconv.Atoi(i.NextLine())
  return n
}
func(i *Input) NextInts() (int,int) {
  s := strings.Fields(i.NextLine())
  x,_ := strconv.Atoi(s[0])
  y,_ := strconv.Atoi(s[1])
  return x,y
}

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

int main() {
  string s,t;
  int a,b;
  cin >> s >> t;
  cin >> a >> b;
  string u;
  cin >> u;
  if (s==u) cout << a-1 << " " << b << endl;
  else cout << a << " " << b-1 << endl;
  
}

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

using namespace std;

#define fin(ans) cout << ans << endl

int main(void) {
  string str;
  cin >> str;
  int ans = 0;
  int size = (int)(str.size());

  vector<char> vec(size);

  for (int i = 0; i < size; i++) {
    vec.at(i) = str.at(i);
  }

  for (int i = 0; i < size/2; i++) {
    if (vec.at(i) != vec.at(size - 1 - i))
      ans++;
  }

  fin(ans);
  return 0;
}



Measured memory_bytes: 256
#import numpy as np
#import collections
#import math

#f = open('./input_B.txt')
#
#f.readline()
#int(f.readline())
#map(int, f.readline().split())
#list(map(int, f.readline().split()))

#input()
#int(input())
a,b,c,d=map(int, input().split())
#list(map(int, input().split()))

ans_list = []
ans_list.append(a*c)
ans_list.append(a*d)
ans_list.append(b*c)
ans_list.append(b*d)

ans = max(ans_list)

print(ans)

Measured memory_bytes: 61820
#include <bits/stdc++.h>
#define ft first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=1e5+7;
static const ll MOD=1e9+7;
ll max(ll a, ll b) {return a>b?a:b;}
ll min(ll a, ll b) {return a<b?a:b;}


ll H, W;
string s[1111];
ll d[1111][1111];
ll dx[]={0, -1, 0, 1};
ll dy[]={-1, 0, 1, 0};

void bfs() {
  ll i, j;
  memset(d, -1, sizeof(d));
  
  priority_queue<pair<ll, P>> q;
  
  for(i=0; i<H; i++) {
    for(j=0; j<W; j++) {
      if(s[i][j]=='#') {
        d[i][j]=0;
        q.push({0, {i, j}});
      }
    }
  }
  
  while(q.size()) {
    pair<ll, P> f=q.top(); q.pop();
    
    for(i=0; i<4; i++) {
      ll tx=f.sc.ft+dx[i];
      ll ty=f.sc.sc+dy[i];
      
      if(tx<0 || ty<0 || tx>=H || ty>=W) continue;
      if(d[tx][ty]!=-1) continue;
      d[tx][ty]=d[f.sc.ft][f.sc.sc]+1;
      q.push({-d[tx][ty], {tx, ty}});
    }
    
  }
  
}

int main(void) {
  cin >> H >> W;
  ll i, j;
  
  for(i=0; i<H; i++) cin >> s[i];
  
  bfs();
  ll ans=0;
  for(i=0; i<H; i++) {
    for(j=0; j<W; j++) {
      chmax(ans, d[i][j]);
    }
  }
  pt(ans);
}












Measured memory_bytes: 37608
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <cmath>
#include <map>
#include <fstream>
#include <iterator>
using namespace std;

// Debug Vector
template <typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v)
{
    if (!v.empty())
    {
        out << '[';
        std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
        out << "\b\b]";
    }
    return out;
}

template <typename T1, typename T2>
std::ostream &operator<<(std::ostream &out, const std::pair<T1, T2> &p)
{
    out << "[" << p.first << ", " << p.second << "]";
    return out;
}

typedef long long ll;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    vector<pair<int, int>> AB(N);

    int a, b;
    for (int i = 0; i < N; ++i)
    {
        cin >> a >> b;
        AB[i] = make_pair(a, b);
    }
    sort(AB.begin(), AB.end());

    ll sum = 0;
    int cnt = 0;
    bool flag = false;
    for (int i = 0;; ++i)
    {
        for (int j = 0; j < AB[i].second; ++j)
        {
            sum += AB[i].first;
            ++cnt;
            if (cnt == M)
            {
                goto END;
            }
        }
    }
END:
    cout << sum << endl;
}

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

#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()

typedef long long ll;
typedef array<int, 3> tri;
typedef long double ld;

template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}




void _main() {
        int n; cin >> n;
        vector<int> a(n); cin >> a;
        vector<int> p((int)1e5 + 1), q((int)1e5 + 1);
        int u = 0, v = 0;
        for (int i = 0; i < n; i++) {
                if (i % 2 == 0) p[a[i]]++, u++;
                else q[a[i]]++, v++;
        }

        vector<int> suf(1e5 + 2);
        for (int i = 1e5; i >= 1; i--) {
                suf[i] = max(suf[i + 1], q[i]);
        }


        int ans = n;
        int mx = 0;
        for (int i = 1; i <= 1e5; i++) {
                ans = min(ans, u - p[i] + v - max(mx, suf[i + 1]));
                mx = max(mx, q[i]);
        }

        cout << ans;
}




signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}


Measured memory_bytes: 4776
import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int[] b = new int[a];
        int sum = 0;
        int sum2 = 0;
        int answer = 1000000;
        for (int i = 0; i < a; i++) {
            b[i] = sc.nextInt();
            sum += b[i];
        }
        for (int i = 0; i < a; i++) {
            sum -= b[i];
            sum2 += b[i];
            answer = Math.min(answer, Math.abs(sum - sum2));
        }
        System.out.println(answer);
    }
}

Measured memory_bytes: 21844
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;
                                                                                                     
ll MOD=1000000007;                                                                                     
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    ll n,k,ans=0,sum=0; cin>>n>>k;
    vector<ll> a(n,0);
    rep(i,n) cin>>a[i];
    map<ll,ll> m;
    m[0]=1;
    queue<ll> que;
    que.push(0);
    rep(i,n){
        sum+=a[i];
        ll num=(sum-i-1)%k;
        num=(num+k)%k;
        que.push(num);
        if(i>=k-1){
            m[que.front()]--;
            que.pop();
        }
        if(m.count(num)) ans+=m[num];
        else m[num]=0;
        m[num]++;
    }
    cout<<ans<<endl;
}

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

int main() {
  int r, D, x_2000;
  cin >> r >> D >> x_2000;
  int algaes[20];
  algaes[0] = r * x_2000 - D;
  for (int i = 1; i < 10; i++) {
    algaes[i] = r * algaes[i-1] - D;
  }
  for (int i = 0; i < 10; i++) cout << algaes[i] << endl;
}
    

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

const int MAXN = 3E3+2;

vector<pair<int,int> > a(MAXN);
int n, T;
int f[MAXN][2*MAXN];

int dp(int i, int j){
	int& ret = f[i][j];
	if(ret != -1) return ret;
	if(i==0) return ret = 0;
	ret = dp(i-1, j);
	if(j >= a[i].first) ret = max(ret, a[i].second + dp(i-1, j-a[i].first));
	return ret;
}


signed main(){
	cin >> n >> T;
	for(int i=1; i<= n; ++i) cin >> a[i].first >> a[i].second;
	sort(a.begin()+1, a.begin()+n+1);
	memset(f, -1, sizeof f);
	int ans = 0;
	for(int i=1; i<= n; ++i){
		ans = max(ans, a[i].second + dp(i-1, T-1));
	}
	cout << ans;
}

Measured memory_bytes: 70784