akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int N, M, K; long long A, B, C, T;
	cin >> N >> M >> K >> A >> B >> C >> T;
	vector<long long> X(M);
	for (int i = 0; i < M; ++i) cin >> X[i], --X[i];
	vector<long long> rem(M), cur(X), nxt(M);
	long long ans = (T - B * X[M - 1] >= 0 ? 1 : 0);
	for (int i = 0; i < M - 1; ++i) {
		rem[i] = T - B * X[i];
		if (rem[i] < 0) continue;
		long long oldcur = cur[i];
		cur[i] += rem[i] / A + 1;
		cur[i] = min(cur[i], X[i + 1]);
		long long delta = cur[i] - oldcur;
		if (delta > 0) {
			ans += delta;
			rem[i] -= C * delta;
			if (rem[i] < 0) continue;
			oldcur = cur[i];
			cur[i] += rem[i] / A + 1;
			cur[i] = min(cur[i], X[i + 1]);
			delta = cur[i] - oldcur;
			nxt[i] = delta;
		}
	}
	for (int i = 0; i < K - M; ++i) {
		int ptr = max_element(nxt.begin(), nxt.end()) - nxt.begin();
		if (nxt[ptr] == 0) break;
		ans += nxt[ptr];
		rem[ptr] -= C * nxt[ptr];
		if (rem[ptr] < 0) {
			nxt[ptr] = 0;
		}
		else {
			long long oldcur = cur[ptr];
			cur[ptr] += rem[ptr] / A + 1;
			cur[ptr] = min(cur[ptr], X[ptr + 1]);
			long long delta = cur[ptr] - oldcur;
			nxt[ptr] = delta;
		}
	}
	cout << ans - 1 << endl;
	return 0;
}


Measured memory_bytes: 3180
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        boolean isOk = true;
        StringBuilder sb = new StringBuilder(s);
        if (!s.equals(sb.reverse().toString())) {
            isOk = false;
        }
        String s2 = s.substring(0,(s.length()-1)/2);
        StringBuilder sb2 = new StringBuilder(s2);
        if (!s2.equals(sb2.reverse().toString())) {
            isOk = false;
        }
        String s3 = s.substring((s.length()+2)/2);
        StringBuilder sb3 = new StringBuilder(s3);
        if (!s3.equals(sb3.reverse().toString())) {
            isOk = false;
        }
        System.out.println(isOk?"Yes":"No");
    }
}


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

// syntax sugar: `for (int i = 0; i < N; ++i)`
#define rep(i, N) for (int i = 0; i < (int)(N); ++i)
// syntax sugar: `for (int i = 0; i < N; ++i)`
#define REP(type, name, beginValue, endCondValue) \
  for (type name = beginValue; name < endCondValue; ++name)
// syntax sugar: 多次元vector
#define VECTOR_DIM3(T, name, d1, d2, d3, initValue) \
    std::vector<std::vector<std::vector<T>>> name(d1, std::vector<std::vector<T>>(d2, std::vector<int>(d3, initValue)));
#define VECTOR_DIM2(T, name, d1, d2, initValue) \
    std::vector<std::vector<T>> name(d1, std::vector<T>(d2, initValue));
#define VECTOR_DIM1(T, name, d1, initValue) \
    std::vector<T> name(d1, initValue);
#define ll long long
#define ld long double


// ABC096C - Grid Repainting 2
int main(){
  int H, W;
  cin >> H >> W;
  VECTOR_DIM2(char, d, H, W, 0);
  VECTOR_DIM2(char, can, H, W, 0);
  rep(i, H) {
    string s;
    cin >> s;
    rep (j, W) {
      d[i][j] = s[j];
    }
  }
  rep(i, H) {
    rep(j, W) {
      if (d[i][j] != '#') {
        continue;
      }
      if (can[i][j]) {
        continue;
      }
      if (i - 1 >= 0 && i + 1 <= H - 1) {
        if (d[i+1][j] == '#') {
          can[i][j] = true;
          can[i+1][j] = true;
        }
        if (d[i-1][j] == '#') {
          can[i][j] = true;
          can[i-1][j] = true;
        }
      }
      if (j - 1 >= 0 && j + 1 <= W - 1) {
        if (d[i][j-1] == '#') {
          can[i][j] = true;
          can[i][j-1] = true;
        }
        if (d[i][j+1] == '#') {
          can[i][j] = true;
          can[i][j+1] = true;
        }
      }
      if (i - 2 >= 0 && d[i-1][j] == '#') {
          can[i][j] = true;
          can[i-1][j] = true;
      }
      if (i + 2 <= H - 1 && d[i+1][j] == '#') {
          can[i][j] = true;
          can[i+1][j] = true;
      }
      if (j - 2 >= 0 && d[i][j-1] == '#') {
          can[i][j] = true;
          can[i][j-1] = true;
      }
      if (j + 2 <= W - 1 && d[i][j+1] == '#') {
          can[i][j] = true;
          can[i][j+1] = true;
      }
      if (!can[i][j]) {
        cout << "No" << endl;
        return 0;
      }
    }
  }

  cout << "Yes" << endl;
  return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
using namespace std;
int n,m,x,y,pos[100005],father[100005],nx,ny,ans;
inline int find(int now){
	if(father[now]==now){
		return now;
	}
	father[now]=find(father[now]);
	return father[now];
} 
int main(){
	scanf("%d%d",&n,&m);
	for(register int i=1;i<=n;i++){
		scanf("%d",&x);
		pos[x]=i;
		father[i]=i;
	}
	for(register int i=1;i<=m;i++){
		scanf("%d%d",&x,&y);
		nx=find(x);
		ny=find(y);
		father[ny]=nx;
	}
	for(register int i=1;i<=n;i++){
		if(find(i)==find(pos[i])){
			ans++;
		}
	}
	printf("%d\n",ans);
	return 0;
} 

Measured memory_bytes: 4616
#include <bits/stdc++.h>
#define debug1(x) cout << #x << " " << x << endl;
#define debug2(x,y) cout << #x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout << #x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define pb push_back
#define mp make_pair
#define f first
#define s second

typedef long long ll;
using namespace std;

void readFile() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

ll binpow(ll a,ll b) {    // a^b
    if(b==0) return 1;
    long long res = binpow(a,b/2);
    if(b%2)
        return res*res*a;
    else
        return res*res;
}

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

    int T;
    cin >> T;
    if(T>=30)
    cout << "Yes\n";
else cout << "No\n";
    return 0;
}


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

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

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

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}

typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int n;
string s, w = "SW";

void kuwa(int x, int y) {
	string t;
	t.push_back(w[x]), t.push_back(w[y]);
	reps(i,1,n+1) t.push_back(w[((t[i-1]=='W' && s[i]=='o') || (t[i-1]=='S' && s[i]=='x')) ^ (t[i]=='W')]);
	if (t[0]==t[n] && t[1]==t[n+1]) {
		cout << t.substr(0,n);
		exit(0);
	}
}

int main() {
	cin >> n >> s;
	s += s.substr(0,2);
	rep(i,2) rep(j,2) kuwa(i,j);
	cout << -1;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
  ll n,m;
  cin >>n>>m;
  vector <ll> p;
  if(n==1) cout <<m<<endl;
  else{
  for(ll i=1; i*i<=m;i++){
    if(m%i==0){
      if((m/i)/n>0) p.push_back(i);
      if(i!=1&&i*i!=m){
        ll k=m/i;
        if((m/k)/n>0) p.push_back(k);
      }
      }
    }
  sort(p.begin(),p.end());
  cout <<p[p.size()-1]<<endl;
 }
}


Measured memory_bytes: 256
fun readInts(separator: Char = ' ') = readLine()!!.split(separator).map(String::toInt)
fun readSplit(separator: Char = ' ') = readLine()!!.split(separator)
fun main(args: Array<String>) {
    val N=readInts()[0]
    var sum=0
    var a=Array(110,{i->false})
    var arr=readInts()
    for (i in 0..N-1){
        var temp=arr[i]
        if(temp<3200)
        a[temp/400]=true
        else sum++
    }
    print("${if(a.count{it}==0) 1 else a.count{it}} ${a.count{it}+sum}")
}



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

using namespace std;

bool is_prime(int a) {
	for (int i = 2; i * i <= a; i++) {
		if (a % i == 0)return false;
	}
	return true;
}

bool is2017(int a) {
	return is_prime(a) && is_prime((a + 1) / 2);
}

int csum[100000 + 100];

int main() {
	for (int i = 2; i <= 100000; i++) {
		csum[i] = csum[i - 1];
		if (i % 2 == 1) {
			csum[i] += is2017(i);
		}
	}
	
	int Q;
	cin >> Q;
	while (Q--) {
		int l, r;
		cin >> l >> r;
		cout << csum[r] - csum[l - 1] << endl;
	}
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100010;

int main() {
//	cout << fixed << setprecision(15);
	int n;
	cin >> n;
	cout << (n + 1) / 2 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
 
int main() {
    int A,B;
    cin >> A >> B;
    bool a=false;
    for(int i=1;i<=3;i++){
        if(A*B*i%2==1)a=true;
    }
    if(a)cout << "Yes" << endl;
    else cout << "No" << endl;
    }

Measured memory_bytes: 256
A,B,C,X,Y=list(map(int,input().split()))
money=0
if min(A,B,2*C)==2*C:
    money+=2*C*max(X,Y)
elif A+B>=2*C:
    money+=2*C*min(X,Y)
    if min(X,Y)==X:
        Y -= X
        if B<2*C:
            money+=Y*B
        else:
            money+=Y*2*C
    else:
        X-=Y
        if A<2*C:
            money+=X*A
        else:
            money+=X*2*C
else:
    money+=A*X
    money+=B*Y
print(money)

Measured memory_bytes: 3064
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    for(int i = 0; i < m; i++) {
      n -= sc.nextInt();
    }
    int ans = n;
    if(n < 0) ans = -1;
    System.out.println(ans);
  }
}

Measured memory_bytes: 46324
# -*- coding: utf-8 -*-

import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians, log10
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd 
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul, xor
from copy import copy, deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits
from datetime import date

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def round(x): return int((x*2+1) // 2)
def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)
def lcm_list(nums): return reduce(lcm, nums, 1)
def gcd_list(nums): return reduce(gcd, nums, nums[0])
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

A,B,Q=MAP()

S=[-INF]*(A+2)
for i in range(A):
    S[i+1]=INT()
T=[-INF]*(B+2)
for i in range(B):
    T[i+1]=INT()
S[-1]=T[-1]=INF

# Si番目の神社から左に一番近い寺
L1=[INF]*(A+2)
# Si番目の神社から右に一番近い寺
R1=[INF]*(A+2)
for i in range(1, A+1):
    idx=bisect_right(T, S[i])-1
    if T[idx]!=0:
        L1[i]=S[i]-T[idx]
    idx=bisect_left(T, S[i])
    if T[idx]!=INF:
        R1[i]=T[idx]-S[i]

# Ti番目の寺から左に一番近い神社
L2=[INF]*(B+2)
# Ti番目の寺から右に一番近い神社
R2=[INF]*(B+2)
for i in range(1, B+1):
    idx=bisect_right(S, T[i])-1
    if S[idx]!=0:
        L2[i]=T[i]-S[idx]
    idx=bisect_left(S, T[i])
    if S[idx]!=INF:
        R2[i]=S[idx]-T[i]

for i in range(Q):
    dist1=dist2=dist3=dist4=INF
    x=INT()
    # 地点xから左に一番近い神社
    idx=bisect_right(S, x)-1
    # idx番目の神社に行く
    dist1=x-S[idx]
    # idx番目の神社から一番近い寺に行く
    dist1+=min(L1[idx], R1[idx])
    idx=bisect_left(S, x)
    dist2=S[idx]-x
    dist2+=min(L1[idx], R1[idx])
    idx=bisect_right(T, x)-1
    dist3=x-T[idx]
    dist3+=min(L2[idx], R2[idx])
    idx=bisect_left(T, x)
    dist4=T[idx]-x
    dist4+=min(L2[idx], R2[idx])
    print(min(dist1, dist2, dist3, dist4))


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

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    cout << min(A, B) + min(C, D) << endl;
    return 0;
}

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

#define rep(i,x,y) for(ll i=(x);i<(y);i++)
#define rrep(i,x,y) for(ll i=(ll)(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
#ifdef LOCAL
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#define itrdebug(x) cerr << #x << " "; for (auto & el : (x)) {cerr << (el) << " ";} cerr << endl
#define dassert(...) assert(__VA_ARGS__)
#else
#define debug(x)
#define itrdebug(x)
#define dassert(...)
#endif
//#define int long long

typedef long long ll;
const ll MOD = 1e9 + 7;
const long double EPS = 1e-8;

void solve(long long N, long long K, std::vector<long long> A){
    vector<ll> sum(N+2), nextSum(N+2);
    rep(i,0,N) {
        int left = i+1 - A[i], right = i+1 + A[i];
        sum[max(0, left)]++;
        sum[min<int>(N+1, right+1)]--;
    }
    nextSum = sum;
    rep(i,0,K) {
        bool fixed = true;
        int current = sum[0];
        rep(j,0,N) {
            current += sum[j+1];
            int prevLeft = j+1 - A[j], prevRight = j+1 + A[j];
            int left = j+1 - current, right = j+1 + current;
            nextSum[max(0, prevLeft)]--;
            nextSum[min<int>(N+1, prevRight+1)]++;
            nextSum[max(0, left)]++;
            nextSum[min<int>(N+1, right+1)]--;
            A[j] = current;
            if (current != N) fixed = false;
        }
        sum = nextSum;
        if (fixed) break;
    }
    rep(i,0,N) cout << A[i] << (i != N-1 ? " " : "\n");
}

signed main(){
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, K, std::move(A));
    return 0;
}


Measured memory_bytes: 8032
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n; cin >> n;
  V<> a(n + 1); for (auto&& e : a) cin >> e;
  V<> b(n); for (auto&& e : b) cin >> e;
  lint res = 0;
  for (int i = 0; i < n; ++i) {
    int l = min(a[i], b[i]);
    a[i] -= l;
    b[i] -= l;
    res += l;
    int r = min(a[i + 1], b[i]);
    a[i + 1] -= r;
    b[i] -= r;
    res += r;
  }
  cout << res << '\n';
}

Measured memory_bytes: 1024
import java.io.*;

class Main
{
   public static void main(String[] args) throws IOException
   {

      BufferedReader br =
       new BufferedReader(new InputStreamReader(System.in));

      String str1 = br.readLine();
      String str2[] = str1.split(" ");
      int a = Integer.parseInt(str2[0]);
      int b = Integer.parseInt(str2[1]);
      int c = a*b;
      int d = 2*(a+b);
      System.out.println( c + " " + d );

   }
}

Measured memory_bytes: 24324
/*
    ThunderClap and Flash.
    Raunaq Singh
*/
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
#define ThunderClap ios::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
#define debugg(something)   cout<<#something<<" - "<<something<<"\n";
#define vi vector
#define umap unordered_map
#define uset unordered_set
#define mset multiset
#define LB lower_bound
#define UB upper_bound
#define mp make_pair
#define pb push_back
#define in insert
#define s second
#define f first
#define pQueue priority_queue
#define maxElement *max_element
#define minElement *min_element
#define MAX 100000LL
#define mod 1000000007LL
#define inf 1000000000000000000LL
#define mI2 500000004LL
inline ll add(ll a, ll b){ return ((a%mod)+(b%mod))%mod;}
inline ll mul(ll a, ll b){ return ((a%mod)*(b%mod))%mod;}
inline ll sub(ll a, ll b){ return ((a%mod)-(b%mod)+mod)%mod;}

void Flash(){
    string s;
    cin>>s;
    ll isReversed=0;
    ll q;
    cin>>q;
    string insertAtFront="";
    string insertAtBack="";
    ll t,f;
    char c;
    while(q--){
        cin>>t;
        if(t==1){
            isReversed^=1;
        }else{
            cin>>f>>c;
            if(f==1){
                if(isReversed){
                    insertAtBack.pb(c);
                }else{
                    insertAtFront.pb(c);
                }
            }else{
                if(isReversed){
                    insertAtFront.pb(c);
                }else{
                    insertAtBack.pb(c);
                }
            }
        }
    }
    string ans="";
    if(isReversed){
        reverse(insertAtBack.begin(),insertAtBack.end());
        reverse(s.begin(),s.end());
        ans=insertAtBack+s+insertAtFront;
    }else{
        reverse(insertAtFront.begin(),insertAtFront.end());
        ans=insertAtFront+s+insertAtBack;
    }
    cout<<ans<<"\n";
}  

int main(int argc, char const *argv[]){
    ThunderClap;
    ll t=1;
    //cin>>t;
    for(ll i=1;i<=t;i++){
        //cout<<"Case #"<<i<<": ";
        Flash();
    }
    return 0;
}

Measured memory_bytes: 1300
package main

import(
	"fmt"
)

var n, x int
var s string

func main() {
	fmt.Scan(&n)

	m := make(map[string]bool)

	for i := 0; i < n; i++ {
		fmt.Scan(&s)
		if m[s] == true {
			x++;
		}
		m[s] = true
	}

	fmt.Println(n-x)
}

Measured memory_bytes: 18892
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=200005;
int dp[M+3];
int yo1[M+2],yo2[M+2];
int ses[M];
 main()

{
    fast
    f(i,1,M-1)
    {
       int one=__builtin_popcountll(i);
       dp[i]=1+dp[i%one];
    }
    string s;
    int n;
    cin>>n;
    cin>>s;
    int cnt=0;
    f(i,0,n-1)
    {
        if(s[i]=='1')cnt++;
    }
    int m1=cnt+1;
    int m2=cnt-1;
    if(cnt==0)
    {
        f(i,1,n)
        {
            cout<<"1\n";
        }
        return 0;
    }
    int two=1,s1=0;
     yo1[0]=1%m1;
     f(i,1,n+1)
    {
        two=(two*2)%m1;
        yo1[i]=two;
    }
     for(int i=n-1,j=0;i>=0;i--,j++)
    {
        if(s[i]=='1')
        {
            int val=yo1[j];
            s1=(s1+val)%m1;
        }
    }
    if(cnt==1)
    {
         for(int i=n-1,j=0;i>=0;i--,j++)
        {
            if(s[i]=='1')
            {
                ses[i]=0;
            }
            else
            {
                 int val=yo1[j];
                 int rem=(s1+val)%m1;
                 ses[i]=1+dp[rem];
            }
        }
        f(i,0,n-1)
        {
            cout<<ses[i]<<"\n";
        }
        return 0;
    }
    yo2[0]=1%m2;
    two=1;
    f(i,1,n+1)
    {
        two=(two*2)%m2;
        yo2[i]=two;
    }
    int s2=0;
    for(int i=n-1,j=0;i>=0;i--,j++)
    {
        if(s[i]=='1')
        {
            int val;
            val=yo2[j];
            s2=(s2+val)%m2;
        }
    }
    for(int i=n-1,j=0;i>=0;i--,j++)
    {
        if(s[i]=='1')
        {
             int val=yo2[j];
             int rem=(s2-val)%m2;
             while(rem<0)
             {
                 rem=rem+m2;
                 rem=rem%m2;
             }
             ses[i]=1+dp[rem];
        }
        else
        {
            int val=yo1[j];
            int rem=(s1+val)%m1;
            ses[i]=1+dp[rem];
        }
    }
    f(i,0,n-1)
    {
        cout<<ses[i]<<"\n";
    }
    return 0;

}




































Measured memory_bytes: 10032
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

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

	scanf("%d %d %d", &a, &b, &c);
	if (a >= 0 && c <= 100) {

		if (a<b && b<c) {
			printf("Yes\n");
		}
		else {
			printf("No\n");
		}

	}

	return 0;
}

Measured memory_bytes: 2528
#include<stdio.h>
int main(void)
{
	int l,a,b,c,d,x,y,i,n;
	scanf("%d %d %d %d %d",&l,&a,&b,&c,&d);
	x=a/c;
	if(a%c>0)	{
	x++;
	}
	y=b/d;
	if(b%d>0)	{
	y++;
	}
	if(x<y)	{
	n=l-y;	
	printf("%d\n",n);
	}
	else	{
	n=l-x;
	printf("%d\n",n);
	}
	return 0;
}


Measured memory_bytes: 2756
s_ = input().lower()

L_s = []
i=0
while i<len(s_):
    if s_[i]=="a":
        L_s.append("a")
        i+=1
    elif s_[i]=="b":        
        if i<len(s_)-1 and s_[i+1]=="c":
            L_s.append("x")
            i+=2
        else:
            L_s.append("y")
            i+=1
    else:
        L_s.append("y")
        i+=1
        
L_s.append("a")
#xの次に何かの文字が来ることでansに加算されるため

s = ''.join(L_s)

if s[0]=="a":
    cnt_a = 1
else:
    cnt_a = 0
    
cnt_x = 0

ans = 0

for i in range(1,len(s)):
    if s[i]=="a":
        if s[i-1]=="a":
            cnt_a+=1
        elif s[i-1]=="x":
            ans += cnt_a*cnt_x
            cnt_x=0
            cnt_a+=1
        else:
            cnt_x = 0
            cnt_a = 1
    elif s[i]=="x":
        if s[i-1]=="x":
            cnt_x+=1
        elif s[i-1]=="a":
            ans += cnt_a*cnt_x
            cnt_x+=1
        else:
            cnt_x=1
            cnt_a=0
    else:
        if s[i-1]!="a":
            ans += cnt_a*cnt_x
        cnt_a=0
        cnt_x=0

        
print(ans)


Measured memory_bytes: 54188
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int main(void){
	ll n,a,b,ans=INFLL;
	cin >> n >> a >> b;
	if(!((b-a)%2)){
		ans = min(ans,(b-a)/2);
		ans = min(ans,(a+b-2)/2);
		ans = min(ans,(n-a+n-b)/2);
		ans = min(ans,max(a-1,b-1));
		ans = min(ans,max(n-a,n-b));
	}else{
		ans = min(ans,(a+b-1)/2);
		ans = min(ans,(n-a+n-b+1)/2);
		ans = min(ans,max(a-1,b-1));
		ans = min(ans,max(n-a,n-b));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#define mod 998244353

const long double PI = 3.141592653589793236L;

typedef long long int ll;
typedef long double ld;

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t;
    t=1;
    //cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;
        if(n>=30) cout<<"Yes";
        else cout<<"No";
    }
    return 0;
}


Measured memory_bytes: 3124
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val k = sc.nextInt()
    println(problem126c(n, k))
}

fun problem126c(n: Int, k: Int): Double {
    var sum = 0.0
    for (i in 1..n) {
        var j = i.toDouble()
        var count = 0.0
        while (j < k) {
            count++
            j *= 2
        }
        sum += 1.0 / n * Math.pow(1 / 2.0,  count.toDouble())
    }
    return sum
}

Measured memory_bytes: 31396
class PriorityQueue
  def initialize(array = [])
    @data = []
    array.each{|a| add(a)}
  end

  def add(element)
    @data.push(element)
    bottom_up
  end

  # @return Integer
  def peek
    @data[0]
  end

  # @return Integer
  def poll
    if size == 0
      return nil
    elsif size == 1
      return @data.pop
    else
      min = @data[0]
      @data[0] = @data.pop
      top_down
      return min
    end
  end

  # @return Integer
  def size
    @data.size
  end

  private

  def swap(i, j)
    @data[i], @data[j] = @data[j], @data[i]
  end


  def bottom_up
    idx = size - 1
    while(has_parent?(idx))
      parent_idx = parent_idx(idx)
      if @data[parent_idx] > @data[idx]
        swap(parent_idx, idx)
        idx = parent_idx
      else
        return
      end
    end
  end

  def top_down
    idx = 0
    while (has_child?(idx))
      a = left_child_idx(idx)
      b = right_child_idx(idx)
      if @data[b].nil?
        c = a
      else
        c = @data[a] <= @data[b] ? a : b
      end
      if @data[idx] > @data[c]
        swap(idx, c)
        idx = c
      else
        return
      end
    end
  end


  # @param Integer
  # @return Integer
  def parent_idx(idx)
    (idx - (idx.even? ? 2 : 1)) / 2
  end

  # @param Integer
  # @return Integer
  def left_child_idx(idx)
    (idx * 2) + 1
  end

  # @param Integer
  # @return Integer
  def right_child_idx(idx)
    (idx * 2) + 2
  end

  # @param Integer
  # @return Boolent
  def has_child?(idx)
    ((idx * 2) + 1) < @data.size
  end

  def has_parent?(idx)
    idx > 0
  end
end

N,M=gets.split.map(&:to_i)
as=gets.split.map(&:to_i).map{|e|-e}
queue=PriorityQueue.new(as)
M.times do
    add=queue.poll
    queue.add(-(-add/2))
end
cnt=0
N.times do
    cnt+=-queue.poll
end
puts cnt


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

int gcd(int in1, int in2);

int main() {
  int in1,in2;
  cin >> in1 >> in2;
  cout << gcd(in1,in2) << endl;
  return 0;
}

int gcd(int in1, int in2) {
  if(in1>in2) {
    int temp = in2;
    in2 = in1;
    in1 = temp;
  }

  int modulus = in2 % in1;
  if(modulus == 0)
    return in1;
  else
    return gcd(modulus,in1);
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long a, b;
	cin >> a >> b;
	if(a*b <= 0){
		cout << "Zero" << endl;
	}
	else if(a > 0){
		cout << "Positive" << endl;
	}
	else{
		b = min(0LL, b);
		if((b-a)%2 == 0)
			cout << "Negative" << endl;
		else
			cout << "Positive" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<functional>
#include<algorithm>
#include<string>
#include<vector>
#include<utility>
#include<tuple>
#include<map>
#include<set>
#include<queue>
#include<cmath>

using namespace std;
#define LL long long

int N,K,ans=1e9;
vector<int>p,m;

int main() {
	cin>>N>>K;
	for(int i=0;i<N;i++){
		int x;
		cin>>x;
		if(x==0)K--;
		else if(x<0)m.push_back(x);
		else p.push_back(x);
	}
	if(K==0){
		cout<<0<<endl;
		return 0;
	}
	reverse(m.begin(),m.end());
	for(int i=0;i<=min((int)m.size(),K);i++){
		int mc=i,pc=K-i;
		if(mc>(int)m.size()||pc>(int)p.size())continue;
		int t1=1e9,t2=1e9;
		if(mc==0)ans=min(ans,p[K-1]);
		else{
			t1=-m[mc-1];
			t2=-m[mc-1]*2;
		}
		if(pc==0)ans=min(ans,-m[K-1]);
		else{
			t1+=p[pc-1]*2;
			t2+=p[pc-1];
		}
		ans=min({ans,t1,t2});
	}
	cout<<ans<<endl;


	return 0;
}



Measured memory_bytes: 1020
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define fs first
#define sc second
using namespace std;
typedef long long ll;
int N;
map<ll, int> h;
vector<ll> v;
string s;
pair<ll, ll> frac[200100];
ll cnt[110][110];

pair<ll, ll> getFrac(string &s) {
  ll x = 0, y = 1;
  bool dec = false;
  for(int i=0;i<s.size();++i) {
    if(s[i] == '.') {
      dec = true;
      continue;
    }
    x = x*10 + (s[i] - '0');
    if(dec) y = y*10;
  }
  ll d = __gcd(x, y);
  x /= d; y /= d;
  if(!h[y]) {
    h[y] = 1;
    v.pb(y);
  }
  return mp(x, y);
}

int main() {
  cin>>N;
  ll ret = 0;
  for(int i=0;i<N;++i) {
    cin>>s;
    frac[i] = getFrac(s);
  }
  sort(v.begin(), v.end());
  for(int i=0;i<v.size();++i) h[v[i]] = i;
  for(int i=0;i<N;++i) {
    ll a = frac[i].fs, b = frac[i].sc;
    for(int j=0;j<v.size();++j) {
      if(a % v[j] == 0) {
        ret += cnt[h[b]][j];
      }
    }
    for(int j=0;j<v.size();++j) {
      if(a % v[j] == 0) {
        ++cnt[j][h[b]];
      }
    }
  }
  cout<<ret<<"\n";
}

Measured memory_bytes: 6716
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stdint.h>
#include<vector>
#include<cmath>
#include<algorithm>
using namespace std;
typedef pair<int ,int> pp;
typedef long long ll;
const ll MOD = 1000000007;

int main(){
    ll n;
    cin>>n;
    ll k = floor(sqrt(n));
    for(ll i = k; i > 0; i--){
        if(n % i == 0){
            ll ans = i + n / i - 2;
            printf("%lld\n", ans);
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 768
{-# LANGUAGE TypeApplications #-}

import Data.Maybe
import Data.List
import Control.Monad
import Data.Bifunctor
import Control.Applicative
import Data.Monoid
import Data.Coerce

main :: IO ()
main = do
    [n, m, x] <- fmap (read @Int) . words <$> getLine
    list <- replicateM n $ fromJust . uncons . fmap (read @Int) . words <$> getLine
    print $ (
            fromMaybe (-1) .
            foldl1May min .
            map fst .
            filter (all (>= x) . snd) .
            id @[(Int, [Int])] .
            coerce .
            fmap mconcat .
            traverse (: [mempty]) .
            id @[(Sum Int, Ap ZipList (Sum Int))] .
            coerce
        ) list
    pure ()


foldl1May :: (a -> a -> a) -> [a] -> Maybe a
foldl1May f (x:xs) = Just $ foldl f x xs
foldl1May _ _ = Nothing

Measured memory_bytes: 5196
n=int(input())
inputs=[]
for i in range(n-1):
    inputs.append([int(j) for j in input().split()])
q,k= map(int,input().split())
from collections import defaultdict
from heapq import heappop, heappush


class Graph(object):
    """
    隣接リストによる有向グラフ
    """

    def __init__(self):
        self.graph = defaultdict(list)

    def __len__(self):
        return len(self.graph)

    def add_edge(self, src, dst, weight=1):
        self.graph[src].append((dst, weight))

    def get_nodes(self):
        return self.graph.keys()
class Dijkstra(object):
    """
    ダイクストラ法（二分ヒープ）による最短経路探索
    計算量: O((E+V)logV)
    """

    def __init__(self, graph, start):
        self.g = graph.graph

        # startノードからの最短距離
        # startノードは0, それ以外は無限大で初期化
        self.dist = defaultdict(lambda: float('inf'))
        self.dist[start] = 0

        # 最短経路での1つ前のノード
        self.prev = defaultdict(lambda: None)

        # startノードをキューに入れる
        self.Q = []
        heappush(self.Q, (self.dist[start], start))

        while self.Q:
            # 優先度（距離）が最小であるキューを取り出す
            dist_u, u = heappop(self.Q)
            if self.dist[u] < dist_u:
                continue
            for v, weight in self.g[u]:
                alt = dist_u + weight
                if self.dist[v] > alt:
                    self.dist[v] = alt
                    self.prev[v] = u
                    heappush(self.Q, (alt, v))

    def shortest_distance(self, goal):
        """
        startノードからgoalノードまでの最短距離
        """
        return self.dist[goal]

    def shortest_path(self, goal):
        """
        startノードからgoalノードまでの最短経路
        """
        path = []
        node = goal
        while node is not None:
            path.append(node)
            node = self.prev[node]
        return path[::-1]
        

g = Graph()
for src, dst, weight in inputs:
    g.add_edge(src, dst, weight)
    g.add_edge(dst, src, weight)

d = Dijkstra(g, k)   #0から

ans=[]
for i in range(q):
    a=[int(j) for j in input().split()]
    ans.append(d.shortest_distance(a[0])+d.shortest_distance(a[1]))

for i in ans:
    print(i)



    
    

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

int main() {
	int n, tmp, min;
	string s;
	int count, ans;
	cin >> n >> s;
	tmp = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == '.') tmp++;
	}
	//シロの個数をtmpに数え上げた

	min = tmp; //今のところ最小は全部クロの場合＝白の個数が変える石の数

	for (int i = 0; i < n;i++) {
		if (s[i] == '.') tmp--; else tmp++;
		if (tmp < min) min = tmp;
	}
	cout << min << endl;
	cin >> n;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for(ll i = a; i < (ll)(b); i++)

#define ALL(x) (x).begin(), (x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

using namespace std;
using ll = long long;
using vel = vector<ll>;
using ves = vector<string>;
using veb = vector<bool>;
using qul = queue<ll>;

int binary_search(ll x, vel a) {
    auto ite = lower_bound(ALL(a), x);
    if(ite != a.end() && *ite == x) {
        return ite - a.begin();
    } else {
        return -1;
    }
}

ll modpow(ll a, ll n, ll mod) {
    if(n == 0)
        return 1;
    if(n == 1)
        return a % mod;
    if(n % 2 == 1)
        return (a * modpow(a, n - 1, mod)) % mod;
    ll t = modpow(a, n / 2, mod);
    return (t * t) % mod;
}

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

Measured memory_bytes: 3920
#include <cstdio>
#include <vector>

using namespace std;

#define MOD 998244353
#define MAX_N 200010

typedef long long ll;

int N, M, K;

ll f[MAX_N], rf[MAX_N];
ll inv(ll x) {
    ll res = 1;
    ll k = MOD - 2;
    ll y = x;
    while (k) {
        if (k & 1) res = (res * y) % MOD;
        y = (y * y) % MOD;
        k /= 2;
    }
    return res;
}
void init() {
    f[0] = 1;
    for (int i = 1; i < MAX_N; i++) f[i] = (f[i - 1] * i) % MOD;
    for (int i = 0; i < MAX_N; i++) rf[i] = inv(f[i]);
}
ll comb(int n, int k) {
    ll a = f[n]; // = n!
    ll b = rf[n-k]; // = (n-k)!
    ll c = rf[k]; // = k!

    ll bc = (b * c) % MOD;

    return (a * bc) % MOD;
}

ll modpow(ll a, ll n) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1;
  }
  return res;
}

ll modinv(ll a) {
  return modpow(a, MOD - 2);
}

void solve() {
  ll ans = 0;

  for (int k = 0; k <= K; k++) {
    ll n = modpow(M-1, N-k-1);
    n = (n * M) % MOD;
    ans = ans + (n * comb(N-1, k)) % MOD;
  }

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

int main() {
  scanf("%d %d %d", &N, &M, &K);

  init();

  solve();
}


Measured memory_bytes: 4860
#include <bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  cin>>s;
  if(s=="Sunny"){
    cout<<"Cloudy"<<endl;
  }
  else if(s=="Rainy"){
    cout<<"Sunny"<<endl;
  }
  else if(s=="Cloudy"){
    cout<<"Rainy"<<endl;
  }
}

Measured memory_bytes: 384
#include<iostream>

char a[10];
int max = 0, count;
int main()
{
	std::cin >> a;

	for(int i = 0; i < 11; i++)
	{
		if(a[i] == 'A')
		{
			count++;
		}
		else if(a[i] == 'C')
		{
			count++;
		}
		else if(a[i] == 'G')
		{
			count++;
		}
			else if(a[i] == 'T')
		{
			count++;
		}
		else
		{
			if(max < count)
			{
				max = count;
			}
			count = 0;
		}
	}
	

	std::cout << max;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //10^19 < 9223372036854775807
typedef unsigned long long ull; //10^20 < 18446744073709551615

#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
#define FORA(i,I) for(const auto& i:I)
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 

#define MOD 1000000007

int main(void)
{
    ll H,N;
    cin >> H >> N;

    int A;
    REP (i,N) {
        cin >> A;
        H -= A;
    }

   string ans = "No";
    if (H <= 0) {
        ans = "Yes";
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3564
def main():
    n = int(input())
    array = [int(x) for x in input().split()]

    cnt = 0
    while True:
        flag = False
        for i in range(1, n)[::-1]:
            if array[i-1] > array[i]:
                tmp = array[i]
                array[i] = array[i-1]
                array[i-1] = tmp
                flag = True
                cnt += 1
        if not flag:
            break
    print(" ".join(map(str, array)))
    print(cnt)


main()


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

int A, B;

long long gcd(long long x, long long y){
  long long a = max(x, y), b = min(x, y);
  if(b == 0){
    return a;
  }
  return gcd(b, a % b);
}

int main(){
  cin >> A >> B;
  long long ans = (1LL) * A * B / gcd(A, B);
  cout << ans << endl;
}



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

public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            int n  = Integer.parseInt(br.readLine());
            int i = 0;
            boolean flag = false;
            while (true) {
                if (i * 4 > n || flag == true) {
                    break;
                }
                int j = 0;
                while (true) {
                    if (i * 4 + j * 7 > n) {
                        break;
                    }
                    if (i * 4 + j * 7 == n) {
                        flag = true;
                        break;
                    }
                    j++;
                }
                i++;
            }
            if (flag) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}


Measured memory_bytes: 24532
using System;
using System.Collections.Generic;
using System.Linq;

namespace CSharpSample01
{


    class Program
    {

        static string Solve(string S, string T)
        {
            int sn = S.Length;
            int tn = T.Length;

            int[,] dp = new int[sn + 1, tn + 1];
            
            for(int i = 0; i <= sn; i++)
            {
                dp[i, 0] = 0;
            }
            for(int j = 0; j <= tn; j++)
            {
                dp[0, j] = 0;
            }

            for(int i = 1; i <= sn; i++)
            {
                for(int j = 1; j <= tn; j++)
                {
                    if(S[i - 1] == T[j - 1])
                    {
                        dp[i, j] = dp[i - 1, j - 1] + 1;                       
                    }
                    else
                    {
                        dp[i, j] = Math.Max(dp[i - 1, j], dp[i, j - 1]);
                    }
                }
            }

            
            string ans = "";
            int u = sn;
            int v = tn;
            while(u > 0 && v > 0)
            {
                if(dp[u, v] == dp[u - 1, v])
                {
                    u--;
                }
                else if(dp[u, v] == dp[u, v - 1])
                {
                    v--;
                }
                else
                {
                    ans = S[u - 1] + ans;
                    u--;
                    v--;
                }
            }


            return ans;
        }


        
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            string T = Console.ReadLine();

            Console.WriteLine(Solve(S, T));
        }
    }
}

Measured memory_bytes: 50136
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=200050;
//ここまでテンプレ
int main(){
	int H,W,N;
	cin>>H>>W>>N;
	//それぞれの行について、もっとも左にあるブロックの位置
	priority_queue<int,vint,greater<int>> que[SIZE];
	for(int i=0;i<N;i++){
		int x,y;
		cin>>x>>y;
		x--;
		y--;
		que[x].push(y);
	}
	//到達可能な列の中で最も右のものを持ちながら下に下がっていく
	int R=0,ans=0;
	for(int i=1;i<H;i++){
		ans++;
		if(que[i].empty() || que[i].top()>R+1){
			R++;
		}
		else if(que[i].top()<=R){
			cout<<ans<<endl;
			return 0;
		}
	}
	cout<<H<<endl;
	return 0;
}

Measured memory_bytes: 12800
import java.util.Scanner;

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

        int N = sc.nextInt();

        System.out.println(solve(N) ? "Yes" : "No");

        sc.close();
    }

    static boolean solve(int N) {
        return N % String.valueOf(N).chars().map(ch -> ch - '0').sum() == 0;
    }
}

Measured memory_bytes: 28500
//E - Sequence Sum
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>

#define LL long long
#define Cl(X,Y) memset((X),(Y),sizeof(X))
#define FOR(i,A,B) for(LL i=A;i<=B;i++)
#define BOR(i,A,B) for(LL i=A;i>=B;i--)
#define Lowbit(X) (X & (-X))
#define INF 0x3f3f3f3f3f3f3f3f
#define Rson (X<<1|1)
#define Lson (X<<1)
using namespace std;
const LL MaxN=1e5+10;

LL N,X,M,Ans;
LL Loc[MaxN],Pre[MaxN];

inline void File() {
    freopen(".in","r",stdin);
    freopen(".out","w",stdout);
}
signed main() {
    // File();
    ios::sync_with_stdio(false);
    cin>>N>>X>>M;
    Ans+=X;
    Pre[1]=X; 
    Loc[X]=1;
    LL Sta=INF;
    FOR(i,2,N) {
        X=X*X%M;
        Pre[i]=Pre[i-1]+X;
        Ans+=X;
        if(Loc[X]) { LL Len=i-Loc[X]; Ans+=(N-i)/Len*(Pre[i]-Pre[Loc[X]]); Sta=N-(N-i)%Len+1; break; }
        else { Loc[X]=i; }
    }
    FOR(i,Sta,N) {
        X=X*X%M;
        Ans+=X;
    }
    cout<<Ans<<endl;
    // fclose(stdin);
    // fclose(stdout);
   // system("pause");
    return 0;
}

Measured memory_bytes: 4708
import java.math.*;
import java.text.*;
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		Stack<Integer> st = new Stack<Integer>();
		while(in.hasNextInt()){
			int n = in.nextInt();
			if(n==0){
				System.out.println(st.pop());
			}
			else{
				st.push(new Integer(n));
			}
		}
	}

}

Measured memory_bytes: 12000
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

ll dp[2010][2010];
ll a[2010],b[2010];
int main(){
	ll n,m;
	scanf("%lld%lld",&n,&m);
	rep(i,0,n)scanf("%lld",a+i);
	rep(i,0,m)scanf("%lld",b+i);
	rep(j,0,m+1)dp[0][j]=1;
	
	rep(i,1,n+1){
		ll s[100010]={};
		rep(j,0,m+1){
			//a[i]を取るとき、j以前にあるb[k]==a[i]であるようなkのところを拾ってくる
			//取らないとき、dp[i-1][j]までをそのまま
			dp[i][j]=(dp[i-1][j]+s[a[i-1]])%MOD;
			s[b[j]]=(s[b[j]]+dp[i-1][j])%MOD;
//	rep(i,0,n+1){rep(j,0,m+1)printf("%lld",dp[i][j]);puts("");}
//	rep(i,0,5)printf("%lld",s[i]);puts("");
			
		}
	}
	printf("%lld",dp[n][m]);
}

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

using namespace std ;
typedef long long ll;

int n, a[222];

int main()
{
    scanf("%d", &n);
    n <<= 1;
    for (int i = 0; i < n; ++i)
        scanf("%d", &a[i]);
    sort(a, a+n);
    int ans = 0;
    for (int i = 0; i < n; i += 2)
        ans += a[i];
    printf("%d\n", ans);
    return 0 ;
}


Measured memory_bytes: 256
/******************************************************************************

                         بسم الله الرحمن الرحيم
                     Author: Mst: Mhamuda Khatun
                               RUCSE27

*******************************************************************************/

#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define ll long long
#define pi 2*acos(0.0)
#define f first
#define s second
#define pb push_back
#define gap ' '
#define fastio {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define mod 1000000007
#define MAX 1000000000000
#define N 305

int main()
{
    fastio;
    int i,p=0;
    string s,t;
    cin>>s>>t;

    for(i=0;i<s.size();i++)
    {
        if(s[i]!=t[i])
        {
            p=1;
            break;
        }

    }
    if(p==0)
    {
        if(s.size()!=t.size()-1)
            p=1;
    }
    if(p)
        cout<<"No";
    else
        cout<<"Yes";
    cout<<"\n";
    return 0;   //:D
}




Measured memory_bytes: 3604
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int n = sc.nextInt();
  int a = sc.nextInt();
  int b = sc.nextInt();
  int ans = 0;
  for(int i =1;i<=n;i++){
    int c = (i/10000) + (i%10000)/1000 + (i%1000)/100 + (i%100)/10 +i%10;
    if(c>=a && c<=b)ans += i;
    if(i == n)System.out.println(ans);
  }
}}

Measured memory_bytes: 21972