akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<P> a(n);
    rep(i,n){
        cin >> a[i].first;
        a[i].second = i+1;
    }
    sort(a.begin(), a.end());
    rep(i,n) cout << a[i].second << " ";
    cout << endl;
    return 0;
}


Measured memory_bytes: 3948
//agc036_a.cpp
//Sat Aug  3 17:08:18 2019

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	ll x = (1000000000-s%1000000000)%1000000000;
	ll y = (s+x)/1000000000;


	cout << "0 0 1000000000 1 "<< x << " " << y << endl;
//	printf("%.4f\n",ans);
}

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

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

using ll  = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

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

void func(long long W, long long H, long long x, long long y) {
    cout << fixed << setprecision(6);
    cout << (double)W * (double)H / 2 << " ";
    cout << (W == x * 2 && H == y * 2) << endl;
}

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

    long long W;
    scanf("%lld", &W);
    long long H;
    scanf("%lld", &H);
    long long x;
    scanf("%lld", &x);
    long long y;
    scanf("%lld", &y);
    func(W, H, x, y);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

int main() {
    int X, Y;
    cin >> X >> Y;
    for(int i=0;i<=X;++i){
        if(i*2+(X-i)*4 == Y){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;

ll mod(ll a, ll b){
  ll ret=a%b;
  if(ret<0) ret+=b;
  return ret;
}

ll modpow(ll a,ll b,ll c){
  ll res=1;
  while(b>0){
    if(b&1) res=mod(res*a,c);
    a=mod(a*a,c);
    b>>=1;
  }
  return res;
}

int par[100010],ran[100010];

void init(int n){
  for(int i=0;i<n;i++){
    par[i]=i;
    ran[i]=0;
  }
}

int find(int x){
  if(par[x]==x){
    return x;
  }
  else{
    return par[x]=find(par[x]);
  }
}

void unite(int x,int y){
  x=find(x);y=find(y);
  if(x==y) return;
  if(ran[x]<ran[y]){
    par[x]=y;
  }
  else{
    par[y]=x;
    if(ran[x]==ran[y]) ran[x]++;
  }
}

bool same(int x,int y){
  return find(x)==find(y);
}

int main() {
  int n,m;
  cin>>n>>m;
  init(n);
  int ans=0;
  int p[n];
  for(int i=0;i<n;i++){
    cin>>p[i];
    p[i]--;
  }
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    a--;b--;
    unite(a,b);
  }
  for(int i=0;i<n;i++){
    if(find(i)==find(p[i])) ans++;
  }
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 4732
#include <stdio.h>

int main()
{
    int n,a[200000],box[200000] = {0},boxcount = 0,boxi[200000];
    scanf("%d",&n);
    for (int i = 0; i < n; i++)
    {
        scanf("%d",&a[i]);
    }
    
    int cnt;
    for (int i = n - 1; i >= 0; i--)
    {
        cnt = 0;
        for (int j = i; j < n; j += i + 1)
        {
            cnt += box[j];
        }
        if (cnt % 2 != a[i])
        {
            box[i] = 1;
            boxi[boxcount] = i + 1;
            boxcount++;
        }
    }
    
    printf("%d\n",boxcount);
    for (int i = 0; i < boxcount; i++)
    {
        printf("%d ",boxi[i]);
    }
    
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define sz(a) int((a).size())
#define all(a) (a).begin(), (a).end()
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPD(i,n) for(int i=(n)-1;i>=0;--i)
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define FORD(i,a,b) for(int i=(a);i>=(b);--i)
#define TLE() cerr<<"\nTime elapsed: "<<1000*clock()/CLOCKS_PER_SEC<<"ms.\n";
const ll MOD = 1E9+7;
const ll IINF = 1E18;
const int INF = 1e9;
const double EPS = 1E-9;
const double PI = atan(1.0) * 4.0;
template<class T> T getbit(T s, int i) {return s>>i&1;}
template<class T> void flipbit(T& s, int i) {s^=(1LL<<i);}
constexpr int cntbit(ll x) {return __builtin_popcountll(x);}
constexpr int lg2(ll x) {return __lg(x);} // return int(log2(x))
// mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count()); 
ll fpow(ll a,ll p){ll res=1LL;while(p){if(p&1LL) res=res*a%MOD;a=a*a%MOD;p>>=1LL;} return res;}
 
const int N=55;
int k,n,a[N],res;
 
int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin>>n>>k;
	FOR(i,1,n) cin>>a[i];
	if(k>=n){
	   int sum=accumulate(a+1,a+n+1,0);
	   sort(a+1,a+n+1);
	   REP(i,min(n,k-n)) 
	        if(a[i+1]<0) sum-=a[i+1];
	   cout<<sum<<'\n';
	   return 0;
	}
	FOR(i,1,k){
		FOR(l,0,i){
			priority_queue<int,vector<int>,greater<int>> q;
			FOR(j,1,l) q.push(a[j]);
			FORD(j,n,n-(i-l)+1) q.push(a[j]);
			REP(j,k-i) if(!q.empty()&&q.top()<0) q.pop();
			int sum=0;
			while(!q.empty()) sum+=q.top(),q.pop();
			res=max(res,sum);
		}
	}
	cout<<res<<'\n';
}
 


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

int main() {
  long long n,a,b,c,d,e;
  cin>>n;
  cin >>a>>b>>c>>d>>e;
  long long saishou=  min(a,min(b,min(c,min(d,e))));
  long long kotae=n/saishou;
  if(n%saishou==0){
    cout<<setprecision(12)<<kotae+4<<endl;
  }else{
    cout<<setprecision(12)<<kotae+5<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;

void dfs(int cur, int c, vector<vector<pair<int,int>>>& edge, vector<int>& color){
    if(color[cur] >= 0) return;
    color[cur] = c;
    for(auto p: edge[cur]){
        dfs(p.first, (p.second + c) % 2, edge, color);
    }
}

int main(){
    int N;
    cin >> N;
    vector<vector<pair<int,int>>> edge(N);
    for(int i = 0; i < N-1; ++i){
        int x, y, w;
        cin >> x >> y >> w;
        --x; --y;
        edge[y].push_back(pair<int,int>(x,w));
        edge[x].push_back(pair<int,int>(y,w));
    }
    vector<int> color(N, -1);
    dfs(0, 0, edge, color);
    for(int c: color){
        cout << c << endl;
    }
    return 0;
}



Measured memory_bytes: 8192
#include<iostream>
#include<cstring>
#include<algorithm>
#define MOD 1000000007
using namespace std;
int dp[1005][1005];
int main(){
  int h,w;
  char a[1005][1005];
  
  cin>>h>>w;
  for(int i=1;i<=h;i++){
    for(int j=1;j<=w;j++){
      cin>>a[i][j];
    }
  }
  
  dp[1][1]=1;
  for(int i=1;i<=h;i++){
    for(int j=1;j<=w;j++){
      if(i==1 && j==1){
      }else if(a[i][j]=='.'){
	dp[i][j]=(dp[i-1][j]%MOD+dp[i][j-1]%MOD)%MOD;
      }else{
	dp[i][j]=0;
      }
    }
  }
  
  cout<<dp[h][w]<<"\n";

  return 0;
}


Measured memory_bytes: 5120
#include <iostream>
#include <vector>
#include <algorithm>
#include <array>
#include <cmath>
using i64 = long long;
using namespace std;

const int maxs = 3000;
string dp[2][maxs + 1];

int main() {
  string s, t;
  cin >> s >> t;
  for (int i = 1, k = 1; i <= s.size(); i++, k ^= 1) {
    for (int j = 1; j <= t.size(); j++) {
      auto max = [](string &a, string b) {
        a = a.size() > b.size() ? a : b;
      };
      if (s[i - 1] == t[j - 1]) 
        max(dp[k][j], dp[k ^ 1][j - 1] + s[i - 1]);
      max(dp[k][j], dp[k ^ 1][j]);
      max(dp[k][j], dp[k][j - 1]);
    }
  }
  cout << dp[s.size() & 1][t.size()] << '\n';
}

Measured memory_bytes: 8448
#include <iostream>
#include <string>
using namespace std;
 
int main()
{
	int n,a,b;
	cin >> n >> a >> b;
	int res = 0;
	
	for (int i = 1; i<=n; i++){		
		int count = 1;
		int j = 10;
		
		while(true){
			if (i/j == 0){
				break;
			}else{
				count++;
			}
			j *= 10;
		}
	
		int test = 10;
		for (int k = 0; k < count; k++){
			test *= 10;
		}
		
		int sum = 0;
		for(int l = 10; l < test; l *= 10){
			sum += (i % l*10) / l;
		}
		
		if (sum >= a && sum <= b){
			res += i;
		}
	}
	cout << res << "\n";
}


Measured memory_bytes: 256
#include<algorithm>
#include<climits>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<utility>
#include<vector>
 
#define lint long long
#define VI vector<int>
#define VL vector<lint>
#define VB vector<bool>
#define VC vector<char>
#define VS vector<string>
#define VVI vector<VI>
#define VVL vector<VL>
#define rep(i, n) for(int i = 0 ; i < n ; i++)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX

using namespace std;

const lint MOD = 1e9 + 7;

lint rec(lint n){
    if(n == 1){
        return 1;
    }
    return (n % MOD) * (rec(n-1) % MOD) % MOD;
}

int main(){
    lint n;
    cin >> n;
    cout << rec(n) << endl;
    return 0;
}

Measured memory_bytes: 1792
/*
 * This problem is similar to the english words problem, however,
 * because it only needs the top and bottom heights, we can create
 * a much easier solution of making it a sorted array and choosing
 * the last and first values.
 */
// get the input and put it an array separated by line, and then sort it
var input = require("fs").readFileSync("/dev/stdin").toString();
input = input.split("\n").sort();

// extract the tallest and shortest from the list
var tallest = input[input.length-1];
var shortest = input[0];

// print out the difference
console.log(tallest-shortest);

Measured memory_bytes: 15380
#include<bits/stdc++.h>
using namespace std;
int w;
int main(){

while( cin >> w && (~w) ){
int res = 1150;
if( w > 10){
res += min(10,w-10) * 125;
}
if(w > 20){
res += min(10,w-20) * 140;
}
if(w > 30){
res += (w-30)*160;
}
cout << 4280-res << endl;
}




}

Measured memory_bytes: 1160
from collections import deque

LIST = deque()

num_command = int(input())

for loop in range(num_command):
    input_command = input()

    if input_command == 'deleteFirst':
        LIST.popleft()
    elif input_command == 'deleteLast':
        LIST.pop()
    else:
        com, num = input_command.split()

        if com =='insert':
            LIST.appendleft(num)
        elif com == 'delete':
            try:
                LIST.remove(num)
            except:
                pass
print(' '.join(LIST))



Measured memory_bytes: 69740
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <iterator>
#include <stack>
#include <string.h>
#include <cstdlib>
#include <queue>
#include <list>
#include <string>

using namespace std;

int main()
{
    int N;
    int W;
    int v[105];
    int w[105];
    
    cin >> N >> W;
    for (int i = 1;i <= N;i++){
        cin >> v[i] >> w[i];
    }
    
    int dp[105][100005];
    
    for (int i = 0;i <= N;i++){
        dp[i][0] = 0;
    }
    for (int i = 0;i <= W;i++){
        dp[0][i] = 0;
    }
    for (int i = 1;i <= N;i++){
        for (int j = 0;j <= W;j++){
            if (j >= w[i]){
                dp[i][j] = max(dp[i-1][j-w[i]]+v[i],dp[i-1][j]);
            }
            else {
                dp[i][j] = dp[i-1][j];
            }
        }
    }
    cout << dp[N][W] << endl;
}



Measured memory_bytes: 7424
N, x = map(int, input().split())
lst = [int(x) for x in input().split()]
total = sum(lst)
for i in range(N - 1):
    if lst[i] + lst[i + 1] > x:
        lst[i + 1] = lst[i + 1] - min(max(lst[i] + lst[i + 1] - x, 0), lst[i + 1])
    if lst[i] + lst[i + 1] > x:
        lst[i] = lst[i] - min(max(lst[i] + lst[i + 1] - x, 0), lst[i])
print(total - sum(lst))


Measured memory_bytes: 14400
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define fi first
#define se second
#define mk make_pair
using namespace std;
typedef pair<int,int> P;
#define int long long
main(){
    int n;
    cin>>n;
    int a[n];
    r(i,n)cin>>a[i];
    sort(a,a+n);
    int b[2],c=0;
    for(int i=n-1;i>=1;i--){
        if(a[i]==a[i-1]){
            b[c++]=a[i];
            i--;
        }
        if(c==2)break;
    }
    if(c!=2)cout<<0<<endl;
    else cout<<b[0]*b[1]<<endl;
}

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

using namespace std;

#define ll          long long
#define  mod         1000000007
ll subtraction_modulo(ll x, ll y ){
        return ( ( (x - y) %  mod ) +  mod ) %  mod;
    }
long long  power(long long int x, long long  int y, long long  p)  
{  
   long long  res = 1;     // Initialize result  
  
    x = x % p; // Update x if it is more than or  
                // equal to p 
   
    if (x == 0) return 0; // In case x is divisible by p; 
  
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % p;  
  
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
} 
int main()
{
	int t;
	t=1;
	
	while(t--)
	{
	
	long long a,b,c,d,e,f,n,m,i,j,k;
	
	cin>>n;
	
	
	if(n==1)
	cout<<0<<endl;
	
	else if(n==2)
	cout<<2<<endl;
	
	else
	{
		
		
	
	
	i= (power(9,n,mod)*2)%mod;
	 j= (power(10,n,mod) -i + power(8,n,mod) +mod )%mod;
//	m= subtraction_modulo(subtraction_modulo( power(10,n,mod), i ),power(8,n,mod) );
		
		
		cout<< j<<endl;
		
	}
	
	
	}



}


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

void replace(string &s, char c) {
    for (size_t p = s.find("ABC"); p != string::npos; p = s.find("ABC", p + 2)) {
        s[p] = c;
        s[p + 1] = s[p + 2] = '@';
    }
    s.erase(remove(s.begin(), s.end(), '@'), s.end());
}

bool solve(string s) {
    string t = s;
    string log;
    const string abc = "ABC";
    while (t != abc && t.find(abc) != string::npos) {
        if (t.substr(0, 3) == abc) {
            replace(t, 'A');
            log += 'A';
        } else if (t.substr(t.size() - 3, 3) == abc) {
            replace(t, 'C');
            log += 'C';
        } else {
            replace(t, 'B');
            log += 'B';
        }
    }
    if (t != abc) return false;
    reverse(log.begin(), log.end());
    for (int i = 0; i < log.size(); i++) {
        for (int j = 0; j < t.size(); j++) {
            if (t[j] == log[i]) {
                t.erase(t.begin() + j);
                t.insert(t.begin() + j, abc.begin(), abc.end());
                j += 2;
            }
        }
    }
    return s == t;
}

int main() {
    string s;
    while(cin >> s)
    puts(solve(s) ? "Yes" : "No");
}

Measured memory_bytes: 3244
#include <bits/stdc++.h>
#define f first
#define s second
#define fore(i,a,b) for(int i = (a), ThxMK = (b); i < ThxMK; ++i)
#define pb push_back
#define all(s) begin(s), end(s)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(s) int(s.size())
#define ENDL '\n'
using namespace std;
typedef long double ld;
typedef long long lli;
typedef pair<lli,lli> ii;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
#define deb(x) cout << #x": " << (x) << endl;

const int N = 3e3+5;
const lli INF = 1e18;
const lli MOD = 1e9+7;


vi primes(1,2);
vector<vector<ld>>nk;
void sieve(){
	vi m(N+1,0);
	for(int i = 4; i<N; i+=2)m[i]=1;
	for(int i = 3; i*i<=N; i+=2)if(!m[i])for(int j = i*i; j<N; j+=i)m[j]=1;
	for(int i = 3; i<N; i+=2)if(!m[i])primes.pb(i);
}

void pascal(){
	nk =vector<vector<ld>>(N,vector<ld>(N,0.0));
	fore(i,0,N)nk[i][0]=nk[i][i]=1.0;
	fore(i,1,N)fore(j,1,i)nk[i][j]=nk[i-1][j-1]+nk[i-1][j];
}

lli gcd(lli a, lli b){return (b?gcd(b,a%b):a);}

lli lcm(lli a, lli b){
	if(a<b)swap(a,b);
	lli c = gcd(a,b);
	a/=c;
	return a*b;
}

int popcount(lli x) { return __builtin_popcountll(x); }

lli poww(lli a, lli b){
	lli res =1;
	while(b){
		if(b&1) res = res * a;
		a = a*a;
		b/=2;
	}
	return res;
}

lli powm(lli a, lli b){
	lli res =1;
	while(b){
		if(b&1) res = (res * a)%MOD;
		a = (a*a)%MOD;
		b/=2;
	}
	return res;
}

bool isPrime(lli x){
	if(x==1)return 0;
	for(auto i:primes){
		if(i*i>x)return 1;
		if(x%i==0)return 0;
	}
	return 1;
}

lli SUM(lli a, lli b, lli mod=MOD){
	return (a+b+mod)%mod;
}
lli PROD(lli a, lli b, lli mod=MOD){
	a%=mod; b%=mod;
	return a*b % mod;
}
int dx[4]={-1,0,0,1}, dy[4]={0,1,-1,0};

// ---- コーディングはここから！ ('-')7



void solve(){
	string s; cin>>s; int d; cin>>d;
	vvl dp(d,vl(2,0));
	dp[0][0]=1;
	fore(i,0,sz(s)){
		vvl aux(d,vl(2,0));
		fore(j,0,d)fore(k,0,2)fore(ii,0,10){
		if(ii>(s[i]-'0') and k==0)break;
		aux[(j + ii)%d][k or ii<(s[i]-'0')]=SUM(aux[(j + ii)%d][k or ii<(s[i]-'0')],dp[j][k]);
		}
		dp=aux;
	}
	cout<<SUM(dp[0][0],dp[0][1]-1)<<ENDL;


}

int main(){_
	//int t; cin>>t; while(t--)
	solve();
}


Measured memory_bytes: 3652
# include <bits/stdc++.h>
# define endl "\n"
# define int long long
using namespace std;

void solve() {

	long double a, b;
	cin >> a >> b;

	cout << (int)floor(a * b);

}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
# ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
# endif
	// int t;
	// cin >> t;
	// while (t--)
	solve();
	return 0;
}

Measured memory_bytes: 3748
#include<bits/stdc++.h>
#define ll long long int
#define ff first
#define ss second
#define eps 1e-9

using namespace std;

int main()
{

    ll t,n,m,f,a,b,c,l,r,q,k,x,y,z,ans,mn,mx,sum=0;
    //ios_base::sync_with_stdio(false);
    //cin.tie(NULL);
    char ch;
    cin>>ch;

    if(ch>96)
    {
        cout<<'a'<<endl;
    }
    else
    {
        cout<<'A'<<endl;
    }


}


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

int main() {
    //
    int num;
    long long N, R;
    cin >> num;

    vector<long long> vec(num);
    for (int i = 0; i < num; i++) cin >> vec.at(i);
    sort(vec.begin(), vec.end());

    N = vec.at(num - 1);
    vec.pop_back();

    R = 999999999999;
    for (int i = 0; i < vec.size(); i++) {
        if (abs(N / 2 - R) >= abs(N / 2 - vec.at(i))) {
            R = vec.at(i);
        }
    }

    cout << N << " " << R << endl;
    //
}


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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;


int main() {
    string S;
    cin >> S;
    S = S + '.';

    int ans = 0;
    int count = 0;
    REP(i,S.size()){
        if(S[i]=='A' || S[i]=='T' || S[i]=='C' || S[i]=='G'){
            count ++;
        }else{
            ans = max(ans, count);
            count = 0;
        }
    }

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

Measured memory_bytes: 3604
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[]t = new int[n];
    
    int all = 0;
    for(int i=0; i<n; i++) {
    	t[i] = sc.nextInt();
    	all += t[i];
    }
    int m = sc.nextInt();
    int[]p = new int[m];
    int[]x = new int[m];

    for(int i=0; i<m; i++) {
    	p[i] = sc.nextInt();
    	x[i] = sc.nextInt();
    }

    for(int i=0; i<m; i++) {
    	System.out.println(all - t[p[i]-1] + x[i]);
    }
}
} 


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

#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, k, n) for (int i = (k); i < (int)(n); ++i)
typedef long long int ll;

using namespace std;

int main() {
  int H, W, h, w;
  cin >> H >> W >> h >> w;
  cout << H * W - h * W - H * w + h * w << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<cstring>
using namespace std;
long long int mod = 1e9 + 7;
template <class T>
void inputV(vector<T> &x, int n){
  for(int i=0; i<n; i++) cin >> x[i];
}
int dx[9] = {0, 1, 1, 1, 0, -1, -1, -1, 0};
int dy[9] = {0, 1, 0, -1, -1, -1, 0, 1, 1};
int main() {
  long long int h, w, n;
  cin >> h >> w >> n;
  map<pair<int, int>, int> mp;
  for(int i=0; i<n; i++) {
    int x, y;
    cin >> y >> x;
    x--; y--;
    for(int d=0; d<9; d++){
      int nx = x + dx[d];
      int ny = y + dy[d];
      if(nx <= 0 || ny <= 0 || nx >= w-1 || ny >= h-1) continue;
      mp[{nx, ny}]++;
    }
  }
  vector<long long int> ans(10, 0);
  int tmp = 0;
  for(auto i=mp.begin(); i!=mp.end(); i++){
    ans[i->second]++;
    tmp++;
  }
  ans[0] = (h-2)*(w-2) - tmp;
  for(int i=0; i<10; i++){
    cout << ans[i] << endl;
  }

  return 0;
}



//


Measured memory_bytes: 56448
from sys import stdin
from sys import setrecursionlimit
setrecursionlimit(10 ** 7)

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

def combination(n,r,mod=10**9+7):
    r=min(r,n-r)
    up,down=1,1
    for i in range(r):
        up=up*(n-i)%mod
        down=down*(i+1)%mod
    return up*pow(down,mod-2,mod)%mod

if n < 2:
    print(0)
    exit()

now = 1
hiki = 1
hiki2 = 1

for i in range(n):
    now *= 10
    hiki *= 8
    hiki2 *= 9

    now %= mod
    hiki %= mod
    hiki2 %= mod

hiki2 *= 2
hiki2 %= mod

print((now+hiki-hiki2)%mod)

Measured memory_bytes: 9236
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
using State = string::iterator;

class Solve {
public:
    void input() {

    }

    int expression(State &begin) {
        int ret = term(begin);

        while (true) {
            if (*begin == '+') {
                begin++;
                ret += term(begin);
            } else if (*begin == '-') {
                begin++;
                ret -= term(begin);
            } else if (*begin == ' ') {
                begin++;
            } else {
                break;
            }
        }
        return ret;
    }

    int term(State &begin) {
        int ret = factor(begin);
        while (true) {
            if (*begin == '*') {
                begin++;
                ret *= factor(begin);
            } else if (*begin == '/') {
                begin++;
                ret /= factor(begin);
            } else if (*begin == ' ') {
                begin++;
            } else {
                break;
            }
        }
        return ret;
    }

    int factor(State &begin) {
        if (*begin == '(') {
            begin++;
            int ret = expression(begin);
            begin++;
            return ret;
        } else {
            return number(begin);
        }
    }

    int number(State &begin) {
        int ret = 0;
        while (*begin == ' ') begin++;
        while (isdigit(*begin)) {
            ret *= 10;
            ret += *begin - '0';
            begin++;
        }
        return ret;
    }

    void deletespace(State &begin) {

    }

    void solve() {
        input();
        int n;
        cin >> n;

        for (int i = 0; i < n; ++i) {
            string s;
//            cin.ignore(0);
//            getline(cin, s);
            cin >> s;

            State begin = s.begin();
            int ans = expression(begin);
            cout << ans << endl;
        }

    }
};


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

    Solve().solve();


    return 0;
}



Measured memory_bytes: 3168
import java.util.*;
public class Main {

		static void solve() {
			Scanner sc = new Scanner(System.in);
			int n = sc.nextInt();
			int ans = 0;
			sc.close();
			for(int i = 1;i<=n;i+=2) {
				int check = 0;
				for(int j = 1;j<=i;j++) {
					if(i%j==0) {
						check++;
						if(check==8) {
							ans++;
						}
					}
				}
			}
			System.out.println(ans);
			
		}
	public static void main(String[] args) {
		solve();

	}

}

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

public class Main {

	public static boolean doNim(final int all, int player, int[] M, int S, boolean[][] is_memo, boolean[][] memo){
		//System.out.println((player % 2 == 0 ? "Your  Team" : "Enemy Team") + " : " + (player / 2 + 1) + "th" + " => "+ S);
		if(is_memo[S][player]){
			return memo[S][player];
		}else if(S == 0){
			is_memo[S][player] = true;
			return memo[S][player] = true;
		}
		
		boolean can_win = false;
		for(int use = M[player]; use >= 1; use--){
			if(!doNim(all, (player + 1) % all, M, Math.max(0, S - use), is_memo, memo)){
				can_win = true;
				break;
			}
		}
		
		is_memo[S][player] = true;
		return memo[S][player] = can_win;
	}
	
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		while(true){
			final int n = sc.nextInt();
			final int all = n * 2;
			
			if(n == 0){
				break;
			}
			
			final int S = sc.nextInt();
			int[] M = new int[all];
			for(int i = 0; i < all; i++){
				M[i] = sc.nextInt();
			}
			
			boolean[][] is_memo = new boolean[S + 1][all];
			boolean[][] memo = new boolean[S + 1][all];
			System.out.println(doNim(all, 0, M, S, is_memo, memo) ? 1 : 0);
			
			//System.gc();
		}
		
		
		sc.close();
	}

	public static class Scanner {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while (!hasNext()) {
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			if (tok == null) {
				return false;
			} else {
				return tok.hasMoreTokens();
			}
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public void close() throws IOException {
			br.close();
		}
	}

}

Measured memory_bytes: 22868
#include <cstdio>
#include <string>
#include <iostream>

using namespace std;

int main(void){
    int A,B,C;

    scanf("%d%d%d", &A, &B, &C);
    if ( (A >= C && B <= C) || (B >= C && A <= C)) {
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

	private static class Unionfind{
		private static int par[];
		
		public Unionfind(int n) {
			par = new int[n];
			for(int i = 0; i < n; ++i)
				par[i] = i;
		}
		
		public int root(int x) {
			if(par[x] == x)return x;
			return par[x] = root(par[x]);
		}
		
		public void unite(int x, int y) {
			int rx = root(x);
			int ry = root(y);
			if(rx == ry)return;
			par[rx] = ry;
		}
		
		public boolean isSame(int x, int y) {
			int rx = root(x);
			int ry = root(y);
			return rx == ry;
		}
		
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), m = sc.nextInt();
		int p[] = new int[n];
		for(int i = 0; i < n; ++i)
			p[i] = sc.nextInt();
		Unionfind union = new Unionfind(n);
		for(int i = 0; i < m; ++i) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			union.unite(p[x - 1] - 1, p[y - 1] - 1);
		}
		sc.close();
		int ans = 0;
		for(int i = n - 1; i >= 0; --i) {
			if(union.isSame(p[i] - 1, i)) 
				ans++;
		}
		System.out.println(ans);
	}

}


Measured memory_bytes: 91760
import java.util.Scanner;
import java.util.stream.Stream;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] bingo = new int[9];
		boolean[] bingoMap = new boolean[9];
		String ans = "No";
		int row0_3_6,row1_4_7,row2_5_8,col0_1_2,col3_4_5,col6_7_8,dia0_4_8,dia2_4_6;
		row0_3_6 = row1_4_7 = row2_5_8 = col0_1_2 = col3_4_5 = col6_7_8 = dia0_4_8 = dia2_4_6 = 0;
		for (int i = 0; i < 9; i+= 3) {
			int[] line = Stream.of(sc.nextLine().split(" ", 0)).mapToInt(Integer::parseInt).toArray();
			System.arraycopy(line, 0, bingo, i, 3);
		}
		int items =Integer.parseInt(sc.nextLine());
		for (int i = 0; i < items; i++) {
			int target = Integer.parseInt(sc.nextLine());
			for (int j = 0; j < 9; j++) {
				if (bingo[j] == target) {
					bingoMap[j] = true;
					break;
				}
			}
		}

		for (int i = 0; i < 9; i++) {
			boolean isPanched = bingoMap[i];
			if (isPanched) {
				switch(i) {
					case 0:
						row0_3_6++;
						col0_1_2++;
						dia0_4_8++;
						break;
					case 1:
						row1_4_7++;
						col0_1_2++;
						break;
					case 2:
						row2_5_8++;
						col0_1_2++;
						dia2_4_6++;
						break;
					case 3:
						row0_3_6++;
						col3_4_5++;
						break;
					case 4:
						row1_4_7++;
						col3_4_5++;
						dia0_4_8++;
						dia2_4_6++;
						break;
					case 5:
						row2_5_8++;
						col3_4_5++;
						break;
					case 6:
						row0_3_6++;
						col6_7_8++;
						dia2_4_6++;
						break;
					case 7:
						row1_4_7++;
						col6_7_8++;
						break;
					case 8:
						row2_5_8++;
						col6_7_8++;
						dia0_4_8++;
						break;
				}

				if (row0_3_6 == 3 || row1_4_7 == 3 || row2_5_8 == 3 || col0_1_2 == 3 || col3_4_5 == 3 || col6_7_8 == 3 || dia0_4_8 == 3 || dia2_4_6 == 3 ) {
					ans = "Yes";
					break;
				}

			}
		}

		System.out.println(ans);


	}

}


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

using namespace std;
int main()
{
	int N;
	int a[201];

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

	sort(a, a + 2*N);

	int Ans = 0;

	for (int j = 0; j < 2 * N; j = j + 2) {
		Ans = Ans + a[j];
	}

	cout << Ans;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <queue>
using namespace std;

int main()
{
	int h, w;
	cin >> h >> w;
	int ch, cw, dh, dw;
	cin >> ch >> cw >> dh >> dw;
	ch += 1;
	cw += 1;
	dh += 1;
	dw += 1;
	auto s = vector<string>(h + 4);
	s[0] = s[1] = s[h + 2] = s[h + 3] = string(w + 4, '#');
	for(int i = 2; i < h + 2; ++i){
		cin >> s[i];
		s[i] = "##" + s[i] + "##";
	}
	auto chk = vector<vector<int>>(h + 4, vector<int>(w + 4, -1));

	auto rec = [&s, &chk](auto rec, int x, int y, int c, set<pair<int, int>>& se) -> void {
		if(chk[y][x] != -1) return;
		chk[y][x] = c;
		int d[4][2] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}};
		for(int i = 0; i < 4; ++i){
			int dx = x + d[i][0];
			int dy = y + d[i][1];
			if(s[dy][dx] == '#') continue;
			rec(rec, dx, dy, c, se);
		}
		for(int i = -2; i < 3; ++i){
			for(int j = -2; j < 3; ++j){
				if(s[y + i][x + j] == '#') continue;
				se.insert(make_pair(x + j, y + i));
			}
		}
	};

	auto next = queue<pair<int, int>>();
	next.push(make_pair(cw, ch));
	int ans = 0;
	while(!next.empty()){
		auto teleport = set<pair<int, int>>();
		while(!next.empty()){
			int x = next.front().first;
			int y = next.front().second;
			next.pop();
			rec(rec, x, y, ans, teleport);
		}
		for(auto p : teleport){
			int x = p.first;
			int y = p.second;
			if(chk[y][x] == -1) next.push(make_pair(x, y));
		}
		++ans;
	}

	cout << chk[dh][dw] << endl;
	return 0;
}

Measured memory_bytes: 10536
#include <algorithm>
#include <array>
#include <bitset>
#include <iostream>
#include <string>

using namespace std;

int main() {
	int N;
	cin >> N;
	auto A = new int[N];
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	int count = 0;
	bool done = false;
	while (!done) {
		for (int i = 0; i < N; i++) {
			if (A[i] % 2 == 0) {
				A[i] /= 2;
			}
			else {
				done = true;
				break;
			}
		}
		if (!done) {
			count++;
		}
	}
	cout << count << endl;
}

Measured memory_bytes: 256
X = int(input())

if X < 600:
    print(8)
elif X < 800:
    print(7)
elif X < 1000:
    print(6)
elif X < 1200:
    print(5)
elif X < 1400:
    print(4)
elif X < 1600:
    print(3)
elif X < 1800:
    print(2)
elif X < 2000:
    print(1)

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

int main(void){
    string s;
    cin >> s;
    sort(all(s));
    cout << ((s[0] == s[1] && s[1] != s[2] && s[2] == s[3]) ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
 
int main() {
  int N;
  int d[100000];
  int i;

  for(i=0; i<100000; i++)
    d[i] = 1000000;

  std::cin >> N;
  for(i=0; i<N; i++)
    std::cin >> d[i];
  
  std::sort(d, d+N);

  if(N%2!=0) {
    std::cout << "0";
    return 0;
  }

  int answer = d[N/2] - d[N/2-1];

  std::cout << answer;

  return 0;

}


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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
#define LINF 1e18
typedef long long ll;


int main() {
    ll N,M; cin >> N >> M;
    vector<int> A(N);
    REP(i,N) cin >> A[i];
    sort(ALL(A));

    map<ll,int> op;
    REP(i,M){
        int b,c; cin >> b >> c;
        op[-c] += b;
    }
    ll cnt = 0;
    ll ans = 0;
    int itr = 0;
    for(auto o: op){
        int i = o.second;
        while(i > 0){
            if(-o.first <= A[itr]){
                ans += A[itr];
            }else{
                ans += -o.first;
                i--;
            }
            itr++;
            if(itr==N) break;
        }
        if(itr==N) break;
    }
    FOR(i,itr,N){
        ans += A[i];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 9872
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
const long long mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
const int ddx[4] = {1,1,-1, -1};
const int ddy[4] = {1,-1,-1,1};
//////////////////////////////////

int main(){
  int a, b; cin >> a >> b;
  if(b < a) swap(a, b);
  if(a==1&&b==2) cout << 3 << endl;
  if(a==1&&b==3) cout << 2 << endl;
  if(a==2&&b==3) cout << 1 << endl;

  return 0;
}

// EOF


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef pair<int, P> E;
const LL MOD = 1000000007LL;
int main() {
	string s;
	cin >> s;
	if (s[0] == s.back()) {
		int len = 0;
		int sum = 0;
		for (int i = 1; i < s.size(); i++) {
			if (s[i] != s[0]) len++;
			else sum += len - 1, len = 0;
		}
		if (sum % 2 == 0) cout << "Second" << endl;
		else cout << "First" << endl;
	}
	else {
		if (s.size() % 2 == 0) cout << "Second" << endl;
		else cout << "First" << endl;
	}
}

Measured memory_bytes: 512
import std.algorithm;
import std.array;
import std.ascii;
import std.bigint;
import std.complex;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

void readlnTo(T...)(ref T t) {
    auto s = readln().split();
    assert(s.length == t.length);
    foreach(ref ti; t) {
        ti = s[0].to!(typeof(ti));
        s = s[1..$];
    }
}

class UnionFindTree {
public:
    this(size_t n) {
        parent = iota(n).array();
        rank = new size_t[](n);
    }
    size_t find(size_t n) {
        if(n == parent[n]) {
            return n;
        } else {
            parent[n] = find(parent[n]);
            return parent[n];
        }
    }
    void unite(size_t n, size_t m) {
        auto p1 = find(n);
        auto p2 = find(m);
        if(n == m) {
            return;
        }
        if(rank[p1] < rank[p2]) {
            swap(p1, p2);
        }
        if(rank[p1] == rank[p2]) {
            ++rank[p1];
        }
        parent[p2] = p1;
    }
private:
    size_t[] parent;
    size_t[] rank;
}
unittest {
    auto uft = new UnionFindTree(10);
    foreach(i; iota(10)) {
        assert(uft.find(i) == i);
    }
    foreach(i; iota(10).filter!(a => a%3 == 0).drop(1)) {
        uft.unite(i, i-3);
    }
    foreach(i; iota(10).filter!(a => a%3 == 0)) {
        assert(uft.find(0) == uft.find(i));
    }
    foreach(i; iota(10).filter!(a => a%3 != 0)) {
        assert(uft.find(0) != uft.find(i));
    }
}

const real eps = 1e-10;

const long p = 1_000_000_000 + 7;

void main(){
    long n, a, b;
    readlnTo(n, a, b);
    auto x = readLongs();

    long ans;
    foreach(i; iota(n-1)) {
        auto dist = x[i+1] - x[i];
        ans += min(dist * a, b);
    }
    writeln(ans);
}



Measured memory_bytes: 4404
import java.util.Scanner;
 
public class Main {
    public static void main(String args[]){
 
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
 
        int ansA = 0;
        int ansB = 0;
 
        boolean isBreak = false;
 
        for(int a = 0;a <= 500;a++){
            for(int b = -500;b < 500;b++){
                if(fifthExponentiation(a) - fifthExponentiation(b) == x){
                    ansA = a;
                    ansB = b;
                    isBreak = true;
                    break;
                }
            }
            if(isBreak){
                break;
            }
        }
        System.out.println(ansA + " " + ansB);
    }
 
    static int fifthExponentiation(int num){
        int answer = 1;
        for(int i = 1; i <= 5; i++){
            answer *= num;
        }
        return answer;
    }
}

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

int main(){
    int a,b;
    cin>>a>>b;
    int x=a*12.5;
    int temp=x*0.08;
    while(x*0.08<a+1){
        temp=x*0.08;
        if(temp<a){
            x++;
            continue;
        }
        temp=x*0.1;
        if(temp==b){
            cout<<x<<endl;
            return 0;
        }
        x++;
    }
    cout<<"-1"<<endl;
    return 0;
}

Measured memory_bytes: 256
a, b, c, d = map(int, input().split())

takahasi = a
aoki = c
flag = True
while True:
    if takahasi <= 0:
        print("No")
        break
    elif aoki <= 0:
        print("Yes")
        break
    elif flag:
        aoki -= b
        flag = False
    else:
        takahasi -= d
        flag = True


Measured memory_bytes: 9164
#include <iostream>
using namespace std;
#include<string>
int main(){
	string S,sunadatyan;
      cin>>S>>sunadatyan;
     if(S[0]==sunadatyan[2]&&S[1]==sunadatyan[1]&&S[2]==sunadatyan[0]){
     	cout<<"YES"<<endl;
     }
     else{
     	cout<<"NO"<<endl;
     }
}


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

using namespace std;
using ll = long long;

#define REP2(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; ++i)
#define REP3(i, l, r) for (int i = (l), i##_len = (int)(r); i < i##_len; ++i)
#define GET_MACRO_REP(_1, _2, _3, NAME, ...) NAME
#define REP(...) GET_MACRO_REP(__VA_ARGS__, REP3, REP2) (__VA_ARGS__)
#define RREP2(i, n) for (int i = (n - 1); i >= 0; --i)
#define RREP3(i, l, r) for (int i = (r - 1), i##_len = (l); i >= i##_len; --i)
#define GET_MACRO_RREP(_1, _2, _3, NAME, ...) NAME
#define RREP(...) GET_MACRO_REP(__VA_ARGS__, RREP3, RREP2) (__VA_ARGS__)
#define IN(type, n) type n; cin >> n
#define INALL(type, v) REP(i, v.size()) { IN(type, _tmp); v.at(i) = _tmp; }
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

#ifdef _DEBUG
#define DEBUG(x) cout << #x << ": " << x << endl
#else
#define DEBUG(x)
#endif

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; }
#pragma endregion

int main() {
  IN(int, N);
  IN(int, M);
  vector<vector<int> > switchs(N, vector<int>(0));
  REP(i, M) {
    IN(int, k);
    REP(j, k) {
      IN(int, s);
      switchs.at(--s).push_back(i);
    }
  }
  vector<int> p(M);
  INALL(int, p)

  int max = (int)pow(2, N);
  int count = 0;
  REP(bits, max) {
    vector<int> lights(M, 0);
    REP(i, N) {
      if ((bits & (1 << i)) != 0) {
        REP(j, switchs.at(i).size()) {
          lights.at(switchs.at(i).at(j))++;
        }
      }
    }
    bool ok_flag = true;
    REP(i, M) {
      if (lights.at(i) % 2 != p.at(i)) {
        ok_flag = false;
        break;
      }
    }
    if (ok_flag) count++;
  }
  cout << count << endl;

  return 0;
}


Measured memory_bytes: 4048
import queue

class Dinic:
    def __init__(self, v, inf = 1000000007):
        self.V = v
        self.inf = inf
        self.G = [[] for _ in range(v)]
        self.level = [0 for _ in range(v)]
        self.iter = [0 for _ in range(v)]

    def add_edge(self, from_, to, cap):
        # to: 行き先, cap: 容量, rev: 反対側の辺
        self.G[from_].append({'to':to, 'cap':cap, 'rev':len(self.G[to])})
        self.G[to].append({'to':from_, 'cap':0, 'rev':len(self.G[from_])-1})

    # sからの最短距離をbfsで計算
    def bfs(self, s):
        self.level = [-1 for _ in range(self.V)]
        self.level[s] = 0
        que = queue.Queue()
        que.put(s)
        while not que.empty():
            v = que.get()
            for i in range(len(self.G[v])):
                e = self.G[v][i]
                if e['cap'] > 0 and self.level[e['to']] < 0:
                    self.level[e['to']] = self.level[v] + 1
                    que.put(e['to'])

    # 増加バスをdfsで探す
    def dfs(self, v, t, f):
        if v == t: return f
        for i in range(self.iter[v], len(self.G[v])):
            self.iter[v] = i
            e = self.G[v][i]
            if e['cap'] > 0 and self.level[v] < self.level[e['to']]:
                d = self.dfs(e['to'], t, min(f, e['cap']))
                if d > 0:
                    e['cap'] -= d
                    self.G[e['to']][e['rev']]['cap'] += d
                    return d

        return 0

    def max_flow(self, s, t):
        flow = 0
        while True:
            self.bfs(s)
            # bfsで到達不可
            if self.level[t] < 0 : return flow
            self.iter = [0 for _ in range(self.V)]
            f = self.dfs(s, t, self.inf)
            while f > 0:
                flow += f
                f = self.dfs(s,t, self.inf)


N = int(input())
A = [] #R_x
B = [] #R_y
C = [] #B_x
D = [] #B_y

for i in range(N):
    a,b = map(int, input().split())
    A.append(a)
    B.append(b)
for i in range(N):
    c,d = map(int, input().split())
    C.append(c)
    D.append(d)

#Rは2～N+1、BはN+2～2N+1
s = 0
e = 1
r_top = 2
b_top = N+2

dinic = Dinic(2 + 2*N)
for i in range(N):
    dinic.add_edge(s, r_top+i, 1)
    for j in range(N):
        if ((A[i] < C[j]) & (B[i] < D[j])):
            dinic.add_edge(r_top+i, b_top+j, 1)
            #print(i, j)
    dinic.add_edge(b_top+i, e, 1)

f = dinic.max_flow(s, e)

print(f)


Measured memory_bytes: 5744
n = int(input())
t,a = map(int, input().split())
h = list(map(int,input().split()))
ans = 1
temp = t-h[0]*0.006
for i in range(n):
    loc = t-h[i]*0.006
    if abs(a-loc)<abs(a-temp):
        temp = loc
        ans = i+1
print(ans)

Measured memory_bytes: 62500
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;
import std.container : heapify;

void main()
{
    auto N = readln.chomp.to!int;
    auto as = readln.split.to!(long[]);

    long[] lres, rres;
    lres.length = N+1;
    rres.length = N+1;

    auto ls = as[0..N].dup;
    sort!"a < b"(ls);
    foreach (l; ls) lres[0] += l;
    auto lq = heapify!"a > b"(ls, ls.length);

    auto rs = as[2*N..$].dup;
    sort!"a > b"(rs);
    foreach (r; rs) rres[N] += r;
    auto rq = heapify!"a < b"(rs, rs.length);

    foreach (i; 1..N+1) {
        auto l = as[N+i-1];
        lres[i] += lres[i-1] + l;
        if (l < lq.front) {
            lres[i] -= l;
        } else {
            lres[i] -= lq.front;
            lq.replaceFront(l);
        }

        auto r = as[2*N-i];
        rres[N-i] += rres[N-i+1] + r;
        if (r > rq.front) {
            rres[N-i] -= r;
        } else {
            rres[N-i] -= rq.front;
            rq.replaceFront(r);

        }
    }

    long max_r = long.min;
    foreach (i; 0..N+1) {
        max_r = max(max_r, lres[i] - rres[i]);
    }

    writeln(max_r);
}

Measured memory_bytes: 17452
def main():
    n = int(input())
    A = list( map(int, input().split()) )
    A.sort()
    ans = "YES"
    for i in range(n-1):
        if A[i] == A[i+1]:
            ans = "NO"
            break

    print(ans)
    return

if __name__=="__main__":
    main()

Measured memory_bytes: 86740
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=-1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

a,b=get_i
diff=b-a
puts diff*(diff+1)/2-b

Measured memory_bytes: 3836