akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>

#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long>vll;
typedef pair<int,int> pi;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

typedef string::const_iterator State;
int p,q,r;

int number(State &begin);
int term(State &begin);
int expr(State &begin);
int factor(State &begin);


int NOT(int x){
  if(x==0)return 2;
  else if(x==1)return 1;
  else return 0;
}

int AND(int x,int y){
  if(x==0||y==0)return 0;
  else if(x==2&&y==2)return 2;
  else return 1;
}

int OR(int x,int y){
  if(x==0&&y==0)return 0;
  else if(x==2||y==2)return 2;
  else return 1;
}

int main(){
  string s;
  int ans=0;
  while(cin>>s){
    if(s==".")break;
    ans=0;
    for(p=0;p<3;p++){
      for(q=0;q<3;q++){
	for(r=0;r<3;r++){
	  State begin=s.begin();
	  if(expr(begin)==2)ans++;
	}
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}

int number(State &begin){
  int ret=-1;
  if(isdigit(*begin)) ret=(*begin-'0');
  else if(*begin=='P') ret=p;
  else if(*begin=='Q') ret=q;
  else if(*begin=='R') ret=r;
  begin++;
  return ret;
}

int term(State &begin){
  if(*begin=='-'){
    begin++;
    return NOT(term(begin));
  }else{
    return factor(begin);
  }
}

int expr(State &begin){
  int ret=term(begin);
  while(1){
    if(*begin=='+'){
      begin++;
      ret=OR(ret,term(begin));
    }else if(*begin=='*'){
      begin++;
      ret=AND(ret,term(begin));
    }else{
      break;
    }
  }
  return ret;
}

int factor(State &begin){
  int ret=0;
  if(*begin=='('){
    begin++;
    ret=expr(begin);
    begin++;
  }else{
    ret=number(begin);
  }
  return ret;
}



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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
int N,W[111];
int T,i,ans;
int main(){
    scanf("%d", &N);
    fornum(i,0,N){
        scanf("%d", &W[i]);
    }

    fornum(i,0,N){
        ans += W[i];
    }
    fornum(T,0,N){
        ans -= W[T]*2;
        //printf("%d %d\n", T, ans);
        if(ans<0){
            int a = ans + W[T] * 2;
            printf("%d", a < abs(ans) ? a : abs(ans));
            break;
        }
    }

    return 0;
}

Measured memory_bytes: 256
use proconio::{fastout, input};
use std::io::*;
use std::str::FromStr;

use std::cmp::{max, min};
use std::collections::{BinaryHeap, HashMap, HashSet, VecDeque};

fn main() {
    input! {
        x: usize
    }
    if x == 1 {
        println!("0");
        return;
    }
    println!("1");
}


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

int n, m, ans;
vv w;
vector<bool> visit;

void input() {
    cin >> n >> m;
    visit = vector<bool>(n, false);
    w = vv(n);
    rep(i, m) {
        int x, y, z;
        cin >> x >> y >> z;
        w[--x].push_back(--y);
        w[y].push_back(x);
    }
}

void grouping(int me) {
    visit[me] = true;
    for (int i : w[me]) {
        if (visit[i]) continue;
        grouping(i);
    }
}

int main() {
    input();
    ans = 0;
    rep(i, n) {
        if (visit[i]) continue;
        ans++;
        grouping(i);
    }
    cout << ans << endl;
}


Measured memory_bytes: 8832
#include<iostream>
#include<vector>

using namespace std;

vector<vector<int>> spreadsheet(101,vector<int>(101));

int main(){
  int r,c;
  cin >> r >> c;
  for(int i=0;i < r;i++){
    for(int j=0;j < c;j++){
      cin >> spreadsheet.at(i).at(j);
    }
  }

  for(int i=0;i < r;i++){
    for(int j=0;j < c;j++){
      spreadsheet.at(i).at(c) += spreadsheet.at(i).at(j);
    }
  }

  for(int i=0;i <= c;i++){
    for(int j=0;j < r;j++){
      spreadsheet.at(r).at(i) += spreadsheet.at(j).at(i);
    }
  }

  for(int i=0;i <= r;i++){
    for(int j=0;j <= c;j++){
      cout << spreadsheet.at(i).at(j);
      if(j != c) cout << " ";
      else cout << endl;
    }
  }
  return 0;
}


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

#define rep(i, n) REP(i, 0, n)
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(x) cout << x << endl;

int main() {
    int n; cin >> n;
    double a[n]; rep(i, n) cin >> a[i];

    double ans = 0.0;
    rep(i, n){
        ans += 1.0 / a[i];
    }
    ans = 1.0 / ans;
    cout << setprecision(16) << ans << endl;
}


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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

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

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF   = 1e9;
const ll  INFLL = 1e18;
typedef pair<int, int> PII;
typedef vector<vector<int>> Graph;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

int main()
{
    ios::sync_with_stdio(false);
    string S; cin >> S;
    cout << (S.find("AC") != string::npos ? "Yes" : "No") << endl;
}

Measured memory_bytes: 764
#include <iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main()
{
	int N;
	cin >> N;

	int C0 = 0;
	int C1 = 0;
	int C2 = 0;
	int C3 = 0;
	for (int i = 0; i < N; i++) {
		string s;
		cin >> s;
		if (s == "AC") {
			C0++;
		}
		else if (s == "WA") {
			C1++;
		}
		else if (s == "TLE") {
			C2++;
		}
		else if (s == "RE") {
			C3++;
		}
	}

	cout << "AC x " << C0 << endl;
	cout << "WA x " << C1 << endl;
	cout << "TLE x " << C2 << endl;
	cout << "RE x " << C3 << endl;


}





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

inline
int count(const int& n) {
    int ret = 0;
    for (int i = n; i % 2 == 0; ++ret, i >>= 1);
    return ret;
}
int main(void){
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    int ans = 0;
    for (auto& v : a) {
        ans += count(v);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
n = gets.to_i

flag = true
ot = ox = oy = 0 # old
n.times do |i|
    
    t,x,y = gets.split.map(&:to_i)
    dt = t - ot
    dx = (x-ox).abs
    dy = (y-oy).abs
    
    remain_t = dt - dx - dy
    if remain_t < 0 or remain_t.odd?
        flag = false
        break
    end
    
    ot = t
    ox = x
    oy = y
end

puts flag ? "Yes" : "No"


Measured memory_bytes: 1788
#include<stdio.h>

void swapc(int*, int*);

int main(){
  int a,b,c,n,i;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d %d %d",&a,&b,&c);
    swapc(&a,&c);
    swapc(&b,&c);
    if(a*a+b*b == c*c){
      printf("YES\n");
    }
    else {
      printf("NO\n");
    }
  }
  return 0;
}

void swapc(int *x, int *c){
  int temp;
  if(*x>*c){
    temp = *x;
    *x = *c;
    *c = temp;
  }
}


Measured memory_bytes: 2036
#include<bits/stdc++.h>
using namespace std;
long long height[55]={1};
long long patty[55]={1};
long long f(long long n,long long x){
	if(x==0) return 0;
	if(x>=height[n]) return patty[n];
	
	long long len = height[n];
	if(x>=len/2+1){
		return patty[n-1]+1+f(n-1,x-2-height[n-1]);
	}
	else return f(n-1,x-1);
}
int main(){
	for(int i=1; i<=50; i++){
		height[i] = 3+2*height[i-1];
		patty[i] = 2*patty[i-1]+1;
	}
	long long n,x;
	cin>>n>>x;
	cout<<f(n,x);
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long
#define mp make_pair
#define endl "\n"
#define pii pair<int,int> 
#define ff first
#define ss second
#define mii map<int,int>
#define si set<int>
#define sti stack<int>
#define qi queue<int>
#define vi vector<int>
#define pq priority_queue<int>
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int M=1e9+7;

int32_t main(){
    IOS;
    string s;
    cin>>s;
    if(s=="ABC") cout<<"ARC"<<endl;
    else cout<<"ABC"<<endl;
}


Measured memory_bytes: 3564
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		char[] nums = new char[4];
		nums = S.toCharArray();

		String ans = "Good";
		for (int i = 0; i < 3; i++) {
			if (nums[i] == nums[i + 1]) {
				ans = "Bad";
				break;
			}
		}
		System.out.println(ans);
		sc.close();
	}
}


Measured memory_bytes: 22868
NX = input().split()
N, X = int(NX[0]), int(NX[1])
donut_list = []
for i in range(N):
    donut_list.append(int(input()))

X -= sum(donut_list)
min_donut = min(donut_list)
ans = N + X // min_donut

print(ans)

Measured memory_bytes: 3060
// AtCoder Beginner Contest 140
// C - Maximam Value
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >> N;

  vector<int> B(N - 1);
  for (int i = 0; i < N - 1; i++) {
    cin >> B.at(i);
  }

  vector<int> A(N);
  A.at(0) = B.at(0);
  A.at(N - 1) = B.at(N - 2);
  for (int i = 1; i < N - 1; i++) {
    A.at(i) = min(B.at(i), B.at(i - 1));
  }

  int ans = 0;
  for (int i = 0; i < N; i++) {
    ans += A.at(i);
  }
  cout << ans << endl;
}

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

int main()
{
	char str[5];
	int flag = 0;
	cin >> str;
	for (int i = 0; i < 3; i++)
	{
		if (str[i] == str[i + 1])
		{
			flag = 1;
			break;
		}
	}
	if (flag==1)
	{
		cout << "Bad" << endl;
	}
	else
	{
		cout << "Good" << endl;
	}
	return 0;
}

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

#define SWAP(a,b) ((a != b)? (a += b,b = a - b,a -= b) : 0 ) //数値のみ
#define SWAPs(type,a,b) { type temp = a; a = b; b = temp; } //型指定する ポインタ, 構造体等
#define rng(i, a, b) for(int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define pb push_back
#define eb emplace_back
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed

int main() {
  int s, t, d, ans = 0;
  map<string, int> m;
  //string s;
  cin >> d >> t>> s;
  //vector<ll> c(n), v(n);
  //rep(i, n) cin >> c.at(i);
  if(t * s >= d) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a, b;cin >> a >> b;
  if(b > 0)
    if(a > b)
      cout << a - b + 2 << endl;
    else
      if(a >= 0)
	cout << b - a << endl;
      else if(abs(a) < b)
	cout << b - abs(a) + 1 << endl;
      else
	cout << abs(a) - b + 1 << endl;
  else
    if(a <= b)
      cout << b - a << endl;
    else
      if(a < 0)
	cout << a - b + 2 << endl;
      else if(a > abs(b))
	cout << a - abs(b) + 1 << endl;
      else
	cout << abs(b) - a + 1 << endl;
  return 0;
}


Measured memory_bytes: 256
/*input
5
11 1 2 4 8
11 1 2 2 8
32 10 8 5 4
29384293847243 454353412 332423423 934923490 1
900000000000000000 332423423 454353412 934923490 987654321
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define eb emplace_back
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (int)(lower_bound(c.begin(),c.end(),x)-c.begin())
#define EL cout<<'\n'
#define BS(a,x) binary_search(ALL(a),x)
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
template<typename T>
ostream& operator<<(ostream& out,vector<T> V){
	REP(i,SZ(V)) out<<V[i]<<((i!=SZ(V)-1)?" ":"");
	return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=20;
const ll INF64=1e18;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		b>>=1;
	}
	return res;
}

unordered_map<ll,ll> mp;

ll a,b,c,d;

ll cal(ll n){
	if(n==0) return 0;
	if(mp.count(n)) return mp[n];

	ll ret = INF64;

	if(1e18/n > d) {
		ret = n*d;
	}

	ret = min(ret, n%2*d + a + cal(n/2));
	if(n%2 && n/2+1 < n){
		ret = min(ret, (2-n%2)*d + a + cal(1+n/2));
	}

	ret = min(ret, n%3*d + b + cal(n/3));
	if(n%3 && n/3+1 < n){
		ret = min(ret, (3-n%3)*d + b + cal(1+n/3));
		// if(n==11){
		// 	cout<<b<<' '<<d<<' '<<cal(1+n/3)<<' '<<ret<<' '<<(n-n%3)*d + b + cal(1+n/3)<<endl;
		// }
	}

	ret = min(ret, n%5*d + c + cal(n/5));
	if(n%5 && n/5 + 1 < n){
		ret = min(ret, (5-n%5)*d + c + cal(1+n/5));
	}
	mp[n] = ret;
	// cout<<n<<' '<<ret<<'\n';
	return ret;
}

void solve(){
	ll n;
	cin>>n>>a>>b>>c>>d;
	mp.clear();
	cal(n);
	cout<<mp[n]<<'\n';
	// cerr<<SZ(mp)<<endl;
}

int main(){
	IOS;	
	int T;
	cin>>T;
	while(T--) solve();
	return 0;
}


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

using namespace std;

long long inf=1000000007;

long long modpow(long long n,long long p,long long mod);

int main(){
	long long hoge=15;
	string s;
	cin>>s;
	for(auto a:s){
		if(a=='x') hoge--;
	}

	if(hoge>=8) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;

	return 0;
}

long long modpow(long long n,long long p,long long mod){
	if(p==0) return 1;
	if(p%2==0) return (modpow(n,p/2,mod)*modpow(n,p/2,mod))%mod;
	if(p%2==1) return (modpow(n,p-1,mod)*n)%mod;
	cerr<<"ERROR"<<endl;
	return 1;
}


Measured memory_bytes: 3608
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main() {

    int a, b;
    char s;

    scanf("%d %c %d", &a, &s, &b);
    
    if(s=='+'){
        printf("%d",a+b);
    }else {
        printf("%d", a - b);
        
    }


    return 0;

}


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

int main() {
  int n, x, m[101];
  int min = 100000;
  cin >> n >> x;
  for (int i = 0; i < n; i++) {
    cin >> m[i];
    if (min > m[i]) min = m[i];
    x -= m[i];
  }
  cout << n + x / min << endl;
  return 0;
}

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

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define dump(x)  cout << #x << " = " << (x) << endl;	//debug
#define SZ(x) ((int)(x).size())
#define REP(i, n) for(ll i = 0; i < (n); i++)
#define REPR(i, n) for (ll i = (n); i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define yes() cout << "Yes"<< endl;
#define no() cout << "No"<< endl;

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
////////////////////////////////////////////////////////////
#define all(x) (x).begin(), (x).end() 
const int inf = 1e9;
const long long INF=1e15;
#define endl '\n'
#define forn(i, n) for(int i=0;i<(n);++i)
#define pb push_back
#define eb emplace_back
#define fastio ios::sync_with_stdio(false);cin.tie(0); //cout.tie(0);

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;

int main() {
	int n, m; cin >> n >> m;
	cout << n*(n-1)/2 + m*(m-1)/2;
}

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

using namespace std;

int main()
{int N; cin >> N;  vector<long long> R(N); 
for(int i = 0; i < N ; i++)
   {cin >> R[i];}

long long max_diff = -2000000000;
long long minimum =R[0];
for(int j = 1; j < N; j++)
   {max_diff = max(max_diff, R[j] - minimum);
     minimum = min(minimum, R[j]);}

cout << max_diff << endl;

return 0;
}


Measured memory_bytes: 4336
#include<stdio.h>

int main(){
  int h,w,x,y;

  while(1){
    scanf("%d %d",&h,&w);

    if(h+w == 0) break;

    for(y=0;y<h;++y){
      for(x=0;x<w;++x){
	printf("#");
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2104
#include "bits/stdc++.h"
using namespace std;
typedef complex<double> Point;
const double eps = 1e-9;
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
	int N; 
	while (cin >> N, N) {
		vector<Point> P(N);
		for (int i = 0; i < N;i++) {
			double x, y; cin >> x >> y;
			P[i] = Point(x, y);
		}
		if (N == 1) { cout << 1 << endl; continue; }
		int ans = 1;
		for (int i = 0; i < N;i++) for (int j = i + 1; j < N;j++) {
			double dist = abs(P[i] - P[j]);
			if (dist > 2) continue;
			double r = sqrt(1 - dist*dist / 4);
			double difx = -(P[i] - P[j]).imag()*r / dist;
			double dify = (P[i] - P[j]).real()*r / dist;
			Point new_P(difx, dify);
			Point check_P(new_P + (P[i] + P[j]) / 2.0);
			
			int cnt = 0;
			for (int k = 0; k < N;k++) {
				if (abs(check_P - P[k]) < 1.0 + eps)cnt++;
			}
			ans = max(ans, cnt);
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    vector<int> vc;
    cin >> n;
    int sum = 0;
    for(int i = 0;i < n;i++) {
        int x; 
        cin >> x;
        sum += x;
        vc.push_back(sum);
    }
    int min;
    min = abs(vc[n-1]-2*vc[0]);
    int flag = 0;
    for(int i = 1;i < n;i++) {
        int cmp;
        cmp = abs(vc[n-1]-2*vc[i]);
        if(min > cmp) {
            min = cmp;
            flag = i;
        }
    }

    cout << min << endl;
    return 0;

}

Measured memory_bytes: 256
H,W,K = map(int, input().split())
S = [[int(i) for i in list(input())] for _ in range(H)]

ans = float("inf")
for state in range(2 ** (H - 1)):
    flag = True

    # 横棒のカウント
    yoko = 0
    for i in range(H - 1):
        if (state >> i) & 1:
            yoko += 1

    res = yoko

    # ホワイトチョコレートの個数
    cntHW = [0] * (yoko + 1)
    for j in range(W):
        # 今のグループ
        now = 0
        # 列を探索
        cntH = [0] * (yoko + 1)
        for i in range(H):
            if S[i][j] == 1:
                cntH[now] += 1

            if (state >> i) & 1: # 区切り
                now += 1
        
        for cH in cntH:
            if cH > K:
                flag = False

        # 個数の最大値
        MAX = max(cH + cHW for cH,cHW in zip(cntH,cntHW))
        if MAX > K:
            res += 1
            cntHW = cntH[::]
        else:
            for i in range(yoko + 1):
                cntHW[i] += cntH[i]

    if flag:
        ans = min(ans, res)

print(ans)

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

using std::pair;
using std::vector;
using std::string;

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

#define fst first
#define snd second
#define pb(a) push_back(a)
#define mp(a, b) std::make_pair(a, b)
#define debug(...) fprintf(stderr, __VA_ARGS__)

template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }

const int oo = 0x3f3f3f3f;
const double PI = acos(-1.0);
const double eps = 1e-5;

string procStatus() {
    std::ifstream t("/proc/self/status");
    return string(std::istreambuf_iterator<char>(t), std::istreambuf_iterator<char>());
}

template <typename T> T read(T& x) {
    int f = 1; x = 0;
    char ch = getchar();
    for(;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
    for(; isdigit(ch); ch = getchar()) x = x * 10 + ch - 48;
    return x *= f;
}

double sqr(double x) { return x * x; }

const int N = 100;

struct P{
    int id;
	double x,y;
	P(){}
	P(double _x,double _y):x(_x),y(_y){}
	friend P operator +(P a,P b){
		return P(a.x+b.x,a.y+b.y);
	}
	friend P operator -(P a,P b){
		return P(a.x-b.x,a.y-b.y);
	}
	friend double operator*(P a,P b){
		return a.x*b.y-a.y*b.x;
	}
	friend double operator/(P a,P b){
		return a.x*b.x+a.y*b.y;
	}
	friend bool operator==(P a,P b){
		return fabs(a.x-b.x)<eps&&fabs(a.y-b.y)<eps;
	}
	friend bool operator!=(P a,P b){
		return !(a==b);
	}
	friend bool operator<(P a,P b){
		if(fabs(a.y-b.y)<eps)return a.x<b.x;
		return a.y<b.y;
	}
	friend double dis2(P a){
		return sqr(a.x)+sqr(a.y);
	}
	friend void print(P a){
		printf("%.2lf %.2lf\n",a.x,a.y);
	}
};

double dot (P a, P b) {
    return a.x * b.x + a.y * b.y;
}

double len (P a) {
    return sqrt(1. * a.x * a.x + 1. * a.y * a.y);
}

double angle(P a, P b) {
    return acos(dot(a, b) / len(a) / len(b));
}

int n, m;
double ans[N + 5];
P p[N + 5], q[N + 5];

bool cmp(P a,P b)
{
	if(fabs((b-p[1])*(a-p[1]))<eps)return dis2(a-p[1])<dis2(b-p[1]);
	return (a-p[1])*(b-p[1])>0;
}

void graham()
{
	for(int i=1;i<=n;i++)
		if(p[i]<p[1])std::swap(p[i],p[1]);
    std::sort(p+2,p+n+1,cmp);
	q[++m]=p[1];q[++m]=p[2];
	for(int i=3;i<=n;i++)
	{
		while((q[m]-q[m-1])*(p[i]-q[m-1])<eps&&m>1)m--;
		q[++m]=p[i];
	}
}

int main() {
#ifdef Wearry
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif

    read(n);
    if(n == 2) {
        printf("%.5lf\n%.5lf\n", 0.5, 0.5);
        return 0;
    }

    for (int i = 1; i <= n; ++ i) {
        static int x, y;
        read(x), read(y);

        p[i].id = i;
        p[i].x = x, p[i].y = y;
    }

    graham();
    if(m == 2) {
        for (int i = 1; i <= n; ++ i) printf("%.8lf\n", (i == q[1].id || i == q[2].id) ? 0.5 : 0);
        return 0;
    }

    for (int i = 1; i <= m; ++ i) {

        int lst = (i == 1) ? m : i - 1;
        int nxt = (i == m) ? 1 : i + 1;

        double ang = angle(q[nxt] - q[i], q[lst] - q[i]);

        while (ang < 0) ang += PI;
        while (ang > PI) ang -= PI;
        ans [q[i].id] = (PI - ang) / 2 / PI;

    }

    for (int i = 1; i <= n; ++ i) printf("%.8lf\n", ans[i]);

    return 0;
}



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

int main() {
    int N,K;
    int a[110];
    cin >> N >> K;
    for (int i = 0; i < N; ++i) cin >> a[i];

    sort(a, a + N, greater<int>());
    int ans = 0;
    for (int j = 0; j < K; ++j) {
            ans += a[j];
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;
template <typename A, size_t N, typename T> void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
// long long mod = 998244353;
#define REP(i, n) for (long long i = 0; i < (n); i++)
#define rep(i, a, n) for (long long i = a; i < (n); i++)
typedef long long ll;
typedef pair<ll, ll> P;
long long mod = 1000000007;
long long modpow(long long m, long long n, long long modvalue) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2, modvalue);
        return t * t % modvalue;
    } else {
        return modpow(m, n - 1, modvalue) * m % modvalue;
    }
}

long long moddiv(long long a, long long b, ll modvalue) { return (a * modpow(b, mod - 2, modvalue)) % modvalue; }

const ll INF = 1LL << 60;

string change_binary(long long a) {
    string ret;
    for (int i = 31; i >= 0; i--) {
        ret += (a >> i & 1) + '0';
    }
    return ret;
}

ll nCkmod(ll n, ll k, ll modvalue) {
    ll numera = 1;
    for (int i = n; i > n - k; i--) {
        numera *= i;
        numera %= modvalue;
    }
    ll denomi = 1;
    REP(i, k) {
        denomi *= (i + 1);
        denomi %= modvalue;
    }
    return moddiv(numera, denomi, modvalue);
}

map<ll, ll> cnt;
void primeFactors(long long n) {
    while (n % 2 == 0) {
        cnt[2]++;
        n = n / 2;
    }
    for (int i = 3; i <= sqrt(n); i = i + 2) {
        while (n % i == 0) {
            cnt[i]++;
            n = n / i;
        }
    }
    if (n > 2) {
        cnt[n]++;
    }
}
struct UnionFind {
    vector<int> parent, size;
    UnionFind(int n) {
        parent.resize(n, -1);
        size.resize(n, 1);
    }
    void unite(int x, int y) {
        if (same(x, y)) {
            return;
        }
        x = root(x);
        y = root(y);
        if (size[x] <= size[y]) {
            swap(x, y);
        }
        parent[y] = x;
        size[x] += size[y];
    }
    bool same(int x, int y) { return (root(x) == root(y)); }
    int root(int x) {
        while (parent[x] != -1) {
            x = parent[x];
        }
        return x;
    }
    int getsize(int x) { return size[root(x)]; }
};
int main() {
    ll x, k, d;
    cin >> x >> k >> d;
    x = abs(x);
    if (k <= x / d) {
        cout << x - k * d << endl;
    } else {
        k = k - x / d;
        x -= (x / d) * d;
        k = k % 2;
        cout << abs(x - k * d) << endl;
    }
}

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

int main(){
    int a,b,c,d;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    if(abs(a-c)<=d){
        printf("Yes");
    }
    else if(abs(a-b)<=d && abs(b-c)<=d){
        printf("Yes");
    }
    else{
        printf("No");
    }
return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n,ans=-1;
	scanf("%d",&n);
	for(int i=1;i<=n;i++) {
		if((int)(i*1.08)==n) ans=i;
	}
	if(~ans) printf("%d\n",ans);
	else printf(":(\n");
	return 0;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,M;
ll mo=998244353;

ll modpow(ll a, ll n = mo-2) {
	ll r=1;
	while(n) r=r*((n%2)?a:1)%mo,a=a*a%mo,n>>=1;
	return r;
}

ll combi(ll N_, ll C_) {
	const int NUM_=1000005;
	static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];
	if (fact[0]==0) {
		inv[1]=fact[0]=factr[0]=1;
		for (int i=2;i<=NUM_;++i) inv[i] = inv[mo % i] * (mo - mo / i) % mo;
		for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%mo, factr[i]=factr[i-1]*inv[i]%mo;
	}
	if(C_<0 || C_>N_) return 0;
	return factr[C_]*fact[N_]%mo*factr[N_-C_]%mo;
}
ll hcomb(int P_,int Q_) { return (P_==0&&Q_==0)?1:combi(P_+Q_-1,Q_);}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>M;
	
	ll Q=modpow(combi(N+M,N));
	ll P=0;
	
	for(i=N+M-2;i>=0;i-=2) {
		int left=(N+M-i)/2;
		ll a=combi(left*2,left);
		ll b=combi(N+M-left*2,N-left);
		(P += a*b)%=mo;
	}
	
	cout<<(P*modpow(2)%mo*Q+max(N,M))%mo<<endl;
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 23680
#include<iostream>
#include<algorithm>
using namespace std;
int dp[1010][1010];
int main(){string a,b;cin>>a>>b;
for(int i=0;i<a.size()+1;i++)dp[i][0]=i;
for(int i=0;i<b.size()+1;i++)dp[0][i]=i;
for(int i=1;i<=a.size();i++){
for(int j=1;j<=b.size();j++){
int q=1;if(a[i-1]==b[j-1])q = 0;
dp[i][j]=min(min(dp[i-1][j-1]+q,dp[i][j-1]+1),dp[i-1][j]+1);}}
cout<<dp[a.size()][b.size()]<<endl;return 0;}

Measured memory_bytes: 7120
from sys import stdin
import sys
input = stdin.readline
sys.setrecursionlimit(10**6)
mod = 10**9+7
 
n = int(input())
m = n-1
graph = [[] for j in range(n)]
d = {}

for i in range(m):
    a,b,c = map(int, input().split())
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)
    d[(a-1,b-1)] = d[(b-1,a-1)] = c

q,k = map(int,input().split())
    
# 頂点kから各頂点への距離
dis = [0]*n
    
# v = 現在の頂点
# per = vの親(vが根のときは-1)
# ans = 総距離
def DFS(v,per,ans):
	if not per == -1 :
		dis[v] = ans
	for i in graph[v]:
        # 移動先iがvの親ならスキップ（訪問済みのチェックと同じ）
		if i == per :
			continue
		DFS(i,v,ans+d[(v,i)])

DFS(k-1,-1,0)

for i in range(q) :
  x,y = map(int,input().split())
  print(dis[x-1]+dis[y-1])

Measured memory_bytes: 156632
module Main where
import qualified Data.Vector as V
import Data.Vector (Vector)
import Data.Vector ((!))
import Data.Vector ((!?))
import Control.Applicative

main :: IO ()
main = do
  n:maxw:_ <- map read . words <$> getLine :: IO [Int]
  vws <- V.replicateM n $ do
    v:w:_ <- map read . words <$> getLine :: IO [Int]
    return (v,w)
  print $ V.maximum $ solve vws (maxw+1)
  return ()

solve :: Vector (Int,Int) -> Int -> Vector Int
solve vws maxw = V.foldl' next v0 vws
  where
    v0 :: Vector Int
    v0 = V.replicate (maxw) 0
    next :: Vector Int -> (Int,Int) -> Vector Int
    --next vs _ | traceShow vs False = undefined
    next vs (v,w) = V.generate maxw gen
      where
        gen i = max v1 v2
          where
            v1 = vs ! i
            v2 = case vs !? (i - w) of
              Nothing -> 0
              Just p -> p + v

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

using namespace std;

const int nMax = 2005;

int n, x, y, d[nMax], viz[nMax];

int main(){
//    freopen("date.in", "r", stdin);
//    freopen("date.out", "w", stdout);
    cin >> n >> x >> y;
    queue<pair<int, int>> q; // pos, dist;
    for (int i=1; i<=n; i++){
        memset(viz, 0, sizeof(viz));
        q.push(make_pair(i, 0));
        while (q.size()){
            auto &el = q.front(); q.pop();
            int pos=el.first, dist=el.second;
            if (!viz[pos]){
                viz[pos]++;
                if(dist && pos > i) d[dist]++;

                if (pos<n) q.push(make_pair(pos+1, dist+1));
                if (pos>1) q.push(make_pair(pos-1, dist+1));
                if (pos==x && y>pos) q.push(make_pair(y, dist+1));
                if (pos==y && x>pos) q.push(make_pair(x, dist+1));
            }
        }
    }
    for (int i=1; i<=n-1; i++){
        cout << d[i] << "\n";
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;

int main(){
    int h,w;
    cin>>h>>w;
    vector<vector<char>>v(h,vector<char>(w));
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
        {
            cin>>v[i][j];
        }
    }
    vector<vector<int>>dp(h,vector<int>(w,0));    
    dp[0][0]=1;
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
        {
            if(i>=1&&v[i-1][j]=='.'){
                dp[i][j]+=dp[i-1][j];
                dp[i][j]%=mod;
            }
            if(j>=1&&v[i][j-1]=='.'){
                dp[i][j]+=dp[i][j-1];
                dp[i][j]%=mod;
            }
        }
    }
    cout<<dp[h-1][w-1];
}

Measured memory_bytes: 8560
#include <bits/stdc++.h>
using namespace std;
 
typedef long long T;
 
struct point { 
    T x,y;
    int i; 
    point operator - (const point &rhs) {
        return {x-rhs.x, y-rhs.y, 0};
    }
    T dot(const point &rhs) {
        return x*rhs.x + y*rhs.y;
    }
    T cross(const point &rhs) {
        return x*rhs.y - y*rhs.x;
    }
    T len2() {
        return x*x + y*y;
    }
};
 
int compare(T x, T y) {
    if(y-x > 0) return -1;
    if(x-y > 0) return 1;   
    return 0;
}
 
T cross(point p, point q, point r) { return (r-q).cross(p-q); }

int turn(point p, point q, point r)
{
    T result = (r.x - q.x) * (p.y - q.y) - (r.y - q.y) * (p.x - q.x);
    return compare(result, 0); 
}
 
//int turn(point p, point q, point r) { return compare(cross(p,q,r), 0); }
 
int cw(point p, point q, point r) { return turn(p,q,r) < 0; }
 
 /*
double angle(point p, point q, point r) 
{
    point v = r - q;
    point u = p - q;
    return acos(v.dot(u) / sqrt(v.len2() * u.len2())); 
}
*/
T dot(point p, point q) { return p.x * q.x + p.y * q.y; }
// modulo^2 de un punto (distance to origin)
double norm2(point p) { return p.x * p.x + p.y * p.y; }


double angle(point a, point o, point b) // angle AOB (radians)
{
   point u = {a.x - o.x, a.y - o.y}; // u: vector oa
   point v = {b.x - o.x, b.y - o.y}; // v: vector ob
   return acos(dot(u,v) / sqrt(norm2(u) * norm2(v))); // dot product
}

 
bool cmp(const point &p, const point &q)
{
    return p.x < q.x || (p.x == q.x && p.y < q.y);
}
 
vector<point> convex_hull(vector<point> &p)
{
    int n = (int)p.size(), k = 0;
    vector<point> h(2 * n);
    sort(p.begin(), p.end(), cmp);
    for(int i = 0; i < n; i++) 
    {
        while(k >= 2 && cw(h[k-2], h[k-1], p[i])) k--;
        h[k++] = p[i];
    }
    for(int i = n - 2, t = k + 1; i >= 0; i--) 
    {
        while(k >= t && cw(h[k-2], h[k-1], p[i])) k--;
        h[k++] = p[i];
    }
    h.resize(k); h.pop_back(); 
    return h;
}
 
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    cout << fixed << setprecision(10);
    int n,m;
    vector<point> p,h;
    double ans[105];
    while(cin >> n)
    {
        p = vector<point>(n);
        for(int i = 0; i < n; i++)
        {
            cin >> p[i].x >> p[i].y;
            p[i].i = i;
        }
        h = convex_hull(p);
        for(int i = 0; i < n; i++)
            ans[i] = 0;
        m = h.size();
        for(int i = 0; i < m; i++)
            ans[h[i].i] = (M_PI - angle(h[(i-1+m)%m], h[i], h[(i+1)%m])) / (2*M_PI);
        for(int i = 0; i < n; i++)
            cout << ans[i] << '\n';
    }
    return 0;
} 

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

#define INF 1e+12
#define MAX_V 100000
struct edge{
  ll to;
  ll cost;
};
// <最短距離, 頂点の番号>
using P = pair<ll, ll>;

vector<edge> G[MAX_V];
ll depth[MAX_V];
void dfs(int v, int p, ll d){
  depth[v] = d;
  for(auto &i : G[v]){
    if(i.to == p){
      continue;
    }
    dfs(i.to, v, d + i.cost);
  }
}

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

  for(int i = 0; i < n - 1; i++){
    int a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    edge e = {b, c};
    G[a].push_back(e);
    e = {a, c};
    G[b].push_back(e);
  }
  int q, k;
  cin >> q >> k;
  k--;
  dfs(k, -1, 0);

  vector<int> x(q), y(q);
  for(int i = 0; i < q; i++){
    cin >> x[i] >> y[i];
    x[i]--;
    y[i]--;
  }
  for(int i = 0; i < q; i++){
    cout << depth[x[i]] + depth[y[i]] << '\n';
  }
  return 0;
}

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

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

	int N;
	std::cin >> N;

	std::vector<ll> Hap[3];
	std::vector<ll> dp[3];
	for(int i=0; i<3; i++){
		Hap[i].resize(N+1, 0);
		dp[i].resize(N+1, 0);
	}
	
	for(int i=1; i<=N; i++){
		std::cin >> Hap[0][i] >> Hap[1][i] >> Hap[2][i];
	}


	for(int i=1; i<=N; i++){
		for(int j=0; j<3; j++){
			for(int k=0; k<3; k++){
				if( j == k ) continue;
				dp[j][i] = std::max(dp[j][i], dp[k][i-1] + Hap[j][i] );
			}
		}
	}
	std::cout << std::max( dp[0][N], std::max(dp[1][N], dp[2][N]) ) << '\n';
	return 0;
}

Measured memory_bytes: 4992
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#define ALL(x) (x).begin(), (x).end()     //昇順
#define RALL(x) (x).rbegin(), (x).rend()  // 降順
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
const long long mod = 1e9 + 7;
typedef long long ll;
typedef priority_queue<int> PQ;
typedef vector<long long> VL; // VL a(n);
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VS> VSS;
typedef vector<VC> VCC;
typedef vector<VL> VLL; // VII a(n,VI(m)) n * m
typedef pair<ll, ll> PL;
typedef map<ll, ll> MP; // MP a;
typedef vector<pair<ll, ll>> PS; // PS a(n);

template <class T, class U>
bool chmax(T &a, U b) {
  if (a <= b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T, class U>
bool chmin(T &a, U b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
  os << "}";
  return os;
}

// g++ -std=c++11 prac.cpp
// operator << (cout,a);
// chmin(min,a)

int main() {
  ll n,k,m,x=0,y=0,z = 0,cnt=0,h=0,w=0,ans=0,sum = 0, Max = -1, Min = 3e9+1;
  string s;
  cin >> n;
  VS a(n);
  VL b(5);
  rep(i,n) {
    cin >> a[i];
    if(a[i][0] == 'M'){ b[0]++; }
    if(a[i][0] == 'A'){ b[1]++; }
    if(a[i][0] == 'R'){ b[2]++; }
    if(a[i][0] == 'C'){ b[3]++; }
    if(a[i][0] == 'H'){ b[4]++; }
  }
  rep(i,3){
    for(int j=i+1; j<4;j++){
      for(int k=j+1; k<5; k++){
        ans += b[i]*b[j]*b[k];
      }
    }
  }
  pri(ans);
  return 0;
}

Measured memory_bytes: 6428
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _0128
{
    public class Program

    {
        public static void Main(string[] args)
        {
            char[,] abacus = new char[,]
            {
                 {'*',' ','=',' ','*','*','*','*' }
               , {'*',' ','=','*',' ','*','*','*' }
               , {'*',' ','=','*','*',' ','*','*' }
               , {'*',' ','=','*','*','*',' ','*' }
               , {'*',' ','=','*','*','*','*',' ' }
               , {' ','*','=',' ','*','*','*','*' }
               , {' ','*','=','*',' ','*','*','*' }
               , {' ','*','=','*','*',' ','*','*' }
               , {' ','*','=','*','*','*',' ','*' }
               , {' ','*','=','*','*','*','*',' ' }
            };

            StringBuilder sb = new StringBuilder();
            while (true)
            {
                string line = Console.ReadLine();
                if (string.IsNullOrEmpty(line)) break;

                line = line.PadLeft(5, '0');

                char[,] ans = new char[5, 8];
                for (int i = 0 ; i < line.Length ; i++)
                {
                    for (int j = 0 ; j < 8 ; j++)
                    {
                        ans[i, j] = abacus[int.Parse(line[i].ToString()), j];
                    }
                }

                if (sb.Length != 0) sb.AppendLine("");
                for (int i = 0 ; i < 8 ; i++)
                {
                    for (int j = 0 ; j < 5 ; j++)
                    {
                        sb.Append(ans[j, i]);
                    }
                    sb.Append(Environment.NewLine);
                }
            }
            Console.Write(sb.ToString());
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}



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

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

    int a, b, c;
    a = n / 100 / 1;
    b = n % 100 / 10;
    c = n % 10;

    if (a == 7 || b == 7 || c == 7) {
        cout << "Yes" << endl;
    }else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3624
n=int(input())
s=list(input())
ctR=0;ctG=0;ctB=0
for i in range(n):
  if s[i]=='R':
    ctR+=1
  elif s[i]=='G':
    ctG+=1
  else:
    ctB+=1

ct=0
for i in range(n):
  x=s[i]
  for j in range(1,min(i,n-1-i)+1):
    if s[i]!=s[i-j] and s[i]!=s[i+j] and s[i-j]!=s[i+j]:
      ct+=1
print(ctR*ctG*ctB-ct)

Measured memory_bytes: 73784
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;

int main(){
  ll n;
  cin >> n;
  ll min = 1000, max = 0;
  REP(i,n){
    ll a;
    cin >> a;
    if(min>a) min = a;
    if(max<a) max = a;
  }
  cout << max-min << endl;
  return 0;
}


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

int main(){
    int N; cin >> N;
    vector<string> W(N);
    bool flag = false;
    for(int i=0;i<N;i++){
        cin >> W[i];
        if(i>0 && W[i][0]!=W[i-1][W[i-1].size()-1]){
            flag = true;
        }
        for(int j=0;j<i;j++){
            if(W[i]==W[j]){
                flag = true;
                break;
            }
        }
        if(flag){
            break;
        }
    }
    if(flag){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 256
s = list(str(input()))
n = len(s)
s.append('A')
i = 0
same_letter = 0
ans = 0
while i < n:
    if s[i] == s[i+1]:
        same_letter += 1
        i += 1
    else:
        same_letter += 1
        if same_letter % 3 == 0:
            ans += same_letter * 2 // 3
            same_letter = 0
            i += 1
        elif same_letter % 3 == 1:
            ans += (same_letter + 2) * 2 // 3 - 1
            same_letter = 0
            i += 1
        elif same_letter % 3 == 2 and i < n-1:
            ans += (same_letter + 1) * 2 // 3
            same_letter = 0
            i += 2
        else:
            ans += (same_letter + 1) * 2 // 3 - 1
            break
print(ans)



Measured memory_bytes: 4968
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;

int n, m;
int capX, capY;
vector<int> cityX, cityY;

void input() {
	cin >> n >> m;
	cin >> capX >> capY;
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		cityX.push_back(x);
	}
	for (int i = 0; i < m; i++) {
		int y;
		cin >> y;
		cityY.push_back(y);
	}
}

string solve() {
	cityX.push_back(capX);
	sort(cityX.begin(), cityX.end());
	cityY.push_back(capY);
	sort(cityY.begin(), cityY.end());

	int maxX = cityX.at(n);
	int minY = cityY.at(0);

	if(maxX < minY) return "No War";
	return "War";
}

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

	input();
	cout << solve() << "\n";

	return 0;
}

Measured memory_bytes: 256
import math

X=int(input())

root = math.floor(X**0.2)
half = root//2 - 5

while root > half:
    root2 = int((X-root**5)**0.2)
    if root**5 + root2**5 == X:
        print(int(root),-int(root2))
        exit()
    root -= 1

root = math.ceil(X**0.2)

while True:
    root2 = int((root**5-X)**0.2)
    if root**5 - root2**5 == X:
        print(int(root),int(root2))
        exit()
    root+=1   

Measured memory_bytes: 9464
#include <iostream>
#include <cstdio>
#include <set>
#include <cstring>
#include <string>

using namespace std;

int main()
{
	int N;
	char dstr[13];
	string str;
	set<string> dset;
	cin>>N;
	for(int i=0;i<N;i++){
		scanf("%s",dstr);
		str=dstr;
		if(str=="insert"){
			cin>>str;
			dset.insert(str);
		}else{
			scanf("%s",dstr);
			str=dstr;
			if(dset.count(str)){
				cout<<"yes"<<endl;
			}else{
				cout<<"no"<<endl;
			}
		}
	}
}

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

using namespace std;

int main()
{
   long long int H , W , ans1=1e14 , ans2=1e14 , ans3=1e14 , ans4 =1e14;
  
    cin >> H >>  W;
   
  
  
  for(int h=0;h<H;h++){
    
    long long int s1 = h*W;
    
    long long int s2 = (H-h)*(W/2);
    
    long long int s3 = (H-h)*(W-(W/2));
    
    ans1 = min(ans1 , max({s1 , s2 , s3}) - min({s1 , s2 , s3}));
            
  }
  
  for(int h=0;h<H;h++){
    
    long long int t1 = h*W;
    
    long long int t2 = ((H-h)/2)*W;
    
    long long int t3 = (H-(H-h)/2-h)*W;
    
    ans2 = min(ans2 , max({t1 , t2 , t3}) - min({t1 , t2 , t3}));
            
  }
  
  for(int w=0;w<W;w++){
    
    long long int u1 = w*H;
    
    long long int u2 = (W-w)*(H/2);
    
    long long int u3 = (W-w)*(H-(H/2));
    
    ans3 = min(ans3 , max({u1 , u2 , u3}) - min({u1 , u2 , u3}));
            
  }
  
  for(int w=0;w<W;w++){
    
    long long int v1 = w*H;
    
    long long int v2 = ((W-w)/2)*H;
    
    long long int v3 = (W-(W-w)/2-w)*H;
    
    ans4 = min(ans4 , max({v1 , v2 , v3}) - min({v1 , v2 , v3}));
            
  }
  
  
 cout <<  min( {ans1 , ans2 , ans3 , ans4} ) << endl;
  
}
  
  
  

Measured memory_bytes: 256
d_cnt,sum_X =(int(x) for x in input().split()) 
al=[]
last,d_plus=0,0

for i in range(d_cnt): 
  al.append(int(input())) 
last=sum_X-sum(al)

if last>min(al):
  d_plus=last//min(al)

print(d_cnt+d_plus)


Measured memory_bytes: 3060
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#define Mod 1000000007
#define INF 1e14
typedef long long int ll;
const ll N=1e6+5;
bool x[N+1]={false};
ll fast(ll n,ll a)
{
    if(n==0)
        return 1;
    else if(n==1)
        return a;
    else
    {
        ll res=fast(n/2,a)%Mod;
        if(n%2==0)
        {
            return (((res%Mod)*(res%Mod))%Mod);
        }
        else{
            return (((((res%Mod)*a)%Mod)*res)%Mod);
        }
    }
}
int main()
{
  int n,a,b;
  cin>>n>>a>>b;
  cout<<min(n*a,b);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
int main() {
	cin.tie(0);
    ios::sync_with_stdio(false);

    int H, W;
    cin >> H >> W;

    vector<vector<char> > a(H, vector<char>(W));

    vector<bool> b(H);
    vector<bool> c(W);

    for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) {
            cin >> a[i][j];
            if(a[i][j] == '#') {
                b[i] = true;
                c[j] = true;
            }
        }
    }

    for(int i = 0; i < H; i++) {
        if(!b[i]) continue;
        for(int j = 0; j < W; j++) {
            if(c[j]) {
                cout << a[i][j];
            }
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

int main(){ _;
  int a,b;cin>>a>>b;
  cout<<(a+b)%24<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
 
int main(){
  int h,w,n,i,k;
  std::cin >> h;
  std::cin >> w;
  std::cin >> n;
  if(h >= w){
  	i=h;
  }else{
  	i=w;
  }
  k = ceil((double)n/(double)i);
  std::cout << k << std::endl;
  
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
using ll = long long;

int main(){
    int n;
    cin >> n;
    vector<int> l;
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        l.push_back(a);
    }
    sort(l.begin(), l.end());
    int ans = 0;
    for(int i = 0; i < n -2 ; i++){
        for(int j = i + 1; j < n - 1; j++){
            bool isContinue = true;
            for(int k = j + 1; k < n; k++){
                if(l[i] < l[j] + l[k]){
                    if(l[j] < l[i] + l[k]){
                        if(l[k] < l[i] + l[j]){
                            ans++;
                        } else {
                            break;
                        }
                    } else {
                        isContinue = false;
                        break;
                    }
                } else {
                    continue;
                }
            }
            if(!isContinue){
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256