akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

int stringcount(string s, char c) {
    return count(s.cbegin(), s.cend(), c);
}

int main() {
    
    string s;
    cin>>s;
    if(stringcount(s,'A')==3||stringcount(s,'B')==3){
        fin("No");
    } else fin("Yes");
}


Measured memory_bytes: 256
using namespace std;

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <limits>
#include <climits>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <numeric>
typedef long long ll;
typedef pair<int,int> p;

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




int main()
{
  // input & declare
  int n,tmp;
  cin >> n;
  vector<vector<int>> vv(n,std::vector<int>());
  for (int i = 0; i < n; i++)
  {
    cin >> tmp;
    vv[i].push_back(tmp);
    cin >> tmp;
    vv[i].push_back(tmp);
    cin >> tmp;
    vv[i].push_back(tmp);
  }

  // process
  int nTime = vv[0][0];
  int nx = vv[0][1];
  int ny = vv[0][2];

  for (int i = 0; i < n; i++)
  {
    // std::cout << nTime << '\n';
    // std::cout << nx << '\n';
    // std::cout << ny << '\n';

    if (nTime < nx + ny || (nTime - (nx + ny)) % 2 == 1) {
      std::cout << "No" << '\n';
      exit(0);
    }
    if (i != n-1) {
      nTime = abs(vv[i+1][0] - vv[i][0]);
      nx = abs(vv[i+1][1] - vv[i][1]);
      ny = abs(vv[i+1][2] - vv[i][2]);
    }
  }
  std::cout << "Yes" << '\n';

}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
#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++)
int main() {
  string S;
  cin >> S;
  int N = S.size();
  cout << S.at(0) << N - 2 << S.at(N - 1) << endl;
}

Measured memory_bytes: 3568
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }

template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  ll i = 0;
  for (auto x : v) {os << " [" << i++ << "]" << x; if (i % 10 == 0) os << std::endl;}
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::vector< std::pair<T, S> > vp)
{
  ll i = 0;
  for (auto p : vp) {os << " [" << i++ << "]" << p.first << " " << p.second; if (i % 10 == 0) os << std::endl;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

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

  std::string s, t;
  std::cin >> s >> t;
  std::string ans;
  for (ll i = 0; i < (ll)s.size()-1; i++) {
    ans += s[i];
    ans += t[i];
  }
  ans += s[s.size()-1];
  if (s.size() == t.size()) ans += t[t.size()-1];
  print(ans);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int s = 0;
int a_n[1000001] = { 0 };

int f(int n);
int a(int i);

int main()
{
	bool found = false;
	int num = 0;

	cin >> s;

	for (int i = 1; i <= 1000000; i++) {
		a_n[i] = a(i);

		for (int j = 1; j < i; j++) {
			if (a_n[i] == a_n[j]) {
				num = i;
				found = true;
				break;
			}
		}

		if (found) break;
	}

	cout << num << endl;

	return 0;
}

int f(int n)
{
	int ret;

	if (n % 2) ret = 3 * n + 1;
	else ret = n / 2;

	return ret;
}

int a(int i)
{
	int ret = 0;

	if (i == 1) ret = s;
	else ret = f(a(i - 1));

	return ret;
}

Measured memory_bytes: 256
/*input
10
2311312312
*/
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
using ll = long long;
using ld = long double;
using pii = pair<int,int>;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
const ll INF64=4e18;
const int INF=0x3f3f3f3f;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld eps=1e-6;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
ll sub(ll a,ll b){
    ll x=a-b;
    while(x<0) x+=MOD;
    while(x>MOD) x-=MOD;
    return x;
}
ll mult(ll a,ll b){
    return (a*b)%MOD;
}
ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=(res*a)%MOD;
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
const ll maxn=1e6+5;
const ll maxlg=__lg(maxn)+2; 
int n;
int fac[maxn];
int c[maxn];
int main(){
    cin>>n;
    string s;
    cin>>s;
    REP(i,n) s[i]--;
    REP1(i,n-1) fac[i]=fac[i-1]+__builtin_ctz(i);
    REP(i,n){
        c[i]=fac[n-1]-fac[i]-fac[n-i-1];
        if(c[i]==0) c[i]=1;
        else c[i]=0;
    }
    ll ans=0;
    REP(i,n){
        ans+=(s[i]-'0')*(c[i]);
    }
    if(ans%2==1){
        cout<<1;
        return 0;
    }
    REP(i,n){
        if(s[i]=='1'){
            cout<<0;
            return 0;
        }
        if(s[i]=='2') s[i]='1';
    }
    ans=0;
    REP(i,n){
        ans+=(s[i]-'0')*c[i];
    }
    if(ans%2==1){
        cout<<2;
        return 0;
    }    
    cout<<0;
}

Measured memory_bytes: 9220
#include <iostream>

const int size = 10;

int num[size];

bool dfs(int beforeB, int beforeC, int depth) {
	if(depth == 10)
		return true;
	
	if(num[depth] > beforeB)
		return dfs(num[depth], beforeC, depth + 1);
	else if(num[depth] > beforeC)
		return dfs(beforeB, num[depth], depth + 1);
	else
		return false;
}

int main() {
	int n = 0;
	std::cin >> n;
	
	for(int i = 0; i < n; ++i) {
		for(auto&& x : num)
			std::cin >> x;
		
		std::cout << (dfs(0, 0, 0) ? "YES" : "NO") << std::endl;
	}
}

Measured memory_bytes: 1148
#include<bits/stdc++.h>
#include<stdio.h>
#include<string.h>
using namespace std;
#define ll  long long
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define rep(i,t,n) for(int i=t;i<n;i++)
#define nd "\n"
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>




/*ll power(ll x,ll t){
if(t<=0){
    return 1;
}
ll y=(power(x,t/2));
y=(y*y)%ma;
if(t%2)
    y=(y*x)%ma;
return y;

}*/
/*ll ph[100001];
void E_phi(int n){

ph[0]=0;
ph[1]=1;
for(int i=2;i<=n;i++){
    ph[i]=i;
}
for(int i=2;i<=n;i++){
    if(ph[i]==i){
        for(int j=i;j<=n;j+=){
            ph[j]-=ph[j]/i;
        }
    }
}


}*/
/*string s,t;
vector<int>  z_fun(string s){

int n = (int) s.length();
    vector<int> z(n);
    for (int i = 1, l = 0, r = 0; i < n; ++i) {
        if (i <= r)
            z[i] = min (r - i + 1, z[i - l]);
        while (i + z[i] < n && s[z[i]] == s[i + z[i]])
            ++z[i];
        if (i + z[i] - 1 > r)
            l = i, r = i + z[i] - 1;
    }
    return z;
}*/

/*struct st{
ll sum,pre,suf,ans;
st(){}
st(ll k){
ans=k,pre=k,suf=k,sum=0;
}

};
ll t[4*200001+4];
ll a[200001];
ll lazy[4*200001+4];
ll mx=1e14;



void push(int ind){
int l=2*ind+1,r=2*ind+2;
t[l]+=lazy[ind];
t[r]+=lazy[ind];
lazy[l]+=lazy[ind];
lazy[r]+=lazy[ind];
lazy[ind]=0;

}

void build(int ind,int l,int r){
if(l==r){
    t[ind]=a[l];
return;
}
int mid=(l+r)/2;
build(2*ind+1,l,mid);
build(2*ind+2,mid+1,r);

  t[ind] =min(t[ind*2+1] , t[ind*2+2]);



}
ll query(int ind,int l,int r,int p,int q){

if(l>q || r<p )
    return mx;
    int mid=(l+r)/2;

if(l>=p && r<=q )
    {
      return t[ind];
    }
    push(ind);
ll x=query(2*ind+1,l,mid,p,q);
ll y=query(2*ind+2,mid+1,r,p,q);


return min(x,y);
}

void update(int ind,int l,int r,int p,int q,int val){
if(l>q || r<p )
    return;

if(l>=p && r<=q )
    {
      t[ind]+=val;
      lazy[ind]+=val;
      return;
    }
push(ind);
int mid=(l+r)/2;
    update(2*ind+1,l,mid,p,q,val);
     update(2*ind+2,mid+1,r,p,q,val);
    t[ind]=min(t[2*ind+1],t[2*ind+2]);



}


ll mod(ll a){
if(a>=0)
    return a;
else return -a;
}
*/
ll mod(ll a){
if(a>=0)
    return a;
else return -a;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
   ll x,k,d;
   cin>>x>>k>>d;
   x=mod(x);
   ll t=x/d;
   if(t>=k){
    cout<<x-d*k<<endl;
    return 0;
   }
   k-=t;
   if(k%2){
    cout<<d-(x%d)<<endl;
   }
   else cout<<x%d<<endl;

   }





Measured memory_bytes: 3648
import java.util.Scanner;

public class Main {
    
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		boolean flag = true;
		while(s.hasNext()){
			String a = s.next();
			String[] b = a.split(",");
			int num = Integer.parseInt(b[0]); 
			double h = Double.parseDouble(b[2]); 
			double w = Double.parseDouble(b[1]); 
			if(w/h/h >= 25){
				System.out.println(num);
				flag = false;
			}
		}
		if (flag)
			System.out.println("ツ該ツ督鳴づ按つオ");
    }
}

Measured memory_bytes: 11000
N = int(input().strip())
p = list(map(int, input().strip().split()))

P = p.copy()
P.sort()
final = []

if P == p:
    final.append("YES")
else:
    for i in range(N):
        for o in range(i):
            pCopy = p.copy()
            I = pCopy[i]
            O = pCopy[o]
            pCopy[i] = O
            pCopy[o] = I
            if pCopy == P:
                final.append("YES")
            pCopy = p
if "YES" in final:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 3064
n, m = map(int, input().split())
sc = [list(map(int, input().split())) for _ in range(m)]
ans = float('inf')
k = 0
if n == 2: k = 10
elif n == 3: k = 100
for i in reversed(range(k, 1000)):
    #print(f'i: {i}')
    flg = True
    for s, c in sc:
        #print(f'{s}桁目が{c}?', end=' ')
        if list(str(i))[s-1] == str(c): continue
        #print('No!')
        flg = False
    
    if flg:
        ans = min(ans, i)
        #print('ans: ', ans)
if ans == float('inf'): ans = -1
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  int d, n;
  cin >> d >> n;
  ll a = pow(100, d);
  ll b = a * 100;
  ll now = 0;
  FOR(i, 1, 10000) {
    ll ans = a * i;
    if (ans % b == 0) {
      continue;
    }
    now++;
    if (now == n) {
      cout << ans << endl;
      return 0;
    }
  }
}

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

int main() {
	// your code goes here
	int n;
	cin>>n;
	string arr[n];
	set<string>s;
	for(int i=0;i<n;i++){
		cin>>arr[i];
		s.insert(arr[i]);
	}
	cout<<s.size();
	return 0;
}

Measured memory_bytes: 25352
#include<iostream>
using namespace std;
int main()
{
int a,b;
cin >> a >> b;
if(a<b)
{
cout << "a < b" << endl;
}
else if(a>b)
{
cout << "a > b" << endl;
}
else
{
cout << "a == b" << endl;
}
return 0;
}

Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e9;
const ll INF = 1e18;
const ld EPS = 1e-10;

int main(){
    int Q;
    cin >> Q;
    multiset<ll> s;
    int y; ll a, b;
    cin >> y >> a >> b;
    s.insert(a);
    multiset<ll>::iterator ite = s.find(a);
    ll x = a, sum = b;
    rep(i, Q-1){
        cin >> y;
        if(y == 2){
            cout << x << ' ' << sum << endl;
            continue;
        }
        cin >> a >> b;
        sum += b;
        if(s.size()%2 == 1){
            if(a < x){
                sum += x-a, s.insert(a);
                ite--, x = *ite;
            }
            else{
                sum += a-x, s.insert(a);
            }
        }
        else{
            ite++;
            ll r = *ite;
            if(a < x){
                sum += x-a, s.insert(a);
                ite--;
            }
            elif(a < r){
                s.insert(a), ite--;
                x = a;
            }
            else{
                sum += a-r, s.insert(a);
                x = r;
            }
        }
    }
}

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

int main(){
    string s;
    cin >> s;
    bool flag = false;
    for (int i = 0; i < s.size() - 1; i++){
        if (s[i] == 'A' && s[i + 1] == 'C') flag = true;
    }
    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main ()
{
    int n;
    scanf("%d",&n);
    int a[n+1];
    memset(a,0,sizeof(a));
    int m=0;
    for(int x=1;x<100;x++)
    {
        for(int y=1;y<100;y++)
        {
            for(int z=1;z<100;z++)
            {
                m=(x+y)*(x+y)+(x+z)*(x+z)+(y+z)*(y+z);
                if((m+1)/2>n)
                    break;
                else if(m&1)
                   continue;
                else
                    a[m/2]++;

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


Measured memory_bytes: 3684
inputs = list(map(int, input().split(' ')))[:2]
N = inputs[0]
M = inputs[1]

min_R = N
max_L = 0

for i in range(0,M):
    LR = list(map(int, input().split(' ')))[:2]
    max_L = max(max_L,LR[0])
    min_R = min(min_R,LR[1])

print(len(range(max_L,min_R+1)))


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define F first
#define S second
#define pll pair<ll,ll>
#define all(x) x.begin(), x.end()
#define ed cout << "\n"
#define vll vector<ll>
#define vpll vector<pll>
#define ar array
#define sz(x) (ll)x.size()                                        
#define NAME ""
bool isFile = 0;
 
typedef long long ll;
typedef long double ld;
 
const ll INF=1e9+1234;                                                   
const int N = 2e5 + 1234; 
const ll MOD=998244353;
const ll mod=1e9+7;                                            
double EPS = 3e-18;
const double PI = acos(-1);  
 
 
void faster()
{
	if(isFile)
	{
		freopen(NAME".in","r",stdin);
		freopen(NAME".out","w",stdout);
	}
	ios_base::sync_with_stdio(false);                                                
    cin.tie(NULL);                                         
    cout.tie(NULL);                                
}
		 

void solve() 
{
	int n;
	set<string>s;
	cin >> n;
	string x;
	for(int i = 0; i < n; i++)
	{
		cin >> x;
		s.insert(x);
	}
	cout << sz(s);	 			  														     	 	
}
            
                           
int main()                                     
{                            
	faster();                
	int t = 1;
	//cin >> t;	
	while(t--)
	{               	
		solve();
		ed;
	}
	return 0;
}


Measured memory_bytes: 19216
import numpy as np
K = int(input())
N = 50
A = np.array([np.zeros(N) for _ in range(N)]).astype(int)
for i in range(N):
    for j in range(N):
        A[i,j] = 1 if j==i+1 else 0
A[N-1,0] = 1
B = [0 for _ in range(N)]
B[0] = np.identity(N).astype(int)
for i in range(1,N):
    B[i] = np.dot(B[i-1],A).astype(int)
C = [0 for _ in range(N)]
C[0] = np.identity(N).astype(int)
for i in range(1,N):
    C[i] = (C[i-1]+B[i]).astype(int)
print(N)
X = np.arange(N)
X = X[::-1].astype(int)
if K==0:
    print(*X)
else:
    r = (K-1)%N
    q = (K-1)//N
    b = [-1 for _ in range(N)]
    b[0] = N
    b = np.array(b).astype(int)
    X = np.dot(X,B[(r+1)%N])
    X += np.dot(b,q*C[N-1]+C[r])
    print(*X)

Measured memory_bytes: 14332
fun main(args:Array<String>):Unit{
    val line1 = readLine()!!.trim().toInt()
    when(line1){
        1-> println("Hello World")
        2->{
            val a = readLine()!!.trim().toInt()
            val b = readLine()!!.trim().toInt()
            println(a+b)
        }
    }
}

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

ll gcd(ll a, ll b){return b!=0 ? gcd(b, a%b) : a;}
ll lcm(ll a, ll b){return a / gcd(a, b) * b;}

int main(){
	int n;
	cin >> n;
	vector<double> v(n);
	rep(i, n) cin >> v[i];
	
	sort(v.begin(), v.end());
	int ans = 0;
	for(int i = 0; i < n-1; ++i){
		v[i+1] = (v[i] + v[i+1]) / 2;
	}
	cout << v[n-1] << endl;
	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
struct Point{
  int x,y;
  Point& operator=(Point & p){
    x=p.x;y=p.y;
    return *this;
  }
};
struct Polygon{
  vector<int> ls;
  vector<int> ps;
  bool operator==(const Polygon & a)const{
    if(ls.size()!=a.ls.size()) return false;
    int i,j,k;
    int f=0;
    for(i=0;i<ls.size();i++){
      if(ls[i]!=a.ls[i])f=1;
    }
    for(i=0;i<ps.size();i++){
      if(ps[i]!=a.ps[i])f=1;
    }
    if(f==0) return true;
    f=0;
    for(i=0;i<ls.size();i++){
      if(ls[i]!=a.ls[ls.size()-(i+1)])f=1;
    }
    for(i=0;i<ps.size();i++){
      if(ps[i]==a.ps[ps.size()-(i+1)])f=1;
    }
    if(f==0) return true;
    return false;
  }
};
int main(){
  int n,m;
  int i,j,k;
  cin >> n;
  while(n!=0){
    Polygon base;
    Point buf,bef;
    Point b,c;
    
    
    cin >> m;
    cin >> bef.x >> bef.y;
    b.x=0;b.y=0;
    for(j=0;j<m-1;j++){
      cin >> buf.x >> buf.y;
      int l=(buf.x-bef.x)+(buf.y-bef.y);
      if(l<0) l*=-1;
      base.ls.push_back(l);
      if(buf.x>bef.x) {
	c.x=1;c.y=0;
      }else if(buf.x<bef.x){
	c.x=-1;c.y=0;
      }else if(buf.y>bef.y){
	c.x=0;c.y=1;
      }else if(buf.y<bef.y){
	c.x=0;c.y=-1;
      }
      
      if(b.x==1){
	if(c.y==1) base.ps.push_back(-1);
	else if(c.y==-1) base.ps.push_back(1);
      }else if(b.x==-1){
	if(c.y==1) base.ps.push_back(1);
	else if(c.y==-1) base.ps.push_back(-1);
      }else if(b.y==1){
	if(c.x==1) base.ps.push_back(1);
	else if(c.x==-1) base.ps.push_back(-1);
      }else if(b.y==-1){
	if(c.x==1) base.ps.push_back(-1);
	else if(c.x==-1) base.ps.push_back(1);
      }
      
      b=c;
      bef=buf;
    }
    //cout << endl;
    vector<Polygon> ps;
    for(i=0;i<n;i++){
      cin >> m;
      Polygon p;
      cin >> bef.x >> bef.y;
      b.x=0;b.y=0;
      for(j=0;j<m-1;j++){
	cin >> buf.x >> buf.y;
	int l=(buf.x-bef.x)+(buf.y-bef.y);
	if(l<0) l*=-1;
	p.ls.push_back(l);
	//cout << l << endl;
	
	if(buf.x>bef.x) {
	  c.x=1;c.y=0;
	}else if(buf.x<bef.x){
	  c.x=-1;c.y=0;
	}else if(buf.y>bef.y){
	  c.x=0;c.y=1;
	}else if(buf.y<bef.y){
	  c.x=0;c.y=-1;
	}

	int t=1;
	if(b.x==1){
	  if(c.y==1) t=-1;
	  else if(c.y==-1) t=1;
	}else if(b.x==-1){
	  if(c.y==1) t=1;
	  else if(c.y==-1) t=-1;
	}else if(b.y==1){
	  if(c.x==1) t=1;
	  else if(c.x==-1) t=-1;
	}else if(b.y==-1){
	  if(c.x==1) t=-1;
	  else if(c.x==-1) t=1;
	}

	if(j!=0) {
	  p.ps.push_back(t);
	  //cout << j << ":" << t << endl;
	}
	
	b=c;
	//cout << bef.x << bef.y << endl;
	bef=buf;
	//cout << bef.x << bef.y << endl;
      }
      ps.push_back(p);
      //cout << endl;
    }
    //cout << ps.size() << endl;
    for(i=0;i<n;i++){
      if(base==ps[i]) cout << (i+1) << endl;
    }
    cout << "+++++" << endl;
    //cout << n;
    cin >> n;
    //cout << n;
  }
  return 0;
}

Measured memory_bytes: 1228
def solve(s1, s2):
    if len(s1) != len(s2):
        return "DIFFERENT"
    for i in range(0, len(s1), 2):
        if s1[i] != s2[i]:
            return "DIFFERENT"
    diff_count = 0
    for i in range(1, len(s1), 2):
        if s1[i] != s2[i]:
            diff_count += 1
    if diff_count == 0:
        return "IDENTICAL"
    elif diff_count == 1:
        return "CLOSE"
    else:
        return "DIFFERENT"


if __name__ == "__main__":
    i = 1
    while True:
        s1 = input()
        if s1 == ".":
            break
        s2 = input()
        #
        s1_list = s1.split('"')
        s2_list = s2.split('"')
        print(solve(s1_list, s2_list))


Measured memory_bytes: 5580
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace ConsoleApplication9
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
 
            int count = 0;
            for (int i = 1; i <= N; i++)
            {
                if (i % 2 == 1 && DivisorsNum(i))
                {
                    count++;
                }
            }
 
            Console.WriteLine(count);
        }
 
        public static bool DivisorsNum(int N)
        {
            int count = 0;
            for (int i = 1; i <= N; i++)
            {
                if(N%i == 0)
                {
                    count++;
                }
                if(count > 8) return false;
            }
            
            if(count ==8) return true;
            else return false;
        }
    }
}

Measured memory_bytes: 27476
import java.util.*;
import java.lang.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int t = sc.nextInt();
        int a = sc.nextInt();
        double ave[] = new double[n];
        for (int i = 0; i < n; i++) {
            ave[i] = Math.abs(a - (t - 0.006 * sc.nextInt()));
        }
        double min = ave[0];
        int mini = 0;
        for (int i = 1; i < n; i++) {
            if (min > ave[i]) {
                mini = i;
                min = ave[i];
            }
        }
        System.out.println(mini + 1);
    }
}



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

const int MAXN = 50001;

bool prime[MAXN] = {true, true};

int main()
{
  for (int i = 2; i * i < MAXN; i++){
    for (int j = i * i; j < MAXN; j += i){
      prime[j] = true;
    }
  }
  
  int n;
  while (scanf("%d", &n), n){
    int cnt = 0;
    for (int i = 2; i <= n / 2; i++){
      if (!prime[i] && !prime[n - i]){
        cnt++;
      }
    }
    printf("%d\n", cnt);
  }

  return (0);
}

Measured memory_bytes: 1236
#include <stdio.h>

int main() {
  int num, month, day, pass = 0;
  int date[12][2] = {
    {1, 31}, {2, 29}, {3, 31}, {4, 30}, {5, 31}, {6, 30},
    {7, 31}, {8, 31}, {9, 30}, {10, 31}, {11, 30}, {12, 31}};
  char *weeks[7] = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};

  scanf("%d %d", &month, &day);

  while ( month != 0 && day != 0) {

    for (num = 0; num < month - 1; num++) {
      pass += date[num][1];
    }

    pass += day + 2;
    pass %= 7;

    for (num = 0; num < 7; num++) {
      if ( pass == num ) {
        printf("%s\n", weeks[num]);
      }
    }

  pass = 0;
  scanf("%d %d", &month, &day);
  }

  return 0;
}

Measured memory_bytes: 584
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>

using namespace std;

int main(void){
  string s;
  cin >> s;
  for(int w=s.size();w>=0;w--){
    for(int i=0;i+w<=s.size();i++){
      bool res=true;
      for(int j=0;j<w;j++){
        res = res && (s[i+j]=='A' || s[i+j]=='C' || s[i+j]=='G' || s[i+j]=='T');
      }
      if(res){
        cout << w << endl;
        return 0;
      }
    }
  }

  return 0;
}


Measured memory_bytes: 256
inp = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n')
X = inp.shift() * 1
x = ~~(X / 100)
y = X % 100
f = 0
for (i=0; i<=y; i++) {
for (j=0; j<=y; j++) {
for (k=0; k<=y; k++) {
for (l=0; l<=y; l++) {
    m = y-(i*5+j*4+k*3+l*2)
    n = x-(i+j+k+l+m)
    if (m >= 0 && n>=0) {
        f = 1
        break;
    }
}
if (f) break;
}
if (f) break;
}
if (f) break;
}
console.log(f)


Measured memory_bytes: 7372
#[allow(unused_macros)]
macro_rules! debug {
    ($($arg:tt)*) => (if cfg!(debug_assertions) {print!("[DEBUG] "); println!($($arg)*)});
}

fn main() {
    let mut rd = reader::Reader::new();

    let s: String = rd.next();
    let s:Vec<char> = s.chars().collect();
    let n = s.len();

    println!("{}", if (s[0] != s[n-1]) ^ (n % 2 == 0) {
        "First"
    } else {
        "Second"
    });
}

mod reader {
    use std::fmt::Debug;
    use std::str::FromStr;
    use std::collections::VecDeque;
    use std::io::{self, Read};

    fn _read_line() -> String {
        let mut buf = String::new();
        let _ = io::stdin().read_to_string(&mut buf);
        buf
    }

    fn _read_vec_deque_string() -> VecDeque<String> {
        _read_line()
            .split_whitespace()
            .map(|s| s.to_string())
            .collect()
    }

    #[allow(dead_code)]
    pub struct Reader {
        buf: VecDeque<String>,
    }

    #[allow(dead_code)]
    impl Reader {
        pub fn new() -> Reader {
            Reader { buf: VecDeque::new() }
        }

        fn update_buf(&mut self) {
            if self.buf.is_empty() {
                self.buf = _read_vec_deque_string();
            }
        }

        pub fn next<T>(&mut self) -> T
            where
                T: FromStr,
                T::Err: Debug,
        {
            self.update_buf();
            self.buf.pop_front().unwrap().parse::<T>().unwrap()
        }

        pub fn next_n<T>(&mut self, n: usize) -> Vec<T>
            where
                T: FromStr,
                T::Err: Debug,
        {
            let mut vec: Vec<T> = Vec::with_capacity(n);

            for _ in 0..n {
                vec.push(self.next());
            }
            vec
        }
    }
}


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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define REPV(iter, v) for(auto (iter)=(v).begin(); (iter)!=(v).end();++(iter))
#define ALL(v) (v).begin(),(v).end()

#define MOD 1000000007

using namespace std;

typedef long long ll;

int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n);
    REP(i, n) cin >> a[i];

    vector<ll> sumA(n, 0);
    // -, +, -, +, ...の順番
    ll countFirst = 0;
    sumA[0] = a[0];
    if (sumA[0] >= 0) 
    {
        countFirst += sumA[0] + 1;
        sumA[0] = -1;
    }
    for (int i = 1; i <= n - 1; ++i)
    {
        sumA[i] = sumA[i - 1] + a[i];
        if (i % 2 == 1)
        {
            if (sumA[i] <= 0)
            {
                countFirst += -sumA[i] + 1;
                sumA[i] = 1;
            }
        }
        else
        {
            if (sumA[i] >= 0)
            {
                countFirst += sumA[i] + 1;
                sumA[i] = -1;
            }
        }
    }

    // +, -, +, -, ...の順番
    ll countSecond = 0;
    sumA[0] = a[0];
    if (sumA[0] <= 0)
    {
        countSecond += -sumA[0] + 1;
        sumA[0] = 1;
    }
    for (int i = 1; i <= n - 1; ++i)
    {
        sumA[i] = sumA[i - 1] + a[i];
        if (i % 2 == 1)
        {
            if (sumA[i] >= 0)
            {
                countSecond += sumA[i] + 1;
                sumA[i] = -1;
            }
        }
        else
        {
            if (sumA[i] <= 0)
            {
                countSecond += -sumA[i] + 1;
                sumA[i] = 1;
            }
        }
    }
    ll ans = min(countFirst, countSecond);

    cout << ans << endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll MOD=1000000007;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
long long gcd(long long a,long long b){
    ll gcdmax=max(a,b);
    ll gcdmin=min(a,b);
    while(true){
        if(gcdmax%gcdmin==0)break;
        else gcdmax%=gcdmin;
        swap(gcdmin,gcdmax);
    }
    return gcdmin;
}
ll powerup(ll N,ll P,ll M){
    if(P==0)return 1;
    else if(P%2==0){
        ll t=powerup(N,P/2,M);
        return t*t%M;
    }
    else return N*powerup(N,P-1,M)%M;
}
vector<ll> find_divisor(ll N){
  ll k=1;
  while(k*k<=N){
    k++;
  }
  vector<ll> A(1);
  rep(i,k){
    if(i==1)A.at(0)=1;
    else if(i>=2){
      if(N%i==0)A.push_back(i);
    }
  }
  ll t=0;
  t=A.size();
  rep(i,t){
    if(A.at(t-i-1)*A.at(t-i-1)!=N)A.push_back(N/A.at(t-1-i));
  }
  return A;
}
int main()
{
  ll N,X,Y;
  cin>>N>>X>>Y;
  char C;
  ll A=0;
  ll B=0;
  rep(i,N){
    cin>>C;
    if(C=='a'){
      if(A<X+Y){
        A++;
        cout<<"Yes"<<endl;
      }
      else cout<<"No"<<endl;
    }
    else if(C=='b'){
      if(A<X+Y&&B<Y){
        A++;
        B++;
        cout<<"Yes"<<endl;
      }
      else cout<<"No"<<endl;
    }
    else cout<<"No"<<endl;
  }
}


Measured memory_bytes: 640
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>

using namespace std;

int main()
{
    int n;
    
    scanf("%d",&n);
    
    int arr[n];
    
    for(int i=0;i<n;i++)
        scanf("%d",&arr[i]);
    
    sort(arr,arr+n);
    reverse(arr,arr+n);
        
    int check=n-1,M=1e9+7,ans=1;
    bool poss=true;
    
    for(int i=0;i<n-1;i+=2)
    {
        if(arr[i]==arr[i+1] && arr[i]==check-i)
            ans=(ans*2)%M;
        else
        {
            poss=false;
            break;
        }
    }
    
    if(check&1^1)
    {
        if(arr[n-1]!=0)
            poss=false;
    }
    
    poss?printf("%d",ans):printf("0");
    
    return 0;
}

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

typedef long long int ll;

ll n,m;
ll mod = 1000000007;
char arr[1005][1005];

ll dp[1005][1005];

ll solve(ll i,ll j){
	
	if(i==n-1 and j==m-1)return 1;
	if(i==n || j==m || i==-1 || j==-1)return 0;
	
	if(dp[i][j]==-1){
		
		ll x = 0;
		ll y = 0;
		if(arr[i+1][j]=='.' )
		x = solve(i+1,j);
		if(arr[i][j+1]=='.')
		y = solve(i,j+1);
		dp[i][j] = ((x)%mod+(y)%mod)%mod; 
	}
	return dp[i][j];
	
}

int main(){
	
	cin>>n>>m;
	for(ll i=0;i<n;i++){
		for(ll j=0;j<m;j++)cin>>arr[i][j];
	}
	memset(dp,-1,sizeof(dp));
	cout<<solve(0,0);
	
}

Measured memory_bytes: 9216
#include <iostream>

using namespace std;

int main (){
	int n;
	cin >> n;
	int a[n],b[n];
	
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	for(int i=0;i<n;i++){
		cin >> b[i];
	}
	int diff[n];
	int sum =0;
	for(int i=0;i<n;i++){
		diff[i] = a[i] - b[i];
		if (diff [i] > 0) {
			sum += diff[i];
		}
	}
	cout << sum << endl;
}


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

int main()
{
  int n;
  cin >> n;
  Graph G(n + 1);
  int u, k, v;
  for (int i = 0; i < n; i++)
  {
    cin >> u >> k;
    for (int j = 0; j < k; j++)
    {
      cin >> v;
      G.at(u).push_back(v);
    }
  }
  vector<int> dist(n + 1, -1);
  queue<int> que;
  dist.at(1) = 0;
  que.push(1);
  int nv;
  while (!que.empty())
  {
    v = que.front();
    que.pop();
    for (int i = 0; i < G.at(v).size(); i++)
    {
      nv = G.at(v).at(i);
      if (dist.at(nv) != -1)
      {
        continue;
      }
      dist.at(nv) = dist.at(v) + 1;
      que.push(nv);
    }
  }
  for (int i = 1; i <= n; i++)
  {
    cout << i << " " << dist.at(i) << endl;
  }
}


Measured memory_bytes: 3152
#include<iostream>
#include<cstdio>
#define LL long long
using namespace std;
int n;
LL ans;
const int N=45;
char s[N][N];
LL f[N][N][N],g[N][N][N];
int main()
{
	cin>>n;n*=2;
	for(int i=1;i<=n;++i)scanf("%s",s[i]+1);
	for(int i=1;i<n;++i)
	{
		f[i][i][i]=1;
		for(int j=i+1;j<=n;++j)
			if(s[i][j]=='1')g[i][i][j]=1;
	}
	for(int len=3;len<n;len+=2)
		for(int j=1;j+len<=n;++j)
		{
			int k=j+len-1;
			for(int l=j;l<=k;l+=2)
				for(int r=k;r>l;r-=2)
				{
					LL s=0;
					for(int t=r;t<=k;++t)s+=g[j][l][t]*f[r][k][t];
					for(int t=l+1;t<r;++t)f[j][k][t]+=f[l+1][r-1][t]*s;
				}
			for(int t1=j+1;t1<k;++t1)
				for(int t2=k+1;t2<n;++t2)
					if(s[t1][t2]=='1')g[j][k][t2]+=f[j][k][t1];
		}
	for(int i=1;i<n;++i)
		if(s[i][n]=='1')ans+=f[1][n-1][i];
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <sstream>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <string>
#include <complex>

#include <cassert>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <cstring>

#define REP(i,e) for(int i=0;i<(int)(e);i++)
#define FOR(i,b,e) for(int i=(int)(b);i<(int)(e);i++)
#define ALL(c) (c).begin(), (c).end()
#define EACH(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define RALL(c) (c).rbegin(), (c).rend()
#define ALLA(a,n) ((a)+0), ((a)+n)

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef vector<string> vstring;
typedef vector<double> vdouble;

template<class T>void pp(T v,int n){ REP(i,n)cout<<v[i]<< ' ' ; cout << endl; }
template<class T>void pp(T v){ EACH(it,v) cout << *it << ' ' ; cout << endl;  }
template<class T>T& ls(T& a,T b){ if(b<a) a=b; return a; }
template<class T>T& gs(T& a,T b){ if(b>a) a=b; return a; }
inline ll to_i(const string& s){ll n;sscanf(s.c_str(),"%lld",&n);return n;}
inline string to_s(ll n){char buf[32];sprintf(buf,"%lld",n);return string(buf);}

struct __scanner__{ bool e; operator bool(){ return e; } } IN = { false };
inline __scanner__& operator>>(__scanner__& in,int &n)
{ in.e = scanf("%d",&n)==1; return in; }
inline __scanner__& operator>>(__scanner__& in,ll &n)
{ in.e = scanf("%lld",&n)==1; return in; }
inline __scanner__& operator>>(__scanner__& in,double &n)
{ in.e = scanf("%lf",&n)==1; return in; }
inline __scanner__& operator>>(__scanner__& in,char &n)
{ in.e = scanf(" %c",&n)==1; return in; }
inline __scanner__& operator>>(__scanner__& in,string &n) // BUFFER SIZE!
{ static char buf[1000000]; in.e = scanf(" %s",buf)==1; n = buf; return in; } 

ll compute(vector<vll>& v) {
  ll result = 0;
  REP(i,v.size()) REP(j,i) {
    bool ok = true;
    REP(k,v.size()) if (k != i && k != j && v[i][k] + v[k][j] == v[i][j]) ok = false;
    if (ok) result += v[i][j];
  }
  return result;
}

int main(){
  int n;
  while (cin >> n) {
    vector<vll> v(n, vll(n));
    REP(i,n) REP(j,n) cin >> v[i][j];
    vector<vll> u = v;
    REP(k,n) REP(i,n) REP(j,n) ls(u[i][j], u[i][k] + u[k][j]);
    if (u != v) {
      cout << -1 << endl;
    } else {
      cout << compute(u) << endl;
    }
  }
}


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

int f(int x){
  int ans = 0;
  while(x > 0){
    ans += x % 10;
    x /= 10;
  }
  return ans;
}

int main(){
  int x;
  cin >> x;
  if ( x % f(x) == 0 ){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

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

Vs=[0]*N
for i in range(N):
    Vs[i] = L+i

sumv = sum(Vs)

minv = 999999
v = 0
for i in range(N):
    t = sumv-Vs[i]
    d = abs(sumv-t)
    if d<minv:
        minv = d
        v = t
print(v)

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

int main() {
  int N, K;
  cin >> N >> K;
  int A = 1;
  
  for(int i = 0; i < N; i++){
      if(A < K){
          A *= 2;
      }
      else{
          A += K;
      }
  }
  cout << A << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define REP(i, b, n) for (Int i = b; i < Int(n); i++)
#define rep(i, n) REP(i, 0, n)
using namespace std;
using Int = long long;
Int inf = 1000000000000000001LL;
using vi = vector<Int>;
using vvi = vector<vi>;
using mapis = unordered_map<Int,string>;
using mapii = unordered_map<Int,Int>;
using pii = pair<Int,Int>;

Int GCD(Int a, Int b){
    if(b==0) return a;
    if(a < b) return GCD(b, a);
    unsigned r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

Int modinv(Int a, Int m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

Int binary_search_index(Int Y, vi &q){
    int left = 0, right = q.size() - 1;
    while (right >= left) {
        int mid = left + (right - left) / 2;
        if (q[mid] == Y) return mid;
        else if (q[mid] > Y) right = mid - 1;
        else if (q[mid] < Y) left = mid + 1;
    }
    return -1;
}

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

int main() {
    Int N;
    vi A,B;


    cin >> N;
    vector<pair<Int,Int>>  vpii = vector<pair<Int,Int>>(N);
    string ans= "Yes";

    rep(i,N){
        int a,b;
        cin >> a >> b;
        vpii[i].first = a;
        vpii[i].second = b;
    }

    sort(vpii.begin(),vpii.end(),compare_by_b);

    Int result = 0;
    rep(i,N){
        result += vpii[i].first;
        if(result>vpii[i].second){
            ans = "No";
            break;
        }
    }




    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <cstdio>
#include <set>
#include <stack>
#include <bitset>
#include <math.h>
#include <algorithm>
#include <queue>
#include <map>
#include <vector>
#include <string.h>
#include <array>

using namespace std;

const int maxn=1e6+5;

bitset < maxn > val;
int pos[maxn];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	int a;
	for(int i=0; i<n; i++){
		cin >> a;
		pos[a]++;
		val[a]=1;
	}
	int sol=0;
	for(int i=1; i<maxn; i++){
		if(val[i]){
			if(pos[i]==1){
				sol++;
			}
			for(int j=i; j<maxn; j+=i){
				val[j]=0;
			}
		}
	}
	cout << sol << '\n';
	return 0;
}

Measured memory_bytes: 7664
a = str(input())
s = ['z','x','c','v','b','n','m','a','s','d','f','g','h','j','k','l','q','w','e','r','t','y','u','i','o','p']
s.append(a)
s.sort()
Q = s.index(a)
e = Q + 2
print(s[int(e)])



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


long long Gcd(long long int m, long long int n)
{
	long long int temp;
	while (m % n != 0)
	{
		temp = n;
		n = m % n;
		m = temp;
	}
	return n;
}
long long int Lcm(long long int m, long long int n)
{
	return m * n / Gcd(m,n); 
}

int main(){
 long long int a,b,c,d,count;
  count=0;
  cin>>a>>b>>c>>d;
  long long int tmp1=0;
  long long int tmp2=0;
  long long int tmp3=0;
  long long int tmp4=0;
  long long int tmp5=0;
  long long int tmp6=0;
  long long int abc=Lcm(c, d);
  tmp1=b/c; 
  tmp2=b/d;
  tmp3=a/c;
  tmp4=a/d;
  tmp5=b/abc;
  tmp6=a/abc;

 long long int ans=0;

 ans=(tmp1-tmp3)+(tmp2-tmp4)-(tmp5-tmp6);
 if(a%c==0){
    ans++;
 }
 if(a%d==0){
 	ans++;
 }
 if(a%abc==0){
 	ans--;
 }
 cout<<1+b-a-ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

class UnionFind{
public:
    //親の番号を格納する。親だった場合はー（その集合のサイズ）
    vector<int> parents;

    //作る時はparentsを-1で初期化する
    //こうすることで全部ばらばらになる
    UnionFind(int n){
        parents = vector<int>(n, -1);
    }

    //Aがどのグループにいるか調べる
    int root(int A){
        if(parents[A]<0) return A;
        return parents[A] = root(parents[A]);
    }

    //自分のいるグループの大きさを調べる
    int size(int A){
        return -parents[root(A)];
    }

    //AとBをくっつける
    bool connect(int A, int B){
        //AとBを直接ではなく親同士をくっつける
        A=root(A);
        B=root(B);
        if(A==B){
            return false;
        }

        //大きい方（A)に小さい方（B)をくっつけたい
        if(size(A)<size(B)) swap(A, B);

        parents[A] += parents[B];
        parents[B] = A;

        return true;
    }
};

int main(){
    int N, K, L; cin >> N >> K >> L;
    UnionFind roads(N+1), rails(N+1);

    for(int i=0; i<K; i++){
        int p,q; cin >> p >> q;
        roads.connect(p, q);
    }

    for(int i=0; i<L; i++){
        int r, s; cin >> r >> s;
        rails.connect(r, s);
    }

    map<pair<int, int>, int> mp;
    for(int i=1; i<=N; i++){
        mp[{roads.root(i), rails.root(i)}]++;
    }

    for(int i=1; i<=N; i++){
        if(i != 1) cout << " ";
        cout << mp[{roads.root(i), rails.root(i)}];
    }

    cout << endl;
}

Measured memory_bytes: 13568
import sys
input=sys.stdin.readline
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[0]*n
for i in range(1,n):
  kk=i-k
  if kk<0:kk=0
  dp[i]=min(d+abs(hh-h[i])for d,hh in zip(dp[kk:i],h[kk:i]))
print(dp[n-1])

Measured memory_bytes: 13888
package main

import (
	. "fmt"
    . "math"
)

// func init() { Println("----------------------------------------") }

func main() {
    var a, b, c, k int
    Scanf("%d %d %d", &a, &b, &c)
    Scanf("%d", &k)

    max := int(Max(float64(a), Max(float64(b), float64(c))))
    ans := a + b + c - max

    for i := 0; i < k; i++ {
        max *= 2
    }
    Println(ans + max)
}


Measured memory_bytes: 512
n = int(input())
h = list(map(int, input().split()))

ans = 0

for i in range(n):
    while h[i]!=0:
        j = i
        while h[j]!=0:
            h[j]-=1
            j+=1
            if j==n:
                break
        ans +=1

print(ans)

Measured memory_bytes: 39280
// In the name of GOD
 
#include <bits/stdc++.h>
#define ll long long
#define pp pair <int, int>
using namespace std;
const int N = 1e5 + 10;
string s;
int n;

void solve() {
	int n;
	cin >> n;
	vector <int> a(n);
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	int dp[n];
	memset(dp, 0, sizeof dp);
	dp[0] = 0;
	for (int i = 0; i < n; ++i) {
		if (i > 0) {
			// cout << dp[i - 1] << " ";
			dp[i] = abs(a[i] - a[i - 1]) + dp[i - 1];
		}
		if (i - 1 > 0) {
			// cout << dp[i - 2] << " ";
			dp[i] = min (dp[i], abs(a[i] - a[i - 2]) + dp[i - 2]);
		}
	}
	cout << dp[n - 1];
}
int main () {
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    int tt = 1;
    // cin >> tt;
    for (int tc = 1; tc <= tt; ++tc) {
        solve();
    }
}                                  

Measured memory_bytes: 1024
//C
#include <cassert>
//#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

//ここまで標準include

using namespace std;

long aCb(long a, long b) {
	long out = 1;
	for (long i = 1; i <= b; i++) {
		out = out * (a + 1 - i) / i;
	}
	return out;
}

int main() {
	int N;
	cin >> N;
	vector<int>enemy(N + 1);
	vector<int>actor(N);
	for (int i = 0; i < N + 1; i++) {
		cin >> enemy.at(i);
	}
	for (int i = 0; i < N; i++) {
		cin >> actor.at(i);
	}
	long ans = 0;
	for (int i  = 0; i < N; i++) {
		if (enemy.at(i) >= actor.at(i)) {
			ans += actor.at(i);
			enemy.at(i) -= actor.at(i);
			actor.at(i) = 0;
		}
		else {
			ans += enemy.at(i);
			actor.at(i) -= enemy.at(i);
			enemy.at(i) = 0;
			if (enemy.at(i + 1) >= actor.at(i)) {
				ans += actor.at(i);
				enemy.at(i + 1) -= actor.at(i);
				actor.at(i) = 0;
			}
			else {
				ans += enemy.at(i + 1);
				enemy.at(i + 1) = 0;
				actor.at(i) -= enemy.at(i + 1);
			}
		}
	}
	cout << ans << endl;
}


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

int main(){
  while(true){
    int n, m, p;
    cin >> n >> m >> p;
    if(n == 0 && m == 0 && p == 0)break;
    int x;
    int hito = 0, sum = 0;;
    
    
    rep(i, n){
      cin >> x;
      sum += x;
      if(i == m){
	hito = x;
      }
    }
    if(hito == 0){
      cout << 0 << '\n';
    }else{
      cout << sum*(100-p)/hito << '\n';
    }
  }
}

Measured memory_bytes: 1160