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


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

  string s;
  cin>>s;

  rep(i,s.size()){
    if(s[i]=='1') s[i]='9';
    else s[i]='1';
  }
  cout<<s<<endl;


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n, x;
  cin >> n >> x;
  int ans = 0;
  int l[n];
  int d[n + 1];
  for(int i = 0; i < n; i++) {
    cin >> l[i];
  }
  
  d[0] = 0;
  for(int i = 1; i < n + 1; i++) {
    d[i] = d[i - 1] + l[i - 1];
    if(x  >= d[i]) {
      ans++;
    }
  }
  cout << ans + 1 << endl;
}

Measured memory_bytes: 256
#define _DEBUG
#include "bits/stdc++.h"
#include <atcoder/all>
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif
#define rep(index,num) for(int index=0;index<(int)num;index++)
#define rep1(index,num) for(int index=1;index<=(int)num;index++)
#define brep(index,num) for(int index=(int)num-1;index>=0;index--)
#define brep1(index,num) for(int index=(int)num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
using namespace atcoder;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=(ll)1e+18+1;
int INF=1e+9+1;
ll a[500001];
int main(){
	int N,Q;
	scan(N>>Q);
	fenwick_tree<ll> fw(N);
	rep(i,N) scan(a[i]),fw.add(i,a[i]);
	rep(q,Q){
		int k,l,r;
		scan(k>>l>>r);
		if(k==0) fw.add(l,r);
		else prin(fw.sum(l,r));//[l,r)
	}
	return 0;
}


Measured memory_bytes: 12128
#include<stdio.h>
#include<math.h>
#include<string.h>
#define max(a,b) a>b?a:b
#define min(a,b) a<b?a:b
#define N 102
int a[3][N],road[3][N],n;
// int dp[N][N];
int maxSum()
{
  int i,sum = 0;
  for(i = 1; i <= n; i++)
  road[1][i] = road[1][i-1]+a[1][i];
  for(i = n; i >= 1; i--)
  road[2][i] = road[2][i+1]+a[2][i];
  for(i = 1; i <= n; i++)
  {
    if(sum<road[1][i]+road[2][i])
    sum = road[1][i]+road[2][i];
  }
  return sum;
}


int main()
{
   // int dp[]
    // int a[2][01];
    int i,j;
    scanf("%d",&n);
    for( i = 1; i <= 2; i++)
    {
      for(j = 1; j <= n; j++){
      scanf("%d",&a[i][j]);
      }
    }
    printf("%d\n",maxSum());
    return 0;
}

Measured memory_bytes: 128
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//入力
		int N = sc.nextInt();
		int L = sc.nextInt();

		List<String> SArray = new ArrayList<String>();

		for (int i = 0; i < N; i++) {
			String S = sc.next();
			SArray.add(S);
		}

		Collections.sort(SArray);

		for (int i = 0; i < N; i++) {
		System.out.print(SArray.get(i));
		}
	}
}

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

int main() {
  long x;
  cin >> x;
  for (long i = -1000; i <= 1000; ++i) {
    for (long j = -1000; j <= 1000; ++j) {
      long a = i * i * i * i * i - j * j * j * j * j;
      if (a == x) {
        cout << i << ' ' << j << endl;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  if(min(B,D) - max(C,A)<0)
  {
    cout << 0 << endl;
  }
  else
  {
      cout << min(B,D) - max(C,A) << endl;
  }
  
  return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,d;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	if((a+b)<(c+d))
		printf("Right");
	else if((a+b)>(c+d))
		printf("Left");
	else
		printf("Balanced");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    ll n;cin>>n;
    ll s[n];
    unordered_map<ll,ll> mp;
    vector<pll> vv;
    vector<ll> pri;
    bool uu[100001];
    fill(uu,uu+100001,false);
    rep(i,2,100001){
        if(uu[i])continue;
        pri.push_back(i);
        for(ll j=i;j<100001;j+=i)uu[j]=true;
    }
    rep(i,0,n){
        cin>>s[i];
        rep(j,0,pri.size()){
            ll now=pri[j];
            now=now*now*now;
            if(now>s[i])break;
            while(s[i]%now==0)s[i]/=now;
        }
    }
    unordered_map<ll,ll> hei;
    rep(i,0,pri.size()){
        hei[pri[i]*pri[i]]=pri[i];
    }
    ll ans=0;
    rep(i,0,n){
        
        ll ns=1;
        ll gy=1;
        rep(jj,0,pri.size()){
            ll j=pri[jj];
            if(j*j*j>10000000000)break;
            
            if(s[i]%j==0){
                ll sum=0;
                while(s[i]%j==0){
                    s[i]/=j;
                    sum++;
                }
                sum%=3;
                rep(k,0,sum)ns*=j;
                sum=3-sum;
                sum%=3;
                rep(k,0,sum)gy*=j;
            }
        }
        //cout<<ns<<" "<<s[i]<<endl;
        if(s[i]==1){
            s[i]=ns;
        mp[s[i]]++;
        vv.push_back({ns,gy});
            continue;
        }
        if(s[i]<=100000){
            ns=s[i]*ns;
            gy*=s[i]*s[i];
            s[i]=ns;
            mp[s[i]]++;
            vv.push_back({ns,gy});
            continue;
        }
        if(hei[s[i]]>0){
            ns=s[i]*ns;
            gy*=hei[s[i]];
            s[i]=ns;
            mp[s[i]]++;
            vv.push_back({ns,gy});
            continue;
        }
        ans++;
      // cout<<ns<<" "<<gy<<endl;
    }
    
    unordered_map<ll,bool> used;
    
    rep(i,0,vv.size()){
        pll p=vv[i];
        if(used[p.first])continue;
        if(p.first==1){
            ans++;
            used[1]=true;
        }
        else{
            ans+=max(mp[p.first],mp[p.second]);
            used[p.first]=true;
            used[p.second]=true;
        }
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 17520
import java.util.*;

public class Main {
    public static void main(String args[]) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Map<String, Integer> wordFreq = new HashMap<>();
        for(int i = 0; i < n; i++) {
        	String word = sc.next();
        	char[] arr = word.toCharArray();
        	Arrays.sort(arr);
        	String newWord = new String(arr);
        	wordFreq.put(newWord, wordFreq.getOrDefault(newWord, 0) + 1);
        }
        long res = 0;
        for(Integer freq : wordFreq.values()) {
        	if(freq < 2) continue;
        	res += comb(freq);
        }
        System.out.println(res);
    }

    private static long comb(long a) {
    	return a * (a - 1) / 2;
    }
}


Measured memory_bytes: 51244
#include "bits/stdc++.h"
using namespace std;

#define fi first
#define se second
#define pb push_back
#define int long long
#define all(x) (x).begin(), (x).end()

using LL = long long;
using LD = long double;
using pii = pair<int, int>;
using vii = vector<pii>;

const int INF = 1e18;
const int MOD = 1e9 + 7;
const int N = 1e5 + 5;

int32_t main() {
    //ios::sync_with_stdio(false); cin.tie(nullptr);

    int n1, a, b, c;
    cin >> n1 >> a >> b >> c;

    vector<int> v1(n1), v2(n1), v3(n1);
    for (int i = 0; i < n1; i++) {
        cin >> v1[i];
    }

    float t1 = clock();

    int ans = INT_MAX;
    for (int mask1 = 1; mask1 < (1<<n1); mask1++) {
        int aa = 0;
        for (int i = 0, j = 0; i < n1; i++) {
            if (mask1 & (1<<i)) {
                aa += v1[i];
            } else {
                v2[j++] = v1[i];
            }
        }
        int tmp1 = 10 * max(0, __builtin_popcount(mask1) - 1) + abs(a - aa);
        int n2 = n1 - __builtin_popcount(mask1);
        for (int mask2 = 1; mask2 < (1<<n2); mask2++) {
            int bb = 0;
            for (int k = 0, l = 0; k < n2; k++) {
                if (mask2 & (1<<k)) {
                    bb += v2[k];
                } else {
                    v3[l++] = v2[k];
                }
            }
            int tmp2 = 10 * max(0, __builtin_popcount(mask2) - 1) + abs(b - bb);
            int n3 = n2 - __builtin_popcount(mask2);
            for (int mask3 = 1; mask3 < (1<<n3); mask3++) {
                int cc = 0;
                for (int m = 0; m < n3; m++) {
                    if (mask3 & (1<<m)) {
                        cc += v3[m];
                    }
                }
                int tmp3 = 10 * max(0, __builtin_popcount(mask3) - 1) + abs(c - cc);
                if (n1 > 0 and n2 > 0 and n3 > 0) {
                    ans = min(ans, tmp1 + tmp2  + tmp3);
                }
            }
        }
    }

    cout << ans << "\n";
    //cout << fixed << setprecision(3) << "Time: " << (clock() - t1) / CLOCKS_PER_SEC << "\n";
    return 0;
}


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

#define REP(i,s,N) for(int i=s; i<N; ++i)

/// print vector
template<typename U>
inline void print(U u) {
        if (u.size() == 0) return;
        std::cout << u[0];
        for (int i=1; i<u.size(); ++i) std::cout << " " << u[i];
        std::cout << std::endl;
}

using namespace std;

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

        vector<int> x(N,0);
        REP(i,0,N) {
                cin >> x[i]; 
        }   
        // insertion sort
        print(x);
        REP(i,1,N) {
                int key = x[i];
                int j = i-1;
                while (j >= 0 && x[j] > key) {
                        x[j+1] = x[j];
                        j--;
                }
                x[j+1] = key;
                print(x);
        }
        return 0;
}



Measured memory_bytes: 3140
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>


// #define int  long long
#define rep(i,begin,end) for(__typeof(end)i=(begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
// rep(i,1,10) is from 1 to 9 and rep(I,10,1) is from 9 to 1
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define F first
#define S second
#define sz(x) ((int)x.size())
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define pf push_front
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define mod 1000000007
#define mi multiset<int>
#define mii multiset<pii>
#define what_is(x) cerr << #x << " is " << x <<"\n";
#define sortA(v) sort(v.begin(), v.end())
#define sortD(v) sort(v.rbegin(), v.rend())
#define PI 3.14159265358979323846
#define vout(a) for(auto x:a) cout<<x<<" ";

// #define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>


// using namespace __gnu_pbds;
using namespace std;

int lcm(int a,int b) {return (a*(b/__gcd(a,b)));}

int modp(int a,int n)
{
    if(n==0) return 1;
    if(n==1) return a;
    int res=modp(a,n/2);
    if(n%2==0) return (res*res);
    else return (a*res*res);
}

// vi adj[1000000];

int check(long double m,vii a,int n)
{
    long double left=-1e18,right=1e18;

    rep(i,0,n)
    {
        long double dist;
        dist=sqrt(m*m-(a[i].S-m)*(a[i].S-m));
        left=max(left,dist);
        right=min(right,dist);
    }
    if(left<=right) return true;
    return false;
}


void solve()
{
    int t,n,m,i,k,r,l,u,v,w,j,s,sum=0,pos,flag=0,count=0;
    string S,T,U;
    
    cin>>S>>T;
    n=sz(S);
    m=sz(T);
    if(m==n+1)
    {
        rep(i,0,n)
        {
            if(S[i]!=T[i])
            {
                cout<<"No";
                return;
            }
        }
        cout<<"Yes";
        return;
    }    
    cout<<"No";

}


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


Measured memory_bytes: 3676
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
const int mod = 1E9 + 7;
const int inf = 1 << 29;

int main() {
  string s;
  int q;
  cin >> s >> q;
  vector<int> t(q), f(q);
  vector<char> c(q);
  rep(i, q) {
    cin >> t[i];
    if (t[i] == 2) {
      cin >> f[i] >> c[i];
    }
  }
  deque<char> string;
  rep(i, s.length()) string.push_back(s[i]);
  bool is_reversed = false;
  rep(i, q) {
    if (t[i] == 1) {
      is_reversed = !is_reversed;
    } else if (f[i] == 1) {
      if (!is_reversed) {
        string.push_front(c[i]);
      } else {
        string.push_back(c[i]);
      }
    } else {
      if (!is_reversed) {
        string.push_back(c[i]);
      } else {
        string.push_front(c[i]);
      }
    }
  }
  if (is_reversed) {
    for (auto it = string.rbegin(); it != string.rend(); ++it) {
      cout << *it;
    }
  } else {
    for (auto it = string.begin(); it != string.end(); ++it) {
      cout << *it;
    }
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 2688
#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <stack>
#include <algorithm>
#include <ctime>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define make make_pair
#define fi first
#define se second
#define vi std::vector<int>;
#define DEBUG cout << "debug" << endl
#define CLOSE ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
#define CASE int Kase=0;cin>>Kase;for(int kase=1;kase<=Kase;kase++)
const int N = 1e5 + 5;
const int M = 1e6 + 5;
const int MOD = 1e9 + 7;
const int CM = 998244353;
const int INF = 0x3f3f3f3f;
const double eps = 1e-6;
template <typename T>
T MAX(T a, T b) { return a > b ? a : b; }
template <typename T>
T MIN(T a, T b) { return a > b ? b : a; }
template <typename T>
T GCD(T a, T b){ return b == 0 ? a : GCD(b, a % b); }
template <typename T>
T LCM(T a, T b){ return a / GCD(a, b) * b; }
template <typename T>
T ABS(T a, T b) { return a > 0 ? a : -a; }
template <typename T>
T ADD(T a, T b, T MOD){ return (a + b) % MOD; }
template <typename T>
T DEL(T a, T b, T MOD) { return ((a - b) % MOD + MOD) % MOD; }
int n;
int a[N];
void solve(){
    cin >> n;
    for(int i = 1; i <= n; i++) cin >> a[i];
    sort(a + 1, a + n + 1);
    int ans = 0;
    for(int i = 1; i <= n; i++) {
        for(int j = i + 1; j <= n; j++) {
            for(int k = j + 1; k <= n; k++) {
                if(a[i] + a[j] > a[k] && a[i] != a[j] && a[j] != a[k]) ans++;
            }
        }
    }
    cout << ans << endl;
}
void TIME(){
    clock_t start, finish;
    double totaltime;
    start = clock();

    // 待测程序

    // CASE {
        solve();
    // }
    // 待测程序

    finish = clock();
    totaltime = (double)(finish - start) / CLOCKS_PER_SEC;
    printf("\nTime:%lfms\n", totaltime * 1000);
}
int main(){
    #ifdef ONLINE_JUDGE
        // CLOSE;
        // CASE {
            solve();
        // }
    #else
        // freopen("./data/a.txt", "r", stdin);
        // freopen("./data/a.txt", "w", stdout);
        TIME();
    #endif
    return 0;
}










Measured memory_bytes: 3192
n = int(input())

min_r = pre_r = int(input())
max_diff = None

for _ in range(n-1):
    cur_r = int(input())
    min_r = pre_r if pre_r < min_r else min_r
    pre_r = cur_r

    diff = cur_r - min_r
    if max_diff is None or diff > max_diff:
        max_diff = diff

print(max_diff)


Measured memory_bytes: 5612
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5,P=1e9+7;

int n,f[105][64];
int main(){
	scanf("%d",&n);
	if(n==1){
		puts("4");
		return 0;
	}
	if(n==2){
		puts("16");
		return 0;
	}
	if(n==3){
		puts("61");
		return 0;
	}
	for(int i=0;i<4;i++)
	for(int j=0;j<4;j++)
	for(int k=0;k<4;k++)
		f[3][i*16+j*4+k]=1;
	f[3][11]=f[3][35]=f[3][14]=0;
	for(int i=4;i<=n;i++)
	for(int j=0;j<64;j++){
		int x=j/16,y=(j%16)/4,z=j%4;
		(f[i][y*16+z*4]+=f[i-1][j])%=P;
		(f[i][y*16+z*4+1]+=f[i-1][j])%=P;
		if(!(y==0&&z==3))(f[i][y*16+z*4+2]+=f[i-1][j])%=P;
		if((y==2&&z==0)||(y==0&&z==2)||(x==0&&z==2)||(x==0&&y==2));
		else (f[i][y*16+z*4+3]+=f[i-1][j])%=P;
	}
	int ans=0;
	for(int i=0;i<64;i++)
		ans=(ans+f[n][i])%P;
	printf("%d",ans);
}
/*
A 0
T 1
G 2
C 3
AGC
GAC
ACG

A*GC
AG*C
*AGC
*GAC
*ACG
*/

Measured memory_bytes: 256
# 入力の受け取り
n = int(input())
s = input()

# 全種類用意しとく
alphabets_list = [c for c in "abcdefghijklmnopqrstuvwxyz"]

# 判定
result = []
for i in range(1, n):
    x = s[ :i]
    y = s[i: ]
    count = 0
    for alphabet in alphabets_list:
        if (alphabet in x) and (alphabet in y):
            count += 1
        else:
            count += 0
    result.append(count)

print(max(result))

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include<numeric>
#include<vector>
#include<iostream>
#include<map>
#include<math.h>

using namespace::std;

int main(void)
{

  int n;
  cin >> n;

  while( n-- )
    {
      vector<double> edge(3);
      
      for(int i = 0; i < 3; i++)
	{
	  cin >> edge[i];
	}

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

      string ans = "YES";

      if( !( pow( edge[0] , 2 ) + pow( edge[1] , 2 ) == pow( edge[2] , 2 ) ) )
	{
	  ans = "NO";
	}

      cout << ans << endl;

    }

  return 0;

}

Measured memory_bytes: 1252
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <bitset>
#define INF 0x3f3f3f3f
#define eps 1e-8
#define FI first
#define SE second
using namespace std;
typedef long long LL;
int dp[1 << 11][1 << 11];
int num[150];
char str[15];
int n, m;

int solve(int x, int y) {
    if(dp[x][y] != -1) return dp[x][y];
    int cnt = 0;
    for(int i = 0; i < n; ++i) cnt += (num[i] & x) == y;
    if(cnt <= 1) return dp[x][y] = 0;
    int &res = dp[x][y];
    res = INF;
    for(int i = 0; i < m; ++i) {
        if(x & (1 << i)) continue;
        res = min(res, 1 + max(solve(x | 1 << i, y), solve(x | 1 << i, y | 1 << i)));
    }
    return res;
}

int main() {
    while(scanf("%d%d", &m, &n)) {
        if(n + m == 0) break;
        for(int i = 0; i < n; ++i) {
            scanf("%s", str);
            num[i] = 0;
            for(int j = 0; j < m; ++j) num[i] = num[i] * 2 + str[j] - '0';
        }
        memset(dp, -1, sizeof(dp));
        printf("%d\n", solve(0, 0));
    }
    return 0;
}

Measured memory_bytes: 17584
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define _GLIBCXX_DEBUG
#define debug(x) cerr << #x << ": " << x << '\n';

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, i, cnt = 0;
  cin >> n;
  map<int, int> mp;
  for (i = 0; i < 2;) {
    mp[n] = 1;
    if (n % 2 == 0) {
      n /= 2;
    } else {
      n = 3 * n + 1;
    }
    cnt++;
    if (mp.count(n)) {
      break;
    }
  }
  cout << ++cnt << '\n';
}


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

char dat[16];

int hantei(char a,char b){
  char lc[]="({[";
  char rc[]=")}]";

  for (int i=0;i<3;i++){
    if (a==lc[i]&&b==rc[i])return 1;
    
    if (b==lc[i]&&a==rc[i])return 1;
    
  }
  return 0;
}

int search(int a,int b,int c,int islfix){
  int lm,rm;
  if (islfix){
    for (int i=b;i>c;i--){
      if (hantei(dat[i],dat[a])){
	lm=search(a+1,i-1,c,1);
	rm=search(a+1,i-1,c,0);
	return max(lm,rm)+2;
      }
    }
  }else{
    for (int i=a;i<c;i++){
      if (hantei(dat[i],dat[b])){
	lm=search(i+1,b-1,c,1);
	rm=search(i+1,b-1,c,0);
	return max(lm,rm)+2;
      }
    }
  }
  int reta=0,retb=0,flg=0;
  if (a<c-1){
    rm= search( a+1, b, c, 0);
    lm= search( a+1, b, c, 1);
    //cout << a << " " << b ;

    //cout << rm << " " << lm << endl;
    reta=max(rm,lm);
    flg=1;
  }
  if (b>c+1){
    rm= search( a, b-1, c, 0);
    lm= search( a, b-1, c, 1);
    //cout << a << " " << b ;
    // cout << rm << " " << lm << endl;
    retb=max(rm,lm);
    flg=1;
  }
  //cout << flg << " "<< reta << " " << retb << endl;
  if (flg)return max(reta,retb);
  else return 3;
}

int main(){
  int c,ret;
  cin >> dat;
  for (c=0;dat[c]!='w';c++);
  ret = max(search(0,strlen(dat)-1,c,0),search(0,strlen(dat)-1,c,1));
  cout << ret << endl;
  return 0;
}

Measured memory_bytes: 3080
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#include <random>
#include <time.h>
#include <iomanip>
#include <assert.h>
#include <numeric>
#define int long long
#define double long double
#define oku7 1000000007
#define MAXN (int)1e+5 * 2+1
#define LL_MAX 9223372036854775807	//ない環境用
#define LL_HALFMAX 9223372036854775807 / 2	//ない環境用

using namespace std;
std::mt19937 mt((int)time(0));

int dx[4] = { 0, 1, 0, -1 }; // x軸方向への変位
int dy[4] = { 1, 0, -1, 0 }; // y軸方向への変位

int x[101], y[101], h[101];

int a[100001], b[100001], sum[100001];
signed main() {
	int N,K;
	cin >> N >> K;
	for (int i = 1; i <= N; i++) {
		cin >> a[i];
	}

	int bTmp = 0, sumTmp = 0;
	for (int i = 1; i <= N; i++) {
		if(a[i]>=0) bTmp += a[i];
		sumTmp += a[i];
		b[i] = bTmp;
		sum[i] = sumTmp;
	}

	int maxScore = -1;

	for (int i = 1; i+K-1 <= N; i++) {
		//left
		//a[0] == 0 b[0] == 0 sum[0] == 0
		int left = b[i - 1];
		int cent = max(0LL, sum[i + K - 1] - sum[i - 1]);
		int right = b[N] - b[i + K - 1];

		int score = left + cent + right;
		maxScore = max(maxScore, score);
	}

	cout << maxScore << "\n";



	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

typedef pair<int, int> P;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

__attribute__((constructor))
void initial() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main() {
    int N;
    cin >> N;
    int maxLength = 0;
    int length = 0;

    rep(i, N) {
        int A;
        cin >> A;
        if (A) {
            length++;
        } else {
            length = 0; 
        }
        maxLength = max(maxLength, length);
    }
    cout << (maxLength + 1) << endl;
}



Measured memory_bytes: 3224
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>
#include<deque>

using namespace std;
typedef long long int ll;

#define C cout<<
#define E <<endl
#define CE cout<<endl

ll n,m,a,b,c,x,y,z,aa[200010],ab[200010],ac[1010][1010];
bool r,ra,rb,rc;
string s,sa,sb,sc;
char ca,cb,cc,cd[1010][1010];
vector<ll> va,vb,vc;

int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>aa[i];
        va.push_back(aa[i]);
    }

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

    for(int i=0;i<n;i++){
        //C va[n/2]<<va[n/2-1] E;
        if(aa[i]< va[n/2])b=va[n/2];
        if(aa[i]>=va[n/2])b=va[n/2-1];
        C b E;
    }
}


Measured memory_bytes: 5488
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;
typedef pair<int, int> P;

signed main(){
    string s;
    getline(cin, s);
    rep(i, 0, s.size()){
        if('a' <= s[i] && s[i] <= 'z'){
            s[i] = s[i] - 'a' + 'A';
        }
    }
    cout << s << endl;
}

Measured memory_bytes: 2972
import numpy as np
import sys
input = sys.stdin.buffer.readline

a, b, q = map(int,input().split())
ab = [[-1, -10**11], [-1, 10**11]]
aa = [-10**11, 10**11]
bb = [-10**11, 10**11]
for i in range(a):
    x = int(input())
    ab.append([0, x])
    aa.append(x)
    
for i in range(b):
    x = int(input())
    ab.append([1, x])
    bb.append(x)
ab = sorted(ab, key=lambda x:(x[1], x[0]))
aa.sort()
bb.sort()

ab_arr = np.array(ab)
ab_arr = ab_arr.T[1]

a_arr = np.array(aa)
b_arr = np.array(bb)

for cq in range(q):
    ans = 10**12
    s = int(input())
    ci = np.searchsorted(ab_arr, s)
    for cj in [ci, ci-1]:
        d = abs(ab_arr[cj] - s)
        flg = ab[cj][0]
        if flg:
            na = np.searchsorted(a_arr, ab_arr[cj])
            d2 = min(abs(a_arr[na] - ab_arr[cj]), abs(a_arr[na-1] - ab_arr[cj]))
            d += d2
        else:
            nb = np.searchsorted(b_arr, ab_arr[cj])
            d2 = min(abs(b_arr[nb] - ab_arr[cj]), abs(b_arr[nb-1] - ab_arr[cj]))
            d += d2
        ans = min(ans, d)
    print(ans)

Measured memory_bytes: 69508
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;

int main(){
    i64 n,ans=0;
    string s;
    cin>>n>>s;
    for(i64  i=0;i<1000;i++){
        i64 c[3]={i/100,(i/10)%10,i%10};
        int f=0;
        for(i64 j=0;j<n;j++){
            if(s[j]==('0'+c[f])) f++;
            if(f==3) break;
        }
        if(f==3) ans++;
    }
    cout<<ans<<endl;
    return 0;
}

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

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		long[] A = new long[N];
		long ans = 0;
		int count = 0;
		for (int i = 0; i < N; i++) {
			long num = in.nextLong();
			if (num < 0) {
				count++;
				num = num * -1;
			}
			A[i] = num;
			ans += A[i];
		}
		if (count % 2 != 0) {
			Arrays.sort(A);
			ans -= A[0] * 2;
		}
		System.out.println(ans);
		in.close();
	}
}

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

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
const ll mod = 1e9 + 7;
const ll INF = 10000000000;

int main() {
	cin.sync_with_stdio(false);
	int N;
	cin >> N;
	vector<ll>a(N), b(N);
	rep(i, N)cin >> a[i];
	rep(i, N)cin >> b[i];
	ll suma = 0, sumb = 0;
	rep(i, N) {
		int m = min(a[i], b[i]);
		a[i] -= m;
		b[i] -= m;
		suma += a[i];
		sumb += b[i] / 2;
	}
	if (sumb>=suma) {
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 384
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

int N, couL, couR;
std::string S;

int main()
{
	in >> N >> S;
	rep(i, S.length())
	{
		if (S[i] == '(') ++couL;
		else
		{
			--couL;
			couL = std::max(couL, 0);
		}
	}
	rep(i, S.length())
	{
		if (S[S.length() - i - 1] == ')') ++couR;
		else
		{
			--couR;
			couR = std::max(couR, 0);
		}
	}
	rep(i, couR) out << "(";
	out << S;
	rep(i, couL) out << ")";
	out << std::endl;
	return 0;
}


Measured memory_bytes: 256
import sys
import numpy as np
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, K = map(int, input().split())

MOD = 10 ** 9 + 7


# 階乗、Combinationコンビネーション(numpyを使う)
def cumprod(arr, MOD):
    L = len(arr)
    Lsq = int(L**.5+1)
    arr = np.resize(arr, Lsq**2).reshape(Lsq, Lsq)
    for n in range(1, Lsq):
        arr[:, n] *= arr[:, n-1]
        arr[:, n] %= MOD
    for n in range(1, Lsq):
        arr[n] *= arr[n-1, -1]
        arr[n] %= MOD
    return arr.ravel()[:L]


def make_fact(U, MOD):
    x = np.arange(U, dtype=np.int64)
    x[0] = 1
    fact = cumprod(x, MOD)
    x = np.arange(U, 0, -1, dtype=np.int64)
    x[0] = pow(int(fact[-1]), MOD-2, MOD)
    fact_inv = cumprod(x, MOD)[::-1]
    return fact, fact_inv


U = 10**4
fact, fact_inv = make_fact(U, MOD)
fact, fact_inv = fact.tolist(), fact_inv.tolist()


def mod_comb_k(n, k, mod):
    return fact[n] * fact_inv[k] % mod * fact_inv[n - k] % mod


ans = []
red = N - K

# i回操作する方法
for i in range(1, K + 1):
    #print("i=", i)
    res = 1

    # i分割するためには、i-1個ボールが必要
    if red < (i - 1):
        ans.append(str(0))
        continue

    # i分割する
    # i-1箇所に置く
    pat_split = 1
    pat_split *= mod_comb_k(K - 1, i - 1, MOD)

    #print("pat_split", pat_split)

    # 残りの玉を置く
    pat_rest = i - 1 + 2
    bal_rest = N - (i - 1) - K
    res *= mod_comb_k(pat_rest + bal_rest - 1, bal_rest, MOD)
    #print("res", res)
    res *= pat_split
    res %= MOD

    ans.append(str(res))

print("\n".join(ans))


Measured memory_bytes: 13288
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
struct po{double x, y;};

void saiki(po p1,po p2,int dep){
  if(dep==0) return;
  po s,t,u;
  s.x=(2*p1.x+p2.x)/3;
  s.y=(2*p1.y+p2.y)/3;
  t.x=(p1.x+2*p2.x)/3;
  t.y=(p1.y+2*p2.y)/3;
  u.x=(t.x-s.x)/2-(t.y-s.y)*(sqrt(3.0)/2)+s.x;
  u.y=(t.x-s.x)*(sqrt(3.0)/2)+(t.y-s.y)/2.0+s.y;

  saiki(p1,s,dep-1);
  printf("%.8f %.8f\n",s.x,s.y);
  saiki(s,u,dep-1);
  printf("%.8f %.8f\n",u.x,u.y);
  saiki(u,t,dep-1);
  printf("%.8f %.8f\n",t.x,t.y);
  saiki(t,p2,dep-1);
}

int main(){
  int n;
  cin>>n;
  po a,b;
  a.x=0,a.y=0;
  printf("%.8f %.8f\n",a.x,a.y);
  
  b.x=100,b.y=0;
  saiki(a,b,n);
  printf("%.8f %.8f\n",b.x,b.y);
  return 0;
}

Measured memory_bytes: 1200
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#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 pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

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


	int A, B;
	cin >> A >> B;

	rep1(i, 20000) {
		int a = i * 8 / 100;
		int b = i * 10 / 100;
		if (a == A && b == B) {
			co(i);
			return 0;
		}
	}

	co(-1);


	Would you please return 0;
}

Measured memory_bytes: 384
#include <boost/regex.hpp>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

int b, c1, c2, q1, q2;
ll com;

bool pred(int x)
{
	com = (b - c1 * x) / c2;
	
	if(com < 0 || q2 < x || b - c1 * x < 0) return false;
	
	return q1 <= x + com;
}

int main()
{
	while(cin >> q1 && q1)
	{
		cin >> b >> c1 >> c2 >> q2;
	
		ll lb = 0, ub = 10000000;
		
		rep(i, 100)
		{
			ll mid = (lb + ub) / 2;
			(pred(mid) ? lb : ub) = mid;
		}
		
		if(ub <= 1) cout << "NA" << endl;
		else cout << ub - 1 << " " << (com < 0 ? 0 : com) << endl;
	}
}

Measured memory_bytes: 0
using System;

namespace AOJ
{
    class Program
    {
        static void Main()
        {
            string[] str = (Console.ReadLine()).Split(' ');
            int a = int.Parse(str[0]);
            int b = int.Parse(str[1]);

            if (a < b)
                Console.WriteLine("a < b");
            else if(a > b)
                Console.WriteLine("a > b");
            else if(a == b)
                Console.WriteLine("a == b");
        }
    }
}

Measured memory_bytes: 8912
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
//#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int mod = 1e9 + 7;
const int N = (1 << 20);
const int K = 300000;
int a[N], b[N], t[N], n;
int sum (int r)
{
	int result = 0;
	for (; r >= 0; r = (r & (r+1)) - 1)
		result += t[r];
	return result;
}

void inc (int i, int delta)
{
	for (; i < N; i = (i | (i+1)))
		t[i] += delta;
}
int f(int x){
    for (int i = 1; i <= n; i++) if (a[i] <= x) b[i] = 1; else b[i] = 0;
    for (int i = 0; i < N; i++) t[i] = 0;
    inc(K, 1);
    int s = 0;
    int res = 0;
    int z = 0;
    for (int i = 1; i <= n; i++){
        s += b[i];
        res += sum(K + 2 * s - i - 1);
        inc(K + 2 * s - i, 1);
    }
 //   cout << x << " " << res << endl;
    return res;
}
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    cin >> n;
    for (int i = 1; i <= n; i++){
        cin >> a[i];
    }
    int l = 0;
    int r = 1e9;
    int k = n * (n + 1) / 2;
    while(r - l > 1){
        int mid = (r + l) / 2;
        if (f(mid) >= k / 2 + 1) r = mid; else l = mid;
    }
    cout << r;
}


Measured memory_bytes: 12672
import sys

input = sys.stdin.readline


def main():
    N, K = map(int, input().split())
    D = list(map(str, input().split()))

    for i in range(N, 10 ** 5):
        s = str(i)
        hated = False
        for d in D:
            if d in s:
                hated = True
        if not hated:
            ans = i
            break

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <tuple>

int ndeg(int n){
  if(n >= 100000) return 5;
  if(n >= 10000) return 4;
  if(n >= 1000) return 3;
  if(n >= 100) return 2;
  if(n >= 10) return 1;
  if(n >= 1) return 0;
}

int mul10(int n){
  int ans = 1;
  for(int i = 0; i < n; i++){
    ans *= 10;
  }
  return ans;
}

int main(){
  int N;
  std::cin >> N;
  long long int memo[10][10] = {};

  for(int i = 1; i <= N; i++){
    int nd = ndeg(i);
    int md = mul10(nd);
    int top = i/md;
    int bottom = i%10;
    memo[top][bottom]++;
  }

  long long int ans = 0;
  for(int top = 1; top < 10; top++){
    for(int bottom = 1; bottom < 10; bottom++){
      if(top == bottom){
        ans += memo[top][bottom]*(memo[top][bottom]-1);
        ans += memo[top][bottom];
      }else{
        ans += memo[top][bottom]*memo[bottom][top];
      }
    }
  }
  std::cout << ans << std::endl;

  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> //required
//#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long
#define lb long double
#define pb push_back
#define loop(i,start,n) for(ll i=start;i<n;i++)
#define rloop(i,n,start)for(ll i=n;i>=start;i--)
#define mod 1000000007
#define endl "\n"
#define INF     1e15
#define NEG_INF -1e15
#define pll pair<ll,ll>
#define x first
#define y second
#define all(x) x.begin(),x.end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
//using namespace __gnu_pbds;
//template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 


int main(){
	IOS;
	ll n;
	cin >> n;
	map<string, ll> mp;
	loop(i, 0, n){
		string temp;
		cin >> temp;
		mp[temp]++;
	}

	cout << "AC x " << mp["AC"] << endl;
	cout << "WA x " << mp["WA"] << endl;
	cout << "TLE x " << mp["TLE"] << endl;
	cout << "RE x " << mp["RE"] << endl;
}

Measured memory_bytes: 3664
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
#%%code
def resolve():
    N,x=pin()
    A=list(pin())

    temp=A[0]
    ans=0
    if temp>x:
        A[0]=x
        ans+=temp-x
    
    for ai in range(1,N):
        temp=A[ai]+A[ai-1]
        if temp>x:
            A[ai]=x-A[ai-1]
            ans+=temp-x
        temp-=A[ai-1]
    print(ans)
        
#%%submit!
resolve()

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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var points = new int[N];

            for (var i = 0; i < N; i++) points[i] = int.Parse(Console.ReadLine());

            var dp = new int[101, 10001];
            dp[0, 0] = 1;
            var ans = 0;

            for (var i = 0; i < N; i++)
            {
                for (var j = 0; j <= 10000; j++)
                {
                    dp[i + 1, j] |= dp[i, j];
                    if (j >= points[i])
                    {
                        if (dp[i, j-points[i]] > 0)
                        {
                            dp[i + 1, j] = 1;
                            if (j % 10 != 0) ans = Math.Max(ans, j);
                        }
                    }
                }
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 14816
#include<stdio.h>
#include<stdlib.h>
#define kai(a) (a)*(a)
int min(int a[],int n){
    int ret;
    ret=a[0];
    for(int i=1;i<n;i++){
        if(a[i]<=ret) ret=a[i];
    }
    return ret;
}
int max(int a[], int n){
    int ret=a[0];
    for(int i=1;i<n;i++){
        if(a[i]>=ret) ret=a[i];
    }
    return ret;
}

int main(){
    int n;
    int *a;
    int *sum;
    scanf("%d",&n);
    a=calloc(n,sizeof(int));
    sum=calloc(max(a,n)-min(a,n)+1,sizeof(int));
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    int j=0;
    for(int i=min(a,n);i<=max(a,n);i++){
        int ssum=0;
        for(int k=0;k<n;k++){
            ssum+=kai(a[k]-i);
        }
        sum[j++]=ssum;
    }


    printf("%d",min(sum,max(a,n)-min(a,n)+1));

    printf("\n");
    return 0;
}

Measured memory_bytes: 1708
<?php
$n=trim(fgets(STDIN));
$a=trim(fgets(STDIN));
$ans=(int)ceil($n/$a);
$r=$ans;
$b=trim(fgets(STDIN));
$ans+=(int)max(ceil(($n-($r-1)*$b)/$b),1);
$r=$ans;
$c=trim(fgets(STDIN));
$ans+=(int)max(ceil(($n-($r-2)*$c)/$c),1);
$r=$ans;
$d=trim(fgets(STDIN));
$ans+=(int)max(ceil(($n-($r-3)*$d)/$d),1);
$r=$ans;
$e=trim(fgets(STDIN));
$ans+=(int)max(ceil(($n-($r-4)*$e)/$e),1);

echo $ans;

Measured memory_bytes: 4604
#include <cstdio>
#include <cstring>
using namespace std;

int a[10];
int b[10];
int c[10];

int main() {
  int n, t;
  bool solved;
  scanf("%d", &n);
  for (int x=0; x<n; x++) {
    for (int i=0; i<10; i++) a[i] = 0;
    for (int i=0; i<10; i++) {
      for (int j=0; j<10; j++) {
        scanf("%d", &t);
        a[i] |= t<<j;
      }
    }

    solved = false;
    for (int i=0; i<(1<<10); i++) {
      memcpy(b, a, sizeof(a));
      b[0] ^= i;
      b[0] ^= i<<1;
      b[0] ^= i>>1;
      b[0] &= (1<<10)-1;
      b[1] ^= i;
      for (int j=1; j<10; j++) {
        b[j] ^= b[j-1];
        b[j] ^= b[j-1]<<1;
        b[j] ^= b[j-1]>>1;
        b[j] &= (1<<10)-1;
        if (j<9) {
          b[j+1] ^= b[j-1];
        }
      }
      if (!b[9]) {
        c[0] = i;
        for (int j=1; j<10; j++) {
          c[j] = b[j-1];
        }
        solved = true;
        break;
      }
    }

    if (solved) {
      for (int i=0; i<10; i++) {
        for (int j=0; j<10; j++) {
          if (j) putchar(' ');
          printf("%d", (c[i]>>j)&1);
        }
        putchar('\n');
      }
    }
  }

  return 0;
}

Measured memory_bytes: 1028
def c_lining_up(N, A):
    # Nが偶数なら、人数の差の絶対値のリストは[N-1,N-3,...,3,1,1,3,...,N-3,N-1]
    # Nが奇数なら、人数の差の絶対値のリストは[N-1,N-3,...,2,0,2,...,N-3,N-1]
    # でなければならない。このリストとAを共にソートして一致しなければ解は0。

    # 人数の差の絶対値のリストを昇順ソートしたリストを(わざと技巧的に)作る
    b = ([] if N % 2 == 0 else [0]) + [k for k in range(1 if N % 2 == 0 else 2, N, 2) for _ in range(2)]

    ans = 2**(N // 2) % (10**9 + 7) if sorted(A) == b else 0
    return ans

N = int(input())
A = [int(i) for i in input().split()]
print(c_lining_up(N, A))

Measured memory_bytes: 13880
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>
#include <random>


#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(20);

	int n; cin >> n;
	cout << (n + 1) / 2 << endl;

	return 0;
}

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

struct edge {
	int f, t, c;
	//from,to,cost
};

vector<vector<int>> G(2501);
vector<edge> E;
vector<bool> BB(5010, false), BBB = BB, BI = BB;
vector<int> Ar(2501, INT32_MAX);

int main() {
	int N, M, P, a, b, c;
	cin >> N >> M >> P;
	for (int i = 0;i < M;i++) {
		cin >> a >> b >> c;
		a--;b--;
		G[a].push_back(i);
		E.push_back({ a,b,P - c });
		if (a == 0)BB[i] = true;
	}
	Ar[0] = 0;

	5;
	7;
	5;

	for (int i = 0;i < N;i++) {
		for (int j = 0;j < M;j++) {
			if (BB[j]) {
				if (Ar[E[j].t] > Ar[E[j].f] + E[j].c) {
					Ar[E[j].t] = Ar[E[j].f] + E[j].c;
					for (auto f : G[E[j].t]) {
						BBB[f] = true;
					}
				}
			}
		}
		BB = BBB;
		BBB = BI;
	}

	for (int i = 0;i < N;i++) {
		for (int j = 0;j < M;j++) {
			if (BB[j]) {
				Ar[E[j].t] = INT32_MIN;
				for (auto f : G[E[j].t]) {
					BBB[f] = true;
				}
			}
		}
		BB = BBB;
		BBB = BI;
	}

	if (Ar[N - 1] == INT32_MIN)
		cout << -1 << endl;
	else
		cout << max(0, -Ar[N - 1]) << endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lowbit(a) ((a) & -(a))
#define clean(a, b) memset(a, b, sizeof(a))
const int mod = 998244353;
const int inf = 0x3f3f3f3f;
const int maxn = 2e5 + 9;
typedef pair<int,int>P;

int _;

//========================================================================

//========================================================================
int main()
{
    char s[10];
    scanf("%s",s);
    int len=0,ans=0;
    if(s[0]=='R'&&s[1]=='R'&&s[2]=='R') ans=3;
    else if(s[0]=='S'&&s[1]=='S'&&s[2]=='S') ans=0;
    else if(s[0]=='R'&&s[1]=='R'&&s[2]=='S') ans=2;
    else if(s[0]=='S'&&s[1]=='R'&&s[2]=='R') ans=2;
    else ans=1;
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 3764
#include<bits/stdc++.h>
using namespace std;
using lli = long long;
#define rep(i,n) for(int i=0;i<n;i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

string s;

int main(void){
	cin >> s;
	while(1){
		lli n = s.size();
		if(n == 0) break;
		lli e = -1;
		if(n >= 7 && s.substr(n-7) == "dreamer") e = 7;
		if(n >= 6 && s.substr(n-6) == "eraser") e = 6;
		if(n >= 5 && (s.substr(n-5) == "dream" || s.substr(n-5) == "erase")) e = 5;

		if(e == -1){
			cout << "NO" << endl;
			return 0;
		}else{
			s.erase(n-e);
		}
	}
	cout << "YES" << endl;
	return 0;
}


Measured memory_bytes: 3772