akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <set>
#include <queue>
#include <tuple>
#include <functional>
#include <cstring>

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int  i = 0; i < n; i++)
#define irep2(i,a,n) for(int i = a; i < n; i++)
#define lrep(i,n) for(long long  i = 0; i < n; i++)
#define lrep2(i,a,n) for(long long i = a; i < n; i++)

typedef long long ll;
typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<std::vector<std::string> > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<std::vector<bool> > v2_bool;
typedef std::pair<ll, ll> pll;

using namespace std;

int main() 
{
    int a,b;
    string s,t;
    cin >> a >> b;

    irep(i, a) {
        s += to_string(b);
    }
    irep(i, b) {
        t += to_string(a);
    }
    if(s < t) {
        cout << s << endl;        
    } else {
        cout << t << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int slove(int n)
{
    int sum=0;
    while(n)
    {
        sum+=(n%10);
        n/=10;
    }
    return sum;
}
int main()
{
  int n,a,b;
  scanf("%d%d%d",&n,&a,&b);
  int sum=0;
  for(int i=1;i<=n;i++)
  {
      int k=slove(i);
      if(k>=a&&k<=b)
      {
          sum+=i;
      }

  }
    printf("%d\n",sum);
    return 0;
}


Measured memory_bytes: 256
x = list(input())
k = 1
st = 0
ed = 1
cur_st = 1
cur_ed = 2
for i in range(1,len(x)):
  if x[st:ed] == x[cur_st:cur_ed]:
    cur_ed += 1
  else:
    st = cur_st
    ed = cur_ed
    cur_st = i+1
    cur_ed = i+2
    k += 1
print(k)

Measured memory_bytes: 4840
/***************************************************
 * Problem Name : C.cpp
 * Problem Link :
 * OJ           :
 * Verdict      : Trying
 * Date         : 2020-05-31
 * Problem Type :
 * Author Name  : Saikat Sharma
 * University   : CSE, MBSTU
 ***************************************************/
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <list>
#include <unordered_map>
#include <unordered_set>
#include <cstdlib>
#include <deque>
#include <stack>
#include <bitset>
#include <cassert>
#include <map>
#include <set>
#include <cassert>
#include <iomanip>
#include <random>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;

#define __FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define __FileRead freopen ("input.txt", "r", stdin)
#define __FileWrite freopen ("output.txt", "w", stdout)
#define SET(a,v) memset(a,v,sizeof(a))
#define SZ(v) (int)v.size()
#define pii pair<int,int>
#define pil pair <int, ll>
#define pli pair <ll, int>
#define pll pair <ll, ll>
#define debug cout <<"######\n"
#define debug1(x) cout <<"### " << x << " ###\n"
#define debug2(x,y) cout <<"# " << x <<" : "<< y <<" #\n"
#define nl cout << "\n";
#define sp cout << " ";
#define sl(n) scanf("%lld", &n)
#define sf(n) scanf("%lf", &n)
#define si(n) scanf("%d", &n)
#define ss(n) scanf("%s", n)
#define pf(n) scanf("%d", n)
#define pfl(n) scanf("%lld", n)
#define all(v) v.begin(), v.end()
#define rall(v) v.begin(), v.end()
#define srt(v) sort(v.begin(), v.end())
#define r_srt(v) sort(v.rbegin(), v.rend())
#define rev(v) reverse(v.rbegin(), v.rend())
#define Sqr(x) ((x)*(x))
#define Mod(x, m) ((((x) % (m)) + (m)) % (m))
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define pb push_back
#define mk make_pair
#define F first
#define S second
#define MAX 100005
#define INF 1000000009
#define MOD 1000000007

template<class T>
using min_heap = priority_queue<T, std::vector<T>, std::greater<T>>;
template<typename T>
using ordered_set  = tree<T, null_type, less<T>, rb_tree_tag,
      tree_order_statistics_node_update>;

template <typename T> string toString ( T Number ) {
    stringstream ss;
    ss << Number;
    return ss.str();
}
template<typename T> int toInt (T str) {
    stringstream ss;
    ss << str;
    int num;
    ss >> num;
    return num;
}
ll lcm ( ll a, ll b ) {
    return ( a / __gcd ( a, b ) ) * b;
}
/************************************ Code Start Here ******************************************************/

int main () {
    __FastIO;
    //~ cout << setprecision (10) << fixed;
    ull A;
    long double B;
    cin >> A >> B;
    ull sum = (A * B);
    cout << sum << "\n";
    return 0;
}


Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

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

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

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    int N,M,C;
    cin >> N >> M >> C;
    vector<int> B(M);
    REP(i,M)cin >> B[i];
    vector<vector<int>> A(N,vector<int>(M));
    REP(i,N){
        REP(l,M)cin >> A[i][l];
    }
    ll count = 0;
    REP(i,N){
        ll score = 0;
        REP(l,M){
            score += A[i][l]*B[l];
        }
        score += C;
        count += (score > 0);
    }
    cout << count << "\n";
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
#include<tuple>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  bool ans = true;
  rep(i, n) cin >> a[i];
  rep(i, n){
    if(a[i] % 2 == 0){
      if(a[i] % 3 != 0 && a[i] % 5 != 0) ans = false;
    }
  }
  if(ans){
    cout << "APPROVED" << endl;
  } else {
    cout << "DENIED" << endl;
  }
}


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

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

using namespace std;

#define deb(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) { cout << '\n';}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << '[' << *it << " = " << a << "]  ";
    err(++it, args...);
}

#define fcout cout<<fixed<<setprecision(15)
#define repp(i,j,k) for(int i=j; i<k; ++i)
#define rep(i,j) repp(i,0,j)
#define rrep(i,j,k) for(int i=j; i>=k; --i)
#define all(x) (x).begin(), (x).end()
#define sort(x) sort(x.begin(), x.end())
#define lb(x,val) lower_bound(x.begin(), x.end(), val)
#define ub(x,val) upper_bound(x.begin(), x.end(), val)
#define pb(x) emplace_back(x);

typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef tuple<lli, lli> tii;
typedef tuple<lli, lli, lli> tiii;

//const lli M=998244353ll;
const lli M=1000000007ll;
const double D=1.0;


void solve(){
	string s; cin>>s;
	rep(i,s.size()) cout<<"x";

}

int main(){
	fast_io
	int tc=1;
	//cin>>tc;
	while(tc--){solve();}
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>

typedef long long ll;

int main() {
  //freopen("input.txt", "r", stdin);
  int N;
  while (~scanf("%d", &N)) {
    ll sum = 0LL;
    for (int i = 1; i <= N; i++)
      if (i % 3 && i % 5) sum += ll(i);
    printf("%lld\n", sum);
  }
  return 0;
}


Measured memory_bytes: 1732
#include<bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define M 1000000007
typedef pair<int,int> P;
typedef pair<int,int> PP;
typedef pair<int,int> Q;
int n,m,k,i,j,l,q,ki,kaz;
int mp[5001][5001],mp2[5001],flg[5001],mp3[5001][5001];
int len[5001];
int main(void)
{
	long long min;
	queue <int> qe;
	queue <int> qu;
	Q ppp;
	P p[5001];
	PP pp[10001];
	cin>>n>>m;
	for(i=1;i<=n;i++) cin>>p[i].f>>p[i].s;
	for(i=1;i<=m;i++) cin>>pp[i].f>>pp[i].s;
	for(i=1;i<=n;i++) {
		len[i]=1;
		for(j=1;j<=n;j++) mp[i][j]=M;
	}
	for(i=1;i<=m;i++) {
		mp[pp[i].f][pp[i].s]=1,mp[pp[i].s][pp[i].f]=1;
		mp3[pp[i].f][len[pp[i].f]]=pp[i].s,len[pp[i].f]++;
		mp3[pp[i].s][len[pp[i].s]]=pp[i].f,len[pp[i].s]++;
	}
	//ppp.sは意味無い
	//cout<<"aa"<<endl;
	for(i=1;i<=n;i++){
		for(l=1;l<=len[i];l++) qe.push(mp3[i][l]),qu.push(2);
		while(qe.size()!=0){
			q=qe.front();
			kaz=qu.front();
			for(j=1;j<=len[q];j++){
				if(mp[i][mp3[q][j]]>kaz&&mp3[q][j]!=i&&kaz<=p[i].s){
					mp[i][mp3[q][j]]=kaz;
					qe.push(mp3[q][j]);
					qu.push(kaz+1);
				}
			}
			qe.pop();
			qu.pop();
		}
		//for(j=0;j<=300000000;j++);
		/*for(l=1;l<=n;l++) {
			for(j=1;j<=n;j++) printf("%d ",mp[l][j]);
			cout<<endl;
		}
		cout<<endl;*/
	}
	//cout<<"aa"<<endl;
	for(i=1;i<=n;i++) flg[i]=0,mp2[i]=M;
	mp2[1]=0;
	for(i=1;i<=n;i++){
		min=M;
		for(j=1;j<=n;j++){
			if(min>mp2[j]&&flg[j]!=1) min=mp2[j],ki=j;
		}
		for(j=1;j<=n;j++){
			if(mp[ki][j]<=p[ki].s&&mp2[j]>mp2[ki]+p[ki].f) mp2[j]=mp2[ki]+p[ki].f;
		}
		flg[ki]=1;
		/*printf("%d\n",ki);
		for(j=1;j<=n;j++) printf("%d ",mp2[j]);
		cout<<endl;*/
	}/*
	while(qu.size()!=0){
		ppp=qu.front();
		if(mp2[ppp.s]>mp2[ppp.f]+p[ppp.f-1].f){
			mp2[ppp.s]=mp2[ppp.f]+p[ppp.f-1].f;
			for(i=1;i<=n;i++) if(mp[ppp.s][i]<=p[ppp.s-1].s) qu.push(Q(ppp.s,i));
		}
		//printf("%d %d %d ",ppp.f,ppp.s,p[ppp.s-1].s);
		qu.pop();
	}*/
	printf("%d\n",mp2[n]);
	return 0;
}


Measured memory_bytes: 121104
"use strict"

function main(input) {

    input = input.split('\n').map(v => ~~v)
    const n = input[0]
    const s = input.slice(1, input.length).sort((a, b) => a - b)
    const sums = eval(s.join("+")); //単純に合計を計算
    if (sums % 10 != 0) {
        console.log(sums);
        return
    }
    for (let i = 0; i < n; i++) {
        if ((sums - s[i]) % 10 != 0) {
            console.log(sums - s[i])
            return
        }
    }
    console.log(0)

}
main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7500
from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush,heappop
import math
from collections import *
from functools import reduce,cmp_to_key
import sys
input = sys.stdin.readline

M = mod = 10**9 +7
def factors(n):return sorted(set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0))))
def inv_mod(n):return pow(n, mod - 2, mod)

def li():return [int(i) for i in input().rstrip('\n').split()]
def st():return input().rstrip('\n')
def val():return int(input().rstrip('\n'))
def li2():return [i for i in input().rstrip('\n')]
def li3():return [int(i) for i in input().rstrip('\n')]
def li4():return [float(i) for i in input().rstrip('\n').split(' ')]








n = val()
l = li() + [2,2]

if n == 1:
    print(0)
    exit()
elif n == 2:
    print(abs(l[0] - l[1]))
    exit()
ans = [float('inf')]*(n + 2)
ans[0] = 0
for i in range(n):
    ans[i + 1] = min(ans[i + 1],ans[i] + abs(l[i] - l[i+1]))
    ans[i + 2] = min(ans[i + 2],ans[i] + abs(l[i] - l[i+2]))
print(ans[n-1])

Measured memory_bytes: 56072
#include <stdio.h>
int main(){
	int i;
	char c[1201];
	gets(c);
	for (i=0;i<1201;i++){
		if      (c[i]>='a'&&c[i]<='z') c[i]=c[i]+'A'-'a';
		else if (c[i]>='A'&&c[i]<='Z') c[i]=c[i]-('A'-'a');
	}
	printf("%s\n",c);
	return 0;
}

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

int main(void){
    int a, b, k;
    cin >> a >> b;

    if(ceil((a + b) / 2.0) != floor((a + b) / 2.0)){
        puts("IMPOSSIBLE");
        return 0;
    }

    cout << (a + b) / 2 << endl;

    return 0;
} 


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long cnt,ans;
int main() {
	int n,a,b;
	cin>>n;
	vector<long long>vec,x(n),y(n);
	for(int i=0;i<n;i++){
		cin>>x[i];
	}
	for(int i=0;i<n;i++){
		cin>>y[i];
	}
	for(int i=0;i<n;i++){
		if(x[i]<y[i]){
			cnt+=y[i]-x[i];
			ans++;
		}
		else{
			vec.push_back(x[i]-y[i]);
			//cout<<a-b<<endl;
		}
	}
	sort(vec.begin(),vec.end());
	reverse(vec.begin(),vec.end());
	for(int i=0;i<vec.size();i++){
		if(cnt<=0){
			cout<<ans<<endl;
			return 0;
		}
		cnt-=vec[i];
		ans++;
	}
	if(cnt<=0){
		cout<<ans<<endl;
		return 0;
	}
	cout<<-1<<endl;
}

Measured memory_bytes: 2936
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define sqr(a) ((a) * (a))
#define io() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define co() cout.precision(10);
#define F for(li i=0;i<n;i++)
#define fo(i,a,n) for(i=a;i<n;i++)
#define ne cout<<endl;
#define nec cout<<endl;continue;
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define test int t;cin>>t;while(t--)
//memset(arr, 0, sizeof arr);
typedef long long li;
typedef long double ld;
 
const li mod = 1000000007;
 
int main()
{ 
io();
li n;
cin>>n;
n--;
long long int root = sqrt(n); 
    long long int ans = 0; 
  
    for (int i = 1; i <= root; i++)  
        ans += n / i; 
      
    ans = 2 * ans - (root * root); 
    cout<<ans;
}

Measured memory_bytes: 3692
//--- pE ---//
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main {
	public static void main (String[] args) throws java.lang.Exception {
		new Solution();
	}
}
class Solution {
	Reader reader;
	PrintWriter out;
	public Solution() {
		reader = new Reader();
		out = new PrintWriter(System.out);
		// int t = reader.ni();
		while (reader.hasNext()) {
			run_case();
		}
		out.flush();
	}

	long mod = (long)1e9+7;
	private void run_case() {
		int n = reader.ni();
		int m = reader.ni();

		long res = 0;
		long[] cnt = new long[m+1];

		for (int i=m; i>=1; i--) {
			cnt[i] = power_mod(m / i, n, mod);
			for (int j=i+i; j<=m; j+=i) {
				cnt[i] = add(cnt[i], mod - cnt[j], mod);
			}
			res = add(res, 1L * cnt[i] * i % mod, mod);
		}

		System.out.println(res);
		return;
	}

	private long power_mod(long x, long y, long mod) {
	    long res = 1;
	    x = x % mod;
	    while (y > 0) {
	        if ((y & 1) == 1) res = (res * x) % mod;
	        y = y >> 1;
	        x = (x * x) % mod;
	    }
	    return res;
	}

	private long add(long a, long b, long mod) {
		a += b;
		a %= mod;
		return a;
	}
}



class Reader {
	BufferedReader br;
	StringTokenizer st;
	public Reader(){
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			st = new StringTokenizer(br.readLine());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public String next() {
		if (st.hasMoreTokens()) return st.nextToken();
		try {
			st = new StringTokenizer(br.readLine());
		} catch (Exception e) {
			e.printStackTrace();
		}
		return st.nextToken();
	}
	public boolean hasNext() {
		try {
			if (!st.hasMoreTokens() && !br.ready()) return false;
			else return true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return false;
	}
	public int ni() {return Integer.parseInt(this.next());}
	public long nl() {return Long.parseLong(this.next());}
	public String ns() {return this.next();}
}


Measured memory_bytes: 33780
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main() {
  int N, A[SIZE];

  scanf("%d", &N);

  for (int i=0; i<N; i++)
    scanf("%d", A+i);

  int ans = 100;

  for (int i=0; i<N; i++) {
    int t = 0;
    while(A[i] % 2 == 0) {
      A[i] /= 2;
      t++;
    }
    ans = min(ans, t);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include  <iostream>
#include  <algorithm>
#include  <climits>
#include  <vector>
#include  <string>
#include  <cstring>
#include  <stack>
#include  <queue>
#include  <cmath>
#include  <iomanip>
#include  <set>
#include  <map>
#include  <new>
#include <cstdint>
#include <cctype>
#include  <cstdio>
#include  <sstream>
#include  <bitset>
using namespace std;
#define rep(i,n)  for(int i = 0; i < n; i++)
#define lrep(i,n,m)  for(int i = n; i < m; i++)

using ll = long long;
using ld = long double;
using Vii = vector<vector<int> >;
using Gjudge = vector<vector<bool>>;
using Vi = vector<int>;
using Vl = vector<ll>;
using Vd = vector<double>;
using Vld = vector<long double>;
using Vll = vector<vector<ll> >;
using Vldd = vector<vector<ld> >;
using Vs = vector<string>;
using Vb = vector<bool>;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Pli = pair<ll, int>;
using VPi = vector<Pi>;
using VPl = vector<Pl>;
using VPli = vector<Pli>;
using Ti = tuple<int, int, int>;
using Tl = tuple<ll, ll, ll>;

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

const int Mod = static_cast<int>(1e9 + 7);
const int INF = INT_MAX;
const ll LINF = LLONG_MAX;
const int dx[4] = { 1,0,-1,0 };
const int dy[4] = { 0,1,0,-1 };

int main()
{
	string s;
	cin >> s;
	if (s[s.size() - 1] == 's') cout << s + "es" << endl;
	else cout << s + 's' << endl;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int N;
  cin>>N;
  map<int,int> A;
  rep(i,0,N){
    int X;
    cin>>X;
    if(A.count(X))
      A.at(X)++;
    else
      A[X]=1;
  }
  int ans=0;
  for(auto p:A){
    int key=p.first;
    int value=p.second;
    if(key>value)
      ans+=value;
    else
      ans+=value-key;
  }
  cout<<ans;
  }


Measured memory_bytes: 6272
#include <stdio.h>

int memo[4][257][1<<15];

int count(int now,int prev,int rest) {
	int result=0;
	int i;
	if(rest==0)return 1;
	if(rest<0 || now>=4)return 0;
	if(memo[now][prev][rest]>0)return memo[now][prev][rest]-1;
	for(i=prev;i<=256 && i*i<=rest;i++) {
		result+=count(now+1,i,rest-i*i);
	}
	memo[now][prev][rest]=result+1;
	return result;
}

int main(void) {
	int query;
	while(1) {
		scanf("%d",&query);
		if(query==0)break;
		printf("%d\n",count(0,1,query));
	}
	return 0;
}

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

using namespace std;
int main(){
int N,K; cin >> N >> K;
 vector<int> a(N); for(int i = 0; i < N; i++){ cin >> a[i];}
  int dp[100100]; for(int i = 0; i < 100100; i++){ dp[i] = 0;}
  for(int i = 0; i < N; i++){ dp[a[i]] = 1;} dp[0] = -1;
  // 1 = true, -1 = false , 0 = unknown
  
  for(int x = 0; x < 100100; x++){
    if(dp[x] != 0){ continue;}
    
    bool flag = false;
    for(int i = 0; i < N; i++){
      if( x-a[i] >= 0){ 
        if( dp[x-a[i]] == -1){ flag = true;}}}
    if( flag){ dp[x] = 1; } else{ dp[x] = -1;}
  }
  
  if(dp[K] == 1){ cout << "First" << endl;} else{ cout << "Second" << endl;}
  return 0;}
    

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,k;
  cin>>a>>b>>c>>k;
  int x=0;
  while(a>=b){
    b*=2;
    x++;
  }
  while(b>=c){
    c*=2;
    x++;
  }
  cout<<(x<=k?"Yes":"No")<<endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=2e5+5;

set<int>G[maxn];
int A[maxn],B[maxn],vis[maxn];
set<int>Q;

int main(){
	ios::sync_with_stdio(false);
	
	int n,m;
	cin>>n>>m;
	string s;
	cin>>s;
	s="#"+s;
	
	for (int i=1;i<=n;i++) {
		Q.insert(i);
		vis[i]=1;
	}
	
	for (int i=1;i<=m;i++){
		int u,v;
		cin>>u>>v;
		if (!G[u].count(v)){
			G[u].insert(v);
			if (s[v]=='A') A[u]++;
			else B[u]++;
		}
		
		if (!G[v].count(u)){
			G[v].insert(u);
			if (s[u]=='A') A[v]++;
			else B[v]++;
		}
		
		if (A[u]>0&&B[u]>0) {vis[u]=0; Q.erase(u);}
		if (A[v]>0&&B[v]>0) {vis[v]=0; Q.erase(v);}
	}
	
	while (!Q.empty()){
	 	int x=*Q.begin();
	 	Q.erase(x);
	 	for (int u:G[x]){
			G[u].erase(x);
			if (s[x]=='A') A[u]--;
			else B[u]--;
			
			if (A[u]==0||B[u]==0)
				if (!vis[u]) { Q.insert(u); vis[u]=1; }
		}
	}
	
	int flag=0;
	for (int i=1;i<=n;i++){
		if (!vis[i]) flag=1;
	}
	if (flag){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
} 


/*
pick x[i] :  cost X + (m+1)^2*x[i]+ X + x[i-1];


otherwise :  cost m^2*x[i] + x[i] + X; 	


*/

Measured memory_bytes: 35220
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <functional>
#define REP(i,n) for(int i=0;i<n;i++)
typedef long long ll;

using namespace std;
int kaijo(int n){
	int ans = 1;
	if (n != 0){
		for (int i = 0; i < n; i++){
			ans *= (n - i);
		}
	}
	else{
		ans = 1;
	}
	return ans;
}

int main(){
	string s, t;
	cin >> s >> t;
	//string s1, t1;
	sort(s.begin(), s.end());
	sort(t.begin(), t.end(), greater<char>());
	if (lexicographical_compare(s.begin(), s.end(), t.begin(), t.end())){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int selectionSort(int *,int);
int main(){
  int i,N,*data,count;
  scanf("%d",&N);
  data=(int *)malloc(N*sizeof(data));
  for(i=0;i<N;i++){
    scanf("%d",&data[i]);
  }

  count=selectionSort(data,N);

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

int selectionSort(int *data,int N){
  int i,j,minj,temp,flag,count=0;
  for(i=0;i<N;i++){
    flag=0;
    minj=i;
    for(j=i;j<N;j++){
      if(data[j]<data[minj]){
	minj=j;
	flag++;
      }
    }
    if(flag!=0){
    temp=data[i];
    data[i]=data[minj];
    data[minj]=temp;
    count++;
    }
  }
  return count;
}



Measured memory_bytes: 2052
#include <iostream>
using namespace std;
int h[51];
int main() {
 int a,b,c,d,n,j=0,m;
 for (m=0; m<10000; m++) {
	 a=m/1000; b=(m-a*1000)/100;
	 c=(m-a*1000-b*100)/10; d=m-a*1000-b*100-c*10;
     h[a+b+c+d]++;
 }
 while(cin >> n) cout << h[n] << endl;
 return 0;
}

Measured memory_bytes: 1160
from math import gcd
from collections import defaultdict

n,m = map(int,input().split())
s = input()
t = input()

ans = n*m // gcd(n,m)
d = defaultdict(lambda : '?')

for i,si in enumerate(s):
    d[i * ans//n] = si

for j,tj in enumerate(t):
    if(not d[j * ans//m] in ['?', tj]):
        print(-1)
        exit()

print(ans)

Measured memory_bytes: 98472
#include "bits/stdc++.h"
using namespace std;
const int maxn = 200200;
const int mod = 1000000007;
long long f[maxn];
long long a[maxn], c[maxn], d[maxn];
int main(){
  int n;
  cin >> n;
  for(int i = 1; i <= n; i++) cin >> c[i];
  int nn = 1;
  d[nn] = c[nn];
  for(int i = 2; i <= n; i++){
    if(c[i] == d[nn]) continue;
    d[++nn] = c[i];
  }
  nn++;
  n = nn;
  f[n + 1] = 1;
  for(int i = n; i >= 1; i--){
    f[i] = f[i + 1];
    f[i] += a[d[i]];
    if(f[i] >= mod) f[i] -= mod;
    a[d[i]] += f[i + 1];
    if(a[d[i]] >= mod) a[d[i]] -= mod;
  }
  cout << f[1] << endl;
  return 0;
}


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

int main() {
    double l;
    cin >> l;
    double x = l/3;
    double ans = pow(x,3);
    printf("%.10f\n", ans); // フォーマット指定子
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;


class UNKO
{
    
    static void Main()
    {
        string str;

        List<double> Answers = new List<double>();
        int count = 0;

        while ((str = Console.ReadLine()) != null)
        {
            string[] strarray = str.Split(' ');

            double[] abcdef = new double[6];

            for (int i=0;i<6;i++)
            {
                abcdef[i] = double.Parse(strarray[i]);
            }

           
                    double x = ((abcdef[4] * abcdef[2]) - (abcdef[1] * abcdef[5])) / ((abcdef[4] * abcdef[0]) - (abcdef[1] * abcdef[3]));
                    double y = ((abcdef[3] * abcdef[2]) - (abcdef[0] * abcdef[5])) / ((abcdef[1] * abcdef[3]) - (abcdef[0] * abcdef[4]));
     
            Answers.Add(x);
            Answers.Add(y);


            count++;   
        }

        for (int i=0; i< count;i++)
        {
            Console.WriteLine("{0} {1}", (Answers[2 * i]).ToString("F3"), (Answers[1 + (2 * i)]).ToString("F3"));

        }
    }
}

Measured memory_bytes: 9168
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
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; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

struct Node {
  string name;
  vi children;

  Node() {
  }
};

void solve() {
  int n;
  cin >> n;
  vector<Node> nodes(n);
  rep(i, n) {
    int k;
    string m;
    cin >> k >> m;
    k--;
    nodes[i].name = m;
    if (k >= 0) nodes[k].children.pb(i);
  }
  function<void(int, int)> dfs = [&](int p, int depth) {
    cout << string(depth, '.') << nodes[p].name << endl;
    for (int x : nodes[p].children) dfs(x, depth + 1);
  };
  dfs(0, 0);
}

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

int main(){
    int n, counter=0;
    string s;
    cin >> n >> s;
    rep(i,n-2){
        if(s[i]=='A'){
            if(s[i+1]=='B'){
                if(s[i+2]=='C'){
                    ++counter;
                }else{
                    continue;
                }
            }else{
                continue;
            }
        }else{
            continue;
        }
    }
    cout << counter << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()

using namespace std;

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}

template<typename T>
T finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}

/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*/
int main() {
	ll N,M,C; cin >> N;
	ll ans = 0;
	VLL  A(N);
	for (int i = 0;i < N;i++) cin >> A[i];
	sort(all(A));
	for (int i = N-1;i >-1;i-=2) {
		ans += A[i];
	}
	for (int i = N - 2;i > -1;i -= 2) {
		ans -= A[i];
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <cmath>
#include <map>
#include <queue>
#include <vector>
#define INF 0x3f3f3f3f
using namespace std;
typedef long long ll;
const ll INFll=0x3f3f3f3f3f3f3f3fll;

int main(){
    ll n,m;
    ll ans;
    cin>>n>>m;
    if(n*2<=m){
        ans = n+(m-n*2)/4;
    }else{
        ans = m/2;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define M 1000000007
#define pi ld(acos(-1.0))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n) for(int i=1;i<(int)(n);i++)
#define repp(i,a,b)  for(int i=a;i<=(int)(b);i++)
#define Repp(i,a,b)  for(int i=a;i>=(int)(b);i--)
#define cs ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fi first
#define se second
#define ii pair<int,int>
#define bye(x) {cout<<x;return 0;}
typedef long long ll;
typedef long double ld;
using namespace std;

int main(){
    cs
    string s,t;cin>>s>>t;
    t.pop_back();
    if(s==t) cout<<"Yes";else cout<<"No";

}

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


using namespace std;
typedef long long LL;
const int maxn = 100010;
int a[maxn], fa[maxn], mi[maxn], id[maxn], vis[maxn];
int n, m;

void Init()
{
    for(int i = 0; i <= n; i++)
    {
        fa[i] = i;
        mi[i] = a[i];
        id[i] = i;
    }
}

int Find(int x)
{
    return fa[x] == x ? x : fa[x] = Find(fa[x]);
}

void Merge(int x, int y)
{
    int fx = Find(x), fy = Find(y);
    fa[fx] = fy;
    if(mi[fy] > mi[fx])
    {
        mi[fy] = mi[fx];
        id[fy] = id[fx];
    }
}

int main()
{
    scanf("%d%d", &n, &m);
    multiset<int> s;
    for(int i = 1; i <= n; i++)
    {
        scanf("%d", &a[i]);
        s.insert(a[i]);
    }
    Init();
    for(int i = 1; i <= m; i++)
    {
        int u, v;
        scanf("%d%d", &u, &v);
        Merge(u + 1, v + 1);
    }
    int num = 0;
    LL ans = 0;
    for(int i = 1; i <= n; i++)
    {
        if(Find(i) == i)
        {
            num++;
            ans += mi[fa[i]];
            s.erase(s.find(mi[fa[i]]));
        }
    }
    if(n < 2 * num - 2)
        printf("Impossible\n");
    else if(num == 1)
        printf("0\n");
    else
    {
        int cnt = 0;
        multiset<int>::iterator it;
        for(it = s.begin(); it != s.end() && cnt < num - 2; it++)
        {
            cnt++;
            ans += *it;
        }
        printf("%lld\n", ans);
    }
    return 0;
}


Measured memory_bytes: 6528
c = []
while s = gets
  c.push(s.split.map(&:to_i))
end

if (c[0][0]-c[1][0]) != (c[0][1]-c[1][1]) ||(c[0][0]-c[1][0]) != (c[0][2]-c[1][2])
  puts "No"
  exit
elsif (c[1][0]-c[2][0]) != (c[1][1]-c[2][1]) ||(c[1][0]-c[2][0]) != (c[1][2]-c[2][2])
  puts "No"
  exit
elsif (c[0][0]-c[0][1]) != (c[1][0]-c[1][1]) ||(c[0][0]-c[0][1]) != (c[2][0]-c[2][1])
  puts "No"
  exit
elsif (c[0][1]-c[0][2]) != (c[1][1]-c[1][2]) ||(c[0][1]-c[0][2]) != (c[2][1]-c[2][2])
  puts "No"
  exit
end
puts "Yes"

Measured memory_bytes: 1916
#include <stdio.h>

int main(void){
    // 変数
    long int n, k;
    long int result = 0;

    // 入力
    scanf( "%ld %ld", &n, &k );

    // 演算
    result = n % k ;

    // 条件分岐
    if( result > ( k - result ) ){
        result = k - result ;
    }

    // 出力
    printf( "%ld\n", result );

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
struct edge {
  int to;
  ll cost;
  edge(int t, ll c): to(t), cost(c) {};
};
using P = pair<int, ll>;
int N;
void dijkstra(int s,
	      vector<vector<edge>>& G,
	      vector<ll>& d) {
  priority_queue<P, vector<P>, greater<P> > que;
  d = vector<ll>(N, longinf);
  d[s] = 0;
  que.push(P(0, s));
  while (!que.empty()) {
    P p = que.top();
    que.pop();
    int v = p.second;
    if (d[v] < p.first) continue;
    for (int i=0; i<(int)G[v].size(); ++i) {
      edge e = G[v][i];
      if (d[e.to] > d[v] + e.cost) {
	d[e.to] = d[v] + e.cost;
	que.push(P(d[e.to], e.to));
      }
    }
  }
}
int main() {
  int M, s, t;
  cin >> N >> M >> s >> t;
  --s, --t;
  vector<vector<edge>> Gy(N), Gs(N);
  rep(i, M) {
    int u, v;
    ll a, b;
    cin >> u >> v >> a >> b;
    --u, --v;
    Gy[u].push_back(edge(v, a));
    Gy[v].push_back(edge(u, a));
    Gs[u].push_back(edge(v, b));
    Gs[v].push_back(edge(u, b));
  }
  vector<ll> dy, ds;
  dijkstra(s, Gy, dy);
  dijkstra(t, Gs, ds);
  vector<ll> ans(N);
  ll mn = longinf;
  rrep(i, N) {
    mn = min(dy[i]+ds[i], mn);
    ans[i] = 1e15L - mn;
  }
  rep(i, N) cout << ans[i] << endl;
  return 0;
}


Measured memory_bytes: 19572
S=gets.chomp

g = 0
score = 0
S.each_char do |c|
    if g == 0
        g += 1
        if c == 'p'
            score -= 1
        end
    else
        g -= 1
        if c == 'g'
            score += 1
        end
    end
end

puts score

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
	for(auto &e:u) fill_v<T>(e,v...);
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int64 A, B, N;
	cin >> A >> B >> N;
	cout << A*min(B-1, N)/B << endl;
}


Measured memory_bytes: 3612
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//pair sort
bool compare_by_b(pair<LL, LL> a, pair<LL, LL> b) {
    if(a.second != b.second) return a.second < b.second;
    else return a.first < b.first;
}
std::uint32_t euclidean_gcd(std::uint32_t a, std::uint32_t b){return b != 0 ? euclidean_gcd(b, a % b) : a;}


void solve(long long N, long long K, std::vector<long long> p){
    vector <double> e(N);
    REP(i, N)e[i] = ((double)p[i]+1.0)/2.0;
    double sum=0;
    double maxsum = 0;
    LL idx=0;
    for (int i=0; i < K;i++)sum+=e[i];
    maxsum=sum;
    for(int i=1; i <N-K+1; i++){
        sum=sum-e[i-1]+e[i+K-1];
        if(sum > maxsum){
            idx = i;
            maxsum=sum;
        }
    }
    double ans=0.0;
    for(int i=idx; i <idx+K; i++){
        ans+=e[i];
    }
    
    cout<<setprecision(9)<<ans<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> p(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&p[i]);
    }
    solve(N, K, std::move(p));
    return 0;
}


Measured memory_bytes: 3328
// Ver19.03
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF (1 << 29) * 2
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

int main()
{
  char s[11], t[11], u[11];
  int a, b;
  scanf("%s%s%d%d%s", s, t, &a, &b, u);
  !strcmp(s, u) ? printf("%d %d\n", --a, b) : printf("%d %d\n", a, --b);
}

Measured memory_bytes: 128
def main():
    k = int(input())

    ans = 0
    ketasave = 0
    ng = False
    while True:
        for _ in range(9):
            ans += k
            if ans % 10 == 7:
                while ans % 10 == 7:
                    ans -= 7
                    ans //= 10
                    ketasave += 1
                break
        else:
            ng = True
            break

        if ans==0:
            break
            
    print(ketasave if not ng else -1)

main()

Measured memory_bytes: 9184
for lp in range(1, int(input()) + 1):

    num = int(input())

    print("Case " + str(lp) + ":")

    for _ in range(10):
        num **= 2
        num = str(num)
        num = "0" * (8 - len(num)) + num
        num = num[2:-2]
        num = int(num)
        print(num)



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

int compare_int(const void *a, const void *b){
  return *(int *)b - *(int *)a;
}

int main(void){
  int N;
  int d[110] = {};
  int i, j, k;
  int count = 1;
  scanf("%d", &N);
  for(i = 0; i < N; i++){
    scanf("%d", &d[i]);
  }
  qsort(d, N, sizeof(int), compare_int);
  for(i = 1; i < N; i++){
    if(d[i] < d[i-1]){
      count++;
    }
  }
  printf("%d\n", count);
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int n;
    int maX=200000;
    cin>>n;
    int R[maX];
    int maxv,minv,i,j;
    for(i=0;i<n;i++){
        cin>>R[i];
    }
    minv = R[0];
    maxv = R[1]-R[0];
    for(j=1;j<n;j++){
        maxv = max(maxv,R[j] - minv);
        minv = min(minv,R[j]);
    }
   cout<<maxv<<endl;
   return 0;
    
}



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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

#define mask ((1LL<<60)-1)

ll n,k;
ll a[1001];

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

  cin>>n>>k;
  rep(i,n){
    cin>>a[i];
  }
  multiset<ll> st;
  rep(i,n){
    ll sum=0;
    repl(j,i,n){
      sum+=a[j];
      st.insert(sum);
    }
  }
  ll res=0;
  for(ll i=(1LL<<60);i>=1;i>>=1LL){
    ll cnt=0;
    for(ll j : st){
      if((j&i)>0)cnt++;
    }
    if(cnt<k)continue;
    res|=i;
    vector<ll> er;
    for(ll j : st){
      if((j&i)==0)er.push_back(j);
    }
    for(ll j : er)st.erase(st.find(j));
  }
  cout<<res<<endl;

  return 0;
}


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

int main() {
	int W, H, x, y, r;
	scanf("%d", &W);
	scanf("%d", &H);
	scanf("%d", &x);
	scanf("%d", &y);
	scanf("%d", &r);

	if (x + r <= W && x - r >= 0 && y + r <= H && y - r >= 0) {
		printf("Yes");
	}
	else {
		printf("No");
	}

	cout << endl;
	return 0;
}

Measured memory_bytes: 3252
#include <stdio.h>
int main (){
int a,b,c;
scanf ("%d%d%d",&a,&b,&c);
if (a<c & b<c){
printf ("%d",a+b);
}
  else {
  if (a>b){
  printf ("%d",c+b);
  }
    else{
    printf ("%d",a+c);
    }
  }
return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		try (Scanner sc = new Scanner(System.in)) {
			
			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = 0;
			
			if (a <= 5) {
				c = 0;
			}
			else if (5 < a && a <= 12) {
				c = b/2;
			} else if (12 < a) {
				c = b;
			}
			System.out.println(c);		
		}
	}
}

Measured memory_bytes: 20820
#include <cstdio>

#define parent(x) (x - 1) / 2
#define left(x) 2 * x + 1
#define right(x) 2 * x + 2

int A[500005], H;

void maxHeapify(int i)
{
	int l = left(i);
	int r = right(i);

	if (l >= H) return;
	else if (r >= H)
	{
		if (A[i] < A[l])
		{
			int temp = A[i];
			A[i] = A[l];
			A[l] = temp;
		}
		else return;
	}
	else
	{
		if (A[i] >= A[l] && A[i] >= A[r]) return;
		int large = A[l] > A[r] ? l : r;
		int temp = A[i];
		A[i] = A[large];
		A[large] = temp;
		maxHeapify(large);
	}
}

int main()
{
	scanf("%d", &H);
	for (int i = 0; i < H; i++)
		scanf("%d", &A[i]);
	for (int i = H - 1; i >= 0; i--)
		maxHeapify(i);
	for (int i = 0; i < H; i++)
	{
		//if (i == 0)
			//printf("%d", A[i]);
		printf(" %d", A[i]);
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 4536
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
const int inf = 1001001001;

int main(){
  ll n;
  ll x,m;
  cin >> n >> x >> m;

  vector<pair<ll,ll>> ord(m);
  ll a = x;
  ll sum = 0;
  for(ll i = 0; i < n; i++){
    if(ord[a].first){
      ll res = n-i-1;
      ll t = i - ord[a].first;
      ll c = res/t;
      ll sumc = (sum - ord[a].second);
      sum += sumc*c;
      i += c*t;
    }else{
          ord[a].first = i;
          ord[a].second = sum;
    }
    sum += a;
    a = (a*a)%m;
  }
  cout << sum << endl;
}


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

int main() {
    int n;
    cin >> n;
    string ans = "APPROVED";
    for (int i=0; i<n; i++) {
        int a;
        cin >> a;

        if (a%2==0 && (a%3!=0 && a%5!=0)) {
            ans = "DENIED";
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pr(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define all(v) (v).begin(), (v).end()
#define int long long
#define sz(v) (int)(v).size()
#define mod 1000000007 // ((a- b)% mod+ mod)% mod

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

const int N= 200001;

void solve() {
        int n, m, k; cin >> n>> m>> k;

        vector<int> vn(n), vm(m);

        for (auto& i: vn) cin >> i;
        for (auto& i: vm) cin >> i;

        vector<int> nsum(n+ 1, 0), msum(m+ 1, 0);
        for (int i= 1; i<= n; i++) nsum[i]= nsum[i- 1]+ vn[i- 1];
        for (int i= 1; i<= m; i++) msum[i]= msum[i- 1]+ vm[i- 1];

        int mx= 0;

        for (int i= 0; i<= n; i++) {
                int cnt= nsum[i];
                if (cnt> k) break;
                int pos= upper_bound(all(msum), (k- cnt))- msum.begin();
                mx= max(mx, i+ pos- 1);
        }

        cout << mx<< "\n";
}

int32_t main(){
ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
        int T= 1;
        //cin >> T;
        while ( T-- ) {
                solve();
        }
return 0;
}


Measured memory_bytes: 9540
#include <bits/stdc++.h>
#include <string>
#include <cmath>
#include <sstream>
//#include <unordered_map>
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORD(i, a, b) for(int i = (a-1); i >= (b); i--)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
typedef long long int ll;
using namespace std;
//ll mod=1000000007;
//ll mod=67280421310721;
ll mod=998244353;
ll INF=1e18;
ll po(ll a,ll b)
{
	ll re=1;
	while(b)
	{
		if(b%2==1)
		{
			re=(re*a);
//			re%=mod;
		}
		a=(a*a);
//		a%=mod;
		b>>=1;
	}
	return re;
}
bool vis[20];
bool re;
bool gra[20][20];
int d;
void dfs(int i )
{
	if(i==d)
	{
		re=1;
		return;
	}
	vis[i]=1;
	FOR(j,0,20)
	{
		if(gra[i][j] && vis[j]==0)
		dfs(j);
		if(re)
		return;
	}
	return;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int test=1;
//	cin>>test;
	while(test--)
	{
		int a,b,c,k;
		cin>>a>>b>>c>>k;
		while(b<=a)
		{
			b*=2;
			k--;
		}
		while(c<=b)
		{
			c*=2;
			k--;
		}
		if(k>=0)
		{
			cout<<"Yes";
		}
		else
		cout<<"No";
	}
	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
int main() {
  int n;
  cin >> n;
  int ans;
  cin >> ans;
  rep(i,n-1){
    int a;
    cin >> a;
    ans = gcd(ans,a);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256