akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>          
using namespace std;               
typedef long long ll;

int main() {
    string S, T;
    cin >> S >> T;
    // cin >> S;
    // cin >> T;
    ll N = S.size();
    ll count = 0;
    for (ll i=0; i<N; i++) {
        if (S[i]!=T[i]) {
            count++;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 3928
#include <iostream>
#include <algorithm>

using namespace std;

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

    if(min(A, B) < C && max(A, B) > C){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }


    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] array = new int[n][2];
        
        for (int i = 0; i < n; i++) {
            int num = sc.nextInt();
            int num2 = sc.nextInt();
            
            array[i][0] = num - num2;
            array[i][1] = num + num2;
        }
        
        Arrays.sort(array, (a, b) -> Integer.compare(a[1], b[1]));
        
        int count = 1;
        int now = array[0][1];
        for (int i = 1; i < n; i++) {
            if (now <= array[i][0]) {
                now = array[i][1];
                count++;
            }
        }
        
        System.out.println(count);
    }
}


Measured memory_bytes: 95272
fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val H = readLine()!!.split(" ").map(String::toInt)
    var high = 0
    var p = 0
    H.forEach { h ->
        if (high > h) return@forEach
        high = h
        p++
    }
    println(p)
}

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


using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define reps(i,n) for (int i = 1; i <= (int)(n); ++i)
#define repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for(int i = (int)(n); i > 0; --i)
#define all(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
#define rall(f,x,...) ([&](decltype((x)) whole) { return (f)(rbegin(whole), rend(whole), ## __VA_ARGS__); })(x)
#define sz(a) (int)(a).size()
#define mins(a,...) a = min<decltype(a)>({a, ## __VA_ARGS__})
#define maxs(a,...) a = max<decltype(a)>({a, ## __VA_ARGS__})
#define plusMod(a,b) a = (a % mod + b % mod) % mod
using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e17;
ll mod = static_cast<ll>(1e9 + 7);
std::ostream& endn(std::ostream& os) {
    return os.put(os.widen('\n'));
}
template<typename A, size_t N, typename T>
void fillArray(A(&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}


int n, k;
ll dp[105][100005];
void solve() {
    cin >> n >> k;

    vector<pair<int, int>> s;
    for (int i = 1; i * i <= n; ++i) {
        s.emplace_back(i, 0);
        s.emplace_back(n / i, 0);
    }

    all(sort, s);
    s.erase(all(unique, s), s.end());

    auto m = sz(s);
    rep(i, m - 1) {
        auto l = n / s[i + 1].first;
        auto r = n / s[i].first;
        s[i].second = r - l;
    }
    s.back().second = 1;

    map<int, int> mp;
    rep(i, m)
        mp[s[i].first] = i;

    dp[0][mp[n]] = 1;
    rep(i, k) {
        repd(j, m - 1)
            plusMod(dp[i][j], dp[i][j + 1]);
        rep(j, m) {
            auto nj = mp[n / s[j].first];
            plusMod(dp[i + 1][j], dp[i][nj] * s[j].second);
        }
    }

    ll ans = 0;
    rep(j, m)
        plusMod(ans, dp[k][j]);

    cout << ans << endn;

}


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

    solve();

    cout << flush;

    return 0;
}


Measured memory_bytes: 83064
from scipy.misc import comb
#from scipy.special import comb

N, K = map(int, input().split())
B = K
R = N - K
for i in range(1, K+1):
    # R+i C i
    #tmp1 = comb(R+1, i, exact = True)%10000000007
    tmp1 = comb(N-K+1, i, exact=True)
    rest = B - i
    # i H rest
    #tmp2 = comb(B-1, i-1, exact = True)%10000000007
    tmp2 = comb(K-1, i-1, exact=True)

    ans = (tmp1*tmp2)%1000000007
    print(int(ans))

Measured memory_bytes: 14148
#include <iostream>

using namespace std;

int main(){

	int k,n;
	cin>>k>>n;
	int a[n];
	int b=0;
	int ans=0;

	for(int i=0;i<n;i++){
	
		cin>>a[i];
	}
	for(int i=1;i<n;i++){
	
		ans+=a[i]-a[i-1];
		if(a[i]-a[i-1]>=b){
		
			b=a[i]-a[i-1];
		}
	}
	if(k-a[n-1]+a[0]>b){
	
		cout<<ans;
		return 0;
	}
	ans+=k-a[n-1]+a[0];
	ans-=b;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 4428
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long
#define float long double
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define endl '\n'
#define pii pair<int, int>
#define min3(a,b,c) min(a, min(b, c))
#define max3(a,b,c) max(a, max(b, c))
#define all(x) x.begin(), x.end()
#define fill(a,b) memset(a, b, sizeof(a))
#define sz(x) (int)x.size()
#define sp(x) setprecision(x)
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define bs binary_search

signed main()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

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

    int x,k,d; cin>>x>>k>>d;
    x=abs(x);
    int p=x/d;
    if(p>=k){
        cout<<x-k*d<<endl;
        return 0;
    }
    int a=x%d,c=k-p;
    if(c%2==0) cout<<a<<endl;
    else cout<<abs(a-d)<<endl;

}

Measured memory_bytes: 3616
/*input
15 8 5
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
//}}}
const ll maxn=1005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}

ll f[200];

ll dp[maxn][maxn];;

int main()
{
	IOS;
	f[0]=f[1]=1;
	for(int i=2;i<200;i++){
		f[i]=f[i-1]+f[i-2];
		if(f[i]>=MOD) f[i]-=MOD;
	}
	dp[0][0]=1;
	int h,w,k;
	cin>>h>>w>>k;

	for(int i=1;i<=h;i++){
		REP(j,w){
			if(j-1>=0){
				dp[i][j]+=dp[i-1][j-1]*f[j-1]%MOD*f[w-(j+1)]%MOD;
				if(dp[i][j]>=MOD) dp[i][j]-=MOD;
			}
			dp[i][j]+=dp[i-1][j]*f[j]%MOD*f[w-(j+1)]%MOD;
			if(dp[i][j]>=MOD) dp[i][j]-=MOD;
			if(j+1<w){
				dp[i][j]+=dp[i-1][j+1]*f[j]%MOD*f[w-(j+2)]%MOD;
				if(dp[i][j]>=MOD) dp[i][j]-=MOD;
			}

		}
	}


	cout<<dp[h][k-1]<<'\n';
	return 0;
}


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

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

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


Measured memory_bytes: 256
import java.util.*;
import java.io.*;

class Point{
    int dim;
    int[] cood;
    public Point(int[] c){
        this.cood = c;
        this.dim = c.length;
    }
    int sqDistance(Point another){
        int ans = 0;
        for(int d=0; d<dim; d++) ans += (this.cood[d]-another.cood[d])*(this.cood[d]-another.cood[d]);
        return ans;
    }
}
public class Main {
    static boolean isSquare(int n){
        for(int i=0; i*i<=n; i++) if(i*i==n) return true;
        return false;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int D = sc.nextInt();
        Point[] p = new Point[N];
        for(int n=0; n<N; n++){
            int[] c = new int[D];
            for(int d=0; d<D; d++) c[d] = sc.nextInt();
            p[n] = new Point(c);
        }
        int ans = 0;
        for(int i=0; i<N; i++) for(int j=i+1; j<N; j++){
            if(isSquare(p[i].sqDistance(p[j]))) ans++;
        }
        System.out.println(ans);

    }
}

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

using namespace std;

int main(){
    int N, M;
    cin >> N >> M;
    vector<pair<long, long>> cost(N);
    for(int i=0;i<N;i++){
        cin >> cost[i].first >> cost[i].second;
    }

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

    long long sum=0, num_sum=M;
    for(int i=0;i<N;i++){
        if(num_sum > cost[i].second){
            sum += cost[i].first * cost[i].second;
            num_sum -= cost[i].second;
        }
        else{
            sum += cost[i].first * num_sum;
            break;
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 1792
import java.util.Scanner;

//A New Plan of Aizu Ski Resort
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[][] move = {{1,-1},{1,0},{1,1}};
		while(true){
			int w = sc.nextInt();
			int h = sc.nextInt();
			if((w|h)==0)break;
			int[][] map = new int[h+1][w];
			int[][] dp = new int[h][w];
			for(int i=0;i<h;i++)for(int j=0;j<w;j++)map[i][j]=sc.nextInt();
			for(int j=0;j<w;j++)if(map[h-1][j]!=1)dp[h-1][j]=1;
			for(int i=h-2;i>=0;i--){
				for(int j=0;j<w;j++){
					if(map[i][j]==1){
						dp[i][j] = 0;
						continue;
					}
					if(map[i][j]==2){
						if(i+2==h)dp[i][j]=1;
						else dp[i][j]=dp[i+2][j];
					}
					else{
						int s = 0;
						for(int k=0;k<3;k++){
							int ni = i+move[k][0];
							int nj = j+move[k][1];
							if(0<=nj&&nj<w){
								if(k!=1 && map[ni][nj]==2)continue;
								s+=dp[ni][nj];
							}
						}
						dp[i][j]=s;
					}
				}
			}
			int s=0;
			for(int j=0;j<w;j++)s+=dp[0][j];
			System.out.println(s);
		}
	}
}

Measured memory_bytes: 0
#include<iostream>
#include<bitset>
#include<vector>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;



int main() {
    int h, w, k;
    cin >> h >> w >> k;
    vector<string> s(h);
    rep(i,h) cin >> s[i];

    int ans = 0;

    rep(is, 1 << h)
        rep(js, 1 << w){
            int cnt = 0;
            rep(i,h)
                rep(j,w){
                    if(is >> i& 1) continue;
                    if(js >> j & 1) continue;
                    if(s[i][j] == '#') cnt++;
                }
            if(cnt == k) ans++;
        }
    cout << ans << endl;
}

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

struct UnionFind{
	vector<int> d;
	UnionFind(int n) : d(n, -1){}
	int find(int x){
		if(d.at(x) < 0) return x;
		return d.at(x) = find(d.at(x));
	}
	bool unite(int x, int y){
		x = find(x); y = find(y);
		if(x == y) return false;
		if(d.at(x) > d.at(y)) swap(x, y);
		d.at(x) += d.at(y);
		d.at(y)= x;
		return true;
	}
	bool same(int x, int y) { return find(x) == find(y); }
	int size(int x) { return -d.at(find(x)); }
};

int main(){
	int n, m, k, a, b;
	cin >> n >> m >> k;
	UnionFind uf(n);
	vector<int> deg(n, 0);
	vector<vector<int>> to(n, vector<int>());
	rep(i, m){
		cin >> a >> b;
		a--; b--;
		deg.at(a)++;
		deg.at(b)++;
		uf.unite(a, b);
	}
	
	rep(i, k){
		cin >> a >> b;
		a--; b--;
		to.at(a).push_back(b);
		to.at(b).push_back(a);
	}
	
	rep(i, n){
		int ans = uf.size(i) - 1 - deg.at(i);
		for(int u : to.at(i)){
			if(uf.same(i, u)) ans--;
		}
		if(i != 0) cout << " ";
		cout << ans;
	}
	cout << endl;
	
	return 0;
}

Measured memory_bytes: 6784
N = int(input())
S = input().strip()

ans = ""

l = 0
r = 0

for i in range(N):
    if S[i] == "(":
        l += 1
        ans += "("
    else:
        r += 1
        if l >= r:
            ans += ")"
        else:
            ans = "(" + ans + ")"
            l += 1

while l < r:
    ans = "(" + ans
    l += 1
while l > r:
    ans += ")"
    r += 1

print(ans)


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = Integer.parseInt(scan.next());
        int m = Integer.parseInt(scan.next());

        int[] c = new int[m];
        for (int i = 0; i < m; i++) {
            c[i] = Integer.parseInt(scan.next());
        }
        scan.close();

        int[] dp = new int[n + 1];

        dp[1] = 1;
        for (int i = 1; i < n; i++) {
            int min = dp[i] + 1;
            for (int j = 0; j < m; j++) {
                if (i + 1 - c[j] >= 0 && min > dp[i + 1 - c[j]] + 1) {
                    min = dp[i + 1 - c[j]] + 1;
                }
            }
            dp[i + 1] = min;
        }

        System.out.println(dp[n]);
    }

}



Measured memory_bytes: 26920
#include <stdio.h>
#include <math.h>
#define Max 10000

int primte(int);

int main(){
  int i,n,sum=0;
  int judge;
  int x[Max];

  scanf("%d",&n);
  for(i=0;i<n;i++){scanf("%d",&x[i]);}

  for(i=0;i<n;i++){
    judge = prime(x[i]);
    if(judge==0)sum++;
  }
  printf("%d\n",sum);
}

int prime(int x){
  int i,n;
  n = sqrt(x);
  if(x==2)return 0;
  if(x%2==0||x==1)return -1;

  for(i=3;i<=n;i+=2){
    if(x % i == 0) {return -1;}
  }
  return 0;
}



Measured memory_bytes: 2060
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define PI 3.141592
#define MOD7 1000000007
#define LL_INF 9000000000000000000
#define LL_MINF -9000000000000000000
#define INT_INF 2000000000
#define INT_MINF -2000000000
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int main(){
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    for(int i = 0; i < N; i++) cin >> A[i];
    N -= K;
    cout << (N + K - 2) / (K -1) + 1 << endl;
}

Measured memory_bytes: 3716
#include <iostream>
#include <vector>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <queue>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define ll long long
#define fr(i,k,N) for(ll i=k; i<N;i++)
#define rep(i,N) for(ll i=0; i<N;i++)
#define alll(v) v.begin(),v.end()
using namespace std;
template <class X> void pr(X test){cout<<test<<endl;}
template <class X> void prr(X test){for(auto it:test){cout<<it<<endl;}cout<<endl;}

int main() {
    string s;
    cin>>s;
    pr(2*min(count(s.begin(),s.end(),'0'), count(s.begin(),s.end(),'1')));    
}



Measured memory_bytes: 512
#include <stdio.h>

long long int factorial(int x,long long int y){
	if (x==1) return y;
	else {
		y *= x;
		factorial(x-1,y);
	}
}

int main(){
	int a;
	scanf("%d",&a);
	printf("%lld\n",factorial(a,1));
	return 0;
}

Measured memory_bytes: 0
abcde = list()
ans = "Yay!"
flag = True
for i in range(6):
    abcde.append(int(input()))

for i in range(5):
    for j in range(5):
        if abs(abcde[i] - abcde[j]) > abcde[5]:
            ans = ":("
            flag = False
            break
    if flag != True: break
print(ans)


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

#define ll long long long

using namespace std;

int main (){
    //freopen("input.txt", "r", stdin);

    int n;
    cin>>n;

    int a = n/500;
    int ans = a*1000;
    n -= (a*500);
    a = n / 5;
    ans += a*5;
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    long  double a, b, c;
    cin >> a >> b >> c; 
    string messages = "No";
    if(a + b + 2*sqrt(a)*sqrt(b) < c) {
        messages = "Yes";
    }
    cout << messages << endl;
    return 0;
}

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

int main()
{
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++)
  {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  a.erase(unique(a.begin(), a.end()), a.end());
  if (n == a.size())
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}

Measured memory_bytes: 1024
import numpy as np

A, B, H, M = map(int, input().split())
delta_min = 360 / 60
deg_min = delta_min * M
delta_hour = 360 / 12
delta_min_in_hour = 30 / 60
deg_hour = delta_hour * H + delta_min_in_hour * M

hour_X = A * np.sin(np.deg2rad(deg_hour))
hour_Y = A * np.cos(np.deg2rad(deg_hour))
min_X = B * np.sin(np.deg2rad(deg_min))
min_Y = B * np.cos(np.deg2rad(deg_min))

print(np.sqrt((hour_X - min_X)**2 + (hour_Y-min_Y)**2))


Measured memory_bytes: 27224
#!/usr/bin/env python3
# GRL_4_A: Path/Cycle - Cycle Detection for a Directed Graph


from collections import namedtuple

DirectedEdge = namedtuple('DirectedEdge', ('src', 'dest'))


class Digraph:
    def __init__(self, v):
        self.v = v
        self._edges = [[] for _ in range(v)]

    def add(self, edge):
        self._edges[edge.src].append(edge)

    def adj(self, v):
        return self._edges[v]

    def edges(self):
        for es in self._edges:
            for e in es:
                yield e


def has_cycle(graph):
    def dfs(v):
        if visited[v]:
            if not left[v]:
                return True
        else:
            visited[v] = True
            for e in graph.adj(v):
                if dfs(e.dest):
                    return True
            left[v] = True
        return False

    visited = [False] * graph.v
    left = [False] * graph.v

    for v in range(graph.v):
        if not visited[v] and dfs(v):
            return True

    return False


def run():
    v, e = [int(i) for i in input().split()]
    g = Digraph(v)

    for _ in range(e):
        s, t = [int(i) for i in input().split()]
        g.add(DirectedEdge(s, t))

    if has_cycle(g):
        print("1")
    else:
        print("0")


if __name__ == '__main__':
    run()



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

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 n, r;
  cin >> n >> r;
  if(n >= 10) cout << r << endl;
  else cout << (r+100*(10-n)) << endl;
}





Measured memory_bytes: 256
package main
import "fmt"

func main() {
  var (
    A int
    B int
    C int
  )
  fmt.Scan(&A)
  fmt.Scan(&B)
  fmt.Scan(&C)

  if A + B >= C {
    fmt.Println("Yes")
  } else {
    fmt.Println("No")
  }
  
}


Measured memory_bytes: 512
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

// Use g++ compiler for this include to work.
#include <bits/stdc++.h>

using namespace std;

// Constants 
#define INF 1e18
#define EPS 1e-9
#define MOD 1000000007
 
// // for using in pairs
#define F first
#define S second
 
// Macros
#define all(x) begin(x), end(x)
 
// aliases
using ll = long long;
using ull = unsigned long long;
using ui = unsigned int;
using ld = long double;

// Temporary macro.
#define int long long

// Operator overloads.
/**
 * The type of element in the vector should have overload for << operator with ostream. 
 */
template<typename T>
ostream& operator<<(ostream &stream, vector<T> v)
{
	for (const auto &it : v)
		stream << it << " ";
	return stream;
}

/**
 * Both types in the pair should have overload for << operator with ostream. 
 */
template<typename T1, typename T2>
ostream& operator<<(ostream &ostream, pair<T1, T2> p)
{
	ostream << p.first << " " << p.second;
	return ostream;
}

template<typename T>
void swap(T &a, T &b)
{
	T t = a;
	a = b;
	b = t;
}

// Utility functions.
void swap(int &a, int &b)
{
	int t = a;
	a = b;
	b = t;
}

int GCD(int a, int b)
{
	if (!b)
		return a;
	return GCD(b, a % b);
}

int LCM(int a, int b)
{
	return (a * b) / GCD(a, b);
}

int modpow(int x, int n, int m = MOD)
{
	if (n == 0) return 1 % m;
	long long u = modpow(x, n / 2, m);
	u = (u * u) % m;
	if (n % 2 == 1)
		u = (u * x) % m;
	return u;	
}

//////////////////// START CODE HERE ///////////////////////////


void solve(int tc)
{
	int n, m;
	cin >> n >> m;
	char a[n][m];
	for (int i = 0; i < n; i++)
		for (int j = 0; j < m; j++)
			cin >> a[i][j];

	int dp[n + 1][m + 1]; // dp[i][j] : represents the number of possible paths from 1,1 to i, j

	for (int i = 0; i <= n; i++)
	{
		for (int j = 0; j <= m; j++)
		{
			if (!i || !j)
			{
				dp[i][j] = 0;
				continue;
			}
			if (i == 1 && j == 1)
			{
				dp[i][j] = 1;
				continue;
			}
			dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
			if (a[i - 1][j - 1] == '#')
				dp[i][j] = 0;
			dp[i][j] %= MOD;
		}
	}
	cout << dp[n][m];
}

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

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

	int t = 1;
	// cin >> t;		
	for (int i = 1; i <= t; i++)
	{
		solve(i);
	}

	return 0;
}


Measured memory_bytes: 12416
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,sum=0;
  cin>>N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin>>A[i];
    sum+=A[i];
    }
  sort(A.begin(),A.end());
  if(A[N-1]<sum-A[N-1])
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
  }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; --i)
#define FOR(i, n, m) for (int i = m; i < n; i++)
#define MM(i, n, m) for (int i = m; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

typedef long long ll;

/**
 * C問以降は ll を使う.
 * double型にするのを忘れない.
 * nC2の求め方 (1/2)*n*(n-1)
 * vector<型> 変数名(要素数, 初期値)
 * pair<型, 型> 変数名
 * map<型, 型> 変数名  // 連想配列
 * priority_queue<型> 変数名  // 最大値から出てくるヒープ
*/
int main()
{
    int n;
    cin >> n;
    if (n == 1) {
        cout << "Hello World" << endl;
    } else {
        int a, b;
        cin >> a >> b;
        cout << a + b << endl;
    }
    return 0;
}

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



int main()
{
        int n;
        cin>>n;
        LL a[n+2][3],DP[n+2][3];
        for(int i=1;i<=n;i++)
        {
                for(int j=0;j<=2;j++)
                {
                        cin>>a[i][j];
                        DP[i][j]=0;
                }
        }
        DP[1][0]=a[1][0];
        DP[1][1]=a[1][1];
        DP[1][2]=a[1][2];
        for(int i=2;i<=n;i++)
        {
                DP[i][0] = max(DP[i-1][1] , DP[i-1][2]) + a[i][0];
                DP[i][1] = max(DP[i-1][0] , DP[i-1][2]) + a[i][1];
                DP[i][2] = max(DP[i-1][0] , DP[i-1][1]) + a[i][2];
        }
        cout<<max(DP[n][0] , max(DP[n][1] ,DP[n][2]));
  }

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main() {
	int a,b; cin >> a >> b;
	if(a<9 && b<9) cout << "Yay!" << endl;
	else cout << ":(" << endl;
}


Measured memory_bytes: 256
N,C = map(int,input().split())
d = [list(map(int,input().split())) for _ in range(C)]
g0 = [0]*C
g1 = [0]*C
g2 = [0]*C
for i in range(N):
    col = list(map(int,input().split()))
    for j in range(N):
        col[j] -= 1
        if (i+j)%3==0:
            g0[col[j]] += 1
        elif (i+j)%3 ==1:
            g1[col[j]] += 1
        else:
            g2[col[j]] += 1
ans = float('inf')
for i in range(C):
    for j in range(C): 
        for k in range(C):
            if i==j or j==k or i==k:
                continue
            s=0
            for l in range(C):
                s += d[l][i]*g0[l] + d[l][j]*g1[l] + d[l][k]*g2[l]
            ans = min(ans,s)
print(ans)


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


int i,j;
const int INF=100000000;
const int mod=998244353;
   long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}
  


int main (){
  ll n,m,k,ans,ba;
  ans=0;
 cin >> n >> m >> k;
  ll kai[n];
  ll rui[n];
  ll invkai[n];
  
  kai[0]=1;
  invkai[0]=1;
  
  rui[0]=1;
  for(i=0;i<n-1;i++)
  {
    kai[i+1]=kai[i]*(i+1)%mod;
    invkai[i+1]=modinv(kai[i+1],mod);
    rui[i+1]=rui[i]*(m-1)%mod;
  }
  for(i=0;i<k+1;i++)
  {
    ba=kai[n-1]*invkai[i]%mod*invkai[n-i-1]%mod*m%mod*rui[n-i-1]%mod;
    ans+=ba;
    ans=ans%mod;
  }
  cout << ans << endl;
  
  
  
}  
  

Measured memory_bytes: 8280
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#include <climits>
#include <iostream>
#include <string>
#include <bitset>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>

using namespace std;

#define ALL(g) (g).begin(), (g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define INF 1 << 30
#define pb push_back
#define mp make_pair

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

static const int MAX = 100000;


vector<int> G[MAX];
vector<int> out;
int V[MAX];
int N;
int indeg[MAX];

void bfs(int s) {
    queue<int> q;
    q.push(s);
    V[s] = 1;
    while (!q.empty()) {
        int u = q.front(); q.pop();
        out.push_back(u);

        rep(i, G[u].size()) {
            int v = G[u][i];
            indeg[v]--;
            if (indeg[v] == 0 && V[v] == 0) {
                V[v] = 1;
                q.push(v);
            }
        }
    }
}


void tsort(void) {
    rep(i, N) {
        V[i] = 0;
        indeg[i] = 0;
    }

    rep(i, N) {
        rep(j, G[i].size()) {
            indeg[G[i][j]]++;
        }
    }

    rep(i, N) {
        if (indeg[i] == 0 && V[i] == 0) bfs(i);
    }
}


int main(void) {
    int M, s, t;
    scanf("%d %d", &N, &M);

    rep(i, M) {
        scanf("%d %d", &s, &t);
        G[s].push_back(t);
    }

    tsort();

    rep(i, out.size()) printf("%d\n", out[i]);

    return 0;
}

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

int main(){
  int n, x;
  cin >> n >> x;
  vector<int> vec(n);
  for(auto& v : vec){
    cin >> v;
  }
  int count = 1;
  int p = 0;
  for(auto v : vec){
    p += v;
    if(p <= x){
      count++;
    }else{
      break;
    }
  }
  cout << count;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const LL MOD = 1e9 + 7;

int main(){
    
    // 1. 入力情報取得.
    LL H, W;
    scanf("%lld %lld", &H, &W);
    char A[1001][1001];
    for(int i = 0; i < H; i++){
        char c[1001];
        scanf("%s", c);
        for(int j = 0; j < W; j++) A[i][j] = c[j];
    }
    
    // 2. 経路数を計算.
    LL dp[H][W] = {};
    // ゴール地点を, 1通りで設定.
    dp[H - 1][W - 1] = 1;
    for(LL i = H - 1; i >= 0; i--){
        for(LL j = W - 1; j >= 0; j--){
            string s = A[i];
            // 右.
            if(j < W - 1){
                string s = A[i];
                if(s[j] == '.' && s[j + 1] == '.') dp[i][j] = dp[i][j + 1], dp[i][j] %= MOD;
            }
            // 下.
            if(i < H - 1){
                string s = A[i], t = A[i + 1];
                if(s[j] == '.' && t[j] == '.') dp[i][j] = dp[i + 1][j], dp[i][j] %= MOD;
            }
            // 右 and 下.
            if(j < W - 1 && i < H - 1){
                string s = A[i], t = A[i + 1];
                if(s[j] == '.' && s[j + 1] == '.' && t[j] == '.'){
                    dp[i][j] = dp[i][j + 1] + dp[i + 1][j], dp[i][j] %= MOD;
                }
            }
        }
    }
    
    // for(LL i = 0; i < H; i++){
    //     for(LL j = 0; j < W; j++){
    //         cout << dp[i][j] << " ";
    //     }
    //     cout << endl;
    // }
    // 3. 後処理.
    printf("%lld", dp[0][0]);
    return 0;
    
}

Measured memory_bytes: 9088
n,m = map(int,input().split())
l = list(map(int,input().split()))
s = sum(l)
l.sort(reverse=True)
count = 0
for i in range(n):
  if l[i] >= s/(4*m):
    count += 1
  else:
    break
print('Yes' if count >= m else 'No')

Measured memory_bytes: 38384
import numpy as np
N = int(input())


V = np.array([int(i) for i in input().split()])


C = np.array([int(j) for j in input().split()])

profit = 0
for k in range(N):
    if V[k] - C[k] > 0:
        profit += V[k] - C[k]
print("{}".format(profit))


Measured memory_bytes: 21568
#include <bits/stdc++.h>
#define ALL(a) (a).begin(),(a).end()
#define N_MAX 1000
#define ll long long int
using namespace std;

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

	int cnt = 0;
	for (int i = 0; i < 3; i++) {
		if (S[i] == T[i])cnt++;
	}

	cout << cnt << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		double x, h, s, v;
		
		while(true){
			x = scan.nextDouble();
			h = scan.nextDouble();
			if(x == 0 && h == 0)break;
			
			s = Math.sqrt(Math.pow(h, 2) + Math.pow(x/2, 2));
			
			v = x * x + x * s * 2;
			System.out.println(v);
		}
	}
}

Measured memory_bytes: 27932
#include<bits/stdc++.h>
using namespace std;
using ll  = long long;
using vl  = vector<ll>;
using vi  = vector<int>;
#define _GLIBCXX_DEBUG
#define IO_STREAM cin.tie(0);ios::sync_with_stdio(false)
#define all(x) x.begin(),x.end()
#define rep(i,sta,end) for(ll i=sta;i<end;++i)
#define lcm(a,b) (a)/__gcd((a),(b))*(b)
#define pb push_back
const ll INF = 1000000000000000;
const ll MOD = 1000000007;
const double PI = acos(-1);
//||
#define DBG(a,b,c,d) cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<endl
//DBG("","","","");

ll sum(ll n){
	ll ret;
	ret = n*(n+1);
	ret /= 2;
	return ret;
}

signed main(){
	IO_STREAM;
	ll N;	cin>>N;
	ll ans=0;
	rep(i,1,N+1){
		ans+=sum(N/i)*i;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3632
import sys
input = sys.stdin.readline
import numpy as np
x, y, a, b, c = map(int, input().split())
P = [0]*x + [int(p) for p in input().split()]
Q = [0]*y + [int(q) for q in input().split()]
R = [int(r) for r in input().split()]

P.sort()
Q.sort()
R.sort(reverse=True)
Px = P[a:]
Qy = Q[b:]
R = R[:x+y]
pc, qc = 0, 0
pqpq = [Px, Qy]
pqc = [pc, qc]
pqctop=[x, y]
for r in R:
    if pqc[0] == x:
        pq = 1
    elif pqc[1] == y:
        pq = 0
    else:
        if Px[pqc[0]]<Qy[pqc[1]]:
            pq = 0
        else:
            pq = 1
    if pqpq[pq][pqc[pq]] < r:
        pqpq[pq][pqc[pq]] = r
        pqc[pq]+= 1
    else:
        break

print(sum(Px)+sum(Qy))


Measured memory_bytes: 32816
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int N;
int a[110];

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N;
  double sum = 0;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    sum += a[i];
  }  
  sum /= N;
  double dis = 1e9;
  int pos = -1;
  for (int i = 0; i < N; i++) {
    if (pos < 0 || abs(sum-a[i]) < dis) {
      pos = i;
      dis = abs(sum-a[i]);
    }
  }
  cout << pos << endl;

  return 0;
}

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


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#define fo(i, n) for(int i=0; i<n; i++)
#define Fo(i, k, n) for(int i=k; i<n; i++)
#define w(x)  int x; cin>>x; while(x--)
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define watch2(x,y) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<"\n"
#define watch3(x,y,z) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<" and "<<(#z)<<" is "<<(z)<<"\n"
#define watch4(x,y,z,q) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<" and "<<(#z)<<" is "<<(z)<<" and "<<(#q)<<" is "<<(q)<<"\n"
#define MOD 1000000007
#define INF 1000000007;
#define F first
#define S second
#define pb(x) push_back(x);


#define ll  long long
#define all(c) (c).begin(),(c).end()
#define endl "\n"

typedef vector<int> vl;
typedef vector< vl > vvl;
typedef pair< int, int> pll;
typedef map< int, int> mll;


#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif





void c_p_c()
{
#ifndef ONLINE_JUDGE
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
void parray(int a[], int n) {
	for (int i = 0; i < n; i++) {
		cout << a[i] << " ";
	}
	cout << endl;
}

int main() {
	ll i, n, m, k, c = 0, sum = 0;
	c_p_c();
	ll no;

	cin >> n >> m;
	int a[n];
	fo(i, n) cin >> a[i];
	ll t = 0;

	t += m;
	ll pos=a[0]+m;
	// debug(t,pos);
	for (int i = 1; i < n; ++i)
	{
		if(a[i]<pos){
			ll less = pos-a[i];
			t-=less;
		}
		t+=m;
		pos=a[i]+m;
		// debug(t);
	}
	cout<<t<<endl;


	return 0;
}



Measured memory_bytes: 4316
import math

a,b,C = list(map(int,input().split()))

S = a * b * math.sin(math.radians(C)) / 2
c = math.sqrt(a**2 + b**2 - 2 * a * b * math.cos(math.radians(C)))
h = 2 * S / a

print(S)
print(a+b+c)
print(h)

Measured memory_bytes: 7752
#include<bits/stdc++.h>
#define ll               long long
#define mod              1000000007
#define endl              "\n"
#define fast               ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb                push_back
#define all(v)             v.begin(),v.end()
#define inp(V,n)      for(int i=0;i<n;i++){cin >> V[i];}
#define oup(V,n)     {for(int i=0;i<n;i++){cout <<  V[i] << " "  ;} cout << endl;}
using namespace std;
ll factorial(ll n)
{
    return (n == 1 || n == 0) ? 1 : n * factorial(n - 1);
}
ll gcd(ll a, ll b)
{
    if (a == 0)
      return b;
    return gcd(b % a, a);
}
ll lcm(ll a, ll b)
{
   return (a*b)/gcd(a, b);
}
bool sortByVal(const pair<ll,ll> &a,
               const pair<ll,ll> &b)
{
    return (a.second > b.second);
}
ll Powb(ll b,ll n)
{
    if(n==0) return 1LL;
    if(n==1) return b;
    ll temp = Powb(b,n/2);
    if(n%2==0){return (temp*temp)%mod;}
    else{return (b*((temp*temp)%mod))%mod;}
}
ll sumofdigit(ll n)
{
    ll c=0,d=0,sum=0,i;
    while(n>0)
    {
        c=n%10;
        sum+=c;
        n/=10;
    }
    return sum;
}
int main()
{
     fast;
     int t=1;
     //cin>>t;
     while(t--)
     {
       double c=0,m=3.141592653589793238,i,j,d=0,sum=0,e=0,f=0,g=0,h=0,n,maxi=0;
       cin>>n;
       c=2*m*n;
       cout<<fixed<<setprecision(20)<<c;



     }

}


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

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

	int c = a * b;

	if (c % 2 == 0) {
		cout << "Even" << endl;
	}
	else {
		cout << "Odd" << endl;
	}
}

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

int main(){
    using namespace std;
    constexpr unsigned long MOD = 998244353;
    size_t N, M;
    cin >> N >> M;
    auto modpow = [&MOD](unsigned long a, unsigned long n, unsigned long b = 1) -> unsigned long{
        auto ret = b % MOD;
        a %= MOD;
        while(n){
            if(n & 1)(ret *= a) %= MOD;
            (a *= a) %= MOD;
            n >>= 1;
        }
        return ret;
    };
    auto modbinomial = [&MOD, &modpow](unsigned long n, unsigned long k) -> unsigned long{
        unsigned long ret = 1, den = 1;
        for(unsigned long i = 1; i <= k; ++i){
            (ret *= (n - i + 1)) %= MOD;
            (den *= i) %= MOD;
        }
        return modpow(den, MOD - 2, ret);
    };
    auto a = modbinomial(MOD - N, 3 * M) + N * modbinomial(MOD - N, M - 1);
    a = M & 1 ? MOD - a % MOD : a % MOD;
    if(M + 1 < N){
        auto ub = min(N, 3 * M), lb = M, sz = (ub - lb) / 2;
        vector<unsigned long> A(sz), B(sz);
        {
            auto k = M + 2;
            auto nn = N, dd = k;
            A[0] = modbinomial(nn, dd);
            for(unsigned long i = 1; i < sz; ++i){
                A[i] = modpow((dd + 1) * (dd + 2), MOD - 2, A[i - 1] * (nn - dd) % MOD * (nn - dd - 1));
                dd += 2;
            }
        }
        {
            auto kk = ub;
            if((ub ^ M) & 1)kk -= 1;
            auto nn = N - 1 + (3 * M - kk) / 2, dd = N - 1;
            B.back() = modbinomial(nn, dd);
            for(unsigned long i = sz - 1; i--; ++nn)B[i] = modpow(nn - dd + 1, MOD - 2, B[i + 1] * (nn + 1));
        }
        a += MOD - inner_product(A.begin(), A.end(), B.begin(), 0UL, plus<>(), [&MOD](auto a, auto b){return a * b % MOD;}) % MOD;
    }
    cout << a % MOD << endl;
    return 0;
}

Measured memory_bytes: 4608
using System;
using System.Collections.Generic;

namespace at
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = Console.ReadLine().Split(' ');
            var n1 = int.Parse(a[0]);
            var n2 = int.Parse(a[2]);

            if(a[1]=="+")
            {
                Console.WriteLine(n1+n2);
            }
            else
            {
                Console.WriteLine(n1-n2);
            }
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
 using namespace std;
 #define rep(i,N) for(int i=0;i<int(N);++i)
 using ll = long long;
 const int INF = 2147483647;
 const ll MOD = 1000000007;
//  const long long INF = 1LL << 60;

int main(){
   ll n,k;
   cin >> n >> k;
   vector<ll> a(n);
   rep(i,n) cin >> a[i];
   vector<pair<ll,ll>> comp(n-k+1);
   rep(i,n-k+1){
      comp[i].first = a[i];
      comp[i].second = a[k-1+i];
   }
   vector<bool> ans(n-k+1);
   rep(i,n-k+1){
      if(i==0) continue;
      if(comp[i].second>comp[i-1].first){
         ans[i] = true;
      }
      else
         ans[i] = false;
   }
   rep(i,n-k+1){
      if(i==0) continue;
      else{
         if(ans[i]) cout << "Yes" << endl;
         else cout << "No" << endl;
      }
   }
   return 0;
}

Measured memory_bytes: 8004
# coding: utf-8

def lcs(str1, str2):
    # dp[i][j]: str1のi番目までとstr2のj番目までを使って作れるlcs
    dp = [[0 for _ in range(len(str2)+10)] for _ in range(len(str1)+10)]
    # 計算量は1000*1000=10^6なんだけど時間切れ？
    for i in range(0,len(str1)):
        for j in range(0,len(str2)):
            v = max(dp[i+1][j],dp[i][j+1])
            if str1[i] == str2[j]:
                dp[i+1][j+1] = max(v,dp[i][j] + 1)
            else:
                dp[i+1][j+1] = max(v,dp[i][j])
    return dp[len(str1)][len(str2)]

# てか、普通のdpじゃ通らないってどんだけシビアなんだ
def lcs_another(str1, str2):
    # str1の中の文字列とstr2の中の文字列が一致したらその位置から先を＋１するだけ
    # なんか自然には思い浮かばないなあ
    dp = [0 for _ in range(len(str2)+10)]
    for c1 in str1:
        tmp = dp[:]
        for i, c2 in enumerate(str2):
            if c1 == c2:
                dp[i+1] = tmp[i]+1
            elif dp[i+1] < dp[i]:
                dp[i+1] = dp[i]
    return dp[len(str2)]

p = int(input().rstrip())
for _ in range(p):
    line1 = input().rstrip()
    line2 = input().rstrip()
    print(lcs_another(line1,line2))


Measured memory_bytes: 5640
#include <iostream>
#include <vector>
const int MOD = 1000000007;
typedef long long ll;
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++)
		cin >> a[i];
	vector<int> b(n, 0);
	for (int i = 0; i < n; i++)
		b[a[i]]++;
	if (n % 2 == 1) {
		if (b[0] != 1) {
			cout << 0 << endl;
			return 0;
		}
		for (int i = 2; i < n; i += 2) {
			if (b[i] != 2) {
				cout << 0 << endl;
				return 0;
			}
		}
	}
	else {
		for (int i = 1; i < n; i += 2) {
			if (b[i] != 2) {
				cout << 0 << endl;
				return 0;
			}
		}
	}
	ll ans = 1;
	for (int i = 0; i < n / 2; i++)
		ans = ans * 2 % MOD;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vii vector<int,int>
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define fi first
#define sc second
#define all(a) a.begin(),a.end()
const int INF=1e9+7;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int main(){
    fast;
    int n,k;
    cin>>n>>k;
    int a[n],dp[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
        dp[i]=INF;
    }
    dp[0]=0;
    dp[1]=abs(a[1]-a[0]);
    for(int i=2;i<n;i++){
        for(int j=i-1;j>=max(0,i-k);j--){
            dp[i]=min(dp[i],abs(a[j]-a[i])+dp[j]);
        }
    }
    cout<<dp[n-1];
}

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

using namespace std;
typedef long long ll;
#define all(x) (x).begin(), (x).end()
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<bool>> vvb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
void debugF(ostream &os) {os << endl;}
template <typename Head, typename... Tail>
void debugF(ostream &os, Head H, Tail... T) { os << " " << H; debugF(os, T...); }
#define debug(...) cout << "[" << #__VA_ARGS__ << "]:", debugF(cout, __VA_ARGS__)
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); os << (i>0 ? " ":"") << v[i++]); return os;}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    char ch;
    cin >> ch;
    if(ch >= 'a' && ch <= 'z'){
        cout << "a\n";
    }else{
        cout << "A\n";
    }
    return 0;
}

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

using namespace std;
using llong = long long;
using P = pair<llong, llong>;

#define BE(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	int n;

	cin >> n;

	cout << n/3 << endl;

	return 0;
}

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

vector<vector<int>> board;

int rec(int i, int j, int acc)
{
    acc += board[i][j];
    if (i + 1 == board.size() && j + 1 == board[1].size()) {
        return acc;
    }
    if (i + 1 < board.size() && j + 1 < board[i].size()) {
        return max(rec(i, j + 1, acc), rec(i + 1, j, acc));
    } else if (i + 1 < board.size()) {
        return rec(i + 1, j, acc);
    } else {
        return rec(i, j + 1, acc);
    }
}

int main()
{
    int n;
    cin >> n;
    board.assign(2, vector<int>(n));
    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < n; j++) {
            cin >> board[i][j];
        }
    }
    cout << rec(0, 0, 0) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;
int main()
{
  string S;
  cin >> S;
  if (S.at(0) == 'A')
  {
    int cnt = 0;
    for (int i = 1; i < S.size(); ++i)
    {
      if (isupper(S[i])) // 大文字か比較
      {
        if (i == 1 || i == S.size() - 1 || S[i] != 'C')
        {
          cout << "WA" << endl;
          return 0;
        }
        cnt++;
      }
    }
    if (cnt != 1)
    {
      cout << "WA" << endl;
      return 0;
    }
  }
  else
  {
    cout << "WA" << endl;
    return 0;
  }
  cout << "AC" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cctype>
#include<cstdlib>
#include<algorithm>
#include<bitset>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<ctime>
#include<complex>
#include<functional>
#include<climits>
#include<cassert>
#include<iterator>
#include<unordered_set>
#include<unordered_map>
using namespace std;



int n;
vector<int> v;
int gcd(int a, int b) {
	if (a > b)swap(a, b);
	while (a) {
		swap(a, b);
		a %= b;
	}
	return b;
}
int main() {
	cin >> n;
	bool one = false;
	int sum = 0;
	for (int i = 0; i < n; i++) {
		int a;
		scanf("%d", &a);
		if (a == 1) {
			one = true;
		}
		v.push_back(a);
		sum += a - 1;
	}
	if (one == true) {
		if (sum & 1) {
			puts("First");
		}
		else {
			puts("Second");
		}
		return 0;
	}
	bool f = false;
	while (1) {
		f ^= true;
		vector<int> id;
		int sum = 0;
		for (int i = 0; i < n; i++) {
			if (v[i] & 1) {
				id.push_back(i);
				
			}
			sum += v[i] - 1;
		}
		if (sum & 1) {
			if (f) {
				puts("First");
			}
			else {
				puts("Second");
			}
			return 0;
		}
		if (id.size() != 1) {
			if (f) {
				puts("Second");
			}
			else {
				puts("First");
			}
			return 0;
		}
		if (id.size() == 1) {
			if (v[id[0]] == 1) {
				if (f) {
					puts("Second");
				}
				else {
					puts("First");
				}
				return 0;
			}
			v[id[0]]--;
			int gc = 0;
			for (int i = 0; i < n; i++) {
				gc = gcd(gc, v[i]);
			}
			for (int i = 0; i < n; i++) {
				v[i] /= gc;
			}
			continue;
		}
	}
	return 0;
}

Measured memory_bytes: 1400
n = int(input())
L = [0]*(110**2*6+1)

for i in range(1,110):
    for j in range(1,110):
        for k in range(1,110):
            a = i**2 + j**2 + k**2 + i*j +j*k + k*i
            if a <= n:
                L[a-1] +=1
for i in range(n):
    print(L[:n+1][i])

Measured memory_bytes: 76592
//@author yash2040
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define int long long
#define pb push_back
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
int32_t main()
{
	fast();
	int n,x,t;
	cin>>n>>x>>t;
	int d=ceil((long double)n/x*1.0);
	cout<<d*t<<endl;
}








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

int n;
std::vector<int> v,c;



int main()
{
    std::cin >> n;
    v.resize(n);
    c.resize(n);
    for(int i = 0; i < n; i++)std::cin >> v[i];
    for(int i = 0; i < n; i++)std::cin >> c[i];
    int res = 0;

    for(int bit = 0; bit < (1 << n); bit++){
        int V = 0, C = 0;
        for(int i = 0; i < n; i++){
            if(bit & (1 << i)){
                V += v[i];
                C += c[i];
            }
        }
        res = std::max(V - C, res);
    }
    std::cout << res << std::endl;

}

Measured memory_bytes: 256