akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<ll,ll>;
using PP=pair<ll,P>;
using vp=vector<P>;
using vpp=vector<PP>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
template<typename A,typename B>istream&operator>>(istream&is,pair<A,B> &p){is>>p.fi>>p.se;return is;}
template<typename A,typename B>ostream&operator<<(ostream&os,const pair<A,B> &p){os<<"("<<p.fi<<","<<p.se<<")";return os;}
template<typename T>istream&operator>>(istream&is,vector<T> &t){REP(i,t.size())is>>t[i];return is;}
template<typename T>ostream&operator<<(ostream&os,const vector<T>&t){os<<"{";REP(i,t.size()){if(i)os<<",";os<<t[i];}cout<<"}";return os;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
template<int mod>
struct ModInt{
    int x;
    ModInt():x(0){}
    ModInt(long long y):x(y>=0?y%mod:(mod-(-y)%mod)%mod){}
    ModInt &operator+=(const ModInt &p){
        if((x+=p.x)>=mod)x-=mod;
        return *this;
    }
    ModInt &operator-=(const ModInt &p){
        if((x+=mod-p.x)>=mod)x-=mod;
        return *this;
    }
    ModInt &operator*=(const ModInt &p){
        x=(int)(1LL*x*p.x%mod);
        return *this;
    }
    ModInt &operator/=(const ModInt &p){
        *this*=p.inverse();
        return *this;
    }
    ModInt operator-()const{return ModInt(-x);}
    ModInt operator+(const ModInt &p)const{return ModInt(*this)+=p;}
    ModInt operator-(const ModInt &p)const{return ModInt(*this)-=p;}
    ModInt operator*(const ModInt &p)const{return ModInt(*this)*=p;}
    ModInt operator/(const ModInt &p)const{return ModInt(*this)/=p;}
    bool operator==(const ModInt &p)const{return x==p.x;}
    bool operator!=(const ModInt &p)const{return x!=p.x;}
    ModInt inverse()const{
        int a=x,b=mod,u=1,v=0,t;
        while(b>0){
            t=a/b;
            a-=t*b;
            swap(a,b);
            u-=t*v;
            swap(u,v);
        }
        return ModInt(u);
    }
    friend ostream &operator<<(ostream &os,const ModInt<mod> &p){
        return os<<p.x;
    }
    friend istream &operator>>(istream &is,ModInt<mod> &a){
        long long x;
        is>>x;
        a=ModInt<mod>(x);
        return (is);
    }
};

const int mod=1e9+7;
using mint=ModInt<mod>;
int main(){
    int n;
    cin>>n;
    vi vec(n);
    cin>>vec;
    map<int,int> ma;
    vector<mint> dp(n+1);
    dp[0]=1;
    REP(i,n){
        dp[i+1]=dp[i];
        if(ma.count(vec[i])&&ma[vec[i]]!=i){
            dp[i+1]+=dp[ma[vec[i]]];
        }
        ma[vec[i]]=i+1;
    }
    cout<<dp[n]<<endl;
    return 0;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp>
//#include <functional> // for less
#define PI acos(-1.0)
#define eps 1e-9
#define ll long long
#define ull unsigned long long
#define nl printf("\n")
#define sf scanf
#define pf printf
#define INF (ll)1e15
#define mod 1000000007

///#define isValid(n,m,nx,ny)nx>=0&&nx<n&&ny>=0&&ny<m
///int kx[]={1, 1, -1, -1, 2, 2, -2, -2}; //knight moves
///int ky[]={2,-2,  2, -2, 1,-1,  1, -1}; //knight moves
///int dx[]={1,-1,0,0,1,-1,1,-1};//eight direction
///int dy[]={0,0,1,-1,1,-1,-1,1};//eight direction
 
///using namespace __gnu_pbds;
using namespace std;
 
///inline double toRad(double deg){return deg*PI/180;}
///inline double toDeg(double rad){return rad*180/PI;}
///typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set;
 
const int S=123456;
int main()
{
    #ifndef ONLINE_JUDGE
    //freopen("input.txt","r",stdin);
    #endif
    int n,t;
    while(sf("%d %d",&n,&t)==2)
    {
        int ara[n+5];
        for(int i=0;i<n;i++)
        {
            sf("%d",&ara[i]);
        }

        ll ans=0,cur=0,pre=0;
        for(int i=1;i<n;i++)
        {
            if(ara[i-1]+t>=ara[i])
            {
                cur=ara[i];
            }
            else
            {
                cur+=t;
                ans+=cur-pre;
                pre=ara[i];
                cur=ara[i];
            }
        }
        cur+=t;
        ans+=cur-pre;
        pf("%lld\n",ans);
    }
    return 0;
}
 









 




























Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main()
{
        int a[3][3];
        for(int i=0;i<3;i++){
                for(int j=0;j<3;j++) cin>>a[i][j];
        }
        bool f=false;
        for(int a1=0;a1<=a[0][0];a1++){
                int b1=a[0][0]-a1;
                for(int a2=0;a2<=a[1][1];a2++){
                        int b2=a[1][1]-a2;
                        for(int a3=0;a3<=a[2][2];a3++){
                                int b3=a[2][2]-a3;
                                int a21=a2+b1,a31=a3+b1,a12=a1+b2,a32=a3+b2,a13=a1+b3,a23=a2+b3;
                                if(a21==a[1][0]&&a31==a[2][0]&&a12==a[0][1]&&a32==a[2][1]&&a13==a[0][2]&&a23==a[1][2]) f=true;
                        }
                }
        }
        cout<<(f?"Yes":"No")<<endl;
        return 0;
}

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

using ll = long long;
#define ld long double
#define ull unsigned long long int

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  // (i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define ret return

typedef pair<int, int>    pii;
typedef vector<int>       vi;
typedef vector<vi>        vii;
typedef vector<long long> vl;

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

//入力
#include <stdio.h>
#include <algorithm>
#include <vector>

    int n;
    cin >> n;
    vector<int> v;
    for (int i = 0; i < n; i++) {
        int z;
        cin >> z;
        z--;
        v.push_back(z);
    }
    int now = 0, c = 0;
    while (true) {
        if (now == 1) {
            cout << c << endl;
            break;
        }
        if (c >= n) {
            cout << -1 << endl;
            break;
        }
        c++;
        now = v[now];
    }

    // 処理
    // 出力

    return 0;
}


Measured memory_bytes: 892
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      int num=sc.nextInt();
      String a=sc.next();
      String b=sc.next();
      String c=sc.next();
      int count=0;
      
      String[] strArrayA = new String[a.length()];
      String[] strArrayB = new String[b.length()];
      String[] strArrayC = new String[c.length()];
 
// 変数strの長さ分回す
	for (int i = 0; i < num; i++) {
    // strの先頭から1文字ずつString型にして取り出す
      String str1 = String.valueOf(a.charAt(i));
      String str2 = String.valueOf(b.charAt(i));
      String str3 = String.valueOf(c.charAt(i));
    // 配列に順番に格納する
      strArrayA[i]=str1;
      strArrayB[i]=str2;
      strArrayC[i]=str3;
    }
      
      for(int i=0;i<num;i++){
       if(strArrayA[i].equals(strArrayB[i])&&strArrayA[i].equals(strArrayC[i])&&strArrayB[i].equals(strArrayC[i])){
         
       }else if(strArrayA[i].equals(strArrayB[i])){
         count++;
       }else if(strArrayA[i].equals(strArrayC[i])){
         count++;
       }else if(strArrayB[i].equals(strArrayC[i])){
         count++;
       }else{
        count+=2; 
       }
      }
      
      System.out.println(count+"");
		
	}
}

Measured memory_bytes: 23892
from collections import deque

def main():
    K = int(input())
    que = deque([i for i in range(1, 10)])

    while K:
        if K == 1:
            ans = que.popleft()
            break
        K -= 1
        v = que.popleft()
        for i in range(-1, 2, 1):
            a = v % 10 + i
            if a < 0 or a > 9:
                continue
            que.append(v * 10 + a)
            
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 12404
from itertools import accumulate
A = [a for a in range(1,41)]
A = list(accumulate(A))

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(n**0.5//1)+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

N = int(input())
n = factorization(N)
cnt = 0
if N == 1:
    print(0)
else:
    for x in n:
        i = 0
        while x[1] >= A[i]:
            cnt += 1
            i += 1
    print(cnt)

Measured memory_bytes: 63640
using System; 
using System.Text;
using System.Collections.Generic; 
using System.Linq; 
using E = System.Linq.Enumerable; 


class Program {
    static void Main(string[] args) {
        //入力を受け取る
        var N = int.Parse(Console.ReadLine());
        var tmp = Console.ReadLine().ToCharArray();
        Array.Sort(tmp);
        var X = new String(tmp);
        for(int i = 1;i < N; i++){
            var S = Console.ReadLine().ToCharArray();
            Array.Sort(S);
            var Y = new String(S);
            X = ReturnCommonPart(X,Y);
        }
        Console.WriteLine(X);
     }
     
     static string ReturnCommonPart(string X,string Y){
         var res = "";
         var XP = 0;
         var YP = 0;
         while(XP < X.Length && YP < Y.Length){
             
             if(X[XP] == Y[YP]){
                 res = res+X[XP];
                 XP++;
                 YP++;
             }else{
                 if(X[XP] < Y[YP]){
                     var org = XP;
                     
                     while(XP < X.Length && X[XP] == X[org]){
                         XP++;
                         
                     }
                     
                     
                 }else{
                     var org = YP;
                     while(YP < Y.Length && Y[YP] == Y[org]){
                         YP++;
                     }
                 }
                 
             }
         }
         return res;
     }
}
     
     
                   


Measured memory_bytes: 11348
//##MohK
#include <bits/stdc++.h>
using namespace std ;
int main()
{
    long long x=0,y=0,z=0,n=0;
    long long a;
    cin>>a;
    char b[a];
    for(int i=0;i<a;i++){
        cin>>b[i];
        if(b[i]=='G')x++;
        if(b[i]=='W')y++;
        if(b[i]=='P')z++;
        if(b[i]=='Y')n++;
    }
    if(x==0||y==0||z==0||n==0)cout<<"Three";
    else cout<<"Four";

    return 0 ;
}


Measured memory_bytes: 256
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#define int long long
#define boost() ios_base :: sync_with_stdio(0); cin.tie(); cout.tie(); cout << fixed; cout << setprecision(15); srand(time(NULL))
#define all(x) x.begin(), x.end()
using namespace std;

string s;

signed main () {
  cin >> s;
  int res = 0;
  for (int i = 0; i < s.size(); i++) {
    res += (s[i] == '2');
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
import itertools

N,M,Q = list(map(int, input().split()))
numbers = [list(map(int,input().split())) for l in range(Q)]

#print(numbers)


suuretus = itertools.combinations_with_replacement(range(1, M+1), N)

ans = 0
for suuretu in suuretus:
    tmp = 0

    if len(suuretu) == N:
#        print(suuretu)
        for number in numbers:
            if suuretu[number[1]-1] - suuretu[number[0]-1] == number[2]:
                tmp += number[3]
        
    ans = max(ans, tmp)
#    print(ans)

print(ans)

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

using ll=long long;
using namespace std;

#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vll(v) sort((v).begin(), (v).end(), greater<long long>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

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

const int IINF=(1<<30);
const ll LLINF = 1LL<<60;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    int n, m, l;
    cin >> n >> m >> l;
    vector<vector<ll>> A(n, vector<ll>(m));
    vector<vector<ll>> B(m, vector<ll>(l));
    vector<vector<ll>> C(n, vector<ll>(l));
    for (int i = 0; i < n; i++){
        for (int a = 0; a < m; a++){
            cin >> A[i][a];
        }
    }
    
    for (int i = 0; i < m; i++){
        for (int a = 0; a < l; a++){
            cin >> B[i][a];
        }
    }

    for (int i = 0; i < n; i++){
        for (int a = 0; a < l; a++){
            for (int b = 0; b < m; b++){
                C[i][a] += A[i][b]*B[b][a];
            }
        }
    }

    for (int i = 0; i < n; i++){
        for (int a = 0; a < l; a++){
            cout << C[i][a];
            if(a != l - 1)cout << " ";
        }
        cout << endl;
    }
    

    // 3 2 3
    // C[0][0] = A[0][0]*B[0][0] + A[0][1]*B[1][0]
    // C[0][1] = A[0][0]*B[0][1] + A[0][1]*B[1][1]
    // C[0][2] = A[0][0]*B[0][2] + A[0][1]*B[1][2]

    // C[1][0] = A[1][0]*B[0][0] + A[1][1]*B[1][0]
    // C[1][1] = A[1][0]*B[0][1] + A[1][1]*B[1][1]
    // C[1][2] = A[1][0]*B[0][2] + A[1][1]*B[1][2]

    // C[2][0] = A[2][0]*B[0][0] + A[2][1]*B[1][0]
    // C[2][1] = A[2][0]*B[0][1] + A[2][1]*B[1][1]
    // C[2][2] = A[2][0]*B[0][2] + A[2][1]*B[1][2]
}


Measured memory_bytes: 3260
n=int(input())
arr=list(map(int,input().split()))
cnt=[0]*13
cnt[0]=1
ans=0
for val in arr:
  cnt[val]+=1
flag=True
for i in range(13):
  if i==0 or i==12:
    if cnt[0]>=2:
      flag=False
      break
  else:
    if cnt[i]>=3:
      flag=False
      break
if flag==False:
  print(0)
else:
  ans=0
  base=[0]*24
  base[0]=1
  if cnt[12]!=0:
    base[12]=1
  for i in range(2**11):
    pos=base[:]
    bit=format(i,'b')
    if len(bit)!=11:
      bit='0'*(11-len(bit))+bit
    for j in range(1,12):
      if cnt[j]==0:
        continue
      elif cnt[j]==2:
        pos[j]=1
        pos[24-j]=1
      else:
        if bit[j-1]=='0':
          pos[j]=1
        else:
          pos[24-j]=1
    tmp=10**10
    for j in range(24):
      if pos[j]==0:
        continue
      for k in range(1,24):
        if pos[(j+k)%24]==1:
          tmp=min(tmp,k)
          break
    ans=max(ans,tmp)
  print(ans)

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

using namespace std;

int solve(int n, const std::vector<int>& ds) {
  std::bitset<10> bits;
  for (auto const d : ds) {
    bits.set(d);
  }
  int ret = n;
  for (;; ret++) {
    int r = ret;
    bool deny = false;
    while (r) {
      if (bits.test(r % 10)) {
        deny = true;
        break;
      }
      r /= 10;
    }
    if (!deny) {
      break;
    }
  }
  return ret;
}

int main() {
  int n, k;
  std::cin >> n >> k;
  std::vector<int> ds(k);
  for (auto& d : ds) {
    std::cin >> d;
  }
  std::cout << solve(n, ds) << std::endl;
  return 0;
}

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

int main() {
	// your code goes here
	int n;
	cin>>n;
	double arr[n];
	memset(arr, 0, sizeof(arr));
	for(int i=0;i<n;i++)
		cin>>arr[i];
	vector<vector<double>>dp(n+1, vector<double>(n+1, 0));
	dp[0][0]=1; // Crucial to remember
	for(int i=1;i<=n;i++)
		dp[0][i]=0;
		
	for(int i=1;i<=n;i++) {
		for(int j=0;j<=i;j++) {
			if(j == 0)
				dp[i][j]=dp[i-1][j]*(1-arr[i-1]);
			else
				dp[i][j]=dp[i-1][j]*(1-arr[i-1])+dp[i-1][j-1]*arr[i-1];
		}
	}	
	double sum=0;
	for(int i=(n+1)/2;i<=n;i++)
		sum+=dp[n][i];
		
	cout<<setprecision(10)<<sum<<endl;	

}

Measured memory_bytes: 72704
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;

typedef long long Int;
typedef pair<Int,Int> P;
#define print(x) cout<<(x)<<endl

#define INF10 10000000000
#define INF5 100000
#define EPS 1e-10
#define MOD 1000000007



int main() {
	int n, a, b;
	cin >> n >> a >> b;
	cout << min(a, b) << " " << max(a + b - n, 0) << endl;




	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<n; ++i)
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 100100100;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;



int main(){
    int n; cin>>n;
    vector<int> p(n); rep(i,n)cin>>p[i];
    vector<int> q(n); rep(i,n)cin>>q[i];

    vector<int> perm(n); rep(i,n)perm[i] = i+1;

    int count = 0;
    int p_p, p_q;
    do{
        if(p == perm)p_p = count;
        if(q == perm)p_q = count;
        count++;
    }while(next_permutation(perm.begin(),perm.end()));

    cout<<abs(p_p-p_q)<<endl; return 0;
}


Measured memory_bytes: 256
#include <float.h>
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <math.h>

#define P 1000000007

int comp(const void *a, const void *b){return *(int*)a-*(int*)b;}
int compw(const void *a, const void *b){return (*(int*)a>*(int*)b)-(*(int*)a<*(int*)b);}
int compr(const void *a, const void *b){return *(int*)b-*(int*)a;}

uint32_t nextpint(void){ char c=getchar(); while(c<'0'||'9'<c) c=getchar(); uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return x; }
uint32_t nextstr(char *s){ char c=getchar(); while(c==' '||c=='\n') c=getchar(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar(); } *s='\0'; return len; }

inline int max2(const int a, const int b){return a>b?a:b;}
inline int min2(const int a, const int b){return a>b?b:a;}
inline int dif2(const int a, const int b){return a>b?a-b:b-a;}

int main(void){
	int k=nextpint();
	int n=nextpint();
	int a, b;
	int ans=0;
	int f=b=nextpint();
	for(int i=1; i<n; i++){
		a=nextpint();
		int now=a-b;
		if(now>ans) ans=now;
		b=a;
	}
	int now=k+f-b;
	if(now>ans) ans=now;
	printf("%d\n", k-ans);
}


Measured memory_bytes: 128
/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
        Comilla  University

*/
#include<bits/stdc++.h>
#define pi 2*acos(0.0)
#define ll long long
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node
#define spc " "
#define  E  2.71828182845904523536
#define pb push_back
#define pp pop_back
#define valid(nx,ny) nx>=0 && nx<n && ny>=0 && ny<m
#define ee endl
#define pii pair<int,int>
#define infinity 10000000000000000
#define mod 1000000007
int fx[]={0,0,+1,-1};
int fy[]={+1,-1,0,0};

using namespace std;
///check n=1;
///check corner case;
const int maX=1e5+1;
vector<ll>Graph[maX],cost[maX];
ll visit[maX];
ll x[10];
ll y[10];
double dist(ll i, ll j)
{
    double dx=x[i]-x[j];
    double dy=y[i]-y[j];
    return pow(dx*dx+dy*dy,0.5);
}

int main()
{
   ll n,i,j,cc=0;
   cin>>n;
   ll ara[n];
   for(i=0;i<n;i++)cin>>ara[i];
   vector<ll>q;
   for(i=0;i<n;i++){
    for(j=i+1;j<n;j++){
        q.pb(ara[i]*ara[j]);
    }
   }
   cc=accumulate(q.begin(),q.end(),cc);
   cout<<cc<<endl;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define print(x) cout << x << endl;
using namespace std;
typedef long long ll;

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

    vector<vector<double>> X(N, vector<double>(D, 0));
    rep(i, N) {
        rep(j, D) {
            cin >> X.at(i).at(j);
        }
    }

    int ans = 0;


    double dist = 0.0;
    for (int i = 0; i < N-1; i++) {
        for (int j = i + 1; j < N; j++) {
            for (int k = 0; k < D; k++) {
                dist += pow(X.at(i).at(k) - X.at(j).at(k), 2.0);
            }
            dist = pow(dist, 0.5);
            double d;
            double _ = modf(dist, &d);
            if (dist == d) ans++;
            dist = 0.0;
        }
    }

    cout << ans << endl;


    return 0;
}

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

typedef long long lli;
typedef vector<int> Vi;
typedef vector<lli> Vl;
typedef pair<int, int> Pii;
typedef pair<lli, lli> Pll;


//===

template<class Abel> struct UnionFind {
	vector<int> par;
	vector<int> rank;
	vector<Abel> diff_weight;

	UnionFind(int n = 1, Abel SUM_UNITY = 0) {
		init(n, SUM_UNITY);
	}

	void init(int n = 1, Abel SUM_UNITY = 0) {
		par.resize(n); rank.resize(n); diff_weight.resize(n);
		for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0, diff_weight[i] = SUM_UNITY;
	}

	int root(int x) {
		if (par[x] == x) {
			return x;
		}
		else {
			int r = root(par[x]);
			diff_weight[x] += diff_weight[par[x]];
			return par[x] = r;
		}
	}

	Abel weight(int x) {
		root(x);
		return diff_weight[x];
	}

	bool issame(int x, int y) {
		return root(x) == root(y);
	}

	bool merge(int x, int y, Abel w) {
		w += weight(x); w -= weight(y);
		x = root(x); y = root(y);
		if (x == y) return false;
		if (rank[x] < rank[y]) swap(x, y), w = -w;
		if (rank[x] == rank[y]) ++rank[x];
		par[y] = x;
		diff_weight[y] = w;
		return true;
	}

	Abel diff(int x, int y) {
		return weight(y) - weight(x);
	}
};




int main()
{
	int N;
	cin >> N;
	UnionFind<lli> uf(N);
	for (int i = 0; i < N-1; ++i) {
		int u, v, w;
		cin >> u >> v >> w;
		uf.merge(u-1, v-1, w);
	}

	Vi colors(N);
	colors[0] = 0;
	for (int i = 1; i < N; ++i) {
		if (uf.diff(0, i) % 2 == 0) {
			colors[i] = 0;
		}
		else {
			colors[i] = 1;
		}
	}

	for (const auto& v : colors) {
		cout << v << endl;
	}
}

Measured memory_bytes: 2432
//by kcz 1552920354@qq.com
//if you find any bug in my code
//please tell me
#include<bits/stdc++.h>
using namespace std;

template <typename T> void chmin(T &x,const T &y)
{
	if(x>y)x=y;
}
template <typename T> void chmax(T &x,const T &y)
{
	if(x<y)x=y;
}
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,l,r) for(int i=l;i<=r;++i)
#define per(i,r,l) for(int i=r;i>=l;--i)
#define pb push_back
#define mp make_pair
#define gc (c=getchar())
char readc()
{
	char c;
	while(gc<'-');
	return c;
}
int read()
{
    char c;
    while(gc<'-');
    if(c=='-')
    {
        int x=gc-'0';
        while(gc>='0')x=x*10+c-'0';
        return -x;
    }
    int x=c-'0';
    while(gc>='0')x=x*10+c-'0';
    return x;
}
#undef gc

const int N=100+5;
char s[N][N];

int main()
{
	//freopen("1.in","r",stdin);//freopen("1.out","w",stdout);
	rep(i,1,50)
	rep(j,1,100)s[i][j]='.';
	rep(i,51,100)
	rep(j,1,100)s[i][j]='#';
	int a,b;
	cin>>a>>b;
	--a;--b;
	for(int i=2;i<50;i+=2)
	for(int j=2;j<100;j+=2)
	if(--b>=0)s[i][j]='#';
	for(int i=52;i<=100;i+=2)
	for(int j=2;j<100;j+=2)
	if(--a>=0)s[i][j]='.';
	printf("%d %d\n",100,100);
	rep(i,1,100)printf("%s\n",s[i]+1);
}



Measured memory_bytes: 384
import scala.io.StdIn
import scala.math._

object Main {

  def main(args: Array[String]): Unit = {
    val n = StdIn.readLine.toInt
    val hs = StdIn.readLine.split(" ").map(_.toInt)

    val rec = new Array[Int](n)
    rec(0) = 0
    rec(1) = abs(hs(1) - hs(0))
    for (i <- 2 until n) {
      rec(i) = min(rec(i - 1) + abs(hs(i) - hs(i - 1)), rec(i - 2) + abs(hs(i) - hs(i - 2)))
    }

    println(rec(n - 1))

  }
}

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

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
const int W = 0, B = 1;
vector<vector<pair<int, int>>>adj;
int n;
void dijkstra() {
	priority_queue<pair<int, int>>pq;
	vector<int>color(n, W), d(n, INF);
	d[0] = 0;
	pq.push(make_pair(0, 0));

	while (!pq.empty()) {
		pair<int, int>f(pq.top()); pq.pop();// d[v], v
		color[f.second] = B;

		if (d[f.second] < (-1)*f.first)continue;
		
		rep(i, 0, adj[f.second].size()) {
			pair<int, int>v(adj[f.second][i]);
			if (color[v.first] != B&&d[f.second] + v.second < d[v.first]) {
				d[v.first] = d[f.second] + v.second;
				pq.push(make_pair(d[v.first] * (-1),v.first));
			}
		}
	}
	rep(i, 0, n) {
		cout << i << " " << d[i] << endl;
	}
}
signed main() {
	cin >> n; adj = vector<vector<pair<int, int>>>(n, vector<pair<int, int>>());
	rep(i, 0, n) {
		int u, k; cin >> u >> k;
		rep(j, 0, k) {
			int v, c; cin >> v >> c;
			adj[u].push_back(make_pair(v, c));

		}
	}
	dijkstra();
	return 0;
}

Measured memory_bytes: 7852
#include<iostream>
#include<stdio.h>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
    long long n,a=1,b;
    cin>>n;
    for(int i=1;i<=sqrt(n);i++){
        b=n/i;
        if(b*i==n&&a<i){
            a=i;
        }
    }
    b=n/a;
    int c=0;
    while(b!=0){
        c++;
        b=b/10;
    }
    cout<<c<<endl;
    return 0;
}


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

#define ll              long long int
#define ull             unsigned long long int
#define pii             pair < int, int>
#define pll             pair < ll, ll>
#define sc              scanf
#define scin(x)         sc("%d",&(x))
#define scln(x)         sc("%lld",&(x))
#define pf              printf
#define NL              pf("\n")
#define ms(a,b)         memset(a,b,sizeof(a))
#define pb(a)           push_back(a)
#define mp              make_pair
#define db              double
#define EPS             10E-10
#define ff              first
#define ss              second
#define sqr(x)          (x)*(x)
#define vi              vector< int >
#define vl              vector< ll >
#define vii             vector<vector< int > >
#define vll             vector<vector< ll > >
#define DBG             pf("HI\n")
#define MOD             1000000007
#define CIN             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define RUN_CASE(t,T)   for(__typeof(t) t=1;t<=T;t++)
#define CASE(t)         printf("Case %d: ",t)
#define CASEL(t)        printf("Case %d:\n",t)
#define intlimit        2147483648
#define longlimit       9223372036854775808
#define infinity        (1<<28)
#define gcd(a, b)       __gcd(a,b)
#define lcm(a, b)       (((a)/gcd(a,b))*b)
#define mx              1234567899
#define TC              int t;scin(t);while(t--)
#define PI              2*acos(0.0)
#define rep(i,a,b)      for( i=a; i<=b; i++)
#define rev(i,a,b)      for( i=a; i>=b; i--)
#define file            freopen("E:\\file.txt", "r", stdin);ios_base::sync_with_stdio(false); cin.tie(NULL);
#define all(x)          x.begin(),x.end()
#define DEBUG(args...)    do {   cerr << #args << ' ' ;  print(args); } while(0); cerr<< endl ;
using namespace std;
int get(int n,int p){int res = 0;while(n>=p) res+=n/p,n/=p;return res;}
template<class T> T power(T N,T P){ return (P==0)?  1: N*power(N,P-1); }
void VC(vector<ll> &v){for(int i=0;i<v.size();i++) printf("%lld ", v[i]);printf("\n");}

template< typename T > void print(const T& v) {    cerr << v << ' ' ;}
template< typename T1, typename... T2 >
void print( const T1& first, const T2&... rest ){
    print(first);
    print(rest...) ;
}
///--------------Graph Moves--------------------------------------
///const int fx[] = {+1,-1,+0,+0};
///const int fy[] = {+0,+0,+1,-1};
///const int fx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's move
///const int fy[] = {-1,+1,+0,+0,+1,+1,-1,-1}; ///king's Move
///const int fx[] = {-2,-2,-1,-1,+1,+1,+2,+2}; ///knight's move
///const int fy[] = {-1,+1,-2,+2,-2,+2,-1,+1}; ///knight's move
///---------------------------------------------------------------

long long BigMod(long long int a, long long int b, int M) { long long remainder, answer = 1;remainder = a%M; while(b!=0){if(b%2==1) answer = (answer*remainder)%M;remainder = (remainder*remainder)%M;b/=2;}return answer;}
bool cmp(int a,int b)
{
    return a>b;
}
int main()
{
    CIN;
    ll n, cost = 0;
    cin >> n;
    ll a[n+3];

    for(int i=1;i<=n-1;i++) cin >> a[i];
    for(int i=1;i<n-1;i++)
    {
        cost+=min(a[i],a[i+1]);
    }
    cost+=a[1]+a[n-1];

    cout << cost  << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <map>
#include <utility>
#include <set>

using namespace std;

int root(vector<int> &par, int x) {
  if (par[x] == x) {
    return x;
  }
  else {
    return par[x] = root(par, par[x]);
  }
}

bool same(vector<int> &par, int x, int y) {
  return root(par, x) == root(par, y);
}

void unite(vector<int> &par, int x, int y) {
  int rootx = root(par, x);
  int rooty = root(par, y);

  if (rootx == rooty) {
    return;
  }
  else {
    par[rootx] = rooty;
  }
}

int main() {

  int n, m;
  cin >> n >> m;

  int tmp, tmp0, tmp1;

  vector<int> num(n, 0);
  for (int i = 0; i < n; i++) {
    cin >> tmp;
    num[i] = tmp - 1;
  }

  vector<int> par(n, 0);
  for (int i = 0; i < n; i++) {
    par[i] = i;
  }

  vector<vector<int>> edge(m, vector<int>(2, 0));
  for (int i = 0; i < m; i++) {
    cin >> tmp0 >> tmp1;
    unite(par, tmp0 - 1, tmp1 - 1);
  }

  int ans = 0;

  for (int i = 0; i < n; i++) {
    if (same(par, i, num[i])) {
      ans ++;
    }
  }

  cout << ans << endl;

  return 0;
}


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

int mod3(int x) {
    return (x % 3 + 3) % 3;
}

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

    string S, T;
    cin >> S >> T;
    int N = S.size(), M = T.size();

    vector<int> S_prefix(N + 1, 0), T_prefix(M + 1, 0);

    for (int i = 0; i < N; i++)
        S_prefix[i + 1] = mod3(S_prefix[i] + (S[i] == 'A' ? +1 : -1));

    for (int i = 0; i < M; i++)
        T_prefix[i + 1] = mod3(T_prefix[i] + (T[i] == 'A' ? +1 : -1));

    int Q;
    cin >> Q;

    for (int q = 0; q < Q; q++) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        a--; c--;

        int S_value = mod3(S_prefix[b] - S_prefix[a]);
        int T_value = mod3(T_prefix[d] - T_prefix[c]);
        cout << (S_value == T_value ? "YES" : "NO") << '\n';
    }
}


Measured memory_bytes: 1744
#include <bits/stdc++.h>
 
using namespace std;
typedef long long int lli;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef pair <lli,lli> pii;
#define ff first
#define ss second
#define MOD 1000000007
#define pb push_back
#define EPS 1e-6
 
 
 
int main(){
	fast;
	lli x;
	cin>>x;
	lli one = x/500;
	lli five= (x-one*500)/5;
	lli ans=0;
	if(one>0) ans+=one*1000;
	if(five>0) ans+=five*5;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>       // printf,scanf
#include <stdlib.h>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>  //sort,binarySearch
#include <functional> 
#include <iomanip> // setprecision
#include <utility>    // c+11 Array
#include <set>
#include <sstream>
#include <bits/stdc++.h>
#define PI 3.141592653589793238462643383279
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define pb(x) push_back(x)
#define debug(x) cout << #x << " = " << x << endl;
#define debret(x) debug(x) ; return 0;

using namespace std;

int main(void){

    string str;
    string ans = "";

    cin >> str;

    REP(i,str.size()){
        if(str[i] == '0') ans += '0';
        if(str[i] == '1') ans += '1';
        if(str[i] == 'B') ans = ans.substr(0,ans.size()-1);
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
 
int main() {
	
	string s;
	cin >> s;
	
	string ans="Yes";
	
	vector<int> c(30,0);//check
	
	rep(i,s.size()){
		int index=s[i]-'a';
		c[index]++;
	}
	
	rep(i,30){
		if(c[i]%2==1){
			ans="No";
		}
	}
	
	
	
	
    cout << ans << endl;
    
    return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int i,j,a[20],n,b,c;
int main()
{
  for(cin>>n;i<n;i++)cin>>a[i];
  for(i=1;i<n-1;i++)if((a[i-1]<a[i]&&a[i]<a[i+1])||(a[i-1]>a[i]&&a[i]>a[i+1]))c++;
  cout<<c;
}

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

int n,m;
std::vector<int> to[100003];
bool vis[100003];
int main()
{
	scanf("%d%d",&n,&m);
	for(int i = 0;i < m;++i) {
		int a,b;
		scanf("%d%d",&a,&b);--a,--b;
		to[a].push_back(b);
		to[b].push_back(a);
	}
	std::vector<int> deg4;
	bool deg6 = false;
	for(int i = 0;i < n;++i) {
		if(to[i].size()%2!=0) {
			printf("No\n");
			return 0;
		}
		if(to[i].size() >= 6) {
			deg6 = true;
		} else if(to[i].size() == 4) {
			deg4.push_back(i);
		}
	}
	if(deg6 || deg4.size() >= 3) {
		printf("Yes\n");
		return 0;
	} else if(deg4.size() <= 1) {
		printf("No\n");
		return 0;
	}
	vis[deg4[0]] = vis[deg4[1]] = true;
	std::queue<int> q;
	int cnt = 0;
	for(int i = 0;i < n;++i) if(!vis[i]) {
		q.push(i);
		bool ca = false, cb = false;
		while(!q.empty()) {
			int cur = q.front();q.pop();
			for(int j = 0;j < to[cur].size();++j) {
				int k = to[cur][j];
				if(!vis[k]) {
					vis[k] = true;
					q.push(k);
				} else if(k == deg4[0]) {
					ca = true;
				} else if(k == deg4[1]) {
					cb = true;
				}
			}
		}
		if(ca && cb) {
			++cnt;
		}
	}
	if(cnt == 2) {
		printf("Yes\n");
	} else {
		printf("No\n");
	}
}


Measured memory_bytes: 5760
#include<stdio.h>

int main(void)
{
	int A,B,C;
	
	scanf("%d %d",&A,&B);
	
	for(int i=1;i<=3;i++){
		if((A*B*i)%2==1){
			printf("Yes\n");
			return 0;
		}
	}
	
	printf("No\n");
	return 0;
}

Measured memory_bytes: 128
private val scanner = java.util.Scanner(System.`in`)

private fun readInts(n: Int) = Array(n) { scanner.nextInt() }
private fun readLongs(n: Int) = Array(n) { scanner.nextLong() }
private fun readLineInts() = readLine()!!.split(" ").map { it.toInt() }.toTypedArray()
private fun readLineLongs() = readLine()!!.split(" ").map { it.toLong() }.toTypedArray()

fun main(args: Array<String>) {
    val (N, M) = readLine()!!.split(" ").map { it.toInt() }
    val X = readLine()!!.split(" ").map { it.toInt() }

    val sortedX = X.sorted()
    val s = (0 until M - 1).map { sortedX[it + 1] - sortedX[it] }

    try {
        println(Math.max(0, s.sorted().reversed().drop(N - 1).sum()))
    } catch (ex: Exception) {
        println("0")
    }
}

Measured memory_bytes: 54648
S = int(input())

if S >= 3600:
    h=S//3600
    m=S%3600//60
    s=S%60
elif 3600 > S >= 60:
    h=0
    m=S//60
    s=S%60
else:
    h=m=0
    s=S
print(h, m, s, sep=":")

Measured memory_bytes: 7676
n, m = map(int, input().split())
h = list(map(int, input().split())) 
a = [list(map(int,input().split())) for i in range(m)]
b = [0] * n
for i in range(m):
 if h[a[i][0]-1] > h[a[i][1]-1]:
   b[a[i][1]-1] +=1
 if h[a[i][0]-1] < h[a[i][1]-1]:
   b[a[i][0]-1] +=1
 if h[a[i][0]-1] == h[a[i][1]-1]: 
   b[a[i][1]-1] +=1
   b[a[i][0]-1] +=1
print(b.count(0))

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

using namespace std;

#define debug(x) '[' << #x << " is: " << x << "] "
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.precision(10);
	cout << fixed;
	int n,m;
	cin>>n>>m;
	vector<pair<int,int>> a(n);
	for(int i=0;i<n;i++)
		cin>>a[i].first>>a[i].second;
	ll ans = 0;
	sort(a.begin(),a.end());
	reverse(a.begin(),a.end());
	multiset<int> st;
	int leftday = m - 1;
	for(int i=0;i<n;i++){
		if(a[i].first > m - st.size()){
			if(st.size()){
				auto it = st.begin();
				if(*it < a[i].second){
					st.erase(st.begin());
					st.insert(a[i].second);
				}
			}
		}else{
			st.insert(a[i].second);
		}
	}
	for(auto it : st){
		ans += it;
	}
	cout << ans << endl;
}

Measured memory_bytes: 5760
#include <algorithm>
#include <climits>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>

#define int long long int
constexpr int INF = std::numeric_limits<int>::max();
constexpr int NINF = std::numeric_limits<int>::min();
using namespace std;

void solve() {
  int N;
  string S;
  cin >> N >> S;

  vector<int> v(26), z(26);
  for (char c:S) {
    z[c-'a']++;
  }

  int ans = 0;
  for (int p = 0; p < S.size() - 1; p++) {
    char c = S[p];
    v[c-'a']++;
    z[c-'a']--;

    int a = 0;
    for (int i = 0; i < v.size(); i++) {
      if (v[i] > 0 && z[i] > 0) {
        a++;
      }
    }
    ans = max(ans, a);
  }
  cout << ans << endl;
}

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


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

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
// #define int long long
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000               // 2e9
#define LLINF 2000000000000000000ll  // 2e18 (llmax:9e18)
#define fi first
#define sec second
#define all(x) (x).begin(), (x).end()
#define sq(x) ((x) * (x))
#define dmp(x) cerr << #x << ": " << x << endl;

template <class T>
void chmin(T &a, const T &b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T &a, const T &b) {
  if (a < b) a = b;
}

template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template <class T>
vector<T> vect(int len, T elem) {
  return vector<T>(len, elem);
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << p.fi << ',' << p.sec;
  return os;
}
template <class T, class U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.fi >> p.sec;
  return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) {
    os << vec[i];
    if (i + 1 < vec.size()) os << ' ';
  }
  return os;
}
template <class T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) is >> vec[i];
  return is;
}
void fastio() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
}

#define endl "\n"

template <class T>
struct RangeSum {
  vector<T> vec;
  RangeSum() {}
  RangeSum(vector<T> elems) : vec(elems) {
    for (int i = 1; i < vec.size(); i++) { vec[i] += vec[i - 1]; }
  }
  T sum(int l, int r) {
    if (l > r) return T(0);
    if (l == 0)
      return vec[r];
    else
      return vec[r] - vec[l - 1];
  }
};

void solve() {
  int N, Y;
  cin >> N >> Y;
  Y /= 1000;
  vector<vector<bool>> dp = vect(N + 1, vect(Y + 1, false));
  vector<vector<int>> prev = vect(N + 1, vect(Y + 1, INF));
  dp[0][0] = true;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < Y; j++) {
      if (!dp[i][j]) continue;
      dp[i + 1][j + 1] = true;
      prev[i + 1][j + 1] = j;
      if (j + 5 <= Y) {
        dp[i + 1][j + 5] = true;
        prev[i + 1][j + 5] = j;
      }
      if (j + 10 <= Y) {
        dp[i + 1][j + 10] = true;
        prev[i + 1][j + 10] = j;
      }
    }
  }
  if (!dp[N][Y]) {
    cout << "-1 -1 -1" << endl;
    return;
  }
  int now = Y;
  vector<int> ans(20, 0);
  for (int i = 0; i < N; i++) {
    int nxt = prev[N - i][now];
    ans[now - nxt]++;
    now = nxt;
  }
  cout << ans[10] << ' ' << ans[5] << ' ' << ans[1] << endl;
  return;
}

signed main() {
  fastio();
  solve();
  //   int t;
  //   cin >> t;
  //   while (t--) solve();
  return 0;
}


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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int ans[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k;
  cin >> k;
  cout << ans[k - 1] << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <numeric>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <algorithm>
using namespace std;

using ll = long long;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define REP1(i, n) for (ll i = 1; i <= n; i++)
#define REPR(i, n) for (ll i = n - 1; i >= 0; i--)
#define REPR1(i, n) for (ll i = n; i >= 1; i--)
#define FOR(i, m, n) for (ll i = m; i <= n; i++)

int gcd(int a, int b) { if (a < b) { a ^= b; b ^= a; a ^= b; } return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }

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

    ll sum = 0;
    REP1(i, N) {
        ll a;
        cin >> a;
        sum += a;
    }

    cout << (H <= sum ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
double pi(){return std::atan(1)*4;}
double degToRad(double deg){
  return deg * pi() / 180;
}
int main(){
  double x=0,y=0,angle=0;
  for(;;){
    int leng,rot;
    scanf("%d,%d",&leng,&rot);
    if(!(leng|rot)){break;}
    y+=cos(degToRad(angle))*leng;
    x+=sin(degToRad(angle))*leng;
    angle+=rot;
  }
  printf("%d\n%d\n",(int)x,(int)y);
}

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

int main(){
    int n;
    cin>>n;
    map<string,int>mp;
    rep(i,n){
        string s; cin>>s;
        sort(s.begin(),s.end());
        mp[s]++;
    }
    ll ans=0;
    for(auto&p:mp){
        ans+=(ll)p.second*(p.second-1)/2;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 11136
//AtCoder ABC091 B - Two Colors Card Game
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;

int main() {
    ll N;
    cin>>N;
    unordered_map<string,ll> blue;
    for(ll i=0;i<N;++i){
        string s;
        cin>>s;
        ++blue[s];
    }
    ll M;
    cin>>M;
    unordered_map<string,ll> red;
    for(ll i=0;i<M;++i){
        string s;
        cin>>s;
        ++red[s];
    }
    ll ans=0;
    for(auto& b:blue){
        ll v=b.second;
        auto it = red.find(b.first);
        if (it !=red.end()){
            v-=it->second;
        }
        ans=max(ans,v);
    }
    cout<<ans<<endl;
    return 0;
}

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

bool solve() {
  int H, W; cin >> H >> W;
  int g1 = H & W & 1;
  int g2 = H % 2 * W / 2 + W % 2 * H / 2;
  int g4 = H * W - g1 - g2 * 2;
  vector<int> cnt(26);
  for (int i = 0; i < H*W; i++) {
    char c; cin >> c;
    cnt[c-'a']++;
  }
  int c1 = 0, c2 = 0, c4 = 0;
  for (int i = 0; i < 26; i++) {
    c4 += cnt[i] / 4; cnt[i] %= 4;
    c2 += cnt[i] / 2; cnt[i] %= 2;
    c1 += cnt[i];
  }
  if (c1 > g1 || c2 > g2) return false;
  return true;
  
}

int main() {
  if (solve()) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main
{
    public static void main(String args[])
    {
	Scanner scan=new Scanner(System.in);
	int n=scan.nextInt();
	int count[]=new int[6];
	for(int i=0;i<n;i++)
	    {
		float high=scan.nextFloat();
		if(high<165.0)count[0]++;
		if(165.0<=high && high<170.0)count[1]++;
		if(170.0<=high && high<175.0)count[2]++;
		if(175.0<=high && high<180.0)count[3]++;
		if(180.0<=high && high<185.0)count[4]++;
		if(185.0<=high)count[5]++;
	    }
	for(int i=0;i<6;i++)
	    {
		System.out.print((i+1)+":");
		    for(int j=0;j<count[i];j++)
		    {
			System.out.print("*");
		    }
		System.out.println();
	    }
    }
}

Measured memory_bytes: 20216
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};



int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    int n;
    string s;
    cin>>n>>s;
    int cntl=0,cntr=0;
    rep(i,n){
        if(s[i]=='.') cntr ++;
    }
    int ans=cntr;
    rep(i,n){
        if(s[i]=='.') cntr --;
        else cntl ++;
        ans=min(ans,cntl+cntr);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 720
A,B,C = (int(x) for x in input().split())
if A==B:
    if A !=C:
        print("Yes")
    else:
        print("No")
elif B==C:
    if A !=B:
        print("Yes")
    else:
        print("No")
elif A==C:
    if A !=B:
        print("Yes")
    else:
        print("No")
else:
    print("No")

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

int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    
    for(int i=0; i<N; i++){
        int a;
        cin >> a;
        A[a-1] = i+1;
    }
    for(int i=0; i<N; i++){
        cout << A[i];
        if(i != N-1) cout << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 1152
#include <stdio.h>
#include <stdlib.h>

char
win(char c)
{
    char tp;
    switch(c) {
        case 'r':
            tp = 'p';
            break;
        case 's':
            tp = 'r';
            break;
        case 'p':
            tp = 's';
            break;
    }
    return tp;
}

void
solver(int n, int k, int r, int s, int p, char *t)
{
    int total=0;
    int i;
    char u[100001], tp;

    for (i=0; i<n; i++) {
        tp = win(t[i]);
        
        if (i+1>k && tp==u[i-k]) {
            if (i>n-k || t[i+k]==tp)
                tp = t[i];
            else {
                tp = t[i+k];
            }
        }
        else {
            switch(tp) {
                case 'r':
                    total += r;
                    break;
                case 's':
                    total += s;
                    break;
                case 'p':
                    total += p;
                    break;
            }
        }
        u[i] = tp;
    }

    printf("%d\n", total);
}

int
main(int argc, char *argv[])
{
    int N, K;
    int R, S, P;
    char T[100001];

    scanf("%d%d", &N, &K);
    scanf("%d%d%d", &R, &S, &P);
    scanf("%s", T);

    solver(N, K, R, S, P, T);

    return 0;
}

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

int main(){
  int n;
  string s;
  cin >> n >> s;
  
  for(int i = 0; i < s.size(); i++){
    char c = ((((s[i] - 'A') + n)%26) + 'A');
    cout << c;
  }
}

Measured memory_bytes: 256