akhauriyash/Code-Regression huggingface dataset:
from collections import defaultdict
from collections import deque
import itertools
import math

def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

n = readInt()
s = input()
t = input()

if s==t and len(s)>=n:
  print(len(s))
  exit()
if n>=len(s)+len(t):
  print(n)
  exit()

de = 0
for i in range(min(len(s),len(t))):
  if s[i*-1-1:]==t[:i+1]:
    de = i+1

print(len(s)+len(t)-de)

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

int main()
{

	int a, b, m[7];

	for( int i = 0; i < 7; i++ ) {

		cin >> a >> b;
		m[i] = a - b;

	}
	for( int i = 0; i < 7; i++ ) cout << m[i] << endl;

	return 0;

}

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

int main(){
	int n;
	long st=0;
	bool ans=true;
	
	scanf(" %d", &n);
	for(int i=0; i<n; ++i){
		char p;
		long x;
		scanf(" %c %ld", &p, &x);
		
		if(p=='(') st+=x;
		else if(p==')')st-=x;	
			
		if(st<0)ans=false;
	}
	
	if(st!=0) ans=false;
	
	if(ans) printf("YES\n");
	else printf("NO\n");
}

Measured memory_bytes: 1172
n=int(input())
a=[0]
for i in range(40):
  if n&(1<<i):a.append(i)
ans=[]
j=100
for i in range(len(a)-1):
  for _ in range(a[i+1]-a[i]):
    ans.append(j)
    j-=1
  ans.append(i+1)
ans=ans[:-1]
ans=[50]+[100-i for i in range(a[-1])]+[i+1 for i in range(len(a)-2)][::-1]+ans+[50]
print(len(ans))
print(*ans)

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

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

  int A = 0, ans = 0;

  for (int i = 1; i < N + 1; i++) {
    for (int j = 1; j < N + 1; j++) {
      if (i % j == 0 && i % 2 == 1) A++;
    }
    if (A == 8) ans++;
    A = 0;
  }

  cout << ans << endl;
}

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

int main(){
  int a,b;
  cin >> a >> b;
  cout << max(a+b,max(a*b,a-b)) << endl;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
using namespace std;

ll n,a[200010],sum,b[200010],v1,myB,ans=1e18;

int main()
{

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

    cin >> n;
    for(ll i=0; i<n; i++) cin >> a[i] , a[i]-=(i+1);

    if( n==1 ){
        cout << 0;
        return 0;
    }

    sort( a , a+n );
    b[0] = a[0];
    for(ll i=1; i<n; i++) b[i] = a[i]+b[i-1];

    for(ll i=0; i<n-1; i++){
        sum = -b[i]+b[n-1]-b[i];
        v1 = n-i-1-i-1;

        myB = 0;
        if( v1 < 0 ) myB = -a[i];
        if( v1 > 0 ) myB = -a[i+1];

        ans = min( ans , sum+myB*v1 );
    }

    ans = min( ans , b[n-1]+(-a[0])*n );
    ans = min( ans , -b[n-1]+(a[n-1])*n );

    cout << ans;

    return 0;
}


Measured memory_bytes: 3328
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<cstring>
#include<map>
using namespace std;
vector<pair<int,int> >data;
map<pair<int,int>,int> dp[201];

int check(int i,pair<int,int> last)
{
  //  cout<<i<<" "<<endl;
  if(i<0)
    return 0;

  if(dp[i].count(last)!=0)
    return dp[i][last];


  int ans=0;
  if(last.first>data[i].first &&
     last.second>data[i].second )
    ans=check(i-1,data[i])+1;

  ans=max(ans,check(i-1,last));
  dp[i][last]=ans;
  return ans;
}

int main()
{
  int n;
  for(;cin>>n,n;)
    {
      data.clear();
      for(int i=0;i<n;i++)
	{
	  int h,r;
	  cin>>h>>r;
	  data.push_back(make_pair(h,r));
	}
      int m;
      cin>>m;
      for(int i=0;i<m;i++)
	{
	  int h,r;
	  cin>>h>>r;
	  data.push_back(make_pair(h,r));
	}
      sort(data.begin(),data.end());
      // memset(dp,-1,sizeof(dp));
      //int ans=;
      for(int i=0;i<201;i++)
	dp[i].clear();

      cout<<check(data.size()-1,make_pair(9999,9999))<<endl;
    }

}

Measured memory_bytes: 2144
#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;

constexpr int INF = 1 << 30;
constexpr ll LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;

vector<ll> fac;
bool CombParity(int a, int b) {
    if (fac[a] - fac[a-b] - fac[b] > 0) {
        return 0;
    } else {
        return 1;
    }
}

int main() {
    int n; cin >> n;
    string a; cin >> a;
    vector<int> b(n);
    rep(i, n) {
        b[i] = a[i] - '1';
    }

    fac.assign(n+1, 0);
    int i = 2;
    while (i <= n) {
        int j = 1;
        while (i * j <= n) {
            fac[i*j]++;
            j++;
        }
        i *= 2;
    }
    rep(i, n) {
        fac[i+1] += fac[i];
    }

    bool parity = 0;
    rep(i, n) {
        parity ^= (b[i]%2) * CombParity(n-1, i);
    }

    if (parity == 1) {
        cout << 1 << endl;
        return 0;
    }

    bool flag1 = 0;
    rep(i, n) {
        if (b[i] == 1) flag1 = 1;
    }
    if (flag1) {
        cout << 0 << endl;
        return 0;
    }

    rep(i, n) {
        if (b[i] == 2) b[i] = 1;
    }
    parity = 0;
    rep(i, n) {
        parity ^= b[i] * CombParity(n-1, i);
    }
    if (parity) {
        cout << 2 << endl;
    } else {
        cout << 0 << endl;
    }



    return 0;
}

Measured memory_bytes: 13060
#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use std::collections::*;
use std::process::exit;
use std::cmp::*;
use itertools::Itertools;


fn main() {
    proconio::input! {
        n: usize,
        mut p: [isize;n],
        }
    let mut q= vec![0;1000000];
    q[1]=(p[1]-p[0]).abs();
    for i in 0..n-2 {
        q[i+1]=min((p[i+1]-p[i]).abs()+q[i],q[i+1]);
        q[i+2]=(p[i+2]-p[i]).abs()+q[i];
    }
    q[n-1]=min((p[n-2]-p[n-1]).abs()+q[n-2],q[n-1]);
    println!("{}",q[n-1]);
}

Measured memory_bytes: 3948
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
	char s[1024] = "";
	char t[32][9] = {"100101", "10011010", "0101", "0001", "110",
		"01001", "10011011", "010000", "0111", "10011000", "0110",
		"00100", "10011001", "10011110", "00101", "111", "10011111",
		"1000", "00110", "00111", "10011100", "10011101", "000010",
		"10010010", "10010011", "10010000", "101", "010001", "000011",
		"10010001", "000000", "000001"};
	char u[32][6] = {"00000", "00001", "00010", "00011", "00100",
		"00101", "00110", "00111", "01000", "01001", "01010", "01011",
		"01100", "01101", "01110", "01111", "10000", "10001", "10010",
		"10011", "10100", "10101", "10110", "10111", "11000", "11001",
		"11010", "11011", "11100", "11101", "11110", "11111"};
	int i, j, k, c, f;
	while (cin.getline(s, sizeof(s)), !cin.eof())
	{
		char a[5120] = "", r[5120] = "";
		c = 0;
		for (i = 0; i < strlen(s); i++, c--)
		{
			switch (s[i])
			{
			case ' ':
				for (j = 0; j < 6; j++, c++)
					a[c] = u[26][j];
				break;
			case '.':
				for (j = 0; j < 6; j++, c++)
					a[c] = u[27][j];
				break;
			case ',':
				for (j = 0; j < 6; j++, c++)
					a[c] = u[28][j];
				break;
			case '-':
				for (j = 0; j < 6; j++, c++)
					a[c] = u[29][j];
				break;
			case '\'':
				for (j = 0; j < 6; j++, c++)
					a[c] = u[30][j];
				break;
			case '?':
				for (j = 0; j < 6; j++, c++)
					a[c] = u[31][j];
				break;
			default:
				for (j = 0; j < 6; j++, c++)
					a[c] = u[s[i]-'A'][j];
			}
		}
		for (i = c = 0; i < strlen(a); i += j+1, c++)
		{
			f = 0;
			for (j = 2; j < 9; j++)
			{
				char b[9] = "";
				for (k = 0; k <= j; k++)
					b[k] = a[i+k];
				for (k = 0; k < 32; k++)
					if (strcmp(b, t[k]) == 0)
					{
						switch (k)
						{
						case 26:
							r[c] = ' ';
							break;
						case 27:
							r[c] = '.';
							break;
						case 28:
							r[c] = ',';
							break;
						case 29:
							r[c] = '-';
							break;
						case 30:
							r[c] = '\'';
							break;
						case 31:
							r[c] = '?';
							break;
						default:
							r[c] = k + 'A';
						}
						f = 1;
						break;
					}
				if (f)
					break;
			}
		}
		cout << r << endl;
	}
}

Measured memory_bytes: 0
#include <cstdio>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

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

    for(int d=1; d<=dNum; ++d){
        int h, w;
        cin >> w >> h;

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

        vector<int> dp(1<<w, -1);
        dp[0] = 0;
        for(int y=0; y<h; ++y){
            for(int x=0; x<w; ++x){
                vector<int> next(1<<w, -1);
                for(int i=0; i<(1<<w); ++i){
                    if(dp[i] == -1)
                        continue;

                    bitset<21> bs = i;
                    bs <<= 1;

                    if(!bs[w] && (x == 0 || !bs[1])){
                        bs &= (1<<w) - 1;
                        bs[0] = true;
                        next[bs.to_ulong()] = max(next[bs.to_ulong()], dp[i] + r[y][x]);
                        bs[0] = false;
                    }

                    bs &= (1<<w) - 1;
                    next[bs.to_ulong()] = max(next[bs.to_ulong()], dp[i]);
                }
                dp.swap(next);
            }
        }

        int ret = 0;
        for(int i=0; i<(1<<w); ++i)
            ret = max(ret, dp[i]);
        cout << "Case " << d << ": " << ret << endl;
    }

    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;

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

int main() {
    ios::sync_with_stdio(false);
    vector<int> a(3);

    rep(i, 3) { cin >> a[i]; }
    sort(a.begin(), a.end());
    if (a[0] == a[1] && a[1] == a[2]) {
        cout << "No" << endl;
    } else if (a[0] == a[1] || a[1] == a[2] || a[0] == a[2]) {
        cout << "Yes" << endl;
    } else
        cout << "No" << endl;

    return 0;
}


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

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define dump_1(x1) cerr << #x1 << ": " << x1 << endl
#define dump_2(x1, x2) \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define dump_3(x1, x2, x3)                                                \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << endl
#define dump_4(x1, x2, x3, x4)                                            \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << endl
#define dump_5(x1, x2, x3, x4, x5)                                        \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#define dump(...) \
  CHOOSE((__VA_ARGS__, dump_5, dump_4, dump_3, dump_2, dump_1, ~))(__VA_ARGS__)
#define check(s) cerr << s << endl

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

using namespace std;

using ll = long long;

const long long MOD = 1000000007;

vector<int> dx = {0, 1, 0, -1};
vector<int> dy = {1, 0, -1, 0};

const ll LINF = 2e18;
const int INF = 1e9;

ll N;
vector<ll> x, y;

vector<vector<ll>> dp;
vector<bool> seen;
vector<vector<ll>> G;

void f(ll i, ll p) {
  if (seen.at(i)) return;
  seen.at(i) = true;
  dp.at(i).at(0) = 1;
  dp.at(i).at(1) = 1;
  for (ll j : G.at(i)) {
    if (j == p) continue;
    f(j, i);
    dp.at(i).at(0) = dp.at(i).at(0) * (dp.at(j).at(0) + dp.at(j).at(1)) % MOD;
    dp.at(i).at(1) = dp.at(i).at(1) * dp.at(j).at(0) % MOD;
  }
  return;
}

void solve() {
  seen.resize(N, false);
  dp.resize(N, vector<ll>(2));
  G.resize(N);

  rep(i, N - 1) {
    G.at(x.at(i)).push_back(y.at(i));
    G.at(y.at(i)).push_back(x.at(i));
  }

  f(0, -1);
  ll ans = (dp.at(0).at(0) + dp.at(0).at(1)) % MOD;
  cout << ans << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  scanf("%lld", &N);
  x.resize(N - 1);
  y.resize(N - 1);
  for (int i = 0; i < N - 1; i++) {
    scanf("%lld %lld", &x.at(i), &y.at(i));
    x.at(i)--;
    y.at(i)--;
  }
  solve();
  return 0;
}


Measured memory_bytes: 22740
// ※※※ 解答不能 ※※※
// ※※※ 上級者の解答を勉強する. ※※※
// ats5515氏.
// https://atcoder.jp/contests/abc134/submissions/6459526
// 解き直し.
// AtCoder Beginner Contest 134 解説.
// https://img.atcoder.jp/abc134/editorial.pdf
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1e9 + 7;
int dp[51][2505][51];

int add(int &a, const int &b){
    a += b;
    if(a >= MOD) a -= MOD;
}

signed main(){
    
    // 1. 入力情報取得.
    int N, K;
    scanf("%d %d", &N, &K);
    
    // 2. dp更新.
    dp[0][0][0] = 1;
    for(int i = 0; i < N; i++){
        for(int s = 0; s <= K; s++){
            for(int j = 0; j <= N; j++){
                if(s + 2 * j <= K){
                    add(dp[i + 1][s + 2 * j][j], dp[i][s][j]);
                    add(dp[i + 1][s + 2 * j][j + 1], dp[i][s][j]);
                    if(j > 0){
                        add(dp[i + 1][s + 2 * j][j - 1], (j * j * dp[i][s][j]) % MOD);
                        add(dp[i + 1][s + 2 * j][j], (2 * j * dp[i][s][j]) % MOD);
                    }
                }
            } 
        }
    }
    
    // 3. 出力 ～ 後処理.
    printf("%d\n", dp[N][K][0]);
    return 0;

}

Measured memory_bytes: 50176
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

s=input()[::-1]
n=len(s)
a=[0]*2019
a[0]=1
c,d=0,1
for i in s:
    c+=int(i)*d
    c%=2019
    d*=10
    d%=2019
    a[c]+=1
ans=0
for i in a:
    ans+=i*(i-1)//2
print(ans)

Measured memory_bytes: 10564
M,D=map(int,input().split())
res = 0
for m in range(1,M+1):
    for d in range(1,D+1):
        if len(str(d))==2:
            d10=d//10
            d1=d%10
            if d10>=2 and d1>=2 and d10*d1==m:
                #print(m, d)
                res+=1
print(res)
                
    

Measured memory_bytes: 2940
n=int(input())
a=list(map(int,input().split()))
su=sum(a)
ru=[0 for i in range(n)]
ru[0]=su-a[0]

for i in range(1,n):
    ru[i]=ru[i-1]-a[i]
ans=0
for i in range(0,n-1):
    ans+=(a[i]*(ru[i]%1000000007))%1000000007
    ans=ans%1000000007
print(ans)

Measured memory_bytes: 31568
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
bool isprime(ll a){
  if(a==2)return 1;
  if(!(a&1))return 0;
  for(ll i=3;i*i<=a;i+=2)
    if(a%i==0)return 0;
  return 1;
}
ll mpow(ll base,ll exponent,ll modulus){
  if(modulus==1)return 0;
  long long result = 1;
  base=base%modulus;
  while(exponent){
    if(exponent%2 == 1)
    result=(result*base)%modulus;
    exponent=exponent>>1;
    base=(base*base)%modulus;
  }
  return result;
}
ll minv(ll a,ll mod){
  ll _gcd=gcd(a,mod);
  assert(_gcd==1);
  return mpow(a,mod-2,mod);
}


/*
ll ncr(ll N,ll K){
  if(N<K)return 0;
  if(K==0)return 1;
  if(N==0)return 0;

  ll den=1;
  for(ll i=1;i<=K;i++)den*=i;
  ll num=1;
  while(K--){
    num*=N;
    if(num%den==0){
      num/=den;
      den=1;
    }
    N--;
  }

  return num;
}
*/
ll n,m;
int main(){FAST;
cin>>n>>m;
string a,b;
for(int i=0;i<n;++i){
  a.pb(m+'0');
}
for(int i=0;i<m;++i){
  b.pb(n+'0');
}
if(a<b)cout<<a;
else if(a>b)cout<<b;
else cout<<a;
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) *b;
}

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};


///////////////////////////



int main() {
	ll N;
	string S;
	cin >> N >> S;

	ll v = 0;
	rep(i, N) {
		if (S[i] == '.') { v++; }
	}

	ll ans = v;

	rep(i, N) {
		if (S[i] == '.') { v--; }
		else { v++; }
		ans = min(v, ans);
	}

	cout << ans;

	system("PAUSE");
}


Measured memory_bytes: 764
use std::io::stdin;

fn main() {
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s = s.trim().to_string();

    let mut i = 0;
    let mut was_str = "er";
    let mut res = "YES";
    loop {
        // successfully finished
        if s.len() == i {
            break;
        }

        if s.len() >= i + 5 {
            if ["dream", "erase"].contains(&&s[i..i+5]) {
                was_str = &s[i..i+5];
                i += 5;
                continue;
            }
        }
        if (s.len() >= i + 2) & (was_str == "dream") {
            if &s[i..i+2] == "er" {
                was_str = &s[i..i+2];
                i += 2;
                continue;
            }
        }
        if (s.len() >= i + 1) & (was_str == "erase") {
            if &s[i..i+1] == "r" {
                was_str = &s[i..i+1];
                i += 1;
                continue;
            }
        }

        res = "NO";
        break;
    }
    
    println!("{}", res);
}


Measured memory_bytes: 4352
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

#define INF_LL (ll)1e18
#define INF (int)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
using ll = long long;
using PII = pair<int, int>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

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

	int x, a, b;
	cin >> x >> a >> b;
	if(abs(x-a) < abs(x-b)){
		cout << "A" << endl;
	}else{
		cout << "B" << endl;
	}
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define MAX(X,Y) (*max_element(X,Y))
#define MIN(X,Y) (*min_element(X,Y))
#define NP(X,Y) next_permutation(X,Y)
#define setp(X,Y) cout<<fixed<<setprecision(Y)<<X;
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int N;
int A[200010];
bool C[200010];


signed main(){
	cin>>N;
	int sum=0;
	REP(i,N){
		cin>>A[i];
	}
	for(int i=N;1<=i;i--){
		int t=i;
		int c=0;
		while(1){
			t+=i;
			if(t>N){
				break;
			}
			c+=C[t];
		}
		if(c%2!=A[i-1]){
			C[i]=true;
		}
	}
	vector<int> v;
	for(int i=1;i<=N;i++){
		if(C[i]==true){
			v.push_back(i);
		}
	}
	cout<<v.size()<<endl;
	REP(i,v.size()){
		cout<<v[i];
		if(i<N-1)cout<<" ";
	}
	return 0;
}


Measured memory_bytes: 3700
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF (1e9+1)
//#define INF (1LL<<59)

int main(){
	string s;
	int n;
	cin>>s>>n;
	rep(i,s.size()){
		if(s[i]=='a')continue;
		if( n>='z'-s[i]+1 ){
			n-=('z'-s[i]+1);
			s[i]='a';
		}
	}
	s[s.size()-1] = 'a'+((s[s.size()-1]-'a')+n)%26;
	cout<<s<<endl;
}



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

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

using namespace std;
//using ll = long long;

vector<int> to_array(string s);

int main()
{
    string s; cin>>s;
    vector<int> A;
    A = to_array(s);
    rep(bit,(1<<3)){
        int ans=A[0];

        rep(i,3){
            if(bit&(1<<i)){
                ans+=A[i+1];
            }else{
                ans-=A[i+1];
            }
        }
        //cout << ans << endl;
        if(ans==7){
            rep(i,3){
                cout<<A[i];
                if(bit&(1<<i)){
                    cout<<"+";
                }else{
                    cout<<"-";
                }
            }
            cout<<A[3]<<"=7"<<endl;
            return 0;
        }
    }
    return 0;
}



vector<int> to_array(string s)
{
    vector<int> A;
    rep(i,s.size()){
        if(s[i]=='0'){
            A.push_back(0);
        }else if(s[i]=='1'){
            A.push_back(1);
        }else if(s[i]=='2'){
            A.push_back(2);
        }else if(s[i]=='3'){
            A.push_back(3);
        }else if(s[i]=='4'){
            A.push_back(4);
        }else if(s[i]=='5'){
            A.push_back(5);
        }else if(s[i]=='6'){
            A.push_back(6);
        }else if(s[i]=='7'){
            A.push_back(7);
        }else if(s[i]=='8'){
            A.push_back(8);
        }else{
            A.push_back(9);
        }
    }
    return A;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
 
#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);
 
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T,vector<T>,greater<T>>;
 
constexpr long long MOD = (long long)1e9 + 7;
constexpr long long MOD2 = 998244353;
constexpr long long HIGHINF = (long long)1e18;
constexpr long long LOWINF = (long long)1e15;
constexpr long double PI = 3.1415926535897932384626433;
 
template <class T> vector<T> multivector(size_t N,T init){return vector<T>(N,init);}
template <class... T> auto multivector(size_t N,T... t){return vector<decltype(multivector(t...))>(N,multivector(t...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max(a,b);}
template <class T> void chmin(T& a, const T b){a=min(a,b);}
void YN(bool flg) {cout << (flg ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << (flg ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << (flg ? "yes" : "no") << endl;}

int main() {
	ll N,D,A; cin >> N >> D >> A;
	vector<pair<ll,ll>> P(N+1,{LOWINF,LOWINF});
	vector<ll> X(N+1,LOWINF),H(N+1,LOWINF);
	for(int i = 0; i < N; ++i){
		cin >> P[i].first >> P[i].second;
	}
	sort(ALL(P));
	for(int i = 0; i < N; ++i){
		X[i] = P[i].first;
		H[i] = P[i].second;
	}
	vector<ll> dp(N+1,0);
	ll ans = 0;
	for(int i = 0; i < N; dp[i+1] += dp[i],++i){
		ll Y = -dp[i] + H[i];
		if(Y<=0) continue;
		int j = upper_bound(ALL(X),X[i]+2*D)-X.begin();
		ll cnt = Y/A + (Y%A!=0);
		ans += cnt;
		dp[i] += cnt*A;
		dp[j] -= cnt*A;
	}
	cout << ans << endl;
    return 0;
}

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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))

#define INF 2e9
#define INF_LL 1LL<<60
#define ll long long

typedef pair<ll, ll> P;

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, k; cin >> n >> k;
    vector<int> h(n);
    REP(i, n) cin >> h[i];

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

    int ans = INF;

    REP(i, n-k+1) {
        int tmp = h[i+k-1] - h[i];
        ans = min(ans, tmp);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<stack>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#define white 0
#define grey 1
#define nil -1
#define maxn 100000
using namespace std;

vector<int> g[maxn+5];
int color[maxn+5];
int n,m;

void dfs(int s,int t)
{
    stack<int>q;
    q.push(s);
    color[s]=t;
    while(!q.empty())
    {
        int v=q.top();
        q.pop();
        for(int j=0;j<g[v].size();j++)
        {
            int u=g[v][j];
            if(color[u]==nil)
            {
                q.push(u);
                color[u]=t;
            }
        }
    }
}

void work()
{
    int id=1;
    for(int i=0;i<n;i++)
        color[i]=nil;
    for(int i=0;i<n;i++)
        if(color[i]==nil)
           dfs(i,id++);
}

int main()
{
    scanf("%d%d",&n,&m);
    for(int i=0;i<m;i++)
    {
        int x,y;
        scanf("%d%d",&x,&y);
        g[x].push_back(y);
        g[y].push_back(x);
    }
    work();

    int q;
    scanf("%d",&q);
    for(int i=1;i<=q;i++)
    {
        int s,t;
        scanf("%d%d",&s,&t);
        if(color[s]==color[t])
            printf("yes\n");
        else printf("no\n");
    }
    return 0;
}

Measured memory_bytes: 9020
#include<stdio.h>

int linearSearch(int,int *,int);

int main(){
  int S[10000],T[500],n,q;
  int i;
  int res=0;

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

  scanf("%d",&q);
  if (q<=500){
    for(i=0; i<q; i++){
      scanf("%d",&T[i]);
      res += linearSearch(n,S,T[i]);
    }
  }

  printf("%d\n",res);

  return 0;
}

int linearSearch(int n,int *S,int key)
{
  int i=0;
  S[n] = key;
  while(S[i] != key)i++;
  if(i != n)return 1;
  else return 0;
}



Measured memory_bytes: 2108
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }
    

    Scanner cin;
    
    void calc()
    {
        cin = new Scanner();
        long A = cin.nextLong();
        long B = cin.nextLong();
        long X = cin.nextLong();
        Console.WriteLine(calc2(B, X) - calc2(A - 1, X));
    }
    
    long calc2(long a, long x)
    {
        if (a < 0) return -1;
        return a / x;
    }
}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

Measured memory_bytes: 13140
package main

import (
	"fmt"
	"math"
)

func main() {
	for{
		var n int
		fmt.Scan(&n)
		if n == 0{
			break
		}

		s := make([]int, n)
		sum := 0.0
		for i:=0; i<len(s); i++{
			fmt.Scan(&s[i])
			sum += float64(s[i])
		}
		average := sum / float64(n)

		bsum := 0.0
		for i:=0; i<len(s); i++{
			bsum += (float64(s[i])-average) * (float64(s[i])-average)
		}
		fmt.Println(math.Sqrt(bsum / float64(n)))
	}
}


Measured memory_bytes: 1212
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
for i in range(N-1):
  if A[i]+1 == A[i+1]:
    B.append(C[A[i]-1])
print(sum(B))

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

using namespace std;

int main(){
  int N;  cin>>N;
  vector<int> a(N),b(N),c(N);
  for(int i=0;i<N;i++){
    cin>>a[i]>>b[i]>>c[i];
  }

  vector<vector<int> > dp(N,vector<int>(3,0));

  dp[0][0]=a[0];
  dp[0][1]=b[0];
  dp[0][2]=c[0];

  for(int i=1;i<N;i++){
    dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i];
    dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b[i];
    dp[i][2]=max(dp[i-1][0],dp[i-1][1])+c[i];
  }

  cout<<max(max(dp[N-1][0],dp[N-1][1]),dp[N-1][2])<<endl;

  return 0;
}


Measured memory_bytes: 6912
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N, M = LI()
    A = LI()
    num2match = {
        1: 2,
        2: 5,
        3: 5,
        4: 4,
        5: 5,
        6: 6,
        7: 3,
        8: 7,
        9: 6,
    }
    dp = ['' for _ in range(N+1)]
    for a in A:
        match_need = num2match[a]
        if 0 <= match_need <= N:
            dp[match_need] = max(str(dp[match_need]), str(a))
    for i in range(N+1):
        for a in A:
            match_need = num2match[a]
            if i - match_need > 0:
                if dp[i-match_need] == '':
                    continue
                old = dp[i]
                new = str(a) + dp[i-match_need]
                if len(old) > len(new):
                    dp[i] = old
                elif len(new) > len(old):
                    dp[i] = new
                else:
                    dp[i] = max(old, new)
    print(dp[N])
main()



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

using namespace std;

#define fRead(x)        freopen(x,"r",stdin)
#define fWrite(x)       freopen (x,"w",stdout)

#define LL              long long
#define ULL             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define PI              acos(-1.0)
#define mk              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define FastRead        ios_base::sync_with_stdio(0);cin.tie(nullptr);
#ifdef VAMP
     #define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template < typename Arg1 >
    void __f(const char* name, Arg1&& arg1){
        cout << name << " = " << arg1 << std::endl;
    }
    template < typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names+1, ',');
        cout.write(names, comma - names) << " = " << arg1 <<" | ";
        __f(comma+1, args...);
    }
#else
    #define debug(...)
#endif


int main()
{
    #ifdef VAMP
        clock_t tStart = clock();
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    string s;
    cin >> s;
    int ans = 0;
    int cnt = 0;
    for(int i = 0;i < s.size();i++){
        if(s[i] == 'R'){
            cnt++;
        }else{
            cnt = 0;
        }
        ans = max(ans,cnt);
    }
    cout << ans << "\n";
    #ifdef VAMP
        fprintf(stderr, "\n>> Runtime: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC);
    #endif
}


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

int main() {
	int q;
	long long n,i,k,j,sum=0,count=0,ans=0,m,a,b;
    cin>>n;
    if(n==1)
    {cout<<2;
return 0;}    k=0;
    while(1)
    {
        count=0;
        k=1;
      for(i=2;i<=sqrt(n);i++)
      {
        if(n%i==0)
        {
            k=0;
            break;
        }
      }
        if(k==1)
        {cout<<n; return 0;}
        else n++;
    }
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int N,temp;
struct node{
	int number,count;
	bool operator<(const node& n) const{
		return count<n.count;
	}
};
vector<node> v;
int main(){
	cin>>N;
	for(int i=1;i<=N;i++){
		cin>>temp;
		v.push_back({i,temp});		
	}
	sort(v.begin(),v.end());
	for(int i=0;i<N;i++){
		cout<<v[i].number<<" ";
	}
	cout<<endl;
} 

Measured memory_bytes: 1780
#include<stdio.h>
typedef long long ll;
ll gcd(ll a,ll b){
    if(a%b==0){
        return b;
    }else{
        return gcd(b,a%b);
    }
}
ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}
int main(void){
    ll a,b;
    while(scanf("%lld %lld",&a,&b)!=EOF){
        printf("%lld %lld\n",gcd(a,b),lcm(a,b));
    }
    return 0;
}


Measured memory_bytes: 1944
/*
    問題をよく読もう！
    論理的に考えよう！
    サンプルを確認しよう!
    絶対に諦めるな！
    工夫をしろ！
    配列は少し多めにとっておく

    Twitterは終わるまでログアウト！
    （間違えて解法をツイートしてはいけないから）

*/
//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include<cstring>
//namespace
using namespace std;
//繰り返し
#define REP(i, m, n) for(int i=(int)m; i<(int)n; ++i)
#define rep(i, n) REP(i, 0, n)
//イテレータ
#define all_range(C) begin(C), end(C)
//簡略化
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
typedef pair<string,int> pst;

const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
//最大最小
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) {if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) {if(a<b) a=b;}

//関数

//最大公約数を求める
ll my_gcd(ll x, ll y) {
  ll r;

  while(y!=0) {
    r = x%y;
    x = y;
    y = r;
  }

  return x;
}

//最小公約数を求める
ll my_lcm(ll x, ll y) {

  return (x*y)/my_gcd(x,y);
}

//xのy乗を求める ※参考：10^18乗まで
ll my_pow(ll x, ll y) {
  ll sum = 1;

  while(y>0) {
    sum *= x;
  }

  return sum;
}

//main.cpp----------------------------


void solve();

string s;
ll len;

int main() {
  cin >> s;

  solve();

  return 0;
}

void solve() {
  len = (int)(s.length());
  bool cflag = false, fflag = false;

  rep(i, len) {
    if(s[i]=='C') cflag = true;

    if(cflag&&s[i]=='F') fflag = true;
  }

  if(fflag) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
//const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
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;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) {cout << (A) << '\n'; exit(0);}

int main()
{
  string S;
  cin >> S;
  string T = S;
  reverse(S.begin(), S.end());

  ll ans = 0;
  for (ll i = 0; i < S.size(); i++)
  {
    if (S.at(i) != T.at(i))
      ans++;
  }
  cout << divceil(ans, 2) << endl;
}

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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vvb = vector<vb>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, s, n) for(int i = (int)(s); i < (int)(n); i++)

int INF = 1ll << 30;

int main(){
  int n;
  cin >> n;
  vi a(n);
  int N = 1000010;
  vi ck(N, 0);
  rep(i, 0, n){
    cin >> a[i];
    ck[a[i]]++;
  }
  
  vi cnt(N, 0);
  vb check(N, 0);
  bool p = 1, s = 1;
  
  for(int i = 2; i < N; i++){
    if(check[i] > 0)
      continue;
    for(int j = i; j < N; j += i){
      cnt[i] += ck[j];
      check[j] = 1;
    }
    if(cnt[i] > 1)
      p = 0;
    if(cnt[i] == n){
      s = 0;
      break;
    }
  }
  
  if(p)
    cout << "pairwise coprime" << endl;
  else if(s)
    cout << "setwise coprime" << endl;
  else
    cout << "not coprime" << endl;
    
  
  return 0;
  
}

Measured memory_bytes: 15124
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int modP = 1000000007;

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int n = in.nextInt();
			int x = 800*n;
			int y = (n/15)*200;
			out.println(x-y);

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}


Measured memory_bytes: 24788
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author KharYusuf
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CPrison solver = new CPrison();
        solver.solve(1, in, out);
        out.close();
    }

    static class CPrison {
        public void solve(int testNumber, FastReader s, PrintWriter w) {
            int n = s.nextInt(), m = s.nextInt(), a[] = new int[n + 1], ans = 0;
            for (int i = 0; i < m; i++) {
                a[s.nextInt() - 1]++;
                a[s.nextInt()]--;
            }
            if (a[0] == m) ans++;
            for (int i = 1; i < n; i++) {
                a[i] = a[i - 1] + a[i];
                if (a[i] == m) ans++;
            }
            w.println(ans);
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public int nextInt() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 23636
from sys import stdin
from string import ascii_lowercase

count_let = {k : 0 for k in ascii_lowercase}

s = list(stdin.read().rstrip().lower())
for c in s:
    count_let[c] = count_let.get(c, 0)+1

for k, v in sorted(count_let.items()):
    if k in ascii_lowercase:
        print("{} : {}".format(k, v))


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

#define int long long
#define pb push_back
#define f first
#define s second
#define all(container) container.begin(),container.end()

#define fast ios::sync_with_stdio(0); cin.tie(0)
#define print(...) __f(#__VA_ARGS__, __VA_ARGS__)

template <typename Arg1> void __f(const char* name, Arg1&& arg1){
  cout << name << ": " << arg1 << '\n';
}

template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}

int32_t main(){
    
    fast;
    int n; cin >> n;
    
    cout << n*n*n << "\n";
  
  
    return 0;
} 

Measured memory_bytes: 256
from collections import deque

def main():
    n, q = map(int, input().split())
    li = [ deque() for i in range(n)]

    for _ in range(q):
        command, *para = map(int, input().split())

        if   command == 0:
            li[para[0]].append(para[1])
            
        elif command == 1:
            print(*li[para[0]])

        elif command == 2:

            if  not li[para[0]]:
                continue

            if not li[para[1]]:
                li[para[1]] = li[para[0]]
                
            elif   len(li[para[0]]) == 1:
                li[para[1]].append(li[para[0]][0])
            elif len(li[para[1]]) == 1:
                li[para[0]].appendleft(li[para[1]][0])
                li[para[1]] = li[para[0]]
            else:
                li[para[1]].extend(li[para[0]])

            li[para[0]] = deque()

main()


Measured memory_bytes: 30744
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

int a, b, c;

int main(){
	//IO("input.txt", "output.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> a >> b >> c;
	if(c >= a && c <= b) cout << "Yes\n";
	else cout << "No\n";
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>

using namespace std;

int main(){
   int N,M;
   cin >> N >> M;
   cout << (N*(N-1)+M*(M-1))/2 <<endl;
   return 0;
}


Measured memory_bytes: 256