akhauriyash/Code-Regression huggingface dataset:
#include <atcoder/all>
using namespace atcoder;
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define rrep(i, n) for (int i = (int)n-1; i >= 0; --i)
using namespace std;
using ll = long long;
template<typename T>
inline bool chmax(T& a, const T& b) {
    if (a < b){
        a = b;
        return true;
    }
    return false;
}
template<typename T>
inline bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
/**
 * @brief 多次元 vector の作成
 * @author えびちゃん
 */
namespace detail {
    template<typename T, int N>
    auto make_vec(vector<int>& sizes, T const& x) {
        if constexpr (N == 1) {
            return vector(sizes[0], x);
        } else {
            int size = sizes[N-1];
            sizes.pop_back();
            return vector(size, make_vec<T, N-1>(sizes, x));
        }
    }
}
template<typename T, int N>
auto make_vec(int const(&sizes)[N], T const& x = T()) {
    vector<int> s(N);
    for (int i = 0; i < N; ++i) s[i] = sizes[N-i-1];
    return detail::make_vec<T, N>(s, x);
}
__attribute__((constructor))
void fast_io() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

int main() {
    int n, m;
    cin >> n >> m;
    vector<string> s(n);
    rep(i, n) cin >> s[i];

    int V = n * m + 2;
    int a = n * m, b = a + 1;

    mf_graph<int> g(V);

    rep(i, n) rep(j, m) {
        if ((i + j) % 2 == 0) g.add_edge(a, m * i + j, 1);
        else g.add_edge(m * i + j, b, 1);
    }

    array<int, 4> di = {1, 0, -1, 0}, dj = {0, 1, 0, -1};
    rep(i, n) rep(j, m) {
        if ((i + j) % 2 == 0 && s[i][j] == '.') {
            rep(k, 4) {
                int ni = i + di[k], nj = j + dj[k];
                if (0 <= ni && 0 <= nj && ni < n && nj < m && s[ni][nj] == '.') {
                    g.add_edge(m * i + j, m * ni + nj, 1);
                }
            }
        }
    }

    int ans = g.flow(a, b);
    
    auto es = g.edges();
    for (auto e : es) {
        if (e.flow > 0 && e.from != a && e.to != b) {
            int x = e.from, y = e.to;
            if (x > y) swap(x, y);
            int xi = x / m, xj = x % m;
            int yi = y / m, yj = y % m;
            if (xi == yi) {
                s[xi][xj] = '>';
                s[yi][yj] = '<';
            } else {
                s[xi][xj] = 'v';
                s[yi][yj] = '^';
            }
        }
    }

    cout << ans << '\n';
    rep(i, n) cout << s[i] << '\n';
}

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

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

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

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

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



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  ll n; cin>>n;
  string s; cin>>s;
  vvll sum(n+1, vll(3));
  rep(i,n){
    rep(j,3) sum[i+1][j]=sum[i][j];
    if(s[i]=='R') sum[i+1][0]++;
    else if(s[i]=='G') sum[i+1][1]++;
    else sum[i+1][2]++;
  }
  
  ll ans=0;
  rep(i,n){
    for(ll j=i+1; j<n; j++){
      ll d=j-i;
      if(s[i]==s[j]) continue;
      if(s[i]=='R' && s[j]=='G' || s[i]=='G' && s[j]=='R'){
        ans+=sum[n][2]-sum[j][2];
        if(j+d<n && s[j+d]=='B') ans--;
      }
      if(s[i]=='R' && s[j]=='B' || s[i]=='B' && s[j]=='R'){
        ans+=sum[n][1]-sum[j][1];
        if(j+d<n && s[j+d]=='G') ans--;
      }
      if(s[i]=='G' && s[j]=='B' || s[i]=='B' && s[j]=='G'){
        ans+=sum[n][0]-sum[j][0];
        if(j+d<n && s[j+d]=='R') ans--;
      }
    }
  }
  cout<<ans<<endl;
}

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

#define ALL(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v) {
  for (T& x: v) s >> x;
  return s;
}
inline void Yes(bool f=true){cout<<(f?"Yes":"No")<<endl;}
inline void YES(bool f=true){cout<<(f?"YES":"NO")<<endl;}

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

    int A,B,C;
    cin >> A>>B>>C;
    cout << C - min(A-B, C) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e5 + 10; 

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   int n;
   map<string,bool> cnt;
   cin >> n;
   f(i,0,n){
      string s;
      cin >> s;
      cnt[s];
   }
   cout << cnt.size() << '\n';
   return 0;
} 

Measured memory_bytes: 19184
#include <iostream>
using namespace std;
char c;
int main() {
  cin >> c;
  switch (c) {
    case 'A':
      cout << "T\n";
      break;
    case 'T':
      cout << "A\n";
      break;
    case 'G':
      cout << "C\n";
      break;
    case 'C':
      cout << "G\n";
      break;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;
const ll mod=1000000007,mod9=1000000009;
template <class T>inline T lcm(T a,T b){return (a*b/__gcd(a,b));}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    double a;
    multiset<double> ms;
    multiset<double>::iterator itr;
    for(int i=0;i<n;i++){
        cin>>a;
        ms.insert(a);
    }
    itr=ms.begin();
    double ans=*itr;
    ms.erase(itr);
    for(int i=1;i<n;i++){
        itr=ms.begin();
        ans=(ans+*itr)/2;
        ms.erase(itr);
    }
    doublecout(ans);
    return 0;
}



Measured memory_bytes: 256
S=input()
a=len(S)
kai=S[::-1]
c=int((a-1)/2)
kai_mae=S[:c]
kai_ato=S[-c:]
if S==kai and kai_mae==kai_mae[::-1] and kai_ato==kai_ato[::-1]:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
import itertools
N = input()
S = input()

#com = list(set([c[0]+c[1]+c[2] for c in itertools.combinations(S,3)]))
#com = list(set([c[0]+c[1]+c[2] for c in itertools.combinations(N,3)]))
#print(len(com))


# X1_list = [int(input()) for i in range(N)]
# X2_list = [list(map(int,input().split())) for i in range(N)]
result = 0

for i in range(0,1000):
    s = str(i).zfill(3)
    #print(s[0] + '\d' + s[1] + '\d' + s[2])
    #pattern = '\d' + s[0] + '*\d' + s[1] + '*\d' + s[2] + '*\d'
    #import re
    #repattern = re.compile(pattern)
    #result = repattern.match(S)
    first_index = S.find(s[0])
    if first_index == -1:
        continue
    S_1 = S[first_index+1:]
    second_index = S_1.find(s[1])
    if second_index == -1:
        continue
    S_2 = S_1[second_index+1:]
    third_index = S_2.find(s[2])
    if third_index == -1:
        continue
    result += 1
print(result)

Measured memory_bytes: 3188
#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 FORR(i,m,n) for(int i=(m) ; i>=(n) ; i--)

typedef long long ll;
typedef unsigned long long ull;

const int INF = 999999999;

int main(){
   int a,b,c;cin>>a>>b>>c;
   cout<< min(b/a,c);
   return 0;
}

Measured memory_bytes: 256
import sys

n, m = map(int, input().split())
x = list(map(int, input().split()))
if m == 1:
    print(0)
    sys.exit()
if n == 1:
    print(max(x) - min(x))
    sys.exit()
if n >= m:
    print(0)
    sys.exit()
x.sort()
a = []
for i in range(m - 1):
    a.append(abs(x[i] - x[i + 1]))
ans = sum(a)
a.sort(reverse=True)
for i in range(n - 1):
    ans -= a[i]
print(max(0, ans))


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

using namespace std;

int main() {
    int x, y;
    cin >> x >> y;
    cout << (100000 * (max(0, 4 - x) + max(0, 4 - y)) + (x == 1 && y == 1 ? 400000 : 0)) << endl;
}


Measured memory_bytes: 256
/*
author: Apoorv Singh
*/
 
/*

CODE CREDITS: https://www.geeksforgeeks.org/queries-number-distinct-elements-subarray/

*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
 
typedef vector <int> vi;
typedef pair <int, int> pii;
typedef vector <long long> vll;
typedef pair <long long, long long> pll;
#define pb push_back   
#define all(c) c.begin(), c.end()
#define For(i, a, b) for (long long i = a; i < b; ++i)
#define Forr(i, a, b) for (long long i = a; i > b; --i)
#define um unordered_map
#define F first
#define S second
#define ll long long 
#define endl "\n"
#define min(a,b) (a < b ? a : b)
#define max(a,b) (a > b ? a : b)
#define fast_io() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);


const int MAX = 1000001; 

// structure to store queries 
struct Query 
{ 
	int l, r, idx; 
}; 

// cmp function to sort queries according to r 
bool cmp(Query x, Query y) 
{ 
	return x.r < y.r; 
} 

// updating the bit array 
void update(int idx, int val, int bit[], int n) 
{ 
	for (; idx <= n; idx += idx&-idx) 
		bit[idx] += val; 
} 

// querying the bit array 
int query(int idx, int bit[], int n) 
{ 
	int sum = 0; 
	for (; idx>0; idx-=idx&-idx) 
		sum += bit[idx]; 
	return sum; 
} 

void answeringQueries(int arr[], int n, Query queries[], int q) 
{ 
	// initialising bit array 
	int bit[n+1]; 
	memset(bit, 0, sizeof(bit)); 

	// holds the rightmost index of any number 
	// as numbers of a[i] are less than or equal to 10^6 
	int last_visit[MAX]; 
	memset(last_visit, -1, sizeof(last_visit)); 

	// answer for each query 
	int ans[q]; 
	int query_counter = 0; 
	for (int i=0; i<n; i++) 
	{ 
		// If last visit is not -1 update -1 at the 
		// idx equal to last_visit[arr[i]] 
		if (last_visit[arr[i]] !=-1) 
			update (last_visit[arr[i]] + 1, -1, bit, n); 

		// Setting last_visit[arr[i]] as i and updating 
		// the bit array accordingly 
		last_visit[arr[i]] = i; 
		update(i + 1, 1, bit, n); 

		// If i is equal to r of any query store answer 
		// for that query in ans[] 
		while (query_counter < q && queries[query_counter].r == i) 
		{ 
			ans[queries[query_counter].idx] = 
					query(queries[query_counter].r + 1, bit, n)- 
					query(queries[query_counter].l, bit, n); 
			query_counter++; 
		} 
	} 

	// print answer for each query 
	for (int i=0; i<q; i++) 
		cout << ans[i] << endl; 
} 

// driver code 
int main() 
{ 
	fast_io();
	int n,q;
	cin >> n >> q;
	int a[n];
	For(i,0,n) cin >> a[i];
	Query queries[q];
	For(i,0,q)
	{
		cin >> queries[i].l >> queries[i].r;
		--queries[i].l; --queries[i].r;
		queries[i].idx = i;
	} 
	sort(queries, queries+q, cmp); 
	answeringQueries(a, n, queries, q); 
	return 0; 
} 


Measured memory_bytes: 19344
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main
{
	public static void main(String[] args) {
		new Thread(null, new Runnable() {
			public void run() {
                solve();
            }
        }, "1", 1 << 26).start();
	}
	static void solve () {
		FastReader fr =new FastReader();	PrintWriter op =new PrintWriter(System.out);
 
 		int n =fr.nextInt() ,i ,j =0 ;

 		for (i =1 ; i<=n ; ++i) {
 			j =(j * (10%n))%n ;

 			j =(j + 7%n)%n ;

 			if (j == 0)	break;
 		}
 		if (i > n)	op.println(-1) ;
 		else 	op.println(i) ;

		op.flush();	op.close();
	}
	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br =new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st==null || (!st.hasMoreElements())) 
			{
				try
				{
					st =new StringTokenizer(br.readLine());
				}
				catch(IOException e)
				{
					e.printStackTrace();
				}
				
			}
			return st.nextToken();
		}

		String nextLine() {
			String str ="";

			try
			{
				str =br.readLine();
			}
			catch(IOException e)
			{
				e.printStackTrace();
			}

			return str;
		}

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

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

Measured memory_bytes: 33044
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin(), v.end()
bool chmin(ll & a, ll  b) { if (b < a) { a = b; return 1; } return 0; }
bool chmax(ll & a, ll b) { if (b > a) { a = b; return 1; } return 0; }
const ll INF = 999999999999999;
const ll MOD = 1000000007;
const ll MAX_N=500010;
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l, ans;
int main() {
    ll A[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    cin >> n;
    cout<<A[n-1]<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <sstream>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define rep(i,a,b) for(ll i = a; i <= b; ++i)
#define fo(i,a,b) for(int i = a; i<= b; ++i)
#define ull unsigned long long int
#define ll long long
#define all(a) a.begin(),a.end()
using namespace std;
typedef vector<ll> vi;
typedef pair<ll,ll> pi;
ll MD=1000000007;
ll md=998244353;
const ll INF=1e18L+5;
ll exp(ll a,ll b){ll r=1ll;while(b>0){if(b&1){r=r*(a%md);r=(r+md)%md;}b/=2;a=(a%md)*(a%md);a=(a+md)%md;}return (r+md)%md;}//put b as bmod(md-1) if md is prime}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll pow_2(ll a, ll b)
{
    ll res = 1;
    while(b)
    {
        if(b & 1)
            res = (res * a);
        a = (a * a);
        b >>= 1;
    }

    return res;
}
bool isPrime(ll a)
{
    for(ll i=3; (i*i)<=a; i+=2)
    {
        if( (a%i)==0 )
            return false;
    }
    if( ( a!=2 ) && ( (a%2)==0 ) )
        return false;
    if( a==1 )
        return false;

    return true;
}
string decToBinary(int n)
{
    // Size of an integer is assumed to be 32 bits
    string s="";
    for (int i = 31; i >= 0; i--) {
        int k = n >> i;
        if (k & 1)
            //cout << "1";
            s=s+"1";
        else
            //cout << "0";
            s=s+"0";
    }
    return s;
}
int decimalToBinary(int N)
{

    // To store the binary number
    ull B_Number = 0;
    int cnt = 0;
    while (N != 0) {
        int rem = N % 2;
        ull c = pow(10, cnt);
        B_Number += rem * c;
        N /= 2;

        // Count used to store exponent value
        cnt++;
    }

    return B_Number;
}
string toString(ull num)
{
    std::string number;
    std::stringstream strstream;
    strstream << num;
    strstream >> number;
    return number;
}
const double PI = acos(-1);
ll dp[3000][3000];
ll solve(ll arr[],int start,int last)
{
    if(start>last){dp[start][last]=0;return 0;}
    else if(start==last){dp[start][last]=arr[start];return arr[start];}
    else if(dp[start][last]!=-1)return dp[start][last];
    else return dp[start][last]=max(arr[start]-solve(arr,start+1,last),arr[last]-solve(arr,start,last-1));
}
int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
    int n;
    cin>>n;
    ll arr[n];
    memset(dp,-1,sizeof(dp));
    for(int i=0;i<n;i++)cin>>arr[i];
    if(n==0)cout<<"0"<<endl;
    else if(n==1)cout<<arr[0]<<endl;
    else cout<<solve(arr,0,n-1)<<endl;

return 0;}




Measured memory_bytes: 74188
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main()
    {
    	int n,k,b,dis=0;
    	cin>>n>>k;
    	vector <int > a(n);
    	b=k/2;
    	for(int i=0;i<n;i++)
    		cin>>a[i];
    	sort(a.begin(),a.end());
    	for(int i=0;i<n;i++)
    	{
    		if(a[i]>b)
    			dis+=2*(k-a[i]);
    		else
    			dis+=2*a[i];
    	}
    	cout<<dis<<endl;
    	return 0;
    }


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

typedef long long ll;

const int INF = 1001001001;
const int MOD = 1000000007;
const double PI=acos(-1);

int main(){
    ll N,K;
    cin >> N >> K;

    ll ans = 0;

    for (ll k=K; k<=N+1; k++) {
        ans += (N+(N-k+1))*k/2 - (k-1)*k/2 + 1;
        ans %= MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int K,A,B;
  cin >> K;
  cin >> A >> B;
  if(
    B - A >= K || 
    A % K == 0 || 
    B % K == 0 || 
    B / K - A / K > 0 || 
    K == 1
  )
    cout << "OK";
  else 
    cout << "NG";
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define Would
#define you
#define please

int main() {

	string N;
	cin >> N;

	int kotae = 0;

	rep(i, 3) {
		kotae += N[i] - '0';
	}

	co(kotae);
	Would you please return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define forn(i,n) for(int i=0;i <int(n);++i)
#define forsn(i,s,n) for(int i=s;i <int(n);++i)
struct vec {
	double x, y;
	double operator ^ (vec const& o) const {
		return x*o.y - y*o.x;
	}
	double operator * (vec const& o) const {
		return x*o.x + y*o.y;
	}
	vec operator - (vec const& o) const {
		vec res = *this;
		res.x -= o.x; res.y -= o.y;
		return res;
	}
	double n2 () const {
		return *this * *this;
	}
	double n1 () const {
		return sqrt(n2());
	}
};

int main () {
	int n;
	cin >> n;
	vector<vec> ps(n);
	forn(i,n) cin >> ps[i].x >> ps[i].y;
	ps.push_back(ps[0]);

	double diam = 0;
	int j = 1;
	forn(i,n){
		vec edge = ps[i+1] - ps[i];
		vec perp = {-edge.y, edge.x};
		while(perp*ps[j] <= perp*ps[j+1]){
			j += 1;
			if(j == n) j = 0;
			vec d1 = ps[j] - ps[i];
			vec d2 = ps[j] - ps[i+1];
			diam = max({diam, d1.n1(), d2.n1()});
		}
	}
	printf("%.9f\n",diam);
}


Measured memory_bytes: 5212
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rec register char
#define rel register ll
#define gc getchar
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
inline void read(rel &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  x=f?x:-x;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return pc(48);
  if (x<0) x=-x,pc('-');
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;

double nd(int a,int b){
return 100.0*b/(a+b);
}
set<int> s,t;

int main(){
int i,j,k,a=read(),b=read(),c=read(),d=read(),e=read(),f=read();
for (i=0;i<=1212;++i){
  for (j=0;j<=1212;++j){
    if (i*a*100+j*b*100<=f) s.insert(i*100*a+j*100*b);
    }
  }
for (i=0;i<=1212;++i){
  for (j=0;j<=1212;++j){
	if (i*c+j*d<=f) t.insert(i*c+j*d); 
	}
  }
double lim=1.0*e/(100+e),ans=-1;int p=0,q=0;
for (int i:s){
  for (int j:t){
    int sum=i+j;
    double x=1.0*j/sum;
    if (sum<=f&&x<=lim&&x>ans){
      ans=x,p=sum,q=j;
	  }
    }
  }
printf("%d %d",p,q);
}

Measured memory_bytes: 384
N = int(input())
A = [int(input()) for _ in range(N)][::-1]
def LIS(L):
  from bisect import bisect
  seq=[]
  for i in L:
    pos=bisect(seq,i)
    if len(seq)<=pos:
      seq.append(i)
    else:
      seq[pos]=i
  return len(seq)
print(LIS(A))


Measured memory_bytes: 56152
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
//Some custom functions for quick use(fast_power,nCr,lcm,gcd)
ll power(ll a, ll b)
{
  if(b == 0)
   {
	  return 1;
   }
   else if(b % 2 == 0)
   {
	  return power(a*a, b/2);
   }
   else
   {
	  return a * power(a*a, b/2);
   }
}
long long int nChoosek( long long int n, long long int k )
{
if (k > n) return 0;
if (k * 2 > n) k = n-k;
if (k == 0) return 1;
	int result = n;
for( int i = 2; i <= k; ++i )
{
		result *= (n-i+1);
		result /= i;
}
	return result;
}

long long int lcm(long long int a,long long int b)
{
	long long int m,n;
	m=a;
	n=b;
	while(m!=n)
	{
		if(m < n)
		{
			m=m+a;
		}
		else
		{
			n=n+b;
		}
	}
	return m;
}

long long int gcd(long long int a,long long int b)
{ 
if (a == 0) 
return b; 
return gcd(b % a, a);
}
/* Basic DFS Boilerplate */ 
vector<ll> adj[10005]; // graph is stored as adjacency list
bool visited[10005];
void dfs(ll s)  //given node s
{
	if(visited[s])
		return;
	visited[s]=true;
	//the process on node 's'
	for(auto u : adj[s])
	{
		dfs(u);
	}    
}
/* Basic BFS Boilerplate */
ll x;   // given node
queue<ll>q;
bool vis[10005];
ll dist[10005];
//
void bfs(ll x)
{
	vis[x]=true;
	dist[x]=0LL;
	q.push(x);
	while (!q.empty())
	{
		ll s=q.front();
		q.pop();
		//the process
		//on node x
		for(auto u :adj[x])
		{
			if(vis[u]==true)
				continue;
			vis[u]=true;
			dist[u]=dist[x]+1;
			q.push(u);
		}
	}
	
}

bool sbs(const pair<ll,ll> &a, 
              const pair<ll,ll> &b) 
{ 
    return (a.second < b.second); 
} 

int main()
{
	fastio
	
	ll k;
	cin>>k;
	ll sum=0;
	for (ll a = 1; a <= k; a++)
	{
		/* code */
		for (ll b = 1; b <= k; b++)
		{
			/* code */
			for (ll c = 1; c <=k; c++)
			{
				/* code */
				sum+= gcd(a,gcd(b,c));
			}
			
		}
		
	}
	cout<<sum<<'\n';
	return 0;
}


Measured memory_bytes: 3892
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a==1&&b==1&&c==0||a==0&&b==0&&c==1){
    cout<<"Open"<<endl;
  }
  else cout<<"Close"<<endl;
  return(0);
}



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

int n, k;
vector<int> a;

int main() {
    cin >> n >> k;
    a.resize(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    // dp[i]:残りi個で手番が回ってきたら勝てるか?
    vector<bool> dp(k + 1);
    for (int i = 0; i <= k; i++) {
        bool res = false;
        for (int j = 0; j < n; j++) {
            if (i - a[j] >= 0 && !dp[i - a[j]]) {
                res = true;
                break;
            }
        }
        dp[i] = res;
    }
    if (dp[k]) {
        cout << "First" << endl;
    } else {
        cout << "Second" << endl;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long a = sc.nextLong();
    long b = Long.parseLong(sc.next().replace(".",""));
    sc.close();

    long x = a * b / 100;

    System.out.println(x);
  }

}


Measured memory_bytes: 35880
#include <bits/stdc++.h>
#define int long long
#define N 200010
using namespace std;


inline int read()
{
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
	return x*f;
}
int n,m,v,p;
int a[N],tmp[N],add[N];
inline int check(int x)
{
	memset(add,0,sizeof add);
	memset(tmp,0,sizeof tmp);
	for(int i=1;i<=n;i++) if(i!=x)
		tmp[++tmp[0]]=a[i];
	int ts=a[x]+m,tp=p;
	int sum=(v-1)*m;
	for(int i=n-1;tmp[i]>ts;i--,tp--) sum-=m;
	for(int i=1;tmp[i]<ts&&i<n;i++)
	{ 
		add[i]+=min(m,ts-tmp[i]);
		sum-=add[i];
	}
	for(int i=n-1;sum>0&&tp>0&&i>=1;i--) if(tmp[i]<=ts&&add[i]<m)
	{
		sum-=m-add[i]; tp--;
	} 
	return (tp>0)&&(sum<=0);
}
signed main()
{
	scanf("%lld%lld%lld%lld",&n,&m,&v,&p);
	for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
	sort(a+1,a+1+n);
	int l=1,r=n,ans=n;
	while(l<=r)
	{
		int mid=(l+r)>>1;
		if(check(mid)) ans=mid,r=mid-1;
		else l=mid+1;
	}
	cout << n-ans+1 << endl;
	return 0;
}

Measured memory_bytes: 4352
n=int(input())
a=list(map(int,input().split()))
x=0
y=0
for i in a:
    if i%4==2:
        y+=0.5
    elif i%4==0:
        x+=1
#print(x,y)
if x+int(y)>=(n-1)/2:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 15020
#include <stdio.h>
#include <vector>
#include <string.h>
int C = 2;
int count[1000010][30];
int next[1000010][30];
char x[1000010];
std::vector<char> V[200010];
int check[30];

int main()
{
	int a;
	scanf("%d",&a);
	for(int i=1;i<=a;i++)
	{
		scanf("%s",x+1);
		int b = strlen(x+1);
		for(int j=1;j<=b;j++) V[i].push_back(x[j]);
	}
	for(int i=1;i<=a;i++)
	{
		for(int j=0;j<=25;j++) check[j] = 12345678;
		for(int j=V[i].size()-1;j>=0;j--) check[V[i][j]-'a'] = j;
		
		int p = 1;
		for(int j=V[i].size();j>=1;j--)
		{
			for(int k=0;k<=25;k++) if(check[k]<j) count[p][k]++;
			if(next[p][V[i][j-1]-'a']==0) next[p][V[i][j-1]-'a'] = C++;
			p = next[p][V[i][j-1]-'a'];
		}
	}
	
	long long int ans = 0;
	for(int i=1;i<=a;i++)
	{
		int p = 1;
		for(int j=V[i].size()-1;j>=1;j--) p = next[p][V[i][j]-'a'];
		ans += count[p][V[i][0]-'a'];
	}
	printf("%lld",ans-a);
}

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

int main() {
  int h, w, i, j, a;
  cin >> h >> w;
  
  string s[h];
  
  for (i=0; i<h; i++) {
    cin >> s[i];
  }
  
  for (i=0; i<h; i++) {
    for (j=0; j<w; j++) {
      if (s[i][j] == '.') {
        a = 0;
        if ((i>0 && j>0) && s[i-1][j-1]=='#') a++;
        if ((j>0) && s[i][j-1]=='#') a++;
        if ((i>0) && s[i-1][j]=='#') a++;
        if ((i<h-1 && j>0) && s[i+1][j-1]=='#') a++;
        if ((i<h-1) && s[i+1][j]=='#') a++;
        if ((i>0 && j<w-1) && s[i-1][j+1]=='#') a++;
        if ((j<w-1) && s[i][j+1]=='#') a++;
        if ((i<h-1 && j<w-1) && s[i+1][j+1]=='#') a++;
        cout << a;
      } else {
        cout << '#';
      }
    }
    cout << endl;
  }
  
  
  return 0;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define ANS(ans) cout<<(ans)<<endl;
typedef vector<int> VI;


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



int main() {
	int n;
	cin >> n;
	VI a(n);
	REP(i, n) {
		cin >> a[i];
	}

	SORT(a);
	a.push_back(0);


	int ans = 0;
	int cnt = 1;
	FOR(i,0,n-1){
		if (a[i] == a[i + 1]) {
			cnt++;
			//ANS(cnt);
		}
		else {
			if (cnt % 2 == 1) {
				ans++;
				cnt = 1;
				//cout << ans << " " << cnt << endl;
			}
			else {
				cnt = 1;
			}
		}
	}

	ANS(ans);


	return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define Cout(s) cout << s << endl;
typedef long long ll;
typedef pair<int, int> P;

const ll INF = 1ll << 60;
ll MOD = 1e9 + 7;

int main()
{

    int n;
    cin >> n;
    vector<int> a(n);
    REP(i, n)
    cin >> a[i];

    bool isApproved = true;

    REP(i, n)
    {
        if (a[i] % 2 == 0)
        {
            if (a[i] % 3 != 0 && a[i] % 5 != 0)
                isApproved = false;
        }
    }

    cout << (isApproved ? "APPROVED" : "DENIED") << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#include <new>
#include <typeinfo>

typedef  long long ll;
#define mop 1000000007
#define mop2 998244353

using namespace std;

int main() {
	ll n;
	cin >> n;
	ll ans = INT64_MIN;
	ll minr = INT64_MAX;
	for (ll i = 0; i < n; i++) {
		ll tmp;
		cin >> tmp;
		if (minr == INT64_MAX) {
			minr = tmp;
		}
		else {
			if (tmp - minr > ans) {
				ans = tmp - minr;
			}
			if (tmp < minr) {
				minr = tmp;
			}
		}
	}
	cout << ans << endl;
	
}


Measured memory_bytes: 3112
use std::io::*;
use std::str::*;
use std::cmp;

fn main() {
    let line: Vec<u32> = read_vec();
    let (n, k): (usize, u32) = (line[0] as usize, line[1]);
    let s: String = read();
    let ss: Vec<&str> = s.split("").filter(|i| i.len() > 0).collect();
    let mut point: u32 = 0;
    let mut current: &str = ss[0];
    for i in 1..n {
        if current == ss[i] { point += 1 }
        current = ss[i];
    }
    println!("{}", cmp::min((n - 1) as u32, point + k * 2))
}

fn read<T: FromStr>() -> T {
    let mut line = String::new();
    stdin().read_line(&mut line).ok();
    line.trim().parse().ok().unwrap()
}

fn read_vec<T: FromStr>() -> Vec<T> {
    let mut line = String::new();
    stdin().read_line(&mut line).ok();
    line.trim().split_whitespace()
        .map(|i| i.parse().ok().unwrap()).collect()
}

Measured memory_bytes: 6396
#include <bits/stdc++.h>//復習必須
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#define rep(i, n) for (int i = 0; i < n; ++i)
using ll = long long;
using namespace std;
#define P pair<int, int>
int main () {
    int N,M,ans=0;
    cin >> N >> M;
    vector<int> k(M),p(M);
    vector<bool> swt(N),light(M);
    int s[12][12];
    for (int i = 0; i < M; i++){
        cin >> k[i];
        for (int j = 0; j < k[i]; j++){
            cin >> s[i][j];
        }
    }
    for (int i = 0; i < M; i++){
        cin >> p[i];
    }
    
    for (int i = 0; i < (1 << N); i++){
        for (int j = 0; j < N; j++){
            if(i & (1 << j)){
                swt[j] = true;
            }else{
                swt[j] = false;
            }
        }
 
        for (int j = 0; j < M; j++){
            int cnt = 0;
            light[j] = false;
            for (int l = 0; l < k[j]; l++){
                if(swt[s[j][l]-1]) cnt++;
            }
            if(cnt%2 != p[j]) break;
            else if(j == M-1) ans++;
        }
    } 
    
    cout << ans << endl;

    return 0 ;
}

 


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007LL
#define llMAX 9223372036854775807LL
#define llMIN -9223372036854775808LL
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,k,x,y;

int main(){
  ll ans=0;
  string s;cin>>s;
  if (s[0]=='R'){
    ans=1;
    if (s[1]=='R'){
      ans=2;
      if (s[2]=='R'){
        ans=3;
      }
    }
  }else{
    if (s[1]=='R'){
      ans=1;
      if (s[2]=='R'){
        ans=2;
      }
    }else{
      if (s[2]=='R'){
        ans=1;
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3592
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<algorithm>

using namespace std;

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    bool flag = false;

    if (abs(a - c) <= d) {
        flag = true;
    }

    if (abs(a - b) <= d && abs(b - c) <= d) {
        flag = true;
    }

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

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>

using namespace std;

int main() {
  int i;
  int N, x;
  int a[100010];
  scanf("%d %d", &N, &x);
  for (i = 0; i < N; i++) {
    scanf("%d", &a[i]);
  }
  long long ans = 0;
  if (a[0] > x) {
    int d = a[0] - x;
    a[0] -= d;
    ans += d;
  }
  for (i = 1; i < N; i++) {
    if (a[i] + a[i-1] > x) {
      int d = a[i]+a[i-1] - x;
      a[i] -= d;
      ans += d;
    }
  }
  printf("%lld", ans);
  return 0;
}


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

int main() {
  int N,K;
  cin>>N>>K;
  int ans=K;
  rep(i,N-1){
    ans *= K-1;
  }
  cout<<ans<<endl;
  return 0;
}

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

int main() {
  char c;
  cin >> c;
  
  if(c == 'a')
    cout << "vowel" << endl;
  
  else if(c=='e')
    cout << "vowel" << endl;
  
    else if(c=='i')
    cout << "vowel" << endl;
  
    else if(c=='o')
    cout << "vowel" << endl;
  
    else if(c=='u')
    cout << "vowel" << endl;
  
  else
    cout << "consonant" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int W = cin.nextInt();
		int H = cin.nextInt();
		int x = cin.nextInt();
		int y = cin.nextInt();
		int r = cin.nextInt();
		if((x-r)>=0 && (x+r)<=W && (y-r)>=0 && (y+r)<=H) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}


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

using namespace std;

#define int long long

void solve() {
    int n;
    cin >> n;
    if (n % 10 == 7) {
        cout << "Yes";
        return;
    }
    n /= 10;

    if (n % 10 == 7) {
        cout << "Yes";
        return;
    }
    n /= 10;

    if (n % 10 == 7) {
        cout << "Yes";
        return;
    }
    n /= 10;
    cout << "No";
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 3640
#include <algorithm>
#include <iostream>
#include <math.h>
#include <cstdio>
#include <string.h>
#include <vector>
#include <functional>
#include <stack>
#include <queue>
#include <string>
#include <list>
using namespace std;
typedef long long ll;

/****************/
/*  Algorithm   */
/****************/

//エラトステネスのふるい(素数発見アルゴリズム)
vector<int> SOE(int min, int max)
{
//0,1は含まれない
if (min < 2) min = 2;
//探索リスト作成
vector<int> int_array;
for (int i = min; i <= max; i++) int_array.push_back(i);
//素数リスト
vector<int> sosu;
//√max
double stop = sqrt(max);
//計算
while (true)
{
//素数リストに追加
sosu.push_back(int_array.front());
int_array.erase(int_array.begin());
//停止
if (stop < (double)(sosu.back())) break;
//ふるい
for (int i = 0; i < (int)int_array.size(); i++)
{
if (int_array[i] % sosu.back() == 0)
int_array.erase(int_array.begin() + i);
}
}
sosu.insert(sosu.end(), int_array.begin(), int_array.end());
return sosu;
}

//最小公倍数
int MinCM(int a, int b)
{
int c = a * b;
//入れ替え
if (a < b)
swap(a, b);
int r = a % b;
while (r != 0)
{
a = b;
b = r;
r = a % b;
}
return c / b;
}

//最大公約数
int MaxCD(int a, int b)
{
//入れ替え
if (a < b)
swap(a, b);
int r = a % b;
while (r != 0)
{
a = b;
b = r;
r = a % b;
}
return b;
}
//iget cin int 2 vector
vector<int> igets(int N){
vector<int> A;
int temp;
for (int i = 0; i < N; ++i){
cin >> temp;
A.push_back(temp);
}
return A;
}

int nPr(int n,int r){
   int ans=1;
   r=n-r;
   while(n!=r){
       ans*=n;
   --n;
   }
   return ans;
}

int nE(int n){
   return nPr(n,n);
}

int nCr(int n,int r){
if(r==0)return 1;else
   return nPr(n,r)/nE(r);
}

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

int i;
cin >> i;
string ans;
if(1000<=i)cout << "ABD" << endl;
else cout << "ABC" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main() {
	int N;
	int s[1000000]={0};
	scanf("%d", &N);
  	for(int i=0; i<N; i++){
      int c = 0;
      scanf("%d",&c);
      s[c-1] += 1;
    }
  for(int i=0; i<N; i++)
    printf("%d\n", s[i]);
}

Measured memory_bytes: 5636
import java.util.Scanner;

/**
 * Xor Sum 4
 */
public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            int N = sc.nextInt();
            long[] A = new long[N];
            for (int i = 0; i < N; i++) {
                A[i] = sc.nextLong();
            }

            long ans = 0;

            long sum = 0;
            int[] count = new int[62];

            for (int j = 0; j < 60; j++) {
                count[j] += ((A[0] >> j) & 1);
            }

            for (int i = 1; i < N; i++) {
                sum = (sum + (A[i - 1] % 1000000007)) % 1000000007;

                int[] b = new int[62];
                for (int j = 0; j < 60; j++) {
                    b[j] += ((A[i] >> j) & 1);
                }

                ans = (ans + (A[i] % 1000000007) * i) % 1000000007;
                ans = (ans + sum) % 1000000007;

                for (int j = 0; j < 60; j++) {
                    if (b[j] == 1) {
                        ans = (ans - count[j] * ((1L << j) % 1000000007) * 2) % 1000000007;
                        while (ans < 0) {
                            ans += 1000000007;
                        }
                    }
                }

                for (int j = 0; j < 60; j++) {
                    count[j] += b[j];
                }
            }

            System.out.println(ans);
        }
    }

}


Measured memory_bytes: 126908
#include<iostream>
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<list>
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define ll long long

using namespace std;

string s;
int q;
int t;
int f; char c;
ll cnt;
list<char> x;

int main() {
	cin >> s;
	rep(i, s.size()) {
		x.push_back(s[i]);
	}

	cin >> q;

	rep(i, q) {
		cin >> t;
		if (t == 1) {
			cnt++;
		}
		else {
			cin >> f >> c;

			if (cnt % 2 == 0) {
				if (f == 1) {
					x.push_front(c);
				}
				else x.push_back(c);
			}
			else {
				if (f == 1) {
					x.push_back(c);
				}
				else x.push_front(c);
			}
		}
	}

	if (cnt % 2 == 1) {
		reverse(x.begin(), x.end());
	}

	for (auto itr = x.begin(); itr != x.end(); itr++) {
		cout << *itr;
	}
	
	cout << endl;

	return 0;
}

Measured memory_bytes: 9984
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <numeric>
#include <queue>

#include <vector>
using namespace std;
#define INF 1000000001;

int n;
int f_dist[100000];  //黒
int s_dist[100000];  //白

const int MAX_V = 100000;

vector<int> G[MAX_V];  //グラフの隣接リスト

void bfs_f() {
  queue<int> que;
  que.push(0);
  f_dist[0] = 0;

  while (que.size()) {
    int u = que.front();
    que.pop();
    //cerr << u << endl;
    for (int i = 0; i < G[u].size(); i++) {
      if (f_dist[G[u][i]] > f_dist[u] + 1) {  //もし未訪問なら
        f_dist[G[u][i]] = f_dist[u] + 1;
        //cerr << u << "<->" << G[u][i] << ":" << f_dist[G[u][i]] << endl;
        que.push(G[u][i]);
      }
    }
  }
}

void bfs_s() {
  queue<int> que;
  que.push(n - 1);
  s_dist[n - 1] = 0;

  while (que.size()) {
    int u = que.front();
    que.pop();
    //cerr << u << endl;
    for (int i = 0; i < G[u].size(); i++) {
      if (s_dist[G[u][i]] > s_dist[u] + 1) {  //もし未訪問なら
        s_dist[G[u][i]] = s_dist[u] + 1;
        //cerr << u << "<->" << G[u][i] << ":" << s_dist[G[u][i]] << endl;
        que.push(G[u][i]);
      }
    }
  }
}

int main() {
  cin >> n;  // == V

  for (int i = 0; i < n-1; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    G[a].push_back(b);
    G[b].push_back(a);

  }

  for (int i = 0; i < n; i++) {
    f_dist[i] = 9999999;
    s_dist[i] = 9999999;
  }

  bfs_f();
  //cerr << "\n";
  bfs_s();

  int fpts = 0;
  int spts = 0;

  for (int i = 0; i < n; i++) {
    //cerr << i << " :: "  << "f:" << f_dist[i] << ", s:" << s_dist[i] << endl;
    if (f_dist[i] <= s_dist[i]) {
      fpts++;
    } else {
      spts++;
    }
  }

  if (fpts > spts) {
    cout << "Fennec" << endl;
  } else {
    cout << "Snuke" << endl;
  }

  return 0;
}

Measured memory_bytes: 6656
#include<stdio.h>
int main()
{
	int a[300];
	int n,l,i,sum=0;
	scanf("%d%d",&n,&l);
	for(i=1;i<=n;i++)
	{
		a[i]=l+i-1;
		sum=sum+a[i];
	}
	if(a[1]>0)
	sum=sum-a[1];
	if(a[n]<0)
	sum=sum-a[n];
	printf("%d",sum);
}

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  ll n,x,m; cin >> n >> x >> m;
  ll a[100000] = {};
  ll b[100000] = {};
  bitset<100000> bs;
  ll cnt = 1;
  ll ans = x;
  while(1){
    if(cnt == n){
      cout << ans << endl;
      break;
    }
    cnt++;
    x = (x*x) % m;    
    ans += x;
    if(bs[x]){
      ll diffa = b[x] - ans;
      ll diffc = a[x] - cnt;
      ll rans = ans + ((n-cnt)/diffc)*diffa;
      n = (n-cnt)%diffc;
      for(ll i = 0; i < n; ++i){
	x = (x*x)%m;
	rans += x;
      }
      cout << rans << endl;
      return 0;
    }
    bs[x] = 1;
    a[x] = cnt;
    b[x] = ans;
  }  
  return 0;
}


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

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

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const double PI = 3.1415926535;
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;

const int MAX = 1000000;
const int MOD = 1000000007;

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }

int main(){
  string s1, s2;
  cin >> s1 >> s2;
  int ans = 0;
  rep(i, 0, 3){
    if(s1[i]==s2[i])ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3592
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#define sqr(x) (x)*(x)
using namespace std;
vector<long long> bi[100005];
long long n,m,i,j,sz[2],x,y,vis[100005];
void dfs(int x,int c)
{
	 sz[c]++;vis[x]=1;
	 int i;
	 for (i=0;i<bi[x].size();i++)
	 {
	 	if (!vis[bi[x][i]]) dfs(bi[x][i],c);
	 }
}
int main()
{
	ios::sync_with_stdio(0);
	cin>>n>>m;
	for (i=1;i<=m;i++)
	{
		cin>>x>>y;
		bi[x].push_back(y);
		bi[y].push_back(x);
	}
	dfs(1,0);dfs(2,1);
	sort(sz,sz+2);sz[1]=n-sz[0];
	cout<<sz[0]*(sz[0]-1)/2+sz[1]*(sz[1]-1)/2-m;
	return 0;
}

Measured memory_bytes: 11264
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vll = vector<long long>;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

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; }
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;

//aのp乗を求める
ll modpow(ll a, int p) {
    if(p == 0) return 1;
    if(p % 2 == 0) {
        int halfP = p / 2;
        ll half = modpow(a, halfP);
        //a^(p/2)をhalfとして、half*halfを計算
        return half * half % MOD;
    } else {
        //pが奇数のときは偶数にするために1減らす
        return a * modpow(a, p-1) % MOD;
    }
}

//10C3 (10*9*8) / (3*2*1) 
//(10*9*8):ansMul (3*2*1):ansDiv 
ll calcComb(int a, int b) {
    if(b > a - b) return calcComb(a, a - b);

    ll ansMul = 1;
    ll ansDiv = 1;
    rep(i, b) {
        ansMul *= (a - i);
        ansDiv *= (i + 1);
        ansMul %= MOD;
        ansDiv %= MOD;
    }
    //ansMul / ansDiv をしたい
    //ansDivの逆元を求める
    ll ans = ansMul * modpow(ansDiv, MOD - 2) % MOD;

    return ans;
}

int main() {
    int n, m; 
    cin >> n >> m;
    
    int MNokori = m;
    ll ans = 1;
    for(int i = 2; i * i <= MNokori; i++) {
        if(MNokori % i == 0) {
            int cnt = 0;
            while (MNokori % i == 0) {
                cnt++;
                MNokori /= i;
            }
            ans *= calcComb(n + cnt - 1, n - 1);    //n-1はcntと同じ
            ans %= MOD;
        }
    }
    if(MNokori != 1) {
        //最後に素数が残っている分を処理する
        ans *= calcComb(n + 1 - 1, n - 1);
        ans %= MOD;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
(format t "~d~%"
	(let* ((x (read))
	       (y (read))
	       (a (read))
	       (b (read))
	       (c (read))
	       (p (make-sequence 'vector a))
	       (q (make-sequence 'vector b))
	       (r (make-sequence 'vector c)))
	  (loop for i upto (1- a) do (setf (elt p i) (read)))
	  (loop for i upto (1- b) do (setf (elt q i) (read)))
	  (loop for i upto (1- c) do (setf (elt r i) (read)))
	  (reduce #'+ (sort (concatenate 'vector
					 (subseq (sort p #'>) 0 x)
					 (subseq (sort q #'>) 0 y)
					 r)
			    #'>)
		  :end (+ x y))))

Measured memory_bytes: 61896
#include <iostream>
#include <cstdio>
#define N 16005
using namespace std;

int x, y, c;
bool d, t[2][N], v[2][N];
string s;
int main()
{
	int i, j;
	cin >> s >> x >> y;
	v[1][8000] = 1;
	for (i = 0; s[i] == 'F'; i++);
	v[0][8000 + i] = 1;
	for (; i <= s.size(); i++) {
		if (s[i] == 'F') c++;
		else {
			for (j = c; j < N - c; j++) {
				t[d][j - c] = max(t[d][j - c], v[d][j]);
				t[d][j + c] = max(t[d][j + c], v[d][j]);
			}
			for (j = 0; j < N; j++) v[d][j] = t[d][j], t[d][j] = 0;
			c = 0;
			d = !d;
		}
	}
    cout << (v[0][x + 8000] & v[1][y + 8000] ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int time;
	if(b<c || d<a){
		time = 0;
	}
	if(a<=c && c<=b && b<=d){
		time = b-c;
	}
	if(c<=a && a<=d && d<=b){
		time = d-a;
	}
	if(a<=c && d<=b){
		time = d-c;
	}
	if(c<a && b<d){
		time = b-a;
	}
	cout << time << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    // Your code here
    int M,D,count=0,a,b;
    scanf("%d%d",&M,&D);
    for(int i=2;i<=D;i++){
        a=i/10;
        b=i%10;
            if(i/10!=1&&i%10!=1){
                if(4<=a*b&&a*b<=M){
                count++;
            }
        }
    }
    printf("%d",count);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
    #include<vector>
    using namespace std;
    using ll = long long;
    #define rep(i, n) for (int i = 0; i < (int)(n); i++)
    #define rep1(j, m) for (int j = 0; j <= (int)(m); j++)


int main(){

string a;
cin >> a;

char ans = 'a';

if(a<"a") ans = 'A';


cout << ans << endl;


}

Measured memory_bytes: 3616