akhauriyash/Code-Regression huggingface dataset:
using System;
using static System.Console;
using static System.Math;
using System.IO;
using System.Collections.Generic;
namespace I_am_the_green_coder{
    class Inonoa{
        static void Main(){
            long[] nk = ILongs();
            long n = nk[0];
            long k = nk[1];

            long[] a = ILongs();

            long ans = 0;

            long ansppoi1 = 0;

            for(int i=0;i<a.Length-1;i++){
                for(int j=i+1;j<a.Length;j++){
                    if(a[i]>a[j]){
                        ansppoi1 ++;
                    }
                }
            }

            ans += ansppoi1 * k;

            Array.Sort(a);

            long ansppoi2 = 0;

            for(int i=a.Length-1;i>-1;i--){
                for(int j=a.Length-1;j>-1;j--){
                    if(a[i]>a[j]){
                        ansppoi2 ++;
                    }
                }
            }

            for(int i=0;i<ansppoi2;i++){
                ans += k * (k-1) / 2;
                ans %= MOD;
            }

            Console.WriteLine(ans);

        }

        static readonly long MOD = 1000000007;

        ///<summary>a_1, a_2, a_3, ...みたいなの</summary>
        static long[] ILongs(){
            string[] s = ReadLine().Split();
            long[] re = new long[s.Length];
            for(long i=0;i<s.Length;i++){
                re[i] = long.Parse(s[i]);
            }
            return re;
        }

        ///<summary>xooxoxoxxoxo...みたいなの</summary>
        static char[] IChars(){
            return ReadLine().ToCharArray();
        }

        ///<summary>n m とかをちょっとはやくかくだけ</summary>
        static string[] IStrings(){
            return ReadLine().Split();
        }

        ///<summary>n行の入力を取ったり</summary>
        static long[][] ILongLongs(long n){
            long[][] re = new long[n][];
            for(long i=0;i<n;i++){
                string[] s = ReadLine().Split();
                re[i] = new long[s.Length];
                for(long j=0;j<s.Length;j++){
                    re[i][j] = long.Parse(s[j]);
                }
            }
            return re;
        }

        ///<summary>n行の文字列を取ったり</summary>
        static char[][] ICharsChars(long n){
            char[][] re = new char[n][];
            for(long i=0;i<n;i++){
                re[i] = ReadLine().ToCharArray();
            }
            return re;
        }
    }
}

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

int main() {
	int n, W;
	cin >> n >> W;
	long long v[n], w[n];
	for (int i = 0; i < n; i++)
		cin >> w[i] >> v[i];
	long long dp[n + 1][W + 1];
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= W; j++) {
			if (i == 0 || j == 0)
				dp[i][j] = 0;
			else {
				long long a = (j - w[i - 1] >= 0) ? v[i - 1] + dp[i - 1][j - w[i - 1]] : 0;
				dp[i][j] = max(dp[i - 1][j], a);
			}
		}
	}
	cout << dp[n][W] << endl;
}


Measured memory_bytes: 79104
package main

import (
	"fmt"
	"sort"
)

const inf = 1 << 60

type point struct{ x, y int }
type byXY []point

func (p byXY) Len() int      { return len(p) }
func (p byXY) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
func (p byXY) Less(i, j int) bool {
	if p[i].x == p[j].x {
		return p[i].y < p[j].y
	}
	return p[i].x < p[j].x
}

func main() {
	var n int
	fmt.Scan(&n)
	as := make([]point, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&as[i].x, &as[i].y)
	}
	bs := make([]point, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&bs[i].x, &bs[i].y)
	}
	sort.Sort(byXY(bs))

	aIsUsed := make([]bool, len(as))
	ct := 0
	for _, b := range bs {
		found := false
		yMax := -inf
		yMaxIdx := -1
		for j, a := range as {
			if aIsUsed[j] {
				continue
			}
			if !(a.x < b.x && a.y < b.y) {
				continue
			}
			found = true
			if a.y > yMax {
				yMax = a.y
				yMaxIdx = j
			}
		}
		if found {
			ct++
			aIsUsed[yMaxIdx] = true
		}
	}
	fmt.Println(ct)
}


Measured memory_bytes: 512
#C問題  
N,K=map(int,input().split())
D=list(map(str,input().split()))
for i in range(10*N):
    Nlist=list(str(N))
    Nlen=len(Nlist)
    flag=0
    for j in range(Nlen):
        if Nlist[j] in D:
            flag=1
            break
    if flag == 0:
        print(int(N))
        break
    N+=1

Measured memory_bytes: 3060
#include <iostream>
#include <string>
using namespace std;
typedef long long ll;
int main(void){
  	string ans,x,y;
  	cin >> ans;
  	ll q;
  	cin >> q;
  	int k = 1;
  	
  	
  	for(ll i=0;i<q;i++){
  	    int a,f;
  	    string c;
  	    cin >> a;
  	    if(a == 1)k = k*(-1);
  	    if(a == 2){
  	        cin >> f >> c;
  	        if(f == 2)f = -1;
  	        if(f * k == 1)x = x + c;
  	        if(f * k == -1)y = y + c;
  	        
  	    }
  	}
  
    if(k==1){
    if(x.length()!=0){
    for(ll i=x.length()-1;i>=0;i--){
            cout << x.at(i);
        }
    }
        cout << ans << y << endl;
    }
    else {
    if(y.length()!=0){
    for(ll i=y.length()-1;i>=0;i--){
            cout << y.at(i);
        }
    }
        for(ll i=ans.length()-1;i>=0;i--){
            cout << ans.at(i);
        }
        
        cout << x << endl;
    }
    
}


Measured memory_bytes: 1456
#include <stdio.h>

int main(void){
  int a, b, c, sum;
  scanf("%d %d %d", &a,&b,&c);
  sum=a+b+c;
  if(a*2==sum || b*2==sum || c*2==sum){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}


Measured memory_bytes: 128
n = gets.chomp.to_i
list = []
n.times do
  op, key = gets.chomp.split

  case op
  when 'insert'
    list.unshift(key)
  when 'delete'
    if idx = list.index(key)
      list.delete_at(idx)
    end
  when 'deleteFirst'
    list.shift
  when 'deleteLast'
    list.pop
  end
end
puts list.join(' ')


Measured memory_bytes: 78336
#include <bits/stdc++.h>
using namespace std;
#define pb push_back

int ncr(int n,int r){ int res=1; if(r>n-r)r=n-r; for(int i=0;i<r;i++) {  res*=n-i;  res/=i+1; } return res; }

int gcd(int a,int b){
    if(b==0) return a;
    else return gcd(b,a%b);
}
vector<int>v;
bool isPresent(int n){
    for(int i=0;i<v.size();i++){
        if(v[i]==n) return true;
    }
    return false;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin>>t;
    int sum=0;
    while(t--){
        string s;
        cin>>s;
        int minh=1e9;
        for(int i=0;i<s.length()-2;i++){
            int num=0;
            int n=0;
            for(int j=i;j<i+3;j++){
                num=(s[j]-'0');
                n+=num*pow(10,(i+2-j));
            }
            minh=min(minh,abs(n-753));
        }
        cout<<minh;
        
    }
}
    

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
///////////////////////////////////////////
const long long int INF = 100000000000;
const long long int Mod = 1000000007;
using ll = long long int; //long long int は64bit
using ci = const int; using vi = vector<int>; using Vi = vector<long long int>; using pii = pair<int,int>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(int i=0;i<N;i++)
#define np nullptr
template<class T>bool chmax(T &former, const T &b) { if (former<=b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define fill(x,num) memset(x,num,sizeof(x));
typedef vector<vector<ll> > matrix;
//       cin.tie(0);ios::sync_with_stdio(false);
void cinit(){cin.tie(0);ios::sync_with_stdio(false);}
//////////////////////////^^ *Emile ^^^//////////////////////////////////////////////////////

ll n;
vi a;

int main(){
	cin>>n;ll aa;
	pair<ll,ll> ans;
	rep(i,n){
		cin>>aa;
		a.pb(aa);
	}
	sort(all(a));
	decltype(a)::iterator it = upper_bound(all(a),a[a.size()-1]/2);
	if(it!=a.end()){
		double r = (double)it[0] - (double)a[a.size()-1]/2;
		double l = (double)it[-1] - (double)a[a.size()-1]/2;
		//cout<<r<<" "<<l<<" "<<(double)a[a.size()-1]/2<<endl;
		if(abs(r)<abs(l))ans = mp(a[a.size()-1],it[0]);
		else ans = mp(a[a.size()-1],it[-1]);
	}else{
		ans = mp(a[a.size()-1],a[a.size()-2]);
	}
	cout<<ans.first<<" "<<ans.second<<endl;
	return 0;
}

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

using namespace std;
int k;
string s;
set < int > pos[27];
map < string, bool > m;
int main(){
    cin >> s;
    cin >> k;
    for(int j = 0; j < s.size(); j++){
        pos[s[j] - 'a'].insert(j);
    }
    k--;
    for(int i = 0; i < 26; i++){
        if(!k && !pos[i].empty()){
            cout << char(i + 'a');
            return 0;
        }
        if(!pos[i].empty()){
            k--;
        }
        string s3;
        s3 += char(i + 'a');
        set < pair < string , int > > s2;
        for(auto it = pos[i].begin(); it != pos[i].end(); it++){
            if(*it + 1 < s.size()){
                s2.insert({s3 + s[*it + 1], *it + 1});
            }
        }
        while(!s2.empty()){
            string s4 = s2.begin() -> first;
            int pos = s2.begin() -> second;
            s2.erase(s2.begin());
            if(!k && !m[s4]){
                cout << s4;
                return 0;
            }
            else if(!m[s4]){
                k--;
                m[s4] = 1;
            }
            if(pos + 1 < s.size()){
                s4 += s[pos + 1];
                pos++;
                s2.insert({s4, pos});
            }
        }
    }
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
                     
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
const ll mod = 1e9+7;
 
 
int solve(){
    ll n;cin>>n;
    vector<ll> a(n), pre(n+3,0);
    for(int i=0;i<n;++i){
        cin>>a[i];
        pre[i+1] = pre[i] + a[i];
    }
    vector<vector<ll>> dp(n+4, vector<ll>(n+4,LLONG_MAX));
    //len // ending idx
    for(int i=0;i<n;++i){
        // dp[1][i] = a[i];
        dp[1][i] = 0;
    }
    for(int i=2;i<=n;++i){
        for(int s=0;s<=n-i;++s){//
            int e = s+i-1;
            for(int ine=s;ine<=e-1;++ine){
                
                dp[i][s] = min(dp[i][s], pre[ine+1] - pre[s-1+1] + pre[e+1] - pre[ine+1-1+1] + dp[ine-s+1][s] + dp[e-(ine+1)+1][ine+1]);
            }
        }
    }
    // for(int i=2;i<=n;++i){
    //     for(int s=0;s<=n-i;++s){
    //         cout<<dp[i][s]<<' ';
    //     }cout<<endl;
    // }
    cout<<dp[n][0];

    return 0;
}
int main(){
    fast;
    int t=1;
    //cin>>t;
    while(t--){
        solve();
    }

    return 0;
}

Measured memory_bytes: 4496
#include <stdio.h>
#include <math.h>
 
int main(){
  int n;
  double x,n_double;
  
  scanf("%d",&n);
  
  x=n/1.08;
  n_double=floor(floor(x)*1.08);
  if((double)n==n_double){
    printf("%d",(int)floor(x));
    exit(0);
  }
 
  n_double=floor(ceil(x)*1.08);
  if((double)n==n_double){
    printf("%d",(int)ceil(x));
    exit(0);
  }
  
  printf(":(");
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
 
#define inf 0x3f3f3f3f
#define pi acos(-1)
#define fi first
#define se second
#define pb push_back
#define all(a) a.begin(),a.end()
#define EPS 1e-9
template<class T> bool mmin(T &a,T b){return (a>b ?(a=b,true):false);};
template<class T> bool mmax(T &a,T b){return (a<b ?(a=b,true):false);};

int n,d;
int dist(array<int,11> a,array<int,11> b){
	int val = 0;
	for(int i=0;i<d;i++)
		val += (a[i]-b[i])*(a[i]-b[i]);
	return val;
}
int32_t main(){
	
	cin >> n >> d;
	vector<array<int,11>> A(n);
	for(auto &a:A)
		for(int i=0;i<d;i++)
			cin >> a[i];
	int ans=0;
	for(int i=0;i<n;i++)
		for(int j=i+1;j<n;j++){
			int val = dist(A[i],A[j]);
			double sq = (double)sqrt((double)val);
			if(sq==floor(sq))
				ans++;
		} 
	cout << ans << '\n';
#ifdef LOCAL_DEFINE
	cerr << "\nTime: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long ll;
ll n,a,b,s[100000],ans,ans1;
int main(void){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>s[i];
    }
    for(int i=0;i<n;i++){
        a+=s[i];
        if(i%2==0){
            if(a<=0){
                ans+=-a+1;
                a=1;
            }
        }
        else{
            if(a>=0){
                ans+=a+1;
                a=-1;
            }
        }
    }
    a=0;
    ans1=ans;
    ans=0;
    for(int i=0;i<n;i++){
        a+=s[i];
        if(i%2==1){
            if(a<=0){
                ans+=-a+1;
                a=1;
            }
        }
        else{
            if(a>=0){
                ans+=a+1;
                a=-1;
            }
        }
    }
    cout<<min(ans,ans1)<<endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

//#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define EPS (1e-10)
#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    VL B(N-1); REP(i,N-1) cin >> B[i];

    LL ans = 0;
    REP(i,N){
        if(i == 0){
            ans += B[i];
        }else if(i == N-1){
            ans += B[N-2];
        }else{
            ans += min(B[i-1],B[i]);
        }
        dump(ans)
    }
    cout << ans << endl;

}


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

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n)  FOR(i, 0, n)
#define ASC(c) sort((c).begin(), (c).end())
#define DESC(c) sort((c).begin(), (c).end(), greater<int>())

#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
    int h, a; cin >> h >> a;
    int ans = 0;
    if (h % a) {
        h -= h % a;
        ans += 1;
    }
    ans += h / a;
    cout << ans << endl;
}


Measured memory_bytes: 380
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

#define N 500010
ll h[N], d = 8, p[N];
int c[N], c2[N];
int n;
string s;
void calc(){
	rep(i, n) h[i+1] = (h[i]*d+s[i])%mod;
}
bool eq(int a, int b, int n){
	return ((h[b+n]-h[b])-(h[a+n]-h[a])*p[b-a])%mod==0;
}

int main(){
	cin>>s;
	n = s.size();
	calc();
	p[0] = 1;
	rep(i, n) p[i+1] = (p[i]*d)%mod;
	for(int i = 1; i <= n/2; i++){
		if(c[i]) continue;
		for(int j = 2*i; j <= n; j+=i){
			if(eq(0, j-i, i)) c[j] = 1;
			else break;
		}
	}
	reverse(all(s)); calc();
	for(int i = 1; i <= n/2; i++){
		if(c2[i]) continue;
		for(int j = 2*i; j <= n; j+=i){
			if(eq(0, j-i, i)) c2[j] = 1;
			else break;
		}
	}
	reverse(c2, c2+n+1);

	if(!c[n]){
		cout<<1<<endl;
		cout<<1<<endl;
	} else if(s==string(n, s[0])){
		cout<<n<<endl;
		cout<<1<<endl;
	} else {
		cout<<2<<endl;
		int sum = 0;
		for(int i = 0; i <= n; i++) if(!c[i]&&!c2[i]) sum++;
		cout<<sum<<endl;
		//for(int i = 0; i <= n; i++) cout<<c[i]<<" "<<c2[i]<<endl;
	}
	return 0;
}


Measured memory_bytes: 13060
#include <iostream>
#include <math.h>
using namespace std;
typedef long long int ll;

int main() {
	// your code goes here
    ll n,j,temp;
    cin>>n;
    ll a;
    ll b[(int)pow(n,0.5)];
    ll k=0;
    for(a=1;a<=pow(n,0.5);a++){
        if(n%a==0){
            b[k++]=(a-1)+((n/a)-1);
            
        }
        
    }
    for(a=0;a<k-1;a++){
        for(j=1;j<k;j++){
            if(b[j]<b[a]){
                temp=b[j];
                b[j]=b[a];
                b[a]=temp;
            }
        }
    }
    cout<<b[0]<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"first":"second")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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 long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
  int n;
  bool ans=false;
  cin >>n;
  Vi a(n);
  rep(i,n){
    cin>>a[i];
    ans|=(a[i]%2);
  }
  cout<<solve(ans)<<endl;
}

Measured memory_bytes: 640
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
long x=sc.nextLong();
long ans=2l*(long)(x/11l);
if(2l*x-11l*ans>12l)ans++;
if(2l*x==11l*ans)ans--;
ans++;
System.out.println(ans);
}
}

Measured memory_bytes: 9812
#include<bits/stdc++.h>
using namespace std;
#define Mod(n) n % 1000000007
const int dx[8] = {1, 0, -1, 0, -1, 1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, -1, -1, 1};
int main()
{    
    long long a,b,x;
    cin >> a >> b >> x;
    long long ans = 0;
    ans = (b / x) - (a / x);
    if(a % x == 0)
        ans++;
    cout << ans << '\n';
}   



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int N;
main()
{
	cin>>N;
	vector<pair<int,int> >A;
	for(int i=0;i<N;i++)
	{
		int a,b;cin>>a>>b;
		A.push_back({b,a});
	}
	sort(A.begin(),A.end());
	long now=0;
	for(int i=0;i<N;i++)
	{
		now+=A[i].second;
		if(now>A[i].first)
		{
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
}


Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
#define int           long long
#define pb            push_back
#define mp            make_pair
#define PI            3.14159265
#define M             1000000007
#define MM            998244353
#define fr            first
#define sc            second
#define all(v)        (v).begin(),(v).end()
#define rall(v)       (v).rbegin(),v.rend()
#define vc            vector
#define vi            vector<int>
#define pii           pair<int,int>
#define psi           pair<string,int>
#define pis           pair<int,string>
#define mii           map<int,int>
#define msi           map<string,int>

int solve(){
    int x,a; cin>>x>>a;
    int b=((x<a)?0:10);
    cout<<b;
}

signed main() {
    ios::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    //cin>>t;
    while(t--) solve();
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int
main (void)
{
  int n;
  scanf ("%d", &n);
  n %= 10;
  
  if (n == 0 || n == 1 || n == 6 || n == 8)
    puts ("pon");
  else if (n == 3)
    puts ("bon");
  else
    puts ("hon");
      
  return 0;
}

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

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

int main()
{
    int h, w;
    cin >> h >> w;
    vector<string> s(h);

    for (int i = 0; i < h; i++)
    {
        cin >> s.at(i);
    }
    bool ans = true;

    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            if (s[i][j] == '#')
            {
                bool found = false;
                for (int k = 0; k < 4; k++)
                {
                    int x = i + dx[k];
                    int y = j + dy[k];
                    if (0 <= x && x < h && 0 <= y && y < w &&
                        s[x][y] == '#')
                        found = true;
                }
                if (!found)
                    ans = false;
            }
        }
    }
    cout << (ans ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#define rep(i,n) for(int i=0;i<n;i++)
#define ck(a) (0<=(a)&&(a)<9)
int di[]={-3,-1,1,3};
int main(){
    int n,s,t,b; char cs,ct,cb;
    while(scanf("%d",&n),n){
        scanf(" %c %c %c",&cs,&ct,&cb); s=cs-'A', t=ct-'A', b=cb-'A';
        double p[9]={0}; p[s]=1;
         
        while(n--){
            double q[9]={0};
            rep(i,9)rep(d,4){
                if(ck(i+di[d])&&!(i%3==0&&di[d]==-1)&&!(i%3==2&&di[d]==1)&&i+di[d]!=b)q[i+di[d]]+=p[i]/4;
                else q[i]+=p[i]/4;
            }
            rep(i,9)p[i]=q[i];
        }
         
        printf("%.8f\n",p[t]);
    }
    return 0;
}

Measured memory_bytes: 1224
#include <iostream>
#include <string.h>
#include <algorithm>
#include <cmath>

using ll = long long;
const ll INF = __LONG_LONG_MAX__;

using namespace std;

int main() {
    int A, B;
    cin >> A >> B;

    int AB[3];
    int max;
    AB[0] = A + B;
    AB[1] = A - B;
    AB[2] = A * B;
    
    for(int i = 0; i < 3; i++) {
        if(i == 0) {
            max = AB[i];
       } else {
           if(max < AB[i]) {
               max = AB[i];
           }
       }
    }

    cout << max << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] s = sc.next().split("");
		int ans = Integer.parseInt(s[0]);
		boolean max = true;
		for (int i = 1; i < s.length; i++) {
			int tem = Integer.parseInt(s[i]);
			if (tem != 9) {
				max = false;
				break;
			}
			ans += tem;
		}
		if (!max) {
			ans = 0;
			for (int i = 0; i < s.length; i++) {
				if (i != 0)
					ans += 9;
				else if (i == 0)
					ans += Integer.parseInt(s[0]) - 1;
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 21972
#include <iostream>
using namespace std;
int main(void)
{
    int N;
    cin >> N;
    string s;
    int  cnt = 0;
    bool b   = true;
    for(int i = 0 ; i < N ; i++)
    {
        cin >> s;
        if(s == "A")
        {
            cnt++;
        }else{
            cnt--;
            if(cnt < 0){b = false;}
        }
    }
    if(b == true && cnt == 0){cout << "YES" << endl;}else{cout << "NO" << endl;}
}


Measured memory_bytes: 3160
n=int(input())
s=input()
t=s.count("R")*s.count("G")*s.count("B")
for i in range(n-1):
    for j in range(i+1,n):
        if 2*j-i>=n:
            break
        else:
            if s[j]!=s[2*j-i]!=s[i]!=s[j]:
                t-=1
print(t)

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

using namespace std;

#define REP(i,n)	for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPS(i,s,n)	for(int i=(s), i##_len=(n); i<i##_len; ++i)

#define ALL(obj)	(obj).begin(),(obj).end()

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int 			ll;

typedef pair<int,int>			P;

#define LINF		((ll)1 << 63 -1)
#define INF 		2000000007
#define MINF		-2000000007
#define MAX 		100005

const int MOD = 1e9+7;
// テンプレ終了
//====================================================================//

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

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

	sort(ALL(A));

	ll ans = gcd((ll)A[0],(ll)A[1]);
	REPS(i,2,N)
		ans = gcd(ans,(ll)A[i]);

	if(K % ans==0)ans=1;
	else ans = 0;
	if(K>A[N-1])ans=0;
	cout << (ans==1 ? "POSSIBLE" : "IMPOSSIBLE") << endl;

	return 0;
}




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

using namespace std;

using ll = long long int;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vs = vector<string>;

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

const int MAX_A = 100002;

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

	int n;
	cin >> n;

	vi cnt(MAX_A);
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;

		if (a == 0) {
			cnt[a]++;
			cnt[a + 1]++;
		} else {
			cnt[a - 1]++;
			cnt[a]++;
			cnt[a + 1]++;
		}
	}

	int ma = 0;
	for (int i = 0; i < MAX_A; i++) {
		ma = max(ma, cnt[i]);
	}

	cout << ma << endl;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define N 105
using namespace std;
typedef pair<int,int> P;



int main(){
  
  int s,d,m;
  while(cin>>s>>d>>m){
    
    vector<P> v[N],cost;
    
    for(int i=0;i<s;i++){
    
      int k;
      cin>>k;

      for(int j=0;j<k;j++){
      
	int w,p;
	cin>>w>>p;
      
	v[i].push_back(P(w,p));
      }
    
    }

    for(int i=0;i<d;i++){
    
      int f;
      cin>>f;
    
      for(int j=0;j<v[f].size();j++)
	cost.push_back(v[f][j]);
    
    }

    int dp[5005][305];

    memset(dp,-1,sizeof(dp));
    dp[0][0]=0;
  
    for(int i=0;i<cost.size();i++){

      for(int j=0;j<=m;j++){

	if(dp[i][j]==-1)continue;
      
	dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
      
	if(j+cost[i].second<=m)
	  dp[i+1][j+cost[i].second]=max(dp[i+1][j+cost[i].second],dp[i][j]+cost[i].first);
      
      }
    
    }

    int ans1=0,ans2=0;

    for(int i=m;i>=0;i--){
      
      if(ans1<=dp[cost.size()][i]){
	ans1=dp[cost.size()][i];
	ans2=i;
      }
    }

    cout<<ans1<<' '<<ans2<<endl;
  }
  return 0;
}

Measured memory_bytes: 9124
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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 long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	ll n;
	ll ans=INFLL;
	cin >>n;
	for(ll i=1;i<=sqrt(n);i++){
		if(n%i==0){
			chmin(ans,-2+i+n/i);
		}
	}
	cout<<ans<<endl;
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using lint = long long;
using ulint = unsigned long long;

int main(void)
{
    ulint A;
    double B;
    cin >> A;
    cin >> B;

    ulint C = (ulint)(B * 100);
    cout << A * C / (ulint)100 << endl;
    
    return 0;
}

Measured memory_bytes: 3724
'''
問題：
    高橋君は九九を覚えたので、1 以上 9 以下の 2 つの整数の積を計算することができます。

    整数 N が与えられるので、N を 1 以上 9 以下の 2 つの整数の積として表すことができるか判定し、
    できるなら Yes を、できないなら No を出力して下さい。
'''

'''
制約：
    1 ≦ N ≦ 100
    Nは整数である
'''

def abc144b(n: int)-> str:
    for i in range(1, 9 + 1):
        if n % i == 0 and 0 < n // i < 10:
            return 'Yes'
    return 'No'

n = int(input())
print(abc144b(n))


Measured memory_bytes: 9080
#include<cstdio>
#include<algorithm>

using namespace std;

int a[100100];
int N;
int K;

long long sum[100100];
long long psum[100100];

long long solve(){
	sum[0] = 0;
	psum[0] = 0;
	for(int i = 1; i <= N; ++i){
		sum[i] = sum[i - 1] + a[i];
		psum[i] = a[i] < 0 ? psum[i - 1] : (psum[i - 1] + a[i]);
	}
	long long res = 0;
	for(int i = 1; i <= N - K + 1; ++i){
		//[i, i + K)
		long long le = psum[i - 1];
		long long ri = psum[N] - psum[i + K - 1];
		long long mid = max(sum[i + K - 1] - sum[i - 1], 0ll);
		res = max(res, le + ri + mid);
		//printf("%lld %lld %lld\n", le, ri, mid);
	}
	return res;
}

void input(){
	scanf("%d%d", &N, &K);
	for(int i = 0; i < N; ++i){
		scanf("%d", a + i + 1);
	}
}

int main(){
	input();
	long long ans = solve();
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main(){
	ll n; scanf("%lld", &n);
	ll ans = 0;
	for(ll i=1; i*i<n*10; i++){
		if((n-i)%i==0 && (n-i)/i>i){
			ans += (n-i)/i;
		}
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
     
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define sz size()
#define all(a) a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()
#define mod 1000000007
#define forn(i, n) for (int i = 0; i < (int) (n); ++i)
#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
     
using namespace std;
     
int main(){
    IO;       
    int n;
    cin >> n;
    vector<array<int,3>> h(n);
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < 3; ++j) {
            cin >> h[i][j];
        }
    }
 
    vector<array<ll,3>> dp(n);
    for (int j = 0; j < 3; ++j) {
        dp[0][j] = h[0][j];
    }
    
    for (int i = 1; i < n; ++i) {
        for (int j = 0; j < 3; ++j) {
            dp[i][j] = 0;
            for (int k = 0; k < 3; ++k) {
                if (j == k) continue;
                dp[i][j] = max(dp[i][j], h[i][j] + dp[i - 1][k]);
            }
        }
    }
    return cout << max(dp[n - 1][0], max(dp[n - 1][1], dp[n - 1][2])) << '\n',0; 
}

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

int main() {
	ios_base::sync_with_stdio( false );

	const int n = 3;

	int c[n][n] = {};
	for( int i = 0; i < n*n; ++i ) {
		cin >> c[i/n][i%n];
	}

	bool result = true;

	for( int i = 1; i < n; ++i ) {
		int x = c[i][0] - c[i-1][0];
		int y = c[i][1] - c[i-1][1];
		int z = c[i][2] - c[i-1][2];

		if( x != y || y != z ) {
			result = false;
			break;
		}
	}

	cout << (result ? "Yes" : "No") << endl;

	return 0;
}


Measured memory_bytes: 256
/*
Author: QAQAutomaton
Lang: C++
Code: A.cpp
Mail: lk@qaq-am.com
Blog: https://www.qaq-am.com/
*/
#include<bits/stdc++.h>
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define DEBUG printf("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define Debug debug("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define all(x) x.begin(),x.end()
#define x first
#define y second
using namespace std;
typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;
typedef complex<double> cp;
typedef pair<int,int> pii;
int inf;
const double eps=1e-8;
const double pi=acos(-1.0);
template<class T,class T2>int chkmin(T &a,T2 b){return a>b?a=b,1:0;}
template<class T,class T2>int chkmax(T &a,T2 b){return a<b?a=b,1:0;}
template<class T>T sqr(T a){return a*a;}
template<class T,class T2>T mmin(T a,T2 b){return a<b?a:b;}
template<class T,class T2>T mmax(T a,T2 b){return a>b?a:b;}
template<class T>T aabs(T a){return a<0?-a:a;}
template<class T>int dcmp(T a,T b){return a>b;}
template<int *a>int cmp_a(int x,int y){return a[x]<a[y];}
#define min mmin
#define max mmax
#define abs aabs
struct __INIT__{
	__INIT__(){
		memset(&inf,0x3f,sizeof(inf));
	}
}__INIT___;
namespace io {
	const int SIZE = (1 << 21) + 1;
	char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c, qu[55]; int f, qr;
	// getchar
	#define gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	// print the remaining part
	inline void flush () {
		fwrite (obuf, 1, oS - obuf, stdout);
		oS = obuf;
	}
	// putchar
	inline void putc (char x) {
		*oS ++ = x;
		if (oS == oT) flush ();
	}
	template<typename A>
	inline bool read (A &x) {
		for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;else if(c==EOF)return 0;
		for (x = 0; c <= '9' && c >= '0'; c = gc()) x = x * 10 + (c & 15); x *= f;
		return 1;
	}
	inline bool read (char &x) {
		while((x=gc())==' '||x=='\n' || x=='\r');
		return x!=EOF;
	}
	inline bool read(char *x){
		while((*x=gc())=='\n' || *x==' '||*x=='\r');
		if(*x==EOF)return 0;
		while(!(*x=='\n'||*x==' '||*x=='\r'||*x==EOF))*(++x)=gc();
		*x=0;
		return 1;
	}
	template<typename A,typename ...B>
	inline bool read(A &x,B &...y){
		return read(x)&&read(y...);
	}
	template<typename A>
	inline bool write (A x) {
		if (!x) putc ('0'); if (x < 0) putc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10;
		while (qr) putc (qu[qr --]);
		return 0;
	}
	inline bool write (char x) {
		putc(x);
		return 0;
	}
	inline bool write(const char *x){
		while(*x){putc(*x);++x;}
		return 0;
	}
	inline bool write(char *x){
		while(*x){putc(*x);++x;}
		return 0;
	}
	template<typename A,typename ...B>
	inline bool write(A x,B ...y){
		return write(x)||write(y...);
	}
	//no need to call flush at the end manually!
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
}
using io :: read;
using io :: putc;
using io :: write;
signed main(){
#ifdef QAQAutoMaton 
	freopen("A.in","r",stdin);
	freopen("A.out","w",stdout);
#endif
	int a,b,c,d,e;
	read(a,b,c,d,e);
	write((c*60+d)-(a*60+b)-e,'\n');

	return 0;
}



Measured memory_bytes: 3636
#abc107c

n,k=map(int,raw_input().split())
x=map(int,raw_input().split())
res=float('inf')
for i in xrange(n-k+1):
 l=x[i]
 r=x[i+k-1]
 res=min(res,abs(l)+abs(r-l),abs(r)+abs(l-r))
print res


Measured memory_bytes: 11344
times = int(input())
a = list(input())

alphabet = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S"\
            ,"T","U","V","W","X","Y","Z"]
for i in range(len(a)):
  b = alphabet.index(a[i])+times
  if 25 < b:
    b = b-26
  a[i]=alphabet[b]
for i in range(len(a)):
  print(a[i],end="")

Measured memory_bytes: 43352
from collections import deque
n,m = map(int,input().split())
li = [list(map(int,input().split())) for _ in range(m)]
g = [[] for _ in range(n)]
l = [float('inf')] * n

for x,y in li:
    x -= 1
    y -= 1
    g[x].append(y)
    g[y].append(x)

def bfs():
    que = deque()
    l[0] = 0
    que.append(0)
    while que:
        a = que.popleft()
        for i in g[a]:
            if l[i] != float('inf'):continue
            l[i] = a
            que.append(i)
bfs()
for i in l:
    if i == float('inf'):
        print('No')
        exit()
print('Yes')
for i in l[1:]:
    print(i+1)
        

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

int main(){

  int N, Y;
  cin >> N; //num of shihei
  cin >> Y; //sum

  int x, y, z;
  x = 0; //10000
  y = 0; //5000
  z = 0; //1000

  bool endflag = false;

  for (x = 0; x < N + 1; ++x) {
    for (y = 0; y < N + 1; ++y) {
      z = (Y - x * 10000 - y * 5000) / 1000;
      if ((z >= 0) && (x + y + z == N)) {
        cout << x << " " << y << " " << z << " " << endl;
        endflag = true;
      }
      if (endflag) {break;}
    }
    if(endflag) {break;}
  }
  if(endflag == false) {
    cout << "-1 -1 -1" << endl;
  }
}

Measured memory_bytes: 256
from itertools import permutations
from math import sqrt, factorial
import sys
input = sys.stdin.readline


def dist(xy1, xy2):
    x1, y1 = xy1
    x2, y2 = xy2
    return sqrt((x1-x2)**2 + (y1-y2)**2)


def main():
    n = int(input())
    lst = [tuple(map(int, input().split())) for _ in range(n)]
    sum_d = 0
    for perm in permutations(range(n)):
        d = 0
        for i in range(n-1):
            d += dist(lst[perm[i]], lst[perm[i+1]])
        sum_d += d
    print(sum_d / factorial(n))


if __name__ == "__main__":
    main()

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

int main(){
  int n;
  cin>>n;
  vector<int> a(n),b(n),c(n);
  rep(i,n) cin>>a[i];
  rep(i,n) cin>>b[i];
  rep(i,n) cin>>c[i];
  sort(ALL(a));
  sort(ALL(c));
  long long ans=0;
  rep(i,n){
    ans+=(lower_bound(ALL(a),b[i])-a.begin())
      *(c.end()-upper_bound(ALL(c),b[i]));
  }
  cout<<ans<<endl;  
}


Measured memory_bytes: 4564
#include <iostream>
#include <regex>
#include <string>

int main() {
  std::regex reg("^([^L][^R])*[^L]?$");
  std::string s;
  std::cin >> s;
  std::cout << (std::regex_match(s, reg) ? "Yes" : "No") << std::endl;
}

Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstddef>
#include<queue>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
    int n;
    cin >> n;
    if(n % 10 == 3) cout << "bon" << endl;
    else if(n % 10 == 0 ||n % 10 == 1 || n % 10 == 6 || n % 10 == 8) cout << "pon" << endl;
    else cout << "hon" << endl;
    return 0;
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

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

    string S, T;
    cin >> S >> T;
    int N = S.size();
    cout << ((S == T.substr(0, N)) ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 3656
#include<stdio.h>
#define N 1000000000

int main(){
  int n; scanf("%d",&n);
  int a[n],c=0;
  for(int i=0; i<n; i++){
    scanf("%d",&a[i]);
  }
  for(int i=0; i<n; i++)
    for(int j=0; j<i; j++){
      if(i!=j) c+=a[i]*a[j];
    }
  printf("%d\n",c);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <string>
#include <tuple>
using namespace std;
int main(void){
  int A,B,K;
  cin>>A>>B>>K;
  int count=0;
  for(int i=1;i<=100;i++){
    if(A%i==0&&B%i==0){ count++; }
  }
  int ans=0;
  for(int i=1;i<=100;i++){
      if(A%i==0&&B%i==0){ans++; if(ans==count-K+1){cout<<i; break;}}
  }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main (void)
{
	int se , h , m ,s;
	scanf("%d" , &se);
	h =  se / 3600;
	m = (se - h * 3600) / 60;
	s = se % 60;
    printf("%d:%d:%d\n" , h , m , s);
	return 0;
}



Measured memory_bytes: 2144
score = []

while True:
    m, f, r = map(int, input().split())
    total = m + f
    if m == -1 and f == -1 and r == -1:
        break
    if m == -1 or f == -1:
        score.append("F")
    elif total >= 80:
        score.append("A")
    elif total >= 65:
        score.append("B")
    elif total >= 50 or (r >= 50 and total >=30):
        score.append("C")
    elif total >= 30:
        score.append("D")
    else:
        score.append("F")
        
for i in range(len(score)):
    print(score[i])


Measured memory_bytes: 5600
import java.util.Scanner;

public class Main {
	    public static void main(String[] args) {
	        Scanner scan = new Scanner(System.in);
	        char c[] = scan.next().toCharArray();
	        if ((c[0] == c[1] && c[1] == c[2]) || (c[3] == c[2] && c[1] == c[2])) System.out.println("Yes");
	        else System.out.println("No");
	    }
	}


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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);

    ll D;
    cin >> D;

    cout << "Christmas";

    REP(i, 25-D){
        cout << " Eve";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<(int)(n);i++)
#define N 200000
#define K 205891132094649

int main() {
	int t;
	long long ww, xx, yy, zz;
	bool v;
	long long w, x, y, z;
	long long k,s, ans;
	scanf("%d", &t);
	f(tt, t) {
		scanf("%lld %lld %lld %lld", &ww, &xx, &yy, &zz);
		ww--;
		xx--;
		yy--;
		zz--;
		k = K;
		v = true;
		while (k>1) {
			k /= 3;
			w = ww / k;
			x = xx / k;
			y = yy / k;
			z = zz / k;
			if ((w == y) && (x == z))continue;
			if ((w != y) && (x != z))break;
			if (w != y) {
				swap(w, x);
				swap(y, z);
              	swap(ww, xx);
				swap(yy, zz);
			}
			if (w % 3 != 1)continue;
			if (abs(x - z) > 1) {
				s = (ww%k) + (yy%k);
				s = min(s+2, (2 * k) - s);
				printf("%lld\n", abs(zz - xx) + s);
				v = false;
				break;
			}
		}
		if (v) {
			printf("%lld\n", abs(zz - xx) + abs(yy - ww));
		}
	}

	return 0;
}


Measured memory_bytes: 256
s=input()
num1=s[:2]
num2=s[2:]
if(int(num1)<=12)and(int(num1)>=1):
  if(int(num2)<=12)and(int(num2)>=1):
    print('AMBIGUOUS')
  else:
    print('MMYY')
elif(int(num2)<=12)and(int(num2)>=1):
  print('YYMM')
else:
  print('NA')

Measured memory_bytes: 3064
import sys


class BinaryIndexedTree():
    '''
    1-indexed
    '''
    def __init__(self, A):
        self.__n = len(A)
        self.__node = [0] * (self.__n + 1)
        self.__data = [0] * (self.__n + 1)

        S = [0] * (self.__n + 1)
        for i in range(self.__n):
            S[i + 1] = S[i] + A[i]

        for i in range(1, self.__n + 1):
            self.__data[i] = A[i - 1]
            self.__node[i] = S[i] - S[i - (i & -i)]

    def add(self, i, v):
        self.__data[i] += v
        while i <= self.__n:
            self.__node[i] += v
            i += i & -i

    def sum(self, i):
        ''' [1, i]の和
        '''
        rst = 0
        while i > 0:
            rst += self.__node[i]
            i -= i & -i
        return rst
    
    def get(self, i, j):
        '''[i, j]の和
        '''
        if i == j:
            return self.__data[i]
        else:
            return self.sum(j) - self.sum(i - 1)


def main():
    N, Q = map(int, input().split())
    C = list(map(int, input().split()))

    P = [[] for _ in range(N)]
    for i, c in enumerate(C):
        P[c - 1].append(i)

    right = [0] * N
    for p in P:
        if len(p):
            right[p.pop()] = 1
    BIT = BinaryIndexedTree(right)

    query = [[] for _ in range(N)]
    for i in range(Q):
        l, r = map(int, sys.stdin.readline().split())
        query[r - 1].append((l - 1, i))

    ans = [None] * Q

    cur = N - 1
    for r, q in enumerate(reversed(query)):
        r = (N - 1) - r
        while q:
            l, i = q.pop()
            while r < cur:
                c = C[cur] - 1
                # BIT.update(cur + 1, 0)
                p = P[c]
                if len(p):
                    BIT.add(p.pop() + 1, 1)
                cur -= 1
            tmp = BIT.get(l + 1, r + 1)
            ans[i] = tmp

    print(*ans, sep='\n')


if __name__ == '__main__':
    main()


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
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 U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
	for(auto &e:u) fill_v<T>(e,v...);
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	if (s.size()%2) {
	  cout << "No" << endl;
	  return 0;
	}
	bool ok = 1;
	for (int64 i = 0; i < s.size(); i += 2) {
	  if (s.substr(i, 2) != "hi") {
	    cout << "No" << endl;
	    return 0;
	  }
	}
	cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    int n; cin >> n;
    for (int i = 0; i < n-1; i++)
        for (int j = i+1; j < n; j++)
            for (int k = 0; ; k++)
                if (((i^j) >> k) & 1) {
                    cout << k+1 << (j==n-1 ? '\n' : ' ');
                    break;
                }
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <cmath>
#include <cstdio>
using namespace std;
struct P{double x,y;};
#define rep(i,n) for(int i=0;i<n;i++)
const double EPS = 1e-15;
vector<P> cross(P a, P b){
	vector<P> ret;
	
	double x = a.x - b.x , y = a.y - b.y;
	double L = x * x + y * y;
	if(L > 4.0)return ret;
	
	L = sqrt(L);
	double C = atan2(b.y-a.y,b.x-a.x);
	double alpha = acos(L/2);
	
	P r1,r2;
	r1.x = a.x + cos(C+alpha) , r1.y = a.y + sin(C+alpha);
	r2.x = a.x + cos(C-alpha) , r2.y = a.y + sin(C-alpha);
	
	ret.push_back(r1) , ret.push_back(r2);
	
	return ret;
}

bool check(P cir , P pt){
	cir.x -= pt.x , cir.y -= pt.y;
	return (cir.x*cir.x + cir.y * cir.y) <= 1.0 + EPS;
}
int main(){
	int n;
	while(scanf("%d",&n) && n){
		int ret = 1;
		vector<P> data(n);
		vector<P> search;
		rep(i,n)scanf("%lf,%lf\n",&data[i].x,&data[i].y);
		
		rep(i,n){
			for(int j=i+1;j<n;j++){
				vector<P> get = cross(data[i],data[j]);
				rep(k,get.size())search.push_back(get[k]);
			}
		}
		rep(i,search.size()){
			int count = 0;
			rep(j,n)count += check(data[j],search[i]);
			ret = max(ret,count);
		}
		cout << ret << endl;
	}
}

Measured memory_bytes: 0