akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;

int cnt[11];

int main()
{
	int a, b, c; cin >> a >> b >> c;
	cnt[a]++; cnt[b]++; cnt[c]++;
	if (cnt[5] == 2 && cnt[7] == 1)cout << "YES" << endl;
	else cout << "NO" << endl;

    return 0;
}



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

S = []

a = ord("a")
for i in range(N):
    s = list(input())
    s.sort()
    s_= "".join(s)
    S.append(s_)
S.sort()

ans = 0
c = 1
tmp = S[0]
for i in range(1, N):
    if(tmp == S[i]):
        c += 1
    else:
        tmp = S[i]
        ans += c * (c-1) // 2
        c = 1
else:
    ans += c * (c-1) // 2

print(ans)



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

struct WarshallFloyd {
    typedef vector< vector< long long > > Matrix;
    const long long INF = 1LL<<60;
    int n;
    Matrix g;
    WarshallFloyd(int n) : n(n), g(n, vector< long long >(n, INF)) {
        for (int i = 0; i < n; ++i) g[i][i] = 0;
    }
    void add_edge(int u, int v, long long c) {
        g[u][v] = c;
    }
    void build() {
        for (int k = 0; k < g.size(); ++k) {
            for (int i = 0; i < g.size(); ++i) {
                for (int j = 0; j < g.size(); ++j) {
                    g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
                }
            }
        }
    }
    bool is_negative_cycle() {
        for (int i = 0; i < n; ++i) if (g[i][i] < 0) return true;
        return false;
    }
    long long path(int s, int t) {
        if (g[s][t] < INF / 2) return g[s][t];
        return INF;
    }
};

/*
    verified http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_C&lang=jp
*/
// int main() {
//     int v, e; cin >> v >> e;
//     WarshallFloyd wf(v);
//     for (int i = 0; i < e; ++i) {
//         int s, t, d; cin >> s >> t >> d;
//         wf.add_edge(s, t, d);
//     }
//     wf.build();
//     if (wf.is_negative_cycle()) {
//         cout << "NEGATIVE CYCLE" << endl;
//         return 0;
//     }
//     for (int i = 0; i < v; ++i) {
//         for (int j = 0; j < v; ++j) {
//             if (j != 0) cout << " ";
//             long long path = wf.path(i, j);
//             if (path == wf.INF) cout << "INF";
//             else cout << path;
//         }
//         cout << endl;
//     }
// }

/*
    verified https://atcoder.jp/contests/abc073/tasks/abc073_d
*/
int main() {
    int n, m, r; cin >> n >> m >> r;
    vector<int> rs(r);
    for (int i = 0; i < r; ++i) {
        cin >> rs[i];
        --rs[i];
    }
    WarshallFloyd wf(n);
    for (int i = 0; i < m; ++i) {
        int s, t, d; cin >> s >> t >> d;
        --s, --t;
        wf.add_edge(s, t, d);
        wf.add_edge(t, s, d);
    }
    wf.build();
    sort(rs.begin(), rs.end());
    long long res = 1LL<<60;
    do {
        long long sum = 0;
        for (int i = 1; i < r; ++i) {
            sum += wf.path(rs[i - 1], rs[i]);
        }
        res = min(res, sum);
    } while (next_permutation(rs.begin(), rs.end()));
    cout << res << endl;
}

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

int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i=0; i<n; i++){
		cin >> a.at(i);
	}
	sort(a.begin(), a.end());
	int ans=a.at(n-1)-a.at(0);
	cout << ans << endl;
}


Measured memory_bytes: 3492
#include <stdio.h>

int main(void){
	int h, m, s;
	scanf("%d", &s);
	h = s / (60 * 60);
	m = s / 60 - h * 60;
	s -= ((m * 60) + (h * 60 * 60));

	printf("%d:%d:%d\n", h, m, s);

	return 0;

}

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

using namespace std;
typedef long long int ll;
int N;

set<int> chld[100005];
int prnt[100005];
int dst[100005];


void calc(int n, int m){
  dst[n]=m;
  for( auto&& i:chld[n]){
    if(i==prnt[n])continue;
    prnt[i]=n;
    calc(i,m+1);
  }
}

int gen(int n,int m){
  if(m==0)return n;
  return gen(prnt[n],m-1);
}

int cnt(int v){
  int res = 0;
  for( auto&& i:chld[v]){
    if(i==prnt[v])continue;
    res+=cnt(i);
  }
  return res+1;
}
int main() {
  cin >> N;
  for( int i = 0;i<N-1;i++){
    int a,b;
    cin>>a>>b;
    chld[a].insert(b);
    chld[b].insert(a);
  }
  calc(1,0);
  int v = gen(N,(dst[N]-1)/2);
  
  if(cnt(v)*2<N)cout<<"Fennec"<<endl;
  else cout<<"Snuke"<<endl;
  return 0;
}


Measured memory_bytes: 19712
value=[input().rstrip() for i in range(4)]
value=list(map(int,value))
#print(value)
a=value[3]
answer=0
for i in range(0,value[0]+1):
    fake=a-500*i
    if fake==0:
        answer+=1
        break
    else:
        for j in range(0,value[1]+1):
            if j>0:
                fake=fake-100
            if fake==0:
                answer+=1
                #print(str(j)+'!')
            elif fake>0 and fake<=50*value[2]:
                answer+=1
# print(str(answer)+'!')

#if a<=50*value[2]:
#    answer+=1
print(answer)     

Measured memory_bytes: 3188
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <math.h> // sqrt
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <iomanip> // setprecision
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<long long>;
using pii = pair<int, int>;
using psi = pair<string, int>;

int main() {
    int N, M;
    int MOD = 1000000007;
    cin >> N >> M;
    vb data(N + 1, true);
    for (int i = 0; i < M; i++) {
        int a;
        cin >> a;
        data.at(a) = false;
    }
    vi dp(N + 1, 0);
    dp.at(0) = 1;
    if (data[1]) {
        dp[1] = 1;
    }
    for (int i = 2; i < N + 1; i++) {
        if (data[i - 1]) {
            dp[i] += dp[i - 1];
        }
        if (data[i - 2]) {
            dp[i] += dp[i - 2];
        }
        dp[i] %= MOD;
    }
    cout << dp[N] << endl;
}

Measured memory_bytes: 3788
#include<iostream>
#include<string>
using namespace std;
int main() {
	string str;
	while (getline(cin, str)) {
		string st = str;
		string s[1000],h="";
		str += " ";
		int c = 0;
		for (int i = 0; i < str.length(); i++) {
			for (int j = i; j < str.length(); j++) {
				if (str[j] == '.' || str[j] == ' ') {
					if (h != "") {
						s[c] = h;
						h = "";
						c++;
					}
					i = j ;
					break;
				}
				else
					h += str[j];
			}
		}
		int w = 0;
		for (int i = 0; i < c; i++) {
			if (s[i].length() == 3 || s[i].length() == 4) {
				int t = (int)'t' - (int)s[i][0];
				string h = "t";
				for (int j = 1; j < s[i].length(); j++) {
					int u = t + (int)s[i][j];
					if (u > 'z') u -= 26;
					else if (u < 'a') u += 26;
					h += (char)u;
				}
				if (h == "the" || h == "that" || h == "this") {
					w = t;
					break;
				}
			}
		}
		string stri = "";
		for (int i = 0; i < st.length(); i++) {
			if (st[i] == ' ' || st[i] == '.')
				stri += st[i];
			else {
				int u;
				u = (int)st[i] + w;
				if (u > 'z') u -= 26;
				else if (u < 'a')u += 26;
				stri += (char)u;
			}
		}
		cout << stri << endl;
	}
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr int inf = 1<<30;
constexpr int mo = 1e9+7;
constexpr ll infl = 1ll<<60;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n;
    cin>>n;
    vector<pair<int,int>> E[100050];
    for(int i=0;i<n-1;++i){
        int a,b;ll c;
        cin>>a>>b>>c;
        a--;b--;
        E[a].push_back({b,c});
        E[b].push_back({a,c});
    }
    int Q,k;
    cin>>Q>>k;
    k--;
    queue<int> q;
    q.push(k);
    vector<ll> dist(n,infl);
    dist[k] = 0;
    while(!q.empty()){
        auto cur = q.front();q.pop();
        for(auto & v : E[cur]){
            if(dist[cur] + v.second < dist[v.first]){
                dist[v.first] = dist[cur] + v.second;
                q.push(v.first);
            }
        }
    }
    for(int i=0;i<Q;++i){
        int x,y;
        cin>>x>>y;
        x--;y--;
        cout << dist[x] + dist[y] << endl;
    }
    return 0;
}

Measured memory_bytes: 10572
#include <bits/stdc++.h>
#define int long long
#define uint unsigned int
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repr(i, a, b) for (int i = a; i >= b; i--)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define sz(a) (a).size()
#define pb(a) push_back(a)
#define eb(...) emplace_back(__VA_ARGS__)
#define mp(a, b) make_pair(a, b)
#define mt(...) make_tuple(__VA_ARGS__)
using namespace std;
using pii = pair<int, int>;
template <class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template <class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
constexpr int MOD = 1000000007;
constexpr int INF = 1LL << 30;
constexpr double EPS = 1e-10;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int A, B, C, K;
  cin >> A >> B >> C >> K;
  if (K & 1) cout << B - A << endl;
  else cout << A - B << endl;

  return 0;
}

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

typedef pair<int, int> edge;
#define to first
#define cost second

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

  int n, m, w;
  cin >> n >> m >> w;

  vector<int> in(n, 0);
  vector<vector<edge>> G(n);
  for(int i = 0; i < m; ++i) {
    int s, t, c;
    cin >> s >> t >> c;
    G[s].emplace_back(t, c);
    ++in[t];
  }

  const int abs_w = abs(w);

  vector<vector<int>> dp(n, vector<int>(abs_w, false));
  queue<int> que;

  for(int v = 0; v < n; ++v) {
    if(in[v] == 0) que.push(v);
  }

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

    for(int i = 0; i < abs_w; ++i) {
      if(dp[v][i]) {
	ans = max(ans, i - abs_w);
      }
    }

    for(const auto &e : G[v]) {
      for(int i = abs_w - 1 - e.cost; i >= 0; --i) {
	dp[e.to][i + e.cost] |= (i == 0 ? true : dp[v][i]);
      }

      if(--in[e.to] == 0) {
	que.push(e.to);
      }
    }
  }

  cout << (ans == INT_MIN ? "NA" : to_string(ans)) << endl;

  return 0;
}


Measured memory_bytes: 54588
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define INF 1234567890
#define pii pair<int,int>
#define LL long long
using namespace std;

int main () {
    //clock_t start = clock();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >> n;
    int a[n+5];
    for (int i=1;i<=n;i++) cin >> a[i];
    int ans = 0;
    for (int i=1;i<=n;i++) {
        for (int j=i+1;j<=n;j++) {
            for (int k=j+1;k<=n;k++) {
                if (a[i]+a[j] > a[k] && a[j]+a[k] > a[i] && a[i]+a[k] > a[j] && a[i] != a[j] && a[j] != a[k] && a[i] != a[k]) ans++;
            }
        }
    }
    cout << ans << endl;
    //cerr << fixed << setprecision(3) << (clock()-start)*1./CLOCKS_PER_SEC << endl;
    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;

#define pb push_back
#define mp make_pair
#define pf push_front
#define ff first
#define ss second
#define vll vector < ll >
#define vvll vector < vll >
#define vld vector < ld >
#define pll pair < ll,ll > 
#define ppll pair < ll, pll>
#define pld pair < ld,ld > 
#define vpll vector < pll >
#define vpld vector < pld >
#define all(X) X.begin(),X.end()
#define endl "\n"
#define sz(x) ((ll)((x).size()))
vll emptyVector;
const ll MAX = 2e5 + 5;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;

ll binaryExpo(ll x, ll n)
{
	if(n == 0)
		return 1;
	if(n % 2 == 0)
		return binaryExpo((x*x), n/2);
	return (x*binaryExpo((x*x), n/2));
}
const double pi = 3.141592653589793238462643383279502884197169399375105;
/*-------------------------------------------		CODE STARTS FROM HERE		------------------------------------------*/



void solve(void)
{
	int n;
	cin >> n;
	string s;
	cin >> s;
	int l = s.length();
	for(int i = 0; i < min(n, l); i++)
		cout << s[i];
	if(n < l)
		cout << "...";
	cout << endl;

}


int main(void)
{
	// ios_base::sync_with_stdio(false);
	// cin.tie(NULL);

	// int t;
	// cin >> t;
	// while(t--)
	{
		solve();
	}
	




	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define ss(x) (int) x.size()
#define fi first
#define se second
#define cat(x) cerr << #x << " = " << x << endl
#define rep(i, j, n) for (int i = j; i <= n; ++i)
#define per(i, j, n) for (int i = n; j <= i; --i)
#define all(x) x.begin(), x.end()
 
using namespace std;

const int mod = 2019;
const int nax = 2e5 + 100;

int pt(int a, int b) {
	if (!b) return 1;
	if (b&1) return a * pt(a, b - 1) % mod;
	return pt(a * a % mod, b / 2);
}

int n;
char s[nax];

int cnt[mod];

int main() {
	scanf ("%s", s + 1);
	n = strlen(s+1);
	cnt[0]++;
	int hasz = 0;
	int odw = -1;
	ll res = 0;
	
	rep(i, 1, 2019)
		if (i * 10 % mod == 1) {
			odw = i;
			break;
		}
	int f = odw;
	
	rep(i, 1, n) {
		hasz = (1LL * hasz * 10 + (s[i] - '0')) % mod;
		int x = 1LL * hasz * f % mod;
		res += cnt[x];
		cnt[x]++;
		f = f * odw % mod;
	}
	printf ("%lld\n", res);
	
	return 0;
}


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

#define EPS (1e-10)
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)

using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;

constexpr int MOD = 1000000007;

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

    int a, b, c;
    cin >> a >> b >> c;
    cout << (a + b + c <= 21 ? "win" : "bust") << endl;

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<queue>
#include<vector>
#include<map>
#include<cstdlib>
#include<string>
#include<algorithm>
#define mod 998244353;
using namespace std;
char c[25][25],s[25][25];
int n,d[25][25];
bool issub(int x)
{
	for(int i=0;i<n;i++)
	if(i!=x&&strstr(c[i],c[x])!=NULL)return true;
	return false;
}
int gdis(char a[],char b[])
{
	int n=strlen(a);
	int m=strlen(b);
	int ed=min(n,m);
	for(int i=ed;i>=0;i--)
	{
		bool flag=true;
		for(int j=0;j<i;j++)
		{
			if(a[n-i+j]!=b[j])
			{
				flag=false;
				break;
			}
		}
		if(flag) return i;
	 } 
	 return -1;
}
int len[25];
int dp[14][1<<14];
inline void Min(int &a,const int &b)
{
	if(a==-1||b<a)
	a=b;
}
int main()
{
	while(scanf("%d",&n),n)
	{
		for(int i=0;i<n;i++)
		scanf("%s",c[i]);
		int m=0;
		for(int i=0;i<n;i++)
		if(!issub(i))
		{
			strcpy(s[m],c[i]);
			m++;
	    } 
	    n=m;
	    for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
		if(i!=j)
		{
			d[i][j]=gdis(s[i],s[j]);
		}
		memset(dp,-1,sizeof(dp));
		for(int i=0;i<n;i++)dp[i][1<<i]=len[i]=strlen(s[i]);
		int ed=(1<<n)-1;
		for(int j=1;j<ed;j++)
		{
			for(int i=0;i<n;i++) 
			if(dp[i][j]!=-1)
			{
				for(int k=0;k<n;k++)
				if(!(j>>k&1))
				{
					Min(dp[k][j|(1<<k)],dp[i][j]+len[k]-d[i][k]);
				}
			}
		}
		int ans=-1;
		for(int i=0;i<n;i++)
		if(dp[i][ed]!=-1)
		Min(ans,dp[i][ed]);
		printf("%d\n",ans); 
	}
}

Measured memory_bytes: 4088
#include <bits/stdc++.h>
//#include <boost/array.hpp>
//#include <boost/range/numeric.hpp>
//#include <boost/range/algorithm.hpp>
//#include <boost/multiprecision/cpp_int.hpp>

#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
//using namespace boost::multiprecision;

constexpr long long INF = LLONG_MAX;
constexpr long long MOD = 1000000007;
constexpr long double PI = M_PI;

#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); ++i)
#define RFOR(i,n,r) for(ll i = (ll)(n-1); i >= r; --i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,n,0)
#define ALL(x) x.begin(),x.end()
#define CALL(x) x.cbegin(),x.cend()
#define RALL(x) x.rbegin(),x.rend()
#define CRALL(x) x.crbegin(),x.crend()

#define cout cout << fixed << setprecision(12)
#define dbglf cerr << '\n'

#define ACCM(arr) accumulate(ALL(arr),0LL)
#define Yes(ex) cout << ((ex) ? "Yes" : "No") << endl
#define YES(ex) cout << ((ex) ? "YES" : "NO") << endl

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using vi = vector<ll>;
using vvi = vector<vi>;
using vp = vector<pair<ll, ll>>;
using vs = vector<string>;
using vc = vector<char>;
using lst = list<ll>;
using pq = priority_queue<ll>;

template < typename T >
inline void veccin(vector<T>& v) {
    for (auto && e : v) { cin >> e; }
}

template < typename T >
inline void dbg(T a) { cerr << a << ' '; }

ll n, m, k;
ll ans = 0, sum = 0, cnt = 0;
//ld d;
string s/*1, s2, s3*/;
char c/*1, c2, c3*/;
bool flag = false;

/*--------------------template--------------------*/

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

    cin >> n>>k;
	vi a(n),tst,b(n,0);
	veccin(a);
	ll i = 1;
	while(k--){
    	//dbg(i);
    	tst.push_back(i);
    	b[i-1]++;
    	i = a[i-1];cnt++;
    	//auto it = find(ALL(tst),i);
      	if(b[i-1]){
          dbg(cnt);
          auto it = find(ALL(tst),i);
          sum=distance(tst.begin(),it);
          cnt-=sum;
          break;
        }
    	if(cnt==n){
        	//cout << tst
        }
    }
	//dbg(k);
	if(k==-1){cout<<i<<endl;return 0;}
	//for(auto&&e:tst){dbg(e);}
	/*dbg(cnt);
	dbglf;
	dbg(k);*/
	k%=cnt;
	/*dbg(k);
	dbglf;
	for(auto&&e:tst){dbg(e);}*/
	tst.erase(tst.begin(), tst.begin()+sum);
    cout << tst[(k%cnt)] << endl;
}


Measured memory_bytes: 8420
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;

struct LazySegmentTree{
private:
    int n;
    vector<ll> node,lazy;
public:
    LazySegmentTree(const vector<ll>& v){
        int sz=(int)v.size();
        n=1;
        while(n<sz)n*=2;
        node.resize(2*n-1);
        lazy.resize(2*n-1);
        for(int i=0;i<sz;i++){
            node[i+n-1]=v[i];
        }
        for(int i=n-2;i>=0;i--){
            node[i]=node[2*i+1]+node[2*i+2];
        }
    }
    void eval(int k,int l,int r){
        if(lazy[k]!=0){
            node[k]+=lazy[k];
            if(r-l>1){
                lazy[2*k+1]+=lazy[k]/2;
                lazy[2*k+2]+=lazy[k]/2;
            }
        }
        lazy[k]=0;
    }
    void update(int a,int b,ll x,int k=0,int l=0,int r=-1){
        if(r==-1)r=n;
        eval(k,l,r);
        if(b<=l||r<=a)return;
        if(a<=l&&r<=b){
            lazy[k]=x*(r-l);
            eval(k,l,r);
        }
        else{
            update(a,b,x,2*k+1,l,(l+r)/2);
            update(a,b,x,2*k+2,(l+r)/2,r);
            node[k]=node[2*k+1]+node[2*k+2];
        }
    }
    ll get(int a,int b=-1,int k=0,int l=0,int r=-1){
        if(b==-1)b=a+1;
        if(r==-1)r=n;
        eval(k,l,r);
        if(b<=l||r<=a)return 0;
        if(a<=l&&r<=b){
            return node[k];
        }
        else{
            return get(a,b,2*k+1,l,(l+r)/2)+get(a,b,2*k+2,(l+r)/2,r);
        }
    }
};

int main(){
    int n,d,a;
    cin>>n>>d>>a;
    pair<ll,int> mon[n];
    for(int i=0;i<n;i++){
        int x,h;
        cin>>x>>h;
        mon[i]={x,h};
    }
    sort(mon,mon+n);
    int r[n];
    for(int i=0;i<n;i++){
        ll x=mon[i].first;
        auto it=upper_bound(mon,mon+n,make_pair(x+2*d,INF));
        r[i]=it-mon;
    }
    vector<ll> v(n);
    for(int i=0;i<n;i++){
        v[i]=mon[i].second;
    }
    LazySegmentTree seg(v);
    ll ans=0;
    for(int i=0;i<n;i++){
        ll h=seg.get(i);
        if(h<=0)continue;
        ll c=(h+a-1)/a;
        ans+=c;
        seg.update(i,r[i],-c*a);
    }
    cout<<ans<<endl;
}

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

using namespace std;
using ll = long long;

int main() {
    int n;
    cin>>n;
    vector<int> uma(n);
    vector<int> ama(3,0);
    vector<vector<int>> hon(3);
    for(int i = 0;i < n;++i) {
        cin>>uma[i];
        ++ama[uma[i]%3];
        hon[uma[i]%3].emplace_back(uma[i]);
    }
    sort(hon[0].begin(),hon[0].end());
    sort(hon[1].begin(),hon[1].end());
    sort(hon[2].begin(),hon[2].end());

    int a=ama[0];
    int b=ama[1];
    int c=ama[2];

    int ans=0;
    if(b==0&&c==0) {
        cout<<1<<endl;
    }
    else if(b==c||b+1==c||c+1==b) {

        cout<<n<<endl;
    }
    else if(b+3<=c) {
        ans+=a;
        ans+=b;
        for(int i = 0;i < b+3;++i) {
            ans++;
        }
        cout<<ans<<endl;
    }
    else {
        ans+=a;
        ans+=c;
        for(int i = 0;i < min(b,c+3);++i) {
            ans++;
        }
        cout<<ans<<endl;
    }
    return 0;
}



Measured memory_bytes: 7000
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vll vector <pll>
#pragma 03
using namespace std;
ll ac[100005][3];
ll dp[100005][3];
int main(){
	for (int i = 0; i<100005; i++){
		for (int j = 0; j<3; j++) dp[i][j] = 0;
	}
	ll n;
	cin >> n;
	for (int i = 0; i<n; i++){
		for (int j = 0; j<3; j++) cin >> ac[i][j];
	}
	for (int i = 0; i<3; i++) dp[0][i] = ac[0][i];
	for (int i = 1; i<n; i++){
		for (int j = 0; j<3; j++){
			for (int k = 0; k<3; k++){
				if (k != j) dp[i][k] = max(dp[i][k], dp[i-1][j] + ac[i][k]); 
			}
		}
	}
	ll mx = 0;
	for (int i = 0; i<3; i++) mx = max(mx, dp[n-1][i]);
	cout << mx << endl;
	return 0;
}
 


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

int main() {
	int A, B, M;
	cin >> A >> B >> M;
	vector<int>a(A), b(B), a1, b1;
	for (int i = 0; i < A; i++)cin >> a[i];

	for (int i = 0; i < B; i++)cin >> b[i];

	a1 = a;
	b1 = b;
	sort(a1.begin(), a1.end());

	sort(b1.begin(), b1.end());
	int mn = a1[0] + b1[0];

	for (int i = 0; i < M; i++) {
		int s, f, t;
		cin >> s >> f >> t;
		mn = min(mn, a[s - 1] + b[f - 1] - t);
	}
	cout << mn << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int n,m;
vector<vector<int> >g;
vector<int> vis;
int dfs(int node){
    vis[node] = 0;
    for(int i=0;i<g[node].size();i++){
        if(vis[g[node][i]] != -1){
            vis[node] = max(vis[node],1+vis[g[node][i]]);
            continue;
        }
        vis[node] = max(vis[node],1+dfs(g[node][i]));
    }
    return vis[node];
}
int main(){
    cin>>n>>m;
    int x,y;
    g.resize(n+1);
    vis.resize(n+1,-1);
    for(int i=0;i<m;i++)
    {
        cin>>x>>y;
        g[x].push_back(y);
    }
    for(int i=1;i<=n;i++)
    {
        if(vis[i] == -1){
            dfs(i);
        }
    }
    int ans;
    for(int i=1;i<=n;i++)
        ans = max(ans,vis[i]);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 8192
#include <iostream>
#include <string.h>
using namespace std;

int main() {
  	int N,i,temp;
  	string S,OUT;
  	cin >> N >> S;
	temp = S[0];
  	for(i=1; i<=N; i++){
    	if(temp != S[i]){
        	OUT += temp;
          	temp = S[i];
        }
    }
  	cout << OUT.length() << endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = double;
using P = pair<ld,ld>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using T = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define prt(v) cout<<v<<"\n";
#define fi(v) get<0>(v)
#define se(v) get<1>(v)
#define th(v) get<2>(v)
#define endl "\n"
template <typename T> bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=998244353;

ll N,M,R;
vector<vector<ll>> d(205, vector<ll>(205, INF));
vector<ll> r(8,0);


signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    cin >> N;
    cin >> M;
    cin >> R;
    for(ll i=0;i<R;++i){cin>>r[i];r[i]--;}
    vector<ll> A(M,0);
    vector<ll> B(M,0);
    vector<ll> C(M,0);
    for(ll i=0;i<M;++i){cin>>A[i]>>B[i]>>C[i];A[i]--;B[i]--;}

    //ワーシャルフロイド法
    for(ll i=0;i<M;++i){
        d[A[i]][B[i]]=C[i];d[B[i]][A[i]]=C[i];
    }
    for(ll i=0;i<N;++i)d[i][i]=0;
    for(ll i=0;i<N;++i)
            for(ll j=0;j<N;++j)
                for(ll k=0;k<N;++k)chmin(d[j][k],d[j][i]+d[i][k]);
    vector<ll> zyun(R,0);
    iota(zyun.begin(), zyun.end(), 0);
    ll ans=INF;
    do{
        ll sum=0;
        for(ll i=0;i<R-1;++i){
            sum+=d[r[zyun[i]]][r[zyun[i+1]]];
        }
        chmin(ans,sum);
    }while(next_permutation(zyun.begin(), zyun.end()));
    prt(ans)

    


    return 0;
}


Measured memory_bytes: 1024
import sys
import math
input = sys.stdin.readline

def main():
    N, H = map(int, input().split())
    b = [0] * N
    a_max = 0
    for i in range(N):
        t1, t2 = map(int, input().split())
        a_max = max(a_max, t1)
        b[i] = t2

    b = sorted(b, reverse=True) # bの降順ソート

    count = 0
    for i in range(N):
        if H > 0 and b[i] > a_max: # H > 0 で a_maxより大きいb[i]がある間、投げつける
            H -= b[i]
            count += 1
        else:
            break
    if H > 0:
        count += math.ceil(H/a_max) # 残りの H を振って攻撃(切り上げ)
    print(count)

if __name__ == "__main__":
    main()


Measured memory_bytes: 42716
#include <bits/stdc++.h>
 
using namespace std;
 
#define MAX 1010
typedef unsigned long long ull;
 
int N,M,P,Q;
char field[MAX][MAX],pattern[MAX][MAX];
ull hash[MAX][MAX],tmp[MAX][MAX];
 
void compute_hash(char a[MAX][MAX],int n,int m){
    const ull B1 = 63533;
    const ull B2 = 100007;
    
    ull t1 = 1;
    for(int j = 0 ; j < Q ; j++) t1 *= B1;
    
    for(int i = 0 ; i < n ; i++){
        ull e = 0;
        for(int j = 0 ; j < Q ; j++) e = e * B1 + a[i][j];
        for(int j = 0 ; j + Q <= m ; j++){
            tmp[i][j] = e;
            if(j + Q < m) e = e * B1 - t1 * a[i][j] + a[i][j+Q]; 
        }
    }
    
    ull t2 = 1;
    for(int i = 0 ; i < P ; i++) t2 *= B2;
    
    for(int j = 0 ; j + Q <= m ; j++){
        ull e = 0;
        for(int i = 0 ; i < P ; i++) e = e * B2 + tmp[i][j];
      
        for(int i = 0 ; i + P <= n ; i++){
            hash[i][j] = e;
            if(i + P < n) e = e * B2 - t2 * tmp[i][j] + tmp[i+P][j];
        }
    }
}
  
void solve(){
    compute_hash(pattern, P, Q);
    ull res = hash[0][0];
    compute_hash(field, N, M);
    for(int i = 0 ; i <= N ; i++){
        for(int j = 0 ; j <= M ; j++){
            if(res == hash[i][j]){
                cout << i << " " << j << endl;
            }
        }
    }
}
 
int main(){
    cin >> N >> M;
    for(int i = 0 ; i < N ; i++){
        for(int j = 0 ; j < M ; j++){
            cin >> field[i][j];
        }
    }
    cin >> P >> Q;
    for(int i = 0 ; i < P ; i++){
        for(int j = 0 ; j < Q ; j++){
            cin >> pattern[i][j];
        }
    }
    if(N < P && M < Q) return 0;
    solve();
    return 0;
}

Measured memory_bytes: 18584
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

int main()
{
    const int mod = 1000000007;
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    for (int i = 0; i < h; i++) { cin >> s[i]; }
    vector<vector<int>> d(h, vector<int>(w, 0));
    d[0][0] = 1;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (s[i][j] == '#') continue;
            if (i == 0 && j == 0) continue;
            if (i == 0)
                d[i][j] = d[i][j - 1] % mod;
            else if (j == 0)
                d[i][j] = d[i - 1][j] % mod;
            else
                d[i][j] = (d[i - 1][j] + d[i][j - 1]) % mod;
        }
    }
    cout << d[h - 1][w - 1] << endl;

    return 0;
}

Measured memory_bytes: 5760
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <climits>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <functional>
#include <set>
#include <numeric>
#include <stack>
#include <utility>
#include <time.h>
#include <iterator>
//#include "util.h"

using namespace std;
typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vint;
typedef vector<ll> vll;

//呪文
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const pair<_KTy, _Ty>& m) { cout << "{" << m.first << ", " << m.second << "}"; return ostr; }
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const map<_KTy, _Ty>& m) { if (m.empty()) { cout << "{ }"; return ostr; } cout << "{" << *m.begin(); for (auto itr = ++m.begin(); itr != m.end(); itr++) { cout << ", " << *itr; } cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const vector<_Ty>& v) { if (v.empty()) { cout << "{ }"; return ostr; }	cout << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const set<_Ty>& s) { if (s.empty()) { cout << "{ }"; return ostr; } cout << "{" << *(s.begin()); for (auto itr = ++s.begin(); itr != s.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
#define PI 3.14159265358979323846
#define EPS 1e-8
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define all(x) (x).begin(), (x).end()
	


int main() {
	int N, A, B;
	cin >> N >> A >> B;
	cout << min(N * A, B) << endl;

	return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
S = input()[: -1]
dp = [0] * (len(S) + 1)
dp[0] = 1
for i in range(len(S)):
  if i + 5 <= len(S):
    if S[i: i + 5] == "dream": dp[i + 5] += dp[i]
    if S[i: i + 5] == "erase": dp[i + 5] += dp[i]
  if i + 7 <= len(S):
    if S[i: i + 7] == "dreamer": dp[i + 7] += dp[i]
  if i + 6 <= len(S):
    if S[i: i + 6] == "eraser": dp[i + 6] += dp[i]
if dp[-1]: print("YES")
else: print("NO")

Measured memory_bytes: 41200
#include <iostream>
using namespace std;
int main(void)
{
	for (;;)
	{
		int a,b,c,d;
		cin>>a;
		if (a==0)
		{
			break;
		}
		d=0;
		for (b=0;b<9;b++)
		{
			cin>>c;
			d=d+c;
		}
		b=a-d;
		cout<<b<<endl;
	}
	return 0;
}

Measured memory_bytes: 3004
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define st string
#define ve(i) vector<i>
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define each(i, n) for(auto&& i: n)

int main() {
  int N;
  st S, a = "Yes";
  cin >> N >> S;
  if(S.size() % 2 == 0) {
    rep(i, N / 2) {
      if(S.at(i) != S.at(i + N / 2)) {
        a = "No";
      }
    }
  }
  else {
    a = "No";
  }
  cout << a << endl;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
string s;
int main(){
  cin >> s;
  if( s.size() >= 4 && s[0] == 'Y' && s[1] == 'A' &&
      s[2] == 'K' && s[3] == 'I' ){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define rrep(i,n) for(int i=(int)n-1;i>=0;--i)
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T& a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U& u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U& u,const V... v){for(auto& e:u)fill_v<T>(e,v...);}

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

    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    ll now = 1000;
    rep(i, n-1) {
        if (a[i] < a[i+1]) {
            ll x = now / a[i];
            now %= a[i];
            now += x * a[i+1];
        }
    }
    cout << now << endl;
}


Measured memory_bytes: 3600
#include<iostream>
#include<iomanip>
#include<cassert>
#include<math.h>
#include<complex>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

ll N;
ll A[2010];
ll dp[2010][2010];
P p[2010];
int main(){
    cin>>N;
    for(ll i=0;i<N;i++){
        cin>>p[i].first;
        p[i].second=i;
    }
    sort(p,p+N,greater<P>());
    for(ll i=0;i<N;i++){
        for(ll j=0;j<=N;j++){
            dp[i][j]=-INF;
        }
    }
    dp[0][0]=0;
    for(ll i=0;i<N;i++){
        for(ll l=0;l<N;l++){
            dp[i+1][l+1]=max(dp[i+1][l+1],dp[i][l]+p[i].first*abs(p[i].second-l));
            ll r=i-l;
            dp[i+1][l]=max(dp[i+1][l],dp[i][l]+p[i].first*abs(p[i].second-(N-1-r)));
        }
    }
    ll ans=0;
    for(ll i=0;i<=N;i++){
        ans=max(ans,dp[N][i]);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 35092
#include<bits/stdc++.h>
using namespace std;
long long a[100002],b[100002];
int n;
vector<pair<long long,pair<long long,long long> > >v;
int main(){
	cin>>n;
	unsigned long long s1=0;
	unsigned long long s2=0;
	long long diff=0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		s1+=a[i];
	}
	for(int i=1;i<=n;i++){
		cin>>b[i];
		s2+=b[i];
	}
	if(s1<s2){
		cout<<-1;
		return 0;
	}
	for(int i=1;i<=n;i++){
		if(a[i]==b[i])
			continue;
		if(a[i]<b[i]){
			diff+=b[i]-a[i];
		}
		else{
			v.push_back(make_pair(a[i]-b[i],make_pair(a[i],b[i])));
		}
	}
	//cout<<diff<<endl;
	if(diff==0){
		cout<<0;
		return 0;
	}
	sort(v.begin(),v.end());
	for(int i=v.size()-1;i>=0;i--){
		diff-=v[i].first;
		//cout<<diff<<endl;
		(v[i].second).first=(v[i].second).second;
		if(diff<=0){
			//cout<<i<<endl;
			break;
		}
	}
	int ans=n-v.size();
	//cout<<ans<<endl;
	for(int i=0;i<v.size();i++){
		if((v[i].second).first==(v[i].second).second)
			ans++;
	}
	cout<<ans;
	
}

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

signed main(){
    // cout << fixed << setprecision(10) << flush;

    string s;
    cin >> s;
    int K;
    cin >> K;
    K--;

    set<string> ans = {"zzzzz"};
    for(int i=0; i<s.size(); i++){
        for(int l=1; l<=5 && i+l<=s.size(); l++){
            string sbst = s.substr(i, l);
            auto itr = ans.end();
            itr--;
            if(*itr > sbst){
                ans.insert(sbst);
                if(ans.size() > 5){
                    ans.erase(itr);
                }
            }
        }
    }
    auto itr = ans.begin();
    for(int i=0; i<K; i++){
        itr++;
    }
    cout << *itr << endl;
    return 0;
}

Measured memory_bytes: 3648
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
// #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
// #define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_);

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<unordered_map>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-11;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 11100000;
const int UF_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	inline long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ

int main(){
	long long a;
	double b;
	scanf("%lld%lf",&a,&b);
	int B=100*(b+0.005);
	a*=B;
	a/=100;
	printf("%lld\n",a);
}

Measured memory_bytes: 1748
string solve(long a, long b, long c){
	return (a+b>=c)? "Yes": "No";
}
void main(){
	long a, b, c;
	readf("%d %d %d\n", &a, &b, &c);
	solve(a, b, c).writeln();
}
     
import std.stdio, std.conv, std.algorithm, std.numeric, std.string, std.math, std.range;
const long mod = 10^^9+7;      
// 1要素のみの入力
T inelm(T= int)(){
	return to!(T)( readln().chomp() );
}
     
// 1行に同一型の複数入力
T[] inln(T = int)(){
	T[] ln;
	foreach(string elm; readln().chomp().split())ln ~= elm.to!T();
	return ln;
}


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

int main(){
    int N; cin >> N;
    vector<int> V;
    for (int i = 0; i < N; i++)
    {
        int v; cin >> v;
        V.push_back(v);
    }
    sort(V.begin(), V.end());
    double ans = V[0];
    for (int i = 1; i < N; i++)
    {
        ans = (ans + V[i])/2.0;
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 256
qqq = list(input())
List_R = []
if qqq[0] == "o":
    List_R.append(1)
if qqq[1] == "o":
    List_R.append(1)
if qqq[2] == "o":
    List_R.append(1)
print(700+len(List_R*100))

Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define all(c) begin(c),end(c)
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
//最大公約数
ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}
//最小公倍数
ll lcm(ll x, ll y) {
  return x/gcd(x, y)*y;
}
//素因数分解
vector<pair<ll,int>> factorize(ll n) {
  vector<pair<ll,int>> res;
  for (ll i = 2; i*i <= n; ++i) {
    if (n%i) continue;
    res.emplace_back(i,0);
    while (n%i == 0) {
      n /= i;
      res.back().second++;
    }
  }
  if (n != 1) res.emplace_back(n,1);
  return res;
}
 
 
 ll mod=998244353;
 
int main() {

  int x,y;
  cin>>x>>y;

  int t,s;
  
  for(s=0;s<=x;s++){
    t=x-s;
    int y2=4*s+2*t;
    if(y2==y){
      cout<<"Yes";
      return 0;
    }

  }
  cout<<"No";


}



Measured memory_bytes: 3628
#include<stdio.h>
#define MAX 100000

int A[MAX], n;

int partition( int p, int r ) {
  int x, i, j, tmp;
  x = A[r];
  i = p - 1;
  for ( j = p; j < r; j++ ) {
    if ( A[j] <= x ) {
      i++;
      tmp = A[i]; A[i] = A[j]; A[j] = tmp;
    }
  }
  tmp = A[i + 1]; A[i + 1] = A[r]; A[r] = tmp;
  return i + 1;
}

int main() {
  int i, q;

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

  q = partition(0, n - 1);

  for ( i = 0; i < n; i++ ) {
    if ( i ) printf(" ");
    if ( i == q ) printf("[");
    printf("%d", A[i]);
    if ( i == q ) printf("]");
  }
  printf("\n");

  return 0;
}


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define ff first
#define mp make_pair
#define ss second
#define rep(i,a,b) for(int i = a; i < b; i++)
#define repp(i,a,b) for(int i = a; i <= b; i++)
#define endl '\n'
#define mod 1000000007
#define mod_in(a) bin(a, mod - 2)
#define fact(n) rep(i, 1, n+1) ft.pb((ft[i-1] * i) % mod)
#define ncr(n, r) (n >= r ? ((ft[n] * mod_in((ft[r] * ft[(n)-(r)]) % mod)) % mod) : 0LL)
#define pi 3.14159265358979323
#define INF 1e15
#define lb(v, a) lower_bound(v.begin(), v.end(), a)
#define ub(v, a) upper_bound(v.begin(), v.end(), a)

int power(int x, int n){
    int res=1;
    while(n>0){
        if(n&1)
            res=res*x;
        x*=x;
        n>>=1;
    }
    return res;
}

int bin(int x, int n){
    int res=1; x%=mod;
    while(n){
        if(n&1) res=(res*x)%mod;
        x=(x*x)%mod;
        n>>=1;
    }
    return res;
}

bool prime(int n){
    if(n==3)return 1;
    repp(i,2,sqrt(n)){
        if(n%i==0)return 0;
    }
    return 1;
}


// vector<int> adj[2000005];
// vector<int> pr(2000005, 1), xx[2000005];
// void sieve(int n){ 
//     for(int p=2; p<n; p++){ 
//         if(pr[p]){ 
//             for(int i=p; i<n; i += p){
//                 pr[i]=0;
//                 xx[i].pb(p);
//             }
//         } 
//     } 
// }  
// vector<int> ft(40);

int n, ww;
int w[101], v[101];
 int dp[101][100001];

int fun(int ind, int n, int weight, int dp[][100001]){
    if(weight < 0 or ind ==n) return 0;
    if(dp[ind][weight] != -1) return dp[ind][weight];
    int ans1, ans2;
    if(weight >= w[ind]) ans1 = v[ind] + fun(ind+1, n, weight - w[ind], dp);
    else ans1 = fun(ind +1, n, weight, dp);
    ans2 = fun(ind+1, n, weight, dp);
    return dp[ind][weight] = max(ans1, ans2);
}

void solve(){
    cin>>n>>ww;
    rep(i,0,n)rep(j,0,ww+1) dp[i][j]=-1;
    rep(i,0,n){
        cin>>w[i]>>v[i];
    }
    cout<<fun(0, n, ww, dp)<<endl;
}

signed main(){
    fast
    int t=1;
    // cin>>t;
    while(t--) solve();
}

Measured memory_bytes: 81720
using System;

class Program
{
    static void Main()
    {
        int ss = int.Parse(Console.ReadLine());
        int h = ss/(60*60);
        int m = ss%(60*60)/60;
        int s = ss%(60*60)%60;
        
        Console.WriteLine(string.Format("{0}:{1}:{2}", h, m, s));
    }
}


Measured memory_bytes: 9180
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
int main(){
    ll h,w,d,A[301][301],q;
    cin>>h>>w>>d;
    map<int,pair<int,int>> B;
    ll C[d][h*w/d+1];
    rep(i,h)rep(j,w) cin>>A[i][j],B[A[i][j]]=make_pair(i,j);
    rep(i,d)rep(j,(h*w-i)/d+1){
        if(j==0) C[i][j]=0;
        else C[i][j]=C[i][j-1]+abs(B[i+d*(j-1)].first-B[i+d*j].first)+abs(B[i+d*(j-1)].second-B[i+d*j].second);
    }
    cin>>q;
    rep(i,q){
        int a,b;
        cin>>a>>b;
        cout<<C[b%d][b/d]-C[a%d][a/d]<<endl;
    }
}

Measured memory_bytes: 8192
n = input()
s = input()

def count(s, k):
    c, needs = 0, 0
    for i in s:
        if i != k:
            if c <= 0:
                needs += 1
            else:
                c -= 1
        else:
            c += 1
    return needs

l = count(s, '(')
r = count(s[::-1], ')')
print('('*l + s + ')'*r)


Measured memory_bytes: 2940
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	sc.Scan()
	k, _ := strconv.Atoi(sc.Text())

	hl := make([]int, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		h, _ := strconv.Atoi(sc.Text())
		hl[i] = h
	}

	sort.Ints(hl)

	ans := 9999999999
	for i := 0; i <= n-k; i++ {
		if d := hl[i+k-1] - hl[i]; d < ans {
			ans = d
		}
	}

	fmt.Println(ans)
}


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

#define REP(i, a, b) for (int i = a; i < b; ++i)
#define MOD 1000000007
#define nline cout << "\n";
#define PB push_back
#define MP make_pair
#define F first
#define S second
typedef long long int lli;
typedef vector<int> vi;
typedef vector<lli> vlli;

typedef pair<int, int> pi;
typedef pair<lli, lli> plli;

typedef vector<pi> vpii;
typedef vector<plli> vplli;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    // cin >> t;

    while (t--)
    {
        int a;
        cin >> a;
        cout << a + a * a + a * a * a;
    }

    return 0;
}


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

int main(){
  long long a,b,c,x,y,ans=0;cin>>a>>b>>c>>x>>y;
  if(a+b<c*2) ans=a*x+b*y;
  else{
    ans+=c*2*min(x,y);
    if(x>y){
      if(a>c*2) ans+=c*2*(x-y);
      else ans+=a*(x-y);
    }else{
      if(b>c*2) ans+=c*2*(y-x);
      else ans+=b*(y-x);    
    }
  }
  cout<<ans;
}

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

#define ll long long
#define mod 1000000007
#define ffor(i,a,b) for(int i=a;i<b;i++)
#define bfor(i,a,b) for(int i=a-1;i>=b;i--)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define mem(x,y) memset(x,y,sizeof(x))
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sz(x) (int)x.size()
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define PI 3.1415926535
#define lb lower_bound
#define ub upper_bound
#define bs binary_search

int main()
{
    int n;
    cin>>n;
    ll a[n];
    ffor(i,0,n) cin>>a[i];
    ll ans[n];
    ll sum=0;
    ffor(i,0,n) sum+=a[i];
    ffor(i,0,n-1)
    {
        sum-=2*a[i];
        i++;
    }
    ans[n-1]=sum;
    ans[0]=2*a[n-1]-sum;
    ffor(i,1,n-1)
    {
        ans[i]=2*a[i-1]-ans[i-1];

    }
    ffor(i,0,n) cout<<ans[i]<<" ";
    return 0;
}


Measured memory_bytes: 2816
#include<queue>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#define ll long long
#define inf 0x3f3f3f3f
using namespace std;
inline int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9')
    {
        if(ch=='-')f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9')
    {
        x=x*10+ch-'0';
        ch=getchar();
    }
    return x*f;
}
const int N=1e5+10;
ll a[N];
int main()
{
    int n=read(),l=read(),t=read();
    ll tmp,cnt=0;
    int d;
    for(int i=0;i<n;i++){
        tmp=read();d=read();
        if(d==1){
            a[i]=(tmp+t)%l;
            cnt+=(tmp+t)/l;
        }else{
            a[i]=(tmp-t)%l;
            cnt+=(tmp-t)/l;
            if(a[i]<0)  a[i]+=l,cnt--;
        }
    }
    sort(a,a+n);
    cnt=(cnt%n+n)%n;
    for(int i=cnt;i<n;i++) printf("%d\n",a[i]);
    for(int i=0;i<cnt;i++) printf("%d\n",a[i]);
    return 0;
}


Measured memory_bytes: 1920