akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

vector <vector <ll>> graph(1e5+1, vector<ll>());
vector <vector<ll>> visited(2, vector<ll>(1e5+1, -1));

ll d = 1e9 + 7;
ll calc(bool black, ll node, ll parent){
    if (visited[black][node] != -1){
        return visited[black][node];
    }
    ll ret = 1;
    for (auto next: graph[node]){
        if (next == parent){
            continue;
        }
        ll bai = 0;
        bai += calc(false, next, node);
        if (!black){
            bai += calc(true, next, node);
        }
        bai %= d;
        ret *= bai;
        ret %= d;
    }
    visited[black][node] = ret;
    return ret;
}
int main(void){
    ll n; cin >> n;
    REP(i, n-1){
        ll a; cin >> a; ll b; cin>> b;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    graph[0].push_back(1);
    cout << calc(false, 0, -1) << endl;
    return 0;
}

Measured memory_bytes: 15600
import sys
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush

sys.setrecursionlimit(10**6)
INF = 10**20

def mint():
    return map(int,input().split())
def lint():
    return map(int,input().split())
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])

S = input()
N = len(S)
for i in range(1,N//2):
    if S[:N//2-i]==S[N//2-i:N-2*i]:
        print(N-2*i)
        exit()

Measured memory_bytes: 65052
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#define INF 100000000000
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define LOOP(i,N) for(int i=0;i<N;i++)
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
// #define int long long
/* define/include */

int main(){
  string S;
  cin >> S;
  string T;
  cin >> T;
  string A;
  int Sl = S.length();
  int Tl = T.length();
  int F;
  F=1;
  for(int i=Sl-Tl;i>=0;i--){
    F=0;
    for(int j=Tl-1;j>=0;j--){
      if(S[i+j]==T[j] || S[i+j]=='?')F=0;
      else{
        F=1;break;
      }
    }
    if(F==0){
      for(int j=0;j<Tl;j++){
        S[i+j]=T[j];
      }
      break;
    }
  }
  if(F==1){
    cout << "UNRESTORABLE" << endl;
  }else{
    for(int i=0;i<Sl;i++){
      if(S[i]=='?')S[i]='a';
    }
    cout << S << endl;
  }

}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int checked[31];
int main() {
	int r;
	for(int i=0;i<28;i++){
		cin >> r;
		checked[r]=1;
	}
	for(int i=1;i<=30;i++){
		if(checked[i]==0)
			cout << i << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<algorithm>
using namespace std;
typedef pair<int, int> P;
static const int MAX_H = 50;
static const int MAX_W = 50;
static const int INF = 1 << 29;
int H, W;
vector<string> s(MAX_H);

int dist[MAX_H][MAX_W];
int dx[] = {1, 0, -1, 0}; int dy[] = {0, 1, 0, -1};

int bfs(){
	queue<P> que;
	fill(dist[0], dist[H], INF);
	que.push(P(0, 0));
	dist[0][0] = 0;
	for(; !que.empty(); ){
		P p = que.front(); que.pop();
		if(p.first == H - 1 && p.second == W - 1) break;
		for(int i = 0; i < 4; i++){
			int nx = p.first + dx[i], ny = p.second + dy[i];
			if(nx < 0 || nx >= H || ny < 0 || ny >= W) continue;
			if(s[nx][ny] == '.' && dist[nx][ny] == INF){
				que.push(P(nx, ny));
				dist[nx][ny] = dist[p.first][p.second] + 1;
			}
		}
	}
	return dist[H - 1][W - 1];
}
int main(){
	cin >> H >> W;
	for(int i = 0; i < H; i++){
		string input;
		cin >> input;
		s[i] = input;
	}
	int cnt = 0;
	for(int i = 0; i < H; i++){
		for(int j = 0; j < s[i].length(); j++){
			if(s[i][j] == '.') cnt++;
		}
	}
	if(bfs() == INF) cout << -1 << endl;
	else cout << cnt - (bfs() + 1) << endl;
	return 0;
}

Measured memory_bytes: 256
/*
क्षमाशील हो रिपु-समक्ष
तुम हुये विनत जितना ही
दुष्ट कौरवों ने तुमको
कायर समझा उतना ही।
*/
#include<bits/stdc++.h>
using namespace std;
 
#define int                 long long int
#define ull                 unsigned int
#define ld                  long double
#define pb                  push_back
#define ff                  first
#define ss                  second
#define S(arr)              sort(arr.begin(),arr.end());
#define all(p)              p.begin(), p.end()
#define RS(arr)             sort(arr.rbegin(),arr.rend());
#define R(arr)              reverse(arr.begin(),arr.end());
#define pii                 pair <int, int>
#define vpi                 vector <pii>
#define vi                  vector <int>
#define vld                 vector <ld>
#define vvi                 vector <vector <int>>
#define vs                  vector <string>
#define si                  set <int>
#define spi                 set <pii>
#define setbits(x)          __builtin_popcountll(x)
#define zrobits(x)          __builtin_ctzll(x)
#define mii                 map <int, int>
#define mci                 map<char, int>
#define mpi                 map <pii, int>
#define T                   int tcf;cin>>tcf;while(tcf--)
#define que_max(t)          priority_queue <t>
#define que_min(t)          priority_queue <t, vector<t>, greater<t>>
#define endl                "\n"
#define dba(a, l, r)        for(auto x:a)cout<<x<<" ";cout<<endl;
#define db1(x)              cout << #x " = " << x << endl;
#define db2(x,y)            cout << #x " = " << x << " " << #y " = " << y << endl;
#define db3(x,y,z)          cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << endl;
#define db4(x,y,z,w)        cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << " " << #w " = " << w << endl;
#define db5(x,y,z,w,v)      cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << " " << #w " = " << w << " " << #v " = " << v << endl;
#define db6(x,y,z,w,v,a)    db3(a, y, x)db3(w, v, a)
#define p2d(v)              for(auto a:v){for(auto b:a)cout<<b<<" ";cout<<endl;}
#define p1d(v)              for(auto a:v)cout<<a<<" ";cout<<endl;
#define ppi(v)              for(auto a:v)cout<<a.ff<<" "<<a.ss<<endl;

// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;  
// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
//  // *( hsh.find_by_order(k) ) kth smallest, from 0
//  // hsh.order_of_key(k) num of ele str less than k
//  // change less to less_equal for multiset pbds
 
void read(int n=10){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout<<setprecision(n)<<fixed;
    // #ifndef ONLINE_JUDGE
    //      freopen("input.txt",  "r",  stdin);
    //      freopen("output.txt", "w", stdout);
    // #endif
}
 
int M = 1e9 + 7;
int M1 = 998244353;
#define qqq 4000005
#define pi 3.14159265358979323851



int32_t main(){
    read();
    ld n;
    cin>>n;
    cout<<(n/3.0)*(n/3.0)*(n/3.0);
}  

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include <unordered_map>  
#include <algorithm>
#include <functional>
#include <map>
#include <string>
#include <sstream>
#include <cmath>
#include <float.h>
using namespace std;

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

Measured memory_bytes: 256
import sys
import numpy as np
import numba
from numba import njit
i8 = numba.int64

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

@njit((i8, ), cache=True)
def popcount(n):
    ret = 0
    while n:
        ret += n & 1
        n >>= 1
    return ret


@njit((i8, ), cache=True)
def f(n):
    t = 0
    while n:
        t += 1
        n %= popcount(n)
    return t

@njit((i8[:], ), cache=True)
def main(X):
    N = len(X)
    popX = X.sum()
    MOD1 = popX + 1
    MOD2 = popX - 1
    if popX == 1:
        MOD2 = 1
    pow1 = np.ones_like(X)
    pow2 = np.ones_like(X)
    for n in range(1, N):
        pow1[n] = 2 * pow1[n - 1] % MOD1
        pow2[n] = 2 * pow2[n - 1] % MOD2

    X1, X2 = 0, 0
    for x in X:
        X1 = (2 * X1 + x) % MOD1
        X2 = (2 * X2 + x) % MOD2

    ans = np.empty(N, np.int64)
    for i in range(N):
        x = X[N - 1 - i]
        if x == 0:
            nxt = (X1 + pow1[i]) % (popX + 1)
            ans[i] = 1 + f(nxt)
        elif x == 1:
            if popX == 1:
                ans[i] = 0
            else:
                nxt = (X2 - pow2[i]) % (popX - 1)
                ans[i] = 1 + f(nxt)
    return ans[::-1]

N = int(readline())
X = np.array(list(read().rstrip()), np.int64) - ord('0')
ans = main(X)
print('\n'.join(map(str, ans.tolist())))

Measured memory_bytes: 127520
#include <iostream>


using namespace std;

int main() {

	int i, j;

	for (i = 1; i <= 9; i++) {

		for (j = 1; j <= 9; j++) {

			cout << i << "x" << j << "=" << i*j << "\n";

		}

	}

	
	return 0;

}

Measured memory_bytes: 1112
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Iterator;

class Graph {
	public Integer[][] adjMatrix;
	private int totalVertex;
	private LinkedList<LinkedList<Integer>> adjList;
	//adjacency list of edges
	public Graph() { totalVertex = 0; }
	public void loadAdjList() {
		Scanner in = new Scanner(System.in);
		totalVertex = in.nextInt();
		adjList = new LinkedList<LinkedList<Integer>>();
		for(int i = 0; i < totalVertex; i ++) {
			LinkedList<Integer> tmp = new LinkedList<Integer>();
			int idx1 = in.nextInt() - 1;
			int degree = in.nextInt();
			//System.out.println("mark idx1 = " + idx1 + " degree = " + degree);
			for(int j = 0; j < degree; j ++) {
				int idx2 = in.nextInt() - 1;
				tmp.add(idx2);
			}	
			adjList.add(tmp);
		}
		in.close();
	}
	
	public void BFS(int s) {
		int[] level = new int[totalVertex];
		boolean visited[] = new boolean[totalVertex];
		visited[s] = true;
		Queue<Integer> q = new LinkedList<>();
		q.add(s);
		level[0] = 0;
		int count = 0;
		while(!q.isEmpty()) {
			int v = q.poll();
			visited[v] = true;
			count += 1;
			for (int i = 0; i < totalVertex; i++) {
				if (adjMatrix[v][i] == 1 && visited[i] == false) {
					level[i] = level[v] + 1;
					q.add(i);
					visited[i] = true;
				}
			}
		}
		System.out.println(1 + " " + level[0]);
		for (int i = 1; i < totalVertex; i++) {
			if (level[i] == 0) {
				System.out.println(i+1 + " " + -1);
			}
			else {
				System.out.println(i+1 + " " + level[i]);
			}
		}
	}
	
	
	public void printAdjMatrix() {
		adjMatrix = new Integer[totalVertex][totalVertex];
		//complete the following
		for (int i = 0; i < totalVertex; i++) {
			for (int j = 0; j < totalVertex; j++) {
				if (adjList.get(i).contains(j)) {
					adjMatrix[i][j] = 1;
				}
				else {
					adjMatrix[i][j] = 0;
				}
			}
		}
	}
}

//change class name GraphRepresentation to Main() for submission to AIZU
public class Main {
	public static void main(String argv[]) {
		Graph g = new Graph();
		g.loadAdjList();
		g.printAdjMatrix();
		g.BFS(0);
	}
}


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

int main() {
  int N,K;
  cin >> N >> K;
  int result = 1;
  
  //常に最小の値になればいいことが自明
  for(int i =0;i<N;i++) {
    if(result<=K) {
      result*=2;
    }
    else {
      result+=K;
    }
  }
  cout << result << endl;
}

Measured memory_bytes: 256
import sys
import numpy as np

n,k=map(int,sys.stdin.readline().split())
ans=[0]*n
cnt=0
for i in range(k):
    d=int(sys.stdin.readline())
    a=sys.stdin.readline().split()
    for j in a:
        ans[int(j)-1]=1
for i in range(n):
    if ans[i]==0:
        cnt+=1
print(cnt)



Measured memory_bytes: 27188
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
LL gcd(LL a,LL b){
    return b==0?a:gcd(b,a%b);
}
LL C(LL a,LL b)
{
    LL ans = 1;
    LL res = 1;
    for(LL i = 0;i<b;i++){
        ans = ans*(a-i);
        res = res*(i+1);
        LL my = gcd(ans,res);
        ans/=my;res/=my;
    }
    return ans/res;
}
int main()
{
    LL l,k;
    scanf("%lld%lld",&l,&k);
    LL sum = (l+1)/2;
    for(LL i = 1;i<=(l+1)/2;i++){
        for(LL j = 1;j<=i;j++){
            if(2*i - 1 - j  + k*j>l)break;
            sum+=C(i,j);
        }
    }
    printf("%lld\n",sum);
    return 0;
}



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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



i64 n;
void solve(){
	cin >> n;
	
	i64 ans = 0;
	for(int i = 1; i <= n; i++){
		if(i%3==0 || i%5 == 0) continue;
		ans+=i;
	}
	cout << ans << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int main(){
	char a,b,c,d;
	int s=0;
	cin>>a>>b>>c>>d;
	if(a=='+')s++;
	else s--;
	if(b=='+')s++;
	else s--;
	if(c=='+')s++;
	else s--;
	if(d=='+')s++;
	else s--;
	cout<<s;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;
typedef pair<int ,P> P3;
const int IINF = INT_MAX;
#define REP(i, n) for (int i = 0; i < n; i++)

int n, m, l, k, a, h;
int d[105][105];
bool f[105];
vector<vector<P> > g;
 
void dijkstra(){
    for(int i=0;i<n;i++) fill(d[i],d[i]+m+1,IINF/2);
    d[a][m] = 0;
    priority_queue<P3, vector<P3>, greater<P3> > que;
    que.push({0,{a,m}});
    while(!que.empty()){
        P3 tmp = que.top();
        que.pop();
        int i = tmp.second.first, j = tmp.second.second;
        if(tmp.first > d[i][j])continue;
        for(auto e : g[i]){
            int to = e.first, t = e.second;
            if(j-t < 0)continue;
            if(d[to][j-t] > d[i][j]+t){
                d[to][j-t] = d[i][j]+t;
                que.push({d[to][j-t],{to,j-t}});
            }
        }
        if(f[i] && j<m){
            if(d[i][j+1] > d[i][j]+1){
                d[i][j+1] = d[i][j]+1;
                que.push({d[i][j+1],{i,j+1}});
            }
        }
    }
}
 
int main() {
    while(cin >> n >> m >> l >> k >> a >> h, n){
        fill(f,f+n,false);
        g.clear();
        g.resize(n);
        REP(i,l){
            int t;
            cin >> t;
            f[t] = true;
        }
        REP(i,k){
            int x, y, t;
            cin >> x >> y >> t;
            g[x].push_back({y,t});
            g[y].push_back({x,t});
        }
        dijkstra();
        int ans = IINF/2;
        REP(i,m+1) ans = min(ans, d[h][i]);
        if(ans<IINF/2){
            cout << ans << endl;
        }
        else{
            cout << "Help!" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3216
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  string s;
  cin>>s;
  if(s[0]=='9' || s[1]=='9') cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

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

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOREACH(x, a) for(auto x : a)

/* exchange */
#define CHMIN(a, b) (a) = min((ll)(a), (ll)(b))
#define CHMAX(a, b) (a) = max((ll)(a), (ll)(b))

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define LN() cerr << "\n"
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll N = 0;
ll t;
ll ret = 0;
string s;

void input() {
  IN(N);
  IN(s);
}

void solve() {
  char c = s[0];
  ret += 1;
  FOR(i, 1, N) {
    if (c == s[i]) {
      continue;
    } else {
      ret += 1;
      c = s[i];
    }
  }
  PRINT(ret);
}

int main(void){
  input();
  solve();
}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<set>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstdlib>
#include<tuple>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define MOD 1000000007

using namespace std;

typedef long long int ll;

const ll INF=(ll)1e18;

int N,Q;

int main(){
  cin >> N >> Q;
  set<int> ss;
  vector<pair<ll, ll> > event;
  REP(i,N){
    ll s,t,x;
    cin >> s >> t >> x;
    event.push_back(make_pair(s-x, x));
    event.push_back(make_pair(t-x, -x));
  }

  sort(event.begin(),event.end());

  int i = 0;
  REP(j,Q){
    ll d;
    cin >> d;

    while(i < 2*N && event[i].first <= d){
      if(event[i].second > 0){
        ss.insert(event[i].second);
      }else{
        ss.erase(-event[i].second);
      }
      i++;
    }
    if(ss.empty()){
      cout << -1 << endl;
    }else{
      cout << *ss.begin() << endl;
    }
  }
}



Measured memory_bytes: 18152
import heapq
#標準入力受け取り
N, M = list(map(int, input().split()))
jobs = [[] for _ in range(M)]

for i in range(N):
    d, r = list(map(int, input().split()))
    if d-1 < M:
        jobs[d-1].append(-r) #マイナスにしている

rewards = 0
heap = []

#解法
for i in range(M):
    #要素を一つづつヒープに追加
    for reward in jobs[i]:
        heapq.heappush(heap, reward)
    if len(heap) > 0:
        #最大値(最小値)をヒープから取り出し
        reward = heapq.heappop(heap)
        rewards += -reward#マイナスにしている

print(rewards)


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

int main() {
    ll N,T;
    cin >> N >>T;
    vector<ll> A(N);
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    vector<ll> maxAfter(N);
    maxAfter[N-1] = A[N-1];
    ll maxDif = 0;
    for(int i=N-2;i>=0;--i){
        maxAfter[i] = max(A[i],maxAfter[i+1]);
        maxDif = max(maxDif,maxAfter[i]-A[i]);
    }
    // cerr << maxDif << endl;
    ll num =0;
    for(int i=0;i<N;i++){
        if((maxAfter[i]-A[i]) == maxDif){
            num++;
        }
    }
        cout << num <<endl;
    
    return 0;
}

Measured memory_bytes: 1920
#include <stdio.h>
#include <string.h>
 
int main(void){
    long long k,lun[100000],a=10,j=1;
    scanf("%lld",&k);
    for (int i=1;i<=9;i++){
        lun[i] = i;
    }
    while (a <= k){
        long long one;
        one = lun[j]%10;
        if (one != 0){
            lun[a] = (lun[j]*10)+one-1;
            a++;    
        }
        lun[a] = (lun[j]*10)+one;
        a++;
        if (one != 9){
            lun[a] = (lun[j]*10)+one+1;
            a++;
        }
        j++;
    }
    printf("%lld\n",lun[k]);
}

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

using namespace std;

typedef long long llint;

int main() {
  int n;
  cin >> n;
  vector<llint> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a.rbegin(), a.rend());
  llint ans = 0;
  for (int i = 1; i <= n - 1; i++) {
    ans += a[i / 2];
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 4788
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<limits>
#include<iomanip>
#include<cmath>
#include<climits>
#include <unordered_set>
#include <numeric>
#include<cstring>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

const ll p = 998244353;

ll dp1[300][90000+1];
ll dp2[300][90000+1];

int f1(vector<ll>& a, int n) {
    memset(dp1,0,sizeof(dp1));
    dp1[0][0]=2;
    dp1[0][a[0]]=1;
    repeat(i,1,n) {
	rep(s,90000+1) {
	    dp1[i][s]=dp1[i-1][s]*2;
	    dp1[i][s]%=p;
	    if(s-a[i]>=0) {
		dp1[i][s]+=dp1[i-1][s-a[i]];
		dp1[i][s]%=p;
	    }
	}
    }
    ll S=accumulate(a.begin(),a.end(),0LL);
    ll ret=0;
    for(ll s=(S+1)/2; s<=S; s++) {
	ret+=dp1[n-1][s];
	ret%=p;
    }
    return ret;
}

ll f2(vector<ll>& a, int n) {
    memset(dp2,0,sizeof(dp2));
    dp2[0][0]=1;
    dp2[0][a[0]]=1;
    repeat(i,1,n) {
	rep(s,90000+1) {
	    dp2[i][s]=dp2[i-1][s];
	    dp2[i][s]%=p;
	    if(s-a[i]>=0) {
		dp2[i][s]+=dp2[i-1][s-a[i]];
		dp2[i][s]%=p;
	    }
	}
    }
    ll S=accumulate(a.begin(),a.end(),0LL);
    if(S%2==1)
	return 0;
    return dp2[n-1][S/2];
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  cout<<fixed;
  int n;
  cin>>n;
  vector<ll> a(n);
  rep(i,n)cin>>a[i];
  ll ret=1;
  rep(i,n) {
      ret*=3;
      ret%=p;
  }
  ll b=f1(a,n);
  rep(t,3) {
      ret-=b;
      ret%=p;
      ret+=p;
      ret%=p;
  }
  ret+=3*f2(a,n);
  ret%=p;
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 422520
import java.util.*;

public class Main {
    public static Deque<Integer> hashList = new ArrayDeque<>();

    public static void main(String[] args) {
        int total;

        Scanner inp = new Scanner(System.in);
        total = inp.nextInt();

        for (int k = 0; k < total; k++) {
            String command = inp.next();

            switch (command) {
                case "insert": {
                    int num = inp.nextInt();

                    hashList.addFirst(num);
                    break;
                }
                case "delete": {
                    int num = inp.nextInt();

                    hashList.remove(num);
                    break;
                }
                case "deleteFirst":

                    hashList.removeFirst();
                    break;
                case "deleteLast":

                    hashList.removeLast();
                    break;
            }
        }

        //int counter = 0;

        StringBuilder pInt = new StringBuilder();

        pInt.append(hashList.poll());
        for(int n : hashList)
            pInt.append(" ").append(n);

        System.out.println(pInt);
    }
}


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

int main(int argc, char **argv)
{
    int N;
    std::cin >> N;

    std::vector<int> a(3*N);
    std::vector<int> b(3*N);

    for(int i = 0; i < 3*N; i++){
        std::cin >> a.at(i);
        b.at(i) = a.at(i);
    }

    std::sort(a.begin(), a.end(), std::greater<int>());
    std::sort(b.begin(), b.end());

    std::vector<int> c(N);

    long sum = 0;
    for(int i = 0; i < N; i++){
        int x, y, z;
        x = a.at(2*i+0);
        y = a.at(2*i+1);
        z = b.at(i);
        sum += y;
    }

    std::cout << sum << std::endl;
    
}


Measured memory_bytes: 2944
require 'pp'

def gets; ARGF.gets; end

class Solver

  def initialize
  end

  def main
    s = gets.chomp

    ans = ""

    s.each_char.with_index do |c, i|
      ans += c if (i+1).odd?
    end

    puts ans
  end
end

if __FILE__ == $0
  Solver.new.main
end


Measured memory_bytes: 81020
import math
a, b, x = map(int, input().split())
if x <= a*a*b//2:
    ans = 90 - math.degrees(math.atan(2*x/(a*b*b)))
else:
    ans = math.degrees(math.atan(2*(a*a*b-x)/(a*a*a)))
print(ans)


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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

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

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
	string s;cin>>s;
	int n=s.size();
	int m=n-7;
	string a="";
	rep(i,m){
		a.PB('1');
	}
	vector<pair<string,string>>t;
	t.PB(MP("keyence",""));
	t.PB(MP("keyenc","e"));
	t.PB(MP("keyen","ce"));
	t.PB(MP("keye","nce"));
	t.PB(MP("key","ence"));
	t.PB(MP("ke","yence"));
	t.PB(MP("k","eyence"));
	t.PB(MP("","keyence"));
	rep(i,8){
		string b=t[i].F+a+t[i].S;
		int cnt=0;
		rep(j,n){
			if(s[j]!=b[j]){cnt++;}
		}
		if(cnt==m){
			cout<<"YES"<<endl;
			return 0;
		}
	}
	cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(), v.end()
#define mem(arr) memset(arr, 0, sizeof(arr))
#define ff first
#define ss second
#define int long long int
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int N = 1e6 + 1;
vector<int> g[N];
vector<int> vis(N);
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc = 1;
    while(tc--){
        int n;
        cin >> n;
        int a[n];
        int sum = 0;
        for(int &it : a){
            cin >> it;
            sum += it;
            sum %= MOD;
        }
        int ans = 0;
        for(int i = 0; i < n; i++){
            sum = (sum - a[i] + MOD) % MOD;
            ans += sum * a[i];
            ans %= MOD;
        }
        cout << ans << '\n';
    }
}

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

class Graph {
    struct Edge {
        int to, cost;
        Edge(int to, int cost) : to(to), cost(cost) {}
    };

    vector<vector<Edge>> node;
    vector<int> color;

public:
    Graph(int n) : node(n), color(n, -1) {}

    void connect(int a, int b, int w) {
        node[a].push_back(Edge(b, w));
        node[b].push_back(Edge(a, w));
    }

    void dfs(int from, int cur = 0) {
        color[from] = cur;
        for (auto edge : node[from]) {
            if (color[edge.to] != -1) continue;
            dfs(edge.to, (edge.cost % 2 ? 1 - cur : cur));
        }
    }

    void ans() {
        rep(i, 0, color.size()) cout << color[i] << endl;
    }
};

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

    Graph graph(n);
    rep(i, 0, n - 1) {
        int u, v, w;
        cin >> u >> v >> w;
        graph.connect(--u, --v, w);
    }

    graph.dfs(0);
    graph.ans();
    
    return 0;
}

Measured memory_bytes: 7296
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
#define ALL(x) (x).begin(), (x).end()
#define sz(a) int(a.size())
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define chu(x) cout<<"["<<#x<<" "<<(x)<<"]"<<endl
#define du3(a,b,c) scanf("%d %d %d",&(a),&(b),&(c))
#define du2(a,b) scanf("%d %d",&(a),&(b))
#define du1(a) scanf("%d",&(a));
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
ll powmod(ll a, ll b, ll MOD) { if (a == 0ll) {return 0ll;} a %= MOD; ll ans = 1; while (b) {if (b & 1) {ans = ans * a % MOD;} a = a * a % MOD; b >>= 1;} return ans;}
void Pv(const vector<int> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%d", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
void Pvl(const vector<ll> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%lld", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
inline long long readll() {long long tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
inline int readint() {int tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
const int maxn = 1000010;
const int inf = 0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/
int x, y, z;
std::vector<int> v;
int main()
{
    //freopen("D:\\code\\text\\input.txt","r",stdin);
    //freopen("D:\\code\\text\\output.txt","w",stdout);
    cin >> x >> y >> z;
    int isok = 1;
    if (x == y)
    {
        if (z == y)
        {
            isok = 0;
        }
    } else if (x == z)
    {
        if (z == y)
        {
            isok = 0;
        }
    } else if (y == z)
    {
        if (x == y)
        {
            isok = 0;
        }
    } else
    {
        isok = 0;
    }
    if (isok)
    {
        printf("Yes\n");
    } else
    {
        printf("No\n");
    }
    
    return 0;
}




Measured memory_bytes: 256
#include <vector>
#include <sstream>
#include <algorithm>
#include <fstream>
#include <list>
#include <unordered_map>
#include <map>
#include <istream>
#include <sstream>
#include <stack>
#include <set>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <queue>
#include <string>

#define int long long
#define ull unsigned long long
#define endl "\n"
#define all(x) x.begin(),x.end()
#define rr return 0
#define xx first
#define yy second
#define pii pair<int,int>

using namespace std;

typedef long double ld;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,k;
    cin >> n >> k;
    vector<int> a(n);
    vector<bool> dp(k + 1);
    for(int i = 0;i < n;i++){
        cin >> a[i];
    }
    for(int i = 1;i <= k;i++){
        for(auto j : a){
            if(i >= j && !dp[i - j]){
                dp[i] = true;
            }
        }
    }
    if(dp[k]){
        cout << "First";
    }else{
        cout << "Second";
    }
    rr;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn=1e5+10;
int n,a[maxn],b[maxn],c[maxn];
int aa[maxn],bb[maxn],cc[maxn];
int cnta[maxn],cntb[maxn],cntc[maxn];

int p1[maxn],p2[maxn];
int main(){
    scanf("%d",&n);
    for (int i=1; i<=n; i++) scanf("%d",&a[i]);
    for (int i=1; i<=n; i++) scanf("%d",&b[i]);
    for (int i=1; i<=n; i++) scanf("%d",&c[i]);
    sort(a+1,a+1+n);
    sort(b+1,b+1+n);
    sort(c+1,c+1+n);

    for (int now,i=1; i<=n; i++){
        now=lower_bound(a+1,a+1+n,b[i])-a;
        p1[i]=(now-1);
        now=upper_bound(c+1,c+1+n,b[i])-c;
        p2[i]=(n-now+1);
//        printf("%d %d %d\n",i,p1[i],p2[i]);
    }


    long long  ans=0;
    for (int i=1; i<=n; i++)
        ans+=1ll*p1[i]*p2[i];
    printf("%lld\n",ans);
    return 0;
}

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

int a, b, c;

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

    cin >> a >> b >> c;

    if (a < b && b < c) {
        cout << "Yes" << '\n';
    } else {
        cout << "No" << '\n';
    }
    return 0;
}


Measured memory_bytes: 3216
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>	
#define inf (INT_MAX-1)
#define INF 9223372036854775807
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r);
#define TYPE long long
#define MEMSET(a) memset(a,0,sizeof(a))
const int mod=(int)1e09+7;

int in(void){
	int i;scanf("%d",&i);
	return i;
}
long long llin(void){
	long long i;scanf("%lld",&i);
	return i;
}
double din(void){
	double i;scanf("%lf",&i);
	return i;
}
void chin(char s[]){
	scanf("%s",s);
}
void print(int a){
	printf("%d\n",a);
}
void llprint(long long a){
	printf("%lld\n",a);
}
void dprint(double a){
	printf("%.10f\n",a);
}
void print2(int a,int b){
	printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
	return a>b?a:b;
}
long long min(long long a,long long b){
	return a<b?a:b;
}
long long llabs(long long a){
	return a>0?a:-a;
}
double dmax(double a,double b){
	return a>b?a:b;
}
int cmp(const void *a,const void *b){
	return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
	return *(TYPE *)b-*(TYPE *)a;
}
int char_cmp(const void *a,const void *b){
	return strcmp((char *)a,(char *)b);
}
int char_cmp_r(const void *a,const void *b){
	return strcmp((char *)b,(char *)a);
}
void swap(int *a,int *b){
	int t=*a;
	*a=*b;
	*b=t;
}
long long gcd(long long x,long long y){
	return x%y?gcd(y,x%y):y;
}
long long lcm(long long x,long long y){
	return x/gcd(x,y)*y;
}

typedef struct{
	int x,y;
}data;

int main(void){
	int h=in(),w=in(),d=in(),i,j,t,p[90001]={},q,l,r;
	data a[90001];
	rep(i,h){
		rep(j,w){
			t=in();
			a[t].x=i+1;
			a[t].y=j+1;
		}
	}
	for(i=1;i<=d;i++){
		for(j=i+d;j<=h*w;j+=d)
			p[j]+=p[j-d]+abs(a[j].x-a[j-d].x)+abs(a[j].y-a[j-d].y);
	}
	q=in();
	rep(i,q){
		l=in();
		r=in();
		print(p[r]-p[l]);
	}
	return 0;
}

Measured memory_bytes: 2048
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define mod 1000000007
using namespace std;
ll binpow(ll x,ll y)/* (x^y)%p in O(log y) */{ll res=1;while (y > 0){if(y&1)res=(res*x);y = y>>1;x=(x*x);}return res;}
ll binpowmod(ll x,ll y,ll p)/* (x^y)%p in O(log y) */{ull res=1;x=x%p;while (y > 0){if(y&1)res=(res*x)%p;y = y>>1;x=(x*x)%p;}return res;}
ll mod_inverse(ll n,ll p)/* Returns n^(-1) mod p */{return binpowmod(n,p-2,p);}
int gcd(int x,int y)
{
    if(y==0)
        return x;
    return gcd(y,x%y);
}
bool comp(pair<int,int> x,pair<int,int> y)
{
    return x.first<y.first;
}
bool comp_pairs_by_s(pair<ll,ll> &x ,pair<ll,ll> &y)
{
    return x.second<y.second;
}
bool isPowerOfTwo (ll x)  
{  
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));  
}

class cmp      //comparator for priority_queue 
{               //declaration: priority_queue<int,vector<int>,cmp>
public:         
    bool operator()(pair<int,int> A,pair<int,int> B)
    {
        if(abs(A.first-A.second)==abs(B.first-B.second))
            return A.first>B.first;
        return abs(A.first-A.second)<abs(B.first-B.second);
    }
};
int prime[1768457]={0};
void sieve(void)
{
 int i,j;
 for(i=0;i<1768457;i++)
        prime[i]=1;
 prime[0]=0,prime[1]=0;
 for(i=2;i<=sqrt(1768457);i++){
     if(prime[i]){
         for(j=i*i;j<1768457;j+=i){
             prime[j]=0;
         }
     }
 }
    
}
void swap(ll &x,ll &y){
    int temp=x;
    x=y;
    y=temp;
}
  
unsigned int onesComplement(unsigned int n) 
{ 
   // Find number of bits in the given integer 
   int number_of_bits = floor(log2(n))+1; 
  
   // XOR the given integer with poe(2,  
   // number_of_bits-1 and print the result  
   return ((1 << number_of_bits) - 1) ^ n; 
}


void solve()
{   
    int n,k;
    cin>>n>>k;
    vector<int> p(n);
    for(auto &it : p )
        cin>>it;
    sort(p.begin(),p.end());
    int ans=0;
    for(int i=0;i<k;++i)
        ans+=p[i];
    cout<<ans;

}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
}   


Measured memory_bytes: 3684
# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

n = int(input())
a = [int(i) for i in readline().split()]

s = sum(a)


def isOK(k): #判定関数（個別に書き換え）
    res = 0
    for ai in a:
        c = ai + k - (n-1)
        res += (c+n)//(n+1)
    if res == k: return True
    else: return False

for i in range(max(s-5000,0),s+2,1):
    if isOK(i):
        s = i
        break


print(s)

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

static char *words[] = {
  "the",
  "this",
  "that"
};

int main(void)
{
  char cipher[80];
  while(scanf("%[^\n]%*c", cipher) != EOF){

    int i,j,k,l;
    for(i=0; i<26; ++i){

      for(j=0; j<strlen(cipher); ++j){
        if('a'<=cipher[j] && cipher[j]<='z'){
          cipher[j] = (cipher[j]-'a'+1)%26+'a';
        }
      }
      
      int hit = 0;
      for(j=0; !hit && j<(sizeof words/sizeof words[0]); ++j){
        for(k=0; !hit && k+strlen(words[j])<=strlen(cipher); ++k){
          for(l=0; l<strlen(words[j]); ++l){
            if(cipher[k+l]==words[j][l]){
              hit = 1;
            }else{
              hit = 0;
              break;
            }
          }
        }
      }

      if(hit){
        printf("%s\n", cipher);
        break;
      }
    }
  }

  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define forn(i, a, n) for (int i = (int)(a); i < (int)(n); ++i)
#define ford(i, a, n) for (int i = (int)(n) - 1; i >= (int)(a); --i)
#define fore(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define fs first
#define sn second
#define trace(a)\
    for (auto i : a) cerr << i << ' ';\
    cerr << '\n'
#define eb emplace_back

#ifndef M_PI
const ld M_PI = acos(-1.0);
#endif

template<typename T>
inline void setmax(T& a, T b) {
    if (a < b) a = b;
}

template<typename T>
inline void setmin(T& a, T b) {
    if (a > b) a = b;
}

template<typename T, typename S>
istream& operator>> (istream& in, pair<S, T>& p) {
    in >> p.fs >> p.sn;
    return in;
}
template<typename T, typename S>
ostream& operator<< (ostream& out, pair<S, T>& p) {
    out << p.fs << ' ' << p.sn << ' ';
    return out;
}

template<typename T>
istream& operator>> (istream& in, vector<T>& v) {
    for (T& x : v) in >> x;
    return in;
}
template<typename T>
ostream& operator<< (ostream& out, vector<T>& v) {
    for (T& x : v) out << x << ' ';
    return out;
}

const ld eps = 1e-9;
const int INF = 2000000000;
const ll LINF = 1ll * INF * INF;
const ll MOD = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); 
    srand((unsigned)chrono::high_resolution_clock::now().time_since_epoch().count());
    int n;
    cin >> n;
    int sum = 0;
    while (n) {
        sum += n % 10;
        n /= 10;
    }
    if (sum > 1) cout << sum << '\n';
    else cout << 10 << '\n';
}


Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    def prime_factorize1(N):
        l = []
        x = N
        y = 2
        while y*y <= x:
            while x % y == 0:
                l.append(y)
                x //= y
            y += 1
        if x > 1:
            l.append(x)
        return l

    from collections import Counter
    c=Counter(prime_factorize1(n))
    num=list(c.values())
    ans=0
    for i in num:
        x=i
        for j in range(1,i+1):
            if x-j>=0:
                ans+=1
                x-=j
            else:
                break
    print(ans)
resolve()

Measured memory_bytes: 9468
#include<stdio.h>

int main(){
        int n, x, t, ans;
        scanf("%d%d%d", &n, &x, &t);
        if(n%x==0){
                ans=n/x;
        }else{
                ans=n/x+1;
        }
        printf("%d", ans*t);
        return 0;
}


Measured memory_bytes: 1724
#include <bits/stdc++.h>
using namespace std; 
using ll = long long;
signed main() { 
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n; 
	cin>>n;
	vector<int> v(n);
	for(int i = 0; i < n-1; i++){
		int a;
		cin>>a;
		v[a-1]++;
	}
	for(int i : v)
		cout << i << "\n";
}


Measured memory_bytes: 3988
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <math.h>
#include <set>
#include <bitset>
#include <stack>

using namespace std;

typedef long long ll;

const ll prime = 10000000000 + 7;

/*
vector<int> z_algorithm(const string& s) {
	vector<int> prefix(s.size());
	for (int i = 1, j = 0; i < s.size(); i++)
	{
		if (i + prefix[i - j] < j + prefix[j]) {
			prefix[i] = prefix[i - j];
		}
	}
}
*/

int main() {
	
	ll n, k;
	cin >> n >> k;
	vector<ll> h(n);
	for (ll i = 0; i < n; i++)
	{
		cin >> h[i];
	}

	ll sum = 0;
	for (ll i = 0; i < n; i++)
	{
		if (h[i] >= k) {
			sum++;
		}
	}
	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<algorithm>
#include<cstring>
#define ll long long
#define abs(a) (a>0?a:(-(a)))
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
using namespace std;
char s[1000];
int main(){
	scanf("%s",s);
	if (s[0]=='S') printf("Cloudy");else
	if (s[0]=='C') printf("Rainy");else
		printf("Sunny");
	return 0;
}


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

int main() {
  string s;
  cin >> s;
  replace(s.begin(), s.end(), ',', ' ');
  cout << s << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
#include <tuple>
#include <functional>
#include <cstring>

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define irep(i,n) for(int  i = 0; i < n; i++)
#define irep2(i,a,n) for(int i = a; i < n; i++)
#define lrep(i,n) for(long long  i = 0; i < n; i++)
#define lrep2(i,a,n) for(long long i = a; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl
typedef long long ll;

typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<std::vector<std::string> > v2_string;

using namespace std;

void solve(int* ans, int n, int k, int i, int num)
{
    if(i == n) { 
        *ans = min(*ans, num);
        return;
    }
    solve(ans, n, k, i+1, num+k);
    solve(ans, n, k, i+1, num*2);
}

int main() 
{
    int ans = INF;
    int n, k;
    cin >> n >> k;

    solve(&ans, n, k, 0, 1); 
    cout << ans << endl;

    return 0;
}
    



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

int main() {
  int K;
  string S;
  cin >> K >> S;

  if (S.size() <= K) {
    cout << S << endl;
  }
  else {
    string subS = (string)S.substr(0, K);
    cout << subS + "..." << endl;
  }

  return 0;
}


Measured memory_bytes: 3608
package main

import (
	"fmt"
	"sort"
)

func main() {
	n := make([]int, 3)
	fmt.Scan(&n[0], &n[1], &n[2])
	sort.Ints(n)
	if n[0] == 5 && n[1] == 5 && n[2] == 7 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


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

int partition(vector<int> &a, int p, int r){
	r--;
	int x = a.at(r);
	int i = p;
	for(int j = p; j < r; j++){
		if(a.at(j) <= x){
			swap(a.at(i), a.at(j));
			i++;
		}
	}
	swap(a.at(i), a.at(r));
	
	return i;
}

int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a.at(i);
	int index = partition(a, 0, n);
	rep(i, n){
		if(i != 0) cout << " ";
		if(i != index) cout << a.at(i);
		else cout << "[" << a.at(i) << "]";
	}
	cout << endl;
	
	return 0;
}


Measured memory_bytes: 3112
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

const int maxn = 805;
int n, m, k;
char c[maxn][maxn];

int read() {
  if (scanf("%d%d%d", &n, &m, &k) < 3) {
    return false;
  }
  for (int i = 0; i < n; i++) {
    scanf("%s", c[i]);
  }
  return true;
}

int d[maxn][maxn];
vector< pair<int, int> > q;

const int gox[] = {1, 0, -1, 0};
const int goy[] = {0, 1, 0, -1};

bool inside(int x, int y) {
  return 0 <= x && x < n && 0 <= y && y < m;
}

void solve() {
  int sx = -1, sy = -1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (c[i][j] == 'S') {
        assert(sx == -1);
        sx = i;
        sy = j;
        c[i][j] = '.';
      }
    }
  }
  assert(sx != -1);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      d[i][j] = inf;
    }
  }
  d[sx][sy] = 0;
  q.clear();
  q.push_back(make_pair(sx, sy));
  for (int ql = 0; ql < sz(q); ql++) {
    int x = q[ql].first, y = q[ql].second;
    if (d[x][y] >= k) {
      break;
    }
    for (int dir = 0; dir < 4; dir++) {
      int nx = x + gox[dir], ny = y + goy[dir];
      if (!inside(nx, ny) || c[nx][ny] == '#' || d[nx][ny] < inf) {
        continue;
      }
      d[nx][ny] = d[x][y] + 1;
      q.push_back(make_pair(nx, ny));
    }
  }
  int res = inf;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (d[i][j] >= inf) {
        continue;
      }
      int dist = min(min(i, n - i - 1), min(j, m - j - 1));
      res = min(res, (dist + k - 1) / k + 1);
    }
  }
  printf("%d\n", res);
}

int main() {
  precalc();
#ifdef DEBUG
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (read()) {
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 13804
#include <stdio.h>

int main(void)
{
    int n;
    char color[10];
    scanf("%d", &n);
    scanf("%s", color);

    if (n >= 3200)
    {
        printf("%s\n", color);
    }
    else
    {
        printf("red\n");
    }

    return 0;
}

Measured memory_bytes: 128
public class Main{
       public static void main(String[] args){
    
      
        
       
        
        int i = 1;
        while(i < 10){
        	int j = 1;
        	while(j < 10){
        	int a = i * j; 
        	
        	System.out.println(i+"x"+j+"="+a);
        	j++;
        	}
        i++;
        }
       }
}

Measured memory_bytes: 24132
#include <iostream>
using namespace std;
 
int main(){
    int A,B,C;
    cin >> A >> B >> C;
  
   if (A != B && A != C && B != C) {
     cout << "No" << endl;
   }
  else if (A == B && B == C) {
     cout << "No" << endl;
  }
  else if (A == B && A != C) {
    cout << "Yes" << endl;
  }
  else if (A == C && A != B) {
    cout << "Yes" << endl;
  }
  else if (C == B && A != C) {
    cout << "Yes" << endl;
  }
}


Measured memory_bytes: 3564