akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

ll n;

int main(){
    while(cin >> n && n){
        vector<vector<ll>> t(n,vector<ll>(n+1));
        vector<vector<ll>> dp(2,vector<ll>(1 << n,INF));
        dp[0][0] = 0;
        rep(i,n){
            rep(j,n+1)cin >> t[i][j];
        }
        rep(i,n){
            rep(j,1 << n){
                rep(k,n){
                    ll nxt = j | (1 << k);
                    ll cost = t[k][0];
                    rep(l,n){
                        if(j & (1 << l))cost = min(cost,t[k][l+1]);
                    }
                    dp[(i+1)%2][nxt] = min(dp[i%2][j]+cost,dp[(i+1)%2][nxt]);
                    dp[(i+1)%2][j] = min(dp[i%2][j],dp[(i+1)%2][j]);
                }
            }
        }
        cout << dp[n%2][(1 << n) - 1] << endl;
    }
}


Measured memory_bytes: 4436
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>

using namespace std;

int main(void) {
    int k, q;
    cin >> k >> q;
    vector<int64_t> d(k);
    for(int i=0; i<k; i++) {
        cin >> d[i];
    }

    while(q--) {
        int64_t n, x, m;
        cin >> n >> x >> m;
        x %= m;
        vector<int64_t> tmp(k);
        for(int i=0; i<k; i++) {
            tmp[i] = d[i] % m;
        }
        int64_t sum = accumulate(tmp.begin(), tmp.end(), 0L);
        int64_t zero = count(tmp.begin(), tmp.end(), 0);
        x += sum * ((n-1) / k);
        zero *= ((n-1) / k);
        for(int i=0; i<(n-1)%k; i++) {
            x += tmp[i];
            if(tmp[i] == 0) zero++;
        }
        cout << n-1 - zero - ((x) / m) << endl;
    }
    return 0;
}


Measured memory_bytes: 384
s = input()

if len(s) == 1:
  print(1)
  exit()

ans = []
ans.append(s[0])
s = s[1:]

n = len(s)
i = 0

while i < n:
  if s[i] == ans[-1]:
    ans.append(s[i:i+2])
    i += 2
  else:
    ans.append(s[i])
    i += 1

if ans[-1] == ans[-2]:
  print(len(ans)-1)
else:
  print(len(ans))

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

class T{

public:
  int indx;
  int point;

  bool operator < (const T &a)const{
    if(point == a.point){
      return indx < a.indx;
    }else{
      return point > a.point;
    }
  }
};

int main(){


  vector<T> result;
  int game[21];
  int m;


  while(cin >> m && m){
    result = vector<T>(m);
    for(int i=0; i<m; i++){
      result[i].point=0;
    }

    for(int i=0; i<m; i++){

      cin>>result[i].indx;

      int indx=0;
      while(indx < 20){

	cin >> game[indx];

	//10game
	if(indx==18){
	  cin >> game[++indx];

	  if(game[indx-1]+game[indx] >= 10){
	    cin >> game[++indx];
	  }
	  else{
	    game[++indx]=0;
	  }
	  break;
	}
	//1 to 9 game
	else{
	  if(game[indx]==10){
	    game[++indx]=-1;
	    indx++;
	  }
	  else{
	    cin >> game[++indx];
	    indx++;
	  }
	}
      }
      //while

      /*  cout << endl;
      for(int m=0; m<21; m++){
	cout << game[m] << ' ';
      }cout << endl;
      */

      //score
      indx = 0;
      while(indx<21){

	if(indx == 18){
	  result[i].point+= game[18]+game[19]+game[20];
	  break;
	}
	else{

	  result[i].point+=game[indx];

	  if(game[indx]==10){
	    int work=0;
	    int k=2;
	    while(work<2){
	      if(game[indx+k]!=-1){
		result[i].point+=game[indx+k];
		work++;
	      }
	      k++;
	    }
	    indx+=2;
	  }
	  else{
	    result[i].point+=game[++indx];
	    if(game[indx-1]+game[indx]==10)
	      result[i].point+=game[indx+1];

	    indx++;
	  }
	}

	//cout << "test " <<result[i][1] << endl;;

      }	
      
    }

    //sort
    sort(result.begin(), result.end());
 
    for(int i=0; i<m; i++){
      cout << result[i].indx << ' ' << result[i].point << endl;
    }

  }


  return 0;
}

Measured memory_bytes: 1216
import java.util.*;
import java.io.*;
public class Main {

	public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		int n = Integer.parseInt(bf.readLine());
 		Map<Integer, Integer> graph = new HashMap<Integer, Integer>();
	 		Set<Integer> no = new HashSet<Integer>();
	 		StringTokenizer st1 = new StringTokenizer(bf.readLine());
	 		ArrayList<Integer> array = new ArrayList<Integer>();
	 		for(int i = 0;i<n;i++){
	 			array.add(Integer.parseInt(st1.nextToken()));
	 			no.add(array.get(i));
	 			if (graph.containsKey(array.get(i))){
	 				graph.put(array.get(i), graph.get(array.get(i))+1);
	 			}
	 			else{
	 				graph.put(array.get(i), 1);
	 			}
	 		}
	 	int removecount = 0;
	 	for(int i : array){
	 		ArrayList<Integer> factors = new ArrayList<Integer>();
	 		for(int j = 1;j*j <= i;j++){
	 			if (i%j == 0){
		 			factors.add(j);
		 			factors.add(i/j);
	 			}
	 		}
	 		for(int j : factors){
	 			if (j!= i && graph.containsKey(j)){
	 				removecount++;
	 				break;
	 			}
	 			else if (j == i && graph.containsKey(j) && graph.get(j) >1){
	 				removecount++;
	 				break;
	 			}
	 		}
	 		
	 	}
	 	out.println(n-removecount);
	 	
	 		
 		out.close();
 		
 		
 		
 	}
}
 	
 
//StringJoiner sj = new StringJoiner(" "); 
//sj.add(strings)
//sj.toString() gives string of those stuff w spaces or whatever that sequence is

 		
 		
 		
 		
	




Measured memory_bytes: 74884
#include<bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int h1, m1, h2, m2, k; cin >> h1 >> m1 >> h2 >> m2 >> k;
  if(h2 < h1) h2 += 24;
  if(h2 == h1 && m1 > m2) h2 += 24;
  if(m1 > m2) {
    h2--;
    m2 += 60;
  }
  int ans = (h2 - h1) * 60 + (m2 - m1);
  cout << max(0, ans - k) << '\n';
}

Measured memory_bytes: 3636
#include <cstdio>
#include <iostream>
using namespace std;
int T[51];
int check[51];
int max_p = 0;

/*
void dfs(int A[], int k, int i, int n,int z){
	int x = 0;
	if(k<= 0) return;

	else {

		
		int y;
		for(int t = i; t <= n; t++){
			y = A[t];
			dfs(A, k-1, t+1, n, z+y);
			
			if(z+y>max_p) max_p = z+y;
		}
			 
		
		return;
	}
}
*/

void sort(int A[],int n){
	for(int i = 0; i < n-1; i++){
		for(int j = n-1; j > i; j--){
			if(A[j] > A[j-1]) swap(A[j], A[j-1]);
		}
	}
}

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

	int i;

	int ans = 0;
	sort(T, N);
	for(int t = 0; t < K; t++){
		ans += T[t];
		
	}


	/*
	for(i = 0; i <= N-K; i++){
		dfs(T,K,0,N,0);
	
		
	}
	*/

	cout << ans << endl;


}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
n, m, s, t = map(int,input().split())
C = [list(map(int,input().split())) for i in range(m)]

s -= 1
t -= 1

# O((V + E)log(V))
# Cは [[スタート頂点, ゴール頂点, 重み], ...] のリスト

M = [[] for i in range(n)]
for i in range(len(C)):
    M[C[i][0]-1].append([C[i][1]-1, C[i][2]])  # 無向グラフなら両方追加
    M[C[i][1]-1].append([C[i][0]-1, C[i][2]])  # 無向グラフなら両方追加

N = [[] for i in range(n)]
for i in range(len(C)):
    N[C[i][0]-1].append([C[i][1]-1, C[i][3]])  # 無向グラフなら両方追加
    N[C[i][1]-1].append([C[i][0]-1, C[i][3]])  # 無向グラフなら両方追加

import heapq

def dijkstra(s, M):
    D = [10**16] * n  # 頂点0からの距離
    P = [-1] * n  # 頂点0からの最短距離において、そこの直前の頂点(経路復元に利用)
    D[s] = 0
    V = [0] * n  # その頂点のD[i]が最短距離と確定したら1
    Q = []  # 優先度付きキュー
    for v in range(n):
        heapq.heappush(Q, [D[v], v])

    le = len(Q)
    while le > 0:
        q = heapq.heappop(Q)
        u = q[1]
        du = q[0]
        if V[u] == 0:
            V[u] = 1
            le -= 1
            for i in range(len(M[u])):
                v = M[u][i][0]
                luv = M[u][i][1]
                if V[v] == 0:
                    alt = du + luv
                    if D[v] > alt:
                        D[v] = alt
                        P[v] = u
                        heapq.heappush(Q, [alt, v])
    return D, P

Ds, _ = dijkstra(s, M)
Dt, _ = dijkstra(t, N)

ANS = [0] * n

# print(Ds,Dt)

ans = 10**16
for i in range(n-1, -1, -1):
    ans = min(ans, Ds[i] + Dt[i])
    ANS[i] = ans

for i in range(n):
    print(10**15 - ANS[i])

Measured memory_bytes: 148940
#include<iostream>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip>//setprecision
#include<math.h>
#include <functional>
#include<climits>
using namespace std;
#define rep(i, n)        for(int i=0; i<(int)(n); ++i)
int main(){ 
  int a,b,c,g=0,h=0;cin>>a>>b;
  bool d[a+1];
  int j[a+1];
  rep(i,a+1){
    d[i]=false;
    j[i]=0;
  }
  string e,f;
  rep(i,b){
    cin>>c>>e;
    if(d[c]==false){
      if(e=="AC"){
      g++;
      d[c]=true;
      }
      else
      {
        j[c]++;
      }
      
    }
  }
  rep(i,a+1){
    if(d[i])h+=j[i];
  }
  cout<<g<<" "<<h;
  }


Measured memory_bytes: 768
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<double> VD;
typedef vector<VD> VVD;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int b, k;
    cin >> b >> k;
    int n = (1 << b);

    if (k != 0 && !(k <= n - 1 && b > 1)){
        cout << -1 << endl;
        return 0;
    }

    VI ans;
    if (k == 0){
        REP(i,n) ans.push_back(i);
        REP(i,n) ans.push_back(n - 1 - i);
    }else{
        ans.push_back(0);
        ans.push_back(k);
        ans.push_back(0);
        FOR(i,1,n-1){
            if (i != k) ans.push_back(i);
        }
        ans.push_back(k);
        FORR(i,n-1,1){
            if (i != k) ans.push_back(i);
        }
    }

    REP(i,2*n) printf("%d ", ans[i]);
    cout << endl;
    return 0;
}


Measured memory_bytes: 2932
#include <iostream>


int main()
{
	int A, B, X;
	std::cin >> A;
	std::cin >> B;
	std::cin >> X;

	if (A <= X && X <= A + B) {
		std::cout << "YES" << std::endl;
	} else {
		std::cout << "NO" << std::endl;
	}

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = Integer.parseInt(scan.next());
		int b = Integer.parseInt(scan.next());
		String ans = "";

		if (a < b) {
			ans = "a < b";
		} else if (a > b) {
			ans = "a > b";
		} else if (a == b) {
			ans = "a == b";
		}

		System.out.println(ans);
	}

}



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

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

  vector<string> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
    sort(a.at(i).begin(), a.at(i).end());
  }

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

  int64_t ans = 0, tmp = 0;
  for (int i = 0; i < n-1; i++) {
    if(a.at(i) == a.at(i+1)){
      tmp++;
      if (i == n-2){
        ans += (tmp+1)*tmp / 2;
      }
    }
    else{
      ans += (tmp+1)*tmp / 2;
      tmp = 0;
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 7296
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}

import Control.Applicative
import Control.Monad
import Control.Arrow
import Data.List
import Data.Maybe
import Data.Char
import qualified Data.ByteString.Char8 as B
import Text.Printf

readInt = ( readLn :: IO Int )
readInts = map ( read :: String -> Int ) . words <$> getLine

getList = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	getLine
	s <- getLine
	let
		turn_l = map ( which 1 0 . ( == 'E' ) ) s
		turn_r = map ( 1 - ) turn_l
	print $ minimum $ zipWith (+) ( tail $ scanr (+) 0 turn_l ) ( scanl (+) 0 turn_r )

Measured memory_bytes: 83452
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  long long ans=0;
  cin>>n>>k;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  sort(a.begin(),a.end());
  for(int i=0;i<k;i++){
    ans+=a[i];
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3692
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

int main(){
	int n;
	cin>>n;
	vl a(n), b(n);
	rep(i, n) cin>>a[i]>>b[i];
	ll cnt = 0LL;
	for(int i = n-1; i >= 0; i--){
		a[i]+=cnt;
		if(a[i] % b[i] == 0) continue;
		ll t = a[i]/b[i]+1LL;
		t *= b[i];
		cnt += t - a[i];
	}
	cout<<cnt<<endl;
}


Measured memory_bytes: 1792
import java.math.BigInteger;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {
	Integer steps[];
	Map<Integer, BigInteger> map;

	public Main(int n, Integer a[]) {
		steps = new Integer[n];
		map = new TreeMap<>();
		for (int i = 0; i < steps.length; i++) {
			steps[i] = 1;
		}
		for (int e : a) {
			steps[e] = 0;
		}

	}

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int m = s.nextInt();
		Integer a[] = new Integer[m];
		for (int i = 0; i < m; i++) {
			a[i] = s.nextInt();
		}
		System.out.println(
				new Main(n, a).calc(0).mod(new BigInteger("1000000007")));
	}

	public BigInteger calc(int prefix) {
		BigInteger shortcut = map.get(prefix);
		BigInteger result;
		if (shortcut != null) {
			return shortcut;
		}
		if (prefix >= steps.length) {
			result = BigInteger.ZERO;
		} else if (prefix == steps.length - 1) {
			result = BigInteger.ONE;
		} else if (prefix == steps.length - 2) {
			result = BigInteger.ONE
					.add(((steps[prefix + 1] == 1) ? BigInteger.ONE
							: BigInteger.ZERO));
		} else {
			result = ((steps[prefix + 1] == 1) ? calc(prefix + 1)
					: BigInteger.ZERO)
							.add((steps[prefix + 2] == 1) ? calc(prefix + 2)
									: BigInteger.ZERO);
		}
		map.put(prefix, result);
		return result;
	}
}

Measured memory_bytes: 727680
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    int a,b;
    cin>>a>>b;
    if (a<=b)
        cout<<a<<endl;
    else
        cout<<a-1<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=302,INF=100000001;
long long int a[100100],ans=-1,dp[100100];
vector<int> v;
int used[1000100];
int main(){
   int n,W;
   cin>>n>>W;
   int w,c;
   for(int i=1;i<=n;i++){
   	cin>>w>>c;
   	for(int j=W-w;j>=0;j--){
	   	dp[j+w]=max(dp[j]+c,dp[j+w]);
			if(j+w<=W){
				ans=max(ans,dp[j+w]);
			}		
		}
	}
	cout<<ans;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
const int MAXN=100;
int N;char s[MAXN];int Cnt[30];
void dfs(int x)
{
	if (x==N+1)
	{
		for (int i=1;i<=N;++i) printf("%c",s[i]);
		printf("\n");
		return ;
	}
	for (int i=1;i<=26;++i)
	{
		s[x]='a'+i-1;
		++Cnt[i];
		dfs(x+1);
		--Cnt[i];
		if (!Cnt[i]) break;
	}
}
int main()
{
	cin>>N;
	Cnt[0]=1;
	dfs(1);
	return 0;
}

Measured memory_bytes: 1536
#include <iostream>
#include <cstdio>
#include <string>
#include <bits/stdc++.h>
#include <set>
#include <list> //list<???> a; a.push_back ,insert(追加したい要素),a.sort(),参照できない
#include <vector> //vector<???> a; a.push_back,sort(a.begin(),a.end());a[i]
//配列 int a[N];a[i]=追加したい要素;sort(a,a+N);a[i]
const int MOD = 1e9+7;
using namespace std;
typedef long  ll;
#define rep(i,n) for(int i=0;i<(n);i++)


//using namespace std;
//


int main(){
  int N,M;cin>>N>>M;
  string A[N];
  int flag=0;
  for(int i=0;i<N;i++){
    cin>>A[i];
  }

  for(int i=0;i<M;i++){
    string b;cin>>b;
    for(int j=0;j<=N-M;j++){
      if(b==A[i].substr(j,M)){
        flag+=1;
;
        break;
      }
    }

  }
  if(flag==M){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }

}

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

int main() {
	double a, b, c, d, e, f, x, y;
	while (cin >> a >> b >> c >> d >> e >> f) {
		x = (double)(c*e - b*f) / (a*e - b*d);
		y = (double)(a*f - c*d) / (a*e - b*d);
		if (-0.001<x && 0.001>x) {
			x = 0;
		}if (-0.001<y && 0.001>y) {
				y = 0;
			}
		printf("%.3lf %.3lf\n", x, y);
	}
	return 0;
}

Measured memory_bytes: 1236
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cmath>
#define ll long long int
#define eps 1e-7
#define rep(i, a, b) for(int i = (a); i <= (b); ++ i)
#define dwn(i, a, b) for(int i = (a); i >= (b); -- i)
using namespace std;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if(a + b + c >= 22) cout << "bust" << endl;
    else cout << "win" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>

using namespace std;
using ll = long long;

int main()
{
    while (true) {
        int N;
        cin >> N;
        if (N == 0) {
            break;
        }
        int W, H;
        cin >> W >> H;
        vector<vector<int>> num(H, vector<int>(W, 0));
        for (int i = 0; i < N; i++) {
            int x, y;
            cin >> x >> y;
            x--, y--;
            num[y][x]++;
        }
        int S, T;
        cin >> S >> T;
        int maxi = 0;
        for (int i = 0; i + T - 1 < H; i++) {
            for (int j = 0; j + S - 1 < W; j++) {
                int cnt = 0;
                for (int k = 0; k < T; k++) {
                    for (int l = 0; l < S; l++) {
                        cnt += num[i + k][j + l];
                    }
                }
                maxi = max(maxi, cnt);
            }
        }
        cout << maxi << endl;
    }
    return 0;
}

Measured memory_bytes: 3208
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define fr(i,n,m) for(ll i=n;i<m;i++)
int main()
{
    char s[100];
    scanf("%s",s);
    if (s[0] == 'a'||s[0] == 'e'||s[0]== 'i'||s[0] == 'o'||s[0] == 'u'){
        puts("vowel");
    } else {
        puts("consonant");
    }
    return 0;
}

Measured memory_bytes: 1588
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>
 
#define MP make_pair
#define PB push_back
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP1(i,n) for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n) for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
 
using namespace std;
 
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

int main(){
    int n;
    int a;
    int cnt = 0;
    cin >> n;
    REP(i,n){
        cin >> a;
        if(a % 2 !=0){
            cnt++;
        }
    }
    if(cnt%2!=0){
        cout << "NO" << endl;
    }
    else{
        cout << "YES" << endl;
    }
	return 0;
}

Measured memory_bytes: 256
from typing import List


def judge(c: int, m: int, b: List[int], a: List[int]) -> bool:
    result = c
    for i in range(m):
        result += a[i] * b[i]

    return 0 < result


def answer(n: int, m: int, c: int, b: List[int], a: List[List[int]]) -> int:
    count = 0
    for i in range(n):
        if judge(c, m, b, a[i]):
            count += 1

    return count


def main():
    n, m, c = map(int, input().split())
    b = list(map(int, input().split()))
    a = [list(map(int, input().split())) for _ in range(n)]

    print(answer(n, m, c, b, a))


if __name__ == '__main__':
    main()


Measured memory_bytes: 10264
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll w,h,x,y;
int main()
{
    scanf("%lld%lld%lld%lld",&w,&h,&x,&y);
    double t=(double)w*h/2;
    ll flag=0;
    if(x*2==w&&y*2==h)
        flag=1;
    printf("%.6f %lld",t,flag);
    return 0;
}


Measured memory_bytes: 256
// #include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define exf(x)	 for(auto&& tmp : x) { cout << tmp << endl; }	// 拡張for
#define PI 3.14159265358979323846264338327950288
const int MOD{ int(1e9 + 7) };	// = 1000000007
const int inf{ 2100000000 };	// = 2100000000 (MAX:2147483647)
typedef long long ll;
using namespace std;

// -------------------------------------------------- //
// ------------------ ここから本編 ------------------ //
// -------------------------------------------------- //

ll sumVec(vector<int> v) {
	ll sum = 0;
	for (size_t i = 0; i < v.size(); i++) sum += v[i];
	return sum;
}

int main(void) {

	int N, M; cin >> N >> M;
	priority_queue<int> A;
	rep(i, N) {
		int a;
		cin >> a;
		A.push(a);
	}
	
	while (M) {
		int tmp = A.top();
		A.pop();
		A.push(tmp/2);
		M--;
	}

	ll sum = 0;
	while (!A.empty()) {
		sum += A.top();
		A.pop();
	}
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 3936
package main

import "fmt"

var A, B, C, D int

func main() {
	fmt.Scanf("%d", &A)
	fmt.Scanf("%d", &B)
	fmt.Scanf("%d", &C)
	fmt.Scanf("%d", &D)

	ans := 0
	if A > B {
		ans += B
	} else {
		ans += A
	}

	if C > D {
		ans += D
	} else {
		ans += C
	}

	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <iostream>
#include <stdio.h>

#include <vector>
#include <cctype>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <string>

#include <climits>

using namespace std;

int main()

{
	int n, x;
	
	cin >> n >> x;

	vector<int> m(n);

	for (int i = 0; i < n; i++) {
		cin >> m[i];
	}

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

	int sum = 0;
	int count = 0;
	for (int i = 0; i < n; i++) {
		sum = sum + m[i];
		count++;
	}

	int sumsum = x - sum;

	if (sumsum > 0) {
			count=count+sumsum/m[0];
	}

	cout << count << endl;

	return 0;

}

Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<algorithm>
using Int = long long;

int main() {

	Int A, B, C, D, E, F;

	std::cin >> A >> B >> C >> D >> E >> F;

	long double max_density = (long double)(E * 100) / (long double)(100 + E);
	long double ans_density = 0;
	Int ans_sum = 0;
	Int ans_sugar = 0;
	Int number_a = F / 100 / A;
	Int number_b = F / 100 / B;
	Int number_c = F / C;
	Int number_d = F / D;

	for (Int a = 0; a <= number_a; a++) {
		for(Int b=0;b<=number_b;b++){
			long double sum = 100 * A * a + 100 * B * b;
			if (sum > F)break;

			if (100 * A * a + 100 * B * b > 0) {
				for (Int c = 0; c <= number_c; c++) {
					long double sum = 100 * A * a + 100 * B * b + C * c;
					if (sum > F)break;

					for (Int d = 0; d <= number_d; d++) {
						long double sum = 100 * A * a + 100 * B * b + C * c + D * d;
						if (sum > F)break;

						long double sugar = C * c + D * d;
						long double density = sugar*100 / sum;
						if (density >= ans_density && density <= max_density) {
								ans_density = density;
								ans_sum = sum;
								ans_sugar = sugar;
						}
					}
					
				}
				
			}
		}
	}

	std::cout << ans_sum <<" "<< ans_sugar << std::endl;

}

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

int main(){
  string x, y;
  cin >> x >> y;
  x = "0x" + x;
  y = "0x" + y;

  int a, b;
  a = stoi(x, nullptr, 16);
  b = stoi(y, nullptr, 16);
  
  if (a < b){
    cout << "<";
  } else if (a == b){
    cout << "=";  
  }else{
    cout << ">";
  }
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
using namespace std;
const int N=200005;

struct aa
{
	int c,id;
}a[N];
bool cmp(const aa &x,const aa &y) 
{
	return x.c<y.c;
}

int pos[N],n;

int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&a[i].c);
		a[i].id=i;
	}
	int mid=n/2;
	sort(a+1,a+n+1,cmp);
	for (int i=1;i<=n;i++) pos[a[i].id]=i;
	for (int i=1;i<=n;i++) 
	{
		if (pos[i]<=mid) printf("%d\n",a[mid+1]);
		else printf("%d\n",a[mid]);
	}
	return 0;
}

Measured memory_bytes: 4480
#include <iostream>

int main() {
	long long int n, m;
	std::cin >> n >> m;
	if (n == 1) {
		if (m == 1) std::cout << 1 << std::endl;
		else std::cout << m - 2 << std::endl;
	}
	else {
		if (m == 1) std::cout << n - 2 << std::endl;
		else std::cout << (n - 2) * (m - 2) << std::endl;
	}
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
    using namespace std;
    typedef pair<int,int>pii;
    string s,ss,s2,t,ans,ff;
    vector<pii>v;
    int n,k,i,z,l;
    char mn=127;
    int main(){
    	ios::sync_with_stdio(0);cin.tie(0);
    	cin>>n>>k>>s;ss=s;reverse(ss.begin(),ss.end());ss=s+ss;
    	for(char c:s)mn=min(mn,c);
    	for(i=0;i<n;++i)if(s[i]==mn)v.push_back(pii(++z,i));else z=0;
    	sort(v.begin(),v.end());
    	if(k>15 || (v.back().first<<k-1)>=n){for(i=0;i<n;++i)cout<<mn;return 0;}
    	if(z){
    		if((z<<k)>=n){for(i=0;i<n;++i)cout<<mn;return 0;}
    		l=n-(z<<k);
    		ff=string(n-l,mn)+ss.substr(n+z,l);
    	}else ff=s;
    	l=n-(v.back().first<<k-1);
    	for(pii u:v)if(u.first==v.back().first){
    		t=ss.substr(n*2-1-u.second-l,l);reverse(t.begin(),t.end());
    		if(s2.empty() || t<s2)s2=t;
    	}
    	ans=min(string(n-l,mn)+s2,min(s,ff));
    	cout<<ans<<endl;
    	return 0;
    }

Measured memory_bytes: 384
n=int(input())
seen=[-1]*n
first_order=[0]*n
last_order=[0]*n
cnt=0
def dfs(G,s):
    global cnt
    first_order[s]=cnt+1
    cnt+=1
    seen[s]=1
    for nv in G[s]:
        if(seen[nv]!=-1):
            continue
        dfs(G,nv)
    last_order[s]=cnt+1
    cnt+=1

G=[[] for i in range(n)]
for i in range(n):
    li=list(map(int,input().split()))
    for x in range(2,len(li)):
        G[i].append(li[x]-1)
for i in range(n):
    if(seen[i]==-1):
        dfs(G,i)
for i in range(n):
    print(i+1,first_order[i],last_order[i])


Measured memory_bytes: 5716
#include<bits/stdc++.h>
#define FI first
#define SE second
using namespace std;

int ans,c,pan,k;
vector<pair<int,int> > com;
string x;
char pre;

int main(){
	scanf("%d%d",&pan,&k);
	cin>>x;
	pre = x[0];
	for(int i =0;i<pan;i++){
		if(x[i]!=pre){
			com.push_back({pre-'0',c});
			c = 0;
		}
		c++;
		pre = x[i];
	}
	com.push_back({pre-'0',c});

	int st = 0,ed = 0;
	int now = 0;
	c =0;
	while(ed<com.size()){
//		printf("st ed %d===%d\n",st,ed);
		if(com[ed].FI==0){
//			printf("nolllll\n");
			if(c==k){
				now -=com[st].SE;
//				printf(">> %d\n",now);
				if(com[st].FI==0){	
					c--;	
				}
				st++;
			} else{
				c++;
				now +=com[ed].SE;
//				printf(">> %d\n",now);
				ans = max(now,ans);
				ed++;
			}
		} else {
			now +=com[ed].SE;
//			printf(">> %d\n",now);
			ans = max(now,ans);
			ed++;
		}
	}
	printf("%d\n",ans);
	return 0;
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define int long long
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;

signed main(){
	int n,k;
	string s;
	cin >> n >> k >> s;
	int cnt = 0;
	k *= 2;
	rep(i,n-1){
		if(s[i] == s[i+1]) ++cnt;
		else{
			if(k > 0){
				--k;
				++cnt;
			}
		}
	}
	cout << cnt << '\n';
	return 0;
}



Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main {

	public static void main(String[] args) {
		FastReader sc = new FastReader();
		int n = sc.nextInt();
		long m = sc.nextLong();
		Point[] points = new Point[n];
		for (int i = 0; i < n; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			points[i] = new Point(a, b);
		}
		Arrays.sort(points);
		long cost = 0;
		long number = 0;
		int i = 0;
		while (number < m) {
			if (number + points[i].num > m) {
				points[i].num = m - number;
			}
			number += points[i].num;
			cost += points[i].cost * points[i].num;
			i++;
		}
		System.out.println(cost);
		

	}
	static class Point implements Comparable<Point> {
		long cost;
		long num;
		Point (long c, long n) {
			cost = c;
			num = n;
		}
		
		public int compareTo (Point p) {
			return (int)(cost - p.cost);
		}
	}
	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;
        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 44908
import bisect

n = int(input())
a_list = [int(input()) for i in range(n)]


def lis(n, A):
    L = [0 for i in range(n + 1)]
    L[0] = A[0]
    length = 1
    for i in range(1, n):
        if L[length - 1] < A[i]:
            L[length] = A[i]
            length += 1
        else:
            index = bisect.bisect_left(L, A[i], 0, length - 1)
            L[index] = A[i]
    return length


print(lis(n, a_list))



Measured memory_bytes: 10360
import heapq

def main():
    N = int(input())
    v = list(map(int, input().split()))
    heapq.heapify(v)
    for i in range(N-1):
        x = heapq.heappop(v)
        y = heapq.heappop(v)
        heapq.heappush(v, (x+y)/2)
    ans = heapq.heappop(v)
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include<iostream>
#include <algorithm>
#include <string>
#define rep(i,n)for(i=0;i<n;i++)
using namespace std;
int main() {
	int a,b;
    cin >> a >> b;
    if (a == b) {
        cout << "Draw" << endl;
    }
    else if (a == 1) {
        cout << "Alice" << endl;
    }
    else if (b == 1) {
        cout << "Bob" << endl;
    }
    else {
        if (a > b) {
            cout << "Alice" << endl;
        }
        else {
            cout << "Bob" << endl;
        }
    }
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#ifdef LOCAL
#include<debug.h>
#else
#define db(...) 21
#endif
#define found(m,x) ((m).find(x)!=(m).end())
#define uset unordered_set
#define umap unordered_map
#define a(x) x.begin(),x.end()
#define fo(i,n) for(int i=0;i<(int)n;i++)
#define Fo(i,k,n) for(int i=k;k<n?i<=(int)n:i>=(int)n;k<n?i++:i--)
#define input(v,n) fo(i,n)cin>>v[i]
typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pi;

const int nax = 1e6+7;
const int mod = 1e9+7; //1e9+2667 :: 0xcf : inf, 0xc0 -inf
const int inf = numeric_limits<int> :: max() - (int)1e3;
// ===================== MANASH =================== //

int n,m;
void test() {

	cin >> n;
	map<int,int> cnter;
	vector<int> er(n);
	for( int i = 0; i < n; i++) {
		cin >> m;
		er[i] = m;
		cnter[m]++;
	}
	if(found(cnter,1)) {
		cout << (cnter[1] == 1);
		return;
	}
	sort(a(er));
	int maxe = cnter.rbegin()->first;
	for( int e : er ) {
		if(!found(cnter,e)) continue;
		for( int i = e*2; i <= maxe; i+=e) {
			cnter.erase(i);
		}
	}
	set<int> s;
	for( pi p : cnter) if ( p.second == 1 ) {
		s.insert(p.first);
	}
	if ( s.empty()) {
		cout << 0;
		return;
	}
	cout << s.size();

}

signed main() {

	ios_base :: sync_with_stdio(false);
	cin.tie(NULL);

	#ifdef LOCAL
	freopen("input.txt","r",stdin);
	cout<<"Time Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec.\n";
	#endif

	int T = 1;
	//cin >> T;
	while(T--) {
		test();
		cout << "\n";
	}
	return 0;

}


Measured memory_bytes: 26540
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = input()

for i in range(1, len(S)):
	T = S[:-2*i]
	if T[:len(T)//2] == T[len(T)//2:]:
		print(len(T))
		break


Measured memory_bytes: 5260
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const ll mo = 1000000007;
auto mod = [](ll modx) {modx%=mo;modx+=mo;modx%=mo;return modx; };
ll mypow(ll a, ll b)
{
  ll res = 1;
  a %= mo;
  while (b)
  {
    if (b & 1)
      res = res * a % mo;
    a = a * a % mo;
    b >>= 1;
  }
  return res;
}
vector<ll> factorial(ll n)
{
  vector<ll> fac;
  fac.push_back(1);
  for (ll i = 1; i < n + 10; i++)
  {
    fac.push_back((fac[i - 1] * i) % mo);
  }
  return fac;
}
auto modmul = [](auto... modx) {
  ll res = 1;
  for (auto modx_ : {modx...})
  {
    res *= modx_;
    res %= mo;
    res += mo;
    res %= mo;
  }
  return res;
};
int main()
{
ll n ;
cin >> n ;
vector<ll> ans(n,0);

vector<vector<ll>> g(n);
rep(i, n-1)
{
  ll a, b;
  cin >> a >> b;
  g[a - 1].push_back(b - 1);
  g[b - 1].push_back(a - 1); 
}
vector<ll> fac = factorial(n);

vector<vector<ll>> child(n);
vector<ll> par(n);
vector<ll> k(n,1);
vector<ll> kk(n,1);
ll root=0;
queue<ll> q;
queue<ll> qq;
q.push(root);
par[root]=-1;
//親の定義と葉を見つける
while(!q.empty()){
  ll p=q.front();
  q.pop();
  if(g[p].size()==1 && p!=root){qq.push(p);}
  for(auto r:g[p]){
    if(r==par[p])continue;
    par[r]=p;
    q.push(r);
  }
}
while(!qq.empty()){
  ll p=qq.front();
  qq.pop();
  child[par[p]].push_back(p);//親に値を追加する
  //根の時は例外処理
  if(child[par[p]].size()==g[par[p]].size()){
    ll te=1,nu=1;
    for(auto r:child[par[p]]){
      te*=k[r];
      te%=mo;
      nu+=kk[r];
    }
    kk[par[p]]=nu;
    k[par[p]]=(nu*te)%mo;
  }
  //全ての葉が親に追加し終わった
  if(child[par[p]].size()==g[par[p]].size()-1 && par[p]!=root){
    ll te=1,nu=1;
    for(auto r:child[par[p]]){
      te*=k[r];
      te%=mo;
      nu+=kk[r];
    }
    kk[par[p]]=nu;
    k[par[p]]=(nu*te)%mo;
    qq.push(par[p]);
  }
}

ll tee=1,nuu=1;
for(auto r:g[root]){
  tee*=k[r];
  tee%=mo;
  nuu+=kk[r];
}
kk[root]=nuu;
k[root]=(nuu*tee)%mo;

vector<ll> t(n,1);
vector<ll> tt(n,1);

vector<bool> see(n);
par[root]=-1;
see[root]=1;
q.push(root);
while(!q.empty()){
  auto p=q.front();
  q.pop();
  ll te=1;
  for(auto r:g[p]){
    if(par[p]==r){te*=t[p];te%=mo;}
    else {te*=k[r];te%=mo;}
  }
  ans[p]=(fac[n-1]*mypow(te,mo-2))%mo;
  for(auto r:g[p]){
    if(see[r]!=0)continue;
    par[r]=p;
    see[r]=1;
    q.push(r);
    tt[r]=n-kk[r];
    t[r]=modmul(k[p],tt[r],mypow(kk[p],mo-2),mypow(k[r],mo-2),t[p]);
  }
}
for(auto r:ans)cout << r << endl;
return 0;
}

Measured memory_bytes: 34036
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define repr(i, a, b) for(ll i = (a); i < (b); i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
inline ll GCD(ll a, ll b){ return b?GCD(b, a % b):a; }
inline ll LCM(ll a, ll b){ return a/GCD(a, b)*b; }
inline ll powint(ll x, ll y){ ll r=1; while(y){ if(y&1) r*=x; x*=x; y>>=1; } return r; }
inline ll powmod(ll x, ll y, ll m = MOD){ ll r=1; while(y){ if(y&1) r*=x; x*=x; r%=m; x%=m; y>>=1; } return r; }
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; }
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n, k;
    cin >> n >> k;
    vll a(n);
    map<ll, ll> mp;
    rep(i, n){
        cin >> a[i];
        mp[a[i]]++;
    }
    vll c;
    for(auto&& e: mp){
        c.emplace_back(e.second);
    }
    sort(ALL(c), greater<ll>());
    ll ans = n;
    rep(i, min(k, SZ(c))){
        ans -= c[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 16500
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define inf 1e9
int main(){
ll N=0;cin>>N;
ll a[N][3];
for(ll i=0;i<N;++i){
	a[i][0]=a[i][1]=a[i][2]=0;
	cin>>a[i][0]>>a[i][1]>>a[i][2];
}
ll dp[N][3];
for(ll i=0;i<N;++i){
	dp[i][0]=dp[i][1]=dp[i][2]=0;
}
dp[0][0]=a[0][0];dp[0][1]=a[0][1];dp[0][2]=a[0][2];
for(ll i=1;i<N;++i){
	for(int j=0;j<3;++j){
		ll option1= (j==0)?0:dp[i-1][0];
		ll option2= (j==1)?0:dp[i-1][1];
		ll option3= (j==2)?0:dp[i-1][2];
		dp[i][j]=a[i][j]+max(option1,max(option2,option3));
	}		
}
cout<<max(dp[N-1][0],max(dp[N-1][1],dp[N-1][2]))<<endl;
return 0;
}

Measured memory_bytes: 4992
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		long a = Long.parseLong(sc.next());
		double b = Double.parseDouble(sc.next());
		long c = (long)Math.round(b*100);
		a = a * c;
		a /= 100;
		System.out.println(a);
		
	}


}


Measured memory_bytes: 35572
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main(){
	int n, m; scanf("%d%d", &n, &m);
	if(n > m) printf("No\n");
	else printf("Yes\n");
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
using namespace std;
int c,n,m,s,t;
int dp[11][100];
main()
{
	while(cin>>c>>n>>m>>s>>t,c)
	{
		for(int i=0;i<=c;i++)for(int j=0;j<n;j++)dp[i][j]=1e9;
		vector<vector<pair<int,int> > >G(n);
		for(int i=0;i<m;i++)
		{
			int u,v,C;cin>>u>>v>>C;
			u--,v--;
			G[u].push_back(make_pair(v,C));
			G[v].push_back(make_pair(u,C));
		}
		s--,t--;
		priority_queue<pair<int,pair<int,int> > >P;
		P.push(make_pair(0,make_pair(s,c)));
		dp[c][s]=0;
		while(!P.empty())
		{
			int d=-P.top().first,u=P.top().second.first,s=P.top().second.second;
			P.pop();
			for(int i=0;i<G[u].size();i++)
			{
				int cost=G[u][i].second;
				int v=G[u][i].first;
				if(s>0)
				{
					if(dp[s-1][v]>d+cost/2)
					{
						dp[s-1][v]=d+cost/2;
						P.push(make_pair(-dp[s-1][v],make_pair(v,s-1)));
					}
				}
				if(dp[s][v]>d+cost)
				{
					dp[s][v]=d+cost;
					P.push(make_pair(-dp[s][v],make_pair(v,s)));
				}
			}
		}
		int ans=1e9;
		for(int i=0;i<=c;i++)ans=min(ans,dp[i][t]);
		cout<<ans<<endl;
	}
}




Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  string w;
  cin>>w;
  map<char,int> t;
  int si=w.size();
  rep(i,si){
    if(t.find(w[i])==t.end()){
      t[w[i]]=1;
    }
    else{
      t[w[i]]++;
    }
  }
  rep(i,si){
    if(t[w[i]]%2!=0){
      cout<<"No";
      return(0);
    }
  }
  cout<<"Yes";
  return(0);
}


Measured memory_bytes: 256
#include <iostream> 
#include <cstdio> 
#include <cstdlib> 
#include <cstring> 
#include <cmath> 
#include <algorithm> 
using namespace std; 
const int Mod = 924844033; 
const int MAX_N = 4e3 + 5; 
int N = 4e3, K, fac[MAX_N]; 
int len[MAX_N], tot, cnt; 
int f[MAX_N][MAX_N][2]; 
int main () { 
	fac[0] = 1; for (int i = 1; i <= N; i++) fac[i] = 1ll * fac[i - 1] * i % Mod; 
	cin >> N >> K; 
	for (int i = 1; i <= N; i++) { 
		int l = i + K, r = i - K; 
		if (l <= N && r >= 1) len[l] = len[r] + 2, len[r] = 0; 
		else if (l <= N && l >= 1) len[l]++; 
		else if (r <= N && r >= 1) len[r]++; 
	} 
	for (int i = 1; i <= N; i++) cnt += len[i], tot += (len[i] + 1) / 2; 
	f[0][0][0] = 1; 
	for (int i = 1, cur = 0; i <= N; i++) { 
		for (int j = cur + 1; j <= cur + len[i]; j++) { 
			for (int k = 0; k <= tot; k++) { 
			    f[j][k][0] = (f[j - 1][k][1] + f[j - 1][k][0]) % Mod; 
				if (k) f[j][k][1] = f[j - 1][k - 1][0]; 
				if (j == cur + 1 && k) f[j][k][1] = (f[j - 1][k - 1][1] + f[j][k][1]) % Mod; 
			} 
		} 
		cur += len[i]; 
	} 
	int ans = 0; 
	for (int i = 0, op = 1; i <= tot; i++, op = Mod - op) { 
		int res = (f[cnt][i][0] + f[cnt][i][1]) % Mod; 
		ans = (ans + 1ll * op * res % Mod * fac[N - i]) % Mod; 
	} 
	printf("%d\n", ans); 
    return 0; 
} 

Measured memory_bytes: 124544
import java.util.Scanner;

public class Main {

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

		if (x < 1200) {
			System.out.println("ABC");
		} else {
			System.out.println("ARC");
		}

	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をlongで返却
	 *
	 * @return
	 */
	public static long getLong(Scanner sc) {

		return Long.parseLong(sc.next());
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をintで返却
	 *
	 * @return
	 */
	public static int getInt(Scanner sc) {

		return Integer.parseInt(sc.next());
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をStringで返却
	 *
	 * @return
	 */
	public static String getString(Scanner sc) {

		return sc.next();
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をint配列で返却
	 *
	 * @return
	 */
	public static int[] getIntArray(Scanner sc) {
		String line = "";
		// 直前にnext()を実行していると改行コードだけ取ってしまうのでその対策
		while (line.equals("")) {
			line = sc.nextLine();
		}

		String[] strArray = line.split(" ");
		int[] intArray = new int[strArray.length];
		for (int i = 0; i < strArray.length; i++) {
			intArray[i] = Integer.parseInt(strArray[i]);
		}
		return intArray;
	}

}


Measured memory_bytes: 21716
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>

using namespace std;
using ll=int64_t;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using mii = map<int, int>;
using vi=vector<int>;
using vii=vector<vi>;
using vl=vector<ll>;
using vll=vector<vl>;
using tpi=tuple<int, int, int>;

int main() {
    string S;
    cin >> S;
    int ans = 7;
    if (S == "MON") {
        ans = 6;
    } else if (S == "TUE") {
        ans = 5;
    } else if (S == "WED") {
        ans = 4;
    } else if (S == "THU") {
        ans = 3;
    } else if (S == "FRI") {
        ans = 2;
    } else if (S == "SAT") {
        ans = 1;
    }

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


Measured memory_bytes: 888
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

int main()
{
    int W;
	for(int caseNum = 1; cin >> W && W; caseNum++)
	{
		int N;
		cin >> N;
		
		vint prv(W + 1, 0);
		
		
		rep(i, N)
		{
			vint nxt(prv);
			int val, wei;
			char k;
			
			cin >> val >> k >> wei;
			
			rep(j, W - wei + 1)
			{
				if(j == 0 || prv[j] != 0)
				{
					chmax(nxt[j + wei], prv[j] + val);
				}
			}
			
			prv = nxt;
		}
		
		
		int val = 0, wei;
		rep(i, W + 1)
		{
			if(val < prv[i])
			{
				wei = i;
				val = prv[i];
			}
		}
		
		
		cout << "Case " << caseNum << ":\n" << val << endl << wei << endl;
	}
}

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

#define rep(i,N) for(int (i)=0;(i)<(N);(i)++)
#define repi(i,j,N) for(int (i)=(j);(i)<(N);(i)++)
#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define ll long long
#define numberofdigits(x) floor(log10(x)) + 1


typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;

const char nl = '\n';

void solve() {
    int d,t,s;cin>>d>>t>>s;

    if(s>=(double)d/t)
        cout<<"Yes"<<nl;
    else
        cout<<"No"<<nl;
}

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

//    int t;cin>>t;
//    while(t--) {
	solve();
//    }
    return 0;
}


Measured memory_bytes: 3616