akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<deque>
#include<vector>
#include<map>
#include<iterator>
#include<utility>
#include<algorithm>
#include<bitset>
#include<set>




using namespace std;

typedef long long ll;

int main() {

	int n; cin >> n;
	vector<ll>camels(n);
	set<int>xo;
	for (int i = 0; i < n; i++) {
		ll j; cin >> j;
		camels[i] = j;
		xo.insert(j);
	}
	bool b = true;
	
	sort(camels.begin(), camels.end());
	if (n % 3 == 0) {

		if ((camels[0] != camels[n / 3 - 1]) || (camels[n / 3] != camels[2 * n / 3 - 1]) || (camels[2 * n / 3] != camels[n - 1])) {
			b = false;
		}




		if (xo.size() == 1) {
			if (camels[0] == 0) {
				cout << "Yes";
			}
			else {
				cout << "No";
			}
		}
		else if (xo.size() == 2 && b) {
			ll num = 0;
			for (int i = 0; i < camels.size(); i++) {
				if (camels[i] == 0) {
					num++;
				}
			}
			if (num == n / 3) {
				cout << "Yes";
			}
			else {
				cout << "No";
			}
		}
		else if (xo.size() == 3 && b) {
			bool ans = true; ll c = 0;

			for (auto itr = xo.begin(); itr != xo.end(); itr++) {
				c = c ^ *itr;
			}
			if (c != 0) {
				ans = false;
			}



			if (ans) {
				cout << "Yes";
			}
			else {
				cout << "No";
			}
		}
		else {
			cout << "No";
		}
	}

	else {
		if (xo.size() == 1) {
			if (camels[0] == 0) {
				cout << "Yes";
			}
		}
		else {
			cout << "No";
		}
	}
	

}



Measured memory_bytes: 4480
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <cstdio>
#include <string>
#include <vector>
using namespace std;

int main() {
    const string Yes = "Yes";
    const string No = "No";

    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);

    vector<int> v;
    v.push_back(a);
    v.push_back(b);
    v.push_back(c);

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

    if (v[2] == v[0] + v[1]) printf("%s\n", Yes.c_str());
    else printf("%s\n", No.c_str());

    return 0;
}


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

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

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}
int Madd(int x,int y) {return (x+y)%M;}
int Msub(int x,int y) {return (x-y+M)%M;}
int Mmul(int x,int y) {return (x*y)%M;}


signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);

  int a,b,c;
  cin>>a>>b>>c;
  cout<<min(b/a,c)<<endl;


}

Measured memory_bytes: 256
#include<iostream> 
#include<string>
using namespace std;
int main()
{string S,T,str;
char c;
int i;
cin>>S;
cin>>T;
for(i=0;i<S.length();i++)
{str=S.substr(0,S.size()-1);
c=S[S.size()-1];
S[0]=c;
S.replace(1,S.size()-1,str);
if(S==T) 
{cout<<"Yes"<<endl;
return 0;}
 } 
 cout<<"No"<<endl;
 return 0;
}
 

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

//const long double pi = 3.14159265358979323846;
#define pi 3.14159265358979323846264338327950L

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    long double a, b, h, m;
    cin >> a >> b >> h >> m;

    long double ang = 0;
    long double ang_hr = 0;
    long double ang_min = 0;

    ang_hr = 30*(h+((long double)m/60));
    ang_min = 6*m;
    ang = (long double)abs(ang_hr - ang_min);

    if(ang > 180) ang = (long double) (360 - ang);
    // The above line is giving wrong output because it's my fault

    long double ans = 0;

    ans = (long double)(a*a + b*b);
    ans= (long double)ans - (long double)(2*a*b*cosl((long double)(ang*pi)/180));
    //ans= (long double)ans - (long double)(2*a*b*cosl((long double)(ang*pi)/(long double)180));

    cout << fixed << setprecision(20) << sqrtl(ans) << endl;
    return 0;
}



Measured memory_bytes: 4140
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
// Union Find

template<typename T>
struct UnionFind
{
	vector<T> par;
	vector<T> rank;
	vector<T> sizes;
	UnionFind(T n):par(n),rank(n,0),sizes(n,1){
	   for(T i=0;i<n;i++){
	     par[i]=i;
	   }
	}
	T root(T x){
	  return par[x]==x?x:par[x]=root(par[x]);
	}

	bool unite(T x,T y){
	  if(x==y) return false;
	  x=root(x); y=root(y);
	  if(x==y) return false;
	  if(rank[x]<rank[y]) swap(x,y);
	  if(rank[x]==rank[y]) rank[x]++;
	  par[y]=x;
	  sizes[x]=sizes[x]+sizes[y];
	  return true;
	}
	bool same(T x,T y){
	  return root(x)==root(y);
	}
	T size(T x){
	  return sizes[root(x)];
	}
};
int main(){
  ll n,m;
  cin>>n>>m;
  UnionFind<ll> uf(n+1);
  rep(i,m){
    ll x,y,z;
    cin>>x>>y>>z;
    uf.unite(x,y);
  }
  set<ll> ans;
  for(int i=1;i<=n;i++){
    ans.insert(uf.root(i));
  }
  COUT(sz(ans));
}


Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pll = pair<ll, ll>;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define Rep(i, m, n) for(ll i = m; i < n; i++)
#define all(vec) vec.begin(), vec.end()
#define tmax(x, y, z) max((x), max((y), (z)))
#define tmin(x, y, z) min((x), min((y), (z)))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define ZERO(a) memset(a, 0, sizeof(a))
const ll INF = 1LL << 60;
const ll MM = 1000000000; const ll MOD = MM + 7; const ll MMM=9223372036854775807;//2^63 -1
#define ADD(a,b) a = (a + ll(b)) % MOD
#define MUL(a,b) a = (a * ll(b)) % MOD
ll GCD(ll x, ll y){ if(y == 0) return x; else return GCD(y, x % y);}
ll LCM(ll x, ll y){ return x / GCD(x, y) * y;}
template<class T> inline bool chmin(T& a, T b){ if(a > b){ a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b){ if(a < b){ a = b; return true;} return false;}
template<typename A, size_t N, typename T> void FILL(A (&array)[N], const T &val){ fill( (T*)array, (T*)(array+N), val );}
// struct edge{ ll from, to, cost; };
// struct edge{ ll to, cost; };
// using Graph = vector<vector<ll>>;  // 重み無し
// using Graph = vector<edge>;  // 辺
// using Graph = vector<vector<edge>>;  // 重み付き
ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
ll ddx[8] = {1, 1, 0, -1, -1, -1, 0, 1}, ddy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//cout << fixed << setprecision(10);

int main(){
    ll n, k, ans = 0; cin >> n >> k;
    map<ll, ll> mp;
    rep(i, n){
        ll a; cin >> a;
        mp[a]++;
    }
    priority_queue<pll, vector<pll>, greater<pll>> pq;
    for(auto p: mp){
        pq.push(pll(p.second, p.first));
    }
    while(pq.size() > k){
        pll p = pq.top(); pq.pop();
        ans += p.first;
    }
    cout << ans << endl;
}


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

#define int long long int
#define rep(a,b,c) for(int a=b;a<c;a++)
#define repm(a,b,c) for(int a=(b-1);a>=c;a--)
#define pb push_back
#define str string
#define sf(a) scanfs("%d",&a)
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()

using namespace std;

const int INF = 1e18 + 9;
const int Mod = 1e9 + 7;
inline int replac(str s){double ans=0;rep(i,0,s.length()){ans+=(s[i]-'0')*pow(10,s.length()-i-1);}return (int)ans;}
inline string numstr(int m){str s="";while(m>0){char c;int a=m/10;if(a>0)a=m%(a*10);else a=m;c=(char)('0'+a);s+=c;m/=10;}str st="";for(int i=s.size()-1;i>=0;i--){st+=s[i];}return st;}
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vii;

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    int m[100005];
    bool mm[100005];
    cin >> n ;
    rep(i,0,n){
        cin >> mm[i];
    }
    mm[n]=2;
    int mae=0;
    vector<int> u;
    u.pb(0);
    rep(i,0,n){
        if(mm[i]==mm[i-1]){
            u.pb(mae);
            mae=0;
        }
        mae++;
    }
    u.pb(mae);
    u.pb(0);
    int ans=0;
    //for(int v: u)cout << v << " ";
    rep(i,0,u.size()-2){
        ans=max(ans,u[i]+u[i+1]+u[i+2]);
    }
    cout << ans << endl;
    return 0;
}

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

string s;

bool f(char c) {
  return s.find(c) != string::npos;
}

int main() {
  cin >> s;
  if ((f('N') && !f('S')) || (f('S') && !f('N')) || (f('E')&&!f('W')) || (f('W')&&!f('E'))) cout << "No\n";
  else cout << "Yes\n";
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <sstream>
#include <map>
#include<vector>

using namespace std;
typedef long long ll;

ll ans,mx,sum,mn=1e8,cnt;


int main(){
	long int a;
	cin>>a;
	float b;
	cin>>b;
	ll x=b*100;
	cout<<(a*x)/100;
}


Measured memory_bytes: 3684
#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<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
#define int long long
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const int INF=100000000000000000;

signed main(){
	int N;
	int num[30]={};
	int mod=1e9+7;
	string S;
	int seki=1;
	cin>>N>>S;
	REP(i,S.size()){
		num[S[i]-'a']++;
	}
	REP(i,26){
		seki*=(num[i]+1);
		seki%=mod;
	}
	seki--;
	cout<<seki%mod<<endl;
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#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 INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
 
//const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};
 
int main()
{
	while (1){
		int n;
		cin >> n;
		if (!n) return 0;
		int sum = 0, tmp;
		REP(i, 9){
			cin >> tmp;
			sum += tmp;
		}
		cout << n - sum << endl;
	}
}
	


Measured memory_bytes: 3084
//*******Abhijit Burman***********// 
//Jalpaiguri Government Engineering College/ 

#include<bits/stdc++.h> 
using namespace std; 
#define ll long long int 
#define pb push_back 
#define mk make_pair 
#define MAXX (1000000000000000000+7)
#define mod 1000000007
#define fio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL) 

// ll powermod(ll base, ll exp, ll mod) 
// {
// 	ll result = 1;
// 	while (exp != 0) 
// 	{
// 		if ((exp % 2) == 1) 
// 		{
// 			result = (result * base) % mod;
// 		}
// 		base = (base * base) % mod;
// 		exp /= 2;
// 	}
// 	return result;
// }
map<ll,ll> visited;
// void bfs( vector<ll> adj[], ll node)
// {
//     map<ll,ll> mp;
//     queue<ll> q;
    
//     //strating node
//     q.push(node);
//     mp[node]=1;
//     while(!q.empty())
//     {
//         ll temp = q.front();
//         q.pop();
//         for(int i=0;i<adj[temp].size();i++)
//         {
//             if(mp[adj[temp][i]]==0)
//             {
//                 q.push(adj[temp][i]);
//                 mp[adj[temp][i]]=1;
//             }
//         }
//         cout<<temp<<" ";
        
//     }
//     cout<<endl;
// }
// void dfs(vector<ll> adj[],ll node)
// {
// 
//     visited[node] = 1;
//     for(int i=0;i<adj[node].size();i++)
//     {
//         if(visited[adj[node][i]]==0)
//         {
//             dfs(adj,adj[node][i]);
//         }
//     }
// }

ll firstDivisior(ll n){
    for(int i=2;i*i<=n;i++)
    {
        if(n%i==0)
        {
            return i;
        }
    }
    return n;
    
}
bool isPallindrom(string s){
    ll i=0,j=s.size()-1;
    while(i<=j){
        if(s[i]==s[j]){
            i++;
            j--;
        }
        else{
            return false;
        }
    }
    return true;
}
void solve()
{
    ll n;
    cin>>n;
    set<string> st;
    string s[n];
    for(int i=0;i<n;i++){
        cin>>s[i];
        st.insert(s[i]);
    }
    cout<<st.size()<<endl;
    

}

int main()
{
    fio;
    int tt=1;
    // cin>>tt;
    while(tt--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 25500
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
vector<l_l> v;
ll N;
int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    v.resize(N);
    for(int i = 0; i < N; i++) {
        cin >> v[i].second >> v[i].first;
    }
    sort(v.begin(), v.end());
    ll now = 0;
    for(int i = 0; i < v.size(); i++) {
        now += v[i].second;
        if(now > v[i].first) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


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

#define  ll long long
#define  il inline
#define INF 0x3f3f3f3f
#define pii pair<int,int>

const int mod = 1e9 + 7;
const int maxn = 1e6 + 5;
const int maxm = 2e5 + 10;
const double PI = acos(-1.0);

struct Node{
    int x,y;
}node[55];

map<int,map<int,int>> vis , cur;
//int cur[55][55];
int res = 1e5;

void dfs(int x, int y,int p, int q){
    int xx = x + p, yy = y + q;
    if(!vis[xx][yy] && cur[xx][yy]){
        vis[xx][yy] = 1;
        dfs(xx,yy,p,q);
    }
    xx = x - p, yy = y - q;
    if(!vis[xx][yy] && cur[xx][yy]){
        vis[xx][yy] = 1;
        dfs(xx,yy,p,q);
    }
}

int main()
{
    ios::sync_with_stdio(false);cin.tie(0);
    int n;  cin >> n;
    for(int i = 0; i < n; i++) {
            cin >> node[i].x >> node[i].y;
            cur[node[i].x][node[i].y]++;
    }
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if(j == i) continue;
            for(int k = 0; k < n; k++){
                 int x3 = node[k].x , y3 = node[k].y;
                 vis[x3][y3] = 0;
            }
            int ans = 0;
            int x1 = node[i].x , x2 = node[j].x , y1 = node[i].y, y2 = node[j].y;
            int p = x1 - x2, q = y1 - y2;
             for(int k = 0; k < n; k++){
                 int x3 = node[k].x , y3 = node[k].y;
                 if(!vis[x3][y3]){
                        vis[x3][y3] = 1;
                        dfs(x3, y3,p ,q);
                        ans++;
                 }
             }
            res = min(ans,res);
        }
    }
    if(n == 1) res = 1;
    cout << res << endl;
    return 0;

}


Measured memory_bytes: 17536
#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);
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int k;
cin>>k;
vector<ll> a(k);
for(int i=0;i<k;i++)cin>>a[i];
ll mi=2,ma=2;
for(int i=k-1;i>=0;i--){
     if(ma/a[i]==(mi-1)/a[i]){
         cout<<-1<<endl;
         return 0;
     }
     ma=(ma/a[i]+1)*a[i]-1;
     mi=((mi+a[i]-1)/a[i])*a[i];
}
cout<<mi<<" "<<ma<<endl;
}

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

int main () {
  int N, x;
  cin >> N;
  vector<int> a(N);
  
  for(int i=0;i<N;i++) {
    cin >> a.at(i);
  }
  
  x=a.at(0);
  
  for(int j=0;j<N;j++) {
    
    if(x==2) {
      cout << j+1 << endl;
      break;
    }
    if(j==N-1&&x!=2) {
      cout << -1 << endl;
    }
    
    x=a.at(x-1);
  }
}

Measured memory_bytes: 640
#include <fstream>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <sstream>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <cmath>
#include <queue>
#include <random>
#include <numeric>

using namespace std;

#define INT_MAX_VALUE 2147483647
#define LONG_LONG_MAX_VALUE 9223372036854775807
#define ll long long
#define ld long double

struct XX{
    int a;
    int b;
    int c;
    int i;
};

class xxGreater {
public:
    bool operator()(const XX& riLeft, const XX& riRight) const {
        //第2条件
        if((riLeft.c) == (riRight.c)){
            return riLeft.a < riRight.a;//<:昇順(小さいものから順番)、>:降順(大きいものから順番)
            //プライオリティキューの場合は > で、top()すると値の小さいものがとれる
        }
        //第1条件
        return (riLeft.c) > (riRight.c);
    }
};


//map<long long,long long> prime_f(long long n){
//    map<long long,long long>res;
//    for(int i=2;i*i<=n;i++){
//        while(n%i==0){
//            ++res[i];
//            n/=i;
//        }
//    }
//    if(n!=1)res[n]=1;
//    return res;
//}

//int n;
////int dat[2*10000000];
////int dat2[2*10000000];
//int dat[10];
//int dat2[10];
//
//void init(int n_){
//    n=1;
//    while(n<n_)n*=2;
//    for(int i=0;i<2*n-1;i++){
//        dat[i]=0;
//        dat2[i]=0;
//    }
//}
//
//void initset(int k,int a){
//    k+=n-1;
//    dat[k]=a;
//    while(k>0){
//        k=(k-1)/2;
//        dat[k]=dat[k*2+1]+dat[k*2+2];
//    }
//}
//
////[a,b)の間を[l,r]区間で比較しアップデート
////引数のindexに注意
////nは固定。initで計算すみ
////update2(L[i],R[i]+1,0,0,n,D[i]);
//void update2(int a,int b,int k,int l,int r,int v){//v更新値、区間は0-index
//    if(r<=a || b<=l)return;
//    if(a<=l && r<=b){
//        dat[k]+=dat2[k];
//        if(r-l>1){
//            dat2[k*2+1]+=dat2[k]/2;
//            dat2[k*2+1]+=dat2[k]/2;
//        }
//        dat2[k]=v*(r-l);
//        return;
//    }else{
//        update2(a,b,k*2+1,l,(l+r)/2,v);
//        update2(a,b,k*2+2,(l+r)/2,r,v);
//        return;
//    }
//}
//
//int query(int a,int b,int k,int l,int r){
//    if(r<=a || b<=l)return 0;
//    if(a<=l && r<=b){
//        dat[k]+=dat2[k];
//        if(r-l>1){
//            dat2[k*2+1]+=dat2[k]/2;
//            dat2[k*2+1]+=dat2[k]/2;
//        }
//        dat2[k]=0;
//        return dat[k];
//    }
//    else{
//        int vl=query(a,b,k*2+1,l,(l+r)/2);
//        int vr=query(a,b,k*2+2,(l+r)/2,r);
//        return vl+vr;
//    }
//}




int main(int argc, const char * argv[])
{
    //scanf("%s",S);
    //scanf("%d",&N);
    //scanf("%lld %lld",&target1,&target2);
    //sscanf(tmp.c_str(),"%dd%d%d",&time[i], &dice[i], &z[i]);
    //getline(cin, target);
    //ifstream ifs("3.txt");//テスト用
    //ifs >> a;
    //ここから
    
    //入力高速化
    ios::sync_with_stdio(false);
    cin.tie(0);

    int A,P;
    cin>>A>>P;
    cout << (A*3+P)/2<<endl;

    
    //ここまで
    //cout << "ans" << endl;
    //printf("%.0f\n",ans);//小数点以下表示なし
    //printf("%.7f\n",p);
    
    return 0;
}


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

int main(){
  int l,r,d;
  cin >> l >> r >> d;
  int ans = 0;
  for (int i = l; i < r + 1; i++){
    if(i % d == 0) ans +=1;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>

using namespace std;

int main(void) {
    char a, b;
    bool t[3] = {true, false, false};
    while (true) {
        cin >> a;
        cin.ignore();
        cin >> b;
        if (cin.eof()) break;
        swap(t[int(a - 'A')], t[int(b - 'A')]);
    }
    for (int i = 0; i < 3; i++) {
        if (t[i]) {
            cout << char('A' + i) << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 1132
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
int main()
{
	int N,A,B;
	int t;
	int num = 0;
	int i;
 
	scanf("%d %d %d", &N, &A, &B);
 
	for (i = 0; i < N; i++)
	{
		std::cin >> t;
		if(t < A || t >= B)
		{
			++num;
		}
	}
 
	printf("%d\n", num);
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<math.h>
using namespace std;
double x[32];
double y[32];
double z[32];
int main(){
	int a;
	while(scanf("%d",&a),a){
		for(int i=0;i<a;i++)scanf("%lf%lf%lf",x+i,y+i,z+i);
		double nx=50;
		double ny=50;
		double nz=50;
		double res=9999999;
		double mv=10;
		for(int i=0;i<10000;i++){
			double r=0;
			int at=0;
			for(int j=0;j<a;j++){
				if(r<sqrt((x[j]-nx)*(x[j]-nx)+(y[j]-ny)*(y[j]-ny)+(z[j]-nz)*(z[j]-nz))){
					at=j;
					r=sqrt((x[j]-nx)*(x[j]-nx)+(y[j]-ny)*(y[j]-ny)+(z[j]-nz)*(z[j]-nz));
				}
			}
			if(r<res){
				res=r;
			}
			nx+=(x[at]-nx)*mv;
			ny+=(y[at]-ny)*mv;
			nz+=(z[at]-nz)*mv;
			
			if(i%100==0)mv/=2;
		}
		printf("%.5f\n",res);
	}
}

Measured memory_bytes: 1096
#include <iostream>
#include <iomanip>
#include <stdio.h>
using namespace std;

int main()
{
	int a, b, c;
	int temp;
	
	cin >> a >> b >> c;
	
	if(c < b){
		temp = c;
		c = b;
		b = temp;
	}
	if(b < a){
		temp = b;
		b = a;
		a = temp;
	}
	if (c < b){
		temp = c;
		c = b;
		b = temp;
	}
	
	printf("%d %d %d\n", a, b, c);
	
	return 0;
}



Measured memory_bytes: 3144
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int input = sc.nextInt();
		int[] arr = new int[input];
		long output = 0;
		for(int i = 0;i<input;i++)arr[i]=sc.nextInt();
		for(int i = 0;i<input;i++) {
			for(int j =i+1;j<input;j++) {
				output += arr[i]*arr[j];
			}
		}
		System.out.println(output);
	}	

}


Measured memory_bytes: 22868
N,A,B = map(int,input().split())
if A == 0:
    print(A)
    exit()
n = N // (A + B)
nn = N % (A + B)
if n != 0 and nn <= A:
    print(int(A*n + nn))
elif n != 0 and nn > A:
    print(int(A*(n+1)))
elif n == 0 and N >= A:
    print(A)
elif n == 0 and N < A:
    print(N)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int n,a;
    cin>>n>>a;
    int m=n*n;
    cout<<m-a<<endl;

    return 0;
}


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

int main() {
    int N, X;
    cin >> N >> X;
    int m;
    int min = 10000;
    for(int i = 0; i < N; ++i) {
        cin >> m;
        if(m < min) min = m;
        X -= m;
    }
    cout << N + X / min << endl;
    
}

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

using namespace std;

int main()
{
	string s, t;
	cin >> s >> t;
	for (int i = 0 ; i < s.size() ; ++ i)
	 if (s[i] ^ t[i])
	  {
	  	puts("No");
	  	return 0;
	  }
	puts("Yes");
	return 0;
}

Measured memory_bytes: 3628
n = gets.to_i
s = gets.chomp

r = 0
g = 0
b = 0
count = 0
n.times do |i|
    c = s[i]
    if c == "R"
        r += 1
    elsif c == "G"
        g += 1
    else
        b += 1
    end

    [i, n-i-1].min.times do |j|
        x,y,z = s[i-j-1], s[i], s[i+j+1]
        if x != y && y != z && z != x
            count += 1
        end
    end
end

puts r*g*b - count



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

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, a, b) for (int i = a; i < b; i++)

#define MAXLEN 2000001
#define VMAX 10000

int main() {
    unsigned short *A, *B;

    int n; scanf("%d", &n);
    int C[VMAX + 1];
    A = (unsigned short*)malloc(sizeof(short) * n + 1);
    B = (unsigned short*)malloc(sizeof(short) * n + 1);
    REP(i, VMAX + 1) C[i] = 0;

    REP(i, n) {
        scanf("%d", &A[i + 1]);
        C[A[i + 1]]++;
    }

    FOR(i, 1, VMAX) C[i] += C[i - 1];

    FOR(j, 1, n + 1) {
        B[C[A[j]]] = A[j];
        C[A[j]]--;
    }

    FOR(i, 1, n + 1) {
        if (i > 1) printf(" ");
        printf("%d", B[i]);
    }
    printf("\n");
}

Measured memory_bytes: 11064
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.Closeable;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
import java.util.Map.Entry;
import java.util.stream.IntStream;

public class Main {
    static ContestScanner in;
    static Writer out;
    public static void main(String[] args) {
        Main main = new Main();
        try {
            in = new ContestScanner();
            out = new Writer();
            main.solve();
            out.close();
            in.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    void solve() throws IOException {
        int a = in.nextInt();
        int b = in.nextInt();
        System.out.println((a + b) % 24);
    }
}


class Writer extends PrintWriter{
    public Writer(String filename)throws IOException
    {super(new BufferedWriter(new FileWriter(filename)));}
    public Writer()throws IOException{super(System.out);}
}
class ContestScanner implements Closeable{
    private BufferedReader in;private int c=-2;
    public ContestScanner()throws IOException
    {in=new BufferedReader(new InputStreamReader(System.in));}
    public ContestScanner(String filename)throws IOException
    {in=new BufferedReader(new InputStreamReader(new FileInputStream(filename)));}
    public String nextToken()throws IOException {
        StringBuilder sb=new StringBuilder();
        while((c=in.read())!=-1&&Character.isWhitespace(c));
        while(c!=-1&&!Character.isWhitespace(c)){sb.append((char)c);c=in.read();}
        return sb.toString();
    }
    public String readLine()throws IOException{
        StringBuilder sb=new StringBuilder();if(c==-2)c=in.read();
        while(c!=-1&&c!='\n'&&c!='\r'){sb.append((char)c);c=in.read();}
        return sb.toString();
    }
    public long nextLong()throws IOException,NumberFormatException
    {return Long.parseLong(nextToken());}
    public int nextInt()throws NumberFormatException,IOException
    {return(int)nextLong();}
    public double nextDouble()throws NumberFormatException,IOException
    {return Double.parseDouble(nextToken());}
    public void close() throws IOException {in.close();}
}

Measured memory_bytes: 23380
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<int> v(n);
    int x=0;
    for(int i=1;i<=n;i++)
    {
        cin>>v[i];
        x^=v[i];
    }
    for(int i=1;i<=n;i++)
    {
        int ans=x^v[i];
        cout<<ans<< " ";
    }
}

Measured memory_bytes: 3992
#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <math.h>
#include <array>
#include <list>
#include <set>
#define MOD 1000000007
#define INF 1000000000
using namespace std;
typedef long long ll;
typedef tuple<ll,int,int> tup;
typedef vector<int> vi;
int N;
vector<int> b;
vector<int> ans;
bool change=false;
int main(int argc,char const* argv[])
{
  cin >> N;
  for (int i = 0; i < N; ++i)
    {
      int tmp;
      cin >> tmp;
      b.push_back(tmp);
    }
  bool chain=true;
  int del=-1;
  while(chain)
    {
      chain=false;
      del=-1;
      for (int i=0;i<int(b.size());i++)
	{
	  if(b[i]==i+1)
	    {
	      del=i+1;
	    }
	}
      if(del!=-1)
	{
	  b.erase(b.begin()+del-1);
	  ans.push_back(del);
	  chain=true;
	}
    }
  if(int(b.size())!=0)
    {
      cout << -1 << endl;
    }
  else
    {
      reverse(ans.begin(),ans.end());
      for (int i = 0; i < N; ++i)
	{
	  cout << ans[i] << endl;
	}
    }
 
  return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <bits/stdc++.h>
#include <random>
using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef map<int, int> mii;
typedef pair<int, ii> edge;


#define sc(x)  scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mem(arr,val) memset(arr,val,sizeof arr)
#define sz(v) (int)v.size()
#define rsz(v) v.resize
#define clr(v) v.clear()
#define rev(v) reverse(all(v))
#define lop(i,end) for(int i=0; i<end; i++)
#define rlop(i,start) for(int i=start-1; i>=0; i--)
#define loop(i,start,end) for(int i=start; i<end; i++)
#define rloop(i,start,end) for(int i=start-1; i>=end; i--)
#define PB push_back
#define pb pop_back
#define mP make_pair
#define f first
#define s second

const ll OO = (ll)(4e18) + 9;
const int MOD = (int)(1e9) + 7;
const int oo = 2147483647;
const double EPS = 1e-8;
const double PI = acos(-1.0);

//enum dir { D, R, U, L , dr, ur, dl, ul };
int dx[] = { 1, 0, -1, 0, 1, -1, 1, -1 };
int dy[] = { 0, 1, 0, -1, 1, 1, -1, -1 };

string abc = "abcdefghijklmnopqrstuvwxyz";
string vowels = "aeiouy"; //and sometimes "aeiouy"

template<typename X, typename Y> bool ckmin(X& a, Y b) { return a > b ? a = b, true : false; }
template<typename X, typename Y> bool ckmax(X& a, Y b) { return a < b ? a = b, true : false; }
bool cklex(string &a, string b) {
	if (b == "") return false;
	if (a == "") return a = b, true;
	if (sz(a) < sz(b)) return false;
	if (sz(b) < sz(a)) return a = b, true;
	if (a < b) return false;
	return a = b, true;
}

int dcmp(ld d1, ld d2) { return fabs(d1 - d2) <= EPS ? 0 : d1 > d2 ? 1 : -1; } //Compare Double Numbers
ll gcd(ll x, ll y) { return !y ? x : gcd(y, x%y); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
int conv_2_1(int r, int c, int nCol) { return (nCol*r) + c + 1; } //convert index from 2D array to 1D array. (Zero-indexed)
ii conv_1_2(int n, int nCol) { return{ n / nCol, n % nCol }; } //convert index from 1D array to 2D array (row, col). (Zero-indexed)
template<typename T> void inter(T X) { cout << X << endl; fflush(stdout); }

int n, m;
const int N = 2e5 + 10;
bool vis[N];
vi graph[N];
int groups[N];
int cnt;
void dfs(int nod) {
	groups[cnt]++;
	vis[nod] = true;
	for (auto nv : graph[nod]) if (not vis[nv]) dfs(nv);
}

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int t = 1, tt=1;
	//cin >> t;
	while (t--) {
		cin >> n >> m;
		int u, v;
		map<ii, int> mp;
		lop(i, m) {
			cin >> u >> v, u--, v--;
			if (u > v) swap(u, v);
			if (not mp[{u, v}]) mp[{u, v}]++, graph[u].push_back(v), graph[v].push_back(u);
		}
		cnt = -1;
		lop(i, n) if (not vis[i]) cnt++, dfs(i);
		int nas = 0;
		lop(i, cnt + 1) ckmax(nas, groups[i]);
		cout << nas << endl;
	}


	return 0;
}


Measured memory_bytes: 33500
import java.util.Scanner;

// this solves the allocation problem with a bin search


public class Main {
	public static boolean is_possible(int[] weights, int q, int k) {
		int current_load = 0;
		int truck_count = 0;
		int i = 0;
		while(i < weights.length) {
			if(current_load + weights[i] > q) {
				truck_count++;
				if(truck_count >= k) {
					break;
				}
				current_load = 0;
			}
			
			current_load += weights[i];
			i++;
		}
		
		truck_count ++;
		return (truck_count <= k);
		
		
		
	}
	
	
	public static int min_q(int[] weights, int k, int sum, int max_val) {
		int lo = max_val;
		int hi = sum;
		int mid = 0;
		
		while(lo <= hi) {
			if(hi == lo) {
				return hi;
			}
			
			mid = (hi + lo) >> 1;
			if(is_possible(weights, mid, k)) {
				hi = mid;
			}else {
				lo = mid+1;
			}
		}
		
		return mid;
		
		
	}
	
	
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int n = cin.nextInt();
		int k = cin.nextInt();
		int sum = 0;
		int max_val = 0;
		
		int [] weights = new int[n];
		for(int i = 0; i < n; i++) {
			weights[i] = cin.nextInt();
			sum += weights[i];
			max_val = Math.max(max_val, weights[i]);
		}
		
		System.out.println(min_q(weights, k, sum, max_val));
		
		cin.close();
		
		
	}
}

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

#define MAXN 100005
int N,M;
int WA[MAXN];
bool AC[MAXN];

void solve(){
    cin >> N >> M;
    int cntAC = 0 , cntWA = 0;
    for(int i = 1 ; i <= N ; i++){
        WA[i] = 0;
        AC[i] = false;
    }
    while(M--)
    {
        int id;
        string stat;
        cin >> id >> stat;
        if(AC[id])continue;
        if(stat == "AC"){
            AC[id] = true;
            cntAC++;
            cntWA += (WA[id]);
        }else{
            WA[id]++;
        }
    }
    cout << cntAC << ' ' << cntWA << '\n';
    return;
}

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

    solve();
    return 0;
}


Measured memory_bytes: 768
/*
    Author:zeke

    pass System Test!
    GET AC!!
*/
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
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 (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;
// cout << "Case #" << index << " :IMPOSSIBLE";
ll evaluate(VV& S, ll d, V& prev, V& C, ll j) {
    ll temp = 0;
    temp += S[d][j];
    rep(k, 26) {
        if (j == k) {
            continue;
        }
        temp -= C[k] * (d - prev[k]);
    }
    return temp;
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    ll d;
    cin >> d;
    V C(26);
    rep(i, 26) cin >> C[i];
    VV S(d, V(26));
    rep(i, d) { rep(j, 26) cin >> S[i][j]; }
    ll width = 430;
    vector<tuple<ll, V, V>> vec;
    V temp;
    rep(i, 26) temp.push_back(-1);
    V temp2;
    vec.push_back({0, temp, temp2});
    rep3(i, 0, d) {
        priority_queue<tuple<ll, V, V>> q;
        for (auto j : vec) {
            ll score = get<0>(j);
            V prev = get<1>(j);
            V history = get<2>(j);
            rep(k, 26) {
              bool f=false;
                for(int g=history.size()-1,h=0;h<10&&g>=0;h++,g--){
                    if(!history.empty()&&history[g]==k){
                      f=true;
                      break;
                    }
                }
                if(f)continue;
                ll value = evaluate(S, i, prev, C, k);
                ll prev2 = prev[k];
                
                prev[k] = i;
                history.push_back(k);
                q.push({score + value, prev, history});
                history.pop_back();
                prev[k] = prev2;
            }
        }
        vec = {};
        for (ll j = 0; j < width && !q.empty(); j++) {
            vec.push_back(q.top());
            q.pop();
        }
    }
    for (auto i : get<2>(vec[0])) {
        cout << i + 1 << endl;
    }
}


Measured memory_bytes: 27348
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#define ALL(a)  (a).begin(),(a).end()
 
const ll mod = 1000000007;
const ll LINF = 1e13;
const ll LLINF = 1e18;
const ll ALPHABET = 26;
 
template <class T>
void Swap(T& r, T& l) {
  T tmp = r;
  r = l;
  l = tmp;
}
 
template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
  for (T& x : vec) is >> x; //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいい
  return is;
}


int main(){
  string s;
    cin >> s;
    ll n;
    n = s.size();
    vector<ll> arr(n+2,0);


    reverse(s.begin(),s.end());

    for (ll i = 0; i < n; i++)
    {
        arr[i] = s[i] - '0';
    }

    
    

    // 5周りの計算が必要
    ll ans =0;
    for (ll i = 0; i < n; i++){
        if (arr[i] > 9){
            arr[i+1]++;
            if (i==n-1){
                n++;
            }
            arr[i]-=10;
        }

        if (arr[i] > 5){
            if (i==n-1){
                ans+= 10 - arr[i] + 1;
            }else{
                arr[i+1]++;
                ans+= 10 - arr[i];
            }
        }else if (arr[i]==5){
            bool isb = false;
            for( ll j = i+1;j<n;j++){
                if (arr[j] > 5){
                    isb = true;
                    break;
                }else if (arr[j] < 5){
                    isb = false;
                    break;
                }
            }
            if (i!=n-1 && arr[i+1] >=5 ){
                arr[i+1]++;
                ans+= 10 - arr[i];
            }else{
                ans += arr[i];
            }
            
        }else{
            ans += arr[i];
        }

        // cerr << arr[i] << " : "<< ans <<endl;
    }


  



    cout<< ans<<endl;

}






Measured memory_bytes: 9220
def PowerMod(N,P,Mod):
    if N%Mod==0:
        return 0
    else:
        PowM = 1
        for TP in range(1,P+1):
            PowM = (PowM*N)%Mod
        return PowM

from collections import Counter
N = int(input())
A = sorted(Counter([int(T) for T in input().split()]).most_common(),key=lambda X:X[0])
PassFlag = True
if N%2==1:
    for TA in range(0,(N+1)//2):
        if A[TA][0]!=(2*TA) or A[TA][1]!=(1+(A[TA][0]!=0)):
            PassFlag = False
            break
    print([0,PowerMod(2,(N-1)//2,10**9+7)][PassFlag])
else:
    for TA in range(0,N//2):
        if A[TA][0]!=(2*TA+1) or A[TA][1]!=2:
            PassFlag = False
            break
    print([0,PowerMod(2,N//2,10**9+7)][PassFlag])

Measured memory_bytes: 20764
#include<bits/stdc++.h>
using namespace std;
const int N=1*1e5+10,Mod=1e9+7;
typedef long long ll;
#define pb push_back
int n;
double a[60];
int main()
{
  cin>>n;
  for(int i=1;i<=n;i++) cin>>a[i];
  sort(a+1,a+n+1);
  for(int i=2;i<=n;i++) a[i]=(a[i]+a[i-1])/2.0;
  cout<<a[n]<<endl;
  return 0;
}


Measured memory_bytes: 256
# coding: utf-8
# Here your code !

import sys
input_line2 = sys.stdin.readline()

flag = 0
for i in range(len(input_line2)):
    for j in range(len(input_line2)):
        if i != j:
            if input_line2[i] == input_line2[j]:
                flag = 1
                break;

if flag == 1:
    print ("no")
else :
    print("yes")

Measured memory_bytes: 2940
// Problem : F - LCS
// Contest : AtCoder - Educational DP Contest
// URL : https://atcoder.jp/contests/dp/tasks/dp_f
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

# include<bits/stdc++.h>
using namespace std ; 

int main() {
	string s , t ; 
	cin >> s >> t ; 
	int s1 = s.size() ; 
	int s2 = t.size() ; 
	int dp[s1+1][s2+1] ; 
	
	//string ans = "" ; 
	//vector<string> tmp ; 
	for(int i =0 ;i <= s1 ; ++i) {
		for(int j = 0 ; j <= s2 ; ++j) {
			if(i==0|| j==0)
				dp[i][j] = 0 ; 
			else if(s[i-1] == t[j-1]) {
				dp[i][j] = 1 + dp[i-1][j-1] ; 
			}
			else 
			dp[i][j] = max(dp[i-1][j] ,dp[i][j-1]) ;  
		}
	}
	int tmp =  dp[s1][s2]  ; 
	int index = tmp; 
	char ans[tmp+1] ;
	ans[tmp] ='\0';
	while(s1> 0 && s2 > 0 ) {
		if(s[s1-1] == t[s2-1]) {
			ans[index-1] = s[s1-1] ; 
			s1--;s2--;
			index--;
		}
		else if (dp[s1-1][s2] > dp[s1][s2-1])
		s1--;
		else 
		s2--;
	}
	
	cout << ans  ; 

}

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

int main(){
	int a,b,c,d=0,sum=3;
	cin>>a>>b>>c;
	if(a==b)
	{
		d++;
		sum--;
	}
	if(c==b)
	{
		d++;
		sum--;
	}
	if(a==c)
	{
		d++;
		sum--;
	}
	if(d==3) sum++;
	cout<<sum; 
	return 0;
}


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

int main(){
  string s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  string t = "abcdefghijklmnopqrstuvwxyz";
  char a;
  cin >> a;
  rep(i,26){
    if(a == s[i]){
      puts("A");
      return 0;
    }
  }
  rep(i,26){
    if(a == t[i]){
      puts("a");
      return 0;
    }
  }
  return 0;
}


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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

int calc(int A, int B, int C, int X){
    return (A*X + B) % C;
}

int main(void){
    vector<int> ans;
    while(true){
        int res = 0;
        int N, A, B, C, X; cin >> N >> A >> B >> C >> X;
        if(C == 0) break;
        rep(i, N){
            int temp; cin >> temp;
            while(X != temp && res <= 10000){
                X = calc(A, B, C, X);
                res++;
            }
            if(i < N-1){
                X = calc(A, B, C, X);
                res++;
            }
        }
        if(res <= 10000) ans.push_back(res);
        else ans.push_back(-1);
    }
    rep(i, ans.size()) cout << ans[i] << endl;
    return 0;
}


Measured memory_bytes: 3116
h, w = list(map(int, input().split(" ")))

minv = 99999999

for i in range(1, h):
    s1 = i*w
    
    if (h-i)*w % 2 == 0:
        s2 = (h-i)* w / 2
        s3 = (h-i)* w / 2
    else:
        s2 = min((h-i), w) * (max((h-i), w)//2)
        s3 = min((h-i), w) * (1+max((h-i), w)//2)
        
    if max(s1, s2, s3) - min(s1, s2, s3) < minv:
        minv = max(s1, s2, s3) - min(s1, s2, s3)
        

for i in range(1, w):
    s1 = i*h
    
    if h*(w-i) % 2 == 0:
        s2 = h*(w-i) / 2
        s3 = h*(w-i) / 2
    else:
        s2 = min(h, (w-i)) * (max(h, (w-i))//2)
        s3 = min(h, (w-i)) * (1+max(h, (w-i))//2)
        
    if max(s1, s2, s3) - min(s1, s2, s3) < minv:
        minv = max(s1, s2, s3) - min(s1, s2, s3)
        
print(int(minv))

Measured memory_bytes: 3188
#!/usr/bin/env python3
def main():
    n = int(input())
    s = []
    t = []
    for _ in range(n):
        s_i, t_i = input().split()
        s.append(s_i)
        t.append(int(t_i))
    x = input()
    print(sum(t[s.index(x) + 1:]))
if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<sstream>
#include<algorithm>
#include<map>
#include<vector>
using namespace std;
typedef pair<int,string> P;


int main(){
	int n;
	string str;
	while(1){
		cin >> n;
		if(n == 0) break;
		map<string,int> count;
		vector<P> v;
		getchar();
		for(int i=0;i<n;i++){
			//cin.ignore();
			getline(cin,str);
			stringstream ss(str);
			while(ss >> str){
				count[str]++;
			}
		}
		char key; cin >> key;
		for(map<string,int>::iterator i=count.begin(),l=count.end();i!=l;i++){
			if(key==i->first[0]){
				v.push_back(make_pair(-i->second,i->first));
			}
		}
		sort(v.begin(),v.end());
		if(v.empty()) cout << "NA" << endl;
		else {
			bool flg = false;
			int s = v.size();
			for(int i=0;i<5&&i<s;i++){
				if(flg) cout << " ";
				else flg = true;
				cout << v[i].second;
			}
			cout << endl;
		}
	}
}

Measured memory_bytes: 1252
def combinatnion(num, cmb):
    nmrtr = 1
    dnmntr = 1

    for i in range(cmb):
        nmrtr = nmrtr * (num - i)
        dnmntr = dnmntr * (i + 1)

    ans = int(nmrtr/dnmntr)
    return ans

n = int(input())

inputList=[]
for i in range(n):
    line = input()
    inputList.append(line)

# print(inputList)

sortedList = []
dic = {}
for i in range(n):
    tmpList = list(inputList[i])
    tmpList.sort()
    tmpword = "".join(tmpList)

    if tmpword in dic:
        dic[tmpword] = dic[tmpword] + 1
    else:
        dic[tmpword] = 1

    # print(dic)

# print(tmpword)

cnt = 0
for val in dic.values():
    if val != 1:
        cnt += combinatnion(val, 2)

print(cnt)









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

using namespace std;

# define int long long

int d,s,h,q,n,p;

signed main()
{
 	scanf("%lld%lld%lld%lld\n",&q,&h,&s,&d);
  	scanf("%lld\n",&n);
  	p=min(min(q*8,h*4),s*2);
  	if(d<p){
     	if(n%2==1)printf("%lld\n",(n-1)/2*d+p/2);
      	else printf("%lld\n",n/2*d);
    }
    else printf("%lld\n",p/2*n);
    return 0;
}

Measured memory_bytes: 3740
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n, k;
		n = sc.nextInt();
		k = sc.nextInt();
		int[] h = new int[n];
		for (int i = 0; i < n; i++) {
			h[i] = sc.nextInt();
		}
		int[] dp = new int[100100];
		Arrays.fill(dp, Integer.MAX_VALUE);
		dp[0] = 0;

		for (int i = 1; i < n; i++) {
			for (int j = 1; j <= k; j++) {
				if(i - j >= 0) dp[i] = Math.min(dp[i], dp[i - j] + Math.abs(h[i] - h[i - j]));
			}
		}

		System.out.println(dp[n - 1]);
	}
}

Measured memory_bytes: 52232
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
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; }
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;
const double PI = 3.1415926535897932;
const int MOD = 1e9 + 7;

//cin.tie(0);ios::sync_with_stdio(false);
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep (i, n) cin >> a[i];
  stack<int> sa, sb;
  sort(a.begin(), a.end());

  rep (i, n) {
    sa.push(a[i]);
    sb.push(a[i]);
  }

  sb.pop(); sb.pop();
  ll ans = sa.top();
  sa.pop();


  while (!sa.empty()) {
    int x = sa.top();
    sa.pop();

    int limit = 0;
    while (!sb.empty() && limit < 2) {
      //printf("sb.top = %d\n", sb.top());
      sb.pop();
      ans += x;
      limit++;
    }
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 5616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// Welcome to my source code!

int main() {
    int n;
    cin >> n;
    string s;
    map<char, int> alphabet;
    for (int i = 0; i < n; i++) {
        cin >> s;
        int t = s.size();
        map<char, int> mp;
        for (int j = 0; j < t; j++) {
            for (int k = 0; k < 26; k++) {
                char c = 'a' + k;
                if (s[j] == c) mp[c]++;
            }
        }
        if (i == 0) {
            alphabet = mp;
            continue;
        }
        for (int j = 0; j < 26; j++) {
            char c = 'a' + j;
            alphabet[c] = min(alphabet[c], mp[c]);
        }
    }
    for (auto x : alphabet) {
        for (int i = 0; i < x.second; i++) cout << x.first;
    }
    cout << endl;
}

Measured memory_bytes: 256