akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define db(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<'\n'
const int N = 1e6;

template <unsigned M> struct modular {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
  static constexpr unsigned mod = M;
  using m = modular;
  unsigned v;
  modular(long long x = 0) : v((x %= mod) < 0 ? x + mod : x) {}
  m operator-() const { return m() -= *this; }
  m& operator+=(m b) { if ((int)(v += b.v - mod) < 0) v += mod; return *this; }
  m& operator-=(m b) { if ((int)(v -= b.v) < 0) v += mod; return *this; }
  m& operator*=(m b) { v = (uint64_t)v * b.v % mod; return *this; }
  m& operator/=(m b) { return *this *= power(b, mod - 2); }
  friend m operator+(m a, m b) { return a += b; }
  friend m operator-(m a, m b) { return a -= b; }
  friend m operator*(m a, m b) { return a *= b; }
  friend m operator/(m a, m b) { return a /= b; }
  friend bool operator==(m a, m b) { return a.v == b.v; }
#pragma GCC diagnostic pop
};
using mint = modular<int(1e9+7)>;

int main() {
	ios_base::sync_with_stdio(0);
	ll n, k;
	cin>>n>>k;
	mint res = 0;
	for(ll i=k;i<=n+1;++i) {
		ll first = i*(i-1)/2;
		ll last = i*(n*2-i+1)/2;
		res += last-first+1;
	}
	cout<<res.v<<endl;
	return 0;
}

Measured memory_bytes: 3676
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <utility>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <istream>
#include <ostream>

#include <cstdlib>
#include <cmath>
#include <cstdio>

using namespace std;

#define fi first
#define se second
#define mkp make_pair
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define rep(i,n) for(ll i=0; i < (n); ++i)
#define rrep(i,n) for(ll i=((n)-1); i >= 0; --i)

#define OPLT(T) bool operator<(const T & lop_, const T & rop_)
#define OPEQ(T) bool operator==(const T & lop_, const T & rop_)

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

istream& operator>>(istream& istr, __float128& obj) { double d; istr >> d; obj = d; return istr; };
ostream& operator<<(ostream& ostr, __float128& obj) { ostr << static_cast<double>(obj); return ostr; };

const ll M = 1e9+7;
ll inv(ll x) {
	ll res = 1;
	ll p = M-2;
	while(p) {
		if(p&1) res = (res*x) % M;
		p /= 2;
		x = (x*x)%M;
	}
	return res;
}
ll fmemo[100100];
ll fact(ll n) {
	if(fmemo[n]) return fmemo[n];
	return fmemo[n] = (n * fact(n-1)) % M;
}
ll binom(ll n, ll r) {
	return (fact(n) * inv(fact(r)) % M )* inv(fact(n-r)) % M;
}

int main() {
	ll n;
	cin >> n;
	vector<int> a(n+1), b;
	rep(i,n+1) cin >> a[i];
	b = a;
	sort(all(b));
	int s = -1;
	rep(i,n) if(b[i] == b[i+1]) s = b[i];

	ll l = 0;
	bool f = false;
	rep(i,n+1) {
		if(a[i] == s) f = !f;
		if(f) {
			l++;
		}
	}
	l--;
	ll L = n+1 -l -2;

	fmemo[0] = 1;
	for(int k = 1; k <= n+1; k++) {
		ll res = 0;
		if(k <= L+1) {
			res = binom(n+1, k) - binom(L,k-1);
		}
		else {
			res = binom(n+1, k);
		}
		res = (res % M + M) % M;
		cout << res << endl;
	}

	return 0;
}


Measured memory_bytes: 4352
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
int dfs(int sx ,int sy, vector<vector<bool> > &map){
	int t=0;
if(map[sx][sy]){
	map[sx][sy]=false;
	t++;
for(int i=0;i<4;i++){
int x=sx+dx[i];
int y=sy+dy[i];
if(map[x][y])	t+=dfs(x,y,map);
}
}
return t;
}
int main(void){
while(1){
int h,w,sx,sy;
cin>>w>>h;
if(h==0)break;
vector<vector<bool> > map(h+2,vector<bool>(w+2,false));
for(int i=1;i<=h;i++){
	for(int j=1;j<=w;j++){
		char a;
		cin>>a;
		if(a=='.')map[i][j]=true;
		if(a=='@'){
			map[i][j]=true;
			sx=i;
			sy=j;
		}
	}
}
//cout<<sx<<' '<<sy<<endl;
/*
for(int i=1;i<=h;i++){
	for(int j=1;j<=w;j++)if(map[i][j])cout<<1;
	else cout<<0;
	cout<<endl;
}*/
cout<<dfs(sx,sy,map)<<endl;
}


return 0;
}



Measured memory_bytes: 3116
import java.util.Scanner;

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

        if(a < b){
            System.out.println( "a < b");
        }else if (a > b) {
            System.out.println("a > b");
        }else if (a == b) {
            System.out.println("a == b");
        }
        // System.out.println();
    }
}


Measured memory_bytes: 26196
//                                                  '-.-'
   //                                         ()      __.'.__
   //                                      .-:--:-.  |_______|
   //                               ()      \____/    \=====/
   //                               /\      {====}     )___(
   //                    (\=,      //\      )__(     /_____\
   //    __    |'-'-'|  //  .\    (    )    /____\     |   |
   //   /  \   |_____| (( \_  \    )__(      |  |      |   |
   //   \__/    |===|   ))  `\_)  /____\     |  |      |   |
   //  /____\   |   |  (/     \    |  |      |  |      |   |
   //   |  |    |   |   | _.-'|    |  |      |  |      |   |
   //   |__|    )___(    )___(    /____\    /____\    /_____\
   //  (====)  (=====)  (=====)  (======)  (======)  (=======)
   //  }===={  }====={  }====={  }======{  }======{  }======={
   // (______)(_______)(_______)(________)(________)(_________)
   //
   // Credits :- Joan G. Stark
   //|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
   //|                      AUTHOR - _P_VATSAL_                                     |
   //|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
#include<bits/stdc++.h>
#include <iomanip>
#include <string>
using namespace std;
//************
//***CODER***
//PRANAV VATSAL
//************
typedef long long ll;
typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
#define f first
#define s second
typedef vector<pli> vpli;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(v) v.begin(),v.end() 
#define fr(i,n) for(i=0;i<n;i++)
#define frr(i,a,b) for(i=a;i<b;i++)
using ld=long double;
lli INF=1e18;
int inf=1e6;
#define endl '\n'


void solve()
{
	lli n;
	cin>>n;
	lli h[n+1];
	lli i;
	fr(i,n)
	{
		cin>>h[i+1];
	}
	if(n==1)
	{
		cout<<0;
		return ;
	}
	lli dp[n+1];//dp[i] is the min cost to reach i from 1
	dp[1]=0;
	dp[2]=abs(h[2]-h[1]);
	frr(i,3,n+1)
	{
		dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]) ,  dp[i-2]+abs(h[i-2]-h[i]));
	}
	cout<<dp[n];
}


int main()
{
  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  int t;
  //cin>>t;
  //while(t--)
    solve();
  return 0;
}


Measured memory_bytes: 5160
#include<bits/stdc++.h>
using namespace std;
int k;
long long  d[200][4];
long long  dp(int l,int cl)
{
    if(cl==0&&l==0)return 1;
    if(l<0)return 0;
    if(~d[l][cl])return d[l][cl];
    d[l][cl]=dp(l-1,!cl);
    if(cl)d[l][cl]+=dp(l-k,!cl);
    return d[l][cl];
}
int main()
{
    int l;
    scanf("%d %d",&l,&k);
    memset(d,-1,sizeof d);
    long long sum=0;
    for(int i=l;i;i--)
        sum+=dp(i,1);
    printf("%lld\n",sum);
}


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

#define GO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int

const int maxr = 1e5 + 5;


int32_t main()
{
	GO;
	string s, t;
	cin >> s >> t;
	int ans = 1e16;
	for (int i = 0; i <= s.size() - t.size(); i++) {
		int count = 0;
		for (int j = 0; j < t.size(); j++) {
			if (s[i + j] != t[j])
				count++;
		}
		ans = min(ans, count);
	}
	cout << ans << endl;
	return 0;
}

//!

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ul unsigned long long int
#define ld long double
#define f(t) for(ll i =0;i<t;i++)
#define vi vector<int>
#define vl vector<ul>
#define pb push_back
#define ff first
#define ss second
#define MOD 1000000007
#define inf 4e18
#define EPS 1e-3
#define PI 3.1415926535897932385
#define display(v) f(v.size())cout << v[i]<<" "
const double h = 1e-6;
const int MAX_  = 200005;
#define all(v) v.begin(),v.end()

inline ll mul(ll a, ll b){ return (a * 1ll * b) % MOD; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += MOD; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > MOD) c -= MOD; return c; }
ll sqr(ll x)
{
    return x*x;
}
 //////////////////////*********CODE***********/////////////////////
 //////////////////////////////////////////////////////////////////

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cout << fixed;
    cout.precision(13);
    int r;  cin>>r;
    cout << 2 * PI * r;
    return 0;
}
    


Measured memory_bytes: 3800
// One Batch Two Batch Penny and Dime

#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long
#define hii cout << "hii" << endl
#define int long long
#define endl '\n'
#define all(s) s.begin(), s.end()
 
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; }
 
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE

const int N = 1e5 + 5;
const int MAXN = 1e6 + 5;
const int M = 1e6 + 5;
const int mod = 998244353;
const int MOD = 998244353;
const int INF = 1e18 + 8;
const int LG = 21;

int arr[N];

struct DSU
{
	int connected;
	vector<int> par, sz;

	void init(int n) 
	{
		par = sz = vector<int> (n + 1, 0);
		for(int i = 1; i <= n; i++)
			par[i] = i, sz[i] = 1;
		connected = n;
	}

	int getPar(int u)
	{
		while(u != par[u])
		{
			par[u] = par[par[u]];
			u = par[u];
		}
		return u;
	}

	int getSize(int u)
	{
		return sz[getPar(u)];
	}

	void unite(int u, int v)
	{
		int par1 = getPar(u), par2 = getPar(v);

		if(par1 == par2)
			return;

		connected--;

		if(sz[par1] > sz[par2])
			swap(par1, par2);

		sz[par2] += sz[par1];
		sz[par1] = 0;
		par[par1] = par[par2];
	}
};

void solve()
{
	int n, m;
	cin >> n >> m;
	DSU d;
	d.init(n);
	for(int i = 0; i < m; i++)
	{
		int a, b;
		cin >> a >> b;
		d.unite(a, b);
	}
	int ret = 0;
	for(int i = 1; i <= n; i++)
	{
		ret += (d.getPar(i) == i);
	}
	cout << ret - 1 << endl;
}


 
int32_t main() 
{	
	ios_base:: sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	    int t = 1;
	    // cin >> t;
	while(t--)solve();
	return 0;
}

Measured memory_bytes: 4724
#include<iostream>

int main(){
  int x = 1;
  int i = 1;
  while (x != 0) {
    std::cin >> x;
    if (x == 0) {
      break;
    }
    std::cout << "Case " << i << ": " << x << std::endl;
    i++;
  }
  return 0;
}

Measured memory_bytes: 3040
import sys

n = int(input())
links = [set() for _ in range(n)]
for i, line in enumerate(sys.stdin):
    a, b = map(int, line.split())
    a -= 1
    b -= 1
    links[a].add((i, b))
    links[b].add((i, a))

ans = [-1] * (n - 1)
k = max(map(len, links))
q = [(0, -1)]
fixed = set()

while q:
    v, c = q.pop()
    color = 1
    if c == color:
        color += 1
    for i, u in links[v]:
        if ans[i] != -1:
            continue
        ans[i] = color
        q.append((u, color))
        color += 1
        if c == color:
            color += 1

print(k)
print('\n'.join(map(str, ans)))


Measured memory_bytes: 57148
#include<iostream>
#include<string>
#include<complex>
#include<stdio.h>
using namespace std;

int main() {
    string s;
    cin>>s;
    int a[26]={};
    for(int i=0;i<s.size();i++){
	a[s[i]-97]=1;
    }
    int i=0;
    for(i=0;i<26;i++){
	if(a[i]==0){
	    printf("%c",i+97);
	    cout <<endl;
	    break;
	}
    }
    if(i==26)cout<<"None"<<endl;
	return 0;
}


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

using namespace std;

#define INF 1e9

int solve(int x){
    int res=0;

    while(x>0){
        res+=(x%10);
        x/=10;
    }

    return res;
}

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

    int n,a,b;
    cin>>n>>a>>b;

    int ans=0;

    for(int i=1;i<=n;i++){
       if(a<=solve(i) && solve(i)<=b)ans+=i;
    }

    cout<<ans<<endl;
    
}

Measured memory_bytes: 256
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE UnboxedTuples #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE MultiWayIf #-}

import Control.Monad
import Control.Monad.ST
import Control.Monad.State
import Control.Monad.Primitive
import Control.Applicative
import Control.Arrow
import Data.List
import Data.Array
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
import Data.Maybe
import Data.Bits
import Data.Ord
import Data.Ratio
import Data.Int
import Data.Char
import qualified Data.IntMap as IM
import qualified Data.ByteString.Char8 as BS
import qualified Data.Set as Set
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.Vector.Generic as VG
import qualified Data.Vector.Generic.Mutable as VGM
import qualified Data.Sequence as Sq
import Data.Tuple
import Data.Function
import Text.Printf
import Debug.Trace
import Numeric

modifyArray arr i f = readArray arr i >>= \x -> writeArray arr i (f x)

listToTuple2 [a,b] = (a,b)
listToTuple3 [a,b,c] = (a,b,c)
listToTuple4 [a,b,c,d] = (a,b,c,d)
listToTuple5 [a,b,c,d,e] = (a,b,c,d,e)

readIntBS = fst . fromJust . BS.readInt

for = flip map

infixr 1 ?
(?) :: Bool -> (a,a) -> a
(?) b t = (if b then fst else snd) t

main :: IO ()
main = do
  
  [a,b] <- map read . words <$> getLine :: IO [Int]

  putStrLn $ if odd $ a*b then "Yes" else "No"


Measured memory_bytes: 508
n = int(input())

mylist = []
for i in range(n):
	mylist.append(list(map(str,input().split())))
	mylist[i].append(i+1)

mylist = sorted(mylist,key=lambda mylist:(mylist[0],-int(mylist[1])))
for i in mylist:
	print(i[2])


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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define LOOP(i) while(i--)
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	vector<int> C({1,0,0});
	string S;
	while(cin>>S){
		swap(C[S[0]-'A'],C[S[2]-'A']);
	}

	int index=0;
	REP(i,3){
		if(C[i]==1) index=i;
	}
	out((char)('A'+index));
	return 0;
}


Measured memory_bytes: 3228
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <string.h>
#include <string>
#include <cmath>
#include <cstdio>
#include <functional>
#include <map>
#include <typeinfo>
#include<bits/stdc++.h>
#define INF 1e9
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<double, double> pd;
typedef pair<ll, ll> pl;


int main()
{
  FILE *inF, *outF;
  //inF = fopen("in", "r");
  //outF = fopen("out", "w");
  inF = stdin;
  outF = stdout;
  
  char s[105], t[105];
  int n;
  
  fscanf(inF, "%d", &n);
  fscanf(inF, "%s", s);
  fscanf(inF, "%s", t);
  
  for(int i = 0; i < n; i++)
  {
    printf("%c", s[i]);
    printf("%c", t[i]);
  }
  printf("\n");
  
  
  return 0;
}


Measured memory_bytes: 256
import heapq
n,m=map(int,input().split())
x=list(map(int,input().split()))
for k in range(n):
    x[k]-=2*x[k]
heapq.heapify(x)
ans=0
for i in range(m):
    maxvalue=heapq.heappop(x)*(-1)
    heapq.heappush(x,(maxvalue//2)*(-1))
ans=-1*sum(x)
print(ans)


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

int main() {
	int N, K;
	string An;
	cin >> N >> K;
	cin >> An;

	int ans = 0;
	while (N > 0)
	{
		++ans;
		if (N <= K)
			N = 0;
		else
			N -= (K - 1);
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 3192
import java.util.*;

public class Main {
	public static void main(String... args) {
		Scanner sc = new Scanner(System.in);
		String[][] a = new String[3][3];
		for (int i = 0 ; i < 3 ; i++) {
			String s = sc.nextLine();
			a[0][i] = s.substring(0, 1);
			a[1][i] = s.substring(1, 2);
			a[2][i] = s.substring(2, 3);
		}
		System.out.println(a[0][0]+a[1][1]+a[2][2]);
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))
#ifdef LOCAL
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#else
#define eprintf(...) 42
#endif
#define y0 y12345
#define y1 y54321
typedef unsigned long ul;
typedef long long ll;
//typedef pair<int, int> mpair;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b;return 1;}return 0;}
using namespace std;

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
   	int n,k;
	cin>>n>>k;
	int h[n];
	rep(i, n)cin>>h[i];
	ul dp[n];
	dp[n-1] = 0;
	for(int i = n-k-1;i < n-1;i++){
		dp[i] = abs(h[i]-h[n-1]);
	}
	for(int i = n-k-2;i>=0;i--){
		ul mi = 2000000000000;
		rep(j, k){
			chmin(mi, dp[i+1+j]+abs(h[i+1+j]-h[i]));
		}
		dp[i] = mi;
	}
	cout << dp[0] << endl;
	return 0;
}


Measured memory_bytes: 1408
from fractions import gcd
def gcd_list(A):
    num=A[0]
    for i in A:
        num=gcd(num,i)
    return num

n,k=map(int,input().split())
A=list(map(int,input().split()))
print("POSSIBLE" if k%gcd_list(A)==0 and k<=max(A) else "IMPOSSIBLE")

Measured memory_bytes: 16244
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include<stdbool.h>
typedef long long ll;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define swap(a,b) {ll tp=a;a=b;b=tp;}
const ll MOD = 1000000007;

int main(){
    char s[202020]; scanf("%s", s);
    int n = strlen(s);
    ll bcnt = 0, ans = 0;
    rep(i,n){
        if(s[i] == 'B') bcnt++;
        else ans += bcnt;
    }

    printf("%lld", ans);
}


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

using namespace std;

const int M=26;

int arr[404];
int n;
int c[26];
int s[404][26];
int las[26];

long long calc()
{
	for(int i=0;i<M;i++) las[i]=0;
	long long ans=0;
	for(int i=0;i<n;i++)
	{
		las[arr[i]-1]=i+1;
		ans+=s[i][arr[i]-1];
		for(int j=0;j<M;j++)
			ans-=c[j]*(i+1-las[j]);
		cout << ans << endl;
	}
	return ans;
}

int main()
{
	cin >> n;
	for(int i=0;i<M;i++) cin >> c[i];
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<M;j++) cin >> s[i][j];
	}
	
	for(int i=0;i<n;i++) cin >> arr[i];
	calc();
	//cout << calc() << endl;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()

int main(){
    int N;cin>>N;
    vector<int>d1(N);
    vector<int>d2(N);
    rep(i,N){
        cin>>d1.at(i)>>d2.at(i);
    }
    bool flag=false;
    int  counter=0;
    rep(i,N){
        if(d1.at(i)==d2.at(i)){
            counter++;
            if(counter==3){
                flag=true;
                break;
            }
        }else{
            counter=0;
        }

    }
    if(flag)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

int main(){
  int N, L; cin >> N >> L;
  vector<int> a(N);
  vector<int> b(N);
  int ans=0;
  
  rep(i,N){
    a[i] = abs(L+i);
    b[i] = L+i;
  }
  
  sort(a.begin(), a.end());
  
  rep(i,N){
    ans += b[i];
  }
  if(b[N-1] >=0 ){
    cout << ans - a[0] << endl;
  }
  else{
    cout << ans + a[0] << endl;
  }
}


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

int main(){
    int n;
    cin >> n;
    int a, b, c;
    for(int i = 0; i < n; i++){
        cin >> a >> b >> c;
        if(a*a == b*b+c*c || b*b == a*a+c*c || c*c == a*a+b*b){
            cout << "YES\n";
        } else{
            cout << "NO\n";
        }
    }
    return 0;
}

Measured memory_bytes: 1120
#include <iostream>
#include <algorithm>
#include <vector>
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 move_pattern[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 itr, class func> void array_output(itr start, itr goal, func out = [](itr x) { return x; } ){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
template<class itr, class func> void nint_output(itr start, itr goal, func out = [](itr x) { return x; } ){ string ans; for(auto i = start; i != goal; i++){ ans += string(out(*i)) + " "; } ans.pop_back(); cout << ans << endl; }
long gcd(long a, long b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }}
#define mod long(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcount(n)

int main(){
    for(int i = 1; i <= 9; i++){
        for(int j = 1; j <= 9; j++){
            cout << i << "x" << j << "=" << i * j << endl;
        }
    }
}



Measured memory_bytes: 3104
// ABEY SAALE
// QUESTION KHUD KR SOLUTION KYU DEKH RHA H
 
 
 
 
 
 
 
 
//MAAF KIJIYEGA ME GUSSE ME IDHAR UDHAR NIKAL JATA HU
#include<bits/stdc++.h>
#define mod 1000000007
#define fr first
#define se second
#define ll long long
#define PI 3.1415926535 
#define pb push_back
#define mpr make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define senky_bansal ios_base::sync_with_stdio(false);
#define IIIT_ALLAHABAD    cin.tie(NULL);cout.tie(NULL);
using namespace std;

ll fac[2000005];
void pre(){ fac[0]=1; fac[1]=1; for(int i=2;i<200005;i++) fac[i]=(i*fac[i-1])%mod;}
ll power(ll a,ll b){ll res=1;while(b){if(b&1) res=(res*a)%mod;a=(a*a)%mod;b=b/2;}return res%mod;}
ll ncr(ll n,ll r){return ((fac[n]*power(fac[r],mod-2))%mod*power(fac[n-r],mod-2))%mod;}
// DEKHIYE JI  WALID JO THE ABBA HAMARE WO YEH function CHHOD KR GYE THE
vector<string>v;
ll n;
void solve(int idx,string s,char te)
{
    if(idx==n){
      v.pb(s);
      return;
    }
    // ll count = te-'a';
    // ll p5 = min(n,idx*1LL+1);
    // for(int i=count;i<p5;i++)
    // {
    //   char p1 = 'a'+i;
    //   string p2 =s;
    //   p2+=p1;
    //   solve(idx+1,p2,p1);
    // }
    set<char>s1;
    for(auto it : s)
      s1.insert(it);
    ll p1 = s1.size();
    for(int i=0;i<p1+1;i++)
    {
         char p2 = 'a'+i;
         string p3 = s;
         p3+=p2;
         solve(idx+1,p3,p2);
    }
}
signed main()
{   


      
      senky_bansal
      IIIT_ALLAHABAD
      
      // pre();
      ll t;
      // cin>>t;
      t=1;
      while(t--)
      { 
         cin>>n;
         string s1="a";
         char p3 = 'a';
        solve(1,s1,p3); 
        sort(all(v));
        // cout<<v.size()<<endl;
        for(auto it : v)
        cout<<it<<endl; 
         

      }
      






}



























Measured memory_bytes: 9716
#include <iostream>
#include <cmath>

using namespace std;

int main(){
    int n;
    int a[200000];
    int profit = -1000000001;

    cin >> n;

    for(int i=0; i<n; i++){
        cin >> a[i];
    }

    int candidate_min = a[0];

    for(int i=1; i<n; i++){
        int cullent_profit = (a[i] - candidate_min);
        if(cullent_profit > profit){
            profit = cullent_profit;
        }

        //最小候補更新
        if( a[i] <= candidate_min){
            candidate_min = a[i];
            continue;
        }

    }

    cout << profit << endl;

    return 0;
}



Measured memory_bytes: 3880
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv,
    std.functional, std.math, std.numeric, std.range, std.stdio, std.string,
    std.random, std.typecons, std.container;

ulong MAX = 100_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Pair = Tuple!(long, "x", long, "y");
alias PQueue(T, alias less = "a>b") = BinaryHeap!(Array!T, less);

void main()
{
    auto s = sread();
    // s[0 .. ($ - 1) / 2].writeln();
    // s[($ + 1) / 2 .. $].writeln();

    if (s.isreverse() && s[0 .. ($ - 1) / 2].isreverse() && s[($ + 1) / 2 .. $].isreverse())
        writeln("Yes");
    else
        writeln("No");
}

bool isreverse(string t)
{
    bool ret = true;
    foreach (i; iota(t.length / 2))
    {
        ret &= (t[i] == t[$ - 1 - i]);
    }
    return ret;
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


Measured memory_bytes: 2604
import java.io.*;
import java.util.*;
public class Main
{
	
	private void solve()throws Exception
	{
		int h1=nextInt();
		int m1=nextInt();
		int h2=nextInt();
		int m2=nextInt();
		int k=nextInt();
		int diff=(h2-h1)*60+(m2-m1);
		out.println(diff-k);
	}

	 
	///////////////////////////////////////////////////////////

	public void run()throws Exception
	{
		br=new BufferedReader(new InputStreamReader(System.in));
		st=null;
		out=new PrintWriter(System.out);

		solve();
		
		br.close();
		out.close();
	}
	public static void main(String args[])throws Exception{
		new Main().run();
	}
	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	String nextToken()throws Exception{
		while(st==null || !st.hasMoreTokens())
		st=new StringTokenizer(br.readLine());
		return st.nextToken();
	}
	String nextLine()throws Exception{
		return br.readLine();
	}
	int nextInt()throws Exception{
		return Integer.parseInt(nextToken());
	}
	long nextLong()throws Exception{
		return Long.parseLong(nextToken());
	}
	double nextDouble()throws Exception{
		return Double.parseDouble(nextToken());
	}
}

Measured memory_bytes: 32560
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String line;
        int[] arr = new int[10001];
        arr[1] = 2;

        for (int i = 2; i <= 10000; i++) {
            arr[i] = arr[i - 1] + i;
        }

        while ((line = br.readLine()) != null) {
            int n = Integer.parseInt(line);
            System.out.println(arr[n]);
        }
    }
}


Measured memory_bytes: 24160
N = int(input())
H = list(map(int, input().split()))
    
if N == 1:
    print("Yes")
    
else:
    for i in range(N - 1, 0, -1):
        if H[i] - H[i - 1] == -1:
            H[i - 1] -= 1
            
        elif H[i] - H[i - 1] < -1:
            print("No")
            break
            
    if i == 1:
        print("Yes")
        
            
        
 

Measured memory_bytes: 15020
#include <stdio.h>
#include <ctype.h>
#include <string.h>

int main(void) {
    char s[11];
    int len;
    int c_found;

    fgets(s, 11, stdin);

    if (s[0] != 'A') {
        printf("WA\n");
        return 0;
    }

    if (isupper(s[1])) {
        printf("WA\n");
        return 0;
    }

    len = strlen(s);
    c_found = 0;
    for (int i = 2; i < len - 2; i++) {
        if (s[i] == 'C') {
            if (c_found) {
                printf("WA\n");
                return 0;
            }
            else
                c_found = 1;
        }
        else if (isupper(s[i])) {
            printf("WA\n");
            return 0;
        }
    }

    if (!c_found) {
        printf("WA\n");
        return 0;
    }

    if (isupper(s[len - 2]) || isupper(s[len - 1])) {
        printf("WA\n");
        return 0;
    }

    printf("AC\n");

    return 0;
}


Measured memory_bytes: 128
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>   
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(ll i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
void calc(){
	int n;
	cin>>n;
	vi b(n+2),he(n+2,inf);
	rep(i,n)cin>>b[i+1]>>he[i+1];
	b[n+1]=100;
	int m;
	cin>>m;
	vi f(m),a(m);
	rep(i,m)cin>>f[i]>>a[i];
	int q;
	cin>>q;
	while(q--){
		int p,t;
		cin>>p>>t;
		vi w(n+1);
		int sum=0;
		rep(i,m)rep(j,n+1)if(b[j]<f[i]&&f[i]<b[j+1]){
			w[j]+=a[i]*t;
			sum+=a[i]*t;
		}
		vi par=b,h=he;
		while(1){
			rep(i,w.size())if((par[i+1]-par[i])*30*min(h[i],h[i+1])<w[i]){
				int sum=(par[i+1]-par[i])*30*min(h[i],h[i+1]);
				if(h[i]<h[i+1]){
					if(w[i-1]==(par[i]-par[i-1])*30*min(h[i],h[i-1])&&h[i-1]>h[i]){
						par.erase(par.begin()+i);
						h.erase(h.begin()+i);
						w[i-1]+=w[i];
						w.erase(w.begin()+i);
					}else w[i-1]+=w[i]-sum,w[i]=sum;
				}else if(h[i]>h[i+1]){
					if(w[i+1]==(par[i+2]-par[i+1])*30*min(h[i+1],h[i])&&h[i+1]<h[i+2]){
						par.erase(par.begin()+i+1);
						h.erase(h.begin()+i+1);
						w[i+1]+=w[i];
						w.erase(w.begin()+i);
					}else w[i+1]+=w[i]-sum,w[i]=sum;
				}
				goto end;
			}
			break;
			end:;
		}
		rep(i,w.size())if(par[i]<p&&p<par[i+1]){
			cout<<shosu(5)<<min(50.,w[i]/30./(par[i+1]-par[i]))<<endl;
			break;
		}
	}
}
int main(){
	int data;
	cin>>data;
	while(data--)calc();
}










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

int main() {
    int N;
    cin >> N;
    int a, b, c, d;
    a = N / 1000;
    b = (N - a * 1000) / 100;
    c = (N - a * 1000 - b * 100) / 10;
    d = (N - a * 1000 - b * 100 - c * 10);
    if (b != c) {
        cout << "No" << endl;
    }
    else if (a == b) {
        cout << "Yes" << endl;
    }
    else if (c == d) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
# input
n, y = map(int, input().split())
# calc
for i in range(n + 1):
    for j in range(n - i + 1):
        if 10000 * i + 5000 * j + 1000 * (n - i - j) == y:
            print(i, j, n - i - j)
            sys.exit()
# output
print("-1 -1 -1")

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

#define int long long

static const int MAX_SIZE = 1 << 17; //segment tree のサイズ。 2^17 ≒ 1.3 * 10^5

typedef long long Int;
Int all[2 * MAX_SIZE - 1], part[2 * MAX_SIZE - 1]; // segment tree

//区間[a, b)に値xを加算する.
void add(int a, int b, int x, int k = 0, int l = 0, int r = MAX_SIZE)
{
  if (a <= l && r <= b){ //[l, r)が[a, b)に完全に内包されていれば
    all[k] += x; //[l, r)の全ての区間が持つ値としてxを足す.
  }
  else if (l < b && a < r){ //[l, r)と[a, b)が交差していれば
    part[k] += (min(b, r) - max(a, l)) * x;  //交差している分の値を, 部分的な和を持つノードに加算する.
    add(a, b, x, k * 2 + 1, l, (l + r) / 2); //子でも同じ処理を行う.
    add(a, b, x, k * 2 + 2, (l + r) / 2, r); //〃.
  }
}

Int sum(int a, int b, int k = 0, int l = 0, int r = MAX_SIZE)
{
  if (b <= l || r <= a){ //[a, b)と[l, r)が全く交差しない場合
    return (0);
  }
  else if (a <= l && r <= b){ //完全に内包されていれば
    return (all[k] * (r - l) + part[k]);
  }
  else { //[l, r)と[a, b)が交差していれば
    Int res;
    res = (min(b, r) - max(a, l)) * all[k]; 
    res += sum(a, b, k * 2 + 1, l, (l + r) / 2); //子ノードで和を求める.
    res += sum(a, b, k * 2 + 2, (l + r) / 2, r); //〃
    return (res);
  }
}

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

  for ( int i = 0; i < N; i++ ) {
    int a, b;
    cin >> a >> b;
    add(a, b+1, 1);
  }

  int ans = 0;
  for ( int i = 100100; i >= 0; i-- ) {
    if ( sum(i, i+1)+1 >= i ) {
      ans = i;
      break;
    }
  }

  cout << ans-1 << endl;
  
  return 0;
}



Measured memory_bytes: 5480
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

kills = 0

for i in range(N):
    if B[i] <= A[i]:
        # 次無理
        kills += B[i]
    else:
        # 次OK
        kills += A[i]
        stock = B[i] - A[i]
        if stock < A[i + 1]:
            # 殲滅無理
            kills += stock
            A[i + 1] -= stock
        else:
            # 殲滅可能
            kills += A[i + 1]
            A[i + 1] = 0
print(kills)

Measured memory_bytes: 18624
n = int(input())
ary = list(map(int, input().split()))
dic = {'gray': 0, 'brawn': 0, 'green': 0, 'water': 0, 'blue': 0, 'yellow': 0, 'orange': 0, 'red': 0}
god = 0

for rate in ary:
    if 0 <= rate < 400:
        dic['gray'] = 1
    elif 400 <= rate < 800:
        dic['brawn'] = 1
    elif 800 <= rate < 1200:
        dic['green'] = 1
    elif 1200 <= rate < 1600:
        dic['water'] = 1
    elif 1600 <= rate < 2000:
        dic['blue'] = 1
    elif 2000 <= rate < 2400:
        dic['yellow'] = 1
    elif 2400 <= rate < 2800:
        dic['orange'] = 1
    elif 2800 <= rate < 3200:
        dic['red'] = 1
    else:
        god += 1
cnt = sum(dic.values())
if cnt == 0:
    print(1, god)
else:
    print(cnt, cnt+god)

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

typedef unsigned ui;
typedef long long ll;
typedef unsigned long long ul;

struct point { int x, y; } ps[N];

ui fs[N];
ui uf(ui x) { return fs[x] ? fs[x] = uf(fs[x]) : x; }
bool uu(ui x, ui y) {
	x = uf(x); y = uf(y);
	if (x != y) fs[x] = y;
	return x != y;
}

ui p[N];

struct edge { ui u, v, w; };
bool operator<(edge e1, edge e2) { return e1.w < e2.w; }
ui dis(ui u, ui v) { return min(abs(ps[u].x - ps[v].x), abs(ps[u].y - ps[v].y)); }

int main(void) {
	ios::sync_with_stdio(0); cin.tie(0);
#ifdef _DEBUG
	ifstream cin("1.in");
#endif
	ui n; cin >> n;
	ul ans = 0;
	for (ui i = 1; i <= n; ++i) cin >> ps[i].x >> ps[i].y;
	iota(p, p + n, 1);
	vector<edge> ev;

	sort(p, p + n, [](ui i1, ui i2) { return ps[i1].x < ps[i2].x; });
	ui i = 0;
	while(i != n - 1) {
		ui u = p[i], v = p[i + 1];
		if (ps[u].x == ps[v].x) uu(u, v);
		else ev.push_back({ u, v, dis(u, v) });
		++i;
	}

	sort(p, p + n, [](ui i1, ui i2) { return ps[i1].y < ps[i2].y; });
	i = 0;
	while(i != n - 1) {
		ui u = p[i], v = p[i + 1];
		if (ps[u].y == ps[v].y) uu(u, v);
		else ev.push_back({ u, v, dis(u, v) });
		++i;
	}

	sort(ev.begin(), ev.end());
	for (edge e : ev)
		if (uu(e.u, e.v))
			ans += e.w;

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 6132
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
const int MOD = 1e9+7;
const int INF = 1<<30;
const ll LINF = 1LL<<60;

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

    ll n, k;
    cin >> n >> k;

    vector<int> a(n);
    rep(i, n) {
        cin >> a[i];
        a[i]--;
    }



    vector<int> b(n, -1);
    int idx = 0;
    b[idx] = 0;
    rep(i, n) {
        idx = a[idx];
        b[idx] = 1;
        if (b[a[idx]] != -1) {
            idx = a[idx];
            break;
        }
    }

    int s = 0;
    int visited = 0;
    vector<int> d;
    int v = 0;
    while(visited <= n) {
        if (s == idx) {
            break;
        }
        d.push_back(s);
        s = a[s];
        visited++;
    }

    int t = idx;
    int sum = 1;
    vector<int> c;
    c.push_back(idx);
    while(sum <= n) {
        t = a[t];
        if (t == idx) {
            break;
        }
        c.push_back(t);
        sum++;
    }

    if (k >= visited) {
        k -= visited;
        k %= sum;
        cout << c[k] + 1 << endl;
    } else {
        cout << d[k] + 1 << endl;
    }

    return 0;
}

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

int main(){
  int N, M;
  cin >> N >> M;
  
  vector<int> vec1(M);
  vector<int> vec2(N);
  
  for(int j=0; j<M; j++){
	for(int i=0; i<2; i++){
	   	cin >> vec1.at(i);   
        if(vec1.at(i)%N == 0)vec2.at(N-1)++;
      	else vec2.at((vec1.at(i)%N)-1)++;
  	}
   }
  
  for(int i=0; i<N;i++){
    cout << vec2.at(i) << endl;
  }
  
  
  
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a,b,c,temp,temp2;
  cin>>a>>b>>c;
  temp=a;
  a=b;
  b=temp;
  temp2=c;
  c=a;
  a=temp2;
  cout<<a<<" "<<b<<" "<<c;
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;
template <typename A, size_t N, typename T> void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
// long long mod = 998244353;
#define REP(i, n) for (long long i = 0; i < (n); i++)
#define rep(i, a, n) for (long long i = a; i < (n); i++)
typedef long long ll;
typedef pair<ll, ll> P;
long long mod = 1000000007;
long long modpow(long long m, long long n, long long modvalue) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2, modvalue);
        return t * t % modvalue;
    } else {
        return modpow(m, n - 1, modvalue) * m % modvalue;
    }
}

long long moddiv(long long a, long long b, ll modvalue) { return (a * modpow(b, mod - 2, modvalue)) % modvalue; }

const ll INF = 1LL << 60;

string change_binary(long long a) {
    string ret;
    for (int i = 31; i >= 0; i--) {
        ret += (a >> i & 1) + '0';
    }
    return ret;
}

ll nCkmod(ll n, ll k) {
    ll denomi = 1;
    for (int i = n; i > n - k; i--) {
        denomi *= i;
        denomi %= mod;
    }
    ll numera = 1;
    REP(i, k) {
        numera *= (i + 1);
        numera %= mod;
    }
    return moddiv(denomi, numera, mod);
}
// struct SegmentTree {
//     vector<int> ar;
//     ll size = 1;
//     SegmentTree(int n) {
//         ar.resize(4 * n - 1, INF);
//         while (size < n) {
//             size *= 2;
//         }
//     }
//     void update(ll idx, ll x) {
//         ll k = size + idx;
//         ar[k] = x;
//         while (k != 1) {
//             k /= 2;
//             ar[k] = min(ar[k * 2], ar[k * 2 + 1]);
//         }
//     }
//     ll find(ll s, ll t){
//     }
// }
signed main() {
    ll n, k;
    cin >> n >> k;
    cout << nCkmod(n - 1, k - 1) << endl;
}


Measured memory_bytes: 3220
a,b,c,d=map(int,input().split())
x = abs(a-c)
y = abs(b-d)
if b <= d:
    ax = c - y
    bx = a - y
else:
    ax = c + y
    bx = a + y
if a <= c:
    ay = d + x
    by = b + x
else:
    ay = d - x
    by = b - x
print(str(ax)+' '+str(ay)+' '+str(bx)+' '+str(by))

Measured memory_bytes: 9068
#include <stdio.h>

int		cmp(char *day, char now[4])
{
	for (int i = 0; i < 3; i++)
	{
		if (day[i] != now[i])
			return (0);
	}
	return(1);
}

int		main()
{
	char	day[4];
	int		left = 7;

	scanf("%s\n", day);
	if (cmp(day, "MON"))
		left = 6;
	else if (cmp(day, "TUE"))
		left = 5;
	else if (cmp(day, "WED"))
		left = 4;
	else if (cmp(day, "THU"))
		left = 3;
	else if (cmp(day, "FRI"))
		left = 2;
	else if (cmp(day, "SAT"))
		left = 1;
	printf("%d\n", left);
	return (0);
}


Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        static void Main(string[] args)
        {
            try
            {
                SetOut(sw);
                Solve.Answer();
                Out.Flush();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
                Out.Flush();
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            var s = ReadLine();
            var a = IO.RInt;

            var sb = new StringBuilder();
            int i = 0;
            while (a * i < s.Length)
            {
                sb.Append(s.Substring(a * i, 1));
                i++;
            }
            WriteLine(sb.ToString());
        }
    }

    public class IO
    {
        #region Input
        public static int RInt => int.Parse(ReadLine());
        public static long RLong => long.Parse(ReadLine());
        public static double RDouble => double.Parse(ReadLine());

        public static string[] RSString => ReadLine().Split();
        public static int[] RSInt => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        public static long[] RSLong => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
        public static double[] RSDouble => ReadLine().Split().Select(s => double.Parse(s)).ToArray();
        #endregion

        #region Output
        public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
        public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");
        public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES" : "NO");
        #endregion
    }

    public class Mod
    {
        #region
        private readonly static long M = 1000000007;

        public static long Add(long a, long b) => (a * b) % M;
        public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
        public static long Multi(long a, long b) => (a * b) % M;
        #endregion
    }
}

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

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

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

typedef unsigned long long ull;

mt19937_64 r(std::chrono::high_resolution_clock::now().time_since_epoch().count());

ull const MASK30 = (1<<30)-1;
ull const MASK31 = INT_MAX;
ull const MOD = (1LL<<61)-1;
ull const MOD5 = MOD*5;
ull const base = r()%MOD;

struct RollingHash {
private:
    vector<ull> power,hash;
public:
    inline ull mul(ull a,ull b) {
        ull au = a>>31;
        ull ad = (a&MASK31);
        ull bu = b>>31;
        ull bd = (b&MASK31);
        ull mid = au*bd+ad*bu;
        return ((au*bu)<<1)+ad*bd+(mid>>30)+((mid&MASK30)<<31);
    }

    inline ull calcmod(ull a) {
        a = (a&MOD)+(a>>61);
        if (a > MOD) a -= MOD;
        return a;
    }

    RollingHash(string& s) {
        int n = s.size();
        power.resize(n+1);
        hash.resize(n+1);
        power[0] = 1;
        hash[0] = 0;
        for (int i = 0;i < n;++i) power[i+1] = calcmod(mul(power[i],base));
        for (int i = 0;i < n;++i) hash[i+1] = calcmod(mul(hash[i],base)+s[i]);
    }

    ull get(int l, int r)  {
        if (l) return calcmod(hash[r]+MOD5-mul(hash[l],power[r-l]));
        return hash[r];
    }

    ull connect(ull h1,int l,int r) {
        ull h2 = get(l,r);
        return calcmod(mul(h1,power[r-l])+h2);
    }

    // [l,r)
    int LCP(int l1,int r1,RollingHash& rh,int l2,int r2) {
        int ok = 0,ng = min(r1-l1,r2-l2)+1;
        while (ng-ok > 1) {
            int mid = (ok+ng)/2;
            if (get(l1,l1+mid) == rh.get(l2,l2+mid)) ok = mid;
            else ng = mid;
        }
        return ok;
    }
};

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans = 0;
    RollingHash rh(s);
    int ok = 0,ng = n/2+1;
    while (ng-ok > 1) {
        map<ll,int> mp;
        int mid = (ok+ng)/2;
        bool f = false;
        for (int i = 0;i < n-mid+1;++i) {
            ull key = rh.get(i,i+mid);
            if (mp[key]) {
                if (mp[key] < i+2-mid) {
                    f = true;
                    break;
                }
            } else mp[key] = i+1;
        }
        (f ? ok : ng) = mid;
    }
    cout << ok << endl;
}

Measured memory_bytes: 640