akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <complex>
#include <tuple>

#define FAST ios_base::sync_with_stdio(false); cin.tie(0)
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define repr(i, a, b) for(int i=int(a); i>=int(b); i--)
#define reps(i,n) for(int i=1;i<=int(n);++i)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define iceil(x,y) (x+y-1)/y
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define all(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define LF "\n"

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

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<int, PII> PP;

ll n;
ll a;

int main()
{
	FAST;

	cin >> n;

	string ans="second";

	rep(i,n) {
		cin >> a;
		if (a%2==1) ans="first";
	}

	cout << ans << LF;

	return 0;
}

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

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}


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

    REP(i,N) {
        if ( A[i]%2 == 0 ) {
            if (!((A[i] % 3 == 0) || (A[i] % 5 == 0))) {
                cout << "DENIED" << endl;
                return 0;
            }
        }
    }
    cout << "APPROVED" << endl;
    return 0;

}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<queue>
#include<functional>
#include<map>
#include<set>
#include<cstring>
#include<string>
#include<stack>
#include<malloc.h>
#include<math.h>
using namespace std;
//#define int long long
typedef pair<int, int> pii;
typedef pair<int, char> pic;
typedef priority_queue<pii, vector<pii>, greater<pii> > RPQ;
#define mk make_pair
#define INF (1 << 30)
#define INFL (1ll << 60ll)
#define mod 1000000007

int N;
pic a[100100];

int partition(pic A[], int p, int r){
    int x = A[r].first;
    int i = p - 1;
    for(int j = p; j < r; j++){
        if(A[j].first <= x){
            i++;
            if(i != j)swap(a[i], a[j]);
        }
    }
    swap(A[i + 1], A[r]);
    return i + 1;
}

void quicksort(pic A[], int p, int r){
    if(p >= r)return;
    int q = partition(A, p, r);
    quicksort(A, p, q - 1);
    quicksort(A, q + 1, r);
}

map<int, string> mp1, mp2;

signed main(){
    cin >> N;
    for(int i = 0; i < N; i++){
        int x;
        char c;
        cin >> c >> x;
        a[i] = mk(x, c);
        mp1[x] += c;
    }
    quicksort(a, 0, N - 1);
    for(int i = 0; i < N; i++){
        mp2[a[i].first] += a[i].second;
    }
    string flag = "Stable";
    for(int i = 0; i < N; i++){
        if(mp1[a[i].first] != mp2[a[i].first]){
            flag = "Not stable";
        }
    }
    cout << flag << endl;
    for(int i = 0; i < N; i++){
        cout << a[i].second << " " << a[i].first << endl;
    }

    return 0;
}

/*

*/


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

int main() {
  int n;
  cin >> n;
  int a[n];
  int mx = 0, p;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] > mx) {
      mx = a[i];
      p = i;
    }
  }
  int r = 0, rr = 1e9 + 1;
  for (int i = 0; i < n; i++) {
    if (i == p) continue;
    if (abs(a[i] - mx / 2) < rr) {
      rr = abs(a[i] - mx / 2);
      r = a[i];
    }
  }
  cout << mx << " " << r << endl;
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")
#define endl "\n"
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template<class T, class T2> inline bool chkmax(T &x, const T2 &y) { return x < y ? x = y, 1 : 0; }
template<class T, class T2> inline bool chkmin(T &x, const T2 &y) { return x > y ? x = y, 1 : 0; }
const ll mod = 1e9 + 7;
template<class T> inline void fix(T &x) {if(x >= mod | x <= -mod) {x %= mod;} if(x < 0) {x += mod;}}

const int MAX_N = 110;
int tab[MAX_N][MAX_N];
int dp[MAX_N][MAX_N];

signed main() {
    //ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int n, m;
    cin >> n >> m;
    for(int i = 0; i < n; i ++) {
        for(int j = 0; j < m; j ++) {
            char c;
            cin >> c;
            tab[i][j] = (c == '#');
            dp[i][j] = mod;
        }
    }
    dp[0][0] = tab[0][0];
    for(int i = 0; i < n; i ++) {
        for(int j = 0; j < m; j ++) {
            if(i < n - 1) {
                int cost = 0;
                if(tab[i][j] != tab[i + 1][j] && tab[i][j] == 0) {cost = 1;}
                chkmin(dp[i + 1][j], dp[i][j] + (cost));
            }
            if(j < m - 1) {
                int cost = 0;
                if(tab[i][j] != tab[i][j + 1] && tab[i][j] == 0) {cost = 1;}
                chkmin(dp[i][j + 1], dp[i][j] + cost);
            }
        }
    }
    cout << dp[n - 1][m - 1];
    return 0;
}




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

ll inf=9223372036854775806,ans=0;

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);
	int i,a=0,b=0,c=0;
	string t;
	cin>>t;
	for (i=0;i<t.size();i++){
		if (t[i]=='a'){a++;}
		else if (t[i]=='b'){b++;}
		else if (t[i]=='c'){c++;}
	}
	if (a==1&&b==1&&c==1){
		cout<<"Yes";
	}
	else {
		cout<<"No";
	}
	return 0;
}

Measured memory_bytes: 256
/*..............................................*\
Author:Kishor Kumar Paroi
Dept:CSE-1703053
email.kishor.josephite@gmail.com
RUET,BANGLADESH
\*---------------------------*/
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
#include <sstream>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include<bits/stdc++.h>
#include<iostream>
#include<iterator>

#define max(a,b) ((a>b)?a:b)                        //finding max
#define min(a,b) ((a<b)?a:b)                        //finding min
#define Max(a,b,c) max(a,max(b,c))                  //finding max between 3 numbers
#define Min(a,b,c) min(a,min(b,c))                  //finding min between 3 numbers
#define Pi acos(-1.0)                               //defining Pi for mathematical uses
#define Clear(a) memset(a,0,sizeof(a))              //clearing memory of an array
#define setfalse(a) memset(a,false,sizeof(a))       //setting the array into false
#define settrue(a) memset(a,true,sizeof(a))         //setting the array into true
#define clrstr(a) memset(a,'\0',sizeof(a))          //setting string array to null
#define open freopen("input.txt","r",stdin)         //opening input file
#define close freopen ("output.txt","w",stdout)     //opening output file
#define Case(a) printf("Case %d: ",a)               //printing case number
#define caseh(a) printf("Case #%d: ",a)             //printing case number having '#'
#define getcase(a) scanf("%d",&a)                   //scanning case number
#define caseloop(a,b) for(a=1;a<=b;a++)             //making case loop
#define EPS 1e-9                                    //small value for avoiding preccesion error
#define LL long long                                //long long short form
#define fori(i,n) for(int i=1;i<=n;++i)
#define forn(i,n) for(int i=0;i<n;++i)
#define sz(x) int(x.size())
#define error(x) cout<<#x<<" "<<x<<endl
#define IOS  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)

//const int N=100*1000;
//const int mod=1e9+7;

//# define int min3(int a,int b,int c){return min(a,min(b,c));}
//#define int max3(int a,int b,int c){return max(a,max(b,c));}
//#define int min4(int a,int b,int c,int d){return min(min(a,b),min(c,d));}
//#define int max4(int a,int b,int c,int d){return max(max(a,b),max(c,d));}

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    char s[1];
    int i;
    for(i=0; i<1; i++)
        cin>>s[i];
    for(i=0; i<1; i++)
    {
        if(s[i]=='A')
            cout<< "T"<<endl;

        else if(s[i]=='G')
            cout<< "C"<<endl;

        else if(s[i]=='C')
            cout<< "G"<<endl;

        else
            cout<< "A"<<endl;
    }
    return 0;
}



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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const ll mod = 1000000007;

pair<ll, ll> reduce(ll a, ll b){
	if(b == 0)return {1, 0};
	if(a == 0)return {0, 1};
	if(b < 0){
		a = -a;
		b = -b;
	}
	ll g = __gcd(abs(a), abs(b));
	a /= g; b /= g;
	return {a, b};
}

pair<ll, ll> getPair(pair<ll, ll> a){
	return reduce(-a.second, a.first);
}

const ll modPow(ll a, ll b){
	ll ret = 1;
	while(b){
		if(b&1)(ret *= a) %= mod;
		(a *= a) %= mod;
		b >>= 1;
	}
	return ret;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	int n; cin>>n;
	map<pair<ll, ll>, int> mp;
	int cnt = 0;
	for(int i = 0; i < n; i++){
		ll a, b; cin>>a>>b;
		if(a == 0 && b == 0){
			cnt++;
		}else{
			mp[reduce(a, b)]++;
		}
	}
	set<pair<ll, ll> > st;
	ll ans = 1;
	for(auto x : mp){
		if(st.find(x.first) != st.end())continue;
		pair<ll, ll> y = getPair(x.first);
		ll tmp = modPow(2, mp[x.first]) + modPow(2, mp[y]) - 1;
		(ans *= tmp) %= mod;
		st.insert(x.first); st.insert(y);
	}
	(ans += cnt + mod - 1) %= mod;
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 53572
#include<bits/stdc++.h>
using namespace std;
int main() {
	int N, x; cin >> N >> x;
	int a[N];
	for (int i = 0; i < N; i++)	cin >> a[i];
	sort(a, a + N);
	int res = 0;
	long long sum = 0;
	for (int i = 0; i < N; i++)
	{
		if(sum + a[i] > x) {
			cout << res << endl;
			return 0;
		}
		else {
			sum += a[i];
			res++;
		}
	}
	if(sum == x) cout << N << endl;
	else cout << N-1 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);
static const int INF = 1e9+7;

/*
  DP
  0-1 ナップザック問題

*/

int main(){

  int n, w;
  cin >> n >> w;
  P items[n+1];
  REP2(i,1,n+1){
    int v, w;
    cin >> v >> w;
    items[i].first = v;
    items[i].second = w;
  }



  int dp[n+1][w+1];
  REP(i,n+1) REP(j, w+1){
    dp[i][j] = 0;
  }

  REP2(i,1,n+1){
    int value = items[i].first;
    int weight = items[i].second;
    REP2(j,1,w+1){
      if(j < weight){
        dp[i][j] = dp[i-1][j];
      }
      else{
        dp[i][j] = max(dp[i-1][j], dp[i-1][j-weight] + value);
      }
    }
  }

  // REP(i,n+1){
  //   REP(j,w+1){
  //   cout << dp[i][j] << " ";
  // }
//   cout << endl;
// }

  int ans = dp[n][w];

  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 7028
#pragma GCC optimize("O3")
#pragma GCC target("avx")
#include <cstdio>
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define SIZE 100000
#define MOD 1000000007
using namespace std;
typedef long long ll;

struct ModFact {
    int sum[SIZE+1];
    int fact[SIZE+1];
    constexpr ModFact() : fact(), sum() {
        ll f = 1;
        fact[0] = f;
        for (int i = 0; i <= SIZE; i++) {
            f = f*(i+1)%MOD;
            fact[i+1] = f;
        }
        f = power(f, MOD-2);
        for (int i = SIZE; i >= 0; i--) {
            sum[i] = fact[i] * f % MOD;
            f = f * (i+1) % MOD;
        }
        for (int i = 1; i <= SIZE; i++) {
            sum[i] = (sum[i] + sum[i-1]) % MOD;
        }
    }
    inline constexpr ll power(ll a, ll b) {
        ll r = 1;
        while (b>0) {
            if((b&1)!=0) r = (r*a)%MOD;
            a = (a*a)%MOD;
            b >>= 1;
        }
        return r;
    }
	inline int operator[](int index) {
		return sum[index];
	}
	inline int getfact(int index) {
		return fact[index];
	}
    
} fact;

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
    if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
    return *ci++;
}

inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
    else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
    return A;
}

int main() {
    ll ans = 0, d;
    int N, prev, now;
    N = getint();
    prev = getint();
    REP(i, N-1) {
        ans += fact[i] * ll((now = getint()) - prev);
        prev = now;
    }
    printf("%lld\n", (ans%MOD)*fact.getfact(N-1)%MOD);
	return 0;
}


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

#define int long long

using namespace std;

int solve (int b, int n) {
    if (b > n) return n;

    return solve(b, n / b) + n % b;
}

signed main(){
    int n, s;
    scanf("%lld %lld", &n, &s);

    if (n == s) printf("%lld", n + 1);
    else {
        int m = n - s;
        int cur = 0x3f3f3f3f3f3f3f3f;

        for (int i = 1; i <= sqrt(m); i++) {
            if (m % i == 0) {
                int res = solve(i + 1, n);
                int ans = solve(m / i + 1, n);

                if (res == s) cur = min(cur, i + 1);
                if (ans == s) cur = min(cur, m / i + 1);
            }
        }

        if (cur > 1e18) printf("%lld", -1LL);
        else printf("%lld", cur);
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;

#define endl '\n'
#define loop(i, m, n) for (ll i = m; i < n; i++)
#define loope(i, m, n) for (ll i = m; i <= n; i++)
#define epool(i, m, n) for (ll i = m; i >= n; i--)
#define mod 1000000007
#define mod2 998244353                                                                          
#define vi vector<ll>
#define pll pair<ll, ll>
#define fi first
#define se second
#define pb push_back
#define MP make_pair
#define empf emplace_front
#define empb emplace_back
#define ret(x) return cout << x,0;
#define all(v) v.begin(),v.end() 
#define maxheap priority_queue<ll>
#define minheap priority_queue<ll,vector<ll>,greater<ll>>
const ll INF=1e18;
const double PI=4*atan(1);

#define SpeedForce               \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                    \
    cout.tie(0);

using namespace __gnu_pbds;
using namespace std;
typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;

const int maxN=8*1e6;
bool prime[maxN+1];
ll mpow(ll base,ll exp);
ll POW(ll base,ll exp);
ll gcd(ll a,ll b);
ll modInverse(ll n);
ll nCr(ll n, ll r);
void sieve();
ll myxor(ll a,ll b);

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

void solve(){
    ll d,t,s;
    cin >> d >> t >> s;

    if(s*t>=d){
        cout << "Yes";
    }
    else cout << "No";

}

int32_t main(){
    SpeedForce


    int t;
    t=1;
    //cin >> t;
    cerr << endl;
    while (t--){
        //cout << fixed << setprecision(10);
        solve();
    }
    cerr << "Time : " << 1000*((double)clock())/ (double)CLOCKS_PER_SEC << "ms" << endl;
}   

ll POW(ll base,ll exp){
    ll result = 1;
    while (exp > 0){
        if (exp & 1)
            result = ((ll)result * base);
        base = ((ll)base * base);
        exp >>= 1;
    }
    return result;
}

ll mpow(ll base, ll exp){
    base %= mod;
    ll result = 1;
    while (exp > 0){
        if (exp & 1)
            result = ((ll)result * base) % mod;
        base = ((ll)base * base) % mod;
        exp >>= 1;
    }
    return result;
}

ll gcd(ll a,ll b){
    if(b==0) return a;
    return gcd(b,a%b);
}

ll modInverse(ll n) { 
    return mpow(n, mod-2); 
}
 
ll nCr(ll n, ll r){ 
   if (r==0) 
      return 1; 
    ll fac[n+1]; 
    fac[0] = 1; 
    for (int i=1 ; i<=n; i++) 
        fac[i] = (fac[i-1]*i)%mod; 
    return ((fac[n]* modInverse(fac[r]) % mod * 
            modInverse(fac[n-r]) % mod)%mod)%mod; 
}

ll myxor(ll a,ll b){
    return (a|b)&(~a|~b);
}

void sieve(){
    memset(prime,true,sizeof(prime));
    for(int p=2;p*p<maxN;p++){
        if(prime[p]){
            for(int i=2*p;i<maxN;i+=p){
                prime[i]=false;
            }
        }
    }
}

Measured memory_bytes: 3804
#include <bits/stdc++.h>
using namespace std;
#define N 100010
#define ll long long
int n,a[N],b[N],id[N];
ll ans[N];
inline bool cmp(int x,int y){
	return a[x]>a[y] || (a[x]==a[y] && x<y);
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i) scanf("%d",&a[i]),b[i]=a[i],id[i]=i;
	sort(b+1,b+n+1);sort(id+1,id+n+1,cmp);
	
	for(int i=1,lst=0;i<=n;++i){
		if(i==1) lst=id[i];
		if(i==1 || a[id[i]]!=a[id[i-1]]){
			int p=lower_bound(b+1,b+n+1,a[id[i]])-b-1;
			lst=min(lst,id[i]);
			ans[lst]+=1ll*(a[id[i]]-b[p])*(n-p);
		}
	}
	for(int i=1;i<=n;++i) printf("%lld\n",ans[i]);
	return 0;
} 

Measured memory_bytes: 3072
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007; // 998244353
using ll = long long;
using namespace std;

int main(){
	map<string, int> mp;
	int n; cin >> n;
	while( n-- ){
		string temp; cin >> temp;
		++mp[temp];
	}
	int cnt = 0;
	for( auto &k : mp ){
		++cnt;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 19228
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int,int> P;
 
const int INF = 1e9;
const int mod = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1.0);


int main(){
    ll n;
    cin >> n;
    ll ans = INF;
    while(n/100 != 0){
        ans = min(ans,abs(753-n%1000));
        n /= 10;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <set>
#include <vector>
#include <queue>

using namespace std;

typedef long long ll;
typedef long double ld;

constexpr int INF = 1e9;
constexpr ll BIGINF = 1e18;
constexpr double EPS = 1e-16;
constexpr int MOD = 1e9 + 7;

void preambule() {
  cin.tie(0);
  cout.precision(16);
  cout << fixed;
}

int a;
int b;
int c;

void input() {
  cin >> a >> b >> c;
}

void solve() {
  cout << min(b / a, c);
}

int main() {
#ifdef _DEBUG
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  preambule();
  input();
  solve();
}


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

// #が連結ならよい
int main(){
    int H, W;
    cin >> H >> W;
    vector<vector<char> > s(H,vector<char>(W));

    for(int i=0; i<H;i++){
        for(int j=0; j<W; j++){
            cin >> s.at(i).at(j);
        }
    }

    bool flag =true; //孤立点があればfalse

    vector<int> dx(4);
    dx.at(0)=-1; dx.at(1)=0; dx.at(2)=1; dx.at(3)=0;
    vector<int> dy(4);
    dy.at(0)=0; dy.at(1)=1; dy.at(2)=0; dy.at(3)=-1;

    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            if(s.at(i).at(j)=='#'){
                bool flag2 = false; //孤立点かどうかのフラグ
                for(int k=0; k<=3; k++){
                    int nx = i+dx.at(k); //新しいx座標
                    int ny = j+dy.at(k); //
                    if( 0<=nx && nx < H && 0<=ny && ny < W && s.at(nx).at(ny) == '#' ){
                        flag2 = true;
                    }
                }
                if(!flag2) flag = false;
            }
        }
    }

/*
    for(int i=0; i<H;i++){
        for(int j=0; j<W; j++){
            cout << s.at(i).at(j);
        }
        cout << endl;
    }
*/
    if(flag) cout << "Yes" << endl;
    if(!flag) cout << "No" << endl;
}

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

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

using namespace std;
using lint=long long;

int main(){
	int n; cin>>n;
	lint ans=1;
	rep(i,n) ans=ans*(i+1)%1000000007;
	cout<<ans<<'\n';

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int Maxn=400;
int a[Maxn],maj,n;
int main(){
	cin>>n;
	for(int i=0;i<(2*n);i++){
		cin>>a[i];
	}
	sort(a,a+(2*n));
	for(int i=0;i<(2*n);i+=2){
		maj+=a[i];
	}
	cout<<maj;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const int INF = 1e3;
typedef long double ld;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
int main(){
  int n;  cin >> n;
  int k;  cin >> k;
  string s; cin >> s;
  int fst = 0;
  rep(i,0,s.size()-1){
    if(s[i]==s[i+1]) fst++;
  }
  int ans = min(n-1, fst+2*k);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
using namespace std;
const int mo = 1e9 + 7;
const int ma = 10005, m = 105;
#define int long long
struct mint
{
    int x;
    mint() : x(0) {}
    mint(int x) : x((x % mo + mo) % mo) {}
    mint &fix()
    {
        x = (x % mo + mo) % mo;
        return *this;
    }
    mint operator-() const { return mint(0) - *this; }
    mint &operator+=(const mint &a)
    {
        if ((x += a.x) >= mo)
            x -= mo;
        return *this;
    }
    mint &operator-=(const mint &a)
    {
        if ((x += mo - a.x) >= mo)
            x -= mo;
        return *this;
    }
    mint &operator*=(const mint &a)
    {
        (x *= a.x) %= mo;
        return *this;
    }
    mint operator+(const mint &a) const { return mint(*this) += a; }
    mint operator-(const mint &a) const { return mint(*this) -= a; }
    mint operator*(const mint &a) const { return mint(*this) *= a; }
    bool operator<(const mint &a) const { return x < a.x; }
    bool operator==(const mint &a) const { return x == a.x; }
};
istream &operator>>(istream &i, mint &a)
{
    i >> a.x;
    return i;
}
ostream &operator<<(ostream &o, const mint &a)
{
    o << a.x;
    return o;
}
mint dp[ma][m][2];
main()
{
    string s;
    cin >> s;
    int n;
    cin >> n;
    dp[0][0][0] = 1;
    for( int i = 0; i < s.size(); i++ )for( int j = 0; j < n; j++ )for( int k = 0; k < 2; k++ ) for( int x = 0; x < 10; x++ )
    {
        int nk = k;
        if( !k && x > s[i] - '0' )continue;
        if( x < s[i] - '0' ) nk = 1;
        dp[i + 1][( j + x ) % n ][nk] += dp[i][j][k];
    }
    mint ans = dp[s.size()][0][0];
    ans += dp[s.size()][0][1];
    ans -= 1;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 16640
S = input()
tList = list(S)

firstStation = tList[0]
Monopoly = 0

for str in tList:
    if(str == firstStation):
        Monopoly = 0

    else:
        Monopoly = 1
        break

if(Monopoly == 0):
    print('No')
else:
    print('Yes')


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,n) for(ll i=0;i<n;i++)
#define repp(i,a,b) for(ll i=a;i<=b;i++)
#define reff(i,a,b) for(ll i=a;i>=b;i--)
#define ll long long int
#define pll pair<ll,ll>
#define fill(a,x) memset(a,x,sizeof(a))
#define mb make_pair
#define pb push_back
#define F first
#define S second
#define M 1000000007
#define sc(x) scanf("%d",&x)
#define scc(x1,x2) scanf("%d%d",&x1,&x2)
#define sccc(x1,x2,x3) scanf("%d%d%d",&x1,&x2,&x3)
#define pr(x) printf("%lld ",x)
#define dbg(a)          std::cerr<<#a<<"="<<(a)<<"\n"
#define dbg1(a,b)       std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define dbg2(a,b,c)     std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define dbg3(a,b,c,d)   std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"
#define all(v) v.begin(),v.end()
#define PI 3.14159265
#define co cout<<"fuck"<<endl
const int INF = 2034567891;
const ll INF64 = 4234567890123456789ll;
long long nc3(long long v){return (v * (v - 1ll) * (v - 2ll)) / 6ll;}
long long nc2(long long v){return (v * (v - 1ll)) / 2ll;}
ll gcd(ll a, ll b) { return (b == 0 ? a : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return (a * (b / gcd(a, b))); }
const int N = 10+2e5;
bool isprime(ll n) {
    if (n < 2) return 0;
    if (n == 2) return 1;
    if (n % 2 == 0) return 0;
    for (ll i = 3; i*i <= n; i++) if (n%i == 0) return 0;
    return 1;
}
double dist(pll p1, pll p2)
 {
    return (p1. F - p2.F)*(p1.F - p2.F) +
          (p1.S - p2.S)*(p1.S - p2.S);
 }
ll power(ll x,ll y)
{
    ll ans=1;
    while(y>0){
        if(y&1)
            ans=(ans*x)%M;
        x=(x*x)%M;
        y/=2;
    } 
    return ans;
}
int main()
{
     fast;
     ll n,m,x,y;
     cin>>n>>m;
     ll a[n+1];
     repp(i,1,n)
     cin>>a[i];
     vector<int>v(n+1,1);
     rep(i,m)
     {
        cin>>x>>y;
        if(a[x]<=a[y])
        v[x]=0;
        if(a[y]<=a[x])
        v[y]=0;
	 }
	 ll cnt=0;
	 repp(i,1,n)
	 {
	    if(v[i])
	    cnt++;
	 }
	 cout<<cnt;
}   

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

int n;
int sq[1000][1000];

bool safe(int x, int y){
    return (x >= 0 && y >= 0 && x < n && y < n);
}

int minOf4(int x, int y){
    int b = 0;
    if (sq[x+1][y+1] && sq[x][y+1] && sq[x+1][y]){
	b = min(sq[x+1][y+1], min(sq[x][y+1], sq[x+1][y]));
    }
    return b;
}

int main(){
    while (1){
	cin >> n;
	if (!n) break;

	char c;
	for (int i = 0; i < n; i++){
	    for (int j = 0; j < n; j++){
		cin >> c;
		if (c == '.') sq[i][j] = 1;
		else sq[i][j] = 0;
	    }
	}

	for (int i = n-1; i >= 0; i--){
	    for (int j = n-1; j >= 0; j--){
		if (sq[i][j] != 0)
		    sq[i][j] += minOf4(i, j);
	    }
	}

	int m = 0;
	for (int i = 0; i < n; i++){
	    for (int j = 0; j < n; j++){
		if (m < sq[i][j]) m = sq[i][j];
	    }
	}

	cout << m << endl;
    }
}

Measured memory_bytes: 0
#include <stdio.h>
int main (void){

  int i , j ;

  for (i = 1 ; i <= 9 ; i++){
    for (j = 1 ; j <= 9 ; j++){
      printf ("%dx%d=%d\n",i,j,i*j);
    }

  }

  return 0 ;
}

Measured memory_bytes: 524
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define pa pair<int,int>
const int Maxn=4010;
const int mod=998244353;
const int inf=2147483647;
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<<3)+(x<<1)+(ch^48),ch=getchar();
	return x*f;
}
void upd(int &x,int y){x+=y;if(x>=mod)x-=mod;}
int k,n,C[Maxn][Maxn];
void pre()
{
	C[0][0]=1;
	for(int i=1;i<=4000;i++)
	{
		C[i][0]=1;
		for(int j=1;j<=i;j++)
		C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
	}
	
}
int main()
{
	pre();
	k=read(),n=read();
	for(int i=2;i<=(k<<1);i++)
	{
		int t,tmp=0;
		if(i<=k+1)t=(i>>1);
		else t=(i>>1)-(i-k)+1;
		for(int j=0;(j<<1)<=n&&j<=t;j++)
		{
			if(!(j&1))upd(tmp,(LL)C[t][j]*C[n-(j<<1)+k-1][k-1]%mod);
			else upd(tmp,(LL)mod-(LL)C[t][j]*C[n-(j<<1)+k-1][k-1]%mod);
		}
		printf("%d\n",tmp);
	}
}

Measured memory_bytes: 61440
N = int(input())
A = [int(i) for i in input().split()]

while len(A) > 1:
  min_num = min(A)
  min_index = A.index(min(A))
  for i in range(len(A)):
    if i != min_index:
      A[i] = A[i] % min_num

  while 0 in A:
    A.remove(0)

print(A[0])

Measured memory_bytes: 14252
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const vector<int> num = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> a(m);
  rep(i, m) cin >> a[i];
  sort(a.begin(), a.end());
  vector<int> dp(n+1, -1);
  dp[0] = 0;
  for (int i = 1; i <= n; i++) {
    rep(j, m) {
      if (i-num[a[j]] < 0 || dp[i-num[a[j]]] < 0)
        continue;
      chmax(dp[i], dp[i-num[a[j]]]+1);
    }
  }
  int i = n;
  while (i) {
    for (int j = m-1; j >= 0; j--) {
      if (i-num[a[j]] < 0)
       continue;
      if (dp[i-num[a[j]]]+1 == dp[i]) {
        cout << a[j];
        i -= num[a[j]];
        break;
      }
    }
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 3596
#include <cstdio>

using namespace std;

int main(void){
  long long int x,y;
  
  scanf("%lld%lld", &x, &y);
  if (x>=2 && y>=2) printf("%lld\n", (x-2)*(y-2));
  if (x==1 && y!=1) printf("%lld\n", y-2);
  if (x!=1 && y==1) printf("%lld\n", x-2);
  if (x==1 && y==1) printf("1\n");
  return 0;
}
  

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
//#include <unordered_set>
//#include <iomanip>
//#pragma GCC optimize("Ofast")  //デバッグ時にoptimized-outされて邪魔だった
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define floatprec(dig) fixed << setprecision(dig)
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
#define invar(typ, var) typ var; cin >> var;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

int dp[102][20002];

signed main(void) {
  cin.tie(0); ios::sync_with_stdio(false);
  
  invar(int, N); invar(int, W);
  vi v(N); vi w(N);
  rep(i, N) {
    cin >> v[i] >> w[i];
  }
  /*
  for(int i=1; i<=N; ++i) {
    for(int j=0; j<=W; ++j) {
      dp[i][j] = max(dp[i - 1][j], (j - w[i - 1] >= 0 ? dp[i - 1][j - w[i - 1]] + v[i - 1] : 0));
    }
  }*/
  //与えるDP
  for(int i=0; i<N; ++i) {
    for(int j=0; j<=W; ++j) {
      chmax(dp[i + 1][j + w[i]], dp[i][j] + v[i]);
      chmax(dp[i + 1][j], dp[i][j]);
    }
  }
  
  fin(dp[N][W]);
}


Measured memory_bytes: 7580
#include <bits/stdc++.h>
#include <string>
using namespace std;
 
int main(){
  string S;
  cin >> S;
  int L=S.size();
  string ans;
  for(int i=0; i<L; i++){
    if(S.at(i)=='0') ans+= '0';
    else if(S.at(i)=='1') ans+= '1';
    else if(S.at(i)=='B' && ans.size()!=0) ans.erase(ans.begin()+ans.size()-1);
  }
  cout << ans << endl;  
}

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

using namespace std;

#define ll long long
#define ld long double
#define pll pair <ll , ll>

#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mp make_pair

#define X first
#define Y second

#define LB(x) ((x) & -(x))
#define BIT(a , b) (((a)>>(b)) & 1)

const ll MAXN=3e3+10;

vector <ll> vertex[MAXN];

ll a[MAXN];
ll dp[MAXN];

void dfs(ll v , ll par=-1)
{
    dp[v]=0;

    for(ll i=0;i<vertex[v].size();i++)
    {
        if (vertex[v][i]!=par)
        {
            dfs(vertex[v][i] , v);

            if (a[vertex[v][i]]<a[v])
            {
                dp[v]|=(1-dp[vertex[v][i]]);
            }
        }
    }
}

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

	ll n;
	cin>>n;

	for(ll i=1;i<=n;i++)
    {
        cin>>a[i];
    }

    for(ll i=0;i<(n-1);i++)
    {
        ll v , u;
        cin>>v>>u;

        vertex[v].pb(u);
        vertex[u].pb(v);
    }

    for(ll i=1;i<=n;i++)
    {
        dfs(i);

        if (dp[i])
        {
            cout<<i<<" ";
        }
    }
}


Measured memory_bytes: 640
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;
const long double EPS = 1e-10;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    double inx; cin >> inx;
    inx = inx / 180.0 * M_PI;
    P< long double, long double> vec = {0, 1.0};
    long double x = 0, y = 0;
    int i = 0;
    while (true) {
        i++;
        x += vec.first, y += vec.second;
        if (-EPS < x && x < EPS && -EPS < y && y < EPS) break;
        P< long double, long double> tmpv = {cosl(inx) * vec.first - sinl(inx) * vec.second,
                                             sinl(inx) * vec.first + cosl(inx) * vec.second};
        vec = tmpv;
    }
    cout << i << '\n';
    return 0;
}


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

int main(){
  int N, M, A, K, ans=0;
  cin >> N >> M;
  vector<int> tmp(M, 0);
  for(int i=0; i<N; ++i){
    cin >> K;
    for(int j=0; j<K; ++j){
      cin >> A;
      tmp[A-1]++;
    }
  }
  for(int i=0; i<M; ++i) ans += (tmp[i]==N);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<ctime>
#include<cstdio>
#include<string>
//#include<string>
//#include<sstream>
using namespace std;
int main()
{
	int n;
	scanf("%d",&n);
	printf("ABC%d\n",n);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,k;cin>>n>>k;
    string s;cin>>s;
    vector<int> ren;
    int now=1;//今見ている数
    int cnt=0;//nowがいくつ並んでいるか
    for(int i=0;i<n;i++){
        if(s[i]==(int)('0'+now))cnt++;
        else{
            ren.push_back(cnt);
            now=1-now;
            cnt=1;//新しいのをカウントし始める
        }
    }
    if(cnt!=0)ren.push_back(cnt);
    if(ren.size()%2==0)ren.push_back(0);//1-0-1-0-1;
    if(ren.size()/2<k){
        cout<<s.size()<<endl;
        return 0;
    }
    //for(int i=0;i<ren.size();i++)cout<<ren[i]<<" ";
    //cout<<endl;
    int res = ren[0];
    for(int i=0;i<k;i++){
        int key = i*2+1;
        res+=ren[key]+ren[key+1];
    }
    //cout<<res<<endl;
    
    int sum = res;
    for(int i=k*2;i<ren.size()-2;i+=2){
        sum-=(ren[i-k*2]+ren[i-k*2+1]);
        //cout<<ren[i-k*2]<<" "<<ren[i-k*2+1]<<endl;
        //cout<<sum<<endl;
        sum+=ren[i+1]+ren[i+2];
        res=max(sum,res);
    }
    cout<<res<<endl;
}

Measured memory_bytes: 1020
from bisect import bisect_left as bl

n = int(input())
s = list(input())
q = int(input())
l = [[] for i in range(26)]
for i in range(n):
    l[ord(s[i])-ord("a")].append(i)
for i in range(q):
    x,y,z = input().split()
    if x == "1":
        y = int(y)-1
        if s[y] == z:
            continue
        b = ord(s[y])-ord("a")
        a = ord(z)-ord("a")
        l[b].pop(bl(l[b],y))
        l[a].insert(bl(l[a],y),y)
        s[y] = z
    if x == "2":
        count = 0
        for j in l:
            index = bl(j,int(y)-1)
            if index < len(j) and j[index] < int(z):
                count += 1
        print(count)

Measured memory_bytes: 28872
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
  a[i]=format(a[i],'022b')
A=[[0 for i in range(22)] for j in range(n+1)]
for i in range(n):
  for j in range(22):
    if a[i][j]=='1':
      A[i+1][j]=A[i][j]+1
    else:
      A[i+1][j]=A[i][j]

ct=0
right=1
for i in range(n):
  flag=0
  for j in range(right,n+1):
    check=0
    for k in range(22):
      if A[j][k]-A[i][k]<=1:
        check+=1
    if check!=22:
      right=j-1
      ct+=right-i
      flag=1
      break
  if flag==0:
    right=j
    ct+=right-i
print(ct)

Measured memory_bytes: 126568
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main{

	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);

		int n=sc.nextInt();
		int m=sc.nextInt();
		int p[]= new int[m];
		long y[]=new long[m];
		HashMap<Long,Long> map= new HashMap<Long,Long>();
;		long num[]=new long[m];

		for(int i=0;i<m;++i){
			p[i]=sc.nextInt();
			y[i]=sc.nextLong();
			num[i]=10000000000L*p[i]+y[i];
		}
		Arrays.sort(num);

		long div=1;
		long counter=1;
		for(int i=0;i<m;++i){
			if(num[i]/10000000000L==div);
			else{
				div=num[i]/10000000000L;
				counter=1;
			}
			map.put(num[i]-div*10000000000L,counter);
			++counter;
		}

		for( int i=0;i<m;++i){
			String s=String.valueOf((long)1000000+p[i]);
			String s2=String.valueOf(1000000+map.get(y[i]));
			System.out.println(s.substring(1)+s2.substring(1));
		}
	}
}

Measured memory_bytes: 113256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

#define mp(a,b) make_pair(a, b)
#define __builtin_popcount __builtin_popcountll

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
    os<<"["; for(auto it = t.begin(); it != t.end(); ++ it) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
    os<<"{"; for(auto &it : t) {if(it!=t.begin()) os<<","; os<<it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const map<S, T> &t) {
    os<<"{"; for(const auto &it : t) {if(it!=t.begin()) os<<","; os<<it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class S, class T> pair<S,T> operator+(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first+t.first, s.second+t.second);}
template<class S, class T> pair<S,T> operator-(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first-t.first, s.second-t.second);}

const int INF = 1<<28;
const double EPS = 1e-8;
const int MOD = 1000000007;


int T, h, w;

int max_rect(vi &data){
    data.push_back(0);
    vector<pii> q;
    q.emplace_back(0, -1);
    int res = 0;
    for (int i = 0; i < data.size(); ++i) {
        int ni = i;
        int x = data[i];
        while(!q.empty() && q.back().first >= x) {
            int y, j; tie(y, j) = q.back(); q.pop_back();
            res = max(res, y * (i - j + 1));
            ni = j;
        }
        q.emplace_back(x, ni);
    }
    return res;
}

int main(int argc, char *argv[]){
    ios::sync_with_stdio(false);
    scanf("%d%d", &h, &w);
    vector<vi> raw(h, vi(w));
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            char c;
            scanf(" %c", &c);
            raw[i][j] = c == '#';
        }
    }
    int ans = max(h, w);
    vector<vi> data(w, vi(h));
    for (int i = 1; i < h; ++i) {
        int p1 = 0, p2 = 0;
        for (int j = (int) w - 1; j >= 0; --j) {
            if (raw[i][j] == raw[i-1][j]) {
                p1 = 0;
                p2 ++;
            } else {
                p1 ++;
                p2 = 0;
            }
            data[j][i] = max(p1, p2);
        }
    }
    for (int j = 0; j < w; ++j) {
        ans = max(ans, max_rect(data[j]));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 43520
#include<iostream>
using namespace std;
main()
{
	int a,b,c,d;cin>>a>>b>>c>>d;
	for(int i=a;i<c;i++)cout<<"R";
	for(int i=b;i<d;i++)cout<<"U";
	for(int i=a;i<c;i++)cout<<"L";
	for(int i=b;i<d;i++)cout<<"D";
	cout<<"D";
	for(int i=a;i<=c;i++)cout<<"R";
	for(int i=b;i<=d;i++)cout<<"U";
	cout<<"LU";
	for(int i=a;i<=c;i++)cout<<"L";
	for(int i=b;i<=d;i++)cout<<"D";
	cout<<"R"<<endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int x = scan.nextInt();
        System.out.println(x < 1200 ? "ABC" : "ARC");
    }
}


Measured memory_bytes: 21204
#include <stdio.h>
#include <math.h>
int isprime(int);
int main(){
  int A[10000], i, j, x, n, count = 0, cnt = 0;
  scanf("%d",&n);
  for(i = 0; i < n; i++)scanf("%d",&A[i]);
  for(i = 0; i < n; i++){
    if(isprime(A[i]) == 1)count++;
  }
  printf("%d\n",count);
  return 0;
}
int isprime(int x){
  int i;
  if(x == 2)return 1;
  if(x < 2 || x % 2 == 0)return 0;
  i = 3;
  while(i <= sqrt(x)){
    if(x % i == 0)return 0;
    i += 2;
  }
  return 1;
}



Measured memory_bytes: 2068
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(long long i=0; i<(int)n; i++)
#define rep2(i,a,n) for(long long i=(a); i<(int)(n); i++)
#define all(vec) vec.begin(),vec.end()
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using psi = pair<string, int>;
const int dx[4] = {1, 0,-1, 0};
const int dy[4] = {0, 1, 0,-1};
const int mod = 1e9+7;
int gcd(int a, int b){if(a%b == 0){return(b);}else{return(gcd(b, a%b));}}
int lcm(int a, int b){return a * b / gcd(a, b);}

int N, M, K, H, W, L, R, X;
//string S, T;

signed main(){
  cin >> N;
  vi vec(N,0);
  rep(i,N-1){
    int C, S, F; cin >> C >> S >> F;
    for(int j=0; j<=i; j++){
      if(vec[j]<=S) vec[j] = C+S;
      else {
        int t = (vec[j]-S + F-1)/F;
        vec[j] = C+S+t*F;
      }
    }
  }
  rep(i,N) cout << vec[i] << endl;
  return 0;
}


Measured memory_bytes: 3592
#include <atcoder/all>
#include <bits/stdc++.h>

using namespace std;
using namespace atcoder;

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

#define m0(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
#define rep(i, n) for(int i = 0; i < (n); i++)
#define asort(x) sort(all(x));
#define dsort(x, t) sort(x.begin(), x.end(), greater<t>());
#define vuni(v) v.erase(unique(v.begin(), v.end()), v.end());
#define mins(m, s) m.insert(make_pair(s, 1));
#define mfin(m, s) m.find(s) != m.end()

#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl

const int INF = 1e9;
const ll LINF = 1e18;
const int mod = 1e9 + 7;

int main() {
    int N, M;
    cin >> N >> M;
    dsu d(N);

    int A, B;
    for(int i = 0; i < M; i++) {
        cin >> A >> B;
        A--, B--;
        d.merge(A, B);
    }

    vector<vector<int>> num = d.groups();
    cout << num.size() - 1 << endl;

    return 0;
}

Measured memory_bytes: 9012
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <stack>
#include <functional>
#include <sstream>
#define rep(i,j,n) for(i=j;i<(n);i++)
#define rrep(i,j,n) for(i=j;i>(n);i--)
typedef long long int lli;
#define N 1000000007

using namespace std;

int main(){
    lli n,m,s,c;
    bool wrong=true;
    string t,d;
    vector<string> num;
    lli i,j;
    cin>>n>>m;
    rep(i,0,n){
        num.push_back("a");
    }
    rep(i,0,m){
        cin>>s>>c;
        d=to_string(c);
        if((num[s-1]=="a")||(num[s-1]==d)){
            num[s-1]=d;
        }
        else{
            wrong=false;
        }
    }
    if((n==1)&&(num[0]=="a")){
        num[0]="0";
    }
    if(num[0]=="a"){
        num[0]="1";
    }
    rep(i,1,n){
        if(num[i]=="a"){
            num[i]="0";
        }
    }
    if(wrong==true){
        if((n!=1)&&(num[0]=="0")){
            cout<<"-1"<<endl;
        }
        else{
            rep(i,0,n){
                cout<<num[i];
            }
            cout<<endl;
        }
    }
    else{
        cout<<"-1"<<endl;
    }
}


Measured memory_bytes: 256
#include <queue>
#include <cstdio>
using namespace std;
main(){
	int n,m,x,y;
	scanf("%d%d",&m,&n);
	vector<vector<int> >v(m+1);
	vector<int>c(m+1);
	for(;n--;){
		scanf("%d%d",&x,&y);
		v[x].push_back(y);
		c[y]++;
	}
	queue<int>q;
	for(x=1;x<=m;x++)if(!c[x])q.push(x);
	for(;!q.empty();){
		int f=q.front();q.pop();
		printf("%d\n",f);
		for(x=0;x<v[f].size();x++){
			if(--c[v[f][x]]==0)q.push(v[f][x]);
		}
	}
}

Measured memory_bytes: 1052
#include <stdio.h>
#include <string.h>

int main(void)
{
  char str[11];
  scanf("%s",str);

  int i;
  int current = 0;
  int max = 0;

  for(i = 0; i < strlen(str); i++)
    {
      switch (str[i]) {
        case 'A':
        case 'C':
        case 'G':
        case 'T':
          current++;
          break;
        default:
          max = (max > current ? max : current);
          current = 0;
          break;
      }
    }
  max = (max > current ? max : current);
  printf("%d\n", max);
  return 0;
}


Measured memory_bytes: 128