akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define f first
#define s second
#define fastio ios_base::sync_with_stdio(false); cin.tie(0)
#define loop(i, a, b) for(int i=a; i<b; i++)
#define loopb(i, a, b) for(int i=a; i>=b; i--)
#define pb push_back
typedef long long int lli;
typedef pair<lli, lli> pii;
typedef vector<lli> vll;
// use to avoid collision
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
// for pair in unordered_map
struct hash_pair {
    template <class T1, class T2>
    size_t operator()(const pair<T1, T2>& p) const
    {
        auto hash1 = hash<T1>{}(p.first);
        auto hash2 = hash<T2>{}(p.second);
        return hash1 ^ hash2;
    }
};
lli power(lli x, lli y){
    lli res = 1;
    x = x ;
    while (y > 0) {
        if (y & 1)
            res = (res*x) ;
        y = y>>1;
        x = (x*x);
    }
    return res;
}
lli solve(){
	double a, b, h, x ;
	cin>>a>>h>>x;
	double r = 2.0*x / (h*a);
	if(r > a)
		r = a;
	b = 2.0 * (h*a*r-x)/ (a * r *r);
	double angle = atan(b);
	angle = angle * 180.0 / 3.1415926535897;
	cout<<setprecision(9)<<angle<<"\n";
	return 0;
}
int main(){
	fastio;
	lli t;
//	cin>>t;
	t = 1;
	while(t>0){
		t--;
		solve();
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cctype>
using namespace std;
int main() {
	int n, m;
	cin >> n >> m;
	if (n==m){
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

		long n = sc.nextLong();

		long ans = 0;

		for (int i = 1; i <= n; i++) {
			if (i % 3 != 0 && i % 5 != 0)
				ans += i;
		}

		System.out.println(ans);
	}

}


Measured memory_bytes: 27192
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace mp2019B
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s1 = Console.ReadLine().Split(' ');
            string[] s2 = Console.ReadLine().Split(' ');
            string[] s3 = Console.ReadLine().Split(' ');

            List<int> li = new List<int>();
            List<int> lic = new List<int>();

            li.Add(int.Parse(s1[0]));
            li.Add(int.Parse(s1[1]));

            li.Add(int.Parse(s2[0]));
            li.Add(int.Parse(s2[1]));

            li.Add(int.Parse(s3[0]));
            li.Add(int.Parse(s3[1]));

            li.Sort();

            lic.Add(1);
            lic.Add(2);
            lic.Add(2);
            lic.Add(3);
            lic.Add(3);
            lic.Add(4);

            lic.Sort();


            if(li.SequenceEqual(lic))
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }


        }
    }
}


Measured memory_bytes: 13152
#include<iostream>
#include<cmath>
using namespace std;
#define ll long long
ll a,b,n;
ll x;
ll gg;
int main(){
	cin>>a>>b>>n;
	x=min(b-1,n);
	gg=a*x/b;
	cout<<gg<<endl;
	return 0;
}

Measured memory_bytes: 3592
#include <iostream>
using namespace std;
int main(){
  int s, flag=0;
  cin >> s;
  if(s/100<13&&s/100>=1&&s%100<13&&s%100>0) cout << "AMBIGUOUS";
  else if(s/100<13&&s/100>=1&&s%100>=0) cout << "MMYY";
  else if(s/100>=0&&s%100<13&&s%100>0) cout << "YYMM";
  else cout << "NA";
  return 0;
}

 

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <climits>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <sstream>
using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;

int N;

int main() {
    cin >> N;
    if (N % 2 == 0) {
        cout << N / 2 << endl;
    } else {
        cout << N / 2 + 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
typedef pair<int, int> P;
void bfs(int sx, int sy, int d[111][111]){
  const int W = 110;
  const int H = 110;
  REP(y, H) REP(x, W) d[y][x] = INF;
  queue<int> qx, qy;
  qx.push(sx); qy.push(sy);
  d[sy][sx] = 0;
  while(!qx.empty()){
    int x = qx.front(); qx.pop();
    int y = qy.front(); qy.pop();
    if(y % 2 == 1){
      int dx[6] = {-1, 0, 1, 0, -1, -1};
      int dy[6] = {-1, -1, 0, 1, 1, 0};
      REP(r, 6) {
        int nx = x + dx[r];
        int ny = y + dy[r];
        if(valid(nx, ny, W, H) && d[ny][nx] > d[y][x] + 1){
          d[ny][nx] = d[y][x] + 1;
          qx.push(nx); qy.push(ny);
        }
      }
    }else{
      int dx[6] = {0, 1, 1, 1, 0, -1};
      int dy[6] = {-1, -1, 0, 1, 1, 0};
      REP(r, 6) {
        int nx = x + dx[r];
        int ny = y + dy[r];
        if(valid(nx, ny, W, H) && d[ny][nx] > d[y][x] + 1){
          d[ny][nx] = d[y][x] + 1;
          qx.push(nx); qy.push(ny);
        }
      }
    }
  }
}

int main(){
  int W, H;
  while(cin >> W >> H && W){
    int N;
    int tx[10], ty[10];
    cin >> N;
    REP(i, N) cin >> tx[i] >> ty[i];
    int dist[11][111][111];
    REP(i, N){
      bfs(tx[i], ty[i], dist[i]);
    }
    int ans = 0;
    int M; cin >> M;
    REP(i, M){
      int nx, ny; cin >> nx >> ny;
      bfs(nx, ny, dist[N]);
      int cnt = 0;
      REP(y, H)REP(x, W){
        //printf("nx = %d ny = %d x = %d y = %d dist %d\n", nx, ny, x + 1, y + 1, dist[N][y + 1][x + 1]);
        bool ok = true;
        REP(j, N) if(dist[N][y + 1][x + 1] >= dist[j][y + 1][x + 1]) ok = false;
        if(ok) cnt++;
      }
      ans = max(ans, cnt);
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1744
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <complex>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <stack> 
#include <bitset>
#include <queue>
#include <assert.h>
#include <unordered_map>
using namespace std;

const int mod = 1000000007;
const int N = 2000010;
int fac[N], inv[N];

long long mpow(long long a, long long b) {
	long long ans = 1;
	while (b) {
		if (b & 1) ans = ans * a % mod;
		a = a * a % mod;
		b >>= 1;
	}
	return ans;
}

long long com(int n, int m) {
	if (n < m) return 0;
	return 1LL * fac[n] * inv[m] % mod * inv[n - m] % mod;
}

char s[N];

int main()
{
	fac[0] = inv[0] = 1;
	for (int i = 1; i < N; i++) {
		fac[i] = 1LL * fac[i - 1] * i % mod;
		inv[i] = mpow(fac[i], mod - 2);
	}

	int tot;
	scanf("%d", &tot);
	scanf("%s", s);
	int m = strlen(s);
	long long ans = mpow(26, tot);
	// x1 + x2 + ... + xm = p
	// xi >= 0
	for (int p = 1; p <= tot; p++) {
		long long t = mpow(26, tot - p);
		long long mul = mpow(25, p);
		ans = (ans + t * mul % mod * com(m + p - 1, m - 1)) % mod;
		// for (int n = 1; n <= p && n <= m; n++)
		//	ans = (ans + t * com(m, n) % mod * mul % mod * com(p - 1, n - 1)) % mod;
	}

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



Measured memory_bytes: 19784
using System;
using System.Linq;
using System.Collections.Generic;

namespace cs
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = ReadLineLong;
            var hap = (input / 500) * 1000 + (input % 500 / 5) * 5;
            Console.WriteLine(hap);
        }

        static long ReadLineLong => long.Parse(Console.ReadLine());

        static string ReadLineString => Console.ReadLine();

        static IEnumerable<long> ReadLinesIntList => Console.ReadLine().Split(' ').Select(i => long.Parse(i));

        static IEnumerable<string> ReadLinesStringList => Console.ReadLine().Split(' ');

    }
}


Measured memory_bytes: 27428
#include<bits/stdc++.h>
#define int long long 
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define all(a) a.begin(),a.end()
#define ld long double
using namespace std;
signed main(){
    fast;
    int n,m;
    cin>>n>>m;
    int a[n+1];
    int total = 0;
    for(int i = 1;i<=n;i++){
        cin>>a[i];
        total+=a[i];
    }
    sort(a+1,a+n+1,greater<int>());
    ld val = (ld)total/((ld)4*m);
    //cout<<
    //cout<<val<<endl;
    for(int i = 1;i<=m;i++){
        if(a[i]<val){
            cout<<"No";
            return 0 ;
        }
    }
    cout<<"Yes";
}

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

int main(){
  int N;
  cin >> N;
  
  vector<int> A(N);
  
  rep(i,N){
    cin >> A[i];
  }
  
  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());
  
  int sum=0;
  
  rep(i,N){
    if(i%2 == 0) sum += A[i];
    else sum -= A[i];
  }
  
  cout << sum << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
const Int MOD = 1000000007;
void add(Int &x, Int y) { x = (x + y) % MOD; }
Int dp[101][101][256], fac[101];
int main() {
    cin.tie(nullptr); ios::sync_with_stdio(false);
    int N, K; cin >> N >> K;
    vector<int> A(N); for (auto &a : A) cin >> a;
    dp[0][0][0] = 1;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= i; j++) {
            for (int k = 0; k < 256; k++) {
                add(dp[i + 1][j][k], dp[i][j][k]);
                add(dp[i + 1][j + 1][k ^ A[i]], dp[i][j][k]);
            }
        }
    }
    fac[0] = fac[1] = 1;
    for (int i = 2; i <= N; i++) {
        fac[i] = fac[i - 1] * i % MOD;
    }
    Int ans = 0;
    for (int i = 0; i <= N; i++) {
        add(ans, dp[N][i][K] * fac[i] % MOD);
    }
    cout << ans << endl;
    return 0;
}


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

const long double EPS = 1e-10;
const long long INF = 1e18;
const int MOD = (int)1e9 + 7;
const long double PI = acos(-1.0L);

int main() {  // TODO
  int x, n;
  cin >> x >> n;
  vector<int> p(n);
  rep(i, n) cin >> p[i];
  sort(p.begin(), p.end());
  if (!binary_search(p.begin(), p.end(), x)) {
    cout << x << endl;
    return 0;
  }
  rep(i, p[n - 1] + 1) {
    if (!binary_search(p.begin(), p.end(), x - i)) {
      cout << x - i << endl;
      return 0;
    }
    if (!binary_search(p.begin(), p.end(), x + i)) {
      cout << x + i << endl;
      return 0;
    }
  }

  return 0;
}

Measured memory_bytes: 3616
import Data.List ( sort, nub )

solve a b c = try c $ life a b
  where
    life a b = nub . sort $ map (\n -> n * a `mod` b) [1..b]

    try c [0] = "NO"
    try c (0:n:_) = if c `mod` n == 0 then "YES" else "NO"

main = do
    [a, b, c] <- map read . words <$> getLine
    putStrLn $ solve a b c


Measured memory_bytes: 508
#include <iostream>
#include <assert.h>
#include <vector>
#include <unordered_map>
#include <queue>
#include <climits>
#include <cmath>
#include <algorithm>
#include <unordered_set>
using namespace std;
constexpr int64_t MOD = 1e9 + 7;

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

  int32_t N;
  cin >> N;
  int64_t cnt = 0;
  for (int c = 1; c < N; c++) {
    int32_t tgt = N-c;
    for (int a = 1; a * a <= tgt; a++) {
      if (tgt % a == 0) {
        if (tgt / a == a) {
          cnt++;
        } else {
          cnt += 2;
        }
      }
    }
  }
  cout << cnt << endl;

  
  return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <utility>
#include <iomanip>
#include <cmath>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
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;}
using ll = long long;
constexpr ll INF = 1LL << 60;
constexpr int MOD = 1e9 + 7;

struct UnionFind {
    vector<int> par, weight;
    UnionFind(int n) :par(n,-1), weight(n) {}
    void unite(int x, int y, int w = 0) {
        w += get_weight(x); w -= get_weight(y);
        x = root(x); y = root(y);
        if (x == y) return;
        if (par[x] > par[y]) swap(x, y), w = -w;
        par[x] += par[y];
        par[y] = x;
        weight[y] = w;
        return;
    }
    bool same(int x, int y) { return root(x) == root(y); }
    int root(int x) {
        if(par[x] < 0) return x;
        int r = root(par[x]);
        weight[x] += get_weight(par[x]);
        return par[x] = r;
    }
    int sizeOf(int x) { return -par[root(x)]; }
    int get_weight(int x) { root(x); return weight[x]; }
    int diff(int x, int y) { return get_weight(y) - get_weight(x); }
};

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int N,M;cin>>N>>M;
    UnionFind uf(N);
    int L,R,D,A;
    for(int i=0;i<M;++i){
        cin>>A>>L>>R;
        if(A==0){
            cin>>D;
            uf.unite(L,R,D);
        } else {
            if(uf.same(L,R)){
                cout << uf.diff(L,R) << '\n';
            } else {
                cout << '?' << '\n';
            }
        }
    }
    return 0;
}


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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)

const string YES = "YES";
const string NO = "NO";

void func(std::string S){
    vector<string> ans;
    ans.push_back("dream");
    ans.push_back("dreamer");
    ans.push_back("erase");
    ans.push_back("eraser");
    REP(i,0,4)reverse(ans[i].begin(),ans[i].end());

    reverse(S.begin(),S.end());

    lli cnt=0;
    lli now=0;
    while(now<S.size()){
        bool ok = false;
        REP(i,0,4){
            if(S.substr(now,ans[i].size())==ans[i]){
                now += ans[i].size();
                ok=true;
            }
        }
        if(!ok)break;
    }
    if(now!=S.size()){
        cout<<NO<<endl;
    }
    else{
        cout<<YES<<endl;
    }
}

int main(){
    // cout << fixed << setprecision(5);

    std::string S;
    std::cin >> S;
    func(S);
    return 0;
}


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

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecbool vector<bool>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)


int main()
{
  ll a, b, c, m=LLONG_MAX;
  cin >> a >> b >> c;
  if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0)
	cout << 0 << endl;
  else{
	m = min(m, a * b);
	m = min(m, b * c);
	m = min(m, c * a);
	cout << m << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main()
{
	int M, D;
	cin >> M >> D;

	int d1, d10;
	int cnt = 0;
	FOR(mIdx, 1, M+1) {
		FOR(dIdx, 1, D+1) {
			d10 = dIdx / 10;
			d1 = dIdx - d10*10;
			if (d1 >= 2 && d10 >= 2 && mIdx == d10 * d1) {
				++cnt;
			}
		}
	}

	cout << cnt << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <queue>
#include <math.h>
#include <bitset>
#define INF 100000000000
#define N 1000000007
#define ll long long
using namespace std;

int main(){
    ll n; cin>>n;
    bool data[n];
    for(ll i=0; i<n; i++){
        int a,b;
        cin>>a>>b;
        if(a==b) data[i]=true;
        else data[i]=false;
    }
    
    bool ans=false;
    for(ll i=0; i<n-2; i++){
        bool point=true;
        for(int j=0; j<=2; j++){
            if(data[i+j]==false) point=false;
        }
        if(point) ans=true;
    }
    
    if(ans) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 3632
<?php

while ($stdin = fgets(STDIN)) {
    $line[] = trim($stdin);
}
foreach ($line as $key => $value) {
    $data[] = explode(' ', $value);
}

foreach ($data as &$line) {
    $line = array_map(function($val) { return (int)$val; }, $line);
}


$s = $data[0][0];
$mod = $s % 10;
if ($mod === 3) {
    $ans = 'bon';
} else  if ($mod === 0 || $mod === 1 || $mod === 6 || $mod === 8) {
    $ans = 'pon';
} else {
    $ans = 'hon';
}


printf('%s', $ans);


Measured memory_bytes: 16144
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

string check(string &str) {
    int upper = 0;
    int lower = 0;
    upper += (str[0]-'0')*10;
    upper += (str[1]-'0');

    lower += (str[2]-'0')*10;
    lower += (str[3]-'0');

    if((upper == 0 || upper > 12) && (lower > 0 && lower < 13)) {
        return "YYMM";
    } else if( (upper > 0 && upper < 13) && (lower == 0 || lower > 12)) {
        return "MMYY";
    } else if((upper == 0 || upper > 12) && (lower == 0 || lower > 12)) {
        return "NA";
    } else {
        return "AMBIGUOUS";
    }
}


int main(void) {
    string str;

    cin>>str;
    cout<<check(str)<<endl;

    return 0;
}




Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <list>
#include <set>
using namespace std;
typedef long long ll;


int main(int argc, char *args[]) {
	int n, k;
	cin >> n >> k;
	int num = 1;
	for (int i = 0; i < n; i++) {
		if (num > k) {
			num += k;
		}
		else {
			num *= 2;
		}
	}
	cout << num << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using pi = pair<int,int>;
using mp = map<int,int>;
using ump = unordered_map<int,int>;
#define MOD 1000000007

#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;

typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update > ordered_set;

#define dbg(args...) do {cerr<<#args<<" : "; faltu(args); } while(0)
void faltu ()  {        cerr << endl;}
template < typename T, typename ... hello>void faltu( T arg, const hello &... rest) {cerr<<arg<< ' ';faltu(rest...);}

#define fastio  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int main(){
    fastio;
    ll a, b, c, d, sum=0;
    cin>>a>>b>>c>>d;
    if(a>d)
    {
            sum+=(d)*1;
        cout<<sum<<endl;
        return 0;
    }
    else if(a==d){
        cout<<a*1<<endl;
        return 0;
    }
    if(a<d&&b>=(d-a)){
        cout<<a*1<<endl;
        return 0;
    }
    if(a<d&&b<(d-a)&&c>=(d-a-b)){
        cout<<a*1-1*(d-a-b)<<endl;
        return 0;
    }

return 0;
}


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

int main() {
    for (;;) {
        string g;
        cin >> g;
        if ("#" == g) {
            break;
        }
        int y, m, d;
        cin >> y >> m >> d;
        if (y > 31 || y == 31 && m >= 5) {
            cout << "? " << y - 30 << " " << m << " " << d << endl;
        }
        else {
            cout << g << " " << y << " " << m << " " << d << endl;
        }
    }
    return 0;
}


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

using ll = long long;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int a[3][3];
	for (int i=0; i<3; i++) {
		for (int j=0; j<3; j++) {
			cin >> a[i][j];
		}
	}
	int n;
	cin >> n;
	for (int q=1; q<=n; q++) {
		int x; cin >> x;
		for (int i=0; i<3; i++) {
			for (int j=0; j<3; j++) {
				if (a[i][j] == x) a[i][j] = 0;
			}
		}
	}
	int ans = 0;
	for (int i=0; i<3; i++) {
		int res = 0;
		for (int j=0; j<3; j++) {
			res += (a[i][j]==0);
		}
		ans = max(ans, res);
	}
	for (int j=0; j<3; j++) {
		int res = 0;
		for (int i=0; i<3; i++) {
			res += (a[i][j]==0);
		}
		ans = max(ans, res);
	}
	int res1 = 0, res2 = 0;
	for (int i=0; i<3; i++) {
		if (!a[i][i]) res1 ++;
		if (!a[i][2-i]) res2 ++;
	}
	ans = max(ans, max(res1, res2));
	if (ans == 3) {
		cout << "Yes";
	} else {
		cout << "No";
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

const ll INF = 1001001001;

ll d[55][55];
string s[55];
ll dx[4] = { 0, 0, -1, 1 }, dy[4] = { -1, 1, 0, 0 };

int main() {
    ll h, w;
    cin >> h >> w;
    ll white = 0;
    for (ll i = 0; i < h; i++) {
        cin >> s[i];
        for (ll j = 0; j < w; j++) {
            if (s[i][j] == '.') white++;
        }
    }
    for (ll i = 0; i < 55; i++) {
        for (ll j = 0; j < 55; j++) {
            d[i][j] = INF;
        }
    }
    queue<P> que;
    que.push(P(0, 0));
    d[0][0] = 1;
    while (que.size()) {
        P p = que.front(); que.pop();
        ll cy = p.first, cx = p.second;
        for (ll i = 0; i < 4; i++) {
            ll ny = cy + dy[i], nx = cx + dx[i];
            if (0 <= ny && ny < h && 0 <= nx && nx < w && d[ny][nx] == INF && s[ny][nx] == '.') {
                d[ny][nx] = d[cy][cx] + 1;
                que.push(P(ny, nx));
            }
        }
    }
    if (d[h - 1][w - 1] == INF) cout << -1 << endl;
    else cout << white - d[h - 1][w - 1] << endl;
}

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

namespace AtCoder
{
	public class Program
	{
		public static void Main(string[] args)
		{
			var str = Console.ReadLine().Split(' ');
			var カードの数 = int.Parse(str[0]); // 2 ~ 2×10^5
			var カードの数字の情報 = Console.ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray(); // -10^9 ~ 10^9

			var 全てのカードの合計値 = カードの数字の情報.Sum();

			var すぬけくんが持てる可能なカードの合計値 = new long[カードの数];

			var 最小の答え = long.MaxValue;

			for (var すぬけくんのカードの枚数 = 1; すぬけくんのカードの枚数 < カードの数; すぬけくんのカードの枚数++)
			{
				すぬけくんが持てる可能なカードの合計値[すぬけくんのカードの枚数] = すぬけくんが持てる可能なカードの合計値[すぬけくんのカードの枚数 - 1] + カードの数字の情報[すぬけくんのカードの枚数 - 1];
				var すぬけくんのカードの合計値からアライグマのカードの合計値を引いた値の絶対値 = Math.Abs(すぬけくんが持てる可能なカードの合計値[すぬけくんのカードの枚数] * 2 - 全てのカードの合計値);
				if (すぬけくんのカードの合計値からアライグマのカードの合計値を引いた値の絶対値 < 最小の答え)
				{
					最小の答え = すぬけくんのカードの合計値からアライグマのカードの合計値を引いた値の絶対値;
				}
			}

			Console.WriteLine(最小の答え);
		}
	}
}

Measured memory_bytes: 38084
#include<iostream>
#include<cstdio>
#include<queue>
using namespace std;

const int maxn = 1000 + 5;
char mem[maxn][maxn];
int h, w;
int n = 0;
int dx[] = {0, -1, 0, 1};
int dy[] = {-1, 0, 1, 0};

struct P
{
	int x;
	int y;
};

queue<P> que;

int solve()
{
	int cnt=0,num=n, times=0, total=n; 
	while(total != h*w)
	{
		times = 0;
		while(num--)
		{
			P rem = que.front(); que.pop();
			//printf("(%d, %d)\n", rem.x, rem.y);
			for(int j = 0; j < 4; j++)
			{
				int nx = rem.x + dx[j];
				int ny = rem.y + dy[j];
				if(mem[nx][ny] != '.' || nx < 0 || nx >= h || ny < 0 || ny >= w) continue;

				mem[nx][ny] = '#';
				P nrem; nrem.x = nx; nrem.y = ny;
				que.push(nrem);
				times++; //新获得的次数
				//cout << mem[nx][ny] << " " << nx << "," << ny << endl; //
			}
		}
		num = times; 
		total += times;
		cnt++;
		//cout << cnt << endl; //
		//printf("num: %d\n", num);
		//printf("times: %d\n", times);
		//printf("total: %d\n", total);
	}
	return cnt;
}

void Print()
{
	cout << "show:" << endl;
	for(int i = 0; i < h; i++)
		for(int j = 0; j < w; j++)
		{
			if(j < w-1) printf("%c", mem[i][j]);
			else printf("%c\n", mem[i][j]);
		}
}

int main()
{
	scanf("%d %d", &h, &w); getchar();
	for(int i = 0; i < h; i++)
		for(int j = 0; j < w; j++)
		{
			scanf("%c", &mem[i][j]);
			if(j == w-1) getchar(); 
			if(mem[i][j] == '#') 
			{
				P temp; temp.x = i; temp.y = j;
				que.push(temp);
				n++;
			}
		}

	//Print();

	printf("%d\n", 	solve());
}

Measured memory_bytes: 9360
def main():
    N, K = map(int, input().split())

    ans = 0

    for i in range(1, N+1):
        tmp = 0
        while i * pow(2, tmp) < K:
            tmp += 1
        ans += 1/N * pow(0.5, tmp)

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
def main():
    #import numpy as np
    import sys, math
    from itertools import permutations, combinations
    from collections import defaultdict, Counter, deque
    from math import factorial#, gcd
    from bisect import bisect_left #bisect_left(list, value)
    sys.setrecursionlimit(10**7)
    enu = enumerate
    MOD = 10**9+7
    def input(): return sys.stdin.readline()[:-1]
    pl = lambda x: print(*x, sep='\n')

    H, W, K = map(int, input().split())
    S = [list(map(int, list(input()))) for _ in range(H)]

    from copy import deepcopy
    cS = [[0]*(W+1) for _ in range(H+1)]
    # cS = deepcopy(S)

    for h in range(1, H+1):
        for w in range(W):
            cS[h][w+1] = cS[h][w] + S[h-1][w]
    for w in range(1, W+1):
        for h in range(H):
            cS[h+1][w] = cS[h][w] + cS[h+1][w]
    # pl(cS)

    mcut = 10**9
    for i in range(2**(H-1)):
        yoko = []
        for j in range(H):
            if ((i >> j) & 1):
                yoko.append(j+1)
        yoko = [0] + yoko + [H]
        # yoko.append(H)
        # print(yoko)
        
        cut = len(yoko)-2
        lastcut = 0 # index-w
        w = 1
        cannot = False
        while w < W+1:
            if cannot:
                w = W + 100
                break
            for ind, y in enu(yoko):
                if ind == 0:
                    continue
                v1 = cS[y][w]
                v2 = cS[yoko[ind-1]][w]
                v3 = cS[yoko[ind-1]][lastcut]
                v4 = cS[y][lastcut]
                val = v1 - v2 + v3 - v4
                # print('  v1, v2', v1, v2)
                if K < val:
                    cut += 1
                    if lastcut == w-1:
                        cannot = True
                    lastcut = w-1
                    break
            else:
                w += 1
            # print(' val', val)
        if not(cannot) and cut < mcut:
            # print('yoko', yoko)
            mcut = cut

    print(mcut)
if __name__ == '__main__':
    main()

Measured memory_bytes: 75660
#include<stdio.h>

int main(){
int count[30]={0};
int i;
char s[101];
scanf("%s",s);
for(i=0;s[i]!=0;i++){
count[s[i]-'a']++;
}
for(i=0;i<30;i++){
if(count[i]%2==1){
puts("No");
return 0;
}
}
puts("Yes");
return 0;
}

Measured memory_bytes: 128
s = input()
ans = 0
for i in range(len(s)+1):
  for j in range(i+1,len(s)+1):
    if s[i:j].count("A")+s[i:j].count("T")+s[i:j].count("C")+s[i:j].count("G") == len(s[i:j]):
      ans = max(ans,len(s[i:j]))
print(ans)


Measured memory_bytes: 3060
#include<cstdio>
#include<algorithm>
#define LL long long
#define N 5010
using namespace std;
int n,k,a[N],f[N];
LL S;
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
		a[i]=min(a[i],k);
		S+=a[i];
	}
	sort(a,a+n+1); f[0]=1;
	for(int i=n;i>=0;i--)
	{
		for(int j=k-1;j>=0&&j>=k-S;j--)
			if(f[j]) goto ok;
		printf("%d",i);
		return 0;
		ok:;
		for(int j=k;j>=a[i];j--)
		{
			f[j]|=f[j-a[i]];
		}
		S-=a[i];
	}	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(src,dst)    for(int i=src; i<dst;  i++)
#define rep2(src,dst)   for(int j=src; j<dst;  j++)
#define INF 1000000000000 //1e12
#define MOD 1000000007 //1e9+7
#define PI  acos(-1)
#define ll long long
template<typename T> inline void cMin(T* a, T* b)  {if(*a>*b) *a=*b;}
template<typename T> inline void chMax(T* a, T* b) {if(*a<*b) *a=*b;}
template<typename T> inline int  div(T a, T b)     {return ((a+b-1)/b);}
template<typename T> inline bool eoVerify(T a)     {return (!(a&1)? true : false );}

/***********************
* O(1)                 *
* O(logN)              *
* O(N)                 *
* O(NlogN)             *
* O(N^2)               *
* O(N^3)               *
* O(k^N)               *
* O(N!)                *
************************/

int main(){
    int n, x, t;
    cin >> n >> x >> t;
    int tmp = n%x;
    int ret = n/x * t;

    if(x>=n){
        cout << t << endl;
        return 0;
    }
    cout << (tmp>0? ret + t : ret);
    return 0;
}


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

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

signed main() {
  ll N, las=0;
  cin>>N;
  rep(i,0,N){
    ll h;
    cin>>h;
    if (h<las){
      cout<<"No"<<endl;
      return 0;
    } else if (h == las){
      las = h;
    } else if (h > las) {
      las = h-1;
    }
  }
  cout<<"Yes"<<endl;
  return 0;
}


Measured memory_bytes: 256
from collections import Counter
from math import factorial


def main():
    number = factorial(int(input()))
    mod = 10 ** 9 + 7
    prime_factors = []
    while not number % 2:
        prime_factors.append(2)
        number //= 2
    i = 3
    while i <= number:
        if not number % i:
            number //= i
            prime_factors.append(i)
        else:
            i += 2
    answer = 1
    for p in list(Counter(prime_factors).values()):
        answer = answer * (p + 1) % mod
    print(answer)


if __name__ == '__main__':
    main()



Measured memory_bytes: 3316
#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>

const int N = 1005;

using namespace std;

int n,t,ans,tmp,T;
int con[N][N];
int spe[N][N],dis[N*N];
int head[N*N],in[N*N];

struct edge{
	int to;
	int next;
}e[N*N*2];
queue<int> q;

void add(int x,int y){
	e[++t].to=y;
	e[t].next=head[x];
	head[x]=t;
	return;
}
void topsort(){
	for(int i=1;i<=T;i++)
		if(!in[i]) {
			tmp++;
		 	q.push(i);
			dis[i]=1;
		}
	while(!q.empty()){
		int j=q.front();
		q.pop();
		for(int i=head[j];i;i=e[i].next){
			int k=e[i].to;
			dis[k]=dis[j]+1;
			in[k]--;
			if(!in[k]) {
				tmp++;
				q.push(k);
			} 
		}
	}
	return;
}
int main ( void ) {
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		for(int j=1;j<n;j++){
			scanf("%d",&con[i][j]);
			if(!spe[i][j]&&!spe[j][i])
				spe[i][j]=spe[j][i]=++T;
		}
	for(int i=1;i<=n;i++)
		for(int j=2;j<n;j++) {
		 	add(spe[i][con[i][j-1]],spe[i][con[i][j]]);
		 	in[spe[i][con[i][j]]]++;
		}
	topsort();
	if(tmp<T) {
		printf("-1\n");
		return 0;
	}
	for(int i=1;i<=T;i++)
		ans=max(ans,dis[i]);
	printf("%d\n",ans); 
	return 0;
}

Measured memory_bytes: 29696
#include <bits/stdc++.h>
#define pi acos(-1)

using namespace std;

int main() {
  double r,ans;
  while(scanf("%lf", &r) == 1) {
   ans = 2.0 * pi * r;
   printf("%lf\n", ans);
  }
  return 0;
}
  

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int N; cin >> N;
    string T; cin >> T;

    vector<int> C = {1};
    for (int i = 0; i < N; i++) {
        C.emplace_back(C.back() * 3);
    }
    vector<vector<int>> V(N);
    vector<int> L1(N), L2(N);

    for (int i = 0; i < N; i++) {
        V[i].resize(C[i+1]);
        for (int j = 0; j < C[i+1]; j++) {
            V[i][j] = j / C[i];
        }
        L1[i] = (C[i+1] - 1) / 2;
        L2[i] = C[i+1] - 1;
    }

    auto upd = [&](auto &L, int n) {
        for (int i = 0; i < N; i++) {
            int X = i == 0 ? 0 : L[i-1];
            for (int j = 0; j < 3; j++) {
                int Y = (X + j * C[i]) % C[i+1];
                if (V[i][Y] == n) {
                    L[i] = Y; break;
                }
            }
        }
    };
    bool sw = false;
    auto S = [&]() { sw = !sw; };
    auto R = [&]() {
        if (!sw) {
            for (int i = 0; i < N; i++) {
                for (int j = 0; j < 3; j++) {
                    int X = (L2[i] + j * C[i]) % C[i+1];
                    V[i][X] = (V[i][X] + 1) % 3;
                }
            }
        } else {
            for (int i = 0; i < N; i++) {
                for (int j = 0; j < 3; j++) {
                    int X = (L1[i] + j * C[i]) % C[i+1];
                    V[i][X] = (V[i][X] + 2) % 3;
                }
            }
        }
        upd(L1, 1), upd(L2, 2);
    };

    for (auto &c: T) {
        if (c == 'S') S();
        else R();
    }

    if (sw) {
        for (auto &v: V) {
            for (auto &x: v) {
                x = (3 - x) % 3;
            }
        }
    }

    for (int i = 0; i < C[N]; i++) {
        long long x = 0;
        for (int j = 0; j < N; j++) {
            x += C[j] * V[j][i%C[j+1]];
        }
        if (i) cout << " ";
        cout << x;
    }
    cout << "\n";

    return 0;
}

Measured memory_bytes: 7324
n = int(input())
h = list(map(int, input().split()))
if n == 1:
    print('Yes')
else:
    i = 0
    f = 0
    while i < n-1:
        if h[i]-h[i+1] > 1:
            print('No')
            i = n 
        elif h[i]-h[i+1] == 1:
            f += 1
            if f == 2:
                print('No')
                i = n
            else:
                i += 1
        elif h[i] == h[i+1]:
            i += 1
        else:
            f = 0
            i += 1
    if i == n-1:
        print('Yes')

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

int main()
{
   int h, w, k;
   cin >> h >> w >> k;
   vector<string> c(h);
   rep(i,h) cin >> c[i];
   int ans = 0;
   rep(is, 1<<h)rep(js, 1<<w){
      int cnt = 0;
      rep(i,h)rep(j,w){
         if(is>>i&1) continue;
         if(js>>j&1) continue;
         if(c[i][j] == '#') cnt++;
      }
      if(cnt == k) ans++;
   }
   cout << ans << endl;
   return 0; 
}

Measured memory_bytes: 3600
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int D = sc.nextInt();

        while (true) {
            
            C = C - B;
            if (C <= 0) {
            	System.out.println("Yes");
            	return;
            }
          
            A = A - D;
            if (A <= 0) {
                System.out.println("No");
                return;
            }
        }

    }
}


Measured memory_bytes: 35764
N = int(input())
L = list(map(int, input().split()))
d = [(L[i+1]-L[i]) for i in range(len(L)-1)]
b = False
c = 0
ans = 0
for i in d:
    if i==0:
        b = True
    else :
        b = False
    if b:
        c += 1
    else :
        ans += (-(-c//2))
        c = 0
if b:
    ans += (-(-c//2))
print(ans)

Measured memory_bytes: 3064
//標準関数をすべてインクルードする。
#include <bits/stdc++.h>
using namespace std;

int main(){
    //cin coutを高速化
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	std::cout.tie(0);

    int a, b, c;
    int sum = 0;

    cin >> a >> b;
    if (a > b){
        c = a;
        a = b;
        b = c;
    }
    for (int i = 0; i < b; i++){
        sum += a * pow(10, i);  
        //cout << sum << endl;  
    }

    cout << sum << endl;
    
}

Measured memory_bytes: 512
from itertools import combinations

lst = [int(input()) for _ in range(6)]
lst_ = lst[0:5]
k = lst[5]
# print(lst_, k)

comb = list(combinations(lst_, 2))
# print(comb)

ans = "Yay!"
for c in comb:
    tmp = abs(c[0] - c[1])
    # print(tmp, k)
    if tmp > k:
        ans = ":("

print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
#include<cmath>

using namespace std;

struct RootedTree {
	int id = -1;
	int parent = -1;
	int depth = 0;
	vector<int> node;
};

int main() {
	int N;
	cin >> N;
	vector<RootedTree> tree(N);
	for (int j = 0; j < N; ++j) {
		int p;
		int k;
		cin >> p >> k;
		tree[p].id = p;
		if (tree[p].parent != -1) {
			tree[p].depth = tree[tree[p].parent].depth + 1;
		}
		for (int i = 0; i < k; ++i) {
			int inputNode;
			cin >> inputNode;
			tree[p].node.push_back(inputNode);
			tree[inputNode].parent = p;
			tree[inputNode].depth = tree[p].depth + 1;
		}
	}


	for (int i = 0; i < N; ++i) {
		printf("node %d: parent = %d, depth = %d, ",tree[i].id, tree[i].parent, tree[i].depth);
		
		if (!(tree[i].node.size() == 0 || tree[i].parent == -1)) {
			printf("internal node, [%d", tree[i].node[0]);
			for (int j = 1; j < tree[i].node.size(); ++j) {
				printf(", %d", tree[i].node[j]);
			}
			printf("]\n");
		}
		else if(tree[i].parent == -1){
			if (tree[i].node.size() != 0) {
				printf("root, [%d", tree[i].node[0]);
				for (int j = 1; j < tree[i].node.size(); ++j) {
					printf(", %d", tree[i].node[j]);
				}
			}
			else {
				printf("root, [");
			}
			printf("]\n");
		}
		else {
			printf("leaf, []\n");
		}
	}

	return 0;
}


Measured memory_bytes: 7528
#include <algorithm>
#include <functional>
#include <iostream>
#include <vector>
using namespace std;

int main() {
	int N, ans = 1;
	cin >> N;
	vector<int> d(N);
	for (int& i : d) cin >> i;
	sort(d.begin(), d.end(), greater<int>());
	for (int i = 1; i < N; ++i) {
		if (d[i - 1] > d[i]) ++ans;
	}
	cout << ans;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

      if (a == 0 && b == 0) break;
    
      for (int i = 0; i < a; ++i) {
        if (i % 2 == 0) {
            for (int j = 0; j < b; ++j) {
              if (j % 2 == 0) System.out.print("#");
              else System.out.print(".");
            }
        }
        else {
          for (int j = 0; j < b; ++j) {
            if (j % 2 == 0) System.out.print(".");
            else System.out.print("#");
          }
      }
        System.out.println();
      }

      System.out.println();
    }
  }
}


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

int main(){
  int n;cin>>n;
  string s;cin>>s;
  int sum_max=0;
  for(int i=1;i<n-1;i++){
    string s1,s2;
    s1=s.substr(0,i);
    s2=s.substr(i,n-i);
    int c[100]={0};
    for(int j=0;j<i;j++){
      int a=-1;
      a=s2.find(s1.substr(j,1));
      if(a>=0)c[a]=1;
    }
    int sum=0;
    for(int k=0;k<100;k++){
      sum+=c[k];
    }
    sum_max=max(sum_max,sum);
  }
  cout<<sum_max<<endl;
}

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

int main() {
    using namespace std;
    unsigned long N;
    cin >> N;
    vector<unsigned long> a(N);
    for(auto& i : a)cin >> i;
    map<unsigned long, pair<unsigned long, pair<unsigned long, unsigned long>>> m;
    unsigned long cnt{0};
    for(const auto& i : a){
        auto it = m.lower_bound(i);
        if(it == m.end()){
            m.emplace(i, pair<unsigned long, pair<unsigned long, unsigned long>>{cnt, pair<unsigned long, unsigned long>{1, 0}});
        }else{
            ++it->second.second.first;
            it->second.second.second += it->first - i;
        }
        ++cnt;
    }
    vector<unsigned long> v(N), o(N), c(N);
    {
        vector<pair<unsigned long, pair<unsigned long, pair<unsigned long, unsigned long>>>> gue(m.rbegin(), m.rend());
        unsigned long M{gue.size()};
        gue.emplace_back();
        for(unsigned long i{0}; i < M; ++i){
            v[gue[i].second.first] = gue[i].second.second.first + (i ? v[gue[i - 1].second.first] : 0);
            c[gue[i].second.first] = gue[i].first - gue[i + 1].first;
            o[gue[i].second.first] = gue[i].second.second.second;
        }
    }
    vector<unsigned long> ans(N);
    for(unsigned long i{0}; i < N; ++i)ans[i] = v[i] * c[i] - o[i];
    copy(ans.begin(), ans.end(), ostream_iterator<unsigned long>(cout, "\n"));
    return 0;
}

Measured memory_bytes: 19456
def main():
    S = input()
    T = input()

    min_change = 1e5
    for i in range(len(S)-len(T)+1):
        tmp_change = 0
        for j in range(len(T)):
            if S[i+j] != T[j]:
                tmp_change += 1
        min_change = min(min_change, tmp_change)

    if len(S) == len(T):
        min_change = 0
        for i in range(len(T)):
            if S[i] != T[i]:
                min_change += 1

    print(min_change)


if __name__ == '__main__':
    main()


Measured memory_bytes: 73092
#include <bits/stdc++.h>
#define ll long long
#define all(a) (a).begin(), (a).end()
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz() size()
#define fr first
#define sc second
#define pb push_back
#define er erase
#define in insert
#define pi pair<int,int>
#define pii pair<pair<int,int>,int>
//#define mp make_pair
#define int long long
#define rc(s) return cout<<s,0
#define rcc(s) cout<<s,exit(0)
using namespace std;

const int mod=1e9+7;
const int modx=998244353;

int n,a,b;

int32_t main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    srand(chrono::steady_clock::now().time_since_epoch().count());
    cin >> n >> a >> b;
    int x = abs(a-b);
    if(x%2==0) cout << x/2;
    else{
        if(a>b) swap(a,b);
        int res1=(a-1);
        int res2=(n-b);
        cout << min(res1,res2)+x/2+1;
    }
}


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

int gcd(int a,int b){
  if(a % b == 0){
    return b;
  }else{
    return (gcd(b,a%b));
  }
}

signed main(){
  int n,ans=0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      for (int k = 1; k <= n; k++){
        ans += gcd(i,gcd(j,k));
      }
    }
  }
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 3588
#include<cstdio>

int main(){
    int n,i,a,b,min,max;
    long long sum;
    scanf("%d %d",&n,&a);
    min = a;
    max = a;
    sum = a;
    for(int i = 2;n >= i;i++){
        scanf("%d",&b);
        if(min >= b){
            min = b;
        }
        else{
            min = min;
        }
        if(max <= b){
            max = b;
        }
        else{
            max = max;
        }
        sum = sum + b;
        }
        printf("%d %d %lld\n",min,max,sum);
        return 0;
        
}


Measured memory_bytes: 2716
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int N, M, D;

	while (true)
	{
		scanf("%d", &N);
		scanf("%d", &M);

		if (N == 0 && M == 0) { break; }

		vector<int> C; C.push_back(0);

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

			if (D <= M)
			{
				C.push_back(D);
			}
		}

		vector<int> r;

		for (int i = 0; i < C.size(); i++)
		{
			for (int j = 0; j < C.size(); j++)
			{
				if (C[i] + C[j] <= M)
				{
					r.push_back(C[i] + C[j]);
				}
			}
		}

		sort(r.begin(), r.end());

		int ret = 0;

		for (int i = 0; i < r.size(); i++)
		{
			int ptr = upper_bound(r.begin(), r.end(), M - r[i]) - r.begin() - 1;
			
			if (ptr >= 0)
			{
				ret = max(ret, r[i] + r[ptr]);
			}
		}

		printf("%d\n", ret);
	}

	return 0;
}

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

using namespace std;

const long long MAX = 1000000000000001;

string n2char(long long n) { // n = 0, 1, ..., 25
    char c;
    for (long long i = 0; i < 26; ++i) {
        if (i == n) {
            c = 'a' + i;
        }
    }
    string ret = { c };
    return ret;
}

void Main() {
    long long N;
    cin >> N;

    string ret = "";
    for (long long i = 0; i < MAX; ++i) {
        if (i > 0 && N == 0) {
            break;
        }
        --N;
        long long residual = N % 26;
        ret += n2char(residual);
        //cout << i << " " << residual << " " << ret << endl;
        N /= 26;
    }
    reverse(ret.begin(), ret.end());
    cout << ret << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3564
#include<cstdio>
#include<cmath>
#include<queue>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const int MAXN=1e5,MAXM=2e5;
int head[MAXN+5],nxt[MAXM+5],Cnt;
bool vis[MAXN+5],v[MAXN+5];
int cnt[MAXN+5],out[MAXN+5],id[MAXN+5];
int n,m,root;
struct Edge
{
	int u,v;
	Edge(int _u=0,int _v=0){u=_u,v=_v;}
}E[MAXM+5];
struct node
{
	int id,num;
}f[MAXN+5];
bool cmp(node a,node b)
{
	return a.id>b.id;
}
void Addedge(int u,int v)
{
    E[++Cnt]=Edge(u,v);
    nxt[Cnt]=head[u];
    head[u]=Cnt;
}
void bfs(int root)
{
	int tot=0;
	queue<int> que;
	que.push(root);
	vis[root]=1;
	while(!que.empty())
	{
		int u=que.front();que.pop();
		f[++tot].id=tot,f[tot].num=u;
		id[u]=tot;
		for(int i=head[u];i;i=nxt[i])
			if(!vis[E[i].v])
			{
				vis[E[i].v]=1;
				que.push(E[i].v);
			}
	}
	//for(int i=1;i<=n;i++)
	//	printf("点%d:%d\n",i,id[i]);
	//printf("----------\n");
}
void Solve()
{
	sort(f+1,f+n+1,cmp);
	for(int i=1;i<=n;i++)
	{
		int u=f[i].num;
		//printf("u:%d\n",u);
		for(int j=head[u];j;j=nxt[j])
			if(id[E[j].v]<f[i].id)
			{
				if(out[u]%2)
				{
					out[u]++;
					printf("%d %d\n",u,E[j].v);					
				}
				else
				{
					out[E[j].v]++;
					printf("%d %d\n",E[j].v,u);
				}	
			}
	}
}
int main()
{
	//freopen("degree.in","r",stdin);
	//freopen("degree.out","w",stdout);
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		root=u;
		cnt[u]++,cnt[v]++;
		Addedge(u,v);
		Addedge(v,u); 
	}
	//printf("---------\n");
	if(m%2)
	{
		printf("-1\n");
		return 0;
	}
	bfs(root);
	Solve();
	return 0;
}
/*
5 6
1 2
1 3
2 3
2 5
3 4
4 5

4 6
1 2
2 3
3 4
1 4
1 3
2 4
*/

Measured memory_bytes: 6272
n=int(input())
s=[]
mi=10**10
for i in range(n):
    si=int(input())
    s.append(si)
    if si%10!=0:
        mi=min(mi,si)

if sum(s)%10!=0:
    print(sum(s))
else:
    print(max(0,sum(s)-mi))

Measured memory_bytes: 3060
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <iostream>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;

int main(void) {
  int n, i;
  cin >> n >> i;
  printf("%d\n", n-i+1);
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main {
	
	static boolean primeTable[] = new boolean[10001];
	
	public static void main(String args[]){
		Scanner in = new Scanner(System.in);
		makePrimeCheckTable(10000);
		while(in.hasNext()){
			int n = in.nextInt();
			int cnt=0;
			for(int i=1; i<=n; i++){
				if(isPrime(i) && isPrime(n-i+1))
					cnt++;
			}
			System.out.println(cnt);
		}
	}
	
	private static void makePrimeCheckTable(int n){
		for(int i=2; i<=n; i++) primeTable[i] = true;
		for(int i=2; i*i<=n; i++){
			if(primeTable[i]){
				for(int j=i*2; j<=n; j += i){
					primeTable[j] = false;
				}
			}
		}
	}
	
	private static boolean isPrime(int n){
		return primeTable[n];
	}
}

Measured memory_bytes: 12000
W, H, N = map(int, input().split())
ver_left = [0]
ver_right = [W]
hor_down = [0]
hor_up = [H]

for i in range(N):
    x, y, a = map(int, input().split())
    if a == 1:
        ver_left.append(x)
    elif a == 2:
        ver_right.append(x)
    elif a == 3:
        hor_down.append(y)
    elif a == 4:
        hor_up.append(y)

ver_left.sort()
ver_right.sort()
hor_down.sort()
hor_up.sort()

ans = max(0, ver_right[0]-ver_left[-1]) * max(0, hor_up[0]-hor_down[-1])

print(ans)

Measured memory_bytes: 3064