akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define INF 1000000000
#define eps 1e-7
#define mod 1000000007
#define int ll
using namespace std;

int ten_p[15]; //ten_p[k]:10^k

int S(int n) {
    string str = to_string(n);
    int sum=0;
    rep(i, str.size()) {
        sum+=str[i]-'0';
    }
    return sum;
}

double sunuke(int n) {
    return (double)n/S(n);
}

int next_sunuke(int n) { //n以上の数で，sunuke(n)が最小になるものを返す
    vector<pair<double, int> > sunuke_cand;
    for(int k=-1; k<=15; k++) { //上から10^k+1の桁まで一緒で，10^k の桁がnより大きい
        int tmp;
        if (k == -1) { //nと一致
            tmp = n;
            // cout << "tmp:" << tmp << endl;
            sunuke_cand.pb(mp(sunuke(tmp), tmp));
        } else {
            // cout << "k:" << k << endl;
            // cout << "n:" << n << endl;
            // cout << "ten_p[k]:" << ten_p[k] << endl;
            // cout << "n / ten_p[k]" << (n / ten_p[k]) << endl;
            tmp = ((n / ten_p[k]) + 1) * ten_p[k] - 1;
            // cout << "tmp:" << tmp << endl;
            int th = (n / ten_p[k]) % 10;
            // cout << "th:" << th << endl;
            for (int i=th; i<=9; i++) {
                int cand = tmp+(i-th)*ten_p[k];
                // cout << "cand:" << cand << endl;
                sunuke_cand.pb(mp(sunuke(cand), cand));
            }
            // for (auto e : sunuke_cand) {
            //     cout << e.fi << ", " << e.se << endl;
            // }
        }
    }
    sort(all(sunuke_cand));
    return sunuke_cand[0].se;
}
 
signed main(void) {
    int K;
    cin >> K;
    
    ten_p[0] = 1;
    for(int i=1; i<=15; i++) {
        ten_p[i] = ten_p[i-1] * 10;
    }

    int now_sunuke = 1;
    cout << now_sunuke << endl;
    for(int i=1; i<K; i++) {
        cout << next_sunuke(now_sunuke+1) << endl;
        now_sunuke = next_sunuke(now_sunuke+1);
    }
    
}



Measured memory_bytes: 256
n = int(input())
k, *l = [int(x) for x in input().split()]

mbit =[]
for i in l:
    mbit.append(i)

print("0:")
for i in range(1, 1<<len(mbit)):
    num = 0
    p = []
    for j in range(len(mbit)):
        if i & (1<<j) != 0:
            num |= 1<<mbit[j]
            p.append(mbit[j])

    print("{}: ".format(num), end="")
    print( *p )




Measured memory_bytes: 6184
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;

int main(){
	ll n, a, b, c, d, e;
	scanf("%ld %ld %ld %ld %ld %ld", &n, &a, &b, &c, &d, &e);
	ll x = std::min({a, b, c, d, e});
	printf("%ld\n", 4+(n+x-1)/x);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <numeric>
using namespace std;
 
typedef long long ll;

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

    int n;
    cin >> n;
    vector<ll> a(n);
    for(int i = 0; i < n; ++i){
        cin >> a[i];
    }
    ll sum = accumulate(a.begin(), a.end(), (ll)0);
    if(sum % ((ll)n * (n+1) / 2) != 0){
        cout << "NO\n";
        return 0;
    }

    ll times = sum / ((ll)n * (n+1) / 2);
    // 階差数列
    for(int i = 0; i < n; ++i){
        ll d = a[(i+1)%n] - a[i];
        if(d > times || (times - d) % n != 0){
            cout << "NO\n";
            return 0;
        }
    }

    cout << "YES\n";
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<'\n';
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin>>n>>m;
    priority_queue<ll> a;
    vector<vector<ll> > now(m+10);
    rep(i,n){
      ll x,y;
      cin>>x>>y;
      if(x>m) continue;
      now[x].push_back(y);
    }
    ll ans=0;
    for(ll i=1;i<=m;i++){
      for(auto itr:now[i]) a.push(itr);
      if(!a.empty()){
        ans+=a.top();
        a.pop();
      }
    }
    cout<<ans<<endl;
}

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

int main() {

  double a, b, c, S, PI = acos(-1), rad, L;

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

  rad = (c * PI) / 180.0;

  S = (0.5) * a * b * sin(rad);
  L = a + b + sqrt(pow(a, 2) + pow(b, 2) - 2*a*b*cos(rad));
  
  printf("%f\n%f\n%f\n", S, L, (S / a) * 2.0);
  
  return 0;
}


Measured memory_bytes: 2880
h,w = gets.split.map(&:to_i)
s = []
h.times do |i|
  s[i] = gets.chomp.split("")
end

h.times do |i|
  w.times do |j|
    if s[i][j] == "#"
      dec = false
      [[i-1,j],[i+1,j],[i,j-1],[i,j+1]].each do |hi,wi|
        next if hi < 0 || hi > h - 1 || wi < 0 || wi > w - 1
        if s[hi][wi] == "#"
          dec = true
          break
        end
      end
      if !dec
        puts "No"
        exit
      end
    end
  end
end

puts "Yes"


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

int main(){
    int n;
    cin >> n;
    vector<ll> a(10001);
    for(int x=1;x<=100;x++){
        for(int y=1;y<=100;y++){
            for(int z=1;z<=100;z++){
                int tn = x*x+y*y+z*z+x*y+y*z+z*x;
                if(tn <= 10000){
                    a.at(tn)++;
                }
            }
        }
    }
    for(int i=1;i<=n;i++){
        cout << a.at(i) << endl;
    }
    return 0;
}

Measured memory_bytes: 3676
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

class SlidingWindowAggretgation:
    def __init__(self, default, f = min):
        self.default = default
        self.f = f
        self.front_stack = deque()
        self.back_stack = deque()

    def get(self):
        res = self.default
        if self.front_stack:
            res = self.f(res, self.front_stack[-1][1])
        if self.back_stack:
            res = self.f(res, self.back_stack[-1][1])
        return res

    def append(self, x):
        fx = x
        if self.back_stack:
            fx = self.f(self.back_stack[-1][1], x)
        self.back_stack.append((x, fx))

    def popleft(self):
        if not self.front_stack:
            x, fx = self.back_stack.pop()
            self.front_stack.append((x, x))
            while self.back_stack:
                x, fx = self.back_stack.pop()
                fx = self.f(x, self.front_stack[-1][1])
                self.front_stack.append((x, fx))
        self.front_stack.pop()

def solve():
    n = I()
    p = LIR(n)
    p.sort()
    maxl = max([l for (l,r) in p])
    minr = min([r for (l,r) in p])
    ans = max(0, minr-maxl+1)+max([r-l+1 for (l,r) in p])
    swagll = SlidingWindowAggretgation(0,max)
    swaglr = SlidingWindowAggretgation(float("inf"),min)
    swagrl = SlidingWindowAggretgation(0,max)
    swagrr = SlidingWindowAggretgation(float("inf"),min)
    for l,r in p:
        swagrl.append(l)
        swagrr.append(r)
    for l,r in p[:-1]:
        swagll.append(l)
        swaglr.append(r)
        swagrl.popleft()
        swagrr.popleft()
        ll = swagll.get()
        lr = swaglr.get()
        rl = swagrl.get()
        rr = swagrr.get()
        k = max(lr-ll+1,0)+max(rr-rl+1,0)
        if ans < k:
            ans = k
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 91792
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

int main()
{
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    int min = a[0];
    int max = a[0];
    for (int i = 1; i < 3; ++i)
    {
        if (a[i] < min) { min = a[i]; }
        if (a[i] > max) { max = a[i]; }
    }
    cout << max - min << endl;
    return 0;
}


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

int main() {
	int n;
	cin >> n;
	vector<pair<int,int>> task;

	for(int i=0;i<n;i++){
		pair<int,int> p;
		cin >> p.first >> p.second;
		task.push_back(p);
	}

	sort(task.begin(), task.end(), 
     [](const pair<int,int>& x, const pair<int,int>& y) { return x.second < y.second;});

	int asum = 0;

	for(auto iter = task.begin(); iter != task.end(); iter++){
		asum += iter->first;
		if(asum > iter->second){
			cout << "No" << endl;
			return 0;
		}
	}

    cout << "Yes" << endl;
}

Measured memory_bytes: 2420
import java.util.*;
import java.math.*;
import java.io.*;
public class Main {
	static HashMap<String,String> map = new HashMap<String,String>();
	static ArrayList<String> list = new ArrayList<String>();

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] c = new int[n];
		int[] g = new int[n];
		for(int i = 0; i < n; i++) {
			c[i] = sc.nextInt();
			g[i] = sc.nextInt();
		}
		Data[] data = new Data[n];
		for(int i = 0; i < n; i++) {
			data[i] = new Data(c[i],g[i]);
		}
		Arrays.sort(data);
		int[][] gSum = new int[10][n];
		int id = 1;
		for(int i = 0; i < n; i++) {
			if(i != 0 && data[i].g != data[i-1].g) {
				id = 1;
			}
			gSum[data[i].g-1][id] = gSum[data[i].g-1][id-1] + data[i].c;
			id++;
		}
		
		
		
		int[][] dp = new int[11][k+1];
		for(int i = 0; i < 10; i++) {
			for(int j = 0; j < k+1; j++) {
				for(int kk = 0; kk < n; kk++) {
					if(kk + j > k) break;
					if(kk != 0 && gSum[i][kk] == 0) break;
					dp[i+1][j + kk] = Math.max(gSum[i][kk] + dp[i][j] + (kk)*(kk-1),dp[i+1][j+kk]);
				}
			}
		}
		
		
		
		int max = dp[10][k];
		
		System.out.println(max);
		
		
		
		
		
		
		
		
		
		
		
		
	}
	
	static class Data implements Comparable<Data> {
		int c;
		int g;
		Data(int a, int b) {
			c = a;
			g = b;
		}
		@Override
		public int compareTo(Data o) {
			if(this.g == o.g) return o.c - this.c;
			return this.g - o.g;
		}
	}

}

Measured memory_bytes: 37096
/* #                          */

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdint>
#include <cstring>
#include <algorithm>
#include <queue>
#include <vector>
#include <string>
#include <deque>
#include <map>
//#pragma warning(disable:4996)

using namespace std;


/** Type Define **/
typedef long long int           ll;
typedef pair<int, int>          pii;
typedef pair<ll, ll>            pll;
typedef vector<string>          vs;
typedef vector<bool>            vb;
typedef vector<int>             vi;
typedef vector<long long>		vl;
typedef vector<vi>              vvi;
typedef vector<vl>				vvl;
typedef vector<char>            vch;

constexpr int               inf = 0x3f3f3f3f;
constexpr long long 		INF = 9123456789123456789;
constexpr long long         MOD = 1000000007LL;
/*************************************************/
int N, K;
vi H;
void sol() {

}

int main() {
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cin.tie(nullptr);
    cin >> N >> K;
    H.resize(N);
    for (int i = 0; i < N; i++)
        cin >> H[i];
    if (N <= K) cout << "0\n";
    else {
        ll sum(0);
        sort(H.begin(), H.end());
        for (int i = 0; i < (N - K); i++) {
            sum += (ll)H[i];
        }
        cout << sum << '\n';
    }
    

    return 0;
}




Measured memory_bytes: 1024
// 基本テンプレート
 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

int dp[100010][4], dp2[100010];
string pat = "#ABC";
 
signed main() {
    string s; cin >> s;

    int N = s.length();

    dp2[0] = 1;
    for(int i=0; i<N; i++) {
        bool is_que = (s[i] == '?');
        int f = pat.find(s[i]);

        dp2[i+1] = dp2[i] * (is_que ? 3 : 1) % MOD;
        dp[i+1][0] += dp[i][0];

        if(is_que || f == 1) {
            (dp[i+1][1] += (dp[i][1] + dp2[i])) %= MOD;
            (dp[i+1][2] +=  dp[i][2]) %= MOD;
            (dp[i+1][3] +=  dp[i][3]) %= MOD;
        }
        if(is_que || f == 2) {
            (dp[i+1][1] +=  dp[i][1]) %= MOD;
            (dp[i+1][2] += (dp[i][2] + dp[i][1])) %= MOD;
            (dp[i+1][3] +=  dp[i][3]) %= MOD;
        }
        if(is_que || f == 3) {
            (dp[i+1][1] +=  dp[i][1]) %= MOD;
            (dp[i+1][2] +=  dp[i][2]) %= MOD;
            (dp[i+1][3] += (dp[i][3] + dp[i][2])) %= MOD;
        }
    }
    cout << dp[N][3] << endl;
    return 0;
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	1<=a;
	a<=12;
	1<=b;
	b<=31;
	if (a>b)
	{
		a=a-1;
		cout<<a<<endl;		
	}
	else
	{
		cout<<a<<endl;	
	}	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vii vector<vector<int>>
#define vpi vector<pair<int,int>>
#define w(t) int t;cin>>t;while(t--)
#define pi pair<int,int>
#define mii map<int,int>
#define pb push_back
#define ff first
#define ss second
#define FOR(i,t,n) for(int i=t;i<n;i++)
#define SCI(x)  scanf("%d",&x)
#define SCL(x) scanf("%lld",&x)

int main()
{

	ll A,B;
	cin>>A>>B;
	char c;
	cin>>c;
	int d;
	cin>>d;


	ll ans =  A*B;
	ans = ans + (A*d)/ 100 ;

	cout<<ans<<endl;

}

Measured memory_bytes: 3636
# author:  Taichicchi
# created: 28.09.2020 19:33:45

import sys

from collections import Counter


n, k = map(int, input().split())

c = dict(Counter(map(int, input().split())))

s_c = sorted(c.items(), key=lambda x: x[1])

l = len(s_c)
if l <= k:
    print(0)
else:
    ans = 0
    for i in range(l - k):
        ans += s_c[i][1]
    print(ans)


Measured memory_bytes: 45260
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n+1); i++)
int main(){
    int N,A,B;
    cin>>N>>A>>B;
    vector<int>P(N);
    int D=0;
    int E=0;
    int F=0;
    rep(i,N){
        cin>>P[i];
        if(P[i]<=A){
            D++;
        }
        else if(P[i]<=B){
            E++;
        }
        else
        {
            F++;
        }
        
    }
    int G=min(D,E);
    cout<<min(G,F)<<endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;
int main()
{
  int N, K;
  cin >> N >> K;
  cout << K * (int)pow((K - 1), (N - 1)) << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int main(){

  int n,b,f,r,v;

  int count[5][4][11]={0};

  cin>>n;

  for(int i=0;i<n;i++){
    cin>>b>>f>>r>>v;
    count[b][f][r]+=v;
  }
  for(int i=1;i<5;i++){
    for(int j=1;j<4;j++){
      for(int k=1;k<11;k++){
	cout<<" "<<count[i][j][k];
      }
      cout<<endl;   
    }
    if(i==4)break;
    cout<<"####################"<<endl; 
  }
  return 0;
}

Measured memory_bytes: 3056
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    long long N; cin >> N;
    vector<string> S(N);
    unordered_map<string, long long>MP;
    for(int i = 0; i < N; i++ ) cin >> S[i];
    for(int i = 0; i < N; i++){
        sort(S[i].begin(), S[i].end());
        MP[S[i]]++;
    }
    long long ans = 0;
    for(auto e: MP){
        ans += e.second * (e.second-1) / 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 17700
if __name__ == '__main__':
    a = [int(i) for i in input().split()]
    b = []
    same = 0

    for i in a:
        if i in b:
            same = same +1
        else:
            b.append(i)
    if same ==1:
        print("Yes")
    else:
        print("No")



Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
using namespace std;

#define rep(i, n) for(int i = 0; i < n; ++i)
#define repi(i, n, k) for(int i = k; i < n; ++i)
typedef long long int ll;

int main(int argc, const char * argv[]) {
    int n;
    cin >> n;
    
    int a[100010];
    int b[100010] = {};
    
    rep(i, n) {
        cin >> a[i];
        if(a[i] > 0) b[a[i] - 1] += 1;
        b[a[i]] += 1;
        b[a[i] + 1] += 1;
    }
    
    int res = 0;
    rep(i, 100000) res = max(res, b[i]);
    cout << res << endl;
    
    
}



Measured memory_bytes: 3940
object Main{
  def main(args:Array[String]) = {
    val num = scala.io.StdIn.readLine.toInt;
    val list = scala.io.StdIn.readLine.split(" ").map(_.toLong).toList;
    println(list.min + " " +  list.max + " " + list.sum)
  }
}

Measured memory_bytes: 49772
/***************************************** START OF TEMPLATE *********************************************/
#include<bits/stdc++.h>

using namespace std;

#define  SPEED          ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
#define  randomINIT     mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define  foo(i,a,n)     for(ll i = (a); i <= n; i++)
#define  frr(i,a,n)     for(ll i = (a); i >= n; i--)
#define  fo(i,n)        for(ll i = 0; i < n; i++)
#define  newl           cout<<"\n";
#define  f              first
#define  s              second
#define  pb             push_back
#define  mp             make_pair
#define  sym(s)         s="#"+s+"#";
#define  sqr(v)         v*v;
#define  all(x)         (x).begin(),(x).end()
#define  alll(x, n)     x+1, x+n+1
#define  mset(x,val)    memset(x,val,sizeof(x))
#define  mset1d(a,n,v)  foo(i,0,n+5)a[i]=v;
#define  mset2d(a,n,m,v)foo(i,0,n+5)foo(j,0,m+5)a[i][j]=v;
#define  INP(a,n)       foo(i,1,n) cin>>a[i];
#define  deb1d(a,n)     foo(i,1,n)cout<<a[i]<<" ";newl;
#define  deb2d(a,n,m)   foo(i,1,n){foo(j,1,m){cout<<a[i][j]<<" ";}newl;}    
#define  debm(a)        for(auto it: a)cout<<"{"<<it.f<<","<<it.s<<"}, ";newl;
#define  debp(a,n)      foo(i,1,n)cout<<"{"<<a[i].f<<","<<a[i].s<<"}, ";newl;
#define  debv(a)        for(auto it: a)cout<<it<<" ";newl;
#define  deb1(a)        cout<<a<<" ";newl;
#define  deb2(a,b)      cout<<a<<" "<<b;newl;
#define  deb3(a,b,c)    cout<<a<<" "<<b<<" "<<c;newl;
#define  deb4(a,b,c,d)  cout<<a<<" "<<b<<" "<<c<<" "<<d;newl;
#define  ll             long long
#define  ld             long double
#define  pll            pair<ll,ll>
#define  vll            vector<ll>
#define  vpll           vector<pll>

const ld   PI    =  3.14159265358979323846; 
const ll   MOD   =  1e+9+7;
const ll   INF   =  LLONG_MAX;
const int  INFi  =  INT_MAX;
const ll   N     =  2e+5+8;

vll adj[N]; ll vis[N];
ll dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};

ll test_cases = 1; randomINIT;

/*********************************************************************************************************/
/***************************************** VARIABLE DECLARATIONS *****************************************/
ll n,k, a[N];

/***************************************** FUNCTION IMPLEMENTATIONS **************************************/



/***************************************** START OF MAIN FUNCTION ****************************************/
void MAIN(ll tc){
    ll p = 1;
    cin>>n>>k;
    foo(i,1,n)cin>>a[i];
    foo(i,k+1,n){
        (a[i]>a[i-k])?cout<<"Yes":cout<<"No";
        newl;
    }

}

int main(){
    SPEED;

    //cin>>test_cases;
    foo(i,1,test_cases){
    MAIN(i);
    }
}

Measured memory_bytes: 9916
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long H,N,sum=0;
    int A[100000];
    cin >>H>>N;
    for(int i=0;i<N;i++){
        cin >>A[i];
        sum+=A[i];
        if(sum>=H){
            cout <<"Yes"<<endl;
            return 0;
        }
    }
    cout <<"No"<<endl;
}

Measured memory_bytes: 640
#include<stdio.h>


int n,a[2000];

int solve(int i,int m){
	if(m==0)return 1;
	if(i>=n)return 0;
	int x=solve(i+1,m) || solve(i+1,m-a[i]);
	return x;
}

int main(){
	int q,m,i;
	
	scanf("%d",&n);
	for(i=0; i<n; i++)
		scanf("%d",&a[i]);
		scanf("%d",&q);
	for(i=0; i<q; i++){
		scanf("%d",&m);
		if(solve(0,m)) printf("yes\n");
		else printf("no\n");
	}
	
	return 0;
}


Measured memory_bytes: 2108
def main():
    n = input()
    a_list = [int(i) for i in input().split()]
    sumv = sum(a_list)
    minv, tmp = 10**9 * 2, 0
    for a in a_list[:-1]:
        tmp += a
        if abs(sumv-2*tmp) < minv: minv = abs(sumv-2*tmp)
    print(minv)


if __name__ == "__main__":
    main()

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

using namespace std;

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

double dp[3005];
double ndp[3005];
int n;

void solve() {
  cin >> n;
  dp[0] = 1;
  for(int i = 0; i < n; i++) {
    double p;
    cin >> p;
    for(int j = 0; j <= i+1; j++) {
      ndp[j] = 0;
      ndp[j] += dp[j] * (1-p);
      if(j) {
        ndp[j] += dp[j-1] * p;
      }
    }
    for(int j = 0; j <= i+1; j++) {
      dp[j] = ndp[j];
    }
  }
  double ret = 0;
  for(int i = 0; i <= n; i++) {
    if(2*i > n) ret += dp[i];
  }
  cout << fixed << setprecision(10) << ret << endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  solve();
}


Measured memory_bytes: 256
from sys import exit
# A,B,C = [int(n) for n in input().split()]
N = int(input())
# a = [int(input()) for _ in range(N)]
# S = str(input())
# L = len(S)
# T = str(input())
# exit()
if( N in [7,5,3]):
    print("YES")
else:
    print("NO")


Measured memory_bytes: 2940
from collections import deque

d=[(1,0),(0,1),(-1,0),(0,-1)]
H,W=map(int,input().split())
M = []
Max_list = []
for i  in range(H):
    t = input()
    M.append(t)
dist = [[-1]*W for _ in range(H)]
def BFS(i,j):
    q = deque()
    dist = [[-1]*W for _ in range(H)]
    if M[i][j] == '.':

        #前処理
        Ma = 0
        q.append((i, j))#スタート地点挿入
        dist[i][j] = 0
        while q:
            cx,cy = q.popleft()
            for nx,ny in d:
                x ,y= cx+nx,cy+ny
                if 0<= x < H and 0<= y < W and M[x][y] == "." and dist[x][y]==-1:
                    dist[x][y]=dist[cx][cy]+1
                    Ma = max(Ma,dist[x][y])
                    q.append((x,y))
        return Ma
    return 0
for i in range(H):#全部の地点でBFSをためす
    for j in range(W):
        Max_list.append(BFS(i,j))

print(max(Max_list))


Measured memory_bytes: 3316
while True:
    n, x = map(int, input().split())
    if n == x == 0:
        break

    ans = 0
    for i in range(1, n+1):
        for j in range(i+1, n+1):
            for k in range(j+1, n+1):
                if i + j + k == x:
                    ans += 1

    print(ans)


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main () {
	int A, B; cin >> A >> B;
	if (B % A) cout << B - A << endl;
	else cout << A + B << endl;
}


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

int main(){
    int x;
    cin>>x;
    if(x==0)cout<<1<<endl;
    if(x==1)cout<<0<<endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using vec = vector<ll>;
using vect = vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i, n) for (ll i = 0; i < n; i++)
#define Loop(i, m, n) for (ll i = m; i < n; i++)
#define pool(i, n) for (ll i = n; i >= 0; i--)
#define Pool(i, m, n) for (ll i = n; i >= m; i--)
#define mod 1000000007ll
#define flagcount __builtin_popcount
#define flag(x) (1 << x)
#define flagadd(bit, x) bit |= flag(x)
#define flagpop(bit, x) bit &= ~flag(x)
#define flagon(bit, i) bit &flag(i)
#define flagoff(bit, i) !(bit & (1 << i))
#define all(v) v.begin(), v.end()
#define low2way(v, x) lower_bound(all(v), x)
#define high2way(v, x) upper_bound(all(v), x)
#define idx_lower(v, x) (distance(v.begin(), low2way(v, x)))  //配列vでx未満の要素数を返す
#define idx_upper(v, x) (distance(v.begin(), high2way(v, x))) //配列vでx以下の要素数を返す
#define idx_lower2(v, x) (v.size() - idx_lower(v, x))         //配列vでx以上の要素数を返す
#define idx_upper2(v, x) (v.size() - idx_upper(v, x))         //配列vでxより大きい要素の数を返す
#define putout(a) cout << a << endl
#define Gput(a, b) G[a].push_back(b)
#define Sum(v) accumulate(all(v), 0ll)
#define gcd(x, y) __gcd(x, y)
ll ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return 0;
}
template <typename T>
T lcm(T x, T y)
{
    T z = gcd(x, y);
    return x * y / z;
}
template <typename T>
bool primejudge(T n)
{
    if (n < 2)
        return false;
    else if (n == 2)
        return true;
    else if (n % 2 == 0)
        return false;
    double sqrtn = sqrt(n);
    for (T i = 3; i < sqrtn + 1; i++)
    {
        if (n % i == 0)
        {
            return false;
        }
        i++;
    }
    return true;
}
//場合によって使い分ける
//const ll dx[4]={1,0,-1,0};
//const ll dy[4]={0,1,0,-1};
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//2次元配列の宣言
//vector<vector<ll>> field(h, vector<ll>(w));

int main()
{
    cout << fixed << setprecision(30);
    string s, t;
    cin >> s >> t;
    ll n = s.size();
    bool check = true;
    loop(i, n) if (s[i] != t[i]) check = false;
    if (check)
        putout("Yes");
    else
        putout("No");
    return 0;
}


Measured memory_bytes: 3628
n = int(input())
b = list(map(int, input().split()))

res = 0

for i in range(n - 1):
    # print('＝＝＝＝＝＝＝＝＝＝')
    if i + 1 < n - 1:
        if b[i] > b[i + 1]:
            if i == 0:
                res = b[0] + b[1]
                # print('b[0] = ', b[0])
                # print('b[0] = ', b[0])
            else:
                res += b[i + 1]
                # print('b[i + 1] = ', b[i + 1])
        else:
            if i == 0:
                res = b[0] + b[0]
                # print('b[0] = ', b[0])
                # print('b[0] = ', b[0])
            else:
                res += b[i]
                # print('b[i] = ', b[i])
    elif i == 0:
        res = b[0] + b[0]
        # print('b[0] = ', b[0])
        # print('b[0] = ', b[0])
    else:
        res += b[i]
        # print('b[i] = ', b[i])
print(res)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, a, b) for(int i = a; i < b; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define debug(x) cerr <<__LINE__<< ": " <<#x<< " = " << x << endl
#define debug_vec(v) cerr<<__LINE__<<": "<<#v<<" = ";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

string s;

bool check(int l, int r) {
    while(l < r) {
        if (s[l] != s[r]) return false;
        l++; r--;
    }
    return true;
}

void solve() {
    cin >> s;
    int n = s.size();
    if (check(0, n - 1) && check(0, (n - 1) / 2 - 1) && check((n + 3) / 2 - 1, n - 1)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

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


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define arep(i, x, n) for (long long i = x; i < n; i++)
#define rep(i, n) for (long long i = 0; i < n; ++i)
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9 + 7
// using ll = long long;
typedef long long ll;

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

    char s[n + 2][m + 2];
    int res[n][m];

    rep(i, n + 2) rep(j, m + 2) s[i][j] = '.';

    rep(i, n) {
        string text;
        cin >> text;
        rep(j, m) { s[i + 1][j + 1] = text.at(j); }
    }


    arep(i, 1, n + 1) {
        arep(j, 1, m + 1) {
            ll cnt = 0;
            if (s[i][j] == '.') {
                ll left = j - 1;
                ll right = j + 1;
                ll top = i - 1;
                ll bot = i + 1;

                if (s[top][left] == '#') cnt++;
                if (s[top][j] == '#') cnt++;
                if (s[top][right] == '#') cnt++;
                if (s[i][left] == '#') cnt++;
                if (s[i][right] == '#') cnt++;
                if (s[bot][left] == '#') cnt++;
                if (s[bot][j] == '#') cnt++;
                if (s[bot][right] == '#') cnt++;
            }
            res[i - 1][j - 1] = cnt;
        }
    }

    rep(i, n) {
        rep(j, m) {
            if (res[i][j] == 0) {
                if (s[i + 1][j + 1] == '.') {
                    cout << 0;
                } else {
                    cout << s[i + 1][j + 1];
                }
            } else {
                cout << res[i][j];
            }
        }

        cout << endl;
    }
}

Measured memory_bytes: 3632
A, B, K = map(int, input().split())
n_list = list(range(min(A,B)))
n_list.reverse()
n_list = [1+i for i in n_list]
c = 0

for n in n_list:
    if A%n == 0 and B%n == 0:
        c += 1
    if c == K:
        print(n)
        break

Measured memory_bytes: 3060
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class Task
    {
        public void solve(int testNumber, Scanner in, PrintWriter out)
        {
            int N = in.nextInt();
            int X[] = CPUtils.readIntArray(N, in);

            int minSum = Integer.MAX_VALUE;
            int currentSum = 0;
            for (int pointX = 0; pointX < 110; pointX++)
            {
                for (int x : X)
                {
                    currentSum += (x - pointX) * (x - pointX);
                }
                minSum = Math.min(minSum, currentSum);
                currentSum = 0;
            }
            out.print(minSum);
        }

    }

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

    }
}



Measured memory_bytes: 21844
import java.util.Scanner;

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

        while(true){
            String a = sc.next();
            if(a.equals("-")) break;
            int m = sc.nextInt();
            int h[] = new int[m];
            for(int i = 0; i < m; i ++){
                h[i] = sc.nextInt();
            }
            
            for(int i = 0; i < m; i++) {
                a = a.substring(h[i], a.length()) + a.substring(0, h[i]);
            }
            System.out.println(a);
        }
    }
}


Measured memory_bytes: 26220
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define EB emplace_back

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;

const int INF = 1e9 + 7;

int a[30];

int main()
{
	IO_OP;
	
	int n;
	cin >> n;
	for(int i=0;i<n;i++)
		cin >> a[i];
	int ans = 0;
	for(int i=1;i<n-1;i++)
		if((a[i] < a[i+1] && a[i] > a[i-1]) || (a[i] > a[i+1] && a[i] < a[i-1]))
			ans++;
	cout << ans << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define ff first
#define ss second
#define eps 1e-9

using namespace std;

int main()
{

    ll t,n,m,k,ans;

    cin>>n>>m>>k;

    vector< ll > a(n),b(m);

    cin>>a[0];

    for(int i=1; i<n; i++)
    {
        cin>>a[i];
        a[i]+=a[i-1];
    }

    cin>>b[0];

    for(int i=1; i<m; i++)
    {
        cin>>b[i];
        b[i]+=b[i-1];
    }

    auto it = upper_bound(b.begin(),b.end(),k);

    if(it==b.end())
    {
        ans = b.size();
    }
    else if(it==b.begin())
    {
        ans = 0;
    }
    else
    {
        ans = (it- b.begin());
    }

    for(ll i=0; i<n; i++)
    {
        if(k-a[i]<0)
        {

        }
        else
        {
            t= k-a[i];

            auto it = upper_bound(b.begin(),b.end(),t);
            if(it==b.end())
            {
                ans = max(ans, (ll)(i + 1 + b.size()));
            }
            else if(it==b.begin())
            {
                ans = max(ans,i+1);

            }
            else
            {
                ans = max(ans, (ll)(i + 1 + (it- b.begin())));
            }

        }
    }
    cout<<ans<<endl;

}


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

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

int main(){
    int x1,y1,x2,y2;
    cin>>x1>>y1>>x2>>y2;
    int x = x2-x1, y = y2-y1;
    printf("%d %d %d %d\n",x2-y,y2+x,x1-y,y1+x); 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define MOD (1000000007)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define all(a)  (a).begin(),(a).end()

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

int gcd(int a, int b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

const ll INF = 1LL << 60;

int main(){
  int n; cin >> n;
  vi ans,b(n);
  rep(i, n) {cin >> b[i]; b[i]--;}
  int start = b.size()-1;
  while (b.size() > 0) {
    for (int i = start; i >= 0; i--) {
      if(b[i] == i){
        ans.push_back(i);
        b.erase(b.begin() + i);
        start = b.size()-1;
        break;
      }
      // b[i]=i を見付けることなくfor文を終えてしまったらダメ
      if(i == 0){
        std::cout << -1 << '\n';
        return 0;
      }
    }
  }
  for (int i = n-1; i >= 0; i--) {
    ans[i]++;
    std::cout << ans[i] << '\n';
  }
}


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

#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
ll MOD = 1e9+7;

ll dp[104][100009];
ll a[104],pre[104][100009];
inline int add(int a, int b){
    a += b;
    if(a >= MOD)a -= MOD;
    return a;
}
 
inline int sub(int a, int b){
    a -= b;
    if(a < 0)a += MOD;
    return a;
}
int main(){
    fast;
    ll n,k;cin>>n>>k;

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

    for(ll i=0;i<n;++i)
        pre[i][0] = dp[i][0] = 1;
    
    
    for(ll i=0;i<=k;++i){
        dp[0][i] = 1*(i<=a[0]);
        if(i>0)
            pre[0][i] = pre[0][i-1] + dp[0][i];
        else
            pre[0][0] = 1;
        
    }
    for(ll i=1;i<n;++i){
        for(ll j=1;j<=k;++j){//sum to make
            if(j-a[i]-1<0){
                dp[i][j] = pre[i-1][j]%MOD;
            }
            else{
                dp[i][j] = sub(pre[i-1][j] , pre[i-1][j-a[i]-1]);
            }
            pre[i][j] = add(pre[i][j-1] , dp[i][j]);

            
            /*int first = (j - a[i] - 1 >= 0)? pre[i - 1][j - a[i] - 1] : 0;
            int last = pre[i - 1][j];
            dp[i][j] = add(dp[i][j], sub(last, first));
            pre[i][j] = add(pre[i][j - 1], dp[i][j]);
            */
            /*  precalculate the sum from dp[i-1][max(0,j-a[i])] to dp[i-1][j].
                which is equal to dp[i-1][j] - dp[i-1][max(0,j-a[i])-1]
            */
            /*for(ll l=max(0ll,j-a[i]);l<=j;++l){//
                dp[i][j] = (dp[i][j]%mod + dp[i-1][l]%mod)%mod;
                
            }*/
        }
    }
    /*cout<<endl<<"prefix\n";
    for(ll x=0;x<n;++x){ 
        cout<<"\n->"<<x+1<<endl; 
        for(ll i=0;i<=k;++i){
            cout<<"\t"<<pre[x][i]<<" ";
        }
    }
    cout<<"\ndp\n";
    for(ll x=0;x<n;++x){
        cout<<"\n->"<<x+1<<endl;
        for(ll i=0;i<=k;++i){
            cout<<"\t"<<dp[x][i]<<" ";
        }
    }*/

    cout<<dp[n-1][k];

    return 0;
}

Measured memory_bytes: 80128
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	q,h,s,d = readline() |> split |> parseMap
	n = readline() |> parseInt
	th = min(2*q,h)
	ts = min(2*th,s)
	println(min(d*div(n,2)+n%2*ts,ts*n))
end

main()


Measured memory_bytes: 167536
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<long long>;
using pll = pair<long long, long long>;
#define rep(i,n) for(long long i(0);(i)<(n);(i)++)

const string YES = "Yes";
const string NO = "No";

void solve(long long N, long long M, long long K){
    rep(i, N+1){
        rep(j, M+1){
            if(i*(M-j)+j*(N-i)==K){
                cout << YES << endl;
                return;
            }
        }
    }
    cout << NO << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    long long K;
    scanf("%lld",&K);
    solve(N, M, K);
    return 0;
}


Measured memory_bytes: 764
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int K = sc.nextInt();
    String S = sc.next();
    if(S.length()<=K){
      System.out.println(S);
    }else{
      System.out.println(S.substring(0,K)+"...");
    }
  }
}

Measured memory_bytes: 38556
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7


#############
# Main Code #
#############

N = getN()
memo = [{} for i in range(N + 1)]
def ok(last4):
    for i in range(4):
        t = list(last4)
        if i >= 1:
            t[i - 1],t[i] = t[i], t[i - 1]
        if ''.join(t).count('AGC') >= 1:
            return False
    return True
def dfs(cur, last3):
    if last3 in memo[cur]:
        return memo[cur][last3]
    if cur == N: return 1
    res = 0
    for c in 'ACGT':
        if ok(last3 + c):
            res  = (res + dfs(cur + 1, last3[1:] + c)) % mod
    memo[cur][last3] = res
    return res
print(dfs(0,'TTT'))

Measured memory_bytes: 87100
iN,iM,iX,iY = [int(x) for x in input().split()]
aX = [int(x) for x in input().split()]
aY = [int(x) for x in input().split()]

aX.append(iX)
aY.append(iY)

if max(aX) < min(aY) :
    print("No War")
else:
    print("War")


Measured memory_bytes: 2940
n,m = map(int, input().split())
AB = sorted([list(map(int, input().split())) for _ in range(n)], key=lambda x: x[0])
cost = 0

while m>0:
  ab = AB.pop(0)
  for _ in range(ab[1]):
    m-=1
    cost += ab[0]
    if m==0: break
    
print(cost)

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

using namespace std;

int main()
{
	string S, T;
	cin >> S >> T;

	vector<int> score(S.length() - T.length() + 1);

	for (int i = 0; i < S.length() - T.length() + 1; ++i)
	{
		for (int j = 0; j < T.length(); ++j)
		{
			if (S[i + j] == T[j]) score[i]++;
		}
	}

	int ans = score[0];
	for (int i = 0; i < score.size(); ++i)
	{
		if (score[i] > ans) ans = score[i];
	}

	cout << T.length() - ans;

	return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>

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

using namespace std;

int main() {

	int a,b,k;

	cin >> k>>a>>b;
	bool flg = false;
	rep(i,1000){
		if(i*k>b)break;
		if(a<=i*k &&i*k <= b)
		{
			flg=true;
			break;
		} 
	}
	if(flg)cout << "OK";
	else cout << "NG";

	return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define ll long long
#define V vector<long long>
#define VV vector<vector<long long>>
#define VVV vector<vector<vector<long long>>>
#define rep(i,n) for(ll (i)=0;(i)<(n);++(i))
using namespace std;

long long mod=1e9+7;
struct mint{
    long long x;
    mint(long long 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{return mint(*this)+=a;}
    mint operator-(const mint a)const{return mint(*this)-=a;}
    mint operator*(const mint a)const{return mint(*this)*=a;}
    mint pow(long long 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{return mint(*this)/=a;}
};
istream& operator>>(istream& is,mint& a){return is>>a.x;}
ostream& operator<<(ostream& os,const mint& a){return os<<a.x;}


int main() {
    mint m;
    ll n;
    cin>>m>>n;
    cout<<m.pow(n)<<endl;
}



Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb push_back
#define endl '\n'
#define MOD 1000000007
#define MOD2 998244353

using namespace std;
typedef long long int ll;

int dp[100010][3];
int a[100010][3];
int lim;

int f(int pos, int type)
{
	if (pos == 0) return a[pos][type];
	int &ret = dp[pos][type];
	if (ret != -1) return ret;
	ret = 0;
	for (int i = 0; i < 3; ++i)
	{
		if (i == type) continue;
		ret = max(ret, f(pos-1, i));
	}
	ret += a[pos][type];
	return ret;
}

int main(void)
{
	fast;
	#ifndef ONLINE_JUDGE
	// freopen("in", "r", stdin);
	// freopen("out", "w", stdout);
	#endif

	int n; cin >> n;
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < 3; ++j)
		{
			cin >> a[i][j];
		}
	}
	memset(dp, -1, sizeof dp);
	int ans = max({f(n-1, 0), f(n-1, 1), f(n-1, 2)});
	cout << ans;
}

Measured memory_bytes: 8832
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
	long long n,m;
	char x;
	cin>>n;
	getchar();
	cin>>x;
	getchar();
	cin>>m;
	if(x=='+')cout<<n+m;
	else cout<<n-m;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <utility>
using namespace std;
#define ll long long

ll mize(ll key, vector<int> &v, vector<ll> &x, vector<ll> &y, int t){
    if(v.size()==t) return key;
    if(v.size()==t+1){
        return key%x[v[t]]+(key/x[v[t]])*y[v[t]];
    }
    ll mx=0;
    for(ll i=0; i*x[v[t]]<=key; ++i){
        mx=max(mx, i*y[v[t]]+mize(key-i*x[v[t]], v, x, y, t+1));
    }
    return mx;
}

int main() {
	ll N; cin >> N;
	vector<ll> a(3), b(3);
	for(int i=0; i<3; ++i) cin >> a[i];
	for(int i=0; i<3; ++i) cin >> b[i];
	vector<int> ab, ba;
	for(int i=0; i<3; ++i){
	    if(a[i]<b[i]) ab.push_back(i);
	    if(a[i]>b[i]) ba.push_back(i);
	}
	ll now=mize(N, ab, a, b, 0);
	now=mize(now, ba, b, a, 0);
	cout << now << endl;
	return 0;
}


Measured memory_bytes: 256