akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll; const ll MM = 1000000000;ll mod = MM + 7;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
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;}
const ll INF = 1LL << 60;

int main() {
    int n, k, r, s, p; string t; cin >> n >> k >> r >> s >> p >> t;
    ll ans = 0;
    bool fl = true;
    rep(i, n) {
        if(i < k) {
            if(t[i] == 'r') ans += p;
            else if (t[i] == 's') ans += r;
            else ans += s;
            continue;
        }
        if(t[i] == t[i-k]) {
            if(t[i-k] != 'g') {
                t[i] = 'g';
                continue;
            }
        }
        if(t[i] == 'r') ans += p;
        else if (t[i] == 's') ans += r;
        else ans += s;
        //cout << ans << endl;
    }
    cout << ans << endl;
}

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

using namespace std;

int main(){
    
    int A[5];
    int a = 0;
    int ans = 0;
    for (int i = 0; i < 5; i++) {
        cin >> A[i];
        if (A[i] % 10 != 0) {
            int b = 10 - A[i]%10;
            a = max(a, b);
            A[i] += b;
        }
        
        ans += A[i];
    }
    cout << ans - a << endl;
    
    
    
    
    
    
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int inf=0X3f3f3f3f;
void read(int &x){
	char c=getchar();
	int f=1;
	x=0;
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	x*=f;
}
int main(){
	int i,j,k,m,n;
	read(n);
	int x;read(x);
	int last=x,sum=0,ans=0;
	for(register int i=2;i<=n;i++){
		read(x);
		if(last>=x){
			last=x;
			sum++;
			ans=max(sum,ans);
		}
		else {
			sum=0;
			last=x;
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

using ll = long long;
using ld = long double;

#define mp make_pair

const int p = 1000000007;


int mul(int a, int b) {
    return (1LL * a * b) % p;
}

int add(int a, int b) {
    int s = (a+b);
    if (s>=p) s-=p;
    return s;
}

int sub(int a, int b) {
    int s = (a+p-b);
    if (s>=p) s-=p;
    return s;
}

int po(int a, int deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}

int inv(int n)
{
    return po(n, p-2);
}


mt19937 rnd(time(0));

/*struct DSU {
    vector<int> sz;
    vector<int> parent;

    int maxx = 1;

    void make_set(int v) {
        parent[v] = v;
        sz[v] = 1;
    }

    int find_set(int v) {
        if (v == parent[v])
            return v;
        return parent[v] = find_set(parent[v]);
    }

    void union_sets(int a, int b) {
        a = find_set(a);
        b = find_set(b);
        if (a != b) {
            if (sz[a] < sz[b])
                swap(a, b);
            parent[b] = a;
            sz[a] += sz[b];
        }
        maxx = max(maxx, sz[a]);
    }

    DSU(int n) {
        sz.resize(n);
        parent.resize(n);
        for (int i = 0; i < n; i++) make_set(i);
    };
};*/

/*
const int N = 1200000;

vector<int> facs(N), invfacs(N);

void init()
{
    facs[0] = 1;
    for (int i = 1; i<N; i++) facs[i] = mul(facs[i-1], i);
    invfacs[N-1] = inv(facs[N-1]);
    for (int i = N-2; i>=0; i--) invfacs[i] = mul(invfacs[i+1], i+1);
}

int C(int n, int k)
{
    if (n<k) return 0;
    return mul(facs[n], mul(invfacs[k], invfacs[n-k]));
}*/

const int N = 1e9;


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

    int H, W, h, w;
    cin>>H>>W>>h>>w;
    if (H%h==0 && W%w==0)
    {
        cout<<"No"; return 0;
    }

    cout<<"Yes"<<endl;

    vector<vector<int>> a(H, vector<int>(W));

    for (int i = 0; i<H; i++)
        for (int j = 0; j<W; j++) if (i%h==0 && j%w==0) a[i][j] = N-1;


    for (int i = 0; i<H; i++)
        for (int j = 0; j<W; j++) if (i%h==H%h && j%w==W%w) a[i][j] = -N;

    for (int i = 0; i<H; i++)
    {
        for (int j = 0; j<W; j++) cout<<a[i][j]<<' ';
        cout<<endl;
    }


}

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

using namespace std;

typedef long long lli;
typedef double lld;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<double> vdl;
typedef vector<vector<lli>> mat;
typedef vector<vdl> mad;
// typedef unordered_map<lli,unordered_map<lli,lli>> graph;
typedef complex<double> cmp;
typedef vector<cmp> vcl;

const lli e5 = 1 << 20;
const lli mod = 998244353;
const lli e3 = 1 << 12;

lli n,m,q;
lli s[e3][e3];
lli query[e5][4];
lli v_edge[e3][e3];
lli h_edge[e3][e3];

int main(){
  cin >> n >> m >> q;
  for(lli i = 1;i <= n;i++){
    string hoge;
    cin >> hoge;
    for(lli j = 0;j < m;j++){
      s[i][j+1] = hoge[j]-'0';
    }
  }
  for(lli i = 0;i < q;i++){
    for(lli j = 0;j < 4;j++) cin >> query[i][j];
  }
  for(lli i = 1;i < n;i++){
    for(lli j = 1;j <= m;j++){
      v_edge[i][j] = (s[i][j] == 1 && s[i+1][j] == 1);
    }
  }
  for(lli i = 1;i <= n;i++){
    for(lli j = 1;j < m;j++){
      h_edge[i][j] = (s[i][j] && s[i][j+1] == 1);
    }
  }
  // s
  for(lli i = 1;i <= n;i++){
    for(lli j = 1;j <= m;j++){
      s[i][j] += s[i-1][j];
    }
  }
  for(lli i = 1;i <= n;i++){
    for(lli j = 1;j <= m;j++){
      s[i][j] += s[i][j-1];
    }
  }
  // v_edge
  for(lli i = 1;i < n;i++){
    for(lli j = 1;j <= m;j++){
      v_edge[i][j] += v_edge[i-1][j];
    }
  }
  for(lli i = 1;i < n;i++){
    for(lli j = 1;j <= m;j++){
      v_edge[i][j] += v_edge[i][j-1];
    }
  }
  // h_edge
  for(lli i = 1;i <= n;i++){
    for(lli j = 1;j < m;j++){
      h_edge[i][j] += h_edge[i-1][j];
    }
  }
  for(lli i = 1;i <= n;i++){
    for(lli j = 1;j < m;j++){
      h_edge[i][j] += h_edge[i][j-1];
    }
  }
  for(lli i = 0;i < q;i++){
    lli vertices = s[query[i][2]][query[i][3]]
    -s[query[i][2]][query[i][1]-1]
    -s[query[i][0]-1][query[i][3]]
    +s[query[i][0]-1][query[i][1]-1];
    lli v = v_edge[query[i][2]-1][query[i][3]]
    -v_edge[query[i][2]-1][query[i][1]-1]
    -v_edge[query[i][0]-1][query[i][3]]
    +v_edge[query[i][0]-1][query[i][1]-1];
    lli h = h_edge[query[i][2]][query[i][3]-1]
    -h_edge[query[i][2]][query[i][1]-1]
    -h_edge[query[i][0]-1][query[i][3]-1]
    +h_edge[query[i][0]-1][query[i][1]-1];
    // cerr << vertices << " " << v << " " << h << endl;
    cout << vertices-v-h << endl;
  }

}


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

int main(){
    int n,k,r,s,p;
    string t;
    cin>>n>>k>>r>>s>>p>>t;
    int mp[256]={};
    mp['r']=0;
    mp['s']=1;
    mp['p']=2;
    int x[3][3]={{0,r,0},{0,0,s},{p,0,0}};
    vector<vector<int>> dp(n,vector<int>(3));
    for(int i=0;i<n;++i) for(int j=0;j<3;++j){
        if(i<k) dp[i][j]=x[j][mp[t[i]]];
        else{
            for(int l=0;l<3;++l) if(l!=j){
                dp[i][j]=max(dp[i][j],dp[i-k][l]+x[j][mp[t[i]]]);
            }
        }
    }
    int ans=0;
    for(int i=0;i<k;++i) ans+=max({dp[n-1-i][0],dp[n-1-i][1],dp[n-1-i][2]});
    cout<<ans<<endl;
}

Measured memory_bytes: 5760
import java.util.Scanner;

public class Main{

	/*
	 * A??§??? ??????????????????????????????????£? ??\????±????????????±?????????????????§?????°?????????
	 *
	 * ??????????????± ??¢?£? ?????? ????????? ??¶?????°
	 *
	 * ????£???????????????????????????????????????????????????\?±??????°????????????????????? ?????????????????????????????????????????????????????????????????????????????¨?±??????\?±??????°??????????????????????????????
	 * ??\?±??????°?????????????????????????????????????????????????????? ????£????????????? #################### (20?????? # )
	 */
	public static void main(String[] args) {

		// ??????????????????????????????????£?
		int[][][] hoUse = new int[4][3][10];

		// ??????????????±
		// ??¢?£? ?????? ????????? ??¶?????°
		int building, floor, room, people;

		Scanner scAner = new Scanner(System.in);
		int info = scAner.nextInt();// ex:3


		for (int i = 0; i < 4; i++)
			for (int j = 0; j < 3; j++)
				for (int k = 0; k < 10; k++)
					hoUse[i][j][k] = 0;

		for (int i = 0; i < info; i++) {
			// ex 3
			// 1 1 3 8
			// 3 2 2 7
			// 4 3 8 1
			building = scAner.nextInt();
			floor = scAner.nextInt();
			room = scAner.nextInt();
			people = scAner.nextInt();

			hoUse[building - 1][floor - 1][room - 1] += people  ;
		}
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					System.out.print(" " + hoUse[i][j][k]);
				}
				System.out.println("");
			}
			if (i < 3)
				System.out.println("####################");
		}
	}
}

Measured memory_bytes: 29932
import sys
sys.setrecursionlimit(10**7)
N = int(input())

wd = [1]
n = 1
while 6**n <= N:
    wd.append(6**n)
    n += 1
n = 1
while 9**n <= N:
    wd.append(9**n)
    n += 1
if N in wd:
    print(1)
    exit()
wd.sort()

INF = float('inf')
mem = [INF] * (N+1)
def dfs(n):
    if mem[n] != INF: return mem[n]
    if n < 6: return n
    mn = INF
    for d in wd[1:]:
        if n-d < 0: break
        mn = min(mn, 1 + dfs(n-d))
    mem[n] = mn
    return mn

print(dfs(N))

Measured memory_bytes: 21488
#include <stdio.h>
#include <cmath>
#include <bits/stdc++.h>



using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;


//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)



int main(void){

	char a, b; cin >> a >> b;

	if(a == 'H'){
		cout << b << endl;
	}
	else if(a == 'D'){
		if(b == 'H') cout << 'D' << endl;
		else cout << 'H' << endl;
	}


	return 0;

}


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

using namespace std;
using LLONG = long long;

int main()
{
    int A, B;
    cin >> A >> B;
    if ((A - B) % 2 != 0)
    {
        cout << "IMPOSSIBLE" << endl;
    }
    else
    {
        cout << (A + B) / 2 << endl;
    }
}


Measured memory_bytes: 764
#pragma GCC optimize ("O3")
#pragma GCC target("avx512f")
#pragma GCC optimize("unroll-loops")
//include,using,define等
#pragma region header
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#include <cstring>

// ===============================================================
//using系
#pragma region header
using namespace std;
using ll = long long;
using lint = long long;
using vl = vector<long long>;
using vvl = vector<vector<long long>>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vc = vector<char>;
using vcc = vector<vector<char>>;
using vm = vector<short>;
using vmm = vector<vector<short>>;
using pii = pair<int, int>;
using psi = pair<string, int>;
using ld = long double;
using ull = unsigned long long;
using ui = unsigned int;
using qul = queue<ll>;
using pql = priority_queue<ll>;
const int dx[] = { 1,0,-1,0 };
const int dy[] = { 0,1,0,-1 };
constexpr ll mod = 1e9 + 7;
constexpr long double pi = 3.141592653589793238462643383279;
#pragma endregion
// ========================================================================
//define
#pragma region header
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i <= n; i++)
#define INF (ll)10000000000000000
#define mod (ll)1000000007
#pragma endregion
#pragma endregion
int x[200000];
int y[200000];
lint ans;

int main(void) {
    int n;
    int x[200000], y[200000];
    int ans = 0;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) scanf("%d", &x[i]);
    for (int i = 0; i < n; i++) scanf("%d", &y[i]);
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
            ans ^= x[i] + y[j];
    printf("%d\n", ans);

    return 0;
}

Measured memory_bytes: 5140
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define rrep(i,n) for(int i=(int)n-1;i>=0;--i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T& a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U& u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U& u,const V... v){for(auto& e:u)fill_v<T>(e,v...);}

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

    int n, T;
    cin >> n >> T;
    vector<int> t(n);
    rep(i, n) cin >> t[i];

    int now = 0;
    ll ans = 0;
    for (int i = 1; i < n; ++i) {
        ans += min(T, t[i] - now);
        now = t[i];
    }
    ans += T;
    cout << ans << endl;
}


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

using namespace std;

typedef long long ll;

ll N, M;
vector<ll> X;

int main(int argc, char const *argv[])
{
    cin >> N >> M;
    for (int i = 0; i < M; ++i) {
        ll x;
        cin >> x;
        X.emplace_back(x);
    }
    sort(X.begin(), X.end());
    ll ans = 0;
    if (N >= M) {
        cout << ans << endl;
        return 0;
    }
    else if (N==1) {
        ans = X[X.size()-1] - X[0];
        cout << ans << endl;
        return 0;
    }
    vector<ll> vec;
    for (int i = 1; i < M; ++i) {
        vec.emplace_back(X[i]-X[i-1]);
    }
    sort(vec.rbegin(), vec.rend());
    vec.erase(vec.begin()+N-1, vec.end());
    sort(vec.begin(), vec.end());
    
    vector<pair<ll, ll>> pv;
    for (int i = 0; i < M && vec.size() > 0; ) {
        for (int j = i+1; j < M && vec.size() > 0; ++j) {
            if (j==M-1) {
                pv.emplace_back(make_pair(i, j-1));
                i = M;
                break;
            }
            ll dis = X[j] - X[j-1];
            auto itr = std::find(vec.begin(), vec.end(), dis);
            size_t index = std::distance(vec.begin(), itr);
            if (index != vec.size()) {
                pv.emplace_back(make_pair(i, j-1));
                vec.erase(itr);
                i = j;
                break;
            }
            else continue;
        }
    }
    for (int i = 0; i < pv.size(); ++i) {
        int b = pv[i].first, e = pv[i].second;
        ans += X[e] - X[b];
    }
    ans += X[X.size()-1] - X[pv[pv.size()-1].second+1];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3956
#include<bits/stdc++.h>
#define int long long
#define Mod 1000000007
using namespace std;
int f[2005];
signed main() {
	int n; cin >> n;
	f[0] = 1;
	for(int i = 3; i <= n; i++) {
		for(int j = 3; j <= i; j++)
		    f[i] = (f[i] + f[i - j]) % Mod;
	}
	cout << f[n] << endl;
}

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

using namespace std;

#define LOG(...) fprintf(stderr, __VA_ARGS__)
//#define LOG(...)
#define FOR(i, a, b) for(int i=(int)(a); i<(int)(b); ++i)
#define REP(i, n) for(int i=0; i<(int)(n); ++i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SQ(n) (n) * (n)

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main() {
  int n, month, day, hour, minite, id;
  char io;
  while(cin >> n, n) {
    vi visiters(1000, -1);
    vi times(1000);
    REP(i, n){
      scanf("%d/%d %d:%d %c %d", &month, &day, &hour, &minite, &io, &id);
      int t = hour * 60 + minite;
      if (io == 'I') {
        visiters[id] = t;
      }else{
        if(id == 0) {
          FOR(i, 1, 1000){
            if(visiters[i] != -1) {
              times[i] += t - max(visiters[i], visiters[0]);
            }
          }
        }else{
          if(visiters[0] != -1) {
            times[id] += t - max(visiters[id], visiters[0]);
          }
        }
        visiters[id] = -1;
      }
    }
    RSORT(times);
    cout << times[0] << endl;
  }
}

Measured memory_bytes: 3164
#pragma GCC optimize("Ofast")
#include  "bits/stdc++.h"
using namespace std;
#define I_AM_SPEED  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define printclock  cerr <<"Time : "<<(double)clock()/(double)CLOCKS_PER_SEC<<" sec\n";
#define mp(a , b)   make_pair(a , b)
#define eb(a)       emplace_back(a)
#define SZ(n)       ((int)(n).size())
#define all(n)      (n).begin(), (n).end()
#define anal           '\n'
#define mod         1000000007
#define fst         first
#define sec         second
#define pr(n)       cerr << n  << " ";
#define pfor(a)     for(auto (w) : (a)) pr(w)
//const double PI = acos(-1.0);
typedef long long ll;
typedef unsigned long long ull;

//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-



//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
int main(){
I_AM_SPEED;
#ifndef ONLINE_JUDGE  
        freopen("input.in", "r", stdin);
        freopen("output.in", "w", stdout);
#endif 
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
     
  ll n, k; cin >> n >> k;
  vector<ll> a(n);
  for(int i = 0; i < n; i++) cin >> a[i];

  ll l = 1, r = *max_element(all(a));
  while(l < r){
      ll mid = l + (r - l)/2;
      bool chk = true;
      ll cut = 0;
      for(int i = 0; i < n; i++){
          cut += (a[i] - 1)/mid ;
          if(cut > k){
              chk = false;
              break;
          }
      }
      if(chk) r = mid;
      else l = mid + 1;
  }  
  cout << l << anal;  

//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
//printclock; 
return  0 ;      
}        



      

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

int n, q, p = -1, maxp = -1;
int d[100][1000];
int m[1000], s[1000];

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

  while(cin >> n >> q, n | q) {
    fill(m, m+100, 0);
    fill(s, s+100, 0);
    memset(d, 0, sizeof(d));
    for(int i = 0; i < n; ++i) {
      cin >> m[i];
      for(int j = 0; j < m[i]; ++j) cin >> d[i][j];
    }
    p = maxp = -1;

    /*for(int i = 0; i < n; i++) {
      for(int j = 0; j < m[i]; j++) {
        cout << "d[" << i << "][" << j << "] = " << d[i][j] << endl;
      }
    }*/

    for(int i = 0; i < n; ++i) {
      for(int k = 0; k < m[i]; ++k) {
        s[d[i][k]]++;
      }
    }
    //for(int i = 0; i < 100; ++i) cout << "s[" << i << "] = "<< s[i] << endl;
    for(int i = 0; i < 100; ++i) {
      if(s[i] >= q && maxp < s[i]) {
        maxp = s[i]; p = i;
      }
    }

    if(p == -1) cout << 0 << endl;
    else cout << p << endl;
    //cout << endl;
  }

  return 0;
}

Measured memory_bytes: 3524
///A drunk man will find his way home, but a drunk bird may get lost forever...
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define f first
#define s second
#define int long long
#define sz(x) (int)x.size()
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	int a, b, c;
	cin >> a >> b >> c;
	cout << max((int)0 , c - (a - b)) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int a, b;
    cin >> a >> b;
    
    if(a < b)           cout << "a < b" << endl;
    else if (a == b)    cout << "a == b" << endl;
    else                cout << "a > b" << endl;
    
    return 0;
}



Measured memory_bytes: 3068
#include<bits/stdc++.h>
using namespace std;
#define nl cout<<'\n';
int main()
{
    string s;
    cin>>s;
    if((s[0]==s[1]&&s[1]==s[2])||(s[1]==s[2]&&s[2]==s[3]))
      cout<<"Yes";
    else
      cout<<"No";
    nl;
    return 0;
}


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

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 1; i <= (n); i++)
#define all(c) (c).begin, (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

int main() {
  int N;
  int v[10];
  int cnt = 0;
  cin >> N;
  int temp = N;
  int ans = 0;
  int sum = 0;
  int c[11][11];
  rep(i, 10) {
    rep(j, 10) {
      c[i][j] = 0;
    }
  }
  repto(i, N) {
    int a, b;
    int temp = i;
    b = temp % 10;
    while(temp) {
      a = temp;
      temp /= 10;
    }
    c[a][b]++;
  }
  repto(i, 9) {
    for (int j = i; j <= 9; j++) {
      if (i == j) {
        ans += c[i][j]*c[i][j];
      }
      else {
        ans += 2*c[i][j]*c[j][i];
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll dp[100005]; //dp[i] is the number of ways such that i candies are used so far
ll mod=1e9+7;
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
	ll n,k,i,j;
	cin >> n >> k;
	ll a[n];
	for(i=0;i<n;i++)
		cin >> a[i];
		
	dp[0]=1;
	for(i=0;i<n;i++)
	{
		vector<ll>pre(k+1);
		for(ll used=k;used>=0;used--)
		{
			ll temp=dp[used];
			ll l=used+1;
			ll r=used+min(a[i],k-used);
			if(l<=r)
			{
				pre[l]+=temp;
				pre[l]%=mod;
				if(r+1<=k)
					pre[r+1]=(pre[r+1]-temp+mod)%mod;
			}	
		}
		ll s=0;
		for(j=0;j<=k;j++)
		{
			s+=pre[j];
			s%=mod;
			dp[j]+=s;
			dp[j]%=mod;
		}
	}
	
	cout<<dp[k]<<"\n";
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] p = new int[n];
        for (int i = 0; i < n; i++) {
            p[i] = Integer.parseInt(sc.next());
        }
        int ans = 0;
        if (p[0] == 1) {
            ans++;
            swap(p, 0, 1);
        }
        if (p[n - 1] == n) {
            ans++;
            swap(p, n - 2, n - 1);
        }
        for (int i = 1; i < n - 1; i++) {
            if (p[i] == i + 1) {
                ans++;
                swap(p, i, i + 1);
            }
        }
        System.out.println(ans);
    }

    private static void swap(int[] p, int i, int j) {
        int temp = p[i];
        p[i] = p[j];
        p[j] = temp;
    }
}

Measured memory_bytes: 50672
#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <iterator>
#include <algorithm>
#include <string>
#include <cstring>
using namespace std;

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}

#define rep(i, n, m) for (int i = n; i <= m; i++)
#define Rep(i, n, m) for (int i = m; i >= 1; i--)

typedef long long ll;
typedef unsigned long long ull;

int main() {
    string s;
    cin >> s;
    int ans = 0;
    rep(i, 1, s.size() - 1) {
        if (s[i-1] == '0') {
            if (s[i] == '0') {
                ans++;
                s[i] = '1';
            }
        } else {
            if (s[i] == '1') {
                ans++;
                s[i] = '0';
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
long long MOD = 998244353;
int main(){
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  vector<vector<long long>> dp(C - A + 1, vector<long long>(D - B + 1, 0));
  dp[0][0] = 1;
  for (int i = 0; i <= C - A; i++){
    for (int j = 0; j <= D - B; j++){
      int H = A + i;
      int W = B + j;
      if (i == 0 && j == 0){
        continue;
      } else if (i == 0){
        dp[i][j] = dp[i][j - 1] * H % MOD;
      } else if (j == 0){
        dp[i][j] = dp[i - 1][j] * W % MOD;
      } else {
        dp[i][j] = 0;
        dp[i][j] += dp[i][j - 1] * H % MOD;
        dp[i][j] += dp[i - 1][j] * W % MOD;
        dp[i][j] -= dp[i - 1][j - 1] * (H - 1) * (W - 1) % MOD;
        dp[i][j] += MOD;
        dp[i][j] %= MOD;
      }
    }
  }
  /*
  for (int i = 0; i <= C - A; i++){
    for (int j = 0; j <= D - B; j++){
      cout << dp[i][j] << ' ';
    }
    cout << endl;
  }
  */
  cout << dp.back().back() << endl;
}

Measured memory_bytes: 73740
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
      Scanner sc = new Scanner(System.in);
      String[] a = sc.next().split("");

      int sum = 0;
      for(String i: a){
        sum += Integer.parseInt(i);
      }
      System.out.println(sum);
      sc.close();
    }
    
}


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

signed main(){
  int N,R;
  cin>>N>>R;
  
  int ans=0;
  if(N<=10){
    ans=R+(100*(10-N));
  }else{
    ans=R;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        while (true) {
            int height = scan.nextInt();
            int width  = scan.nextInt();

            if (height == 0 && width == 0) {
                break;
            }

            for (int i = 0; i < height; i++) {
                for (int j = 0; j < width; j++) {
                    System.out.print("#");
                }
                System.out.println();
            }
            System.out.println();
        }
    }

}

Measured memory_bytes: 32788
#include <stdio.h>
 
int main()
{
  int N;
  scanf("%d",&N);
  int A[N];
  int a;
  int i;
  i = 0;
  while (i < N)
  {
    scanf("%d", &a);
    A[a - 1] = i + 1;
    i++;
  }
  i = 0;
  while (i < N)
  {
    printf("%d ",A[i]);
    i++;
  }
}

Measured memory_bytes: 1152
#include <iostream>
#include<algorithm>
#include<string>
using namespace std;
const int maxn =1e5+10;
struct node
{
    int x,y;
};
node a[maxn];
bool cmp(node m , node n)
{
    return m.y<n.y;
}
int main()
{
    int n;
    cin >> n;
    for(int i=1;i<=n;i++)
    {
       a[i].x=i;
       cin >> a[i].y;
    }
    sort(a+1,a+1+n,cmp);
    for(int i=1;i<=n;i++)
        cout << a[i].x << " ";
    return 0;
}


Measured memory_bytes: 1536
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
     	while(true){
            long sum=0;
            long b=0;
            int n=sc.nextInt();
            int m=sc.nextInt();
            if(n==0&&m==0)
                break;
            int[] a=new int[n];
            
            for(int i=0;i<n;i++){
                a[i]=sc.nextInt();
            }
            
            for(int i=0;i<n;i++){
                for(int j=i+1;j<n;j++){
                    	b = a[i] + a[j];
					if (m >= b) {
						if (sum < b) {
							sum = b;
                    }
                }
            }
            }
            if(sum==0){
                System.out.println("NONE");
            }else{
                System.out.println(sum);
            }
        }
    }
}
                       


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

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define AND(x,y,z) 
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define DUMPP(xs) for (auto x:xs) cout<<'('<<x.first<<','<<x.second<<')';cout<<endl
#define FOR(i,a,b) for (ll i=(ll)(a);i<(ll)(b);++i)
#define OUT(x) cout<<x<<endl
#define REP(i,n) FOR(i,0,n)
#define YES(cond) cond ? OUT("YES") : OUT("NO")
#define Yes(cond) cond ? OUT("Yes") : OUT("No")

template<class T> T gcd(const T x,const T y){if(!y){return x;}return gcd(y,x%y);}
template<class T> T lcm(const T x,const T y){return x/gcd(x,y)*y;};
template<class T> T modpow(T x,T n,const T mod) {
  T res=1;while(n>0){if(n%2)res=res*x%mod;x=x*x%mod;n/=2;};return res;
}
template<class T> T modinv(T x,const T mod){return modpow(x,mod-2,mod);}
template<class T> bool alltrue(const T &a){return all_of(ALL(a),[](bool x){return x;});}
template<class T> bool anytrue(const T &a){return any_of(ALL(a),[](bool x){return x;});}
template<class T> bool contain(const T &a,const T &b){for(auto x:b){if (a.find(x)==a.end()){return false;}}return true;}
template<class T> bool mmax(T &m,const T q){ if (m < q) {m = q; return true;} else return false; }
template<class T> bool mmin(T &m,const T q){ if (m > q) {m = q; return true;} else return false; }
template<class T> int siz(const T &a) {return (int)a.size();}
template<class T> set<T> devisers(T n) {
  set<T> res;for(T i=1;i<(T)sqrt(n)+1;i++){if(n%i==0){res.insert(i);res.insert(n/i);}}return res;
}
template<class T> void concat(T &a, const T &b){a.insert(a.end(),b.begin(),b.end());}
template<class T> void getand(const T &a,const T &b,T &c) {
  set_intersection(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.end()));
}
template<class T> void getor(const T &a,const T &b,T &c) {
  set_union(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.end()));
}
template<class T> void getdiff(const T &a,const T &b,T &c) {
  set_difference(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.end()));
}
template<class T> T deg2rad(T deg) {return deg*2*M_PI/360;}
template<class T> T rad2deg(T rad) {return rad*360/(2*M_PI);}

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

const ll MOD=1e9+7;
const ll MAX=5e6;


int main() {
  string s,t;cin>>s>>t;
  map<char,vector<int>> mp;
  REP(i,siz(s)) mp[s[i]].push_back(i);

  REP(i,siz(t)) {
    if (siz(mp[t[i]])==0) {
      OUT(-1);
      return 0;
    }
  }

  ll ans = 0;
  int tmp = 0;

  REP(i,siz(t)) {
    int tchar = t[i];
    auto it = lower_bound(ALL(mp[tchar]),tmp);
    // 一周して戻ってくる
    if (it==mp[tchar].end()) {
      ans += (mp[tchar].front()+1)+(siz(s)-tmp);
      tmp = (mp[tchar].front()+1)%siz(s);
    } else {
      ans += *it-tmp+1;
      tmp = (*it+1)%siz(s);
    }
  }
  OUT(ans);

  return 0;
}

Measured memory_bytes: 1216
def levenshtein(s1, s2):
    n, m = len(s1), len(s2)
    dp = [[0] * (m+1) for _ in range(n+1)]
    
    for i in range(n+1):
        dp[i][0] = i
    
    for j in range(m+1):
        dp[0][j] = j

    for i in range(1, n+1):
        for j in range(1, m+1):
            cost = 0 if s1[i-1] == s2[j-1] else 1
            dp[i][j] = min(dp[i-1][j] + 1, dp[i][j-1]+1, dp[i-1][j-1] + cost)
            
    return dp[n][m]

def solve():
    
    s1 = input()
    s2 = input()

    print(levenshtein(s1, s2))
    
if __name__ == '__main__':
    solve()

Measured memory_bytes: 44920
S = list(input())
A = []
i = 0
if S[0] == "<":
    temp = [0,1]
else:
    temp = [0,-1]
for i in range(1,len(S)):
    if S[i-1] == "<" and S[i] == ">":
        A.append(temp)
        temp = [0]   
        if S[i] == ">":
            temp.append(temp[-1]-1)
        else:
            temp.append(temp[-1]+1)
    else:
        if S[i] == ">":
            temp.append(temp[-1]-1)
        else:
            temp.append(temp[-1]+1)
A.append(temp)

sumj = 0
for j in A:
    minj = min(j)
    for k in range(len(j)):
        j[k] += -minj
    sumj += sum(j)
m = []
for l in range(len(A)-1):
    m.append(min(A[l][-1],A[l+1][0]))

print(sumj-sum(m))

Measured memory_bytes: 27824
//Date and time of submission: 
 
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll N=1e5+5;
ll a,b,c;
int main() {
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	map<ll,ll> mp;
	cin>>a>>b>>c;
	++mp[a];
	++mp[b];
	++mp[c];
	if(mp[5]==2&&mp[7]==1)
	cout<<"YES";
	else
	cout<<"NO";
	return 0;
}


Measured memory_bytes: 256
n, p = map(int, input().split())
A = list(map(int, input().split()))
U = n*100
dp = [0]*(U+1)
dp[0] = 1
for a in A:
    for j in reversed(range(U+1)):
        if 0 <= j-a:
            dp[j] += dp[j-a]
print(sum(dp[p::2]))


Measured memory_bytes: 9008
#include <iostream>

long long int N, M, X;
long long int C[12 + 1];
long long int A[12 + 1][12 + 1];
long long int skill[12 + 1];
bool flag[12 + 1];
long long int min_cost = 10000000000;

void func() {
  long long int tmp = 0;
  bool f = true;

  for (int i = 1; i <= N; i++) {
    if (flag[i] == true) {
      for (int j = 1; j <= M; j++) {
        skill[j] += A[i][j];
      }
      tmp += C[i];
    }
  }

  for (int j = 1; j <= M; j++) {
    if (skill[j] < X) {
      f = false;
    }
    skill[j] = 0;
  }

  if (f == true && min_cost > tmp) {
    min_cost = tmp;
  }
}

void select(int ord) {
  if (ord > N) {
    func();
    return;
  }

  flag[ord] = true;
  select(ord + 1);
  flag[ord] = false;
  select(ord + 1);
}

int main() {
  std::cin >> N >> M >> X;
  for (int i = 1; i <= N; i++) {
    std::cin >> C[i];
    for (int j = 1; j <= M; j++) {
      std::cin >> A[i][j];
    }
  }

  select(1);

  if (min_cost == 10000000000)
    std::cout << "-1" << std::endl;
  else
    std::cout << min_cost << std::endl;

  return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

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

    vector<vector<int> > v(n);
    vector<int> cost(n,-1);
    vector<bool> checked(n,false);
    vector<int> check_from(n,-1);

    rep(i,m){
        int a,b;
        cin >> a >> b;
        --a;
        --b;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    /*
    rep(i,n){
        cerr << i << " : ";
        rep(j,v[i].size()){
            cerr << v[i][j] << " ";
        }
        cerr << endl;
    }
    */
    cost[0] = 0;
    queue<int> q;
    q.push(0);

    while(!q.empty()){
        int now = q.front();
        q.pop();
    //    cerr << "now : " << now << endl;
        if(checked[now]){
            continue;
        }
        cerr << v[now].size() << endl;
        rep(i,v[now].size()){
            int next = v[now][i];
    //        cerr << "next : " << next << endl;
            if(cost[next] == -1){
                cost[next] = cost[now] + 1;
                check_from[next] = now;
                q.push(next);
            }
        }
        checked[now] = true;
    }    

    bool ans = true;
    rep(i, n){
        if(cost[i] == -1){
            ans = false;
            break;
        }
    }

    if(ans){
        cout << "Yes" << endl;
        rep2(i,1,n){
            cout << check_from[i] + 1 << endl;
        }
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 10764
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef vector<int> vi;
typedef vector<double> di;
typedef vector< vi > vvi;
typedef pair<int, int> pii;  // pair<int, int> に pii という別名を付ける
typedef long long ll;

int main(){
  int s;
  int w;
  cin >> s >> w;
  if(s>w){
	  cout << "safe" << endl;
  }
  else{
	  cout << "unsafe" << endl;
  }

}


Measured memory_bytes: 3624
#include<bits/stdc++.h> 
using namespace std; 
#define ll long long int
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll power(ll x, ll y, ll p)  
{  
    ll res = 1;
    x = x % p;
    if (x == 0)
    return 0; // In case x is divisible by p; 
    while (y > 0)  
    {  
        if (y & 1)  
            res = (res*x) % p;  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}
bool sortinrev(const pair<vector<int>,int>&a,const pair<vector<int>,int>&b)
{
    if(a.fi==b.fi)
    return b.se>a.se;
    return a.fi>b.fi;
}
// make adjustment;
// void BFS()
// {
//     level[1]=1;
//     q.push(1);vis[1]=true;
//     while(!q.empty())
//     {
//         int p = q.front();
//         q.pop();
//         for(int i=0;i<adj[p].size();i++)
//         {
//             if(vis[adj[p][i]]==false)
//             {
//                 level[adj[p][i]] = level[p]+1;
//                 q.push(adj[p][i]);
//                 vis[adj[p][i]]=true;
//             }
//         }
//     }
// }
void DFS(vector<int>adj[],vector<bool>&visited,int u,int n,vector<int>&vi)
{
    visited[u]=true;
    vi.pb(u);
    for(int i=0;i<adj[u].size();i++)
    {
        if(visited[adj[u][i]]==false)
        {
            (DFS(adj,visited,adj[u][i],n,vi));
        }
    }
}
void run(vector<int>v)
{
    for(int i=0;i<v.size();i++)
    cout<<v[i]<<" ";
    cout<<endl;
}
ll fact(ll n)
{
    ll f=1;
    for(int i=1;i<=n;i++)
    {
        f*=i;
    }
    return f;
}
int main() 
{ 
    FIO;
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    while(a>0 || c>0)
    {
        c=c-b;
        if(c<=0)
        {
            cout<<"Yes";
            return 0;
        }
        a = a-d;
        if(a<=0)
        {
            cout<<"No";
            return 0;
        }
    }
   return 0; 
} 

Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <climits>
#include <cstdlib>

struct Value {
  int value;
  int index;
};

void merge(std::vector<struct Value *> *A, int left, int mid, int right, long *count) {
  int n1 = mid - left;
  int n2 = right - mid;
  
  std::vector<struct Value *> *L = new std::vector<struct Value *>(n1 + 1, NULL);
  std::vector<struct Value *> *R = new std::vector<struct Value *>(n2 + 1, NULL);

  for (int i = 0; i < n1; i++) {
    L->at(i) = A->at(left + i);
  }

  for (int i = 0; i < n2; i++) {
    R->at(i) = A->at(mid + i);
  }

  L->at(n1) = (struct Value *) std::malloc(sizeof(struct Value));
  R->at(n2) = (struct Value *) std::malloc(sizeof(struct Value));  
  
  L->at(n1)->value = INT_MAX;
  R->at(n2)->value = INT_MAX;

  int i = 0;
  int j = 0;

  for (int k = left; k < right; k++) {
    struct Value *l = L->at(i);
    struct Value *r = R->at(j);
    
    if (l->value <= r->value) {
      A->at(k) = l;
      i++;
    } else {
      (*count) += n1 - i;
	
      A->at(k) = r;
      j++;
    }
  }

  delete R;
  delete L;
}

void merge_sort(std::vector<struct Value *> *A, int left, int right, long *count) {
  if (left + 1 < right) {
    int mid = (left + right) / 2;
  
    merge_sort(A, left, mid, count);
    merge_sort(A, mid, right, count);
    merge(A, left, mid, right, count);
  }
}

int main(void) {
  std::ios_base::sync_with_stdio(false);
  
  int n = 0;

  std::cin >> n;
  
  std::vector<struct Value *> *A = new std::vector<struct Value *>(n, NULL);

  for (int i = 0; i < n; i++) {
    struct Value *v = (struct Value *) std::malloc(sizeof(struct Value));
    
    std::cin >> v->value;
    v->index = i;
    
    A->at(i) = v;
  }

  long count = 0;

  int left = 0;
  int right = A->size();
  int mid = (left + right) / 2;

  merge_sort(A, left, right, &count);

  std::cout << count << std::endl;
  
  return 0;
}

Measured memory_bytes: 22984
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
ll n, k, l, p, q, r, s, ans[200008];

struct union_find {
	vector<int> rnk, par;
	union_find(int n) {
		rnk.resize(n+1);
		par.resize(n+1);
		for(int i = 1; i <= n; i++){
			par[i] = i;
			rnk[i] = 0;
		}
	}
	
	int find(int x) {
		if (par[x] == x) return x;
		return par[x] = find(par[x]);
	}
 
	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y)return;
		if (rnk[x] < rnk[y]) {
			par[x] = y;
		}
		else {
			par[y] = x;
			if (rnk[x] == rnk[y])rnk[x]++;
		}
	}
	
	bool same(int x, int y) {
		return (find(x) == find(y));
	}
};

int main(){
	cin >> n >> k >> l;
	
	union_find road(n), rail(n);
	for(ll i = 1; i <= k; i++){
		cin >> p >> q;
		road.unite(p, q);
	}
	
	for(ll j = 1; j <= l; j++){
		cin >> r >> s;
		rail.unite(r, s);
	}
	
	map<pair<int, int>, int> ans;
	for(ll i = 1; i <= n; i++){ans[make_pair(road.find(i), rail.find(i))]++;}
	for(ll i = 1; i <= n-1; i++){cout << ans[make_pair(road.find(i), rail.find(i))] << " ";}
	cout << ans[make_pair(road.find(n), rail.find(n))] << endl;
	return 0;
}

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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define PRINT(x) cout << (x) << "\n"

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

inline int in(int& a) {return scanf("%d", &a);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};


signed main(){
    string S;
    cin >> S;
    int m = 0, len = S.length();
    REP(i, len){
        int cnt = 0;
        FOR(j, i, len){
            if(S[j] == 'A' || S[j] == 'C' || S[j] == 'G' || S[j] == 'T'){
                cnt++;
            }else{
                break;
            }
        }
        m = max(m, cnt);
    }
    PRINT(m);
    return 0;
}

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

using Int = long long;
const char newl = '\n';

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}
template<typename T=int>
vector<T> read(size_t n){
  vector<T> ts(n);
  for(size_t i=0;i<n;i++) cin>>ts[i];
  return ts;
}

//INSERT ABOVE HERE
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  int n,x,t;
  cin>>n>>x>>t;
  cout<<(n+x-1)/x*t<<newl;
  return 0;
}


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

signed main()
{
  string weekday;
  cin >> weekday;
  if (weekday == "SUN") cout << 7 << endl;
  else if (weekday == "MON") cout << 6 << endl;
  else if (weekday == "TUE") cout << 5 << endl;
  else if (weekday == "WED") cout << 4 << endl;
  else if (weekday == "THU") cout << 3 << endl;
  else if (weekday == "FRI") cout << 2 << endl;
  else if (weekday == "SAT") cout << 1 << endl;
}


Measured memory_bytes: 256
import math

A, B, H, M = map(int, input().split())

rad = 0
deg_long = M * 6
deg_short = 30 * H + M / 2

if abs(deg_long - deg_short) > 180:
    rad = math.radians(360 - abs(deg_long - deg_short))
else:
    rad = math.radians(abs(deg_long - deg_short))

print(math.sqrt(A ** 2 + B ** 2 - 2 * A * B * math.cos(rad)))

Measured memory_bytes: 9300
#include<bits/stdc++.h>
#define rep(i,k,n) for(ll i= (ll) k;i< (ll) n;i++)
#define all(v) (v).begin(), (v).end()
#define SZ(v) (int)((v).size())
#define pb push_back
#define ft first
#define sd second
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const long long INF = 4e18L + 1;
const int IINF = 2e9 + 1;

using namespace std;

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

#ifdef LOCAL
#define DBG(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define DBG(...) ;
#define cerr if(0)cout
#endif

int main()
{
#ifndef LOCAL
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
    string s; cin >> s;
    ll n = SZ(s);
    ll res = ((n + 1) * n) / 2 + 1;
    map<char, ll> cnt;
    for(auto& c : s){
        cnt[c]++;
    }
    for(auto& p : cnt){
        res -= (p.sd * (p.sd + 1)) / 2;
    }
    cout << res << "\n";
    return 0;
}

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

#define REP(i, n) for(decltype(n) i = 0; i < n; i++)

#define ALL(c)   c.begin(), c.end()
#define SORT(c)  std::sort(ALL(c))
#define RSORT(c) std::sort(ALL(c), std::greater<decltype(c)::value_type>())

using namespace std;
using ll = long long;

const int MOD  = (int)1e9 + 7;
const int INF  = (int)1e9 + 1;
const ll  LINF = (ll)1e18 + 1;

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

    int H, W, K;
    std::cin >> H >> W >> K;

    vector<vector<ll>> dp(H + 1, vector<ll>(W, 0));

    dp[0][0] = 1;
    for(int hi = 1; hi < H + 1; hi++) {
        REP(wi, W) {
            // bit全探索
            for(int i = 0; i < (1 << (W - 1)); i++) {
                [&]() {
                    bool prev_is_assert = false;
                    for(int j = 0; j < W - 1; j++) {
                        if(i & (1 << j)) {
                            if(prev_is_assert) {
                                return;
                            }
                            else {
                                prev_is_assert = true;
                            }
                        }
                        else {
                            prev_is_assert = false;
                        }
                    }

                    bool l = i & (1 << (wi - 1));
                    bool r = i & (1 << wi);
                    if(l) {
                        dp[hi][wi] += dp[hi - 1][wi - 1];
                        dp[hi][wi] %= MOD;
                    }
                    else if(r) {
                        dp[hi][wi] += dp[hi - 1][wi + 1];
                        dp[hi][wi] %= MOD;
                    }
                    else {
                        dp[hi][wi] += dp[hi - 1][wi];
                        dp[hi][wi] %= MOD;
                    }
                }();
            }
        }
    }

    std::cout << dp[H][K - 1] << std::endl;

    return 0;
}


Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
    final BigInteger mod = BigInteger.valueOf(1000000007L);

    private static int taskOne(int n, int k) {


        return 0;
    }

    private static int taskTwo() {
        return 0;
    }

    private static int taskThree() {
        return 0;
    }

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

        if (n % 2 != 0) {
            System.out.println(n / 2 + 1);
        } else {
            System.out.println(n / 2);
        }
    }
}

Measured memory_bytes: 21972
// dile a la jardinera que traigo flores

#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define sz(x) int(x.size())
#define all(v) (v).begin(),(v).end()
#define trace(x) cout << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define FER(i,a,b) for(int i = int(a); i < int(b); ++i)
#define IFR(i,a,b) for(int i = int(a); i >= int(b); i--)
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;


int main(){	
	fastio;
	double a,b;cin>>a>>b;
	cout<<fixed<<setprecision(10)<<a/b<<endl;
	return 0;
}


Measured memory_bytes: 256
#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())

lli lengthT[100100],lengthA[100100];
lli edge[100100];

signed main(){

	lli n,u,v;
	cin>>n>>u>>v;
	u--,v--;

	map<lli,vector<lli>> d;
	vector<lli> a(n-1),b(n-1);
	REP(i,0,n-1){
		cin>>a[i]>>b[i];
		a[i]--,b[i]--;
		d[a[i]].push_back(b[i]);
		d[b[i]].push_back(a[i]);
	}

	REP(i,0,100100){
		lengthT[i]=INF;
		lengthA[i]=INF;
		edge[i]=0;
	}
	lengthT[u]=0;
	lengthA[v]=0;

	queue<lli> qt,qa;
	qt.push(u);
	qa.push(v);

	while(qt.size()){
		lli top=qt.front();
		qt.pop();
		for(auto e:d[top]){
			if(lengthT[e]!=INF)continue;
			lengthT[e]=lengthT[top]+1;
			qt.push(e);
		}
	}

	while(qa.size()){
		lli top=qa.front();
		qa.pop();

		bool flag=false;
		for(auto e:d[top]){
			if(lengthA[e]!=INF)continue;
			lengthA[e]=lengthA[top]+1;
			qa.push(e);
			flag=true;
		}
		if(!flag)edge[top]=1;
	}

	lli ans=0;
	REP(i,0,n){
		if(edge[i]==1 && lengthT[i]<=lengthA[i]){
			if(DEBUG)cout<<"i="<<i<<" lengthA="<<lengthA[i]<<endl;
			lli tmp = lengthA[i]-1;
			ans = max(ans,tmp);
		}
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 15872