akhauriyash/Code-Regression huggingface dataset:
//﻿#define _CRT_SECURE_NO_WARNINGS

#pragma comment(linker, "/STACK:256000000")

#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <map>
#include <set>
#include <array>
#include <unordered_set>
#include <deque>
#include <queue>
#include <iomanip>
#include <fstream>
#include <string>
#include <climits>
#include <sstream>

typedef long long ll;
typedef long double ld;

#define vi vector<int>
#define pii pair<int, int>
#define fi(n) for(int i = 0; i < (n); i++)
#define FOR(i, k, n) for(int i = (k); i < (n); i++)
#define RFOR(i, k, n) for(int i = (k); i >= (n); i--)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define umin(a, b) a = min(a, b)
#define umax(a, b) a = max(a, b)

const int INF = INT_MAX;
const int mod = 1e9 + 7;
const long long LINF = LLONG_MAX;

using namespace std;

int main()
{
	int n;
	cin >> n;
	int answ = 0;
	bool b = true;
	fi(n)
	{
		int x;
		cin >> x;
		if (b && x == i + 1)
			answ++, b = false;
		else
			b = true;
	}
	cout << answ << endl;
	return 0;
}

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

int main(void){
    int N;
    cin >> N;
    vector<string> s(N);
    for(int i = 0; i < N; i++)
        cin >> s[i];
    int M;
    cin >> M;
    vector<string> t(M);
    for(int i = 0; i < M; i++)
        cin >> t[i];

    int count = 0;
    int max = 0;

    for(int i = 0; i < N-1; i++){
        count = 0;
        for(int j = i; j < N; j++){
            if(s[i] == s[j])
                count++;
        }
        for(int k = 0; k < M; k++){
            if(s[i] == t[k])
                count--;
        }
        if(max < count)
            max = count;
    }

    cout << max << endl;
    return 0;
}

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

#define mp make_pair
#define pb push_back
#define REP(i,a,n) for(int i = a;i < (n);i++)
#define rep(i,n) for(int i = 0;i < (n);i++)
#define all(s) s.begin(), s.end()
#define rall(s) s.rbegin(), s.rend()
#define range(x,min,max) ((min) <= (x) && (x) <= (max))
#define xyrange(x, minX, maxX, y, minY, maxY) (range(x, minX, maxX) && range(y, minY, maxY))

using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef pair<int,int> PII;
typedef vector<PII> VPII;


const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};
const int INF = 0x3f3f3f3f;

int n, a, b;
string s;
VS ans;

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	cin >> n >> a >> b >> s;
	int cnt = 0, b_cnt = 0;
	for (char c : s) {
		if (c == 'a') {
			if (cnt < a + b) {
				ans.pb("Yes");
				cnt++;
			} else {
				ans.pb("No");
			}
		} else if (c == 'b') {
			if (cnt < a + b && b_cnt < b) {
				ans.pb("Yes");
				cnt++;
				b_cnt++;
			} else {
				ans.pb("No");
			}
		} else {
			ans.pb("No");
		}
	}
	for (string a : ans) {
		cout << a << endl;
	}
	return 0;
}



Measured memory_bytes: 6212
#include <bits/stdc++.h>
#define FASTIO ios::sync_with_stdio(false);cin.tie(0);
#define ADD +
#define SUBTRACT -
#define MULTIPLY *
#define DIVIDE /
#define MOD %
#define INCREMENT(x) ++x
#define DECREMENT(x) --x
#define in(a,b) cin>>a>>b;
#define out(a,b) cout<<a<<endl<<b<<endl;
#define scan(a) scanf("%d",&a);
#define print(a) printf("%d\n",a);
#define scanii(a,b) scanf("%d %d",&a,&b);
#define printii(a,b) printf("%d\n%d\n",a,b);
#define scaniii(a,b,c) scanf("%d %d %d",&a,&b,&c);
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define ll long long
#define ull unsigned long long
#define sll signed long long
#define pi acos(-1)
#define mod 1000000007
#define TRUE 1
#define FALSE 0
#define ZERO 0
#define MP make_pair
#define F first
#define S second
#define f1(i,a) for(int i=0;i<a;++i)
#define f2(i,a) for(int i=a-1;i>=0;--i)
#define en puts("");
#define elif else if
typedef ll int lli;
typedef sll int slli;
typedef ull int ulli;
const int sz=10000;
using namespace std;

int clue();
int result();
void show();
bool check();


// bool cmp(pair<int,int>p,pair<int,int>q) {
//     return p.first>q.first;//descending by first
//     return p.first<q.first;//ascending by first
//     return p.second>q.second;//descending by second
//     return p.second<q.second;//ascending by second
// }

bool cmp(int p,int q) {
    return p>q;//descending
    // return p<q;//ascending
}

int main() {

    int t;
    // cin>>t;
    t=1;
    while(t-->0) {
        clue();
    }
    return 0;
}
int clue() {

    int n;
    cin>>n;
    int x=n%10;
    if(x==0||x==1||x==6||x==8) {
        cout<<"pon"<<endl;
    }
    elif(x==3) {
        cout<<"bon"<<endl;
    }
    else {
        cout<<"hon"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3632
import Data.IORef
import Control.Monad
import System.IO.Unsafe
 
main :: IO()
main = print.unsafePerformIO.solve.map read.lines.unsafePerformIO $ getContents

solve :: [Int] -> IO Int
solve (_:x:y:xs) = do
                    let a = unsafePerformIO $ newIORef (y - x)
                        b = unsafePerformIO $ newIORef (min x y)
                    forM_ xs $ \z -> do
                      a' <- readIORef a
                      b' <- readIORef b
                      when (z - b' > a') $ writeIORef a (z - b')
                      when (z < b')      $ writeIORef b z
                    readIORef a

Measured memory_bytes: 5488
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i=a; i<n; i++)
#define RREP(i, a, n) for(ll i=n-1; i>=a; i--)
typedef long long ll;
const ll mod =1e9+7;
const ll inf =1e18;
using namespace std;

ll k, n;
ll a[202020];
int main() {
    cin>>k>>n;
    REP(i, 0, n) cin>>a[i];

    ll mn=a[n-1]-a[0];
    REP(i, 0, n-1){
        ll l=i;
        ll r=l+1;
        mn=min(mn, k-a[r]+a[l]);
    }
    cout<<mn<<endl;
    return 0;
}

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

// int/long:		-2147483648 - 2147483648 (-2^31 <= int < 2^31)
// long/long long:	-9223372036854775808 - 9223372036854775807 (-2^63 <= long < 2^63)

#define	INF (1<<29)
//536870912

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// bit: &/and, |/or, ^/xor, ~/not

#define	MOD 1000000007

int	main() {
	string s;
	cin >>s;
	vector<vector<int>> A(26, vector<int> {0});
	for (int i=0; i<s.size(); i++)
		A.at(s.at(i)-'a').push_back(i+1);
	for (int i=0; i<26; i++)
		A.at(i).push_back(s.size()+1);
	int S=100;
	for (int i=0; i<26; i++){
		int SS=0;
		for (int j=0; j<A.at(i).size()-1; j++) 
			SS=max(SS, A.at(i).at(j+1)-A.at(i).at(j)-1);
		S=min(S, SS);
	}
	cout << S << endl;
	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(void)
{
	int a, b, d;
	float c, x, y;
	char s1[101];
	char s2[101];
	scanf("%s %s",s1, s2);
	strcat (s1,s2);
	
	a = atoi(s1);
	
	c = sqrt(a);
	x = floor(c);
	y = ceil(c);
	if(x == y){
		printf("Yes");
	}else{
		printf("No");
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>

using namespace std;

typedef pair<int,int> P;

int main() {
    int n;
    cin >> n;
    P a[n];
    for (int i=0; i<n; i++) {
        cin >> a[i].first;
        a[i].second = i;
    }
    sort(a, a+n);
    int cnt = 0;
    for (int i=0; i<n; i++) {
        if (a[i].second%2 != i%2) 
            cnt++;
    }
    cout << cnt / 2 << '\n';
    return 0;
}

Measured memory_bytes: 1024
# import math
# import bisect
# import heapq
# from collections import deque
# import numpy as np

# n, m = map(int, input().split())

a = [0] * 9
i = 0
for i in range(3):
    b,c,d = map(int, input().split())
    # print(b,c,d)
    a[3*i],a[3*i+1],a[3*i+2] = b,c,d

ans = 'No'

n = int(input())

b = [ int(input()) for i in range(n) ]
# print(b)
for i in range(n):
    for j in range(9):
        a[j] = -1 if b[i] == a[j] else a[j]

pairs = [
    [0,1,2],[3,4,5],[6,7,8],
    [0,3,6],[1,4,7],[2,5,8],
    [0,4,8],[2,4,6]]

for p in pairs:
    if a[p[0]] == -1 and a[p[1]] == -1 and a[p[2]] == -1:
        ans = 'Yes'


print(ans)

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

int main() {
    string S;

    cin >> S;

    ll ans = 0;

    if (S == "SSS") {
        ans = 0;
    } else if (S == "RSS" || S == "SRS" || S == "SSR" || S == "RSR") {
        ans = 1;
    } else if (S == "RRS" || S == "SRR") {
        ans = 2;
    } else if (S == "RRR") {
        ans = 3;
    }
    
    


    

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

Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);(i)--)
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);(i)--)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T> inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }

int main() {
    init();

    while (1) {
        int t;
        cin >> t;
        if (t == 0)break;
        int n;
        cin >> n;
        FOR(i, 0, n) {
            int s, f;
            cin >> s >> f;
            t -= f - s;
        }
        if (t <= 0)cout << "OK\n";
        else cout << t << "\n";
    }
}


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

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

using ll  = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rep1r(i, n) for (int i = ((int)(n)); i > 0; --i)

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

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

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

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

    int n;
    cin >> n;
    ll a[n];
    for (int i = 0; i < n + 1; i++) {
        cin >> a[i];
    }
    ll b[n];
    rep(i, n) { cin >> b[i]; }

    ll sum = 0;
    for (int i = 0; i < n; i++) {
        ll temp = 0;
        if (b[i] > a[i]) {
            temp = b[i] - a[i];  // 隣を殺せる数
            if (a[i + 1] > temp) {
                a[i + 1] -= temp;
                sum += a[i] + temp;      // i+1を一部やっつける
            } else {                     // iもi+1も全部殺せる
                sum += a[i] + a[i + 1];  // a+1も全部やっつける
                a[i + 1] = 0;
            }
        } else {          // b<a
            sum += b[i];  // bだけやっつける。隣町は行かない
        }
    }

    cout << sum << endl;

    return 0;
}


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

const int INF = 1001001001;
const int mod = 1000000007;

ll pow(ll base, ll order) {
	ll ans = 1;
	rep(i,order - 1) ans *= base;
	return ans;
}

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

ll sum(ll x) { // sum of subsequent numbers from 0 to x
	return x*(x + 1)/2;
}

int main() {
	int n, k;
	cin >> n >> k;

	ll ans = 0;
	for (int i = k - 1; i < n + 1; i++) {
		ll low, up;
		low = sum(i);
		up = sum(n) - sum(n - i - 1);
		//cout << "up and low " << low << " " << up << endl;
		ans += up - low + 1;
		ans %= mod;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3636
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	String fileName = "erase";

	public void solve() throws IOException {
		int a = nextInt();
		int b = nextInt();
		int bo = 1;
		if (a % 2 == 0)
			bo = -1;
		if (b % 2 == 0)
			bo = -1;
		if (bo == -1)
			out.print("Even");
		else
			out.print("Odd");
	}

	public void run() {
		try {
			InputStreamReader isr = new InputStreamReader(System.in);
			br = new BufferedReader(isr);
			out = new PrintWriter(System.out, true);
			// out = new PrintWriter(fileName + ".out");
			// br = new BufferedReader(new FileReader(fileName + ".in"));
			solve();
			out.close();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	BufferedReader br;
	StringTokenizer in;
	static PrintWriter out;

	public String nextToken() throws IOException {
		while (in == null || !in.hasMoreTokens()) {
			in = new StringTokenizer(br.readLine());
		}
		return in.nextToken();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	public static void main(String[] args) throws IOException {
		new Main().run();
	}

}


Measured memory_bytes: 21332
#include<bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
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 ; 0 <= i ; i--)
#define ROP(i, n)       for(int i = 1 ; i <= n ; i++)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define VECOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define SORT(obj) sort(ALL(obj))
#define GSORT(obj) sort(ALL(obj) , greater<int>())
#define P pair<int , int>
#define V vector<int>
#define VLL vector<long long>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

#define LIMIT 50
int N, M, ans;
int A[LIMIT], B[LIMIT];

bool edge[LIMIT][LIMIT];
bool visited[LIMIT];

void dfs(int v){
  visited[v] = true;
  for(int i = 0 ; i < LIMIT ; i++){
    if(edge[v][i] == false)  continue;
    if(visited[i] == true)   continue;
    dfs(i);
  }
}

int main(void) {

	ios::sync_with_stdio(false);	cin.tie(0);
    cin >> N >> M;  ans = 0;
    REP(i, M){
      cin >> A[i] >> B[i];
      A[i]--, B[i]--;
      edge[A[i]][B[i]] = edge[B[i]][A[i]] = true;
    }

    REP(i, M){
      edge[A[i]][B[i]] = edge[B[i]][A[i]] = false;
      REP(j, LIMIT)  visited[j] = false;

      dfs(0);
      bool bridge = false;
      for(int i = 0 ; i < N ; i++)
        if(visited[i] == false)  bridge = true;
      if(bridge) ans += 1;

      edge[A[i]][B[i]] = edge[B[i]][A[i]] = true;
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
main(){
  int i;
  int n;cin >> n;
  vector<int> a(110000,0);
  for(i=0;i<n;i++){
    int d;
    cin >> d;
    a[d]++;
  }
  priority_queue<int> ans;
  for(i=0;i<110000;i++){
    int L=a[i]+a[i-1]+a[i+1];
    ans.push(L);
  }
  cout << ans.top() <<endl;
  return 0;
}

Measured memory_bytes: 4268
function Main (input) {
  input = input.split("\n").map(inp => inp.split(" ").map(Number));
  var N = input[0][0];
  var A = input[1];
  for (var i of A) {
    N -= i;
  }
  console.log(N < 0 ? -1 : N);
}

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

Measured memory_bytes: 30892
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}

void solve(){
  int N; cin >> N;
  string S; cin >> S;
  if(N%2!=0){
    cout<<"No"<<endl;
    return;
  }
  if(S.substr(0,N/2)==S.substr(N/2,N/2)){
    cout<<"Yes"<<endl;
  }
  else cout<<"No"<<endl;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 3628
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace NotFounds
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            new Program().Solve(new ConsoleInput(Console.In, ' '));
            Console.Out.Flush();
        }

        public void Solve(ConsoleInput cin)
        {
            const long MOD = 1000000007;
            var N = cin.ReadInt;

            var map = new int[1001];
            for (int i = 2; i <= N; ++i)
            {
                var n = i;
                for (int j = 2; j <= n; ++j)
                    while (n != 0 && n % j == 0) { n /= j; map[j]++; }
            }
            var ans = 1L;

            for (int i = 2; i <= N; ++i)
                ans = (map[i] == 0 ? 1 : (map[i] + 1)) * ans % MOD;
            WriteLine(ans);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
        public void ReadIntArrays(long N, out int[] A, out int[] B) { A = new int[N]; B = new int[N]; for (long i = 0; i < N; ++i) { A[i] = ReadInt; B[i] = ReadInt; }}
    }
}


Measured memory_bytes: 11220
N=int(input())
A=[int(i) for i in input().split()]
T=[2**i for i in range(1,35)]
table=[True]*N
A.sort()
ans=0
for t in T[::-1]:
  l,r=0,N-1
  while l<r:
    if A[l]+A[r]>t:
      r-=1
    elif A[l]+A[r]==t:
      if table[l] and table[r]:
        ans+=1
        table[l],table[r]=False,False
      if not table[l]:
        l+=1
      if not table[r]:
        r-=1
    elif A[l]+A[r]<t:
      l+=1
print(ans)
        

Measured memory_bytes: 88532
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        String c = sc.next();
        System.out.print(a.charAt(0));
        System.out.print(b.charAt(1));
        System.out.print(c.charAt(2));
        System.out.println();

    }
}

Measured memory_bytes: 23124
import sys
N,H = map(int,input().split())
A = 0
B = []
for _ in range(N):
    a,b = map(int,input().split())
    A = max(A,a)
    B.append(b)
B.sort(reverse=True)

ans = 0
for b in B:
    if b > A:
        H -= b
        ans += 1
    else:
        break
    if H <= 0:
        print(ans)
        sys.exit()

print((H-1)//A +1 +ans)


Measured memory_bytes: 7384
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

ll cnt = 1;
vector<ll>counter;
int n, m, a[100010];
ll ans = 0;
int main() {
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	for (int i = 1; i <= n; i++) {
		a[i] += a[i - 1];
		a[i] %= m;
	}
	sort(a, a + n + 1);
	for (int i = 1; i <= n; i++) {
		if (a[i] != a[i - 1]) {
			counter.push_back(cnt);
			cnt = 1;
		}
		else {
			cnt++;
		}
		if (i == n) {
			counter.push_back(cnt);
		}
	}
	for (int i = 0; i < counter.size(); i++) {
		ans += counter[i] * (counter[i] - 1) / 2;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1276
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
ll GCD(ll x, ll y) {
    if (y == 0) return x;
    else return GCD(y, x % y);
}
ll LCM(ll x, ll y) { 
  return x / GCD(x, y) * y;
}

int main(){
  int n; cin >> n;
  vector<double> x(n);
  vector<string> u(n);
  rep(i, n) cin >> x[i] >> u[i];
  double ans = 0;
  rep(i, n) {
    if(u[i] == "JPY") ans += x[i];
    else ans += x[i] * 380000;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
void solve() {
        int n;
        cin >> n;
        vector <int> v;
        for(int i=0;i<n;i++) {
                int x;
                cin >> x;
                v.push_back(x);
        }
        sort(v.begin(), v.end());
        int count = 0;
        for(int i=0;i<n;i++) {
                for(int j=i+1;j<n;j++) {
                        count += lower_bound(v.begin(), v.end(), v[i]+v[j]) - v.begin() - j -1;
                }
        }
        cout << count << endl;
        return ;
}
int main() {
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        solve();
        return 0;
}


Measured memory_bytes: 256
#入力処理
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
kingaku=[]
for i in range(M):
    x_input, y_input, c_input = map(int, input().split())
    kingaku.append(a[x_input-1]+b[y_input-1]-c_input)
kingaku.append(min(a)+min(b))

print(min(kingaku))

Measured memory_bytes: 18736
#include <bits/stdc++.h>
#include <string>
using namespace std;
int main()
{
    int k;
    scanf("%i",&k);
    string s ;
    cin>>s;
    int n;
    n = s.size();
    if (n<=k)
    {
    	cout<<s<<endl;
    }
    else
    {
    	for(int i = 0 ; i < k ; i++)
    	{
    		printf("%c",s[i]);
    	}
    	for (int i = 0 ; i < 3 ; i++)
    	{
    		printf(".");
    	}
    	printf("\n");
    }
    
    return 0;
}

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



int main(){
	
	long long N;
	cin>>N;
	
	map<char,long long> mp;
	for(int i=0;i<N;i++){
		string s;
		cin>>s;
		mp[s[0]]++;
	}
	
	string S = "MARCH";
	sort(S.begin(),S.end());
	
	long long ans = 0;
	
	do{
		long long a = 1;
		for(int i=0;i<3;i++){
			a *= mp[S[i]];
		}
		ans+=a;
	}
	while(next_permutation(S.begin(),S.end()));
	
	cout<<ans/12<<endl;
	
		
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B;
  cin >>A>>B;
  if(A>=13){
    cout <<B<<endl;
  }
  if(A>=6&&A<=12){
    cout <<B/2<<endl;
  }
  if(A<=5){
    cout <<0<<endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<string.h>
using namespace std;
#define pb push_back
#define all(v) v. begin(),v. end()
#define  rep(i,n,v) for(i=n;i<v;i++)
#define per(i,n,v) for(i=n;i>v;i--)
#define ff first 
#define ss second 
#define pp pair<ll,ll>
#define eps 1e-6
#define ll  long long
#define endl '\n'
void solve()
{
  ll n, a,m=0,b=1, k=0, i, j,l=2e9+7;
  string s, r, y;
  cin>>n>>a>>b;
  k=min(n+a,min(n+b,a+b));
  cout<<k;
  /*if(n<a) cout<<0;
  else cout<<10;*/
}
int main()
{
 ios_base::sync_with_stdio(false);
  cin. tie(0);cout. tie(0);
    ll t=1;
 //  cin>>t;
    while(t--)
    {
      solve();
    }
    return 0;
}

Measured memory_bytes: 3644
n = int(input())
a = list(map(int,input().split()))

mm = 10**9 + 7

def cumsum(a):
    s = [0]
    for i in range(len(a)):
        s.append(s[i]+a[i])
    return s

S = cumsum(a)

ans = 0
for i in range(n):
    ans += a[i]*S[i]
print(ans % mm)

Measured memory_bytes: 31608
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T
{
    std::io::Read::bytes(std::io::stdin())
                    .map(|c| c.unwrap() as char)
                    .skip_while(|c| c.is_whitespace())
                    .take_while(|c| !c.is_whitespace())
                    .collect::<String>()
                    .parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_line<T: std::str::FromStr>() -> Vec<T>
{
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim()
        .split_whitespace()
        .map(|x|
            x.parse().ok().unwrap()
        )
        .collect()
}

fn main() {
    let h: usize = read();
    let w: usize = read();
    let s: Vec<Vec<bool>> = 
        (0..h).map(|_|
            read::<String>().chars()
                .map(|c| if c == '#' {true} else {false})
                .collect()
        ).collect();
    let mut flag = true;
    
    for i in 0..h {
        for j in 0..w {
            if !s[i][j] {continue;}

            if (i == 0 || !s[i-1][j])
                && (i == h-1 || !s[i+1][j])
                && (j ==   0 || !s[i][j-1])
                && (j == w-1 || !s[i][j+1]) {
                    flag = false;
                }
        }
    }

    if flag {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
const long double pi = acos(-1);
const long double eps = 1e-10;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int n, k;
VI a;
vector<VI> memo;
bool solve(int num, int turn) {
    if (memo[num][turn] != -1)return memo[num][turn] == 1;
    bool ret;
    if (turn == 0) {
        ret = false;
        for (int i = 0; i < n && a[i] <= num; ++i) {
            ret |= solve(num - a[i], turn ^ 1);
        }
    }
    else {
        ret = true;
        for (int i = 0; i < n && a[i] <= num; ++i) {
            ret &= solve(num - a[i], turn ^ 1);
        }
    }
    memo[num][turn] = (ret ? 1 : 0);
    return ret;
}

int main() {
    init();

    cin >> n >> k;
    a.resize(n); cin >> a;
    memo = defvec<int>(-1, k + 1, 2);
    cout << (solve(k, 0) ? "First\n" : "Second\n");
}


Measured memory_bytes: 12032
/**
 * Title: B - Golden Coins
 * Url: https://atcoder.jp/contests/abc160/tasks/abc160_b
 */
#include<bits/stdc++.h>

using namespace std;

#define ll long long

int main() {
    int x; cin >> x;
    int happy = x/500*1000;
    if(x%500!=0) {
        happy += (x%500)/5*5;
    }
    cout << happy << endl;

    return 0;
}

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

using namespace std;
struct node
{
    int x, y, f;
};
char a[1010][1010];
int book[1010][1010];
int m, n, h, ans, head, tail;
int dir[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
void bfs(int x, int y, int step)
{
    int k = 0;
    node s, e;
    s.x = x;
    s.y = y;
    s.f = 0;
    memset(book, 0, sizeof(book));
    book[x][y] = 1;
    queue<node>q;
    q.push(s);
    while(!q.empty())
    {
        s = q.front();
        q.pop();
        for(int i = 0 ;i < 4; i++)
        {
            e.x = s.x + dir[i][0];
            e.y = s.y + dir[i][1];
            e.f = s.f + 1;
            if(a[e.x][e.y] == 'X' || e.x < 0 || e.y < 0 || e.x >= m || e.y >= n || book[e.x][e.y])
                continue;
            if(a[e.x][e.y] == step + '0')
            {
                ans += e.f;
                k = 1;
                break;
            }
            book[e.x][e.y] = 1;
            q.push(e);
        }
        if(k)
            break;
    }
    if(k && step == h)
        return;
    bfs(e.x, e.y, step+1);
}
int main ()
{
    while(~scanf("%d %d %d", &m, &n, &h))
    {
        int i, j;
        ans = 0;
        for(i = 0; i < m; i++)
            scanf("%s", a[i]);
        for(i = 0; i < m; i++)
            for(j = 0; j < n; j++)
                if(a[i][j] == 'S')
                   {
                        bfs(i, j, 1);
                        break;
                   }
        printf("%d\n", ans);
    }
    return 0;
}

Measured memory_bytes: 6192
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
using Weight = int;
using Flow = int;
struct Edge {
	int src, dst;
	Weight weight;
	Flow cap;
	Edge() : src(0), dst(0), weight(0) {}
	Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) {}
};
using Edges = std::vector<Edge>;
using Graph = std::vector<Edges>;
using Array = std::vector<Weight>;
using Matrix = std::vector<Array>;

void add_edge(Graph &g, int a, int b, Weight w = 1) {
	g[a].emplace_back(a, b, w);
	g[b].emplace_back(b, a, w);
}
void add_arc(Graph &g, int a, int b, Weight w = 1) { g[a].emplace_back(a, b, w); }
struct ford_fulkerson {
	using Matrix = std::vector<std::vector<Flow>>;
	int n, t;
	std::vector<int> vis;
	std::vector<std::vector<Flow>> cap, flow;
	std::vector<std::vector<int>> g;
	const Flow INF;
	ford_fulkerson(int n)
		: n(n),
		cap(n, std::vector<Flow>(n)),
		flow(n, std::vector<Flow>(n)),
		g(n, std::vector<int>()),
		INF(std::numeric_limits<Flow>::max() / 8) {}
	ford_fulkerson(const Graph &graph) : ford_fulkerson(graph.size()) {
		for (int i = 0; i < n; ++i)
			for (auto &e : graph[i]) add_edge(e.src, e.dst, e.cap);
	}
	void add_edge(int u, int v, Flow c) {
		cap[u][v] += c;
		cap[v][u] += c;
		flow[v][u] += c;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	Flow solve(int s, int t) {
		this->t = t;
		Flow res = 0, aug = 1;
		while (aug > 0) {
			vis.assign(n, false);
			res += (aug = augment(s, INF));
		}
		return res;
	}
	Flow augment(const int &v, const Flow &lim) {
		vis[v] = true;
		if (v == t) return lim;
		for (const int &d : g[v]) {
			if (vis[d] || flow[v][d] == cap[v][d]) continue;
			Flow aug = augment(d, std::min(lim, cap[v][d] - flow[v][d]));
			flow[v][d] += aug;
			flow[d][v] -= aug;
			if (aug > 0) return aug;
		}
		return 0;
	}
};
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<vector<int> > A(26, vector<int>(26, 0));
	int res = 0;
	vector<int> X(26, 0);
	for (int i = 0; i < N; i++) {
		string S;
		cin >> S;
		if (S[0] != S.back()) {
			A[S[0] - 'a'][S.back() - 'a']++;
		}
		X[S.back() - 'a'] = 1;
	}
	for (int a = 0; a < 26; a++) {
		if (X[a] == 1) {
			ford_fulkerson ff(27);
			int sum = 0;
			for (int i = 0; i < 26; i++) {
				for (int j = 0; j < 26; j++) {
					if (A[i][j] > 0) {
						if (j == a) {
							ff.add_edge(i, 26, A[i][j]);
						}
						else {
							ff.add_edge(i, j, A[i][j]);
						}
						if (i == a) {
							sum += A[i][j];
						}
					}
				}
			}
			if (ff.solve(a, 26) == sum) {
				cout << char(a + 'a') << endl;
			}
		}
	}
}


Measured memory_bytes: 3272
X, N = map(int, input().split())
p_list = list(map(int, input().split()))

if N == 0:
    print(X)
    exit()

p_set = set(p_list)
min_p = min(p_list)
max_p = max(p_list)

compare_X = X
min_d = 100000
min_d_i = compare_X

while True:
    if compare_X not in p_set:
        d = abs(X - compare_X)
        min_d = min(min_d, d)
        if min_d == d:
            min_d_i = compare_X

    if compare_X > max_p:
        break

    compare_X += 1

compare_X = X


while True:
    if compare_X not in p_set:
        d = abs(X - compare_X)
        min_d = min(min_d, d)
        if min_d == d:
            min_d_i = compare_X

    if compare_X < min_p:
        break

    compare_X -= 1


print(min_d_i)
        






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

ex = [0] * m
left = [0] * (2*m)
right = [[0,0] for _ in range(2*m)]

ans = 0
for i in range(n-1):
    a0 = a[i]-1
    a1 = a[i+1]-1
    ans += (a1-a0)%m
    left[a0+1] += 1
    right[a1 + (a0>a1)*m][0] += 1
    right[a1 + (a0>a1)*m][1] += (a1-a0)%m -1

now = left[0]
dif = 0
for i in range(1,2*m):
    dif += now
    ex[i%m] -= dif
    now += left[i] - right[i][0]
    dif -= right[i][1]

ans += min(ex)
print(ans)

Measured memory_bytes: 99876
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
ll a[100007],m,n,v,p,ans,val,idx ;

ll op(ll mid ){
    ll i , rem = INT_MAX ;;
    if (a[mid]+m>=val){

        rem = max(0LL,v-mid-p) ;
        ll more = a[mid]+m ;
        //cout <<mid << ' '<<rem << endl ;
        rem*=m ;

        for(i=mid+1;i<=idx;i++){

            ll tt = more- a[i] ;
            rem-= min(tt,m) ;

        }
        //cout << rem << ' ';
    }
    if (rem<=0)
    return 1 ;
    else
        return 0 ;

}

int main(){


    cin >> n >> m >> v >> p;


    ll i ;

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

    val= a[n-p] ,idx= n-p;
    ans = p ;

    ll high = n-p ,low=0,mid;

    while(high>=low){
        mid= (high+low)/2 ;

        if (op(mid)){
            ans= mid ;
           // cout <<a[mid] << endl ;
            high = mid-1 ;
        }
        else
            low=mid+1 ;



    }

    cout << n-ans << endl ;







}


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

def make_divisors(n):
    import math
    divisors = []
    for i in range(1, int(math.sqrt(n)) + 1):
        if n % i == 0: #割り切れるとき
            divisors.append(i)
            if i != n//i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

def F(A, B):
    return max(len(str(A)), len(str(B)))


lst = make_divisors(N)

ans = 10 ** 18
for a in lst:
    b = N // a
    ans = min(ans, F(a, b))

print (ans)






Measured memory_bytes: 3064
s = gets.chomp + 'X'
r_len = 0
l_len = 0

result = []

state = :R
s.each_char do |c|
  case state
  when :L
    if c != 'L'
      next if r_len + l_len == 0
      (r_len-1).times { result << 0 }
      result << ((r_len+1)/2 + l_len/2)
      result << (r_len/2 + (l_len+1)/2)
      (l_len-1).times { result << 0 }
      r_len = 1
      state = :R
    else
      l_len += 1
    end
  when :R
    if c != 'R'
      l_len = 1
      state = :L
    else
      r_len += 1
    end
  end
end

puts result.join(" ")

Measured memory_bytes: 15916
#include <bits/stdc++.h>
#define LL long long
#define INF 0x3f3f3f3f
using namespace std;

template<class T> inline
void read(T& x) {
	int f = 1; x = 0;
	char ch = getchar();
	while (ch < '0' || ch > '9')   {if (ch == '-') f = -1; ch = getchar();}
	while (ch >= '0' && ch <= '9') {x = x * 10 + ch - '0'; ch = getchar();}
	x *= f;
}

/*============ Header Template ============*/

const int N = 500 + 5;

int n;
int a[N][N];
int c[N], d[N], inq[N];
char s[N][N];

queue<int> Q;

void SPFA() {
	for (int i = 1; i <= n; i++)
		if (d[i] == 0) {
			Q.push(i);
			inq[i] = 1;
		}
	while (!Q.empty()) {
		int x = Q.front(); Q.pop(); inq[x] = 0;
		for (int i = 1; i <= n; i++)
			if (d[i] > d[x] + 1) {
				d[i] = d[x] + 1;
				if (!inq[i]) {
					Q.push(i);
					inq[i] = 1;
				}
			}
	}
}

int main() {
	read(n);
	for (int i = 1; i <= n; i++) scanf("%s", s[i] + 1);
	int mx = 0;
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++) {
			a[i][j] = (s[i][j] == '#');
			c[i] += a[i][j];
			mx = max(mx, c[i]);
		}
	if (mx == 0) {printf("-1\n"); return 0;}
	for (int i = 1; i <= n; i++) d[i] = INF;
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++) if (a[i][j]) d[j] = 0;
	SPFA();
	int tmp = INF, id = 0;
	for (int i = 1; i <= n; i++) {
		if (d[i] != INF && n - c[i] < tmp) {
			tmp = min(tmp, n - c[i] + d[i]);
			id = i;
		}
	}
	for (int j = 1; j <= n; j++) {
		for (int i = 1; i <= n; i++) {
			if (!a[i][j]) {
				tmp++;
				break;
			}
		}
	}
	printf("%d\n", tmp);
	return 0;
}

Measured memory_bytes: 1536
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long A = sc.nextLong();
		long B = sc.nextLong();
		long C = sc.nextLong();
		long K = sc.nextLong();
		sc.close();

		if (K <= A) {
			System.out.println(K);
		} else if (A < K && K <= (A + B)) {
			System.out.println(A);
		} else {
			System.out.println(A - (K - (A + B)));
		}
	}
}


Measured memory_bytes: 35804
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
#define int long long
#define veb vector<bool>
#define vveb vector<veb>
#define vel vector<long long>
#define vvel vector<vel>
#define vvvel vector<vvel>
void mmin(int &a, int b) { a = min(a, b); }
void mmax(int &a, int b) { a = max(a, b); }
void sor(vel &v) { sort(v.begin(), v.end()); }
int zero(void) { return 0; }
signed main() {
	int n;
	cin >> n;
	int k; cin >> k;
	vveb a(n,veb(41));
	for (int i = 0; i < n; i++) {
		int a0; cin >> a0;
		for (int j = 0; j <= 40; j++) {
			a[i][j] = (a0 % 2 == 1);
			a0 = a0 / 2;
		}
	}
	vel ru(42, 1);
	for (int i = 1; i <= 41; i++) {
		ru[i] = ru[i - 1] * 2;
	}
	vel co(41,0);
	for (int i = 40; i >= 0; i--) {
		for (int j = 0; j < n; j++) {
			if (!a[j][i]) co[i]++;
		}
		co[i]=co[i] * ru[i];
	}
	vel rco(42,0);
	for (int i = 0; i <= 40; i++) {
		rco[i + 1] = rco[i] + max(co[i], n*ru[i] - co[i]);
	}
	int ans = 0;
	vel man(41, 0);
	for (int i = 1; i <= 40; i++) {
		int mn = k % ru[i];
		if (mn < ru[i - 1]) {
			man[i] = n*ru[i-1]-co[i-1]+man[i - 1];
		}
		else {
			man[i] = max(co[i-1]+man[i - 1], n*ru[i-1] - co[i-1] + rco[i-1]);
		}
	}
	cout << man[40] << endl;
}

Measured memory_bytes: 7296
#include<stdio.h>
#include<math.h>
int main(){
    int a;
    scanf("%d",&a);
    while(a--){
        double x1,y1,x2,y2,x3,y3;
        scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
        double a1=2*(x2-x1);
        double b1=2*(y2-y1);
        double c1=x1*x1-x2*x2+y1*y1-y2*y2;
        double a2=2*(x3-x1);
        double b2=2*(y3-y1);
        double c2=x1*x1-x3*x3+y1*y1-y3*y3;
        double x=(b1*c2-b2*c1)/(a1*b2-a2*b1);
        double y=(c1*a2-c2*a1)/(a1*b2-a2*b1);
        double r=hypot(x-x1,y-y1);
        printf("%.3lf %.3lf %.3lf\n",x,y,r);
    }
}

Measured memory_bytes: 1104
#include <iostream>
#include <string>
#include <algorithm>

std::string ar[101];

int main() {
  int N, L; std::cin>>N>>L;
  for (int i = 0; i < N; ++i)
    std::cin>>ar[i];
  std::sort(ar, ar+N);

  for (int i = 0; i < N; ++i)
    std::cout<<ar[i];
  std::cout<<"\n";

  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
try:
    from typing import List
except ImportError:
    pass


def solve(N: int, K: int, S: str):
    print(S[:K - 1] + S[K - 1].lower() + S[K:])


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, K, S)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <stdio.h>
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <assert.h>
#include <queue>
#include <string.h>
#include <string>
#include <set>
#include <memory.h>
#include <functional>
#include <bitset>
using namespace std;
#define ll long long

const int N = 105;
const int inf = 2e9;
struct Edge{
    int nextNode,cap,rid;
    Edge(int nextNode,int cap,int rid) : nextNode(nextNode), cap(cap),rid(rid) {
    }
};
vector<Edge> adj[N];

void insert(int u,int v,int cap) {
    adj[u].push_back(Edge(v,cap, (int)adj[v].size()));
    adj[v].push_back(Edge(u,0,(int)adj[u].size()-1));
}
int work[N],level[N];

bool bfs(int source,int sink) {
    queue<int> q;
    q.push(source);
    memset(level, -1, sizeof(level));
    level[source] = 0;
    while(!q.empty()) {
        int node = q.front();
        q.pop();
        for(int i=0;i<adj[node].size();++i) {
            if(adj[node][i].cap>0 && level[adj[node][i].nextNode]==-1) {
                level[adj[node][i].nextNode] = level[node] + 1;
                q.push(adj[node][i].nextNode);
            }
        }
    }
    return level[sink] != -1;
}
int dfs(int node,int flow,int sink) {
    if(node==sink) {
        return flow;
    }
    for(int &i= work[node];i<(int)adj[node].size();++i) {
        int nextNode = adj[node][i].nextNode,cap = adj[node][i].cap;
        if(level[nextNode] == level[node] + 1 && cap>0) {
            int tmp = dfs(nextNode, min(cap,flow),sink);
            if(tmp>0) {
                adj[node][i].cap -= tmp;
                adj[nextNode][adj[node][i].rid].cap += tmp;
                return tmp;
            }
        }
    }
    return 0;
}
ll maxFlow(int source,int sink) {
    ll ret = 0;
    while(bfs(source,sink)) {
        memset(work,0,sizeof(work));
        while(true) {
            int flow = dfs(source,inf,sink);
            ret += flow;
            if(flow==0) {
                break;
            }
        }
    }
    return ret;
}

int a[N];

void solve() {
    int n;
    scanf("%d",&n);
    ll ret = 0;
    int source = 0, sink = n+1;
    for(int i=1;i<=n;++i) {
        scanf("%d",&a[i]);
        if(a[i]>0) {
            ret += a[i];
            insert(source,i,a[i]);
        } else if(a[i]<0) {
            insert(i,sink,-a[i]);
        }
    }
    for(int i=1;i<=n;++i) {
        if(a[i]<0) {
            for(int j=1;j<=n;++j) {
                if(j%i==0 && a[j]>0) {
                    insert(j,i,inf);
                }
            }
        }
    }
    ret -= maxFlow(source, sink);
    printf("%lld\n",ret);
}
int main() {
    //freopen("/Users/gotop/Documents/ps_practice/ps_practice/input.txt", "r", stdin);
    solve();
}


Measured memory_bytes: 256
Slist=input()
Slist=Slist.replace("><",">,<").split(",")
ans=0
for S in Slist:
    a=S.count("<")
    b=S.count(">")
    n=max(a,b)
    m=len(S)-n
    ans=ans+n*(n+1)//2+(m-1)*m//2
print(ans)

Measured memory_bytes: 12828
#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
using namespace std ;
int main()
{
    ios_base::sync_with_stdio(false) ;
    cin.tie(0);
    cout.tie(0);
    ll n , d ;
    cin >> n >> d ;
    ll cnt = 0 ;
    long long temp1, temp2 ;
    for(int i = 0 ; i < n ; i++)
    {
        cin >> temp1;
        cin  >> temp2 ;
        long double dist = temp1*temp1 + temp2*temp2 ;
        dist = sqrt(dist) ;
        if(dist <= d)
        {
           cnt++ ;
        }
    }
    cout << cnt << endl ;


}


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

#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define pll         pair<long,long>
#define vi          vector<int>
#define vll         vector<ll>
#define vii         vector<pii>
#define vpll        vector<pair<ll,ll>>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define mod        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define rem(i,a,b)  for(int i=a;i>b;i--)
#define mp(a,b)     make_pair(a,b)
#define vvi(a,b,name)    vector<vector<int>> name(a,vector<int>(b,-1))


void solve(){
    int h,w;cin>>h>>w;
    char dp[105][105];
    rep(i,0,h){
        dp[i][0]='#';
        rep(j,1,w+1){
            cin>>dp[i][j];
        }
        dp[i][w+1]='#';
    }
    rep(i,0,w+2)cout<<'#';
    cout<<endl;
    rep(i,0,h){
        rep(j,0,2+w){
            cout<<dp[i][j];
        }
        cout<<endl;
    }
    rep(i,0,w+2)cout<<'#';

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


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

int main() {
  int N;
  cin >> N;
  for(int i = 0; i < N; i++){
    string s;
    cin >> s;
    if(s == "Y"){
      cout << "Four" << endl;
      break;
    }else if(s != "Y" && i == N-1){
      cout << "Three" << endl;
    }
  }
}



Measured memory_bytes: 256
#!/usr/bin/env python3
N, *a = map(int, open(0))
n = N//2 - 1
a.sort()
print(2*sum(a[n+2:]) - 2*sum(a[:n]) + a[n+1] - a[n] - (min(a[n]+a[n+2], 2*a[n+1]) if N%2 else 0))

Measured memory_bytes: 7388
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long LL;
LL a,b,c,d,n;
int main() {
	scanf("%lld%lld%lld%lld%lld",&a,&b,&c,&d,&n);
	a=min(a*4,min(b*2,c));
	if (a*2<=d) printf("%lld\n",n*a);
		else printf("%lld\n",n/2*d+n%2*a);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
#define ll long long
int a[maxn], n;
void slove()
{
    scanf("%d" ,&n);
    for (int i = 1; i <= n; ++ i)
        scanf("%d" ,a + i);
    int ans = 0;
    for (int i = 2; i < n; ++ i)
    {
        int b[5];
        b[1] = a[i - 1], b[2] = a[i], b[3] = a[i + 1];
        sort(b + 1, b + 4);
        if (b[2] == a[i])
        {
            ans ++;
        }
    }
    printf("%d\n" ,ans);
    return ;
}
signed main()
{
    slove();
    return 0;
}


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

#ifdef _DEBUG
#define debug(x) cout<<#x<<": "<<x<<endl
#else
#define debug(x)
#endif

using namespace std;

int main() {
    string S;
    cin >> S;
    if (S == "AAA" || S == "BBB"){
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 256