akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define pb push_back
#define mp make_pair
#define f(i,x,n) for(ll i=x;i<n;i++)
#define fl(i,x,n) for(ll i=n;i>=x;i--)
#define mod (ll)1e9+7
#define print(x) cout<<x<<endl
#define vec vector<ll>
#define pai pair<ll, ll>
#define itr(it) :: iterator it
#define MAX (ll)1e16
#define MIN (ll)-1e16
#define X first
#define Y second
#define up upper_bound
#define lo lower_bound
using namespace std;
       ///////////   ///     ///   ///      ///   ////////////  ///      ///
       ///           ///     ///   ///      ///   ///      ///  ///      ///
       ///           ///     ///   ///      ///   ///      ///  ///      ///
       ///////////   ///////////   ///      ///   ////////////  ////////////
               ///   ///     ///   ///      ///   ///      ///  ///      ///
               ///   ///     ///   ///      ///   ///      ///  ///      ///
       ///////////   ///     ///   ////////////   ////////////  ///      ///
ll minn( ll a , ll b) 
{
    if(a>b)
        return b;
    return a;
}
ll maxx2( ll a , ll b)
{
    if(a>b)
        return a;
    return b;
}
ll maxx(ll a,ll b,ll c)
{
  return maxx2(a,maxx2(b,c));
}
ll gcdd(ll a, ll b)
{
    if(b==0)
        return a;
    else
        return gcdd(b,a%b);
}
ll dsum(ll n)
{
    ll sum=0;
    while(n>0)
    {
        sum+=n%10;
        n/=10;
    }
    return sum;
}
ll poww(ll a,ll b)
{
    if(b<=0)
        return 1;
    if(b==1)
        return a;
    else
        return poww(a,b/2)*poww(a,b/2)*poww(a,b%2);
}
ll sumsq(ll x,ll y,ll z)
{
    return (x-y)*(x-y)+(y-z)*(y-z)+(z-x)*(z-x);
}
ll n,w,a[101],c[101],dp[100001][100]={0};
ll solve(ll i,ll j)
{
    if(i<0 || j<0)
        return 0;
    if(dp[i][j]!=-1)
        return dp[i][j];
    if((i-a[j])>=0)
    	dp[i][j]=maxx2(solve(i-a[j],j-1)+c[j],solve(i,j-1));
    else
    	dp[i][j]=solve(i,j-1);
    return dp[i][j];
}
signed main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    IOS;
    cin>>n>>w;
    f(i,0,n)
    {
        cin>>a[i]>>c[i];
    }
    f(i,0,w+1)
    {
        f(j,0,100)
        {
            dp[i][j]=-1;
        }
    }
    // f(i,0,w+1)
    // {
    // 	f(j,0,n)
    // 	{
    // 		cout<<dp[i][j]<<" "<<i<<" "<<j<<endl;
    // 	}
    // }
    ll ans=solve(w,n-1);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 78336
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
using int64 = long long;

vector< int64 > divisor(int64 n)
{
    vector< int64 > ret;
    for(int64 i = 1; i * i <= n; i++) {
        if(n % i == 0) {
            ret.push_back(i);
            if(i * i != n) ret.push_back(n / i);
        }
    }
    sort(begin(ret), end(ret));
    return(ret);
}
int main(){
    int r,g,b,n;
    cin >> r >> g >> b >> n;
    ll ans = 0;
    rep(i,3001){
        rep(j,3001){
            int k = n - r * i  - j * g;
//            show(k);
            if(k>=0 and k%b==0)ans++;
        }
    }
    cout << ans << endl;
}
int main2(){
    int n;
    cin >> n;
    vector<string>s(n);
    rep(i,n)cin >> s[i];
    int ans = 0;
    rep(i,n){
        int k = (int) s[i].size();
        rep(j,k-1){
            if(s[i][j] == 'A' and s[i][j+1] == 'B')ans++;
        }
    }
    int a = 0, b = 0, c = 0, d = 0;
    rep(i,n){
        if(s[i][0] == 'A'){
            if(s[i].back() == 'A')a++;
            else b++;
        }else if(s[i][0] == 'B'){
            if(s[i].back() == 'A')c++;
            else d++;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define int             long long
#define ld              long double
#define fi              first
#define se              second
#define pb              push_back
#define mp              make_pair
#define mt              make_tuple
#define sq(a)           (a)*(a)
#define fo(i,n)         for(i=0;i<n;i++)
#define fo1(i,n)        for(i=1;i<=n;i++)
#define rep(i,a,b)      for(i=a;i<=b;i++)
#define Fo(i,k,n)       for(i=k;k<=n?i<=n:i>=n;k<=n?i++:i--)
#define all(x)          x.begin(),x.end()
#define rall(x)         x.rbegin(),x.rend()
#define sortall(x)      sort(all(x))
#define sortrall(x)     sort(rall(x))
#define clr(x)          memset(x,0,sizeof(x))
#define tr(it, a)       for(auto it=a.begin();it!=a.end();it++)
#define pii             pair<int,int>
#define mk(arr,n,type)  type *arr=new type[n];
#define vi              vector<int>
#define si              set<int>
#define usi             unordered_set<int>
#define mii             map<int,int>
#define umii            unordered_map<int,int>
#define pqmx            priority_queue<int>
#define pqmn            priority_queue<int,vi,greater<int>>
#define setbits(x)      __builtin_popcountll(x)
#define trailzrobits(x) __builtin_ctzll(x)
#define leadzrobits(x)  __builtin_clzll(x)
#define paritybits(x)   __builtin_parityll(x)
#define gcd             __gcd
#define lcm(x, y)       (x * y)/gcd(x,y)
#define mod             1000000007
#define endl            '\n'
#define PI              3.1415926535897932384626
#define inf             1e18
#define sp(x,y)         fixed<<setprecision(y)<<x
void __print(int32_t x) {cout<<x;}
void __print(int x) {cout<<x;}
void __print(ld x) {cout<<x;}
void __print(double x) {cout<<x;}
void __print(float x) {cout<<x;}
void __print(bool x) {cout<<(x?"true":"false");}
void __print(char x) {cout <<'\''<<x<<'\'';}
void __print(const char *x) {cout <<'\"' <<x<<'\"';}
void __print(const string &x) {cout<<'\"'<<x<<'\"';}
template<typename T,typename V>     void __print(const pair<T,V> &x) {cout<<'{';__print(x.first);cout<<',';__print(x.second);cout<<'}';}
template<typename T>                void __print(const T &x) {int f=0;cout<<'{';for(auto &i:x)cout<<(f++?",":""),__print(i);cout<<"}";}void _print(){cout<<"]\n";}
template <typename T,typename... V> void _print(T t, V... v) {__print(t);if(sizeof...(v))cout<<", ";_print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout<<"["<<#x<<"]=[";_print(x)
#else 
#define dbg(x...)
#endif
int power(int base,int exp) {int res=1;base%=mod;while(exp>0){if(exp&1)res=(res*base)%mod;base=(base*base)%mod;exp=exp>>1;}return res;}
int inv(int x) {return power(x,mod-2)%mod;}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++




const int N=1e4+50,M=N;
int i,j,k;

vi a(N);
void solve() {
    
    int n; cin>>n;
    
    fo1(i,105) fo1(j,105) fo1(k,105){
        int x=sq(i)+sq(j)+sq(k)+i*j+j*k+k*i;
        if(x<10050) a[x]++;
    } 
    
    fo1(i,n) cout<<a[i]<<endl;
    
}




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

Measured memory_bytes: 3604
costs = []
for i in range(5):
    costs.append(int(input()))
    
waits = []
for cost in costs:
    waits.append((10 - (cost % 10))%10)

time = 0
for i in range(5):
    time += (costs[i] + waits[i])

print(time - max(waits))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main () {
  int N;
  cin >> N;
  if (N < 105) cout << 0 << endl;
  else if (N < 135) cout << 1 << endl;
  else if (N < 165) cout << 2 << endl;
  else if (N < 189) cout << 3 << endl;
  else if (N < 195) cout << 4 << endl;
  else cout << 5 << endl;
}


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

int main() {
   int n;
   cin >> n;
   int A[n];
   for (int i=0; i<n; i++) {
       cin >> A[i];
   }
   int q;
   cin >> q;
   int m[q];
   for (int i=0; i<q; i++) {
       cin >> m[i];
   }
   for (int i=0; i<q; i++) {
       bool f=false;
       for (int tmp=0; tmp<(1<<20); tmp++) {
           bitset<20> s(tmp);
           int count=0;
           for (int j=0; j<n; j++) {
               if (s.test(j)) count+=A[j];
               if (count>2000) break;
           }
           if (m[i]==count) {
               cout << "yes" << endl;f=true;break;
           }
       }
       if (!f) cout << "no" << endl;
   }
}


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

int main () {
 int num;
 int s_size; 
 string s;
 
 cin >> num;
 cin >> s;
 s_size = s.length();
  
 if (num >= s_size) {
  cout << s << endl; 
 } else { 
  for (int i = 0; i < num; i++) {
   cout << s[i];  
  }
  cout <<  "..." << endl;
 }
  
 return 0; 
}

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

using namespace std;
using ll = long long;

constexpr int MAX_N = 105;
constexpr int MAX_VAL = 100100;

int n, max_weight;
int weight[MAX_N], val[MAX_N];

ll dp[MAX_N][MAX_VAL];

int main() {
    scanf(" %d %d", &n, &max_weight);
    for (int i = 1; i <= n; ++i) {
        scanf(" %d %d", &weight[i], &val[i]);
    }

    memset(dp, -1, sizeof(dp));

    dp[0][0] = 0LL;
    for (int i = 1; i <= n; ++i) {
        for (int j = 0; j < MAX_VAL; ++j) {
            dp[i][j] = dp[i - 1][j];
            if (j - val[i] >= 0 && dp[i - 1][j - val[i]] != -1) {
                ll cur = dp[i - 1][j - val[i]] + weight[i];
                if (dp[i][j] == -1 || cur < dp[i][j]) {
                    dp[i][j] = cur;
                }
            }
        }
    }

    int ans = 0;
    for (int j = 0; j < MAX_VAL; ++j) {
        if (dp[n][j] != -1 && dp[n][j] <= max_weight) {
            ans = j;
        }
    }

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

    return 0;
}


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

public class Hello
{
    private const int MOD_N = 1000000000 + 7;

    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var list = Console.ReadLine().Split(' ');
        var ass = new int[n];
        for (int i = 0; i < ass.Length; ++i)
        {
            ass[i] = int.Parse(list[i]);
        }

        var link = new List<int>[n];
        for (int i = 0; i < link.Length; ++i)
            link[i] = new List<int>();
        for (int i = 0; i < link.Length; ++i)
        {
            var a = i + 1;
            for (int b = a * 2; b <= n; b += a)
                link[b - 1].Add(i);
        }

        var state = new int[n];
        var answer = new List<int>();

        for (int i = ass.Length - 1; i >= 0; --i)
        {
            if (ass[i] != state[i])
            {
                answer.Add(i + 1);
                var l = link[i];
                for (int j = 0, c = l.Count; j < c; ++j)
                {
                    state[l[j]] ^= 1;
                }
            }
        }

        Console.WriteLine(answer.Count);
        if (answer.Count > 0)
        {
            Console.WriteLine(string.Join(" ", answer));
        }
    }

    private static int GCD(int a, int b) => a > b ? GCD_impl(a, b) : GCD_impl(b, a);
    private static int GCD_impl(int a, int b) => b == 0 ? a : GCD_impl(b, a % b);
    private static long LCM(int a, int b) => (long)a * b / GCD(a, b);

    private static int Comb(int m, int n)
    {
        var t = m - n;
        if (n > t)
            n = t;

        long numerator = 1;
        for (int i = 0; i < n; ++i)
        {
            numerator *= m - i;
            numerator %= MOD_N;
        }
        long denominator = 1;
        for (; n != 0; --n)
        {
            denominator *= n;
            denominator %= MOD_N;
        }

        var inv_denominator = ModInv((int)denominator, MOD_N);
        var ret = (int)(numerator * inv_denominator % MOD_N);

        return ret >= 0 ? ret : ret + MOD_N;
    }

    private static int ModInv(int a, int m)
    {
        int b = m, x = 1, y = 0;
        while (b != 0)
        {
            var t = a / b;
            a -= t * b;
            Swap(ref a, ref b);
            x -= t * y;
            Swap(ref x, ref y);
        }
        x %= m;
        return x >= 0 ? x : x + m;
    }

    private static void Swap<T>(ref T a, ref T b)
    {
        var t = a;
        a = b;
        b = t;
    }
}


Measured memory_bytes: 69276
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef pair<int,int> P;
typedef long long ll;


int main(void){
    ll n;
    cin>>n;
    vector<ll>a(n);
    for(ll i=0;i<n;i++)cin>>a[i];
    reverse(a.begin(),a.end());
    for(ll i=0;i<n-1;i++){
        if(a[i]<a[i+1]){
            a[i+1]--;
            if(a[i]<a[i+1]){
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 1024
#!/usr/bin/env python3
import sys


def solve(N: int, S: str):
    for i in range(len(S)):
        print( chr( (ord(S[i]) + N - ord('A')) % 26 + ord('A') ), end="")
    print()
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 4468
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>

using namespace std;

typedef  long long int lint;

#define rep(i, n) for (lint i = 0; i < n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define mp make_pair
#define IP pair<int,int>
#define enld endl

int main() {
	lint N, M, X;
	cin >> N >> M >> X;
	vector<lint>C(N);
	vector<vector<lint>>A(N, vector<lint>(M));
	rep(i, N) {
		cin >> C[i];
		rep(j, M) {
			cin >> A[i][j];
		}
	}

	lint ans = 100000000;

	for (int S = 0; S < 1 << N; S++) {
		//作成
		vector<int>V;
		rep(i, N) {
			if ((S >> i) & 1) {
				V.push_back(i);
			}
		}
/*
		//操作
		rep(i, V.size()) {
			cout << V[i] << ' ';
		}
		cout << endl;
		*/

		lint cnt = 0;
		vector<lint>R(M);//理解度
		rep(i, V.size()) {
			rep(j, M) {
				R[j] += A[V[i]][j];
			}
		}
		bool ok = true;
		rep(i, R.size()) {
			if (R[i] < X) {
				ok = false;
			}
		}
		if (ok) {
			rep(i, V.size()) {
				cnt += C[V[i]];
			}
			ans = min(ans, cnt);
		}
		/*rep(i, V.size()) {
			cout << V[i] << ' ';
		}
		cout << endl;
		rep(i, R.size()) {
			cout << R[i] << ' ';
		}
		cout << endl;
		cout << cnt << enld;
		cout << endl;*/
	}
	if (ans == 100000000) {
		cout << -1 << endl;
	}
	else {
		cout << ans << endl;
	}
	
}

Measured memory_bytes: 3636
import java.util.*

fun main(args: Array<String>) {
    val (H, N) = readIntList()
    val A = readIntList()
    println(if (A.sum() >= H) "Yes" else "No")
}

fun readString() = readLine()!!
fun readStringList() = readLine()!!.split(" ")
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)

Measured memory_bytes: 47996
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define ep emplace_back
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(v) v.begin(), v.end()
#define revall(v) v.rbegin(), v.rend()
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){ if(y<h && y>=0 && x<w && x>=0) return true; return false; }
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; }





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	int x = 0, y = 0, t = 0;
	bool ok = true;
	rep(i,n){
		int T,X,Y;cin >> T >> X >> Y;
		int k = abs(x - X) + abs(y - Y);
		if(k > T - t || k % 2 != (T - t) % 2) ok = false;
		x = X;
		y = Y;
		t = T;
	}
	if(ok) cout << "Yes" << endl;
	else cout << "No" << endl;
}


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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};


void solve(long long n, long long m, long long d){
    double all = n * n;
    double cnt = n;
    if(d != 0) {
        cnt = (n - d) * 2;
    }

    printf("%.9f\n", cnt * (m - 1) / all);
}

int main(){
    long long n;
    scanf("%lld",&n);
    long long m;
    scanf("%lld",&m);
    long long d;
    scanf("%lld",&d);
    solve(n, m, d);
    return 0;
}


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

using namespace std;

int match(string s,int r,int w){
    int i=1,count=0;
    for(char c : s){
        if(i<=r)
        {
            if(c!='R')count++;
        }
        else
        {
            if(c!='W')count++;
        }
        i++;
    }
    return count/2;
}
int main()
{
    int n,r=0,w=0;
    string s;
    cin>>n>>s;
    for(char c : s)
    {
        if(c=='W')w++;
        else r++;
    }
    cout<<match(s,r,w);
}


Measured memory_bytes: 3848
#include<stdio.h>
#include<math.h>
int main(){
  int a,b,c,n,i,x,y,z;
  scanf("%d",&n);
  for(i=0 ; i<n ; i++){
    scanf("%d %d %d",&a,&b,&c);
    x=pow(a,2);
    y=pow(b,2);
    z=pow(c,2);

    if(x+y==z){
      printf("YES\n");
    }
    else if(y+z==x){
      printf("YES\n");
    }
    else if(x+z==y){
      printf("YES\n");
    }
    else{
      printf("NO\n");
    }
  }

  return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

ll w[300010],e[300010];
int main() {
	ll n;
	cin>>n;
	for(ll i=0;i<n;i++){
		char now;
		cin>>now;
		if(now=='W'){
			w[i]++;
		}
		else{
			e[i]++;
		}
	}
	for(ll i=1;i<n;i++){
		w[i]=w[i]+w[i-1];
	}
	for(ll i=n-2;i>=0;i--){
		e[i]=e[i]+e[i+1];
	}
	ll ans=inf;
	for(ll i=0;i<n;i++){
		ll now=w[i]+e[i]-1;
		ans=min(now,ans);
	}
	cout <<ans;
	// your code goes here
	return 0;
}

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

string to_string(string s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef LOCAL
#define db(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define db(...) 42
#endif

using ll = long long;

int main() {
  int r, c;
  cin >> r >> c;
  for (int i = 0; i < r; i++) {
    string s;
    cin >> s;
    cout << s << '\n' << s << '\n';
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
ll dp[100100];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,k;
    cin>>n>>k;
    ll a[n+1];
    ll num;
    for(ll i=1;i<=n;i++)
    {
        cin>>num;
        a[i]=num;
    }
    sort(a+1,a+n+1);
    for(ll i=0;i<a[1];i++)
    {
        dp[i]=1;
    }
    for(ll i=a[1];i<=k;i++)
    {
        ll flag=0;
        for(ll j=1;j<=n;j++)
        {
            if(i-a[j]>=0)
            {
                if(dp[i-a[j]]==1)
                {
                    flag=1;
                }
            }
        }
        if(flag==1)
        {
            dp[i]=0;
        }
        else
        {
            dp[i]=1;
        }
    }
    if(dp[k]==0)
    {
        cout<<"First";
    }
    else
    {
        cout<<"Second";
    }
}

Measured memory_bytes: 1024
#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>;
using v  = vector<int>;
using vv = vector<v>;
const int MOD = 1000000007;

v dp(10001, 1001001001);

//個数制限なしナップサック問題
int main(){
    int h,n;
    cin >>h>>n;
    
    v a(n), b(n);
    rep(i,n)cin >> a[i] >> b[i];
    
    dp[0]=0;
    for(int i=0; i<n; i++){
        for(int x=0; x<h+a[i]; x++){
            int nx = min(h,x);
            if(x-a[i]>=0)
                dp[nx] = min(dp[nx], dp[x-a[i]]+b[i]);
        }
    }
    
    cout << dp[h] << endl;
    
    return 0;
}

Measured memory_bytes: 256
import sys
import math
import copy
from heapq import heappush, heappop, heapify
from functools import cmp_to_key
from bisect import bisect_left, bisect_right
from collections import defaultdict, deque, Counter
# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = float("inf")
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)


def solve():
    n = getN()
    g = [[] for i in range(n)]
    ans = [-1 for i in range(n)]
    ji = [0 for i in range(n)]

    for i in range(n-1):
        a, b = getZList()
        g[a].append(b)
        g[b].append(a)
        ji[a] += 1
        ji[b] += 1

    cn = getList()
    cn.sort()
    h = []
    for i, j in enumerate(ji):
        heappush(h, (j, i))

    anss = 0

    for cnn in cn:
        while True:
            cj, ci = heappop(h)
            if ans[ci] == -1:
                ans[ci] = cnn
                anss += cnn * cj
                for gg in g[ci]:
                    ji[gg] -= 1
                    heappush(h, (ji[gg], gg))
                break

    print(anss)
    print(*ans)
def main():
    n = getN()
    for _ in range(n):
        solve()

    return
if __name__ == "__main__":
    # main()
    solve()

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

int main(){
    int n;
    cin>>n;
    double ans=n/3.00*n/3.00*n/3.00;
    cout<<fixed<<setprecision(12);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3780
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int H, W; cin >> H >> W;
    vector<string> S(H); cin >> S;
    mat C1(H, vec(W, 0)), C2(H, vec(W, 0));
    REP(i, H){
        int j0 = 0, j1 = 0;
        while(j0 < W){
            if(j1 < W && S[i][j1] == '.') j1++;
            else{
                int num = j1 - j0;
                FOR(j, j0, j1) C1[i][j] = num;

                j0 = j1;
                while(j0 < W && S[i][j0] == '#') j0++;
                j1 = j0;
            }
        }
    }
    REP(j, W){
        int i0 = 0, i1 = 0;
        while(i0 < H){
            if(i1 < H && S[i1][j] == '.') i1++;
            else{
                int num = i1 - i0;
                FOR(i, i0, i1) C2[i][j] = num;

                i0 = i1;
                while(i0 < H && S[i0][j] == '#') i0++;
                i1 = i0;
            }
        }
    }
    int ans = 0;
    //mdebug(C1);
    //debug(C2);
    REP(i, H) REP(j, W) Max(ans, C1[i][j] + C2[i][j] - 1);
    Out(ans);

    return 0;
}


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

int main(){
    long long N;
    cin>>N;
    N++;

    string S=to_string(N);

    char t=S[0];
    long ans=9*(S.size()-1)+(S[0]-'0')-1;


    cout<<ans<<endl;
}

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

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define f(i,a,b) for(int i=a;i<b;i++)
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
int ketasuu(int x){
  int n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}


ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

int main(){
  int n,m;
  cin >>n>>m;
  if(n==m) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}




Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

/**
 * N 枚のカードがあり、i 枚目のカードには ai という数が書かれています。 Alice と Bob はこれらのカードを使ってゲームを行います。ゲームでは
 * 2 人が交互に 1 枚ずつカードを取っていきます。Alice が先にカードを取ります。 2
 * 人がすべてのカードを取ったときゲームは終了し、取ったカードの数の合計がその人の得点になります。2
 * 人とも自分の得点を最大化するように最適戦略をとったとき、Alice は Bob より何点多くの得点を獲得できるかを求めてください。
 *
 * @author tsuch
 *
 */
public class Main {

	private static Scanner sc = new Scanner(System.in);

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

	private void solve() {
		try {
			int n = sc.nextInt();
			int a[] = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = sc.nextInt();
			}
			Arrays.sort(a);

			int b = 0;
			int c = 0;

			for (int i = n - 1; i >= 0; i--) {
				if (i % 2 == 0) {
					b = b + a[i];
				} else {
					c = c + a[i];
				}
			}
			System.out.println(Math.abs(b - c));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 21972
target = input('')
list_score = list(map(int, input().split()))
a = []
for i in range(len(list_score)):
    if list_score[i] % 2 == 0:
        a.append(list_score[i]/2)

ans = "APPROVED"

for i in range(len(a)):
    if a[i] % 3 != 0:
        if a[i] % 5!= 0:
            ans = "DENIED"

print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
const int N = 1e3 +5;
int n,m,vis[N],ans;
int main() {
	ios::sync_with_stdio(0);
	cin >> n >> m;
	for(int i = 1,d,x;i <= m;++i) {
		cin >> d;
		while(d--) cin >> x,vis[x] = 1;
	}
	for(int i = 1;i <= n;++i)
		if(!vis[i]) ++ans;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int A,B,T;
    cin>>A>>B>>T;
    cout <<T/A*B<<"\n";
}

Measured memory_bytes: 256
N,M=map(int,input().split())
A = list(map(int,input().split()))

c = [2,5,5,4,5,6,3,7,6]

dp = [[-1 for n in range(N+1)] for m in range(M+1)]
dp[0][0] = 0
#keta
dp_r = [[-1 for n in range(N+1)] for m in range(M+1)]
#m

d = {}
for a in A:
    d[a] = c[a-1]
#print(d)

inv_d = {}
for k,v in d.items():
    if v in inv_d:
        if k > inv_d[v]:
            inv_d[v] = k
    else:
        inv_d[v] = k
#print(inv_d)

s_A = sorted(inv_d.items(), key=lambda x:x[0])
A = [a[1] for a in s_A]
M = len(A)

for m in range(1,M+1):
    for n in range(N+1):
        #dp[m][n] = max(dp[m-1][n],
        #dp[m][n-c[A[m-1]-1]] + 1 if (n-c[A[m-1]-1])>=0 and dp[m][n-c[A[m-1]-1]] != -1 else -1)
        if n-c[A[m-1]-1] >= 0 and dp[m][n-c[A[m-1]-1]] != -1:
            if dp[m-1][n] < (dp[m][n-c[A[m-1]-1]] + 1):
                dp[m][n] = dp[m][n-c[A[m-1]-1]] + 1
                dp_r[m][n] = 1
            elif dp[m-1][n] == (dp[m][n-c[A[m-1]-1]] + 1):
                dp[m][n] = dp[m][n-c[A[m-1]-1]] + 1
                dp_r[m][n] = 2
            else:
                dp[m][n] = dp[m-1][n]
                dp_r[m][n] = 0
        else:
            dp[m][n] = dp[m-1][n]
            dp_r[m][n] = 0


#import pprint
#pprint.pprint(dp,width=100)
#pprint.pprint(dp_r,width=100)

def trace(dp,m,n):
    r=[[]]
    for _ in range(N+M+2):
        if m==0 and n==0:
            return r
        elif dp_r[m][n] == 0:
            m = m-1
        elif dp_r[m][n] == 1:
            r = [r_+[m] for r_ in r]
            n = n-c[A[m-1]-1]
        elif dp_r[m][n] == 2:
            r_1 = trace(dp,m-1,n)
            r_2 = trace(dp,m,n-c[A[m-1]-1])
            return [r[0]+r_ for r_ in r_1] + [r[0]+r_+[m] for r_ in r_2]

tm = trace(dp,M,N)

ans = []
for tm_ in tm:
    ans_ = [inv_d[c[A[m-1]-1]] for m in tm_]
    ans_.sort(reverse=True)
    ans += [ans_]

ans.sort(reverse=True)
#print(ans)
for ans_ in ans[0]:
    print(ans_,sep='',end='')
print()

Measured memory_bytes: 5952
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include <algorithm>
#include<initializer_list>
#include<map>
#include<set>
#include<utility>
#include<tuple>
using namespace std;
#define ull unsigned long long
int main() {
	ull n, m;
	cin >> n >> m;
	ull a = m * 1900 + (n - m) * 100;
	double p = pow(0.5, m);
	double r = 1 - p;
	double dsum = a*p / pow((1 - r), 2);
	
	

	cout << (ull)dsum;
	return 0;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define  rep(i,a,b)for(long long i=a;i<b;++i)
#define  rrep(i,a,b)for(int i=a;i>=b;--i)
#define  yesno(flag)if(flag)cout<<"Yes"<<endl; else cout<<"No"<<endl;
using namespace std;
const ll INF=1000000000000LL;
const ll r197=1000000007;
typedef pair<int,int>P;
typedef pair<int,P>Pa;
bool Inframe(int a,int b,int c,int d,int h,int w){
	if(a+b>=0&&a+b<h&&c+d>=0&&c+d<w)return true;
	return false;
}


int n,a[1005],ma,b[1005]={};
int c[1005];
int ans=0;
vector<P> v[1005][1005];
int main() {
	cin>>n;
	rep(i,0,n)cin>>a[i];
	rep(i,0,n){
		cin>>b[i];
		ans+=b[i];
	}
	rep(i,0,n-1){
		cin>>c[i];
	}
	rep(i,0,n-1){
		if(a[i]+1==a[i+1])ans+=c[a[i]-1];
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 23936
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#define endl "\n"
using namespace std;

int main()
{
    int n, i;
    cin >> n;
    vector <int> v1(n);
    vector <int> v2(n);
    string str1;
    string str2;
    for(i = 0; i < n; i ++)
    {
    	cin >> v1[i];
    	str1 += v1[i] + '0';
    }

    for(i = 0; i < n; i ++)
    {
    	cin >> v2[i];
    	str2 += v2[i] + '0';
    }
    string check = str1;
    string check2 = str2;
    sort(str1.begin(), str1.end());
    sort(str2.begin(), str2.end());

    int count = 0;
    do
    {
    	if(str1 == check)
    		break;
    	count ++;
    }while(next_permutation(str1.begin(), str1.end()));

    // cout << count << endl;
    int count2 = 0;
    
    do
    {
    	if(str2 == check2)
    		break;
    	count2 ++;
    }while(next_permutation(str2.begin(), str2.end()));

    // cout << count2 << endl;
    cout << abs(count - count2) << endl;
}

Measured memory_bytes: 256
#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() {
    string S;
    cin >> S;
    int even0 = 0;
    int even1 = 0;
    rep(i,S.size()) {
        if (i % 2 == 0 && S.at(i) == '0') ++even0;
        else if (i % 2 == 1 && S.at(i) == '1') ++even0;
    }
    rep(i,S.size()) {
        if (i % 2 == 0 && S.at(i) == '1') ++even1;
        else if (i % 2 == 1 && S.at(i) == '0') ++even1;
    }
    cout << min(even0, even1) << endl;
}


Measured memory_bytes: 3748
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,x=0;
  cin>>n;
  while(n--){
    string s;
    cin>>s;
    x+=s=="A"?1:-1;
    if(x<0){cout<<"NO"<<endl;return 0;}
  }
  cout<<(x?"NO":"YES")<<endl;
  return 0;
}


Measured memory_bytes: 3168
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <queue>
using namespace std;
typedef long long int ll;


int d[110][110];
char fi[110][110];
int h,w;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cin >> h >> w;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin >> fi[i][j];
			d[i][j]=1e9;
		}
	}
	d[0][0]=1;
	queue<pair<int,int>> q;
	q.push(make_pair(0,0));
	while(q.size()){
		auto p=q.front();
		q.pop();
		int x=p.first,y=p.second;
		if(x+1<h){
			int nx=x+1;
			int ny=y;
			int dd=1;
			if(fi[x][y]==fi[nx][ny]){
				dd=0;
			}
			if(d[nx][ny]>d[x][y]+dd){
				d[nx][ny]=d[x][y]+dd;
				q.push(make_pair(nx,ny));
			}
		}
		if(y+1<w){
			int nx=x;
			int ny=y+1;
			int dd=1;
			if(fi[x][y]==fi[nx][ny]){
				dd=0;
			}
			if(d[nx][ny]>d[x][y]+dd){
				d[nx][ny]=d[x][y]+dd;
				q.push(make_pair(nx,ny));
			}
		}
	}
	if(fi[0][0]=='.'){
		cout << d[h-1][w-1]/2 << endl;
	}else{
		cout << (d[h-1][w-1]+1)/2 << endl;
	}
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define int ll
#define ll long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
// #define MOD 998244353 
#define MEM_SIZE 100010
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }



void solve(void)
{
  int N;cin>>N;
  vector<int> vec (N,0);
  for (int i = 0; i < N; i++)
  {
     cin>>vec[i];
  }
  vector<int> DP (N+1,0);
  DP[0] = 1000;
  for (int i = 1; i <= N-1; i++)
  {
    DP[i] = DP[i-1];
    for (int j = 0; j < i; j++)
    {
      chmax(DP[i],DP[j] + (vec[i] - vec[j])*(DP[j]/vec[j]));
    }
    
  }
  cout<<DP[N-1]<<endl;
  
  return;
}
int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();

  return 0;
}


Measured memory_bytes: 3672
package main

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

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() (int, []int) {
	n := readInt()
	return n, readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int

// -----------------------------------------------------------------------------

func main() {
	defer stdout.Flush()
	n := readInt64()
	m := readInt64()
	if m%n == 0 {
		println(m / n)
		return
	}

	ans := int64(0)
	for i := int64(1); ; i++ {
		x := n * i
		if m < x {
			break
		}
		if (m%x)%i == 0 {
			ans = i
		}
	}
	println(ans)
}

// -----------------------------------------------------------------------------


Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <tuple>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(perm),end(perm)
#define showall(obj) for(auto x:obj)cout<<x<<' ';
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
typedef vector<int> vint;
typedef vector<ll> vll;
const int inf = 100100100;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
    string s; cin>>s;
    int ans = inf;
    rep(i,s.size()-2){
        int n = (s[i]-'0')*100+(s[i+1]-'0')*10+(s[i+2]-'0')*1;
        ans = min(ans,abs(n-753));
    }
    cout<<ans <<endl; 
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int
proc(int n, int b[])
{
        int mem[10100] = {0};
        int i, proc_cnt = 0;
        int head, tail;
        int chk_triangle;
        
        head = 0;
        tail = n - 1;
        for (;n > 0; n--)
                mem[n - 1] = b[n - 1];

        while (proc_cnt < 10000) {
                chk_triangle = 1;
                for (i = head; i <= tail; i++)
                        if (mem[i] != chk_triangle) {
                                if (mem[i] != 0) {
                                        chk_triangle = -1;
                                        break;
                                }
                        } else {
                                chk_triangle++;
                        }
                if (chk_triangle != -1) {
                        printf("%d\n", proc_cnt);
                        return 0;
                }

                for (i = head; i <= tail; i++)
                        if (mem[i] != 0) {
                                mem[tail + 1]++;
                                mem[i] -= 1;
                        }
                tail++;
                proc_cnt++;
                
                for (i = head; mem[i] == 0; i++);
                head = i;
        }

        return 1;
}

int
main()
{
        int n, i;
        int b[100];
        
        while (scanf("%d", &n), n != 0) {
                for (i = 0; i < n; i++)
                        scanf("%d", b + i);
                if (proc(n, b))
                        printf("-1\n");
        }
        return 0;
}

Measured memory_bytes: 660
N = int(input())
H = list(map(int, input().split()))
import sys
prev = -999
for i in range(N):
    if prev <= H[i] - 1:
        prev = H[i] - 1
    elif prev == H[i]:
        prev = H[i]
    else:
        print('No')
        sys.exit(0)
print('Yes')

Measured memory_bytes: 14228
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
typedef long long lng;
#define UP(i,a,b) for(int i=(a); i<=(b); ++i)
#define DOWN(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) UP(i,0,n-1)
#define ALL(a) (a).begin(), (a).end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end()) //NOTE: <a> must be sorted in advance

lng power(lng b, int n) {lng sol=1; while(n>0) {if(n&1) {sol=sol*b;} n>>=1; b*= b;} return sol;} //calculate b^n in O(log(n)) time

const int MOD = 1000000007; //10^9+7
const double PI = 3.1415926535897932384626;

/*********** variables ************/
lng N, M;
/**********************************/


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

    if(2*N>M) {
        cout << M/2 << endl;
    }
    else {
        lng ans = N;
        M -= 2*N;
        cout << ans + M/4 << endl;
    }
}


Measured memory_bytes: 256
//#pragma GCC optimize ("O3")
//#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

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


	int K, A, B;
	cin >> K >> A >> B;

	int c = B / K * K;

	if (c >= A) co("OK");
	else co("NG");



	Would you please return 0;
}

Measured memory_bytes: 3640
package main

import (
	"fmt"
	"strconv"
	"strings"
)

var n, cnt int

func dfs(i int, s string) {
	if i == 0 {
		t, _ := strconv.Atoi(s)
		if t <= n &&
			strings.Count(s, "3") >= 1 && strings.Count(s, "5") >= 1 && strings.Count(s, "7") >= 1 {
			cnt++
			//fmt.Printf("cnt %d, %s\n", cnt, s)
		}
		return
	}
	dfs(i-1, s+"3")
	dfs(i-1, s+"5")
	dfs(i-1, s+"7")
}

func main() {
	fmt.Scan(&n)
	for i := 1; i <= 9; i++ {
		dfs(i, "")
	}
	fmt.Println(cnt)
}


Measured memory_bytes: 1152
#include<stdio.h>
int main(void){
	int H,W;
	int i,j;
	while(1){
	scanf("%d %d",&H,&W);
		if(H==0 && W==0){
			return 0;
		}
		for(i=1;i<=H;i++){
			for(j=1;j<=W;j++){
				if((i+j)%2==0){
					printf("#");
				}
				else{
					printf(".");
				}
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}

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

#define li long long int
#define rep(i, to) for (li i = 0; i < ((li)(to)); i++)
#define repp(i, start, to) for (li i = (li)(start); i < ((li)(to)); i++)
#define allof(v) (v).begin(), (v).end()


int main(void)
{
	li a[4];
	rep(i, 4)cin >> a[i];

	if (a[1] <= a[2] || a[3] <= a[0]) {
		puts("0");
		return 0;
	}

	cout << min(a[1], a[3]) - max(a[0], a[2]) << endl;


	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[10];
int main()
{
	int n,m;
	memset(a,-1,sizeof(a));
	cin>>n>>m;
	for(int i=1;i<=m;i++)
	{
		int s,c;
		cin>>s>>c;
		if(a[s]!=-1&&a[s]!=c)
		{
			printf("-1\n");
			return 0;
		}
		else a[s]=c;
	}
	if(n>1&&a[1]==0) printf("-1\n");
	else if(n==1)
	{
		if(a[1]==-1) printf("0\n");
		else printf("%d\n",a[1]);
	}
	else
	{
		for(int i=1;i<=n;i++)
		{
			if(i==1&&a[i]==-1) printf("1");
			else if(a[i]==-1) printf("0");
			else printf("%d",a[i]);
		}
		printf("\n");
	}
	return 0;
} 

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

using namespace std;

#define int long long int
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(), (x).end()
#define capi(x) int x;cin>>x
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define dev(v, m, n) for(int i=0;i<n;++i){for(int j=0;j<m;++j){cout<<"|"<<v[j][i];}cout<<"|"<<endl;}

using vi = vector<int>;

#define P (1'000'000'007)

template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(b<a){a=b;return 1;}return 0;}

signed main() {
    capi(n);

    auto res = 1 + (n % 2);
    int dp[200001][3];

    rep(j, res + 1) {
        dp[0][j] = 0;
    }

    rep(i, n) {
        capi(a);
        
        if ((i + 1) % 2 == 0) {
            dp[i + 1][0] = dp[i][0];
        } else {
            dp[i + 1][0] = dp[i][0] + a;
        }

        rep(j, res) {
            if (j > i) {
                dp[i + 1][j + 1] = 0;
            } else if ((i + j) % 2 == 0) {
                dp[i + 1][j + 1] = max(dp[i][j], dp[i][j + 1]);
            } else {
                dp[i + 1][j + 1] = max(dp[i][j], dp[i][j + 1] + a);
            }
        }
    }

    cout << dp[n][res];

    return 0;
}

Measured memory_bytes: 7776