akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
# ifdef DEB
# define debug(...) fprintf(stderr, __VA_ARGS__)
# else
# define debug(...)
#endif
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define LL long long
#define LD long double
#define PII pair<int, int>
#define PLL pair<LL, LL>
#define pb pop_back
#define VI vector<int> 
#define VPI vector<PII> 
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define FORD(i,a,b) for(int i = (a); i >= (b); i--)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define ALL(x) (x).begin(), (x).end()
#define siz(V) ((int)V.size())
#define int LL

int n, W, first;
PII T[4];
vector<int> V[4], P[4];
int res;

main()
{
  //ios_base::sync_with_stdio(0);
  scanf("%lld%lld", &n, &W);
  int w, v;
  scanf("%lld%lld", &w, &v);
  first = w;
  V[0].PB(-v);
  T[0].F--;
  for (int i = 0; i < 4; i++)
  {
    T[i].S = i;
  }
  for (int i = 1; i < n; i++)
  {
    scanf("%lld%lld", &w, &v);
    T[w - first].F--;
    V[w - first].PB(-v);
  }
  for (int i = 0; i < 4; i++)
  {
    sort(ALL(V[i]));
    P[i].PB(0);
    if (V[i].empty())
    {
      continue;
    }
    P[i].PB(-V[i][0]);
    for (int j = 1; j < siz(V[i]); j++)
    {
      P[i].PB(P[i][j] - V[i][j]);
    }
  }
  /*for (int i = 0; i < 4; i++)
  {
    for (int j = 0; j < siz(P[i]); j++)
    {
      printf("%d ", P[i][j]);
    }
    printf("\n");
  }
  for (int i = 0; i < 4; i++)
  {
    printf("     %d %d\n", T[i].F, T[i].S);
  }
  printf("first %d\n", first);*/
  for (int i = 0; i <= -T[0].F; i++)
  {
    for (int j = 0; j <= -T[1].F; j++)
    {
      for (int k = 0; k <= -T[2].F; k++)
      {
        for (int l = 0; l <= -T[3].F; l++)
        {
          if (i * (first + T[0].S) + j * (first + T[1].S) + k * (first + T[2].S) + l * (first + T[3].S) <= W)
          {
            res = max(res, P[0][i] + P[1][j] + P[2][k] + P[3][l]);
          }
          
        }
      }
    }
  }
  printf("%lld\n", res);
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    double f;
    int a,b,r,d;
    scanf("%d %d",&a,&b);
    d=a/b;
    r=a%b;
    f=1.0*a/b;
    printf("%d %d %.5lf\n",d,r,f);
return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	if (a <= 0 && b >= 0) return 0 * puts("Zero");
	int neg = 0;
	if (a <= 0) neg += -a;
	if (b < 0) neg += -b - 1;
	if (neg & 1) puts("Negative"); else puts("Positive");
}



Measured memory_bytes: 256
n=input()
q=n[0]
if len(n)==1:
	print(q)
	exit()
if n[0]=="1":
	for i in range(len(n)-1):
		if n[i+1]!="9":
			print(9*(len(n)-1))
			exit()
	print(1+9*(len(n)-1))
else:
	for i in range(len(n)-1):
		if n[i+1]!="9":
			print(int(n[0])-1+9*(len(n)-1))
			exit()
	print(int(n[0])+9*(len(n)-1))


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string> 
#include <string.h>
#include <set>
#include <stdlib.h>
#include <cstdio>
#include <cstdlib> 
using namespace std; 
int main()
{
	int r,g,b;
	cin>>r>>g>>b;
	if((100*r+10*g+b) % 4==0) cout<<"YES";
	else
	cout<<"NO"; 
	return 0;
}

Measured memory_bytes: 256
import sys 
try:
	sys.stdin = open('input.txt', 'r') 
	sys.stdout = open('output.txt', 'w')
except:
	pass

input = sys.stdin.readline

n = int(input())
arr = list(map(int,input().split()))

arr = list(enumerate(arr))
arr.sort(reverse = True, key = lambda x:(x[1]))
dp = [[0 for c in range(n+1)] for r in range(n+1)]
ans = 0
for r in range(n+1):
	st = r-1
	for c in range(n+1-r):
		if r==c==0:
			pass
		elif r-1<0:
			dp[r][c] = dp[r][c-1] + ( arr[st][1] * abs((arr[st][0]+1) - (n+1-c)) )

		elif c-1<0:
			dp[r][c] = dp[r-1][c] + ( arr[st][1] * abs((arr[st][0]+1) - r) )

		else:
			dp[r][c] = max( dp[r-1][c] + ( arr[st][1] * abs((arr[st][0]+1) - r) ), 
						dp[r][c-1] + ( arr[st][1] * abs((arr[st][0]+1) - (n+1-c)) )                           
						)
		ans = max(ans, dp[r][c])
		st += 1
print(ans)

Measured memory_bytes: 102040
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000

#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

int n;
vector<int>pos[3];
vector<int>num;
string s;
const ll mod = 998244353;

int main(){
	cin >> n >> s;
	rep(i,s.size()){
		if(s[i] == 'R') pos[0].pb(i);
		else if(s[i] == 'G') pos[1].pb(i);
		else pos[2].pb(i);
	}
	num.resize(s.size(),0);
	rep(i,n){
		int mn = min(pos[0][i],min(pos[1][i],pos[2][i]));
		int mx = max(pos[0][i],max(pos[1][i],pos[2][i]));
		num[mn] ++;
		num[mx] --;
	}
	ll ans = 1;
	int cur = 0;
	int cur2 = 0;
	rep(i,s.size()){
		if(num[i] == 1) cur ++;
		else if(num[i] == 0) {
			ans = ans*cur%mod;
			cur--; cur2++;
		}
		else{
			ans = ans*cur2%mod;
			cur2--;
		}
	}
	repn(i,n) ans = ans*i%mod;
	cout << ans << endl;
}

Measured memory_bytes: 3324
n,w = list(map(int,input().split()))
wv = []
for i in range(n):
    wi,vi = list(map(int,input().split()))
    wv.append((wi,vi))

dp = [[0] * (w+1) for i in range(n)]

for i in range(wv[0][0],w+1):
    dp[0][i] = wv[0][1]
for i in range(1,n):
    for j in range(0,w+1):
        if wv[i][0] > j:
            dp[i][j] = dp[i-1][j]
        else:
            dp[i][j] = max(dp[i-1][j],dp[i-1][j-wv[i][0]]+wv[i][1])

#print(dp)

print(dp[n-1][w])


Measured memory_bytes: 119660
/**
 *      ABC 67 B
 *      author  : kyomukyomupurin
 *      created : 2018-09-04 23:53:02
**/

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int N, K; cin >> N >> K;
    int l[50] = {};
    for (int i = 0; i < N; ++i) {
        cin >> l[i];
    }
    sort(l, l + N, greater<int>());
    int max = 0;
    for (int i = 0; i < K; ++i) {
        max += l[i];
    }
    cout << max << endl;

    return 0;
}

Measured memory_bytes: 256
//#define LOCAL

#include <fstream>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <cstring>

#define int long long
//typedef long long ll;
#define rep(i, n) for(int i=0; i<(n); i++)

#define MOD 1000000007

using namespace std;

int n, m;
int x[100010], y[100010];

signed main()
{
#ifdef LOCAL
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
#endif

    cin >> n >> m;
    rep(i,n) cin >> x[i];
    rep(i,m) cin >> y[i];

    int sum_x = 0;
    rep(i,n) {
        sum_x += i * x[i] - (n - i - 1) * x[i];
    }
    sum_x %= MOD;

    int sum_y = 0;
    rep(i,m) {
        sum_y += i * y[i] - (m - i - 1) * y[i];
    }
    sum_y %= MOD;

    cout << (sum_x * sum_y) % MOD << endl;
}


Measured memory_bytes: 1792
N = int(input())
A = list(input().split())
A = [int(i) for i in A]
if 0 in A:
    print(0)
    exit(0)

ans = 1
for i in A:
    ans *= i
    if ans > 10**18:
        print('-1')
        exit(0)
print(ans)


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

int n ;

int a[100010] ;

int b[100010] ;

int tree[200010] ;

void update(int pos){
	while(pos <= 2 * n){
		tree[pos] ++ ;
		pos += pos & (-pos) ;
	}
}

int get(int pos){
	int ans = 0 ;
	while(pos){
		ans += tree[pos] ;
		pos -= pos & (-pos) ;
	}
	return ans; 
}

bool check(int value){
	long long total = 0 ;
	int cur = n ;
	update(n) ;
	for (int i = 1; i <= n; ++ i){
		if(a[i] <= value) cur ++ ;
		else cur -- ;
		total += 1ll * get(cur - 1) ;
		update(cur) ;
	}	
	memset(tree, 0, sizeof(tree)) ;
	long long limit = 1ll * n * (n + 1) / 2 ;
	limit = (limit + 2ll) / 2 ;
	return total >= limit ;
}

int main(){
	#define NAME "MEDIAN"
	//freopen( NAME".inp" , "r" , stdin ) ; freopen( NAME".out" , "w" , stdout ) ;

	ios_base :: sync_with_stdio(false) ;

	cin >> n ;

	for (int i = 1; i <= n; ++ i) cin >> a[i], b[i] = a[i] ;

	sort(b + 1, b + n + 1) ;
	
	int l = 1, r = n ;

	while(l < r){
		int mid = (l + r) / 2 ;
		if(check(b[mid])) r = mid ;
		else l = mid + 1 ;
	}

	cout << b[l] << endl ;

	return 0 ;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
using namespace std;

int main(){
    int n,d,c=0;
    cin>>n>>d;
    vector<vector<int>> x(n,vector<int>(d));
    rep(i,n){
        for(int j=0;j<d;j++){
            cin>>x[i][j];
        }
    }
    rep(i,n){
        for(int j=i+1;j<n;j++){
            int num=0;
            rep(k,d){
                int diff = abs(x[i][k]-x[j][k]);
                num += diff * diff;
            }
            rrep(k,num){
                if(k*k==num) c++;
            }
        }
    }
    cout<<c<<endl;
    return 0;
}

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


typedef long long i64;

i64 n;



vector<i64> vec;

int main()
{
	cin >> n;

	for(int i = 1;i <= n;i++)
	{
		i64 a;
		cin >> a;
		vec.push_back(a);
	}

	

	i64 result = 0;
	while(true)
	{
		i64 s = 0;
		bool out = true;

		for(int i = 0;i < n;i++)
		{
			s += vec[i] / n;
			if(vec[i] >= n)
			{
				out = false;
			}
		}

		if(out) break;

		for(int i= 0;i < n;i++)
		{
			i64 cou = (vec[i] / n);
			vec[i] -= (cou) * n;
			vec[i] += s - (cou);
			result += (cou);
		}
	}

	cout << result << endl;
	return 0;

}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

const int INF = INT_MAX / 2;

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

    vector<int> dp(n, INF);
    dp[0] = 0;
    for(int i=0; i<n-1; ++i){
        dp[i+1] = min(dp[i+1], dp[i] + abs(h[i] - h[i+1]));
        if(i < n - 2)
            dp[i+2] = min(dp[i+2], dp[i] + abs(h[i] - h[i+2]));
    }
    cout << dp[n-1] << endl;

    return 0;
}


Measured memory_bytes: 1024
n = gets.to_i
h = gets.split.map &:to_i

diff = h

count = 0

ps = nil
p_min = -1
is_remain = true

while is_remain
	is_remain = false
	(0..diff.size).each {|i|
		if diff[i] != nil && diff[i] > 0 then
			is_remain = true
			if ps == nil then
				ps = i
				p_min = diff[i]
			else
				p_min = [p_min, diff[i]].min
			end
		else
			if ps != nil then
				(ps...i).each{|j|
					diff[j] -= p_min
				}
				count += p_min
				p_min = -1
				ps = nil
			end
		end 
	}
end

puts count

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

int main(){
  int N,M;
  cin >> N >> M;
  
  vector<int>city(N);
  vector<int>road(N);
  
  for(int i=0;i<N;i++){
    city.at(i)=i+1;
  }
  
  for(int j=0;j<2*M;j++){
    int s;
    cin >> s;
    for(int i=0;i<N;i++){
      if(s==city.at(i)){
        road.at(i)++;
        break;
      }
    }
  }
  for(int i=0;i<N;i++){
    cout << road.at(i) << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int N = 1e5+10;
const int MAX = 1e5+10;
const double exps = 1e-8;

inline int max(int a, int b) { return a > b ? a : b; }
inline int min(int a, int b) { return a > b ? b : a; }
int a[] = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
           1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51}; 
int main() {
    int k;
    cin>>k;
    cout<<a[k-1];
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int , int> P;
typedef pair<ll, ll> PL;
const int INT_INF = 2147483646;
const ll LL_INF = 9223372036854775807;

bool SecondCompare(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second>b.second;
}

int h,n,w;
int a,b;
int p[101];

int main(){
    cin >> n;
    cin >> a >> b;
    for(int i = 0; i < n; i++){
           cin >> p[i];
    }
    sort(p,p+n);

       int s1,s2;
    for(int i = 0;i < n; i++){
           if(a<p[i]){
                  s1 = i;
                  break;
           }
           if(i == n-1)     s1 = n;
    }
    for(int i = 0; i < n; i++){
           if(b<p[i]){
                  s2 = i;
                  break;
           }
           if(i == n-1)     s2 = n;
    }
    int ans = 0;
    for(int i = 0; i < n; i++){
           if(p[i]> a || p[s1] > b || s2 == n){
                  break;
           }
           ++s1;
           ++s2;
           ++ans;
    }
                      cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <ctime>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <stack>
#include <deque>
#include <queue>
#include <list>
#include <array>
#include <string>
#include <cstring>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <random>
#include <chrono>
#include <fstream>

#define PI 3.14159265359
#define mt make_tuple
#define mp make_pair
#define pii pair <int, int>
#define pll pair <long long, long long>
#define all(x) (x).begin(), (x).end()

//mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());

using namespace std;

int main()
{
	int x;
	cin >> x;
	if (x == 0)
		cout << 1 << "\n";
	else
		cout << 0 << "\n";

	return 0;
}



Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    int A, B;
    cin >> A >> B;
    cout << A * B << endl;
    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値

// nCk を取得
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
int main(){
ll n;
string s;
cin>>s;
n=s.size();
ll counter=0;
ll a=0;
ll b=0;
ll f1=0;
ll f2=0;
for(ll i=0; i<n-1; i++){
if(s.at(i)=='A'){
a++;}
if(s.at(i)=='B'&&s.at(i+1)=='C'){
counter+=a;
i++;
continue;}
if(s.at(i)=='C'){
a=0;}
if(s.at(i)=='B'&&s.at(i+1)=='B'){
a=0;}
if(s.at(i)=='B'&&s.at(i+1)=='A'){
a=0;}
}

cout<<counter<<endl;}


Measured memory_bytes: 3748
import java.io.*;
import java.util.*;

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static long cnt=0;
	public static void main(String[] args) throws Exception {
		solution(args);
		if(in!=null){
			in.close();
		}
	}

	public static void solution(String[] args) throws Exception{
		int N = nextInt();

		long[] h = nextLongs();
		long ans =0;
		int st=0;

		while(st!=N){
			for(int i=st;i<N;i++){
				if(h[st]==0){
					st=st+1;
				}else{
					break;
				}
			}
			long min=Long.MAX_VALUE;
			int eIdx=N;
			for(int i=st;i<N;i++){
				if(h[i]==0){
					eIdx=i;
					break;
				}
				min=Math.min(min, h[i]);
			}
			for(int i=st;i<eIdx;i++){
				h[i]-=min;
			}
			if(min!=Long.MAX_VALUE){
				ans+=min;
			}
		}
		System.out.println(ans);
	}





	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}

}



Measured memory_bytes: 21332
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

template <typename T> // T : type of cost
struct BellmanFord {
    T inf = numeric_limits<T>::max(); // initial value, reused when clear() is called
    int n;                            // number of nodes
    vector<T> dist;                   // distance from start node
    bool negativeLoop;
    struct edge {
        int from, to;
        T cost;
        edge(int from, int to, T cost) : from(from), to(to), cost(cost) {}
    };
    vector<edge> edges;

    BellmanFord(int n) : n(n), negativeLoop(false), dist(n, inf){};
    // 0-indexed!
    void addEdge(int from, int to, T cost) { edges.emplace_back(from, to, cost); }
    // calculate dist[i] as a shortest distance from start (to end)
    // end is used to check if there is "relevant" negative circuit
    // even if there is negative curcuit, it might not affect the path of interest
    void build(int start, int end = -1) {
        dist[start] = 0;
        for (int i = 0; i < n; ++i) {
            for (auto &e : edges) {
                if (dist[e.from] != inf && dist[e.to] > dist[e.from] + e.cost) {
                    dist[e.to] = dist[e.from] + e.cost;
                    if (i == n - 1 && (end == -1 || end == e.to)) {
                        negativeLoop = true;
                        break;
                    }
                }
            }
        }
    }
};

int main() {
    int n, m;
    cin >> n >> m;
    BellmanFord<ll> graph(n);
    for (int i = 0; i < m; ++i) {
        ll a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        graph.addEdge(a, b, -c);
    }
    graph.build(0, n - 1);
    if (graph.negativeLoop) {
        cout << "inf"
             << "\n";
    } else {
        cout << -graph.dist[n - 1] << "\n";
    }

    return 0;
}

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

typedef long long ll;
typedef long double lld;
using namespace std;

#define endl "\n"
#define fi first
#define se second
#define MEMS(a,b) memset(a,b,sizeof(a))
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define __ freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define all(c) c.begin(),c.end()
#define pii pair<int, int>

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rand(int l, int r)
{
	uniform_int_distribution<int> uid(l, r);
	return uid(rng);
}

#define tr(...) cout<<__FUNCTION__<<' '<<__LINE__<<" = ";trace(#__VA_ARGS__, __VA_ARGS__)
template<typename S, typename T>
ostream& operator<<(ostream& out,pair<S,T> const& p){out<<'('<<p.fi<<", "<<p.se<<')';return out;}

template<typename T>
ostream& operator<<(ostream& out,vector<T> const& v){
ll l=v.size();for(ll i=0;i<l-1;i++)out<<v[i]<<' ';if(l>0)out<<v[l-1];return out;}

template <typename T>
ostream &operator<<(ostream &out, set<T> const &v) {
    for (auto i = v.begin(); i != v.end(); i++)
        out << (*i) << ' ';
    return out;
}
template <typename T>
ostream &operator<<(ostream &out, multiset<T> const &v) {
    for (auto i = v.begin(); i != v.end(); i++)
        out << (*i) << ' ';
    return out;
}
template <typename T, typename V>
ostream &operator<<(ostream &out, map<T, V> const &v) {
    for (auto i = v.begin(); i != v.end(); i++)
        out << "\n" << (i->first) <<  ":"  << (i->second);
    return out;
}

template<typename T>
void trace(const char* name, T&& arg1){cout<<name<<" : "<<arg1<<endl;}

template<typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cout.write(names, comma-names)<<" : "<<arg1<<" | ";trace(comma+1,args...);}

// #define int ll

const int MAXN = 1e7 + 4;

std::vector <int> prime;
bool is_composite[MAXN];
int phi[MAXN];
int ans[MAXN];
int connect[MAXN];
int cnt[MAXN];

void sieve (int n) {
	std::fill (is_composite, is_composite + n, false);
	phi[1] = 1;
	for (int i = 2; i < n; ++i) {
		if (!is_composite[i]) {
			prime.push_back (i);
			phi[i] = i;					//i is prime
		}
		for (int j = 0; j < prime.size () && i * prime[j] < n; ++j) {
			is_composite[i * prime[j]] = true;
			if (i % prime[j] == 0) {
				phi[i * prime[j]] = prime[j];
				break;
			} else {
				phi[i * prime[j]] = prime[j];	//prime[j] does not divide i
			}
		}
	}
    // tr("sdf");
}

int solve() {
    sieve(10000001);
    int n;
    cin >> n;
    ll anss = 1;
    ans[1] = 1;
    for (int i = 2; i <= n; i++) {
        int x = i;
        int cnt = 0;
        while (x % phi[i] == 0) {
            cnt += 1;
            x /= phi[i];
        }
        ans[i] = ans[x] * (cnt + 1);
        anss += 1ll * i * ans[i];
    }
    cout << anss << endl;
    return 0;
}

int32_t main(){ _
    int t;
    // cin >> t;
    t = 1;
    while (t--) solve();
    return EXIT_SUCCESS;	
}


Measured memory_bytes: 93944
#include<iostream>
using namespace std;
 
int main(){
 int N,W;
 cin>>N>>W;
 
 int v[N],w[N];
 
 for(int i=0;i<N;i++){
    cin>>v[i]>>w[i];
 }
 
 int DP[N+1][W+1];
 
 for(int j=0;j<=W;j++){
    DP[0][j]=0;
 }
 
 for(int i=1;i<=N;i++){
    for(int j=0;j<=W;j++){
        if(j<w[i-1]){
            DP[i][j]=DP[i-1][j];
        }else{
            if(DP[i-1][j]>DP[i-1][j-w[i-1]]+v[i-1]){
                DP[i][j]=DP[i-1][j];
            }else{
                DP[i][j]=DP[i-1][j-w[i-1]]+v[i-1];
            }
        }
    }
 }
 cout<<DP[N][W]<<endl;
return 0;
}

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

int main() {
  int x, count;
  cin >> x;
  if (x < 2) {
    cout << 1;
  }else if (x < 4) {
    cout << 2;
  }else if (x < 8) {
    cout << 4;
  }else if (x < 16) {
    cout << 8;
  }else if (x < 32) {
    cout << 16;
  }else if (x < 64) {
      cout << 32;
    }else {
      cout << 64;
    }
}

Measured memory_bytes: 3584
n, m = map(int, input().split())
x = list(map(int, input().split()))
x.sort()


arr = []
for i in range(1,len(x)):
    arr.append(x[i] - x[i-1])

    
arr.sort()
arr.reverse()
print(x[-1] - x[0] - sum(arr[:n-1]))

Measured memory_bytes: 13968
import scala.io.Source

object Main extends App {

  val input: List[(String, Int)] = Source.stdin.getLines.toList.tail
                                     .map(_.split(" "))
                                     .map(arr => (arr(0), arr(1).toInt))

  val fullSet: List[(String, Int)] =
    for {
      s <- List("S", "H", "C", "D")
      i <- 1 to 13
    } yield (s, i)

  def missingCards(input: List[(String, Int)]) =
    for {
      card <- fullSet
      if (!input.contains(card))
    } yield card

  missingCards(input).map { case (str, int) => s"$str $int" }.map(println)
}

Measured memory_bytes: 44220
#include"bits/stdc++.h"
	using namespace std;


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

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
int main()
{char a[100];
 int x,y;
 scanf("%d%d",&x,&y);
 scanf("%s",a);
 if(a[x]!='-')
   {printf("No\n");
    return 0;} 
 for(int i=0;i<x;i++)
    if(!(a[i]>='0'&&a[i]<='9'))
      {printf("No\n");
       return 0;}
 for(int i=x+1;i<=x+y;i++)
    if(!(a[i]>='0'&&a[i]<='9'))
      {printf("No\n");
       return 0;}
 printf("Yes\n");
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void){
	int debt = 100000;
	int dmod1000;
	int week,i;
	scanf("%d",&week);
	for(i = 0; i < week; i++){
		debt *= 1.05;
		dmod1000 = debt % 1000;
		if(dmod1000){
			debt += (1000-dmod1000);
		}
	}
	printf("%d\n",debt);
	return 0;
}

Measured memory_bytes: 0
# -*- coding: utf-8 -*-
from collections import Counter
n = int(input())
a = [int(i) for i in input().split()] 

c = Counter(a)
a.sort()
max_a = a[-1]
flag = [True for _ in range(max_a+1)]
ans = []
for i in a:
    if c[i] >= 2:
        flag[i] = False
    
    for j in range(i + i, max_a + 1, i):
        flag[j] = False
for i in a:
    if flag[i]:
        ans.append(i)
#print(ans)
print(len(ans))


Measured memory_bytes: 42776
#define _CRT_SECURE_NO_WARNINGS

#pragma comment(linker, "/STACK:250000000")

#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <complex>
#include <functional>
#include <numeric>
#include <random>
#include <cstring>
#include <ctime>
#include <cassert>

#define y1 klfjvkldfngldf

using namespace std;

typedef long long LL;

int n;
int a[300000];

multiset<pair<int, int> > L, M, R;

int main()
{
	scanf("%d", &n);
	for (int i = 0; i < 3 * n; ++i)
		scanf("%d", &a[i]);

	LL sL = 0;
	for (int i = 0; i < n; ++i)
	{
		L.insert({ a[i], i });
		sL += a[i];
	}

	LL sR = 0;
	for (int i = n; i < 3 * n; ++i)
	{
		R.insert({ a[i], i });
		sR += a[i];
		if (R.size() > n)
		{
			sR -= R.rbegin()->first;
			M.insert(*R.rbegin());
			R.erase(*R.rbegin());
		}
	}
	LL score = sL - sR;

	for (int i = n; i < 2 * n; ++i)
	{
		pair<int, int> p = { a[i], i };
		if (M.count(p))
			M.erase(p);
		else
		{
			sR -= p.first;
			R.erase(p);
			R.insert(*M.begin());
			sR += M.begin()->first;
			M.erase(M.begin());
		}
		sL += a[i];
		L.insert({ a[i], i });
		sL -= L.begin()->first;
		L.erase(L.begin());
		score = max(score, sL - sR);
	}

	cout << score << '\n';

	return 0;
}

Measured memory_bytes: 15488
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, 0, n) cin >> a[i];
    int ans = 0;
    rep(i, 0, n - 1){
        if(a[i] == i + 1){
            swap(a[i], a[i + 1]);
            ans++;
        }
    }
    if(a[n - 1] == n) ans++;
    cout << ans << endl;
}

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



int main(){
    
   
	
	string s;

	cin>>s;
	
	if(s=="SSS")
	cout<<0<<endl;
	
	else if(s=="RRR")
	cout<<3<<endl;
	
	else if(s=="SSR"|| s=="SRS"||s=="RSS")
	cout<<1<<endl;
	
	else if(s=="SRR"|| s=="RRS")
	cout<<2<<endl;
	
	else if(s=="RSR")
	cout<<1<<endl;
	

	

    
        
        
        
        
        
    




}

Measured memory_bytes: 3624
#pragma warning(disable:4996)
#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)
#define TPL template
#define TNM typename

using ll = long long;
using ull = unsigned long long;
TPL<TNM T> using vec = vector<T>;
TPL<TNM T> using vec2 = vec<vec<T>>;
TPL<TNM T> using vec3 = vec<vec2<T>>;
TPL<TNM T> using vec4 = vec<vec3<T>>;
TPL<TNM T> using vec5 = vec<vec4<T>>;

TPL<TNM K, TNM V> using umap = unordered_map<K, V>;
TPL<TNM K, TNM V> using uset = unordered_set<K, V>;

struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(6); } } pre__;

TPL<TNM V, TNM H> void resize(vector<V>& v, const H h) { v.resize(h); }
TPL<TNM V, TNM H, TNM ... T> void resize(vector<V>& v, const H& h, const T ... t) { v.resize(h); for (auto& _v : v) resize(_v, t ...); }
TPL<TNM V, TNM T> void fill(V& x, const T& val) { x = val; }
TPL<TNM V, TNM T> void fill(vector<V>& vec, const T& val) { for (auto& v : vec) fill(v, val); }

int main(void) {
	string s, t;
	cin >> s >> t;
	sort(ALL(s));
	sort(ALL(t), greater<char>());
	if (s < t) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
s=gets.chomp
k=gets.to_i(&:to_i)

z="z".ord+1

s=s.chars.map do |c|
  next c if k <= 0
  next c if c == "a"
  next c if z-c.ord > k
  k -= (z-c.ord)
  'a'
end

if k > 0
  k=k%26
  a = s[-1].ord+k
  s[-1] = a > "z".ord ? (a-26).chr : a.chr
end

puts s.join



Measured memory_bytes: 13820
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
const ll BIG=1e15;

ll mp[2001][2001], mp2[2001][2001];
int N,K,KK;

void rect(int x0, int x1, int y0, int y1){
    if(x1>KK){
        rect(x0,KK,y0,y1);
        rect(0,x1-KK,y0,y1);
        return;
    }
    if(y1>KK){
        rect(x0,x1,y0,KK);
        rect(x0,x1,0,y1-KK);
        return;
    }
    mp[x0][y0]++;
    mp[x0][y1]--;
    mp[x1][y0]--;
    mp[x1][y1]++;

}

int main(){
    
    cin>>N>>K;
    vector<pair<ll,ll>> d;
    KK=2*K;
    for(int i=0;i<N;i++){
        ll x,y;
        char c;
        cin>>x>>y>>c;
        if(c=='B') d.push_back(make_pair(x%KK,y%KK));
        else d.push_back(make_pair(x%KK,(y+K)%KK));
    }

    //for(int i=0;i<N;i++) cout<<d.at(i).first<<' '<<d.at(i).second<<endl;
    for(int i=0;i<N;i++){
        int x=d.at(i).first, y=d.at(i).second;
        rect(x,x+K,y,y+K);
        x=(x+K)%KK;
        y=(y+K)%KK;
        rect(x,x+K,y,y+K);
    }

    for(int i=0;i<=KK;i++){
        ll memo=0;
        for(int j=0;j<=KK;j++){
            memo+=mp[i][j];
            mp2[i][j]=memo;
        }
    }
    for(int i=0;i<=KK;i++){
        ll memo=0;
        for(int j=0;j<=KK;j++){
            memo+=mp2[j][i];
            mp[i][j]=memo;
        }
    }

    ll ans=0;
    for(int i=0;i<KK;i++){
        for(int j=0;j<KK;j++) {ans=max(ans,mp[i][j]);}
       //cout<<endl;
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 64496
#include <bits/stdc++.h>
#include <vector>
#include <cmath>
using namespace std;
 
int main() {
    string s; cin >> s;
    int size = s.size();
    if(s[size-1]=='s')
        cout << s << "es" << endl;
    else
    {
        cout << s << "s" << endl;
    }
    
}

Measured memory_bytes: 3620
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<vector>
#include<string> 
#include<queue>
#include<set>
#include<algorithm>
using namespace std;
#define INF 0x3f3f3f3f
#define ll long long
int main()
{
	int n,i,e=0,w=0,a[300005],b[300005];
	char s[300005];
	cin>>n;
	int ans=INF;
	scanf("%s",s);
	memset(a,0,sizeof(a));
	memset(b,0,sizeof(b));
	for(i=0;i<n;i++)
	{
		if(s[i]=='E')e++;
		else w++;
		a[i]=e;
		b[i+1]=w;
	}
	for(i=0;i<n;i++)
	{
		ans=min(ans,b[i]+(e-a[i]));
	}
	cout<<ans<<endl;
	return 0;
 } 

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i=0; i<int(n); i++)
#define RNG(i, f, t) for(int i=int(f); i<=int(t); i++)
#define REV(i, f, t) for(int i=int(f); i>=int(t); --i)
#define ALL(v) (v).begin(), (v).end()
bool RELAXED = false;
template<int,typename T> struct MINMAX{ T val; MINMAX(T val) : val(val) {} };
template<typename T> MINMAX<1,T> MAX(T val) { return MINMAX<1,T>(val); };
template<typename T> MINMAX<2,T> MIN(T val) { return MINMAX<2,T>(val); };
template<typename T, typename U> inline T& operator|=(T &lhs, MINMAX<1,U> rhs) { return lhs = (rhs.val > lhs ? (RELAXED=true,rhs.val) : (RELAXED=false,lhs)); }
template<typename T, typename U> inline T& operator|=(T &lhs, MINMAX<2,U> rhs) { return lhs = (rhs.val < lhs ? (RELAXED=true,rhs.val) : (RELAXED=false,lhs)); }
template<typename T> inline vector<T> readVector(int n) { vector<T> vec(n); FOR(i,n) cin>>vec[i]; return vec; }
template<typename T> void EXIT(T answer) { cout<<answer<<endl; exit(0); }
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef signed long long int ll;

const int MAXN =1e5+5;
const int MOD =1e9+7;
vector<vi> adj(MAXN);

int dp[MAXN][5];

int dfs(int u, int p, int pb) {
    if(dp[u][pb]<MOD)
        return dp[u][pb];

    ll waysSum=0;

    FOR(b,2) {
        if(b&&pb) continue;
        ll ways=1;

        for(auto to : adj[u]) {
            if(to==p) continue;
            ways *= dfs(to, u, b);
            ways %= MOD;
        }
        waysSum += ways;
        waysSum %= MOD;
    }

    return dp[u][pb]=waysSum;
}

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

    memset(dp, 0x7f, sizeof dp);

    int n; cin>>n;
    FOR(i,n-1) {
        int a,b;
        cin>>a>>b;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }

    cout<<dfs(1, -1, 0)<<endl;

    return 0;
}



Measured memory_bytes: 17408
#include <cstdio>

int main(){
    int n;
    scanf("%d",&n);
    for(int i = 0; i <= n / 7; i++){
        for(int j = 0; j <= n / 4; j++){
            if(7 * i + 4 * j == n){
                printf("Yes\n");

                return 0;
            }
        }
    }

    printf("No\n");

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <set>
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

#define ll unsigned long long
const ll N = 1000000000;

void solve() {
}

int main(){
    int n, k;
    cin >> n >> k;
    int a[101];
    fill(a, a + 101, 1);
    for (int i = 0; i < k; ++i) {
        int d; cin >> d;
        for (int j = 0; j < d; ++j) {
            int p; cin >> p;
            a[p] = 0;
        }
    }

    int ans = 0;
    for (int i = 1; i <= n; ++i) ans += a[i];

    cout << ans;

    return 0;
}

Measured memory_bytes: 3636
N=parse(readline())
if ispow2(N)
	println("No")
	exit()
end
println("Yes")
for i=2:2:N-1
	println("1 $i")
	println("$i $(i+1)")
	println("1 $(i+1+N)")
	println("$(i+1+N) $(i+N)")
end
println("3 $(N+1)")
if N%2==0
	M=prevpow(2,N)
	println("$M $N")
	println("$((M$N$1)+N) $(2N)")
end

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

using namespace std;

#define MAX 1010
typedef unsigned long long ull;

int N,M,P,Q;
char field[MAX][MAX],pattern[MAX][MAX];
ull hash[MAX][MAX],tmp[MAX][MAX];

void compute_hash(char a[MAX][MAX],int n,int m){
    const ull B1 = 63533;
    const ull B2 = 100007;

    ull t1 = 1;
    for(int j = 0 ; j < Q ; j++) t1 *= B1;

    for (int i = 0; i < n ; ++i) {
        ull e = 0;
        for(int j = 0 ; j < Q ; j++) e = e * B1 + a[i][j];
        for(int j = 0 ; j + Q <= m ; j++){
            tmp[i][j] = e;
            if(j + Q < m) e = e * B1 - t1 * a[i][j] + a[i][j+Q];
        }
    }

    ull t2 = 1;
    for (int i = 0; i < P ; ++i)  t2 *= B2;

    for (int j = 0; j + Q <= m  ; ++j) {
        ull e = 0;
        for (int i = 0; i < P ; ++i)e = e * B2 + tmp[i][j];
        for (int i = 0; i + P <= n ; ++i) {
            hash[i][j] = e;
            if(i + P < n) e = e * B2 - t2 * tmp[i][j] + tmp[i + P][j];
        }
    }
}

void solve(){
    compute_hash(pattern,P,Q);
    ull res = hash[0][0];
    compute_hash(field,N,M);
    for (int i = 0; i <= N ; ++i) {
        for (int j = 0; j <= M ; ++j) {
            if(res == hash[i][j]){
                cout << i << " " << j << endl;
            }
        }
    }
}

int main(){
    cin >> N >> M;
    for (int i = 0; i < N ; ++i) {
        for (int j = 0; j < M ; ++j) {
            cin >> field[i][j];
        }
    }
    cin >> P >> Q;
    for (int i = 0; i < P ; i++) {
        for (int j = 0; j < Q; ++j) {
            cin >> pattern[i][j];
        }
    }
        if(N < P && M < Q) return 0;
        solve();
        return 0;
}

Measured memory_bytes: 18588
#include <iostream>
#include <algorithm>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)

int main()
{
  int n, l, r, sum = 0;
  cin >> n;
  while (n--) {
    cin >> l >> r;
    if (l - r == 0) ++sum;
    else sum += r - l + 1;
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
n = int(input())
abc = [list(map(int,input().split())) for i in range(n)]
f_min = 0 
dp = [[f_min] * 3 for _ in range(n)]
def chmin(a, b):
    if a > b:
        return b
    else:
        return a
def chmax(a,b):
    if a < b:
        return b
    else:
        return a
def main():
    dp[0][0], dp[0][1], dp[0][2] = abc[0][0], abc[0][1], abc[0][2]
    for i in range(1,n):
            a,b,c = abc[i][0], abc[i][1], abc[i][2]
            dp[i][0] = chmax(dp[i][0], chmax(dp[i-1][1] + a, dp[i-1][2] +a))
            dp[i][1] = chmax(dp[i][1], chmax(dp[i-1][0] + b, dp[i-1][2] +b))
            dp[i][2] = chmax(dp[i][2], chmax(dp[i-1][0] + c, dp[i-1][1] +c))
    print(chmax(dp[n-1][0], chmax(dp[n-1][1],dp[n-1][2])))

if __name__ == "__main__":
    main()

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

        int main() {
          string S;
          cin>> S;
          int flag=1; 
          for(int i=0; i< S.size(); i++){
            if((i%2)==0){
                int x= (S.at(i)=='R'||S.at(i)=='U'||S.at(i)=='D');
              flag = x*flag; 
            }else if((i%2)==1){
                int x=(S.at(i)=='L'||S.at(i)=='U'||S.at(i)=='D');
              flag = x*flag; 
            }//else ends
          }//for ends
		if(flag){
          cout<< "Yes" << endl; 
        }else{
          cout<< "No" << endl; 
        }        
        }

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

int N, L;
vector<int> a;

int main(void) {
	cin >> N >> L;
	a.resize(N);

	int pos = 0;
	cin >> a[0];
	for (int i = 1; i < N ; ++i) {
		cin >> a[i];
		if (pos == 0 && a[i - 1] + a[i] >= L)
			pos = i;
	}

	if (pos == 0)
		cout << "Impossible\n";
	else {
		cout << "Possible\n";
		for (int i = 1; i < pos; ++i)
			cout << i << '\n';
		for (int i = N - 1; i > pos; --i)
			cout << i << '\n';
		cout << pos << '\n';
	}
	return 0;
}


Measured memory_bytes: 1152
#include <stdio.h>

int main() {
	int n;
	char s[101]={};
	char t[101]={};
	scanf("%d", &n);
	scanf("%s%s", s,t);
	for (int i = 0; i < n; i++) {
		printf("%c", s[i]);
		printf("%c", t[i]);
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 128
#include <stdio.h>


int main(){
    int multi; // 5
    int multiAfter=0;
    int tbawah, tatas; // 14 16
    scanf("%d", &multi);
    scanf("%d %d", &tbawah, &tatas);
    while(multiAfter<=tatas){
        multiAfter=multiAfter+multi;
        if(multiAfter>=tbawah && multiAfter<=tatas){
            printf("OK\n");
            break;
        }
        else if(multiAfter>=tatas){
            printf("NG\n");
            break;
        }    
        else{
            continue;
        }
    }

    return 0;
}

Measured memory_bytes: 1632
#include<stdio.h>

int main(){
  int a,b,c;
  scanf("%d%d%d",&a,&b,&c);
  if(a>=b && a>=c) printf("%d",10*a+b+c);
  else if(b>=a && b>=c) printf("%d",10*b+a+c);
  else printf("%d",10*c+a+b);
  
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <iomanip>
#include <string>

using namespace std;

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

    if (today == "Sunny") cout << "Cloudy";
    if (today == "Cloudy") cout << "Rainy";
    if (today == "Rainy") cout << "Sunny";
}

Measured memory_bytes: 256
#!/usr/bin/env python3

import sys
# import math
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product                # product(iter, repeat=n)
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference


def main():
    mod = 1000000007                  # 10^9+7
    inf = float('inf')
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():  return int(input())
    def mi():  return map(int, input().split())
    def mi_0(): return map(lambda x: int(x)-1, input().split())
    def lmi(): return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():  return list(input())
    
    
    n = ii()
    print(0.5) if n % 2 == 0 else print(((n+1)//2) / n)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

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

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


Measured memory_bytes: 3624
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<vector>
#include<cstdio>
#include<numeric>

using namespace std;
/*
int find(int x, vector<int> &p) {
if (p[x] == x)return x;
return p[x] = find(p[x], p);
}

void uni(int x, int y, vector<int> &p) {
x = find(x, p);
y = find(y, p);
p[x] = y;
}

int same(int x, int y, vector<int> p) {
if (find(x, p) == find(y, p))return 1;
return 0;
}
*/

int main() {
	long long N, K, cnt = 0, tmp, ans = 0;
	string S;
	cin >> S;

	map<char, int> m;
	for (int i = 0; i < 4; i++) {
		m[S[i]] = 0;
	}
	for (int i = 0; i < 4; i++) {
		m[S[i]]++;
	}
	for (int i = 0; i < 4; i++) {
		if (m[S[i]] != 2) {
			cout << "No";
			return 0;
		}
	}
	cout << "Yes";

	char qq;
	cin >> qq;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iterator>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
	int P, Q, R;
	cin >> P >> Q >> R;
	cout << min(P + Q, min(Q + R, R + P));

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
#include <unordered_map>
using namespace std;



int main(){
	long long int n, a, b;
	cin >> n >> a >> b;
	long long int ans = n/(a+b)*a + min(n%(a+b),a);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	int A,B;
	cin >> A >> B;
	if(A%3==0||B%3==0||(A+B)%3==0){
		cout << "Possible" << endl;
	}else{
		cout << "Impossible" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
//By Vlgd
#include<bits/stdc++.h>
using namespace std;
const int N=100;
int n,m;
long long d[N][N],INF=(1ll<<32);
void floyd(){
	for(int k=0;k<n;k++){
		for(int i=0;i<n;i++){
			if(d[i][k]==INF) continue;
			for(int j=0;j<n;j++){
				if(d[k][j]==INF) continue;
				d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
			}
		}
	}
}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++) for(int j=0;j<n;j++) d[i][j]=(i==j?0:INF); 
	for(int i=0;i<m;i++){
		int u,v;long long w;
		scanf("%d%d%lld",&u,&v,&w);
		d[u][v]=w; 
	}
	floyd();
	bool isn=false;
	for(int i=0;i<n;i++) if(d[i][i]<0){isn=true;break;}
	if(isn) printf("NEGATIVE CYCLE\n");
	else{
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				if(d[i][j]<INF) printf("%d",d[i][j]);
				else printf("INF");
				if(j!=n-1) printf(" ");
				else printf("\n");
			}
		}
	}
}



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

int main(){
    int n;
    cin>>n;
    if(1800<=n && n<=1999)cout<<1;
    if(1600<=n && n<=1799)cout<<2;
    if(1400<=n && n<=1599)cout<<3;
    if(1200<=n && n<=1399)cout<<4;
    if(1000<=n && n<=1199)cout<<5;
    if(800<=n && n<=999)cout<<6;
    if(600<=n && n<=799)cout<<7;
    if(400<=n && n<=599)cout<<8;








    return 0;
}

Measured memory_bytes: 3628
n, k = map(int, input().split())
*arr, = map(int, input().split())

lo = 1
hi = max(arr) + 1

def can(arr, rem_length, k):
    cnt = 0
    for v in arr:
        cnt += (v - 1) // rem_length
    if cnt <= k:
        return True
    return False


while lo < hi:
    mid = (lo + hi) // 2
    if can(arr, mid, k):
        hi = mid
    else:
        lo = mid + 1


print(lo)


Measured memory_bytes: 95552
import Data.Array

main = do
  li <- getLine
  let [n,x] = map read $ words li
  let ans = compute n x
  print ans

{-
バーガーの厚さは、l0 = 1, ln = 2l(n-1)+3
肉の枚数は、m0 = 1, mn = 2m(n-1)+1
バーガーを素直に配列で作るのは無謀なので、計算で求める。
-}
la = listArray (0,50) $ iterate ((3 +).(2 *)) 1
ma = listArray (0,50) $ iterate (succ .(2 *)) 1

compute :: Int -> Int -> Int
compute n x = burger 0 n x

-- n次元バーガーのx層を食べたときの肉の数 + a
burger a _ 0 = a
burger a n x
  | x <= n = a -- nバーガーの下n枚はバンズ
  | la ! n - x <= n = a + ma ! n -- nバーガーの上n枚はバンズ
  | ln1 >= x1 = burger a n1 x1 -- 下のn-1バーガーの中に納まる
  | x2 == 0   = m1 -- 真ん中の肉まで
  | True      = burger m1 n1 x2 -- ここまでと残り
  where
    x1 = pred x -- 一番下のバンズ
    n1 = pred n
    ln1 = la ! n1
    m1 = a + ma ! n1 + 1
    x2 = x1 - ln1 - 1


Measured memory_bytes: 508
#include <iostream>
#include <fstream>
#include <algorithm>
#include <set>
//#define LOCAL
#define be(n) n.begin(), n.end()
using namespace std;
typedef long long ll;
set<ll>a, b;


int main() {
#ifdef LOCAL
ifstream fin("1.txt");
streambuf*p;
p=cin.rdbuf(fin.rdbuf());
#endif // LOCAL
ll n;
cin>>n;
for(ll i=0;i<n;i++){
    ll v;
    cin>>v;
    a.insert(v);
}

ll m;
cin>>m;
for(ll i=0;i<m;i++){
    ll v;
    cin>>v;
    b.insert(v);
}
set<ll>c;
set_symmetric_difference(be(a), be(b), inserter(c, c.begin()));
for(set<ll>::iterator it=c.begin();it!=c.end();it++){
    cout<<*it<<endl;
}

#ifdef LOCAL
fin.close();
#endif // LOCAL
}



Measured memory_bytes: 40584