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

#define ll long long 
#define pb push_back
#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define memf(a) memset(a,false,sizeof(a))
#define all(v) v.begin(),v.end()
#define sz(a) (ll)a.size()
#define F first
#define S second
#define INF 2000000000000000000
#define endl "\n"
#define _time_ 1.0 * clock() / CLOCKS_PER_SEC
#define popcount(x) __builtin_popcountll(x)
#define pll pair<ll,ll> 
#define ld long double

const int M=1000000007;
const int MM=998244353;
const long double PI = acos(-1);

ll power(ll b,ll e,ll m)
{
    if(e==0) return 1;
    if(e&1) return b*power(b*b%m,e/2,m)%m;
    return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
    if(e==0) return 1;
    if(e&1) return b*power(b*b,e/2);
    return power(b*b,e/2);
}
template<typename T, typename U> static inline void amin(T &x, U y){ if(y<x) x=y; }
template<typename T, typename U> static inline void amax(T &x, U y){ if(x<y) x=y; }
template<typename T, typename U> ostream& operator<<(ostream &os, const pair<T, U> &p)
{ 
    return os<<'('<<p.F<< ","<<p.S<<')'; 
}

int _runtimeTerror_()
{
    ll ans=0;
    int n;
    cin>>n;
    vector<ll> v(n);
    for(int i=0;i<n;++i)
        cin>>v[i];
    sort(all(v));
    for(int i=0;i<n;++i)
    {
        for(int j=i+1;j<n;++j)
        {
            for(int k=j+1;k<n;++k)
            {
                if(v[i]==v[j] || v[j]==v[k] || v[i]==v[k])
                    continue;
                if(v[i]+v[j]>v[k])
                    ++ans;
            }
        }
    }
    cout<<ans<<"\n";
    return 0;
}

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    #ifdef runSieve
        sieve();
    #endif
    #ifdef NCR
        initialize();
    #endif
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--)
        _runtimeTerror_();
    return 0;
}

Measured memory_bytes: 3644
#include <iostream>
using namespace std;
namespace Fastio {
void fastio() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
}
} // namespace Fastio
namespace output {
int func(int n) {
  while (n) {
    if (n % 10 == 7)
      return 1;
    n /= 10;
  }
  return 0;
}
} // namespace output
using namespace Fastio;
using namespace output;
int main() {
  int n;
  cin >> n;
  if (output::func(n))
    cout << "Yes\n";
  else
    cout << "No\n";
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <functional>
using namespace std;


int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
    int n, t[110], m, p[110], x[110];
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> t[i];
    }
    cin >> m;
    for (int i = 0; i < m; i++) {
        cin >> p[i] >> x[i];
    }
    for (int i = 0; i < m; i++) {
        int sum = 0;
        for (int j = 0; j < n; j++) {
            if (j == p[i] - 1) {
                sum += x[i];
            }
            else
                sum += t[j];
        }
        cout << sum << endl;
    }

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;


int main(){
    int n;
    char s[10010];
    cin>>n>>s;
    int len=strlen(s);
    rep(i,len){
        int x=s[i]-'A';
        x=(x+n)%26;
        putchar('A'+x);
    }
    cout<<endl;
}

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

vector<bool> sieve() {
    vector<bool> res(100001, true);
    res[0] = false, res[1] = false;
    for (int i = 2; i * i <= 100000; i++) {
        for (int j = 2 * i; j <= 100000; j += i) {
            res[j] = false;
        }
    }
    return res;
}

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

    vector<bool> isPrime = sieve();
    vector<int> cnt(100001);
    for (int i = 3; i <= 100000; i += 2) {
        if (isPrime[i] && isPrime[(i + 1) / 2]) {
            cnt[i]++;
        }
    }
    for (int i = 1; i <= 100000; i++) {
        cnt[i] += cnt[i - 1];
    }

    for (int i = 0; i < Q; i++) {
        int l, r;
        cin >> l >> r;
        cout << cnt[r] - cnt[l - 1] << endl;
    }
    return 0;
}

Measured memory_bytes: 1024
N,M = map(int,input().split())
A = list(map(int,input().split()))
num = {1:2,2:5,3:5,4:4,5:5,6:6,7:3,8:7,9:6}

def lenmax(a,b):
    if len(a) > len(b):
        return a
    elif len(a) < len(b):
        return b
    return max(a,b)

dp = ['-' for i in range(10**4+10)]
dp[0] = ''
for i in range(N+1):
    if dp[i] == '-':
        continue
    for a in A:
        dp[i+num[a]] = lenmax(dp[i+num[a]],dp[i]+str(a))
print(dp[N])

Measured memory_bytes: 30196
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <algorithm>

using ll = long long int;
using P = std::pair<int, int>;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int x[334334],y[334334],c[334334],d[334334];
P a[334334],b[334334];
std::set<P> st;

int main(void){
	int h,w,m,n,i,j,ans;
	bool flag = false;
	std::cin >> h >> w >> m;
	for(i=0; i<h; ++i){
		a[i].second = i;
	}
	for(i=0; i<w; ++i){
		b[i].second = i;
	}
	for(i=0; i<m; ++i){
		std::cin >> x[i] >> y[i];
		--x[i]; --y[i];
		++a[x[i]].first; ++b[y[i]].first;
		st.insert(P(x[i],y[i]));
	}
	std::sort(a,a+h,std::greater<P>());
	std::sort(b,b+w,std::greater<P>());
	ans = a[0].first + b[0].first - 1;
	for(i=0; i<h; ++i){
		if(a[0].first > a[i].first){
			break;
		}
		for(j=0; j<w; ++j){
			if(b[0].first > b[j].first){
				break;
			}
			if(!st.count(P(a[i].second,b[j].second))){
				++ans;
				flag = true;
				break;
			}
		}
		if(flag){
			break;
		}
	}
	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 24720
#include <bits/stdc++.h>
using namespace std;
int main() {
for (int i = 0; i < 3000; i++){
int x, y; 
cin >> x >> y; 
if(x == 0 && y == 0) break; 
else{
if(x > y) swap(x, y); 
cout << x << " " << y << endl; 
}
}
}


Measured memory_bytes: 3012
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pl;
typedef vector<ll> vl;
const int MN = 100012;
ll x,y,red,green,white;
ll a[MN],b[MN],c[MN];
int main (void) {
  ios::sync_with_stdio(false);cin.tie(0);
  cin >> x >> y >> red >> green >> white;
  for (int i = 0; i < red; i++) cin >> a[i];
  for (int i = 0; i < green; i++) cin >> b[i];
  for (int i = 0; i < white; i++) cin >> c[i];
  sort(a, a+red, greater<ll>());
  sort(b, b+green, greater<ll>());
  sort(c, c+white, greater<ll>());

  int l = x-1, r = y-1;
  for (int i = 0; i < white; i++) {
    if (c[i] <= a[l] and c[i] <= b[r]) break;
    if (c[i] <= a[l]) {
      swap(b[r], c[i]);
      if (r > 0) r--;
    } else if (c[i] <= b[r]) {
      swap(a[l], c[i]);
      if (l > 0) l--;
    } else {
      if (a[l] < b[r]) {
        swap(a[l], c[i]);
        if (l > 0) l--;
      } else {
        swap(b[r], c[i]);
        if (r > 0) r--;
      }
    }
  }
  ll ans = 0;
  for (int i = 0; i < x; i++) ans += a[i];
  for (int i = 0; i < y; i++) ans += b[i];
  cout << ans << '\n';

  return 0;
}



Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int ll
#define pb push_back
#define setbits(x)          __builtin_popcountll(x)
#define endl "\n"
typedef long long ll;
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++)
    cin>>arr[i];
  ///  a+b>c    , c+b>a
  int ans=0;
  sort(arr,arr+n);
for(int i=0;i<n;i++)
{
    for(int j=i+1;j<n;j++)
    {
        int pos=lower_bound(arr,arr+n,arr[i]+arr[j])-arr;
        pos-=1;

        ans+=max(pos-j,0*1ll);
    }
}
cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using ll=long long;
using namespace std;
int main(){
  ll a,b;
  cin>>a>>b;
  for(int i=1;i<1100;i++){
    ll A=floor(i*0.08);
    ll B=floor(i*0.1);
    if(A==a&&B==b){
      cout<<i<<endl;
      return 0;
    }
  }
  cout<<-1<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	// 借金額：10万円
	public static int LOAN = 100000;

	public static void main(String[] args) {

		// インプット
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);
		int input = sc.nextInt();
		double result = LOAN;

		// 一週間ずつ計算
		for (int i = 0; input > i; i++) {

			// 利子を加える
			result = result * 1.05;

			// 1000で割り、千円以下を切り上げ
			result = Math.ceil(result / 1000);
			// 金額を元に戻す
			result = result * 1000;
		}
		System.out.println((int) result);
	}
}

Measured memory_bytes: 17168
#include <stdio.h>          // printf(), scanf()
#include <stdlib.h>         // qsort()
#include <stdbool.h>

#define MAX_N 200
#define max(a, b) ((a) > (b) ? (a) : (b))

typedef struct doll_tbl
{
	int h;
	int r;
} doll_t;

int
cmp_func(const void *l_, const void *r_)
{
	const doll_t *l = (const doll_t*) l_;
	const doll_t *r = (const doll_t*) r_;

	if (l->h < r->h)
		return -1;

	if (l->h > r->h)
		return 1;

	return 0;
}

int
solve(doll_t doll[MAX_N], int N)
{
	int dp[MAX_N];

	qsort(doll, N, sizeof(doll_t), cmp_func);

	int count = 0;
	for (int i = 0; i < N; ++i)
	{
		dp[i] = 1;
		for (int j = 0; j < i; ++j)
		{
			if (doll[j].h < doll[i].h && doll[j].r < doll[i].r)
				dp[i] = max(dp[i], dp[j] + 1);
		}

		count = max(count, dp[i]);
	}

	return count;
}

int
main(int argc, char **argv)
{
	doll_t doll[MAX_N];

	while (true)
	{
		int n, m;
		scanf("%d", &n);
		if (n == 0)
			break;

		for (int i = 0; i < n; ++i)
			scanf("%d%d", &doll[i].h, &doll[i].r);

		scanf("%d", &m);
		for (int i = 0; i < m; ++i)
			scanf("%d%d", &doll[n + i].h, &doll[n + i].r);

		printf("%d\n", solve(doll, n + m));
	}

	return 0;
}


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


int main() {
  int h, w, k;
  cin >> h >> w >> k;
  vector<string> c(h);
  rep(i,h) cin >> c[i];
  int ans = 0;
  for(int bit = 0; bit < (1<<h); bit++) {
    for(int j = 0; j < (1<<w); j++) {
      int num = 0;
      rep(i,h) {
        rep(m,w) {
          if(!(bit & 1<<i)&&!(j & 1<<m)&&c[i][m]=='#') num++;
        }
      }
      if(num == k) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#include<unordered_set>
#define rep(i,a,b) for(ll i = a; i<b; i+= 1)
#define dep(i,a,b) for(int i = a; i>b; i--)
#define makeUnique(vec) sort(all(vec)); vec.resize(unique(all(vec)) - vec.begin())
#define LOG_vec(vec, sep) for (int fl = 0; fl < vec.size(); fl++) { std::cout << vec[fl]<< (fl == vec.size()-1?"\n":sep;)}
#define LOG_ints(vec, sep) for (int fl = 0; fl < MAXSIZE; fl++) { std::cout << vec[fl]<< sep; } std::cout << "\n"
#define all(x) (x).begin(), (x).end()
#define LSB(i) ((i) & -(i))
#define MAXSIZE 100000

using namespace std;
typedef long long ll;
typedef vector<int> vi;

void solve() {
	int m, n;
	cin >> n >> m;
	vector<double> v;
	double tot = 0;
	rep(i, 0, n) {
		double tmp; cin >> tmp;
		v.push_back(tmp);
		tot += tmp;
	}
	sort(all(v));
	reverse(all(v));
	rep(i, 0, m) {
		if (v[i] < tot / (4 * m)) {
			cout << "No\n";
			return;
		}
	}
	cout << "Yes\n";
}
int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	int t = 1;
	while (t--) {
		solve();
	}
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max<R>(x,0.0));}

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

// Problem Specific Parameter:

int main(void){
	int n;
	cin >> n;
	string s,t;
	cin >> s >> t;

	int ans=2*n;
	rep(i,1,n+1) if(s.substr(n-i,i)==t.substr(0,i)) chmin(ans,2*n-i);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
'use strict'
function _(s){let l=s.split('\n');if(l[l.length-1]=='')l.pop();this.l=l;this.y=0}
_.prototype.ints = function(){return this.l[this.y++].split(' ').map(v=>+v)}
_.prototype.intv = function(){const y=this.y;this.y=this.l.length;return this.l.slice(y).map(v=>+v)}
_.prototype.strv = function(){const y=this.y;this.y=this.l.length;return this.l.slice(y)}
_.prototype.strn = function(n){const y=this.y;this.y+=n;return this.l.slice(y,y+n)}
const $ = new _(require("fs").readFileSync("/dev/stdin", "utf8"));
(()=>{

const n = $.ints()[0]
const a = $.ints()
let s = 0
for(let e of a){
    s += e
}
let avg = s / n
let neighbor = a[0]
let needle = 0
for(let i = 1;i<n;i++){
    if(Math.abs(a[i]-avg) < Math.abs(neighbor-avg)){
        neighbor = a[i]
        needle = i
    }
}
console.log(needle)
})()

Measured memory_bytes: 7500
# joisinoお姉ちゃんは、A op B という式の値を計算したいと思っています。
# ここで、A,B は整数で、op は、+ または - の記号です。
# あなたの仕事は、joisinoお姉ちゃんの代わりにこれを求めるプログラムを作ることです。

input = gets.chomp.split
a = input[0].to_i
op = input[1]
b = input[2].to_i

case op
when "+"
    puts a + b
when "-"
    puts a - b
end

Measured memory_bytes: 1788
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int sum = 0;

        if(n > 1){
            sum += n * (n - 1) / 2;
        }
        if(m > 1){
            sum += m * (m -1) / 2;
        }
        System.out.println(sum);
    }
}

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

int main(){
  int A,B;
  cin >> A >> B;

  for(int i=1;i<10000;i++){
    if(i*8/100==A && i/10==B){
      cout << i << endl;
      return 0;
    }
  }
  
  cout << -1 << endl;
  return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define fe first
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define esb(x,e,b) (int e=fst[x],b=vb[e];e;e=nxt[e],b=vb[e])
#define SZ 666666
int n,t,d[SZ],a[SZ],b[SZ];
int main()
{
	scanf("%d%d",&n,&t);
	for(int i=1;i<=n;++i) scanf("%d",d+i);
	a[0]=t;
	for(int i=1;i<=n;++i)
		a[i]=min(a[i-1],abs(a[i-1]-d[i]));
	b[n+1]=1;
	for(int i=n;i>=1;--i)
		if(b[i+1]+b[i+1]<=d[i]) b[i]=b[i+1];
		else b[i]=b[i+1]+d[i];
	int m,q; scanf("%d",&m);
	while(m--)
	{
		scanf("%d",&q);
		if(a[q-1]>=b[q+1]) puts("YES");
		else puts("NO");
	}
}


Measured memory_bytes: 9088
open Printf
open Scanf

let read_int _ = scanf " %d " (fun x -> x)

let () =
  let n = read_int () in
  let sp = Array.init n (fun i -> scanf " %s %d " (fun x y -> x,y,(i+1))) in
  Array.fast_sort (fun (s1,p1,_) (s2,p2,_) -> if s1 <> s2 then compare s1 s2 else compare p2 p1) sp;
  Array.iter (fun (_,_,i) -> printf "%d\n" i) sp


Measured memory_bytes: 2560
import copy

n = int(input())
game = n * (n-1) // 2

point = [0] * n
for _ in range(game):
    a, b, c, d = map(int, input().split())
    if c > d:
        point[a-1] += 3
    elif c < d:
        point[b-1] += 3
    else:
        point[a-1] += 1
        point[b-1] += 1

point_tmp = copy.deepcopy(point)
point_tmp.sort(reverse=True)

grade = [0] * n
for i, p in enumerate(point):
    grade[i] = point_tmp.index(p) + 1

for g in grade:
    print(g)


Measured memory_bytes: 6336
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    int n,m; cin>>n>>m;
    const int M = 114514;
    vector<vector<int>> g(M*3);

    rep(i,m) {
        int a,b; cin>>a>>b;
        --a,--b;
        g[a].push_back(b+M);
        g[a+M].push_back(b+M+M);
        g[a+M+M].push_back(b);
    }

    int s,t; cin>>s>>t;
    --s,--t;
    vector<int> dp(M*3, INF);
    queue<int> q;
    q.push(s+M+M);
    dp[s+M+M] = 0;
    
    while (q.size()) {
        int v = q.front(); q.pop();
        for (auto &&e: g[v]) {
            if (dp[e] > dp[v]+1) {
                dp[e] = dp[v]+1;
                q.push(e);
            }
        }
    }

    if (dp[t+M+M]==INF || dp[t+M+M]%3 != 0) cout << -1 << '\n';
    else cout << dp[t+M+M]/3 << '\n'; 

    return 0;
}

Measured memory_bytes: 19072
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<iterator>
#include<complex>
#include<stack>
#include "stdio.h"
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const long long mod_const = 1e9+7;
using MIte = multimap<long, long, greater<long> >::iterator;

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

	// long long?
	long long N, i;
	cin >> N >> i;

	cout << N - i + 1 << endl;
	
	return 0;

}

Measured memory_bytes: 256
function main()
  
  s = split(chomp(readline()),"")

  pop!(s)

  count = 0
  
  while true
        
    if length(s) % 2 == 0

      for i in 1:div(length(s),2)

        if s[i] == s[i+div(length(s),2)]
          count += 1
        else
          check = false
        end
        
      end
      
    end

    if count == div(length(s),2)
      break
    elseif length(s) == 0
      break
    end
      
    pop!(s)
    count = 0
  end
  
  println(length(s))
    
end

main()

Measured memory_bytes: 110480
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double EPS = 1e-9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int main() {
	char t;
	int a, b; cin >> a >> t >> b;
	if (t == '+')cout << a + b << endl;
	else cout << a - b << endl;
	return 0;
}

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

int main() {
    int a,b;
    cin >> a >> b;

    if(a < b){
        swap(a,b);
    }

    if(a - b >0){
        cout << a * 2 -1 <<endl;
    } else {
        cout << a * 2 << endl;
    }
}

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

int main() {
  vector<int> v(5);
  rep(i,5) {
    cin >> v[i];
  }
  rep(i,5) {
    if(v[i] == 0) {
      cout << i + 1 << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3576
#include <cstdio>
using namespace std; 
int main() {
  long long int x; 
  scanf("%lld", &x); 
  long long int l = 100; 
  short i = 0;  
  while (l < x) {
   l += l/100; 
    i ++; 
  }
  printf("%hd", i); 
  return 0; 
}

Measured memory_bytes: 1736
# coding: utf-8
# Your code here!
n=int(input())
A=[]
B=list(map(int,input().split()))
B.append(10**6)
A.append(B[0])

for i in range(1,n):
    A.append(min(B[i-1],B[i]))
    
print(sum(A))


Measured memory_bytes: 3060
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;

namespace AtCoderWorkspace
{
    public class Solver
    {
        public void Solve()
        {
            var cin = new Scanner();
            var c1 = cin.next();
            var c2 = cin.next();

            Console.WriteLine((c1[0]==c2[2] && c1[1]==c2[1] && c1[2]==c2[0])?"YES":"NO");
        }
    }

    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 string[] ArrayString(int N)
        {
            string[] Array = new string[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = next();
            }
            return Array;
        }

        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 int[] DPArrayInt(int N, int ex)
        {
            int[] Array = new int[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt();
            }
            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 long[] DPArrayLong(int N, int ex)
        {
            long[] Array = new long[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong();
            }
            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;
        }
    }

    class Program
    {
        static void Main(string[] s) => new Solver().Solve();
    }
}


Measured memory_bytes: 13140
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

int N,K;
vector<Int> V;

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

    for(int i = 0;i < N;i++) {
        Int s;
        cin>>s;

        V.push_back(s);
    }

    Int ans = 0;

    for(int k = 0;k <= min(N,K);k++) {
        for(int l = 0;l <= k;l++) {
            Int sum = 0;
            int left = l;
            int right = k-l;
            vector<Int> neg;
            while(left > 0) {
                sum += V[left-1];
                if(V[left-1] < 0)
                    neg.push_back(V[left-1]);
                left--;
            }
            while(right > 0) {
                sum += V[N-right];
                if(V[N-right] < 0)
                    neg.push_back(V[N-right]);
                right--;
            }
            sort(neg.begin(),neg.end());
            int s = 0;
            for(int i = K-k;i > 0;i--) {
                if(neg.size() > s) {
                    if(neg[s] < 0) {
                        sum -= neg[s];
                    } else {
                        break;
                    }
                    s++;
                }
            }
            ans = max(ans,sum);
        }
    }

    cout<<ans<<endl;

    return 0;
}
    





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


#for i in range(N):
#    if a[i]==1:
#        mi=i
#r=N-mi
#l=mi+1
#if K==N:
#    ans=1
#else:
ans=-(-(N-1)//(K-1))
print(ans)

Measured memory_bytes: 14008
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define intput(i) cout << i << endl
#define ll long long
#define stringput(s) cout << (string)(s) << endl

int main(){
  ll X, Y, A, B, C;
  cin >> X >> Y >> A >> B >> C;
  vector<ll> p(A);
  vector<ll> q(B);
  vector<ll> r(C);
  rep(i, A) cin >> p[i];
  rep(i, B) cin >> q[i];
  rep(i, C) cin >> r[i];

  sort(p.begin(),p.end());
  reverse(p.begin(),p.end());
  sort(q.begin(),q.end());
  reverse(q.begin(),q.end());
  vector<ll> D(A+B+C);

  rep(i, X){
    D[i] = p[i];
  }
  rep(i, Y){
    D[i+X] = q[i];
  }
  rep(i, C){
    D[i+X+Y] = r[i];
  }
  sort(D.begin(),D.end());
  reverse(D.begin(),D.end());
  ll ans = 0;
  rep(i, X+Y){
    ans += D[i];
  }
  cout << ans << endl;
  }


Measured memory_bytes: 4992
#include<iostream>
#include<string>

using namespace std;

int main(){
  int x, y, course[15][15], route[20][20], i, j, sum;
  while(cin >> x >> y, x+y){
    sum = 0;
    for(i=0; i<20; i++){
      for(j=0; j<20; j++){
        route[i][j] = 0;
      }
    }
    for(i=0; i<y; i++){
      for(j=0; j<x; j++){
        cin >> course[i][j];
      }
    }
    for(i=0; i<y; i++){
      for(j=0; j<x; j++){
        if(i==0){
          if(course[i][j]==0){
            route[i][j] = 1;
	  }else{
            route[i][j] = 0;
          }
        }else{
          if(j==0){
            if(course[i][j]==0){
              if(course[i-1][j]==0){
                route[i][j] += route[i-1][j];
              }
              if(course[i-1][j+1]==0){
                route[i][j] += route[i-1][j+1];
              }
            }else if(course[i][j]==1){
              route[i][j] = 0;
            }else{
              if(course[i-1][j]==0){
                route[i][j] += route[i-1][j];
              }
              route[i+2][j] += route[i][j];
            }
          }else if(j==x-1){
            if(course[i][j]==0){
              if(course[i-1][j]==0){
                route[i][j] += route[i-1][j];
              }
              if(course[i-1][j-1]==0){
                route[i][j] += route[i-1][j-1];
              }
            }else if(course[i][j]==1){
              route[i][j] = 0;
            }else{
              if(course[i-1][j]==0){
                route[i][j] += route[i-1][j];
              }
              route[i+2][j] += route[i][j];
            }
          }else{
            if(course[i][j]==0){
              if(course[i-1][j]==0){
                route[i][j] += route[i-1][j];
              }
              if(course[i-1][j-1]==0){
                route[i][j] += route[i-1][j-1];
              }
              if(course[i-1][j+1]==0){
                route[i][j] += route[i-1][j+1];
              }
            }else if(course[i][j]==1){
              route[i][j] = 0;
            }else{
              if(course[i-1][j]==0){
                route[i][j] += route[i-1][j];
              }
              route[i+2][j] += route[i][j];
            }
          }
        }
      }
    }
    for(i=y-1; i<y+1; i++){
      for(j=0; j<x; j++){
        sum+=route[i][j];
      }
    }
    cout << sum << endl;
  }
}

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

using namespace std;

template <typename T>
struct is_vector : std::false_type {};

template <typename T>
struct is_vector<std::vector<T>> : std::true_type {};

template <typename T>
std::ostream &operator<<(std::ostream &os, const std::vector<T> &vec) {
  for (const auto &e : vec)
    os << e
       << (&e == &vec.back()
               ? ""
               : is_vector<typename std::decay<decltype(e)>::type>::value
                     ? "\n"
                     : " ");
  return os;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int64_t A, B;
  cin >> A >> B;
  auto f = [](int64_t N) {
    vector<int64_t> res;
    for (int64_t i = 1; i * i < N + 1; i++) {
      if (N % i == 0) {
        res.emplace_back(i);
        res.emplace_back(N / i);
      }
    }
    sort(res.begin(), res.end());
    res.erase(unique(res.begin(), res.end()), res.end());
    return res;
  };
  vector<int64_t> C = f(A), D = f(B), E;
  for (auto c : C) {
    if (binary_search(D.begin(), D.end(), c)) E.emplace_back(c);
  }
  int res = 1;
  for (int i = 1; i < (int)E.size(); i++) {
    if (E[i] == -1) continue;
    res++;
    for (int j = i + 1; j < (int)E.size(); j++) {
      if (E[j] % E[i] == 0) E[j] = -1;
    }
  }
  cout << res << '\n';
  return 0;
}


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

ans = 0
visited = [[0]*W for _ in range(H)]
stack = []
dx = [1,0,-1,0]
dy = [0,1,0,-1]

for i in range(H):
    for j in range(W):
        b,w = 0,0
        if not visited[i][j]:
            stack.append([i,j])
            visited[i][j] = 1
            while stack:
                x,y = stack.pop()
                if S[x][y]=='#':
                    b += 1
                else:
                    w += 1
                for k in range(4):
                    nx,ny = x+dx[k],y+dy[k]
                    if not(0<=nx<H and 0<=ny<W):
                        continue
                    if not visited[nx][ny] and S[x][y]!=S[nx][ny]:
                        visited[nx][ny] = 1
                        stack.append([nx,ny])
            ans += b*w

print(ans)

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

int main(){
  int a,b;
  char c;
  cin>>a;
  cin>>c;
  while(1){
    cin>>b;
    if(c=='+'){
      a+=b;
    }else if(c=='-'){
      a-=b;
    }else if(c=='*'){
      a*=b;
    }else if(c=='/'){
      a/=b;
    }else if(c=='='){
      break;
    }
    cin>>c;
  }
  cout<<a<<endl;
  return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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; }

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

    int n;cin>>n;
    if(n==2){
        cout<<-1<<endl;
        return 0;
    }

    //僕の考えた最強の埋め込み
    string a3[3]={
        {"aab"},
        {"c.b"},
        {"cdd"}
    };
    string a4[4]={
        {"aabd"},
        {"ccbd"},
        {"efgg"},
        {"efhh"}
    };
    string a5[5]={
        {"aabbc"},
        {"dxx.c"},
        {"d..ye"},
        {"f..ye"},
        {"fgghh"}
    };
    string a7[7]={
        {"aabe..."},
        {"c.be..."},
        {"cdd.ff."},
        {"y.x...g"},
        {"y.x...g"},
        {".u.jjhh"},
        {".u.aaii"}
    };

    if(n%3==0){
        char ans[n][n];
        rep(i,n){
            rep(j,n){
                ans[i][j]='.';
            }
        }
        rep(i,n/3){
            ans[3*i][3*i]='a';
            ans[3*i][3*i+1]='a';

            ans[3*i+2][3*i+2]='b';
            ans[3*i+1][3*i+2]='b';
        }
        rep(i,n){
            rep(j,n){
                cout<<ans[i][j];
            }cout<<endl;
        }
    }else{
        int i4=-1,i5=-1,i7=-1;
        if(n%7==0){
            i4=0,i5=0,i7=n/7;
        }
        else if(n%5==0){
            i4=0,i5=n/5,i7=0;
        }
        else if(n%4==0){
            i4=n/4,i5=0,i7=0;
        }
        else{
            bool f=true;
            for(int i=0;i*4<=n and f;i++){
                for(int j=0;i*4+j*5<=n and f;j++){
                    int k=(n-i*4-j*5)/7;
                    if(i*4+j*5+k*7==n){
                        f=false;
                        i4=i;i5=j;i7=k;
                    }
                }
            }
        }
        int idx=0;
        char ans[n][n];
        rep(i,n)rep(j,n) ans[i][j]='.';
        rep(_,i4){
            rep(i,4){
                rep(j,4){
                    ans[idx+i][idx+j]=a4[i][j];
                }
            }
            idx+=4;
        }
        rep(_,i5){
            rep(i,5){
                rep(j,5){
                    ans[idx+i][idx+j]=a5[i][j];
                }
            }
            idx+=5;
        }
        rep(_,i7){
            rep(i,7){
                rep(j,7){
                    ans[idx+i][idx+j]=a7[i][j];
                }
            }
            idx+=7;
        }
        rep(i,n){
            rep(j,n){
                cout<<ans[i][j];
            }cout<<endl;
        }
    }

    return 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define endl "\n"
#define speed() ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(x) (int)(x).size()
#define _USE_MATH_DEFINES
using namespace std;
typedef long long int lli;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int main() {
    speed();
    string s; cin >> s;
    int n = s.size();
    int max_no = 999;
    for (int i = 0; i <= n-3; ++i) {
        int num = (s[i] - '0')*100 + (s[i+1] - '0')*10 + (s[i+2] - '0');
        max_no = min(max_no, abs(num - 753));
    }
    cout << max_no << endl;
    return 0;
}

Measured memory_bytes: 256
# include <stdio.h>

void part( int [], int ,int ); 
int n;
int main(){
  int i;
  scanf("%d" , &n);
  int input[n];

  
  for ( i = 0; i < n; i++ ){
    scanf("%d" ,&input[i]);
  }
 
  part (input ,0 , n-1) ;

  
  return 0;
}

void part (int a[] ,int p ,int r){
  int x = a[r] ,t ,k;
  int j, i = p-1;
  for ( j = p ; j < r ; j++ ){
    if ( a[j]  <= x){
      i++;
      t = a[i]; a[i] = a[j]; a[j] =t;
    }
  }
  t = a[i+1]; a[i+1] = a[r] ; a[r]=t;

  
  for ( k = 0; k <= i; k++ ){
    printf("%d " ,a[k]);
  }printf("[%d] " , x);k++;
  for (; k < n; k++ ){
    printf("%d" ,a[k]);
    if( k != n-1){printf(" ");}
  }
  printf("\n");
}



Measured memory_bytes: 2092
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int N; cin >> N; 
	int A[200010], B[200010]; 
	for(int i = 0; i < N; i++) cin >> A[i]; 
	for(int i = 0; i < N; i++) cin >> B[i]; 
	int cnt[200010] = {}; 
	for(int i = 0; i < N; i++){
		cnt[A[i]] ++; cnt[B[i]] ++; 
	}
	for(int i = 1; i <= N; i++){
		if(cnt[i] > N){
			cout << "No" << "\n"; return 0;
		}
	}
	cout << "Yes" << "\n"; 
	for(int i = 0; i < (N+1)/2; i++) swap(B[i], B[N-1-i]); 
	vector<int> overlap; 
	vector<int> not_overlap; 
	int num = -1; 
	for(int i = 0; i < N; i++){
		if(A[i] == B[i]){
			overlap.push_back(i); num = A[i]; 
		}
	}
	for(int i = 0; i < N; i++){
		if(A[i] != num && B[i] != num) not_overlap.push_back(i);
	}
	for(int i = 0; i < (int) overlap.size(); i++){
		swap(B[overlap.at(i)], B[not_overlap.at(i)]); 
	}
	for(int i = 0; i < N; i++) cout << B[i] << " ";
	cout << "\n";  
}

Measured memory_bytes: 6900
#include <bits/stdc++.h>
#define INF 100000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main()
{
  // string test = "abc";
  // cout << test[0] << endl;
  ll N;
  cin >> N;
  string S;
  cin >> S;
  vector<vector<ll>> char_num(N + 1, vector<ll>(26, 0));
  for (ll i = 0; i < N; ++i) {
    char_num.at(i + 1).at(S[i] - 'a') += 1;
  }
  for (ll i = 0; i < N; ++i) {
    for (ll j = 0; j < 26; ++j) {
      char_num.at(i + 1).at(j) += char_num.at(i).at(j);
    }
  }
  ll Q;
  cin >> Q;
  vector<pll> change;//place, abc
  for (ll i = 0; i < Q; ++i) {
    ll q;
    cin >> q;
    if (q == 1) {
      ll place;
      char c;
      cin >> place >> c;
      change.push_back({place - 1, c - 'a'});
    }
    else {
      string temp_S = S;
      ll l, r;
      cin >> l >> r;
      l -= 1;
      r -= 1;
      vector<ll> abc(26);
      for (ll j = 0; j < 26; ++j) {
        abc.at(j) = char_num.at(r + 1).at(j) - char_num.at(l).at(j);
      }
      for (ll j = 0; j < change.size(); ++j) {
        pll check = change.at(j);
        if (check.first <= r && check.first >= l) {
          abc.at(temp_S[check.first] - 'a') -= 1;
          abc.at(check.second) += 1;
          temp_S[check.first] = char('a' + check.second);
        }
      }
      ll res = 0;
      for (ll j = 0; j < 26; ++j) {
        if (abc.at(j) > 0) {
          res += 1;
        }
      }
      cout << res << endl;
    }
  }
}


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

int main(){
  int N,T,A;
  cin>>N>>T>>A;
  vector<int> H(N);
  for (int i=0; i<N; i++){
   cin>>H.at(i);
  }
  double dtemp;
  double mini=abs((T-H.at(0)*0.006)-A);
  int mini_i=0;
  for (int i=1; i<N; i++){
    dtemp=abs((T-H.at(i)*0.006)-A);
    if (dtemp<mini){
      mini=dtemp;
      mini_i=i;
    }
  }
  cout<<mini_i+1<<endl;
}
                            

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;cin>>n;
    long long su=0;
    int a[n];for(int i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    if(n==1)
    cout<<"0";
    else{
    int i=1,j=n-2;su+=a[n-1];
    while(i<n-1){
        su+=a[j];
        i++;
        //cout<<su<<"\n";
        if(i<n-1){su+=a[j];i++;j--;}
        }
    cout<<su;}
}

Measured memory_bytes: 4400
#include <bits/stdc++.h>
using namespace std;
map<string,int> m;
map<string,int>::iterator it; 
int main()
{
	string str1;
	char sz[11];
	int n,t,i,ma=0;
	scanf("%d",&n);
	getchar();
	for(i=0;i<n;i++)
	{
		scanf("%s",sz);
		str1=sz;
		if(m.count(str1)==0)
		{
			m[str1]=1;
		}
		else
		{
			m[str1]++;
		}
	//	printf("%s %d\n",str1.c_str(),m[str1]);
	}
	scanf("%d",&t);
	getchar();
	for(i=0;i<t;i++)
	{
		scanf("%s",sz);
		str1=sz;
		if(m.count(str1)==0)
			m[str1]=-1;
		else
			m[str1]--;
	}
	for(it=m.begin();it!=m.end();it++)
	{
		ma=max(ma,it->second);	
	}
	printf("%d",ma);
	return 0;
}

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

int main(){
	int n, a, b;
	cin >> n >> a >> b;

	cout << (a*n < b ? a*n : b) << endl;

	return 0;
}

Measured memory_bytes: 256
# div2019D - DivRem Number
# cf. ARC026B - 完全数
def divisors(n: int) -> set:
    """
    Compute divisors of a number.
    
    Args: n (int): an integer to be evaluated.
    Returns: div (set): set of divisors
    """
    div = set()
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            div.add(i)
            div.add(n // i)
    return div


def main():
    N = int(input())
    divs = divisors(N)
    divs.discard(1)
    ans = 0
    for m in divs:
        m -= 1
        if N // m == N % m:
            ans += m
    print(ans)


if __name__ == "__main__":
    main()

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

long long n,p[250005],dist[505][505],ans,x,y;
bool lib[505][505];
pair<int,int> dir[4]={{1,0},{-1,0},{0,1},{0,-1}};

void dfs(int row,int col,int val){
	
	if(lib[row][col]==false)val++;
	
	for(int i=0;i<4;i++){
		if((row+dir[i].first)>=0 && (row+dir[i].first)<n && (col+dir[i].second)>=0 && (col+dir[i].second)<n 
		&& dist[(row+dir[i].first)][(col+dir[i].second)]>val){
			dist[(row+dir[i].first)][(col+dir[i].second)]=val;
			dfs((row+dir[i].first),(col+dir[i].second),val);
		}
	}
	
}

int main(){

	ios::sync_with_stdio(false);
	cin.tie(0);

	cin>>n;
	
	for(int i=0;i<(n*n);i++){
		cin>>p[i];
		p[i]--;
	}
	
	for(long long i=0;i<n;i++){
		for(long long j=0;j<n;j++){
			dist[i][j]=min({i,n-1-i,j,n-1-j});
		}
	}
	
	for(int i=0;i<(n*n);i++){
		x=p[i]/n;
		y=p[i]%n;
		
		//cout<<"aggiungo "<<dist[x][y]<<"\n";
		
		ans+=dist[x][y];
		lib[x][y]=true;
		
		dfs(x,y,dist[x][y]);
	}
	
	cout<<ans<<"\n";

return 0;
}


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

int main(){
	int n, amigos = 0;
	float tam_min, tam_amigo;

	cin >> n >> tam_min;

	for (int i = 0; i < n; ++i)
	{
		cin >> tam_amigo;
		if (tam_amigo >= tam_min)
		{
			amigos += 1;
		}
	}

	cout << amigos << endl;

	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

int main() {
    int N;
    cin >> N;
    set<Int> a;
    for (int i = 0; i < N; i++) {
        Int in;
        cin >> in;
        if (!a.insert(in).second) {
            cout << "NO" << endl;
            return 0;
        }
    }

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

Measured memory_bytes: 9600
#include<stdio.h>

int main(){
  int n;
  scanf("%d", &n);
  
  struct cell{
    int index;
    int value;
  };
  
  int a[n];
  int max = 0;
  int max_next;
  int i;
  for(i = 0; i < n; i++){
    scanf("%d", a+i);
    if(*(a+i) >= max){
      max_next = max;
      max = *(a+i);
    }else if(*(a+i) > max_next){
      max_next = *(a+i);
    }
  }
  
  for(int i = 0; i < n; i++){
    if(*(a+i) == max){
      printf("%d\n", max_next);
    }else{
      printf("%d\n", max);
    }
  }
  
  return 0;
}


Measured memory_bytes: 2304
#include <stdio.h>
int main(void)
{
    int i,j,sn=0,pn=0,t;
    char s[101],p[101];
    scanf("%s",s);
    scanf("%s",p);
   
    while(s[sn]!='\0') sn++;
    while(p[pn]!='\0') pn++;
    
    for(i=0;i<sn;i++){
        t=1;
        for(j=0;j<pn;j++)
            if(s[(i+j)%sn]!=p[j])
                t=0;
            if(t) break;
    }
    
    if(t) printf("Yes\n");
    else printf("No\n");
    
    return 0;
   
}



Measured memory_bytes: 2112
n,y=map(int,input().split())
A=y//10000+1
a=-1
b=-1
c=-1
for i in range(A+1):
  for j in range(n-i+1):
    k=n-i-j
    if i*10000+j*5000+k*1000==y and k>=0:
      a=i
      b=j
      c=k
print(a,b,c)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
  string s1,s2,s3;
  cin>>s1>>s2>>s3;
  string c1,c2,c3;
  c1 = s1.at(0);
  c2 = s2.at(0);
  c3 = s3.at(0);
  cout<<c1+c2+c3<<endl;
}

Measured memory_bytes: 256
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/


int main(){

int X;
cin>>X;
rep3(i,360){
    if((i*X)%360==0){
        cout<<i<<endl;
        return 0;
    }
}

return 0;
}

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

int main(){
	double d;
	int v[6] = {};
	int n;
	cin >> n;
	for(int i = 0;i < n;i++) {
		cin >> d;
		if(d < 165.0) v[0]++;
		else if(d < 170.0) v[1]++;
		else if(d < 175.0) v[2]++;
		else if(d < 180.0) v[3]++;
		else if(d < 185.0) v[4]++;
		else v[5]++;
	}
	for(int i = 0;i < 6;i++){
		cout << i + 1 << ":";
		for(int j = 0;j < v[i];j++) cout << "*";
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1232