akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstring>
#include<cmath>
#include<vector>
#include<algorithm>

#define range(i, n) for (i = 0; i < n; i++) 
#define rrange(i, n) for(i = n-1; i>=0; i--)

using namespace std;

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


int main() {

	int N, K;

	cin >> N >> K;

	vector<pair<long long , long long > >s(N);
	vector<pair<long long , long long > >select;

	vector<bool>neta(N+1, false);
	long long netacount = 0;
	long long sum = 0;
	long long result = 0;

	int i, k, n;
	range(i, N) {
		cin >> s[i].second >> s[i].first;
	}

	sort(s.begin(), s.end());
	reverse(s.begin(), s.end());

	k = 0;
	range(i, K) {
		sum += s[i].first;
		if (neta[s[i].second] == false) {
			neta[s[i].second] = true;
			netacount++;
			continue;
		}
		select.push_back(s[i]);
	}

	result = sum + (netacount * netacount);


	range(i, N) {
		if (netacount >= K)break;
		if (select.size() <= 0)break;
		if (neta[s[i].second] == true) continue;

		sum = (sum - select.back().first) + s[i].first;
		neta[s[i].second] = true;
		netacount++;
		chmax(result, sum + (netacount * netacount));
		select.pop_back();

	}

	cout << dec << result;







	return 0;
}


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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define PRINT(x) cout << (x) << "\n"

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

inline int in(int& a) {return scanf("%d", &a);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};
const int MOD = 1000000007;

signed main(){
    string S;
    bool easy = true;
    cin >> S;
    REP(i, S.length()){
        if((i + 1) % 2 == 1 && S[i] == 'L') easy = false;
        if((i + 1) % 2 == 0 && S[i] == 'R') easy = false; 
    }
    if(easy) PRINT("Yes");
    else PRINT("No");
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"reflect"
	"strconv"
	"strings"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	length, _ := strconv.Atoi(sc.Text())
	var inputSuits = make([]string, length)
	var inputNums = make([]int, length)
	var inputSuits2 = make([]string, length)
	var inputNums2 = make([]int, length)

	sc.Scan()
	for i, v := range strings.Split(sc.Text(), " ") {
		inputSuits[i] = string(v[0])
		inputSuits2[i] = string(v[0])
		inputNums[i], _ = strconv.Atoi(string(v[1]))
		inputNums2[i], _ = strconv.Atoi(string(v[1]))
	}

	bubbleSuits, bubbleNums := bubbleSort(inputSuits, inputNums)
	selectionSuits, selectionNums := selectionSort(inputSuits2, inputNums2)

	print(inputSuits, inputNums, bubbleSuits, bubbleNums)
	print(inputSuits, inputNums, selectionSuits, selectionNums)
}

func bubbleSort(strs []string, nums []int) ([]string, []int) {
	var flag bool
	var count int
	for {
		if flag {
			break
		}
		flag = true
		for i := range nums[:len(nums)-1] {
			if nums[i] > nums[i+1] {
				tmp := nums[i]
				nums[i] = nums[i+1]
				nums[i+1] = tmp

				tmp2 := strs[i]
				strs[i] = strs[i+1]
				strs[i+1] = tmp2

				flag = false
				count++
			}
		}
	}
	return strs, nums
}

func selectionSort(strs []string, nums []int) ([]string, []int) {
	var count int
	for i := range nums {
		minj := i
		for j := i; j < len(nums); j++ {
			if nums[j] < nums[minj] {
				minj = j
			}
		}
		if i != minj {
			tmp := nums[i]
			nums[i] = nums[minj]
			nums[minj] = tmp

			tmp2 := strs[i]
			strs[i] = strs[minj]
			strs[minj] = tmp2

			count++
		}
	}

	return strs, nums
}

func judgeStable(orgStrs []string, orgNums []int, sortedStrs []string, sortedNums []int) bool {
	var sortedSuits [9][]string
	for i, v := range sortedNums {
		sortedSuits[v-1] = append(sortedSuits[v-1], sortedStrs[i])
	}

	var orgSuits [9][]string
	for i, v := range orgNums {
		orgSuits[v-1] = append(orgSuits[v-1], orgStrs[i])
	}

	return reflect.DeepEqual(sortedSuits, orgSuits)
}

func print(orgStrs []string, orgNums []int, sortedStrs []string, sortedNums []int) {
	for i, v := range sortedNums {
		if i == 0 {
			fmt.Printf("%s%d", sortedStrs[i], v)
		} else {
			fmt.Printf(" %s%d", sortedStrs[i], v)
		}
	}
	if judgeStable(orgStrs, orgNums, sortedStrs, sortedNums) {
		fmt.Println("\nStable")
	} else {
		fmt.Println("\nNot stable")
	}
}



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

int main(){
  int a,n,ans=0;cin>>n;
  map<int,int> mp;
  for(int i=0;i<n;i++) cin>>a,mp[a]++;
  for(auto p:mp){
    ans+=p.second;
    if(p.first<=p.second) ans-=p.first;
  }
  cout<<ans;
}

Measured memory_bytes: 4736
#include "bits/stdc++.h"
#define ll long long int
#define ld long double
#define fastIO ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define pb push_back
#define MOD 1000000007

using namespace std;
typedef pair<int, int> pii;

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

    int arr[n];
    ll pref[n];

    for (int i = 0; i < n; i++) {
//        arr[i] = 1e9;
        cin >> arr[i];
    }

    pref[n - 1] = 0;
    for (int i = n - 2; i >= 0; i--) {
        pref[i] = pref[i + 1] + arr[i + 1];
    }

    // pref[i] = prefix sum from i + 1 to the end

    ll sum = 0;
    for (int i = 0; i < n; i++) {
        sum += ((ll) arr[i]) * (pref[i] %= MOD);
        sum %= MOD;
    }

    cout << sum;

}


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

/**
 * 解説通りに作成したソースコード
 */
public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			int[] a = IntStream.range(0, n).map(i -> scanner.nextInt() - 1 - i).sorted().toArray();
			// 中央値を求める
			int middle = (0 == (1 & n)) ? (a[n / 2] + a[n / 2 - 1]) / 2 : a[n / 2];
			System.out.println(IntStream.range(0, n).mapToLong(i -> Math.abs(a[i] - middle)).sum());
		}
	}
}


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

int main() {
  string s;
  cin >> s;

  for(int i = 0; i < 3; i++) {
    if(s.at(i) == s.at(i+1)) {
      cout << "Bad" << endl;
      return 0;
    }
  }

  cout << "Good" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf 1e9
struct activity{
    int A,B,C;
};
int solve(vector<activity> ar,int n){
    int dp[n+1][3];
    dp[1][0] = ar[1].A;
    dp[1][1] = ar[1].B;
    dp[1][2] = ar[1].C;
    for(int i=2;i<=n;i++){
        dp[i][0] = ar[i].A + max(dp[i-1][1], dp[i-1][2]);
        dp[i][1] = ar[i].B + max(dp[i-1][0], dp[i-1][2]);
        dp[i][2] = ar[i].C + max(dp[i-1][0], dp[i-1][1]);
          
    }
    return max(dp[n][0], max(dp[n][1],dp[n][2]));
    
}
int main(){
    int n,k;
    cin>>n;
    vector<activity>ar(n+1);
    for(int i=1;i<=n;i++){
        cin>>ar[i].A;
        cin>>ar[i].B;
        cin>>ar[i].C;
    }
    cout<<solve(ar,n);
    return 0;
}

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

typedef long long ll;
typedef long double ld;

int niz[1000005];

int main(){
    ios_base::sync_with_stdio(false);
    cout.precision(10);
    cout<<fixed;

    int n, x;
    cin >> n >> x;
    for(int i=1; i<=n; i++) cin >> niz[i];
    sort(niz+1, niz+1+n);
    int cnt=0;
    for(int i=1; i<=n; i++){
        if(niz[i] <= x){
            x -= niz[i];
            cnt++;
        }
    }
    if(cnt == n && x) cnt--;
    cout << cnt;
    return 0;
}


Measured memory_bytes: 256
N, K = [int(x) for x in input().split()]
R, S, P = [int(x) for x in input().split()]
T = input()
d = {'r': P, 's': R, 'p': S}
ans = 0
m = set()
for i in range(N):
    t = T[i]
    if i < K:
        ans += d[t]
    else:
        if t == T[i-K]:
            if i-K in m:
                ans += d[t]
            else:
                m.add(i)
        else:
            ans += d[t]
print(ans)


Measured memory_bytes: 42608
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <numeric>
#include <bitset>
using namespace std;
#define lint long long
#define ll long long
#define pq priority_queue
long long INF = 1e10;
#define pii pair<long long,long long>
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
/******************************define*********************************/

/*****************************functions********************************/

/****************************main function*****************************/
int main(void){

    int n,m; cin >> n >> m;
  cout << n - m + 1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T> void print(T a, T b) { 
    for (T i = a; i != b; ++i) { if (i != a) { cout << " "; } cout << *i; } cout << endl; 
}



vint inp;

int main() {
    inp.resize(8);
    while ( cin >> inp[0] ) {
        for (int i = 1; i < 8; ++i) cin >> inp[i];
        vint num(8);
        num[0] = 1, num[1] = 2, num[2] = 1, num[3] = 2;
        num[4] = 1, num[5] = 4, num[6] = 1, num[7] = 4;
        
        int Min = 100000000;
        vint res(8, 10);
        
        for (int p = 0; p < 8; ++p) {
            int tot = 0;
            for (int i = 0; i < 8; ++i) {
                if (num[i] < inp[i]) tot += inp[i] - num[i];
            }
            if (Min > tot) {
                Min = tot;
                res = num;
            }
            else if (Min == tot) {
                chmin(res, num);
            }
            
            vint tmp(8);
            for (int i = 0; i < 8; ++i) tmp[i] = num[ (i+1)%8 ];
            num = tmp;
        }
        
        for (int i = 0; i < 8; ++i) {
            cout << res[i];
            if (i != 7) cout << " ";
        }
        cout << endl;
    }
    return 0;
}


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

int main() {
  int H, W;
  cin >> H >> W;
  vector<string> vec(H + 2);
  for(int i = 0; i < H; i ++)
  {
    cin >> vec.at(i + 1);
    vec.at(i + 1) = "#" + vec.at(i + 1) + "#";
  }
  vec.at(0) = string(W + 2, '#');
  vec.at(H + 1) = string(W + 2, '#');

  for(auto str: vec)
  {
    cout << str << endl;
  }
  
}


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

  string tmp;
  map <string,bool> a;
  int n,i;

  cin>>n;
  for(i=0;i<n;i++){
    cin>>tmp;
    if(tmp=="insert"){
      cin>>tmp;
      a.insert(make_pair(tmp,true));
    } else {
      cin>>tmp;
      if(a.count(tmp)) cout<<"yes"<<endl;
      else cout<<"no"<<endl;
    }

  }

  return 0;

}

Measured memory_bytes: 36904
#include <bits/stdc++.h>
using namespace std;
#define f(i,a,b) for( int i = a; i < b ; i++ ) 
#define af(i,a,b) for( int i = a; i >= b ; i--)
#define rep(i,a,b,k) for(int i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( int i = a; i >= b ; i-= k)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define PI 3.14159265358979323846

typedef long double ld;
typedef long long int ll;
typedef vector<int> vi ;
typedef pair<int,int> ii ;
typedef vector<ii> vii 	;

ld dp[310][310][310];
int n;
ld calc(int a,int b,int c){
	if(a+b+c==0) return 0.0;
	if(a<0 || b<0 || c<0 ) return 0.0;
	if(dp[a][b][c]>0) return dp[a][b][c];
	ld ans = calc(a-1,b,c)*a+calc(a+1,b-1,c)*b+calc(a,b+1,c-1)*c;
	dp[a][b][c]=(n+ans)/(a+b+c);
	return dp[a][b][c];
}
int main(){
	fastio;
	cout<<fixed<<setprecision(15);
	int x,a=0,b=0,c=0;
	cin>>n;
	f(i,0,n){
		cin>>x;
		if(x==1)a++;
		else if(x==2)b++;
		else c++;
	}
	cout<<calc(a,b,c);


}

Measured memory_bytes: 450816
#include <stdio.h>
int main()
{
	int n, i, k, l, m, data[3][200], sum, value;

	scanf("%d",&n);
	
	for(i=0; i<n; i++)
	{
		for(k=0; k<3; k++)
		{
			scanf("%d",&data[k][i]);
		}
	}

	for(k=0; k<3; k++)
	{
		for(i=0; i<n; i++)
		{
			value = data[k][i];

			for(l=0; l<n; l++)
			{
				if(i == l)
				{
					continue;
				}
				if(value == data[k][l]){
					data[k][i] = 0;
					data[k][l] = 0;
				}
			}
		}
	}

	for(i=0; i<n; i++)
	{
		sum = 0;
		for(k=0; k<3; k++)
		{
			sum += data[k][i];
		}
		printf("%d\n",sum);
	}
	return 0;
}

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

int main()
{
  string s, t;
  cin >> s >> t;
  int n = s.size();
  int b[26]{0}, c[26]{0};
  for(int i = 0; i < n; i++){
    b[s[i] - 'a']++;
    c[t[i] - 'a']++;
  }
  sort(b, b + 26);
  sort(c, c + 26);
  for(int i = 0; i < 26; i++){
    if(b[i] != c[i]){
      cout << "No" << endl;
      return(0);
    }
  }
  cout << "Yes" << endl;
}

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

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

    if (a == b && b == c) {
        cout << "Yes" << endl;
    }
    else
        cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

int Solve(int n){
  std::vector<int> a(n);
  int sum=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
    sum+=a[i];
  }
  int average=sum/n;
  std::sort(a.begin(), a.end());
  int result=0;
  for(int i=0;i<n;i++){
    if(a[i]<=average){
      result++;
    }else{
      break;
    }
  }
  return result;
}

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);

  while(1){
    int n;
    cin>>n;
    if(n==0){
      break;
    }
    cout<<Solve(n)<<endl;
  }



  return 0;
}



Measured memory_bytes: 3260
s = input()

if s.count('S') == 3:
  print(0)
elif s.count('S') == 2:
  print(1)
elif s.count('S') == 1:
  if s[1] == 'S':
    print(1)
  else:
    print(2)
elif s.count('S') == 0:
  print(3)


Measured memory_bytes: 61868
class UnionFind:
  def __init__(self, N):
    self.par=[i for i in range(N)]
    self.rank=[0 for _ in range(N)]
    self.size=[1 for _ in range(N)]
    
  def unite(self, x, y):
    x=self.getroot(x)
    y=self.getroot(y)
    if x!=y:
      if self.rank[x]<self.rank[y]:
        x, y=y, x
      if self.rank[x]==self.rank[y]:
        self.rank[x]+=1
      self.par[y]=x
      self.size[x]+=self.size[y]
      
  def united(self, x, y):
    return self.getroot(x)==self.getroot(y)
      
  def getroot(self, x):
    if self.par[x]==x:
      return x
    else:
      self.par[x]=self.getroot(self.par[x])
      return self.par[x]

  def getsize(self, x):
    return self.size[self.getroot(x)]

N, M=map(int, input().split())
UF=UnionFind(N+1)
for i in range(M):
  a, b=map(int, input().split())
  UF.unite(a, b)
  
print(max([UF.getsize(i) for i in range(1, N+1)]))

Measured memory_bytes: 97944
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
using namespace std;
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
int character_count(string text, char character){ int ans = 0; for(int i = 0; i < text.size(); i++){ ans += (text[i] == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
#define mod long(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl(long(n))

int main(){
    int N, M;
    cin >> N >> M;
    vector<pair<int, int>> prefectures[N];
    for(int i = 0; i < M; i++){
        int P, Y;
        cin >> P >> Y;
        prefectures[P - 1].push_back({Y, i});
    }
    string ans[M];
    for(int i = 0; i < N; i++){
        sort(all(prefectures[i]));
        for(int j = 0; j < prefectures[i].size(); j++){
            ans[prefectures[i][j].second] = "000000000000";
            int up = i + 1, down = j + 1;
            for(int k = 5; k >= 0; k--){
                ans[prefectures[i][j].second][k] = up % 10 + '0';
                up /= 10;
                ans[prefectures[i][j].second][k + 6] = down % 10 + '0';
                down /= 10;
            }
        }
    }
    for(int i = 0; i < M; i++){
        cout << ans[i] << endl;
    }
}


Measured memory_bytes: 12416
import sys
input = sys.stdin.buffer.readline
N, x = map(int, input().split())
if N == 2:
  if x == 2:
    print("Yes")
    print(1)
    print(2)
    print(3)
  else:
    print("No")
  exit(0)
if x == 1 or x == 2 * N - 1:
  print("No")
  exit(0)
print("Yes")
if x == 2:
  i = 4
  for _ in range(1, N - 2):
    i += 1
    print(i)
  print(x + 2)
  print(x - 1)
  print(x)
  print(x + 1)
  for _ in range(N + 2, 2 * N):
    i += 1
    print(i)
else:
  i = 0
  for _ in range(1, N - 1):
    if i == x - 3:
      i += 5
    else:
      i += 1
    print(i)
  print(x - 1)
  print(x)
  print(x + 1)
  print(x - 2)
  for _ in range(N + 3, 2 * N):
    if i == x - 3:
      i += 5
    else:
      i += 1
    print(i)

Measured memory_bytes: 48728
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

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

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;

#define all(a) (a).begin(), (a).end()

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

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

    int n, W; cin>>n>>W;
    vector<int> w(n), v(n);
    for(int i=0; i<n; i++) cin>>w[i]>>v[i];

    vector<vector<ll>> dp(n+1, vector<ll>(100010, INF));
    dp[0][0] = 0;
    for(int i=0; i<n; i++){
        for(int j=0; j<=100000; j++){
            chmin(dp[i+1][j], dp[i][j]);
            if(j - v[i] >= 0) chmin(dp[i+1][j], dp[i][j-v[i]] + w[i]);
        }
    }

    int ans = 0;
    for(int i=0; i<=100000; i++){
        if(dp[n][i] <= W) ans = i;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 80256
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <stdlib.h>

int main() {

	char n[5];

	scanf("%s", n);

	if ((n[0] == n[1] && n[1] == n[2]) || (n[2] == n[3] && n[1] == n[2])) printf("Yes\n");
	else printf("No\n");

	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
using namespace std;

typedef long long ll;
typedef vector<int> vi;

int main()
{
	ll x;
	cin >> x;

	ll a, b;
	for (b = -120; b < 120; b++) {
		for (a = b + 1; a <= 120; a++) {

			ll dif = a - b;
			if (x % dif) continue;

			ll y =
				(a * a * a * a) +
				(a * a * a * b) +
				(a * a * b * b) +
				(a * b * b * b) +
				(b * b * b * b);

			if (y == x / dif) {
				cout << a << " " << b << endl;
				return 0;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
 
#define ll long long 
# define skorost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) 

using namespace std ;
 
ll z , o , ans ;

ll N = 1e4 + 15820 ;

int main(){ skorost ;

	string s ;

	cin >> s ;

	vector<int>a(26,0);

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

		a[s[i]-'a'] ++ ;

	}

	for( int i = 0 ; i < 26 ; i ++ ){

		if( a[i] % 2 != 0 ){

			cout << "No" << endl ;

			return 0 ;

		}

	}

	cout << "Yes" << endl ;

	return 0 ;
}

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

const int N=100010;
template<typename T> class myqueue
{
 private:
    T a[N]; 
    int head,sz;
 public:
    myqueue():head(0),sz(0){}
    void push(T val){
        a[(head+sz)%N]=val; sz++;
    }
    void pop(){
        head=(head+1)%N; sz--;
    }
    T front(){ 
        return a[head]; 
    }
    bool empty(){ 
        return sz==0; 
    }
};

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

    int N,T; cin>>N>>T;
    vector<string> name(N);
    myqueue<pair<int,int>> Q;  
    for(int i=0;i<N;i++){
        int time;
        cin>>name[i]>>time;
        Q.push({i,time});
    }

    int cur=0;
    while(!Q.empty()){
        int idx,rest;
        tie(idx,rest)=Q.front(); Q.pop();
        int t=min(rest,T);
        rest-=t; cur+=t;
        if(rest==0){
            cout<<name[idx]<<' '<<cur<<endl;
        }else{
            Q.push({idx,rest});
        }
    }
    return 0;
}


Measured memory_bytes: 6296
/***

    Muhammad Imdad-Ul-Haque Rakib(Attari)
    CSE'19
    Chittagong,Bangladesh

***/


#include<bits/stdc++.h>


/**Definitions**/


#define   ld             long double
#define   ll             long long
#define   boost_         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define   pb             push_back
#define   ppb            pop_back
#define   ull            unsigned long long
#define   over           return 0
#define   scan(i,n,a)    for(i=0;i<n;i++) cin>>a[i]
#define   MP             make_pair
#define   spc            " "

using namespace std;


/** Predefined Functions **/


int gcd(int x,int y){
    if(x==0) return y;
    else return gcd(y%x,x);
}
bool sortbysec(const pair<int,int>&a, const pair<int,int>&b){ return (a.second<b.second); }
bool sortbysecinrev(const pair<int,int>&a, const pair<int,int>&b){ return (a.second>b.second); }
bool sortbysize(string &s1,string &s2){ return s1.size() < s2.size(); }
bool sortinrev(const pair<int,int> &a, const pair<int,int> &b){ return (a.first > b.first); }


/** Main Function **/


int main(){

    boost_;
    string s;
    cin>>s;
    int i;
    map<char,int>mp;
    for(i=0;i<s.size();++i){
        mp[s[i]]++;
    }

    for(auto i:mp){
        if(i.second%2){ cout<<"No"<<endl; over;}
    }

    cout<<"Yes"<<endl;
    over;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
 
#define ll long long
#define Add_Speed ios_base::sync_with_stdio(0);cin.tie(0);
#define ins insert
#define pb push_back
#define pf push_front
#define mp make_pair
#define f first
#define sz size()
#define s second
#define all(s) s.begin(), s.end()
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define inf (int)1e9
#define gcd(a, b) __gcd(a, b)
//#define int ll
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

const int maxn = (int)1e5 + 17;
const int maxm = (int)15e2 + 7;
const int minn = (int)1e4 + 7;
const int mod = (int)1e9 + 7;
const long double PI = acos(-1);
const int P = (int)1e5 + 7;

int n, k, a[maxn], b[maxn], c[maxn], dp[maxn][4];

int main () {
 
    Add_Speed

    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a[i] >> b[i] >> c[i];
    }
    dp[1][1] = a[1], dp[1][2] = b[1], dp[1][3] = c[1];
    for(int i = 2; i <= n; i++){
        dp[i][1] = max(dp[i - 1][2], dp[i - 1][3]) + a[i];
        dp[i][2] = max(dp[i - 1][1], dp[i - 1][3]) + b[i];
        dp[i][3] = max(dp[i - 1][2], dp[i - 1][1]) + c[i];
    }
    cout << max(dp[n][1], max(dp[n][2], dp[n][3]));
}

Measured memory_bytes: 2944
#include<stdio.h>

int main(void) {
    int a,b,i;

    scanf("%d %d",&a,&b);
    i = a>b ? 1 : (a<b ? 2 : 0);
    switch(i) {
        case 0:puts("a == b");       break;
        case 1:puts("a > b");        break;
        case 2:puts("a < b");        break;
        default :break;
    }

    return 0;
} 

Measured memory_bytes: 580
#include <vector>
//#define DEBUG
#define MAXN 10000000
#include <bits/stdc++.h>
using namespace std;


int main() {
#ifdef DEBUG
    freopen("in.in", "r", stdin);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int a, b, c, k;
    cin >> a >> b >> c >> k;

    int ans = 0;

    if (a >= k) {
        ans = k;
        cout << ans << endl;
    } else {
        ans += a;
        k -= a;
        if (b >= k) {
            cout << ans << endl;
        } else {
            k -= b;
            if (c >= k) {
                ans -= k;
                cout << ans << endl;
            }
        }
    }



    /*
    if ((a-k) >= 0) {
        ans += a;
        k -= a;
    }
    if ((k-b) >= 0) {
        k -= b;
    }
    if (k >= 0) {
        ans -= k;
    }
    cout << ans << endl;
    */


    return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <queue>
#include <cstdlib>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
typedef long long ll;

using namespace std;

int main(){
    ll n,tmp = 1,j;
    cin >> n;
    //string *s;
    string str;
    vector <string> s(n);
    //s = new string[n];
    /*
    cin >> s[0];
    for(ll i = 1; i < n; i++){
        cin >> s[tmp];
        for(j = 0; j < tmp; j++){
            //cout << s[j] << tmp << endl;
            if(s[j] == s[tmp]) break;
        }
        //cout << j << tmp << endl;
        if(j == tmp){
            tmp++;
        }
    }
    */
    /*
    for(ll i = 0; i < n; i++){
        cin >> s[i];
    }

    for(ll i = 0; i < n - 1; i++){
        for(ll j = i+1; j < n; j++){
            if(s[i] == s[j]) tmp++;
        }
    }
    */
    for(ll i = 0; i < n; i++){
        cin >> s[i];
    }
    sort(s.begin(),s.end());
    for(ll i = 0; i < n-1; i++){
        if(s[i] != s[i+1]) tmp++;
    }
    cout << tmp << endl;
    return 0;
}

Measured memory_bytes: 9596
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define clr(a) memset(a, 0, sizeof(a))
#define sz(x) x.size()
#define printarray(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout<<*it<<" "; cout<<endl;
#define rep(n) for (ll i = 0; i < n; i++)
#define repc(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, x, y) for (int i = x; i < y; i++)
#define DEC(i, x, y) for (int i = x; i >= y; i--)
#define all(v) v.begin(), v.end()
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define alla(a, n) a, a + n
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * b)/gcd(a, b)
#define int long long int
#define ull unsigned long long

using namespace std;
const int MOD = 1e9 + 7;
const int MAXN = 1e5 + 5;

int fastexpo(int b, int exp){
    if(exp == 0) return 1;
    if(exp == 1) return b;
    int ans = (fastexpo(b,exp/2) % MOD);
    ans *= ans;
    ans %= MOD;
    if(exp % 2 == 1){
        ans *= b;
    }
    ans %= MOD;
    return ans;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    int n;
    cin>>n;
    int a[n];
	for(int i = 0;i<n;i++){
		cin>>a[i];
	}    
	int ans = 0;
	for(int i= 0;i<n;i++){
		for(int j = i + 1;j<n;j++){
			ans += a[i] * a[j];
		}
	}
	cout<<ans<<endl;
    return 0;
}





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

using namespace std;

int main() {
    string S; cin >> S;
    int a=0;
    for(int i = 0; i<S.size(); i++){
        if(S[i] == '+'){
            a += 1;
        }else{
            a -= 1;
        }
    }
    cout << a << endl;

    return 0;
}

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

int main() {
  int n;
  string s;
  cin >> n >> s;
  for(int i=0; i<s.size(); i++) {
    if(s[i]+n<='Z') s[i]=(char)(s[i]+n);
    else s[i]=(char)(s[i]+n-26);
  }
  cout << s << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

static const int N = 1000;

void trace(int A[], int n){
  int i;
  for ( i = 1; i <= n; i++ ){
    if ( i > 1 ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}

int main(){
  int n, i, j;
  int key;
  int A[N+1];
  scanf("%d", &n);

  for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]);
  
  trace(A, n);
  for(j = 2; j < n+1; j++){
    	key = A[j];
    for(i = j -1; i >= 1; i--){ 

	if(key < A[i]){
	A[i+1] = A[i];
	A[i] = key;
      }
    }
    trace(A, n);
  }
  return 0;
}

Measured memory_bytes: 608
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define vl vaector<long>
#define vll vector<long long int>
#define vC  vector<char>
#define FastIO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__)
ll pow(ll x, ll y,ll m) { ll res = 1;x=x%m; while (y > 0) { if (y & 1) res = ((res%m) * (x%m))%m; y = y >> 1; x = ((x%m) * (x%m))%m; } return res%m; }
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1){std::cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}
const ll INF = 0xFFFFFFFFFFFFFFFL;
clock_t time_p=clock();
void abhigyan10()
{time_p=clock()-time_p;cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";}
ll seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline ll rnd(ll l=0,ll r=INF){return uniform_int_distribution<ll>(l,r)(rng);}
#define clrbuf cin.ignore(numeric_limits<streamsize>::max(),'\n');
#define preciset(x) cout<<setprecision(x)<<fixed;
const ll mod =1000000007;
int main()
{
        FastIO


        ll h,w;
        cin>>h>>w;
        if(h>1 && w>1)
        cout<< (h*w +1LL)/2LL;
    	else
    		cout<<1;
        return 0;
    }


Measured memory_bytes: 256
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = float('inf')
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    _LI = lambda : [int(x)-1 for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    SI = lambda : sys.stdin.readline().rstrip()
    DD = ((1,0),(0,1),(-1,0),(0,-1))

    K = NI()
    S = SI()
    LS = len(S)

    f = [1]
    r = [1]
    c = 1
    for i in range(1, K + LS +1):
        c = (c * i) % MOD
        f.append(c)
        r.append(pow(c, MOD - 2, MOD))

    def comb(n, k):
        return (f[n] * r[k] * r[n - k]) % MOD

    ans = 0
    for i in range(K+1):
        ans = (ans + pow(25,i,MOD) * pow(26,K-i,MOD) * comb(i+LS-1,LS-1)) % MOD
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 219948
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
	"strings"
)

func Run(r io.Reader, w io.Writer) {
	sc := NewScanner(r)

	a := sc.ReadLine().Ints()
	N, D := a[0], a[1]

	lines := sc.ReadLines(N).Ints()

	count := 0
	for _, line := range lines {
		d := math.Sqrt(float64(line[0]*line[0] + line[1]*line[1]))
		if float64(D) >= d {
			count++
		}
	}
	fmt.Fprintln(w, count)
}

func main() {
	Run(os.Stdin, os.Stdout)
}

type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner(r io.Reader) *Scanner {
	return &Scanner{sc: bufio.NewScanner(r)}
}

func (s *Scanner) ReadLine() Value {
	if s.sc.Scan() {
		return Value(s.sc.Text())
	}
	panic("scan error")
}

func (s *Scanner) ReadLines(n int) Values {
	var a Values
	for i := 0; i < n; i++ {
		a = append(a, s.ReadLine())
	}
	return a
}

type Value string

func (v Value) String() string {
	return string(v)
}

func (v Value) Int() int {
	n, err := strconv.Atoi(v.String())
	if err != nil {
		panic(err)
	}
	return n
}

func (v Value) Float64() float64 {
	f, err := strconv.ParseFloat(v.String(), 64)
	if err != nil {
		panic(err)
	}
	return f
}

func (v Value) Strings() []string {
	return strings.Split(v.String(), " ")
}

func (v Value) Ints() []int {
	var a []int
	for _, s := range v.Strings() {
		n, err := strconv.Atoi(s)
		if err != nil {
			panic(err)
		}
		a = append(a, n)
	}
	return a
}

func (v Value) Float64s() []float64 {
	var a []float64
	for _, s := range v.Strings() {
		f, err := strconv.ParseFloat(s, 64)
		if err != nil {
			panic(err)
		}
		a = append(a, f)
	}
	return a
}

func (v Value) Runes() []rune {
	return []rune(v.String())
}

type Values []Value

func (v Values) Strings() [][]string {
	var a [][]string
	for _, value := range v {
		a = append(a, value.Strings())
	}
	return a
}

func (v Values) Ints() [][]int {
	var a [][]int
	for _, value := range v {
		a = append(a, value.Ints())
	}
	return a
}

func (v Values) Float64s() [][]float64 {
	var a [][]float64
	for _, value := range v {
		a = append(a, value.Float64s())
	}
	return a
}

func (v Values) Runes() [][]rune {
	var a [][]rune
	for _, value := range v {
		a = append(a, value.Runes())
	}
	return a
}


Measured memory_bytes: 40472
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

//typedef pair<int,int> P;


int main(){
	int x,y,z;
	scanf("%d %d %d", &x, &y, &z);

	int ans = 0;
	while(ans*(y+z)+z <= x){
		ans++;
	}
	printf("%d\n", ans-1);

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <set>
using namespace std;
int main(void){
    int q;
    long long a, b, c, sum_b = 0, sum_l=0, sum_r=0;
    long long num_l = 0, num_r = 0, x;
    multiset<int> left, right;
    cin >> q;
    cin >> c >> a >> b;
    sum_b = b;
    x = a;
    for(int i=1;i<q;i++){
        cin >> c;
        if(c==1){
            cin >> a >> b;
            sum_b += b;
            if(num_l == num_r){
                if(x<a){
                    right.insert(a);
                    num_r++;
                    sum_r+=a;
                }else{
                    right.insert(x);
                    num_r++;
                    sum_r+=x;
                    x=a;
                    left.insert(a);
                    sum_l+=a;
                    auto itr = left.end();
                    itr--;
                    x = (*itr);
                    sum_l-=(*itr);
                    left.erase(itr);

                }
            }else if(num_l < num_r){
                if(a<x){
                    left.insert(a);
                    sum_l+=a;
                    num_l++;
                }else{
                    left.insert(x);
                    sum_l+=x;
                    num_l++;
                    right.insert(a);
                    sum_r+=a;
                    auto itr = right.begin();
                    x = (*itr);
                    sum_r-=(*itr);
                    right.erase(itr);
                }
            }
        }else{
            long long t;
            t = x * num_l -sum_l + sum_r - x *num_r;
            cout << x << " " << sum_b+t << endl;
        }
    }


}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
#define ll unsigned long long int
#define mod 1000000007
bool isPrime[1000001];
ll power(ll a,ll b)
{
    ll result = 1;
    while(b>0)
    {
        if(b%2)
        {
            result = (a*result)%mod;
        }
        a = (a*a)%mod;
        b = b/2;
    }
    return result;
}
int gcd(int a,int b)
{
    if(b==0)
    {
        return a;
    }
    return gcd(b,a%b);
}
void sieve()
{
    memset(isPrime,1,sizeof(isPrime));
    isPrime[0] = isPrime[1] = 0;
    for(int i=2;i*i<=1000000;i++)
    {
        if(isPrime[i])
        {
            for(int j=i*i;j<=1000000;j+=i)
            {
                isPrime[j] = 0;
            }
        }
    }
}
int main()
{
    int x;
    cin>>x;
    cout<<x+x*x+x*x*x;
    return 0;
}

Measured memory_bytes: 3580
(* O(n log n) *)
Scanf.scanf "%d" @@ fun n ->
  let sps = Array.init n @@ fun i -> Scanf.scanf " %s %d" @@ fun s p -> i + 1, s, p in
  let cmp (i, s, p) (j, s1, p1) = if s = s1 then p1 - p else compare s s1 in
  Array.sort cmp sps;
  Array.iter (fun (i, s, p) -> Printf.printf "%d\n" i) sps

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n,d;
    cin>>n>>d;
    ll cnt=0;
    while(n--)
    {
        ll a,b;
        cin>>a>>b;
        a=abs(a);
        b=abs(b);
        d=abs(d);
        if((a*a+b*b)<=d*d)
            cnt++;
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 3644
n = int(input())
s = input()
max_v = 0

for i in range(1,n):
    tmp1 = s[:i]
    tmp2 = s[i:]
    tmp1 = set(tmp1)
    tmp1 = list(tmp1)
    tmp2 = set(tmp2)
    tmp2 = list(tmp2)
    ans = 0
    for j in range(len(tmp1)):
        if tmp1[j] in tmp2:
            ans += 1
    max_v = max(max_v,ans)
    
print(max_v)

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

int n , arr[2][111];

int Do(int i , int j)
{
	if(i>2 or j>n) return 0;
	return max(Do(i+1 , j) + arr[i][j] , Do(i , j+1) + arr[i][j]);
}

int main()
{
	cin >> n;
	for(int i = 1 ; i<= 2; i++) for(int j = 1 ; j <= n ; j++) cin >> arr[i][j];
	cout << Do(1,1) << endl;
}


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

int main(){
  string x;
  cin >> x;
  
  int ans;
  rep(i,x.size()-2){
    string str;
    str += x[i];
    str += x[i+1];
    str += x[i+2];
    int num = stoi(str);
    num = abs(753-num);
    if(i==0){
      ans = num;
    }else{
      if(ans>num) ans = num;
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
x=int(input())
if x>=400 and x<=599:
    print(8)
elif x>=600 and x<=799:
    print(7)
elif x>=800 and x<=999:
    print(6)
elif x>=1000 and x<=1199:
    print(5)
elif x>=1200 and x<=1399:
    print(4)
elif x>=1400 and x<=1599:
    print(3)
elif x>=1600 and x<=1799:
    print(2)
else:
    print(1)
    

Measured memory_bytes: 61660
import collections
k = int(input())
queue = collections.deque(range(1, 10))
for i in range(k - 1):
    x = queue.popleft()
    xmod = x % 10
    if xmod != 0:
        queue.append(10 * x + xmod - 1)
    queue.append(10 * x + xmod)
    if xmod != 9:
        queue.append(10 * x + xmod + 1)
print(queue.popleft())

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

const string YES = "Yes";
const string NO = "No";

void solve(long long N){
    for (int i = 1; i < 10; i++)
    {
        if(N%i==0 and N/i<10){
            cout<<YES<<endl;
            return;
        }
    }
    cout<<NO<<endl;
    
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


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

ll inf=9223372036854775806;

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);
	int n,a,b;
	cin>>n;
	if (n==1){
		cout<<"Hello World";
	}
	else {
		cin>>a>>b;
		cout<<a+b;
	}
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <stdio.h>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define case(i) cout<<"Case #"<<i<<": "
using namespace std;
typedef long long int ll;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const ll INF = 4e18;



int main(){
	int n; cin >> n;
	vector<int> a(n),b;
	rep(i, 0, n) cin >> a[i];
	ll ans = 0;
	rep(i, 0, n) {
		ans += abs(a[i]);
		if (a[i] < 0) {
			a[i] *= -1;
			b.push_back(a[i]);
		}
	}
	sort(a.begin(), a.end());
	if (b.size() % 2) ans -= 2*abs(a[0]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1276
#include <iostream>
#include <vector>
#include <map>

using namespace std;
typedef long long ll;

int main() {
    ll n;   cin >> n;
    
    vector<ll> c(101);
    for (int i = 0; i <= 100; i++)
        c[i] = i;

    for (ll i = 2; i * i <= 100; i++) {
        if (c[i] != i)
            continue;

        for (ll j = i; j * i <= 100; j++) {
            c[j*i] = i;
        }
    }

    map<ll, ll> mp;
    for (int i = 1; i <= n; i++) {
        ll x = i;
        while (x != 1) {
            mp[c[x]]++;
            x /= c[x];
        }
    }
    

    vector<ll> cnt(76, 0);
    for (auto p: mp) {
        ll tmp = p.second;
        if (2 <= tmp)
            cnt[2]++;
        if (4 <= tmp)
            cnt[4]++;
        if (14 <= tmp)
            cnt[14]++;
        if (24 <= tmp)
            cnt[24]++;
        if (74 <= tmp)
            cnt[74]++;
    }
    ll ans = 0;
    ans += (cnt[2]-cnt[4]) * cnt[4] * (cnt[4]-1) / 2;
    ans += cnt[4] * (cnt[4]-1) * (cnt[4]-2) / 2;
    ans += cnt[14] * (cnt[14]-1);
    ans += cnt[14] * (cnt[4] - cnt[14]);
    ans += cnt[24] * (cnt[24] - 1) ;
    ans += cnt[24] * (cnt[2] - cnt[24]);
    ans += cnt[74];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3612
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define eb emplace_back
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<i_i, int> p_i;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef vector<char> vc;
typedef vector<vector<char> > vvc;
typedef vector<double> vd;
typedef vector<vector<double> > vvd;
template<class T> using vv=vector<vector< T > >;
typedef deque<int> di;
typedef deque<deque<int> > ddi;

// cout vector
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size();
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len - 1) s << "\t";
    }
    return s;
}

// cout 2-dimentional vector
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
    int len = vv.size();
    for (int i = 0; i < len; ++i) {
        s << vv[i] << endl;
    }
    return s;
}

int main() {
    string s;
    cin >> s;
    vc st;
    rep (i, (int)s.length()) {
        if ( s[i] == 'B' ) {
            if ( st.size() > 0 ) {
                st.erase(end(st)-1);
            }
        } else {
            st.eb(s[i]);
        }
    }
    rep (i, (int)st.size()) {
        cout << st[i];
    }
    printf("\n");

    return 0;
}


Measured memory_bytes: 888
package main

import (
  "fmt"
)

func main() {

  var n,d int
  fmt.Scan(&n,&d) 
 
  var mod int = n % (2 * d + 1)
  var person int = n / (2 * d + 1) 
  
  if mod == 0 {
    fmt.Println(person)
  } else {
    fmt.Println(person + 1)
  }
}

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define endl "\n"

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

  ll A,B,N;
  cin>>A>>B>>N;
  cout<<(A*(min(N,B-1)%B)-(A*min(N,B-1))%B)/B<<endl;
  return 0;
}


Measured memory_bytes: 3600
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;

vector<pair<string, vector<int>>>data;

void saiki(int now, int level)
{
	for (size_t i = 0; i < level; i++)
	{
		cout << ".";
	}
	cout << data[now].first << endl;
	for (auto x : data[now].second)
	{
		saiki(x, level + 1);
	}
}

int main()
{
	int N;
	cin >> N;
	data.resize(N+1);
	int a;
	for (size_t i = 1; i <= N; i++)
	{
		cin >> a;
		data[a].second.push_back(i);
		cin >> data[i].first;
	}
	for (auto x : data[0].second)
	{
		saiki(x, 0);
	}
	return 0;
}

Measured memory_bytes: 1424