akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
#define all(x) (x).begin(),(x).end()

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

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(10);
    int N;
    cin >> N;
    string S,T;
    cin >> S >> T;
    string ans = "";
    REP(i,N){
        ans = ans + S[i] + T[i];
    }
    cout <<ans<< "\n";
}

Measured memory_bytes: 256
using System; //Console, IComparable
using System.IO; //StreamWriter 
using System.Linq; //Select(), Where(), OrderBy(), Count()
using System.Collections.Generic; //List<T>
using System.Reflection;

namespace NNN{
    public class CRun{
        private static class gv{
            public static int N {get; set;} = 0;
            public static int X {get; set;} = 0;
            public static int Y {get; set;} = 0;
        }
    
        public void build(){ string[] input;
            input = IC._s;
            
            var pi = typeof(gv).GetProperties();
            for (int i = 0; i < pi.Length; i++) {
                pi[i].SetValue(typeof(gv), int.Parse(input[i]));
            }
        }
    
        public void solve(){ StreamWriter so = new StreamWriter(Console.OpenStandardOutput());
            
            var ans = new int[gv.N +2]; Array.Clear(ans, 0, ans.Length);
            
            for (int start = 1; start < gv.N; start++) {
                for (int end = start + 1; end <= gv.N; end++) {
                    var pass_1 = end - start;
                    var pass_2 = Math.Abs(start - gv.X) + Math.Abs(end - gv.Y) +1;
                    ans[Math.Min(pass_1, pass_2)] += 1;
                }
            }
            
            for (int i = 1; i < gv.N; i++) {
                Console.WriteLine(ans[i]);
            }
        }
    }

    class Program { 
        static void Main() { 
            var run = new CRun();
            run.build();
            run.solve();
        } 
    }

    public static class IC{
        public static string _a{get{return Console.ReadLine();}}
        public static string[] _s{get{return (Console.ReadLine().Split());}}
    }
}

Measured memory_bytes: 13780
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		long cnt = 0, sum = 0;
		for (long i=0; i<N; i++) {
			long A = sc.nextLong();
			if (A==0) {
				cnt += sum/2;
				sum = 0;
			}
			sum += A;
		}
		cnt += sum/2;
		System.out.println(cnt);
		sc.close();
	}

}


Measured memory_bytes: 22988
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    deque<ll> d;
    rep(i, n) {
        int idx = lower_bound(d.begin(), d.end(), a[i]) - d.begin();
        if (idx == 0) {
            d.push_front(a[i]);
        }
        else {
            d[idx-1] = a[i];
        }
    }
    cout << d.size() << endl;
    return 0;
}


Measured memory_bytes: 4428
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;
typedef long double ld;
//typedef pair<int,int> P;
//ll const INF=1001001001;
//ll const INF=1001001001001001001;
ll const MOD=1000000007;

int X;

int main(){
    cin>>X;

    string ans="No";
    if(X>=30) ans="Yes";

    cout<<ans<<endl;
}

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

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

#define XX              first
#define YY              second
#define PB              push_back
#define MP              make_pair

#define NEWLINE         cerr << "\n";
#define HOISE           cerr << "hoise " << __LINE__ << "\n"
#define PAUSE           system("pause")
#define DEBUG(x)        cerr << #x << " = " << x << "\n"
#define FASTIO          ios_base::sync_with_stdio(false);cin.tie(NULL)

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

const int INF = 1e9 + 23;
const ll INFL = 2e18 + 23;

int32_t main()
{
    string s;
    cin >> s;
    int n = s.size();
    for(int i = 0; i < n; i++){
        if(s[i]=='?'){
            s[i] = 'D';
        }
    }        
    cout << s;

    return 0;
}

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

int main() {

  string S;

  cin >> S;

  bool Aflg = false;
  bool Bflg = false;

  for(int i=0; i<S.size(); i++){
    if(S.at(i) == 'A'){
      Aflg = true;
    }else{
      Bflg = true; 
    }
    if(Aflg&&Bflg){
      break;
    }
  }

  if(Aflg&&Bflg){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }

}


Measured memory_bytes: 256
N = int(input())
s = []
for _ in range(N) :
    s.append(input())

countDic = {}

for i in range(N) :
    dic = {}
    for ss in s[i] :
        if ss in dic :
            dic[ss] += 1
        else :
            dic[ss] = 1
    sortedS = ''.join(sorted(list(s[i])))
    #print(sortedS)
    if sortedS in countDic :
        countDic[sortedS] += 1
    else :
        countDic[sortedS] = 1

ans = 0

for k in countDic :
    number = countDic[k] - 1
    ans += number * (number + 1) // 2


print(ans)


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

using namespace std;

int n,cnt[1<<20],d;

int main() {
    int i,x;
    
    scanf("%d", &n);
    for(i=1;i<=n;i++) {
        scanf("%d", &x);
        ++cnt[x];
        d=max(d,x);
    }
    if(d==1 && n!=2) {
        printf("Impossible\n");
        return 0;
    }
    if(d&1) {
        if(cnt[((d+1)>>1)]!=2) {
            printf("Impossible\n");
            return 0;
        }
        for(i=d;i>((d+1)>>1);i--) {
            if(cnt[i]<2) {
                printf("Impossible\n");
                return 0;
            }
        }
        for(i=1;i<((d+1)>>1);i++) {
            if(cnt[i]>0) {
                printf("Impossible\n");
                return 0;
            }
        }
        printf("Possible\n");
    }
    else {
        if(cnt[d>>1]!=1) {
            printf("Impossible\n");
            return 0;
        }
        for(i=d;i>(d>>1);i--) {
            if(cnt[i]<2) {
                printf("Impossible\n");
                return 0;
            }
        }
        for(i=1;i<(d>>1);i++) {
            if(cnt[i]>0) {
                printf("Impossible\n");
                return 0;
            }
        }
        printf("Possible\n");
    }

    return 0;
}


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

bool IsPrime(int n){
	for(int i=2;i*i<=n;i++){
		if(n%i == 0){return false;}
	}
	return true;
}

int main(void) {
	int count =0;
	int n;
	cin >> n;
	for(int i=0;i<n;i++){
		int p;
		cin >> p;
		if(IsPrime(p)){
			count++;
		}
	}
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 3036
import java.io.*;

class Point {
	Point(double x, double y) {
		this.x = x;
		this.y = y;
	}
	@Override
	public String toString() {
		return this.x + " " + this.y;
	}
	public double x, y;
}

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		Point p1 = new Point(0.0, 0.0);
		Point p2 = new Point(100.0, 0.0);
		System.out.println(p1);
		kochcurv(p1, p2, n);
		System.out.println(p2);
	}
	public static void kochcurv(Point p1, Point p2, int n) {
		if (n == 0) {
			return;
		}
		Point s, t, u;
		s = new Point(
			(2.0 * p1.x + p2.x) / 3.0, (2.0 * p1.y + p2.y) / 3.0);
		t = new Point(
			(p1.x + 2.0 * p2.x) / 3.0, (p1.y + 2.0 * p2.y) / 3.0);
		u = new Point(
			(t.x - s.x) * Math.cos(RADIAN_60) - (t.y - s.y) * Math.sin(RADIAN_60) + s.x,
			(t.x - s.x) * Math.sin(RADIAN_60) + (t.y - s.y) * Math.cos(RADIAN_60) + s.y);
		kochcurv(p1, s, n - 1);
		System.out.println(s);
		kochcurv(s, u, n - 1);
		System.out.println(u);
		kochcurv(u, t, n - 1);
		System.out.println(t);
		kochcurv(t, p2, n - 1);
	}
	public static final double RADIAN_60 = Math.PI * 60.0 / 180.0;
}

Measured memory_bytes: 30632
#include <cstdio>
#include <algorithm>
using namespace std;

int main() {
        int n, a;
        scanf("%d", &n);
        int ans = 50;
        for (int i = 0; i < n; i ++) {
                scanf("%d", &a);
                ans = min(ans, __builtin_ctz(a));
        }
        return !printf("%d\n", ans);
}


Measured memory_bytes: 128
import java.io.*; 
import java.util.Scanner;
import java.lang.Math;

public class Main {
  
	public static void main(String[] args){
      	Scanner in = new Scanner(System.in);
		int N = in.nextInt();
      	int[] weigths = new int[N];
      
      	for(int i=0;i<N;i++){
        	weigths[i]= in.nextInt();
        }
        
      	if(N>1) System.out.println(balance(weigths, N));
      	else System.out.println(weigths[0]);
	}
  	
    public static int balance(int[] weigths, int n){
      	int S1 = weigths[0];
      	int S2 = weigths[weigths.length-1];
      	int indexL = 1;
      	int indexR = weigths.length-2;
      	int counter = n-2;
      	while(counter>0){
        	if(S1<=S2){
              S1+=weigths[indexL];
              indexL++;
              counter--;
            }else{
              S2+=weigths[indexR];
              indexR--;
              counter--;
            }
        }
      	int ret = S1-S2;
      	return Math.abs(ret);
    }
}


Measured memory_bytes: 23764
n = int(input())
a = [int(input()) for i in range(n)]

max_num = max(a)
max_pos = a.index(max(a))
a[max_pos] = -1
second_max = max(a)

for i in range(n):
    if i == max_pos:
        print(second_max)
    else:
        print(max_num)

Measured memory_bytes: 12608
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define IFOR(i, m, n) for(ll i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main(){
  ll n; cin >> n;
  // vector<ll> p(n);
  // iota(ALL(p),1);
  // ll ans = 0;
  // do{
  //   ll t = 0;
  //   FOR(i,1,n+1){
  //     t += i%p[i-1];
  //   }
  //   ans = max(ans,t);
  // }while(next_permutation(ALL(p)));
  // cout << ans << endl;
  cout << n*(n-1)/2 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
using namespace std;
typedef long long int ll;


int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n,m,k; cin >> n >> m >> k;
    vector<ll> a(n),b(m);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    vector<ll> sum(m+1,0);
    for(int i=0;i<m;i++){
        cin >> b[i];
        sum[i+1]=sum[i]+b[i];
    }
    int res=0;
    ll su=0;
    for(int i=0;i<n;i++){
        su+=a[i];
        if(su>k)break;
        int p=upper_bound(sum.begin(), sum.end(),k-su)-sum.begin()-1;
        res=max(res,i+1+p);
    }
    int p=upper_bound(sum.begin(), sum.end(),k)-sum.begin()-1;
    res=max(res,p);
    cout << res << endl;
}

Measured memory_bytes: 7932
#include<iostream>
#include<cstdio>
using namespace std;
typedef long long ll;
const int MAXN=1e6+10;
ll dvd[MAXN],num,n;
void get_dvd(ll len){
    num=0;
    for(ll i=1;i*i<=len;i++){
        if(i*i==len){
            dvd[++num]=i;
            break;
        }else if(len%i==0){
            dvd[++num]=i;
            dvd[++num]=len/i;
        }
    }
}
int main(){
    scanf("%lld",&n);
    get_dvd(n-1);
    int res=num-1;
    get_dvd(n);
    for(int i=2;i<=num;i++){
        ll tmp=n;
        while(tmp%dvd[i]==0) tmp/=dvd[i];
        if(tmp%dvd[i]==1) res++;
    }
    printf("%d",res);
    return 0;
}


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


#define long long long int

using namespace std;

typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef pair<int, int> pi;


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

    int n;
    cin >> n;
    cout << (n + 1) / 2;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  int s;
  cin >> s;
  map<int,bool> mp;
  int cnt = 0;
  while (0 == 0) {
    if (mp[s] == true) {
      break;
    }
    mp[s] = true;
    if (s % 2 == 0) {
      s /= 2;
    } else {
      s = (3 * s) + 1;
    }
    cnt++;
  }
  cout << cnt+1 << endl;
  return 0;
}

Measured memory_bytes: 3640
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
using namespace std;
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 INF = 1LL << 60;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(){
    int64_t n;
    cin>>n;
    int m;
    cin>>m;
    vector<int> a(m);
    int64_t Sum=0;
    rep(i,m){
        cin>>a.at(i);
        Sum+=a.at(i);
    }
    if(n-Sum>=0) cout<<n-Sum<<endl;
    else cout<<-1<<endl;
}

Measured memory_bytes: 3632
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math;

int[3][3] CS;

void main()
{
    foreach (i; 0..3)
        CS[i][] = readln.split.to!(int[])[];

    foreach (a1; 0..201) {
        if (a1 > CS[0][0] || a1 > CS[0][1] || a1 > CS[0][2]) continue;

        auto b1 = CS[0][0] - a1;
        if (b1 > CS[1][0] || b1 > CS[2][0]) continue;

        auto a2 = CS[1][0] - b1;
        auto a3 = CS[2][0] - b1;

        auto b2 = CS[0][1] - a1;
        if (a2 + b2 != CS[1][1] || a3 + b2 != CS[2][1]) continue;

        auto b3 = CS[0][2] - a1;
        if (a2 + b3 != CS[1][2] || a3 + b3 != CS[2][2]) continue;

        writeln("Yes");
        return;
    }
    writeln("No");
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    Map<String, Integer> map = new HashMap<>();
 
    for (int i = 0; i < N; i++) {
      String key = sc.next();
      map.computeIfPresent(key, (k, v) -> (v + 1));
      map.putIfAbsent(key, 1);
    }
 
    List<Integer> list = new ArrayList<>();
    map.entrySet().forEach(e -> list.add(e.getValue()));
    Collections.sort(list, Comparator.reverseOrder());
    int ans = list.stream().skip(K).mapToInt(n -> n).sum();
    System.out.println(ans);
    sc.close();
  }
}

Measured memory_bytes: 77424
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll inf=1e9+7;
const ll mod=998244353;
int main(){
    ll n;
    ll k;
    cin>>n>>k;
    set<ll>s;
    rep(i,k){
        ll t;cin>>t;
        s.insert(t);
    }
    REP(i,n,100000){
        ll t=i;
        bool f=1;
        while(t){
            if(s.find(t%10)==s.end());
            else f=0;
            t/=10;
        }
        if(f){
            cout<<i<<endl;
            break;
        }
    }
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <set>
#include <string>
#include <iostream>
#include <cassert>
#include <cmath>
using namespace std;

int main() {
        int h, w;
        scanf("%d%d", &h, &w);
        vector<string> s(h);
        for (int i = 0; i < h; i ++) {
                cin >> s[i];
        }
        bool ans = true;
        static const int dy[] = { -1, 0, 1, 0 }, dx[] = { 0, -1, 0, 1 };
        for (int i = 0; i < h; i ++) {
                for (int j = 0; j < w; j ++) {
                        if (s[i][j] == '#') {
                                bool ok = false;
                                for (int d = 0; d < 4; d ++) {
                                        int ni = i + dy[d], nj = j + dx[d];
                                        if (ni < 0 || ni >= h || nj < 0 || nj >= w) continue;
                                        if (s[ni][nj] == '#') {
                                                ok = true;
                                        }
                                }
                                ans = ans && ok;
                        }
                }
        }
        puts(ans ? "Yes" : "No");
        return 0;
}



Measured memory_bytes: 256
N, M = map(int, input().split())
A = []

for i in range(N):
    A.append([int(m) for m in input().split()])
    A[i].pop(0)
cnt =0
for i in range(1,M+1):
    flag = 1
    for k in range(N):
        if i not in A[k]:
            flag = 0
    if flag == 1:
        cnt += 1
        

print(cnt)

Measured memory_bytes: 3060
#include <iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
  
int main(){
    string S;
    char a,b;
    cin>>S;
    if(S.size()==2){
        cout<<S<<endl;
    }
    else{
    a=S.at(0);
    b=S.at(2);
    S.at(0)=b;
    S.at(2)=a;
        cout<<S<<endl;
    }
    
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define MOD 1000000007
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;

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

int main() {
    int N;
    cin >> N;
    vector<P> list(N);
    rep(i,N) {
        cin >> list[i].first;
        list[i].second = i + 1;
    }

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

    rep(i,N) {
        if (i == 0) cout << list[i].second;
        else cout << " " << list[i].second;
    }

    cout << endl;

    return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
int n;
string str,res;
map<char,char> opp;
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	opp['S']='W';
	opp['W']='S';
	cin>>n>>str;
	for(int i=0;i<n;i++)
		res+="?";
	res[0]='S';
	res[n-1]='S';
	while(1){
		bool ok=true;
		for(int i=0;i<n;i++){
			if(str[i]=='o'&&res[i]=='S'||str[i]=='x'&&res[i]=='W'){
				if(res[(i+1)%n]!=res[(i-1+n)%n]&&res[(i+1)%n]!='?')
				{
					ok=false;
					break;
				}
				res[(i+1)%n]=res[(i-1+n)%n];
			}
			else{
				if(res[(i+1)%n]==res[(i-1+n)%n]&&res[(i+1)%n]!='?')
				{
					ok=false;
					break;
				}
				res[(i+1)%n]=opp[res[(i-1+n)%n]];
			}
		}
		if(ok){
			cout<<res<<endl;
			return 0;
		}
		for(int i=1;i<n-1;i++)
			res[i]='?';
		if(res[0]=='S'&&res[n-1]=='S')
			res[n-1]='W';
		else if(res[0]=='S'&&res[n-1]=='W')
			res[0]='W',res[n-1]='S';
		else if(res[0]=='W'&&res[n-1]=='S')
			res[n-1]='W';
		else
			break;
	}
	cout<<-1<<endl; 
	return 0;
}
//OWN

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long int N,Q;
    cin >> N >> Q;
    int w[N],p[N];
    for(int i=0;i<N;i++)
    {
        cin >> w[i];
        cin >> p[i];
    }
    long long int Arr[N][Q+1];
    for(long int i=0;i<N;i++)
    {
        for(long int j=0;j<=Q;j++)
        {
            if(j==0)
            {
                Arr[i][j]=0;
            }
            else if(i==0)
            {
                if(j<w[i])
                {
                    Arr[i][j]=0;
                }
                else
                    Arr[i][j]=p[i];
            }
            else{
                if(j-w[i]>=0)
                {
                    Arr[i][j]=max(p[i]+Arr[i-1][j-w[i]],Arr[i-1][j]);
                }
                else
                    Arr[i][j]=Arr[i-1][j];
            }

        }
    }
    cout << Arr[N-1][Q];

}


Measured memory_bytes: 78336
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

int main() {
    int n, y;
    cin >> n >> y;
    
    int ans1 = -1, ans2 = -1, ans3 = -1;
    for (int i = 0; i <= n; i++) {
        for (int j = 0; i + j <= n; j++) {
            int k = n - i - j;
            int hantei = 10000 * i + 5000 * j + 1000 * k;
            if (hantei == y) {
                ans1 = i, ans2 = j, ans3 = k;
                break;
            }
        }
    }
    printf("%d %d %d\n", ans1, ans2, ans3);
    return 0;
    
}

Measured memory_bytes: 256
N = int(input())
L = list(map(int,input().split()))
L.sort()
ans = 0
for i in range(N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            if (L[i] == L[j] or L[j] == L[k] or L[i] == L[k]):
                continue
            else:
                if L[i]+L[j] > L[k] and L[j]+L[k] > L[i] and L[i]+L[k] > L[j]:
                    ans += 1
print(ans)

Measured memory_bytes: 9216
#include <iostream>
using namespace std;
int main()
{
	int n, t, a,b;
	int m = 0,k = 1000;
	cin >> n >> t;
	for (int i = 0; i < n; ++i) {
		cin >> a >> b;
		if (b <= t) {
			if (a < k)k = a;
			m = 1;
		}
	}
	if(m==1)cout << k << "\n";
	else cout << "TLE" << "\n";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,c=0;
  cin>>n;
  bool b=false;
  int a[n+1];
  for(int i=1;i<=n;i++){
    cin>>a[i];
    if(a[i]==i){
      if(b){
        swap(a[i],a[i-1]);
        c++;
        b=false;
      }else{
        b=true;
      }
    }else{
      b=false;
    }
  }
  for(int i=1;i<=n;i++){
    if(i==a[i]) c++;
  }
  cout<<c;
}

Measured memory_bytes: 640
#include<cstdio>


using namespace std;

inline int In(){
	char c=getchar(); int x=0,ft=1;
	for(;c<'0'||c>'9';c=getchar()) if(c=='-') ft=-1;
	for(;c>='0'&&c<='9';c=getchar()) x=x*10+c-'0';
	return x*ft;
}

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

int A,B,C;

int main(){
	A=In(); B=In(); C=In();
	printf("%d\n",min(A+B+1,C)+B);
	return 0;
}

Measured memory_bytes: 128
import sys
from collections import deque
import bisect
import copy
import heapq
import itertools
import math
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


def main():
    N = int(input())
    S = input().strip()

    W = S.count("W")
    R = S[N - W:].count("R") 
    print(R)


if __name__ == "__main__":
    main()


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

int main(){

ll n;
cin>>n;
ll a[n+1],ans=0;
for(ll i=1;i<=n;i++)
{
    cin>>a[i];
    if(i%2!=0)
    if(a[i]%2!=0)
        ans++;
}
cout<<ans<<endl;
return 0;
}


Measured memory_bytes: 3564
using System;

class Program
{
    static void Main(string[] args)
    {
        var s = Console.ReadLine();

        var max = 0;
        var tmp = 0;
        for (int i = 0; i < s.Length; i++)
        {
            if (s[i] == 'A' ||
                s[i] == 'C' ||
                s[i] == 'G' ||
                s[i] == 'T')
            {
                tmp++;
                max = Math.Max(max, tmp);
            }
            else
            {
                tmp = 0;
            }
        }

        Console.WriteLine(max);
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define INFF 9223372036854775807
#define ll long long
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,m,n) for(int i=m;i<n;i++)
#define ALL(N) (N.begin(),N.end())

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int A, B;
  cin >> A >> B;
  if(A>=B) swap(A,B);
  if((B-A)%2==0) {
    cout << (B-A)/2+A << endl;
  }
  else cout  << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 256
#include <cstdio>

using namespace std;

int main()
{
  int N;
  scanf(" %d ", &N);
  for (int i = 0; i < N; i++) {
    int a[3];
    for (int j = 0; j < 3; j++) {
      scanf(" %d ", &a[j]);
    }
    for (int j = 0; j < 3; j++) {
      if (a[j] * a[j] == a[(j + 1) % 3] * a[(j + 1) % 3] + a[(j + 2) % 3] * a[(j + 2) % 3]) {
	printf("YES\n");
	goto next;
      }
    }
    printf("NO\n");
  next:;
  }
}

Measured memory_bytes: 0
#include<stdio.h>
#define MAX 10000
#define NIL -1

struct Node { int p, l, r; };
struct Node T[MAX];
int n;

void preParse (int u){
    if ( u == NIL ) return;
    printf(" %d", u);
    preParse(T[u].l);
    preParse(T[u].r);
}

void inParse (int u){
    if ( u == NIL ) return;
    inParse(T[u].l);
    printf(" %d", u);
    inParse(T[u].r);
}

void postParse (int u){
    if ( u == NIL ) return;
    postParse(T[u].l);
    postParse(T[u].r);
    printf(" %d", u);
}

int main() {
    int i, v, l, r, root;
    
    scanf("%d", &n);
    for ( i = 0; i < n; i++ ){
        T[i].p = NIL;
    }
    
    for ( i = 0; i < n; i++ ){
        scanf("%d %d %d", &v, &l, &r);
        T[v].l = l;
        T[v].r = r;
        if( l != NIL ) T[l].p = v;
        if( r != NIL ) T[r].p = v;
    }
    
    for ( i = 0; i < n; i++ ) if ( T[i].p == NIL ) root = i;
    
    printf("Preorder\n");
    preParse(root);
    printf("\n");
    printf("Inorder\n");
    inParse(root);
    printf("\n");
    printf("Postorder\n");
    postParse(root);
    printf("\n");

    return 0;
    
}

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

int main() {
  int n;
  cin >> n;
  
  long long sum = 0;
  
  for(int i = 1; i < n+1 ; i++){
    if(i%3!=0 && i%5!=0){
      sum += i;
    }
    else{
      continue;
    }
    
  }
    
    cout << sum << endl;
}

Measured memory_bytes: 3608
//
#include <vector>
#include <set>
#include <array>
#include <iostream>
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <numeric>
#include <bitset>
//
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);++i)
inline void yes(bool cond) { cond ? puts("Yes") : puts("No"); }
template<typename Type> inline void chmin(Type& a, Type b) { if (a > b) a = b; }
template<typename Type> inline void chmax(Type& a, Type b) { if (a < b) a = b; }
template<typename Arr, typename Type> inline void fill(Arr& arr, Type v) { std::fill(arr.begin(), arr.end(), v); }
template<typename Type> inline void sort(Type& arr) { std::sort(arr.begin(), arr.end()); }
template<typename Type> inline Type nth(vector<Type>& arr, size_t pos) { std::nth_element(arr.begin(), arr.begin() + pos, arr.end()); return arr[pos]; }
constexpr double BIGP = 1000000007L;
constexpr double INF_I = std::numeric_limits<double>::max();
constexpr double INF_F = std::numeric_limits<float>::infinity();
constexpr double PI = 3.14159265358979323846L;
//
int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    vector<ll> buka(N, 0);
    rep(i, N - 1)
    {
        ll a;
        cin >> a;
        --a;
        ++buka[a];
    }
    rep(i, N) cout << buka[i] << endl;
    //
    return 0;
}

Measured memory_bytes: 4376
#include <bits/stdc++.h>
using namespace std;
#define fr(i,k,n) for(int i=k;i<n;i++)
#define read(x) cin>>x
#define ll long long int
#define mod 1000000007 
#define print(x) cout<<x<<endl
#define pb(x) push_back(x)
#define fastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main() { 
    fastIO;
     int t=1,n,m;
    // cin>>t;
     while(t--){cin>>n>>m;
                vector<int>v;
                int input;
                int sum=0;
                fr(i,0,m)
                {
                cin>>input;
                  v.push_back(input);
                  sum+=v[i];
                }
                if(n>=sum)
                cout<<n-sum<<endl;
                else
                  cout<<-1<<endl;
         
         
     }
	 
	return 0;
}
 

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

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

	ios::sync_with_stdio(false);
	cin.tie();
	cout.tie();
	return 0;
}

Measured memory_bytes: 3860
def main():
    n, s = int(input()), input()

    w, e = [0 for i in range(n+1)], [0 for i in range(n+1)]
    for i in range(1, n+1):
        if s[i-1] == 'W':
            w[i] = w[i-1] + 1
        else:
            w[i] = w[i-1]
        if s[i-1] == 'E':
            e[i] = e[i-1] + 1
        else:
            e[i] = e[i-1]

    p_lst = []
    for i in range(n):
        p_lst.append(w[i]+e[n]-e[i+1])

    print(min(p_lst))


if __name__ == '__main__':
    main()


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

int main() {
  stack<int> s;
  int a, b;
  char c[3];
  while(cin>>c) {
    if (c[0] == '+') {
      b = s.top();
      s.pop();
      a = s.top();
      s.pop();
      s.push(a + b);
    } else if (c[0] == '-') {
      b = s.top();
      s.pop();
      a = s.top();
      s.pop();
      s.push(a - b);
    } else if (c[0] == '*') {
      b = s.top();
      s.pop();
      a = s.top();
      s.pop();
      s.push(a * b);
    } else {
      s.push(atoi(c));
    }
  }
  cout << s.top() << endl;
};



Measured memory_bytes: 3132
def solve(x):
    if x >= 30:
        return "Yes"
    else:
        return "No"


def main():
    x = int(input())
    res = solve(x)
    print(res)


def test():
    assert solve(25) == "No"
    assert solve(30) == "Yes"


if __name__ == "__main__":
    test()
    main()


Measured memory_bytes: 9064
a,b,c,x,y = map(int,input().split())

all_ab = a*x + b* y
all_c = max(x,y) * 2 *c

if x>y:
    mix_abc = (x-y)*a + y*2*c
else:
    mix_abc = (y-x)*b + x*2*c

# print(all_ab)
# print(all_c)
# print(mix_abc)

print(min(all_ab, all_c, mix_abc))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define RNG(i,from,to) for(int i=(from); i<(int)(to); i++)
#define gcd(i,j) __gcd((i), (j))
typedef long long ll;
typedef pair<int, int> pii;
template<typename T> void show(T e){ cout << e << endl; }
template<typename T> void show(const vector<T>& v){ for(const auto& e : v){ cout << e << " "; } cout << endl; }
template<typename T> void show(const vector<vector<T>>& vv){ for(const auto& v : vv){ show(v); } }
template<class Iter> void show(Iter first, Iter last){ for(auto it=first; it != last; it++){ cout << *it << " "; }; cout << endl; }
const ll DVSR = 1e9+7;
template <typename T> T modpow(T base, T exp, T modulus) {
  base %= modulus; T result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % modulus;
    base = (base * base) % modulus;
    exp >>= 1;
  }
  return result;
}


ll modpow(ll x, ll n) {
  ll res = 1;

  while (n > 0) {
    if (n&1) res = res*x%DVSR;
    x = x*x%DVSR;
    n /= 2;
  }
  return res;
}

int main(int argc, char const *argv[])
{
  ll N; cin >> N;
  vector<ll> CS(N);
  REP(i, N) cin >> CS[i];
  sort(CS.begin(), CS.end(), greater<ll>());
  ll res = 0;
  RNG(i, 1, N+1) {
    res += CS[i-1]*(i+1);
    res %= DVSR;
  }
  cout << (modpow(4,N-1)*res % DVSR) << endl;
}


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

#define pb push_back
#define mp make_pair

const int MAX_N = 55;
int N, M, Q;
int a[MAX_N],b[MAX_N],c[MAX_N],d[MAX_N];
ll ans = 0;

void dfs(int at, int lb, vector<int> A)
{
	if(at == N){
		ll res=0;
		for(int i=0;i<Q;++i){
			int x=a[i]-1,y=b[i]-1;
			if(A[y]-A[x]==c[i]) res+=d[i];
		}
		ans=max(ans,1LL*res);
		return;
	}
	for(int x=lb;x<=M;++x){
		A[at]=x;
		dfs(at+1,x,A);
		A[at]=-1;
	}
}

void solve()
{
	vector<int> v(N);
	dfs(0, 1, v);
	cout << ans << '\n';
}

int main()
{
	ios::sync_with_stdio(false);
	cin >> N >> M >> Q;
	for(int i=0;i<Q;++i){
		cin >> a[i] >> b[i] >> c[i] >> d[i];
	}
	solve();
	return 0;
}

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

#define MAX_V 110
const int INF = 1e9;

int cost[MAX_V][MAX_V];
int mincost[MAX_V];
bool used[MAX_V];
int V;

int prim(){
  for(int i = 0 ; i < V ; i++){
    mincost[i] = INF;
    used[i] = false;
  }
  mincost[0] = 0;
  int res = 0;
  
  while(true){
    int v = -1;
    for(int u = 0 ; u < V ; u++){
      if(!used[u] && (v == -1 || mincost[u] < mincost[v])) v = u;
    }
    if(v == -1) break;
    
    used[v] = true;
    res += mincost[v];
    for(int u = 0 ; u < V ; u++){
      mincost[u] = min(mincost[u], cost[v][u]);
    }
  }
  return res;
}

void init(){
  for(int i = 0 ; i < MAX_V ; i++){
    mincost[i] = used[i] = 0;
    for(int j = 0 ; j < MAX_V ; j++){
      cost[i][j] = INF;
    }
  }  
}

int main(){
  int n, m;
  while(cin >> n, n){
    init();
    cin >> m;
    V = n;
    int from, to, C;
    for(int i = 0 ; i < m ; i++){
      scanf("%d,%d,%d", &from, &to, &C);
      cost[from][to] = C - 100;
      cost[to][from] = C - 100;
    }
    
    int ans = prim();
    cout << ans / 100 << endl;    
  }
  
  return 0;
}

Measured memory_bytes: 1292
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <deque>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <fstream>
#define debug(x) cout << #x << " = " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,n) for(int i = (n); i > -1; i--)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const ll LINF = 1e18;
const double EPS = 1e-9;


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

  int n,k;
  cin>>n>>k;
  int a[n];
  rep(i,n) cin>>a[i];
  bool dp[k+1];
  rep(i, a[0]) dp[i] = false;
  for(int i = a[0]; i <= k; i++) {
    dp[i] = false;
    rep(j, n) {
      if(i - a[j] >= 0 && !dp[i - a[j]]) dp[i] = true;
    }
  }
  if(dp[k]) {
    cout << "First" << endl;
  } else {
    cout << "Second" << endl;
  }

  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define rep(i,j,k) for(int i=(int)j;i<=(int)k;i++)
#define per(i,j,k) for(int i=(int)j;i>=(int)k;i--)
using namespace std;
typedef long long LL;
const int N=505;
char a[N][N];bool b[N][N];
int n;
bool col[N][2];
int main(){
    scanf("%d",&n);
    rep(i,1,n)scanf("%s",a[i]+1);
    rep(i,1,n)rep(j,1,n)b[i][j]=(a[i][j]=='#');
    bool flag=0;
    rep(i,1,n)rep(j,1,n){
        flag|=b[i][j];
        col[j][b[i][j]]=1;
    }
    if(!flag){
        printf("-1\n");return 0;
    }
    int ans=100000000;
    rep(i,1,n){
        int res=(1^col[i][1]);
        rep(j,1,n)if(!b[i][j])res++;
        rep(j,1,n)if(col[j][0])res++;
        ans=min(ans,res);
    }
    printf("%d\n",ans);
    return 0;
}









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

int main(){
    ll H;
    cin >> H;
    ll monster_num = 1;
    ll ans = 0;
    while(true){
        if (H == 1){
            ans += monster_num;
            break;
        }
        else{
            H /= 2;
            ans += monster_num;
            monster_num *= 2;
        }
    }
    cout << ans << endl;
}



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

int main(void){
    int a,b,c;
    cin >> a >> b >> c;
    if (a==b)
    {
        cout << c <<endl;
    }
    else if (a==c)
    {
        cout << b << endl;
    }else
    {
        cout << a << endl;
    }
    return 0;
}

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

int main()
{
    char op1,op2,x;
    map<char,int> mp;
    for(int i=0;i<10;i++)
    {
        x=(char)('0'+i);
        mp[x]=i;
    }
    mp['A']=10;mp['B']=11;mp['C']=12;mp['D']=13;mp['E']=14;mp['F']=15;
    cin>>op1>>op2;
    if(mp[op1]>mp[op2]) cout<< '>' <<endl;
    else if(mp[op1]<mp[op2]) cout<< '<' <<endl;
    else cout<< '=' <<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int N;
	scanf("%d", &N);

	if (N == 1) {
		puts("Hello World");
	} else {
		int A, B;
		scanf("%d %d", &A, &B);
		printf("%d\n", A + B);
	}
	return 0;
}


Measured memory_bytes: 128
// Problem : E - Simple String Queries
// Contest : AtCoder - AtCoder Beginner Contest 157
// URL : https://atcoder.jp/contests/abc157/tasks/abc157_e
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define int long long
#define db double
#define mod 1000000007
#define pb push_back
#define pp pair<int,int>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repe(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=b;i>=a;i--)
#define maxn 500005
#define ss second
#define ff first
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
int inv(int a, int b){
 return 1<a ? b - inv(b%a,a)*b/a : 1;
}
int st[maxn][26];
int n,q;
string str;
int ind;
void update(int j,int val,int ind)
{
	int i=j;
	while(i<=n)
	{
		if(ind >=0)
		st[i][ind]--;
		st[i][val]++;
		i+=(i&-i);
	}
}
int ans[26];
void query(int ind,int flag)
{
	int i=ind;
	while(i>0)
	{
		for(int j=0;j<26;j++)
		{
			if(flag)
				ans[j]+=st[i][j];
			else ans[j]-=st[i][j];
		}
		i-=(i&-i);
	}
}
void solve()
{
	cin >> n;
	cin >> str;
	cin >> q;
//	build(1,0,n-1);
	for(int i=0;i<n;i++)
	update(i+1,str[i]-'a',-1);
	while(q--)
	{
		int t;
		cin >> t;
		if(t==1)
		{
			int i;
			char x;
			cin >> i >> x;
			update(i,x-'a',str[i-1]-'a');
			str[i-1]=x;
		}
		else{
			int i,j;
			cin >> i >> j;
			//cout << i <<" "<<j<<"\n";
			query(j,1);
			query(i-1,0);
			int cnt=0;
			rep(k,0,26){
				if(ans[k]>0)
				{
					//cout << (char)(k+'a') <<" ";
					cnt++;
					}
				ans[k]=0;
			}
			cout << cnt <<"\n";
		}
	}
}
signed main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

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


Measured memory_bytes: 105336
#include <bits/stdc++.h>
      
#define FOR(i,a,b) for( ll i = (a); i < (ll)(b); i++ )
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort( (x).begin(),(x).end() )
#define REVERSE(x) reverse( (x).begin(),(x).end() )
#define UNIQUE(x) (x).erase( unique( ALL( (x) ) ) , (x).end() )
#define PW(x) (1LL<<(x))
#define SZ(x) ((ll)(x).size())
#define SHOW(x) cout << #x << " = " << x << endl
#define SHOWA(x,n) for( int yui = 0; yui < n; yui++ ){ cout << x[yui] << " "; } cout << endl

#define pb emplace_back
#define fi first
#define se second

using namespace std;

typedef long double ld;
typedef long long int ll;
typedef pair<ll,ll> pl;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<pl> vpl;
typedef vector<vpl> gr;
typedef vector<vl> ml;
typedef vector<vd> md;
     
const ll INF = (ll)1e9 + 10;
const ll INFLL = (ll)1e18 + 10;
const ll MOD = 1e9+7;
     
template<class T> T &chmin( T &a , const T &b ){ return a = min(a,b); }
template<class T> T &chmax( T &a , const T &b ){ return a = max(a,b); }
template<class T> inline T sq( T a ){ return a * a; }

ll in(){ long long int x; scanf( "%lld" , &x ); return x; }
char yuyushiki[1000010]; string stin(){ scanf( "%s" , yuyushiki ); return yuyushiki; }

// head

struct BIT{
  vector<ll> node;
  ll size;
  BIT(int n){
    size = 1;
    while(size < n){
      size *= 2;
    }
    node = vector<ll>(size, 0);
  }
  void add(ll p, ll x){
    for(ll i = p+1; i <= size; i += i&-i){
      node[i] += x;
    }
  }
  ll sum(ll p){
    ll res = 0;
    for(ll i = p; i > 0; i -= i&-i){
      res += node[i];
    }
    return res;
  }
};

using P = tuple<ll, ll>;

ll n, k;
ll a[200010];
ll s[200010];

int main(){

  n = in();
  k = in();
  REP(i, n){
    a[i] = in();
  }
  REP(i, n){
    s[i+1] = s[i] + a[i];
  }

  vector<P> v;
  REP(i, n+1){
    v.pb(s[i]-k*i, i);
  }

  SORT(v);
  REVERSE(v);

  BIT bit(n+1);

  ll ans = 0;
  REP(i, n+1){
    ll p = get<1>(v[i]);
    ans += i - bit.sum(p);
    bit.add(p, 1);
  }

  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 10480
#include<bits/stdc++.h>
using namespace std;
#define rkc ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
#define fl(i,a,b) for(ll i=a;i<b;i++)
#define rfl(i,a,b) for(ll i=a;i>b;i--)
#define pb push_back
#define mp make_pair
#define test ll t;cin>>t;while(t--)
#define lld long double
const ll M = 1e9 + 7;
const double pi  =3.141592653589793238463;
int main()
{
    string s,p;
    cin>>s;
    //p=reverse(s.begin(),s.end());
    ll c=0,c1=0,n;
    n=s.length();
    fl(i,0,n-1)
    {
        if(s[i]==s[i+1])
        {
            c++;
            if(s[i]=='0')
            s[i+1]='1';
            else
            s[i+1]='0';
        }
    }
   /* cout<<c<<endl;
    
    cout<<s<<endl;
    rfl(i,n-1,0)
    {
        if(s[i]==s[i-1])
        {
            c1++;
            if(s[i]=='0')
            s[i-1]='1';
            else
            s[i-1]='0';
        }
    }
    cout<<c1<<endl;*/
    cout<<c;
}


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

using namespace std;

int main() {
    string w;
    int cnt[26] = { 0 };
    cin >> w;
    for (int i = 0; i < w.size(); ++i) {
        cnt[w[i] - 'a']++;
    }
    for (int i = 0; i < 26; ++i) {
        if (cnt[i] % 2 == 1) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 256
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            ans = 500 * a + 100 * b + 50 * c
            # print(a,b,c,X, ans)
            if ans == X:
                count +=1

print(count)

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

int main(){
   int a,b;
   cin >> a >> b;
   if(a>b){
      cout << "a > b" << endl; 
   }else if(a<b){
      cout << "a < b" << endl;
   }else{
      cout << "a == b" << endl;
   }
   return 0;
}


Measured memory_bytes: 3052
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> using vt = vector<T>;
template<class T> using vvt = vector<vt<T>>;
template<class T> using ttt = tuple<T,T>;
using tii = tuple<int,int>;
using vi = vector<int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define DIV int(1e9+7)
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;
//const double PI = M_PI;  
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}

/*Coding Space*/
int main(){
  int sx,tx,sy,ty; cin >> sx >> sy >> tx >> ty;
  rep(i,tx-sx)
    cout << "R";
  rep(i,ty-sy)
    cout << "U";
  rep(i,tx-sx)
    cout << "L";
  rep(i,ty-sy)
    cout << "D"; 

  cout << "D";

  rep(i,tx-sx+1)
    cout << "R";
  rep(i,ty-sy+1)
    cout << "U";
  cout << "LU";
  
  rep(i,tx-sx+1)
    cout << "L";
  rep(i,ty-sy+1)
    cout << "D";
  cout << "R" << endl;  
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

B = []
C = []

for i in range(N):
  if A[i] % 2 == 0:
    B.append(A[i])
    
l = len(B)

for i in range(l):
  if B[i] % 3 == 0 or B[i] % 5 == 0:
    C.append(B[i])
    
x = len(B) - len(C)    
    
if x == 0:
  print("APPROVED")

else:
  print("DENIED")

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

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

    int max = 0;
    int ans = 0;
    for (int i = 0; i < N; i++) {
        int H;
        cin >> H;
        if (max <= H) {
            max = H;
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}

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

for i in range(n):
  a, b = list(map(int, input().split()))
  ans[a] += b

ord = 0
for key in sorted(ans.keys()):
  ord += ans[key]
  if(ord >= k):
    print(key)
    exit()

Measured memory_bytes: 10864
#include <stdio.h>

int main()
{
  int N, A[100], count;
  scanf("%d", &N);
  for (int i = 0; i < N; i++)
    scanf("%d", &A[i]);

  for (int i = 0; i < N; i++)
  {
    int minj = i;
    for (int j = i + 1; j < N; j++)
    {
      if (A[j] < A[minj])
      {
        minj = j;
      }
    }
    if (minj > i)
    {
      int tmp = A[i];
      A[i] = A[minj];
      A[minj] = tmp;
      count++;
    }
  }

  for (int i = 0; i < N; i++)
  {
    if (i > 0)
      printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
  printf("%d\n", count);
}



Measured memory_bytes: 2756
#include<algorithm>
#include<cstring>
#include<cstdio>
int n;
int a[101];
int ans;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i)scanf("%d",&a[i]);
	std::sort(a+1,a+n+1);
	for(int i=1;i<=n;++i){
		for(int j=i+1;j<=n;++j){
			for(int k=j+1;k<=n;++k){
				if(a[i]+a[j]>a[k]&&a[k]-a[j]<a[i]&&a[k]-a[i]<a[j]&&a[k]!=a[j]&&a[j]!=a[i]&&a[i]!=a[k])++ans;
			}
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1728
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	int num,diff = 0;
	cin >> num;
	vector<int> v(num);
	for (int i = 0; i < num; ++i)
		cin >> v[i];
	vector<int> v2(v);

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

	for (int i = 0; i < num; ++i)
	{
		if (v[i] != v2[i])
			diff++;
	}
	if (diff == 2 || diff == 0)
		cout << "YES";
	else
		cout << "NO";
	system("pause");
	return 0;
}

Measured memory_bytes: 504
#include <stdio.h>

int main ()
{
	int m, n;
	
	while(scanf("%d %d", &m, &n))
	{
	
		if (m == 0 && n == 0)
		{
			break;
		}
		for(int i = 0; i < m; i++)
		{
		
			for(int j = 0; j < n; j++)
			{
				printf("#");
			}
			printf("\n");
		}
		printf("\n");	
		
	}
	
	
	return 0; 
} 


Measured memory_bytes: 2620