akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string.h>

const long long INF = __LONG_LONG_MAX__;

using namespace std;

void chmax(int& a, int b) {
    if(a < b) {
        a = b;
    }
    return;
}

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

    int dp[s.size() + 1][t.size() + 1];
    for (int i = 0; i < s.size() + 1; i++) {
        for (int j = 0; j < t.size() + 1; j++) {
            dp[i][j] = 0;
        }
    }  

    for(int i = 0; i < s.size(); i++) {
        for (int j = 0; j < t.size(); j++) {
            if(s[i] == t[j]) {
                chmax(dp[i+1][j+1], dp[i][j] + 1);
            }
            chmax(dp[i+1][j+1], dp[i][j+1]);
            chmax(dp[i+1][j+1], dp[i+1][j]);
        }   
    }

    string result = "";
    int i = s.size();
    int j = t.size();

    while(i > 0 && j > 0) {
        if(dp[i][j] == dp[i-1][j]) {
            i--;
        } else if (dp[i][j] == dp[i][j-1]) {
            j--;
        } else {
            result = s[i-1] + result;
            i--;
            j--;
        }
    }

    cout << result << endl;

    return 0;
}

Measured memory_bytes: 35456
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using vec=vector<ll>;
using mat=vector<vec>;
#define For(i,a,b) for(i=a;i<b;i++)
#define bFor(i,a,b) for(i=a;i>=b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define mod 1000000007
#define endl "\n"
#define output(v) do{bool f=0;for(auto i:v){cout<<(f?" ":"")<<i;f=1;}cout<<endl;}while(0)
using datas=pair<ll,ll>;
using tdata=pair<ll,datas>;

int main(){
  ll i,j,k,N,M,R,d,ans=LLONG_MAX;
  cin>>N>>M>>R;
  vec rlis(R);
  mat v(N,vec(N,2*pow(10,10)));
  rep(i,R){
    cin>>rlis[i];
    rlis[i]--;
  }
  vsort(rlis);
  rep(i,M){
    cin>>j>>k>>d;
    v[j-1][k-1]=d;
    v[k-1][j-1]=d;
  }
  rep(i,N){
    v[i][i]=0;
  }
  rep(k,N){
    rep(i,N){
      rep(j,N){
        v[i][j]=min(v[i][j],v[i][k]+v[k][j]);
      }
    }
  }
  do{
    d=0;
    rep1(i,R){
      d+=v[rlis[i-1]][rlis[i]];
    }
    ans=min(ans,d);
  }while(next_permutation(all(rlis)));
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 512
n, m = map(int, input().split())

ac = 0
wa = 0
acs = [0] * n
was = [0] * n
for _ in range(m):
    p, s = input().split()
    p = int(p) - 1
    if s == 'AC':
        if not acs[p]:
            ac += 1
            wa += was[p]
            acs[p] += 1
    else:
        if not acs[p]:
            was[p] += 1
print(ac, wa)


Measured memory_bytes: 77476
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n,m) for(int i=n;i<m;i++)
#define repn1(i,n,m) for(int i=n;i<=m;i++)
using namespace std;
typedef long long ll;
const int INF = 1e+8;

ll dp[1000][1000];

int main(){

	int w,h,n;
	int x[1000], y[1000];
	int res = 0;

	cin >> w >> h >> n;
	
	rep(i,n) cin >> x[i] >> y[i];

	repn(i,1,n){
		int dx = abs(x[i]-x[i-1]), dy = abs(y[i]-y[i-1]);
		
		if((x[i]>=x[i-1]&&y[i]>=y[i-1])||(x[i]<=x[i-1]&&y[i]<=y[i-1])) res += max(dx,dy);
		else res += (dx+dy);
	}
	cout << res << endl;
	
	return 0;
}

Measured memory_bytes: 1168
n = int(input())
l = len(str(n))

from itertools import product

a = ["3", "5", "7"]

count = 0
for i in range(3, l+1):
  for j in list(product(*[a for _ in range(i)])):
    if "3" in j and "5" in j and "7" in j:
      num = int("".join(j))
      if num <= n:
        count += 1

print(count)

Measured memory_bytes: 6260
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  auto s = readln.chomp.replace("C", "A").replace("G", "A").replace("T", "A");
  int res, cnt;
  foreach (e; s) {
    if (e == 'A') {
      cnt++;
    } else {
      res = max(res, cnt);
      cnt = 0;
    }
  }
  res = max(res, cnt);
  res.writeln;
}


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



int main() {
#ifdef HOME
    freopen("in", "r", stdin);
#endif

    string s;
    while (cin >> s) {
        int n = s.length();
        cout << s.substr(0, n - 8) << endl;
    }

#ifdef HOME
    cerr << clock() / (double)CLOCKS_PER_SEC << endl;
#endif
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<functional>
#include<map>
#include<set>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)

map<string, int> mp;

int main() {
    string s;
    cin >> s;
    rep(i, s.size()) {
        if (i % 2 == 0)cout << s[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 512
#!venv/bin/python

import math
import numpy as np
import random
import copy
import statistics 
import bisect
import heapq
from collections import defaultdict 

N, M = [int(x) for x in input().split()]
AB = []
for _i in range(N):
    AB.append([int(x) for x in input().split()])

AB = sorted(AB, key=lambda x: x[0])

got_num = 0
total_money = 0
for ab in AB:
    price = ab[0]
    num = ab[1]
    if got_num + num <= M:
        total_money += price * num
        got_num += num
    else:
        total_money += price * (M - got_num)
        got_num = M
    if got_num >= M:
        break
print(total_money)

Measured memory_bytes: 33980
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        n: usize,
        v: [usize; n]
    }
    let mut b = vec![vec![0; 60]; n];
    for i in 0..n {
        for j in 0..60 {
            b[i][j] = v[i] >> j & 1;
        }
    }
    for i in (1..n).rev() {
        for j in 0..60 {
            b[i - 1][j] += b[i][j];
        }
    }
    let d = 1000000007;
    let mut ans: usize = 0;
    for i in 0..n - 1 {
        for j in 0..60 {
            if v[i] & 1 << j == 0 {
                ans = (ans + (1 << j) % d * b[i + 1][j]) % d;
            } else {
                ans = (ans + (1 << j) % d * (n - i - 1 - b[i + 1][j])) % d;
            }
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 170236
import java.io.*;
import java.util.*;
public class Main{
    public static void main(String[] args) throws IOException{
        MyReader r = new MyReader();    
        int X, A, B;
        {int[] a = r.ii(); X = a[0]; A = a[1]; B = a[2];}
        println(B<=A ? "delicious" : B-A <= X ? "safe" : "dangerous");
    }

    static void print(Object o){
        System.out.print(o.toString());
    }

    static void println(Object o){
        System.out.println(o.toString());
    }

    static int Int(String s){
        return Integer.parseInt(s);
    }

    static long Long(String s){
        return Long.parseLong(s);
    }
    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }

        String s() throws IOException{
            return readLine();
        }

        String[] ss() throws IOException{
            return s().split(" ");
        }

        int i() throws IOException{
            return Int(s());
        }

        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Int(ss[j]);
            return ii;
        }

        long l() throws IOException{
            return Long(s());
        }

        long[] ll() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            long[] ll = new long[size];
            for(int j = 0; j < size; j++) ll[j] = Long(ss[j]);            
            return ll;
        }
    }
}

Measured memory_bytes: 21204
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const int MOD=1e9+7;
const int INF=1e9;
const double PI=acos(-1);


int main() {
    ios_base::sync_with_stdio(false); 

    ll n;
    cin >> n;
    ll ans=0;
    repr(i,1,1000010) {
        if ((n-i)%i==0) {
            ll m=(n-i)/i;
            if (m<=i) break;
            ans+=m;
        }
    }
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 3628
# coding: utf-8
import itertools
import math

N = int(input())
saidai = int(math.sqrt(N)) + 1

def g(x, y, z):
    return x**2 + y**2 + z**2 + x*y + y*z + z*x

def f(n):
    result = [0] * (n+1)
    for idx, (x, y, z) in enumerate(itertools.product(range(1, saidai + 1), repeat=3)):
        tmp = g(int(x), int(y), int(z))
        if tmp <= N:
            result[tmp] += 1
    return result

res = f(N)
for i in range(1, N+1):
    print(res[i])




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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_N = (int)(1e5 + 5);
const ll MOD = (ll)(1e9 + 7);

int n;
ll t[MAX_N];
ll a[MAX_N];

bool et[MAX_N];

int main(void) {
  // Here your code !
  scanf("%d", &n);

  for (int i = 0; i < n; ++i) {
    scanf("%lld", &(t[i]));
  }

  for (int i = 0; i < n; ++i) {
    scanf("%lld", &(a[i]));
  }

  if (t[n - 1] != a[0]) {
    printf("%d\n", 0);
    return 0;
  }

  et[0] = true;

  for (int i = 1; i < n; ++i) {
    if (t[i] > t[i - 1]) {
      et[i] = true;
    } else {  // t[i] == t[i - 1]
      et[i] = false;
    }
  }

  ll ans = 1LL;

  for (int i = n - 2; i >= 0; --i) {
    if (a[i] > a[i + 1]) {  // i-th height must be exact from a's sight
      if (et[i]) {          // both are exact
        if (a[i] != t[i]) {
          ans = 0LL;
          break;
        } else {
          ans *= 1LL;
          ans %= MOD;
        }
      } else {              // a is exact, t is not exact
        if (a[i] > t[i]) {  // since a is exact, t must be bigger than a
          ans = 0LL;
          break;
        } else {
          ans *= 1LL;
          ans %= MOD;
        }
      }
    } else {                // a[i] == a[i + 1]
      if (et[i]) {          // t is exact, a is not exact
        if (a[i] < t[i]) {  // since t is exact, a must be bigger than t
          ans = 0LL;
          break;
        } else {
          ans *= 1LL;
          ans %= MOD;
        }
      } else {  // t is not exact
        ans *= min(a[i], t[i]);
        ans %= MOD;
      }
    }
  }

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

  return 0;
}


Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,k;
int a[1000001];
map<int,int>mp;
int sum[1000001];
signed main()
{
	scanf("%lld%lld",&n,&k);
	for(int i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	mp[0]=1;
	long long ans=0;
	for(int i=1;i<=n;i++)
	{
		sum[i]=sum[i-1]+a[i];
		sum[i]%=k;
		if(i>=k) mp[((sum[i-k]-i)%k+k+k)%k]--;
		ans+=mp[((sum[i]-i)%k+k)%k];
		mp[((sum[i]-i)%k+k)%k]++;
	}
	printf("%lld",ans);
	return 0;
}


Measured memory_bytes: 18432
#if __has_include("debug.h")
    #include "debug.h"
#else  
#include <bits/stdc++.h>
using namespace std;
#define d(...) 2;
#endif

#define int long long int
#define ld long double

#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"      

#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ff first
#define ss second
#define eps 1e-10
#define PI acos(-1LL)

#define gcd(a,b)            __gcd((a),(b))
#define lcm(a,b)            ((a*b)/gcd(a,b))

void solve();

int32_t main()
{
    #ifdef DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
    #endif 

    fast
    
    int t = 1;
	// cin>>t;
	
	while(t--)
	    solve();
	return 0;  
}

void solve()
{
	int i,j;
	int n;
	string t,s,f="";
	cin>>n>>s>>t;

	for(i=0;i<s.length();i++)
	{
			f+=s[i];
			f+=t[i];
	}
	cout<<f<<endl;

}

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

int main(){
  int n;
  cin>>n;
  vector<int> A(n);
  int mn=1000000000;
  for(int i=0;i<n;i++){
    int c=0;
    cin>>A[i];
    while(A[i]%2==0){
      A[i]/=2;
      c++;
    }
    mn=min(mn,c);
  }
  cout<<mn<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001


int main (){
    string S; cin >> S;
    int origin = 0;
    for(char c:S)
        origin += c - '0';
    
    int n = S[0] - '0' - 1;
    n += 9 * (S.size() - 1);
        
    cout << max(origin, n) << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include "math.h"


int main(int argc, char *argv[]){

  char S[101];

  scanf("%s", S);

  if(strcmp(S, "Sunny") == 0){
    printf("Cloudy\n");
  }else if(strcmp(S, "Cloudy") == 0){
    printf("Rainy\n");
  }else if(strcmp(S, "Rainy") == 0){
    printf("Sunny\n");
  }

  return 0;
}


Measured memory_bytes: 128
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author I.E
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <math.h>
#include <iomanip>
#include <algorithm>

using namespace std;

#define ll long long
#define ull unsigned long long
#define ld long double
#define fr(i,a,b) for(int i=a;i<b;++i)
#define frn(i,a,b) for(int i=a;i>b;i--)
#define rep(i,n) fr(i,0,n)
#define present(container, element) (container.find(element) != container.end())
#define cpresent(container, element) (find(all(container),element) != container.end())
#define sz(a) int((a).size())
#define srt(container, lambda) sort(container.begin(), container.end(), lambda)

typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> ii;

int int_pow(int x, int p)
{
    if (p == 0) return 1;
    if (p == 1) return x;

    int tmp = int_pow(x, p/2);
    if (p%2 == 0) return tmp * tmp;
    else return x * tmp * tmp;
}

void fill(istream& in, vi& a, int n) {
    int elm;
    rep(i, n) {
        in >> elm;
        a.push_back(elm);
    }
}

void fill(istream& in, vl& a, int n) {
    ll elm;
    rep(i, n) {
        in >> elm;
        a.push_back(elm);
    }
}

void fill(vi& a, int n, int val) {
    rep(i, n) {
        a.push_back(val);
    }
}

void fill(vl& a, int n, ll val) {
    rep(i, n) {
        a.push_back(val);
    }
}

int sum(vi arr) {
    int s = 0;
    for (auto& x: arr)
        s += x;
    return s;
}

int max(vi a) {
    return *max_element(a.begin(), a.end());
}

int min(vi a) {
    return *min_element(a.begin(), a.end());
}

void print(ostream& out, vi a) {
    for (auto& x: a) {
        out << x << " ";
    }
    out << endl;
}

void print(ostream& out, vl a) {
    for (auto& x: a) {
        out << x << " ";
    }
    out << endl;
}

//======================================================
int dx[] = { 0,  0, 1, -1 ,  1,  -1,  1,  -1 };
int dy[] = { 1, -1, 0,  0 , -1,   1,  1,  -1 };
//======================================================
ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
ll power(ull a, ull b, ull ret = 1LL) {
    while (b--) ret = (ret * a);
    return ret;
}
//======================================================

#pragma GCC optimize("Ofast")
static auto speedup = [](){
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    cout.tie(nullptr);
    return 0;
}();



class ATakoyaki {
public:
    void solve(std::istream& in, std::ostream& out) {
        int n, x, t;
        in >> n >> x >> t;
        int ans = (n + x - 1) / x;
        ans *= t;
        out << ans << endl;
    }
};


int main() {
	ATakoyaki solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3144
#include <stdio.h>

#define MAX 500000
int h,a[MAX+1];

void maxHeapify(int i){
  int l,r,est,tmp;

  l=2*i;
  r=2*i+1;
  if(l<=h && a[l]>a[i]){est=l;}
  else{est=i;}
  if(r<=h && a[r]>a[est]){est=r;}
  if(est!=i){
    tmp=a[est];
    a[est]=a[i];
    a[i]=tmp;
    maxHeapify(est);
  }
}

int main()
{
  int i;
  scanf("%d",&h);
  for(i=1;i<=h;i++) scanf("%d",&a[i]);
  for(i=h/2;i>=1;i--) maxHeapify(i);
  for(i=1;i<h+1;i++){
    if(i>0){printf(" ");}
    printf("%d",a[i]);
  }
  printf("\n");
  return 0;
}


Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int64_t> a(n);
  for(int i=0;i<n;i++)
    cin>>a.at(i);
  int64_t k=0;
  for(int i=0;i<n;i++){
    if(a.at(i)>=n){
      k+=(a.at(i)-n)/(n+1)+1;
      a.at(i)=n+(a.at(i)-n)%(n+1)-(n+1);
    }
  }
  for(int i=0;i<n;i++)
    a.at(i)+=k;
  sort(a.begin(),a.end(),greater<int>());
  k+=max(a.at(n-1)-n,(int64_t)0)*n;
  for(int i=0;i<n;i++)
    a.at(i)-=max(a.at(n-1)-n,(int64_t)0);
  for(int i=0;a.at(i)>=n;i=(i+1)%n){
    for(int j=0;j<n;j++){
      if(i==j)
        a.at(j)-=n;
      else
        a.at(j)++;
    }
    k++;
  }
  cout<<k<<endl;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define fin ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ii pair<int,int>
#define F first
#define S second
#define pb push_back
#define pf push_front
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a) for(int i = a; i >= 0; i--)
#define fori(i,m) for(auto i = m.begin(); i != m.end(); i++) 
#define w(t) while(t--)
#define sz(s) int(s.size())
#define cls(a,car) memset(a,car,sizeof (a))
#define ff(x) cerr << #x << " is " << x << '\n'
#define FL freopen("in", "r", stdin),freopen("out", "w", stdout);
#define time cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ii> vii;
const int N = 2 * 1e5 + 5;
const ll mod = 1e9 + 7;
const int INF = INT_MAX;
const ll INFCAD  = ll(INT_MAX) * 2 + 1;
const double E = 1e-9;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
// fflush(stdout)
// cout << flush
// a + b = a ^ b + 2 * (a & b) 
int main(){
    //FL;
    fin;
    int n;
    cin >> n;
    int v[n  +1];
    fore(i, 0, n){
        cin >> v[i];
    }
    bool  flag = 1;
    //ff(v[n - 1]);
    for(int i = n - 1; i >= 1; i--){
        if(v[i] == v[i - 1])continue;
        if(v[i] <= v[i - 1])
            v[i - 1]--;
    }
    fore(i, 1, n){
        if(v[i] < v[i - 1])
            flag = 0;
    }
    cout << (flag ? "Yes" : "No") << '\n';
    time;
    return 0;
}   

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>

using namespace std;

int main() {
	string s;
	cin >> s;

	if (s.find('7') == string::npos) {
		cout << "No" << endl;
	} else {
		cout << "Yes" << endl;
	}
	return 0;
}


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

#define FOR(i,a,b) for(int i=(a);i<(int)(b);++i)
#define REP(i,n) FOR(i,0,n)
using namespace std;
string str;

bool check(){
  char c1=str[0];
  char c2=NULL;
  int count1=1;
  int count2=0;
  for(int i=1;i<4;i++){
    if(c1==str[i]){
      count1++;
    }else{
      if(c2==NULL){
        c2=str[i];
        count2++;
      }else if(c2==str[i]){
        count2++;
      }else{
        return false;
      }
    }
  }
  //cout<<c1<<c2<<count1<<" "<<count2<<endl;
  if(count1==2&&count2==2)return true;
  return false;
}

int main(){
  cin>>str;

  if(check())cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


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

int main() {
    int numCoins;
    cin >> numCoins;
    vector<double> pHeads(numCoins);
    for(double& coin : pHeads) {
        cin >> coin;
    }

    int nTails = (numCoins - 1)/2;
    vector<vector<double> > memo(numCoins, vector<double>(nTails+1, 0));

	memo[0][0] = pHeads[0];
    memo[0][1] = 1-pHeads[0];
    for(int i = 1; i < numCoins; i++) memo[i][0] = pHeads[i] * memo[i-1][0];

    for(int coin = 1; coin < numCoins; coin++) {
        for(int numTails = 1; numTails <= min(nTails, coin+1); numTails++) {
            memo[coin][numTails] = pHeads[coin] * memo[coin-1][numTails]
                                    + (1-pHeads[coin]) * memo[coin-1][numTails-1];
        }
    }

    double result = 0;
    for(double num : memo[numCoins-1]) result += num;

    printf("%.15f", result);

    return 0;
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define long long long


int main(){
    IOS;

    long int n;
    cin>>n;

    vector<vector<long int>> v(n,vector<long int>(3)), dp(n,vector<long int>(3));

    for(long int i = 0; i < n; i++)
        for(long int j = 0; j < 3; j++)
            cin>>v[i][j];
    
    dp[0][0] = v[0][0], dp[0][1] = v[0][1], dp[0][2] = v[0][2];

    for(long int i = 1; i < n; i++){
        dp[i][0] = max(dp[i-1][1],dp[i-1][2]) + v[i][0];
        dp[i][1] = max(dp[i-1][0],dp[i-1][2]) + v[i][1];
        dp[i][2] = max(dp[i-1][1],dp[i-1][0]) + v[i][2];
    }

    cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
    return 0;
}

Measured memory_bytes: 11136
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <iomanip>
#include <complex>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
using ll = long long;
constexpr long long INF = 1LL << 62;
constexpr int MOD = 1e9 + 7;




int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> a(n+1); REP(i,n+1) cin >> a[i];
    vector<int> b(n  ); REP(i,n  ) cin >> b[i];

    ll ans = 0;
    REP(i,n) {
        if(a[i] < b[i]) {
            ans += a[i]; // zenbu
            ll rest = (b[i] - a[i]);
            if(a[i+1] >= rest) { // yoryoku
                a[i+1] -= (b[i] - a[i]);
                ans += rest;
            } else {
                ans += a[i+1];
                a[i+1] = 0;
            }
                
        } else {
            ans += b[i];
        }
    }
    cout << ans << endl;

    return 0;
}

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

using namespace std;

#define X first
#define Y second
#define eps  1e-5
#define gcd __gcd
#define pb push_back
#define PI acos(-1.0)
#define lowbit(x) (x)&(-x)
#define bug printf("!!!!!\n");
#define mem(x,y) memset(x,y,sizeof(x))

typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
typedef unsigned long long uLL;

const int maxn = 1e5+7;
const int INF  = 1<<30;
const int mod  = 1e9+7;

void solve(){
    int a,b;
    cin>>a>>b;
    cout<<max({a+b,a-b,a*b})<<endl;
    return;
}

int main()
{
#ifndef ONLINE_JUDGE
    //freopen("in.txt","r",stdin);
#endif
//    freopen("out.txt","w",stdout);
//    ios::sync_with_stdio(false);
    int t = 1;
    //scanf("%d",&t);
    while(t--){
    //    printf("Case %d: ",cas++);
        solve();
    }
#ifndef ONLINE_JUDGE
  //  printf("%.10f\n",1.0*clock()/CLOCKS_PER_SEC);
#endif
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define intpow(a, n) (int)pow((long double) a, (long double) n)
#define int long long

signed main(){
    int n, k;
    cin >> n >> k;
    cout << (n-1)/(k-1) + ((n-1)%(k-1)!=0) << 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 n = sc.nextInt();
        char[] S = sc.next().toCharArray();
        long r = 0, g = 0, b = 0;
        for(char c : S) {
            if(c == 'R') r++;
            else if(c == 'G') g++;
            else b++;
        }
        long ans = r * b * g;
        for(int i = 0; i < n; i++) {
            for(int j = 1; j + i < n; j++) {
                    if(i - j >= 0 &&
                            S[i]   != S[i+j] &&
                            S[i]   != S[i-j] &&
                            S[i+j] != S[i-j]) ans--;
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 36356
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	s = input()
	basis = []
	ans = 0
	for i in range(n-1, -1, -1):
		for b in basis:
			a[i] = min(a[i], a[i]^b)
		if a[i]:
			if s[i] == "0":
				basis.append(a[i])
			else:
				ans = 1
				break
	print(ans)

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

using namespace std;

int main(){
    int k,s;
    cin >> k >> s;
    int ans=0;
    for(int i=0;i<=k;i++){
        for(int j=0;j<=k;j++){
            /* for(int z=0;z<=k;z++){
                if(i+j+z == s)ans++;
            }*/
            if(s-(i+j) >= 0 && s-(i+j) <= k){
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
N ,M, X , Y = map(int,input().split())
x = list(map(int,input().split()))
x.sort()
y = list(map(int,input().split()))
y.sort()
Z = y[0]
if x[-1] < y[0] and X < Z <= Y:
    print("No War")
else:
    print("War")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
    int N;
    cin >> N;

    int dnyFlg = false;
    vector<int> A(N);

    for(int i = 0; i < N; i++)
    {
        cin >> A.at(i);

        if(A.at(i) % 2 == 0)
        {
            if((A.at(i) % 3 != 0) && (A.at(i) % 5 != 0))
            {
                dnyFlg = true;
            }
        }
    }

    if(dnyFlg == true)
    {
        cout << "DENIED";
    }
    else
    {
        cout << "APPROVED";
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <cstdlib>
#include <iostream>
#include <string>
#include <time.h>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
using namespace std;

int main(void) {

	int N = 0, L = 0;
	cin >> N >> L;
	string n[10000];
	string temp;
	string res;

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

	for (int i = 0; i<N; i++) {
		for (int j = N - 1; j>i; j--) {
			if (n[j] < n[j - 1]) {
				temp = n[j];
				n[j] = n[j - 1];
				n[j - 1] = temp;
			}
		}
	}

	for (int i = 0; i < N; i++) {
		res += n[i];
	}

		cout << res << endl;

	return 0;




}


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

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






Measured memory_bytes: 512
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
using namespace std;
int gcd(int a,int b)
{
    int r=a%b;
    while(r)
    {
        a=b;
        b=r;
        r=a%b;
    }
    return b;
}
int s[100];
int main()
{
    int i,a,b,k,x;
    scanf("%d%d%d",&a,&b,&k);
    x=gcd(a,b);
    int xx=x;
    int cnt=0;
    for(i=1;i<=sqrt(x);i++)
    {
        if(x%i==0)
        {
            if(i*i!=x)
            {
                s[++cnt]=i;
                s[++cnt]=x/i;
            }
            else
            {
                s[++cnt]=i;
            }
        }
    }
    sort(s+1,s+1+cnt,greater<int>());
    printf("%d\n",s[k]);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
int a[1000001];
int cnt[1000001];
int main(void){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	int ans=0;
	for(int i=0;i<n;i++){
		if(a[i]>n){
			ans++;
		}else{
			cnt[a[i]]++;
		}
	}
	for(int i=1;i<=n;i++){
		if(cnt[i]<i){
			ans+=cnt[i];
		}else{
			ans+=cnt[i]-i;
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 4352
#include <iostream>
#include <vector>

#define mod 1000000007

#define min(a,b) ( (a <= b)*a + (a > b)*b )

using namespace std;

int main(void){
    int n,m,box;
    cin >> n >> m;
    vector<int> a(n+1,1);
    vector<long> res(n+1,0);
    for(int i=0;i<m;i++){
        cin >> box;
        a[box] = 0;
    }
    res[0] = 1;
    for(int i=0;i<=n;i++){
        for(int j=i+1;j<=min(n,i+2);j++){
            if(a[j]){
                 res[j] += res[i];
                 res[j] %= mod;
            }
        }
    }
    cout << res[n] << endl;
    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>& p) { os << p.first << " " << p.second; return os; }
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) { for(int i = 0; i < (int) v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }

void solve()
{
    string s, t; cin >> s >> t;
    cout << t + s << endl;
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

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

#define all(A) begin(A), end(A)
#define rall(A) rbegin(A), rend(A)
#define sz(A) int(A.size())

using namespace std;

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

int main () {
  ios::sync_with_stdio(false); cin.tie(0);
  int x, a;
  cin >> x >> a;
  if (x < a) cout << 0 << endl;
  else cout << 10 << endl;
  return (0);
}


Measured memory_bytes: 256
a,b,n=map(int,input().split())
c=max(0,a//b)
d=min(b,n)
def floor(x):
    return int((a*x)/b)-a*(int(x/b))
if n<b:
    print(floor(n))
elif n==b:
    print(floor(b-1))
else:
    if b<a:
        print(floor(b-1))
    elif b==a:
        print(floor(b))
    else:
        e=max(b-1,a//b)
        print(floor(e))



Measured memory_bytes: 61940
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <cmath>
#include <deque>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define rep3(i,a,b) for(int i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define mt make_tuple
#define pq priority_queue<ll>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vecpll vector<pll>
#define vecbl vector<bool>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
string stin(){string s;cin>>s;return s;}

int main(){
    int n=in();
    map<int,int> mp;
    rep(i,n){
        int x=in();
        mp[x]++;
    }
    int ans=n;
    for(int k=1;k<=1000000;k++){
        if(mp.find(k)!=mp.end()){
           // cout<<mp.find(k)->second<<" ";
            if(mp[k]>=2){
                ans-=mp[k];
            }
            int x=k*2;
            while(x<=1000000){
                auto itr=mp.find(x);
                if(itr!=mp.end()){
                    ans-=mp[x];
                    mp.erase(itr);
                }
                x+=k;
            }
        }
    }
    cout<<ans<<endl;
}


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

int n;

ll solve(vector<ll>a,vector<ll>b,vector<ll>c){
   sort(c.rbegin(),c.rend());
   ll sum=0,ans=0;
   rep(i,n)sum+=b[i];
   for(int i=0;i<n;i+=2){
       ans+=c[i];
   }
   return ans-sum;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin>>n;
    vector<ll>a(n),b(n),c(n);
    rep(i,n){
        cin>>a[i]>>b[i];
        c[i]=a[i]+b[i];
    }
    cout<<solve(a,b,c)<<endl;
    return 0;
}

Measured memory_bytes: 4992
#include<iostream>
#include<stdio.h>
using namespace std;

double Circle_menseki(double r);
double Circle_syu(double r);

int main(){
    double r;
    
    cin >> r;
    printf("%f %f",Circle_menseki(r),Circle_syu(r));
    
    return 0;
}

double Circle_menseki(double r){
    return r * r * 3.141592653589;
}
double Circle_syu(double r){
    return 2 * r * 3.141592653589;
}


Measured memory_bytes: 3204
#include<iostream>
using namespace std;
int h,w,d;
char a[4]={'R','Y','G','B'};
int main()
{
	cin>>h>>w>>d;
	for(int i=1;i<=h;++i,cout<<endl)
	for(int j=1;j<=w;++j)
	{
		int x=i+j+w,y=i-j+w;
		cout<<a[((x/d)&1)*2+((y/d)&1)];
	}
	return 0;
}
 

Measured memory_bytes: 512
#include<stdio.h>
#define MAX 100000

struct Node{
	int parent;
	int left;
	int right;
};

struct Node T[MAX];

int getDepth(int num){
	int depth = 0;
	
	for(depth = 0; T[num].parent != -1; depth++){
		num = T[num].parent;
	}
	return depth;
}

int main(void){
	int n, i, j;
	int num, deg, child, k = 0;
	scanf("%d", &n);
	
	for(i=0; i<n; i++){		//初期化
		T[i].parent = -1;
		T[i].left = -1;
		T[i].right = -1;
	}
	for(i=0; i<n; i++){
		scanf("%d%d", &num, &deg);
		
		for(j=0; j<deg; j++){
			scanf("%d", &child);
			if( j==0 ){ T[num].left = child; }
			else T[k].right = child;
			k = child;
			T[child].parent = num;
		}
	}
	for(i=0; i<n; i++){
		printf("node %d: parent = %d, depth = %d", i, T[i].parent, getDepth(i));
		
		if( getDepth(i) == 0 ){
			printf(", root, [");
		}
		else if( T[i].left == -1 ){
			printf(", leaf, [");
		}
		else{
			printf(", internal node, [");
		}
		
		j = T[i].left;
		
		while(j != -1){
			printf("%d", j);
			j = T[j].right;
			
				if( j != -1 ){ printf(", "); }
		}
		printf("]\n");
	}
	return 0;
}


Measured memory_bytes: 2872
#include <bits/stdc++.h>
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007      //10^9+7
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define Vec(K, L, N, S) vector<L> K(N, S)
#define rt sqrt
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using vs = vector<string>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli a, b = 0, c, h, k, n, x, w, ans = 0, count = 0;
  string s, t;
  cin >> x;

  rep(i, -200, 200)
  {
    rep(j, -200, 200)
    {
      if ((i - j) * (i * i * i * i + i * i * i * j + i * i * j * j + i * j * j * j + j * j * j * j) == x)
      {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  int v[n], c[n];
  for(int i=0; i<n; i++) {
    cin >> v[i];
  }
  for(int i=0; i<n; i++) {
    cin >> c[i];
  }
  int dif[n];
  
  for(int i=0; i<n; i++) {
    dif[i]=v[i]-c[i];
  }
  int ans=0;
  for(int i=0; i<n; i++) {
    if(dif[i]>=0) ans+=dif[i];
  }
  cout << ans << endl;
}

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

using namespace std;

int main() {
	int sum = 0;
	char ch;
	while (1) {
		while ((ch = getchar()) != '\n') {
			sum += ch - '0';
		}
		if (sum == 0)break;
		else {
			printf("%d\n", sum);
			sum = 0;
		}
	}
}


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

int val[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

int main() {
    int K;
    cin >> K;
    cout << val[K-1] << endl;
}

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

int main(){
  int n;
  cin >> n;
  vector<llong> h(n);
  rep(i, n) cin >> h[i];
  int ans = 0, move = 0;
  for(int i = 1; i < n; i++){
    if(h[i] > h[i-1]) {
      move = 0;
    }
    else{
      move++;
      ans = max(ans, move);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
import java.util.*;
public class Main
{
	public static void main(String[] args) 
	{
		Scanner in=new Scanner(System.in);
		for(;;)
		{
			int n=in.nextInt();
			int w=in.nextInt();
			if((n|w)==0)
				return;
			double cnt[]=new double[11];
			double sta=0;
			double ele=0;
			double ans=0.01;
			int v[]=new int[n];
			for(int i=0;i<n;i++)
				v[i]=in.nextInt();
			//Arrays.sort(v);
			for(int i=0;i<n;i++)
			{
				for(int j=0;j<=10;j++)
				{
					int wi=w*j;
					if(v[i]>=wi&&v[i]<wi+w)
						cnt[j]++;
				}
			}

			for(int i=0;i<=10;i++)
				sta=Math.max(sta,cnt[i]);
			for(int i=10;i>=0;i--)
			{
				if(cnt[i]!=0)
				{
					ele=i;
					break;
				}
			}
			for(int i=0;i<=10;i++)
			{
				ans+=((ele-i)/ele)*(cnt[i]/sta);
			}
			System.out.println(ans);
		}
	}

	static public void debug(Object... o)
	{
		System.out.println(Arrays.deepToString(o));
	}
}

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

typedef long long ll;
typedef tuple<ll, ll, ll> mytuple;
const ll INF = 1e9;
const ll MOD = 1000000007;
const double pi = 3.141592653589793238;

// a と b の最大公約数を返す関数
long long GCD(long long a, long long b) { if (b == 0) {return a;} else {return GCD(b, a % b);} }
// a と b の最小公倍数を返す関数
long long LCM(long long a, long long b) { return a/GCD(a,b)*b; }

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

int main() {
  int K, A, B; cin >> K >> A >> B;

  for(int i = A; i <= B; i++) {

    if(i % K == 0) {
      cout << "OK" << endl;
      return 0;
    }
  }
  cout << "NG" << endl;
  return 0;
}


Measured memory_bytes: 3588
#include <iostream>
using namespace std;
#define int long long
signed main(){
    int x;
    cin>>x;
    int amt = 100;
    int yrs = 0;
    int interest;
    while(amt<x){
        interest = amt/100;
        amt+=interest;
        yrs++;
    }   
    cout<<yrs<<endl;
    return 0;
}

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

int main() {
    string str;
    int count = 0;
    int ans = 0;

    cin >> str;
    for (int i = 0; i < str.size(); i++) {
        if ((str[i] == 'A') || (str[i] == 'C') || (str[i] == 'G') || (str[i] == 'T')) {
            while ((str[i] == 'A') || (str[i] == 'C') || (str[i] == 'G') || (str[i] == 'T')) {
                if (str.size() < i) {
                    break;
                }
                count++;
                i++;
            }
            if (ans < count) {
                ans = count;
            }
        }
        count = 0;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rp(i,n) for(int i=1;i<=(int)n;i++)
int main() {
int k,n;cin>>k>>n;
vector<int>a(n);
rep(i,n)cin>>a[i];
vector<int>b(n);
int sum=0;
for(int i=0;i<n-1;i++){
  b[i]=a[i+1]-a[i];
  sum+=b[i];
}
b[n-1]=k-sum;
sort(b.begin(),b.end());
cout<<k-b[n-1]<<endl;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

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

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

ll		is_prime(ll n, ll ans) {
	if (n <= 1)
		return 1;
	for (ll i = 2; i * i <= n; i++) {
		if (n % i == 0) {
			ll a = max(n / i, i);
			chmin(ans, a);
		}
			
	}
	return ans;
}

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

	ll n;
	cin >> n;
	int ans = to_string(is_prime(n, n)).size();
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

const int mod = 1000000007;
struct mint{
    ll x;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a){
        if((x+=a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a){
        if((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a){
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const {
        if(!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if(t&1) a *= *this;
        return a;
    }

    mint inv() const {
        return pow(mod - 2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1){
        assert(n < mod);
        fact[0] = 1;
        for(int i = 1; i <= n; i++) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for(int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;  
    }
    mint operator()(int n, int k){
        if(k < 0 || n < k) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
}comb(200005);

int main(){
    int H, W; cin >> H >> W;
    int A, B; cin >> A >> B;
    mint ans = 0;
    for(int i = 0; i <= H - A - 1; i++){
        ans +=  (comb(B - 1 + i, i) * comb(H - 1 - i + W - B - 1, H - 1 - i));//check
    }
    cout << ans << endl;
}

Measured memory_bytes: 6196
H, N = gets.split.map(&:to_i)
M = N.times.map { gets.split.map(&:to_i) }
M.sort_by! { |a, b| a }

dp = Array.new(H + 1, Float::INFINITY)
dp[0] = 0

N.times do |i|
  a, b = M[i]

  0.upto(H) do |h|
    next if dp[h] == Float::INFINITY

    damage = h + a
    cnt = dp[h] + b

    damage = H if damage > H

    if dp[damage] > cnt
      dp[damage] = cnt
    end
  end
end

puts dp[H]


Measured memory_bytes: 1916
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.PriorityQueue;

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}

	static class TaskC {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			char[] s = in.next().toCharArray();
			for (int i = 0; i < s.length - 1; i++) {
				if (s[i] == 'A' && s[i + 1] == 'C') {
					out.println("Yes");
					return;
				}
			}
			out.println("No");
		}
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

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

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

		public double nextFloat() {
			return Double.parseDouble(next());
		}

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

	}
}

Measured memory_bytes: 23124