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

template <typename T> void chmin(T&x,const T &y)
{
	if(x>y)x=y;
}
template <typename T> void chmax(T &x,const T &y)
{
	if(x<y)x=y;
}
typedef long long s64;
typedef unsigned long long u64;
typedef unsigned int u32;
typedef pair<int,int> pii;
#define rep(i,l,r) for(int i=l;i<=r;++i)
#define per(i,r,l) for(int i=r;i>=l;--i)
#define rep0(i,l,r) for(int i=l;i<r;++i)
#define gc (c=getchar())
int read()
{
	char c;
	while(gc<'-');
	if(c=='-')
	{
		int x=gc-'0';
		while(gc>='0')x=x*10+c-'0';
		return -x;
	}
	int x=c-'0';
	while(gc>='0')x=x*10+c-'0';
	return x;
}
#undef gc

const int N=1e5+5;
vector<int>lk[N];
bool vis[N];

int dfs(int x,int fr)
{
	if(lk[x].size()>2)return x;
	vis[x]=1;
	return dfs(lk[x][lk[x][0]==fr],x);
}

int main()
{
#ifdef kcz
	freopen("1.in","r",stdin);//freopen("1.out","w",stdout);
#endif
	int n,m;
	cin>>n>>m;
	if(m<n+2){puts("No");exit(0);}
	rep(i,1,m)
	{
		int x=read(),y=read();
		lk[x].push_back(y);
		lk[y].push_back(x);
	}
	rep(i,1,n)
	if(lk[i].size()%2){puts("No");exit(0);}
	if(m>n+2){puts("Yes");exit(0);}
	rep(i,1,n)
	if(lk[i].size()>4){puts("Yes");exit(0);}
	int cnt=0;
	rep(i,1,n)
	if(lk[i].size()==4)
	{
		for(auto j:lk[i])
		{
			if(dfs(j,i)!=i)++cnt;
		}
		break;
	}
	if(cnt>=4)puts("No");
	else puts("Yes");	
}


Measured memory_bytes: 5760
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const long long INF = (long long)1e18+1;
#define DIV 1000000007
//#define TEST
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    long idx=0;
    long N, M;
    cin >> N >> M;
    priority_queue<ll> A;
    long num;
    for(size_t i=0;i<N; i++)
    {
        cin >> num;
        A.push(num);
    }

    ll sum=0;
    while(M > 0)
    {
        num = A.top()/2;
        A.pop();
        A.push(num);
        M--;
    }
    for(size_t i=0;i<N; i++)
    {
        sum+= A.top();
        A.pop();
    }
    cout << sum << endl;
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

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

int main(){
  int m,d;
  int ans=0;
  cin>>m>>d;
    for(int i=1;i<m+1;++i){
      for(int j=10;j<d+1;++j){
        int a=j%10;
        int b=j/10;
          if(a>=2 && b>=2 && a*b==i){
            ++ans;
          }
        }
      }
  cout<<ans<<endl;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
const int MOD = pow(10, 9) + 7;

int m[168] = {0};
int p[] = {2 ,3 ,5 ,7 ,11 ,13 ,17 ,19 ,23 ,29 ,31 ,37 ,41 ,43 ,47 ,53 ,59 ,61 ,67 ,71, 73 ,79 ,83 ,89 ,97 ,101 ,103 ,107 ,109 ,113 ,127 ,131 ,137 ,139 ,149 ,151 ,157 ,163 ,167 ,173, 179 ,181 ,191 ,193 ,197 ,199 ,211 ,223 ,227 ,229 ,233 ,239 ,241 ,251 ,257 ,263 ,269 ,271 ,277 ,281, 283 ,293 ,307 ,311 ,313 ,317 ,331 ,337 ,347 ,349 ,353 ,359 ,367 ,373 ,379 ,383 ,389 ,397 ,401 ,409, 419 ,421 ,431 ,433 ,439 ,443 ,449 ,457 ,461 ,463 ,467 ,479 ,487 ,491 ,499 ,503 ,509 ,521 ,523 ,541, 547 ,557 ,563 ,569 ,571 ,577 ,587 ,593 ,599 ,601 ,607 ,613 ,617 ,619 ,631 ,641 ,643 ,647 ,653 ,659, 661 ,673 ,677 ,683 ,691 ,701 ,709 ,719 ,727 ,733 ,739 ,743 ,751 ,757 ,761 ,769 ,773 ,787 ,797 ,809, 811 ,821 ,823 ,827 ,829 ,839 ,853 ,857 ,859 ,863 ,877 ,881 ,883 ,887 ,907 ,911 ,919 ,929 ,937 ,941, 947 ,953 ,967 ,971 ,977 ,983 ,991 ,997
};

int main()
{
    int N;
    scanf("%d", &N);
    for (int j = N; j >= 2; j--) {
        N = j;
        for (int i = 0; i < 168; i++) {
            while (N % p[i] == 0) {
                m[i]++;
                N /= p[i];
            }
        }
    }
    long long ans = 1;
    for (int i = 0; i < 168; i++) {
        ans *= m[i] + 1;
        ans %= MOD;
    }
    printf("%lld\n", ans);
}

Measured memory_bytes: 256
def resolve():
  n = int(input())
  a = list(map(int, input().split()))
  avr = sum(a) / n
  b = []
  m = 100000
  for x in a:
    b.append(abs(x - avr))
    m = min(m, abs(x - avr))
  for i in range(len(b)):
    if b[i] == m:
      print(i)
      return
  return

if __name__ == "__main__":
  resolve()


Measured memory_bytes: 9132
import java.util.*;
public class Main{
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                String s = sc.next();
                boolean ebishu = true;
                for(int i = 0 ; i < s.length() - 1 ; i++){
                        if(s.charAt(i) == 'A' && s.charAt(i + 1) == 'C') ebishu = false;
                }
                if(ebishu){
                        System.out.println("No");
                }else{
                        System.out.println("Yes");
                }
        }
}
//書くことないのでｺｹｺｹ言います
//ｺｯwwｺｯwwｺｹｯwwwｺｯwwｺｹｯwwwｺｹｯｺｯwwwｺｯwwｺｯwwｺｹｯwwwｺｯwwｺｹｯwwwｺｹｯｺｯwwwｺｹｰｰｰｰｯ!!!wwwwwｺｯwwｺｯwwｺｹｯwwwｺｯwwｺｹｯwwwｺｹｯｺｯwwwｺｯwwｺｯwwｺｹｯwwwｺｯwwwｺｹｯwwwｺｹｯｺｯwwwｺｹｰｰｰｰｯ!!!wwwwwｺｹｯｺｯｯｺｰｰｰｰ!!!!!!wwwwwwwwwww

Measured memory_bytes: 35412
# DP
mod = 1000000007
 
n, m = map(int, input().split())
b_list = [True] * (n+1)
dp = [0 for _ in range(n+1)]
for i in range(m):
    b_list[int(input())] = False
 
dp[0] = 1
for i in range(n):
    for j in range(i+1, min(n, i+2)+1):
        if b_list[j] == True:
            dp[j] += dp[i]
            dp[j] %= mod
# print(b_list)
# print(dp)
print(dp[n])

Measured memory_bytes: 7864
/* � Ashiq Uddin Pranto
   Department of Computer Science and Engineering
   BATCH 27
   University Of Rajshahi,Bangladesh
*/
#include<bits/stdc++.h>

#define ll long long
#define ld long double
#define FOR(x,y) for(ll i=x;i<=y;i++)
#define pb(x) push_back(x)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define matrix(x) vector<vector<x>>
#define vss vector<string>
#define PI (2*acos(0.0))
#define sqr(x) ((x)*(x))
#define sf(a)   scanf("%d",&a)
#define sfl(a)  scanf("%lld",&a)
#define sff(a,b)    scanf("%d %d",&a,&b)
#define sffl(a,b)   scanf("%lld %lld",&a,&b)
#define sfff(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define sfffl(a,b,c)    scanf("%lld %lld %lld",&a,&b,&c)
#define ms(a,b) memset(a, b, sizeof(a))
#define ff  first
#define ss  second
#define lcm(a, b)   ((a)*((b)/__gcd(a,b)))
#define all(a)  a.begin(),a.end()
#define readfile freopen("input.txt","r",stdin);
#define writefile freopen("output.txt","w",stdout);
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define gap " "
#define mx 104
#define inf (ll)1e9
#define WHITE 1
#define GRAY 2
#define BLACK 3
#define EMPTY_VALUE -1
#define mod 1000000007
#define MOD(a,b) (a%b + b)%b

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

ll calculate(ll n)
{
    ll cnt  = 0;
    for(ll i=1;i*i<=n;i++)
    {
        if(n%i==0)
        {
            if(i==n/i) cnt++;
            else cnt+=2;
        }
    }
    return cnt;
}
ll sum[1000005];
int main()
{
    //fastio
    ll n;
    sfl(n);
    for(ll i=2;i<=1000000;i++) sum[i]=2;
    sum[1]=1;
    for(ll i=2;i<=1000000/2;i++)
    {
        for(ll j=i+i;j<=1000000;j+=i) sum[j]++;
    }
    for(ll i=2;i<=1000000;i++) sum[i]+=sum[i-1];
    cout<<sum[n-1];
    return 0;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++) 
#define ll long long
#define ld long double
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)  
#define outdeb(fir, sec, thr) cout << fir << ":" << sec << ":" << thr << endl

int main()
{
  int k, n;
  vector<int> x;
  cin >> n >> k ;
  rep(i, n)
  {
    int tmp;
    cin >> tmp;
    x.push_back(tmp);
  }

  std::sort(x.begin(), x.end());
  int ans = 0;
  rep(i, k)
  {
    ans += x[i];
  }

  cout << fixed << ans << endl;

  return 0;
}

Measured memory_bytes: 3604
import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001



class Stack:
    def __init__(self,arg_size):
        self.size = arg_size
        self.stack = [None] * self.size
        self.head = 0
        self.tail = 0

    def is_empty(self):
        return self.tail == self.head

    def push(self,arg_object):
        self.stack[self.tail] = arg_object
        self.tail += 1

    def pop(self):
        self.tail -= 1
        return self.stack[self.tail]

    def top(self):
        return self.stack[self.head]


SIZE = 105
NUM = Stack(SIZE)

input_str = list(map(str,input().split()))

for i in range(len(input_str)):
    ch = input_str[i]
    if ch in ['+','-','*']:
        num_2 = NUM.pop()
        num_1 = NUM.pop()
        num = 0
        if ch == '+':
            num = num_1+num_2
        elif ch == '-':
            num = num_1-num_2
        else:
            num = num_1*num_2
        NUM.push(num)
    else:
        NUM.push(int(ch))

print("%d"%(NUM.top()))



Measured memory_bytes: 6372
#include <cassert>
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <utility>
#include <numeric>
#include <string>
#include <map>
#include <set>
#include <tuple>

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

  size_t N;
  std::cin >> N;
  assert(N <= 100);

  std::vector<double> A(N);
  for (auto& ai: A) std::cin >> ai;

  double res = 0;
  for (auto ai: A) res += 1.0 / ai;
  res = 1.0 / res;

  std::cout << std::fixed << std::setprecision(60000000) << res << std::endl;
}


Measured memory_bytes: 351888
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt();
		int n = sc.nextInt();
		List<Integer> list = new ArrayList<>();
		int ans = x;

		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}

		for (int dif = 0; dif <= n; dif++) {

			//x-difがリストに無いとき
			if (!list.contains(x - dif)) {
				ans = x - dif;
				break;
			}

			//x+difがリストに無いとき
			if (!list.contains(x + dif)) {
				ans = x + dif;
				break;
			}

		}

		System.out.println(ans);

	}

}


Measured memory_bytes: 35876
#include<stdio.h>
#include<algorithm>
#include<queue>
using namespace std;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int wall[60][60];
int bfs[60][60];
int main(){
	int a,b,c;scanf("%d%d%d",&a,&b,&c);
	for(int i=0;i<b;i++){
		wall[0][i]+=4;
		wall[a-1][i]+=1;
	}
	for(int i=0;i<a;i++){
		wall[i][0]+=8;
		wall[i][b-1]+=2;
	}
	for(int i=0;i<c;i++){
		int p,q,r,s;
		scanf("%d%d%d%d",&p,&q,&r,&s);
		if(p>r)swap(p,r);
		if(q>s)swap(q,s);
		if(p==r){
			for(int j=q;j<s;j++){
				wall[p-1][j]|=1;
				wall[p][j]|=4;
			}
		}else{
			for(int j=p;j<r;j++){
				wall[j][q-1]|=2;
				wall[j][q]|=8;
			}
		}
	}
	/*for(int i=0;i<a;i++){
		for(int j=0;j<b;j++)printf("%d ",wall[i][j]);
		printf("\n");
	}*/
	int sr,sc,tr,tc;
	scanf("%d%d%d%d",&sr,&sc,&tr,&tc);
	queue<pair<int,int> >Q;
	for(int i=0;i<a;i++)for(int j=0;j<b;j++)bfs[i][j]=-1;
	bfs[sr][sc]=0;
	Q.push(make_pair(sr,sc));
	while(Q.size()){
		int row=Q.front().first;
		int col=Q.front().second;
		Q.pop();
		for(int i=0;i<4;i++){
			if(wall[row][col]&(1<<i))continue;
			if(~bfs[row+dx[i]][col+dy[i]])continue;
			bfs[row+dx[i]][col+dy[i]]=bfs[row][col]+1;
			Q.push(make_pair(row+dx[i],col+dy[i]));
		}
	}
	int dis=bfs[tr][tc];
	if(dis<0){
		printf("0\n");
		return 0;
	}
	int ret=0;
	for(int i=0;i<a;i++)for(int j=0;j<b;j++)for(int k=0;k<4;k++){
		if(wall[i][j]&(1<<k))continue;
		wall[i][j]+=(1<<k);
		wall[i+dx[k]][j+dy[k]]+=(1<<(k^2));
		for(int l=0;l<a;l++)for(int m=0;m<b;m++)bfs[l][m]=-1;
		bfs[sr][sc]=0;
		Q.push(make_pair(sr,sc));
		while(Q.size()){
			int row=Q.front().first;
			int col=Q.front().second;
			Q.pop();
			for(int l=0;l<4;l++){
				if(wall[row][col]&(1<<l))continue;
				if(~bfs[row+dx[l]][col+dy[l]])continue;
				bfs[row+dx[l]][col+dy[l]]=bfs[row][col]+1;
				Q.push(make_pair(row+dx[l],col+dy[l]));
			}
		}
		if(~bfs[tr][tc]){
			ret=max(ret,bfs[tr][tc]-dis);
		//	printf("%d %d %d: %d\n",i,j,k,bfs[tr][tc]);
		}
		wall[i][j]-=(1<<k);
		wall[i+dx[k]][j+dy[k]]-=(1<<(k^2));
	}
	printf("%d\n",ret);
}

Measured memory_bytes: 1084
#include<iostream>
#include<vector>
#include<iterator>
#include<unordered_map>
using lli = long long int;
using loi = long int ;
using namespace std;

// Problem https://atcoder.jp/contests/abc073/tasks/abc073_c

loi solver(loi aicount,vector<lli> joiNumber){
    loi result ;
    result = 0;

    unordered_map<lli,loi> dict;
    for(loi j=0;j<aicount;j++){
        dict[joiNumber.at(j)]=dict[joiNumber.at(j)]+1;
    }
    for(auto itr=dict.begin();itr!=dict.end();itr++){
        loi saidNum;
        saidNum = (itr->second)%2;
        result = saidNum + result;
    }
    return result;
}

int main(void){
    loi answer;
    loi N;
    cin >> N ;
    vector<lli>  Ai(N,0);
    for(loi j=0;j<N;j++){
        cin >> Ai.at(j);
    }
    answer = solver(distance(Ai.begin(),Ai.end()),Ai);
    cout << answer << endl;
}

Measured memory_bytes: 5924
#include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MOD	1000000007
#define int	long long
#define pii pair<int,int> 
#define vi vector<int>
using namespace std;

int32_t main(){
	int a, b, h, s;
	cin >> a >> b >> h >> s;
	
	double pi = acos(-1.0);
	
	cout << fixed << setprecision(20);
	
	if(h == 6 && s == 0){
		cout << a + b;
	}
	else{
		double angle = abs((h + s / 60.0) * 360.0 / 12 - (s * 360.0 / 60));
		angle = min(angle,360.0-angle);
		cout << sqrt(1.0 * a * a + b * b - 2.0 * a * b * cos(angle*pi/180.0)) << endl;
	}

	return 0;
}



Measured memory_bytes: 4176
(let ((a (char= (read-char) #\H))
      (dummy (read-char))
      (b (char= (read-char) #\H)))
  (declare (ignore dummy))
  (format  t "~a~%"
           (if (or (and a b)
                   (and (not a) (not b)))
               #\H
               #\D)))


Measured memory_bytes: 10340
#include <iostream>
#include <math.h>
#include <string>

#define MIN(x, y) (x < y ? x : y)
#define MAX(x, y) (x > y ? x : y)

using namespace std;

int main(){
	string s;
	cin >> s;
	int idx = 0;
	cin >> idx;

	string k[6] = {"{", "{", "{", "{", "{", "{"};

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

		int j = MIN(5, s.length() - i);
		bool _flag = false;
		for(int id = 4; id >= 0; --id){
			string _s = string() + s[i];
			// cout << _s << " " << k[id] << endl;
			if(_s < k[id]){
				_flag = true;
			}
		}

		// cout << " : " <<  s.substr(i, j) << endl;
		for(; j > 0 && _flag; --j){
			// cout << " * " << s.substr(i, j) << endl;
			k[5] = s.substr(i, j);
			bool flag = true;

			for(int j = 0; j < 5; ++j){
				if(k[j] == k[5]){
					flag = false;
				}
			}
			if(flag){
				for(int j = 0; j < 6; ++j){
					for(int l = j + 1; l < 6; ++l){
						if(k[j] > k[l]){
							string hoge = k[j];
							k[j] = k[l];
							k[l] = hoge;
						}
					}
				}
			}
		}	
	}
	cout << k[idx - 1] << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
typedef long long ll;
using namespace std;

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


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#include<string>
#include <iomanip>
#include<deque>
#include<queue>
#include<stack>
#include<set>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e8;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

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; }

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n, m;
	cin >> n >> m;
	vector<string> a(n);
	vector<string> b(m);
	rep(i, n)
	{
		cin >> a[i];
	}
	rep(i, m)
	{
		cin >> b[i];
	}
	bool ans = false;
	
	for (int i = 0; i < n - m + 1; i++)
	{
		for (int j = 0; j < n - m + 1; j++)
		{
			if (a[i][j] == b[0][0])
			{
				for (int k = 0; k < m; k++)
				{
					for (int l = 0; l < m; l++)
					{
						if (a[i + k][j + l] == b[k][l])
						{
							ans = true;
							continue;
						}
						ans = false;
						break;
					}
					if (!ans)
					{
						break;
					}
				}
				if (ans)
				{
					cout << "Yes" << endl;
					ret;
				}
			}
		}
	}


	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#AC dattakedo segtree iranaikara keshita
def main():
    N, C = map(int, input().split())
    S = []
    for i in range(N):
        x, v = map(int, input().split())
        S.append((x,v))
    r = [S[0][1] - S[0][0]]
    rm = [S[0][1] - S[0][0]]
    for i, v in enumerate(S[1:], start=1):
        r.append(r[-1] + v[1] - (v[0] - S[i-1][0]))
        rm.append(max(rm[-1], r[-1]))
    l = [S[-1][1] + S[-1][0] - C]
    lm = [S[-1][1] + S[-1][0] - C]
    for i, v in enumerate(reversed(S[:-1]), start=1):
        l.append(l[-1] + v[1] - (S[N-i][0] - v[0]))
        lm.append(max(lm[-1], l[-1]))
    l.reverse()
    lm.reverse()
    def func(x,y):
        return max(x, y)
    m = 0
    for i in range(N):
        rr = r[i] - S[i][0] + lm[i+1] if i < N-1 else 0
        ll = l[i] + S[i][0] - C + rm[i-1] if i > 0 else 0
        m = max(m, r[i], rr, ll, l[i])
    return m
print(main())


Measured memory_bytes: 72280
N = int(input())
S ="MARCH"
S2 = [0]*len(S)
n=0

for i in range(N):
    s = input()
    for k, j in enumerate(S):
        if s[0] == j:
            S2[k]+=1
            
for i in range(len(S2)):
    for j in range(i+1,len(S2)):
        for k in range(j+1,len(S2)):
            n +=S2[i]*S2[j]*S2[k]
    
print(n)

Measured memory_bytes: 3060
package main
import "fmt"                                                                                                                                                                                                                                                         
import "math"                                                                                                                                                                                                                                                          



func main(){
                                                                                                                                                                                                                                                 
        var N int
        var cols []int                                                                                                                                                                                                                                             

        fmt.Scan( &N )
        for i := 0; i < N; i ++ {
                var v int
                fmt.Scan( &v )
                cols = append( cols, v )
        }
        memo := make( []int, len( cols ) )
        maxval := -1.0
        for i, _ := range cols{
                count := 0
                if i == 0 || memo[ i - 1] == 0 {
                        for j:= i + 1; j < len( cols ); j ++{
                                if cols[ j-1 ] >= cols[j] {
                                        count ++
                                }else{
                                        break
                                }
                        }
                        memo[ i ] = count
                }else{
                        memo[ i ] = memo[ i - 1 ] - 1
                }
                maxval = math.Max( float64( memo[ i ] ), maxval )
        }
        fmt.Println( maxval )
}

Measured memory_bytes: 7552
#include<iostream>
#include<string.h>
using namespace std;
int main() 
{
   char s[20], t[20];
   int i, flag;
   cin >> s >> t;
   if((strlen(t)-strlen(s))==1)
   {
   	for(i=0,flag=0;i<strlen(s);i++) 
   	if(s[i]!=t[i]) 
   	{
   		flag=1;
   		break;
   	} 
   	
   	if(flag==1)
   	cout << "No" << endl;
   	else
   	cout << "Yes" << endl;
  } 
  else
  cout << "No" << endl;
   return 0;
} 


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main()
{
	long int n,k;
	cin>>n>>k;
	long int a[n],i,x=0,b[n+1],d=0,s=0;
	fill_n(b,n+1,0);
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		b[a[i]]++;		
	}
	for(i=0;i<n+1;i++)
	{
		if(b[i]!=0)
		{
			x++;
		}
	}
	if(x<=k)
	{
		cout<<0<<endl;
		return 0;
	}
	x=x-k;
	sort(b,b+(n+1));
	for(i=0;i<n+1;i++)
	{
		if(b[i]>0)
		{
			d++;
			s=s+b[i];
		}
		if(d>=x)
		{
			break;
		}
	}
	cout<<s<<endl;
	
	
}

Measured memory_bytes: 6724
#include <stdio.h>
int main()
{
    int a, b, c, d;
    scanf("%d%d%d%d", &a, &b, &c, &d);
    if (( a + b ) > ( c + d ))
    {
        printf("Left\n");
    }
    else if (( a + b ) < ( c + d ))
    {
        printf("Right\n");
    }
    else
    {
        printf("Balanced\n");
    }

    return 0;
}


Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main(){
  int numEven,numOdd;
  int N,M;
  
  cin >> N >> M;
  
  if(N<=1)
    numEven = 0;
  else
    numEven = N*(N-1)/2;
  
    
  if(M<=1)
    numOdd = 0;
  else
    numOdd = M*(M-1)/2;
    
  cout << numEven + numOdd;
  
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int M_1, D_1, M_2, D_2;
    cin >> M_1 >> D_1 >> M_2 >> D_2;
    if(D_2 == 1) cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    k = int(input())
    S = list(range(50))
    k, r = divmod(k, 50)
    for i in range(50):
        S[i] += k

    target = 0
    while r:
        for i in range(50):
            if i == target:
                S[i] += 50
            else:
                S[i] -= 1
        target = (target + 1) % 50
        r -= 1
    print(50)
    print(*S)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 9216
// https://atcoder.jp/contests/abc015/tasks/abc015_4

#include <bits/stdc++.h>

using namespace std;

#define ll long long 
#define REPL(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define radrad(a)  180.0 * a / M_PI
#define pow(x) x*x
static const int MAX = 10010;
static const ll INFTY = 1e12;
static const ll NUMMAX = 1000000007;
static const ll MOD = 1000000007;
#define LOOP 10000000
// 四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

// 入力
int H, W;
vector<string> field;
int result = 100;
int dfs_res = 0;



int main() {


    int N;
    cin >> N;
    vector<int> h(N);
    vector<int> dp(N+1, MAX);
    REP(i, N){ cin >>h[i]; }
    int sum = 0;

    dp[0] = 0;
    for(int i = 1; i < N; i++){
        if(i == 1){
            dp[i] = abs(h[i] - h[i-1]);            
        }else {
            dp[i] = min( abs(h[i] - h[i-2]) + dp[i-2], abs(h[i] - h[i-1]) + dp[i-1] );
        }
    //    cout << h[i] << " " <<  h[i-1] << " ";
      //  cout << dp[i] << " ";
    }
    cout << dp[N-1] << endl;

    return 0;
}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/




Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        String s = scan.next();
        String t = scan.next();
        
        int i = 0;
        int matchCount = 0;
        while(i < N) {
            String sSub = s.substring(N - i - 1, N);
            String tSub = t.substring(0, i + 1);

            if(sSub.equals(tSub)) {
                matchCount = i + 1;
            }
            i++;
        }
        
        System.out.println(N * 2 - matchCount);
    }
}


Measured memory_bytes: 9796
# import sys
# input = sys.stdin.readline
# sys.setrecursionlimit(10 ** 9)
# MOD = 10 ** 9 + 7

N = int(input())

lst = [[] for _ in range(N)]
for i in range(N):
    A = int(input())
    for _ in range(A):
        tmp = tuple(map(int, input().split()))
        lst[i].append(tmp)

ans = 0
for i in range(2 ** N): #1の時正直者
    tmp = 0
    flag = True
    for j in range(N):
        if (i >> j) & 1:
            tmp += 1
            for x, y in lst[j]:
                if y == 0:
                    if (i >> (x - 1)) & 1:
                        pass
                    else:
                        continue
                if y == 1:
                    if (i >> (x - 1)) & 1:
                        continue
                
                flag = False
                break
        if not flag:
            break
    if flag:
        ans = max(ans, tmp)
                    
print (ans)


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

int main(){
  int N,sum=0;
  cin >> N;
  int A=N;
  for(int i=0;i<10;i++){
    sum+=A%10;
    A/=10;
  }
  if(N%sum==0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long INF=2E17;
typedef pair<int,int> Pair;
typedef long long int LL;

void binarySearch(const array<LL,100100> &L,LL x,int n,LL ret[]){
    int left = 0;
    int right = n-1;
    while(right-left !=1){
        int mid=(left+right)/2;
        if(x <L[mid]){
            right=mid;
        }else left =mid;
    }
    ret[0]=L[left];
    ret[1]=L[right];
}

int main(){
    int A,B,Q;
    array<LL,100100> s,t;
    cin >> A >> B >> Q;
    for(int i=0;i<A;i++){
        scanf("%lld",&s[i]);
    }
    s[A]=INF;
    s[A+1]=-INF;
    for(int i=0;i<B;i++){
        scanf("%lld",&t[i]);
    }
    t[B]=INF;
    t[B+1]=-INF;
    sort(s.begin(),s.begin()+A+2);
    sort(t.begin(),t.begin()+B+2);
    LL x;
    LL Jin[2];
    LL Tera[2];
    LL ans;
    for(int i=0;i<Q;i++){
        scanf("%lld",&x);
        binarySearch(s,x,A+2,Jin);
        binarySearch(t,x,B+2,Tera);
        ans=INF;
        for(int j=0;j<2;j++){
            for(int k=0;k<2;k++){
                ans=min(ans,abs(Jin[j]-x)+abs(Tera[k]-Jin[j]));
                ans=min(ans,abs(Tera[k]-x)+abs(Tera[k]-Jin[j]));
            }
        }
        cout << ans << endl;
    }
    return 0;
}

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

#define ll          long long
#define mp	    make_pair
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#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 hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;
#define N 	     10001
int A[N];
void solve(){
	int n;cin>>n;
	int nct = n;
	rep(i,0,n)cin>>A[i];
	rep(i,1,n)
		rep(j,0,i)
			if(A[j]>A[i]) {nct--;break;}
	cout<<nct<<endl;
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
     t =1;
//     cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


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

template<class T> inline void chmin(T& a, T b) {if (a > b) a = b;}
template<class T> inline void chmax(T& a, T b) {if (a < b) a = b;}

ll const mod = 1e9+7;



int main() {
  int n,m;
  cin >> n >> m;
  vector<vector<int>> g(n);
  int a,b;
  rep(i,m) {
    cin >> a >> b;
    a--;b--;
    g[a].push_back(b);
  }
  string ans = "IMPOSSIBLE";
  for (auto i:g[0]) {
    for (auto j:g[i]) {
      if (j==n-1) ans = "POSSIBLE";
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 8576
/*
 * atcoder/abc125_2nd/c.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

const int MAX = 100100;
int N;
vector<ll> A(MAX, 0);
ll acc_l[MAX], acc_r[MAX];


void solve() {
  cin >> N;
  loop(n,0,N) cin >> A[n];
  acc_l[0] = 0;
  loop(n,0,N) acc_l[n+1] = gcd(acc_l[n], A[n]);
  acc_r[N-1] = 0;
  for (int n=N-1; n>0; n--) acc_r[n-1] = gcd(acc_r[n], A[n]);
  ll max_ = 0;
  loop(n,0,N) {
    chmax(max_, gcd(acc_l[n], acc_r[n]));
  }
  cout << max_ << endl;
}
int main() {
  // cout.precision(15);
  // cout << fixed << double

  solve();

  return 0;
}


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

#define int long long
#define endl "\n"
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);


main(){
	FIO
	int t;
	t=1;
	while(t--){
		string s,tt;
		cin>>s>>tt;
		int i,j,k=INT_MAX;
		int n = s.length();
		for(i=0;i<n;i++){
			int l=0;
			if(i+tt.length()-1==n)
			break;
			for(j=0;j<tt.length();j++){
				if(s[i+j]!=tt[j]){
					l++;
				}
			}
			k = min(k,l);
		}
		cout<<k<<endl;
	}
}

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

using namespace std;

int main() {
	int n;
	cin >> n;
	for (int j = 0; j < n; j++) {
		int a;
		cin >> a;
		vector< vector<int> > uzu(a, vector<int>(a, 0));
		int ulimit, dlimit, rlimit, llimit;
		ulimit = 0;
		dlimit = a-1;
		rlimit = a-1;
		llimit = 2;
		int tate, yoko;
		tate = a-1;
		yoko = 0;
		if (a == 1) {
			uzu[0][0] = 1;
		}
		while (1) {
			if (yoko > rlimit || tate == ulimit) {
				break;
			}
			for (int i = tate; i >= ulimit; i--) {
				uzu[i][yoko] = 1;
			}
			tate = ulimit;
			ulimit += 2;
			if (tate > dlimit || yoko == rlimit) {
				break;
			}
			for (int i = yoko; i <= rlimit; i++) {
				uzu[tate][i] = 1;
			}
			yoko = rlimit;
			rlimit -= 2;
			if (yoko < llimit || tate == dlimit) {
				break;
			}
			for (int i = tate; i <= dlimit; i++) {
				uzu[i][yoko] = 1;
			}
			tate = dlimit;
			dlimit -= 2;
			if (tate < ulimit || yoko == llimit) {
				break;
			}
			for (int i = yoko; i >= llimit; i--) {
				uzu[tate][i] = 1;
			}
			yoko = llimit;
			llimit += 2;
		}
		if (j > 0) {
			cout << endl;
		}
		for (int i = 0; i < a; i++) {
			for (int k = 0; k < a; k++) {
				if (uzu[i][k] == 1) {
					cout << '#';
				} else {
					cout << ' ';
				}
			}
			cout << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1252
#include<stdio.h>
int main(){
  int n,m,s1,s2,a[101],b[101],i,j,t;
  while(scanf("%d %d",&n,&m),n||m){
    for(i=s1=0;i<n;i++){
      scanf("%d",&a[i]);
      s1+=a[i];
      for(j=i;j;j--){
	if(a[j-1]>a[j]){
	  t=a[j-1];
	  a[j-1]=a[j];
	  a[j]=t;
	}
      }
    } 
    for(i=s2=0;i<m;i++){
      scanf("%d",&b[i]);
      s2+=b[i];
      for(j=i;j;j--){
	if(b[j-1]>b[j]){
	  t=b[j-1];
	  b[j-1]=b[j];
	  b[j]=t;
	}
      }
    }
    s1-=s2;
    if(s1%2){
      printf("-1\n");
      continue;
    }
    s1/=2;
    for(i=0;i<n;i++)a[i]-=s1;
    for(i=j=0;i<n&&j<m;){
      if(a[i]==b[j])break;
      if(a[i]<b[j])i++;
      else         j++;
    }
    if((n-i)*(m-j))printf("%d %d\n",a[i]+s1,b[j]);
    else           printf("-1\n");
  }
  return 0;
}

Measured memory_bytes: 612
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
ans = 0
for i in range(N):
  if A[i] > B[i]:
    ans += B[i]
  elif A[i] <= B[i] < A[i]+A[i+1]:
    ans += B[i]
    A[i+1] -= B[i] - A[i]
  elif A[i] + A[i+1] <= B[i]:
    ans += A[i] + A[i+1]
    A[i+1] = 0

print(ans)

Measured memory_bytes: 18476
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <numeric>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
//#define int long long
#define all(vec) vec.begin(), vec.end()
#define dbg(x) cerr << #x << " = " << (x) << endl
#define yn(b) cout << ((b) ? "Yes" : "No") << endl
#define YN(b) cout << ((b) ? "YES" : "NO") << endl
#define isEven(t) t % 2 == 0

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

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

	int N,x=0,ans=0;
	string S;
	cin >> N >> S;

	for (int i = 0; i < N; i++) {
		if(S[i]=='I'){
			x++;
		}else{
			x--;
		}
		ans = max(ans, x);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl "\n"
#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvvi vector<vector<vector<int>>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S;
ll T;
ll ans = 0;

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

signed main() {
    cin >> N >> T;
    vi a(N), b(N);
    REP(i, N) {
        cin >> a[i] >> b[i];
    }
    vvi dp(T, vi(2, -1));
    dp[0][0] = 0;
    REP(n, N) {
        auto tmp = dp;
        REP(t, T) {
            if (tmp[t][0] != -1) {
                dp[t][1] = max(dp[t][1], tmp[t][0] + b[n]);
                if (t + a[n] < T) {
                    dp[t + a[n]][0] = max(dp[t + a[n]][0], tmp[t][0] + b[n]);
                }
            }
            if (tmp[t][1] != -1) {
                if (t + a[n] < T) {
                    dp[t + a[n]][1] = max(dp[t + a[n]][1], tmp[t][1] + b[n]);
                }
            }
        }
        dump(dp);
    }
    REP(t, T) {
        ans = max((int)ans, dp[t][1]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3960
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
#define Max(a) (*max_element(ALL(a)))
#define Min(a) (*min_element(ALL(a)))
using namespace std;
ll n;
vi A;
ll check(ll num){
  ll ret = 0;
  for(int i=0;i<n;i++){
    ret += abs(A[i]-(i+1+num));
  }
  return ret;
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n;
  A.resize(n);
  for(auto &a:A)cin>>a;
  ll le = -1e9,ri = 1e9;
  for(int i=0;i<500;i++){
    ll lmi = (le*2+ri)/3;
    ll rmi = (ri*2+le)/3;
    if(check(lmi) > check(rmi)){
      le = lmi;
    }else{
      ri = rmi;
    }
  }
  ll ans = llINF;
  for(ll i=le;i<=ri;i++){
    ans = min(ans,check(i));
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1792
/*   ꧁༒☬महाकाल☬༒꧂ ꧁༒ঔमहाकालঔ༒꧂
                   
                   ঔৣ۝महाकालᴳᵒᵈ۝ঔৣ            
 
 */ 
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//template <typename T, typename cmp=less<T>> using oset =tree<T, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define ll long long 
#define mod 1000000007
#define inf 100000000000000000
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define _it iterator
#define all(_x) _x.begin(),_x.end()
#define f first
#define s second
#define pb push_back
void mahakal(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}
int main(){
//	mahakal(),
  fast;
	ll n , m ;
	cin>> n >> m ;
	vector<ll> vec(n);
	ll ans = 0 ;
	priority_queue<ll> q;
	for(ll i=0;i<n ;i++){
		ll a ;cin>>a;
		q.push(a);
	}
	for(ll i=0;i<m ; i++){
		ll a=q.top();
		q.pop();
		a=a/2;
		q.push(a);
	}
	while(!q.empty()){
		ans+=q.top();
		q.pop();
	}
	cout<<ans<<endl;


	return 0;
}

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

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        string s = sc.Next();

        int answer = 0;
        for (int i = 0; i < 4; i++)
        {
            if (s[i] == '+')
            {
                answer++;
            }
            else
            {
                answer--;
            }
        }

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 11092
import java.text.ParseException;
import java.util.Scanner;

class Main {
	static int n;
	static int a;
	static int b;
	static int c;
	static int[] bamboo;

	public static void main(String[] args) throws ParseException {
		Scanner sc = new Scanner(System.in);

		n = sc.nextInt();
		a = sc.nextInt();
		b = sc.nextInt();
		c = sc.nextInt();

		bamboo = new int[n];

		for (int i = 0; i < n; i++) {
			bamboo[i] = sc.nextInt();
		}

		int cur = 0, ba = 0, bb = 0, bc = 0;

		int mp = dfs(cur, ba, bb, bc);

		System.out.println(mp);

		sc.close();
	}

	private static int dfs(int cur, int ba, int bb, int bc) {
		// TODO 自動生成されたメソッド・スタブ
		if (cur == n) {
			if (Math.min(ba, Math.min(bb, bc)) > 0) {
				return Math.abs(ba - a) + Math.abs(bb - b) + Math.abs(bc - c) - 30;
			} else {
				return 1000000000;
			}
		}

		int ret0 = dfs(cur + 1, ba, bb, bc);
		int ret1 = dfs(cur + 1, ba + bamboo[cur], bb, bc) + 10;
		int ret2 = dfs(cur + 1, ba, bb + bamboo[cur], bc) + 10;
		int ret3 = dfs(cur + 1, ba, bb, bc + bamboo[cur]) + 10;

		return Math.min(ret0, Math.min(ret1, Math.min(ret2, ret3)));
	}

}


Measured memory_bytes: 24276
import math
import itertools

k = int(input())
l = list(range(1,k+1))
y = list(itertools.combinations_with_replacement(l,3))
n = len(y)
t = 0

for i in range(n):
    a = y[i][0]
    b = y[i][1]
    c = y[i][2]
    d = math.gcd(math.gcd(a,b),c)
    if a != b != c:
        t += d * 6
    elif a == b == c:
        t += d
    else:
        t += d * 3

print(t)

Measured memory_bytes: 105512
using System;

namespace ChokudaiScanner
{
    class MainClass
    {
        static void Main()
        {
            Scanner cin = new Scanner();
            double b, c = cin.NextDouble();
            b = Math.Ceiling(c / 1.08);

            if (Math.Floor(b * 1.08) == c)
            {
                Console.WriteLine(b);
            }
            else
            {
                Console.WriteLine(":(");
            }

            }
        }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string Next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return Next();
            i = 0;
            return s[i++];
        }

        public int NextInt()
        {
            return int.Parse(Next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextInt() + add;
            }
            return Array;
        }

        public long NextLong()
        {
            return long.Parse(Next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextLong() + add;
            }
            return Array;
        }

        public double NextDouble()
        {
            return double.Parse(Next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextDouble() + add;
            }
            return Array;
        }
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <fstream>
using namespace std;

//#define FILE_INPUT
//#define DEBUG_MODE

void DebugPrint(int a[], int n)
{
#ifdef DEBUG_MODE
	for (int i = 0; i < min(20, n); ++i) {
		cout << a[i] << ",";
	}
	cout << endl;
#endif
}

int Search(int node, vector<vector<int>> &next, vector<int> &dp)
{
	if (dp[node] >= 0) {
		return dp[node];
	}

	if (next[node].size() == 0) {
		return 0;
	}
	int max_path = 0;
	for (int i = 0; i < (int)next[node].size(); ++i) {
		int path = 1 + Search(next[node][i], next, dp);
		if (max_path < path) {
			max_path = path;
		}
	}
	//cout << node << " " << max_path << endl;

	dp[node] = max_path;
	return max_path;
}

int main()
{
#ifdef FILE_INPUT
	ifstream in("test3.txt");
	cin.rdbuf(in.rdbuf());
#endif	/* FILE_INPUT */  

	int n, m;
	cin >> n >> m;
	vector<vector<int>> next(n + 1);
	vector<int> dp(n + 1, -1);

	for (int i = 1; i <= n; ++i) {
		next[0].push_back(i);
	}
	for (int i = 0; i < m; ++i) {
		int from;
		int to;
		cin >> from >> to;
		next[from].push_back(to);
	}

	int max_path = Search(0, next, dp) - 1;

	cout << max_path << endl;

	return 0;
}


Measured memory_bytes: 9208
#include<iostream>
using namespace std;
int main()
{
	int a[7],b[7];
	for(int i=0;i<7;i++)
		cin >> a[i] >> b[i];
	for(int i=0;i<7;i++)
		cout << a[i] - b[i] << endl;
	return 0;
}

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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pl;

const int INT_INF = 2147483646;
const ll LL_INF = 9223372036854775807;

bool SecondCompare(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second>b.second;
}

ll minll(ll a, ll b){
    if(a >= b)  return b;
    else    return a;
}

ll maxll(ll a, ll b){
    if(a >= b)  return a;
    else    return b;
}

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

const ll SIZE = 1e5+10;

string s;

int main(){
    cin >> s;
    if(s[2] == s[3] && s[4] == s[5])    cout << "Yes\n";
    else{
        cout << "No\n";
    }
}

Measured memory_bytes: 256
N = int(input())
M = N//2
x = list(map(int, input().split()))
y = sorted(x)

thre = y[M]

ans_b = y[M]
ans_s = y[M-1]

for x_ in x:
    if x_ >= thre:
        print(ans_s)
    else:
        print(ans_b)

Measured memory_bytes: 26772
#include<stdio.h>

int main(void)
{
	int m, n;	
	int i, j;
	int sum;
	int A[100][100], b[100];

	scanf("%d %d", &n, &m);

	for( i = 0; i < n; i++)
	{
		for( j = 0; j < m; j++)
			scanf("%d", &A[i][j]);
	}

	for( i = 0; i < m; i++)
		scanf("%d", &b[i]);

	for( i = 0; i < n; i++)
	{
		sum = 0;
		for( j = 0; j < m; j++)
			sum += A[i][j] * b[j];
		printf("%d\n", sum);
	}

	return 0;

}


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

int main() {
    ll n; cin >> n;
    ll res;
    if (n % 2 == 0) {
        ll t = (n - 1) / 2;
        res = n * t + (n / 2);
    } else {
        res = n * (n - 1) / 2;
    }
    cout << res << endl;
    // int res;
    // if (n % 2 == 0) {
    //     res = n * (n - 1) / 2 + n / 2;
    // } else {
    //     res = n * (n - 1) / 2;
    // }

    // cout << res << endl;
}

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

int main() {
  char string[100];
  int hugs = 0;
  scanf("%s", string);

  int l = 0;
  int h = strlen(string) - 1;
  int middle;

  if(strlen(string) % 2 == 0)
    middle = strlen(string) / 2;
  else
    middle = strlen(string) / 2 + 1;

  while(h >= middle) {
    if(string[l++] != string[h--])
      hugs++;
  }

  printf("%d\n", hugs);

  return 0;
}


Measured memory_bytes: 128