akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define FASTIO1 ios_base::sync_with_stdio(false)
#define FASTIO2 cin.tie(NULL),cout.tie(NULL)
#define count_1(p) __builtin_popcountll(p)
#define count_0(p) __builtin_ctzll(p)
#define all(x) (x).begin(),(x).end()
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second

ll power(ll x,ll y,ll p);
const ll inf=999999999;
const ll mod=1e9+7;
bool tc=false;

void solve()
{
	string s,t;
	cin>>s>>t;
	ll cur,minm=inf;
	ll n1=s.length();
	ll n2=t.length();
	for(ll i=0;i<=n1-n2;i++)
	{
		cur=0;
		for(ll j=0;j<n2;j++)
			if(s[i+j]!=t[j])
				cur++;
		minm=min(minm,cur);
	}
	cout<<minm;
}

int main() 
{
    FASTIO1;
    FASTIO2;
    clock_t start=clock();
    ll t=1; 
    if(tc) cin>>t;
    while(t--)
        solve();
    cerr<<fixed<<setprecision(6);
    cerr<<(double)(clock()-start)/CLOCKS_PER_SEC<<endl;
    return 0;
}

ll power(ll x,ll y,ll p)  
{  
    ll res=1; x=x%p;
    if(x==0) return 0;
    while(y>0)  
    {
        if(y&1) res=(res*x)%p;
        y=y>>1; x=(x*x)%p;  
    }
    return res;  
}  


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

int main()
{
  ll a, b;
  cin >> a >> b;
  cout << lcm(a, b) << endl;

  return 0;
}


Measured memory_bytes: 3340
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef vector<ll> vec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef vector<vector<ll>> mat;
typedef vector<ll> vec;




void solve() {
	ll n; cin >> n;
	if (n % 2) {
		cout << 0 << endl; return;
	}
	ll ans = 0;
	ans += n / 10; n /= 10;
	while (n > 0) {
		ans += n / 5; n /= 5;
	}
	cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(4);
	//init();
	solve();
	stop
		return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
typedef complex<D> P;
#define F first
#define S second
const ll MOD=1000000007;
//const ll MOD=998244353;

template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,const pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,const vector<T> &A){ll i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}

const ll MX=4010;

int main(){
  ll N;
  cin>>N;
  vector<ll> A(N),W(N),R(N);
  vector<pll> T(N);
  for(int i=0;i<N;i++){
    cin>>R[i]>>A[i]>>W[i]>>T[i].F;
    T[i].F--;
    T[i].F+=R[i];
    T[i].S=i;
  }
  sort(T.begin(),T.end());
  vector<ll> dp(MX,-1*MOD),nx(MX,-1*MOD),rem(MX);
  dp[0]=0;
  for(int i=0;i<N;i++){
    int num=T[i].S;
    int mx=T[i].F;
    for(int j=R[num];j<=mx;j++){
      nx[j]=max(nx[j],dp[j-R[num]]+A[num]);
    }
    for(int j=0;j<R[num];j++){rem[j]=-1*MOD;}
    for(int j=0;j<=mx;j++){
      int k=j%R[num];
      rem[k]=max(rem[k]+W[num],nx[j]);
      nx[j]=rem[k];
    }
    for(int j=0;j<MX;j++){
      nx[j]=max(nx[j],dp[j]);
    }
    swap(dp,nx);
    for(auto &I:nx){I=-1*MOD;}
  }
  ll ans=0;
  for(auto &I:dp){ans=max(ans,I);}
  cout<<ans<<endl;
  
  
  return 0;
}



Measured memory_bytes: 3252
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int maxn = 1005;
int main()
{
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int a,b,ans=1,cnt=0;
	cin>>a>>b;
	while(ans<b)
	{
		ans+=a-1;
		cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
selector = 0
count = 1
A = [int(i) for i in input().split()]
pre_num = A[0]
for num in A[1:]:
    if selector == 0:
        selector = num - pre_num
    if selector > 0:
        if num < pre_num:
            selector = 0
            count += 1
    if selector < 0:
        if num > pre_num:
            selector = 0
            count += 1
    pre_num = num
print(count)

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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    vector<vector<ll>> edge(N, vector<ll>(N, 0));
    REP(_, N) {
        ll n, k;
        cin >> n >> k;
        n--;
        REP(__, k) {
            ll v;
            cin >> v;
            v--;
            edge[n][v]++;
        }
    }

    REP(i, N) {
        REP(j, N) {
            cout << edge[i][j];
            if (j < N - 1)
                cout << " ";
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3220
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>

using namespace std;

#define MAX 1000001

vector<int> vprimes;
bool *isPrime = new bool[MAX];

void MakePrime(){
  isPrime[0]=false;
  isPrime[1]=false;
  isPrime[2]=true;
  for(int i = 2; i < MAX; ++i){
    isPrime[i] = true;
  }
  for(long long int i = 2; i < MAX; ++i){
    if( isPrime[i] ){
      for(long long int j = 2; i * j < MAX; ++j) {
	isPrime[i*j] = false;
      }
    }
  }
  for(int i = 0; i < MAX; ++i){
    if( isPrime[i] ){
      vprimes.push_back( i );
    }
  }
}

int main()
{
  MakePrime();
  while(true){
    int n,x;
    int ans = 0;
    vector<int> menu;
    cin >> n >> x;
    if( n == 0 && x == 0 )break;
    int dp[1+x];
    for(int i = 0; i < n; ++i){
      int v;
      cin >> v;
      menu.push_back( v );
    }

    fill(dp,dp+1+x,0);
    dp[0]=1;
    for(int i = 0; i < 1+x; ++i){
      if( dp[i] ){
	//cout << i << endl;
	for(int k = 0; k < menu.size(); ++k){
	  if( i + menu[k] < 1+x ){

	    dp[ i + menu[k] ] = 1;
	  }
	}
      }
    }
    for(int i = x; i>=0; --i){
      if( dp[i] && isPrime[i] ){
	ans = max(ans, i);
	break;
      }
    }
    if( ans ==0 ){
      cout << "NA" << endl;
    }else{
      cout << ans << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 6232
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<ll,ll> P;
#define fi first
#define se second
#define all(v) (v).begin(),v.end()
const ll inf=(1e18);
const ll mod=1000000007;
const ll mod2=998244353;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
string s;
cin>>s;
char now=s[0];
int ans=s.size();
int n=s.size();
for(int i=1;i<s.size();i++){
  if(s[i]!=now){
      ans=min(ans,max(i,n-i));
      now=s[i];
  }
}
cout<<ans<<endl;
}

Measured memory_bytes: 512
using System;
using System.IO;
using System.Collections.Generic;

namespace _134
{
    class Program
    {
        static void Main(string[] args)
        {
            //Console.SetIn(new StreamReader("input.txt"));
            solve_134();
        }

        public static void solve_134()
        {
            int r = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine(3 * r * r);
        }
    }
}


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

using namespace std;

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

	if (s.at(0) != 'A'){
		cout << "WA" << endl;
		return 0;
	}

	int Ccount = 0;

	for (int i=1; i<s.size(); i++){
		if ((s.at(i) == 'C') && (i>=2) && (i<=s.size()-2)){
			Ccount++ ;
		}else if (isupper(s.at(i))){
			cout << "WA" << endl;
			return 0;
		}
	}

	if (Ccount == 1){
		cout << "AC" << endl;
		return 0;
	}else{
		cout << "WA" << endl;
		return 0;
	}

}

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

int main() {
    int K;
    cin >> K;
    long long res = 0;
    for(int i = 1; i<=K; i++) {
        for(int j = 1; j<=K; j++) {
            for(int z = 1; z<=K; z++) {
                res += __gcd(__gcd(i, j), z);
            }
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 3608
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <utility>
#include <map>
#define maxn 100005
using namespace std;
typedef long long ll;
const int LEN = 100000;

struct fastio{
  char s[LEN + 5]; int len,it;
  fastio(){
    it = len = 0;
  }
  char get(){
    if(it < len) return s[it++];
    it = 0, len = fread(s,1,LEN,stdin);
    return len ? s[it++] : EOF;
  }
  bool notend(){
    char c;
    for(c = get();c == ' ' || c == '\n';c = get());
    if(it) it--;
    return c != EOF;
  }
  void put(char c){
    if(len == LEN) fwrite(s,1,LEN,stdout), len = 0;
    s[len++] = c;
  }
  void flush(){
    fwrite(s,1,len,stdout);
    len = 0;
  }
}buff,bufo;
inline ll getll(){
  char c; ll res = 0, sig = 1;
  for(c = buff.get();c < '0' || c > '9';c = buff.get()) if(c == '-') sig = -1;
  for(;c >= '0' && c <= '9';c = buff.get())
    res = (res << 3) + (res << 1) + (c - '0');
  return sig * res;
}
inline int getint(){
  char c; int res = 0, sig = 1;
  for(c = buff.get();c < '0' || c > '9';c = buff.get()) if(c == '-') sig = -1;
  for(;c >= '0' && c <= '9';c = buff.get())
    res = (res << 3) + (res << 1) + (c - '0');
  return sig * res;
}
inline void putll(ll x){
  if(!x) bufo.put('0');
  else if(x < 0) bufo.put('-'), x = -x;
  char s[25]; int k = 0;
  while(x){
    s[++k] = x % 10 + '0';
    x /= 10;
  }
  for(int i = k;i >= 1;i--) bufo.put(s[i]);
}
inline void putint(int x){
  if(!x) bufo.put('0');
  else if(x < 0) bufo.put('-'), x = -x;
  char s[15]; int k = 0;
  while(x){
    s[++k] = x % 10 + '0';
    x /= 10;
  }
  for(int i = k;i >= 1;i--) bufo.put(s[i]);
}
int n,a[maxn],b[maxn];
vector <int> as;
map <int,int> cnt;
int main(){
  n = getint();
  for(int i = 0;i < n;i++){
    a[i] = getint();
    as.push_back(a[i]);
    cnt[a[i]]++;
  }
  sort(as.begin(),as.end());
  as.erase(unique(as.begin(),as.end()),as.end());
  if(as.size() > 3){
    puts("No");
    return 0;
  }
  if(as.size() == 1){
    if(a[0] == 0) puts("Yes");
    else puts("No");
    return 0;
  }
  b[0] = a[0];
  cnt[b[0]]--;
  for(int i = 0;i < (int)as.size();i++){
    bool okk = true;
    b[1] = as[i];
    cnt[b[1]]--;
    for(int i = 2;i < n;i++){
      b[i] = b[i - 1] ^ b[i - 2];
      if(cnt.find(b[i]) == cnt.end() || cnt[b[i]] == 0){
        okk = false;
        break;
      }
      cnt[b[i]]--;
    }
    if(okk && b[0] == (b[n - 1] ^ b[n - 2]) && b[1] == (b[0] ^ b[n - 1])){
      puts("Yes");
      return 0;
    }
    cnt.clear();
    for(int i = 1;i < n;i++) cnt[a[i]]++;
  }
  puts("No");
  return 0;
}


Measured memory_bytes: 4600
#include <set>
#include <map>
#include <queue>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <bitset>
#include <vector>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
using namespace std;
typedef double db;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pa;
typedef unsigned int uint;
typedef unsigned long long ull;
#define w1 first
#define ls (x<<1)
#define w2 second
#define ins insert
#define rs (x<<1|1) 
#define mp make_pair
#define pb push_back
#define mid ((l+r)>>1)
#define sqr(x) ((x)*(x))
#define cle(x) ((x).clear())
#define lowbit(x) ((x)&(-x))
#define SZ(x) (int((x).size()))
#define ms(x,y) memset(x,y,sizeof (x))
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define rep2(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define per(i,a,b) for(int (i)=(a);(i)>=(b);(i)--)
#define Rep(p,x) for(int (p)=head[(x)];(p);(p)=nxt[(p)]) 
#define Rep2(p,x) for(int (p)=cur[(x)];(p);(p)=nxt[(p)])
#define debegin printf("debug\nbegin\n")
#define deend printf("debug\nend\n")
#define isfind printf("find\n")
template<class T>inline void rread(T&num){
	num=0;T f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')num=num*10+ch-'0',ch=getchar();
	num*=f;
}
inline int getgcd(int x,int y){if(!x)return y;return getgcd(y%x,x);}
inline int power(int x,int k,int p){int res=1;for(;k;k>>=1,x=(ll)x*x%p)if(k&1)res=(ll)res*x%p;return res;}
const double pi=acos(-1);
inline void judge(){
	freopen("input.txt","r",stdin);
} 
//********************************head*************************************
const int maxn=1e5+5;
int n,m,flag;
int val[maxn];
int main(){
	rread(n);rread(m);
	while(m--){
		int x,y;rread(x);rread(y);
		val[x]^=1;val[y]^=1;
	}
	rep(i,1,n)if(val[i])flag=1;
	if(flag)puts("NO");
	else puts("YES");
	return 0;
}

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

int main()
{
  long long K,N;
  cin >>K>>N;
  
  long long A[N];
  
  for(int i=0;i<N;i++){
  cin >>A[i];
  }
  
  int MaxLength=0;
  
  for(int i=0;i<N;i++){
  	int a1=A[i],a2;
    if(i+1>=N){a2=K+A[0];}
  	else{a2=A[i+1];}
    if(a2-a1>MaxLength){MaxLength=a2-a1;}
  }
  
  cout<<K-MaxLength<<endl;
  
}

Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int main(){
    int w,h,x,y,r = 0;
    cin >> w >> h >> x >> y >> r ;
    int left_point = x - r ;
    int right_point = x + r ;
    int up_point = y + r ;
    int down_point = y - r ;
    if (left_point >= 0 && right_point <= w){
        if (up_point <= h && down_point >= 0){
            cout << "Yes" << endl;
        } else {
            cout << "No" <<endl;
        }
    } else {cout << "No" << endl;}
}


Measured memory_bytes: 3116
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		SC sc = new SC(System.in);
		int N=sc.nextInt();
		int[] a=new int[N];
		int ans=0;
		for(int  i=0; i<N; i++) {
			a[i]=sc.nextInt();
		}
		for(int i=0; i<N-2; i++) {
			if(ok(a[i],a[i+1],a[i+2])) {
				ans++;
			}
		}
		pl(ans);
	}
	static boolean ok(int a,int b,int c) {
		int[] p= {a,b,c};
		Arrays.sort(p);
		if(p[1]==b) {
			return true;
		}
		else {
			return false;
		}
	}
	static class SC {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;
		public SC(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
		}
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new UncheckedIOException(e);
			}
		}
	}
	public static void pl(Object o) {
		System.out.println(o);
	}
	public static void pl() {
		System.out.println();
	}
	public static void p(Object o) {
		System.out.print(o);
	}
}

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

const int oo=-10;//优化：定义常量oo小于-8，给有雷的格子标注，这样的话无论下面怎样加也不会大于0
int n,m,a[52][52];
char c;

int main()
{
    cin>>n>>m;//读入
    for(int i=1;i<=n;i++)//从1开始，有0行0列作围墙
        for(int j=1;j<=m;j++)
        {
            cin>>c;//一个一个读入矩阵的各个字符
            if(c=='#')//如果有雷
            {
                a[i][j]=oo;//标注出雷格
                a[i-1][j-1]++;//以下八行给雷格的周围的所有格子的雷数加一
                a[i-1][j]++;
                a[i-1][j+1]++;
                a[i][j-1]++;
                a[i][j+1]++;
                a[i+1][j-1]++;
                a[i+1][j]++;
                a[i+1][j+1]++;
            }
        }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
            if(a[i][j]<0)cout<<"#";//标注的用处：如果小于0就是有雷的格子
            else cout<<a[i][j];//否则输出雷数
        cout<<endl;//省去了死亡换行的困扰
    }   
}

Measured memory_bytes: 384
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));

        }

        public void Solve(ConsoleInput cin)
        {
            var a = cin.ReadInt;
            int[] b = new int[a];
            var list = new List<int>();

            for (int i = 0; i < a; i++)
            {
                b[i] = cin.ReadInt;
                if (!(list.Contains(b[i])))
                {
                    list.Add(b[i]);
                }

            }
            WriteLine(list.Count());
            
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 13396
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<string>
using namespace std;

int main() {
	long long A, B, C, K;
	cin >> A >> B >> C >> K;
	long long res = 0;
	res += min(A, K);
	K -= min(A, K);
	K -= min(B, K);
	res -= min(C, K);
	cout << res;
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h> 
#define ll long long int
#define ld long double
#define DEBUG(x) cerr<<"> "<< #x << ':' <<x<<endl;
using namespace std;
ll INF = 1e15;
ll MOD = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ld a,b;
    cin>>a>>b;
    ll ans = a*b;
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 3744
#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <stack>
#include <climits>
#include <deque>
#include <bitset>
#include <cassert>
#include <ctime>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
const int dy[]={-1,0,1,0},dx[]={0,1,0,-1};
// adjust problem by problem
const double EPS=1e-8;
const double PI=acos(-1.0);
#ifdef __GNUC__
int popcount(int n){return __builtin_popcount(n);}
int popcount(ll n){return __builtin_popcountll(n);}
#endif
#ifndef __GNUC__
template<class T> int popcount(T n){int cnt=0;while(n){if(n%2)cnt++;n/=2;}return cnt;}
#endif
template<class T>int SIZE(T a){return a.size();}
template<class T>string IntToString(T num){string res;stringstream ss;ss<<num;return ss.str();}
template<class T>T StringToInt(string str){T res=0;for(int i=0;i<SIZE(str);i++)res=(res*10+str[i]-'0');return res;}
template<class T>T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template<class T>T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T> void PrintSeq(T &a,int sz){for(int i=0;i<sz;i++){cout<<a[i];if(sz==i+1)cout<<endl;else cout<<' ';}}
bool EQ(double a,double b){return abs(a-b)<EPS;}
void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}
vector<string> split(string str,char del){
  vector<string> res;
  for(int i=0,s=0;i<SIZE(str);i++){
    if(str[i]==del){if(i-s!=0)res.push_back(str.substr(s,i-s));s=i+1;}
    else if(i==SIZE(str)-1){res.push_back(str.substr(s));}
  }
  return res;
}

int N,D;
int T[201];
int A[201];
int B[201];
int C[201];

int dp[201][201];

int dfs(int pos,int prv){
  if(dp[pos][prv]>=0)return dp[pos][prv];
  if(pos==D)return 0;
  int res=0;
  if(pos==0){
    for(int i=0;i<N;i++){
      if(A[i]<=T[pos]&&T[pos]<=B[i]){
        res=max(res,dfs(pos+1,C[i]));
      }
    }
  }
  else{
    for(int i=0;i<N;i++){
      if(A[i]<=T[pos]&&T[pos]<=B[i]){
        res=max(res,dfs(pos+1,C[i])+abs(prv-C[i]));
      }
    }
  }
  return dp[pos][prv]=res;
}

int main(){

  cin>>D>>N;
  for(int i=0;i<D;i++)cin>>T[i];
  for(int i=0;i<N;i++)cin>>A[i]>>B[i]>>C[i];
  memset(dp,-1,sizeof(dp));
  cout<<dfs(0,0)<<endl;

  return 0;
}

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

int main() {
    int k, n; cin >> k >> n;
    int A[n+1];
    for (int i = 0; i < n; i++) cin >> A[i];
    A[n] = A[0] + k;
    int d[n+1];
    for (int i = 0; i < n + 1; i++) {
        d[i] = abs(A[i+1] - A[i]);
    }
    sort(d, d + n);
    int ans = 0;
    for (int i = 0; i < n - 1; i++) {
        ans += d[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <cmath>
#include <climits>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
int col[101][101];

int main(int argc, char const* argv[])
{
  int h, w;
  cin >> h >> w;
  int n;
  cin >> n;
  vector<int> a;
  for(int i = 0; i < n; i++){
    int x;
    cin >> x;
    a.pb(x);
  }
  int si = 0, sj = 0;
  int curr = 0;
  int sum = 0;
  while(si < h){
    col[si][sj] = curr + 1;
    sum++;
    if(a[curr] == sum){
      sum = 0;
      curr++;
    }
    if(si % 2 == 0){
      sj++;
      if(sj == w){
        si++;
        sj = w - 1;
      }
    }else{
      sj--;
      if(sj < 0){
        si++;
        sj = 0;
      }
    }
  }
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      cout << col[i][j];
      if(j != w - 1)cout << " ";
      else cout << endl;
    }
  }
	return 0;
}


Measured memory_bytes: 384
package main

import (
  "bufio"
  "container/heap"
  "fmt"
  "math"
  "os"
  "strconv"
  "strings"
)

const INF float64 = math.MaxFloat64

func main() {
  input := Input{bufio.NewReaderSize(os.Stdin,1000000)}
  xs,ys,xt,yt := input.Next4Float64s()
  n := input.NextInt()
  g := NewGraph(n+2)
  c := Circles{Circle{xs,ys,0},Circle{xt,yt,0}}
  for i:=0;i<n;i++ {
    x,y,r := input.Next3Float64s()
    c = append(c,Circle{x,y,r})
  }
  for i:=0;i<n+1;i++ {
    for j:=i+1;j<n+2;j++ {
      w := c[i].Cost(c[j])
      g.Add(i,j,w)
      g.Add(j,i,w)
    }
  }
  w := g.Dijkstra(0)
  fmt.Printf("%.12f\n",w[1])
}

type Circle struct { x,y,r float64 }
func(c Circle) Dist(o Circle) float64 {
  return math.Sqrt((c.x-o.x)*(c.x-o.x)+(c.y-o.y)*(c.y-o.y))
}
func(c Circle) Cost(o Circle) float64 {
  return math.Max(0,c.Dist(o)-(c.r+o.r))
}
type Circles []Circle

type Item struct { pos,idx int;cost float64 }
type PriorityQueue []*Item
func(pq PriorityQueue) Len() int { return len(pq) }
func(pq PriorityQueue) Less(i,j int) bool { return pq[i].cost < pq[j].cost }
func(pq PriorityQueue) Swap(i,j int) {
  pq[i],pq[j] = pq[j],pq[i]
  pq[i].idx,pq[j].idx = i,j
}
func(pq *PriorityQueue) Push(x interface{}) {
  n := len(*pq)
  item := x.(*Item)
  item.idx = n
  *pq = append(*pq,item)
}
func(pq *PriorityQueue) Pop() interface{} {
  old := *pq
  n := len(old)
  item := old[n-1]
  item.idx = -1
  *pq = old[0:n-1]
  return item
}

type Edge struct { to int;cost float64 }
type Graph [][]Edge
func NewGraph(n int) Graph { return make([][]Edge,n) }
func(g Graph) AddEdge(from int,e Edge) { g[from] = append(g[from],e) }
func(g Graph) Add(from,to int,cost float64) { g.AddEdge(from,Edge{to,cost}) }
func(g Graph) Dijkstra(start int) []float64 {
  n := len(g)
  c := make([]float64,n)
  for i:=0;i<n;i++ { c[i] = INF }
  var pq PriorityQueue
  heap.Init(&pq)
  heap.Push(&pq,&Item{pos:start,cost:0})
  c[start] = 0
  for pq.Len() > 0 {
    s := heap.Pop(&pq).(*Item)
    if s.cost > c[s.pos] { continue }
    for _, e := range g[s.pos] {
      if c[e.to] > s.cost+e.cost {
        c[e.to] = s.cost+e.cost
        heap.Push(&pq,&Item{pos:e.to,cost:c[e.to]})
      }
    }
  }
  return c
}

type Input struct { reader *bufio.Reader }
func(i *Input) NextLine() string {
  var buffer []byte
  for {
    line,isPrefix,err := i.reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer,line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func(i *Input) NextInt() int {
  n,_ := strconv.Atoi(i.NextLine())
  return n
}
func(i *Input) Next3Float64s() (float64,float64,float64) {
  s := strings.Split(i.NextLine()," ")
  x,_ := strconv.ParseFloat(s[0],64)
  y,_ := strconv.ParseFloat(s[1],64)
  z,_ := strconv.ParseFloat(s[2],64)
  return x,y,z
}
func(i *Input) Next4Float64s() (float64,float64,float64,float64) {
  s := strings.Split(i.NextLine()," ")
  x,_ := strconv.ParseFloat(s[0],64)
  y,_ := strconv.ParseFloat(s[1],64)
  z,_ := strconv.ParseFloat(s[2],64)
  w,_ := strconv.ParseFloat(s[3],64)
  return x,y,z,w
}

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

int main()
{
  int N;
  int D, X;
  cin >> N >> D >> X;
  int A[N];

  for (int i=0; i<N; i++) {
    cin >> A[i];
  }

  int sum = 0;
  sum += X;

  for (int i=0; i<N; i++) {
    for (int j=1; j <= D; j += A[i]) {
      sum++;
    }
  }
  //sum += N;

  cout << sum << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  int i,j,a,b;
  cin>>a;
  cin>>b;
  char arr[a];
  for(i=1;i<=a;i++)
  {
    cin>>arr[i];
  }
  arr[b]=arr[b]+32;
  for(j=1;j<=a;j++)
  {
    cout<<arr[j];
  }
}

Measured memory_bytes: 256
(defn input []
  (Integer/parseInt (read-line)))

(defn DigitSums [N]
  (let [Sn (->> N
             str
             (reduce #(+ %1 (Character/digit %2 10)) 0))]
    (if (zero? (rem N Sn))
      "Yes"
      "No")))

(-> (input)
  DigitSums
  println)

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

using namespace std;

int main(){
   ios_base::sync_with_stdio(false); cin.tie(NULL);
   int a, b;
   cin >> a >> b;

   if( a > 0 && b > 0 ) cout << "Positive\n";
   if( a <= 0 && b >= 0) cout << "Zero\n";
   if( a < 0 && b < 0 ){
      if( (b - a) % 2 == 0 ) cout << "Negative\n";
      else	cout << "Positive\n";
   }
   return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush
import collections
import bisect

def main():
    n = int(input())
    mod = 10**9+7

    ans = 1
    for i in range(n):
        ans *= i+1
        ans %= mod
    print(ans)


if __name__ == '__main__':
    main()


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

double calc(vector<int> y, vector<int> z)
{
    int sum = 0;
    for (int i = 0; i < y.size(); i++)
    {
        sum += (y[i] - z[i]) * (y[i] - z[i]);
    }
    return sqrt(double(sum));
}

int main()
{
    int N, D;
    cin >> N >> D;
    vector<vector<int>> X(N);
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < D; j++)
        {
            int x;
            cin >> x;
            X[i].push_back(x);
        }
    }
    int ans = 0;
    for (int i = 0; i < N - 1; i++)
    {
        for (int j = i + 1; j < N; j++)
        {
            double tmp_dist = calc(X[i], X[j]);
            double tmp_dist2 = double(floor(tmp_dist));
            if (tmp_dist == tmp_dist2)
            {
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

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

  int l = 0, r = s.size() - 1, ans = 0;
  while (l < r) {
    if (s[l] == s[r]) {
      l++, r--;
    } else if (s[l] == 'x') {
      l++; ans++;
    } else if (s[r] == 'x') {
      r--; ans++;
    } else {
      ans = -1;
      break;
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
#include<stdlib.h>
int asc(const void* a, const void* b)
{
	return *(int*)a - *(int*)b;
}
int main()

{
	int n, m;
	scanf("%d %d", &n, &m);
	int i;
	int x[100005];
	for (i = 0; i < m; i++)
		scanf("%d", &x[i]);
	if (m <= n)
	{
		printf("0\n");
		return 0;
	}
	qsort(x, m, sizeof(int), asc);
	if (n == 1)
	{
		printf("%d\n", x[m - 1] - x[0]);
		return 0;
	}
	int dx[100005];
	for (i = 0; i < m - 1; i++)
		dx[i] = x[i + 1] - x[i];
	qsort(dx, m - 1, sizeof(int), asc);
	int ans = x[m - 1] - x[0];
	for (i = 0; i < n - 1; i++)
		ans -= dx[m - 2 - i];
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1396
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    A = sorted([(a, i) for i, a in enumerate(A)], reverse=True)

    # dp[i][j] := A が大きい順に i + j 個について、i 個を左詰めして、j 個を右詰めしたときのスコア
    dp = [[0] * (N + 1) for _ in range(N + 1)]
    for i in range(N):
        j = 0
        while i+j < N:
            a, idx = A[i+j]
            # 左に詰める場合
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j] + (idx - i) * a)
            # 右に詰める場合
            dp[i][j+1] = max(dp[i][j+1], dp[i][j] + ((N-1-j) - idx) * a)
            j += 1
    ans = 0
    for i in range(N+1):
        ans = max(ans, dp[i][N-i])
    print(ans)


if __name__ == "__main__":
    resolve()

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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

template<class T,class U>bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U>bool chmin(T &a, const U &b){if(b<a){a=b;return 1;}return 0;}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,pii> ppii;

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

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

int main(){
    bool flag=false;
    ll ans=0,sum=0;

    int n;
    cin >>n;
    vector<int> a(n),b(n);
    vector<int> a_b(n);

    rep(i,n)cin>>a[i];
    rep(i,n)cin>>b[i];
    
    ll luck=0;
    rep(i,n){
        a_b[i]=a[i]-b[i];
        
        if(a[i]-b[i] < 0){
            ans++;
            luck+=a[i]-b[i];
        }
    }

    sort(all(a_b),greater<int>());

    rep(i,n+1){
        //db2(sum,luck);ln;
        if(sum + luck >= 0){
            flag=true;
            break;
        }

        if(a_b[i] < 0)break;

        if(i<n){
            sum +=a_b[i];
            ans++;
        }
    }

    //cout <<fixed<<setprecision(16)<< << endl;
    if(flag)cout<<ans<<endl;
    else puts("-1");
    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>
#include <numeric>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define MOD 1000000007 //10^9+7
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using PLL = pair<long long, long long>;
const int INF = numeric_limits<int>::max();
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

//greatest common divisor
long long gcd(ll a, ll b) 
{
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

//least common multiple
long long lcm(ll a, ll b)
{
    return a / gcd(a, b) * b ;
}

bool is_prime(ll n) {
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) return false;
    }
    return n != 1;
}

int main()
{
    int n; cin >> n;
    vector<ll> l(n);
    rep(i,n) cin >> l[i];
    sort(l.begin(), l.end());

    int ans = 0;
    for (int i = 0; i < n-2; i++) {
        for (int j = i+1; j < n-1; j++) {
            for (int k = j+1; k < n; k++) {
                if (l[i] == l[j] || l[j] == l[k] || l[k]==l[i])
                    continue;
                vector<ll> tmp(3);
                tmp[0] = l[i];
                tmp[1] = l[j];
                tmp[2] = l[k];
                sort(tmp.begin(), tmp.end());
                if (tmp[0] + tmp[1] > tmp[2])
                    ans++;
            }
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3628
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <vector>

using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    int count = 1;
    for (int i = 0; i < n - 1; i++)
    {
        if (s[i] != s[i + 1])
        {
            count++;
        }
    }
    cout << min(n - 1, n - count + 2 * k) << endl;
}


Measured memory_bytes: 512
import scala.io.{StdIn => in}

object Main extends App {
  val x = in.readInt
  def rec(acc:Int, b:Int, p:Int):Int = {
    if(b == 1) return acc
    val res = math.pow(b,p).toInt
    // println(res)
    if(res > x) acc
    else rec(res, b, p+1)
  }
  val ans = (1 to math.sqrt(x).toInt + 1)./:(1)( (acc, i) => {
    val y = rec(i, i, 2)
    if(y <= x) acc max y else acc
  })
  println(ans)
}

Measured memory_bytes: 25408
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        String[] days = new String[]{"thu", "fri", "sat","sun","mon", "tue", "wed"};
        System.out.println(days[x % 7]);
    }
}



Measured memory_bytes: 26352
#include <bits/stdc++.h>
#define ll long long
#define fast cin.tie(0);cout.tie(0);
#define order ios::sync_with_stdio(0);ios_base::sync_with_stdio(0);
using namespace std;
vector<ll>a,b;
int n,m,k,c,ans;
int main()
{
    fast order
    cin>>n>>m>>k;
    for(int i=0,x;i<n;i++)
    {
        cin>>x;
        a.push_back(x);
    }
    for(ll i=0,x;i<m;i++)
    {
        cin>>x;
        b.push_back(x);
        if(i)b[i]+=b[i-1];
    }
    a.push_back(1000000009);
    b.push_back(1000000009);
    ll sum=0;
    for(int i=0;i<=n;i++)
    {
        if(i)sum+=a[i-1];
        if(sum>k)break;
        int l=-1,r=m;
        while(r-l>1)
        {
            int mm=(l+r)/2;
            if(b[mm]<=k-sum)l=mm;
            else r=mm;
        }
        ans=max(ans,l+1+i);
    }
    cout<<ans;
}


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


#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define print(x) cout << x << endl;
typedef long long ll;

constexpr ll INF = 1'010'000'000'000'000'017LL;\
constexpr ll MOD = 1'000'000'007LL;\
constexpr double EPS = 1e-12;\
constexpr double PI = 3.14159265358979323846;

int main()
{
    string S;
    cin >> S;
    if (S == "AAA" || S == "BBB") {
        print("No");
    } else {
        print("Yes");
    }
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    char s;
    cin >> s;
    if (s == 'Y') {
      cout << "Four" << endl;
      return 0;
    }
  }
  cout << "Three" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define ull unsigned ll
#define pb push_back
#define popb pop_back
#define mt make_tuple
#define eb emplace_back
#define mp make_pair
#define ff first
#define ss second
#define pii pair <int,int>
#define piii pair <pii,int>
#define piiii pair <pii,pii>
#define plll pair <pair <ll, ll>, ll>
#define rep0(i,n) for(ll i=0;i<(ll)n;i++)
#define rep1(i,n) for(ll i=1;i<=(ll)n;i++)
#define rep(i,x,y) for(ll i=(ll)x;i<=(ll)y;i++)
#define reprev(i,n) for(ll i=(ll)n;i>=0;i--)
#define all(c) c.begin(),c.end()
#define print(a) rep0(i,a.size()) cout << a[i] << " "
#define hi() cout << "\nHello, I am error. Can you find me? :):):)\n"
#define Randomize mt19937 rng(chrono::steady_clock::now().time_since_eppoch().count())
 
using namespace __gnu_pbds;
using namespace std;
using ordered_set =  tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>;

const int mod = 1e9+9;
const long double pi = acos(-1);

// FOR DEBUGGING
vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}

void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", ";
	else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}

#ifndef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

ll power(ll x, ll y){
	x %= mod;
	ll ans = 1;
	while(y){
		if(y&1) ans = (ans*x)%mod;
		y /= 2;
		x = (x*x)%mod;
	}
	return ans;
}

void solve(){

	int n;
	cin >> n;
	set <string> s;
	string t;
	rep0(i,n){
		cin >> t;
		s.insert(t);
	}
	cout << s.size();

	return;
}

int main(){

	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);

	int TC = 1,t = 0;
	// cin >> TC;
	while(t++ < TC){
		// cout << "Case #" << t << ": ";
		solve();
		// cout << "\n";
	}

	cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";

	return 0; 
}

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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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; }

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;

char G[105][105];

void fail(){
  cout << "No" << endl;
  exit(0);
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll h,w; cin>>h>>w;
  
  rep(i,h) rep(j,w) cin>>G[i][j];
  map<char,ll> m;
  rep(i,h) rep(j,w) m[G[i][j]]++;
  
  map<ll,ll> mod4;
  for(auto e: m){
    mod4[e.second%4]++;
  }
  mod4[1]+=mod4[3];
  mod4[2]+=mod4[3];
  
  if(h%2==0 && w%2==0){
    if(mod4[1] || mod4[2]){
      
      fail();
    }
  }else if(h%2 && w%2){
    if(mod4[1]!=1 || mod4[2]>(h-1)/2+(w-1)/2){
      fail();
    }
  }else{
    if(w%2) swap(h,w);
    if(mod4[1] || mod4[2]>w/2){
      fail();
    }
  }
  
  cout<<"Yes"<<endl;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc018/tasks/abc018_4

#include <bits/stdc++.h>
using namespace std;
#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long
static const int MAX = 10000;
static const ll INFTY = 1e18;

struct edge {
    ll to, cost;
};

using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;
// 入力
// int H, W;
vector<vector<char>> field;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

// 深さ優先探索
vector<bool> seen;
vector<int> colors;

ll nC2(int n){
  return (ll)(n * (n-1) / 2);
}

int main() {

  int N;
  cin >> N;
  vector<string> _s(N);
  map<string, int> _m;
  REP(i, N){
    cin >> _s[i];
    sort(_s[i].begin(), _s[i].end());
    _m[_s[i]]++;
  }

  ll ans = 0;
    for (auto &p: _m) {
        int sc = p.second;
        ans += (ll)sc*(sc-1)/2;
    }
    cout << ans << endl;

}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/

Measured memory_bytes: 18176
N = int(input())
x = N
y = N
ansx = N
ansy = N
ans = []
n = int(N**0.5)
if N**0.5 == int(N**0.5):
    print(int(N**0.5)*2-2)
else:
    for i in range(n+1):
        if N%(i+1) == 0:
            ans.append(i+1)
    ans.append(N)
    if(ans[1]==N):
        print(N-1)
    else:
        for i in range(len(ans)):
            if ansx+ansy>ans[i] + int(N//ans[i]):
                ansx = ans[i]
                ansy =int(N//ans[i])
        print(ansx + ansy -2)

Measured memory_bytes: 3188
//In The Name Of Godd
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<string> vs;
typedef pair<ll, ll> ii;
typedef pair<int, ii> iii;
typedef pair<double, double> dd;
typedef pair<dd, double> ddd;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<dd> vdd;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vii> vvii;

#define forn(i, n) for (ll i = 0; i < n; i++)
#define all(a) (a).begin(), (a).end()
#define inf 100000000000
#define eps 1e-9
const int maxw = 2e5, maxn = 101;
ll dp[maxn][maxw];
ll ww[maxn], v[maxn];

int main() {
  ll n, w; cin >> n >> w;
  forn(i, n) cin >> ww[i] >> v[i];
  // forn(i, maxn) forn(j, maxw) dp[i][j] = -inf;
  // forn(i, maxw) dp[0][i] = 0LL;
  forn(i, n + 1) if(i) {
    for(ll j = 0; j <= w; j++){
      dp[i][j] = dp[i - 1][j];
      if(j >= ww[i - 1]) dp[i][j] = max(dp[i - 1][j - ww[i - 1]] + v[i - 1], dp[i][j]);
    }
  }
  ll ans = -inf;
  forn(i, maxw) ans = max(ans, dp[n][i]);
  cout << ans << endl;

}


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

using namespace std;
struct mm
{
    char s[21];
    int k;
    int q;
}a[101];
int cmp(mm c,mm b)
{
    if(strcmp(c.s,b.s)!=0)
    {
        if(strcmp(c.s,b.s)>0)
        return 0;
        else return 1;
    }
    else
        return c.k>b.k;
}
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i].s>>a[i].k;
        a[i].q=i;
    }
    sort(a+1,a+1+n,cmp);
    for(int i=1;i<=n;i++)
        cout<<a[i].q<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
typedef vector<string> vstring;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
const double PI=3.14159265358979323846;
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll n,c,k;
  cin>>n>>c>>k;
  vint t(n);
  rep(i,n){
    cin>>t[i];
  }
  sort(all(t));
  ll count=0,fg=0;
  ll time,pe=0;
  time=k;
  count++;
  pe++;
  REP(i,1,n){
    time-=t[i]-t[i-1];
    pe++;
    if(time<0){
      count++;
      time=k;
      pe=1;
    }
    if(pe>c){
      count++;
      time=k;
      pe=1;
    }
  }
  cout<<count<<'\n';
  return(0);
}


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

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

using namespace std;

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

int main(){
    int x;
    cin >> x;
    for (int i=x; ; i++) {
        if (is_prime(i)) {
            cout << i << endl;
            break;
        }
    }

    return 0;
}



Measured memory_bytes: 256