akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()    // 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend() // 降順ソート 例：sort(DESC(vec));
#define rep(i, n) for (int i = 0; i < (n); i++)
#define Rep(i, n) for (int i = 1; i < n; i++)
#define REP(i, vec) for (auto i = vec.begin(); i != vec.end(); ++i)

const int       mod = 1000000007;
const int       inf = (1 << 21);
const long long INF = 1LL << 60;

using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;
using vll = vector<pair<ll, ll>>;

template<class T>
inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T>
inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T>
T GCD(T a, T b) { if (b == 0) return a; else return GCD(b, a % b); }
template<class T>
T LCM(T a, T b) { return a / GCD(a, b) * b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

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

	for (int a = -1000; a <= 1000; ++a) {
		for (int b = -1000; b <= 1000; ++b) {
			if (pow(a, 5) - pow(b, 5) == x) {
				cout << a << " " << b << endl;
				return 0;
			}
		}
	}
}


Measured memory_bytes: 4020
#include <bits/stdc++.h>
//#include <iostream>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REP3(i, f, n) for (int(i) = (f); (i) < (n); (i)++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());

#define VSORTR(v, T) sort(v.begin(), v.end(), greater<T>());
#define CINARY(a, n) \
    REP(i, n) { cin >> a[i]; }
#define COUTARY(a, n) \
    REP(i, n) { cout << a[i] << endl; }
#define pb(a) push_back(a)
#define INF 999999999
#define CI(x) cin >> (x);
#define CO(x) cout << (x) << endl;
#ifdef LOCAL
#define DBG(...) fprintf(stderr, __VA_ARGS__)
#else
#define DBG(...) 42
#endif
const int P10POWEROF9PLUS7 = 1000000007;
using namespace std;
typedef long long ll;
typedef long long llong;
typedef vector<int> vi;
typedef pair<int, int> P;
// typedef pair<llong, llong> LP;
// typedef pair<int, P> PP;
// typedef pair<llong, LP> LPP;

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

int main()
{
    int n;
    cin>>n;
    vi d(n);
    CINARY(d,n)
    vi buc(100);
    REP(i,n){
        buc[d[i]]++;
    }
    int cnt=0;
    REP(i,101){
        if(buc[i]>=1){
            cnt++;
        }
    }
    CO(cnt)
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007
int a[110];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout<<setprecision(10);
    cout<<fixed;
    int m=0,n=0,sum=0,ct=0;
    cin>>n>>m;
    for(int i=0;i<n;++i)
        {
            cin>>a[i];
            sum+=a[i];
        }
    double x=(double)sum/(4*m);
    sort(a,a+n,greater<int>());
    for(int i=0;i<n;++i)
    {
        if((double)a[i]>=x)
            ++ct;
        else
            break;
    }
    if(ct>=m)
        cout<<"Yes";
    else
        cout<<"No";
    cout<<endl;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use {
    proconio::{fastout, input, marker::*},
    std::cmp::*,
    std::collections::*,
    std::ops::*,
};

fn main() {
    input! {
        mut a:usize,
        mut b:usize,
    }

    let mut ans = vec![];
    for _ in 0..50 {
        ans.push(vec![b'#'; 100]);
    }
    for _ in 0..50 {
        ans.push(vec![b'.'; 100]);
    }

    a -= 1;
    b -= 1;
    for a in 0..a {
        let p = a / 50;
        ans[p * 2][if p % 2 == 0 {
            (a % 50) * 2
        } else {
            (a % 50) * 2 + 1
        }] = b'.';
    }
    for b in 0..b {
        let p = b / 50;
        ans[100 - 1 - p * 2][if p % 2 == 0 {
            (b % 50) * 2
        } else {
            (b % 50) * 2 + 1
        }] = b'#';
    }

    println!("{} {}", 100, 100);
    for a in ans {
        println!("{}", a.iter().map(|b| *b as char).collect::<String>());
    }
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
#include <unistd.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
 
long long int INF = 3e18;
const ll fact_table = 5000000;
double Pi = 3.1415926535897932384626;
 
vector<ll> G[550010];
//vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←
 
 
#define p(x) cout<<x<<"\n";
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)(); 
 
 
//ll mod = 998244353;
ll mod = 1000000007;
 
ll rui(ll number1,ll number2){
 
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
 
    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){
 
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
 
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}
 
/*
ll fact[fact_table + 5],rfact[fact_table + 5];
 
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=fact_table; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[fact_table] = rui(fact[fact_table],mod - 2);
    for(ll i=fact_table; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod ) * rfact[n-r]) % mod;}
 */
ll n,m,num,sum,a,b,c,d,e,g,h,w,i,j,q,r,l;
ll k;
ll ans;
ll x[500005], y[500005], z[500005];
char s[400004];

int main(){
    string s[7] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    string t;
    cin >> t;
    for(int i=0;i<7;i++){
        if(s[i] == t){
            p(7 - i);

        }
    }
   

    return 0;
    
}


















Measured memory_bytes: 14976
def getN():
    return int(input())

def getMN():
    a = input().split()
    b = [int(i) for i in a]
    return b[0],b[1]

def getlist():
    a = input().split()
    b = [int(i) for i in a]
    return b

n = getN()

arr = getlist()

odd = 0
even = 0

for a in arr:
    if a % 2 == 0:
        even += 1
    else:
        odd += 1

even += odd // 2
odd = odd % 2

if n == 2:
    if odd == 1:
        print("NO")
    else:
        print("YES")
else:
    if odd == 1:
        print("NO")
    else:
        print("YES")


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


int main(){
    ll n;cin>>n;int t=n;
    ll sum=0;
    ll m=100000000;
    rep(i,10){
        sum+=(n/m);
        n=n-m*(n/m);
        m=m/10;
        if(m==0)break;
    }
    if(t%sum==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
void main()
{
    string s = rdStr;
    string t = rdStr;

    bool[][] lists = new bool[][](26, 26);
    foreach (x, y; zip(s, t))
    {
        lists[x-'a'][y-'a'] = true;
    }

    foreach (i; 0 .. 26)
    {
        long a, b;
        foreach (j; 0 .. 26)
        {
            if (lists[i][j]) ++a;
            if (lists[j][i]) ++b;
        }
        if (a > 1 || b > 1)
        {
            "No".writeln;
            return;
        }
    }

    "Yes".writeln;
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 2744
/*
* @Author: _dp95
* @Date:   2020-04-05 07:40:28
*/
#include "bits/stdc++.h"
using namespace std ;

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

typedef long long ll ;
typedef long double ldb ;

#define mp make_pair
#define pb push_back
#define F first
#define S second
#define nl '\n'

#define all( x ) x.begin(),x.end() 
#define sz( x ) ( int )( x ).size( )
#define mem( a, val ) memset(a, val, sizeof( a ) )
#define deci( x ) cout<<fixed<<setprecision( x );
#define bitcount( x ) __builtin_popcountll( x )

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

const int MAX = 2*1000*1000 + 10 ;
const ll INF = 1e18 ;
const int MOD = 1e9 + 7 ;

ll add( ll a, ll b ){
    return ( ( a % MOD ) + ( b % MOD ) ) % MOD ;
}

ll sub( ll a, ll b ){
    return ( ( a % MOD ) - ( b % MOD ) + MOD ) % MOD ;
}

ll mul( ll a, ll b ){
    return ( ( a % MOD ) * ( b % MOD ) ) % MOD ;
}

ll exp( ll a, ll b ){
    ll ans = 1 ;
    while( b ){
        if( b&1 )
            ans = mul( ans, a ) ;
        a = mul( a, a ) ;
        b >>= 1 ;
    }
    return ans ;
}

const int M = 51 ;
struct Matrix {
  int a[M][M];

  Matrix() {
    for (int i = 0; i < M; ++i)
      fill(a[i], a[i] + M, 0);
  }

  int* operator[](int x) {
    return a[x];
  }

  Matrix operator * (Matrix &to) {
    Matrix ans;
    for (int i = 0; i < M; ++i)
      for (int j = 0; j < M; ++j)
        for (int k = 0; k < M; ++k)
          ans[i][j] = add(ans[i][j], mul(a[i][k], to[k][j]));
    return ans;
  }

} ONE;

Matrix bin(Matrix A, ll n ) {
  for (int i = 0; i < M; ++i)
    ONE[i][i] = 1;
  Matrix B = ONE;
  while (n) {
    if (n & 1)
      B = B * A;
    A = A * A;
    n >>= 1;
  }
  return B;
}


signed main( ){
  timesaver ;
  Matrix x ;
  ll n, k ;
  cin >> n >> k ;
  for( int i = 0 ; i < n ; i++ )
    for( int j = 0 ; j < n ; j++ )
      cin >> x.a[i][j] ;
  x = bin( x, k ) ;
  ll ans(0) ;
  for( int i = 0 ; i < n ; i++ )
    for( int j = 0 ; j < n ; j++ ){
      ans += x.a[i][j] ;
      if( ans >= MOD )
        ans %= MOD ;
    }
  cout << ans << nl ;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>

using namespace std;

void solve()
{
	string S;
	cin >> S;
	if (S[0] == 'Y' && S[1] == 'A' && S[2] == 'K' && S[3] == 'I')
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 256
while True:
    l = input().split()
    a,b = int(l[0]),int(l[2])
    if l[1] == "+":
        print(a+b)
    if l[1] == "-":
        print(a-b)
    if l[1] == "*":
        print(a*b)
    if l[1] == "/":
        print(a//b)
    if l[1] == "?":
        break


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

int main(){
    string S, R;
    int guessright = 0;
    cin >> S >> R;
    for(int i=0; i<3; i++){
        if(S[i] == R[i]) guessright++;
    }
    cout << guessright << endl;

}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e9;
const ll MOD = 1e9 + 7;


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

    for(int i=0; i<100000; i++){
        int x = ((double)i*0.08);
        int y = ((double)i*0.1);
        if(a == x && b == y){
            cout << i << endl;
            return 0;
        }
    }

    cout << -1 << endl;
}

Measured memory_bytes: 256
program ABC116B
    implicit none
    integer(8)::i=2
    integer(8)::j
    integer(8)::flg=0
    integer(8),dimension(1000000)::A

    read(5,*)A(1)

    do
        if(mod(A(i-1),2)==0)then
            A(i)=A(i-1)/2
        else
            A(i)=3*A(i-1)+1
        end if

        do j=1,i-1
            if(A(j)==A(i))then
                flg=1
                exit
            end if
        end do

        if(flg==1)then
            exit
        end if

        i=i+1
    end do
    
    print'(i0)',i

end program ABC116B

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

const double pi = acos(-1);

int main(){ 
    double A, B, H, M;
    cin >> A >> B >> H >> M;

    double angleL = 2*pi * (H*60+M)/(12*60);
    double angleS = 2*pi * M / 60;
    double angle = max(angleL, angleS) - min(angleL, angleS);

    double ans = A*A + B*B - 2*A*B*cos(angle);
    cout << setprecision(12) << endl;
    cout << sqrt(ans) << endl;



}


Measured memory_bytes: 4128
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }



int n, a, b;

int main() {
    while (cin >> n) {
        if (n == 0) break;
        int A = 0, B = 0;
        for (int i = 0; i < n; ++i) {
            cin >> a >> b;
            if (a > b) A += a+b;
            else if (a < b) B += a + b;
            else A += a, B += b;
        }
        cout << A << " " << B << endl;
    }
    return 0;
}


Measured memory_bytes: 1160
n=int(input())
d,x=map(int,input().split())
a=[]
day=[]
for i in range(n):
    a.append(int(input()))
    day.append(0)
#print(a)

for i in range(n):
    day[i]=(d-1)//a[i]
#print(day)
print(sum(day)+n+x)

Measured memory_bytes: 3188
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	long long a[100010];
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		scanf("%lld",&a[i]);
	} 
	sort(a,a+n);
	long long sum=0;
	if(n%2==0){
		for(int i=0;i<n/2-1;i++){
			sum+=a[n-i-1];
			sum-=a[i];
		}
		sum=sum*2;
		sum+=a[n/2];
		sum-=a[n/2-1];
	}
	else{
		for(int i=0;i<n/2-1;i++){
			sum+=a[n-i-1];
			sum-=a[i];
		}
		sum=sum*2;
		int a1=a[n/2+1]*2-a[n/2]-a[n/2-1];
		int b1=a[n/2+1]+a[n/2]-2*a[n/2-1];
		sum+=max(a1,b1);
	}
	cout<<sum;
	return 0;
}

Measured memory_bytes: 1024
N = int(input())
ABC = [list(map(int,input().split())) for _ in range(N)]


dp = [[0, 0, 0] for _ in range(N)]
dp[0] = ABC[0]

select_action = [[1,2], [0,2], [0,1]]
for i in range(1,N):
    for j in range(3):
        abc1 = select_action[j][0]
        abc2 = select_action[j][1]

        dp[i][j] = max(dp[i-1][abc1], dp[i-1][abc2]) + ABC[i][j]


print(max(dp[-1]))


Measured memory_bytes: 76248
from collections import defaultdict


def resolve():
    n = int(input())
    d = defaultdict(int)
    for _ in range(n):
        d[input()] += 1
    m = max(d.values())
    l = sorted(x[0] for x in d.items() if x[1] == m)
    for i in l:
        print(i)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 32480
#include <stdio.h>
int main(void){
  int i,l=0;
  char s[11],a[11]={};
  scanf("%s",s);
  for (i=0;s[i];i++){
    if (s[i]=='B'){
      if (l){
        l--;
        a[l]='\0';
      }
    }else{
      a[l]=s[i];
      l++;
    }
  }
  printf("%s\n",a);
  return 0;
}

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

int main()
{
    int a, b;
    int N;
    bool flag = false;
    cin >> a >> b;
    b--;
    cin >> N;
    for(int i = 0; i < N; i++) {
        int s, t;
        cin >> s >> t; t--;
        if(b >= s && t >= a) flag = true;
    }
    cout << flag << endl;
    return (0);
}

Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
// nCk を取得
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
 
int main() {
string s;
cin>>s;
ll k=0;
string t = "";
ll n=s.size();
if(n>9){
cout << "NO" << endl;}
else{

for(ll i=0; i<n; i++){
if(s.at(i)!='A'){
t+=s.at(i);}}
string u="KIHBR";
if(t!=u){
cout << "NO" << endl;}

else{
  
ll ca=0;
while(s.at(ca)=='A'){
ca++;}
if(ca>1){
cout << "NO" << endl;}
else if(s.at(ca+1)!='I'||s.at(ca+2)!='H'){
cout << "NO" << endl;}
  
else{
  
ca++;
ca++;
ca++;
while(s.at(ca)=='A'){
ca++;
k++;}
if(k>1){
cout << "NO" << endl;}
  
else{
  
k=0;
ca++;
while(s.at(ca)=='A'){
ca++;
k++;}
if(k>1){
cout << "NO" << endl;}
else if(n-ca<=2){
cout << "YES" << endl;}
else{
cout << "NO" << endl;}
}}}}}


Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <numeric>
using namespace std;

int t[10001], ti;
int main()
{
  int n;
  while (cin >> n, n){
    ti = 0;
    for (int i = 0; i < n; i++){
      cin >> t[i];
    }
    sort(t, t + n);
    for (int i = 0; i < n; i++){
      int num = t[i];
      t[i] = ti;
      ti += num;
    }
    cout << accumulate(t, t + n, (long long)0) << endl;
  }
  return (0);
}

Measured memory_bytes: 1212
#include<stdio.h>
#include<string>
#include<iostream>
#include<math.h>
#include<vector>
#include<set>
#include<algorithm>
#include<list>
#include<queue>
#include<functional>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define INF 1000000000000000000
struct edge {
	ll to, cost;
};
vector<edge>G1[210];
//start地点に対し
ll d1[210][210];

void dijkstra1(ll s) {
	priority_queue<P, vector<P>, greater<P>>que;
	for (ll i = 1;i <= 210;i++)d1[s][i] = INF;
	d1[s][s] = 0;
	que.push(P(0, s));
	while (!que.empty()) {
		P p = que.top();que.pop();
		ll v = p.second;
		if (d1[s][v] < p.first)continue;
		for (ll i = 0;i < G1[v].size();i++) {
			edge e = G1[v][i];
			if (d1[s][e.to] > d1[s][v] + e.cost) {
				d1[s][e.to] = d1[s][v] + e.cost;
				que.push(P(d1[s][e.to], e.to));
			}
		}
	}
}


int main() {
	ll n, m, r, a, b, c;
	cin >> n >> m >> r;
	vector<ll>k(r);
	for (ll i = 0;i < r;i++)cin >> k[i];
	for (ll i = 0;i < m;i++) {
		cin >> a >> b >> c;
		G1[a].push_back({ b,c });
		G1[b].push_back({ a,c });
	}
	sort(k.begin(), k.end());
	for (ll i = 0;i < r;i++)dijkstra1(k[i]);
	ll ans = INF, dist = 0;
	do {
		dist = 0;
		for (ll i = 0;i < r - 1;i++) {
			dist += d1[k[i]][k[i + 1]];
		}
		ans = min(ans, dist);
	} while (next_permutation(k.begin(), k.end()));
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1152
#include "bits/stdc++.h"

using namespace std;

#define int 		long long
#define endl		"\n"
#define mod			1000000007
#define IOS			ios::sync_with_stdio(0), cin.tie(0)

int32_t main() {

	IOS;

	int n, x = 0;
	cin >> n;
	vector<int> v(n);

	for (int i  = 0; i < n; i++) {
		cin >> v[i];
		x ^= v[i];
	}

	for (int i = 0; i < n; i++) {
		cout << (x ^ v[i]) << " ";
	}

	return 0;
}


Measured memory_bytes: 4784
#include <iostream>

using namespace std;

int main(){
  string A, B, C;
  cin >> A >> B >> C;
  if(A.substr(A.length()-1,1)==B.substr(0,1) && B.substr(B.length()-1,1)==C.substr(0,1)){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
# input
N, L = map(int, input().split())

# check
T = [L + i - 1 for i in range(1, N + 1)]
abs_T = [abs(t) for t in T]
min_abs = min(abs_T)
min_idx = abs_T.index(min_abs)
Pt = sum(T) - T[min_idx]

print(Pt)


Measured memory_bytes: 3064
#pragma GCC optimize("Ofast")
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<string>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<math.h>
#include<utility>
using namespace std;
 

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

    cout << (b+a-3)/(a-1) << endl;
}

Measured memory_bytes: 256
n, k, l = map(int, input().split())
from collections import defaultdict

class UnionFind( ):
    def __init__(self, N):
        self.rank = [0] * N
        self.par = [i for i in range(N)]

    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.rank[x] > self.rank[y]:
            self.par[y] = x
        else:
            self.par[x] = y
            if self.rank[x] == self.rank[y]:
                self.rank[y] += 1

    def same(self, x, y):
        return self.find(x) == self.find(y)


uf1 = UnionFind(n)
uf2 = UnionFind(n)

for i in range(k):
    p, q = map(int, input().split())
    uf1.unite(p - 1, q - 1)


for i in range(l):
    r, s = map(int, input().split())
    uf2.unite(r - 1, s - 1)

pair = defaultdict(int)
for i in range(n):
    a = uf1.find(i)
    b = uf2.find(i)
    pair[(a, b)] += 1

ans = []
for i in range(n):
    ans.append(pair[(uf1.find(i), uf2.find(i))])

print(" ".join(map(str, ans)))

Measured memory_bytes: 127500
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include <string.h>
#include <math.h>

using namespace std;


int main()
{
	string s;
	int tmp = 0;
	cin >> s;
	for (int i = 0; i < 3; i++)
		if (s[i] == '1')tmp++;

	cout << tmp << endl;

	return 0;
}


Measured memory_bytes: 256
n,m,q=map(int,input().split())
a=[[0]*n for _ in range(n)]
for _ in range(m):
  l,r=map(int,input().split())
  l-=1
  r-=1
  a[l][r]+=1
#da[i][j]:(0,0)~(i,j)の長方形の和
def da_generate(h,w,a):
    da = [[0]*w for j in range(h)]
    da[0][0] = a[0][0]
    for i in range(1,w):
        da[0][i] = da[0][i-1]+a[0][i]
    for i in range(1,h):
        cnt_w = 0
        for j in range(w):
            cnt_w += a[i][j]
            da[i][j] = da[i-1][j]+cnt_w
    return da

#da_calc(p,q,x,y):(p,q)~(x,y)の長方形の和
def da_calc(p,q,x,y):
    if p > x or q > y:
        return 0
    if p == 0 and q == 0:
        return da[x][y]
    if p == 0:
        return da[x][y]-da[x][q-1]
    if q == 0:
        return da[x][y]-da[p-1][y]
    return da[x][y]-da[p-1][y]-da[x][q-1]+da[p-1][q-1]
da=da_generate(n,n,a)
for _ in range(q):
  p,q=map(int,input().split())
  p-=1
  q-=1
  print(da_calc(p,p,q,q))

Measured memory_bytes: 15320
#include<stdio.h>
int aqwertysc(const void *ascqwerty, const void *bscqwerty) {
  return *(int *)ascqwerty - *(int *)bscqwerty;  /* この部分はmain関数の前へ */
}

int main(void)
{
  int nor,num,i;
  scanf("%d%d",&num,&nor);
  int high[num];
  for(i=0;i<num;i++)
  {
    scanf("%d",&high[i]);
  }
  
 qsort(high, sizeof(high) / sizeof(int), sizeof(int), aqwertysc);  
  
  int min,j=0;
  min=high[nor-1]-high[0];
  while((j+nor-1)<num)
  {
    if((high[j+nor-1]-high[j])<min) min=high[j+nor-1]-high[j];
    j++;
  }
  
  printf("%d",min);
  return 0;
}

    

Measured memory_bytes: 1020
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 1e3 + 5;
#define DEBUG(x) cout << x << '\n'

int a, b, c, k;
int main(){
#ifdef Irene
    freopen("in.txt", "r", stdin);
#endif // Irene
    ios::sync_with_stdio(false);

    cin >> a >> b >> c >> k;
    int ans = 0;
    if(k >= a) ans += a, k -= a;
    else ans += k, k = 0;
    if(k >= b) k -= b;
    else k = 0;
    ans -= k;
    cout << ans;
}


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

int main(){
    int h,w,k;
    cin >> h >> w >> k;
    vector<string> s(h);
    int ans = 0;
    rep(i,h) cin >> s[i];
    rep(i,1<<h){
        rep(j,1<<w){
            int cnt = 0;
            rep(x,h){
                rep(y,w){
                    if(i>>x & 1) continue;
                    if(j>>y & 1) continue;
                    if(s[x][y]  == '#') cnt++;
                }
            }
            if(cnt == k) ans++;
        }
    }
    cout << ans << endl;

    return 0;
}


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

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    string a,b;
    cin>>a>>b;
    if(a[0]=='H' && b[0]=='H')
    {
        cout<<'H'<<endl;
    }
    else if(a[0]=='D' && b[0]=='D')
    {
        cout<<'H'<<endl;
    }
    else
    {
        cout<<'D'<<endl;
    }
    return 0;
}


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

using namespace std;
using int64 = long long;
const int mod = 1e9 + 7;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

int main() {
  int N, M;
  cin >> N >> M;
  bool dame[100001] = {};
  for(int i = 0; i < M; i++) {
    int x;
    cin >> x;
    dame[x] = true;
  }
  vector< int > dp(N + 1);
  dp[0] = 1;
  for(int i = 0; i <= N; i++) {
    if(dame[i]) continue;
    if(i >= 1) dp[i] += dp[i - 1];
    if(i >= 2) dp[i] += dp[i - 2];
    dp[i] %= mod;
  }
  cout << dp.back() << endl;
}



Measured memory_bytes: 768
#define _GIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main(void) {
  int X, A;
  cin >> X >> A;

  if (X < A) {
    cout << 0 << endl;
  } else {
    cout << 10 << endl;
  }
 
  return 0;
}

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

int main()
{
	int n;
	cin >> n;
	string s, t;
	cin >> s >> t;
	
	for (int i = 0; i < s.length(); ++i)
	{
		cout << s[i] << t[i];
	}
	cout << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define P pair<int,int>
#define PI 3.141592653589793
const int INF = 1001001001;
const ll MX = 1e18;
const int mod = 1000000007;
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

int main() {
	int n, d;
	cin >> n >> d;
	vector<vector<int>> a(n, vector<int>(d));
	rep(i, n)rep(j, d) cin >> a[i][j];

	int ans = 0;
	rep(i, n)rep(j, i) {
		int s = 0;
		rep(k, d) {
			s += (a[i][k] - a[j][k]) * (a[i][k] - a[j][k]);
		}
		int sq = sqrt(s);
		if (sq * sq == s)ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3724
A, B, C, X, Y = gets.split.map(&:to_i)

xymax = [X, Y].max

score_min = 1000000000000000000000000

(0..xymax).each do |c|
  if X > c
    a = X - c
  else
    a = 0
  end
  
  if Y > c
    b = Y - c
  else
    b = 0
  end

  score = A * a + B * b + 2 * C * c
  score_min = [score, score_min].min
end

p score_min

Measured memory_bytes: 1788
// In the name of god
#include <bits/stdc++.h>
#pragma GCC optimze("02")
using namespace std;
using ll =long long;
const ll maxn=1e5+5,inf=1e18+5;
ll n,m,a,b,c,k;
string s,t;
int main(){
	ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0);
	cin>>a>>b>>c>>k;
	if(k<=a){
		cout<<k;
		return 0;
	}
	else if(k<=a+b){
		cout<<a;
		return 0;
	}
	else{
		cout<<a-(k-(a+b));
		return 0;
	}
}


Measured memory_bytes: 3640
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) (v).begin(), (v).end()

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(N);
  rep(i, M) {
    int k;
    cin >> k;
    rep(j, k) {
      int s;
      cin >> s;
      s--;
      a[s] |= 1 << i;
    }
  }
  int p = 0;
  rep(i, M) {
    int x;
    cin >> x;
    p |= x << i;
  }

  int ans = 0;
  for(int s = 0; s < (1 << N); s++) {
    int t = 0;
    for(int i = 0; i < N; i++) {
      if(s >> i & 1) {
        t ^= a[i];
      }
    }
    if(t == p) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main()
{
    while(true){
        string x;
        cin>>x;
        if(x[0]=='0'){
            break;
        }
        int ans=0;
        for(int i=0;i<x.size();i++){
            ans+=(x[i]-'0');
        }
        cout << ans <<endl;
    }
    return 0;
}



Measured memory_bytes: 3156
#[allow(unused_imports)]
use std::cmp;
use std::io::Write;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

  ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($iter, $t);
    input_inner!{$iter $($r)*}
  };
}

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, [ $t:tt ]) => {{
    let len = read_value!($iter, usize);
    (0..len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  }};

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn main() {
  let out = std::io::stdout();
  let mut out = std::io::BufWriter::new(out.lock());
  macro_rules! puts {
    ($($format:tt)*) => (write!(out,$($format)*).unwrap());
  }
  input! {
    n: usize,
    p: [usize1; n],
  }
  let mut ans = 0;
  let mut min = n;
  for &x in &p {
    if x <= min {
      ans += 1;
      min = x;
    }
  }

  puts!("{}\n", ans);
}


Measured memory_bytes: 8444
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
int main() {
  int h, w;
  cin >> h >> w;
  vector<vector<int>> a(h, vector<int>(w));
  for(int i = 0; i < h; i++) {
    for(int j = 0; j < w; j++) {
      cin >> a[i][j];
    }
  }
  vector<pair<int, int>> ans;
  for(int i = 0; i < h; i++) {
    for(int j = 0; j < w; j++) {
      if(a[i][j] % 2 == 0) {
        continue;
      }
      if(j != w - 1) {
        a[i][j]--;
        a[i][j + 1]++;
        ans.push_back({i, j});
      } else if(i != h - 1) {
        a[i][j]--;
        a[i + 1][j]++;
        ans.push_back({i, j});
      }
    }
  }
  cout << ans.size() << endl;
  for(const auto &p : ans) {
    if(p.second != w - 1) {
      cout << p.first + 1 << " " << p.second + 1 << " ";
      cout << p.first + 1 << " " << p.second + 2 << '\n';
    } else {
      cout << p.first + 1 << " " << p.second + 1 << " ";
      cout << p.first + 2 << " " << p.second + 1 << '\n';
    }
  }
  return 0;
}

Measured memory_bytes: 5292
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <float.h>
#include <iomanip>
#include <iostream>
using namespace std;

int main()
{

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

    if((A*B)%2==1){
        cout <<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }

    return 0;
}


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

using namespace std;

int n,m,s,t;
vector<int> edge[(int)3e5+5];
char vis[(int)3e5+5];

void add(int u,int v)
{
    edge[u].push_back(v+n);
    edge[u+n].push_back(v+2*n);
    edge[u+2*n].push_back(v);
}

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

    int i,j,u,v;
    cin>>n>>m;
    while(m--)
    {
        cin>>u>>v;
        add(u,v);
    }
    cin>>s>>t;
    //cout<<endl;
    memset(vis,0,sizeof(vis));
    vis[s]=1;
    queue<int> qx,qt;
    for(i=0;i<edge[s].size();i++)
        qx.push(edge[s][i]),qt.push(1);
    while(!qx.empty())
    {
        u=qx.front(); qx.pop();
        v=qt.front(); qt.pop();
        //cout<<u<<'/'<<v<<endl;
        if(u==t)
            break;
        for(i=0;i<edge[u].size();i++)
            if(!vis[edge[u][i]])
            {
                vis[edge[u][i]]=1;
                qx.push(edge[u][i]);
                qt.push(v+1);
            }
    }
    //cout<<v<<endl;
    if(u==t)
        cout<<v/3<<endl;
    else
        cout<<-1<<endl;
    return 0;
}


Measured memory_bytes: 17024
n=gets.chomp.to_i
a=gets.chomp.split(" ").map { |e| e.to_i  }

n.times do |i|
  a[i] -= (i+1)
end

a.sort!

center = a[n/2]

def absolute(a,b)

  if a>b
     return a-b
  else
    return b-a
  end

end


def minimam(a,center,n)
  min = 0

  n.times do |i|
    min += absolute(a[i],center)
  end

  return min
end

puts minimam(a,center,n)

Measured memory_bytes: 19456
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
import numpy as np
N, M = map(int, raw_input().split())
R = [map(int, raw_input().split()) for i in xrange(M)] 

score = [None for _ in xrange(N+1)]
score[1] = 0
for _ in xrange(N):
    for  a, b, c in R:
        if score[a] != None:
          score[b] = max(score[b], score[a] + c) 
v1 = score[-1]

for _ in xrange(N):
    for  a, b, c in R:
          if score[a] != None:
            score[b] = max(score[b], score[a] + c)
v2 = score[-1]

if v1 != v2:
    print "inf"
else:
    print v2

Measured memory_bytes: 12592
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
const ll INF = 1LL<<60;
const int INT_INF = 1e9;
const ll MOD = 1e9+7;
template<class T> void puts(T x) { std::cout << x << std::endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

int main() {
    int n; cin >> n;
    set<ll> s;
    rep(i, n) {
        ll a; cin >> a;
        if (s.count(a)) {
            s.erase(a);
        } else {
            s.insert(a);
        }
    }
    cout << s.size() << endl;
}


Measured memory_bytes: 4864
#include "bits/stdc++.h"

using namespace std;
using ll = long long;

const int MAX_N = 1e6;
ll a[MAX_N];
int n;


int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	string s;
	cin >> s;
	ll count = 0;
	for(int i = 0;i < s.size();i++){
		char c = s[i] - '0';
		ll val = c;
		count = (count + val) % 9;
	}

	if (count == 0)
		cout << "Yes" << "\n";
	else
		cout << "No" << "\n";
	return 0;
}


Measured memory_bytes: 3672
#include <iostream>
#include <string>
#include <queue>


struct proc {
	std::string name;
	int time;
	proc(std::string s, int i) {
		name = s;
		time = i;
	};
};

int min(int a, int b) {
	return a < b ? a : b;
}

int main() {

	int n;
	std::cin >> n;
	int q;
	std::cin >> q;
	std::queue<proc> p;

	for (int i = 0; i < n; i++) {
		std::string name;
		int time;
		std::cin >> name >> time;
		p.push(proc(name, time));
	}

	int elapsed_t = 0;
	while (!p.empty()) {
		int t = min(p.front().time, q);
		p.front().time -= t;
		elapsed_t += t;
		if (p.front().time != 0)
			p.push(p.front());
		else
			std::cout << p.front().name << " " << elapsed_t << std::endl;
		p.pop();
	}
	return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<vector<int> > submit(n, vector<int>(3, 0));
    rep(i, n) {
        rep(j,3){
            cin >> submit[i][j];
        }
    }
    vector<int> ans(n, 0);
    rep(j, 3) {
        for(int i = 0; i < n; i++){
            bool flag = true;
            for (int k = 0; k < n; k++) {
                if (i == k) continue;
                if (submit[i][j] == submit[k][j]) {
                    flag = false;
                }
            }
            if(flag){
                ans[i] += submit[i][j];
            }
        }
    }
    for(int i = 0; i < n; i++){
        cout << ans[i] << endl;
    }
}   


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

#define MOD 1000000007

int main(){
  int N, M;
  cin >> N >> M;
  vector<int> a(M);
  vector<bool> b(N, true);

  for (int i = 0; i < M; i++) {
      cin >> a.at(i);
      a.at(i)--;
      b.at(a.at(i)) = false;
      if (i > 0) {
          if (a.at(i) - 1 == a.at(i - 1)) {
              cout << 0 << endl;
              return 0;
          }
      }
  }
  
  vector<int> dp(N, 0);
  ll ans = 0;
  for (int i = 0; i < N; i++) {
      if (i == 0) {
          if (b.at(i)) dp.at(i) = 1;
      } else if (i == 1) {
          if (b.at(i)) dp.at(i) = dp.at(i - 1) + 1;
      } else {
          if (b.at(i)) dp.at(i) = dp.at(i - 1) % MOD + dp.at(i - 2) % MOD;
      }
  }
  cout << dp.at(N - 1) % MOD << endl;
  return 0;
}


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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

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

void func(long long N, long long K, std::vector<long long> a){

    vector<lli> d;
    vector<lli> sum(N+1);
    sum[0]=0;
    REP(i,0,N)sum[i+1] = sum[i]+a[i];

    REP(i,0,N){
        REP(j,i+1,N+1){
            d.push_back(sum[j]-sum[i]);
        }
    }
    sort(d.rbegin(),d.rend());
    vector<bool> flag(d.size(),true);

    bool j = false;

    lli ans = 0;
    for(lli bit=62;bit>=0;bit--){
        
        lli cnt = 0;
        REP(i,0,d.size()){
            if(!flag[i])continue;
            if(d[i]&(1LL<<bit))cnt++;
        }
        if(cnt<K)continue;

        REP(i,0,d.size()){
            if(!(d[i]&(1LL<<bit)))flag[i]=false;
        }
        ans |= (1LL<<bit);
    }


    cout<<ans<<endl;

}

int main(){
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> a(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&a[i]);
    }
    func(N, K, std::move(a));
    return 0;
}


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

#define DEBUG

// 型名の省略
typedef unsigned int uint;
typedef long long lint;
typedef unsigned long long ulint;

const int MOD = 1000000007;
const double PI=acos(-1.0);

// cinとcoutの高速化
#define endl "\n"
struct cinacc{cinacc(){cin.tie(0);ios::sync_with_stdio(false);}}cinaccc;
struct coutacc{coutacc(){cout.setf(ios::fixed);cout.precision(12);}}coutaccc;

// 繰り返し
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep_(i,n) for(int i=0;i<(int)(n-1);i++)
#define rep__(i,n) for(int i=n-1;i>=0;i--)

// メモリ関連
#define SZ(x) ((int)(x).size())
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define MEMSET(v,h) memset((v),h,sizeof(h)

// 最大値と最小値を更新する
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;}

// 素数判定
bool isPrime(int n){if(n<2)return false;else if(n==2)return true;else if(n%2==0)return false;double sqrtNum=sqrt(n);for(int i=3;i<=sqrtNum;i+=2)if(n%i==0)return false;return true;}

// ソート
template<class T>vector<T>sortVector(vector<T>v,bool b=true){if(b)sort(v.begin(),v.end());else sort(v.begin(),v.end(),greater<T>());return v;}

// Z-Algorithm O(|S|)
vector<ulint>z_algorithm(string s){vector<ulint>a(s.length());a[0]=s.size();for(ulint i=1,j=0,k;i<s.size();){while(i+j<s.size()&&s[j]==s[i+j])++j;a[i]=j;k=!!j;while(i+k<s.size()&&k+a[k]<j)a[i+k]=a[k],++k;i+=k+!j;j-=k;}return a;}

int main(void) {
    int k, x;
    cin >> k >> x;
    
    if(k * 500 >= x) cout << "Yes";
    else cout << "No";
    
    return 0;
}


Measured memory_bytes: 256
S = input()
S = [Si for Si in S]

i = len(S) - 2
number_of_deleted_qube = 0
while i >= 0 and len(S) >= 2:
    if i >= len(S) - 1:
        i -= 1
        continue

    current = S[i]
    right = S[i + 1]

    if current != right:
        del S[i + 1]
        del S[i]
        number_of_deleted_qube += 2

    i -= 1

print(number_of_deleted_qube)


Measured memory_bytes: 3956
a,b=map(int,input().split())
ct=0
for i in range(1,a+1):
    for j in range(1,32):
        if(a!=b):
            if(i==b):
                break
            elif(i==j):
                ct=ct+1
        elif(i==j):
            ct=ct+1
               
print(ct)


Measured memory_bytes: 2940
#include "bits/stdc++.h"

#define sai(j,n) for(sei j=0;j<sei(n);++j)
#define hsai(j,n) for(sei j=sei(n)-1;j>=0;--j)
#define kan(j,m,n) for(sei j=m;j<sei(n);++j)
#define hkan(j,m,n) for(sei j=sei(n)-1;j>=sei(m);--j)
#define zen(v) (v).begin(),(v).end()
#define yu(v) v.erase(unique(zen(v)), v.end());
#define syutu(v) si(a, (v).size()) {cout << v[a];if(a != v.size()-1)cout << " ";else cout << endl;}
#define mug 10000000111;
#define yo 10000000711;
#define kyo 1e-9;

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

using namespace std;
typedef long long sei;
typedef long double syo;
typedef vector<sei> vs;
typedef vector<syo> vy;
typedef vector<vs> vvs;
typedef vector<vy> vvy;
typedef pair<sei, sei> ks;
sei max(sei a, int b) {return max(a, sei(b));}
sei max(int a, sei b) {return max(sei(a), b);}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    sei j = 0;
    sai(k,s.size()){
        if(s[k]=='+'){
            j++;
        }else{
            j--;
        }
    }

    cout << j << endl;

    return 0;
}

Measured memory_bytes: 256
import Control.Applicative ((<$>), (<*>), (<*), (*>), (<$))
import Control.Monad
import Data.List

main :: IO ()
main = do
  n <- getl read
  ts <- getl $ map read . words
  m <- getl read
  pxs <- replicateM m (getl $ map read . words)
  mapM_ print $ solve n ts pxs

solve :: Int -> [Int] -> [[Int]] -> [Int]
solve n ts pxs = map f pxs
  where
    s = sum ts
    f [p, x] = s - (ts !! (p-1)) + x

getl :: (String -> a) -> IO a
getl f = f <$> getLine


Measured memory_bytes: 1020