akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		String temp = scanner.nextLine();
		String[] tempList = new String[3];
		int result = 0;
		for(int i = 0; i < 3 ; i++) {
			tempList[i] = String.valueOf(temp.charAt(i));
			if(tempList[i].equals("7")) {
				result = 1;
				break;
			}
		}



		if(result == 1) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	}

}


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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl




typedef long long ll;
const ll mod = 1e9+7;
const int maxn = 1e6 + 5;











ll div3(ll n, ll m) {
    if (n>m) swap(n, m);


    ll a = n*(m/3);
    ll b = n*((m+2)/3);
    ll res =b-a;
    return res;
}


ll iterate(ll n, ll m) {
    ll res = 1e18;
    for (ll i=1; i<m; i++) {
	vector<ll> v;
	v.push_back(n*i);
	ll rest = m-i;
	v.push_back((n/2)*rest);
	v.push_back(((n+1)/2)*rest);
	sort(v.begin(), v.end());
	res = min(res, v.back()-v.front());
    }
    return res;
}

ll N, M;


int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);

    ll n, m;
    cin>>n>>m;

    N = n;
    M = m;

    if (n%3==0 || m%3==0) out(0);

    if (n>m) swap(n,m);

    vector<ll> v;
    v.push_back(n*(m/2));

    m = (m+1)/2;
    if (n>m) swap(n, m);
    v.push_back(n*(m/2));
    v.push_back(n*((m+1)/2));


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

    ll ans = v.back()-v.front();


    ans = min(ans, div3(N, M));
    ans = min(ans, iterate(N, M));
    ans = min(ans, iterate(M, N));
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ul;
typedef signed long long ll;
ul over = 1000000007;

mt19937 mt(time(nullptr));
// uniform_int_distribution< int > rand_int(0, 10) // rand[0, 10] inclusive

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  int n;
  cin >> n;
  vector< ul > a(n);
  for (int i=0; i<n; ++i) cin >> a[i];
  sort(a.begin(), a.end());
  ul ans_a = 0, ans_b = 0;
  ul prev = a[n/2];
  for (int i=1; i<n; ++i) {
    //cout << prev << " ";
    if (i%2==0) {
      ans_a += a[n - i/2] - prev;
      prev = a[n - i/2];
    } else {
      ans_a += prev - a[i/2];
      prev = a[i/2];
    }
  }
  //cout << prev << endl;
  if (n%2!=0) {
    prev = a[n/2];
    for (int i=1; i<n; ++i) {
      //cout << prev << " " ;
      if (i%2==0) {
        ans_b += prev - a[i/2-1];
        prev = a[i/2-1];
      } else {
        ans_b += a[n/2+i/2+1]-prev;
        prev = a[n/2+i/2+1];
      }
    }
    //cout << prev << endl;
  }
  cout << max(ans_a, ans_b) << endl;
  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
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; }



int main(int argc, char const *argv[]) {
  int a,b,c;
  cin >> a >> b >> c;
  if((a==b && a!=c) || (a==c && a!=b) || (c==b && a!=c)){
    cout << "Yes" << endl;
  }
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
H, N = map(int, input().split())

magic = [tuple(map(int, input().split())) for _ in range(N)]

DP = [0] * (H+10**4)

for h in range(1, H+1):
  DP[h] = min(DP[h - damage] + mp for damage, mp in magic)
print(DP[H])

Measured memory_bytes: 3596
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
using namespace std;

int main() {
	int A, B; cin >> A >> B;
	int ans = A * B;
	if (ans % 2 != 0) {
		cout << "Odd" << endl;
		return 0;
	}
	else {
		cout << "Even" << endl;
		return 0;
	}
}

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

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

    ll ans = 1, mod = (pow(10, 9) + 7);
    for (int i = 2; i <= n; i++) {
        ans = (ans * i) % mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<algorithm>
using namespace std;
const int N=1e6+7;
int a[N];
int main()
{
	int s,i,j;
		scanf("%d",&s);
	a[0]=s;
	i=1;
	while(1)
	{
		if(a[i-1]%2==0)
			a[i]=a[i-1]/2;
		else
			a[i]=3*a[i-1]+1;
		for(j=0;j<i;j++)
			if(a[i]==a[j])
			{
				printf("%d",i+1);
				return 0;
			}
		i+=1;
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
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; }

int main(void){
  int a; cin >> a;
  cout << a + a*a + a*a*a << endl;
  return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
const int MOD = 1e9+7;
template<typename T> 
struct BIT{
  int n;
  vector<T> bit;
  //1-indexed
  BIT():n(-1){}
  BIT(int n_,T d):n(n_),bit(n_+1,d){}
  
  T sum(int i){
    T s=bit[0];
    for(int x=i;x>0;x-=(x&-x))
      (s+=bit[x])%=MOD;
    return s;
  }
  void add(int i,T a){
    if(i==0) return;
    for(int x=i;x<=n;x+=(x&-x))
      (bit[x]+=a)%=MOD;
  }
  T sum0(int i){
    return sum(i+1);
  }
  void add0(int i,T a){
    add(i+1,a);
  }
};

//INSERT ABOVE HERE
signed main(){
  Int n,m;
  cin>>n>>m;
  vector<Int> x(n),y(m);
  for(Int i=0;i<n;i++) cin>>x[i];
  for(Int i=0;i<m;i++) cin>>y[i];

  using P = pair<Int, Int>;
  vector<P> vp;
  for(Int i=0;i<n;i++){
    if(x[i]<y[0]||y[m-1]<x[i]) continue;
    Int k=lower_bound(y.begin(),y.end(),x[i])-y.begin();
    vp.emplace_back(x[i]-y[k-1],x[i]-y[k]);
  }
  sort(vp.begin(),vp.end());
  vp.erase(unique(vp.begin(),vp.end()),vp.end());

  vector<Int> b;
  b.emplace_back(0);
  for(auto p:vp)
    b.emplace_back(-p.second);
  
  sort(b.begin(),b.end());
  b.erase(unique(b.begin(),b.end()),b.end());

  map<Int, Int> mb;
  for(Int i=0;i<(Int)b.size();i++) mb[b[i]]=i;

  m=b.size();
  BIT<int> bit(m+1,0);
  bit.add0(0,1);
  
  for(auto p:vp){
    Int y=mb[-p.second];
    bit.add0(y,bit.sum0(y-1));
  }
  
  cout<<bit.sum0(m)<<endl;
  return 0;
}


Measured memory_bytes: 9968
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
#include<cstdlib>
#define inf 0x3f3f3f3f
typedef long long ll;
using namespace std;
const int maxn=1e5+5;
int n,k;
ll a[maxn];
ll mp[maxn];

int main()
{
    int n;
    cin>>n;
    if(n==1) cout<<0<<endl;
    else cout<<1<<endl;
	system("pause");
    return 0;
}

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

long long gcd(long long a, long long b);
long long lcs(long long a, long long b);

int main(){
    while(1){
        long long a1,m1,a2,m2,a3,m3;
        scanf("%lld %lld %lld %lld %lld %lld",&a1,&m1,&a2,&m2,&a3,&m3);
        if(a1 == 0 && m1 == 0 && a2 == 0 && m2 == 0 && a3 == 0 && m3 == 0)break;
        long long x=1,y=1,z=1,cntx=0,cnty=0,cntz=0;
        do{
            x = (a1 * x) % m1;
            cntx++;
        }while(x != 1);
        do{
            y = (a2 * y) % m2;
            cnty++;
        }while(y != 1);
        do{
            z = (a3 * z) % m3;
            cntz++;
        }while(z != 1);
        printf("%lld\n",lcs(lcs(cntx,cnty),cntz));
    }
    return 0;
}

long long gcd(long long a, long long b){
    while(a % b != 0){
        long long temp = b;
        b = a % b;
        a = temp;
    }
    return b;
}

long long lcs(long long a, long long b){
    return a*b/gcd(a,b);
}

Measured memory_bytes: 1188
using System;

namespace abc168A
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int M = N % 10;
            if (M == 3)
                Console.WriteLine("bon");
            else if (M == 1 || M == 0 || M == 6 || M == 8)
                Console.WriteLine("pon");
            else
                Console.WriteLine("hon");
        }
    }
}


Measured memory_bytes: 27392
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;

vector<int> a;

int move(int i) {
  return a[i];
}

int main() {
  int n;
  ll k;
  cin >> n >> k;
  a.resize(n);
  
  for (int i = 0; i < n; ++i) {
    int d;
    cin >> d;
    d--;
    a[i] = d;
  }

  vector<int> goal(n+1);
  vector<bool> seen(n);
  goal[0] = 0;
  goal[1] = a[0];
  seen[0] = true;
  seen[a[0]] = true;
  ll cycle = 1;
  int current = a[0];
  int next;
  while(true) {
    cycle++;
    next = move(current);
    if (seen[next]) break;
    seen[next] = true;
    goal[cycle] = next;
    current = next;
  }

  int l;
  for(int i = 0; i < n; ++i) {
    if (goal[i] == next) {
      l = i; 
      break;
   }
  }

  if (k < cycle) {
    cout << goal[k]+1 << endl;
  } else {
    ll rem = (k-l)%(cycle-l);
    cout << goal[l+rem]+1 << endl;
  }
  return 0;
}

Measured memory_bytes: 4852
/* WORK HARD MAN ! IT DEFINETELY AIN'T EASY FOR THE PRIZE IT HOLDS .... */
/* GET YOUR ASS TO WORK ALREADY */
/* FALTU HI LIKH ... BUT KHALI NI BAITHNA */
#include<bits/stdc++.h>

#define fast ios_base::sync_with_stdio(false); cin.tie(nullptr); cin.tie(nullptr);
#define int long long
#define pb emplace_back
#define range(v) v.begin(),v.end()
#define mod 1000000007
#define inf 1e15
#define pii pair<int,int>
#define ff first
#define ss second
// #define N --

using namespace std;

/* if not able to handle the ques.. see up */
int32_t main() {
	fast
	int t_c = 1;
//	cin >> t_c;
	while (t_c--) {
		int n, k;
		cin >> n >> k;
		vector<int> v(n), w(n);
		vector<vector<int>> dp(n + 1, vector<int>(k + 1));
		for (int i = 0; i < n; i++)
			cin >> w[i] >> v[i];

		for (int ci = n; ci >= 0; ci--) {
			for (int cw = 0; cw <= k; cw++) {
				if (cw == 0 or ci == n)
					dp[ci][cw] = 0;
				else {
					if (w[ci] <= cw)
						dp[ci][cw] = dp[ci + 1][cw - w[ci]] + v[ci];
					dp[ci][cw] = max(dp[ci][cw], dp[ci + 1][cw]);
				}
			}
		}

		cout << dp[0][k] << endl;

	}
}

Measured memory_bytes: 80256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template<class T> bool chmin(T& a,T b){if(a>b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b){if(a<b) {a = b; return true;} return false;}
#define all(x) (x).begin(),(y).end()
#define debug(x)  cerr << #x << " = " << (x) << endl;

constexpr ll mod = 1e9+7;
struct mint {
    ll x;
    mint(ll x=0):x((x%mod+mod)%mod){}
    
    friend ostream &operator<<(ostream& os,const mint& a){
        return os << a.x;
    }

    friend istream &operator>>(istream& is,mint& a){
        ll t;
        is >> t;
        a = mint(t);
        return (is);
    }

    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
    bool operator==(const mint a)const{
        return x==a.x;
    }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    mint ans = ((mint) 10).pow(N);
    ans -= ((mint) 9).pow(N)*2;
    ans += ((mint) 8).pow(N);
    cout << ans << "\n";
}

Measured memory_bytes: 3652
s = gets.to_i
ans = 1

loop do
	if (s == 4 or s == 2 or s == 1)
		puts "#{ans += 3}"
		exit
	elsif (s % 2 == 0)
		s = s / 2
		ans += 1
	else
		s = s * 3 + 1
		ans += 1
	end
end

Measured memory_bytes: 1788
import itertools
import bisect
n=int(input())
lst=[]
for i in range(3, len(str(n))+1):
  x=list(itertools.product(["3", "5", "7"], repeat=i))
  z=[int("".join(x[j])) for j in range(len(x))]
  lst+=z
ans=[]
for j in range(len(lst)):
  if len(set(str(lst[j])))==3 and lst[j]<=n:
    ans.append(lst[j])
print(len(ans))

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

int main(){
  int x,y,z,n,a,b,c;
  cin >> a >> b;x=1;y=z=c=0;
  while(x<10){
    while(y<10){
      while(z<10){
        n=x*10001+y*1010+z*100;
        if(a <= n && n<=b){
          c++;
        }
        z++;
      }
      y++;
      z=0;
    }
    x++;
    y=z=0;
  }
  cout << c;
}

Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<cmath>
#include<limits>
#include <queue>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include <set>
#include <iomanip>
#include <map>
#include <stack>
#include <memory>
#include <numeric>
#include <type_traits>
 
using namespace std;
 
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
typedef long long ll;

 
int main() {
    int n; cin >> n;
    string s[n];
    map<string, int> m;
    rep(i,n){
        cin >> s[i];
        m[s[i]] = 1;
    }
    cout << m.size();
    
    



    return 0;
}

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

#define SPEED cin.tie(0);ios::sync_with_stdio(false);

//Dijkstra
template<class T> class Dijkstra {
	vector<long long> num_list;
	vector<long long> sum;
	int N;
	T inf;
	vector<vector<pair<T,int>>> edge;
	vector<T> cost;
public:
	Dijkstra(initializer_list<long long> size_list,T inf):num_list(size_list),inf(inf),N(1){
		for(long long& e:num_list) N *= e;
		sum.resize(num_list.size(),1);
		for(int i = 0; i < num_list.size(); ++i) {
			for(int j = i + 1; j < num_list.size(); ++j) {
				sum[i] *= num_list[j];
			}
		}
		edge.resize(N);
		cost.resize(N);
	}
	void make_edge(int from, int to, T w) {
		if(from < 0 || N <= from || to < 0 || N <= to) return;
		edge[from].push_back({ w,to });
	}
	void make_edge(initializer_list<long long> from_list, initializer_list<long long> to_list, T w) {
		int from = 0, to = 0;
		auto from_itr = from_list.begin(),to_itr = to_list.begin();
		for(int i = 0; i < num_list.size(); ++i) {
			if(*from_itr < 0 || num_list[i] <= *from_itr || *to_itr < 0 || num_list[i] <= *to_itr) return;
			from += (*from_itr)*sum[i];
			to   += (*to_itr)*sum[i];
			from_itr++;
			to_itr++;
		}
		edge[from].push_back({ w,to });
	}
	void solve(initializer_list<long long> start_list) {
		int start = 0;
		auto start_itr = start_list.begin();
		for(int i = 0; i < num_list.size(); ++i) {
			start += (*start_itr)*sum[i];
			start_itr++;
		}
		solve(start);
	}
	void solve(int start) {
		for(int i = 0; i < N; ++i) cost[i] = inf;
		priority_queue<pair<T, int>, vector<pair<T, int>>, greater<pair<T, int>>> pq;
		cost[start] = 0;
		pq.push({ 0,start });
		while (!pq.empty()) {
			auto [v,from] = pq.top();
			pq.pop();
			if(cost[from] < v) continue;
			for (auto [u,to] : edge[from]) {
				T w = v + u;
				if (w < cost[to]) {
					cost[to] = w;
					pq.push({ w,to });
				}
			}
		}
		return;
	}
	T get(int idx){
		return cost[idx];
	}
	T get(initializer_list<long long> idx_list){
		int idx = 0;
		auto idx_itr = idx_list.begin();
		for(int i = 0; i < num_list.size(); ++i) {
			idx += (*idx_itr)*sum[i];
			idx_itr++;
		}
		return get(idx);
	}
};

int main() {
	SPEED
	ll N,M,S,K; cin >> N >> M >> S;
	K = 50*N;
	Dijkstra<ll> dijk({N,K+1},1LL<<50);

	vector<ll> U(M),V(M),A(M),B(M);
	for(int i = 0; i < M; ++i) {
		cin >> U[i] >> V[i] >> A[i] >> B[i];
		U[i]--;
		V[i]--;
		for(int j = 0; j <= K; ++j) {
			dijk.make_edge({U[i],j},{V[i],j-A[i]},B[i]);
			dijk.make_edge({V[i],j},{U[i],j-A[i]},B[i]);
		}
	}
	vector<ll> C(N),D(N);
	for(int i = 0; i < N; ++i) {
		cin >> C[i] >> D[i];
		for(int j = 0; j <= K; ++j) {
			dijk.make_edge({i,j},{i,min(K,j+C[i])},D[i]);
		}
	}
	dijk.solve({0,min(S,K)});
	for(int i = 1; i < N; ++i) {
		ll mini = 1LL<<50;
		for(int j = 0; j <= K; ++j) {
			mini=min(mini,dijk.get({i,j}));
		}
		cout << mini << endl;
	}
    return 0;
}


Measured memory_bytes: 23632
import sys

input = sys.stdin.readline

vacation = int(input())
lst_happiness = [list(map(int, input().split())) for i in range(vacation)]

dp = [[0 for i in range(3)] for j in range(vacation+1)]
def chmax(a, b):
    if a > b:
        return a
    else:
        return b

for i in range(vacation):
    for j in range(3):
        for k in range(3):
            if j == k:
                continue
            dp[i+1][k] = chmax(dp[i+1][k], dp[i][j] + lst_happiness[i][k])
ans = 0
for i in range(3):
    ans = chmax(ans, dp[vacation][i])
print(ans)

Measured memory_bytes: 71552
#include <iostream>
#include <iomanip>
#include <vector>
#include <array>
#include <algorithm>
#include <stdio.h>
#include <string>
#include <sstream>
#include <math.h>
using namespace std;
 
int main()
{
  //入力
  int N, M;   //県の数N、市の数M
  vector<array<int, 4>> SHI;	//0:県番号、1:誕生順、2誕生年、3:市番号(出力順)
  cin>>N>>M;
  for(int i=0; i<M; i++){
    array<int, 4> push;
    cin>>push[0]>>push[2];
    push[1] = 0;
    push[3] = i;
    SHI.push_back(push);
  }
  
  //県ごとにデータを振り分け
  vector<vector<array<int, 4>>> pSHI;
  pSHI.resize(N);
  for(int i=0; i<M; i++)
  {
    pSHI[SHI[i][0]-1].push_back(SHI[i]);
  }

  //各県について誕生年でソートを行って誕生順を振る
  for(int i=0; i<N; i++)
  {
    //順番をソート
    sort(pSHI[i].begin(), pSHI[i].end(), [](const array<int, 4> a, const array<int, 4> b){return a[2]<b[2];});

    //それぞれの誕生順を振る
    for(int j=0; j<pSHI[i].size(); j++)
    {
      SHI[pSHI[i][j][3]][1] = j+1;
    }
  }
  
  //出力
  for(int i=0; i<M; i++)
  {
    //cout<<"県="<<SHI[i][0]<<" "<<"誕生順="<<SHI[i][1]<<endl;
    cout<<setw(6)<<setfill('0')<<SHI[i][0];
    cout<<setw(6)<<setfill('0')<<SHI[i][1]<<endl;
  }
  
  return 0;
}

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

const int N_MAX = 3000010;

vector<int> primes;
void sieve(){
    vector<bool> is_prime(N_MAX, true);
    
    int cnt = 1;
    while(true){
        for(int i=-1; i<=2; i+=2){
            int x = cnt*7 + i;
            if(is_prime[x]){
                for(int j=2*x; j<N_MAX; j+=x)
                    is_prime[j] = false;
                primes.push_back(x);
            }
        }
        
        if(cnt*7 > N_MAX)
            break;
        cnt++;
    }
}


int N;

void solve(){
    cout << N << ":";
    
    for(auto v: primes) if(N%v == 0)
        cout << " " << v;
    
    cout << endl;
}

int main(){
    sieve();
    while(cin >> N, N != 1)
        solve();
    
    return 0;
}

Measured memory_bytes: 5160
#include <bits/stdc++.h>
using namespace std;
//GET AC
int main(void){
    // Your code here!
    int n,q;string s;cin>>n>>q>>s;
    int dp[n];//n文字目まで何回ACが現れたか
    dp[0]=0;
    for(int i=1;i<n;i++){
        if(s[i-1]=='A'&&s[i]=='C')dp[i]=dp[i-1]+1;
        else dp[i]=dp[i-1];
    }
    for(int i=0;i<q;i++){
        int l,r;cin>>l>>r;l--;r--;
        int res=dp[r]-dp[l];
        cout<<res<<endl;
    }
}


Measured memory_bytes: 1408
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element? {
        return self.maxElement()
    }
    func min() -> Element? {
        return self.minElement()
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
//    func enumerated() -> [(Int, Element)] {
//        return self.enumerate()
//    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}
//func gcd(x: Int, _ y: Int) -> Int {
//    if y == 0 {
//        return x
//    } else {
//        return gcd(y, x%y)
//    }
//}
//func lcm(x: Int, _ y: Int) -> Int {
//    return x * y / gcd(x, y)
//}

/*************** テストスペース ***************/



/*************** メインプログラム ***************/

let S = readLine()!.toArray()
let k = 15 - S.count
var oCnt = 0
for c in S {
    if String(c) == "o" {
        oCnt += 1
    }
}
print(oCnt+k >= 8 ? "YES" : "NO")


Measured memory_bytes: 7268
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    xd = [100, 101, 102, 103, 104, 105]
    mxn = int(1e5) + 1
    d = [0] * (mxn)
    d[0] = 1
    for e in xd:
        for i in range(mxn):
            if d[i] and i + e < mxn: d[i + e] = 1
    t = int(input())
    print(d[t])



t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""

a aa c ca c a b a ab a b c

"""


Measured memory_bytes: 9852
import java.util.*;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt(), b = sc.nextInt();
		
		for (int i = 1; i <= 2000; i++) {
			if ((int)(i * 0.08) == a && (int)(i * 0.1) == b) {
				System.out.println(i);
				return;
			}
		}
		
		System.out.println(-1);
		
	}

}

Measured memory_bytes: 23764
#include<iostream>
using namespace std;
int main() {
	int n, m;
	int s = 0;
	cin >> n >> m;
	int x[100][100];
	int y[100];
	int z[100];
	for (int yoko = 0; yoko < n; yoko++) {
		for (int tate = 0; tate < m; tate++) {
			cin >> x[yoko][tate];
		}
	}
	for (int kakeru = 0; kakeru < m; kakeru++) {
		cin >> y[kakeru];
	}
	for (int keisanA = 0; keisanA < n; keisanA++) {
		for (int keisanB = 0; keisanB < m; keisanB++) {
			s += x[keisanA][keisanB] * y[keisanB];
		}
		z[keisanA] = s;
		s = 0;
	}
	for (int naiseki = 0; naiseki < n; naiseki++) {
		cout << z[naiseki] << endl;
	}
	return 0;
}

Measured memory_bytes: 1200
def operation(a,ops):
    ans = a[0]
    for i in range(3):
        if ops[i]=='+':
            ans += a[i+1]
        else:
            ans -= a[i+1]
    return ans

s = list(input())
a = [int(i) for i in s]
op = ['+','-']

for i in range(1<<3):
    ops = [op[1&(i>>j)] for j in range(3)]
    if operation(a,ops)==7:
        print("{}{}{}{}{}{}{}=7".format(a[0],ops[0],a[1],ops[1],a[2],ops[2],a[3]))
        break

Measured memory_bytes: 9028
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class D
{
	public static void Main()
	{
		int N = GetInt();
		long A = GetLong();
		long B = GetLong();
		long[] X = new long[N];
		for(int i = 0; i < N; i++)
			X[i] = GetLong();

		long ans = 0;
		for(int i = 0; i < N - 1; i++)
			ans += Math.Min(A * (X[i+1] - X[i]), B);
		Console.WriteLine(ans);
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}





Measured memory_bytes: 22752
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
#define rep(i, n)    for(ll i = 0; i < (n); ++i)
#define repA(i, a, n)  for(ll i = a; i <= (n); ++i)
#define repD(i, a, n)  for(ll i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (ll)(x).size()
#define unique_sort(x) (sort(x.begin(), x.end()), x.resize(distance(x.begin(), unique(x.begin(), x.end()))))
#define fill(a)  memset(a, 0, sizeof (a))
#define ff first
#define ss second
#define pb push_back
typedef long double ld;
typedef vector<ll> vll;
typedef vector<pair<ll,ll>> vpl;
const ll INF = 1e18;
const ld PI = 4*atan((ld)1);
const ll mod = 1e9+7;

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ll tt=1;
        // cin >> tt;
    while((tt)--){
        ll n,k; cin >> n >> k;
        vll a(n);
        rep(i,n){
            cin >> a[i];
        }
        sort(all(a));
        ll ans =0;
        rep(i,k){
            ans +=a[i];
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3608
/* ***********************************************
Author        :yang12138
Created Time  :2018年01月07日 星期日 22时28分35秒
File Name     :B.cpp
************************************************ */
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdlib>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define mem(a,b) memset(a,b,sizeof(a))
typedef long long ll;
typedef pair<int,int>pii;
#define lson (root<<1)
#define rson (root<<1|1)

const int N=1e3+10;
int a[N];

void solve(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",a+i);
	sort(a+1,a+n+1);
	printf("%d\n",(int)(unique(a+1,a+n+1)-a-1));
}

int main(){
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    
	solve();
    return 0;
}


Measured memory_bytes: 256
//
//  main.cpp
//  ALDS1_5_A
//
//  Created by ptyuan on 2018/10/26.
//  Copyright © 2018 YY. All rights reserved.
//

#include <iostream>
#include <cstdio>
using namespace std;

int n = 0;
int q = 0;
int A[50];
int m = 0;


bool solve(int *A, int i, int m) {
    if (0 == m) return true;
    if (i > n) return false;
    bool res = solve(A, i + 1, m) || solve(A, i + 1, m - A[i]);
    return res;
}


int main(int argc, const char * argv[]) {
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d", A + i);
    }
    scanf("%d", &q);
    
    for (int i = 0; i < q; i++) {
        scanf("%d", &m);
        bool r = solve(A, 0, m);
        if (r) {
            printf("yes\n");
        } else {
            printf("no\n");
        }
    }
    return 0;
}



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

typedef long long ll;

int N;
ll K;
set<int> S;
vector<int> A, V;

void input_init(void) {
	cin >> N >> K;
	A.resize(N + 1);
	for (int i = 1; i <= N; ++i)
		cin >> A[i];
}

void calcu(void) {
	int cur = 1;
	V.push_back(1);
	S.insert(1);
	while (true) {
		int nxt = A[cur];
		V.push_back(nxt);
		if (S.find(nxt) != S.end())
			break;
		S.insert(nxt);
		cur = nxt;
	}
}

int solve(void) {
	int sz = V.size();
	if (K <= (ll)sz)
		return V[(int)K];
	int lst = V[sz - 1];
	vector<int>::iterator itr;
	itr = find(V.begin(), V.end(), lst);
	int fst_id = distance(V.begin(), itr);
	ll loop_len = (ll)(sz - 1 - fst_id);
	int t = (int)((K - fst_id) % (ll)loop_len);
	return V[fst_id + t];
}

int main(void) {
	input_init();
	calcu();
	int ans = solve();
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 13852
import itertools
N,A,B,C = map(int,input().split())
l = [int(input()) for i in range(N)]
inf = float('inf')
ans = inf
for pair in itertools.product(range(4),repeat=N):
    mA = 0 ; mB = 0; mC = 0; cnt = 0
    for i in range(N):
        if pair[i] == 1:
            mA += l[i]
            cnt += 1
        elif pair[i] == 2:
            mB += l[i]
            cnt += 1
        elif pair[i] == 3:
            mC += l[i]
            cnt += 1
    if mA*mB*mC == 0:continue
    cost = abs(mA-A) + abs(mB-B) + abs(mC-C) + (cnt-3)*10
    if cost < ans:
        ans = cost
print(ans)

Measured memory_bytes: 3188
import java.util.Scanner;

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 total = 0;
		
		for(int i = 1; i <= N; i++) {
			String is = String.valueOf(i);
			int sum = 0;
			int k = 0;
			for(int j = 1; j <= is.length(); j++) {
				k = (int)(i / (int)Math.pow(10, j - 1)) % 10;
				sum += k;
			}
			if(A <= sum && sum <= B) {
				total += i;
			}
		}
		System.out.println(total);
	}
}


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

typedef long long ll;

int n,m,s,e,t[110];
ll l[110];
ll dp[110][1<<16];

int main(){
  while(cin >> n,n){
    for(int i=0;i<n;i++){
      cin >> m >> l[i]; t[i] = 0;
      for(int j=0;j<m;j++){
	cin >> s >> e;
	for(int k=s-6;k<e-6;k++)t[i] |= 1<<k;
      }
    }

    for(int i=0;i<=n;i++)
      for(int j=0;j<(1<<16);j++)dp[i][j] = -1;
    dp[0][0] = 0;

    for(int i=0;i<n;i++)
      for(int j=0;j<(1<<16);j++){
	if(dp[i][j]<0)continue;
	dp[i+1][j] = max(dp[i+1][j],dp[i][j]);
	if(t[i]&j)continue;
	dp[i+1][j|t[i]] = max(dp[i+1][j|t[i]],dp[i][j] + l[i]);
      }

    ll ans = 0;
    for(int i=0;i<(1<<16);i++)ans = max(ans,dp[n][i]);
    cout << ans << endl;
  }
}

Measured memory_bytes: 54408
#include<iostream>

#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) for(int i=0;i<a;i++)


using namespace std;
bool prime[10000001];


int main(){
	rep(i, 10000001){
		prime[i] = true;
	}
	prime[0] = prime[1] = false;

	loop(i, 2, 10001){
		if (prime[i]){
			for (int j = i * 2; j < 10000001; j += i){
				prime[j] = false;
			}
		}
	}



	int ord;
	while (1){
		cin >> ord;
		if (ord == 0){
			break;
		}
		while (ord){
			if (prime[ord] && prime[ord - 2] && prime[ord - 6] && prime[ord - 8]){
				cout << ord << endl;
				break;
			}
			else{
				ord--;
			}
		}
	}




}

Measured memory_bytes: 10924
function Main(input) {
    input = input.split("\n");
    for (var i = 0; i < 3000; i++) {
        var str = input[i].split(" ");
        var x = parseInt(str[0]);
        var y = parseInt(str[1]);
         if (x == 0 && y == 0) {
            break;
        }

        if (x < y) {
            console.log(x + " " + y)
        }else{
            console.log(y + " " + x)
        }
           }

    
}
// "実行する"ボタンを押した時に実行される関数 (デバッグ用)
function debug() {
    var input = document.getElementById("input").value;
    Main(input);
}

//* この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

using namespace std;

int main() {
    int n; cin >> n;
    string s; cin >> s;
    if (n % 2 == 1) {
        cout << "No";
        return 0;
    }
    int able = 1;
    for (int i = 0; i < n / 2; i++) {
        if (s[i] != s[n / 2 + i]) {
            able = 0;
            break;
        }
    }
    if (able == 1) cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#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) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please


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


	int A[3];
	rep(i, 3) cin >> A[i];
	sort(A, A + 3);
	if (A[0] == A[1] && A[0] != A[2]) co("Yes");
	else if (A[1] == A[2] && A[0] != A[2]) co("Yes");
	else co("No");

	Would you please return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;

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

        for(int i=A; i<=B; i++){
            if(i%K==0){
                System.out.println("OK");
                return;
            }
        }
        System.out.println("NG");
    }
}

Measured memory_bytes: 35828
package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)
	m := make(map[string]bool)
	var s string
	for i := 0; i < N; i++ {
		fmt.Scan(&s)
		m[s] = true
	}
	fmt.Println(len(m))
}

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

int main(){
    int k,n;
    int a[1000000] = {0};
    cin >> k >> n;
    rep(i,n){
        cin >> a[i];
    }
    int p =k+a[0]-a[n-1];
    rep(i,n-1){
        p =  max(p,a[i+1]-a[i]);
    }
    cout << k-p << endl;
}


Measured memory_bytes: 4728
N = int(input())
a = [int(i) for i in input().split()]

multip4 = 0
unbreakable = 0

for i in a:
    if i % 4 == 0:
        multip4 += 1

    elif i % 2 != 0:
        unbreakable += 1

if N % 2 != 0:
    multip4 += 1

if multip4 >= unbreakable:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 14252
n,m = map(int,input().split())
inl = [[i] + list(map(int,input().split())) for i in range(m)]
inl = sorted(inl,key=lambda x:x[2])
inl = sorted(inl,key=lambda x:x[1])
cnt = 1
for i in range(m):
    a = str(inl[i][1]).rjust(6,"0")
    b = str(cnt).rjust(6,"0")
    cnt +=1
    if i !=m-1 and inl[i][1] != inl[i+1][1]:
        cnt = 1
    inl[i][1] = a
    inl[i][2] = b
inl = sorted(inl,key=lambda x:x[0])
for i in range(m):
    print(str(inl[i][1])+str(inl[i][2]))

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

using namespace std;
#define ll long long int
#define mp make_pair
#define pb push_back
#define fi first
#define si second
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define F(a,n) for(int i=0;i<n;i++){cin>>a[i];}
#define F1(a,n) for(int i=1;i<=n;i++){cin>>a[i];}
#define P(a,n) for(int i=0;i<n;i++){cout<<a[i]<<' ';}cout<<endl;
#define P1(a,n) for(int i=1;i<=n;i++){cout<<a[i]<<' ';}cout<<endl;
#define NF(a,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cin>>a[i][j];}}
#define NF1(a,n,m) for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cin>>a[i][j];}}
#define PNF(a,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
#define PNF1(a,n,m) for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
const int nax = 3e3+3;
const int mod = 1e9+7;

int main(){
	fastIO
	ll n;
	ll dp[nax][nax];
	cin>>n;
	ll *a = new ll[n];
	for(ll i=0; i<n; i++){
		cin>>a[i];
	}
	for(ll i=n-1; i>=0; i--){
		for(ll j=i; j<n; j++){
			dp[i][j] = (i == j) ? (a[i]) : (max(a[i] - dp[i+1][j], a[j] - dp[i][j-1]));
		}
	}
	cout<<dp[0][n-1];

}

Measured memory_bytes: 70656
class UnionFind
  def initialize(size)
    @rank = Array.new(size, 0)
    @parent = Array.new(size, &:itself)
    @count = Array.new(size, 1)
  end

  def find_parent(x)
    @parent[x] == x ? x : @parent[x] = find_parent(@parent[x])
  end

  def unite(x, y)
    x_parent = find_parent(x)
    y_parent = find_parent(y)
    return if x_parent == y_parent

    if @rank[x_parent] > @rank[y_parent]
      @parent[y_parent] = x_parent
      @count[x_parent] += @count[y_parent]
    else
      @parent[x_parent] = y_parent
      @count[y_parent] += @count[x_parent]
      @rank[y_parent] += 1 if @rank[x_parent] == @rank[y_parent]
    end
  end

  def same?(x, y)
    find_parent(x) == find_parent(y)
  end

  def count(x)
    @count[find_parent(x)]
  end

  def inspect
    "rank:#{@rank.inspect}\nparent:#{@parent.inspect}\ncount:#{@count.inspect}\n"
  end
end

def decayed_bridges(n, edges)
  uf = UnionFind.new(n)
  comb = [n * (n - 1) / 2]

  edges.reverse_each do |x, y|
    prev = comb[-1]
    if uf.same?(x, y)
      comb << prev
    else
      comb << prev - uf.count(x) * uf.count(y)
    end

    uf.unite(x, y)
  end

  comb.pop
  comb.reverse_each {|c| puts c }
end

n, m = gets.split.map(&:to_i)
edges = []
m.times do
  x, y = gets.split.map(&:to_i)
  edges << [x - 1, y - 1]
end

decayed_bridges(n, edges)

Measured memory_bytes: 13876
#include"bits/stdc++.h"
#define rep(i,n) for(int i=0;i<n;i++)
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Forr(i,a,b) for(int i=a;i>=b;i--)
typedef long long ll;
double Pi = 3.141592653589793238;
using namespace std;
using Graph = vector<vector<ll>>;
using Field = vector<string>;
using DGraph = vector<vector<pair<int, int>>>;

const long long INF = 1LL << 60;
//---//

int main() {
	ll A,ans;
	long double B; cin >> A >> B;

	ans = A*B;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3712
def myAnswer(R:int,G:int,B:int,N:int) -> int:
   ans = 0
   for i in range(0,N+1,R):
      for j in range(0,N+1,G):
         k = N - j - i
         if( k % B != 0 or k < 0):
            continue
         else:
            # print(i,j,k)
            ans += 1

   return ans

def modelAnswer():
   return
def main():
   R,G,B,N = map(int,input().split())
   print(myAnswer(R,G,B,N))
if __name__ == '__main__':
   main()

Measured memory_bytes: 3064
import math
n = int(input())
place = [list(map(int, input().split())) for _ in range(n)]

pair = math.factorial(n) // math.factorial(n-2)
avg = 0
for x1, y1 in place:
  for x2, y2 in place:
    avg += math.sqrt((x1-x2)**2 + (y1-y2)**2)
avg = avg / pair

result = avg * (n - 1)
print(result)

Measured memory_bytes: 3064
N, M = map(int, input().split())
lst = []
ans_list = list([0, False] for i in range(N))
ans = [0, 0]

for i in range(M):
    tup = tuple(input().split())
    lst.append(tup)

for submit in lst:
    if ans_list[int(submit[0]) - 1][1] == True:
        continue
    else:
        if submit[1] == "AC":
            ans_list[int(submit[0]) - 1][1] = True
        if submit[1] == "WA":
            ans_list[int(submit[0]) - 1][0] += 1

for quest in ans_list:
    if quest[1] == True:
        ans[0] += quest[1]
        ans[1] += quest[0]

print(*ans)


Measured memory_bytes: 31560
#include<bits/stdc++.h>
using namespace std;
char s[100];
int main(){
	scanf("%s",s);
	int n=strlen(s);
	for(int i=0;i<n/2;i++)if(s[i]!=s[n-i-1])return puts("No"),0;
	for(int i=0;i<n/4;i++){
		if(s[i]!=s[n/2-i-1]||s[(n+1)/2+i]!=s[n-i-1])return puts("No"),0;
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,a) for(int i=0;i<(a);i++)
#define MOD 1000000007

int main(){
  int N,L;
  cin>>N>>L;
  int a[N];
  for(int i=0;i<N;i++) cin>>a[i];
  int ind=-1;
  for(int i=0;i<N-1;i++){
    if(a[i]+a[i+1]>=L){
      ind=i+1;
      break;
    }
  }
  if(ind==-1){
    cout<<"Impossible"<<endl;
    return 0;
  }else cout<<"Possible"<<endl;
  for(int i=1;i<ind;i++) cout<<i<<endl;
  for(int i=N-1;i>ind;i--) cout<<i<<endl;
  cout<<ind<<endl;
  return 0;
}


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

function main()
	n,m = readline() |> split |> parseMap
	a = zeros(Int,n,n)
	b = zeros(Int,m,m)
	for i in 1:n
		s=readline() |> chomp
		for j in 1:n
			if s[j]=='#'
				a[i,j] = 1
			end
		end
	end
	for i in 1:m
		s=readline() |> chomp
		for j in 1:m
			if s[j]=='#'
				b[i,j]=1
			end
		end
	end
	f = 0
	for i in 0:n-m
		for j in 0:n-m
			ff = 0
			for x in 1:m
				for y in 1:m
					if a[i+x,j+y]!=b[x,y]
						ff = 1
						break
					end
				end
			end
			if ff==0
				f = 1
				break
			end
		end
	end
	println(f==1?"Yes":"No")
end

main()

Measured memory_bytes: 112760
class MiddleSquare  # 8digit

  def initialize(seed)
    @seed = seed
    @n=4
  end

  def random
    t= (@seed**2).to_s
    r=("00000000"+t.slice(0..-3)).slice(-4..-1).to_i
    @seed = r
    return r
  end

end

def main
  if true then
    fh=STDIN
  else
    fh=open("in1_0137.txt")
  end
  n=fh.gets.chomp.to_i
  0.upto(n-1){|i|
    s=fh.gets.chomp.to_i
    ans=[]
    r=MiddleSquare.new(s)
    10.times{|j|
      ans.push(r.random)
    }
    puts "Case #{i+1}:"
    puts ans
  }
end

if $0==__FILE__ then
  main
end

Measured memory_bytes: 8612
#include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <unordered_map>
#include <vector>
#include <string>

using ll = long long;

using namespace std;

void solve() {
    string str;
    cin >> str;
    if (str == "ABC") {
        cout << "ARC\n";
    } else {
        cout << "ABC\n";
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif
    solve();
}


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

int main() {
    int w,h;
    int i,j,k;
    for(;;){
    cin>>h>>w;
    if(h==0&&w==0)break;
    for(k=0;k<w;k++){
    cout<<"#";}
    cout<<endl;
    for(i=0;i<h-2;i++){
    cout<<"#";
    for(j=0;j<w-2;j++){
    cout<<".";}
    cout<<"#"<<endl;}
    for(k=0;k<w;k++){
    cout<<"#";}
    cout<<endl<<endl;
    }
}


    



Measured memory_bytes: 3076
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
class TaskC
{
public:
	ll h, n, w;
	ll N;
	void solve(istream &is, ostream &os)
	{
		is >> N;
		if (N % 2 == 0)
			os << N << " " << N<<" " << N / 2 << endl;
		else
		{
			for (h = 1; h <= 3500; h++)
			{
				for (n = 1; n <= 3500; n++)
				{
					ll up = N * h*n;
					ll down = 4 * h*n - N * n - N * h;
					if ((up > 0) && (down > 0) && (up%down == 0))
					{
						os << h << " " << n << " " << (up/down) << endl;
						goto label;
					}
				}
			}
			label:N = 1;
		}
	}
};
int main()
{
	cin.tie(NULL);
	cout.tie(NULL);
	ios_base::sync_with_stdio(false);
	TaskC taskC;
	taskC.solve(cin, cout);
	return 0;
}

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

#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define sint int32_t
#define int long long int
#define all(v) v.begin() , v.end()
#define vii vector<int>
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int32_t main()
{
    int d , t , s;
    cin>>d>>t>>s;

    if(d <= t*s) cout<<"Yes\n";
    else cout<<"No\n";
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
    using namespace std;
    typedef long long lint;
    typedef pair<int,int> pint;
    typedef vector<int> vint;
    #define rep(i, n) for(int i = 0; i < n; i++)
    #define rep2(i, m, n) for(int i = m; i < n; i++)
    #define rep3(elem, vec) for(auto elem: vec)
    #define SORT(V) sort((V).begin(),(V).end())
    #define RSORT(V) sort((V).rbegin(), (V).rend())
    #define COUT(N) cout<<fixed<<setprecision(N)
    lint gcd(int a,int b){return b?gcd(b,a%b):a;}
    lint lcm(int a,int b){return a*b/gcd(a,b);}
    lint comb(int a,int b){return b?comb(a-1,b-1)*a/b:1;}
    int dx[4] ={1,0,-1,0},dy[4] = {0,1,0,-1};
    int MOD = 1e9+7;

int main(){
    int N;
    cin >> N;
    vint A(N,0);
    int a;
    rep(i,N-1){
        cin >> a;
        A[a-1]++;
    }    
    rep(i,N){
        cout << A[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 4048
// Once we accept our limits , we go beyond them .
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long double pi = acos(-1);
void start(){
std::ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
}
int main(){
    start();
    ll n , c , k = 1;
    cin >> n ;
    bool b = false ;
    for(ll i = 0 ; i < n ; i++){
        cin >> c;
        if(c == k){
            k++;
            b = true;
        }
    }
    if(b){
        cout << n - k + 1<< endl ;
    }
    else cout << "-1" << endl;
    return 0 ;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, i;
    cin >> n;
    int h[n];
    for(i=0; i<n; i++){
        cin >> h[i];
    }
    for(i=n-1; i>0; i--){
        if(h[i] < h[i-1])
            h[i-1]--;
        if(h[i] < h[i-1]){
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";
    return 0;
}


Measured memory_bytes: 640
#include <stdio.h>

int main()
{
    int H, W;
    int h, w;
    while(1) {
        scanf("%d %d", &H, &W);
        if(H == 0 && W == 0) {
            break;
        }

        for(w = 0; w < W; w++) {
            putchar('#');
        }
        putchar('\n');

        for(h = 1; h < (H-1); h++) {
            putchar('#');
            for(w = 1; w < (W-1); w++) {
                putchar('.');
            }
            putchar('#');
            putchar('\n');
        }

        for(w = 0; w < W; w++) {
            putchar('#');
        }
        putchar('\n');

        putchar('\n');
    }
    return 0;
}


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

int D[1002][1002];

int MD = 1e9 + 7;
int main() {
	int H, W;

	cin >> H >> W;

	char M[1002][1002];
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++)
			cin >> M[i][j];
	}

	D[0][1] = 1;
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++)
			D[i][j] = (M[i][j] != '#') ? (D[i - 1][j] + D[i][j - 1]) % MD : 0;

	}

	cout << D[H][W] << endl;



}

Measured memory_bytes: 5120