akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

ll in[MAXn];
int main(){
  IOS();
  REP (i,3) {
    ll x,y;
    cin >> x >> y;
    in[x]++;
    in[y]++;
  }
  bool ok = true;
  REP1 (i,4) if (in[i] > 2) ok = false;
  if (ok) cout << "YES" << endl;
  else cout << "NO" << endl;
}


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

int main() {
  int N;
  cin >>N;
  vector<int> d(N);
  for(int i=0; i<N; i++) cin >>d.at(i);
  
  int ans=0;
  for(int i=0; i<N-1; i++){
    for(int j=i+1; j<N; j++){
      if(d.at(i)==d.at(j)){
        d.at(j)=0;
      }
    }
  }
  
  for(int i=0; i<N; i++){
    if(d.at(i)!=0) ans++;
  }
  cout <<ans<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;
 
using namespace std;


void solve()
{
	int n, K;
	scanf("%d%d", &n, &K);
	vector<int> a(n);
	int i;
	for (i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}
	ll min = LINF;
	int j;
	for (i = 1; i < (1<<n); i+=2) {
		int cnt = 0;
		ll sum = 0;
		int curr = -1;
		for (j = 0; j < n; j++) {
			if (i & (1 << j)) {
				cnt++;
				if (curr < a[j]) {
					curr = a[j];
				}
				else {
					sum += (curr + 1 - a[j]);
					curr++;
				}
			}
			else {
				curr = MAX(curr, a[j]);
			}
		}
		if (cnt >= K) {
			min = MIN(min, sum);
		}
	}
	printf("%lld\n", min);

    return;
}


int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T; scanf("%d", &T);
    while(T--) {
        solve();
    }
#endif
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long       ll;
typedef pair<int,int>   ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef set<int>        si;
typedef set<ii>         sii;

#define all(x) x.begin(),x.end()
#define clr(x,v) memset(x,v,sizeof x)
#define sz(x) (int)x.size()
#define re return

template<typename T> T sgn (T x)      {re x<0? -1:(x>0? 1:0); }
template<typename T> T gcd (T a, T b) {re a ? gcd (b % a, a) : b; }
template<typename T> T abs (T x)      {re x < 0 ? -x : x; }
template<typename T> T sqr (T x)      {re x*x;}

#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define ins insert
#define y second
#define x first
#define endl "\n"
#define MOD (int)1e9+7
#define N (int)2e5+123

int n;
string aux;
set<string> se;
int main(){_
	cin >> n;
	for(int i = 0 ; i < n;i++){
		cin >> aux;
		se.ins(aux);
	}
	cout << se.size() << endl;
}

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

const int inf = 1e9;
const ll linf = 1e18;

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

    int n, k; cin >> n >> k;
    vector<int> p(n);
    for (int i = 0; i < n; i++) cin >> p[i];
    
    vector<double> e(n);
    for (int i = 0; i < n; i++) {
        e[i] = (p[i] * (p[i] + 1.0)) / (2.0 * p[i]);
    }

    double res = 0.0;
    for (int i = 0; i < k; i++) {
        res += e[i];
    }
    double ans = res;
    for (int i = 0; i < n - k; i++) {
        res += e[i + k] - e[i];
        ans = max(ans, res);
    }
    cout << setprecision(15) <<  ans << endl;
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<n;i++)
int main(void){
    // Your code here!
    vector<string> YN{"NO","YES"};
    vector<string> yn{"No","Yes"};
    int a,b;
    cin>>a>>b;
    cout<<(a+b>9?"error":to_string(a+b))<<endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
class node
{
public:
	int key;
	node *p;
	node *l;
	node *r;
};

node *NIL,*root;

void insert(int v)
{
	node *y=NIL,*x=root,*z=new node;
	z->key=v;z->l=z->r=NIL;
	while(x!=NIL)
	{
		y=x;
		if(z->key<x->key)x=x->l;
		else x=x->r;
	}
	z->p=y;
	if(y==NIL)root=z;
	else if(z->key<y->key)y->l=z;
	else y->r=z;
	return;
}

node* find(int k)
{
	node *x=root;
	while(x!=NIL&&k!=x->key)
	{
		if(k<x->key)x=x->l;
		else x=x->r;
	}
	return x;
}

node* next(node *z)
{
	node *x,*y;
	if(z->r!=NIL)
	{
		x=z->r;
		while(x->l!=NIL)x=x->l;
		return x;
	}
	
	y=z->p;
	while(y!=NIL&&x==y->r)
	{
		x=y;
		y=y->p;
	}
	return y;
}

void del(node *z)
{
	node *y,*x;
	if(z->l==NIL||z->r==NIL)y=z;
	else y=next(z);
	
	if(y->l!=NIL)x=y->l;
	else x=y->r;
	
	if(x!=NIL)x->p=y->p;
	
	if(y->p==NIL)root=x;
	else if(y==y->p->l)y->p->l=x;
	else y->p->r=x;
	
	if(y!=z)z->key=y->key;
	delete(y);
	return;
}

void ino(node *u)
{
	if(u==NIL)return;
	ino(u->l);
	cout<<" "<<u->key;
	ino(u->r);
	return;
}

void preo(node *u)
{
	if(u==NIL)return;
	cout<<" "<<u->key;
	preo(u->l);
	preo(u->r);
	return;
}

void print()
{
	ino(root);
	cout<<endl;
	preo(root);
	cout<<endl;
	return;
}

int main() {
	int n;cin>>n;
	string s;node *a;
	while(cin>>s)
	{
		if(s=="insert")
		{
			cin>>n;
			insert(n);
		}
		else if(s=="find")
		{
			cin>>n;
			a=find(n);
			if(a!=NIL)cout<<"yes"<<endl;
			else cout<<"no"<<endl;
		}
		else if(s=="delete")
		{
			cin>>n;
			del(find(n));
		}
		else if(s=="print")print();
	}
	return 0;
}

Measured memory_bytes: 26512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner scannerS = new Scanner(System.in);
		String s = scannerS.nextLine();

		char s0 = s.charAt(0);
		String ss = s.substring(2, s.length() - 1);
		char sl[] = s.toCharArray();
		int lower = 0;


		for (int i = 0; i < s.length(); i++) {
			if (sl[i] <= 'z' && sl[i] >= 'a')
				lower++;
		}
		//      System.out.println(lower);

		//	    System.out.println(ss);


		int count = 0;
		for (int i = 0; i < ss.length(); i++) {
			if (ss.charAt(i) == 'C')
				count++;
		}

		//	    System.out.println(count);

		if (s0 == 'A' && count == 1 && lower==s.length()-2) {
			System.out.println("AC");
		}else {
			System.out.println("WA");
		}

	}

}

Measured memory_bytes: 23380
import math

def main():
    s = input().split()
    n = int(s[0])
    k = int(s[1])
    
    if n<=(k/2):
        print(n)
        return
    
    n = n - (n//k)*k
    if n<= k/2:
        print(n)
    else:
        print(abs(n-k))

main()


Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using System.Runtime.CompilerServices;
using static MyUtil;

class MyUtil
{
    public static int[] ReadIntArray()
    {
	return ReadLine().Split().Select(x => int.Parse(x)).ToArray();
    }
}

class Program
{
    public static void Main()
    {
	var tmp = ReadIntArray();
	long h = tmp[0], w = tmp[1], n = tmp[2];

	var d = new Dictionary<int, Dictionary<int,int>>();

	long[] ans = new long[10];
	ans[0] = (h-2)*(w-2);
	
	int[] dx = {-2, -1,  0, -2, -1, 0, -2, -1, 0};
	int[] dy = {-2, -2, -2, -1, -1, -1, 0,  0, 0};

	for (int i = 0; i < n; i++)
	{
	    tmp = ReadIntArray();
	    int a = tmp[0], b = tmp[1];
	    for (int j = 0; j < 9; j++)
	    {
		int x = a + dx[j], y = b + dy[j];
		if (x < 1 || x > h - 2 || y < 1 || y > w - 2) continue;
		if (!d.ContainsKey(x)) d.Add(x, new Dictionary<int, int>());
		if (!d[x].ContainsKey(y)) d[x].Add(y, 0);
		int curr = d[x][y]++;
		ans[curr++]--;
		ans[curr]++;
	    }
	}
	
	for (int j = 0; j <= 9; j++)
	    WriteLine(ans[j]);
    }
}


Measured memory_bytes: 91000
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

constexpr double PI = 3.14159265358979323846;
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

class ERemOfSumIsNum {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int n, k; cin >> n >> k;
      vector<int> a(n);
      rep(i, n) {
        cin >> a[i];
        a[i]--;
      }

      vector<int> sum(n+1);
      rep(i, n) {
        sum[i+1] = sum[i] + a[i];
        sum[i+1] %= k;
      }

      ll ans = 0;
      unordered_map<int, int> mp;
      rep(i, n+1) {
        if (i>=k) {
          mp[sum[i-k]]--;
        }
        ans += mp[sum[i]];
        mp[sum[i]]++;
      }
      cout << ans << endl;

    }
};

signed main() {
  ERemOfSumIsNum solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

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

#ifdef LOCAL
#include "../../dump.hpp"
#else
#define dump(...)
#endif

using namespace std;

#define rep(i,n) for(int i=0,i##_cond=(n);i<i##_cond;i++)
#define FOR(i,a,b) for(int i=(a),i##_cond=(b);i<i##_cond;i++)
#define ROF(i,a,b) for(int i=(a)-1,i##_cond=(b);i>=i##_cond;i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumulate(all(a),0)
#define sz(x) ((int)(x).size())
#define pb push_back
#define fst first
#define snd second
#define mp make_pair

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main(){
#define int ll
  string s; cin >> s; reverse(all(s));
  vs t = {"dream", "dreamer", "erase", "eraser"};
  rep(i,sz(t)) reverse(all(t[i]));
  dump(t);
  int x = 0, y;
  while(x < sz(s)){
    y = x;
    rep(i,sz(t)){
      if(x + sz(t[i]) <= sz(s) and s.substr(x, sz(t[i])) == t[i])
	x += sz(t[i]);
    }
    if(x == y){
      cout << "NO\n";
      return 0;
    }
  }
  cout << "YES\n";
}

Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main(){
  int n;
  cin>>n;
  int cnt=0,count=0;
  for(int i=1;i<=n;i=i*10){
    cnt++;
    if(cnt%2==1){
      for(int j=i;j<i*10;j++) 
        if(j<=n)  count++;
    }
    else continue;
  }
  cout<<count;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define PI 3.141592
#define all(a) (a).begin(), (a).end()


int main(){
    int s, w;
    cin >> s >> w;
    if(w >= s) puts("unsafe");
    else puts("safe");
}


Measured memory_bytes: 3644
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  char a, b;
  cin >> a >> b;
  map<char, char> m = {{'H', 'D'}, {'D', 'H'}};
  if (a == 'H') {
    cout << b << endl;
  } else {
    cout << m[b] << endl;
  }
  return 0;
}

Measured memory_bytes: 3584
#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    int n,m;cin>>n>>m;
    VPII a(m);
    REP(i,m){
        cin>>a[i].first>>a[i].second;
        a[i].first--;
        a[i].second--;
    }

    SORT_DESC(a);

    int cut = INF;
    int result = 0;
    REP(i,m){
        if(cut>=a[i].second){
            result++;
            cut=a[i].first;
        }
    }
    cout<<result<<endl;


	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

using ll = long long;
#define INF 1e9


int main(){ 
  int N;
  cin >> N;
  vector<double> A(N);
  double sum = 0;
  REP(i, N){
    cin >> A[i];
    sum += 1/A[i];
  }
  printf("%.9lf\n", 1/sum);
  return 0;
}



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

const int N = 404, mod = 1e9 + 7;

int n, a[N], ps[N], dp[N][N];

int sum(int l, int r) {
	if (l > r) return 0;
	return ps[r] - ps[l - 1];
}

int solve(int l, int r) {
	if (l >= r) {
		return 0;
	}
	if (dp[l][r]) return dp[l][r];
	int mn = LLONG_MAX;
	for (int i = l; i < r; i++) {
		mn = min(mn, solve(l, i) + solve(i + 1, r) + sum(l, i) + sum(i + 1, r));
	}
	return dp[l][r] = mn;
}

signed main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		ps[i] = ps[i - 1] + a[i];
	}
	cout << solve(1, n);
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
typedef long double ld;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1LL<<60;
const int inf = 1e5;
//typedef long double ld;
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; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};
ll gcd(ll a, ll b) { return a ? gcd(b%a, a) : b; };
int main(){
  int N;  cin>>N;
  vector<ll> a(N),b(N),c(N),d(N),e(N);
  vector<P> p(N);
  vector<ll> other(N);
  rep(i,0,N) cin>>a[i], c[i]=e[i]=a[i];
  rep(i,0,N) cin>>b[i], d[i]=b[i];
  rep(i,0,N) p[i]=mp(a[i],b[i]);
  rep(i,0,N){

  }
  sort(all(p));
  sort(all(c)); sort(all(d));
  bool ok=true;
  map<ll,ll> ma;
  ll sum = 0;
  int cnt=0;
  rep(i,0,N){
    if(a[i]<b[i]) cnt++, sum += b[i]-a[i];
  }
  priority_queue<ll> que;
  rep(i,0,N){
    if(a[i]>b[i]){
      que.push(a[i]-b[i]);
    }
  }
  while(que.size()){
    if(sum<=0)break;
    sum -= que.top();
    que.pop();
    cnt++;
  }
  if(sum<=0)cout << cnt << endl;
  else cout<<-1<<endl;
  return 0;
}


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

using ll = long long;
//using P = pair<int, int>;
using P = pair<double, double>;
using edge = struct {int to; ll cost;};

#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(a) (a).begin(), (a).end()

const int di[] = {-1, 0, 1, 0, 1, 1, -1, -1};
const int dj[] = {0, -1, 0, 1, 1, -1, 1, -1};
const int INF = 1001001001;

const int mod = 1000000007;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};
struct combination
{
  vector<mint> fact, ifact;
  combination(int n) : fact(n + 1), ifact(n + 1)
  {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i)
      fact[i] = fact[i - 1] * i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i)
      ifact[i - 1] = ifact[i] * i;
  }
  mint operator()(int n, int k)
  {
    if (k < 0 || k > n)
      return 0;
    return fact[n] * ifact[k] * ifact[n - k];
  }
};

int n;
vector<P> p;

//long long gcd(long long a, long long b);
//long long lcm(long long a, long long b);

double dist(P a, P b) {
  double dx = a.first - b.first;
  double dy = a.second - b.second;
  return sqrt(dx*dx + dy*dy);
}

double f(double x, double y) {
  double res = 0;
  rep(i, n) {
    res = max(res, dist(make_pair(x, y), p[i]));
  }
  return res;
}

double g(double x){
  double l = 0, r = 10000;
  rep(i, 80) {
    double c1 = (l*2+r) / 3;
    double c2 = (l+2*r) / 3;
    if(f(x,c1) > f(x, c2)) l = c1; else r = c2;
  }
  return f(x, l);
}

void solve()
{
  cin >> n;
  p = vector<P>(n);
  rep(i, n) {
    double x, y;
    cin >> x >> y;
    p[i] = make_pair(x, y);
  }

  double l = 0, r = 1000;
  rep(i, 80) {
    double c1 = (l*2+r) / 3;
    double c2 = (l+2*r) / 3;
    if(g(c1) > g(c2)) l = c1; else r = c2;
  }
  double ans = g(l);
  printf("%.10f\n", ans);
}

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


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

int main() {
	int n;
	cin >> n;
	
	for(int i = 1; i <= 9; i++)
		for(int j = 1; j <= 9; j++)
			if (i * j == n){
				cout << "Yes" << endl;
				return 0;
			}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"strings"
)

func main() {
	var companys string
	fmt.Scan(&companys)

	fmt.Println(check(strings.Split(companys, "")))
}

func check(tSlice []string) string {
	for _, str := range tSlice {
		if str != tSlice[0] {
			return "Yes"
		}
	}
	return "No"
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

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


int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using pLL = std::pair<long long, long long>;
using ll = long long;
#define SORT(v) std::sort(v.begin(), v.end())


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, K;
	cin >> N >> K;
	vector<ll> h(100010), dp(100100);
	for (int i = 0; i < N; ++i) {
		cin >> h[i];
	}
	for (int i = 0; i < 100100; ++i) dp[i] = LINF;
	dp[0] = 0;
	for (int i = 0; i < N; ++i) {
		for (int j = 1; j <= K; ++j) {
			chmin(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
		}
	}
	cout << dp[N - 1] << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
using namespace std;
int main() {
   

   long long  n,w;
   cin>>n>>w;
   long long  weights[n],values[n];

   for(long long  i=0;i<n;i++)
    cin>>weights[i]>>values[i];

   long long  dp[n+1][w+1];

   for(long long  i=0;i<n+1;i++)
   {
       for(long long  j=0;j<=w;j++)
       {
           if(i==0||j==0)
            dp[i][j]=0;
           else if(weights[i-1]<=j)
            dp[i][j]=max(values[i-1]+dp[i-1][j-weights[i-1]],dp[i-1][j]);
           else
            dp[i][j]=dp[i-1][j]; 
       }
   } 

   cout<<dp[n][w];

   return 0;
}


Measured memory_bytes: 79104
N = int(input())
L = list(map(int,input().split()))
ans = 0
for i in range(0, N-1):
  a = L[i]
  b = L[i + 1]
  if a - b > 0:
    ans +=(a - b)
    L[i + 1] = L[i]
print(ans)  

Measured memory_bytes: 32092
#include<stdio.h>
#include<algorithm>
#include<queue>
using namespace std;
int g[110][110];
int g2[30][110][110];
int pri[21000];
int sz[30];
int dat1[100];
int dat2[100];
int main(){
	int a,b,c,d,e;
	while(scanf("%d%d%d%d%d",&a,&b,&c,&d,&e),a){
		for(int i=0;i<a;i++)
			for(int j=0;j<a;j++){
				if(i==j)g[i][j]=0;
				else g[i][j]=999999999;
				for(int k=0;k<c;k++){
					if(i==j)g2[k][i][j]=0;
					else g2[k][i][j]=999999999;
				}
			}
		for(int i=0;i<b;i++){
			int p,q,r,s;
			scanf("%d%d%d%d",&p,&q,&r,&s);
			p--;q--;s--;
			g2[s][p][q]=g2[s][q][p]=min(g2[s][p][q],r);
		}
		for(int i=0;i<c;i++)scanf("%d",sz+i);
		for(int t=0;t<c;t++)
			for(int k=0;k<a;k++)
				for(int i=0;i<a;i++)
					for(int j=0;j<a;j++)
						g2[t][i][j]=min(g2[t][i][j],g2[t][i][k]+g2[t][k][j]);
		for(int i=0;i<c;i++){
			for(int j=0;j<sz[i]-1;j++)
				scanf("%d",dat1+j);
			for(int j=0;j<sz[i];j++)
				scanf("%d",dat2+j);
			int now=0;
			int tmp=0;
			for(int j=0;j<21000;j++){
				pri[j]=tmp;
				if(now<sz[i]-1&&dat1[now]==j)now++;
				tmp+=dat2[now];
			}
		//	for(int j=0;j<10;j++)printf("%d ",pri[j]);printf("\n");
			for(int j=0;j<a;j++){
				for(int k=0;k<a;k++){
					if(g2[i][j][k]<99999999)g[j][k]=min(g[j][k],pri[g2[i][j][k]]);
				}
			}
		}
	//	for(int i=0;i<a;i++){
	//		for(int j=0;j<a;j++)printf("%d ",g[i][j]);
	//		printf("\n");
	//	}
		for(int k=0;k<a;k++)
			for(int i=0;i<a;i++)
				for(int j=0;j<a;j++)
					g[i][j]=min(g[i][j],g[i][k]+g[k][j]);
		if(g[d-1][e-1]>99999999)printf("-1\n");
		else printf("%d\n",g[d-1][e-1]);
	}
}

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

int qr[200005][3]; // query type , 2 extra data.
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
    

	string s;
	int q;

	cin >> s;
	cin >> q;

	int t, f;
	char c;

	int i = 0; 
	int n = q;
	while(q--)
	{
		cin >> t;

		if(t == 1)
		{
			qr[i][0] = 1;
			qr[i][1] = 0;
			qr[i][1] = 0;
		}


		else if(t == 2)
		{
			cin >> f >> c;
			qr[i][0] = 2;
			qr[i][1] = f;
			qr[i][2] = int(c);
		}

		i++;
	}

	string last = "";
	string front = "";
	int reversed = 0;
	for(int i=n-1; i>=0; --i)
	{	
		if(qr[i][0] == 1)
		{
			reversed = 1 - reversed;
		}

		else if(qr[i][0] == 2)
		{
			if(qr[i][1] == 1)
			{
				if(reversed)
				{
					last += char(qr[i][2]);
				}
				else
				{ 
					front += char(qr[i][2]);
				}
			}

			else if( qr[i][1] == 2)
			{
				if(reversed)
				{
					front += char(qr[i][2]);
				}
				else
				{
					last += char(qr[i][2]);
				}

			}
		}

	}
	
	if( reversed )
	{
		reverse(s.begin(), s.end());
	}


	reverse(last.begin(), last.end());
	cout << front << s << last << "\n";
	
	return 0;
}


Measured memory_bytes: 3408
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;

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

    vector<vector<int>> g(n);

    vector<int> in_deg(n);

    for (int i = 0; i < m; i++) {
        int x, y;
        cin >> x >> y;

        x--;
        y--;

        g[x].push_back(y);

        in_deg[y]++;
    }


    queue<int> q;

    for (int i = 0; i < n; i++) {
        if (in_deg[i] == 0) {
            q.push(i);
        }
    }

    vector<int> dp(n);

    while(!q.empty()) {
        int p = q.front();
        q.pop();

        for (int to : g[p]) {
            dp[to] = max(dp[to], dp[p] + 1);

            in_deg[to]--;

            if (in_deg[to] == 0) {
                q.push(to);
            }
        }
    }

    cout << *max_element(dp.begin(), dp.end()) << endl;
}


Measured memory_bytes: 6528
import sys
from heapq import heappop, heappush
from operator import itemgetter
from collections import deque, defaultdict, Counter
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
MOD = 10**9 + 7
INF = float('inf')

def sol():
    _, K = map(int, input().split())
    A = list(map(int, input().split()))
    F = list(map(int, input().split()))

    A.sort()
    F.sort(reverse=True)

    def isOk(t):
        cnt = 0
        for a, f in zip(A, F):
            ness = t // f
            if a <= ness:
                continue
            cnt += a - ness

        if cnt > K:
            return False
        else:
            return True

    ng = -1
    ok = A[-1] * F[0]

    while ok - ng > 1:
        mid = (ok + ng) // 2
        if isOk(mid):
            ok = mid
        else:
            ng = mid
    print(ok)


sol()

Measured memory_bytes: 35004
import java.util.Scanner;
import java.util.stream.IntStream;

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

        String S = sc.next();

        System.out.println(solve(S) ? "AC" : "WA");

        sc.close();
    }

    static boolean solve(String S) {
        int[] uppercaseIndices = IntStream.range(0, S.length()).filter(i -> Character.isUpperCase(S.charAt(i)))
                .toArray();

        return S.charAt(0) == 'A' && uppercaseIndices.length == 2 && uppercaseIndices[1] >= 2
                && uppercaseIndices[1] <= S.length() - 2 && S.charAt(uppercaseIndices[1]) == 'C';
    }
}

Measured memory_bytes: 28756
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
#include<map>
using namespace std;

int read(){
	int x=0,f=1;
	char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){x=(x<<3)+(x<<1)+c-48;c=getchar();}
	return x*f;
}

long double ans,sum=0;
int main(){
	int k,m,n;
	n=read();
	for(register int i=1;i<=n;i++){
		scanf("%Lf",&ans);
		sum+=1./ans;
	}
	printf("%6Lf\n",1/sum);
	return 0;
}

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

using namespace std;
typedef long long ll;

#define INF (long long)(1e9+7)
#define REP(i,n) for(ll i = 0; i < n; i++)
#define REP1(i,n) for(ll i = 1; i <= n; i++)

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


Measured memory_bytes: 256
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <bitset>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
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;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
unsigned long long MOD = 1e9 + 7;
ll INF = 1e18;
long long modMult(long long a, long long b, long long m)
{
    long long res = 0;
    long long exp = a % m;
    while (b)
    {
        if (b & 1)
        {
            res += exp;
            if (res > m)
                res -= m;
        }
        exp <<= 1;
        if (exp > m)
            exp -= m;
        b >>= 1;
    }
    return res;
}
long long powMod(long long a, long long b, long long m)
{
    long long res = 1;
    long long exp = a % m;
    while (b)
    {
        if (b & 1)
            res = modMult(res, exp, m);
        exp = modMult(exp, exp, m);
        b >>= 1;
    }
    return res;
}
//powMod(a,b,MOD)
//O(log(b))?
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vector<ll> vec(n);
    vector<ll> reg(100,0);
    rep(i, n) {
        cin >> vec[i];
    }
    rep(i, n)
    {
        ll g=pow(2,61);
        for(ll j=61;j>=0;j--)
        {
            if(g<=vec[i]){
                reg[j]++;
                vec[i]-=g;
            }
            g/=2;
        }
    }
    ll res=0;
  	ll g=1;
    rep(i, 62)
    {
        ll k=g;
        ll f=reg[i]*(n-reg[i]);
        f%=MOD;
        ll p=k*f%MOD;
        res += p;
        res %= MOD;
        g*=2;
        g%=MOD;
    }
    cout << res%MOD << endl;
}


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

int main(void){
  int N,K,count;
  double Nf,Kf;
  scanf("%d %d",&N,&K);
  Nf = log((double)N);
  Kf = log((double)K);
  count = (int)(Nf/Kf+1);
  printf("%d\n",count);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,s,n) for(int i=s;i<n;i++)
 
int main()
{
  string str;
  cin >> str;

  cout << str.at(0) << str.at(1) << str.at(2)  << endl;
  
}
  

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

constexpr int EQUAL = 0;
constexpr int LESS_THAN = 1;
constexpr int GREATER_THAN = 2;

int l;
vector<int> n;
vector<int> a;

int f(int pos, int count, char cmp = 0) {
	int res = 0;

	if (count == 0 && cmp != GREATER_THAN) {
		return 1;
	}

	if (pos == l || cmp == GREATER_THAN) {
		return 0;
	}
	
	for (int d = 0; d < 10; ++d) {
		a[pos] = d;
		if (d != 0) {
			--count;
		}

		char cmp2 = cmp;
		if (cmp2 == EQUAL) {
			if (a[pos] < n[pos]) {
				cmp2 = LESS_THAN;
			} else if (a[pos] > n[pos]) {
				cmp2 = GREATER_THAN;
			}
		}

		res += f(pos + 1, count, cmp2);

		if (d != 0) {
			++count;
		}
		a[pos] = 0;

		if (cmp2 == GREATER_THAN) {
			break;
		}
	}

	return res;
}

int main() {
	string s;
	int k;

	cin >> s >> k;
	
	l = s.length();
	n = vector<int>(l);
	a = vector<int>(l);
	for (int i = 0; i < l; ++i) {
		n[i] = s[i] - '0';
		a[i] = 0;
	}

	cout << f(0, k);
	
	return 0;
}
	

Measured memory_bytes: 256
#include<stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
int main(){
	
	int a,b;
	scanf("%d%d",&a,&b);

	if((a*b)%2==0){
	
		printf("Even\n");
	}
	else{
		printf("Odd\n");
	}
	
		
	return 0;
}

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

#define for_(i,a,b) for(int i=a;i<b;++i)

int N, M, b[15], p[15], p1[15], p2[15];

void solve() {
	int ii = 0, v = 0;
	for_(i,0,M) {
		for_(j,0,p[i]) p1[ii] = v, p2[ii++] = 1 - v;
		v = 1 - v;
	}
	
	int cnt = 0, cnt1 = 0, cnt2 = 0;
	for_(i,0,N) cnt += b[i], cnt1 += p1[i], cnt2 += p2[i];
	bool f1 = cnt == cnt1, f2 = cnt == cnt2;	
	
	int ans1 = 0, ans2 = 0, j1 = 0, j2 = 0;
	for_(i,0,N) {
		if (b[i]) {
			if (f1) {
				while (!p1[j1]) ++j1;
				ans1 += abs(j1 - i);
			}
			if (f2) {
				while (!p2[j2]) ++j2;
				ans2 += abs(j2 - i);
			}
			++j1, ++j2;
		}
	}
	
	cout << min(f1 ? ans1 : 100, f2 ? ans2 : 100) << endl;
}

int main() {
	cin >> N >> M;
	for_(i,0,N) cin >> b[i];
	for_(i,0,M) cin >> p[i];
	solve();
	return 0;
}

Measured memory_bytes: 1164
//#pragma GCC optimize("03", "unroll-loops")
//#pragma GCC target("avx2")

#include <bits/stdc++.h>

#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define FOR(i,n) for(i=0;i<n;i++)
#define FORn(i,j,n) for(i=j;i<n;i++)
#define pb push_back
#define unique_sort(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define vprint(v) for(auto t:v)cout<<t<<" "
#define endl "\n"

using namespace std;

typedef long long int lli;
typedef long int li;
typedef vector<lli> vli; 
typedef vector<int> vi; 
typedef vector<string> vs; 


const lli mod=1000000007;
const lli limit=1000000;


void fc(lli &x)
    {
        bool neg=false;
        register char c;
        x =0;
        c=getchar();
        if(c=='-')
        {
            neg = true;
            c=getchar();
        }
        for(;(c>47 && c<58);c=getchar())
            x = (x<<1) + (x<<3) +c -48;
        if(neg)
            x *=-1;
    }

int main() {

    fast()
    lli n,q,t;
    lli temp,temp1,temp2,temp3;
    lli i,j,k,m;
    cin>>n>>m;
    lli arr[m];
    FOR(i,m)cin>>arr[i];
    temp=0;
    FOR(i,m)temp+=arr[i];
    if(temp>n)cout<<-1<<endl;
    else cout<<n-temp<<endl;
    
}

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

int main() {
  int N;
  cin>>N;
  vector<long> a(N);
  for(int i=0;i<N;i++) cin>>a[i];
  long ans=0;
  vector<long> r(N);
  r[0]=a[0];
for(int i=1;i<N;i++) {
  r[i]=r[i-1]+a[i];
}

long dif=123456789101112;
for(int i=0;i<N-1;i++){
  dif=min(dif,abs((r[N-1]-r[i])-r[i]));
}


cout<<dif<<endl;
}


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

class SegTree{
private:
  int n;
  // 1-index (tree[0] is dummy), leaves are tree[n]-tree[2n-1]
  vector<int> tree;
  const int defVal = 0;
public:
  SegTree(int _n){
    int t;
    t = 1;
    while (t<_n) t*=2;
    n = t;
    tree = vector<int>(2*n, defVal);
    //cerr << "finish init" << endl;
    //cerr << "tree size is " << 2*n << endl;
  }
  void update(int k, int a){
    k += n;
    //cerr << "update:  [" << k << "] = " << a << endl;
    tree[k] += a;
    while (k>1){
      k /= 2;
      tree[k] += a;
    }
  }
  // stab function
  int query(int l, int r){ return _query(l,r,1,0,n);}
  // k:注目してるノード,対応する範囲がkl-kr
  int _query(int l, int r, int k, int kl, int kr){
    // それ以上潜らなくていいパターン
    if (kr<=l || r<=kl) return defVal;
    else if (l<=kl && kr<=r) return tree[k];
    else {
      int vl, vr;
      vl = _query(l,r, k*2, kl, (kl+kr)/2);
      vr = _query(l,r, k*2+1, (kl+kr)/2,kr);
      return vl+vr;
    }
  }
};

int main(void){
  int n,q;
  SegTree *st;
  
  cin >> n >> q;
  st = new SegTree(n);
  for (int i=0; i<q; i++){
    int c,x,y;
    cin >> c >> x >> y;
    if (c==0) st->update(x-1,y);
    else if (c==1) cout << st->query(x-1,y) << endl;
    else cout << "illegal command" << endl;
  }
  return 0;
}


Measured memory_bytes: 4920
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
cord = []
accept = 0
for i in range(n):
    a = list(map(int, input().split()))
    cord.append(a)
for i in cord:
    a = 0
    for j in range(m):
        x = i[j] * b[j]
        a += x
    if a + c > 0:
        accept += 1
print(accept)

Measured memory_bytes: 3064
import java.util.Scanner;
class Main{
    int maisu;
    int seki;
    int cnt=0;
    
    public void solve(){
        Scanner sc = new Scanner(System.in);
        
        while(cnt<4){
            seki = sc.nextInt();
            maisu = sc.nextInt();
            switch(seki){
                case 1:
                seki = 6000;
                break;
                case 2:
                seki = 4000;
                break;
                case 3:
                seki = 3000;
                break;
                case 4:
                seki = 2000;
                break;
            }
            cnt++;
            System.out.println(seki*maisu);
        }
        }
        public static void main(String[]args){
            Main obj = new Main();
            obj.solve();
        }
    }
    

Measured memory_bytes: 17164
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
#define D()
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 10000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

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

    int l[200005];
    int r[200005];

    for(int i = 0; i <= N; i++){
        l[i] = 0;
        r[i] = 0;
    }

    ll c = 0;
    for(int i = 0; i < N; i++){
        ll a;
        cin >> a;

        ll lval = i + 1 + a;
        ll rval = i + 1 - a;
        if(lval < N){
            l[lval]++;
        }
        if(rval > 0){
            r[rval]++;
        }
        if(rval >= 2){
            c += l[rval];
        }
    }

    ll count = 0;
    for(int i = 0; i < N; i++){
        //cout << l[i] << ":" << r[i] << endl;
        count += l[i] * r[i];
    }

    //cout << count << endl;
    cout << c << endl;
}

Measured memory_bytes: 4380
#include <iostream>
#include <unordered_map>

using namespace std;

int main() {
    int N, K;

    cin >> N >> K;

    unordered_map<int, bool> m;
    int count = 0;

    for (int i = 0; i < K; ++i) {
        int d;
        cin >> d;

        for (int j = 0; j < d; ++j) {
            int A;
            cin >> A;

            if (!m[A]) {
                m[A] = true;
                count++;
            }
        }
    }

    cout << N - count << endl;
    
    return 0;
}

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


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

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int M = sc.nextInt();
        int[] a_array = new int[A];
        int[] b_array = new int[B];

        int a_min = 100000;
        int b_min = 100000;
        for (int i = 0; i < A; i++) {
            a_array[i] = sc.nextInt();
            a_min = Math.min(a_min, a_array[i]);
        }
        for (int i = 0; i < B; i++) {
            b_array[i] = sc.nextInt();
            b_min = Math.min(b_min, b_array[i]);
        }

        int ans = a_min + b_min;
        int sum;
        for (int i = 0; i < M; i++) {
            sum = a_array[sc.nextInt() - 1] + b_array[sc.nextInt() - 1] - sc.nextInt();
            ans = Math.min(ans, sum);
        }

        System.out.println(ans);
    }
}

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

using namespace std;

int main() {
  string s;
  cin >> s;
  for(int i=0; i<s.size()-1; i++) {
    if("AC" == s.substr(i, 2))
    {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
#define INF 1007654321
#define PI 3.14159265358979
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repp(i, s, e) for(int i = (s); i <= (e); ++i)
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define FAST_IO() ios::sync_with_stdio(0); cin.tie(0)
template<typename T>
ostream& operator<<(ostream &os, const vector<T> &v) { for (auto x : v) os << x << " "; return os << "\n"; }

const ll MOD = 1e9 + 7;

int main() {
    FAST_IO();
    int N, M; cin >> N >> M;
    vector<ll> x(N+1), y(M+1);
    repp(i, 1, N) cin >> x[i];
    repp(j, 1, M) cin >> y[j];
    ll Si = 0, Sj = 0;
    repp(i, 1, N - 1) {
        Si += 1LL * i * (N - i) % MOD * (x[i+1] - x[i]) % MOD;
        Si %= MOD;
    }
    repp(j, 1, M - 1) {
        Sj += 1LL * j * (M - j) % MOD * (y[j+1] - y[j]) % MOD;
        Sj %= MOD;
    }
    cout << Si * Sj % MOD << endl;
    return 0;
}

Measured memory_bytes: 1792
import java.util.*;
  class Main{
      public static void main(String[] args){
      Scanner stdIn = new Scanner(System.in);
          int N = stdIn.nextInt();
          if(N%2==0){
              System.out.println(N);
          }else{
            System.out.println(N*2);
          }
      }
  }

Measured memory_bytes: 23764
n = int(input())
ta = input().split()
t = []
for i in range(len(ta)):
    t.append(int(ta[i]))
m = int(input())
p = []
x = []
for i in range(m):
    ta = input().split()
    p = int(ta[0])
    x = int(ta[1])

    total = 0
    for j in range(len(t)):
        if j + 1 == p:
            total = total + x
        else:
            total = total + t[j]

    print(total)

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

#define REP(i,n) for(ll i=0; i<(ll)(n); i++)
#define FOR(i,n,m) for (ll i=n; i<(ll)(m); i++)
#define pb push_back
#define INF 1000000007LL
#define all(a) (a).begin(),(a).end()
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)

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

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

ll N;
int main(){
    ios::sync_with_stdio(false);
    cin >> N;
    vector<int> a(N);
    REP(i, N) cin >> a[i];
    bool is_all_even = true;
    REP(i, N) is_all_even = is_all_even && a[i] % 2 == 0;
    if (is_all_even) {
        cout << "second" << endl;
    } else {
        cout << "first" << endl;
    }
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<ll, ll>>;
// ceil() 切り上げ, floor() 切り捨て
// next_permutation(all(x))

int		main(void)
{
	int n, m;
	cin >> n >> m;

	// 無向グラフ (どことどこが繋がっているか)
	vector<vector<int>> G(n);
	for (int i = 0; i < m; i++)
	{
		int a, b;
		cin >> a >> b;
		a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}

	// 各部屋の深さ
	vector<int> dist(n, -1);
	// 発見済みだが未訪問の部屋を格納
	queue<int> que;
	// 深さを計った際の親を格納
	vector<int> ans(n);

	dist[0] = 0;
	que.push(0);

	while (!que.empty())
	{
		int v = que.front();
		que.pop();

		// vと繋がっている部屋を全て調べる
		// next v
		for (int nv : G[v])
		{
			if (dist[nv] != -1)
				continue ;
			// nvについて距離情報を更新してキューに追加する
			dist[nv] = dist[v] + 1;
			ans[nv] = v;
			que.push(nv);
		}
	}
//	for (int v = 0; v < n; v++)
//		cout << v+1 << ": " << dist[v] << endl;
	cout << "Yes" << endl;
	for (int i = 1; i < n; i++)
		cout << ans[i] + 1 << endl;
}



Measured memory_bytes: 10644