akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sys/time.h>
#include <fstream>
//#include "cout.h"

using namespace std;

#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#define PB push_back
#define VI vector < int >
#define PII pair < int, int >
#define LL long long
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define FIT(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define OUT(A) cout << #A << " = "<< (A) << endl
#define OUT2(A, B) cout << "(" << #A << ", " << #B << ") = (" << (A) << ", "<< (B) << ")" << endl
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(ALL(c), (e)) != (c).end())


int h, w, res;
LL blackCnt, whiteCnt;
string s[410];
bool visit[410][410];

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

void go(int x, int y) {
  // cout << "go: " << x << " " << y << endl;
  visit[x][y] = true;
  if(s[x][y] == '.') whiteCnt++;
  else blackCnt++;
  REP(i, 4) {
    int _x = x + dx[i];
    int _y = y + dy[i];
    // cout << "_x:" << _x << " _y:" << _y << endl;
    if (_x >= 0 && _x < h && _y >= 0 && _y < w && !visit[_x][_y] && s[x][y] != s[_x][_y]) {
      go(_x, _y);
    }
  }
}

void init() {

}

void input() {
  cin >> h >> w;
  REP(i, h) cin >> s[i];
  res = 0;
  REP(i, h) REP(j, w) visit[i][j] = false;
}

void solve() {
  LL res = 0;
  REP(i, h) REP(j, w) {
    if (!visit[i][j] && s[i][j] == '#') {
      blackCnt = 0;
      whiteCnt = 0;
      // cout << i << " " << j << endl;
      go(i, j);
      // cout << blackCnt << " " << whiteCnt << endl << endl;
      res += blackCnt*whiteCnt;
    }
  }
  cout << res << endl;
}

int main() {
	init();
	input();
	solve();
	return 0;
}


Measured memory_bytes: 18176
#include<cstdio>
#define ll long long int
int main()
{
	int n,i;
	scanf("%d",&n);
	ll sum =0;
	for ( i=1; i<=n; i++ )
		if ( i%3!=0 && i%5!=0 )
			sum = sum + i;
	printf("%lli\n",sum);
	return 0;
}


Measured memory_bytes: 1728
def dfs(S, mx):
    if len(S) == N:
        print(S)
    else:
        for i in range(a, mx+2):
            if i == mx+1:
                dfs(S+chr(i), mx+1)
            else:
                dfs(S+chr(i), mx)
    return

N = int(input())
a = ord('a')
dfs('a', a)

Measured memory_bytes: 9200
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define L_T_S_K ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);  
const int N = 1e5 + 1;
void solve();

int32_t main(){
 L_T_S_K;
  int t(1);
 // cin >> t;
  while(t--){
    solve();
  }
 return 0;
}

void solve(){
  int n;
  cin >> n;
  int a[n + 1] , dp[n + 1];
  memset(dp , 0 , sizeof dp);
  dp[0] = 2;
  dp[1] = 1;
  for(int i = 2 ; i <= n ;i++){
    dp[i] = dp[i - 1] + dp[i - 2];
  }
  cout << dp[n] << "\n";
}



Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
using namespace std;
int main(){
    int A,B;
    cin >> A >> B;
    cout << (A-1)*(B-1)  << endl;
}

Measured memory_bytes: 256
#print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
from fractions import gcd
def resolve():
    A=[int(input())for i in range(4)]
    cnt=0
    for i in range(A[0]+1):
        for j in range(A[1]+1):
            for k in range(A[2]+1):
                if 500*i+100*j+50*k==A[-1]:
                    cnt+=1
    print(cnt)
 
        
#%%submit!    
resolve()

Measured memory_bytes: 65004
import sys

# sys.stdin = open('b1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    s = read_str()
    l = len(s)
    res = s[0] + str(l - 2) + s[-1]
    print(res)


main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

int a, b, c;

int main(){
	//IO("input.txt", "output.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> a >> b >> c;
	cout << min(c, b / a) << "\n";
	return 0;
}

Measured memory_bytes: 256
def ans():
    S = input()
    N = len(S)
    if not ('1' in S and '0' in S):
        return print(N)

    tmp = 1000000
    for i, v in enumerate(S):
        if i == 0:
            continue
        if S[i-1] != v:
            tmp = min(max(i, N-i), tmp)
    return print(tmp)

# main()
ans()

Measured memory_bytes: 3188
//#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

#define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007LL
#define INF (1LL<<60LL)
#define int long long
typedef long long ll;

using namespace std;


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int h; cin >> h;
	int k = 0;
	while ((1LL << k) - 1LL < h) k++;
	cout << (1LL << k) - 1LL << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int p=1e9+7,N=4010,M=4e6+5;
int dp[N][N],fac[M],finv[M],inv[M];
int comb(int n,int m){return n<m?0:fac[n]*1ll*finv[m]%p*finv[n-m]%p;}
int main()
{
    int n=4e6,k;
    fac[1]=fac[0]=finv[1]=finv[0]=inv[1]=1;
    for(int i=2;i<=n;i++)
        inv[i]=(p-p/i)*1ll*inv[p%i]%p,fac[i]=1ll*fac[i-1]*i%p,
        finv[i]=finv[i-1]*1ll*inv[i]%p;
    cin>>n>>k;
    if(k==1){cout<<1<<endl;return 0;}
    dp[1][0]=1;
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<=i;j++)
        {
            if(i==1&&j==0)continue;
            dp[i][j]=((j!=i)*dp[i-1][j]+
                     (j!=0)*1ll*comb(n-i+(n-j+1)*(k-1)-1,k-2)*dp[i][j-1])%p;
        }
    }
    printf("%lld\n",1ll*dp[n][n]*fac[n]%p);
}


Measured memory_bytes: 80128
#include<stdio.h>

int main(){

    int N;
    scanf("%d",&N);

    int a[N], ans[N];

    int i;
    for(i=0;i<N;i++){
        scanf("%d",&a[i]);
        ans[i] = 0;
    }

    int r;
    int count=0;
    for(i=0;i<N;i++){
        r = i;
        if(ans[i]<a[i]){
            while(ans[r]<a[r])r++;
            int j;
            for(j=i;j<r;j++)ans[j]++;

            count++;
            i--;
        }
    }


    printf("%d\n",count);

    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i, n) for(i = 0; i < n; i++)
#define int long long
using namespace std;
 
int h, w;
string s[20];
 
int dy[4] = {-1, 0, 1, 0};
int dx[4] = {0, 1, 0, -1};
 
int calc(int sy, int sx) {
	typedef pair<int, int> P;
	queue<P> que;
	int dist[20][20];
	int i, j;
	
	rep(i, h) rep(j, w) dist[i][j] = -1;
	dist[sy][sx] = 0;
	
	que.push(P(sy, sx));
	while (!que.empty()) {
		P now = que.front();
		que.pop();
		int y = now.first;
		int x = now.second;
		rep(i, 4) {
			int ny = y + dy[i];
			int nx = x + dx[i];
			if (ny < 0 || ny >= h || nx < 0 || nx >= w) continue;
			if (s[ny][nx] == '#') continue;
			if (dist[ny][nx] == -1) {
				que.push(P(ny, nx));
				dist[ny][nx] = dist[y][x] + 1;
			}
		}
	}
	
	int ret = 0;
	rep(i, h) {
		rep(j, w) {
			ret = max(ret, dist[i][j]);
		}
	}
	return ret;
}
 
signed main() {
	int i, j;
	
	cin >> h >> w;
	rep(i, h) { cin >> s[i]; }
	
	int ans = 0;
	rep(i, h) {
		rep(j, w) {
			if (s[i][j] == '#') continue;
			int res = calc(i, j);
			ans = max(ans, res);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
# util functions

# debug
$debugFlag = ( ARGV[0] != nil )
p "==== DEBUG MODE ====" if $debugFlag

def pd(str)
  p str if $debugFlag
end

# input
inputs = []
lc = 0
while l = $stdin.gets do
  if false
    inputs << l.chomp.split(" ").map(&:to_s)
  else
    inputs << l.chomp.split(" ").map(&:to_i)
  end
  lc += 1
end

# input check
if $debugFlag
  p "--- INPUT (begin) ---"
  inputs.each do |l_i|
    p l_i
  end
  p "--- INPUT (end) ---"
  print "\n"
end

vs = inputs[1]
cs = inputs[2]

# body
if $debugFlag
  p vs
  p cs
end

val = 0
vs.size.times do |i|
  val += vs[i] - cs[i] if vs[i] > cs[i]
end

puts val


Measured memory_bytes: 1788
def shuffle(strings, n):
    return strings[n:]+strings[0:n]
    
while True:
    tmp = input()
    if tmp == '-':
        break
    m = int(input())
    arr = [int(input()) for i in range(m)]
    #print(tmp,m,arr)
    for i in arr:
        tmp = shuffle(tmp,i)
    print(tmp)


Measured memory_bytes: 5600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	string s;cin >> s;
	if(n % 2 == 1){
		cout << "No" << endl;
		return 0;
	}
	bool ok = true;
	rep(i,n / 2){
		if(s.at(i) != s.at(i + n / 2)) ok = false;
	}
	if(ok) cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()

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

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

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

template <typename T, typename U> T pow_fast(T x, U n) {
    T ret = (T)1;
    while(n) {
        if(n & (U)1) ret *= x;
        x *= x;
        n >>= 1;
    }
    return ret;
}

template <typename ModType, ModType MOD> struct ModInt {
    ModType val;
    ModInt() : val(0) {}
    ModInt(ModType x) : val(x % MOD) {
        if(val < 0) val += MOD;
    };
    operator ModType() const { return val; }
    ModInt &operator+=(const ModInt &m) {
        val += m.val;
        if(val >= MOD) val -= MOD;
        return *this;
    }
    ModInt &operator-=(const ModInt &m) {
        val -= m.val;
        if(val < 0) val += MOD;
        return *this;
    }
    ModInt &operator*=(const ModInt &m) {
        (val *= m.val) %= MOD;
        return *this;
    }
    ModInt &operator/=(const ModInt &m) {
        *this *= m.inverse();
        return *this;
    }
    ModInt operator+(const ModInt &m) const { return ModInt(*this) += m; }
    ModInt operator-(const ModInt &m) const { return ModInt(*this) -= m; }
    ModInt operator*(const ModInt &m) const { return ModInt(*this) *= m; }
    ModInt operator/(const ModInt &m) const { return ModInt(*this) /= m; }
    ModInt inverse() const { return pow_fast(*this, MOD - 2); }
    ModInt pow(ModType n) const {return pow_fast(*this, n); }

    friend std::ostream &operator<<(std::ostream &os, const ModInt &rhs) {
        os << rhs.val;
        return os;
    }
    friend std::istream &operator>>(std::istream &is, ModInt &rhs) {
        ModType value;
        is >> value;
        rhs = ModInt(value);
        return is;
    }
};
using mint = ModInt<ll, MOD>;

int main(){
    int s;
    cin >> s;
    vector<mint> cur(s+4), nxt(s+4);
    cur[0] = mint(1);
    mint ans = 0;
    rep(i, s) {
        rep(j, nxt.size()) nxt[j] = 0;
        
        mint sum = 0;
        rep(j, nxt.size()-3) {
            sum += cur[j];
            nxt[j+3] = sum;
        }

        swap(cur, nxt);
        ans += cur[s];
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <stack>
#include <math.h>
#include <map>
#define Z class
#define ln cout<<'\n'
#define ll long long
#define rep(i, n) for(int i = 0; i < (n); ++i)
//ASCII a=97, A=65
// int H[N]; rep(i,N) scanf("%d", &H[i]);
// int max_x = *std::max_element(x.begin(), x.end());
// int min_y = *std::min_element(y.begin(), y.end());
using namespace std;
template<class T> inline bool chmax(T& a, T b){ if(a < b) { a=b; return 1; }return 0;}
template<class T> inline bool chmin(T& a, T b){ if(a > b) { a=b; return 1; }return 0;}
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
const long long INF = 1LL << 60;

int main(){
    long X,t; cin >> X >> t;
    if(X>=t) pr(X-t);
    else pr(0);
}



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

int main() {
    int M1;
    int D1;
    int M2;
    int D2;
    cin >> M1 >> D1 >> M2 >> D2;

    if (M1 == M2){
        cout << 0 << endl;
        return 0;
    }

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



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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define mp make_pair
#define ll long long
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 100010
#define inf 1e9

int main()
{

    map<ll,ll> m;
    ll n;
    cin >> n;
    bool tf = 1;

    for(ll i = 0; i < n; i++)
    {

        ll x;
        cin >> x;
        m[x]++;
        if(m[x] > 1) tf=0;
    }
    if(tf) cout << "YES";
    else cout << "NO";
}


Measured memory_bytes: 12800
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

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

    int n, k, q;
    cin >> n >> k >> q;
    vector<int> cnt(n + 1);
    rep(i, q){
        int x;
        cin >> x;
        cnt[x]++;
    }

    rep(i, n){
        if(q - cnt[i+1] < k){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }

    return 0;
}


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

#define fi  first
#define se  second
#define mp  make_pair
#define pb  push_back

typedef long long ll;
typedef queue <int> qi;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef map <ll, ll> mll;
typedef map <int, int> mii;
typedef pair <int, int> pii;
typedef map <char, int> mci;
typedef map <char, char> mcc;
typedef map <string, int> msi;
typedef pair <string, int> psi;
typedef map <string, string> mss;
typedef unsigned long long ull;

const ll mod = 10e9+7;
const double eps = 1e-11;
const double PI = 2 * acos(0.0);

/*
string to_string(int n) { // Integer -> String
    stringstream convert;
    convert << n;
    return convert.str();
}

int to_int(string s) { // String -> Integer
    istringstream sin(s);
    int x = 0;
    sin >> x;
    return x;
}

ll big_mod(ll b, ll p, ll m) {
    if (p == 0) return 1;
    ll r = big_mod(b, p / 2, m);
    r = (r * r) % m;
    if (p & 1) r = (r * b) % m;
    return r;
}

const int p_max = 1000020;
int status[p_max + 1];
vi prime;

void fact_sieve() {
    int i;
    prime.pb( 2 );
    for (i = 3; i < p_max / 2; i += 2) {
        if (status[i] == 0) {
            prime.pb( i );
            for (int j = i; j <= p_max; j += i)
                status[j] = i;
        }
    }
    for(; i <= p_max; i += 2) {
        if (status[i] == 0) {
            prime.pb( i );
            status[i] = i;
        }
    }
}

// BITMASK - ALL POSSIBLE SET
void bitmask_set_finder() {
    for (int i = 0; i < (1<<n); i++) {
        for (int j = 0; j < n; j++) {
            if (i & (1<<j) != 0) // bla
            else //bla
        }
    }
}
*/

int main() {
    int w, a, b;
    cin >> w >> a >> b;

    if (a < b) {
        int x = a + w;
        int ans = b - x;
        if (b <= x) puts("0");
        else cout << ans << endl;
    }
    else if (a > b) {
        int x = b + w;
        int ans = a - x;
        if (x >= a) puts("0");
        else cout << ans << endl;
    }
    else puts("0");
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int s(int *a, int n)
{
	int t = n;
	int i = 0, ans = a[0];
	for (i = 1; i < 4; i++)
	{
		if (n & 1)
			ans += a[i];
		else
			ans -= a[i];
		n >>= 1;
	}
	if (ans == 7)
		return t;
	else
		return s(a, t - 1);
}
int main()
{
	int a[4], i;
	for (i = 0; i < 4; i++)
		a[i] = (getchar() - '0');
	int n = 7;
	n = s(a, n);
	for (i = 0; i < 3; i++)
	{
		cout << a[i];
		if (n & 1)
			cout << "+";
		else
			cout << "-";
		n >>= 1;
	}
	cout<<a[3] << "=7"<<endl;
	return 0;
}

Measured memory_bytes: 256
from collections import Counter

n, m = map(int, input().split())
a = list(map(int, input().split()))

s = [0] * (n + 1)
for i, ai in enumerate(a):
    s[i + 1] = (s[i] + ai) % m

counter = Counter(s)
ans = 0
for v in counter.values():
    ans += v * (v - 1) // 2

print(ans)

Measured memory_bytes: 17336
import sys
readline = sys.stdin.readline

num = 10**5
primes = [1 for _ in range(num + 1)]
cum = [0 for _ in range(num+1)] 
primes[0] = 0
primes[1] = 0
cum_i = 0
for i in range(2,num+1):
    if primes[i]:
        k=1
        while i*(k+1)<num+1:
            k +=1
            primes[i*k] = 0
        
        if i>2:
            if primes[(i+1)//2]:
                cum_i +=1
    cum[i] = cum_i
q = int(readline())
for _ in range(q):
    l,r = map(int,readline().split())
    print(cum[r] - cum[l-1])

Measured memory_bytes: 5468
import java.util.*

fun main(args: Array<String>) {
    val reader = Scanner(System.`in`)
    val N = reader.nextInt()
    val xorResults = mutableListOf<Int>()
    val values = mutableListOf<Int>()
    var firstValue = 0
    repeat(N) {
        val readValue = reader.nextInt()
        xorResults.add(readValue)
        if(it != 0){
            firstValue = firstValue.xor(readValue)
        }
    }
    values.add(firstValue)
    for(count in 1..N-1){
        val xorValue = xorResults[count]
        val notFirstAndSelf = xorValue.xor(firstValue)
        values.add(xorResults[0].xor(notFirstAndSelf))
    }
    repeat(N){
        if(it == N -1){
            println("${values[it]}")
        }
        else {
            print("${values[it]} ")
        }
    }
}

Measured memory_bytes: 71988
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd
#input=sys.stdin.readline
#import bisect
n,m=map(int,input().split())
ab=[list(map(int,input().split())) for _ in range(m)]
ab=sorted(ab,key=lambda x:x[1])
res=[]
res.append(ab[0][1]-1)
for i in range(1,m):
    a,b=ab[i]
    if a>res[-1]:
        res.append(b-1)
print(len(res))

Measured memory_bytes: 100316
N = input().split()                                                             
N = [int(n) for n in N]                                                         
S = input()                                                                     
s = S.swapcase()                                                                
ans = str(S[0:N[1]-1] + s[N[1]-1] + S[N[1]:])                                   
print(ans)    

Measured memory_bytes: 2940
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
  int N;
  double x,ans=0;
  string s;
  ll i;
  cin >> N;
  for(i=0;i<N;i++){
    cin >> x >> s;
    if(s[0]=='J')ans+=x;else ans+=380000.0*x;
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long int N,X=0;cin>>N;
  vector<string>S(N);
  for(int i=0;i<N;i++){
    cin>>S.at(i);
    sort(S.at(i).begin(),S.at(i).end());
  }
  sort(S.begin(),S.end());
  for(int i=1;i<N;i++){
    if(S.at(i-1)==S.at(i)){
      long long int j=i+1;
      while(j<N&&S.at(i-1)==S.at(j))j++;
      X+=(j-i+1)*(j-i)/2;
      i=j-1;
    }
  }
  cout<<X<<endl;
}

Measured memory_bytes: 7296
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
typedef long long ll;

void Main(){
 int a,b,c;
   cin >> a >> b >> c;
   
  if( (a-b)*(a-b)+(b-c)*(b-c)==0 )
  cout << 1 << endl;
  else if ( (a-b)*(b-c)*(c-a) == 0)
  cout << 2 << endl;
  else 
    cout << 3 << endl;
 return;
 }
  
int main(){
 cin.tie(nullptr);
 ios_base::sync_with_stdio(false);
 cout << fixed << setprecision(15);
 Main();
 return 0;
 }


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
using namespace std;
int main() {
  long long n,a[100000]={},b[100000]={},cnt1=0,cnt2=0,ans=0;
  cin >> n;
  int c[n]={};
  for(int i=0; i<n; i++) {
    cin >> a[i];
  }
  for(int i=0; i<n; i++) {
    cin >> b[i];
  }
  int j=0;
  for(int i=0; i<n; i++) {
    if(a[i]>b[i]) {
      cnt1+=a[i]-b[i];
      c[j]=a[i]-b[i];
      j++;
    }
    if(a[i]<b[i]) {
      cnt2+=b[i]-a[i];
      ans++;
    }
  }
  if(cnt1<cnt2) {
    cout << -1 << endl;
  }
  else {
    sort(c,c+n,greater<int>());
    int k=0;
    while(cnt2>0) {
      cnt2-=c[k];
      ans++;
      k++;
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 2176
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = scanInt()
	}
	return a
}

func debug(a ...interface{}) {
	if os.Getenv("ONLINE_JUDGE") == "false" {
		fmt.Fprintln(os.Stderr, a...)
	}
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	s := scanString()
	if s[len(s)-1] == 's' {
		fmt.Fprintln(wr, s+"es")
	} else {
		fmt.Fprintln(wr, s+"s")
	}
}


Measured memory_bytes: 1780
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <set>
#include <string>
#include <vector>
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) sort((a).rbegin(), (a).rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(a) a.begin(), a.end()
typedef long long int ll;
using namespace std;

int check(int x) {
    int c = 0;
    while (x % 100 == 0) {
        c++;
        x /= 100;
    }
    return c;
}

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

    int d, n;
    cin >> d >> n;

    int count = 0;
    int ans   = 1;
    while (count != n) {
        int x = check(ans);
        if (x == d)
            count++;
        ans++;
    }

    cout << ans - 1 << endl;

    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.*;

public class Main implements Runnable {

    public static void main(String[] args) throws Exception {
        Thread.setDefaultUncaughtExceptionHandler((t, e)->System.exit(1));
        new Thread(null, new Main(), "", 16 * 1024 * 1024).start();
    }

    public void run() {
        String S = null;
        // 入力
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {
            S = br.readLine();
        } catch (Exception e) {
            e.printStackTrace();
        }

        int min = 10000; // 与えられた文字列から切り出した3桁の数値と753の差の絶対値の最小値

        for (int i = 0; i < S.length() - 2; i++) {
            // 3文字取り出す
            String temp = S.substring(i, i + 3);
            // 数値にする
            int temp2 = Integer.parseInt(temp);
            // 差の絶対値を取得する
            // 最小値の更新処理
            min = Math.min(min, Math.abs(temp2 - 753));
        }
        // 出力
        System.out.println(min);
    }
}


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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
ll MOD = 1e9+7;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }

int main(){
  ll i, j;
  ll n, m;
  cin >> n >> m;
  vector<ll> a(n);
  vector<ll> b(n + 1);
  for(i = 0; i < n; i++)
    cin >> a[i];
  ll buf = 0;
  for(i = 0; i < n + 1; buf += a[i++]){
    buf %= m;
    b[i] = buf;
    //cout << b[i] << endl;
  }
  sort(ALL(b));
  //for(i = 0; i <= n; i++)
    //cout << b[i] << endl;
  ll sum = 0, countbuf;
  for(i = 0; i <= n; i++){
    for(j = i, countbuf = 0; j <= n && b[i] == b[j]; countbuf++,j++)
      //cout << b[i] spa b[j] spa i spa  j << endl
      ;
    //cout << countbuf << endl;
    i = j - 1;
    sum += countbuf * (countbuf - 1) / 2;
    //cout << b[i - 1] spa sum << endl;
  }
    
  cout << sum << endl;

  return 0;
}

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

int main(){
	int n,y,sum;

	cin>>n>>y;
	y=y/1000;	//1000円を1とする単位に変換;

	if(y>10*n){
		
	}
	for(int i=n;i>=0;i--){	//諭吉さん;
		sum=10*i;
		if(y<sum)continue;
		for(int j=n-i;j>=0;j--){
			sum=10*i+5*j+(n-i-j);
			if(y==sum){
				cout<<i<<" "<<j<<" "<<n-i-j<<endl;
				return 0;
			}
		}
	}
	cout<<"-1 -1 -1"<<endl;
}

Measured memory_bytes: 384
from math import *
A,B = map(int,input().split())
#A,B = 1,1

#原価を推定
a = ceil(12.5*A)
b = ceil(10*B)

#print(a)
#print(b)

if A%2==0:
    if (a+12 < b) or (b+9 < a):
        print(-1)
    else:
        if a==b:
            print(a)
        elif a > b:
            print(a)
        else:
            print(b)
            
else:
    if (a+11 < b) or (b+9 < a):
        print(-1)
    else:
        if a==b:
            print(a)
        elif a > b:
            print(a)
        else:
            print(b)

Measured memory_bytes: 3188
#include<iostream>
#include<string.h>
using namespace std;
int p[300000];
int main(){
    memset(p,0,sizeof(p));
    for(int i=2;i<253456;i++)
        for(int j=2;i*j<253456;j++)
            p[i*j]=1;
    int n,ans;
    while(cin>>n,n){
        ans=0;
        for(int i=n+1;i<=2*n;i++)
            if(p[i]==0)ans++;
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 2340
#ABC177E
N = int(input())
#N = 1000000
A = list(map(int, input().split()))
#A = [i+1 for i in range(1000000)]
p = {2*i+1: 1 for i in range(1, 500)}
for i in range(3, 1000, 2):
  for j in p:
    if j != i:
      if j % i == 0:
        p[j] = 0
L = [2]
for i in p:
  if p[i] == 1:
    L.append(i)
def gcd(x, y):
  k, l = x, y
  while l:
    k, l = l, k % l
  return k
g = A[0]
i = 0
nn = len(L)
while i < N:
  g = gcd(g, A[i])
  if g == 1:
    break
  i += 1
if g > 1:
  print("not coprime")
else:
  D = {}
  m = 0
  for i in A:
    pnt = 0
    x = i
    for j in L:
      cnt = False
      while x % j == 0:
        cnt = True
        x //= j
      if cnt:
        if j in D:
          D[j] += 1
          if D[j] == 2:
            m = 2
            break
        else:
          D[j] = 1
      pnt += 1
      if pnt == nn and x != 1:
        if x in D:
          D[x] += 1
          if D[x] == 2:
            m = 2
        else:
          D[x] = 1
        break
      if x == 1:
        break
    if m >= 2:
      break
  if D == {}:
    print("pairwise coprime")
  else:
    if m > 1:
      print("setwise coprime")
    else:
      print("pairwise coprime")

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

using namespace std;

int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n,a,flag=1,s;
    cin>>n;
    vector<int> v;
    for(int i=0;i<n;i++)
    {
        cin>>a;
        v.push_back(a);
    }

   for(int i=0;i<n-1;i++)
   {
       if(v[i]>=v[i+1])
       {
           if(v[i]-v[i+1]>1)
           {
               cout<<"No"<<endl;
               return 0;
           }
           else if(v[i]-v[i+1]==1)
           {
              v[i]--;
           }
           else if(v[i]==v[i+1])
           {
               if(i == 0) v[i]--;
               else
                {
                  if(v[i-1]!=v[i])
                  {
                    v[i]--;
                  }
                }
           }
        }
   }
   for(int i=0;i<n-1;i++)
   {
       if(v[i]>v[i+1]){cout<<"No"<<endl;return 0;}
   }
   cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 892
#include <iostream>
#include <vector>

int main(){
    int n1,n2,n3;
    std::cin >> n1 >> n2 >> n3;
    int N = n1+n2+n3;
    if(N>=22){
        std::cout << "bust"<< std::endl;
    }else{
        std::cout << "win"<< std::endl;
    }
}

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

ll XOR(ll n) {
    if (n % 4 == 0) return n;
    else if (n % 4 == 1) return 1;
    else if (n % 4 == 2) return n+1;
    else return 0;
}

int main() {
    ll A, B; cin >> A >> B;
    cout << (XOR(A-1) ^ XOR(B)) << endl;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<string>
#include<vector>
#include<unordered_set>
#include<algorithm>

using namespace std;

#if 1
int main()
{
	int n;

	cin >> n;

	int sum = 0;
	for (int i = 0; i < n; i++)
	{
		int a;
		cin >> a;
		sum += a - 1;
	}

	cout << sum << endl;

	return 0;
}
#endif


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std; 
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ll long long
long long min(long long x,long long y){return (x<y ? x:y);}
long long max(long long x,long long y){return (x>y ? x:y);}
#define ld long double
int stoi(string s) {return atoi(s.c_str());}
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
#define LINEY "YES\n"
#define Liney "Yes\n"
#define LINEN "NO\n"
#define Linen "No\n"

int main(){
  int s; cin >> s;
  int r = 0;
  while(s>0){
    r += s%10; s/=10;
  }
  printf("%d\n",r);
}

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

using namespace std;
using ll=long long;
using vi=vector<int>;
using vl=vector<ll>;
using vs=vector<string>;

#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define repr(i, a, n) for (int i = (n); i >= (a); --i)

template<typename T,typename U>
void Inparray(T &f,U n){
  for(int i=0;i<n;i++) cin>>f[i];
}

template<typename T,typename U>
void Printarray(T f,U n){
  for(int i=0;i<n;i++) i!=n ? cout<<f[i]<<" " : cout<<f[i];
}

void flagfunc(bool flag,string A,string B){
  flag ? cout<<A<<endl : cout<<B<<endl;
}

void flag2func(bool flag){
  flag ? cout<<"Yes"<<endl : cout<<"No"<<endl;
}

void flag3func(bool flag){
  flag ? cout<<"YES"<<endl : cout<<"NO"<<endl;
}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int a,b;cin>>a>>b;
  flagfunc(a%3==0||b%3==0||(a+b)%3==0,"Possible","Impossible");
}


Measured memory_bytes: 256
#include<stdio.h>
 
int main()
{
    int H, W, h, w;
    H>0, W>0;
    H>=h, W>=w;
    scanf("%d %d", &H ,&W);
    scanf("%d %d", &h ,&w);
    printf("%d\n", (H-h)*(W-w));
 
    return 0;
 
}

Measured memory_bytes: 1712
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)

using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string S;
    cin>> S;
    int ans=1000;
    rep(i,0,S.size()-2){
        int k=(S[i]-'0')*100+(S[i+1]-'0')*10+(S[i+2]-'0');
        ans=min(ans,abs(753-k));
    }
        cout << ans<<"\n";
}



Measured memory_bytes: 256
def main():
    N = int(input())
    C, S, F = [], [], []
    capnd, sapnd, fapnd = C.append, S.append, F.append
    for c, s, f in (map(int, input().split()) for _ in [0] * (N - 1)):
        capnd(c)
        sapnd(s)
        fapnd(f)

    for i in range(N):
        t = 0
        for j in range(i, N - 1):
            if t < S[j]:
                t = S[j]
            elif not t % F[j]:
                pass
            else:
                t = t + F[j] - t % F[j]
            t += C[j]
        print(t)

main()


Measured memory_bytes: 3188
#include<bits/stdc++.h>
 
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;
 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
 
#define pb push_back
#define popb pop_back()
#define pf push_front
#define popf pop_front()
#define si size()
#define be begin()
#define en end()
#define all(v) v.be, v.en
#define le length()
#define mp make_pair
#define mt make_tuple
#define acc(v) accumulate(all(v), 0)
#define F first
#define S second
 
#define forz(i, n) for (int i = 0; i < n; i++)
#define fore(i, m, n) for (int i = m; i <= n; i++)
#define rforz(i, n) for (int i = n - 1; i >= 0; i--)
#define rforzm(i, m, n) for (int i = n - 1; i >= m; i--)
#define deci(n) fixed << setprecision(n)
#define high(n) __builtin_popcount(n)
#define highll(n) __builtin_popcountll(n)
#define parity(n) __builtin_parity(n)
#define ctz(n) __builtin_ctz(n)
#define lb lower_bound
#define ub upper_bound
#define er equal_range
#define maxe *max_element
#define mine *min_element
#define mod 1000000007
#define mod2 998244353
#define gcd __gcd
#define kira ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
 
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
using namespace std;
/*STD fucntions*/
lli power(lli x, lli y, lli p)
{
    lli res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        //y must be even now
        y = y >> 1; //y=y/2
        x = (x * x) % p;
    }
    return res;
}
lli modi(lli a, lli m)
{
    // fermat little thm where m is prime
    return power(a, m - 2, m);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
 
int main()
{
	kira;
    lli T=1;
    //cin>>T;
    while(T--)
    {
    	lli a,b;
        cin>>a>>b;
        
        cout<<(a*b)/__gcd(a,b)<<endl;        
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    int A, B;
    cin >> A >> B;
    int ans = (B + A - 2 - 1) / (A - 1);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {

        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i=0; i<n; i++) arr[i] = sc.nextInt();

        long cnt = 0;

        for (int i=1; i<n; i++) {
            if (arr[i] < arr[i-1]) {
                cnt += (long)(arr[i-1] - arr[i]);
                arr[i] = arr[i-1];
            }
        }

        System.out.println(cnt);
    }


}



Measured memory_bytes: 59940
#include <iostream>
#include <string>
#include <vector>
#include <cmath>

using namespace std;

long long mod = 1000000007;


int main() {
  string s;
  cin >> s;
  long long n = s.length();
  long long rez = (n*(n-1))/2 + 1;
  vector <long long> bs(26, 0);
  for (int i = 0; i < n; i++)
   bs[s[i] - 'a']++;
  for (int i = 0; i < 26; i++)
   if (bs[i] > 1)
    rez -= (bs[i]*(bs[i]-1))/2;
  cout << rez;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int n = sc.nextInt();
			int r = sc.nextInt();
			if (n == 0 && r == 0) break;
			int[] card = new int[n];
			for (int i = 0; i < n; i++) {
				card[i] = n - i;
			}
			for (int i = 0; i < r; i++) {
				int p = sc.nextInt();
				int c = sc.nextInt();
				for (int j = 0; j < c; j++) {
					for (int k = p + c - 2; k > 0; k--) {
						int l = card[k];
						card[k] = card[k - 1];
						card[k - 1] = l;
					}
				}
			}
			System.out.println(card[0]);
		}
	}
}



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

public class Main {

    public static void main(String[] argv) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        ArrayList<Integer> m = new ArrayList<Integer>();
        for (int i = 0; i < 10; i++) {
            String s = in.readLine();
            if (s == null) {
                break;
            }
            m.add(Integer.parseInt(s));
        }
        f(m);
    }

    public static void f(ArrayList<Integer> m) {
        Object[] mm = m.toArray();
        Arrays.sort(mm);
        for (int i = mm.length - 1; i > mm.length - 4 && i >= 0; i--) {
            System.out.println(mm[i]);
        }
    }
}

Measured memory_bytes: 9376
/* 
 * Author: Priyadarshini
 */
 
/*
 * Run in Mac using the following command:
 * g++ -std=c++14 <cpp_filename>
 * A binary will be generated. Then run:
 * ./a.out
 */
 
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <fstream>
#include <cstring>
 
using namespace std;
typedef long long int ll;
 
// Macro //
#define X first
#define Y second
#define pii pair<int,int>
#define pll pair<ll,ll>
 
// Global //
 
 
// Functions //
 
 
// Main //
int main(){
    string a;
    cin >> a;
    // cout << a <<endl;
    if (a == "SUN")cout << 7<<endl;
    if (a == "MON")cout << 6<<endl;
    if (a == "TUE")cout << 5<<endl;
    if (a == "WED")cout << 4<<endl;
    if (a == "THU")cout << 3<<endl;
    if (a == "FRI")cout << 2<<endl;
    if (a == "SAT")cout << 1<<endl;


    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define Nmax 200010
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;

int main() {
	int N,aa[Nmax]={};
	cin >> N;
	ll a[Nmax]={};
	int cnt2=0,cnt4=0;
	REP(i,N){
		cin >> a[i];
		if(a[i]%4==0) cnt4++;
		else if(a[i]%2==0) cnt2++;
	}
	int cnt0=N-cnt2-cnt4;
	if(cnt0-cnt4-1<=0 && (cnt2%2==0||cnt4-cnt0+1>0)) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>
#include<stdlib.h>

int  selectionSort(int *,int);
void print_dataset(int *,int);

int main(){
  int *array,n,i;
  int result;
  
  scanf("%d",&n);
  array=(int *)malloc(n*sizeof(int));
  for(i=0;i<n;i++){
    scanf("%d",&array[i]);
  }

  
  result=selectionSort(array,n);
  
  print_dataset(array,n);
  printf("%d\n",result);

  return 0;
}

int selectionSort(int *a,int n){
  int i,j,mini,stock,count=0;
  int flag=1;
  
  for(i=0;i<n;i++){
    mini=i;
    flag=1;
    for(j=i;j<n;j++){
      if(a[j]<a[mini]){
	mini=j;
	flag=0;
      }
    }
    
    if(flag==0){
    stock=a[i];
    a[i]=a[mini];
    a[mini]=stock;
    count++;
    }
 
  }

  return count;
}

void print_dataset(int *a,int n){
  int i;

  for(i=0;i<n;i++){
    printf("%d",a[i]);
    if(i!=n-1) printf(" ");
  }
  printf("\n");
}



Measured memory_bytes: 2144
#include<iostream>
#include<algorithm>
using namespace std;
int main(){

  int a[5],n=5;
  while(n--) cin >> a[n];
  sort(a,a+5);
  for(int i = 4;i >= 0;i--){
    if(i != 0) cout << a[i] << ' ';
    else cout << a[i] << endl;
  }
  return (0);
}

Measured memory_bytes: 3112
import numpy as np

N,L = map(int,input().split())

tastes = np.arange(N) + L
total_taste = tastes.sum()

tastes_wo_ith_apple = total_taste - tastes
abs_tastes = np.abs(total_taste - tastes_wo_ith_apple)

print(tastes_wo_ith_apple[abs_tastes.argmin()])

Measured memory_bytes: 12496
/*====Corycle====*/
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdlib>
#include<complex>
#include<cstdio>
#include<vector>
#include<cmath>
#include<ctime>
#include<stack>
#include<queue>
#include<map>
#define ll long long
using namespace std;
const int inf=0x3f3f3f3f;
int read(){
	int s=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){s=s*10+c-'0';c=getchar();}
	return s*f;
}
int n,m,vis[10];
int main(){
//	freopen("_.in","r",stdin);
//	freopen("_.out","w",stdout);
	n=read();m=read();
	for(int i=1;i<=m;i++)vis[read()]=1;
	while(1){
		int x=n;
		while(x){
			if(vis[x%10])break;x/=10;
			if(!x){printf("%d",n);return 0;}
		}
		n++;
	}
	return 0;
}

Measured memory_bytes: 3760
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
/********************************************************/


int main() {
    int d; cin >> d;
    vector<int> c(26);
    rep(i,26) cin >> c[i];
    vector<vector<int>> s(d, vector<int>(26));
    rep(i,d) rep(j,26) {
        cin >> s[i][j];
    }

    vector<int> ans(d);
    vector<int> last(26, -1);
    rep(i,d) {
        int num, mx_cost, cost;
        mx_cost = -400*100;
        rep(j,26) {
            cost = s[i][j] - c[j]*(i-last[j]);
            if (mx_cost < cost) {
                mx_cost = cost;
                num = j;
            } else if (mx_cost == cost) {
                if (c[num] < c[j]) num = j;
            }
        }
        last[num] = i;
        cout << num+1 << endl;
    }
}

Measured memory_bytes: 3684
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
using namespace std;
typedef long long ll;

int N;

int main(){
    cin>>N;

    rep(i,3){
        if(N%10==7){
            cout<<"Yes"<<endl;
            return 0;
        }
        N/=10;
    }

    cout<<"No"<<endl;
}

Measured memory_bytes: 3624
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Queue;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        char[][] map = new char[h][w];
        int[][] flag = new int[h][w];
        int c = 0;
        for (int i = 0; i < h; i++) {
            String s = sc.next();
            map[i] = s.toCharArray();
            for (int j = 0; j < w; j++) {
                if (map[i][j] == '.') {
                    c++;
                }
            }
            Arrays.fill(flag[i], -1);
        }
        final int[] dx = {-1, 1, 0, 0};
        final int[] dy = {0, 0, -1, 1};

        flag[0][0] = 0;
        Queue<Integer[]> q = new ArrayDeque<Integer[]>();
        q.add(new Integer[]{0, 0});
        while(!q.isEmpty()){
            Integer[] pos = q.poll();
            if (pos[0] == h - 1 && pos[1] == w - 1) {
                break;
            }
            for (int i = 0; i < 4; i++) {
                int yp = pos[0] + dy[i];
                int xp = pos[1] + dx[i];
                if (0 <= yp && yp < h && 0 <= xp && xp < w && map[yp][xp] == '.' && flag[yp][xp] == -1){
                    flag[yp][xp] = flag[pos[0]][pos[1]] + 1;
                    q.add(new Integer[]{yp, xp});
                }
            }
        }
        if (flag[h - 1][w - 1] == -1) {
            System.out.println("-1");
        } else {
            System.out.println(c - flag[h - 1][w - 1] - 1);
        }
    }
}


Measured memory_bytes: 35780