akhauriyash/Code-Regression huggingface dataset:
//vectorはintじゃないとCEする
#include <bits/stdc++.h>
#include <atcoder/segtree>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using namespace atcoder;

int op(int a,int b){return max(a,b);}

int e(){return -1;}

int target;

bool f(int v){return v<target;}


int main() {
  long long N,Q;
	cin>>N>>Q;
	vector<int> a(N);
	rep(i,N)cin>>a[i];
	segtree<int,op,e> seg(a);
	rep(i,Q){
		int T;
	  cin>>T;
		if(T==1){
			long long X,V;
			cin>>X>>V;
			X--;
			seg.set(X,V);
		}else if(T==2){
			long long X,V;
			cin>>X>>V;
			X--;
			cout<<seg.prod(X,V)<<"\n";
		}else{
			long long X;
		  cin>>X>>target;
			X--;
			cout<<seg.max_right<f>(X)+1<<"\n";
		}
	}
	return 0;
}

Measured memory_bytes: 6100
package main

import "fmt"

func main() {
	var a, b int
	fmt.Scan(&a, &b)

	var high, low int
	if a < b {
		high = b
		low = a
	} else {
		high = a
		low = b
	}
	for i := low; i < high; i++ {
		if (i - low) == (high - i) {
			fmt.Println(i)
			return
		}
	}
	fmt.Println("IMPOSSIBLE")
}


Measured memory_bytes: 512
#include <stdio.h>
   
int main(void){   
    int n, b, f, r, v;
    int i, j;
    int B1[3][10], B2[3][10], B3[3][10], B4[3][10];
    
    for(i=0; i<3; i++){
        for(j=0; j<10; j++){
            B1[i][j] = 0;
            B2[i][j] = 0;
            B3[i][j] = 0;
            B4[i][j] = 0;
        }
    }
    scanf("%d", &n);
    for(i=0; i<n; i++){
        scanf("%d %d %d %d", &b, &f, &r, &v);
        if(b == 1) B1[f-1][r-1] += v;
        else if(b == 2) B2[f-1][r-1] += v;
        else if(b == 3) B3[f-1][r-1] += v;
        else if(b == 4) B4[f-1][r-1] += v;
    }
    
    for(i=0; i<3; i++){
        for(j=0; j<10; j++) printf(" %d", B1[i][j]);
        printf("\n");
    }
    for(i=0; i<20; i++) printf("#");
    printf("\n");
    
    for(i=0; i<3; i++){
        for(j=0; j<10; j++) printf(" %d", B2[i][j]);
        printf("\n");
    }
    for(i=0; i<20; i++) printf("#");
    printf("\n");
    
    for(i=0; i<3; i++){
        for(j=0; j<10; j++) printf(" %d", B3[i][j]);
        printf("\n");
    }
    for(i=0; i<20; i++) printf("#");
    printf("\n");
    
     for(i=0; i<3; i++){
        for(j=0; j<10; j++) printf(" %d", B4[i][j]);
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2052
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
 
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
ll n,k;
ll a[200000];

bool input(){
    scanf("%lld%lld",&n,&k);
    if(n == 0 && k == 0)
        return false;
    REP(i,n)
        scanf("%lld",a + i);
    return true;
}
void solve(){
    ll sum = 0;
    REP(i,k){
        sum += a[i];
    }
    ll maxi = sum;
    REP(i,n - k){
        sum = sum - a[i] + a[i + k];
        maxi = max(maxi,sum);
    }
    printf("%lld\n",maxi);
}
int main(){
    while(input())
    solve();
}

Measured memory_bytes: 3968
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int main() {
    int n,k;
    cin>>n>>k;
    vector<pair<int,int>>v(n);
    for(int i=0;i<n;i++){
        pair<int, int>p;
        cin>>p.first;
        cin>>p.second;
        v[i]=p;
    }
    vector<vector<long long >>dp(n+1, vector<long long>(k+1,0));
    for(int i=1;i<=n;i++){
        for(int j=1;j<=k;j++){
            if(j<v[i-1].first)
                dp[i][j]=max(dp[i-1][j], dp[i][j-1]); //within left on same row and top on previous column
            else
                dp[i][j]=max(v[i-1].second+dp[i-1][(j-v[i-1].first)], dp[i-1][j]);
            }
    }
    cout<<dp[n][k];
}


Measured memory_bytes: 80256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <memory.h>
using namespace std;

int n;
int main(){
	while (scanf("%d", &n) != EOF && n) {
		int total[3] = { 0 }, oks[3] = { 0 };
		const char* str[] = { "lunch", "dinner", "midnight" };
		for (int i=0; i<n; ++i) {
			int hh, mm, MM, m, M;
			scanf("%d:%d %d", &hh, &mm, &MM);
			if (2<=hh && hh<11 || 15<=hh && hh<18) continue;
			if (hh < 2) hh += 24;
			m = 60*hh + mm;
			M = 60*hh + MM;
			if (m > M) M += 60;
			int k = 0;
			k += (m >= 18*60) + (m >= 21*60);
			total[k] ++;
			if (M - m <= 8) oks[k] ++;
		}
		for (int i=0; i<3; ++i) {
			printf("%s ", str[i]);
			if (total[i] == 0) puts("no guest");
			else printf("%d\n", oks[i]*100/total[i]);
		}
	}
	return 0;
}

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

using namespace std;

int main() {
int n;
cin>>n;
double a[n];
for(int i=0;i<n;i++)
cin>>a[i];

double dp[n+1][n+1];
dp[0][0]=1;
for(int i=1;i<=n;i++)
dp[0][i]=0;
for(int i=1;i<=n;i++)
{
    for(int j=0;j<=i;j++)     {
    
    if(j)
    dp[i][j]=dp[i-1][j-1]*a[i-1];
    if(i!=j)
    dp[i][j]+=dp[i-1][j]*(1-a[i-1]);
    
}
    
}
double sum=0;
for(int i=n/2+1;i<=n;i++)
sum+=dp[n][i];
printf("%.10f",sum);



return 0;
}

Measured memory_bytes: 70400
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include <string>
#include <bitset>
#include <queue>
#include <tuple>
#include <cmath>
#include <map>
#include <cstring>

template<typename T> bool chmax( T &a, const T &b ) { if ( a <= b ) { a = b; return ( true ); } else { return ( false ); } }
template<typename T> bool chmin( T &a, const T &b ) { if ( a >= b ) { a = b; return ( true ); } else { return ( false ); } }

using namespace std;

using ll = long long;
using ull = unsigned long long;

using Pint = pair<int, int>;
using Pll  = pair<ll, ll>;
using Pull = pair<ull, ull>;

#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple

#define F first
#define S second

#define rep( i, n ) for ( int i = 0; i < (int)( n ); ++i )
#define reps( i, n ) for ( int i = 1; i <= (int)( n ); ++i )
#define rrep( i, n ) for ( int i = (int)( ( n ) - 1 ); i >= 0; --i )
#define rreps( i, n ) for ( int i = (int)( ( n ) ); i > 0; --i )
#define arep( i, v ) for ( auto &&i : ( v ) )

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

#define ALL( c ) ( c ).begin(), ( c ).end()
#define RALL( c ) ( c ).rbegin(), ( c ).rend()
#define UNIQUE( c ) ( c ).erase( unique( ( c ).begin(), ( c ).end() ), ( c ).end() )

constexpr ll MOD = 1000000007LL;

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev

template<typename T = ll> class UnionFind {
public:
	UnionFind( T n ) { rep( i, n ) { par.resize( n ); siz.resize( n ); par[i] = i; siz[i] = 1; } }
	T find( T x ) { if ( x == par[x] ) return ( x ); else return( par[x] = find( par[x] ) ); }
	void unite( T x, T y ) { T xx = find( x ); T yy = find( y ); if ( xx == yy ) return;
		if ( siz[xx] <= siz[yy] ) swap( xx, yy ); par[yy] = xx; siz[xx] += siz[yy]; }
private:
	vector<T> par, siz;
};

template<typename T = ll> T power( T a, T b, T m = MOD ) {
	T res = 1;
	while ( b > 0 ) { if ( b & 1 ) res = res * a % m;
		a = a * a % m; b >>= 1; }
	return ( res );
}

/*
constexpr ll MAX = 500010;
ll fact[MAX];
ll inv[MAX];
ll inv_fact[MAX];

template<typename T> void initComb( T n, T m = MOD )
{
	fact[0] = fact[1] = inv_fact[0] = inv_fact[1] = 1;
	inv[1] = 1;
	for ( int i = 2; i < n; i++ ) {
		fact[i] = ( fact[i - 1] * i ) % m;
		inv[i] = m - inv[m % i] * ( m / i ) % m;
		inv_fact[i] = inv_fact[i - 1] * inv[i] % m;
	}
}

template<typename T> T comb( T n, T r, T m = MOD )
{
	if ( n < r ) return ( 0 );
	if ( n < 0 || r < 0 ) return ( 0 );
	return ( fact[n] * ( inv_fact[r] * inv_fact[n - r] % m ) % m );
}
*/

void replace( string &s, string t, string r ) {
	string::size_type p = 0;
	while ( ( p = s.find( t, p ) ) != string::npos ) {
		s.replace( p, t.length(), r );
		p += r.length();
	}
}


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

	ll cnt = MOD;
	rep( i, N )
	{
		ll tmp; cin >> tmp;
		ll tmpcnt = 0;
		while ( ( ( tmp & 1 ) == 0 ) && ( tmp > 0 ) )
		{
			tmp >>= 1;
			++tmpcnt;
		}

		chmin( cnt, tmpcnt );
	}

	cout << cnt << endl;

	return ( 0 );
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    string s,t,u; cin>>s>>t;
    int a,b; cin>>a>>b;
    cin>>u;
    if(u==s) a--;
    else b--;
    cout<<a<<" "<<b<<endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;int f[4]={1,505,-1,-505},I,n,p,x,i,X,d[255025],a,w[255025];void D(int x){for(int i=0;i<4;++i){X=x+f[i];if(d[X]>d[x]+w[X])d[X]=d[x]+w[X],D(X);}}int main(){cin>>n;for(I=0;I<n*n;++I){x=I/n+1,p=I%n+1;i=x*505+p;w[i]=1,d[i]=min(min(x,n-x+1),min(p,n-p+1));}for(i=1;i<=n*n;++i){cin>>p;p--;x=(p/n+1)*505+(p%n+1);a+=--d[x];w[x]=0;D(x);}cout<<a<<endl;}

Measured memory_bytes: 21076
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define rep(i,n) for(ll (i)=0; i<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll z=0,o=0,v=0;
  string s;cin>>s;
  rep(i,s.length()) {
    v=s[i]-'0';
    if(i%2==0&&v==1) z++;
    if(i%2==1&&v==0) z++;
    if(i%2==0&&v==0) o++;
    if(i%2==1&&v==1) o++;
  }
  ll ans=min(z,o);
  print(ans);
  return 0;
}

Measured memory_bytes: 512
import sys
f = sys.stdin

rhombus = oblong = 0
for line in f:
    a, b, c = map(int, line.split(','))
    if a == b:
        rhombus += 1
    if a * a + b * b == c * c:
        oblong += 1

print(oblong)
print(rhombus)

Measured memory_bytes: 6724
//invincible M15
//IIT-(ISM)Dhanbad
#include<bits/stdc++.h>
typedef long long int ll;
#define pb push_back
#define mp make_pair
#define pi  3.141592653589793238462643383279
#define ff first
#define ss second
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=(int)x; i<y; i++)
#define high_functioning_sociopath  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
const unsigned int M = 1000000007;
/*------------------------------------- THE GAME IS ON ---------------------------------------------*/
ll dp[100005];
ll mincost(int n,int arr[],int k)
{
       if(n<=k)return (abs(arr[n-1]-arr[0]));
       if(dp[n]!=-1)return dp[n];
       else
       {
              ll minn=INT_MAX;
              for(int i=1;i<=k;i++)
              {
                      minn=min(minn,(abs(arr[n-1]-arr[n-(i+1)])+mincost(n-i,arr,k)));
              }
              return dp[n]=minn;
       }
}
void solve()
{
       int n,k;
       cin>>n>>k;
       int arr[n];
       for(int i=0;i<n;i++)cin>>arr[i];
       memset(dp,-1,sizeof(dp));
       cout<<mincost(n,arr,k)<<endl;
}
int32_t main()
{
   high_functioning_sociopath
   ll t=1;
   //cin>>t;
   while(t--)
   {
      solve();
   }
}

Measured memory_bytes: 14036
N = int(input())
K = int(input())

# F(N,K) ... N以下の整数で0でない数字がちょうどK個あるものの個数

from functools import lru_cache
import sys
sys.setrecursionlimit(1 << 25)


@lru_cache(None)
def F(N, K):
    '''N以下でちょうど0以外がK回出てくる (0以外を特にカウントする)'''
    # 終了条件
    assert N > -1
    if K < 0:
        return 0
    if N < 10:
        if K == 0:
            return 1  # '0'でないものが0個の状況、一桁ならば0は必ず0から始まる
        if K == 1:
            return N  # 3だったら1,2,3と'0'でないものが存在する。
        return 0  # それ以外はありえない。

    # 桁dp
    q, r = divmod(N, 10)
    ret = 0
    for d in range(10):
        # d=0のとき、これは必ずF(q,K)の通りの数足される
        if d == 0:
            ret += F(q, K)
        else:  # d=0のとき以外はKは一つ消費される
            # d>rのときF(q-1,K-1)から寄与が来る
            if d > r:
                ret += F(q - 1, K - 1)
            else:
                ret += F(q, K - 1)
    return ret


print(F(N, K))


Measured memory_bytes: 3812
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define maxn 1000005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

ll n,a[maxn],b[maxn],c[maxn],d[maxn];
ull h[maxn],tmp,B[maxn];

vector <int> ans;

int main()
{
	n=read(); B[0]=1; rep(i,1,n) a[i]=read(),a[i+n]=a[i]; rep(i,1,n) b[i]=read();
	rep(i,1,2*n-1) c[i]=a[i]^a[i+1]; c[n]=a[1]^a[n];
	rep(i,1,n-1) d[i]=b[i]^b[i+1]; d[n]=b[1]^b[n];
	rep(i,1,n) tmp=tmp*233+d[i],B[i]=B[i-1]*233;
	rep(i,1,2*n) h[i]=h[i-1]*233+c[i];
	
	//rep(i,1,2*n) cout<<c[i]<<" "; cout<<endl;
	//rep(i,1,n) cout<<d[i]<<" "; cout<<endl<<endl;
	
	for(int i=1;i<=n;i++)
	{
		ull p=h[i+n-1]-h[i-1]*B[n];
		if(p==tmp) ans.pb(i-1);
	}
	for(int i=0;i<ans.size();i++) printf("%lld %lld\n",ans[i],b[1]^a[1+ans[i]]);
	return 0;
}

Measured memory_bytes: 18744
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define irp(i,s,e) for(int i=(s);i>(e);--i)
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(b<a){a=b;return 1;}return 0;}
// #define NMAX 1000000000
ll K;

ll solve(){
	ll ans = 0;
	rp(a,1,K+1){
		rp(b,1,K+1){
			rp(c,1,K+1){
				ll g = gcd(a,b);
				g = gcd(g,c);
				ans += g;
			}
		}
	}
	return ans;
}

int main(){
	cin>>K;
	cout<< solve() <<endl;
}


Measured memory_bytes: 3632
import java.util.Scanner;

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

        final int n = scanner.nextInt();
        final int m = scanner.nextInt();
        scanner.nextLine();

        final int[][] switchIndices = new int[m][n];
        for (int i = 0; i < m; i++) {
            int k = scanner.nextInt();

            for (int j = 0; j < k; j++) {
                switchIndices[i][scanner.nextInt() - 1] = 1;
            }

            scanner.nextLine();
        }

        final int[] mods = new int[m];
        for (int i = 0; i < m; i++) {
            mods[i] = scanner.nextInt();
        }

        int successCount = 0;

        for (int i = 0; i < Math.pow(2, n); i++) {
            boolean lightAll = true;
            for (int j = 0; j < m; j++) {
                lightAll &= checkLight(switchIndices[j], mods[j], i);
            }

            successCount += lightAll ? 1 : 0;
        }

        System.out.println(successCount);
    }

    private static boolean checkLight(int[] switchIndex, int mod, int switchStatus) {
        int switchCount = 0;
        for (int i = 0; i < switchIndex.length; i++) {
            if (switchIndex[i] == 0) continue;

            if ((switchStatus >> i) % 2 == 1) {
                switchCount++;
            }
        }

        return switchCount % 2 == mod;
    }
}

Measured memory_bytes: 23636
#include <iostream>
#include <algorithm>
using namespace std;
const int inf = 2012345678;
int n, ret, a[5009], b[5009], p[5009], dp[5009][5009];
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) cin >> a[i] >> b[i], p[i] = i;
	sort(p, p + n, [](int i, int j) { return a[i] + b[i] < a[j] + b[j]; });
	fill(dp[0] + 1, dp[0] + n + 1, inf);
	for (int i = 0; i < n; i++) {
		fill(dp[i + 1], dp[i + 1] + n + 1, inf);
		for (int j = 0; j <= i + 1; j++) {
			dp[i + 1][j] = dp[i][j];
			if (j >= 1 && dp[i][j - 1] <= a[p[i]]) dp[i + 1][j] = min(dp[i + 1][j], dp[i][j - 1] + b[p[i]]);
		}
	}
	for (int i = 0; i <= n; i++) {
		if (dp[n][i] != inf) ret = i;
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 98176
import java.io.*;
import java.util.*;
import java.math.*;
     
public class Main {
	//static int dir[][]={{0,1},{0,-1},{1,0},{-1,0}};
	public static void main(String[] args) throws Exception {
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            OutputStream outputStream = System.out;
        	PrintWriter out = new PrintWriter(outputStream);
     
            int i, j, u=0, v=0;
      String str=br.readLine();
      long sum=0, k=0, prev=0, c=0;
      for(i=0;i<str.length();i++)
      {
        char ch = str.charAt(i);
        if(ch=='<')
        {
          if(k!=0)
          {
            if(k>c)
            {
              sum+=(k*(k+1)/2);
              if(c!=0)
              	c--;
              sum+=(c*(c+1)/2);
            }
            else
            {
              k--;
				sum+=(k*(k+1)/2);
              sum+=(c*(c+1)/2);
            }
            c=0;
            k=0;
          }
          c++;
        }
        else
        {
          k++;
        }
      }
      if(c!=0)
      {
        if(k>c)
            {
              sum+=(k*(k+1)/2);
              c--;
              sum+=(c*(c+1)/2);
            }
            else
            {
              if(k!=0)
              	k--;
				sum+=(k*(k+1)/2);
              sum+=(c*(c+1)/2);
            }
        c=0;
            k=0;
      }
      if(k!=0)
      {
        if(k>c)
            {
              sum+=(k*(k+1)/2);
          	if(c!=0)
              c--;
              sum+=(c*(c+1)/2);
            }
            else
            {
              if(k!=0)
              	k--;
				sum+=(k*(k+1)/2);
              sum+=(c*(c+1)/2);
            }
      }
      out.print(sum);
    	out.flush();
    	out.close();
    	}
    }

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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

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

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



Measured memory_bytes: 3164
#include <iostream>
#include <string>

int main()
{
    std::string s, t;
    std::cin >> s >> t;

    auto ans = s.size();
    for (auto ofs = 0; ofs <= s.size() - t.size(); ++ofs)
    {
        size_t current = 0;
        for (auto index = 0; index < t.size(); ++index)
        {
            if (s[ofs + index] != t[index])
            {
                ++current;
            }
        }

        if (current < ans)
        {
            ans = current;
        }
    }

    std::cout << ans;
    return 0;
}

Measured memory_bytes: 3628
// atcoder/abc139/F/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

double A(pair<double, double> p) {
  return atan2(p.first, p.second);
}

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n;
  while (cin >> n) {
    vector<pair<double, double>> v(n);
    cin >> v;
    sort(v.begin(), v.end(), [] (auto i, auto j) { return A(i) < A(j); });
    double mx = 0;
    for (int i = 0; i < v.size(); ++i) {
      pair<double, double> p = {0, 0};
      for (int j = 0; j < v.size(); ++j) {
        p.first += v[(i + j) % v.size()].first;
        p.second += v[(i + j) % v.size()].second;
        setmax(mx, sqrt(p.first * p.first + p.second * p.second));
      }
    }
    printf("%.20lf\n", mx);
  }

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(){
  int a, b, c;

  scanf("%d%d%d", &a, &b, &c);

  if((a * 100 + b * 10 + c) % 4 == 0){
    printf("YES");
  }else{
    printf("NO");
  }

  printf("\n");
  
}


Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <stack>
#include <queue>
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(){
    ll M,D,m,d;
    cin>>M>>D>>m>>d;
    if(d==1){
        cout<<1<<endl;
    }else{
        cout<<'0'<<endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
	char ch;
	int a_alpha[26] = {};

	while ((ch = getchar()) != EOF) {
		if (64 < ch && ch < 91) {
			a_alpha[ch - 65]++;
		}
		else if (96 < ch && ch < 123) {
			a_alpha[ch - 97]++;
		}
	}

	for (int i = 0; i < 26; i++) {
		printf("%c : %d\n", i + 97, a_alpha[i]);
	}

	return 0;
}


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

void swap(long *A, long i, long j) {
  long temp;
  temp = A[i];
  A[i] = A[j];
  A[j] = temp;
}

long Partition(long *A, long p, long r) {
  long i,j,x;
  x = A[r];
  i = p-1;
  for(j = p; j < r; j++) {
    if(A[j] <= x) {
      i++;
      swap(A,i,j);
    }
  }
  swap(A,i+1,r);

  return i+1;
}

int main()
{
  long i,n,q,*A;
  scanf("%ld", &n);
  A = (long*)malloc(sizeof(long) * n);
  for (i = 0; i < n; i++) {
    scanf("%ld",A+i);
  }
  q = Partition(A,0,n-1);
  for (i = 0; i < q; i++) {
    printf("%ld ",A[i]);
  }
  printf("[%ld] ",A[i]);
  for (i = q+1; i < n-1; i++) {
    printf("%ld ",A[i]);
  }
  printf("%ld\n",A[i]);
  return 0;
}

Measured memory_bytes: 1384
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include<cmath>
#include <map>
#include <set>
#include <iostream>

using namespace std;

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



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

int main()
{
  int N; cin >> N;
  vector<int> p(N, 0);
  for (int i = 0; i < N; i++)
  {
    cin >> p[i];
  }

  int cnt = 0;
  int I = 0;
  int J = 0;
  for (int i = 0; i < N; i++)
  {
    if (p[i] != i+1) {
      cnt++;
      if (cnt == 1) {
        I = i;
      }
      else if (cnt == 2) {
        J = i;
      }
      else {
        break;
      }
    }
  }
  if (cnt == 2 or cnt == 0) {
    cout << "YES" << endl;
  }
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main{
 
	public static void main(String[] args) {
 
		Scanner sc =  new Scanner(System.in);
		int X =sc.nextInt();
		int Y =sc.nextInt();
		int Z =sc.nextInt();
		int count = 0;
	 
		X -= Z;
		while(X >= (Y + Z)){
				X -= Y+Z;
				count++;
			
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 21844
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class Main {
	InputStream is;
	PrintWriter out;
	String INPUT = "";
	
	void solve()
	{
		int n = ni(), K = ni()-1;
		char[] s = ns(n);
		s[K] = (char)(s[K] - 'A' + 'a');
		out.println(new String(s));
	}
	
		
	void run() throws Exception
	{
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);
		
		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
	}
	
	public static void main(String[] args) throws Exception { new Main().run(); }
	
	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;
	
	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}
	
	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }
	
	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }
	
	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	
	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}
	
	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}
	
	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}
	
	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}
		
		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	
	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}
		
		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	
	private static void tr(Object... o) { System.out.println(Arrays.deepToString(o)); }
}

Measured memory_bytes: 24916
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

/**
 * Count Order
 */
public class Main {

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

            String P = "";
            String Q = "";
            for (int i = 0; i < N; i++) {
                P += sc.nextInt();
            }
            for (int i = 0; i < N; i++) {
                Q += sc.nextInt();
            }

            List<String> list = new ArrayList<>();
            boolean[] use = new boolean[N];
            dfs("", use, list);
            Collections.sort(list);

            int a = list.indexOf(P);
            int b = list.indexOf(Q);

            System.out.println(Math.abs(a - b));
        }
    }

    static void dfs(String str, boolean[] use, List<String> list) {
        if (str.length() == use.length) {
            list.add(str);
            return;
        }

        for (int i = 0; i < use.length; i++) {
            if (use[i]) {
                continue;
            }

            use[i] = true;
            dfs(str + (i + 1), use, list);
            use[i] = false;
        }
    }

}


Measured memory_bytes: 32992
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin >> n;
  vector<int> d(n);
  map<int,int> mp;
  for(int i=0;i<n;i++){
    cin >> d[i];
    mp[d[i]]++;
  }
  cin >> m;
  vector<int> t(m);
  for(int i=0;i<m;i++){
    cin >> t[i];
    if(mp[t[i]]==0){
      cout << "NO" << endl;
      return 0;
    }
    mp[t[i]]--;
  }
  cout << "YES" << endl;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

const ll mod = 1e9 + 7;

int main(){
	cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    ll a, b;
    cin >> a >> b;

    if (b >= a) cout << "unsafe" << endl;
    else cout << "safe" << endl;
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main(){
    int n;
    cin >> n;
    vector<int> e;
    vector<int> o;
    while(n--){
        int x;
        cin >> x;
        if(x % 2) o.push_back(x);
        else e.push_back(x);
    }
    if(o.size()%2){
        cout << "NO" << endl;
    }else{
        cout << "YES" << endl;
    }
}

Measured memory_bytes: 892
import random
import numpy as np


D=int(input())
C=np.array(list(map(int,input().split())))
S=[]
for _ in range(D):
    S.append(list(map(int,input().split())))




l=np.zeros(26,int)

def decrease(d):
    return np.dot(C,(d-l))

def pick(i,l):
    diff=[]
    ll=l.copy()
    for j in range(26):
        ll[j]=i
        diff.append(S[i][j]-decrease(i))
    return np.argmax(diff)+1


for i in range(D):
    p=pick(i,l)
    print(p)
    l[p-1]=i+1

Measured memory_bytes: 27492
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
const int M=500010;
int f[M],a[M],n,lastzero;	//a[M]前一个0的位置 
char c[M];
int main()
{
	scanf("%d%s",&n,c+1);
//	scanf("%s",c+1);
	for(int i=1;i<=n;i++)
	{
		if(c[i]=='0')
			lastzero=i;
		a[i]=lastzero;
//		cout<<a[i]<<" ";
	}
	for(int i=1;i<=n;i++)
	{
		f[i]=f[i-1];
		if(c[i]=='1')
		{
/*			if(a[i]>1&&c[a[i]-1]=='1')
				f[i]=max(f[i],f[a[i]-2]+i-a[i]);	//以上一个101向后合并
			else if(c[i-1]=='0'&&c[i-2]=='1')
			{
				f[i]=max(f[i],f[a[i-2]]+i-2-a[i-2]);//这个1...101向左合并
				f[i]=max(f[i],f[a[i-2]+1]+i-3-a[i-2]);//与前面的1合并 
			} */
			if (c[i-1] =='0'&&c[i-2] == '1') {
                f[i]=max(f[i],f[a[i-2]]+i-2-a[i-2]);
                f[i]=max(f[i],f[a[i-2]+1]+i-2-a[i-2]-1);
            }
            else if(a[i]>1&&c[a[i]-1]=='1')f[i]=max(f[i],f[a[i]-2]+i-a[i]);
		}
	}
	printf("%d\n",f[n]);
	return 0;
} 

Measured memory_bytes: 4608
import java.util.Scanner;

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

        int h = sc.nextInt();
        int w = sc.nextInt();

        while(h != 0 || w != 0){
            for (int i = 0; i < h; i++) {
                for (int j = 0; j < w; j++) {
                    if((i+j)%2==0){
                        System.out.print("#");
                    }else{
                        System.out.print(".");

                    }
                }
                System.out.println("");
            }
            System.out.println("");

            h = sc.nextInt();
            w = sc.nextInt();
            
        }


        sc.close();
    }
}


Measured memory_bytes: 32788
#include<bits/stdc++.h>
using namespace std;
int64_t a(string &n,int k,int p,bool f){
  if(k==0)
    return 1;
  if(p+k>n.size())
    return 0;
  if(f){
    int64_t x=1;
    for(int i=0;i<k;i++)
      x*=(n.size()-p-i)*9;
    for(int i=k;i>0;i--)
      x/=i;
    return x;
  }
  int d=(int)(n.at(p)-'0');
  return (d>0?a(n,k-1,p+1,0)+a(n,k-1,p+1,1)*(d-1)+a(n,k,p+1,1):a(n,k,p+1,0));
}
int main(){
  string n;
  int k;
  cin>>n>>k;
  cout<<a(n,k,0,0)<<endl;
}

Measured memory_bytes: 3580
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
#include<numeric>
#include<atcoder/math>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
//#define MOD 1000000007
#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


int main(){
    int t; cin >> t;
    while(t--){
        ll n,m,a,b; cin >> n >> m >> a >> b;
        cout << atcoder::floor_sum(n,m,a,b) << endl;
    }
}



Measured memory_bytes: 3636
#include"bits/stdc++.h"
using namespace std;

typedef long long ll;
#define FOR(i, a, n) for (ll i=(ll)a;i<(ll)n;i++)
#define REP(i, n) FOR(i, 0, n)


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

    int ans = min(b/a, c);

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n;
string s;
int p2x[200005];
int p2y[200005];
int CT = 0;
int L, R;
int F[200005];
int f(int x){
    if (x == 0) return 0;
    if (F[x] != 0) return F[x];
    return F[x] = 1 + f(x%__builtin_popcount(x));
}
int main(){
    cin >> n >> s;
    for (int i = 0;i < n ;i++) if (s[i] == '1') CT++;
    L = max(1,CT-1);
    R = CT+1;
    p2x[0] = 1 % L;
    p2y[0] = 1 % R;
    for (int i = 1; i <= n; i++){
        p2x[i] = (2*p2x[i-1]) % L;
        p2y[i] = (2*p2y[i-1]) % R;
    }
    int sumx = 0, sumy =0;
    for (int i = 0; i < n; i++){
        if (s[i] == '1'){
            sumx += p2x[n-1-i]; sumx %= L;
            sumy += p2y[n-1-i]; sumy %= R;
        }
    }
    for (int i = 0;  i < n; i++){
        if (s[i] == '1'){
            if (CT == 1){
                printf("0\n");
                continue;
            }
            int _sx = (sumx+L-p2x[n-1-i])%L;
            //printf("after removing %d, %d ones, sum = %d\n",i,L,_sx);
            printf("%d\n",1+f(_sx));
        }
        else{
            int _sy = (sumy+p2y[n-1-i])%R;
           // printf("after adding %d, %d ones, sum = %d\n",i,R,_sy);
            printf("%d\n",1+f(_sy));
        }
    }


}


Measured memory_bytes: 5768
#include<stdio.h>
int main(){
    unsigned long inact[100][100];
    unsigned long act[100];
    unsigned long ans[100];
    unsigned short row, col;
    unsigned short i, j;
    for(i = 0;i < 100;i++){
        for(j = 0;j < 100;j++){
            inact[i][j] = 0;
        }
        act[i] = 0;
        ans[i] = 0;
    }
    scanf("%d %d", &row, &col);
    for(i = 0;i < row;i++){
        for(j = 0;j < col;j++){
            scanf("%d", &inact[i][j]);
        }
    }
    for(i = 0;i < col;i++){
        scanf("%d", &act[i]);
    }
    for(i = 0;i < row;i++){
        for(j = 0;j < col;j++){
            ans[i] += inact[i][j] * act[j];
        }
    }
    for(i = 0;i < row;i++){
        printf("%d\n", ans[i]);
    }
    return 0;
}


Measured memory_bytes: 2100
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef pair<int, int>P;
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
typedef vector<vector<ll>> mat;
typedef vector<int> vec;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
const ll mod = 1000000007;
const ll INF = mod * mod;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll qp(ll a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };

void solve() {
    ll a, b, c, n, k, x;
    string s, t;
    ll ans = 0;
    double dans = 0;
    string sans = "YES";



    cin  >> a ;
    ans = 3 * a * a;




    std::cout << ans << endl; 
    // std::cout << sans << endl; 
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    solve();
    // stop
        return 0;
}

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


int n;
char s[200011];
int num[200010];


int main()
{
	int num_w(0), ans(220000), pos;
	int i;
	
	scanf("%d", &n);
	scanf("%s", s);
	for (i = 1; i < n; ++i)
		num[i] = (s[i - 1] == '#') + num[i - 1];
	for (i = n - 1; i; --i)
		if (s[i] != '#')
			break;
	pos = i;
	for (; i; --i) {
		if (s[i] == '.')
			++num_w;
		if (s[i - 1] == '#')
			ans > num[i - 1] + num_w && (ans = num[i - 1] + num_w);
	}
	if (ans < 200000) {
		ans > num[pos] && (ans = num[pos]);
		printf("%d\n", ans);
	}
	else
		printf("0\n");
	return 0;
}



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

int main(){
  int p1,p2,p3,j1,j2;
  int minn;
  
  cin >> p1 >> p2 >> p3 >> j1 >> j2;

  minn = (p1 + j1) - 50;
  minn = min(minn, (p1+j2) - 50);
  minn = min(minn, (p1+j2) - 50);
  minn = min(minn, (p2+j1) - 50);
  minn = min(minn, (p2+j2) - 50);
  minn = min(minn, (p3+j1) - 50);
  minn = min(minn, (p3+j2) - 50);

  cout << minn << endl;
  return 0;
}



Measured memory_bytes: 3080
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,i,j,k;
  cin>>n>>k;
  vector<int> v(n);
  for(i=0;i<n;i++){
    cin>>v[i];
  }
  long long dp[n+1];
  dp[0]=dp[1]=0;
  k=min(k,n);
  for(i=2;i<=n;i++) dp[i]=INT_MAX;
  for(i=2;i<=n;i++){
        for(j=i-2;j>=max(0,i-k-1);j--)
  dp[i]=min(abs(v[i-1]-v[j])+dp[j+1],dp[i]);
  //cout<<dp[i]<<" ";
  }
  cout<<dp[n];
}
  
  

Measured memory_bytes: 4356
import           System.IO hiding (char8)
import           Control.Applicative
import           Control.Monad
import           Data.List
import           Data.Int
import           Data.Char
import           Data.Maybe
import qualified Data.ByteString.Char8 as BS
import           Debug.Trace

-- + -- + -- + -- + -- + -- + -- + -- + -- + -- + -- + -- + -- + -- + -- + -- + -- + --


main :: IO ()
main = do  
  (sx, sy, tx, ty) <- readInt4 <$> BS.getLine
  putStrLn $ f (sx, sy, tx, ty)

f :: (Int, Int, Int, Int) -> [Char]
f (sx, sy, tx, ty) = fh1 ++ sh1 ++ fh2 ++ sh2
  where
    fh1 = (take (ty-sy) $ repeat 'U') ++ (take (tx-sx) $ repeat 'R')
    sh1 = (take (ty-sy) $ repeat 'D') ++ (take (tx-sx) $ repeat 'L')
    fh2 = 'L':(take (ty-sy+1) $ repeat 'U') ++ ((take (tx-sx+1) $ repeat 'R') ++ ['D'])
    sh2 = 'R':(take (ty-sy+1) $ repeat 'D') ++ ((take (tx-sx+1) $ repeat 'L') ++ ['U'])

-- + -- + -- + -- + -- + -- + -- + -- + -- + -- + -- + -- + -- + -- + -- + -- + -- + --

readInt1 :: BS.ByteString -> Int
readInt1 = fst . fromJust . BS.readInt 
 
readInt4 :: BS.ByteString -> (Int,Int,Int,Int)
readInt4 = toQuadruple . readIntN
 
readIntN :: BS.ByteString -> [Int]
readIntN =  map readInt1 . BS.words
 
toQuadruple :: [a] -> (a, a, a, a)
toQuadruple [w, x, y, z] =(w, x, y, z)

Measured memory_bytes: 1020
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int h,m,h1,m1,k,o;
    cin>>h>>m>>h1>>m1>>k;
    if(h<=h1&&m==m1)cout<<((h1)-(h))*60+(m-m1)-k<<endl;
    else if(h<=h1&&m<m1)cout<<((h1)-(h))*60+(m1-m)-k<<endl;
    else if(h<=h1&&m>m1)cout<<((h1)-(h)-1)*60+(60-m)+m1-k<<endl;
    else if(h>=h1&&m<m1)cout<<(24-((h)-(h1)))*60+(m1-m)-k<<endl;
    else if(h>=h1&&m>m1)cout<<(23-(h-h1))*60+(60-m)+m1-k<<endl;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std; 
typedef long long ll;
#define pb push_back
#define fi first
#define se second
const ll mod = 1e9+7;
const int N = 2e5+6;
void solve(){
	string s; 
	cin>>s; 
	bool ans = false;
	int n = s.size();
	for(int i=0;i<n;i++){
		for(int j=i;j<n;j++){
			string ss = s.substr(0,i);
			ss+=s.substr(j,n-j);
			if(ss=="keyence"){
				ans = true;
			}
		}
	}
	if(ans)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t=1; 
//	cin>>t; 
	while(t--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 3660
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main (String args[]) throws Exception{
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int ans = 0;
		Map<String,String> map = new HashMap<String, String>();
		for(int i = 0;i < n; i++) {
			String  s = scan.next();
			if(map.get(s) == null) {
				ans++;
			}
			map.put(s, "");
		}

		System.out.println(ans);
	}
}

Measured memory_bytes: 67260
#include <iostream>
using namespace std;
int a[100005],b[100005];
int main(int argc, char** argv) {
	int n;
	cin >> n;
	for(int i=1;i<=n;i++) cin >> a[i];
	for(int i=1;i<=n;i++) cin >> b[i];
	int ans=0;
	for(int i=1;i<=n;i++) ans+=max(0,a[i]-b[i]);
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> a(n);
  REP(i, n) {
    REP(j, m) {
      int aij;
      cin >> aij;
      a[i].push_back(aij);
    }
  }

  vi b(m);
  REP(j, m) { cin >> b[j]; }

  vi ans(n);
  REP(i, n) {
    REP(j, m) { ans[i] += a[i][j] * b[j]; }
  }

  REP(i, n) { cout << ans[i] << endl; }
}



Measured memory_bytes: 3196
#include <iostream>
#include <string>
#include <map>
#include <typeinfo>
#include <cxxabi.h>
#define type_name(class)  demangle((typeid(class)).name())
char* demangle(const char *demangle) {
    int status;
    return abi::__cxa_demangle(demangle, 0, 0, &status);
}

using namespace std;

class ButtonForwarder{
private:
	string m_chars;
	int m_nchars;
	unsigned int m_pos;
public:
	ButtonForwarder(){}
	ButtonForwarder(const string& str){
		m_chars = str;
		m_nchars = str.size();
		m_pos = -1;
	} 
	~ButtonForwarder(){}
	void push_button(){
		if(m_pos == m_nchars-1){
			m_pos = 0;
		}else{
			m_pos++;
		}
	}
	const string getCharacter(){
		// cout<<"In getCharacter() string is "<<m_chars<<endl;
		// cout<<"m_pos = "<<m_pos<<endl;
		return m_chars.substr(m_pos,1);
	}
	void reset(){m_pos=-1;}
};

class CellularKeyboard{
private:
	map<string, ButtonForwarder> m_buttons;
	string m_curButton;
	string result_temp;
public:
	CellularKeyboard(){m_curButton="";result_temp="";}
	void setStrings(string button, string chars){
		ButtonForwarder bf(chars);
		m_buttons[button] = bf;
	}
	string push(string button){
		// cout<<"push("<< button <<")"<<endl;
		//確定ボタン(キー0が押された場合)
		if(button == "0"){
			//何もボタンが押されていないときに確定ボタンを押すことはできるが、
			//その場合には何も文字は出力されない。
			if(m_curButton.length()==0){return string("");}
			
			// cout<<m_curButton<<endl;
			result_temp = m_buttons[m_curButton].getCharacter();
			m_buttons[m_curButton].reset();
			m_curButton = "";
			return result_temp;
		}
		m_curButton = button;
		m_buttons[button].push_button();
		// cout<<&(m_buttons[button])<<endl;
		// cout<<"Button"<<button<<" is "<<m_buttons[button].getCharacter()<<endl;
		return string("");
	}
};

int main() {
	// your code goes here
	CellularKeyboard kbd;
	kbd.setStrings(string("1"), string(".,!? "));
	kbd.setStrings(string("2"), string("abc"));
	kbd.setStrings(string("3"), string("def"));
	kbd.setStrings(string("4"), string("ghi"));
	kbd.setStrings(string("5"), string("jkl"));
	kbd.setStrings(string("6"), string("mno"));
	kbd.setStrings(string("7"), string("pqrs"));
	kbd.setStrings(string("8"), string("tuv"));
	kbd.setStrings(string("9"), string("wxyz"));
	
	int num;
	string input, decoded;
	cin>>num;
	for(int n=0;n<num;n++){
		cin>>input;
		decoded="";
		for(int i=0;i<input.length();i++){
			decoded += kbd.push(input.substr(i,1));
		}
		cout<<decoded<<endl;
	}
	
	// string input, decoded;
	// input ="000555555550000330000444000080000200004440000";
	// for(int i=0;i<input.length();i++){
	// 	// cout<<"char : "<<input.substr(i,1)<<" => "<<kbd.push(input.substr(i,1))<<endl;
	// 	decoded += kbd.push(input.substr(i,1));
	// }
	// cout<<decoded<<endl;
	return 0;
}

Measured memory_bytes: 1224
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader bufReader =
				new BufferedReader(new InputStreamReader(System.in));
		while (true) {
			String read = bufReader.readLine();
			if (read == null) {
				break;
			}
			int n = Integer.parseInt(read);
			int match = 0;
			for (int i = 0; i < 10; i++) {
				for (int j = 0; j < 10; j++) {
					for (int k = 0; k < 10; k++) {
						for (int l = 0; l < 10; l++) {
							if (i + j + k + l == n) {
								++match;
							}
						}
					}
				}
			}
			System.out.println(match);
		}
	}

}

Measured memory_bytes: 18520
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Map;
import java.util.Scanner;
import java.util.HashMap;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main
{
    public static void main(String[] args)
    {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task
    {
        public void solve(int testNumber, Scanner in, PrintWriter out)
        {
            int N = in.nextInt();
            int H[] = CPUtils.readIntArray(N, in);
            Map<Integer, Integer> memo = new HashMap<>();
            out.print(solve(N, 0, 0, H, memo));
        }

        static int solve(int N, int position, int localCost, int cost[], Map<Integer, Integer> memo)
        {
            if (position + 1 == N) return localCost;

            if (memo.containsKey(N - position - 1))
            {
                return localCost + memo.get(N - position - 1);
            }
            int r;
            if (position + 2 < N)
            {
                r = Math.min(solve(N, position + 1, localCost + Math.abs(cost[position] - cost[position + 1]), cost, memo),
                             solve(N, position + 2, localCost + Math.abs(cost[position] - cost[position + 2]), cost, memo));

            } else
            {
                r = solve(N, position + 1, localCost + Math.abs(cost[position] - cost[position + 1]), cost, memo);
            }
            memo.put(N - position - 1, r - localCost);
            return r;
        }

    }

    static class CPUtils
    {
        public static int[] readIntArray(int size, Scanner in)
        {
            int[] array = new int[size];
            for (int i = 0; i < size; i++)
            {
                array[i] = in.nextInt();
            }
            return array;
        }

    }
}



Measured memory_bytes: 79260
#include<stdio.h>
#include<math.h>

int isprime(int);

int main(){
  int n, a, i, b;
  int count=0;

  scanf("%d", &n);

  for(i = 0; i < n; i++){
    scanf("%d", &a);
    b = isprime(a);
    if(b == 1)
      count++;
  }

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

  return 0;

}

int isprime(int x){
  int i;

  if(x == 2)
    return 1;

  if(x < 2 || x % 2 == 0)
    return 0;
  

  i = 3;
  while(i <= sqrt((double)x)){
    if(x % i == 0)
      return 0;
    i = i +2;
  }

  return 1;
}

Measured memory_bytes: 596
import collections
import sys
sys.setrecursionlimit(2000000)
# import math
# import itertools
# import statistics
# import numpy as np
n = int(input())
a = list(map(int, input().split()))
ans = []
for i in range(n):
    ans.append(a[i])
    ans.append(a[i]-1)
    ans.append(a[i]+1)

ans_l = collections.Counter(ans)
print(ans_l.most_common()[0][1])


Measured memory_bytes: 30940