akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using ll=long long;
using namespace std;
#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  int n, k;
  cin >> n >> k;
  double m = 0;
  double sum = 0;
  vector<double> hoge(n);
  double a;
  for (int i = 0; i < n; i++){
    cin >> a;
    hoge[i] = (a+1)/2;
  }

  for (int i = 0; i < k; i++){
    sum += hoge[i];
  }
  if(sum >= m){
    m = sum;
  }
  
  for (int i = k; i < n; i++){
    sum += hoge[i];
    sum -= hoge[i - k];
    if(sum >= m){
      m = sum;
    }
  }
  cout << fixed << setprecision(10) << m << endl;
}

Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;

class Program {
    static void Main(string[] args) {
        int n = Cin.Ni();
        HashSet<int> list = new HashSet<int>();
        for (int i = 0; i < n; i++) {
            int a = Cin.Ni();
            if (list.Contains(a)) {
                list.Remove(a);
            } else {
                list.Add(a);
            }
        }
        Console.WriteLine(list.Count);
    }
}


public class Cin {
    private static string[] s = new string[0];
    private static int i = 0;

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

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

    public static int Ni() {
        return int.Parse(Next());
    }

    public static long NextLong() {
        return long.Parse(Next());
    }

    public static double NextDouble() {
        return double.Parse(Next());
    }

}


Measured memory_bytes: 17624
#include<stdio.h>
#include<stdlib.h>
#define MAX_N 100

//???????????????
struct TLine{
  int dist;
  int a,b;
};

typedef struct TLine Line;

Line *line;

int par[MAX_N];
int rank[MAX_N];

//Union Find Tree?????????????????????
//????????¶?????§??????????????????????????§???
//?????¨??????????´???????????????????
void init(int n){
  int i;
  for(i=0;i<n;i++){
    par[i] = i;
    rank[i] = 0;
  }
}


//x?????????????´?????±??????????????????£??¨????????????
int find(int x){
  if(par[x]==x){
    return x;
  }else {
    return par[x] = find(par[x]);
  }
}

//x,y????±?????????????????????¨??????
void unite(int x,int y){
  x =find(x);
  y =find(y);
  if(x==y){
    return ;
  }
  if(rank[x] < rank[y]){
    par[x] = y;
  }else {
    par[y] = x;
    if(rank[x] == rank[y])rank[x]++;
  }
}

//x,y????±?????????????????????????????????????
int same(int x,int y){
  return find(x)==find(y);
}

//?????????????????????(Line.dist?????????)
void LineSort(int s,int e,Line* array){
  int i,j,k;
  i=s-1;
  j=e;
  while(i<j){
    while(++i<e&&array[i].dist<array[e].dist);
    while(--j>=s&&array[j].dist>=array[e].dist);
    if(i<j){
      //??¢??°????????¨??????????????????
      array[i].dist+=array[j].dist;
      array[j].dist=array[i].dist-array[j].dist;
      array[i].dist-=array[j].dist;

      array[i].a+=array[j].a;
      array[j].a=array[i].a-array[j].a;
      array[i].a-=array[j].a;

      array[i].b+=array[j].b;
      array[j].b=array[i].b-array[j].b;
      array[i].b-=array[j].b;

    }
  }
  if(i<e){
    //?????????????????????

    array[e].dist+=array[i].dist;
    array[i].dist=array[e].dist-array[i].dist;
    array[e].dist-=array[i].dist;

    array[e].a+=array[i].a;
    array[i].a=array[e].a-array[i].a;
    array[e].a-=array[i].a;

    array[e].b+=array[i].b;
    array[i].b=array[e].b-array[i].b;
    array[e].b-=array[i].b;

    i++;
  }
  if(s<j)LineSort(s,j,array);
  if(e>i)LineSort(i,e,array);
}

int main(){
  int n,m;
  char s[16];
  int i,j,a,b,d;
  long long int res;
  while(1){
    if(!fgets(s,16,stdin))break;
    sscanf(s,"%d",&n);
    if(n==0)break;
    if(!fgets(s,16,stdin))break;
    sscanf(s,"%d",&m);
    line=(Line*)malloc(sizeof(Line)*m);
    init(n);
    for(i=0;i<m;i++){
      fgets(s,16,stdin);
      sscanf(s,"%d,%d,%d",&a,&b,&d);
      line[i].a=a;
      line[i].b=b;
      line[i].dist=d;
    }
    
    LineSort(0,m-1,line);
    res=0;
    for(i=j=0;i<n-1&&j<m;j++){
      if(!same(line[j].a,line[j].b)){
        unite(line[j].a,line[j].b);
        res+=line[j].dist/100-1;
        i++;
      }
    }
    free(line);
    printf("%lld\n",res);
  }
  return 0;
}

Measured memory_bytes: 668
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		int K = int.Parse(Console.ReadLine());
		if(7%K==0){
			Console.WriteLine(1);
		} else {
			int ans = 2;
			int A = 77;
			while(true){
				if(A%K==0){
					break;
                } else if(ans>=100000000){
					ans = -1;
                  	break;
				} else {
					A = A%K;
					A = A*10+7;
					ans++;
				}
			}
			Console.WriteLine(ans);
        }
	}
}

Measured memory_bytes: 17604
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <cassert>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> PI;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair
#define PB push_back

int n,w,h;
int fie[101][101];
int s,t;

int x,y;

main(){
  while(cin>>n,n){
    cin>>w>>h;
    memset(fie,0,sizeof(fie));
    rep(i,n){
      cin>>x>>y;
      fie[x][y]++;
    }

    cin>>s>>t;
    for(int i=1;i<=w;i++){
      for(int j=1;j<=h;j++){
        fie[i][j]+=fie[i-1][j]+fie[i][j-1]-fie[i-1][j-1];
      }
    }
    int ans=0;
    for(int i=0;i+s<=w;i++){
      for(int j=0;j+t<=h;j++){
        ans=max(ans,fie[i+s][j+t]-fie[i][j+t]-fie[i+s][j]+fie[i][j]);
      }
    }
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOREACH(x, a) for(auto x : a)

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define LN() cerr << "\n"
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll N = 0;
ll tmp;
ll ret = 0;
unordered_map<string, ll> table[105];

set<string> groupC{
  "AGT", 
  "AGG", 
  "ATG", 
  "AAG", 
  "TAG",
  "GAG",
  "CAG",
  "AGA",
  "TGA",
  "GGA",
  "CGA"
};

set<string> groupG{
  "AAC",
  "TAC",
  "GAC",
  "CAC"
};

ll count(string str, ll depth) {
  //手前三文字から次の一文字を決める
  if (depth == N) {
    return 1;
  }
  if (table[depth].find(str) != table[depth].end()) {
    return table[depth][str];
  }
  ll sum = 0;
  string sub = str.substr(1, 2);

  if (groupC.find(str) != groupC.end()) {
    sum += count(sub+"A", depth+1);
    sum %= MOD;
    sum += count(sub+"T", depth+1);
    sum %= MOD;
    sum += count(sub+"G", depth+1);
    sum %= MOD;
  } else if (groupG.find(str) != groupG.end()) {
    sum += count(sub+"A", depth+1);
    sum %= MOD;
    sum += count(sub+"T", depth+1);
    sum %= MOD;
    sum += count(sub+"C", depth+1);
    sum %= MOD;
  } else {
    sum += count(sub+"A", depth+1);
    sum %= MOD;
    sum += count(sub+"T", depth+1);
    sum %= MOD;
    sum += count(sub+"G", depth+1);
    sum %= MOD;
    sum += count(sub+"C", depth+1);
    sum %= MOD;
  }
  table[depth][str] = sum;
  return sum;
}

void input() {
  IN(N);
}

void solve() {
  string item[4] = {"A", "T", "G", "C"};

  if (N == 1) {
    ret = 4;
  } else if (N == 2) {
    ret = 16;
  } else {
    REP(i, 4) {
      REP(j, 4) {
        REP(k, 4) {
          string str = item[i]+item[j]+item[k];
          if (str != "AGC" &&
              str != "GAC" &&
              str != "ACG") {
            ret += count(str, 3);
            ret %= MOD;
          }
        }
      }
    }
  }
  PRINT(ret);
}

int main(void){
  input();
  solve();
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;


int main(){
    int N;
    long long W;
    scanf("%d%lld", &N, &W);
    long long dp[110][100100] = {0};
    vector<long long> weight(N);
    vector<long long> value(N);
    for(int i = 0; i < N; i++)scanf("%lld%lld", &weight[i], &value[i]);
    
    for(int i = 0; i < N; i++){
        for(int w = 0; w <= W; w++){
            if(w - weight[i] >= 0){
                dp[i + 1][w] = max(dp[i + 1][w], dp[i][w - weight[i]] + value[i]);
            }
            dp[i + 1][w] = max(dp[i + 1][w], dp[i][w]);
        }
    }
    
    printf("%lld\n", dp[N][W]);
}

Measured memory_bytes: 86272
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main(){
   int a,b;
   cin >> a >> b;
   if(b%a == 0){
      cout<< a+b;
   }else{
      cout<<b-a;
   }
   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <limits.h>
#include <cmath>
using namespace std;

int N;
long long A[200010]={0};
int main(){
	cin >> N;
	for(int i=1;i<=N;i++){
		cin >> A[i];
		A[i] += A[i-1];
	}
	long long ans = LONG_LONG_MAX;
	for(int i=1;i<=N-1;i++){
		if(fabs(A[N]-2*A[i])<ans) ans = fabs(A[N]-2*A[i]);
	}
	cout << ans << endl;
}

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

using namespace std;

const int N = 30;

int n, m;
int beats[N];
int yubi[N];

main(){
  while(cin >> n >> m && (n|m)){
    for(int i=0;i<n;i++){
      beats[i] = 0;
      for(int j=0;j<16;j++){
        int in;
        cin >> in;
        beats[i] |= (in<<j);
      }
    }
    for(int i=0;i<m;i++){
      yubi[i] = 0;
      for(int j=0;j<16;j++){
        int in;
        cin >> in;
        yubi[i] |= (in<<j);
      }
    }
    int dp[2][1<<16];
    fill(dp[0], dp[2], -1);
    dp[0][0] = 0;
    for(int k=0;k<n;k++){
      for(int i=0;i<(1<<16);i++){
        if(dp[k%2][i] == -1) continue;
        int s = i | beats[k];
        for(int j=0;j<m;j++){
          int t = s & yubi[j];
          int score = 0;
          for(int l=0;l<16;l++) if((t >> l) & 1) score++;
          int u = s & ~t;
          dp[(k+1)%2][u] = max(dp[(k+1)%2][u], score + dp[k%2][i]);
        }
      }
    }
    int ans = 0;
    for(int i=0;i<(1<<16);i++) ans = max(ans, dp[n%2][i]);
    cout << ans << endl;
  }
}

Measured memory_bytes: 1672
//FIRST THINK THEN CODE.

#include <bits/stdc++.h>
 
 
using namespace std;
 
typedef long long ll;
 
#define MOD 998244353
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define rrep(i,a,b) for(ll i=a;i>b;--i)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()
#define endl "\n"
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
ll newmod(ll a,ll b)
 {
  return ((a%b)+b)%b;
}
 
 
ll powM(ll a,ll b,ll m )
{ 
  a%=m;
  ll ans=1LL;
  while(b)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }
 
return ans;
}
 
ll poww(ll a,ll b)
{ 
  
  ll ans=1;
  while(b)
  {
    if(b&1)ans=ans*a;
    a=a*a;
    b>>=1;
  }
 
return ans;
}

const ll N=5e5+5;

ll sp[N];

void sieve(){
  for(int i=2;i<N;i++)sp[i]=i;

    for(int i=2;i*i<N;i++){
      if(sp[i]==i){
      for(int j=i*i;j<N;j+=i){
        sp[j]=i;
      }
    }
}

}

ll fac[N],inv[N];

ll p=1e9+7;

void fill(){
  fac[0]=inv[0]=1;

  for(int i=1;i<N;i++){
    fac[i]=fac[i-1]*i%p;
    inv[i]=powM(fac[i],p-2,p);
  }
}

ll c(ll a,ll b,ll p){
if(a<b)return 0;

  return (fac[a]*inv[a-b]%p)*(inv[b])%p;
}


int main()
{ 

  IOS;

ll n;cin>>n;

ll ans=0;

for(ll i=1;i<=n;i++){
  ll x=n/i;
  ans=ans+i*x*(x+1)/2;
}
cout<<ans<<endl;

return 0;
 
}



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

int main(){
	int N,K;
	cin>>N>>K;
	long V[N];
	for(int i=0;i<N;++i){
		cin>>V[i];
	}
	long ans = 0;
	for(int i=0;i<=min(K,N);++i){
		for(int j=0;j<=i;++j){
			vector<long>tmpvec;
			for(int r=0;r<j;++r){
				tmpvec.push_back(V[N-r-1]);
			}
			for(int l=0;l<i-j;++l){
				tmpvec.push_back(V[l]);
			}
			/*
			for(int k=0;k<tmpvec.size();++k){
				cout<<tmpvec[k]<<" ";
			}
			cout<<endl;
			*/
			sort(tmpvec.begin(),tmpvec.end(),greater<long>());
			long tmpans=0;
			for(int k=0;k<max(0,2*i-K);++k){
				tmpans+=tmpvec[k];
			}
			for(int k=max(0,2*i-K);k<i;++k){
				if(tmpvec[k]<0) break;
				else tmpans+=tmpvec[k];
			}
			//cout<<tmpans<<endl;
			//cout<<endl;
			if(ans<tmpans)ans=tmpans;
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
A, B, C = map(int, input().split())
K = int(input())
a=0
for i in range(K+1):
    if B*(2**i) > A:
        if C*(2**(K-i)) > B*(2**i):
            a=1
if a==1:
    print('Yes')
if a==0:
    print('No')


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

int main() {
  int a,b,i=0;
  cin >> a>>b;
  while(a<=b){
    if(a/10000==a%10 && a/1000%10==a/10%10){
      i++;
    }
    a++;
  }
  cout<<i<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pi;
 
 
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define all(x) x.begin(), x.end()
 
const int MOD = 1000000007;
const ll INF = 1e18;
 
int main() 
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	ll H;
	cin >>H ;
	ll ans=0;
	int i =0;
	while(H>0)
	{
		ans+= pow(2,i);
		H= H>>1;
		i++;
	}
	cout<<ans<<endl;
			
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int k, x; cin >> k >> x;
	cout << (500 * k >= x ? "Yes" : "No") << endl;
	
	return 0;
}

Measured memory_bytes: 256
n = int(input())
ans = 0
for i in range(1, n + 1):
    x, y = i, (n // i) * i
    #等差数列の和は(1/2)*(項数(今回はn//i))*(初項＋末項)
    ans += ((n // i) * (x + y) // 2)
print(ans)

Measured memory_bytes: 63404
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <functional>
#include <numeric>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
using namespace std;
#define INT_MAX 2147483647
#define INT_MIN (-2147483647 - 1)
#define INF (int)1e8
#define _INF (int)-1e8
#define INFLL (long long)1e14
#define _INFLL (long long)-1e14
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loop1(i, n) for(int i = 1; i <= (int)n; i++)
#define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)n; i >= 1; i--)
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> P;

int main() {
	int n, c, k;
	cin >> n >> c >> k;
	vi t(n);
	Loop(i, n) cin >> t[i];
	sort(t.begin(), t.end());
	int cnt = 1;
	int dt = 0;
	int ans = 0;
	Loop1(i, n - 1) {
		dt += t[i] - t[i - 1];
		if (dt > k || cnt ==c){
			ans++;
			cnt = dt = 0;
		}
		cnt++;
	}
	ans++;
	cout << ans << endl;
}

Measured memory_bytes: 640
ROOT = 3
MOD = 998244353
roots  = [pow(ROOT,(MOD-1)>>i,MOD) for i in range(24)] # 1 の 2^i 乗根
iroots = [pow(x,MOD-2,MOD) for x in roots] # 1 の 2^i 乗根の逆元

def untt(a,n):
    for i in range(n):
        m = 1<<(n-i-1)
        for s in range(1<<i):
            w_N = 1
            s *= m*2
            for p in range(m):
                a[s+p], a[s+p+m] = (a[s+p]+a[s+p+m])%MOD, (a[s+p]-a[s+p+m])*w_N%MOD
                w_N = w_N*roots[n-i]%MOD

def iuntt(a,n):
    for i in range(n):
        m = 1<<i
        for s in range(1<<(n-i-1)):
            w_N = 1
            s *= m*2
            for p in range(m):
                a[s+p], a[s+p+m] = (a[s+p]+a[s+p+m]*w_N)%MOD, (a[s+p]-a[s+p+m]*w_N)%MOD
                w_N = w_N*iroots[i+1]%MOD
            
    inv = pow((MOD+1)//2,n,MOD)
    for i in range(1<<n):
        a[i] = a[i]*inv%MOD

def convolution(a,b):
    la = len(a)
    lb = len(b)
    deg = la+lb-2
    n = deg.bit_length()
    if min(la, lb) <= 50:
        if la < lb:
            la,lb = lb,la
            a,b = b,a
        res = [0]*(la+lb-1)
        for i in range(la):
            for j in range(lb):
                res[i+j] += a[i]*b[j]
                res[i+j] %= MOD
        return res

    N = 1<<n
    a += [0]*(N-len(a))
    b += [0]*(N-len(b))
    untt(a,n)
    untt(b,n)
    for i in range(N):
      a[i] = a[i]*b[i]%MOD
    iuntt(a,n)
    return a[:deg+1]

def convolution_all(polys):
    if not polys: return [1]
    polys.sort(key=lambda x:len(x))

    from collections import deque
    q = deque(polys)
    for _ in range(len(polys)-1):
        a = q.popleft()
        b = q.popleft()
        q.append(convolution(a,b))
    return q[0]        
        

SIZE=10**5 + 10 #998244353 #ここを変更する

inv = [0]*SIZE  # inv[j] = j^{-1} mod MOD
fac = [0]*SIZE  # fac[j] = j! mod MOD
finv = [0]*SIZE # finv[j] = (j!)^{-1} mod MOD
fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
for i in range(2,SIZE):
    fac[i] = fac[i-1]*i%MOD
finv[-1] = pow(fac[-1],MOD-2,MOD)
for i in range(SIZE-1,0,-1):
    finv[i-1] = finv[i]*i%MOD
    inv[i] = finv[i]*fac[i-1]%MOD

def choose(n,r): # nCk mod MOD の計算
    if 0 <= r <= n:
        return (fac[n]*finv[r]%MOD)*finv[n-r]%MOD
    else:
        return 0

dfac = [0]*SIZE  # fac[j] = j! mod MOD
dfac[0] = dfac[1] = 1
for i in range(2,SIZE):
    dfac[i] = dfac[i-2]*i%MOD

import sys
readline = sys.stdin.readline
read = sys.stdin.read

n,*h = map(int, read().split())
from collections import Counter

def get(k): # k 個の頂点からiペア作れる場合の数
    res = [1]
    for i in range(k//2):
        res.append(res[-1]*choose(k-2*i,2)%MOD)
    for i in range(2,k//2 + 1):
        res[i] = res[i]*finv[i]%MOD
    return res        


d = Counter(h)
res = []
for k,v in d.items():
    if v >= 2: res.append(get(v))
    if v > n: 
        print(0)
        exit()
    
bad = convolution_all(res)

#print(bad)
#bad = [1,5,7,3]
ans = 0
sgn = 1
for i,ai in enumerate(bad):
    ans += sgn*(dfac[2*n-2*i-1] if i < n else 1)*ai  
    ans %= MOD
    sgn *= -1
    #print(ans)

print(ans%MOD)


Measured memory_bytes: 103388
#define _USE_MATH_DEFINES
#include <iostream>
#include <memory>
#include <memory.h>
#include <fstream>
#include <cmath>
#include <numeric>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <sstream>
#include <cstdlib>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <map>
#include <set>
#include <iomanip>
#include <list>
#include <cctype>
#include <algorithm>
#include <complex>
using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<double, double> Pd;
typedef pair<int, P> PP;
typedef pair<int, PP> PPP;
const int INF = 1 << 29;
const double EPS = 1E-10;

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

ll nums[200000];
ll m[200000];
map<ll,ll> mods;

void make_input(int N, int S, int W){
	int g = S;
	rep(i, N){
		nums[i] = (g / 7) % 10;
		if(g % 2 == 0) g /= 2;
		else g = (g / 2) ^ W;
	}
}

int main(){
	int N, S, Q, W;
	while(cin >> N >> S >> W >> Q && (N || S || W || Q)){
		ll res = 0;
		ll n = 1;
		mods.clear();
		make_input(N, S, W);
		if(Q == 2){
			int cnt = 0;
			rep(i, N){
				if(nums[N-1-i] % 2 == 0){
					cnt++;
				}
				if(nums[N-1-i] != 0) res += cnt;
			}
		}else if(Q == 5){
			int cnt = 0;
			rep(i, N){
				if(nums[N-1-i] % 5 == 0){
					cnt++;
				}
				if(nums[N-1-i] != 0) res += cnt;
			}
		}else{
			make_input(N, S, W);
			mods[0]++;
			ll num = 0;
			rep(i, N){
				ll pre = (i == 0 ? 0: m[i-1]);
				m[i] = pre + n * nums[N-i-1];
				m[i] %= Q;
				n = (n * 10) % Q;
			}
			rep(i, N){
			//	cout << m[i] << endl;
				if(nums[N-i-1] != 0) res += mods[m[i]];
				mods[m[i]]++;
			}
			
		}
		cout << res << endl;
	}
	return 0;
}

Measured memory_bytes: 0
/* Great things never come from comfort zones,
"whatever the mind of a man can conceive and believe,it can achieve." */
 
#include <bits/stdc++.h>
#define ll long long
#define scf(n) scanf("%d",&n)
#define lscf(n) scanf("%lld",&n)
#define lpri(n) printf("%lld ",n)
#define pri(n) printf("%d ",(int)n)
#define prin(n) printf("%d\n",(int)n)
#define lprin(n) printf("%lld\n",n)
#define rep(i,ini,n) for(ll i=ini;i<(int)n;i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x)     x.begin(),x.end()
#define tc   int tt; scf(tt); while(tt--)
#define inf INT_MAX
#define ninf INT_MIN
#define gcd __gcd
#define bitcount(n) __builtin_popcount(n)
typedef double dd;
using namespace std;
const ll mod =1e9+7;
const int N = 1e6+7;

void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B) 
{ cout << ' ' << A; my_dbg(B...); }
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

  
int main()
{
        int n;
        scf(n);
        
        vector<int>a;
        
        rep(i,0,n)
        {
            int x;
            scf(x);
            
            a.pb(x);
        }
        
        set<int>s;
        
        s.insert(a[0]);
        
        ll ans=1;
        
        for(int i=1;i<a.size();i++)
        {
            int v1=(*s.begin());
            
            int v2= *(--s.end());
        
            
            if(a[i]<=v1&&a[i]<=v2)
            ans++,s.insert(a[i]);
        
        }
        
        lprin(ans);
        
}

Measured memory_bytes: 13296
#include <stdio.h>

int main(void){
  int n, k;

  scanf("%d %d", &n, &k);
  if(k==1){
    printf("0\n");
  }else if(k==n){
    printf("0\n");
  }else{
    printf("%d\n", n-k);
  }

  return 0;
}


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

using namespace std;

int main(){
    int a1;
    int a2;
    int a3;
    int dif12;
    int dif23;
    int dif31;
    int m;

    cin >> a1 >> a2 >> a3;

    dif12 = abs(a1-a2);
    dif23 = abs(a2-a3);
    dif31 = abs(a3-a1);
    m = max({dif12,dif23,dif31});

    cout << dif12+dif23+dif31-m;

    //cout << a1 << a2 << a3;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>

typedef struct point
{
	double x;
	double y;
}pointer;

void kock(int n, pointer p1, pointer p2)
{
	pointer s,t,u;
	double th=M_PI*60/180;
	
	if(n==0)
	{
		return;
	}
	
	s.x=(2.0*p1.x+1.0*p2.x)/3.0;
	s.y=(2.0*p1.y+1.0*p2.y)/3.0;
	
	t.x=(1.0*p1.x+2.0*p2.x)/3.0;
	t.y=(1.0*p1.y+2.0*p2.y)/3.0;
	
	u.x=(t.x-s.x)*cos(th)-(t.y-s.y)*sin(th)+s.x;
	u.y=(t.x-s.x)*sin(th)+(t.y-s.y)*cos(th)+s.y;
	
	kock(n-1,p1,s);
	printf("%.8f %.8f\n",s.x,s.y);
	
	kock(n-1,s,u);
	printf("%.8f %.8f\n",u.x,u.y);
	
	kock(n-1,u,t);
	printf("%.8f %.8f\n",t.x,t.y);
	
	kock(n-1,t,p2);
}

int main(void)
{
	int n;
	scanf("%d",&n);
	
	pointer a,b;
	
	a.x=0;
	a.y=0;
	b.x=100;
	b.y=0;
	
	printf("%.8f %.8f\n",a.x,a.y);
	
	kock(n,a,b);
	
	printf("%.8f %.8f\n",b.x,b.y);
	
	return 0;
}


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

int main(){
  int A, B;
  cin >> A >> B;
  
  int wa, sa, seki;
  
  wa = A + B;
  sa = A - B;
  seki = A * B;
  
  if (wa >= sa) {
    if (seki >= wa) {
      cout << seki << endl;
    }
    else {
      cout << wa << endl;
    }
  }
  
  else {
    if (seki >= sa) {
      cout << seki << endl;
    }
    else {
      cout << sa << endl;
    }
  }
  
  return 0;
  
}

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

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

  map<string,int> mp;
  mp["SUN"] = 7;
  mp["MON"] = 6;
  mp["TUE"] = 5;
  mp["WED"] = 4;
  mp["THU"] = 3;
  mp["FRI"] = 2;
  mp["SAT"] = 1;

  cout << mp[s] << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
    int n,x,i,j,k;
    for(;;){
        k=0;
        scanf("%d %d",&n,&x);
        if(n+x==0) break;
        
        for(i=1;i<=n;i++)
            for(j=i+1;j<=n;j++)
                if(j<x-i-j && x-i-j<=n)
                    k++;
        
        printf("%d\n",k);
    }
        
    return 0;
}



Measured memory_bytes: 2140
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) {
	if os.Getenv("ONLINE_JUDGE") == "false" {
		fmt.Fprintln(os.Stderr, a...)
	}
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	h, w := scanInt(), scanInt()
	bit := binaryIndexedTreeInit(w)
	for i := 0; i < w; i++ {
		bit.add(i, 1)
	}

	dp := make([]int, w)
	pq := &pqAsc{}
	for i := 0; i < w; i++ {
		heap.Push(pq, pair{0, i})
	}

	for i := 0; i < h; i++ {
		a, b := scanInt()-1, scanInt()-1

		if b+1 != w && dp[b+1] == -1 {
			s := bit.sum(b + 1)
			if s != 0 {
				k := bit.lowerbound(s)
				dp[b+1] = b + 1 - k + dp[k]
				bit.add(b+1, 1)
				heap.Push(pq, pair{dp[b+1], b + 1})
			}
		}

		s := bit.sum(a-1) + 1
		for {
			k := bit.lowerbound(s)
			if k > b {
				break
			}
			bit.add(k, -1)
			dp[k] = -1
		}

		for len(*pq) != 0 && dp[(*pq)[0].b] != (*pq)[0].a {
			heap.Pop(pq)
		}

		if len(*pq) == 0 {
			fmt.Fprintln(wr, -1)
		} else {
			fmt.Fprintln(wr, (*pq)[0].a+i+1)
		}
		debug(dp)
	}

}

type binaryIndexedTree []int

func binaryIndexedTreeInit(n int) binaryIndexedTree {
	return make(binaryIndexedTree, n+1)
}

func (t binaryIndexedTree) sum(i int) (s int) {
	for i++; i > 0; i -= i & -i {
		s += t[i]
	}
	return
}
func (t binaryIndexedTree) add(i, x int) {
	for i++; i < len(t) && i > 0; i += i & -i {
		t[i] += x
	}
}

func (t binaryIndexedTree) lowerbound(x int) int {
	idx, k := 0, 1
	for k < len(t) {
		k <<= 1
	}
	for k >>= 1; k > 0; k >>= 1 {
		if idx+k < len(t) && t[idx+k] < x {
			x -= t[idx+k]
			idx += k
		}
	}
	return idx
}

type pair struct{ a, b int }

type pqAsc []pair

func (pq pqAsc) Len() int            { return len(pq) }
func (pq pqAsc) Swap(i, j int)       { pq[i], pq[j] = pq[j], pq[i] }
func (pq pqAsc) Less(i, j int) bool  { return pq[i].a < pq[j].a }
func (pq *pqAsc) Push(x interface{}) { *pq = append(*pq, x.(pair)) }
func (pq *pqAsc) Pop() interface{} {
	x := (*pq)[len(*pq)-1]
	*pq = (*pq)[0 : len(*pq)-1]
	return x
}


Measured memory_bytes: 23108
#include <iostream>

using namespace std;

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

    if(N == 25){
        cout << "Christmas" << endl;
    }else if(N == 24){
        cout << "Christmas Eve" << endl;
    }else if(N == 23){
        cout << "Christmas Eve Eve" << endl;
    }else{
        cout << "Christmas Eve Eve Eve" << endl;
    }
}

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

int main(){
  string n;
  cin >> n;
  rep(i,n.size()){
    if( n.at(i) == '7' ){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
typedef long long ll;
const int MAXN = 100500;

map <int, int> cnt;

int main()
{                                                     
	ios_base::sync_with_stdio(0);
	
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		int val;
		cin >> val;
		cnt[val]++;
	}

	if (cnt.size() > 2 || (cnt.size() == 2 && cnt.begin()->first + 1 != (--cnt.end())->first))
	{		
		cout << "No\n";
		return 0;
	}

	if (cnt.size() == 2)
	{
		int need_color = (--cnt.end())->first - cnt.begin()->second;
		int people = (--cnt.end())->second;

		if (need_color <= people / 2 && need_color >= 1)
		{
			cout << "Yes\n";
		}
		else
		{
			cout << "No\n";
		}
	}
	else
	{
		int need_color = cnt.begin()->first;
		int people = cnt.begin()->second;


		if (need_color == people - 1)
		{
			cout << "Yes\n";
		}
		else
		{
			if (need_color <= people / 2 && need_color >= 1)
			{
				cout << "Yes\n";
			}
			else
			{
				cout << "No\n";
			}
		}
	}
	return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long INF = 1LL<<60;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP2(i,m,n) for(int i=m;i<n;i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
static const double pi = 3.14159265358979323846;

int main(){
    int n,m,k;
    cin >> n >> m >> k;
    int A[n],B[m];
    ll a[n+1]={},b[m+1]={};
    
    REP(i,n){
        cin>>A[i];
        a[i+1]=a[i]+A[i];
    }
    

    REP(i,m){
        cin>>B[i];
        b[i+1]=b[i]+B[i];
    }

    ll ans=0;
    int j=m;
    REP(i,n+1){
        if(a[i] >k){
            break;
        }
        while(b[j]>k-a[i]){
            j--;
        }
        // cout<<i<<" "<<j<<b[j]<<endl;
        ans=(ans>(i+j) ) ? ans :(i+j);
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 8196
#include <bits/stdc++.h>
typedef long long ll;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REP2(i, a, b) for(int i = a;i <= b;i++)
#define REPR(i, a, b) for(int i = a; i >= b; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define PI 3.14159265358979323846
#define vi vector<int>
#define vll vector<ll>
#define vi2 vector<vector<int>>
#define eb emplace_back
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define sz(x) int(x.size())
using namespace std;
using P = pair<ll,ll>;
const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};
#define INT(name) int name;cin >> name;
#define VEC(type,name,n) vector<type> name(n);REP(i,n) cin >> name[i];

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

int main()
{
  string S;
  cin >> S;
  int x,y;
  cin >> x >> y;
  int cnt = 0;
  int flag = 0;
  vector<int> X;
  vector<int> Y;
  REP(i,sz(S)){
    if(S[i]=='F'){
      cnt++;
    }else{
      if(flag==0){
        X.push_back(cnt);
        cnt=0;
        flag=1;
      }else{
        Y.push_back(cnt);
        cnt=0;
        flag=0;
      }
    }
  }
  if(flag==0){
    X.push_back(cnt);
  }else{
    Y.push_back(cnt);
  }
  x-=X[0];
  X.erase(X.begin());
  sort(ALL(X),greater<int>());
  sort(ALL(Y),greater<int>());
  int sumx=0;
  REP(i,sz(X)){
    if(sumx<x){
      sumx+=X[i];
    }else{
      sumx-=X[i];
    }
  }
  int sumy=0;
  REP(i,sz(Y)){
    if(sumy<y){
      sumy+=Y[i];
    }else{
      sumy-=Y[i];
    }
  }
  if(sumx==x&&sumy==y){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3620
package main

import (
	"fmt"
	"math"
)

func Max(A ...int) int {
	res := A[0]
	for i := 1; i < len(A); i++ {
		if res < A[i] {
			res = A[i]
		}
	}
	return res
}

func main() {
	var a, b, c, d int

	ans := math.MinInt64

	fmt.Scanf("%d %d %d %d", &a, &b, &c, &d)
	xlist := []int{a, b}
	ylist := []int{c, d}
	for _, x := range xlist {
		for _, y := range ylist {
			ans = Max(ans, x*y)
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1840
#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <sstream>
#include <climits>
#include <cmath>
#include <functional>
#include <map>
#include <stack>
using namespace std;
#define M_PI 3.141592
#define FOR(i,n) for(int i=0;i<(int)n;i++)
#define FORI(i,k,n) for(int i=k;i<(int)n;i++)
#define toRad 2.0*M_PI/360.0
#define inin(x) int x;cin>>x;
#define all(x) x.begin(),x.end()
#define debug(x) cout<<#x<<" "<<x<<endl;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define EPS 1e-12
#define pri_max 60000
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };

/* 
bool memo[pri_max] = {};
vector<int> pri;
void calc()
{
	for (int i = 2; i < pri_max; i++)
	{
		if (memo[i] == false)
		{
			pri.push_back(i);
			for (int l = i; l < pri_max; l += i)
			{
				memo[l] = true;
			}
		}
	}
}*/
double len(pdd a, pdd b)
{
	return sqrt((b.first - a.first)*(b.first - a.first) + (b.second - a.second)*(b.second - a.second));
}

int main()
{
	int n, m;
	while (cin >> n >> m&&n)
	{
		vector<int> a;
		for (int i = 1; i <= n; i++)a.push_back(i);
		vector<int>::iterator it = a.begin();
		for (int i = 1; a.size() > 1; i++, it++)
		{
			if (it == a.end())it = a.begin();
			if (i == m)
			{
				i = 1;
				it = a.erase(it);
				if (it == a.end())it = a.begin();
			}
		}
		cout << a[0] << endl;

	}
}

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

#define lli long long int
#define LLI(n) \
  lli n;       \
  cin >> n;
#define LLIV(a, n)            \
  vector<lli> a(n);           \
  for (lli i = 0; i < n; i++) \
  {                           \
    cin >> a.at(i);           \
  };
#define STR(n) \
  string n;    \
  cin >> n;
#define Sort(n) sort(n.begin(), n.end());
#define Reve(n) reverse(n.begin(), n.end());
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define C45(n) (n + 1) / 2
#define OUT(n) cout << n << endl;
#define SRC(n, c)                    \
  for (lli i = 0; i < s.size(); i++) \
  {                                  \
    if (s.at(i) == c)                \
    {                                \
      n++;                           \
    }                                \
  };
//こぴー
/*#define ZISYO(s, S)                  \
  for (lli i = 0; i < s.size(); i++) \
  {                                  \
    S.at(i) = s.at(i);               \
  }                                  \
  Sort(S) Reve(S) for (lli i = 0; i < s.size(); i++) { s.at(i) = S.at(i); };
*/

//素数
bool IsPrime(lli num)
{
  if (num < 2)
    return false;
  else if (num == 2)
    return true;
  else if (num % 2 == 0)
    return false;
  long double sqrtNum = sqrt(num);
  for (lli i = 3; i <= sqrtNum; i += 2)
  {
    if (num % i == 0)
      return false;
  }
  return true;
}
//各桁の和
lli Sum(lli n)
{
  lli sum = 0;
  if (n < 0)
    return 0;
  while (n > 0)
  {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main(void)
{
  ios::sync_with_stdio(false);
  LLI(n)
  LLIV(a, n)
  Sort(a)
  OUT(a[a.size()-1] - a[0])
}


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

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

  for(int i = 0; i < N; i++){
    cin >> A;
        
    if( i+1 < N && A != "Y"){

      continue;
    } 
    
    else if( i+1 == N && A != "Y"){
      cout << "Three" << endl;
      break;
    } 
    
    else {
      cout << "Four" << endl;
      break;
    }
  }

}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include <map> // pair
using namespace std;
int main(){
  string S;
  cin>>S;
  int ans=0;
  int tempans=0;
  vector<int> flag(S.size(),0);
  for(int i=0;i<S.size();i++){
    if(S.at(i)=='A'||S.at(i)=='T'||S.at(i)=='G'||S.at(i)=='C'){
      tempans++;
      flag.at(i)=1;
    }
    if(i>0&&flag.at(i-1)==1&&flag.at(i)==0){
      if(ans<tempans)ans=tempans;
      tempans=0;
    }else if(i==S.size()-1){
      if(ans<tempans)ans=tempans;
    }
  }
  cout<<ans<<endl;
  }


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

int main() {
	int span, count, time;
	cin >> span >> count >> time;

	int result = 0;
	int current_time = span;
	while (current_time <= time + 0.5) {
		result += count;
		current_time += span;
	}

	cout << result;
}

Measured memory_bytes: 256
(defun splitat (c line)
  (labels ((rec (line acc)
				(let ((pos (position-if (lambda(cc) (char= c cc)) line)))
				  (if pos
					  (rec (subseq line (1+ pos)) (cons (subseq line 0 pos) acc))
					(nreverse (cons line acc))))))
	(rec line nil)))
(defun f(a b)
  (labels ((rec (i n)
				(if (< n b)
				  (rec (1+ i) (+ n (1- a)))
				  i)))
	(rec 0 1)))
(let* ((line (read-line nil nil))
	   (splited (mapcar #'parse-integer (splitat #\space line))))
  (format t "~A" (f (car splited) (cadr splited))))


Measured memory_bytes: 12896
#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 PLL pair<ll,ll>
#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()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>


int a,b,q;

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

 
  
  int a,b,q;
  cin>>a>>b>>q;
  set<int> sl,sr,tl,tr;
  
 
  rep(i,a){
    int x;
    cin>>x;
    sr.insert(x);
    sl.insert(-x);
  }
  rep(i,b){
    int x;
    cin>>x;
    tr.insert(x);
    tl.insert(-x);
  }
 

  while(q--){
    int x;
    cin>>x;
    auto srn=sr.lower_bound(x);
    auto sln=sl.lower_bound(-x);
    auto trn=tr.lower_bound(x);
    auto tln=tl.lower_bound(-x);
    int ans=INF;
    //cout<<srn<<' '<<sln<<' '<<trn<<' '<<tln<<endl;
    if(srn!=sr.end()&&trn!=tr.end())ans=min(ans,max(*srn,*trn)-x);
    //cout<<ans<<endl;
    if(sln!=sl.end()&&tln!=tl.end())ans=min(ans,x-min(-*sln,-*tln));
    //cout<<sln<<' '<<tln<<endl;
    //cout<<ans<<endl;
    if(srn!=sr.end()&&tln!=tl.end())ans=min(ans,*srn+*tln+min(*srn-x,x+*tln));
    //cout<<ans<<endl;
    if(trn!=tr.end()&&sln!=sl.end())ans=min(ans,*trn+*sln+min(*trn-x,x+*sln));
    cout<<ans<<endl;

  }



}

Measured memory_bytes: 20096
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
#include <random>
using namespace std;

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
int INF = INT_MAX / 10;
double EPS = 1e-10;

int main() {
	int N, K; cin >> N >> K;
	vector<int> dp(N + 1);
	dp[N] = 1;
	rep(k, K - 1) {
		vector<int> _dp(N + 1), imos(N + 1);
		for (int i = 0; i <= N; i++) {
			if (i + k < N) _dp[i] = (_dp[i] + dp[i]) % MOD;
			if (i) imos[i - 1] = (imos[i - 1] + dp[i]) % MOD;
		}
		for (int i = N - 1; i >= 0; i--)
			imos[i] = (imos[i] + imos[i + 1]) % MOD;
		for (int i = 0; i <= N; i++)
			_dp[i] = (_dp[i] + imos[i]) % MOD;
		dp = _dp;
	}
	int ans = 0;
	for (int i = 1; i <= N; i++)
		ans = (ans + dp[i]) % MOD;
	rep(t, N - K - 1) ans = ans * 2 % MOD;
	cout << ans << endl;
}


Measured memory_bytes: 384
import sys
# from math import sqrt, gcd, ceil, log
# from bisect import bisect
from collections import defaultdict, Counter
inp = sys.stdin.readline
read = lambda: list(map(int, inp().strip().split()))

# sys.setrecursionlimit(10**6)



def solve():
	n = int(input()); arr = read()
	ans= 0
	for i in range(n):
		for j in range(i+1, n):
			ans += arr[i]*arr[j]
	print(ans)


		

if __name__ == "__main__":
	solve()


Measured memory_bytes: 9440
#include "bits/stdc++.h"
#define lson t<<1,l,mid
#define rson t<<1|1,mid+1,r
#define L t<<1
#define R t<<1|1
using namespace std;
const int N = 3e5+5;
const int h = 3e5+1;

int mx[N<<2];
void update(int t,int l,int r,int pos,int d){
    if(l==r){ mx[t] = d; return; }
    int mid = (l+r)>>1;
    if(pos<=mid) update(lson,pos,d);
    else update(rson,pos,d);
    mx[t] = max( mx[L] , mx[R] );
}

int query(int t,int l,int r,int ei,int ej){
    if(ei<=l && r<=ej) return mx[t];
    int mid = (l+r)>>1;
    if(ej<=mid) return query(lson,ei,ej);
    else if(ei>mid) return query(rson,ei,ej);
    else return max( query(lson,ei,ej) , query(rson,ei,ej) );
}

int main()
{
    ios::sync_with_stdio(false);

    int n,k;  cin>>n>>k;
    int ans = 0;
    for(int i=1;i<=n;i++){
        int a;  cin>>a; a++;
        int b = query(1,1,h, max(a-k,1) , min(a+k,h) )+1;
        ans = max( ans , b );
        update(1,1,h,a,b);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 7728
import java.util.Scanner;

public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		int num1 = scan.nextInt();
		int num2 = scan.nextInt();
		if (num1 > num2) {
			System.out.println("a > b");
		} else if (num1 < num2) {
			System.out.println("a < b");
		} else {
			System.out.println("a == b");
		}
	}
	public static void main(String[] args) {
		Main m = new Main();
		m.run();
	}
}

Measured memory_bytes: 26080
import sys
n = int(input())
l = list(map(int,input().split()))
if n==2:
    ans = l[0]*2
    print(ans)
    sys.exit()
    
ans = 0
lis = []
a,b = l[0],l[1]
if a<=b:
    ans +=a
    lis.append(a)
else:
    ans += a
    lis.append(b)
    
for i in range(n-2):
    a,b = l[i],l[i+1]
    if a<=b:
        ans += a
        lis.append(a)
    else:
        ans += b
        lis.append(b)
        
ans += l[n-2]
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
         char num[3];
         cin >> num;
         bool ans =false;
         for(int i = 0; i<3; i++)
         {
                 if(num[i] == '7')
                 {
                         ans = true;
                         break;
                 }
         }
         if(ans)
         {
                 cout << "Yes" << endl;
         }
         else if(ans == false)
         {
                 cout << "No" << endl;
         }
}



Measured memory_bytes: 3620
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define lli long long int
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define true 1
#define false 0

int comp(const void *a,const void *b){
	return *(lli*)b - *(lli*)a;
}

int main(void){
	int i;
	int n;
	lli *a;
	int p;
	lli ans = 0;
	scanf("%d",&n);
	a = calloc(sizeof(lli),n);
	for(i=0;i<n;i++){
		scanf("%lld",&a[i]);
	}
	p = 1;
	i = 0;
	ans += a[i]-1;
	p++;
	for(i=1;i<n;i++){
		if(a[i]==p){
			p++;
			continue;
		}
		ans += (a[i]-1)/p;
	}
	printf("%lld\n", ans);


	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#pragma gcc optimize("ofast")
using namespace std;

#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define mod 1000000007
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(int x=j;x<n;x++)
#define all(x) (x).begin(), (x).end()

typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> pi;

bool prime(ll n)
{
    if(n<=1)return false;
    if(n<=3)return true;
    if(n%2==0||n%3==0)return false;
    for(ll i=5;i*i<=n;i+=6)
    {
        if(n%i==0||n%(i+2)==0)return false;
    }
    return true;
}
bool comp(pair<ll,ll>a,pair<ll,ll>b)
{
    if(a.fi==b.fi)return a.se>b.se;
    return a.fi>b.fi;
}

int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
ll a,b,c,k; cin>>a>>b>>c>>k;
if(k<=a+b)cout<<min(k,a)<<endl;
else cout<<(a-(k-a-b))<<endl;
return 0;
}


Measured memory_bytes: 3640
h,w,m=list(map(int, input("").split()))
bo=[]
hb=[0]*h
wb=[0]*w
for i in range(m):
    a,b=list(map(int, input("").split()))
    #各行列に爆弾いくつあるか
    hb[a-1]+=1
    wb[b-1]+=1
    #爆弾の座標
    bo.append([a,b])
#ソート
mwb=[]
mhb=[]
#爆弾数が最大の行と列番号をメモ
hmax=max(hb)
wmax=max(wb)
for i in range(h):
    if hb[i]==hmax:
        mhb.append(i)
for i in range(w):
    if wb[i]==wmax:
        mwb.append(i)
c=0
#最大の爆弾数の行と列に含まれる爆弾数=cの確認
for h,w in bo:
     #h in mhb and w in mwb
    if(hb[h-1] == hmax and wb[w-1] == wmax):
        c+=1
#行と列の最大爆弾数の和
out=hmax+wmax
#行と列の最大数の積がcと一致するなら必ず重複があるので－1
if c==len(mwb)*len(mhb):
    out-=1
print(out)

Measured memory_bytes: 82352