akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		try {
			// 1行目の入力読み取り
			String inputLine = sc.nextLine();
			String[] inputLines = inputLine.split(" ");
			int xCount = Integer.parseInt(inputLines[0]);
			int yCount = Integer.parseInt(inputLines[1]);
			int maxPosX = Integer.parseInt(inputLines[2]);
			int minPosY = Integer.parseInt(inputLines[3]);
			// 2行目の入力読み取り
			inputLine = sc.nextLine();
			inputLines = inputLine.split(" ");
			if (inputLines.length != xCount) throw new Exception();
			int tmp = 0;
			for(String s : inputLines)
			{
				tmp = Integer.parseInt(s);
				if (tmp > maxPosX) maxPosX = tmp;
			}
			// 3行目の入力読み取り
			inputLine = sc.nextLine();
			inputLines = inputLine.split(" ");
			if (inputLines.length != yCount) throw new Exception();
			for(String s : inputLines)
			{
				tmp = Integer.parseInt(s);
				if (tmp < minPosY) minPosY = tmp;
			}
			// 判定
			if (maxPosX >= minPosY)
			{
				System.out.println("War");
			} else {
				System.out.println("No War");
			}
		} catch (Exception e) {
			System.out.println("input error");
		} finally {
			sc.close();
		}
	}

}

Measured memory_bytes: 21844
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>
#include <climits>



using namespace std;

using ll = long long;
using P = pair<ll,ll>;

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
const int mod = 1000000007;
#define EPS (1e-10)

#define pb push_back
#define fir first
#define scn second
#define ednl endl

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")


P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}


int gcd(int a,int b){
  if(a%b)return gcd(b,a%b);
  else return b;
}
int main(){
  int n;cin>>n;
  double J = 0;
  double B = 0;
  for(int i = 0; n > i; i++){
    double a;cin>>a;
    string b;cin>>b;
    if(b == "JPY"){
      J += a;
    }else{
      B += a;
    }
  }
  cout << fixed << setprecision(10) << J+B*380000 <<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define ARRAY_LENGTH(array) sizeof(array)/sizeof(*array)
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() {
    ll N, D, X;
    cin >> N >> D >> X;

    vector<ll> A(N);
    REP(i, N) cin >> A[i];

    ll sum = X;
    REP(i, N) {
        for(ll j = 0; j*A[i] + 1 <= D; ++j) {
            ++sum;
        }
    }

    cout << sum << endl;

    return 0;
}

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

int main(){
  int N;
  cin >> N;
  
  int64_t count = 1, ans = 0;
  while(count <= N){
    if(count % 3 != 0 && count % 5 != 0){
      ans += count;
    }
    count++;
  }
  
  cout << ans << endl;
}

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

int n,m;
ll a[100001],b,c,ans;
vector<ll> d;
l_l cb[100001];

int main() {
    cin >> n >> m;
    for (int i=0;i<n;i++) {
        cin >> a[i];
    }
    for (int i=0;i<m;i++) {
        cin >> b >> c;
        cb[i] = make_pair(c,b);
    }
    sort(a,a+n);
    sort(cb,cb+m,greater<l_l>());
    for (int i=0; i<m && d.size()<n; i++) {
        ll C = cb[i].first;
        ll B = cb[i].second;
        for (int j=0;j<B;j++) {
            d.push_back(C);
        }
    }

    for (int i=0;i<n;i++) {
        d.push_back(0);
        ans += max(a[i],d[i]);
    }
    cout << ans << endl;
}



Measured memory_bytes: 4852
import sys
import math
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":pass
n = i()
s = l()
if len(s)%2 == 0 and s[:n//2] == s[n//2:]:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
/*input

*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define int long long 
#define double long double
#define f first
#define s second
#define mp make_pair
#define pb push_back

#define RE(i,n) for (int i = 1; i <= n; i++)
#define RED(i,n) for (int i = n; i > 0; i--)
#define REPS(i,n) for(int i = 1; (i*i) <= n; i++)
#define REP(i,n) for (int i = 0; i < (int)n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)

#define all(v) v.begin(),v.end()
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define print(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout << *it << " "; cout << endl;
#define debug(x) cout << x << endl;
#define debug2(x,y) cout << x << " " << y << endl;
#define debug3(x,y,z) cout << x << " " << y << " " << z << endl;

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

const int INF = 1e18+1;
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;

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

int floor1(int n,int k){
    if(n%k == 0 || n >= 0)return n/k;
    return (n/k)-1;
}

int ceil1(int n,int k){
    return floor1(n+k-1,k);
}

void solve(){
    int n,k;cin >> n >> k;
    cout << (n+k-1)/k;
}

signed main(){
  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  //freopen(".in","r",stdin);freopen(".out","w",stdout);
  int t = 1;
  //cin >> t;
  while(t--){
    solve();
  }
  return 0;
}

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

int main() {
  //定義一覧
  string S;
  string C;
  
  //繰り返し
  for(int i = 0; i < 3; i++){
    cin >> S;
    C += S.at(0);
  }
  
  cout << C << endl;
}

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

 using namespace std;

 int main() {
   int A, B, K, i;

   cin >> A >> B >> K;

   if (A + K - 1 < B - K + 1) {
     for (i = 0; i < K; i++) cout << A + i << endl;
     for (i = 0; i <= K - 1; i++) cout << B - K + 1 + i << endl;
   }

   else {
     int out = A;
     while (out <= B) {
       cout << out << endl;
       out++;
     }
   }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
 ll n,k;
 cin>>n>>k;
 ll h[n];
 for(ll i=0;i<n;i++) cin>>h[i];
 ll dp[n];
 ll INF=1e18;
 for(ll i=0;i<n;i++) dp[i]=INF;
 dp[n-1]=0;
 for(ll i=n-2;i>=0;i--){
  for(ll j=i+1;j<=i+k&&j<n;j++){
   dp[i]=min(dp[i],dp[j]+abs(h[i]-h[j]));
  }
 }
 cout<<dp[0]<<endl;
 return 0;
}

Measured memory_bytes: 1792
#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 D;
  cin >> D;
  vector<int>C(26); //Cには，各コンテストの満足度の下がりやすさが入っている。
  rep(i,26)cin >> C[i];
  
  int S[D][26];
  rep(i,D){
    rep(j,26)cin >> S[i][j];
  }
  
  vector<int>T(D);
  rep(i,D)cin >> T[i];
  
  //↑ここまで入力
  
  vector<int>Last_d(26,0); //ここには最後にコンテストした日が入る 0で初期化
  
  int score =0;
  rep(d,D){ //D日間すべてを見ていく.
    //最初に開いたコンテストぶん点数を加算する
    score += S[d][T[d]-1];
    Last_d[T[d]-1] = d+1; //日付更新
    
    rep(i,26){ //26種のコンテストについて,点数を減算する
      score -= C[i] * (d+1 - Last_d[i]);
    }
    cout << score << endl;
  }
  
  
  
  
}

Measured memory_bytes: 3672
/* ***********************************************
Author        :Winmer
Created Time  :2018年04月20日 星期五 21时58分44秒
File Name     :a.cpp
************************************************ */

#include<iostream>
#include<cstring>
#include<string>
using namespace std;
int sum;
bool b[3];
string s;
int main(){
while(cin>>s){
sum=0;
memset(b,0,sizeof(b));
for(int i=0;i<3;i++){b[s[i]-'a']=true;}
for(int i=0;i<3;i++){sum+=b[i];}
if(sum==3)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}
return 0;
}


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

int main() {
	ll n, m;
	cin >> n >> m;
	ll ans;
	if (n * 2 > m)
		ans = m / 2;
	else
		ans = n + (m - 2 * n) / 4;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import math

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

#a = list(map(int, input().split()))

#####################################


#1:43
h,w = list(map(int, input().split()))
queue=[]
mp=[[-1 for i in range(h)]for j in range(w)]
for i in range(h):
    temp = input()
    for j in range(len(temp)):
        if(temp[j]=='#'):
            queue.append([j,i,0])
            mp[j][i]=0
            
nowq = 0
while(True):
    x,y,times = queue[nowq]
    if(mp[min(x+1,w-1)][y]==-1):
        mp[min(x+1,w-1)][y]=times+1
        queue.append([x+1,y,times+1])
    if(mp[max(x-1,0)][y]==-1):
        mp[max(x-1,0)][y]=times+1
        queue.append([x-1,y,times+1])
    if(mp[x][min(y+1,h-1)]==-1):
        mp[x][min(y+1,h-1)]=times+1
        queue.append([x,y+1,times+1])
    if(mp[x][max(y-1,0)]==-1):
        mp[x][max(y-1,0)]=times+1
        queue.append([x,y-1,times+1])
    nowq+=1
    if(len(queue)==nowq):
        break
ans=0
for i in range(w):
    ans=max(ans,max(mp[i]))
print(ans)

Measured memory_bytes: 158884
#include <stdio.h>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <iostream>
#include<math.h>
#include<bitset>
#include<iomanip>
using namespace std;

int main() {
	int N,a,mod=1e9+7; cin >> N;
	vector<int> A(N,0);
	for (int i = 0; i < N; i++) {
		cin >> a; A[a]++;
	}
	if((N%2==1&&A[0]!=1)){ cout << 0 << endl; return 0; }
	for (int i = 1; i < N; i++) {
		if (A[i]%2!=0) {
			cout << 0 << endl; return 0;
		}
	}
	long long ans = 1;
	if (N % 2 == 1) {
		for (int i = 0; i < (N - 1) / 2; i++)ans = ans*2%mod;
	}
	else {
		for (int i = 0; i < N / 2; i++)ans = ans * 2 % mod;
	}
	cout << ans << endl;
}



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

int n;
ll l[88];

int main(void){
	l[0]=2;
	l[1]=1;
	scanf("%d",&n);
	for(int i=2;i<=n;i++){
		l[i]=l[i-1]+l[i-2];
	}
	printf("%lld\n",l[n]);
	return 0;
}

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

// using queue
int main(){
  int64_t K;
  cin >> K;
  queue<int64_t> L;
  for(int i=1;i<=9;i++){
    L.push(i);
  }
  int64_t count;
  int64_t x;
  for(count=1;count<=K;count++){
    x = L.front();
    if(x%10 != 0) L.push(x*10 + (x%10) - 1);
                  L.push(x*10 + (x%10))    ;
    if(x%10 != 9) L.push(x*10 + (x%10) + 1);
    L.pop();
  }
  cout << x << endl;
}

Measured memory_bytes: 1792
import math

N,D = map(int,input().split())

Xlist = []
countsum = 0
for count in range(N):
    X = list(map(int,input().split()))
    Xlist.append(X)

for count1 in range(N):
    X1 = Xlist[count1]
    for count2 in range(count1 + 1,N):
        X2 = Xlist[count2]
        cul = 0
        for count3 in range(D):
            cul += abs(X1[count3] - X2[count3])**2
        if math.sqrt(cul) % 1 == 0:
            countsum += 1
print(countsum)




Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vi2 = vector<vector<int>>;
using vb = vector<bool>;
using vb2 = vector<vector<bool>>;
using vc = vector<char>;
using vc2 = vector<vector<char>>;
using vs = vector<string>;
using si = set<int>;
using vs2 = vector<vector<string>>;
using pii = pair<int, int>;
using mii = map<int, int>;
const int INF = 1e9;
const ll LINF = 1e18;
const long double PI = acos(-1.0);
#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)
#define sz(x) (int)(x).size()
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
 
#define ALL(x) (x).begin(),(x).end()
#define SORT(v) sort(ALL(v));
#define IN(type,a) type a;cin >> a;
#define VIN(type,a,n) vector<type> a(n);cin >> a;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;
#define COUT(x) cout << (x) << endl;
#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl;
#define ENDL cout << endl;
#define DB(s,x) cout << (s) << " : " << x << endl;

#define HOGE COUT("HOGE")

template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,sz(v))i>>v[j];return i;}

template<typename T> bool chmax(T& a, const T& b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T& a, const T& b){if(a>b){a=b;return true;}return false;}
template<typename T> T gcd(T a,T b){if(b==0){return a;}else{return gcd(b, a%b);}}

int main() {
    IN(ll, n);
    vector<ll> a(n,0);
    REPS(i, n){
        ll k = i;
        while(k<=n){
            a[k-1]++;
            k+=i;
        }
    }
    ll ans = 0;
    REP(i, n){
        ans += a[i]*(i+1);
    }
    COUT(ans);
}



Measured memory_bytes: 81328
#include <bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define lp(i,a,n) for(int i=(a);i<=(int)(n);++i)
#define lpd(i,a,n) for(int i=(a);i>=(int)(n);--i)
#define mem(a,b) memset(a,b,sizeof a)
#define all(v) v.begin(),v.end()
#define println(a) cout <<(a) <<endl
#define sz(x) ((int)(x).size())
#define readi(x) scanf("%d",&x)
#define read2i(x,y) scanf("%d%d",&x,&y)
#define read3i(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define mod 1000000007
#define eps 1e-8
#define infi 1000000000
#define infll 1000000000000000000ll
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef set<int> si;
typedef map<int,int> mii;

const int N = 10002;
int n,h,w,a[N],ans[102][102];

int main(){
    read2i(h,w);
    readi(n);
    lp(i,1,n) readi(a[i]);

    int curr = 1;
    lp(i,1,h){
        if(i&1) lp(j,1,w){
            ans[i][j] = curr;
            --a[curr];
            if(!a[curr]) ++curr;
        }
        else lpd(j,w,1){
            ans[i][j] = curr;
            --a[curr];
            if(!a[curr]) ++curr;
        }
    }

    lp(i,1,h){
        lp(j,1,w) cout <<ans[i][j] <<" ";
        puts("");
    }
}

/*
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
*/


Measured memory_bytes: 384
#include<stdio.h>
#include<cstdio>
using namespace std;

int main() {
  int N;
  scanf("%d", &N);
  int sum = 0;
  int digit = N;
  while (digit > 0) {
    sum += digit % 10;
    digit /= 10;
  }
  if (N % sum == 0) printf("Yes\n");
  else printf("No\n");
}

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

using namespace std;

typedef long long ll;
typedef long double ld;

const int N=(int)1e5+7;

int n,m;
int cnt[N];

vector<int>g[N];

struct info
{
        int nod;
        int cnt;
};

bool operator < (info a,info b)
{
        if(a.cnt==b.cnt)
        {
                return a.nod<b.nod;
        }
        return a.cnt<b.cnt;
}

set<info>s;

int elib[N];

int main()
{
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
        cin>>n>>m;
        for(int i=1;i<=n-1+m;i++)
        {
                int a,b;
                cin>>a>>b;
                cnt[b]++;
                g[a].push_back(b);
        }
        for(int i=1;i<=n;i++)
        {
                s.insert({i,cnt[i]});
        }
        while(s.size()>0)
        {
                auto it=*s.begin();
            //    cout<<" = "<<it.nod<<"\n";
                s.erase(it);
                for(auto &nod:g[it.nod])
                {
                        auto it2=*s.find({nod,cnt[nod]});
                        s.erase(it2);
                        cnt[nod]--;
                        if(cnt[nod]==0)
                        {
                                elib[nod]=it.nod;
                        }
                        s.insert({nod,cnt[nod]});
                }
        }
        for(int i=1;i<=n;i++)
        {
                cout<<elib[i]<<"\n";
        }
        return 0;
        cout<<"\n\n";
        for(auto &it:s)
        {
                cout<<it.nod<<" "<<it.cnt<<"\n";
        }
        return 0;
}
/**

**/


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

#define For(i, l, r) for (register int i = (l), i##end = (int)(r); i <= i##end; ++i)
#define Fordown(i, r, l) for (register int i = (r), i##end = (int)(l); i >= i##end; --i)
#define Rep(i, r) for (register int i = (0), i##end = (int)(r); i < i##end; ++i)
#define Set(a, v) memset(a, v, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define debug(x) cout << #x << ": " << (x) << endl

using namespace std;

template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, T b) { return b > a ? a = b, 1 : 0; }

inline int read() {
	int x(0), sgn(1); char ch(getchar());
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') sgn = -1;
	for (; isdigit(ch); ch = getchar()) x = (x * 10) + (ch ^ 48);
	return x * sgn;
}

void File() {
#ifdef zjp_shadow
	freopen ("D.in", "r", stdin);
	freopen ("D.out", "w", stdout);
#endif
}

const int N = 1e5 + 1e3, Mod = 1e9 + 7;

int n, m, x[N], y[N];

int main () {

	File();

	n = read(); m = read();
	For (i, 1, n) x[i] = read();
	For (i, 1, m) y[i] = read();

	int cx = 0, cy = 0;
	For (i, 1, n - 1) cx = (cx + 1ll * i * (n - i) % Mod * (x[i + 1] - x[i])) % Mod;
	For (i, 1, m - 1) cy = (cy + 1ll * i * (m - i) % Mod * (y[i + 1] - y[i])) % Mod;

	printf ("%lld\n", 1ll * cx * cy % Mod);

	return 0;

}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define int long long
using namespace std;
template<class T> inline bool chmax(T& a, T b){ if(a<b){ a=b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b){ if(a>b){ a=b; return 1; } return 0; }


signed main()
{   
    int N,M; cin>>N>>M;
    vector<vector<int> > G(N,vector<int>());
    vector<int> indeg(N);
    for(int i=0;i<M;i++){
        int x,y; cin>>x>>y;
        x--; y--;
        G[x].push_back(y);
        indeg[y]++;
    }
    
    queue<int> Q;
    for(int i=0;i<N;i++) if(indeg[i]==0){
        Q.push(i);
    }

    vector<int> dp(N);
    while(!Q.empty()){
        int v=Q.front();
        Q.pop();
        for(int u:G[v]){
            indeg[u]--;
            if(indeg[u]==0){
                Q.push(u);
            }
            chmax(dp[u],dp[v]+1);
        }
    }
    cout<<*max_element(dp.begin(),dp.end())<<endl;
}


Measured memory_bytes: 7296
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "

int main(){
    ll n;cin>>n;
    vector<ll> a(n), c(n+1, 0);
    rep(i,n){cin>>a[i];c[a[i]]++;}
    ll sum = 0;
    rep(i, n+1){sum += c[i]*(c[i]-1)/2;}
    rep(i, n){
        ll ans = sum - c[a[i]] + 1;
        co(ans);
    }
}

Measured memory_bytes: 5760
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author indy256
 */

#include <bits/stdc++.h>

using namespace std;

void solve(istream &in, ostream &out) {
    int n;
    in >> n;
    string s;
    in >> s;

    string t = s.substr(0, n / 2);

    out << (s == t + t ? "Yes" : "No") << '\n';
}


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solve(in, out);
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>
#include <climits>
#define MOD 1000000007
typedef long long ll;
using namespace std;

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

  ll ans=LLONG_MAX;
  if(a%2==0||b%2==0||c%2==0) cout<<0<<endl;
  else{
    ans=min(ans,a*b);
    ans=min(ans,a*c);
    ans=min(ans,b*c);
    cout<<ans<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include<vector>
#include<iomanip>
#include<map>
#include <queue>
#include<cmath>
#include<cstdio>
#include<iomanip>

using namespace std;
using ll = long long int;


int main(void){
  int n;
  cin>>n;
  
  map<string, int> m;
  for(int i=0;i<n;i++){
    string s;
    cin>>s;

    m[s]++;
  }

  int max = 0;
  
  for(auto i=m.begin();i!=m.end();i++){
    if(i->second >max) max = i->second;
  }

  for(auto i=m.begin();i!=m.end();i++){
    if(i->second==max)cout<<(i->first)<<endl;
  }

  return 0;
}

Measured memory_bytes: 25216
package main

import (
	"fmt"
)

func max(a []int) int {
	max := a[0]
	for _, v := range a {
		if max < v {
			max = v
		}
	}
	return max
}

func min(a []int) int {
	min := a[0]
	for _, v := range a {
		if v < min {
			min = v
		}
	}
	return min
}

func main() {
	var N, M, X, Y int
	fmt.Scan(&N, &M, &X, &Y)

	x := make([]int, N+1)
	x[0] = X
	for i := 1; i < N+1; i++ {
		fmt.Scan(&x[i])
	}
	y := make([]int, M+1)
	y[0] = Y
	for i := 1; i < M+1; i++ {
		fmt.Scan(&y[i])
	}

	xmax := max(x)
	ymin := min(y)

	if xmax < ymin {
		fmt.Println("No War")
	} else {
		fmt.Println("War")
	}
}


Measured memory_bytes: 512
sd = input()
t = input()
ls = len(sd)
lt = len(t)
ans=[]
for i in range(ls-lt,-1,-1):
  for j, k in zip(sd[i:i+lt], t):
    if j != "?" and j != k:
      break
  else:
    temp = sd[:i] + t + sd[i+lt:]
    ans.append(temp.replace("?","a"))

if not ans:
  print("UNRESTORABLE")
else:
  ans.sort()
  print(ans[0])

Measured memory_bytes: 9016
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld  = long double;
using pll = pair<ll, ll> ;
using pld = pair<ld, ld>;
const int INF=1e9+7;
const ll LINF=1LL<<60;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld EPS = 1e-9; //微調整用（EPSより小さいと0と判定など）

//MODINT
//変数名.nでint型の数値を受け取る
struct mint {
    int n;
    mint(int n_ = 0) : n(n_) {}
};
 
mint operator+(mint a, mint b) { a.n += b.n; if (a.n >= MOD) a.n -= MOD; return a; }
mint operator-(mint a, mint b) { a.n -= b.n; if (a.n < 0) a.n += MOD; return a; }
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }

int ii() { int x; scanf("%d", &x); return x; }
long long il() { long long x; scanf("%lld", &x); return x; }
string is() { string x; cin >> x; return x; }
char ic() { char x; cin >> x; return x; }
void oi(int x) { printf("%d ", x); }
void ol(long long x) { printf("%lld ", x); }
void od(double x) { printf("%.15f ", x); }
void os(const string &s) { printf("%s ", s.c_str()); }
auto op = [&](auto p) -> void{ cout << p; };
auto ov = [&](auto vec) -> void{ cout << vec; };
void br() { putchar('\n'); }
 
#define gcd __gcd //llは受け取ってくれない
int lcm(int a, int b){return a / gcd(a, b) * b;}
#define ALL(a) a.begin(),a.end() //sort(ALL(vec));
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#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())
#define PB push_back
#define SZ(x) ((int)(x).size) //size()がunsignedなのでエラー避けに

// coutによるpairの出力（空白区切り）
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << p.first << " " << p.second;}
// coutによるvectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
	int len = v.size();
	for (int i = 0; i < len; ++i) {
		s << v[i]; if (i < len - 1) s << " "; //"\t"に変えるとTabで見やすく区切る
	}
	return s;
}
// coutによる多次元vectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
	int len = vv.size();
	for (int i = 0; i < len; ++i) {
		s << vv[i] << endl;
	}
	return s;
}

//最大値、最小値を更新する。aよりbのが大きい（小さい）か等しければaを更新してtrueを返す。そうでなければ何もせずfalseを返す chmax(nowmax,x);
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}

// ----- template end ---- //
 
// ------- library ------- //



// ----- library end ----- //



int main() {


  ll N = il();
  ll K = il();

  //N以下の正の整数で、Kの倍数(mod Kが0)なものの数
  ll mk_0 = N / K;

  //Kが偶数のときに使う、N以下でmod KがK/2なものの数
  //...は、結局Kの倍数と同じ数
  if (K%2==0){
    ll mk_kdb0 = 0;
    REP(i, 1, N+1){
      if (i%K==(K/2)) mk_kdb0++;
    }
    ol(pow(mk_0, 3)+pow(mk_kdb0, 3)); br();
    return 0;
  }

  ol(pow(mk_0, 3)); br();

  
// -- main() end -- //
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <string>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
using namespace std;

#define REP(i,p,n) for(ll i=p;i<ll(n);++i)
#define rep(i,n) REP(i,0,n)

using ll = long long int;
using pll = pair<ll, ll>;

const ll mod = static_cast<ll>(1e9) + 7;

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

    if (s[2] == s[3] && s[4] == s[5])
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}


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

// graph //
int V,E,r,from,to,weight;

struct Edge{
    int from,to,cost;
    Edge(int from,int to,int cost) : from(from),to(to),cost(cost){}
};

vector<vector<Edge> >  G;

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cin >> V >> E >> r;
    G.resize(V);
    REP(i,E){
        cin >> from >> to >> weight;
        G[from].emplace_back(from,to,weight);
    }

    priority_queue<pii,vector<pii>, greater<pii> > pq;
    pq.push(pii(0,r));
    vector<ll> dist(V,INF);
    dist[r] = 0;
    while(!pq.empty()){
        pii v = pq.top();pq.pop();
        if(dist[v.second] < v.first) continue;
        for(auto e : G[v.second]){
            if(dist[e.from] != INF && dist[e.to] > dist[e.from] + e.cost){
                dist[e.to] = dist[e.from] + e.cost;
                pq.push(pii(dist[e.to],e.to));
            }
        }
    }

    REP(i,V){
        if(dist[i]==INF) cout << "INF" << '\n';
        else cout << dist[i] << '\n';
    }
    return 0;
}


Measured memory_bytes: 15840
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    string N;
    cin >> N;
    if (N[0] == '7' || N[1] == '7' || N[2] == '7') cout << "Yes" << endl;
    else cout << "No" << endl;
}



Measured memory_bytes: 3624
N = int(input())
A = list(map(int, input().split()))
im, m = 0, 0
for i,a in enumerate(A):
    if abs(a)>abs(m):
        m = a
        im = i

operations = []
for i in range(N):
    if i==im: continue
    operations.append((im+1, i+1))
    A[i] += A[im]

if m>=0:
    for i in range(N-1):
        operations.append((i+1, i+2))
        A[i+1] += A[i]

else:
    for i in range(N-1, 0, -1):
        operations.append((i+1, i))
        A[i-1] += A[i]

print(len(operations))
for x, y in operations:
    print(x,y)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
    using namespace std;
 
    int main(){
      int n , k;
      cin >> n >> k;
      vector<long> v;
      long t;
      int back , backmax;
      backmax = 0; 
      vector<long> vminus , vminus2;
      for(int i = 0; i < n ; i++){
          cin >> t;
          v.push_back(t);
          if (t < 0) {
              backmax += 1;
          }
      }
      
      long ans , temp1 , temp2 , temp3;
      ans = 0;
      temp1 = 0;
      for(int l = -1 ; l < k && l < n && l < k ; l++){
          //cout << "l:" << l << endl;
          temp2 = 0;
          if( l != -1){
              temp1 += v[l]; 
              if(v[l] < 0) {
                  vminus.push_back(v[l]);
                  sort(vminus.begin(), vminus.end());
              }
          }
          ans = max(ans , temp1);
          vector<long>  vminus3(vminus);
          for(int r = -1 ; (l + 1) + (r + 1 )  <= k && (l + 1) + (r + 1 ) <= n && r < n && r < k ; r++){
              temp3 = 0;
              if(r != -1){
                  temp2 += v[n - r - 1];
                  if(v[n - r - 1] < 0) {
                      vminus3.push_back(v[n - r - 1]);
                      sort(vminus3.begin(), vminus3.end());
                  }
              }
              ans = max(ans , temp1 + temp2);
              for(int b = 0 ; (l + 1) +  (r + 1) + (b + 1)  <= k && b < vminus3.size() ; b++){
                  temp3 -= vminus3[b];
                  //cout << "l:" << l << " r:" << r << " b:" << b << endl;
                  //cout << "t1:" << temp1 << " t2:" << temp2 << " t3:" << temp3 << endl;
                  //cout << "t:" << temp1 + temp2 + temp3  << endl;
                  ans = max(ans , temp1 + temp2 + temp3);
              }
          }
      }
      cout << ans << endl;

      return 0;
    }

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <limits.h>
using namespace std;
bool flag[101];
int d[101];
int f[101];
vector<int> v[101];
int t;
void dfs(int node){
	flag[node] = true;
	d[node] = t;
	bool finished = true;
	if (finished && f[node] == 0) f[node] = t;
	for (int i = 0; i < v[node].size(); ++i){
		int tmp = v[node][i];
		if (!flag[tmp]){
			++t;
			dfs(tmp);
			++t;
		}
	}
	f[node] = t;
}
int main(){
	int n; scanf("%d",&n);
	for (int i = 0; i < n; ++i){
		int u, k; scanf("%d %d",&u,&k);
		int tmp;
		for (int j = 0; j < k; ++j){
			scanf("%d", &tmp);
			v[u].push_back(tmp);
		}
	}
	v[0].push_back(1);
	dfs(0);
	++t;
	for (int i = 1; i <= n; ++i){
		if (d[i] == 0) dfs(i);
	}
	
	for (int i = 1; i <= n; ++i){
		cout << i << ' ' << d[i] << ' ' << f[i]+1 << '\n';
	}
}


Measured memory_bytes: 3220
def main():
    from itertools import accumulate as ac
    from bisect import bisect_left as bl
    from bisect import bisect_right as br
    from sys import stdin
    input=stdin.readline

    def check(k):
        dist=a[-k-1]-ini
        if dist<0:
            dist=abs(dist)
            return k>=br(a,ini+dist)-bl(a,ini-dist)-1
        else:
            return k>=br(a,ini+dist)-bl(a,ini-dist)
    
    n,q=map(int,input().split())
    nn=n//2+1
    a=list(map(int,input().split()))
    x=[int(input()) for _ in [0]*q]
    ix=sorted([[i,j] for i,j in enumerate(x)],key=lambda x:x[1])
    ans=[0]*q
    aac=[0]+list(ac(a))
    aac2=[0]+list(ac(a[(n+1)%2::2]))
    k=min(nn,n-1)

    for i,ini in ix:
        while check(k)==True:k-=1
        k+=1
        ans[i]=aac[-1]-aac[-k-1]+aac2[-k-1]
    for i in ans:
        print(i)
main()

Measured memory_bytes: 38692
#include <bits/stdc++.h>
using namespace std;
#include <unordered_map>
#define inputarr(a,n) for(ll i=0;i<n;i++) cin>>a[i];
#define prllarr(a,n) for(ll i=0;i<n;i++) cout<<a[i]<<" ";
#define pb push_back
#define ll long long
#define mod 1000000007
#define foi ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define in(n) scanf("%lld",&n);
#define in2(x,y) scanf("%lld %lld",&(x),&(y));
#define in3(x,y,z) scanf("%lld %lld %lld",&(x),&(y),&(z));
#define out(n) printf("%lld\n",n);
#define out2(x,y) printf("%lld %lld\n",x,y);
#define test(t)  ll t; in(t);while(t--)
#define set(arr,n,s) for(ll i=0;i<n;i++){arr[i]=s;}


/*error-----
convert every int to long long eg-1LL
create array with proper analysis of problem constrain
check mod also
*/
ll power(ll x,ll y,ll p){ll res=1;x=x%p;while(y>0){if(y&1){res=(res*x)%p;} y=y>>1;x=(x*x)%p;}return res;}
ll modInverse(ll a,ll p){return power(a,p-2,p);}//used with feemat little

ll gcd(ll x,ll y){if(x==0 || y==0){return max(y,x);}return gcd(y%x,x);}
ll gcdExtended(ll a,ll b,ll &x,ll &y){if(a==0){x=0;y=1;return b;}ll x1,y1;ll gcd = gcdExtended(b%a,a,x1,y1);x=y1-(b/a)*x1;y=x1;return gcd;}//o(log(b))
;
double arr[3004];
double dp[3005][3005];
int main()
{
	ll n;
	in(n)
	for(ll i=0;i<n;i++){
		double p;
		cin>>p;
		arr[i]=p;
	}
	for(ll i=0;i<n;i++){
		for(ll j=0;j<=n;j++){
			dp[i][j]=0;
		}
	}
	dp[0][1]=arr[0];
	dp[0][0]=1-arr[0];
	for(ll i=1;i<n;i++){
		dp[i][0]=dp[i-1][0]*(1-arr[i]);
		for(ll j=1;j<=n;j++){
			dp[i][j]+=dp[i-1][j-1]*arr[i];
			dp[i][j]+=dp[i-1][j]*(1-arr[i]);
		}
	}
	double ans=0;
	for(ll i=1;i<=n;i++){
		if(n-i<i){
			ans+=dp[n-1][i];
		}
	}
	cout << setprecision(10) << ans << '\n';
}






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

const int N = 1005, MOD = 1e9+7;
int n, m, dp[N][N];
char c;

int32_t main() {
  scanf("%d%d", &n, &m);

  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % MOD;
      dp[1][1] = 1;

      scanf(" %c", &c);
      if (c == '#') dp[i][j] = 0;
    }
  }

  printf("%d\n", dp[n][m]);
  return 0;
}


Measured memory_bytes: 4224
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define int         int64_t
#define ii          pair<int,int>
#define dd          pair<double,double>
#define vi          vector<int>
#define pb          push_back
#define all(x)      (x).begin(), (x).end()
#define checkBit(v, p)      (v&(1LL << p))
#define loop(i,a,b) for(int i = a;i < int(b);i++)
#define x           first
#define y           second
using namespace std;
int inf = 2e9, mod = 1e9 + 7;

struct Pnt{int v; double t;};

void merge(Pnt &a, Pnt b){
    a.t = (a.t * a.v + b.t * b.v) / (a.v + b.v);
    a.v += b.v;
}

int32_t main()
{
    ios_base::sync_with_stdio(false); cout << fixed <<setprecision(10);
    int n, L; cin >> n >> L;
    vector<Pnt> q(n);
    int volume = 0; double temp = 0;
    for(int i=0,l=n,r=n-1,t,v;i<n;i++){
        cin >> t >> v;
        while(volume + v > L){
            int dec = min(q[r].v, volume + v - L);
            volume -= dec;
            temp -= dec * q[r].t;
            q[r].v -= dec;
            if(q[r].v == 0) r--;
        }
        volume += v;
        temp += v * t;
        cout << temp / (double)L << '\n';
        q[--l].v = v, q[l].t = t;
        for(; l < r && q[l].t < q[l+1].t; l++) merge(q[l+1], q[l]);
    }
    cout << endl;
    return 0;
}


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

int main(){
    int N; cin >> N;
    vector<ll> A(N);
    for (int i = 0; i < N; i++)
    {
        cin >> A.at(i);
    }
    
    ll minA = A.at(0); ll maxres = -10000000000; 
    for (int i = 1; i < N; i++)
    {
        maxres = max(maxres, A.at(i) - minA);
        minA = min(minA, A.at(i));
    }

    cout << maxres << endl;    
}


Measured memory_bytes: 4428
while True:
    m, minn, maxn = map(int, input().split())
    if m == minn == maxn == 0:
        break
    P = [int(input()) for i in range(m)]
    ansd = 0
    ansi = 0
    for i in range(minn-1, maxn):
        if P[i] - P[i+1] >= ansd:
            ansd = P[i] - P[i+1]
            ansi = i+1
    print(ansi)


Measured memory_bytes: 5620
#include <iostream>
#include <vector>
using namespace std;
const int MAX = 100000;

int main(){
    int n;
    cin >> n;
    vector<int> l(n), r(n);
    for(int i = 0; i < n; i++) cin >> l[i] >> r[i];

    vector<int> ans(MAX+5, 0);
    for(int i = 0; i < n; i++){
        ans[l[i]]++;
        ans[r[i]+1]--;
    }

    for(int i = 1; i < MAX+3; i++){
        ans[i] += ans[i-1];
    }
    int ans2 = 0;
    for(int i = 1; i <= MAX; i++) ans2 += ans[i];
    cout << ans2 << endl;
    return 0;
}

Measured memory_bytes: 3724
#include <iostream>

using namespace std;

int main() {
    int a, b, d, r;
    double f;
    cin >> a >> b;
    d = a / b;
    r = a % b;
    f =  (double) a / b;
    printf("%d %d %.5f\n", d, r, f);
    return 0;
}


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

int main() {
	int n;
	int a, b;
	a = 0;
	b = 0;
	char c[200001];
	int s[200001];
	int sum[200001];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> c[i];
		if (c[i] == '#') {
			s[i] = 1;
			a++;
		}
		else {
			s[i] = 0;
			b++;
		}
	}
	int ans;
	ans = a;
	if (ans > b) ans = b;

	sum[0] = s[0];
	for (int i = 1; i < n; i++) {
		sum[i] = sum[i - 1] + s[i];
	}

	for (int i = 0; i < n; i++) {
		int pre;
		pre = 2 * sum[i] + n - i - 1 - a;
		if (pre < ans) ans = pre;
	}
	
	cout<<ans<<endl;
	return 0;
}

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

int main() {
    cin.tie(0)->sync_with_stdio(false);

    int m, d;
    cin >> m >> d;

    int cnt = 0;
    for (int i = 1; i <= m; i++) {
        for (int j = 1; j <= d; j++) {
            int div = j / 10;
            int rem = j % 10;
            if (div >= 2 && rem >= 2 && div * rem == i)
                cnt++;
        }
    }

    cout << cnt << '\n';
    return 0;
}

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

int main()
{
    int N;
    scanf("%d", &N);
    vector<int> A(N + 1);
    map<int, int> count;
    int ans;
    for (int i = 1; i <= N; i++) {
        scanf("%d", &A[i]);
        count[A[i]]++;
    }
    ans = count.size();
    if (ans % 2 == 0) ans--;
    printf("%d\n", ans);
    return 0;
}

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

int main() {
  string N;
  cin >> N;
  
  if (N[0] == N[1]) {
    if (N[0] == N[2]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  } else if (N[1] == N[2]) {
    if (N[1] == N[3]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  } else {
      cout << "No" << endl;
  }
}


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

int main(){
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector <int> v(n+1, 0);
  int a = 0;
  for (int i = 0; i < n-1; i++){
    if (s.at(i) == 'A' && s.at(i+1) == 'C'){
      a++;
      v.at(i+1) = a;
    }
    else{
      v.at(i+1) = a;
    }
  }
  int b, c;
  for (int i = 0; i < q; i++){
    cin >> b >> c;
    cout << v.at(c-1) - v.at(b-1) <<endl;
  }
}

Measured memory_bytes: 1408
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, math.MaxInt64)
}

func readString() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	s := readString()
	m := make(map[string]int)
	for i := 0; i < len(s); i++ {
		m[string(s[i])]++
	}
	if len(m) == len(s) {
		fmt.Println("yes")
	}else{
		fmt.Println("no")
	}
}


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

int main()
{
  string s;
  cin >> s;
  if(s[0] == s[1] && s[2] == s[3] && s[0] != s[2] || s[0] == s[3] && s[1] == s[2] && s[0] != s[2] || s[0] == s[2] && s[1] == s[3] && s[0] != s[1]) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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


def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n
def lcm(x, y):
    return (x * y) // gcd(x, y)

def sol(a, b):
    return (a * b) // gcd(a, b)


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








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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define MOD 1000000007

typedef long long ll;

using namespace std;
int main()
{
    int n;
    cin >> n;
    int a[n];
    REP(i, n)
    {
        cin >> a[i];
    }

    int b[n];
    int index;
    if(n % 2 == 0)
    {
        REP(i, n)
        {
            if (i % 2 == 0)
            {
                index = n / 2 + i / 2;
                b[index] = a[i];
            }
            else
            {
                index = n / 2 - 1 - i / 2;
                b[index] = a[i];
            }
        }
    }
    else
    {
        REP(i, n)
        {
            if (i % 2 == 0)
            {
                index = n / 2 - i / 2;
                b[index] = a[i];
            }
            else
            {
                index = n / 2 + 1 + i / 2;
                b[index] = a[i];
            }
        }
    }

    REP(i, n)
    {
        cout << b[i] << " ";
    }
    cout << endl;

}


Measured memory_bytes: 3712
#include<iostream>
#include<algorithm>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    int times = n / 15;
    // cout << times << endl;
    cout << 800*n - (200 * (n / 15)) << endl;
    
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
n, d = map(int, input().split())
z = []
cnt = 0
for i in range(n):
    x, y = map(int, input().split())
    z.append([x, y])
for i in range(n):
    if z[i][0]**2+z[i][1]**2 <= d**2:
        cnt += 1
print(cnt)

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

Measured memory_bytes: 3596
#include <iostream>
 
using namespace std;
 
int main( void )
{
  int A, B;
  
  cin >> A >> B;
  
  if ( B*2 > A ) {
    cout << "0" << endl;
  } else {
    cout << (A-B*2) << endl;
  }
  
  return 0;
}

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


int main(){
int n, t, a, ans;
cin >> n >> t >> a;

double k, mn, h;
mn = 999;
ans = 1;
for (int i = 0; i < n; i++)
{
    cin >> h;
    k = abs(a - (t-0.006*h));
    if(k < mn){
        mn = k;
        ans = i + 1;
    }
}



cout << ans << endl;
}

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

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> a(h);
  for (int i = 0; i < h; i++) {
    cin >> a[i];
  }

  for (int i = 0; i < w + 2; i++) {
    cout << "#";
  }
  cout << endl;
  for (int i = 0; i < h; i++) {
    cout << "#" << a[i] << "#" << endl;
  }
  for (int i = 0; i < w + 2; i++) {
    cout << "#";
  }
  cout << endl;

  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#define ll long long
#define R register
using namespace std;
inline int read(){
	int x=0,f=1;char c=getchar();
	while (c<'0'||c>'9') {if (c=='-') f=-1;c=getchar();}
	while (c>='0'&&c<='9') {x=(x<<1)+(x<<3)+(c^48);c=getchar();}
	return x*f;
}
const int inf=1e9+7,$=2e5+5;
struct node{
	ll x,y;
}ball[$];
ll x[$],y[$],maxn[$],minl[$];
ll n,ans,ans1,ans2,bmax,bmin,rmax,rmin;
inline bool cmp(node a,node b){return a.x<b.x;}
void init(){
	n=read();
	bmax=rmax=-1,bmin=rmin=inf;
}

signed main(){
	init();
	for (R int i(1);i<=n;++i){
		x[i]=read(),y[i]=read();
		if (x[i]>y[i]) swap(x[i],y[i]);
		ball[i].x=x[i],ball[i].y=y[i];
		bmax=max(bmax,y[i]),bmin=min(bmin,y[i]);
		rmax=max(rmax,x[i]),rmin=min(rmin,x[i]);
	}
	ans1=(bmax-bmin)*(rmax-rmin);
	bmin=rmin;
	sort(ball+1,ball+n+1,cmp);
	ans2=inf,maxn[1]=minl[1]=ball[1].y;
	for (R int i(2);i<=n;++i){
		maxn[i]=max(maxn[i-1],ball[i].y);
		minl[i]=min(minl[i-1],ball[i].y);
		if (i!=n) ans2=min(ans2,max(maxn[i],ball[n].x)-min(minl[i],ball[i+1].x));
	}
	ans2*=(bmax-bmin);
	ans=min(ans1,ans2);
	printf("%lld\n",ans);
	return 0; 
}


Measured memory_bytes: 9600
def make_divisors(n: int):
    lower_divs = []
    upper_divs = []
    i = 1
    while i**2 <= n:
        if n % i == 0:
            lower_divs.append(i)
            if i != n // i:
                upper_divs.append(n//i)
        i += 1
    return lower_divs+upper_divs[::-1]


def main():
    A, B, K = [int(i) for i in input().strip().split()]
    div_A = set(make_divisors(A))
    div_B = set(make_divisors(B))
    common = div_A.intersection(div_B)

    return sorted(list(common))[-K]


if __name__ == "__main__":
    print(main())


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

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

int MOD=1e9+7;
ll INF=1e18;

int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};

int main(){
    int n; cin>>n;
    vector<ll> a(3*n), headsum(3*n, 0), tailsum(3*n, 0);
    for(int i=0; i<3*n; i++) cin>>a[i];

    priority_queue<int, vector<int>, greater<int>> head;
    priority_queue<int> tail;

    headsum[0]=a[0];
    for(int i=0; i<n; i++){
        head.push(a[i]);
        if(i>0) headsum[i]=headsum[i-1]+a[i];
    }
    tailsum[3*n-1]=a[3*n-1];
    for(int i=3*n-1; i>=2*n; i--){
        tail.push(a[i]);
        if(i<3*n-1) tailsum[i]=tailsum[i+1]+a[i];
    }

    for(int i=n; i<=2*n; i++){
        head.push(a[i]);
        int hmin=head.top(); head.pop();
        headsum[i]=headsum[i-1]+a[i]-hmin;
    }
    for(int i=2*n-1; i>=n; i--){
        tail.push(a[i]);
        int tmax=tail.top(); tail.pop();
        tailsum[i]=tailsum[i+1]+a[i]-tmax;
    }

    ll ans=-INF;
    for(int i=n-1; i<=2*n-1; i++){
        ans=max(ans, headsum[i]-tailsum[i+1]);
    }
    cout << ans << endl;
}

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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T1, class T2> inline void minup(T1& m, T2 x){ if(m>x) m=static_cast<T2>(x); }
template<class T1, class T2> inline void maxup(T1& m, T2 x){ if(m<x) m=static_cast<T2>(x); }

#define INF 1000000000
#define MOD 1000000009
#define EPS 1E-9

int n;
string x;
//char x[8];
int mn, mx;

int main()
{
  cin >> n;

  while(n--){
    cin >> x;
    //    sort(x, x+8);                   sscanf(x, "%d", &mn);
    //    sort(x, x+8, greater<char>());  sscanf(x, "%d", &mx);
    sort(ALL(x));                   mn = atoi(x.c_str());
    sort(ALL(x), greater<char>());  mx = atoi(x.c_str());
    cout << mx - mn << endl;
  }

  return 0;
}

Measured memory_bytes: 1228